2 * Copyright (c) 2013-2015 Brocade Communications Systems, Inc.
14 struct vf_resource_query {
18 uint8_t num_mac_filters;
19 uint8_t num_vlan_filters;
20 uint8_t num_mc_filters;
23 #define BNX2X_VF_STATUS_SUCCESS 1
24 #define BNX2X_VF_STATUS_FAILURE 2
25 #define BNX2X_VF_STATUS_NO_RESOURCES 4
26 #define BNX2X_VF_BULLETIN_TRIES 5
28 #define BNX2X_VF_Q_FLAG_CACHE_ALIGN 0x0008
29 #define BNX2X_VF_Q_FLAG_STATS 0x0010
30 #define BNX2X_VF_Q_FLAG_OV 0x0020
31 #define BNX2X_VF_Q_FLAG_VLAN 0x0040
32 #define BNX2X_VF_Q_FLAG_COS 0x0080
33 #define BNX2X_VF_Q_FLAG_HC 0x0100
34 #define BNX2X_VF_Q_FLAG_DHC 0x0200
35 #define BNX2X_VF_Q_FLAG_LEADING_RSS 0x0400
40 uint32_t reply_offset;
43 /* tlv struct for all PF replies except acquire */
44 struct vf_common_reply_tlv {
51 /* used to terminate and pad a tlv list */
52 struct channel_list_end_tlv {
59 struct vf_acquire_tlv {
60 struct vf_first_tlv first_tlv;
65 struct vf_resource_query res_query;
67 uint64_t bulletin_addr;
70 /* simple operation request on queue */
72 struct vf_first_tlv first_tlv;
77 /* receive side scaling tlv */
79 struct vf_first_tlv first_tlv;
81 uint8_t rss_result_mask;
82 uint8_t ind_table_size;
85 uint8_t ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
86 uint32_t rss_key[T_ETH_RSS_KEY]; /* hash values */
90 #define BNX2X_VF_MAX_QUEUES_PER_VF 16
91 #define BNX2X_VF_MAX_SBS_PER_VF 16
92 uint16_t hw_sbs[BNX2X_VF_MAX_SBS_PER_VF];
93 uint8_t hw_qid[BNX2X_VF_MAX_QUEUES_PER_VF];
97 uint8_t num_mac_filters;
98 uint8_t num_vlan_filters;
99 uint8_t num_mc_filters;
100 uint8_t permanent_mac_addr[ETH_ALEN];
101 uint8_t current_mac_addr[ETH_ALEN];
102 uint16_t pf_link_speed;
103 uint32_t pf_link_supported;
106 /* tlv struct holding reply for acquire */
107 struct vf_acquire_resp_tlv {
122 struct vf_first_tlv first_tlv;
123 uint64_t sb_addr[BNX2X_VF_MAX_SBS_PER_VF];
131 struct vf_rxq_params {
132 /* physical addresses */
134 uint64_t rcq_np_addr;
141 uint16_t hc_rate; /* desired interrupts per sec. */
145 uint16_t flags; /* for BNX2X_VF_Q_FLAG_X flags */
146 uint16_t stat_id; /* valid if BNX2X_VF_Q_FLAG_STATS */
151 uint8_t cache_line_log; /* BNX2X_VF_Q_FLAG_CACHE_ALIGN */
155 struct vf_txq_params {
156 /* physical addresses */
160 uint8_t vf_sb_id; /* index in hw_sbs[] */
161 uint8_t sb_index; /* Index in the SB */
162 uint16_t hc_rate; /* desired interrupts per sec. */
163 uint32_t flags; /* for BNX2X_VF_Q_FLAG_X flags */
164 uint16_t stat_id; /* valid if BNX2X_VF_Q_FLAG_STATS */
165 uint8_t traffic_type; /* see in setup_context() */
170 struct vf_setup_q_tlv {
171 struct vf_first_tlv first_tlv;
173 struct vf_rxq_params rxq;
174 struct vf_txq_params txq;
176 uint8_t vf_qid; /* index in hw_qid[] */
178 #define VF_RXQ_VALID 0x01
179 #define VF_TXQ_VALID 0x02
183 /* Set Queue Filters */
184 struct vf_q_mac_vlan_filter {
186 #define BNX2X_VF_Q_FILTER_DEST_MAC_VALID 0x01
187 #define BNX2X_VF_Q_FILTER_VLAN_TAG_VALID 0x02
188 #define BNX2X_VF_Q_FILTER_SET_MAC 0x100 /* set/clear */
189 uint8_t mac[ETH_ALEN];
194 #define _UP_ETH_ALEN (6)
196 /* configure queue filters */
197 struct vf_set_q_filters_tlv {
198 struct vf_first_tlv first_tlv;
201 #define BNX2X_VF_MAC_VLAN_CHANGED 0x01
202 #define BNX2X_VF_MULTICAST_CHANGED 0x02
203 #define BNX2X_VF_RX_MASK_CHANGED 0x04
205 uint8_t vf_qid; /* index in hw_qid[] */
206 uint8_t mac_filters_cnt;
207 uint8_t multicast_cnt;
210 #define VF_MAX_MAC_FILTERS 16
211 #define VF_MAX_VLAN_FILTERS 16
212 #define VF_MAX_FILTERS (VF_MAX_MAC_FILTERS +\
214 struct vf_q_mac_vlan_filter filters[VF_MAX_FILTERS];
216 #define VF_MAX_MULTICAST_PER_VF 32
217 uint8_t multicast[VF_MAX_MULTICAST_PER_VF][_UP_ETH_ALEN];
218 unsigned long rx_mask;
222 /* close VF (disable VF) */
223 struct vf_close_tlv {
224 struct vf_first_tlv first_tlv;
225 uint16_t vf_id; /* for debug */
229 /* rlease the VF's acquired resources */
230 struct vf_release_tlv {
231 struct vf_first_tlv first_tlv;
232 uint16_t vf_id; /* for debug */
237 struct vf_first_tlv first_tlv;
238 struct vf_acquire_tlv acquire;
239 struct vf_init_tlv init;
240 struct vf_close_tlv close;
241 struct vf_q_op_tlv q_op;
242 struct vf_setup_q_tlv setup_q;
243 struct vf_set_q_filters_tlv set_q_filters;
244 struct vf_release_tlv release;
245 struct vf_rss_tlv update_rss;
246 struct channel_list_end_tlv list_end;
250 struct vf_common_reply_tlv common_reply;
251 struct vf_acquire_resp_tlv acquire_resp;
252 struct channel_list_end_tlv list_end;
255 /* struct allocated by VF driver, PF sends updates to VF via bulletin */
256 struct bnx2x_vf_bulletin {
257 uint32_t crc; /* crc of structure to ensure is not in
263 uint64_t valid_bitmap; /* bitmap indicating wich fields
267 #define MAC_ADDR_VALID 0 /* alert the vf that a new mac address
268 * is available for it
270 #define VLAN_VALID 1 /* when set, the vf should no access the
273 #define CHANNEL_DOWN 2 /* vf channel is disabled. VFs are not
274 * to attempt to send messages on the
275 * channel after this bit is set
277 uint8_t mac[ETH_ALEN];
284 #define MAX_TLVS_IN_LIST 50
286 BNX2X_VF_TLV_NONE, /* ends tlv sequence */
287 BNX2X_VF_TLV_ACQUIRE,
289 BNX2X_VF_TLV_SETUP_Q,
290 BNX2X_VF_TLV_SET_Q_FILTERS,
291 BNX2X_VF_TLV_ACTIVATE_Q,
292 BNX2X_VF_TLV_DEACTIVATE_Q,
293 BNX2X_VF_TLV_TEARDOWN_Q,
295 BNX2X_VF_TLV_RELEASE,
296 BNX2X_VF_TLV_UPDATE_RSS_OLD,
297 BNX2X_VF_TLV_PF_RELEASE_VF,
298 BNX2X_VF_TLV_LIST_END,
300 BNX2X_VF_TLV_PF_SET_MAC,
301 BNX2X_VF_TLV_PF_SET_VLAN,
302 BNX2X_VF_TLV_UPDATE_RSS,
306 struct bnx2x_vf_mbx_msg {
307 union query_tlvs query[BNX2X_VF_MAX_QUEUES_PER_VF];
308 union resp_tlvs resp;
311 void bnx2x_add_tlv(void *tlvs_list, uint16_t offset, uint16_t type, uint16_t length);
312 int bnx2x_vf_set_mac(struct bnx2x_softc *sc, int set);
313 int bnx2x_vf_config_rss(struct bnx2x_softc *sc, struct ecore_config_rss_params *params);
315 #endif /* BNX2X_VFPF_H */