[v3] common/mlx5: fix storing the synched MAC to internal table

Message ID 20210202174841.15784-1-sodey@rbbn.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series [v3] common/mlx5: fix storing the synched MAC to internal table |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing warning Testing issues

Commit Message

Dey, Souvik Feb. 2, 2021, 5:48 p.m. UTC
  From: Souvik Dey <sodey@rbbn.com>

As the internal MAC table is divided into Unicast and Multicast address
sections, we should check the type of synched MAC address before storing
it to the internal table. Currently the check is not done, and the
synched MAC of 33:33:00:00:00:01 gets stored in the unicast section
(mostly index 1) causing all subsequent mlx5_set_mc_addr_list()
to fail with error -EADDRINUSE, as the mac_list contains the MAC
33:33:00:00:00:01. This denies adding of any new multicast address to
the internal list and also fails to add the MAC address to the device
in case of SR-IOV VF.

Fixes: f22442cb5d42 ('net/mlx5: reduce Netlink commands dependencies')
Fixes: ccdcba53a3f4 ('net/mlx5: use Netlink to add/remove MAC addresses')
Cc: stable@dpdk.org

Signed-off-by: Souvik Dey <sodey@rbbn.com>
---
v2:
* net/ -> common/
* space after mlx5:
* synched -> synched
* section -> sections
* rewording which causes -> causing 
* typo: case (to remove)
* added Fixes for LTS ML
---
v3:
* Changed the "" in Fixes tags to ''.
---
 drivers/common/mlx5/linux/mlx5_nl.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
  

Comments

Slava Ovsiienko Feb. 3, 2021, 8:04 a.m. UTC | #1
Hi,

I'm sorry, but quota character in "Fixes" tags is still wrong, causing the checking script errors.
It should be " (0x22 ASCII), not ' (0x27 ASCII).

Beside this:

Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

> -----Original Message-----
> From: Dey, Souvik <sodey@rbbn.com>
> Sent: Tuesday, February 2, 2021 19:49
> To: Raslan Darawsheh <rasland@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Shahaf
> Shuler <shahafs@nvidia.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Souvik Dey <sodey@rbbn.com>
> Subject: [PATCH v3] common/mlx5: fix storing the synched MAC to internal
> table
> 
> From: Souvik Dey <sodey@rbbn.com>
> 
> As the internal MAC table is divided into Unicast and Multicast address
> sections, we should check the type of synched MAC address before storing it
> to the internal table. Currently the check is not done, and the synched MAC of
> 33:33:00:00:00:01 gets stored in the unicast section (mostly index 1) causing
> all subsequent mlx5_set_mc_addr_list() to fail with error -EADDRINUSE, as the
> mac_list contains the MAC 33:33:00:00:00:01. This denies adding of any new
> multicast address to the internal list and also fails to add the MAC address to
> the device in case of SR-IOV VF.
> 
> Fixes: f22442cb5d42 ('net/mlx5: reduce Netlink commands dependencies')
> Fixes: ccdcba53a3f4 ('net/mlx5: use Netlink to add/remove MAC addresses')
> Cc: stable@dpdk.org
> 
> Signed-off-by: Souvik Dey <sodey@rbbn.com>
> ---
> v2:
> * net/ -> common/
> * space after mlx5:
> * synched -> synched
> * section -> sections
> * rewording which causes -> causing
> * typo: case (to remove)
> * added Fixes for LTS ML
> ---
> v3:
> * Changed the "" in Fixes tags to ''.
> ---
>  drivers/common/mlx5/linux/mlx5_nl.c | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/common/mlx5/linux/mlx5_nl.c
> b/drivers/common/mlx5/linux/mlx5_nl.c
> index 40d8620..ef7a521 100644
> --- a/drivers/common/mlx5/linux/mlx5_nl.c
> +++ b/drivers/common/mlx5/linux/mlx5_nl.c
> @@ -758,11 +758,21 @@ mlx5_nl_mac_addr_sync(int nlsk_fd, unsigned int
> iface_idx,
>  				break;
>  		if (j != n)
>  			continue;
> -		/* Find the first entry available. */
> -		for (j = 0; j != n; ++j) {
> -			if (rte_is_zero_ether_addr(&mac_addrs[j])) {
> -				mac_addrs[j] = macs[i];
> -				break;
> +		if (rte_is_multicast_ether_addr(&macs[i])) {
> +			/* Find the first entry available. */
> +			for (j = MLX5_MAX_UC_MAC_ADDRESSES; j != n; ++j)
> {
> +				if (rte_is_zero_ether_addr(&mac_addrs[j])) {
> +					mac_addrs[j] = macs[i];
> +					break;
> +				}
> +			}
> +		} else {
> +			/* Find the first entry available. */
> +			for (j = 0; j != MLX5_MAX_UC_MAC_ADDRESSES; ++j)
> {
> +				if (rte_is_zero_ether_addr(&mac_addrs[j])) {
> +					mac_addrs[j] = macs[i];
> +					break;
> +				}
>  			}
>  		}
>  	}
> --
> 2.9.3.windows.1
> 
> 
> Notice: This e-mail together with any attachments may contain information of
> Ribbon Communications Inc. and its Affiliates that is confidential and/or
> proprietary for the sole use of the intended recipient. Any review, disclosure,
> reliance or distribution by others or forwarding without express permission is
> strictly prohibited. If you are not the intended recipient, please notify the
> sender immediately and then delete all copies, including any attachments.
  
Dey, Souvik Feb. 3, 2021, 12:09 p.m. UTC | #2
Hi Slava,
	Initially v2 of the patch has " instead of ' in the Fixes tags, but it gave some warnings as wrong quota. So thought of changing it to '. I can change it back again, do you suggest me to submit v4 with with corrected quota character or its ok to have the v3 of the patch itself as you have already acked ?

--
Regards,
Souvik

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Slava Ovsiienko
Sent: Wednesday, February 3, 2021 3:04 AM
To: Dey, Souvik <sodey@rbbn.com>; Raslan Darawsheh <rasland@nvidia.com>; Matan Azrad <matan@nvidia.com>
Cc: dev@dpdk.org; stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v3] common/mlx5: fix storing the synched MAC to internal table

NOTICE: This email was received from an EXTERNAL sender.


Hi,

I'm sorry, but quota character in "Fixes" tags is still wrong, causing the checking script errors.
It should be " (0x22 ASCII), not ' (0x27 ASCII).

Beside this:

Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

> -----Original Message-----
> From: Dey, Souvik <sodey@rbbn.com>
> Sent: Tuesday, February 2, 2021 19:49
> To: Raslan Darawsheh <rasland@nvidia.com>; Slava Ovsiienko 
> <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Shahaf 
> Shuler <shahafs@nvidia.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Souvik Dey <sodey@rbbn.com>
> Subject: [PATCH v3] common/mlx5: fix storing the synched MAC to 
> internal table
>
> From: Souvik Dey <sodey@rbbn.com>
>
> As the internal MAC table is divided into Unicast and Multicast 
> address sections, we should check the type of synched MAC address 
> before storing it to the internal table. Currently the check is not 
> done, and the synched MAC of
> 33:33:00:00:00:01 gets stored in the unicast section (mostly index 1) 
> causing all subsequent mlx5_set_mc_addr_list() to fail with error 
> -EADDRINUSE, as the mac_list contains the MAC 33:33:00:00:00:01. This 
> denies adding of any new multicast address to the internal list and 
> also fails to add the MAC address to the device in case of SR-IOV VF.
>
> Fixes: f22442cb5d42 ('net/mlx5: reduce Netlink commands dependencies')
> Fixes: ccdcba53a3f4 ('net/mlx5: use Netlink to add/remove MAC 
> addresses')
> Cc: stable@dpdk.org
>
> Signed-off-by: Souvik Dey <sodey@rbbn.com>
> ---
> v2:
> * net/ -> common/
> * space after mlx5:
> * synched -> synched
> * section -> sections
> * rewording which causes -> causing
> * typo: case (to remove)
> * added Fixes for LTS ML
> ---
> v3:
> * Changed the "" in Fixes tags to ''.
> ---
>  drivers/common/mlx5/linux/mlx5_nl.c | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/common/mlx5/linux/mlx5_nl.c
> b/drivers/common/mlx5/linux/mlx5_nl.c
> index 40d8620..ef7a521 100644
> --- a/drivers/common/mlx5/linux/mlx5_nl.c
> +++ b/drivers/common/mlx5/linux/mlx5_nl.c
> @@ -758,11 +758,21 @@ mlx5_nl_mac_addr_sync(int nlsk_fd, unsigned int 
> iface_idx,
>                               break;
>               if (j != n)
>                       continue;
> -             /* Find the first entry available. */
> -             for (j = 0; j != n; ++j) {
> -                     if (rte_is_zero_ether_addr(&mac_addrs[j])) {
> -                             mac_addrs[j] = macs[i];
> -                             break;
> +             if (rte_is_multicast_ether_addr(&macs[i])) {
> +                     /* Find the first entry available. */
> +                     for (j = MLX5_MAX_UC_MAC_ADDRESSES; j != n; ++j)
> {
> +                             if (rte_is_zero_ether_addr(&mac_addrs[j])) {
> +                                     mac_addrs[j] = macs[i];
> +                                     break;
> +                             }
> +                     }
> +             } else {
> +                     /* Find the first entry available. */
> +                     for (j = 0; j != MLX5_MAX_UC_MAC_ADDRESSES; ++j)
> {
> +                             if (rte_is_zero_ether_addr(&mac_addrs[j])) {
> +                                     mac_addrs[j] = macs[i];
> +                                     break;
> +                             }
>                       }
>               }
>       }
> --
> 2.9.3.windows.1
>
>

Notice: This e-mail together with any attachments may contain information of Ribbon Communications Inc. and its Affiliates that is confidential and/or proprietary for the sole use of the intended recipient. Any review, disclosure, reliance or distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please notify the sender immediately and then delete all copies, including any attachments.
  
Slava Ovsiienko Feb. 3, 2021, 2:15 p.m. UTC | #3
> back again, do you suggest me to submit v4 with with corrected quota
> character or its ok to have the v3 of the patch itself as you have already
> acked ?

OK, let's ask Raslan to fix this minor issue while integrating the patch.
Raslan, could you, please, fix the quota character in the commit message?

With best regards, Slava

> -----Original Message-----
> From: Dey, Souvik <sodey@rbbn.com>
> Sent: Wednesday, February 3, 2021 14:09
> To: Slava Ovsiienko <viacheslavo@nvidia.com>; Raslan Darawsheh
> <rasland@nvidia.com>; Matan Azrad <matan@nvidia.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: RE: [PATCH v3] common/mlx5: fix storing the synched MAC to
> internal table
> 
> Hi Slava,
> 	Initially v2 of the patch has " instead of ' in the Fixes tags, but it gave
> some warnings as wrong quota. So thought of changing it to '. I can change it
> back again, do you suggest me to submit v4 with with corrected quota
> character or its ok to have the v3 of the patch itself as you have already
> acked ?
> 
> --
> Regards,
> Souvik
> 
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Slava Ovsiienko
> Sent: Wednesday, February 3, 2021 3:04 AM
> To: Dey, Souvik <sodey@rbbn.com>; Raslan Darawsheh
> <rasland@nvidia.com>; Matan Azrad <matan@nvidia.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3] common/mlx5: fix storing the synched
> MAC to internal table
> 
> NOTICE: This email was received from an EXTERNAL sender.
> 
> 
> Hi,
> 
> I'm sorry, but quota character in "Fixes" tags is still wrong, causing the
> checking script errors.
> It should be " (0x22 ASCII), not ' (0x27 ASCII).
> 
> Beside this:
> 
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> 
> > -----Original Message-----
> > From: Dey, Souvik <sodey@rbbn.com>
> > Sent: Tuesday, February 2, 2021 19:49
> > To: Raslan Darawsheh <rasland@nvidia.com>; Slava Ovsiienko
> > <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Shahaf
> > Shuler <shahafs@nvidia.com>
> > Cc: dev@dpdk.org; stable@dpdk.org; Souvik Dey <sodey@rbbn.com>
> > Subject: [PATCH v3] common/mlx5: fix storing the synched MAC to
> > internal table
> >
> > From: Souvik Dey <sodey@rbbn.com>
> >
> > As the internal MAC table is divided into Unicast and Multicast
> > address sections, we should check the type of synched MAC address
> > before storing it to the internal table. Currently the check is not
> > done, and the synched MAC of
> > 33:33:00:00:00:01 gets stored in the unicast section (mostly index 1)
> > causing all subsequent mlx5_set_mc_addr_list() to fail with error
> > -EADDRINUSE, as the mac_list contains the MAC 33:33:00:00:00:01. This
> > denies adding of any new multicast address to the internal list and
> > also fails to add the MAC address to the device in case of SR-IOV VF.
> >
> > Fixes: f22442cb5d42 ('net/mlx5: reduce Netlink commands dependencies')
> > Fixes: ccdcba53a3f4 ('net/mlx5: use Netlink to add/remove MAC
> > addresses')
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Souvik Dey <sodey@rbbn.com>
> > ---
> > v2:
> > * net/ -> common/
> > * space after mlx5:
> > * synched -> synched
> > * section -> sections
> > * rewording which causes -> causing
> > * typo: case (to remove)
> > * added Fixes for LTS ML
> > ---
> > v3:
> > * Changed the "" in Fixes tags to ''.
> > ---
> >  drivers/common/mlx5/linux/mlx5_nl.c | 20 +++++++++++++++-----
> >  1 file changed, 15 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/common/mlx5/linux/mlx5_nl.c
> > b/drivers/common/mlx5/linux/mlx5_nl.c
> > index 40d8620..ef7a521 100644
> > --- a/drivers/common/mlx5/linux/mlx5_nl.c
> > +++ b/drivers/common/mlx5/linux/mlx5_nl.c
> > @@ -758,11 +758,21 @@ mlx5_nl_mac_addr_sync(int nlsk_fd, unsigned
> int
> > iface_idx,
> >                               break;
> >               if (j != n)
> >                       continue;
> > -             /* Find the first entry available. */
> > -             for (j = 0; j != n; ++j) {
> > -                     if (rte_is_zero_ether_addr(&mac_addrs[j])) {
> > -                             mac_addrs[j] = macs[i];
> > -                             break;
> > +             if (rte_is_multicast_ether_addr(&macs[i])) {
> > +                     /* Find the first entry available. */
> > +                     for (j = MLX5_MAX_UC_MAC_ADDRESSES; j != n; ++j)
> > {
> > +                             if (rte_is_zero_ether_addr(&mac_addrs[j])) {
> > +                                     mac_addrs[j] = macs[i];
> > +                                     break;
> > +                             }
> > +                     }
> > +             } else {
> > +                     /* Find the first entry available. */
> > +                     for (j = 0; j != MLX5_MAX_UC_MAC_ADDRESSES; ++j)
> > {
> > +                             if (rte_is_zero_ether_addr(&mac_addrs[j])) {
> > +                                     mac_addrs[j] = macs[i];
> > +                                     break;
> > +                             }
> >                       }
> >               }
> >       }
> > --
> > 2.9.3.windows.1
> >
> >
> 
> Notice: This e-mail together with any attachments may contain information
> of Ribbon Communications Inc. and its Affiliates that is confidential and/or
> proprietary for the sole use of the intended recipient. Any review, disclosure,
> reliance or distribution by others or forwarding without express permission
> is strictly prohibited. If you are not the intended recipient, please notify the
> sender immediately and then delete all copies, including any attachments.
  
Raslan Darawsheh Feb. 3, 2021, 2:34 p.m. UTC | #4
> -----Original Message-----
> From: Slava Ovsiienko <viacheslavo@nvidia.com>
> Sent: Wednesday, February 3, 2021 4:15 PM
> To: Dey, Souvik <sodey@rbbn.com>; Raslan Darawsheh
> <rasland@nvidia.com>; Matan Azrad <matan@nvidia.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: RE: [PATCH v3] common/mlx5: fix storing the synched MAC to
> internal table
> 
> > back again, do you suggest me to submit v4 with with corrected quota
> > character or its ok to have the v3 of the patch itself as you have already
> > acked ?
> 
> OK, let's ask Raslan to fix this minor issue while integrating the patch.
> Raslan, could you, please, fix the quota character in the commit message?
Sure, will handle on integration,
> 
> With best regards, Slava
> 
Kindest regards
Raslan Darawsheh
  
Raslan Darawsheh Feb. 4, 2021, 10:43 a.m. UTC | #5
Hi,

> -----Original Message-----
> From: Dey, Souvik <sodey@rbbn.com>
> Sent: Tuesday, February 2, 2021 7:49 PM
> To: Raslan Darawsheh <rasland@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Shahaf
> Shuler <shahafs@nvidia.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Souvik Dey <sodey@rbbn.com>
> Subject: [PATCH v3] common/mlx5: fix storing the synched MAC to internal
> table
> 
> From: Souvik Dey <sodey@rbbn.com>
> 
> As the internal MAC table is divided into Unicast and Multicast address
> sections, we should check the type of synched MAC address before storing
> it to the internal table. Currently the check is not done, and the
> synched MAC of 33:33:00:00:00:01 gets stored in the unicast section
> (mostly index 1) causing all subsequent mlx5_set_mc_addr_list()
> to fail with error -EADDRINUSE, as the mac_list contains the MAC
> 33:33:00:00:00:01. This denies adding of any new multicast address to
> the internal list and also fails to add the MAC address to the device
> in case of SR-IOV VF.
> 
> Fixes: f22442cb5d42 ('net/mlx5: reduce Netlink commands dependencies')
> Fixes: ccdcba53a3f4 ('net/mlx5: use Netlink to add/remove MAC addresses')
Replaced  ' to "
> Cc: stable@dpdk.org
> 
> Signed-off-by: Souvik Dey <sodey@rbbn.com>
> ---
> v2:
> * net/ -> common/
> * space after mlx5:
> * synched -> synched
> * section -> sections
> * rewording which causes -> causing
> * typo: case (to remove)
> * added Fixes for LTS ML
> ---
> v3:
> * Changed the "" in Fixes tags to ''.
> 

Patch applied to next-net-mlx,

Kindest regards
Raslan Darawsheh
  

Patch

diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c
index 40d8620..ef7a521 100644
--- a/drivers/common/mlx5/linux/mlx5_nl.c
+++ b/drivers/common/mlx5/linux/mlx5_nl.c
@@ -758,11 +758,21 @@  mlx5_nl_mac_addr_sync(int nlsk_fd, unsigned int iface_idx,
 				break;
 		if (j != n)
 			continue;
-		/* Find the first entry available. */
-		for (j = 0; j != n; ++j) {
-			if (rte_is_zero_ether_addr(&mac_addrs[j])) {
-				mac_addrs[j] = macs[i];
-				break;
+		if (rte_is_multicast_ether_addr(&macs[i])) {
+			/* Find the first entry available. */
+			for (j = MLX5_MAX_UC_MAC_ADDRESSES; j != n; ++j) {
+				if (rte_is_zero_ether_addr(&mac_addrs[j])) {
+					mac_addrs[j] = macs[i];
+					break;
+				}
+			}
+		} else {
+			/* Find the first entry available. */
+			for (j = 0; j != MLX5_MAX_UC_MAC_ADDRESSES; ++j) {
+				if (rte_is_zero_ether_addr(&mac_addrs[j])) {
+					mac_addrs[j] = macs[i];
+					break;
+				}
 			}
 		}
 	}