1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2013-2015 Brocade Communications Systems, Inc.
3 * Copyright (c) 2015-2018 Cavium Inc.
15 struct vf_resource_query
{
19 uint8_t num_mac_filters
;
20 uint8_t num_vlan_filters
;
21 uint8_t num_mc_filters
;
24 #define BNX2X_VF_STATUS_SUCCESS 1
25 #define BNX2X_VF_STATUS_FAILURE 2
26 #define BNX2X_VF_STATUS_NO_RESOURCES 4
27 #define BNX2X_VF_BULLETIN_TRIES 5
29 #define BNX2X_VF_Q_FLAG_CACHE_ALIGN 0x0008
30 #define BNX2X_VF_Q_FLAG_STATS 0x0010
31 #define BNX2X_VF_Q_FLAG_OV 0x0020
32 #define BNX2X_VF_Q_FLAG_VLAN 0x0040
33 #define BNX2X_VF_Q_FLAG_COS 0x0080
34 #define BNX2X_VF_Q_FLAG_HC 0x0100
35 #define BNX2X_VF_Q_FLAG_DHC 0x0200
36 #define BNX2X_VF_Q_FLAG_LEADING_RSS 0x0400
38 #define TLV_BUFFER_SIZE 1024
40 #define VFPF_RX_MASK_ACCEPT_NONE 0x00000000
41 #define VFPF_RX_MASK_ACCEPT_MATCHED_UNICAST 0x00000001
42 #define VFPF_RX_MASK_ACCEPT_MATCHED_MULTICAST 0x00000002
43 #define VFPF_RX_MASK_ACCEPT_ALL_UNICAST 0x00000004
44 #define VFPF_RX_MASK_ACCEPT_ALL_MULTICAST 0x00000008
45 #define VFPF_RX_MASK_ACCEPT_BROADCAST 0x00000010
47 /* general tlv header (used for both vf->pf request and pf->vf response) */
54 struct channel_tlv tl
;
55 uint32_t reply_offset
;
58 struct tlv_buffer_size
{
59 uint8_t tlv_buffer
[TLV_BUFFER_SIZE
];
62 /* tlv struct for all PF replies except acquire */
63 struct vf_common_reply_tlv
{
64 struct channel_tlv tl
;
69 /* used to terminate and pad a tlv list */
70 struct channel_list_end_tlv
{
71 struct channel_tlv tl
;
76 struct vf_acquire_tlv
{
77 struct vf_first_tlv first_tlv
;
82 struct vf_resource_query res_query
;
84 uint64_t bulletin_addr
;
87 /* simple operation request on queue */
89 struct vf_first_tlv first_tlv
;
94 /* receive side scaling tlv */
96 struct vf_first_tlv first_tlv
;
98 uint8_t rss_result_mask
;
99 uint8_t ind_table_size
;
100 uint8_t rss_key_size
;
102 uint8_t ind_table
[T_ETH_INDIRECTION_TABLE_SIZE
];
103 uint32_t rss_key
[T_ETH_RSS_KEY
]; /* hash values */
107 #define BNX2X_VF_MAX_QUEUES_PER_VF 16
108 #define BNX2X_VF_MAX_SBS_PER_VF 16
109 uint16_t hw_sbs
[BNX2X_VF_MAX_SBS_PER_VF
];
110 uint8_t hw_qid
[BNX2X_VF_MAX_QUEUES_PER_VF
];
114 uint8_t num_mac_filters
;
115 uint8_t num_vlan_filters
;
116 uint8_t num_mc_filters
;
117 uint8_t permanent_mac_addr
[ETH_ALEN
];
118 struct ether_addr current_mac_addr
;
119 uint16_t pf_link_speed
;
120 uint32_t pf_link_supported
;
123 /* tlv struct holding reply for acquire */
124 struct vf_acquire_resp_tlv
{
139 struct vf_first_tlv first_tlv
;
140 uint64_t sb_addr
[BNX2X_VF_MAX_SBS_PER_VF
];
148 struct vf_rxq_params
{
149 /* physical addresses */
151 uint64_t rcq_np_addr
;
158 uint16_t hc_rate
; /* desired interrupts per sec. */
162 uint16_t flags
; /* for BNX2X_VF_Q_FLAG_X flags */
163 uint16_t stat_id
; /* valid if BNX2X_VF_Q_FLAG_STATS */
168 uint8_t cache_line_log
; /* BNX2X_VF_Q_FLAG_CACHE_ALIGN */
172 struct vf_txq_params
{
173 /* physical addresses */
177 uint8_t vf_sb_id
; /* index in hw_sbs[] */
178 uint8_t sb_index
; /* Index in the SB */
179 uint16_t hc_rate
; /* desired interrupts per sec. */
180 uint32_t flags
; /* for BNX2X_VF_Q_FLAG_X flags */
181 uint16_t stat_id
; /* valid if BNX2X_VF_Q_FLAG_STATS */
182 uint8_t traffic_type
; /* see in setup_context() */
187 struct vf_setup_q_tlv
{
188 struct vf_first_tlv first_tlv
;
190 struct vf_rxq_params rxq
;
191 struct vf_txq_params txq
;
193 uint8_t vf_qid
; /* index in hw_qid[] */
195 #define VF_RXQ_VALID 0x01
196 #define VF_TXQ_VALID 0x02
200 /* Set Queue Filters */
201 struct vf_q_mac_vlan_filter
{
203 #define BNX2X_VF_Q_FILTER_DEST_MAC_VALID 0x01
204 #define BNX2X_VF_Q_FILTER_VLAN_TAG_VALID 0x02
205 #define BNX2X_VF_Q_FILTER_SET_MAC 0x100 /* set/clear */
206 uint8_t mac
[ETH_ALEN
];
211 #define _UP_ETH_ALEN (6)
213 /* configure queue filters */
214 struct vf_set_q_filters_tlv
{
215 struct vf_first_tlv first_tlv
;
218 #define BNX2X_VF_MAC_VLAN_CHANGED 0x01
219 #define BNX2X_VF_MULTICAST_CHANGED 0x02
220 #define BNX2X_VF_RX_MASK_CHANGED 0x04
222 uint8_t vf_qid
; /* index in hw_qid[] */
223 uint8_t mac_filters_cnt
;
224 uint8_t multicast_cnt
;
227 #define VF_MAX_MAC_FILTERS 16
228 #define VF_MAX_VLAN_FILTERS 16
229 #define VF_MAX_FILTERS (VF_MAX_MAC_FILTERS +\
231 struct vf_q_mac_vlan_filter filters
[VF_MAX_FILTERS
];
233 #define VF_MAX_MULTICAST_PER_VF 32
234 uint8_t multicast
[VF_MAX_MULTICAST_PER_VF
][_UP_ETH_ALEN
];
235 unsigned long rx_mask
;
239 /* close VF (disable VF) */
240 struct vf_close_tlv
{
241 struct vf_first_tlv first_tlv
;
242 uint16_t vf_id
; /* for debug */
246 /* rlease the VF's acquired resources */
247 struct vf_release_tlv
{
248 struct vf_first_tlv first_tlv
;
249 uint16_t vf_id
; /* for debug */
254 struct vf_first_tlv first_tlv
;
255 struct vf_acquire_tlv acquire
;
256 struct vf_init_tlv init
;
257 struct vf_close_tlv close
;
258 struct vf_q_op_tlv q_op
;
259 struct vf_setup_q_tlv setup_q
;
260 struct vf_set_q_filters_tlv set_q_filters
;
261 struct vf_release_tlv release
;
262 struct vf_rss_tlv update_rss
;
263 struct channel_list_end_tlv list_end
;
264 struct tlv_buffer_size tlv_buf_size
;
268 struct vf_common_reply_tlv common_reply
;
269 struct vf_acquire_resp_tlv acquire_resp
;
270 struct channel_list_end_tlv list_end
;
271 struct tlv_buffer_size tlv_buf_size
;
274 /* struct allocated by VF driver, PF sends updates to VF via bulletin */
275 struct bnx2x_vf_bulletin
{
276 uint32_t crc
; /* crc of structure to ensure is not in
282 uint64_t valid_bitmap
; /* bitmap indicating which fields
286 #define MAC_ADDR_VALID 0 /* alert the vf that a new mac address
287 * is available for it
289 #define VLAN_VALID 1 /* when set, the vf should no access the
292 #define CHANNEL_DOWN 2 /* vf channel is disabled. VFs are not
293 * to attempt to send messages on the
294 * channel after this bit is set
296 uint8_t mac
[ETH_ALEN
];
303 #define MAX_TLVS_IN_LIST 50
305 BNX2X_VF_TLV_NONE
, /* ends tlv sequence */
306 BNX2X_VF_TLV_ACQUIRE
,
308 BNX2X_VF_TLV_SETUP_Q
,
309 BNX2X_VF_TLV_SET_Q_FILTERS
,
310 BNX2X_VF_TLV_ACTIVATE_Q
,
311 BNX2X_VF_TLV_DEACTIVATE_Q
,
312 BNX2X_VF_TLV_TEARDOWN_Q
,
314 BNX2X_VF_TLV_RELEASE
,
315 BNX2X_VF_TLV_UPDATE_RSS_OLD
,
316 BNX2X_VF_TLV_PF_RELEASE_VF
,
317 BNX2X_VF_TLV_LIST_END
,
319 BNX2X_VF_TLV_PF_SET_MAC
,
320 BNX2X_VF_TLV_PF_SET_VLAN
,
321 BNX2X_VF_TLV_UPDATE_RSS
,
322 BNX2X_VF_TLV_PHYS_PORT_ID
,
326 struct bnx2x_vf_mbx_msg
{
327 union query_tlvs query
[BNX2X_VF_MAX_QUEUES_PER_VF
];
328 union resp_tlvs resp
;
331 int bnx2x_vf_set_mac(struct bnx2x_softc
*sc
, int set
);
332 int bnx2x_vf_config_rss(struct bnx2x_softc
*sc
, struct ecore_config_rss_params
*params
);
334 #endif /* BNX2X_VFPF_H */