--- a/Embedded/src/GbE/iegbe_main.c +++ b/Embedded/src/GbE/iegbe_main.c @@ -2161,7 +2161,8 @@ static void iegbe_set_rx_mode(struct net { struct iegbe_adapter *adapter = netdev_priv(netdev); struct iegbe_hw *hw = &adapter->hw; - struct dev_addr_list *uc_ptr; + struct netdev_hw_addr *ha; + bool use_uc = false; struct dev_addr_list *mc_ptr; u32 rctl; u32 hash_value; @@ -2187,12 +2188,11 @@ int mta_reg_count = E1000_NUM_MTA_REGIST } } - uc_ptr = NULL; if (netdev->uc_count > rar_entries - 1) { rctl |= E1000_RCTL_UPE; } else if (!(netdev->flags & IFF_PROMISC)) { rctl &= ~E1000_RCTL_UPE; - uc_ptr = netdev->uc_list; + use_uc = true; } E1000_WRITE_REG(&adapter->hw, RCTL, rctl); @@ -2210,13 +2210,20 @@ int mta_reg_count = E1000_NUM_MTA_REGIST * if there are not 14 addresses, go ahead and clear the filters * -- with 82571 controllers only 0-13 entries are filled here */ + i = 1; + if (use_uc) + list_for_each_entry(ha, &netdev->uc_list, list) { + if (i == rar_entries) + break; + iegbe_rar_set(hw, ha->addr, i++); + } + + WARN_ON(i == rar_entries); + mc_ptr = netdev->mc_list; - for (i = 1; i < rar_entries; i++) { - if (uc_ptr) { - iegbe_rar_set(hw, uc_ptr->da_addr, i); - uc_ptr = uc_ptr->next; - } else if (mc_ptr) { + for (; i < rar_entries; i++) { + if (mc_ptr) { iegbe_rar_set(hw, mc_ptr->da_addr, i); mc_ptr = mc_ptr->next; } else { @@ -2226,7 +2233,6 @@ int mta_reg_count = E1000_NUM_MTA_REGIST E1000_WRITE_FLUSH(&adapter->hw); } } - WARN_ON(uc_ptr != NULL); /* clear the old settings from the multicast hash table */