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>,
Jiri Pirko <jiri@nvidia.com>, Ben Ben-Ishay <benishay@nvidia.com>
Subject: [PATCH net-next v1 02/03] net/macsec: Add MACsec skb extension Rx Data path support
Date: Sun, 8 May 2022 12:09:53 +0300 [thread overview]
Message-ID: <20220508090954.10864-3-liorna@nvidia.com> (raw)
In-Reply-To: <20220508090954.10864-1-liorna@nvidia.com>
Like in the Tx changes, packet that don't have SecTAG
header aren't necessary been offloaded by the HW.
Therefore, the MACsec driver needs to distinguish if the packet
was offloaded or not and handle accordingly.
Moreover, if there are more than one MACsec device with the same MAC
address as in the packet's destination MAC, the packet will forward only
to this device and only to the desired one.
Used SKB extension and marking it by the HW if the packet was offloaded
and to which MACsec offload device it belongs according to the packet's
SCI.
Signed-off-by: Lior Nahmanson <liorna@nvidia.com>
Reviewed-by: Raed Salem <raeds@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Ben Ben-Ishay <benishay@nvidia.com>
---
drivers/net/macsec.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index 0960339e2442..ee83d6a6e818 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -997,11 +997,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 macsec_ext *macsec_ext;
struct macsec_rxh_data *rxd;
struct macsec_dev *macsec;
rcu_read_lock();
rxd = macsec_data_rcu(skb->dev);
+ macsec_ext = skb_ext_find(skb, SKB_EXT_MACSEC);
list_for_each_entry_rcu(macsec, &rxd->secys, secys) {
struct sk_buff *nskb;
@@ -1011,7 +1013,11 @@ static enum rx_handler_result handle_not_macsec(struct sk_buff *skb)
/* If h/w offloading is enabled, HW decodes frames and strips
* the SecTAG, so we have to deduce which port to deliver to.
*/
- if (macsec_is_offloaded(macsec) && netif_running(ndev)) {
+ if (macsec_is_offloaded(macsec) && netif_running(ndev) &&
+ (!macsec_ext || macsec_ext->offloaded)) {
+ if ((macsec_ext) && (!find_rx_sc(&macsec->secy, macsec_ext->sci)))
+ continue;
+
if (ether_addr_equal_64bits(hdr->h_dest,
ndev->dev_addr)) {
/* exact match, divert skb to this port */
--
2.25.4
next prev parent reply other threads:[~2022-05-08 9:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-08 9:09 [PATCH net-next v1 00/3] Introduce MACsec offload SKB extension Lior Nahmanson
2022-05-08 9:09 ` [PATCH net-next v1 01/03] net/macsec: Add MACsec skb extension Tx Data path support Lior Nahmanson
2022-05-10 9:23 ` Paolo Abeni
2022-05-19 6:26 ` Lior Nahmanson
2022-05-08 9:09 ` Lior Nahmanson [this message]
2022-05-08 9:09 ` [PATCH net-next v1 03/03] net/macsec: Move some code for sharing with various drivers that implements offload Lior Nahmanson
2022-05-08 15:40 ` [PATCH net-next v1 00/3] Introduce MACsec offload SKB extension Leon Romanovsky
2022-05-09 6:41 ` 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=20220508090954.10864-3-liorna@nvidia.com \
--to=liorna@nvidia.com \
--cc=benishay@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jiri@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=raeds@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).