[][Add macsec HW offload backport from kernel 5.18]
[Description]
Add macsec HW offload backport from kernel 5.18.
[Release-log]
N/A
Change-Id: I5b143fe620ec4bcae4075d1d85db5e41c8d48717
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/5981730
diff --git a/target/linux/mediatek/patches-5.4/999-1770-06-v5.18-net-macsec-allow-multiple-macsec-devices-with-offload.patch b/target/linux/mediatek/patches-5.4/999-1770-06-v5.18-net-macsec-allow-multiple-macsec-devices-with-offload.patch
new file mode 100644
index 0000000..4ef5870
--- /dev/null
+++ b/target/linux/mediatek/patches-5.4/999-1770-06-v5.18-net-macsec-allow-multiple-macsec-devices-with-offload.patch
@@ -0,0 +1,65 @@
+From a249f8050624f92f844605274de3367e2c8ac706 Mon Sep 17 00:00:00 2001
+From: Dmitry Bogdanov <dbogdanov@marvell.com>
+Date: Wed, 25 Mar 2020 15:52:35 +0300
+Subject: 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: Dmitry Bogdanov <dbogdanov@marvell.com>
+Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
+Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/macsec.c | 25 +------------------------
+ 1 file changed, 1 insertion(+), 24 deletions(-)
+
+diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
+index 093e81d605ec7..146a7881a20ac 100644
+--- a/drivers/net/macsec.c
++++ b/drivers/net/macsec.c
+@@ -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;
+--
+cgit 1.2.3-1.el7
+