Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac0f6514 authored by Dmitry Bogdanov's avatar Dmitry Bogdanov Committed by Gerrit - the friendly Code Review server
Browse files

net: macsec: init secy pointer in macsec_context



This patch adds secy pointer initialization in the macsec_context.
It will be used by MAC drivers in offloading operations.

Change-Id: I59c0d751f2b026096dcbe57355b47d7f940b0a94
Signed-off-by: default avatarDmitry Bogdanov <dbogdanov@marvell.com>
Signed-off-by: default avatarMark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Git-commit: 182879f89b858fede98136ea3ad45fe9c7178387
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarKarthik Rudrapatna <quic_krudrapa@quicinc.com>
parent d02cb3a2
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -1783,6 +1783,7 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info)

		ctx.sa.assoc_num = assoc_num;
		ctx.sa.rx_sa = rx_sa;
		ctx.secy = secy;
		memcpy(ctx.sa.key, nla_data(tb_sa[MACSEC_SA_ATTR_KEY]),
		       MACSEC_KEYID_LEN);

@@ -1830,6 +1831,7 @@ static int macsec_add_rxsc(struct sk_buff *skb, struct genl_info *info)
	struct nlattr **attrs = info->attrs;
	struct macsec_rx_sc *rx_sc;
	struct nlattr *tb_rxsc[MACSEC_RXSC_ATTR_MAX + 1];
	struct macsec_secy *secy;
	bool was_active;
	int ret;

@@ -1849,6 +1851,7 @@ static int macsec_add_rxsc(struct sk_buff *skb, struct genl_info *info)
		return PTR_ERR(dev);
	}

	secy = &macsec_priv(dev)->secy;
	sci = nla_get_sci(tb_rxsc[MACSEC_RXSC_ATTR_SCI]);

	rx_sc = create_rx_sc(dev, sci);
@@ -1872,6 +1875,7 @@ static int macsec_add_rxsc(struct sk_buff *skb, struct genl_info *info)
		}

		ctx.rx_sc = rx_sc;
		ctx.secy = secy;

		ret = macsec_offload(ops->mdo_add_rxsc, &ctx);
		if (ret)
@@ -2021,6 +2025,7 @@ static int macsec_add_txsa(struct sk_buff *skb, struct genl_info *info)

		ctx.sa.assoc_num = assoc_num;
		ctx.sa.tx_sa = tx_sa;
		ctx.secy = secy;
		memcpy(ctx.sa.key, nla_data(tb_sa[MACSEC_SA_ATTR_KEY]),
		       MACSEC_KEYID_LEN);

@@ -2096,6 +2101,7 @@ static int macsec_del_rxsa(struct sk_buff *skb, struct genl_info *info)

		ctx.sa.assoc_num = assoc_num;
		ctx.sa.rx_sa = rx_sa;
		ctx.secy = secy;

		ret = macsec_offload(ops->mdo_del_rxsa, &ctx);
		if (ret)
@@ -2161,6 +2167,7 @@ static int macsec_del_rxsc(struct sk_buff *skb, struct genl_info *info)
		}

		ctx.rx_sc = rx_sc;
		ctx.secy = secy;
		ret = macsec_offload(ops->mdo_del_rxsc, &ctx);
		if (ret)
			goto cleanup;
@@ -2219,6 +2226,7 @@ static int macsec_del_txsa(struct sk_buff *skb, struct genl_info *info)

		ctx.sa.assoc_num = assoc_num;
		ctx.sa.tx_sa = tx_sa;
		ctx.secy = secy;

		ret = macsec_offload(ops->mdo_del_txsa, &ctx);
		if (ret)
@@ -2330,6 +2338,7 @@ static int macsec_upd_txsa(struct sk_buff *skb, struct genl_info *info)

		ctx.sa.assoc_num = assoc_num;
		ctx.sa.tx_sa = tx_sa;
		ctx.secy = secy;

		ret = macsec_offload(ops->mdo_upd_txsa, &ctx);
		if (ret)
@@ -2422,6 +2431,7 @@ static int macsec_upd_rxsa(struct sk_buff *skb, struct genl_info *info)

		ctx.sa.assoc_num = assoc_num;
		ctx.sa.rx_sa = rx_sa;
		ctx.secy = secy;

		ret = macsec_offload(ops->mdo_upd_rxsa, &ctx);
		if (ret)
@@ -2492,6 +2502,7 @@ static int macsec_upd_rxsc(struct sk_buff *skb, struct genl_info *info)
		}

		ctx.rx_sc = rx_sc;
		ctx.secy = secy;

		ret = macsec_offload(ops->mdo_upd_rxsc, &ctx);
		if (ret)
@@ -3359,6 +3370,7 @@ static int macsec_dev_open(struct net_device *dev)
			goto clear_allmulti;
		}

		ctx.secy = &macsec->secy;
		err = macsec_offload(ops->mdo_dev_open, &ctx);
		if (err)
			goto clear_allmulti;
@@ -3390,9 +3402,11 @@ static int macsec_dev_stop(struct net_device *dev)
		struct macsec_context ctx;

		ops = macsec_get_ops(macsec, &ctx);
		if (ops)
		if (ops) {
			ctx.secy = &macsec->secy;
			macsec_offload(ops->mdo_dev_stop, &ctx);
		}
	}

	dev_mc_unsync(real_dev, dev);
	dev_uc_unsync(real_dev, dev);