ixgbe: Implement HAVE_SET_RX_MODE
Implement HAVE_SET_RX_MODE in the driver for MC and UC lists. Signed-off-by: Christopher Leech <christopher.leech@intel.com> Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
This commit is contained in:
committed by
Jeff Garzik
parent
9da09bb1b8
commit
2c5645cf65
@@ -1619,23 +1619,37 @@ static void ixgbe_restore_vlan(struct ixgbe_adapter *adapter)
|
||||
}
|
||||
}
|
||||
|
||||
static u8 *ixgbe_addr_list_itr(struct ixgbe_hw *hw, u8 **mc_addr_ptr, u32 *vmdq)
|
||||
{
|
||||
struct dev_mc_list *mc_ptr;
|
||||
u8 *addr = *mc_addr_ptr;
|
||||
*vmdq = 0;
|
||||
|
||||
mc_ptr = container_of(addr, struct dev_mc_list, dmi_addr[0]);
|
||||
if (mc_ptr->next)
|
||||
*mc_addr_ptr = mc_ptr->next->dmi_addr;
|
||||
else
|
||||
*mc_addr_ptr = NULL;
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_set_multi - Multicast and Promiscuous mode set
|
||||
* ixgbe_set_rx_mode - Unicast, Multicast and Promiscuous mode set
|
||||
* @netdev: network interface device structure
|
||||
*
|
||||
* The set_multi entry point is called whenever the multicast address
|
||||
* list or the network interface flags are updated. This routine is
|
||||
* responsible for configuring the hardware for proper multicast,
|
||||
* promiscuous mode, and all-multi behavior.
|
||||
* The set_rx_method entry point is called whenever the unicast/multicast
|
||||
* address list or the network interface flags are updated. This routine is
|
||||
* responsible for configuring the hardware for proper unicast, multicast and
|
||||
* promiscuous mode.
|
||||
**/
|
||||
static void ixgbe_set_multi(struct net_device *netdev)
|
||||
static void ixgbe_set_rx_mode(struct net_device *netdev)
|
||||
{
|
||||
struct ixgbe_adapter *adapter = netdev_priv(netdev);
|
||||
struct ixgbe_hw *hw = &adapter->hw;
|
||||
struct dev_mc_list *mc_ptr;
|
||||
u8 *mta_list;
|
||||
u32 fctrl, vlnctrl;
|
||||
int i;
|
||||
u8 *addr_list = NULL;
|
||||
int addr_count = 0;
|
||||
|
||||
/* Check for Promiscuous and All Multicast modes */
|
||||
|
||||
@@ -1643,6 +1657,7 @@ static void ixgbe_set_multi(struct net_device *netdev)
|
||||
vlnctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
|
||||
|
||||
if (netdev->flags & IFF_PROMISC) {
|
||||
hw->addr_ctrl.user_set_promisc = 1;
|
||||
fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
|
||||
vlnctrl &= ~IXGBE_VLNCTRL_VFE;
|
||||
} else {
|
||||
@@ -1653,33 +1668,25 @@ static void ixgbe_set_multi(struct net_device *netdev)
|
||||
fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
|
||||
}
|
||||
vlnctrl |= IXGBE_VLNCTRL_VFE;
|
||||
hw->addr_ctrl.user_set_promisc = 0;
|
||||
}
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
|
||||
IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl);
|
||||
|
||||
if (netdev->mc_count) {
|
||||
mta_list = kcalloc(netdev->mc_count, ETH_ALEN, GFP_ATOMIC);
|
||||
if (!mta_list)
|
||||
return;
|
||||
|
||||
/* Shared function expects packed array of only addresses. */
|
||||
mc_ptr = netdev->mc_list;
|
||||
|
||||
for (i = 0; i < netdev->mc_count; i++) {
|
||||
if (!mc_ptr)
|
||||
break;
|
||||
memcpy(mta_list + (i * ETH_ALEN), mc_ptr->dmi_addr,
|
||||
ETH_ALEN);
|
||||
mc_ptr = mc_ptr->next;
|
||||
}
|
||||
|
||||
ixgbe_update_mc_addr_list(hw, mta_list, i, 0);
|
||||
kfree(mta_list);
|
||||
} else {
|
||||
ixgbe_update_mc_addr_list(hw, NULL, 0, 0);
|
||||
}
|
||||
/* reprogram secondary unicast list */
|
||||
addr_count = netdev->uc_count;
|
||||
if (addr_count)
|
||||
addr_list = netdev->uc_list->dmi_addr;
|
||||
ixgbe_update_uc_addr_list(hw, addr_list, addr_count,
|
||||
ixgbe_addr_list_itr);
|
||||
|
||||
/* reprogram multicast list */
|
||||
addr_count = netdev->mc_count;
|
||||
if (addr_count)
|
||||
addr_list = netdev->mc_list->dmi_addr;
|
||||
ixgbe_update_mc_addr_list(hw, addr_list, addr_count,
|
||||
ixgbe_addr_list_itr);
|
||||
}
|
||||
|
||||
static void ixgbe_napi_enable_all(struct ixgbe_adapter *adapter)
|
||||
@@ -1723,7 +1730,7 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter)
|
||||
struct net_device *netdev = adapter->netdev;
|
||||
int i;
|
||||
|
||||
ixgbe_set_multi(netdev);
|
||||
ixgbe_set_rx_mode(netdev);
|
||||
|
||||
ixgbe_restore_vlan(adapter);
|
||||
|
||||
@@ -3508,7 +3515,8 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
|
||||
netdev->stop = &ixgbe_close;
|
||||
netdev->hard_start_xmit = &ixgbe_xmit_frame;
|
||||
netdev->get_stats = &ixgbe_get_stats;
|
||||
netdev->set_multicast_list = &ixgbe_set_multi;
|
||||
netdev->set_rx_mode = &ixgbe_set_rx_mode;
|
||||
netdev->set_multicast_list = &ixgbe_set_rx_mode;
|
||||
netdev->set_mac_address = &ixgbe_set_mac;
|
||||
netdev->change_mtu = &ixgbe_change_mtu;
|
||||
ixgbe_set_ethtool_ops(netdev);
|
||||
|
Reference in New Issue
Block a user