1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017-2018 Broadcom
9 #include <rte_ethdev.h>
10 #include <rte_ether.h>
13 * Response sent back to the caller after callback
15 enum rte_pmd_bnxt_mb_event_rsp {
16 RTE_PMD_BNXT_MB_EVENT_NOOP_ACK, /**< skip mbox request and ACK */
17 RTE_PMD_BNXT_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
18 RTE_PMD_BNXT_MB_EVENT_PROCEED, /**< proceed with mbox request */
19 RTE_PMD_BNXT_MB_EVENT_MAX /**< max value of this enum */
22 /* mailbox message types */
23 #define BNXT_VF_RESET 0x01 /* VF requests reset */
24 #define BNXT_VF_SET_MAC_ADDR 0x02 /* VF requests PF to set MAC addr */
25 #define BNXT_VF_SET_VLAN 0x03 /* VF requests PF to set VLAN */
26 #define BNXT_VF_SET_MTU 0x04 /* VF requests PF to set MTU */
27 #define BNXT_VF_SET_MRU 0x05 /* VF requests PF to set MRU */
30 * Data sent to the caller when the callback is executed.
32 struct rte_pmd_bnxt_mb_event_param {
33 uint16_t vf_id; /* Virtual Function number */
34 int retval; /* return value */
35 void *msg; /* pointer to message */
39 * Enable/Disable VF MAC anti spoof
42 * The port identifier of the Ethernet device.
46 * 1 - Enable VF MAC anti spoof.
47 * 0 - Disable VF MAC anti spoof.
50 * - (0) if successful.
51 * - (-ENODEV) if *port* invalid.
52 * - (-EINVAL) if bad parameter.
54 int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on);
57 * Set the VF MAC address.
60 * The port identifier of the Ethernet device.
66 * - (0) if successful.
67 * - (-ENODEV) if *port* invalid.
68 * - (-EINVAL) if *vf* or *mac_addr* is invalid.
70 int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf,
71 struct rte_ether_addr *mac_addr);
74 * Enable/Disable vf vlan strip for all queues in a pool
77 * The port identifier of the Ethernet device.
81 * 1 - Enable VF's vlan strip on RX queues.
82 * 0 - Disable VF's vlan strip on RX queues.
85 * - (0) if successful.
86 * - (-ENOTSUP) if hardware doesn't support this feature.
87 * - (-ENODEV) if *port* invalid.
88 * - (-EINVAL) if bad parameter.
91 rte_pmd_bnxt_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on);
94 * Enable/Disable vf vlan insert
97 * The port identifier of the Ethernet device.
101 * 0 - Disable VF's vlan insert.
102 * n - Enable; n is inserted as the vlan id.
105 * - (0) if successful.
106 * - (-ENODEV) if *port* invalid.
107 * - (-EINVAL) if bad parameter.
110 rte_pmd_bnxt_set_vf_vlan_insert(uint16_t port, uint16_t vf,
114 * Enable/Disable hardware VF VLAN filtering by an Ethernet device of
115 * received VLAN packets tagged with a given VLAN Tag Identifier.
118 * The port identifier of the Ethernet device.
120 * The VLAN Tag Identifier whose filtering must be enabled or disabled.
122 * Bitmap listing which VFs participate in the VLAN filtering.
124 * 1 - Enable VFs VLAN filtering.
125 * 0 - Disable VFs VLAN filtering.
127 * - (0) if successful.
128 * - (-ENOTSUP) if hardware doesn't support.
129 * - (-ENODEV) if *port_id* invalid.
130 * - (-EINVAL) if bad parameter.
132 int rte_pmd_bnxt_set_vf_vlan_filter(uint16_t port, uint16_t vlan,
133 uint64_t vf_mask, uint8_t vlan_on);
136 * Enable/Disable tx loopback
139 * The port identifier of the Ethernet device.
141 * 1 - Enable tx loopback.
142 * 0 - Disable tx loopback.
145 * - (0) if successful.
146 * - (-ENODEV) if *port* invalid.
147 * - (-EINVAL) if bad parameter.
149 int rte_pmd_bnxt_set_tx_loopback(uint16_t port, uint8_t on);
152 * set all queues drop enable bit
155 * The port identifier of the Ethernet device.
157 * 1 - set the queue drop enable bit for all pools.
158 * 0 - reset the queue drop enable bit for all pools.
161 * - (0) if successful.
162 * - (-ENODEV) if *port* invalid.
163 * - (-EINVAL) if bad parameter.
165 int rte_pmd_bnxt_set_all_queues_drop_en(uint16_t port, uint8_t on);
168 * Set the VF rate limit.
171 * The port identifier of the Ethernet device.
177 * Mask of the Tx queue
179 * - (0) if successful.
180 * - (-ENODEV) if *port* invalid.
181 * - (-EINVAL) if *vf* or *mac_addr* is invalid.
183 int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf,
184 uint16_t tx_rate, uint64_t q_msk);
187 * Get VF's statistics
190 * The port identifier of the Ethernet device.
192 * VF on which to get.
194 * A pointer to a structure of type *rte_eth_stats* to be filled with
195 * the values of device counters supported statistics:
197 * - (0) if successful.
198 * - (-ENODEV) if *port* invalid.
199 * - (-EINVAL) if bad parameter.
202 int rte_pmd_bnxt_get_vf_stats(uint16_t port,
204 struct rte_eth_stats *stats);
207 * Clear VF's statistics
210 * The port identifier of the Ethernet device.
212 * VF on which to get.
214 * - (0) if successful.
215 * - (-ENODEV) if *port* invalid.
216 * - (-EINVAL) if bad parameter.
218 int rte_pmd_bnxt_reset_vf_stats(uint16_t port,
222 * Enable/Disable VF VLAN anti spoof
225 * The port identifier of the Ethernet device.
229 * 1 - Enable VF VLAN anti spoof.
230 * 0 - Disable VF VLAN anti spoof.
233 * - (0) if successful.
234 * - (-ENODEV) if *port* invalid.
235 * - (-EINVAL) if bad parameter.
237 int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf, uint8_t on);
240 * Set RX L2 Filtering mode of a VF of an Ethernet device.
243 * The port identifier of the Ethernet device.
249 * 1 - Enable a VF RX mode.
250 * 0 - Disable a VF RX mode.
252 * - (0) if successful.
253 * - (-ENODEV) if *port_id* invalid.
254 * - (-EINVAL) if bad parameter.
256 int rte_pmd_bnxt_set_vf_rxmode(uint16_t port, uint16_t vf,
257 uint16_t rx_mask, uint8_t on);
260 * Returns the number of default RX queues on a VF
263 * The port identifier of the Ethernet device.
267 * - Non-negative value - Number of default RX queues
268 * - (-EINVAL) if bad parameter.
269 * - (-ENOTSUP) if on a function without VFs
270 * - (-ENOMEM) on an allocation failure
271 * - (-1) firmware interface error
273 int rte_pmd_bnxt_get_vf_rx_status(uint16_t port, uint16_t vf_id);
276 * Queries the TX drop counter for the function
279 * The port identifier of the Ethernet device.
281 * VF on which to get.
283 * Pointer to a uint64_t that will be populated with the counter value.
285 * - Positive Non-zero value - Error code from HWRM
286 * - (-EINVAL) invalid vf_id specified.
287 * - (-ENOTSUP) Ethernet device is not a PF
289 int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id,
293 * Programs the MAC address for the function specified
296 * The port identifier of the Ethernet device.
298 * The MAC address to be programmed in the filter.
300 * VF on which to get.
302 * - Positive Non-zero value - Error code from HWRM
303 * - (-EINVAL) invalid vf_id specified.
304 * - (-ENOTSUP) Ethernet device is not a PF
305 * - (-ENOMEM) on an allocation failure
307 int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *mac_addr,
311 * Enable/Disable VF statistics retention
314 * The port identifier of the Ethernet device.
318 * 1 - Prevent VF statistics from automatically resetting
319 * 0 - Allow VF statistics to automatically reset
322 * - (0) if successful.
323 * - (-ENODEV) if *port* invalid.
324 * - (-EINVAL) if bad parameter.
326 int rte_pmd_bnxt_set_vf_persist_stats(uint16_t port, uint16_t vf, uint8_t on);
327 #endif /* _PMD_BNXT_H_ */