1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017-2018 Broadcom
9 #include <rte_ethdev.h>
10 #include <rte_ether.h>
12 /** mbuf dynamic field where CFA code is stored */
13 #define RTE_PMD_BNXT_CFA_CODE_DYNFIELD_NAME "rte_net_bnxt_dynfield_cfa_code"
16 * Response sent back to the caller after callback
18 enum rte_pmd_bnxt_mb_event_rsp {
19 RTE_PMD_BNXT_MB_EVENT_NOOP_ACK, /**< skip mbox request and ACK */
20 RTE_PMD_BNXT_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
21 RTE_PMD_BNXT_MB_EVENT_PROCEED, /**< proceed with mbox request */
22 RTE_PMD_BNXT_MB_EVENT_MAX /**< max value of this enum */
25 /* mailbox message types */
26 #define BNXT_VF_RESET 0x01 /* VF requests reset */
27 #define BNXT_VF_SET_MAC_ADDR 0x02 /* VF requests PF to set MAC addr */
28 #define BNXT_VF_SET_VLAN 0x03 /* VF requests PF to set VLAN */
29 #define BNXT_VF_SET_MTU 0x04 /* VF requests PF to set MTU */
30 #define BNXT_VF_SET_MRU 0x05 /* VF requests PF to set MRU */
33 * Data sent to the caller when the callback is executed.
35 struct rte_pmd_bnxt_mb_event_param {
36 uint16_t vf_id; /* Virtual Function number */
37 int retval; /* return value */
38 void *msg; /* pointer to message */
42 * Enable/Disable VF MAC anti spoof
45 * The port identifier of the Ethernet device.
49 * 1 - Enable VF MAC anti spoof.
50 * 0 - Disable VF MAC anti spoof.
53 * - (0) if successful.
54 * - (-ENODEV) if *port* invalid.
55 * - (-EINVAL) if bad parameter.
57 int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on);
60 * Set the VF MAC address.
63 * The port identifier of the Ethernet device.
69 * - (0) if successful.
70 * - (-ENODEV) if *port* invalid.
71 * - (-EINVAL) if *vf* or *mac_addr* is invalid.
73 int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf,
74 struct rte_ether_addr *mac_addr);
77 * Enable/Disable vf vlan strip for all queues in a pool
80 * The port identifier of the Ethernet device.
84 * 1 - Enable VF's vlan strip on RX queues.
85 * 0 - Disable VF's vlan strip on RX queues.
88 * - (0) if successful.
89 * - (-ENOTSUP) if hardware doesn't support this feature.
90 * - (-ENODEV) if *port* invalid.
91 * - (-EINVAL) if bad parameter.
94 rte_pmd_bnxt_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on);
97 * Enable/Disable vf vlan insert
100 * The port identifier of the Ethernet device.
104 * 0 - Disable VF's vlan insert.
105 * n - Enable; n is inserted as the vlan id.
108 * - (0) if successful.
109 * - (-ENODEV) if *port* invalid.
110 * - (-EINVAL) if bad parameter.
113 rte_pmd_bnxt_set_vf_vlan_insert(uint16_t port, uint16_t vf,
117 * Enable/Disable hardware VF VLAN filtering by an Ethernet device of
118 * received VLAN packets tagged with a given VLAN Tag Identifier.
121 * The port identifier of the Ethernet device.
123 * The VLAN Tag Identifier whose filtering must be enabled or disabled.
125 * Bitmap listing which VFs participate in the VLAN filtering.
127 * 1 - Enable VFs VLAN filtering.
128 * 0 - Disable VFs VLAN filtering.
130 * - (0) if successful.
131 * - (-ENOTSUP) if hardware doesn't support.
132 * - (-ENODEV) if *port_id* invalid.
133 * - (-EINVAL) if bad parameter.
135 int rte_pmd_bnxt_set_vf_vlan_filter(uint16_t port, uint16_t vlan,
136 uint64_t vf_mask, uint8_t vlan_on);
139 * Enable/Disable tx loopback
142 * The port identifier of the Ethernet device.
144 * 1 - Enable tx loopback.
145 * 0 - Disable tx loopback.
148 * - (0) if successful.
149 * - (-ENODEV) if *port* invalid.
150 * - (-EINVAL) if bad parameter.
152 int rte_pmd_bnxt_set_tx_loopback(uint16_t port, uint8_t on);
155 * set all queues drop enable bit
158 * The port identifier of the Ethernet device.
160 * 1 - set the queue drop enable bit for all pools.
161 * 0 - reset the queue drop enable bit for all pools.
164 * - (0) if successful.
165 * - (-ENODEV) if *port* invalid.
166 * - (-EINVAL) if bad parameter.
168 int rte_pmd_bnxt_set_all_queues_drop_en(uint16_t port, uint8_t on);
171 * Set the VF rate limit.
174 * The port identifier of the Ethernet device.
180 * Mask of the Tx queue
182 * - (0) if successful.
183 * - (-ENODEV) if *port* invalid.
184 * - (-EINVAL) if *vf* or *mac_addr* is invalid.
186 int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf,
187 uint16_t tx_rate, uint64_t q_msk);
190 * Get VF's statistics
193 * The port identifier of the Ethernet device.
195 * VF on which to get.
197 * A pointer to a structure of type *rte_eth_stats* to be filled with
198 * the values of device counters supported statistics:
200 * - (0) if successful.
201 * - (-ENODEV) if *port* invalid.
202 * - (-EINVAL) if bad parameter.
205 int rte_pmd_bnxt_get_vf_stats(uint16_t port,
207 struct rte_eth_stats *stats);
210 * Clear VF's statistics
213 * The port identifier of the Ethernet device.
215 * VF on which to get.
217 * - (0) if successful.
218 * - (-ENODEV) if *port* invalid.
219 * - (-EINVAL) if bad parameter.
221 int rte_pmd_bnxt_reset_vf_stats(uint16_t port,
225 * Enable/Disable VF VLAN anti spoof
228 * The port identifier of the Ethernet device.
232 * 1 - Enable VF VLAN anti spoof.
233 * 0 - Disable VF VLAN anti spoof.
236 * - (0) if successful.
237 * - (-ENODEV) if *port* invalid.
238 * - (-EINVAL) if bad parameter.
240 int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf, uint8_t on);
243 * Set RX L2 Filtering mode of a VF of an Ethernet device.
246 * The port identifier of the Ethernet device.
252 * 1 - Enable a VF RX mode.
253 * 0 - Disable a VF RX mode.
255 * - (0) if successful.
256 * - (-ENODEV) if *port_id* invalid.
257 * - (-EINVAL) if bad parameter.
259 int rte_pmd_bnxt_set_vf_rxmode(uint16_t port, uint16_t vf,
260 uint16_t rx_mask, uint8_t on);
263 * Returns the number of default RX queues on a VF
266 * The port identifier of the Ethernet device.
270 * - Non-negative value - Number of default RX queues
271 * - (-EINVAL) if bad parameter.
272 * - (-ENOTSUP) if on a function without VFs
273 * - (-ENOMEM) on an allocation failure
274 * - (-1) firmware interface error
276 int rte_pmd_bnxt_get_vf_rx_status(uint16_t port, uint16_t vf_id);
279 * Queries the TX drop counter for the function
282 * The port identifier of the Ethernet device.
284 * VF on which to get.
286 * Pointer to a uint64_t that will be populated with the counter value.
288 * - Positive Non-zero value - Error code from HWRM
289 * - (-EINVAL) invalid vf_id specified.
290 * - (-ENOTSUP) Ethernet device is not a PF
292 int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id,
296 * Programs the MAC address for the function specified
299 * The port identifier of the Ethernet device.
301 * The MAC address to be programmed in the filter.
303 * VF on which to get.
305 * - Positive Non-zero value - Error code from HWRM
306 * - (-EINVAL) invalid vf_id specified.
307 * - (-ENOTSUP) Ethernet device is not a PF
308 * - (-ENOMEM) on an allocation failure
310 int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *mac_addr,
314 * Enable/Disable VF statistics retention
317 * The port identifier of the Ethernet device.
321 * 1 - Prevent VF statistics from automatically resetting
322 * 0 - Allow VF statistics to automatically reset
325 * - (0) if successful.
326 * - (-ENODEV) if *port* invalid.
327 * - (-EINVAL) if bad parameter.
329 int rte_pmd_bnxt_set_vf_persist_stats(uint16_t port, uint16_t vf, uint8_t on);
330 #endif /* _PMD_BNXT_H_ */