4 * Copyright(c) 2017 Broadcom Limited.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Broadcom Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 #include <rte_ethdev.h>
40 * Response sent back to the caller after callback
42 enum rte_pmd_bnxt_mb_event_rsp {
43 RTE_PMD_BNXT_MB_EVENT_NOOP_ACK, /**< skip mbox request and ACK */
44 RTE_PMD_BNXT_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
45 RTE_PMD_BNXT_MB_EVENT_PROCEED, /**< proceed with mbox request */
46 RTE_PMD_BNXT_MB_EVENT_MAX /**< max value of this enum */
49 /* mailbox message types */
50 #define BNXT_VF_RESET 0x01 /* VF requests reset */
51 #define BNXT_VF_SET_MAC_ADDR 0x02 /* VF requests PF to set MAC addr */
52 #define BNXT_VF_SET_VLAN 0x03 /* VF requests PF to set VLAN */
53 #define BNXT_VF_SET_MTU 0x04 /* VF requests PF to set MTU */
54 #define BNXT_VF_SET_MRU 0x05 /* VF requests PF to set MRU */
57 * Data sent to the caller when the callback is executed.
59 struct rte_pmd_bnxt_mb_event_param {
60 uint16_t vf_id; /* Virtual Function number */
61 int retval; /* return value */
62 void *msg; /* pointer to message */
66 * Enable/Disable VF MAC anti spoof
69 * The port identifier of the Ethernet device.
73 * 1 - Enable VF MAC anti spoof.
74 * 0 - Disable VF MAC anti spoof.
77 * - (0) if successful.
78 * - (-ENODEV) if *port* invalid.
79 * - (-EINVAL) if bad parameter.
81 int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
84 * Set the VF MAC address.
87 * The port identifier of the Ethernet device.
93 * - (0) if successful.
94 * - (-ENODEV) if *port* invalid.
95 * - (-EINVAL) if *vf* or *mac_addr* is invalid.
97 int rte_pmd_bnxt_set_vf_mac_addr(uint8_t port, uint16_t vf,
98 struct ether_addr *mac_addr);
101 * Enable/Disable vf vlan strip for all queues in a pool
104 * The port identifier of the Ethernet device.
108 * 1 - Enable VF's vlan strip on RX queues.
109 * 0 - Disable VF's vlan strip on RX queues.
112 * - (0) if successful.
113 * - (-ENOTSUP) if hardware doesn't support this feature.
114 * - (-ENODEV) if *port* invalid.
115 * - (-EINVAL) if bad parameter.
118 rte_pmd_bnxt_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
121 * Enable/Disable vf vlan insert
124 * The port identifier of the Ethernet device.
128 * 0 - Disable VF's vlan insert.
129 * n - Enable; n is inserted as the vlan id.
132 * - (0) if successful.
133 * - (-ENODEV) if *port* invalid.
134 * - (-EINVAL) if bad parameter.
137 rte_pmd_bnxt_set_vf_vlan_insert(uint8_t port, uint16_t vf,
141 * Enable/Disable hardware VF VLAN filtering by an Ethernet device of
142 * received VLAN packets tagged with a given VLAN Tag Identifier.
145 * The port identifier of the Ethernet device.
147 * The VLAN Tag Identifier whose filtering must be enabled or disabled.
149 * Bitmap listing which VFs participate in the VLAN filtering.
151 * 1 - Enable VFs VLAN filtering.
152 * 0 - Disable VFs VLAN filtering.
154 * - (0) if successful.
155 * - (-ENOTSUP) if hardware doesn't support.
156 * - (-ENODEV) if *port_id* invalid.
157 * - (-EINVAL) if bad parameter.
159 int rte_pmd_bnxt_set_vf_vlan_filter(uint8_t port, uint16_t vlan,
160 uint64_t vf_mask, uint8_t vlan_on);
163 * Enable/Disable tx loopback
166 * The port identifier of the Ethernet device.
168 * 1 - Enable tx loopback.
169 * 0 - Disable tx loopback.
172 * - (0) if successful.
173 * - (-ENODEV) if *port* invalid.
174 * - (-EINVAL) if bad parameter.
176 int rte_pmd_bnxt_set_tx_loopback(uint8_t port, uint8_t on);
179 * set all queues drop enable bit
182 * The port identifier of the Ethernet device.
184 * 1 - set the queue drop enable bit for all pools.
185 * 0 - reset the queue drop enable bit for all pools.
188 * - (0) if successful.
189 * - (-ENODEV) if *port* invalid.
190 * - (-EINVAL) if bad parameter.
192 int rte_pmd_bnxt_set_all_queues_drop_en(uint8_t port, uint8_t on);
195 * Set the VF rate limit.
198 * The port identifier of the Ethernet device.
204 * Mask of the Tx queue
206 * - (0) if successful.
207 * - (-ENODEV) if *port* invalid.
208 * - (-EINVAL) if *vf* or *mac_addr* is invalid.
210 int rte_pmd_bnxt_set_vf_rate_limit(uint8_t port, uint16_t vf,
211 uint16_t tx_rate, uint64_t q_msk);
214 * Get VF's statistics
217 * The port identifier of the Ethernet device.
219 * VF on which to get.
221 * A pointer to a structure of type *rte_eth_stats* to be filled with
222 * the values of device counters supported statistics:
224 * - (0) if successful.
225 * - (-ENODEV) if *port* invalid.
226 * - (-EINVAL) if bad parameter.
229 int rte_pmd_bnxt_get_vf_stats(uint8_t port,
231 struct rte_eth_stats *stats);
234 * Clear VF's statistics
237 * The port identifier of the Ethernet device.
239 * VF on which to get.
241 * - (0) if successful.
242 * - (-ENODEV) if *port* invalid.
243 * - (-EINVAL) if bad parameter.
245 int rte_pmd_bnxt_reset_vf_stats(uint8_t port,
249 * Enable/Disable VF VLAN anti spoof
252 * The port identifier of the Ethernet device.
256 * 1 - Enable VF VLAN anti spoof.
257 * 0 - Disable VF VLAN anti spoof.
260 * - (0) if successful.
261 * - (-ENODEV) if *port* invalid.
262 * - (-EINVAL) if bad parameter.
264 int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
267 * Set RX L2 Filtering mode of a VF of an Ethernet device.
270 * The port identifier of the Ethernet device.
276 * 1 - Enable a VF RX mode.
277 * 0 - Disable a VF RX mode.
279 * - (0) if successful.
280 * - (-ENODEV) if *port_id* invalid.
281 * - (-EINVAL) if bad parameter.
283 int rte_pmd_bnxt_set_vf_rxmode(uint8_t port, uint16_t vf,
284 uint16_t rx_mask, uint8_t on);
287 * Returns the number of default RX queues on a VF
290 * The port identifier of the Ethernet device.
294 * - Non-negative value - Number of default RX queues
295 * - (-EINVAL) if bad parameter.
296 * - (-ENOTSUP) if on a function without VFs
297 * - (-ENOMEM) on an allocation failure
298 * - (-1) firmware interface error
300 int rte_pmd_bnxt_get_vf_rx_status(uint8_t port, uint16_t vf_id);
303 * Queries the TX drop counter for the function
306 * The port identifier of the Ethernet device.
308 * VF on which to get.
310 * Pointer to a uint64_t that will be populated with the counter value.
312 * - Positive Non-zero value - Error code from HWRM
313 * - (-EINVAL) invalid vf_id specified.
314 * - (-ENOTSUP) Ethernet device is not a PF
316 int rte_pmd_bnxt_get_vf_tx_drop_count(uint8_t port, uint16_t vf_id,
320 * Programs the MAC address for the function specified
323 * The port identifier of the Ethernet device.
325 * The MAC address to be programmed in the filter.
327 * VF on which to get.
329 * - Positive Non-zero value - Error code from HWRM
330 * - (-EINVAL) invalid vf_id specified.
331 * - (-ENOTSUP) Ethernet device is not a PF
332 * - (-ENOMEM) on an allocation failure
334 int rte_pmd_bnxt_mac_addr_add(uint8_t port, struct ether_addr *mac_addr,
336 #endif /* _PMD_BNXT_H_ */