2 * Copyright (c) 2013-2015 Brocade Communications Systems, Inc.
4 * Copyright (c) 2015 QLogic Corporation.
8 * See LICENSE.bnx2x_pmd for copyright and licensing details.
18 struct vf_resource_query {
22 uint8_t num_mac_filters;
23 uint8_t num_vlan_filters;
24 uint8_t num_mc_filters;
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
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
41 #define TLV_BUFFER_SIZE 1024
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
50 /* general tlv header (used for both vf->pf request and pf->vf response) */
59 uint32_t reply_offset;
62 struct tlv_buffer_size {
63 uint8_t tlv_buffer[TLV_BUFFER_SIZE];
66 /* tlv struct for all PF replies except acquire */
67 struct vf_common_reply_tlv {
74 /* used to terminate and pad a tlv list */
75 struct channel_list_end_tlv {
82 struct vf_acquire_tlv {
83 struct vf_first_tlv first_tlv;
88 struct vf_resource_query res_query;
90 uint64_t bulletin_addr;
93 /* simple operation request on queue */
95 struct vf_first_tlv first_tlv;
100 /* receive side scaling tlv */
102 struct vf_first_tlv first_tlv;
104 uint8_t rss_result_mask;
105 uint8_t ind_table_size;
106 uint8_t rss_key_size;
108 uint8_t ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
109 uint32_t rss_key[T_ETH_RSS_KEY]; /* hash values */
113 #define BNX2X_VF_MAX_QUEUES_PER_VF 16
114 #define BNX2X_VF_MAX_SBS_PER_VF 16
115 uint16_t hw_sbs[BNX2X_VF_MAX_SBS_PER_VF];
116 uint8_t hw_qid[BNX2X_VF_MAX_QUEUES_PER_VF];
120 uint8_t num_mac_filters;
121 uint8_t num_vlan_filters;
122 uint8_t num_mc_filters;
123 uint8_t permanent_mac_addr[ETH_ALEN];
124 struct ether_addr current_mac_addr;
125 uint16_t pf_link_speed;
126 uint32_t pf_link_supported;
129 /* tlv struct holding reply for acquire */
130 struct vf_acquire_resp_tlv {
145 struct vf_first_tlv first_tlv;
146 uint64_t sb_addr[BNX2X_VF_MAX_SBS_PER_VF];
154 struct vf_rxq_params {
155 /* physical addresses */
157 uint64_t rcq_np_addr;
164 uint16_t hc_rate; /* desired interrupts per sec. */
168 uint16_t flags; /* for BNX2X_VF_Q_FLAG_X flags */
169 uint16_t stat_id; /* valid if BNX2X_VF_Q_FLAG_STATS */
174 uint8_t cache_line_log; /* BNX2X_VF_Q_FLAG_CACHE_ALIGN */
178 struct vf_txq_params {
179 /* physical addresses */
183 uint8_t vf_sb_id; /* index in hw_sbs[] */
184 uint8_t sb_index; /* Index in the SB */
185 uint16_t hc_rate; /* desired interrupts per sec. */
186 uint32_t flags; /* for BNX2X_VF_Q_FLAG_X flags */
187 uint16_t stat_id; /* valid if BNX2X_VF_Q_FLAG_STATS */
188 uint8_t traffic_type; /* see in setup_context() */
193 struct vf_setup_q_tlv {
194 struct vf_first_tlv first_tlv;
196 struct vf_rxq_params rxq;
197 struct vf_txq_params txq;
199 uint8_t vf_qid; /* index in hw_qid[] */
201 #define VF_RXQ_VALID 0x01
202 #define VF_TXQ_VALID 0x02
206 /* Set Queue Filters */
207 struct vf_q_mac_vlan_filter {
209 #define BNX2X_VF_Q_FILTER_DEST_MAC_VALID 0x01
210 #define BNX2X_VF_Q_FILTER_VLAN_TAG_VALID 0x02
211 #define BNX2X_VF_Q_FILTER_SET_MAC 0x100 /* set/clear */
212 uint8_t mac[ETH_ALEN];
217 #define _UP_ETH_ALEN (6)
219 /* configure queue filters */
220 struct vf_set_q_filters_tlv {
221 struct vf_first_tlv first_tlv;
224 #define BNX2X_VF_MAC_VLAN_CHANGED 0x01
225 #define BNX2X_VF_MULTICAST_CHANGED 0x02
226 #define BNX2X_VF_RX_MASK_CHANGED 0x04
228 uint8_t vf_qid; /* index in hw_qid[] */
229 uint8_t mac_filters_cnt;
230 uint8_t multicast_cnt;
233 #define VF_MAX_MAC_FILTERS 16
234 #define VF_MAX_VLAN_FILTERS 16
235 #define VF_MAX_FILTERS (VF_MAX_MAC_FILTERS +\
237 struct vf_q_mac_vlan_filter filters[VF_MAX_FILTERS];
239 #define VF_MAX_MULTICAST_PER_VF 32
240 uint8_t multicast[VF_MAX_MULTICAST_PER_VF][_UP_ETH_ALEN];
241 unsigned long rx_mask;
245 /* close VF (disable VF) */
246 struct vf_close_tlv {
247 struct vf_first_tlv first_tlv;
248 uint16_t vf_id; /* for debug */
252 /* rlease the VF's acquired resources */
253 struct vf_release_tlv {
254 struct vf_first_tlv first_tlv;
255 uint16_t vf_id; /* for debug */
260 struct vf_first_tlv first_tlv;
261 struct vf_acquire_tlv acquire;
262 struct vf_init_tlv init;
263 struct vf_close_tlv close;
264 struct vf_q_op_tlv q_op;
265 struct vf_setup_q_tlv setup_q;
266 struct vf_set_q_filters_tlv set_q_filters;
267 struct vf_release_tlv release;
268 struct vf_rss_tlv update_rss;
269 struct channel_list_end_tlv list_end;
270 struct tlv_buffer_size tlv_buf_size;
274 struct vf_common_reply_tlv common_reply;
275 struct vf_acquire_resp_tlv acquire_resp;
276 struct channel_list_end_tlv list_end;
277 struct tlv_buffer_size tlv_buf_size;
280 /* struct allocated by VF driver, PF sends updates to VF via bulletin */
281 struct bnx2x_vf_bulletin {
282 uint32_t crc; /* crc of structure to ensure is not in
288 uint64_t valid_bitmap; /* bitmap indicating wich fields
292 #define MAC_ADDR_VALID 0 /* alert the vf that a new mac address
293 * is available for it
295 #define VLAN_VALID 1 /* when set, the vf should no access the
298 #define CHANNEL_DOWN 2 /* vf channel is disabled. VFs are not
299 * to attempt to send messages on the
300 * channel after this bit is set
302 uint8_t mac[ETH_ALEN];
309 #define MAX_TLVS_IN_LIST 50
311 BNX2X_VF_TLV_NONE, /* ends tlv sequence */
312 BNX2X_VF_TLV_ACQUIRE,
314 BNX2X_VF_TLV_SETUP_Q,
315 BNX2X_VF_TLV_SET_Q_FILTERS,
316 BNX2X_VF_TLV_ACTIVATE_Q,
317 BNX2X_VF_TLV_DEACTIVATE_Q,
318 BNX2X_VF_TLV_TEARDOWN_Q,
320 BNX2X_VF_TLV_RELEASE,
321 BNX2X_VF_TLV_UPDATE_RSS_OLD,
322 BNX2X_VF_TLV_PF_RELEASE_VF,
323 BNX2X_VF_TLV_LIST_END,
325 BNX2X_VF_TLV_PF_SET_MAC,
326 BNX2X_VF_TLV_PF_SET_VLAN,
327 BNX2X_VF_TLV_UPDATE_RSS,
328 BNX2X_VF_TLV_PHYS_PORT_ID,
332 struct bnx2x_vf_mbx_msg {
333 union query_tlvs query[BNX2X_VF_MAX_QUEUES_PER_VF];
334 union resp_tlvs resp;
337 void bnx2x_add_tlv(void *tlvs_list, uint16_t offset, uint16_t type, uint16_t length);
338 int bnx2x_vf_set_mac(struct bnx2x_softc *sc, int set);
339 int bnx2x_vf_config_rss(struct bnx2x_softc *sc, struct ecore_config_rss_params *params);
341 #endif /* BNX2X_VFPF_H */