brintos

brintos / linux-shallow public Read only

0
0
Text · 1.2 KiB · 0ab5fd6 Raw
48 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only */2/*3 * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.4 * Copyright 2007 Nuova Systems, Inc.  All rights reserved.5 */6 7#ifndef _RQ_ENET_DESC_H_8#define _RQ_ENET_DESC_H_9 10/* Ethernet receive queue descriptor: 16B */11struct rq_enet_desc {12	__le64 address;13	__le16 length_type;14	u8 reserved[6];15};16 17enum rq_enet_type_types {18	RQ_ENET_TYPE_ONLY_SOP = 0,19	RQ_ENET_TYPE_NOT_SOP = 1,20	RQ_ENET_TYPE_RESV2 = 2,21	RQ_ENET_TYPE_RESV3 = 3,22};23 24#define RQ_ENET_ADDR_BITS		6425#define RQ_ENET_LEN_BITS		1426#define RQ_ENET_LEN_MASK		((1 << RQ_ENET_LEN_BITS) - 1)27#define RQ_ENET_TYPE_BITS		228#define RQ_ENET_TYPE_MASK		((1 << RQ_ENET_TYPE_BITS) - 1)29 30static inline void rq_enet_desc_enc(struct rq_enet_desc *desc,31	u64 address, u8 type, u16 length)32{33	desc->address = cpu_to_le64(address);34	desc->length_type = cpu_to_le16((length & RQ_ENET_LEN_MASK) |35		((type & RQ_ENET_TYPE_MASK) << RQ_ENET_LEN_BITS));36}37 38static inline void rq_enet_desc_dec(struct rq_enet_desc *desc,39	u64 *address, u8 *type, u16 *length)40{41	*address = le64_to_cpu(desc->address);42	*length = le16_to_cpu(desc->length_type) & RQ_ENET_LEN_MASK;43	*type = (u8)((le16_to_cpu(desc->length_type) >> RQ_ENET_LEN_BITS) &44		RQ_ENET_TYPE_MASK);45}46 47#endif /* _RQ_ENET_DESC_H_ */48