Commit a249f805 authored by Dmitry Bogdanov's avatar Dmitry Bogdanov Committed by David S. Miller
Browse files

net: macsec: allow multiple macsec devices with offload



Offload engine can setup several SecY. Each macsec interface shall have
its own mac address. It will filter a traffic by dest mac address.

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>
parent 182879f8
Loading
Loading
Loading
Loading
+1 −24
Original line number Diff line number Diff line
@@ -2553,11 +2553,10 @@ static int macsec_upd_offload(struct sk_buff *skb, struct genl_info *info)
	enum macsec_offload offload, prev_offload;
	int (*func)(struct macsec_context *ctx);
	struct nlattr **attrs = info->attrs;
	struct net_device *dev, *loop_dev;
	struct net_device *dev;
	const struct macsec_ops *ops;
	struct macsec_context ctx;
	struct macsec_dev *macsec;
	struct net *loop_net;
	int ret;

	if (!attrs[MACSEC_ATTR_IFINDEX])
@@ -2585,28 +2584,6 @@ static int macsec_upd_offload(struct sk_buff *skb, struct genl_info *info)
	    !macsec_check_offload(offload, macsec))
		return -EOPNOTSUPP;

	if (offload == MACSEC_OFFLOAD_OFF)
		goto skip_limitation;

	/* Check the physical interface isn't offloading another interface
	 * first.
	 */
	for_each_net(loop_net) {
		for_each_netdev(loop_net, loop_dev) {
			struct macsec_dev *priv;

			if (!netif_is_macsec(loop_dev))
				continue;

			priv = macsec_priv(loop_dev);

			if (priv->real_dev == macsec->real_dev &&
			    priv->offload != MACSEC_OFFLOAD_OFF)
				return -EBUSY;
		}
	}

skip_limitation:
	/* Check if the net device is busy. */
	if (netif_running(dev))
		return -EBUSY;