Lines Matching refs:rx_sc
54 for (sc = rcu_dereference_bh(secy->rx_sc); \
58 for (sc = rtnl_dereference(secy->rx_sc); \
154 static struct macsec_rx_sa *macsec_active_rxsa_get(struct macsec_rx_sc *rx_sc) in macsec_active_rxsa_get() argument
160 sa = macsec_rxsa_get(rx_sc->sa[an]); in macsec_active_rxsa_get()
169 struct macsec_rx_sc *rx_sc = container_of(head, struct macsec_rx_sc, rcu_head); in free_rx_sc_rcu() local
171 free_percpu(rx_sc->stats); in free_rx_sc_rcu()
172 kfree(rx_sc); in free_rx_sc_rcu()
844 struct macsec_rx_sc *rx_sc = rx_sa->sc; in macsec_decrypt_done() local
873 macsec_rxsc_put(rx_sc); in macsec_decrypt_done()
980 struct macsec_rx_sc *rx_sc; in find_rx_sc() local
982 for_each_rxsc(secy, rx_sc) { in find_rx_sc()
983 if (rx_sc->sci == sci) in find_rx_sc()
984 return rx_sc; in find_rx_sc()
992 struct macsec_rx_sc *rx_sc; in find_rx_sc_rtnl() local
994 for_each_rxsc_rtnl(secy, rx_sc) { in find_rx_sc_rtnl()
995 if (rx_sc->sci == sci) in find_rx_sc_rtnl()
996 return rx_sc; in find_rx_sc_rtnl()
1091 struct macsec_rx_sc *rx_sc; in macsec_handle_frame() local
1155 rx_sc = sc; in macsec_handle_frame()
1166 rxsc_stats = this_cpu_ptr(rx_sc->stats); in macsec_handle_frame()
1176 rx_sa = macsec_rxsa_get(rx_sc->sa[macsec_skb_cb(skb)->assoc_num]); in macsec_handle_frame()
1183 struct macsec_rx_sa *active_rx_sa = macsec_active_rxsa_get(rx_sc); in macsec_handle_frame()
1239 macsec_rxsc_put(rx_sc); in macsec_handle_frame()
1257 macsec_rxsc_put(rx_sc); in macsec_handle_frame()
1274 macsec_rxsc_put(rx_sc); in macsec_handle_frame()
1383 static void free_rx_sc(struct macsec_rx_sc *rx_sc) in free_rx_sc() argument
1388 struct macsec_rx_sa *sa = rtnl_dereference(rx_sc->sa[i]); in free_rx_sc()
1390 RCU_INIT_POINTER(rx_sc->sa[i], NULL); in free_rx_sc()
1395 macsec_rxsc_put(rx_sc); in free_rx_sc()
1400 struct macsec_rx_sc *rx_sc, __rcu **rx_scp; in del_rx_sc() local
1402 for (rx_scp = &secy->rx_sc, rx_sc = rtnl_dereference(*rx_scp); in del_rx_sc()
1403 rx_sc; in del_rx_sc()
1404 rx_scp = &rx_sc->next, rx_sc = rtnl_dereference(*rx_scp)) { in del_rx_sc()
1405 if (rx_sc->sci == sci) { in del_rx_sc()
1406 if (rx_sc->active) in del_rx_sc()
1408 rcu_assign_pointer(*rx_scp, rx_sc->next); in del_rx_sc()
1409 return rx_sc; in del_rx_sc()
1419 struct macsec_rx_sc *rx_sc; in create_rx_sc() local
1430 rx_sc = kzalloc(sizeof(*rx_sc), GFP_KERNEL); in create_rx_sc()
1431 if (!rx_sc) in create_rx_sc()
1434 rx_sc->stats = netdev_alloc_pcpu_stats(struct pcpu_rx_sc_stats); in create_rx_sc()
1435 if (!rx_sc->stats) { in create_rx_sc()
1436 kfree(rx_sc); in create_rx_sc()
1440 rx_sc->sci = sci; in create_rx_sc()
1441 rx_sc->active = active; in create_rx_sc()
1442 refcount_set(&rx_sc->refcnt, 1); in create_rx_sc()
1445 rcu_assign_pointer(rx_sc->next, secy->rx_sc); in create_rx_sc()
1446 rcu_assign_pointer(secy->rx_sc, rx_sc); in create_rx_sc()
1448 if (rx_sc->active) in create_rx_sc()
1451 return rx_sc; in create_rx_sc()
1572 struct macsec_rx_sc *rx_sc; in get_rxsc_from_nl() local
1585 rx_sc = find_rx_sc_rtnl(secy, sci); in get_rxsc_from_nl()
1586 if (!rx_sc) in get_rxsc_from_nl()
1592 return rx_sc; in get_rxsc_from_nl()
1604 struct macsec_rx_sc *rx_sc; in get_rxsa_from_nl() local
1614 rx_sc = get_rxsc_from_nl(net, attrs, tb_rxsc, devp, secyp); in get_rxsa_from_nl()
1615 if (IS_ERR(rx_sc)) in get_rxsa_from_nl()
1616 return ERR_CAST(rx_sc); in get_rxsa_from_nl()
1618 rx_sa = rtnl_dereference(rx_sc->sa[*assoc_num]); in get_rxsa_from_nl()
1622 *scp = rx_sc; in get_rxsa_from_nl()
1727 struct macsec_rx_sc *rx_sc; in macsec_add_rxsa() local
1748 rx_sc = get_rxsc_from_nl(genl_info_net(info), attrs, tb_rxsc, &dev, &secy); in macsec_add_rxsa()
1749 if (IS_ERR(rx_sc)) { in macsec_add_rxsa()
1751 return PTR_ERR(rx_sc); in macsec_add_rxsa()
1787 rx_sa = rtnl_dereference(rx_sc->sa[assoc_num]); in macsec_add_rxsa()
1816 rx_sa->sc = rx_sc; in macsec_add_rxsa()
1848 rcu_assign_pointer(rx_sc->sa[assoc_num], rx_sa); in macsec_add_rxsa()
1878 struct macsec_rx_sc *rx_sc; in macsec_add_rxsc() local
1906 rx_sc = create_rx_sc(dev, sci, active); in macsec_add_rxsc()
1907 if (IS_ERR(rx_sc)) { in macsec_add_rxsc()
1909 return PTR_ERR(rx_sc); in macsec_add_rxsc()
1922 ctx.rx_sc = rx_sc; in macsec_add_rxsc()
1936 free_rx_sc(rx_sc); in macsec_add_rxsc()
2109 struct macsec_rx_sc *rx_sc; in macsec_del_rxsa() local
2127 &dev, &secy, &rx_sc, &assoc_num); in macsec_del_rxsa()
2158 RCU_INIT_POINTER(rx_sc->sa[assoc_num], NULL); in macsec_del_rxsa()
2175 struct macsec_rx_sc *rx_sc; in macsec_del_rxsc() local
2199 rx_sc = del_rx_sc(secy, sci); in macsec_del_rxsc()
2200 if (!rx_sc) { in macsec_del_rxsc()
2216 ctx.rx_sc = rx_sc; in macsec_del_rxsc()
2223 free_rx_sc(rx_sc); in macsec_del_rxsc()
2416 struct macsec_rx_sc *rx_sc; in macsec_upd_rxsa() local
2441 &dev, &secy, &rx_sc, &assoc_num); in macsec_upd_rxsa()
2507 struct macsec_rx_sc *rx_sc; in macsec_upd_rxsc() local
2523 rx_sc = get_rxsc_from_nl(genl_info_net(info), attrs, tb_rxsc, &dev, &secy); in macsec_upd_rxsc()
2524 if (IS_ERR(rx_sc)) { in macsec_upd_rxsc()
2526 return PTR_ERR(rx_sc); in macsec_upd_rxsc()
2529 was_active = rx_sc->active; in macsec_upd_rxsc()
2534 if (rx_sc->active != new) in macsec_upd_rxsc()
2537 rx_sc->active = new; in macsec_upd_rxsc()
2551 ctx.rx_sc = rx_sc; in macsec_upd_rxsc()
2565 rx_sc->active = was_active; in macsec_upd_rxsc()
2576 if (secy->rx_sc) in macsec_is_configured()
2722 struct macsec_rx_sc *rx_sc, int an, in get_rx_sa_stats() argument
2740 ctx.rx_sc = rx_sc; in get_rx_sa_stats()
2776 struct macsec_rx_sc *rx_sc, in get_rx_sc_stats() argument
2791 ctx.rx_sc = rx_sc; in get_rx_sc_stats()
2802 stats = per_cpu_ptr(rx_sc->stats, cpu); in get_rx_sc_stats()
3049 struct macsec_rx_sc *rx_sc; in dump_secy() local
3156 for_each_rxsc_rtnl(secy, rx_sc) { in dump_secy()
3166 if (nla_put_u8(skb, MACSEC_RXSC_ATTR_ACTIVE, rx_sc->active) || in dump_secy()
3167 nla_put_sci(skb, MACSEC_RXSC_ATTR_SCI, rx_sc->sci, in dump_secy()
3181 get_rx_sc_stats(dev, rx_sc, &rx_sc_stats); in dump_secy()
3199 struct macsec_rx_sa *rx_sa = rtnl_dereference(rx_sc->sa[i]); in dump_secy()
3224 get_rx_sa_stats(dev, rx_sc, i, rx_sa, &rx_sa_stats); in dump_secy()
3873 while (macsec->secy.rx_sc) { in macsec_del_dev()
3874 struct macsec_rx_sc *rx_sc = rtnl_dereference(macsec->secy.rx_sc); in macsec_del_dev() local
3876 rcu_assign_pointer(macsec->secy.rx_sc, rx_sc->next); in macsec_del_dev()
3877 free_rx_sc(rx_sc); in macsec_del_dev()