netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: macsec: Retrieve MACSec-XPN attributes before offloading
@ 2022-05-24 11:41 Carlos Fernandez
  2022-05-26  8:59 ` Paolo Abeni
  2022-06-28 11:16 ` Carlos Fernandez
  0 siblings, 2 replies; 9+ messages in thread
From: Carlos Fernandez @ 2022-05-24 11:41 UTC (permalink / raw)
  Cc: carlos.fernandez, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Era Mayflower, open list:NETWORKING DRIVERS,
	open list

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] 9+ messages in thread

* Re: [PATCH net] net: macsec: Retrieve MACSec-XPN attributes before offloading
  2022-05-24 11:41 [PATCH net] net: macsec: Retrieve MACSec-XPN attributes before offloading Carlos Fernandez
@ 2022-05-26  8:59 ` Paolo Abeni
  2022-05-26 12:21   ` Carlos Fernandez
  2022-06-28 11:16 ` Carlos Fernandez
  1 sibling, 1 reply; 9+ messages in thread
From: Paolo Abeni @ 2022-05-26  8:59 UTC (permalink / raw)
  To: Carlos Fernandez
  Cc: carlos.fernandez, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Era Mayflower, open list:NETWORKING DRIVERS, open list

On Tue, 2022-05-24 at 13:41 +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 to nick-picking again, but this patch don't pass checkpatch
validation:

https://patchwork.kernel.org/project/netdevbpf/patch/20220524114134.366696-1-carlos.fernandez@technica-engineering.de/

Specifically, you should add a 'From:' tag as the first line:

From: Carlos Fernandez <carlos.fernandez@technica-engineering.de>

(Or send this patch from the above email address)

Thanks!


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

* Re: [PATCH net] net: macsec: Retrieve MACSec-XPN attributes before offloading
  2022-05-26  8:59 ` Paolo Abeni
@ 2022-05-26 12:21   ` Carlos Fernandez
  0 siblings, 0 replies; 9+ messages in thread
From: Carlos Fernandez @ 2022-05-26 12:21 UTC (permalink / raw)
  To: Paolo Abeni, Carlos Fernandez
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Era Mayflower,
	open list:NETWORKING DRIVERS, open list

Thanks, Paolo.
I'll add the tag and resend it again.

________________________________________
From: Paolo Abeni <pabeni@redhat.com>
Sent: Thursday, May 26, 2022 10:59 AM
To: Carlos Fernandez
Cc: Carlos Fernandez; David S. Miller; Eric Dumazet; Jakub Kicinski; Era Mayflower; open        list:NETWORKING DRIVERS; open list
Subject: Re: [PATCH net] net: macsec: 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 Tue, 2022-05-24 at 13:41 +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 to nick-picking again, but this patch don't pass checkpatch
validation:

https://patchwork.kernel.org/project/netdevbpf/patch/20220524114134.366696-1-carlos.fernandez@technica-engineering.de/

Specifically, you should add a 'From:' tag as the first line:

From: Carlos Fernandez <carlos.fernandez@technica-engineering.de>

(Or send this patch from the above email address)

Thanks!


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

* [PATCH net] net: macsec: Retrieve MACSec-XPN attributes before offloading
  2022-05-24 11:41 [PATCH net] net: macsec: Retrieve MACSec-XPN attributes before offloading Carlos Fernandez
  2022-05-26  8:59 ` Paolo Abeni
@ 2022-06-28 11:16 ` Carlos Fernandez
  2022-06-30  8:16   ` Paolo Abeni
  1 sibling, 1 reply; 9+ messages in thread
From: Carlos Fernandez @ 2022-06-28 11:16 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, mayflowerera, netdev, linux-kernel
  Cc: Carlos Fernandez

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] 9+ messages in thread

* Re: [PATCH net] net: macsec: Retrieve MACSec-XPN attributes before offloading
  2022-06-28 11:16 ` Carlos Fernandez
@ 2022-06-30  8:16   ` Paolo Abeni
  2022-06-30  8:51     ` Carlos Fernandez
  0 siblings, 1 reply; 9+ messages in thread
From: Paolo Abeni @ 2022-06-30  8:16 UTC (permalink / raw)
  To: Carlos Fernandez, davem, edumazet, kuba, mayflowerera, netdev,
	linux-kernel
  Cc: Carlos Fernandez

Hello,

On Tue, 2022-06-28 at 13:16 +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>

This does not pass the checkpatch validation:

https://patchwork.kernel.org/project/netdevbpf/patch/20220628111617.28001-1-carlos.fernandez@technica-engineering.de/

The required 'From: ' tag is still missing.

Please really add it and re-post. Please additionally check your patch
status after the submission via the patchwork UI:

https://patchwork.kernel.org/user/todo/netdevbpf/

so you can detect this kind of issues earlier.

Thanks!

Paolo 
> ---
>  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	[flat|nested] 9+ messages in thread

* Re: [PATCH net] net: macsec: Retrieve MACSec-XPN attributes before offloading
  2022-06-30  8:16   ` Paolo Abeni
@ 2022-06-30  8:51     ` Carlos Fernandez
  2022-06-30 10:00       ` Paolo Abeni
  0 siblings, 1 reply; 9+ messages in thread
From: Carlos Fernandez @ 2022-06-30  8:51 UTC (permalink / raw)
  To: Paolo Abeni, Carlos Fernandez, davem, edumazet, kuba,
	mayflowerera, netdev, linux-kernel

Hi Paolo, 

Sorry about that, I was pretty sure I added it in the first line of the patch and then I used git send-email. 
Is there any way that I can be sure everything is ok before sending it? I'll try again.

Thanks,

________________________________________
From: Paolo Abeni <pabeni@redhat.com>
Sent: Thursday, June 30, 2022 10:16 AM
To: Carlos Fernandez; davem@davemloft.net; edumazet@google.com; kuba@kernel.org; mayflowerera@gmail.com; netdev@vger.kernel.org; linux-kernel@vger.kernel.org
Cc: Carlos Fernandez
Subject: Re: [PATCH net] net: macsec: 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.

Hello,

On Tue, 2022-06-28 at 13:16 +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>

This does not pass the checkpatch validation:

https://patchwork.kernel.org/project/netdevbpf/patch/20220628111617.28001-1-carlos.fernandez@technica-engineering.de/

The required 'From: ' tag is still missing.

Please really add it and re-post. Please additionally check your patch
status after the submission via the patchwork UI:

https://patchwork.kernel.org/user/todo/netdevbpf/

so you can detect this kind of issues earlier.

Thanks!

Paolo
> ---
>  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	[flat|nested] 9+ messages in thread

* Re: [PATCH net] net: macsec: Retrieve MACSec-XPN attributes before offloading
  2022-06-30  8:51     ` Carlos Fernandez
@ 2022-06-30 10:00       ` Paolo Abeni
  0 siblings, 0 replies; 9+ messages in thread
From: Paolo Abeni @ 2022-06-30 10:00 UTC (permalink / raw)
  To: Carlos Fernandez, Carlos Fernandez, davem, edumazet, kuba,
	mayflowerera, netdev, linux-kernel

On Thu, 2022-06-30 at 08:51 +0000, Carlos Fernandez wrote:
> Sorry about that, I was pretty sure I added it in the first line of the patch and then I used git send-email. 
> Is there any way that I can be sure everything is ok before sending it? I'll try again.

As a last resort thing, you can git send-email to another account under
your control (_only_ to that recipient!), git am <email> on a clean -
net tree and check that everything is fine.

Cheers,

Paolo


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

* Re: [PATCH net] net: macsec: Retrieve MACSec-XPN attributes before offloading
  2022-05-26 12:28 Carlos Fernandez
@ 2022-05-28  1:37 ` Jakub Kicinski
  0 siblings, 0 replies; 9+ messages in thread
From: Jakub Kicinski @ 2022-05-28  1:37 UTC (permalink / raw)
  To: Carlos Fernandez
  Cc: David S. Miller, Eric Dumazet, Paolo Abeni, Era Mayflower,
	netdev, linux-kernel

On Thu, 26 May 2022 12:28:00 +0000 Carlos Fernandez wrote:
> From: Carlos Fernandez <carlos.fernandez@technica-engineering.de>
> To: "David S. Miller" <davem@davemloft.net>, Eric Dumazet  <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni  <pabeni@redhat.com>, Era Mayflower <mayflowerera@gmail.com>,  "netdev@vger.kernel.org" <netdev@vger.kernel.org>,  "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
> CC: Carlos Fernandez <carlos.fernandez@technica-engineering.de>
> Subject: [PATCH net] net: macsec: Retrieve MACSec-XPN attributes before  offloading
> Date: Thu, 26 May 2022 12:28:00 +0000
> 
> From 149a8fbcf7a410ed6be0e660d5b83eb9f17decc6 Mon Sep 17 00:00:00 2001
> From: Carlos Fernandez <carlos.fernandez@technica-engineering.de>
> Date: Tue, 24 May 2022 12:29:52 +0200
> Subject: [PATCH net] net: macsec: Retrieve MACSec-XPN attributes before
>  offloading
> 
> 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.

Now git can't detect the patch at all:

$ git pw series apply 645266
Patch is empty.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

:(

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

* [PATCH net] net: macsec: Retrieve MACSec-XPN attributes before offloading
@ 2022-05-26 12:28 Carlos Fernandez
  2022-05-28  1:37 ` Jakub Kicinski
  0 siblings, 1 reply; 9+ messages in thread
From: Carlos Fernandez @ 2022-05-26 12:28 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Era Mayflower, netdev, linux-kernel
  Cc: Carlos Fernandez

From 149a8fbcf7a410ed6be0e660d5b83eb9f17decc6 Mon Sep 17 00:00:00 2001
From: Carlos Fernandez <carlos.fernandez@technica-engineering.de>
Date: Tue, 24 May 2022 12:29:52 +0200
Subject: [PATCH net] net: macsec: Retrieve MACSec-XPN attributes before
 offloading

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);

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

end of thread, other threads:[~2022-06-30 10:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-24 11:41 [PATCH net] net: macsec: Retrieve MACSec-XPN attributes before offloading Carlos Fernandez
2022-05-26  8:59 ` Paolo Abeni
2022-05-26 12:21   ` Carlos Fernandez
2022-06-28 11:16 ` Carlos Fernandez
2022-06-30  8:16   ` Paolo Abeni
2022-06-30  8:51     ` Carlos Fernandez
2022-06-30 10:00       ` Paolo Abeni
2022-05-26 12:28 Carlos Fernandez
2022-05-28  1:37 ` Jakub Kicinski

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).