patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 19.11] net/mlx5: fix storing the synched MAC to internal table
@ 2021-02-12 15:10 Dey, Souvik
  2021-02-15 12:21 ` Christian Ehrhardt
  2021-02-17 21:03 ` [dpdk-stable] [PATCH 19.11 v2] " Dey, Souvik
  0 siblings, 2 replies; 4+ messages in thread
From: Dey, Souvik @ 2021-02-12 15:10 UTC (permalink / raw)
  To: viacheslavo, shahafs, matan, rasland, stable
  Cc: christian.ehrhardt, dev, Souvik Dey

From: Souvik Dey <sodey@rbbn.com>

[ upstream commit 493f0bb51c1144eedcff2bba199cab1b64ff9fd0 ]

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

Signed-off-by: Souvik Dey <sodey@rbbn.com>
---
 drivers/net/mlx5/mlx5_nl.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c
index 64580b9..add756d 100644
--- a/drivers/net/mlx5/mlx5_nl.c
+++ b/drivers/net/mlx5/mlx5_nl.c
@@ -678,11 +678,22 @@ mlx5_nl_mac_addr_sync(struct rte_eth_dev *dev)
 				break;
 		if (j != MLX5_MAX_MAC_ADDRESSES)
 			continue;
-		/* Find the first entry available. */
-		for (j = 0; j != MLX5_MAX_MAC_ADDRESSES; ++j) {
-			if (rte_is_zero_ether_addr(&dev->data->mac_addrs[j])) {
-				dev->data->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 != MLX5_MAX_MAC_ADDRESSES; ++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.

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

* Re: [dpdk-stable] [PATCH 19.11] net/mlx5: fix storing the synched MAC to internal table
  2021-02-12 15:10 [dpdk-stable] [PATCH 19.11] net/mlx5: fix storing the synched MAC to internal table Dey, Souvik
@ 2021-02-15 12:21 ` Christian Ehrhardt
  2021-02-15 16:41   ` Christian Ehrhardt
  2021-02-17 21:03 ` [dpdk-stable] [PATCH 19.11 v2] " Dey, Souvik
  1 sibling, 1 reply; 4+ messages in thread
From: Christian Ehrhardt @ 2021-02-15 12:21 UTC (permalink / raw)
  To: Dey, Souvik; +Cc: viacheslavo, shahafs, matan, rasland, dpdk stable, dev

On Fri, Feb 12, 2021 at 4:10 PM Dey, Souvik <sodey@rbbn.com> wrote:
>
> From: Souvik Dey <sodey@rbbn.com>
>
> [ upstream commit 493f0bb51c1144eedcff2bba199cab1b64ff9fd0 ]

Thanks, added

>
> 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")
>
> Signed-off-by: Souvik Dey <sodey@rbbn.com>
> ---
>  drivers/net/mlx5/mlx5_nl.c | 21 ++++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c
> index 64580b9..add756d 100644
> --- a/drivers/net/mlx5/mlx5_nl.c
> +++ b/drivers/net/mlx5/mlx5_nl.c
> @@ -678,11 +678,22 @@ mlx5_nl_mac_addr_sync(struct rte_eth_dev *dev)
>                                 break;
>                 if (j != MLX5_MAX_MAC_ADDRESSES)
>                         continue;
> -               /* Find the first entry available. */
> -               for (j = 0; j != MLX5_MAX_MAC_ADDRESSES; ++j) {
> -                       if (rte_is_zero_ether_addr(&dev->data->mac_addrs[j])) {
> -                               dev->data->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 != MLX5_MAX_MAC_ADDRESSES; ++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.



-- 
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd

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

* Re: [dpdk-stable] [PATCH 19.11] net/mlx5: fix storing the synched MAC to internal table
  2021-02-15 12:21 ` Christian Ehrhardt
@ 2021-02-15 16:41   ` Christian Ehrhardt
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Ehrhardt @ 2021-02-15 16:41 UTC (permalink / raw)
  To: Dey, Souvik; +Cc: viacheslavo, shahafs, matan, rasland, dpdk stable, dev

On Mon, Feb 15, 2021 at 1:21 PM Christian Ehrhardt
<christian.ehrhardt@canonical.com> wrote:
>
> On Fri, Feb 12, 2021 at 4:10 PM Dey, Souvik <sodey@rbbn.com> wrote:
> >
> > From: Souvik Dey <sodey@rbbn.com>
> >
> > [ upstream commit 493f0bb51c1144eedcff2bba199cab1b64ff9fd0 ]
>
> Thanks, added
>
> >
> > 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")
> >
> > Signed-off-by: Souvik Dey <sodey@rbbn.com>
> > ---
> >  drivers/net/mlx5/mlx5_nl.c | 21 ++++++++++++++++-----
> >  1 file changed, 16 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c
> > index 64580b9..add756d 100644
> > --- a/drivers/net/mlx5/mlx5_nl.c
> > +++ b/drivers/net/mlx5/mlx5_nl.c
> > @@ -678,11 +678,22 @@ mlx5_nl_mac_addr_sync(struct rte_eth_dev *dev)
> >                                 break;
> >                 if (j != MLX5_MAX_MAC_ADDRESSES)
> >                         continue;
> > -               /* Find the first entry available. */
> > -               for (j = 0; j != MLX5_MAX_MAC_ADDRESSES; ++j) {
> > -                       if (rte_is_zero_ether_addr(&dev->data->mac_addrs[j])) {
> > -                               dev->data->mac_addrs[j] = macs[i];


When built this fails, thereby for now I've dequeued this from 19.11.7

[  708s] ../drivers/net/mlx5/mlx5_nl.c: In function ‘mlx5_nl_mac_addr_sync’:
[  708s] ../drivers/net/mlx5/mlx5_nl.c:685:33: error: ‘mac_addrs’
undeclared (first use in this function); did you mean ‘vec_adds’?
[  708s]      if (rte_is_zero_ether_addr(&mac_addrs[j])) {
[  708s]                                  ^~~~~~~~~
[  708s]                                  vec_adds
[  708s] ../drivers/net/mlx5/mlx5_nl.c:685:33: note: each undeclared
identifier is reported only once for each function it appears in
[  708s] ninja: build stopped: subcommand failed.

If you have a chance to refresh your backport with the 19.11 codebase
in mind that would be great.
Looking for an updated backport and thanks in advance.

> > -                               break;
> > +               if (rte_is_multicast_ether_addr(&macs[i])) {
> > +                       /* Find the first entry available. */
> > +                       for (j = MLX5_MAX_UC_MAC_ADDRESSES;
> > +                            j != MLX5_MAX_MAC_ADDRESSES; ++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.
>
>
>
> --
> Christian Ehrhardt
> Staff Engineer, Ubuntu Server
> Canonical Ltd



-- 
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd

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

* [dpdk-stable] [PATCH 19.11 v2] net/mlx5: fix storing the synched MAC to internal table
  2021-02-12 15:10 [dpdk-stable] [PATCH 19.11] net/mlx5: fix storing the synched MAC to internal table Dey, Souvik
  2021-02-15 12:21 ` Christian Ehrhardt
@ 2021-02-17 21:03 ` Dey, Souvik
  1 sibling, 0 replies; 4+ messages in thread
From: Dey, Souvik @ 2021-02-17 21:03 UTC (permalink / raw)
  To: christian.ehrhardt, viacheslavo, shahafs, matan, rasland
  Cc: stable, dev, Souvik Dey

From: Souvik Dey <sodey@rbbn.com>

[ upstream commit 493f0bb51c1144eedcff2bba199cab1b64ff9fd0 ]

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

Signed-off-by: Souvik Dey <sodey@rbbn.com>
---

v2:
* Fixing the compilation errors.

---
 drivers/net/mlx5/mlx5_nl.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c
index 64580b9..6db372e 100644
--- a/drivers/net/mlx5/mlx5_nl.c
+++ b/drivers/net/mlx5/mlx5_nl.c
@@ -678,11 +678,24 @@ mlx5_nl_mac_addr_sync(struct rte_eth_dev *dev)
 				break;
 		if (j != MLX5_MAX_MAC_ADDRESSES)
 			continue;
-		/* Find the first entry available. */
-		for (j = 0; j != MLX5_MAX_MAC_ADDRESSES; ++j) {
-			if (rte_is_zero_ether_addr(&dev->data->mac_addrs[j])) {
-				dev->data->mac_addrs[j] = macs[i];
-				break;
+		if (rte_is_multicast_ether_addr(&dev->data->mac_addrs[j])) {
+			/* Find the first entry available. */
+			for (j = MLX5_MAX_UC_MAC_ADDRESSES;
+					j != MLX5_MAX_MAC_ADDRESSES; ++j) {
+				if (rte_is_zero_ether_addr(
+						&dev->data->mac_addrs[j])) {
+					dev->data->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(
+						&dev->data->mac_addrs[j])) {
+					dev->data->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.

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

end of thread, other threads:[~2021-02-17 21:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-12 15:10 [dpdk-stable] [PATCH 19.11] net/mlx5: fix storing the synched MAC to internal table Dey, Souvik
2021-02-15 12:21 ` Christian Ehrhardt
2021-02-15 16:41   ` Christian Ehrhardt
2021-02-17 21:03 ` [dpdk-stable] [PATCH 19.11 v2] " Dey, Souvik

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git