Imported Upstream version 16.11
[deb_dpdk.git] / drivers / net / ixgbe / rte_pmd_ixgbe.h
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright (c) 2016 Intel Corporation. All rights reserved.
5  *
6  *   Redistribution and use in source and binary forms, with or without
7  *   modification, are permitted provided that the following conditions
8  *   are met:
9  *
10  *     * Redistributions of source code must retain the above copyright
11  *       notice, this list of conditions and the following disclaimer.
12  *     * Redistributions in binary form must reproduce the above copyright
13  *       notice, this list of conditions and the following disclaimer in
14  *       the documentation and/or other materials provided with the
15  *       distribution.
16  *     * Neither the name of Intel Corporation nor the names of its
17  *       contributors may be used to endorse or promote products derived
18  *       from this software without specific prior written permission.
19  *
20  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33 /**
34  * @file rte_pmd_ixgbe.h
35  * ixgbe PMD specific functions.
36  *
37  **/
38
39 #ifndef _PMD_IXGBE_H_
40 #define _PMD_IXGBE_H_
41
42 #include <rte_ethdev.h>
43
44 /**
45  * Set the VF MAC address.
46  *
47  * @param port
48  *   The port identifier of the Ethernet device.
49  * @param vf
50  *   VF id.
51  * @param mac_addr
52  *   VF MAC address.
53  * @return
54  *   - (0) if successful.
55  *   - (-ENODEV) if *port* invalid.
56  *   - (-EINVAL) if *vf* or *mac_addr* is invalid.
57  */
58 int rte_pmd_ixgbe_set_vf_mac_addr(uint8_t port, uint16_t vf,
59                 struct ether_addr *mac_addr);
60
61 /**
62  * Enable/Disable VF VLAN anti spoofing.
63  *
64  * @param port
65  *    The port identifier of the Ethernet device.
66  * @param vf
67  *    VF on which to set VLAN anti spoofing.
68  * @param on
69  *    1 - Enable VFs VLAN anti spoofing.
70  *    0 - Disable VFs VLAN anti spoofing.
71  * @return
72  *   - (0) if successful.
73  *   - (-ENODEV) if *port* invalid.
74  *   - (-EINVAL) if bad parameter.
75  */
76 int rte_pmd_ixgbe_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
77
78 /**
79  * Enable/Disable VF MAC anti spoofing.
80  *
81  * @param port
82  *    The port identifier of the Ethernet device.
83  * @param vf
84  *    VF on which to set MAC anti spoofing.
85  * @param on
86  *    1 - Enable VFs MAC anti spoofing.
87  *    0 - Disable VFs MAC anti spoofing.
88  * @return
89  *   - (0) if successful.
90  *   - (-ENODEV) if *port* invalid.
91  *   - (-EINVAL) if bad parameter.
92  */
93 int rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
94
95 /**
96  * Enable/Disable vf vlan insert
97  *
98  * @param port
99  *    The port identifier of the Ethernet device.
100  * @param vf
101  *    ID specifying VF.
102  * @param vlan_id
103  *    0 - Disable VF's vlan insert.
104  *    n - Enable; n is inserted as the vlan id.
105  *
106  * @return
107  *   - (0) if successful.
108  *   - (-ENODEV) if *port* invalid.
109  *   - (-EINVAL) if bad parameter.
110  */
111 int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf,
112                 uint16_t vlan_id);
113
114 /**
115  * Enable/Disable tx loopback
116  *
117  * @param port
118  *    The port identifier of the Ethernet device.
119  * @param on
120  *    1 - Enable tx loopback.
121  *    0 - Disable tx loopback.
122  *
123  * @return
124  *   - (0) if successful.
125  *   - (-ENODEV) if *port* invalid.
126  *   - (-EINVAL) if bad parameter.
127  */
128 int rte_pmd_ixgbe_set_tx_loopback(uint8_t port, uint8_t on);
129
130 /**
131  * set all queues drop enable bit
132  *
133  * @param port
134  *    The port identifier of the Ethernet device.
135  * @param on
136  *    1 - set the queue drop enable bit for all pools.
137  *    0 - reset the queue drop enable bit for all pools.
138  *
139  * @return
140  *   - (0) if successful.
141  *   - (-ENODEV) if *port* invalid.
142  *   - (-EINVAL) if bad parameter.
143  */
144 int rte_pmd_ixgbe_set_all_queues_drop_en(uint8_t port, uint8_t on);
145
146 /**
147  * set drop enable bit in the VF split rx control register
148  *
149  * @param port
150  *    The port identifier of the Ethernet device.
151  * @param vf
152  *    ID specifying VF.
153  * @param on
154  *    1 - set the drop enable bit in the split rx control register.
155  *    0 - reset the drop enable bit in the split rx control register.
156  *
157  * @return
158  *   - (0) if successful.
159  *   - (-ENODEV) if *port* invalid.
160  *   - (-EINVAL) if bad parameter.
161  */
162
163 int rte_pmd_ixgbe_set_vf_split_drop_en(uint8_t port, uint16_t vf, uint8_t on);
164
165 /**
166  * Enable/Disable vf vlan strip for all queues in a pool
167  *
168  * @param port
169  *    The port identifier of the Ethernet device.
170  * @param vf
171  *    ID specifying VF.
172  * @param on
173  *    1 - Enable VF's vlan strip on RX queues.
174  *    0 - Disable VF's vlan strip on RX queues.
175  *
176  * @return
177  *   - (0) if successful.
178  *   - (-ENOTSUP) if hardware doesn't support this feature.
179  *   - (-ENODEV) if *port* invalid.
180  *   - (-EINVAL) if bad parameter.
181  */
182 int
183 rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
184
185 /**
186  * Response sent back to ixgbe driver from user app after callback
187  */
188 enum rte_pmd_ixgbe_mb_event_rsp {
189         RTE_PMD_IXGBE_MB_EVENT_NOOP_ACK,  /**< skip mbox request and ACK */
190         RTE_PMD_IXGBE_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
191         RTE_PMD_IXGBE_MB_EVENT_PROCEED,  /**< proceed with mbox request  */
192         RTE_PMD_IXGBE_MB_EVENT_MAX       /**< max value of this enum */
193 };
194
195 /**
196  * Data sent to the user application when the callback is executed.
197  */
198 struct rte_pmd_ixgbe_mb_event_param {
199         uint16_t vfid;     /**< Virtual Function number */
200         uint16_t msg_type; /**< VF to PF message type, defined in ixgbe_mbx.h */
201         uint16_t retval;   /**< return value */
202         void *msg;         /**< pointer to message */
203 };
204 #endif /* _PMD_IXGBE_H_ */