Lines Matching refs:secy

46 						 struct macsec_secy *secy)  in cn10k_mcs_get_txsc()  argument
51 if (txsc->sw_secy == secy) in cn10k_mcs_get_txsc()
59 struct macsec_secy *secy, in cn10k_mcs_get_rxsc() argument
65 if (rxsc->sw_rxsc == rx_sc && rxsc->sw_secy == secy) in cn10k_mcs_get_rxsc()
200 struct macsec_secy *secy, u8 hw_secy_id) in cn10k_mcs_write_rx_secy() argument
215 policy = FIELD_PREP(MCS_RX_SECY_PLCY_RW_MASK, secy->replay_window); in cn10k_mcs_write_rx_secy()
216 if (secy->replay_protect) in cn10k_mcs_write_rx_secy()
221 policy |= FIELD_PREP(MCS_RX_SECY_PLCY_VAL, secy->validate_frames); in cn10k_mcs_write_rx_secy()
303 struct macsec_secy *secy, in cn10k_mcs_write_rx_sa_plcy() argument
329 for (reg = 0, key_len = 0; key_len < secy->key_len; key_len += 8) { in cn10k_mcs_write_rx_sa_plcy()
380 struct macsec_secy *secy, in cn10k_mcs_write_tx_secy() argument
392 sw_tx_sc = &secy->tx_sc; in cn10k_mcs_write_tx_secy()
414 policy = FIELD_PREP(MCS_TX_SECY_PLCY_MTU, secy->netdev->mtu); in cn10k_mcs_write_tx_secy()
422 if (secy->protect_frames) in cn10k_mcs_write_tx_secy()
429 if (!secy->protect_frames || secy->operational) in cn10k_mcs_write_tx_secy()
444 struct macsec_secy *secy, in cn10k_mcs_write_tx_flowid() argument
460 mac_sa = ether_addr_to_u64(secy->netdev->dev_addr); in cn10k_mcs_write_tx_flowid()
477 req->sci = (__force u64)cpu_to_be64((__force u64)secy->sci); in cn10k_mcs_write_tx_flowid()
490 struct macsec_secy *secy, in cn10k_mcs_link_tx_sa2sc() argument
513 map_req->sectag_sci = (__force u64)cpu_to_be64((__force u64)secy->sci); in cn10k_mcs_link_tx_sa2sc()
524 struct macsec_secy *secy, in cn10k_mcs_write_tx_sa_plcy() argument
542 for (reg = 0, key_len = 0; key_len < secy->key_len; key_len += 8) { in cn10k_mcs_write_tx_sa_plcy()
902 static int cn10k_mcs_secy_tx_cfg(struct otx2_nic *pfvf, struct macsec_secy *secy, in cn10k_mcs_secy_tx_cfg() argument
907 cn10k_mcs_write_tx_sa_plcy(pfvf, secy, txsc, sa_num); in cn10k_mcs_secy_tx_cfg()
910 cn10k_mcs_link_tx_sa2sc(pfvf, secy, txsc, sa_num, in cn10k_mcs_secy_tx_cfg()
914 cn10k_mcs_write_tx_secy(pfvf, secy, txsc); in cn10k_mcs_secy_tx_cfg()
915 cn10k_mcs_write_tx_flowid(pfvf, secy, txsc); in cn10k_mcs_secy_tx_cfg()
917 cn10k_mcs_write_rx_secy(pfvf, secy, txsc->hw_secy_id_rx); in cn10k_mcs_secy_tx_cfg()
923 struct macsec_secy *secy, u8 hw_secy_id) in cn10k_mcs_secy_rx_cfg() argument
931 for (sw_rx_sc = rcu_dereference_bh(secy->rx_sc); sw_rx_sc && sw_rx_sc->active; in cn10k_mcs_secy_rx_cfg()
933 mcs_rx_sc = cn10k_mcs_get_rxsc(cfg, secy, sw_rx_sc); in cn10k_mcs_secy_rx_cfg()
942 cn10k_mcs_write_rx_sa_plcy(pfvf, secy, mcs_rx_sc, in cn10k_mcs_secy_rx_cfg()
956 struct macsec_secy *secy, in cn10k_mcs_disable_rxscs() argument
964 for (sw_rx_sc = rcu_dereference_bh(secy->rx_sc); sw_rx_sc && sw_rx_sc->active; in cn10k_mcs_disable_rxscs()
966 mcs_rx_sc = cn10k_mcs_get_rxsc(cfg, secy, sw_rx_sc); in cn10k_mcs_disable_rxscs()
985 static void cn10k_mcs_sync_stats(struct otx2_nic *pfvf, struct macsec_secy *secy, in cn10k_mcs_sync_stats() argument
999 if (secy->validate_frames == txsc->last_validate_frames && in cn10k_mcs_sync_stats()
1000 secy->protect_frames == txsc->last_protect_frames) in cn10k_mcs_sync_stats()
1033 txsc->last_validate_frames = secy->validate_frames; in cn10k_mcs_sync_stats()
1034 txsc->last_protect_frames = secy->protect_frames; in cn10k_mcs_sync_stats()
1041 struct macsec_secy *secy = ctx->secy; in cn10k_mdo_open() local
1047 txsc = cn10k_mcs_get_txsc(cfg, ctx->secy); in cn10k_mdo_open()
1052 sw_tx_sa = rcu_dereference_bh(secy->tx_sc.sa[sa_num]); in cn10k_mdo_open()
1054 err = cn10k_mcs_secy_tx_cfg(pfvf, secy, txsc, sw_tx_sa, sa_num); in cn10k_mdo_open()
1058 return cn10k_mcs_secy_rx_cfg(pfvf, secy, txsc->hw_secy_id_rx); in cn10k_mdo_open()
1068 txsc = cn10k_mcs_get_txsc(cfg, ctx->secy); in cn10k_mdo_stop()
1076 return cn10k_mcs_disable_rxscs(pfvf, ctx->secy, false); in cn10k_mdo_stop()
1083 struct macsec_secy *secy = ctx->secy; in cn10k_mdo_add_secy() local
1086 if (secy->icv_len != MACSEC_DEFAULT_ICV_LEN) in cn10k_mdo_add_secy()
1090 if (secy->key_len != 16) in cn10k_mdo_add_secy()
1093 if (secy->xpn) in cn10k_mdo_add_secy()
1100 txsc->sw_secy = secy; in cn10k_mdo_add_secy()
1101 txsc->encoding_sa = secy->tx_sc.encoding_sa; in cn10k_mdo_add_secy()
1102 txsc->last_validate_frames = secy->validate_frames; in cn10k_mdo_add_secy()
1103 txsc->last_protect_frames = secy->protect_frames; in cn10k_mdo_add_secy()
1107 if (netif_running(secy->netdev)) in cn10k_mdo_add_secy()
1108 return cn10k_mcs_secy_tx_cfg(pfvf, secy, txsc, NULL, 0); in cn10k_mdo_add_secy()
1117 struct macsec_secy *secy = ctx->secy; in cn10k_mdo_upd_secy() local
1123 txsc = cn10k_mcs_get_txsc(cfg, secy); in cn10k_mdo_upd_secy()
1127 txsc->encoding_sa = secy->tx_sc.encoding_sa; in cn10k_mdo_upd_secy()
1130 sw_tx_sa = rcu_dereference_bh(secy->tx_sc.sa[sa_num]); in cn10k_mdo_upd_secy()
1132 if (netif_running(secy->netdev)) { in cn10k_mdo_upd_secy()
1133 cn10k_mcs_sync_stats(pfvf, secy, txsc); in cn10k_mdo_upd_secy()
1135 err = cn10k_mcs_secy_tx_cfg(pfvf, secy, txsc, sw_tx_sa, sa_num); in cn10k_mdo_upd_secy()
1149 txsc = cn10k_mcs_get_txsc(cfg, ctx->secy); in cn10k_mdo_del_secy()
1154 cn10k_mcs_disable_rxscs(pfvf, ctx->secy, true); in cn10k_mdo_del_secy()
1167 struct macsec_secy *secy = ctx->secy; in cn10k_mdo_add_txsa() local
1172 txsc = cn10k_mcs_get_txsc(cfg, secy); in cn10k_mdo_add_txsa()
1182 memcpy(&txsc->sa_key[sa_num], ctx->sa.key, secy->key_len); in cn10k_mdo_add_txsa()
1185 if (netif_running(secy->netdev)) { in cn10k_mdo_add_txsa()
1186 err = cn10k_mcs_write_tx_sa_plcy(pfvf, secy, txsc, sa_num); in cn10k_mdo_add_txsa()
1195 err = cn10k_mcs_link_tx_sa2sc(pfvf, secy, txsc, in cn10k_mdo_add_txsa()
1209 struct macsec_secy *secy = ctx->secy; in cn10k_mdo_upd_txsa() local
1214 txsc = cn10k_mcs_get_txsc(cfg, secy); in cn10k_mdo_upd_txsa()
1221 if (netif_running(secy->netdev)) { in cn10k_mdo_upd_txsa()
1228 err = cn10k_mcs_link_tx_sa2sc(pfvf, secy, txsc, in cn10k_mdo_upd_txsa()
1244 txsc = cn10k_mcs_get_txsc(cfg, ctx->secy); in cn10k_mdo_del_txsa()
1261 struct macsec_secy *secy = ctx->secy; in cn10k_mdo_add_rxsc() local
1266 txsc = cn10k_mcs_get_txsc(cfg, secy); in cn10k_mdo_add_rxsc()
1274 rxsc->sw_secy = ctx->secy; in cn10k_mdo_add_rxsc()
1278 if (netif_running(secy->netdev)) { in cn10k_mdo_add_rxsc()
1295 struct macsec_secy *secy = ctx->secy; in cn10k_mdo_upd_rxsc() local
1299 rxsc = cn10k_mcs_get_rxsc(cfg, secy, ctx->rx_sc); in cn10k_mdo_upd_rxsc()
1303 if (netif_running(secy->netdev)) in cn10k_mdo_upd_rxsc()
1316 rxsc = cn10k_mcs_get_rxsc(cfg, ctx->secy, ctx->rx_sc); in cn10k_mdo_del_rxsc()
1335 struct macsec_secy *secy = ctx->secy; in cn10k_mdo_add_rxsa() local
1341 rxsc = cn10k_mcs_get_rxsc(cfg, secy, sw_rx_sc); in cn10k_mdo_add_rxsa()
1351 memcpy(&rxsc->sa_key[sa_num], ctx->sa.key, ctx->secy->key_len); in cn10k_mdo_add_rxsa()
1354 if (netif_running(secy->netdev)) { in cn10k_mdo_add_rxsa()
1355 err = cn10k_mcs_write_rx_sa_plcy(pfvf, secy, rxsc, in cn10k_mdo_add_rxsa()
1375 struct macsec_secy *secy = ctx->secy; in cn10k_mdo_upd_rxsa() local
1381 rxsc = cn10k_mcs_get_rxsc(cfg, secy, sw_rx_sc); in cn10k_mdo_upd_rxsa()
1388 if (netif_running(secy->netdev)) { in cn10k_mdo_upd_rxsa()
1389 err = cn10k_mcs_write_rx_sa_plcy(pfvf, secy, rxsc, sa_num, sa_in_use); in cn10k_mdo_upd_rxsa()
1409 rxsc = cn10k_mcs_get_rxsc(cfg, ctx->secy, sw_rx_sc); in cn10k_mdo_del_rxsa()
1416 cn10k_mcs_write_rx_sa_plcy(pfvf, ctx->secy, rxsc, sa_num, false); in cn10k_mdo_del_rxsa()
1429 struct macsec_secy *secy = ctx->secy; in cn10k_mdo_get_dev_stats() local
1432 txsc = cn10k_mcs_get_txsc(cfg, ctx->secy); in cn10k_mdo_get_dev_stats()
1444 if (secy->validate_frames == MACSEC_VALIDATE_STRICT) in cn10k_mdo_get_dev_stats()
1467 txsc = cn10k_mcs_get_txsc(cfg, ctx->secy); in cn10k_mdo_get_tx_sc_stats()
1489 txsc = cn10k_mcs_get_txsc(cfg, ctx->secy); in cn10k_mdo_get_tx_sa_stats()
1508 struct macsec_secy *secy = ctx->secy; in cn10k_mdo_get_rx_sc_stats() local
1512 rxsc = cn10k_mcs_get_rxsc(cfg, secy, ctx->rx_sc); in cn10k_mdo_get_rx_sc_stats()
1524 if (secy->protect_frames) in cn10k_mdo_get_rx_sc_stats()
1529 if (secy->validate_frames == MACSEC_VALIDATE_CHECK) in cn10k_mdo_get_rx_sc_stats()
1555 rxsc = cn10k_mcs_get_rxsc(cfg, ctx->secy, sw_rx_sc); in cn10k_mdo_get_rx_sa_stats()
1599 struct macsec_secy *secy = NULL; in cn10k_handle_mcs_event() local
1613 secy = txsc->sw_secy; in cn10k_handle_mcs_event()
1614 sw_tx_sa = rcu_dereference_bh(secy->tx_sc.sa[an]); in cn10k_handle_mcs_event()
1618 if (secy && sw_tx_sa) in cn10k_handle_mcs_event()
1619 macsec_pn_wrapped(secy, sw_tx_sa); in cn10k_handle_mcs_event()