This source file includes following definitions.
- rq_enet_desc_enc
- rq_enet_desc_dec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #ifndef _RQ_ENET_DESC_H_
19 #define _RQ_ENET_DESC_H_
20
21
22 struct rq_enet_desc {
23 __le64 address;
24 __le16 length_type;
25 u8 reserved[6];
26 };
27
28 enum rq_enet_type_types {
29 RQ_ENET_TYPE_ONLY_SOP = 0,
30 RQ_ENET_TYPE_NOT_SOP = 1,
31 RQ_ENET_TYPE_RESV2 = 2,
32 RQ_ENET_TYPE_RESV3 = 3,
33 };
34
35 #define RQ_ENET_ADDR_BITS 64
36 #define RQ_ENET_LEN_BITS 14
37 #define RQ_ENET_LEN_MASK ((1 << RQ_ENET_LEN_BITS) - 1)
38 #define RQ_ENET_TYPE_BITS 2
39 #define RQ_ENET_TYPE_MASK ((1 << RQ_ENET_TYPE_BITS) - 1)
40
41 static inline void rq_enet_desc_enc(struct rq_enet_desc *desc,
42 u64 address, u8 type, u16 length)
43 {
44 desc->address = cpu_to_le64(address);
45 desc->length_type = cpu_to_le16((length & RQ_ENET_LEN_MASK) |
46 ((type & RQ_ENET_TYPE_MASK) << RQ_ENET_LEN_BITS));
47 }
48
49 static inline void rq_enet_desc_dec(struct rq_enet_desc *desc,
50 u64 *address, u8 *type, u16 *length)
51 {
52 *address = le64_to_cpu(desc->address);
53 *length = le16_to_cpu(desc->length_type) & RQ_ENET_LEN_MASK;
54 *type = (u8)((le16_to_cpu(desc->length_type) >> RQ_ENET_LEN_BITS) &
55 RQ_ENET_TYPE_MASK);
56 }
57
58 #endif