common/mlx5: fix storing synced MAC to internal table

As the internal MAC table is divided into Unicast and Multicast address
sections, 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) 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: f22442cb5d ("net/mlx5: reduce Netlink commands dependencies")
Fixes: ccdcba53a3 ("net/mlx5: use Netlink to add/remove MAC addresses")
Cc: stable@dpdk.org

Signed-off-by: Souvik Dey <sodey@rbbn.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
This commit is contained in:
Souvik Dey 2021-02-02 12:48:40 -05:00 committed by Ferruh Yigit
parent 5fe95d7364
commit 493f0bb51c

View File

@ -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;
}
}
}
}