[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231116182900.46052-3-rrameshbabu@nvidia.com>
Date: Thu, 16 Nov 2023 10:28:59 -0800
From: Rahul Rameshbabu <rrameshbabu@...dia.com>
To: netdev@...r.kernel.org
Cc: Leon Romanovsky <leon@...nel.org>,
Saeed Mahameed <saeed@...nel.org>,
Gal Pressman <gal@...dia.com>,
Tariq Toukan <tariqt@...dia.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Rahul Rameshbabu <rrameshbabu@...dia.com>,
Sabrina Dubroca <sd@...asysnail.net>
Subject: [PATCH RFC net-next v1 2/3] macsec: Detect if Rx skb is macsec-related for offloading devices that update md_dst
This detection capability will enable drivers that update md_dst to be able
to receive and handle both non-MACSec and MACsec traffic received and the
same physical port when offload is enabled.
This detection is not possible without device drivers that update md_dst. A
fallback pattern should be used for supporting such device drivers. This
fallback mode causes multicast messages to be cloned to both the non-macsec
and macsec ports, independent of whether the multicast message received was
encrypted over MACsec or not. Other non-macsec traffic may also fail to be
handled correctly for devices in promiscuous mode.
Link: https://lore.kernel.org/netdev/ZULRxX9eIbFiVi7v@hog/
Cc: Sabrina Dubroca <sd@...asysnail.net>
Signed-off-by: Rahul Rameshbabu <rrameshbabu@...dia.com>
---
drivers/net/macsec.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index 8c0b12490e89..e14f2ad2e253 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -1002,6 +1002,7 @@ static enum rx_handler_result handle_not_macsec(struct sk_buff *skb)
rcu_read_lock();
rxd = macsec_data_rcu(skb->dev);
md_dst = skb_metadata_dst(skb);
+ bool is_macsec_md_dst = md_dst && md_dst->type == METADATA_MACSEC;
list_for_each_entry_rcu(macsec, &rxd->secys, secys) {
struct sk_buff *nskb;
@@ -1014,10 +1015,13 @@ static enum rx_handler_result handle_not_macsec(struct sk_buff *skb)
if (macsec_is_offloaded(macsec) && netif_running(ndev)) {
struct macsec_rx_sc *rx_sc = NULL;
- if (md_dst && md_dst->type == METADATA_MACSEC)
+ if (macsec->offload_md_dst && !is_macsec_md_dst)
+ continue;
+
+ if (is_macsec_md_dst)
rx_sc = find_rx_sc(&macsec->secy, md_dst->u.macsec_info.sci);
- if (md_dst && md_dst->type == METADATA_MACSEC && !rx_sc)
+ if (is_macsec_md_dst && !rx_sc)
continue;
if (ether_addr_equal_64bits(hdr->h_dest,
--
2.40.1
Powered by blists - more mailing lists