public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Sabrina Dubroca <sd@queasysnail.net>,
	Antoine Tenart <atenart@kernel.org>,
	Leon Romanovsky <leonro@nvidia.com>,
	"David S . Miller" <davem@davemloft.net>,
	Sasha Levin <sashal@kernel.org>,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 6.0 17/44] Revert "net: macsec: report real_dev features when HW offloading is enabled"
Date: Fri, 18 Nov 2022 21:10:57 -0500	[thread overview]
Message-ID: <20221119021124.1773699-17-sashal@kernel.org> (raw)
In-Reply-To: <20221119021124.1773699-1-sashal@kernel.org>

From: Sabrina Dubroca <sd@queasysnail.net>

[ Upstream commit 8bcd560ae8784da57c610d857118c5d6576b1a8f ]

This reverts commit c850240b6c4132574a00f2da439277ab94265b66.

That commit tried to improve the performance of macsec offload by
taking advantage of some of the NIC's features, but in doing so, broke
macsec offload when the lower device supports both macsec and ipsec
offload, as the ipsec offload feature flags (mainly NETIF_F_HW_ESP)
were copied from the real device. Since the macsec device doesn't
provide xdo_* ops, the XFRM core rejects the registration of the new
macsec device in xfrm_api_check.

Example perf trace when running
  ip link add link eni1np1 type macsec port 4 offload mac

    ip   737 [003]   795.477676: probe:xfrm_dev_event__REGISTER      name="macsec0" features=0x1c000080014869
              xfrm_dev_event+0x3a
              notifier_call_chain+0x47
              register_netdevice+0x846
              macsec_newlink+0x25a

    ip   737 [003]   795.477687:   probe:xfrm_dev_event__return      ret=0x8002 (NOTIFY_BAD)
             notifier_call_chain+0x47
             register_netdevice+0x846
             macsec_newlink+0x25a

dev->features includes NETIF_F_HW_ESP (0x04000000000000), so
xfrm_api_check returns NOTIFY_BAD because we don't have
dev->xfrmdev_ops on the macsec device.

We could probably propagate GSO and a few other features from the
lower device, similar to macvlan. This will be done in a future patch.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Reviewed-by: Antoine Tenart <atenart@kernel.org>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/macsec.c | 27 ++++-----------------------
 1 file changed, 4 insertions(+), 23 deletions(-)

diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index c6d271e5687e..4e2b719207bb 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -2682,11 +2682,6 @@ static int macsec_upd_offload(struct sk_buff *skb, struct genl_info *info)
 	if (ret)
 		goto rollback;
 
-	/* Force features update, since they are different for SW MACSec and
-	 * HW offloading cases.
-	 */
-	netdev_update_features(dev);
-
 	rtnl_unlock();
 	return 0;
 
@@ -3454,16 +3449,9 @@ static netdev_tx_t macsec_start_xmit(struct sk_buff *skb,
 	return ret;
 }
 
-#define SW_MACSEC_FEATURES \
+#define 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);
@@ -3480,12 +3468,8 @@ static int macsec_dev_init(struct net_device *dev)
 		return err;
 	}
 
-	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->features = real_dev->features & MACSEC_FEATURES;
+	dev->features |= NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE;
 
 	dev->needed_headroom = real_dev->needed_headroom +
 			       MACSEC_NEEDED_HEADROOM;
@@ -3517,10 +3501,7 @@ 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;
 
-	if (macsec_is_offloaded(macsec))
-		return REAL_DEV_FEATURES(real_dev);
-
-	features &= (real_dev->features & SW_MACSEC_FEATURES) |
+	features &= (real_dev->features & MACSEC_FEATURES) |
 		    NETIF_F_GSO_SOFTWARE | NETIF_F_SOFT_FEATURES;
 	features |= NETIF_F_LLTX;
 
-- 
2.35.1


  parent reply	other threads:[~2022-11-19  2:13 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-19  2:10 [PATCH AUTOSEL 6.0 01/44] wifi: mac80211: fix memory free error when registering wiphy fail Sasha Levin
2022-11-19  2:10 ` [PATCH AUTOSEL 6.0 02/44] wifi: cfg80211: Fix bitrates overflow issue Sasha Levin
2022-11-19  2:10 ` [PATCH AUTOSEL 6.0 03/44] wifi: mac80211_hwsim: fix debugfs attribute ps with rc table support Sasha Levin
2022-11-19  2:10 ` [PATCH AUTOSEL 6.0 04/44] spi: tegra210-quad: Don't initialise DMA if not supported Sasha Levin
2022-11-19  2:10 ` [PATCH AUTOSEL 6.0 05/44] riscv: dts: sifive unleashed: Add PWM controlled LEDs Sasha Levin
2022-11-19  2:10 ` [PATCH AUTOSEL 6.0 06/44] audit: fix undefined behavior in bit shift for AUDIT_BIT Sasha Levin
2022-11-19  2:10 ` [PATCH AUTOSEL 6.0 07/44] wifi: airo: do not assign -1 to unsigned char Sasha Levin
2022-11-19  2:10 ` [PATCH AUTOSEL 6.0 08/44] wifi: mac80211: Fix ack frame idr leak when mesh has no route Sasha Levin
2022-11-19  2:10 ` [PATCH AUTOSEL 6.0 09/44] selftests/net: don't tests batched TCP io_uring zc Sasha Levin
2022-11-19  2:10 ` [PATCH AUTOSEL 6.0 10/44] wifi: ath11k: Fix QCN9074 firmware boot on x86 Sasha Levin
2022-11-19  2:10 ` [PATCH AUTOSEL 6.0 11/44] s390/zcrypt: fix warning about field-spanning write Sasha Levin
2022-11-19  2:10 ` [PATCH AUTOSEL 6.0 12/44] spi: stm32: fix stm32_spi_prepare_mbr() that halves spi clk for every run Sasha Levin
2022-11-19  2:10 ` [PATCH AUTOSEL 6.0 13/44] clocksource/drivers/hyperv: add data structure for reference TSC MSR Sasha Levin
2022-11-19  5:37   ` Michael Kelley (LINUX)
2022-11-24 15:51     ` Sasha Levin
2022-11-25 15:39       ` Wei Liu
2022-11-19  2:10 ` [PATCH AUTOSEL 6.0 14/44] x86/hyperv: fix invalid writes to MSRs during root partition kexec Sasha Levin
2022-11-19  5:37   ` Michael Kelley (LINUX)
2022-11-19  2:10 ` [PATCH AUTOSEL 6.0 15/44] selftests/bpf: Add verifier test for release_reference() Sasha Levin
2022-11-19  2:10 ` [PATCH AUTOSEL 6.0 16/44] selftests/net: give more time to udpgro bg processes to complete startup Sasha Levin
2022-11-19  2:10 ` Sasha Levin [this message]
2022-11-19  2:10 ` [PATCH AUTOSEL 6.0 18/44] ACPI: video: Add backlight=native DMI quirk for Dell G15 5515 Sasha Levin
2022-11-19 13:31   ` Daniel Dadap
2022-11-19  2:10 ` [PATCH AUTOSEL 6.0 19/44] platform/x86: ideapad-laptop: Disable touchpad_switch Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 20/44] platform/x86: touchscreen_dmi: Add info for the RCA Cambio W101 v2 2-in-1 Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 21/44] platform/x86/intel/pmt: Sapphire Rapids PMT errata fix Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 22/44] platform/x86/intel/hid: Add some ACPI device IDs Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 23/44] scsi: ibmvfc: Avoid path failures during live migration Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 24/44] scsi: scsi_debug: Make the READ CAPACITY response compliant with ZBC Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 25/44] drm: panel-orientation-quirks: Add quirk for Nanote UMPC-01 Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 26/44] drm: panel-orientation-quirks: Add quirk for Acer Switch V 10 (SW5-017) Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 27/44] drm/amdgpu: Fix the lpfn checking condition in drm buddy Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 28/44] block, bfq: fix null pointer dereference in bfq_bio_bfqg() Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 29/44] s390: always build relocatable kernel Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 30/44] arm64/syscall: Include asm/ptrace.h in syscall_wrapper header Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 31/44] nvme: quiet user passthrough command errors Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 32/44] nvmet: fix memory leak in nvmet_subsys_attr_model_store_locked Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 33/44] net: wwan: iosm: fix kernel test robot reported errors Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 34/44] drm/amd/display: Zeromem mypipe heap struct before using it Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 35/44] drm/amd/display: Fix FCLK deviation and tool compile issues Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 36/44] drm/amd/display: Fix gpio port mapping issue Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 37/44] Revert "drm/amdgpu: Revert "drm/amdgpu: getting fan speed pwm for vega10 properly"" Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 38/44] drm/amdgpu: Unlock bo_list_mutex after error handling Sasha Levin
2022-11-21  9:57   ` Michel Dänzer
2022-11-21 11:07     ` Christian König
2022-11-24 16:50       ` Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 39/44] drm/amdgpu: Drop eviction lock when allocating PT BO Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 40/44] drm/amd/display: only fill dirty rectangles when PSR is enabled Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 41/44] ALSA: usb-audio: add quirk to fix Hamedal C20 disconnect issue Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 42/44] RISC-V: vdso: Do not add missing symbols to version section in linker script Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 43/44] MIPS: pic32: treat port as signed integer Sasha Levin
2022-11-19  2:11 ` [PATCH AUTOSEL 6.0 44/44] io_uring/poll: lockdep annote io_poll_req_insert_locked Sasha Levin

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=20221119021124.1773699-17-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=atenart@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=leonro@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sd@queasysnail.net \
    --cc=stable@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