From: Lior Nahmanson <liorna@nvidia.com>
To: <edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>
Cc: <davem@davemloft.net>, <netdev@vger.kernel.org>,
Lior Nahmanson <liorna@nvidia.com>, Raed Salem <raeds@nvidia.com>,
Saeed Mahameed <saeedm@nvidia.com>
Subject: [PATCH 2/3] net/macsec: Add MACsec skb_metadata_dst Rx Data path support
Date: Thu, 18 Aug 2022 16:24:10 +0300 [thread overview]
Message-ID: <20220818132411.578-3-liorna@nvidia.com> (raw)
In-Reply-To: <20220818132411.578-1-liorna@nvidia.com>
Like in the Tx changes, if there are more than one MACsec device with
the same MAC address as in the packet's destination MAC, the packet will
be forward only to one of the devices and not neccessarly to the desired one.
Offloading device driver sets the MACsec skb_metadata_dst sci
field with the appropriaate Rx SCI for each SKB so the MACsec rx handler
will know to which port to divert those skbs, instead of wrongly solely
relaying on dst MAC address comparison.
Signed-off-by: Lior Nahmanson <liorna@nvidia.com>
Reviewed-by: Raed Salem <raeds@nvidia.com>
Reviewed-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/macsec.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index 4bf7f9870b91..534459dbc956 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -1001,11 +1001,13 @@ static enum rx_handler_result handle_not_macsec(struct sk_buff *skb)
/* Deliver to the uncontrolled port by default */
enum rx_handler_result ret = RX_HANDLER_PASS;
struct ethhdr *hdr = eth_hdr(skb);
+ struct metadata_dst *md_dst;
struct macsec_rxh_data *rxd;
struct macsec_dev *macsec;
rcu_read_lock();
rxd = macsec_data_rcu(skb->dev);
+ md_dst = skb_metadata_dst(skb);
list_for_each_entry_rcu(macsec, &rxd->secys, secys) {
struct sk_buff *nskb;
@@ -1016,6 +1018,10 @@ static enum rx_handler_result handle_not_macsec(struct sk_buff *skb)
* the SecTAG, so we have to deduce which port to deliver to.
*/
if (macsec_is_offloaded(macsec) && netif_running(ndev)) {
+ if (md_dst && md_dst->type == METADATA_MACSEC &&
+ (!find_rx_sc(&macsec->secy, md_dst->u.macsec_info.sci)))
+ continue;
+
if (ether_addr_equal_64bits(hdr->h_dest,
ndev->dev_addr)) {
/* exact match, divert skb to this port */
--
2.21.3
next prev parent reply other threads:[~2022-08-18 13:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-18 13:24 [PATCH net-next 00/3] Introduce MACsec skb_metadata_dst Lior Nahmanson
2022-08-18 13:24 ` [PATCH 1/3] net/macsec: Add MACsec skb_metadata_dst Tx Data path support Lior Nahmanson
2022-08-19 4:08 ` Jakub Kicinski
2022-08-21 11:12 ` Raed Salem
2022-08-22 18:10 ` Jakub Kicinski
2022-08-22 20:29 ` Saeed Mahameed
2022-08-18 13:24 ` Lior Nahmanson [this message]
2022-08-18 13:24 ` [PATCH 3/3] net/macsec: Move some code for sharing with various drivers that implements offload Lior Nahmanson
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=20220818132411.578-3-liorna@nvidia.com \
--to=liorna@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=raeds@nvidia.com \
--cc=saeedm@nvidia.com \
/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).