]> git.proxmox.com Git - ceph.git/blame - ceph/src/dpdk/drivers/net/bnx2x/bnx2x_vfpf.h
bump version to 12.2.12-pve1
[ceph.git] / ceph / src / dpdk / drivers / net / bnx2x / bnx2x_vfpf.h
CommitLineData
7c673cae
FG
1/*
2 * Copyright (c) 2013-2015 Brocade Communications Systems, Inc.
3 *
4 * Copyright (c) 2015 QLogic Corporation.
5 * All rights reserved.
6 * www.qlogic.com
7 *
8 * See LICENSE.bnx2x_pmd for copyright and licensing details.
9 */
10
11#ifndef BNX2X_VFPF_H
12#define BNX2X_VFPF_H
13
14#include "ecore_sp.h"
15
16#define VLAN_HLEN 4
17
18struct vf_resource_query {
19 uint8_t num_rxqs;
20 uint8_t num_txqs;
21 uint8_t num_sbs;
22 uint8_t num_mac_filters;
23 uint8_t num_vlan_filters;
24 uint8_t num_mc_filters;
25};
26
27#define BNX2X_VF_STATUS_SUCCESS 1
28#define BNX2X_VF_STATUS_FAILURE 2
29#define BNX2X_VF_STATUS_NO_RESOURCES 4
30#define BNX2X_VF_BULLETIN_TRIES 5
31
32#define BNX2X_VF_Q_FLAG_CACHE_ALIGN 0x0008
33#define BNX2X_VF_Q_FLAG_STATS 0x0010
34#define BNX2X_VF_Q_FLAG_OV 0x0020
35#define BNX2X_VF_Q_FLAG_VLAN 0x0040
36#define BNX2X_VF_Q_FLAG_COS 0x0080
37#define BNX2X_VF_Q_FLAG_HC 0x0100
38#define BNX2X_VF_Q_FLAG_DHC 0x0200
39#define BNX2X_VF_Q_FLAG_LEADING_RSS 0x0400
40
41#define TLV_BUFFER_SIZE 1024
42
43#define VFPF_RX_MASK_ACCEPT_NONE 0x00000000
44#define VFPF_RX_MASK_ACCEPT_MATCHED_UNICAST 0x00000001
45#define VFPF_RX_MASK_ACCEPT_MATCHED_MULTICAST 0x00000002
46#define VFPF_RX_MASK_ACCEPT_ALL_UNICAST 0x00000004
47#define VFPF_RX_MASK_ACCEPT_ALL_MULTICAST 0x00000008
48#define VFPF_RX_MASK_ACCEPT_BROADCAST 0x00000010
49
50/* general tlv header (used for both vf->pf request and pf->vf response) */
51struct channel_tlv {
52 uint16_t type;
53 uint16_t length;
54};
55
56struct vf_first_tlv {
57 struct channel_tlv tl;
58 uint32_t reply_offset;
59};
60
61struct tlv_buffer_size {
62 uint8_t tlv_buffer[TLV_BUFFER_SIZE];
63};
64
65/* tlv struct for all PF replies except acquire */
66struct vf_common_reply_tlv {
67 struct channel_tlv tl;
68 uint8_t status;
69 uint8_t pad[3];
70};
71
72/* used to terminate and pad a tlv list */
73struct channel_list_end_tlv {
74 struct channel_tlv tl;
75 uint32_t pad;
76};
77
78/* Acquire */
79struct vf_acquire_tlv {
80 struct vf_first_tlv first_tlv;
81
82 uint8_t vf_id;
83 uint8_t pad[3];
84
85 struct vf_resource_query res_query;
86
87 uint64_t bulletin_addr;
88};
89
90/* simple operation request on queue */
91struct vf_q_op_tlv {
92 struct vf_first_tlv first_tlv;
93 uint8_t vf_qid;
94 uint8_t pad[3];
95};
96
97/* receive side scaling tlv */
98struct vf_rss_tlv {
99 struct vf_first_tlv first_tlv;
100 uint32_t rss_flags;
101 uint8_t rss_result_mask;
102 uint8_t ind_table_size;
103 uint8_t rss_key_size;
104 uint8_t pad;
105 uint8_t ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
106 uint32_t rss_key[T_ETH_RSS_KEY]; /* hash values */
107};
108
109struct vf_resc {
110#define BNX2X_VF_MAX_QUEUES_PER_VF 16
111#define BNX2X_VF_MAX_SBS_PER_VF 16
112 uint16_t hw_sbs[BNX2X_VF_MAX_SBS_PER_VF];
113 uint8_t hw_qid[BNX2X_VF_MAX_QUEUES_PER_VF];
114 uint8_t num_rxqs;
115 uint8_t num_txqs;
116 uint8_t num_sbs;
117 uint8_t num_mac_filters;
118 uint8_t num_vlan_filters;
119 uint8_t num_mc_filters;
120 uint8_t permanent_mac_addr[ETH_ALEN];
121 struct ether_addr current_mac_addr;
122 uint16_t pf_link_speed;
123 uint32_t pf_link_supported;
124};
125
126/* tlv struct holding reply for acquire */
127struct vf_acquire_resp_tlv {
128 uint16_t type;
129 uint16_t length;
130 uint8_t status;
131 uint8_t pad1[3];
132 uint32_t chip_num;
133 uint8_t pad2[4];
134 char fw_ver[32];
135 uint16_t db_size;
136 uint8_t pad3[2];
137 struct vf_resc resc;
138};
139
140/* Init VF */
141struct vf_init_tlv {
142 struct vf_first_tlv first_tlv;
143 uint64_t sb_addr[BNX2X_VF_MAX_SBS_PER_VF];
144 uint64_t spq_addr;
145 uint64_t stats_addr;
146 uint16_t stats_step;
147 uint32_t flags;
148 uint32_t pad[2];
149};
150
151struct vf_rxq_params {
152 /* physical addresses */
153 uint64_t rcq_addr;
154 uint64_t rcq_np_addr;
155 uint64_t rxq_addr;
156 uint64_t pad1;
157
158 /* sb + hc info */
159 uint8_t vf_sb_id;
160 uint8_t sb_cq_index;
161 uint16_t hc_rate; /* desired interrupts per sec. */
162 /* rx buffer info */
163 uint16_t mtu;
164 uint16_t buf_sz;
165 uint16_t flags; /* for BNX2X_VF_Q_FLAG_X flags */
166 uint16_t stat_id; /* valid if BNX2X_VF_Q_FLAG_STATS */
167
168 uint8_t pad2[5];
169
170 uint8_t drop_flags;
171 uint8_t cache_line_log; /* BNX2X_VF_Q_FLAG_CACHE_ALIGN */
172 uint8_t pad3;
173};
174
175struct vf_txq_params {
176 /* physical addresses */
177 uint64_t txq_addr;
178
179 /* sb + hc info */
180 uint8_t vf_sb_id; /* index in hw_sbs[] */
181 uint8_t sb_index; /* Index in the SB */
182 uint16_t hc_rate; /* desired interrupts per sec. */
183 uint32_t flags; /* for BNX2X_VF_Q_FLAG_X flags */
184 uint16_t stat_id; /* valid if BNX2X_VF_Q_FLAG_STATS */
185 uint8_t traffic_type; /* see in setup_context() */
186 uint8_t pad;
187};
188
189/* Setup Queue */
190struct vf_setup_q_tlv {
191 struct vf_first_tlv first_tlv;
192
193 struct vf_rxq_params rxq;
194 struct vf_txq_params txq;
195
196 uint8_t vf_qid; /* index in hw_qid[] */
197 uint8_t param_valid;
198 #define VF_RXQ_VALID 0x01
199 #define VF_TXQ_VALID 0x02
200 uint8_t pad[2];
201};
202
203/* Set Queue Filters */
204struct vf_q_mac_vlan_filter {
205 uint32_t flags;
206 #define BNX2X_VF_Q_FILTER_DEST_MAC_VALID 0x01
207 #define BNX2X_VF_Q_FILTER_VLAN_TAG_VALID 0x02
208 #define BNX2X_VF_Q_FILTER_SET_MAC 0x100 /* set/clear */
209 uint8_t mac[ETH_ALEN];
210 uint16_t vlan_tag;
211};
212
213
214#define _UP_ETH_ALEN (6)
215
216/* configure queue filters */
217struct vf_set_q_filters_tlv {
218 struct vf_first_tlv first_tlv;
219
220 uint32_t flags;
221 #define BNX2X_VF_MAC_VLAN_CHANGED 0x01
222 #define BNX2X_VF_MULTICAST_CHANGED 0x02
223 #define BNX2X_VF_RX_MASK_CHANGED 0x04
224
225 uint8_t vf_qid; /* index in hw_qid[] */
226 uint8_t mac_filters_cnt;
227 uint8_t multicast_cnt;
228 uint8_t pad;
229
230 #define VF_MAX_MAC_FILTERS 16
231 #define VF_MAX_VLAN_FILTERS 16
232 #define VF_MAX_FILTERS (VF_MAX_MAC_FILTERS +\
233 VF_MAX_VLAN_FILTERS)
234 struct vf_q_mac_vlan_filter filters[VF_MAX_FILTERS];
235
236 #define VF_MAX_MULTICAST_PER_VF 32
237 uint8_t multicast[VF_MAX_MULTICAST_PER_VF][_UP_ETH_ALEN];
238 unsigned long rx_mask;
239};
240
241
242/* close VF (disable VF) */
243struct vf_close_tlv {
244 struct vf_first_tlv first_tlv;
245 uint16_t vf_id; /* for debug */
246 uint8_t pad[2];
247};
248
249/* rlease the VF's acquired resources */
250struct vf_release_tlv {
251 struct vf_first_tlv first_tlv;
252 uint16_t vf_id; /* for debug */
253 uint8_t pad[2];
254};
255
256union query_tlvs {
257 struct vf_first_tlv first_tlv;
258 struct vf_acquire_tlv acquire;
259 struct vf_init_tlv init;
260 struct vf_close_tlv close;
261 struct vf_q_op_tlv q_op;
262 struct vf_setup_q_tlv setup_q;
263 struct vf_set_q_filters_tlv set_q_filters;
264 struct vf_release_tlv release;
265 struct vf_rss_tlv update_rss;
266 struct channel_list_end_tlv list_end;
267 struct tlv_buffer_size tlv_buf_size;
268};
269
270union resp_tlvs {
271 struct vf_common_reply_tlv common_reply;
272 struct vf_acquire_resp_tlv acquire_resp;
273 struct channel_list_end_tlv list_end;
274 struct tlv_buffer_size tlv_buf_size;
275};
276
277/* struct allocated by VF driver, PF sends updates to VF via bulletin */
278struct bnx2x_vf_bulletin {
279 uint32_t crc; /* crc of structure to ensure is not in
280 * mid-update
281 */
282 uint16_t version;
283 uint16_t length;
284
285 uint64_t valid_bitmap; /* bitmap indicating wich fields
286 * hold valid values
287 */
288
289#define MAC_ADDR_VALID 0 /* alert the vf that a new mac address
290 * is available for it
291 */
292#define VLAN_VALID 1 /* when set, the vf should no access the
293 * vf channel
294 */
295#define CHANNEL_DOWN 2 /* vf channel is disabled. VFs are not
296 * to attempt to send messages on the
297 * channel after this bit is set
298 */
299 uint8_t mac[ETH_ALEN];
300 uint8_t mac_pad[2];
301
302 uint16_t vlan;
303 uint8_t vlan_pad[6];
304};
305
306#define MAX_TLVS_IN_LIST 50
307enum channel_tlvs {
308 BNX2X_VF_TLV_NONE, /* ends tlv sequence */
309 BNX2X_VF_TLV_ACQUIRE,
310 BNX2X_VF_TLV_INIT,
311 BNX2X_VF_TLV_SETUP_Q,
312 BNX2X_VF_TLV_SET_Q_FILTERS,
313 BNX2X_VF_TLV_ACTIVATE_Q,
314 BNX2X_VF_TLV_DEACTIVATE_Q,
315 BNX2X_VF_TLV_TEARDOWN_Q,
316 BNX2X_VF_TLV_CLOSE,
317 BNX2X_VF_TLV_RELEASE,
318 BNX2X_VF_TLV_UPDATE_RSS_OLD,
319 BNX2X_VF_TLV_PF_RELEASE_VF,
320 BNX2X_VF_TLV_LIST_END,
321 BNX2X_VF_TLV_FLR,
322 BNX2X_VF_TLV_PF_SET_MAC,
323 BNX2X_VF_TLV_PF_SET_VLAN,
324 BNX2X_VF_TLV_UPDATE_RSS,
325 BNX2X_VF_TLV_PHYS_PORT_ID,
326 BNX2X_VF_TLV_MAX
327};
328
329struct bnx2x_vf_mbx_msg {
330 union query_tlvs query[BNX2X_VF_MAX_QUEUES_PER_VF];
331 union resp_tlvs resp;
332};
333
334int bnx2x_vf_set_mac(struct bnx2x_softc *sc, int set);
335int bnx2x_vf_config_rss(struct bnx2x_softc *sc, struct ecore_config_rss_params *params);
336
337#endif /* BNX2X_VFPF_H */