Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright(c) 2018 Aquantia Corporation
3 : : */
4 : :
5 : : #include <ethdev_driver.h>
6 : :
7 : : #include "rte_pmd_atlantic.h"
8 : : #include "atl_ethdev.h"
9 : :
10 : :
11 : : int
12 : 0 : rte_pmd_atl_macsec_enable(uint16_t port,
13 : : uint8_t encr, uint8_t repl_prot)
14 : : {
15 : : struct rte_eth_dev *dev;
16 : :
17 [ # # ]: 0 : RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
18 : :
19 : 0 : dev = &rte_eth_devices[port];
20 : :
21 [ # # ]: 0 : if (!is_atlantic_supported(dev))
22 : : return -ENOTSUP;
23 : :
24 : 0 : return atl_macsec_enable(dev, encr, repl_prot);
25 : : }
26 : :
27 : : int
28 : 0 : rte_pmd_atl_macsec_disable(uint16_t port)
29 : : {
30 : : struct rte_eth_dev *dev;
31 : :
32 [ # # ]: 0 : RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
33 : :
34 : 0 : dev = &rte_eth_devices[port];
35 : :
36 [ # # ]: 0 : if (!is_atlantic_supported(dev))
37 : : return -ENOTSUP;
38 : :
39 : 0 : return atl_macsec_disable(dev);
40 : : }
41 : :
42 : : int
43 : 0 : rte_pmd_atl_macsec_config_txsc(uint16_t port, uint8_t *mac)
44 : : {
45 : : struct rte_eth_dev *dev;
46 : :
47 [ # # ]: 0 : RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
48 : :
49 : 0 : dev = &rte_eth_devices[port];
50 : :
51 [ # # ]: 0 : if (!is_atlantic_supported(dev))
52 : : return -ENOTSUP;
53 : :
54 : 0 : return atl_macsec_config_txsc(dev, mac);
55 : : }
56 : :
57 : : int
58 : 0 : rte_pmd_atl_macsec_config_rxsc(uint16_t port, uint8_t *mac, uint16_t pi)
59 : : {
60 : : struct rte_eth_dev *dev;
61 : :
62 [ # # ]: 0 : RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
63 : :
64 : 0 : dev = &rte_eth_devices[port];
65 : :
66 [ # # ]: 0 : if (!is_atlantic_supported(dev))
67 : : return -ENOTSUP;
68 : :
69 : 0 : return atl_macsec_config_rxsc(dev, mac, pi);
70 : : }
71 : :
72 : : int
73 : 0 : rte_pmd_atl_macsec_select_txsa(uint16_t port, uint8_t idx, uint8_t an,
74 : : uint32_t pn, uint8_t *key)
75 : : {
76 : : struct rte_eth_dev *dev;
77 : :
78 [ # # ]: 0 : RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
79 : :
80 : 0 : dev = &rte_eth_devices[port];
81 : :
82 [ # # ]: 0 : if (!is_atlantic_supported(dev))
83 : : return -ENOTSUP;
84 : :
85 : 0 : return atl_macsec_select_txsa(dev, idx, an, pn, key);
86 : : }
87 : :
88 : : int
89 : 0 : rte_pmd_atl_macsec_select_rxsa(uint16_t port, uint8_t idx, uint8_t an,
90 : : uint32_t pn, uint8_t *key)
91 : : {
92 : : struct rte_eth_dev *dev;
93 : :
94 [ # # ]: 0 : RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
95 : :
96 : 0 : dev = &rte_eth_devices[port];
97 : :
98 [ # # ]: 0 : if (!is_atlantic_supported(dev))
99 : : return -ENOTSUP;
100 : :
101 : 0 : return atl_macsec_select_rxsa(dev, idx, an, pn, key);
102 : : }
|