Lines Matching refs:ctx
448 static struct macsec_flow *vsc8584_macsec_find_flow(struct macsec_context *ctx,
451 struct vsc8531_private *priv = ctx->phydev->priv;
455 if (pos->assoc_num == ctx->sa.assoc_num && pos->bank == bank)
507 struct crypto_aes_ctx ctx;
510 ret = aes_expandkey(&ctx, key, key_len);
514 aes_encrypt(&ctx, hkey, input);
515 memzero_explicit(&ctx, sizeof(ctx));
690 static int __vsc8584_macsec_add_rxsa(struct macsec_context *ctx,
693 struct phy_device *phydev = ctx->phydev;
697 flow->assoc_num = ctx->sa.assoc_num;
698 flow->rx_sa = ctx->sa.rx_sa;
712 ret = vsc8584_macsec_transformation(phydev, flow, ctx->sa.key);
719 static int __vsc8584_macsec_add_txsa(struct macsec_context *ctx,
724 flow->assoc_num = ctx->sa.assoc_num;
725 flow->tx_sa = ctx->sa.tx_sa;
730 vsc8584_macsec_add_flow(ctx->phydev, flow);
735 ret = vsc8584_macsec_transformation(ctx->phydev, flow, ctx->sa.key);
737 vsc8584_macsec_free_flow(ctx->phydev->priv, flow);
742 static int vsc8584_macsec_dev_open(struct macsec_context *ctx)
744 struct vsc8531_private *priv = ctx->phydev->priv;
748 vsc8584_macsec_flow_enable(ctx->phydev, flow);
753 static int vsc8584_macsec_dev_stop(struct macsec_context *ctx)
755 struct vsc8531_private *priv = ctx->phydev->priv;
759 vsc8584_macsec_flow_disable(ctx->phydev, flow);
764 static int vsc8584_macsec_add_secy(struct macsec_context *ctx)
766 struct vsc8531_private *priv = ctx->phydev->priv;
767 struct macsec_secy *secy = ctx->secy;
774 vsc8584_macsec_flow_default_action(ctx->phydev, MACSEC_EGR,
776 vsc8584_macsec_flow_default_action(ctx->phydev, MACSEC_INGR,
779 return vsc8584_macsec_default_flows(ctx->phydev);
782 static int vsc8584_macsec_del_secy(struct macsec_context *ctx)
784 struct vsc8531_private *priv = ctx->phydev->priv;
788 vsc8584_macsec_del_flow(ctx->phydev, flow);
790 vsc8584_macsec_flow_default_action(ctx->phydev, MACSEC_EGR, false);
791 vsc8584_macsec_flow_default_action(ctx->phydev, MACSEC_INGR, false);
797 static int vsc8584_macsec_upd_secy(struct macsec_context *ctx)
799 vsc8584_macsec_del_secy(ctx);
800 return vsc8584_macsec_add_secy(ctx);
803 static int vsc8584_macsec_add_rxsc(struct macsec_context *ctx)
809 static int vsc8584_macsec_upd_rxsc(struct macsec_context *ctx)
814 static int vsc8584_macsec_del_rxsc(struct macsec_context *ctx)
816 struct vsc8531_private *priv = ctx->phydev->priv;
821 flow->rx_sa->sc->sci == ctx->rx_sc->sci)
822 vsc8584_macsec_del_flow(ctx->phydev, flow);
828 static int vsc8584_macsec_add_rxsa(struct macsec_context *ctx)
830 struct phy_device *phydev = ctx->phydev;
839 ret = __vsc8584_macsec_add_rxsa(ctx, flow, false);
847 static int vsc8584_macsec_upd_rxsa(struct macsec_context *ctx)
852 if (ctx->sa.update_pn)
855 flow = vsc8584_macsec_find_flow(ctx, MACSEC_INGR);
860 vsc8584_macsec_flow_disable(ctx->phydev, flow);
862 ret = __vsc8584_macsec_add_rxsa(ctx, flow, true);
866 vsc8584_macsec_flow_enable(ctx->phydev, flow);
870 static int vsc8584_macsec_del_rxsa(struct macsec_context *ctx)
874 flow = vsc8584_macsec_find_flow(ctx, MACSEC_INGR);
878 vsc8584_macsec_del_flow(ctx->phydev, flow);
882 static int vsc8584_macsec_add_txsa(struct macsec_context *ctx)
884 struct phy_device *phydev = ctx->phydev;
893 ret = __vsc8584_macsec_add_txsa(ctx, flow, false);
901 static int vsc8584_macsec_upd_txsa(struct macsec_context *ctx)
906 if (ctx->sa.update_pn)
909 flow = vsc8584_macsec_find_flow(ctx, MACSEC_EGR);
914 vsc8584_macsec_flow_disable(ctx->phydev, flow);
916 ret = __vsc8584_macsec_add_txsa(ctx, flow, true);
920 vsc8584_macsec_flow_enable(ctx->phydev, flow);
924 static int vsc8584_macsec_del_txsa(struct macsec_context *ctx)
928 flow = vsc8584_macsec_find_flow(ctx, MACSEC_EGR);
932 vsc8584_macsec_del_flow(ctx->phydev, flow);