Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / net / ethernet / cisco / enic / rq_enet_desc.h
blob0ab5fd6b8d4679927ed351c681c87f21e6a8f249
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 */
7 #ifndef _RQ_ENET_DESC_H_
8 #define _RQ_ENET_DESC_H_
10 /* Ethernet receive queue descriptor: 16B */
11 struct rq_enet_desc {
12 __le64 address;
13 __le16 length_type;
14 u8 reserved[6];
17 enum 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,
24 #define RQ_ENET_ADDR_BITS 64
25 #define RQ_ENET_LEN_BITS 14
26 #define RQ_ENET_LEN_MASK ((1 << RQ_ENET_LEN_BITS) - 1)
27 #define RQ_ENET_TYPE_BITS 2
28 #define RQ_ENET_TYPE_MASK ((1 << RQ_ENET_TYPE_BITS) - 1)
30 static inline void rq_enet_desc_enc(struct rq_enet_desc *desc,
31 u64 address, u8 type, u16 length)
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));
38 static inline void rq_enet_desc_dec(struct rq_enet_desc *desc,
39 u64 *address, u8 *type, u16 *length)
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);
47 #endif /* _RQ_ENET_DESC_H_ */