net/i40e: set VF MAC anti-spoofing 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 #endif /* _PMD_I40E_H_ */