Commit 1d0f110a authored by Ivan Vecera's avatar Ivan Vecera Committed by David S. Miller

be2net: fix accesses to unicast list

Commit 988d44b1 "be2net: Avoid redundant addition of mac address in HW"
introduced be_dev_mac_add & be_uc_mac_add helpers that incorrectly
access adapter->uc_list as an array of bytes instead of an array of
be_eth_addr. Consequently NIC is not filled with valid data so unicast
filtering is broken.

Cc: Sathya Perla <sathya.perla@broadcom.com>
Cc: Ajit Khaparde <ajit.khaparde@broadcom.com>
Cc: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Cc: Somnath Kotur <somnath.kotur@broadcom.com>
Fixes: 988d44b1 be2net: Avoid redundant addition of mac address in HW
Signed-off-by: default avatarIvan Vecera <cera@cera.cz>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bcd5e1a4
...@@ -275,8 +275,7 @@ static int be_dev_mac_add(struct be_adapter *adapter, u8 *mac) ...@@ -275,8 +275,7 @@ static int be_dev_mac_add(struct be_adapter *adapter, u8 *mac)
/* Check if mac has already been added as part of uc-list */ /* Check if mac has already been added as part of uc-list */
for (i = 0; i < adapter->uc_macs; i++) { for (i = 0; i < adapter->uc_macs; i++) {
if (ether_addr_equal((u8 *)&adapter->uc_list[i * ETH_ALEN], if (ether_addr_equal(adapter->uc_list[i].mac, mac)) {
mac)) {
/* mac already added, skip addition */ /* mac already added, skip addition */
adapter->pmac_id[0] = adapter->pmac_id[i + 1]; adapter->pmac_id[0] = adapter->pmac_id[i + 1];
return 0; return 0;
...@@ -1655,14 +1654,12 @@ static void be_clear_mc_list(struct be_adapter *adapter) ...@@ -1655,14 +1654,12 @@ static void be_clear_mc_list(struct be_adapter *adapter)
static int be_uc_mac_add(struct be_adapter *adapter, int uc_idx) static int be_uc_mac_add(struct be_adapter *adapter, int uc_idx)
{ {
if (ether_addr_equal((u8 *)&adapter->uc_list[uc_idx * ETH_ALEN], if (ether_addr_equal(adapter->uc_list[uc_idx].mac, adapter->dev_mac)) {
adapter->dev_mac)) {
adapter->pmac_id[uc_idx + 1] = adapter->pmac_id[0]; adapter->pmac_id[uc_idx + 1] = adapter->pmac_id[0];
return 0; return 0;
} }
return be_cmd_pmac_add(adapter, return be_cmd_pmac_add(adapter, adapter->uc_list[uc_idx].mac,
(u8 *)&adapter->uc_list[uc_idx * ETH_ALEN],
adapter->if_handle, adapter->if_handle,
&adapter->pmac_id[uc_idx + 1], 0); &adapter->pmac_id[uc_idx + 1], 0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment