netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Igor Russkikh <irusskikh@marvell.com>
To: <netdev@vger.kernel.org>
Cc: "David S . Miller" <davem@davemloft.net>,
	Antoine Tenart <antoine.tenart@bootlin.com>,
	Mark Starovoytov <mstarovoitov@marvell.com>,
	Dmitry Bogdanov <dbogdanov@marvell.com>,
	Igor Russkikh <irusskikh@marvell.com>
Subject: [RFC 11/18] net: macsec: report real_dev features when HW offloading is enabled
Date: Fri, 14 Feb 2020 18:02:51 +0300	[thread overview]
Message-ID: <20200214150258.390-12-irusskikh@marvell.com> (raw)
In-Reply-To: <20200214150258.390-1-irusskikh@marvell.com>

From: Mark Starovoytov <mstarovoitov@marvell.com>

This patch makes real_dev_feature propagation by MACSec offloaded device.

Issue description:
real_dev features are disabled upon macsec creation.

Root cause:
Features limitation (specific to SW MACSec limitation) is being applied
to HW offloaded case as well.
This causes 'set_features' request on the real_dev with reduced feature
set due to chain propagation.

Proposed solution:
Report real_dev features when HW offloading is enabled.
NB! MACSec offloaded device does not propagate VLAN offload features at
the moment. This can potentially be added later on as a separate patch.

Note: this patch requires HW offloading to be enabled by default in order
to function properly.

Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
---
 drivers/net/macsec.c | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index 38403037cea0..a3d96fffa84f 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -2474,6 +2474,10 @@ static int macsec_upd_offload(struct sk_buff *skb, struct genl_info *info)
 		goto rollback;
 
 	rtnl_unlock();
+	/* Force features update, since they are different for SW MACSec and
+	 * HW offloading cases.
+	 */
+	netdev_update_features(dev);
 	return 0;
 
 rollback:
@@ -3234,9 +3238,16 @@ static netdev_tx_t macsec_start_xmit(struct sk_buff *skb,
 	return ret;
 }
 
-#define MACSEC_FEATURES \
+#define SW_MACSEC_FEATURES \
 	(NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST)
 
+/* If h/w offloading is enabled, use real device features save for
+ *   VLAN_FEATURES - they require additional ops
+ *   HW_MACSEC - no reason to report it
+ */
+#define REAL_DEV_FEATURES(dev) \
+	((dev)->features & ~(NETIF_F_VLAN_FEATURES | NETIF_F_HW_MACSEC))
+
 static int macsec_dev_init(struct net_device *dev)
 {
 	struct macsec_dev *macsec = macsec_priv(dev);
@@ -3253,8 +3264,12 @@ static int macsec_dev_init(struct net_device *dev)
 		return err;
 	}
 
-	dev->features = real_dev->features & MACSEC_FEATURES;
-	dev->features |= NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE;
+	if (macsec_is_offloaded(macsec)) {
+		dev->features = REAL_DEV_FEATURES(real_dev);
+	} else {
+		dev->features = real_dev->features & SW_MACSEC_FEATURES;
+		dev->features |= NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE;
+	}
 
 	dev->needed_headroom = real_dev->needed_headroom +
 			       MACSEC_NEEDED_HEADROOM;
@@ -3283,7 +3298,10 @@ static netdev_features_t macsec_fix_features(struct net_device *dev,
 	struct macsec_dev *macsec = macsec_priv(dev);
 	struct net_device *real_dev = macsec->real_dev;
 
-	features &= (real_dev->features & MACSEC_FEATURES) |
+	if (macsec_is_offloaded(macsec))
+		return REAL_DEV_FEATURES(real_dev);
+
+	features &= (real_dev->features & SW_MACSEC_FEATURES) |
 		    NETIF_F_GSO_SOFTWARE | NETIF_F_SOFT_FEATURES;
 	features |= NETIF_F_LLTX;
 
-- 
2.17.1


  parent reply	other threads:[~2020-02-14 15:03 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14 15:02 [RFC 00/18] net: atlantic: MACSec support for AQC devices Igor Russkikh
2020-02-14 15:02 ` [RFC 01/18] net: introduce the MACSEC netdev feature Igor Russkikh
2020-02-14 15:02 ` [RFC 02/18] net: add a reference to MACsec ops in net_device Igor Russkikh
2020-02-14 15:02 ` [RFC 03/18] net: macsec: allow to reference a netdev from a MACsec context Igor Russkikh
2020-02-14 15:02 ` [RFC 04/18] net: macsec: add support for offloading to the MAC Igor Russkikh
2020-02-14 15:02 ` [RFC 05/18] net: macsec: init secy pointer in macsec_context Igor Russkikh
2020-02-21 15:09   ` Antoine Tenart
2020-02-14 15:02 ` [RFC 06/18] net: macsec: invoke mdo_upd_secy callback when mac address changed Igor Russkikh
2020-02-21 15:07   ` Antoine Tenart
2020-02-14 15:02 ` [RFC 07/18] net: macsec: allow multiple macsec devices with offload Igor Russkikh
2020-02-14 15:02 ` [RFC 08/18] net: macsec: support multicast/broadcast when offloading Igor Russkikh
2020-02-14 15:02 ` [RFC 09/18] net: macsec: add support for getting offloaded stats Igor Russkikh
2020-02-21 17:48   ` Antoine Tenart
2020-02-14 15:02 ` [RFC 10/18] net: macsec: enable HW offloading by default (when available) Igor Russkikh
2020-02-21 18:04   ` Antoine Tenart
2020-02-14 15:02 ` Igor Russkikh [this message]
2020-02-14 15:02 ` [RFC 12/18] net: atlantic: MACSec offload skeleton Igor Russkikh
2020-02-21 18:21   ` Antoine Tenart
2020-02-14 15:02 ` [RFC 13/18] net: atlantic: MACSec egress offload HW bindings Igor Russkikh
2020-02-14 15:02 ` [RFC 14/18] net: atlantic: MACSec egress offload implementation Igor Russkikh
2020-02-14 15:02 ` [RFC 15/18] net: atlantic: MACSec ingress offload HW bindings Igor Russkikh
2020-02-14 15:02 ` [RFC 16/18] net: atlantic: MACSec ingress offload implementation Igor Russkikh
2020-02-14 15:02 ` [RFC 17/18] net: atlantic: MACSec offload statistics HW bindings Igor Russkikh
2020-02-14 15:02 ` [RFC 18/18] net: atlantic: MACSec offload statistics implementation Igor Russkikh
2020-02-21 14:57 ` [RFC 00/18] net: atlantic: MACSec support for AQC devices Antoine Tenart
2020-02-26  8:12   ` [EXT] " Igor Russkikh
2020-02-26 15:50     ` Antoine Tenart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200214150258.390-12-irusskikh@marvell.com \
    --to=irusskikh@marvell.com \
    --cc=antoine.tenart@bootlin.com \
    --cc=davem@davemloft.net \
    --cc=dbogdanov@marvell.com \
    --cc=mstarovoitov@marvell.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).