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 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 RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); 18 19 dev = &rte_eth_devices[port]; 20 21 if (!is_atlantic_supported(dev)) 22 return -ENOTSUP; 23 24 return atl_macsec_enable(dev, encr, repl_prot); 25 } 26 27 int 28 rte_pmd_atl_macsec_disable(uint16_t port) 29 { 30 struct rte_eth_dev *dev; 31 32 RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); 33 34 dev = &rte_eth_devices[port]; 35 36 if (!is_atlantic_supported(dev)) 37 return -ENOTSUP; 38 39 return atl_macsec_disable(dev); 40 } 41 42 int 43 rte_pmd_atl_macsec_config_txsc(uint16_t port, uint8_t *mac) 44 { 45 struct rte_eth_dev *dev; 46 47 RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); 48 49 dev = &rte_eth_devices[port]; 50 51 if (!is_atlantic_supported(dev)) 52 return -ENOTSUP; 53 54 return atl_macsec_config_txsc(dev, mac); 55 } 56 57 int 58 rte_pmd_atl_macsec_config_rxsc(uint16_t port, uint8_t *mac, uint16_t pi) 59 { 60 struct rte_eth_dev *dev; 61 62 RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); 63 64 dev = &rte_eth_devices[port]; 65 66 if (!is_atlantic_supported(dev)) 67 return -ENOTSUP; 68 69 return atl_macsec_config_rxsc(dev, mac, pi); 70 } 71 72 int 73 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 RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); 79 80 dev = &rte_eth_devices[port]; 81 82 if (!is_atlantic_supported(dev)) 83 return -ENOTSUP; 84 85 return atl_macsec_select_txsa(dev, idx, an, pn, key); 86 } 87 88 int 89 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 RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); 95 96 dev = &rte_eth_devices[port]; 97 98 if (!is_atlantic_supported(dev)) 99 return -ENOTSUP; 100 101 return atl_macsec_select_rxsa(dev, idx, an, pn, key); 102 } 103