net/i40e: set VF MAC from PF
[dpdk.git] / drivers / net / i40e / rte_pmd_i40e.h
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright (c) 2017 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 #ifndef _PMD_I40E_H_
34 #define _PMD_I40E_H_
35
36 /**
37  * @file rte_pmd_i40e.h
38  *
39  * i40e PMD specific functions.
40  *
41  * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
42  *
43  */
44
45 #include <rte_ethdev.h>
46
47 /**
48  * Response sent back to i40e driver from user app after callback
49  */
50 enum rte_pmd_i40e_mb_event_rsp {
51         RTE_PMD_I40E_MB_EVENT_NOOP_ACK,  /**< skip mbox request and ACK */
52         RTE_PMD_I40E_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
53         RTE_PMD_I40E_MB_EVENT_PROCEED,  /**< proceed with mbox request  */
54         RTE_PMD_I40E_MB_EVENT_MAX       /**< max value of this enum */
55 };
56
57 /**
58  * Data sent to the user application when the callback is executed.
59  */
60 struct rte_pmd_i40e_mb_event_param {
61         uint16_t vfid;     /**< Virtual Function number */
62         uint16_t msg_type; /**< VF to PF message type, see i40e_virtchnl_ops */
63         uint16_t retval;   /**< return value */
64         void *msg;         /**< pointer to message */
65         uint16_t msglen;   /**< length of the message */
66 };
67
68 /**
69  * Notify VF when PF link status changes.
70  *
71  * @param port
72  *   The port identifier of the Ethernet device.
73  * @param vf
74  *   VF id.
75  * @return
76  *   - (0) if successful.
77  *   - (-ENODEV) if *port* invalid.
78  *   - (-EINVAL) if *vf* invalid.
79  */
80 int rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf);
81
82 /**
83  * Enable/Disable VF MAC anti spoofing.
84  *
85  * @param port
86  *    The port identifier of the Ethernet device.
87  * @param vf
88  *    VF on which to set MAC anti spoofing.
89  * @param on
90  *    1 - Enable VFs MAC anti spoofing.
91  *    0 - Disable VFs MAC anti spoofing.
92  * @return
93  *   - (0) if successful.
94  *   - (-ENODEV) if *port* invalid.
95  *   - (-EINVAL) if bad parameter.
96  */
97 int rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port,
98                                        uint16_t vf_id,
99                                        uint8_t on);
100
101 /**
102  * Enable/Disable VF VLAN anti spoofing.
103  *
104  * @param port
105  *    The port identifier of the Ethernet device.
106  * @param vf
107  *    VF on which to set VLAN anti spoofing.
108  * @param on
109  *    1 - Enable VFs VLAN anti spoofing.
110  *    0 - Disable VFs VLAN anti spoofing.
111  * @return
112  *   - (0) if successful.
113  *   - (-ENODEV) if *port* invalid.
114  *   - (-EINVAL) if bad parameter.
115  */
116 int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,
117                                         uint16_t vf_id,
118                                         uint8_t on);
119
120 /**
121  * Enable/Disable TX loopback on all the PF and VFs.
122  *
123  * @param port
124  *    The port identifier of the Ethernet device.
125  * @param on
126  *    1 - Enable TX loopback.
127  *    0 - Disable TX loopback.
128  * @return
129  *   - (0) if successful.
130  *   - (-ENODEV) if *port* invalid.
131  *   - (-EINVAL) if bad parameter.
132  */
133 int rte_pmd_i40e_set_tx_loopback(uint8_t port,
134                                  uint8_t on);
135
136 /**
137  * Enable/Disable VF unicast promiscuous mode.
138  *
139  * @param port
140  *    The port identifier of the Ethernet device.
141  * @param vf
142  *    VF on which to set.
143  * @param on
144  *    1 - Enable.
145  *    0 - Disable.
146  * @return
147  *   - (0) if successful.
148  *   - (-ENODEV) if *port* invalid.
149  *   - (-EINVAL) if bad parameter.
150  */
151 int rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port,
152                                         uint16_t vf_id,
153                                         uint8_t on);
154
155 /**
156  * Enable/Disable VF multicast promiscuous mode.
157  *
158  * @param port
159  *    The port identifier of the Ethernet device.
160  * @param vf
161  *    VF on which to set.
162  * @param on
163  *    1 - Enable.
164  *    0 - Disable.
165  * @return
166  *   - (0) if successful.
167  *   - (-ENODEV) if *port* invalid.
168  *   - (-EINVAL) if bad parameter.
169  */
170 int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
171                                           uint16_t vf_id,
172                                           uint8_t on);
173
174 /**
175  * Set the VF MAC address.
176  *
177  * PF should set MAC address before VF initialized, if PF sets the MAC
178  * address after VF initialized, new MAC address won't be effective until
179  * VF reinitialize.
180  *
181  * This will remove all existing MAC filters.
182  *
183  * @param port
184  *   The port identifier of the Ethernet device.
185  * @param vf_id
186  *   VF id.
187  * @param mac_addr
188  *   VF MAC address.
189  * @return
190  *   - (0) if successful.
191  *   - (-ENODEV) if *port* invalid.
192  *   - (-EINVAL) if *vf* or *mac_addr* is invalid.
193  */
194 int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
195                                  struct ether_addr *mac_addr);
196
197 #endif /* _PMD_I40E_H_ */