net/bnxt: determine the Rx status of VF
[dpdk.git] / drivers / net / bnxt / rte_pmd_bnxt.h
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) 2017 Broadcom Limited.
5  *   All rights reserved.
6  *
7  *   Redistribution and use in source and binary forms, with or without
8  *   modification, are permitted provided that the following conditions
9  *   are met:
10  *
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
16  *       distribution.
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.
20  *
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.
32  */
33
34 #ifndef _PMD_BNXT_H_
35 #define _PMD_BNXT_H_
36
37 #include <rte_ethdev.h>
38
39 /**
40  * Enable/Disable VF MAC anti spoof
41  *
42  * @param port
43  *    The port identifier of the Ethernet device.
44  * @param vf
45  *   VF id.
46  * @param on
47  *    1 - Enable VF MAC anti spoof.
48  *    0 - Disable VF MAC anti spoof.
49  *
50  * @return
51  *   - (0) if successful.
52  *   - (-ENODEV) if *port* invalid.
53  *   - (-EINVAL) if bad parameter.
54  */
55 int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
56
57 /**
58  * Set the VF MAC address.
59  *
60  * @param port
61  *   The port identifier of the Ethernet device.
62  * @param vf
63  *   VF id.
64  * @param mac_addr
65  *   VF MAC address.
66  * @return
67  *   - (0) if successful.
68  *   - (-ENODEV) if *port* invalid.
69  *   - (-EINVAL) if *vf* or *mac_addr* is invalid.
70  */
71 int rte_pmd_bnxt_set_vf_mac_addr(uint8_t port, uint16_t vf,
72                 struct ether_addr *mac_addr);
73
74 /**
75  * Enable/Disable vf vlan strip for all queues in a pool
76  *
77  * @param port
78  *    The port identifier of the Ethernet device.
79  * @param vf
80  *    ID specifying VF.
81  * @param on
82  *    1 - Enable VF's vlan strip on RX queues.
83  *    0 - Disable VF's vlan strip on RX queues.
84  *
85  * @return
86  *   - (0) if successful.
87  *   - (-ENOTSUP) if hardware doesn't support this feature.
88  *   - (-ENODEV) if *port* invalid.
89  *   - (-EINVAL) if bad parameter.
90  */
91 int
92 rte_pmd_bnxt_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
93
94 /**
95  * Enable/Disable hardware VF VLAN filtering by an Ethernet device of
96  * received VLAN packets tagged with a given VLAN Tag Identifier.
97  *
98  * @param port
99  *   The port identifier of the Ethernet device.
100  * @param vlan
101  *   The VLAN Tag Identifier whose filtering must be enabled or disabled.
102  * @param vf_mask
103  *    Bitmap listing which VFs participate in the VLAN filtering.
104  * @param vlan_on
105  *    1 - Enable VFs VLAN filtering.
106  *    0 - Disable VFs VLAN filtering.
107  * @return
108  *   - (0) if successful.
109  *   - (-ENOTSUP) if hardware doesn't support.
110  *   - (-ENODEV) if *port_id* invalid.
111  *   - (-EINVAL) if bad parameter.
112  */
113 int rte_pmd_bnxt_set_vf_vlan_filter(uint8_t port, uint16_t vlan,
114                                     uint64_t vf_mask, uint8_t vlan_on);
115
116 /**
117  * Enable/Disable tx loopback
118  *
119  * @param port
120  *    The port identifier of the Ethernet device.
121  * @param on
122  *    1 - Enable tx loopback.
123  *    0 - Disable tx loopback.
124  *
125  * @return
126  *   - (0) if successful.
127  *   - (-ENODEV) if *port* invalid.
128  *   - (-EINVAL) if bad parameter.
129  */
130 int rte_pmd_bnxt_set_tx_loopback(uint8_t port, uint8_t on);
131
132 /**
133  * set all queues drop enable bit
134  *
135  * @param port
136  *    The port identifier of the Ethernet device.
137  * @param on
138  *    1 - set the queue drop enable bit for all pools.
139  *    0 - reset the queue drop enable bit for all pools.
140  *
141  * @return
142  *   - (0) if successful.
143  *   - (-ENODEV) if *port* invalid.
144  *   - (-EINVAL) if bad parameter.
145  */
146 int rte_pmd_bnxt_set_all_queues_drop_en(uint8_t port, uint8_t on);
147
148 /**
149  * Set the VF rate limit.
150  *
151  * @param port
152  *   The port identifier of the Ethernet device.
153  * @param vf
154  *   VF id.
155  * @param tx_rate
156  *   Tx rate for the VF
157  * @param q_msk
158  *   Mask of the Tx queue
159  * @return
160  *   - (0) if successful.
161  *   - (-ENODEV) if *port* invalid.
162  *   - (-EINVAL) if *vf* or *mac_addr* is invalid.
163  */
164 int rte_pmd_bnxt_set_vf_rate_limit(uint8_t port, uint16_t vf,
165                                 uint16_t tx_rate, uint64_t q_msk);
166
167 /**
168  * Get VF's statistics
169  *
170  * @param port
171  *    The port identifier of the Ethernet device.
172  * @param vf_id
173  *    VF on which to get.
174  * @param stats
175  *    A pointer to a structure of type *rte_eth_stats* to be filled with
176  *    the values of device counters supported statistics:
177  * @return
178  *   - (0) if successful.
179  *   - (-ENODEV) if *port* invalid.
180  *   - (-EINVAL) if bad parameter.
181  */
182
183 int rte_pmd_bnxt_get_vf_stats(uint8_t port,
184                               uint16_t vf_id,
185                               struct rte_eth_stats *stats);
186
187 /**
188  * Clear VF's statistics
189  *
190  * @param port
191  *    The port identifier of the Ethernet device.
192  * @param vf_id
193  *    VF on which to get.
194  * @return
195  *   - (0) if successful.
196  *   - (-ENODEV) if *port* invalid.
197  *   - (-EINVAL) if bad parameter.
198  */
199 int rte_pmd_bnxt_reset_vf_stats(uint8_t port,
200                                 uint16_t vf_id);
201
202 /**
203  * Enable/Disable VF VLAN anti spoof
204  *
205  * @param port
206  *    The port identifier of the Ethernet device.
207  * @param vf
208  *   VF id.
209  * @param on
210  *    1 - Enable VF VLAN anti spoof.
211  *    0 - Disable VF VLAN anti spoof.
212  *
213  * @return
214  *   - (0) if successful.
215  *   - (-ENODEV) if *port* invalid.
216  *   - (-EINVAL) if bad parameter.
217  */
218 int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
219
220
221 /**
222  * Returns the number of default RX queues on a VF
223  *
224  * @param port
225  *    The port identifier of the Ethernet device.
226  * @param vf
227  *   VF id.
228  * @return
229  *   - Non-negative value - Number of default RX queues
230  *   - (-EINVAL) if bad parameter.
231  *   - (-ENOTSUP) if on a function without VFs
232  *   - (-ENOMEM) on an allocation failure
233  *   - (-1) firmware interface error
234  */
235 int rte_pmd_bnxt_get_vf_rx_status(uint8_t port, uint16_t vf_id);
236
237 /**
238  * Queries the TX drop counter for the function
239  *
240  * @param port
241  *    The port identifier of the Ethernet device.
242  * @param vf_id
243  *    VF on which to get.
244  * @param count
245  *    Pointer to a uint64_t that will be populated with the counter value.
246  * @return
247  *   - Positive Non-zero value - Error code from HWRM
248  *   - (-EINVAL) invalid vf_id specified.
249  *   - (-ENOTSUP) Ethernet device is not a PF
250  */
251 int rte_pmd_bnxt_get_vf_tx_drop_count(uint8_t port, uint16_t vf_id,
252                                       uint64_t *count);
253 #endif /* _PMD_BNXT_H_ */