1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017-2018 Broadcom
9 #include <rte_ethdev_driver.h>
12 * Response sent back to the caller after callback
14 enum rte_pmd_bnxt_mb_event_rsp {
15 RTE_PMD_BNXT_MB_EVENT_NOOP_ACK, /**< skip mbox request and ACK */
16 RTE_PMD_BNXT_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
17 RTE_PMD_BNXT_MB_EVENT_PROCEED, /**< proceed with mbox request */
18 RTE_PMD_BNXT_MB_EVENT_MAX /**< max value of this enum */
21 /* mailbox message types */
22 #define BNXT_VF_RESET 0x01 /* VF requests reset */
23 #define BNXT_VF_SET_MAC_ADDR 0x02 /* VF requests PF to set MAC addr */
24 #define BNXT_VF_SET_VLAN 0x03 /* VF requests PF to set VLAN */
25 #define BNXT_VF_SET_MTU 0x04 /* VF requests PF to set MTU */
26 #define BNXT_VF_SET_MRU 0x05 /* VF requests PF to set MRU */
29 * Data sent to the caller when the callback is executed.
31 struct rte_pmd_bnxt_mb_event_param {
32 uint16_t vf_id; /* Virtual Function number */
33 int retval; /* return value */
34 void *msg; /* pointer to message */
38 * Enable/Disable VF MAC anti spoof
41 * The port identifier of the Ethernet device.
45 * 1 - Enable VF MAC anti spoof.
46 * 0 - Disable VF MAC anti spoof.
49 * - (0) if successful.
50 * - (-ENODEV) if *port* invalid.
51 * - (-EINVAL) if bad parameter.
53 int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on);
56 * Set the VF MAC address.
59 * The port identifier of the Ethernet device.
65 * - (0) if successful.
66 * - (-ENODEV) if *port* invalid.
67 * - (-EINVAL) if *vf* or *mac_addr* is invalid.
69 int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf,
70 struct ether_addr *mac_addr);
73 * Enable/Disable vf vlan strip for all queues in a pool
76 * The port identifier of the Ethernet device.
80 * 1 - Enable VF's vlan strip on RX queues.
81 * 0 - Disable VF's vlan strip on RX queues.
84 * - (0) if successful.
85 * - (-ENOTSUP) if hardware doesn't support this feature.
86 * - (-ENODEV) if *port* invalid.
87 * - (-EINVAL) if bad parameter.
90 rte_pmd_bnxt_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on);
93 * Enable/Disable vf vlan insert
96 * The port identifier of the Ethernet device.
100 * 0 - Disable VF's vlan insert.
101 * n - Enable; n is inserted as the vlan id.
104 * - (0) if successful.
105 * - (-ENODEV) if *port* invalid.
106 * - (-EINVAL) if bad parameter.
109 rte_pmd_bnxt_set_vf_vlan_insert(uint16_t port, uint16_t vf,
113 * Enable/Disable hardware VF VLAN filtering by an Ethernet device of
114 * received VLAN packets tagged with a given VLAN Tag Identifier.
117 * The port identifier of the Ethernet device.
119 * The VLAN Tag Identifier whose filtering must be enabled or disabled.
121 * Bitmap listing which VFs participate in the VLAN filtering.
123 * 1 - Enable VFs VLAN filtering.
124 * 0 - Disable VFs VLAN filtering.
126 * - (0) if successful.
127 * - (-ENOTSUP) if hardware doesn't support.
128 * - (-ENODEV) if *port_id* invalid.
129 * - (-EINVAL) if bad parameter.
131 int rte_pmd_bnxt_set_vf_vlan_filter(uint16_t port, uint16_t vlan,
132 uint64_t vf_mask, uint8_t vlan_on);
135 * Enable/Disable tx loopback
138 * The port identifier of the Ethernet device.
140 * 1 - Enable tx loopback.
141 * 0 - Disable tx loopback.
144 * - (0) if successful.
145 * - (-ENODEV) if *port* invalid.
146 * - (-EINVAL) if bad parameter.
148 int rte_pmd_bnxt_set_tx_loopback(uint16_t port, uint8_t on);
151 * set all queues drop enable bit
154 * The port identifier of the Ethernet device.
156 * 1 - set the queue drop enable bit for all pools.
157 * 0 - reset the queue drop enable bit for all pools.
160 * - (0) if successful.
161 * - (-ENODEV) if *port* invalid.
162 * - (-EINVAL) if bad parameter.
164 int rte_pmd_bnxt_set_all_queues_drop_en(uint16_t port, uint8_t on);
167 * Set the VF rate limit.
170 * The port identifier of the Ethernet device.
176 * Mask of the Tx queue
178 * - (0) if successful.
179 * - (-ENODEV) if *port* invalid.
180 * - (-EINVAL) if *vf* or *mac_addr* is invalid.
182 int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf,
183 uint16_t tx_rate, uint64_t q_msk);
186 * Get VF's statistics
189 * The port identifier of the Ethernet device.
191 * VF on which to get.
193 * A pointer to a structure of type *rte_eth_stats* to be filled with
194 * the values of device counters supported statistics:
196 * - (0) if successful.
197 * - (-ENODEV) if *port* invalid.
198 * - (-EINVAL) if bad parameter.
201 int rte_pmd_bnxt_get_vf_stats(uint16_t port,
203 struct rte_eth_stats *stats);
206 * Clear VF's statistics
209 * The port identifier of the Ethernet device.
211 * VF on which to get.
213 * - (0) if successful.
214 * - (-ENODEV) if *port* invalid.
215 * - (-EINVAL) if bad parameter.
217 int rte_pmd_bnxt_reset_vf_stats(uint16_t port,
221 * Enable/Disable VF VLAN anti spoof
224 * The port identifier of the Ethernet device.
228 * 1 - Enable VF VLAN anti spoof.
229 * 0 - Disable VF VLAN anti spoof.
232 * - (0) if successful.
233 * - (-ENODEV) if *port* invalid.
234 * - (-EINVAL) if bad parameter.
236 int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf, uint8_t on);
239 * Set RX L2 Filtering mode of a VF of an Ethernet device.
242 * The port identifier of the Ethernet device.
248 * 1 - Enable a VF RX mode.
249 * 0 - Disable a VF RX mode.
251 * - (0) if successful.
252 * - (-ENODEV) if *port_id* invalid.
253 * - (-EINVAL) if bad parameter.
255 int rte_pmd_bnxt_set_vf_rxmode(uint16_t port, uint16_t vf,
256 uint16_t rx_mask, uint8_t on);
259 * Returns the number of default RX queues on a VF
262 * The port identifier of the Ethernet device.
266 * - Non-negative value - Number of default RX queues
267 * - (-EINVAL) if bad parameter.
268 * - (-ENOTSUP) if on a function without VFs
269 * - (-ENOMEM) on an allocation failure
270 * - (-1) firmware interface error
272 int rte_pmd_bnxt_get_vf_rx_status(uint16_t port, uint16_t vf_id);
275 * Queries the TX drop counter for the function
278 * The port identifier of the Ethernet device.
280 * VF on which to get.
282 * Pointer to a uint64_t that will be populated with the counter value.
284 * - Positive Non-zero value - Error code from HWRM
285 * - (-EINVAL) invalid vf_id specified.
286 * - (-ENOTSUP) Ethernet device is not a PF
288 int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id,
292 * Programs the MAC address for the function specified
295 * The port identifier of the Ethernet device.
297 * The MAC address to be programmed in the filter.
299 * VF on which to get.
301 * - Positive Non-zero value - Error code from HWRM
302 * - (-EINVAL) invalid vf_id specified.
303 * - (-ENOTSUP) Ethernet device is not a PF
304 * - (-ENOMEM) on an allocation failure
306 int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct ether_addr *mac_addr,
310 * Enable/Disable VF statistics retention
313 * The port identifier of the Ethernet device.
317 * 1 - Prevent VF statistics from automatically resetting
318 * 0 - Allow VF statistics to automatically reset
321 * - (0) if successful.
322 * - (-ENODEV) if *port* invalid.
323 * - (-EINVAL) if bad parameter.
325 int rte_pmd_bnxt_set_vf_persist_stats(uint16_t port, uint16_t vf, uint8_t on);
326 #endif /* _PMD_BNXT_H_ */