This source file includes following definitions.
- MWIFIEX_SKB_RXCB
- MWIFIEX_SKB_TXCB
- mwifiex_store_mapping
- mwifiex_get_mapping
- MWIFIEX_SKB_DMA_ADDR
- le16_unaligned_add_cpu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #ifndef _MWIFIEX_UTIL_H_
21 #define _MWIFIEX_UTIL_H_
22
23 struct mwifiex_private;
24
25 struct mwifiex_dma_mapping {
26 dma_addr_t addr;
27 size_t len;
28 };
29
30 struct mwifiex_cb {
31 struct mwifiex_dma_mapping dma_mapping;
32 union {
33 struct mwifiex_rxinfo rx_info;
34 struct mwifiex_txinfo tx_info;
35 };
36 };
37
38
39 #define item_size(n) (FIELD_SIZEOF(struct mwifiex_debug_info, n))
40 #define item_addr(n) (offsetof(struct mwifiex_debug_info, n))
41
42
43 #define adapter_item_size(n) (FIELD_SIZEOF(struct mwifiex_adapter, n))
44 #define adapter_item_addr(n) (offsetof(struct mwifiex_adapter, n))
45
46 struct mwifiex_debug_data {
47 char name[32];
48 u32 size;
49 size_t addr;
50 int num;
51 };
52
53 static inline struct mwifiex_rxinfo *MWIFIEX_SKB_RXCB(struct sk_buff *skb)
54 {
55 struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb;
56
57 BUILD_BUG_ON(sizeof(struct mwifiex_cb) > sizeof(skb->cb));
58 return &cb->rx_info;
59 }
60
61 static inline struct mwifiex_txinfo *MWIFIEX_SKB_TXCB(struct sk_buff *skb)
62 {
63 struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb;
64
65 return &cb->tx_info;
66 }
67
68 static inline void mwifiex_store_mapping(struct sk_buff *skb,
69 struct mwifiex_dma_mapping *mapping)
70 {
71 struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb;
72
73 memcpy(&cb->dma_mapping, mapping, sizeof(*mapping));
74 }
75
76 static inline void mwifiex_get_mapping(struct sk_buff *skb,
77 struct mwifiex_dma_mapping *mapping)
78 {
79 struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb;
80
81 memcpy(mapping, &cb->dma_mapping, sizeof(*mapping));
82 }
83
84 static inline dma_addr_t MWIFIEX_SKB_DMA_ADDR(struct sk_buff *skb)
85 {
86 struct mwifiex_dma_mapping mapping;
87
88 mwifiex_get_mapping(skb, &mapping);
89
90 return mapping.addr;
91 }
92
93 int mwifiex_debug_info_to_buffer(struct mwifiex_private *priv, char *buf,
94 struct mwifiex_debug_info *info);
95
96 static inline void le16_unaligned_add_cpu(__le16 *var, u16 val)
97 {
98 put_unaligned_le16(get_unaligned_le16(var) + val, var);
99 }
100
101 #endif