1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright 2008 Cisco Systems, Inc. All rights reserved.
4 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
6 #ifndef _RQ_ENET_DESC_H_
7 #define _RQ_ENET_DESC_H_
9 /* Ethernet receive queue descriptor: 16B */
16 enum rq_enet_type_types
{
17 RQ_ENET_TYPE_ONLY_SOP
= 0,
18 RQ_ENET_TYPE_NOT_SOP
= 1,
19 RQ_ENET_TYPE_RESV2
= 2,
20 RQ_ENET_TYPE_RESV3
= 3,
23 #define RQ_ENET_ADDR_BITS 64
24 #define RQ_ENET_LEN_BITS 14
25 #define RQ_ENET_LEN_MASK ((1 << RQ_ENET_LEN_BITS) - 1)
26 #define RQ_ENET_TYPE_BITS 2
27 #define RQ_ENET_TYPE_MASK ((1 << RQ_ENET_TYPE_BITS) - 1)
29 static inline void rq_enet_desc_enc(struct rq_enet_desc
*desc
,
30 u64 address
, u8 type
, u16 length
)
32 desc
->address
= cpu_to_le64(address
);
33 desc
->length_type
= cpu_to_le16((length
& RQ_ENET_LEN_MASK
) |
34 ((type
& RQ_ENET_TYPE_MASK
) << RQ_ENET_LEN_BITS
));
37 static inline void rq_enet_desc_dec(struct rq_enet_desc
*desc
,
38 u64
*address
, u8
*type
, u16
*length
)
40 *address
= le64_to_cpu(desc
->address
);
41 *length
= le16_to_cpu(desc
->length_type
) & RQ_ENET_LEN_MASK
;
42 *type
= (u8
)((le16_to_cpu(desc
->length_type
) >> RQ_ENET_LEN_BITS
) &
46 #endif /* _RQ_ENET_DESC_H_ */