DPDK patches and discussions
 help / color / mirror / Atom feed
From: Souvik Dey <sodey@rbbn.com>
To: rasland@nvidia.com, matan@nvidia.com, shahafs@nvidia.com,
	viacheslavo@nvidia.com
Cc: dev@dpdk.org, Souvik Dey <sodey@rbbn.com>
Subject: [dpdk-dev] [PATCH] net/mlx5:fix storing the synced MAC to internal table
Date: Wed,  9 Dec 2020 10:11:08 -0500	[thread overview]
Message-ID: <20201209151108.12352-2-sodey@rbbn.com> (raw)
In-Reply-To: <20201209151108.12352-1-sodey@rbbn.com>

As the internal MAC table is divided into Unicast and Multicast address
section, we should check the type of synced MAC address before storing
it to the internal table. Currently the check is not done, and the
synced MAC of 33:33:00:00:00:01 gets stored in the unicast section
(mostly index 1) which causes 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 case.

Signed-off-by: Souvik Dey <sodey@rbbn.com>
---
 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


  reply	other threads:[~2020-12-09 15:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-09 15:11 Souvik Dey
2020-12-09 15:11 ` Souvik Dey [this message]
2021-01-21 16:56   ` Slava Ovsiienko
2021-02-02  3:53   ` [dpdk-dev] [PATCH v2] common/mlx5: fix storing the synched " Dey, Souvik
2021-02-02 12:58     ` Slava Ovsiienko
2021-02-02 17:48     ` [dpdk-dev] [PATCH v3] " Dey, Souvik
2021-02-03  8:04       ` Slava Ovsiienko
2021-02-03 12:09         ` Dey, Souvik
2021-02-03 14:15           ` Slava Ovsiienko
2021-02-03 14:34             ` Raslan Darawsheh
2021-02-04 10:43       ` Raslan Darawsheh
  -- strict thread matches above, loose matches on Subject: below --
2020-12-09 13:42 [dpdk-dev] [PATCH] net/mlx5:fix storing the synced " Souvik Dey
2020-12-09 13:42 ` Souvik Dey

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=20201209151108.12352-2-sodey@rbbn.com \
    --to=sodey@rbbn.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=shahafs@nvidia.com \
    --cc=viacheslavo@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).