net/atlantic: enable MACsec configuration
[dpdk.git] / drivers / net / atlantic / rte_pmd_atlantic.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Aquantia Corporation
3  */
4
5 /**
6  * @file rte_pmd_atlantic.h
7  * atlantic PMD specific functions.
8  *
9  **/
10
11 #ifndef _PMD_ATLANTIC_H_
12 #define _PMD_ATLANTIC_H_
13
14 #include <rte_ethdev_driver.h>
15
16 /**
17  * Enable MACsec offload.
18  *
19  * @param port
20  *   The port identifier of the Ethernet device.
21  * @param encr
22  *    1 - Enable encryption (encrypt and add integrity signature).
23  *    0 - Disable encryption (only add integrity signature).
24  * @param repl_prot
25  *    1 - Enable replay protection.
26  *    0 - Disable replay protection.
27  * @return
28  *   - (0) if successful.
29  *   - (-ENODEV) if *port* invalid.
30  *   - (-ENOTSUP) if hardware doesn't support this feature.
31  */
32 int rte_pmd_atl_macsec_enable(uint16_t port, uint8_t encr, uint8_t repl_prot);
33
34 /**
35  * Disable MACsec offload.
36  *
37  * @param port
38  *   The port identifier of the Ethernet device.
39  * @return
40  *   - (0) if successful.
41  *   - (-ENODEV) if *port* invalid.
42  *   - (-ENOTSUP) if hardware doesn't support this feature.
43  */
44 int rte_pmd_atl_macsec_disable(uint16_t port);
45
46 /**
47  * Configure Tx SC (Secure Connection).
48  *
49  * @param port
50  *   The port identifier of the Ethernet device.
51  * @param mac
52  *   The MAC address on the local side.
53  * @return
54  *   - (0) if successful.
55  *   - (-ENODEV) if *port* invalid.
56  *   - (-ENOTSUP) if hardware doesn't support this feature.
57  */
58 int rte_pmd_atl_macsec_config_txsc(uint16_t port, uint8_t *mac);
59
60 /**
61  * Configure Rx SC (Secure Connection).
62  *
63  * @param port
64  *   The port identifier of the Ethernet device.
65  * @param mac
66  *   The MAC address on the remote side.
67  * @param pi
68  *   The PI (port identifier) on the remote side.
69  * @return
70  *   - (0) if successful.
71  *   - (-ENODEV) if *port* invalid.
72  *   - (-ENOTSUP) if hardware doesn't support this feature.
73  */
74 int rte_pmd_atl_macsec_config_rxsc(uint16_t port, uint8_t *mac, uint16_t pi);
75
76 /**
77  * Enable Tx SA (Secure Association).
78  *
79  * @param port
80  *   The port identifier of the Ethernet device.
81  * @param idx
82  *   The SA to be enabled (0 or 1).
83  * @param an
84  *   The association number on the local side.
85  * @param pn
86  *   The packet number on the local side.
87  * @param key
88  *   The key on the local side.
89  * @return
90  *   - (0) if successful.
91  *   - (-ENODEV) if *port* invalid.
92  *   - (-ENOTSUP) if hardware doesn't support this feature.
93  *   - (-EINVAL) if bad parameter.
94  */
95 int rte_pmd_atl_macsec_select_txsa(uint16_t port, uint8_t idx, uint8_t an,
96                                    uint32_t pn, uint8_t *key);
97
98 /**
99  * Enable Rx SA (Secure Association).
100  *
101  * @param port
102  *   The port identifier of the Ethernet device.
103  * @param idx
104  *   The SA to be enabled (0 or 1)
105  * @param an
106  *   The association number on the remote side.
107  * @param pn
108  *   The packet number on the remote side.
109  * @param key
110  *   The key on the remote side.
111  * @return
112  *   - (0) if successful.
113  *   - (-ENODEV) if *port* invalid.
114  *   - (-ENOTSUP) if hardware doesn't support this feature.
115  *   - (-EINVAL) if bad parameter.
116  */
117 int rte_pmd_atl_macsec_select_rxsa(uint16_t port, uint8_t idx, uint8_t an,
118                                    uint32_t pn, uint8_t *key);
119
120 #endif /* _PMD_ATLANTIC_H_ */