aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ixgb/ixgb_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/intel/ixgb/ixgb_main.c')
-rw-r--r--drivers/net/ethernet/intel/ixgb/ixgb_main.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
index b8fb16304598..ca3ab4a29ac4 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
@@ -1093,7 +1093,6 @@ ixgb_set_multi(struct net_device *netdev)
1093 struct ixgb_hw *hw = &adapter->hw; 1093 struct ixgb_hw *hw = &adapter->hw;
1094 struct netdev_hw_addr *ha; 1094 struct netdev_hw_addr *ha;
1095 u32 rctl; 1095 u32 rctl;
1096 int i;
1097 1096
1098 /* Check for Promiscuous and All Multicast modes */ 1097 /* Check for Promiscuous and All Multicast modes */
1099 1098
@@ -1120,19 +1119,27 @@ ixgb_set_multi(struct net_device *netdev)
1120 rctl |= IXGB_RCTL_MPE; 1119 rctl |= IXGB_RCTL_MPE;
1121 IXGB_WRITE_REG(hw, RCTL, rctl); 1120 IXGB_WRITE_REG(hw, RCTL, rctl);
1122 } else { 1121 } else {
1123 u8 mta[IXGB_MAX_NUM_MULTICAST_ADDRESSES * 1122 u8 *mta = kmalloc(IXGB_MAX_NUM_MULTICAST_ADDRESSES *
1124 IXGB_ETH_LENGTH_OF_ADDRESS]; 1123 ETH_ALEN, GFP_ATOMIC);
1124 u8 *addr;
1125 if (!mta) {
1126 pr_err("allocation of multicast memory failed\n");
1127 goto alloc_failed;
1128 }
1125 1129
1126 IXGB_WRITE_REG(hw, RCTL, rctl); 1130 IXGB_WRITE_REG(hw, RCTL, rctl);
1127 1131
1128 i = 0; 1132 addr = mta;
1129 netdev_for_each_mc_addr(ha, netdev) 1133 netdev_for_each_mc_addr(ha, netdev) {
1130 memcpy(&mta[i++ * IXGB_ETH_LENGTH_OF_ADDRESS], 1134 memcpy(addr, ha->addr, ETH_ALEN);
1131 ha->addr, IXGB_ETH_LENGTH_OF_ADDRESS); 1135 addr += ETH_ALEN;
1136 }
1132 1137
1133 ixgb_mc_addr_list_update(hw, mta, netdev_mc_count(netdev), 0); 1138 ixgb_mc_addr_list_update(hw, mta, netdev_mc_count(netdev), 0);
1139 kfree(mta);
1134 } 1140 }
1135 1141
1142alloc_failed:
1136 if (netdev->features & NETIF_F_HW_VLAN_RX) 1143 if (netdev->features & NETIF_F_HW_VLAN_RX)
1137 ixgb_vlan_strip_enable(adapter); 1144 ixgb_vlan_strip_enable(adapter);
1138 else 1145 else