Lines Matching full:flow
371 struct macsec_flow *flow) in vsc8584_macsec_flow() argument
374 enum macsec_bank bank = flow->bank; in vsc8584_macsec_flow()
375 u32 val, match = 0, mask = 0, action = 0, idx = flow->index; in vsc8584_macsec_flow()
377 if (flow->match.tagged) in vsc8584_macsec_flow()
379 if (flow->match.untagged) in vsc8584_macsec_flow()
382 if (bank == MACSEC_INGR && flow->assoc_num >= 0) { in vsc8584_macsec_flow()
383 match |= MSCC_MS_SAM_MISC_MATCH_AN(flow->assoc_num); in vsc8584_macsec_flow()
387 if (bank == MACSEC_INGR && flow->match.sci && flow->rx_sa->sc->sci) { in vsc8584_macsec_flow()
388 u64 sci = (__force u64)flow->rx_sa->sc->sci; in vsc8584_macsec_flow()
400 if (flow->match.etype) { in vsc8584_macsec_flow()
404 MSCC_MS_SAM_MAC_SA_MATCH_HI_ETYPE((__force u32)htons(flow->etype))); in vsc8584_macsec_flow()
407 match |= MSCC_MS_SAM_MISC_MATCH_PRIORITY(flow->priority); in vsc8584_macsec_flow()
413 if (flow->action.drop) in vsc8584_macsec_flow()
415 else if (flow->action.bypass || flow->port == MSCC_MS_PORT_UNCONTROLLED) in vsc8584_macsec_flow()
423 MSCC_MS_SAM_FLOW_CTRL_DEST_PORT(flow->port); in vsc8584_macsec_flow()
462 struct macsec_flow *flow) in vsc8584_macsec_flow_enable() argument
464 enum macsec_bank bank = flow->bank; in vsc8584_macsec_flow_enable()
465 u32 val, idx = flow->index; in vsc8584_macsec_flow_enable()
467 if ((flow->bank == MACSEC_INGR && flow->rx_sa && !flow->rx_sa->active) || in vsc8584_macsec_flow_enable()
468 (flow->bank == MACSEC_EGR && flow->tx_sa && !flow->tx_sa->active)) in vsc8584_macsec_flow_enable()
481 struct macsec_flow *flow) in vsc8584_macsec_flow_disable() argument
483 enum macsec_bank bank = flow->bank; in vsc8584_macsec_flow_disable()
484 u32 val, idx = flow->index; in vsc8584_macsec_flow_disable()
495 static u32 vsc8584_macsec_flow_context_id(struct macsec_flow *flow) in vsc8584_macsec_flow_context_id() argument
497 if (flow->bank == MACSEC_INGR) in vsc8584_macsec_flow_context_id()
498 return flow->index + MSCC_MS_MAX_FLOWS; in vsc8584_macsec_flow_context_id()
500 return flow->index; in vsc8584_macsec_flow_context_id()
521 struct macsec_flow *flow) in vsc8584_macsec_transformation() argument
524 enum macsec_bank bank = flow->bank; in vsc8584_macsec_transformation()
525 int i, ret, index = flow->index; in vsc8584_macsec_transformation()
530 ret = vsc8584_macsec_derive_key(flow->key, priv->secy->key_len, hkey); in vsc8584_macsec_transformation()
560 vsc8584_macsec_flow_context_id(flow)); in vsc8584_macsec_transformation()
566 ((u32 *)flow->key)[i]); in vsc8584_macsec_transformation()
577 flow->rx_sa->next_pn : flow->tx_sa->next_pn); in vsc8584_macsec_transformation()
586 sci = (__force u64)(bank == MACSEC_INGR ? flow->rx_sa->sc->sci : priv->secy->sci); in vsc8584_macsec_transformation()
596 flow->has_transformation = true; in vsc8584_macsec_transformation()
605 struct macsec_flow *flow; in vsc8584_macsec_alloc_flow() local
613 flow = kzalloc(sizeof(*flow), GFP_KERNEL); in vsc8584_macsec_alloc_flow()
614 if (!flow) in vsc8584_macsec_alloc_flow()
618 flow->index = index; in vsc8584_macsec_alloc_flow()
619 flow->bank = bank; in vsc8584_macsec_alloc_flow()
620 flow->priority = 8; in vsc8584_macsec_alloc_flow()
621 flow->assoc_num = -1; in vsc8584_macsec_alloc_flow()
623 list_add_tail(&flow->list, &priv->macsec_flows); in vsc8584_macsec_alloc_flow()
624 return flow; in vsc8584_macsec_alloc_flow()
628 struct macsec_flow *flow) in vsc8584_macsec_free_flow() argument
630 unsigned long *bitmap = flow->bank == MACSEC_INGR ? in vsc8584_macsec_free_flow()
633 list_del(&flow->list); in vsc8584_macsec_free_flow()
634 clear_bit(flow->index, bitmap); in vsc8584_macsec_free_flow()
635 memzero_explicit(flow->key, sizeof(flow->key)); in vsc8584_macsec_free_flow()
636 kfree(flow); in vsc8584_macsec_free_flow()
640 struct macsec_flow *flow, bool update) in vsc8584_macsec_add_flow() argument
644 flow->port = MSCC_MS_PORT_CONTROLLED; in vsc8584_macsec_add_flow()
645 vsc8584_macsec_flow(phydev, flow); in vsc8584_macsec_add_flow()
650 ret = vsc8584_macsec_transformation(phydev, flow); in vsc8584_macsec_add_flow()
652 vsc8584_macsec_free_flow(phydev->priv, flow); in vsc8584_macsec_add_flow()
661 struct macsec_flow *flow; in vsc8584_macsec_default_flows() local
664 flow = vsc8584_macsec_alloc_flow(phydev->priv, MACSEC_INGR); in vsc8584_macsec_default_flows()
665 if (IS_ERR(flow)) in vsc8584_macsec_default_flows()
666 return PTR_ERR(flow); in vsc8584_macsec_default_flows()
668 flow->priority = 15; in vsc8584_macsec_default_flows()
669 flow->port = MSCC_MS_PORT_UNCONTROLLED; in vsc8584_macsec_default_flows()
670 flow->match.tagged = 1; in vsc8584_macsec_default_flows()
671 flow->match.untagged = 1; in vsc8584_macsec_default_flows()
672 flow->match.etype = 1; in vsc8584_macsec_default_flows()
673 flow->etype = ETH_P_PAE; in vsc8584_macsec_default_flows()
674 flow->action.bypass = 1; in vsc8584_macsec_default_flows()
676 vsc8584_macsec_flow(phydev, flow); in vsc8584_macsec_default_flows()
677 vsc8584_macsec_flow_enable(phydev, flow); in vsc8584_macsec_default_flows()
680 flow = vsc8584_macsec_alloc_flow(phydev->priv, MACSEC_EGR); in vsc8584_macsec_default_flows()
681 if (IS_ERR(flow)) in vsc8584_macsec_default_flows()
682 return PTR_ERR(flow); in vsc8584_macsec_default_flows()
684 flow->priority = 15; in vsc8584_macsec_default_flows()
685 flow->port = MSCC_MS_PORT_COMMON; in vsc8584_macsec_default_flows()
686 flow->match.untagged = 1; in vsc8584_macsec_default_flows()
687 flow->match.etype = 1; in vsc8584_macsec_default_flows()
688 flow->etype = ETH_P_PAE; in vsc8584_macsec_default_flows()
689 flow->action.bypass = 1; in vsc8584_macsec_default_flows()
691 vsc8584_macsec_flow(phydev, flow); in vsc8584_macsec_default_flows()
692 vsc8584_macsec_flow_enable(phydev, flow); in vsc8584_macsec_default_flows()
698 struct macsec_flow *flow) in vsc8584_macsec_del_flow() argument
700 vsc8584_macsec_flow_disable(phydev, flow); in vsc8584_macsec_del_flow()
701 vsc8584_macsec_free_flow(phydev->priv, flow); in vsc8584_macsec_del_flow()
705 struct macsec_flow *flow, bool update) in __vsc8584_macsec_add_rxsa() argument
710 if (!flow) { in __vsc8584_macsec_add_rxsa()
711 flow = vsc8584_macsec_alloc_flow(priv, MACSEC_INGR); in __vsc8584_macsec_add_rxsa()
712 if (IS_ERR(flow)) in __vsc8584_macsec_add_rxsa()
713 return PTR_ERR(flow); in __vsc8584_macsec_add_rxsa()
715 memcpy(flow->key, ctx->sa.key, priv->secy->key_len); in __vsc8584_macsec_add_rxsa()
718 flow->assoc_num = ctx->sa.assoc_num; in __vsc8584_macsec_add_rxsa()
719 flow->rx_sa = ctx->sa.rx_sa; in __vsc8584_macsec_add_rxsa()
722 flow->match.tagged = 1; in __vsc8584_macsec_add_rxsa()
723 flow->match.sci = 1; in __vsc8584_macsec_add_rxsa()
726 flow->match.untagged = 1; in __vsc8584_macsec_add_rxsa()
728 return vsc8584_macsec_add_flow(phydev, flow, update); in __vsc8584_macsec_add_rxsa()
732 struct macsec_flow *flow, bool update) in __vsc8584_macsec_add_txsa() argument
737 if (!flow) { in __vsc8584_macsec_add_txsa()
738 flow = vsc8584_macsec_alloc_flow(priv, MACSEC_EGR); in __vsc8584_macsec_add_txsa()
739 if (IS_ERR(flow)) in __vsc8584_macsec_add_txsa()
740 return PTR_ERR(flow); in __vsc8584_macsec_add_txsa()
742 memcpy(flow->key, ctx->sa.key, priv->secy->key_len); in __vsc8584_macsec_add_txsa()
745 flow->assoc_num = ctx->sa.assoc_num; in __vsc8584_macsec_add_txsa()
746 flow->tx_sa = ctx->sa.tx_sa; in __vsc8584_macsec_add_txsa()
749 flow->match.untagged = 1; in __vsc8584_macsec_add_txsa()
751 return vsc8584_macsec_add_flow(phydev, flow, update); in __vsc8584_macsec_add_txsa()
757 struct macsec_flow *flow, *tmp; in vsc8584_macsec_dev_open() local
763 list_for_each_entry_safe(flow, tmp, &priv->macsec_flows, list) in vsc8584_macsec_dev_open()
764 vsc8584_macsec_flow_enable(ctx->phydev, flow); in vsc8584_macsec_dev_open()
772 struct macsec_flow *flow, *tmp; in vsc8584_macsec_dev_stop() local
778 list_for_each_entry_safe(flow, tmp, &priv->macsec_flows, list) in vsc8584_macsec_dev_stop()
779 vsc8584_macsec_flow_disable(ctx->phydev, flow); in vsc8584_macsec_dev_stop()
809 struct macsec_flow *flow, *tmp; in vsc8584_macsec_del_secy() local
815 list_for_each_entry_safe(flow, tmp, &priv->macsec_flows, list) in vsc8584_macsec_del_secy()
816 vsc8584_macsec_del_flow(ctx->phydev, flow); in vsc8584_macsec_del_secy()
849 struct macsec_flow *flow, *tmp; in vsc8584_macsec_del_rxsc() local
855 list_for_each_entry_safe(flow, tmp, &priv->macsec_flows, list) { in vsc8584_macsec_del_rxsc()
856 if (flow->bank == MACSEC_INGR && flow->rx_sa && in vsc8584_macsec_del_rxsc()
857 flow->rx_sa->sc->sci == ctx->rx_sc->sci) in vsc8584_macsec_del_rxsc()
858 vsc8584_macsec_del_flow(ctx->phydev, flow); in vsc8584_macsec_del_rxsc()
866 struct macsec_flow *flow = NULL; in vsc8584_macsec_add_rxsa() local
869 return __vsc8584_macsec_add_rxsa(ctx, flow, false); in vsc8584_macsec_add_rxsa()
871 flow = vsc8584_macsec_find_flow(ctx, MACSEC_INGR); in vsc8584_macsec_add_rxsa()
872 if (IS_ERR(flow)) in vsc8584_macsec_add_rxsa()
873 return PTR_ERR(flow); in vsc8584_macsec_add_rxsa()
875 vsc8584_macsec_flow_enable(ctx->phydev, flow); in vsc8584_macsec_add_rxsa()
881 struct macsec_flow *flow; in vsc8584_macsec_upd_rxsa() local
886 flow = vsc8584_macsec_find_flow(ctx, MACSEC_INGR); in vsc8584_macsec_upd_rxsa()
887 if (IS_ERR(flow)) in vsc8584_macsec_upd_rxsa()
888 return PTR_ERR(flow); in vsc8584_macsec_upd_rxsa()
891 /* Make sure the flow is disabled before updating it */ in vsc8584_macsec_upd_rxsa()
892 vsc8584_macsec_flow_disable(ctx->phydev, flow); in vsc8584_macsec_upd_rxsa()
894 return __vsc8584_macsec_add_rxsa(ctx, flow, true); in vsc8584_macsec_upd_rxsa()
897 vsc8584_macsec_flow_enable(ctx->phydev, flow); in vsc8584_macsec_upd_rxsa()
903 struct macsec_flow *flow; in vsc8584_macsec_del_rxsa() local
905 flow = vsc8584_macsec_find_flow(ctx, MACSEC_INGR); in vsc8584_macsec_del_rxsa()
907 if (IS_ERR(flow)) in vsc8584_macsec_del_rxsa()
908 return PTR_ERR(flow); in vsc8584_macsec_del_rxsa()
912 vsc8584_macsec_del_flow(ctx->phydev, flow); in vsc8584_macsec_del_rxsa()
918 struct macsec_flow *flow = NULL; in vsc8584_macsec_add_txsa() local
921 return __vsc8584_macsec_add_txsa(ctx, flow, false); in vsc8584_macsec_add_txsa()
923 flow = vsc8584_macsec_find_flow(ctx, MACSEC_EGR); in vsc8584_macsec_add_txsa()
924 if (IS_ERR(flow)) in vsc8584_macsec_add_txsa()
925 return PTR_ERR(flow); in vsc8584_macsec_add_txsa()
927 vsc8584_macsec_flow_enable(ctx->phydev, flow); in vsc8584_macsec_add_txsa()
933 struct macsec_flow *flow; in vsc8584_macsec_upd_txsa() local
938 flow = vsc8584_macsec_find_flow(ctx, MACSEC_EGR); in vsc8584_macsec_upd_txsa()
939 if (IS_ERR(flow)) in vsc8584_macsec_upd_txsa()
940 return PTR_ERR(flow); in vsc8584_macsec_upd_txsa()
943 /* Make sure the flow is disabled before updating it */ in vsc8584_macsec_upd_txsa()
944 vsc8584_macsec_flow_disable(ctx->phydev, flow); in vsc8584_macsec_upd_txsa()
946 return __vsc8584_macsec_add_txsa(ctx, flow, true); in vsc8584_macsec_upd_txsa()
949 vsc8584_macsec_flow_enable(ctx->phydev, flow); in vsc8584_macsec_upd_txsa()
955 struct macsec_flow *flow; in vsc8584_macsec_del_txsa() local
957 flow = vsc8584_macsec_find_flow(ctx, MACSEC_EGR); in vsc8584_macsec_del_txsa()
959 if (IS_ERR(flow)) in vsc8584_macsec_del_txsa()
960 return PTR_ERR(flow); in vsc8584_macsec_del_txsa()
964 vsc8584_macsec_del_flow(ctx->phydev, flow); in vsc8584_macsec_del_txsa()
1007 struct macsec_flow *flow, *tmp; in vsc8584_handle_macsec_interrupt() local
1018 list_for_each_entry_safe(flow, tmp, &priv->macsec_flows, list) { in vsc8584_handle_macsec_interrupt()
1021 if (flow->bank != MACSEC_EGR || !flow->has_transformation) in vsc8584_handle_macsec_interrupt()
1025 MSCC_MS_XFORM_REC(flow->index, rec)); in vsc8584_handle_macsec_interrupt()
1027 vsc8584_macsec_flow_disable(phydev, flow); in vsc8584_handle_macsec_interrupt()
1028 macsec_pn_wrapped(priv->secy, flow->tx_sa); in vsc8584_handle_macsec_interrupt()