| 886 | } |
| 887 | |
| 888 | static int |
| 889 | test_macsec(const struct mcs_test_vector *td[], enum mcs_op op, const struct mcs_test_opts *opts) |
| 890 | { |
| 891 | uint16_t rx_sa_id[MCS_MAX_FLOWS][RTE_SECURITY_MACSEC_NUM_AN] = {{0}}; |
| 892 | struct rte_security_capability_idx sec_cap_idx; |
| 893 | const struct rte_security_capability *sec_cap; |
| 894 | uint16_t tx_sa_id[MCS_MAX_FLOWS][2] = {{0}}; |
| 895 | uint16_t rx_sc_id[MCS_MAX_FLOWS] = {0}; |
| 896 | uint16_t tx_sc_id[MCS_MAX_FLOWS] = {0}; |
| 897 | void *rx_sess[MCS_MAX_FLOWS] = {0}; |
| 898 | void *tx_sess[MCS_MAX_FLOWS] = {0}; |
| 899 | struct rte_security_session_conf sess_conf = {0}; |
| 900 | struct rte_security_macsec_sa sa_conf = {0}; |
| 901 | struct rte_security_macsec_sc sc_conf = {0}; |
| 902 | struct mcs_err_vector err_vector = {0}; |
| 903 | void *ctx; |
| 904 | int nb_rx = 0, nb_sent; |
| 905 | int i, j = 0, ret, id, an = 0; |
| 906 | uint8_t tci_off; |
| 907 | int k; |
| 908 | |
| 909 | memset(rx_pkts_burst, 0, sizeof(rx_pkts_burst[0]) * opts->nb_td); |
| 910 | |
| 911 | ctx = rte_eth_dev_get_sec_ctx(port_id); |
| 912 | if (ctx == NULL) { |
| 913 | printf("Ethernet device doesn't support security features.\n"); |
| 914 | return TEST_SKIPPED; |
| 915 | } |
| 916 | |
| 917 | sec_cap_idx.action = RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL; |
| 918 | sec_cap_idx.protocol = RTE_SECURITY_PROTOCOL_MACSEC; |
| 919 | sec_cap_idx.macsec.alg = td[0]->alg; |
| 920 | sec_cap = rte_security_capability_get(ctx, &sec_cap_idx); |
| 921 | if (sec_cap == NULL) { |
| 922 | printf("No capabilities registered\n"); |
| 923 | return TEST_SKIPPED; |
| 924 | } |
| 925 | |
| 926 | if (test_macsec_sec_caps_verify(opts, sec_cap, false) != 0) |
| 927 | return TEST_SKIPPED; |
| 928 | |
| 929 | if (opts->rekey_en) { |
| 930 | /* Verify the rekey td */ |
| 931 | sec_cap_idx.macsec.alg = opts->rekey_td->alg; |
| 932 | sec_cap = rte_security_capability_get(ctx, &sec_cap_idx); |
| 933 | if (sec_cap == NULL) { |
| 934 | printf("No capabilities registered\n"); |
| 935 | return TEST_SKIPPED; |
| 936 | } |
| 937 | if (test_macsec_sec_caps_verify(opts, sec_cap, false) != 0) |
| 938 | return TEST_SKIPPED; |
| 939 | } |
| 940 | |
| 941 | tci_off = (opts->sectag_insert_mode == 1) ? RTE_ETHER_HDR_LEN : |
| 942 | RTE_ETHER_HDR_LEN + (opts->nb_vlan * RTE_VLAN_HLEN); |
| 943 | |
| 944 | for (i = 0, j = 0; i < opts->nb_td; i++) { |
| 945 | if (op == MCS_DECAP || op == MCS_VERIFY_ONLY) |
no test coverage detected