This source file includes following definitions.
- qed_ll2_alloc_if
- qed_ll2_dealloc_if
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 #ifndef _QED_LL2_IF_H
34 #define _QED_LL2_IF_H
35
36 #include <linux/types.h>
37 #include <linux/interrupt.h>
38 #include <linux/netdevice.h>
39 #include <linux/pci.h>
40 #include <linux/skbuff.h>
41 #include <linux/version.h>
42 #include <linux/kernel.h>
43 #include <linux/slab.h>
44 #include <linux/qed/qed_if.h>
45
46 enum qed_ll2_conn_type {
47 QED_LL2_TYPE_FCOE,
48 QED_LL2_TYPE_ISCSI,
49 QED_LL2_TYPE_TEST,
50 QED_LL2_TYPE_OOO,
51 QED_LL2_TYPE_RESERVED2,
52 QED_LL2_TYPE_ROCE,
53 QED_LL2_TYPE_IWARP,
54 QED_LL2_TYPE_RESERVED3,
55 MAX_QED_LL2_RX_CONN_TYPE
56 };
57
58 enum qed_ll2_roce_flavor_type {
59 QED_LL2_ROCE,
60 QED_LL2_RROCE,
61 MAX_QED_LL2_ROCE_FLAVOR_TYPE
62 };
63
64 enum qed_ll2_tx_dest {
65 QED_LL2_TX_DEST_NW,
66 QED_LL2_TX_DEST_LB,
67 QED_LL2_TX_DEST_DROP,
68 QED_LL2_TX_DEST_MAX
69 };
70
71 enum qed_ll2_error_handle {
72 QED_LL2_DROP_PACKET,
73 QED_LL2_DO_NOTHING,
74 QED_LL2_ASSERT,
75 };
76
77 struct qed_ll2_stats {
78 u64 gsi_invalid_hdr;
79 u64 gsi_invalid_pkt_length;
80 u64 gsi_unsupported_pkt_typ;
81 u64 gsi_crcchksm_error;
82
83 u64 packet_too_big_discard;
84 u64 no_buff_discard;
85
86 u64 rcv_ucast_bytes;
87 u64 rcv_mcast_bytes;
88 u64 rcv_bcast_bytes;
89 u64 rcv_ucast_pkts;
90 u64 rcv_mcast_pkts;
91 u64 rcv_bcast_pkts;
92
93 u64 sent_ucast_bytes;
94 u64 sent_mcast_bytes;
95 u64 sent_bcast_bytes;
96 u64 sent_ucast_pkts;
97 u64 sent_mcast_pkts;
98 u64 sent_bcast_pkts;
99 };
100
101 struct qed_ll2_comp_rx_data {
102 void *cookie;
103 dma_addr_t rx_buf_addr;
104 u16 parse_flags;
105 u16 err_flags;
106 u16 vlan;
107 bool b_last_packet;
108 u8 connection_handle;
109
110 union {
111 u16 packet_length;
112 u16 data_length;
113 } length;
114
115 u32 opaque_data_0;
116 u32 opaque_data_1;
117
118
119 u32 src_qp;
120 u16 qp_id;
121
122 union {
123 u8 placement_offset;
124 u8 data_length_error;
125 } u;
126 };
127
128 typedef
129 void (*qed_ll2_complete_rx_packet_cb)(void *cxt,
130 struct qed_ll2_comp_rx_data *data);
131
132 typedef
133 void (*qed_ll2_release_rx_packet_cb)(void *cxt,
134 u8 connection_handle,
135 void *cookie,
136 dma_addr_t rx_buf_addr,
137 bool b_last_packet);
138
139 typedef
140 void (*qed_ll2_complete_tx_packet_cb)(void *cxt,
141 u8 connection_handle,
142 void *cookie,
143 dma_addr_t first_frag_addr,
144 bool b_last_fragment,
145 bool b_last_packet);
146
147 typedef
148 void (*qed_ll2_release_tx_packet_cb)(void *cxt,
149 u8 connection_handle,
150 void *cookie,
151 dma_addr_t first_frag_addr,
152 bool b_last_fragment, bool b_last_packet);
153
154 typedef
155 void (*qed_ll2_slowpath_cb)(void *cxt, u8 connection_handle,
156 u32 opaque_data_0, u32 opaque_data_1);
157
158 struct qed_ll2_cbs {
159 qed_ll2_complete_rx_packet_cb rx_comp_cb;
160 qed_ll2_release_rx_packet_cb rx_release_cb;
161 qed_ll2_complete_tx_packet_cb tx_comp_cb;
162 qed_ll2_release_tx_packet_cb tx_release_cb;
163 qed_ll2_slowpath_cb slowpath_cb;
164 void *cookie;
165 };
166
167 struct qed_ll2_acquire_data_inputs {
168 enum qed_ll2_conn_type conn_type;
169 u16 mtu;
170 u16 rx_num_desc;
171 u16 rx_num_ooo_buffers;
172 u8 rx_drop_ttl0_flg;
173 u8 rx_vlan_removal_en;
174 u16 tx_num_desc;
175 u8 tx_max_bds_per_packet;
176 u8 tx_tc;
177 enum qed_ll2_tx_dest tx_dest;
178 enum qed_ll2_error_handle ai_err_packet_too_big;
179 enum qed_ll2_error_handle ai_err_no_buf;
180 bool secondary_queue;
181 u8 gsi_enable;
182 };
183
184 struct qed_ll2_acquire_data {
185 struct qed_ll2_acquire_data_inputs input;
186 const struct qed_ll2_cbs *cbs;
187
188
189 u8 *p_connection_handle;
190 };
191
192 struct qed_ll2_tx_pkt_info {
193 void *cookie;
194 dma_addr_t first_frag;
195 enum qed_ll2_tx_dest tx_dest;
196 enum qed_ll2_roce_flavor_type qed_roce_flavor;
197 u16 vlan;
198 u16 l4_hdr_offset_w;
199 u16 first_frag_len;
200 u8 num_of_bds;
201 u8 bd_flags;
202 bool enable_ip_cksum;
203 bool enable_l4_cksum;
204 bool calc_ip_len;
205 bool remove_stag;
206 };
207
208 #define QED_LL2_UNUSED_HANDLE (0xff)
209
210 struct qed_ll2_cb_ops {
211 int (*rx_cb)(void *, struct sk_buff *, u32, u32);
212 int (*tx_cb)(void *, struct sk_buff *, bool);
213 };
214
215 struct qed_ll2_params {
216 u16 mtu;
217 bool drop_ttl0_packets;
218 bool rx_vlan_stripping;
219 u8 tx_tc;
220 bool frags_mapped;
221 u8 ll2_mac_address[ETH_ALEN];
222 };
223
224 enum qed_ll2_xmit_flags {
225
226 QED_LL2_XMIT_FLAGS_FIP_DISCOVERY
227 };
228
229 struct qed_ll2_ops {
230
231
232
233
234
235
236
237
238 int (*start)(struct qed_dev *cdev, struct qed_ll2_params *params);
239
240
241
242
243
244
245
246
247 int (*stop)(struct qed_dev *cdev);
248
249
250
251
252
253
254
255
256
257
258 int (*start_xmit)(struct qed_dev *cdev, struct sk_buff *skb,
259 unsigned long xmit_flags);
260
261
262
263
264
265
266
267
268
269
270
271 void (*register_cb_ops)(struct qed_dev *cdev,
272 const struct qed_ll2_cb_ops *ops,
273 void *cookie);
274
275
276
277
278
279
280
281
282
283 int (*get_stats)(struct qed_dev *cdev, struct qed_ll2_stats *stats);
284 };
285
286 #ifdef CONFIG_QED_LL2
287 int qed_ll2_alloc_if(struct qed_dev *);
288 void qed_ll2_dealloc_if(struct qed_dev *);
289 #else
290 static const struct qed_ll2_ops qed_ll2_ops_pass = {
291 .start = NULL,
292 .stop = NULL,
293 .start_xmit = NULL,
294 .register_cb_ops = NULL,
295 .get_stats = NULL,
296 };
297
298 static inline int qed_ll2_alloc_if(struct qed_dev *cdev)
299 {
300 return 0;
301 }
302
303 static inline void qed_ll2_dealloc_if(struct qed_dev *cdev)
304 {
305 }
306 #endif
307 #endif