All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2] net: macsec: retrieve the XPN attributes before offloading
@ 2022-05-06 10:55 Carlos Fernandez
  2022-05-10  7:09 ` Paolo Abeni
  2022-05-18  8:57 ` [PATCH net v2] Retrieve MACSec-XPN " Carlos Fernandez
  0 siblings, 2 replies; 8+ messages in thread
From: Carlos Fernandez @ 2022-05-06 10:55 UTC (permalink / raw)
  To: pabeni, carlos.fernandez, davem, edumazet, kuba, netdev, linux-kernel

When MACsec offloading is used with XPN, before mdo_add_rxsa
and mdo_add_txsa functions are called, the key salt is not
copied to the macsec context struct. Offloaded phys will need
this data when performing offloading.

Fix by copying salt and id to context struct before calling the
offloading functions.

Fixes: 48ef50fa866a ("macsec: Netlink support of XPN cipher suites")

Signed-off-by: Carlos Fernandez <carlos.fernandez@technica-engineering.de>
---
 drivers/net/macsec.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index 832f09ac075e..4f2bd3d722c3 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -1804,6 +1804,14 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info)
 
 	rx_sa->sc = rx_sc;
 
+	if (secy->xpn) {
+		rx_sa->ssci = nla_get_ssci(tb_sa[MACSEC_SA_ATTR_SSCI]);
+		nla_memcpy(rx_sa->key.salt.bytes, tb_sa[MACSEC_SA_ATTR_SALT],
+			   MACSEC_SALT_LEN);
+	}
+
+	nla_memcpy(rx_sa->key.id, tb_sa[MACSEC_SA_ATTR_KEYID], MACSEC_KEYID_LEN);
+
 	/* If h/w offloading is available, propagate to the device */
 	if (macsec_is_offloaded(netdev_priv(dev))) {
 		const struct macsec_ops *ops;
@@ -1826,13 +1834,6 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info)
 			goto cleanup;
 	}
 
-	if (secy->xpn) {
-		rx_sa->ssci = nla_get_ssci(tb_sa[MACSEC_SA_ATTR_SSCI]);
-		nla_memcpy(rx_sa->key.salt.bytes, tb_sa[MACSEC_SA_ATTR_SALT],
-			   MACSEC_SALT_LEN);
-	}
-
-	nla_memcpy(rx_sa->key.id, tb_sa[MACSEC_SA_ATTR_KEYID], MACSEC_KEYID_LEN);
 	rcu_assign_pointer(rx_sc->sa[assoc_num], rx_sa);
 
 	rtnl_unlock();
@@ -2046,6 +2047,14 @@ static int macsec_add_txsa(struct sk_buff *skb, struct genl_info *info)
 	if (assoc_num == tx_sc->encoding_sa && tx_sa->active)
 		secy->operational = true;
 
+	if (secy->xpn) {
+		tx_sa->ssci = nla_get_ssci(tb_sa[MACSEC_SA_ATTR_SSCI]);
+		nla_memcpy(tx_sa->key.salt.bytes, tb_sa[MACSEC_SA_ATTR_SALT],
+			   MACSEC_SALT_LEN);
+	}
+
+	nla_memcpy(tx_sa->key.id, tb_sa[MACSEC_SA_ATTR_KEYID], MACSEC_KEYID_LEN);
+
 	/* If h/w offloading is available, propagate to the device */
 	if (macsec_is_offloaded(netdev_priv(dev))) {
 		const struct macsec_ops *ops;
@@ -2068,13 +2077,6 @@ static int macsec_add_txsa(struct sk_buff *skb, struct genl_info *info)
 			goto cleanup;
 	}
 
-	if (secy->xpn) {
-		tx_sa->ssci = nla_get_ssci(tb_sa[MACSEC_SA_ATTR_SSCI]);
-		nla_memcpy(tx_sa->key.salt.bytes, tb_sa[MACSEC_SA_ATTR_SALT],
-			   MACSEC_SALT_LEN);
-	}
-
-	nla_memcpy(tx_sa->key.id, tb_sa[MACSEC_SA_ATTR_KEYID], MACSEC_KEYID_LEN);
 	rcu_assign_pointer(tx_sc->sa[assoc_num], tx_sa);
 
 	rtnl_unlock();

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH net v2] net: macsec: retrieve the XPN attributes before offloading
  2022-05-06 10:55 [PATCH net v2] net: macsec: retrieve the XPN attributes before offloading Carlos Fernandez
@ 2022-05-10  7:09 ` Paolo Abeni
  2022-05-10  8:01   ` Carlos Fernandez
  2022-05-18  8:57 ` [PATCH net v2] Retrieve MACSec-XPN " Carlos Fernandez
  1 sibling, 1 reply; 8+ messages in thread
From: Paolo Abeni @ 2022-05-10  7:09 UTC (permalink / raw)
  To: Carlos Fernandez, carlos.fernandez, davem, edumazet, kuba,
	netdev, linux-kernel

Hello,

On Fri, 2022-05-06 at 12:55 +0200, Carlos Fernandez wrote:
> When MACsec offloading is used with XPN, before mdo_add_rxsa
> and mdo_add_txsa functions are called, the key salt is not
> copied to the macsec context struct. Offloaded phys will need
> this data when performing offloading.
> 
> Fix by copying salt and id to context struct before calling the
> offloading functions.
> 
> Fixes: 48ef50fa866a ("macsec: Netlink support of XPN cipher suites")
> 
> Signed-off-by: Carlos Fernandez <carlos.fernandez@technica-engineering.de>

I'm sorry for nit-picking, but you must avoid empty lines between the
the 'Fixes' and the 'Signed-off-by' tags (or any other tag).

Additionnaly you should include a summary of the changes WRT the
previous patch version, see e.g. commit cec16052d5a7.

The patch contents looks good, but it's better if you address the
above, thanks!

Paolo


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net v2] net: macsec: retrieve the XPN attributes before offloading
  2022-05-10  7:09 ` Paolo Abeni
@ 2022-05-10  8:01   ` Carlos Fernandez
  0 siblings, 0 replies; 8+ messages in thread
From: Carlos Fernandez @ 2022-05-10  8:01 UTC (permalink / raw)
  To: Paolo Abeni, Carlos Fernandez, davem, edumazet, kuba, netdev,
	linux-kernel

Thanks Paolo,

I'll redo the patch and send it again.
About the changes between the previous patch, there're only changes on the description and format of the patch, but none on the code side, maybe referencing them is irrelevant.

________________________________________
From: Paolo Abeni <pabeni@redhat.com>
Sent: Tuesday, May 10, 2022 9:09 AM
To: Carlos Fernandez; Carlos Fernandez; davem@davemloft.net; edumazet@google.com; kuba@kernel.org; netdev@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2] net: macsec: retrieve the XPN attributes before offloading

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

Hello,

On Fri, 2022-05-06 at 12:55 +0200, Carlos Fernandez wrote:
> When MACsec offloading is used with XPN, before mdo_add_rxsa
> and mdo_add_txsa functions are called, the key salt is not
> copied to the macsec context struct. Offloaded phys will need
> this data when performing offloading.
>
> Fix by copying salt and id to context struct before calling the
> offloading functions.
>
> Fixes: 48ef50fa866a ("macsec: Netlink support of XPN cipher suites")
>
> Signed-off-by: Carlos Fernandez <carlos.fernandez@technica-engineering.de>

I'm sorry for nit-picking, but you must avoid empty lines between the
the 'Fixes' and the 'Signed-off-by' tags (or any other tag).

Additionnaly you should include a summary of the changes WRT the
previous patch version, see e.g. commit cec16052d5a7.

The patch contents looks good, but it's better if you address the
above, thanks!

Paolo


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH net v2] Retrieve MACSec-XPN attributes before offloading
  2022-05-06 10:55 [PATCH net v2] net: macsec: retrieve the XPN attributes before offloading Carlos Fernandez
  2022-05-10  7:09 ` Paolo Abeni
@ 2022-05-18  8:57 ` Carlos Fernandez
  2022-05-18  9:01   ` Carlos Fernandez
  1 sibling, 1 reply; 8+ messages in thread
From: Carlos Fernandez @ 2022-05-18  8:57 UTC (permalink / raw)
  To: pabeni, carlos.fernandez, davem, edumazet, kuba, netdev, linux-kernel

When MACsec offloading is used with XPN, before mdo_add_rxsa
and mdo_add_txsa functions are called, the key salt is not
copied to the macsec context struct. Offloaded phys will need
this data when performing offloading.

Fix by copying salt and id to context struct before calling the
offloading functions.

Fixes: 48ef50fa866a ("macsec: Netlink support of XPN cipher suites")
Signed-off-by: Carlos Fernandez <carlos.fernandez@technica-engineering.de>
---
 drivers/net/macsec.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index 832f09ac075e..4f2bd3d722c3 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -1804,6 +1804,14 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info)
 
 	rx_sa->sc = rx_sc;
 
+	if (secy->xpn) {
+		rx_sa->ssci = nla_get_ssci(tb_sa[MACSEC_SA_ATTR_SSCI]);
+		nla_memcpy(rx_sa->key.salt.bytes, tb_sa[MACSEC_SA_ATTR_SALT],
+			   MACSEC_SALT_LEN);
+	}
+
+	nla_memcpy(rx_sa->key.id, tb_sa[MACSEC_SA_ATTR_KEYID], MACSEC_KEYID_LEN);
+
 	/* If h/w offloading is available, propagate to the device */
 	if (macsec_is_offloaded(netdev_priv(dev))) {
 		const struct macsec_ops *ops;
@@ -1826,13 +1834,6 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info)
 			goto cleanup;
 	}
 
-	if (secy->xpn) {
-		rx_sa->ssci = nla_get_ssci(tb_sa[MACSEC_SA_ATTR_SSCI]);
-		nla_memcpy(rx_sa->key.salt.bytes, tb_sa[MACSEC_SA_ATTR_SALT],
-			   MACSEC_SALT_LEN);
-	}
-
-	nla_memcpy(rx_sa->key.id, tb_sa[MACSEC_SA_ATTR_KEYID], MACSEC_KEYID_LEN);
 	rcu_assign_pointer(rx_sc->sa[assoc_num], rx_sa);
 
 	rtnl_unlock();
@@ -2046,6 +2047,14 @@ static int macsec_add_txsa(struct sk_buff *skb, struct genl_info *info)
 	if (assoc_num == tx_sc->encoding_sa && tx_sa->active)
 		secy->operational = true;
 
+	if (secy->xpn) {
+		tx_sa->ssci = nla_get_ssci(tb_sa[MACSEC_SA_ATTR_SSCI]);
+		nla_memcpy(tx_sa->key.salt.bytes, tb_sa[MACSEC_SA_ATTR_SALT],
+			   MACSEC_SALT_LEN);
+	}
+
+	nla_memcpy(tx_sa->key.id, tb_sa[MACSEC_SA_ATTR_KEYID], MACSEC_KEYID_LEN);
+
 	/* If h/w offloading is available, propagate to the device */
 	if (macsec_is_offloaded(netdev_priv(dev))) {
 		const struct macsec_ops *ops;
@@ -2068,13 +2077,6 @@ static int macsec_add_txsa(struct sk_buff *skb, struct genl_info *info)
 			goto cleanup;
 	}
 
-	if (secy->xpn) {
-		tx_sa->ssci = nla_get_ssci(tb_sa[MACSEC_SA_ATTR_SSCI]);
-		nla_memcpy(tx_sa->key.salt.bytes, tb_sa[MACSEC_SA_ATTR_SALT],
-			   MACSEC_SALT_LEN);
-	}
-
-	nla_memcpy(tx_sa->key.id, tb_sa[MACSEC_SA_ATTR_KEYID], MACSEC_KEYID_LEN);
 	rcu_assign_pointer(tx_sc->sa[assoc_num], tx_sa);
 
 	rtnl_unlock();
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net v2] Retrieve MACSec-XPN attributes before offloading
  2022-05-18  8:57 ` [PATCH net v2] Retrieve MACSec-XPN " Carlos Fernandez
@ 2022-05-18  9:01   ` Carlos Fernandez
  2022-05-18 16:23     ` Jakub Kicinski
  0 siblings, 1 reply; 8+ messages in thread
From: Carlos Fernandez @ 2022-05-18  9:01 UTC (permalink / raw)
  To: pabeni, carlos.fernandez, davem, edumazet, kuba, netdev, linux-kernel

When MACsec offloading is used with XPN, before mdo_add_rxsa
and mdo_add_txsa functions are called, the key salt is not
copied to the macsec context struct. Offloaded phys will need
this data when performing offloading.

Fix by copying salt and id to context struct before calling the
offloading functions.

Fixes: 48ef50fa866a ("macsec: Netlink support of XPN cipher suites")
Signed-off-by: Carlos Fernandez <carlos.fernandez@technica-engineering.de>
---
 drivers/net/macsec.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index 832f09ac075e..4f2bd3d722c3 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -1804,6 +1804,14 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info)
 
 	rx_sa->sc = rx_sc;
 
+	if (secy->xpn) {
+		rx_sa->ssci = nla_get_ssci(tb_sa[MACSEC_SA_ATTR_SSCI]);
+		nla_memcpy(rx_sa->key.salt.bytes, tb_sa[MACSEC_SA_ATTR_SALT],
+			   MACSEC_SALT_LEN);
+	}
+
+	nla_memcpy(rx_sa->key.id, tb_sa[MACSEC_SA_ATTR_KEYID], MACSEC_KEYID_LEN);
+
 	/* If h/w offloading is available, propagate to the device */
 	if (macsec_is_offloaded(netdev_priv(dev))) {
 		const struct macsec_ops *ops;
@@ -1826,13 +1834,6 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info)
 			goto cleanup;
 	}
 
-	if (secy->xpn) {
-		rx_sa->ssci = nla_get_ssci(tb_sa[MACSEC_SA_ATTR_SSCI]);
-		nla_memcpy(rx_sa->key.salt.bytes, tb_sa[MACSEC_SA_ATTR_SALT],
-			   MACSEC_SALT_LEN);
-	}
-
-	nla_memcpy(rx_sa->key.id, tb_sa[MACSEC_SA_ATTR_KEYID], MACSEC_KEYID_LEN);
 	rcu_assign_pointer(rx_sc->sa[assoc_num], rx_sa);
 
 	rtnl_unlock();
@@ -2046,6 +2047,14 @@ static int macsec_add_txsa(struct sk_buff *skb, struct genl_info *info)
 	if (assoc_num == tx_sc->encoding_sa && tx_sa->active)
 		secy->operational = true;
 
+	if (secy->xpn) {
+		tx_sa->ssci = nla_get_ssci(tb_sa[MACSEC_SA_ATTR_SSCI]);
+		nla_memcpy(tx_sa->key.salt.bytes, tb_sa[MACSEC_SA_ATTR_SALT],
+			   MACSEC_SALT_LEN);
+	}
+
+	nla_memcpy(tx_sa->key.id, tb_sa[MACSEC_SA_ATTR_KEYID], MACSEC_KEYID_LEN);
+
 	/* If h/w offloading is available, propagate to the device */
 	if (macsec_is_offloaded(netdev_priv(dev))) {
 		const struct macsec_ops *ops;
@@ -2068,13 +2077,6 @@ static int macsec_add_txsa(struct sk_buff *skb, struct genl_info *info)
 			goto cleanup;
 	}
 
-	if (secy->xpn) {
-		tx_sa->ssci = nla_get_ssci(tb_sa[MACSEC_SA_ATTR_SSCI]);
-		nla_memcpy(tx_sa->key.salt.bytes, tb_sa[MACSEC_SA_ATTR_SALT],
-			   MACSEC_SALT_LEN);
-	}
-
-	nla_memcpy(tx_sa->key.id, tb_sa[MACSEC_SA_ATTR_KEYID], MACSEC_KEYID_LEN);
 	rcu_assign_pointer(tx_sc->sa[assoc_num], tx_sa);

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH net v2] Retrieve MACSec-XPN attributes before offloading
  2022-05-18  9:01   ` Carlos Fernandez
@ 2022-05-18 16:23     ` Jakub Kicinski
  2022-05-19  7:43       ` Carlos Fernandez
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2022-05-18 16:23 UTC (permalink / raw)
  To: Carlos Fernandez
  Cc: pabeni, carlos.fernandez, davem, edumazet, netdev, linux-kernel

On Wed, 18 May 2022 11:01:51 +0200 Carlos Fernandez wrote:
> When MACsec offloading is used with XPN, before mdo_add_rxsa
> and mdo_add_txsa functions are called, the key salt is not
> copied to the macsec context struct. Offloaded phys will need
> this data when performing offloading.
> 
> Fix by copying salt and id to context struct before calling the
> offloading functions.
> 
> Fixes: 48ef50fa866a ("macsec: Netlink support of XPN cipher suites")
> Signed-off-by: Carlos Fernandez <carlos.fernandez@technica-engineering.de>

Does not apply to net, please rebase.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net v2] Retrieve MACSec-XPN attributes before offloading
  2022-05-18 16:23     ` Jakub Kicinski
@ 2022-05-19  7:43       ` Carlos Fernandez
  2022-05-19 16:04         ` Jakub Kicinski
  0 siblings, 1 reply; 8+ messages in thread
From: Carlos Fernandez @ 2022-05-19  7:43 UTC (permalink / raw)
  To: Jakub Kicinski, Carlos Fernandez
  Cc: pabeni, davem, edumazet, netdev, linux-kernel

Where should I rebase it? Thanks.

________________________________________
From: Jakub Kicinski <kuba@kernel.org>
Sent: Wednesday, May 18, 2022 6:23 PM
To: Carlos Fernandez
Cc: pabeni@redhat.com; Carlos Fernandez; davem@davemloft.net; edumazet@google.com; netdev@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2] Retrieve MACSec-XPN attributes before offloading

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

On Wed, 18 May 2022 11:01:51 +0200 Carlos Fernandez wrote:
> When MACsec offloading is used with XPN, before mdo_add_rxsa
> and mdo_add_txsa functions are called, the key salt is not
> copied to the macsec context struct. Offloaded phys will need
> this data when performing offloading.
>
> Fix by copying salt and id to context struct before calling the
> offloading functions.
>
> Fixes: 48ef50fa866a ("macsec: Netlink support of XPN cipher suites")
> Signed-off-by: Carlos Fernandez <carlos.fernandez@technica-engineering.de>

Does not apply to net, please rebase.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net v2] Retrieve MACSec-XPN attributes before offloading
  2022-05-19  7:43       ` Carlos Fernandez
@ 2022-05-19 16:04         ` Jakub Kicinski
  0 siblings, 0 replies; 8+ messages in thread
From: Jakub Kicinski @ 2022-05-19 16:04 UTC (permalink / raw)
  To: Carlos Fernandez
  Cc: Carlos Fernandez, pabeni, davem, edumazet, netdev, linux-kernel

On Thu, 19 May 2022 07:43:43 +0000 Carlos Fernandez wrote:
> Where should I rebase it? Thanks.

Oh, not where - on what. Check out the master branch of this tree:

https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/

git cherry-pick the patch on top of it, resolve the conflicts if any,
make sure it still works, git format-patch, git send-email..

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-05-19 16:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06 10:55 [PATCH net v2] net: macsec: retrieve the XPN attributes before offloading Carlos Fernandez
2022-05-10  7:09 ` Paolo Abeni
2022-05-10  8:01   ` Carlos Fernandez
2022-05-18  8:57 ` [PATCH net v2] Retrieve MACSec-XPN " Carlos Fernandez
2022-05-18  9:01   ` Carlos Fernandez
2022-05-18 16:23     ` Jakub Kicinski
2022-05-19  7:43       ` Carlos Fernandez
2022-05-19 16:04         ` Jakub Kicinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.