Commit 9b538163 authored by David S. Miller's avatar David S. Miller

Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
1GbE Intel Wired LAN Driver Updates 2017-04-20

This series contains updates to e1000, e1000e, igb/vf and ixgb.

Tobias Klauser cleans up e1000, ixgb and igbvf from having a local
function or structure for netdev stats.

Bernd Faust fixes an issue for 82579 devices, where the clock frequency
was being incorrectly set for these devices.  These devices only support
96MHz, so make sure they are set to use only that.

Yury Kylulin extends the work Jake and Alex did for ixgbe in MAC filter
handling into the igb driver.

Kim Tatt Chuah enables igb to wake up by packet and to read the necessary
Wake Up Status (WUS) and Wake Up Packet Memory (WUPM) registers.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents e2989ee9 55c05dd0
...@@ -131,7 +131,6 @@ static void e1000_watchdog(struct work_struct *work); ...@@ -131,7 +131,6 @@ static void e1000_watchdog(struct work_struct *work);
static void e1000_82547_tx_fifo_stall_task(struct work_struct *work); static void e1000_82547_tx_fifo_stall_task(struct work_struct *work);
static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
struct net_device *netdev); struct net_device *netdev);
static struct net_device_stats *e1000_get_stats(struct net_device *netdev);
static int e1000_change_mtu(struct net_device *netdev, int new_mtu); static int e1000_change_mtu(struct net_device *netdev, int new_mtu);
static int e1000_set_mac(struct net_device *netdev, void *p); static int e1000_set_mac(struct net_device *netdev, void *p);
static irqreturn_t e1000_intr(int irq, void *data); static irqreturn_t e1000_intr(int irq, void *data);
...@@ -846,7 +845,6 @@ static const struct net_device_ops e1000_netdev_ops = { ...@@ -846,7 +845,6 @@ static const struct net_device_ops e1000_netdev_ops = {
.ndo_open = e1000_open, .ndo_open = e1000_open,
.ndo_stop = e1000_close, .ndo_stop = e1000_close,
.ndo_start_xmit = e1000_xmit_frame, .ndo_start_xmit = e1000_xmit_frame,
.ndo_get_stats = e1000_get_stats,
.ndo_set_rx_mode = e1000_set_rx_mode, .ndo_set_rx_mode = e1000_set_rx_mode,
.ndo_set_mac_address = e1000_set_mac, .ndo_set_mac_address = e1000_set_mac,
.ndo_tx_timeout = e1000_tx_timeout, .ndo_tx_timeout = e1000_tx_timeout,
...@@ -3529,19 +3527,6 @@ static void e1000_reset_task(struct work_struct *work) ...@@ -3529,19 +3527,6 @@ static void e1000_reset_task(struct work_struct *work)
e1000_reinit_locked(adapter); e1000_reinit_locked(adapter);
} }
/**
* e1000_get_stats - Get System Network Statistics
* @netdev: network interface device structure
*
* Returns the address of the device statistics structure.
* The statistics are actually updated from the watchdog.
**/
static struct net_device_stats *e1000_get_stats(struct net_device *netdev)
{
/* only return the current stats */
return &netdev->stats;
}
/** /**
* e1000_change_mtu - Change the Maximum Transfer Unit * e1000_change_mtu - Change the Maximum Transfer Unit
* @netdev: network interface device structure * @netdev: network interface device structure
......
...@@ -3511,6 +3511,12 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca) ...@@ -3511,6 +3511,12 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca)
switch (hw->mac.type) { switch (hw->mac.type) {
case e1000_pch2lan: case e1000_pch2lan:
/* Stable 96MHz frequency */
incperiod = INCPERIOD_96MHz;
incvalue = INCVALUE_96MHz;
shift = INCVALUE_SHIFT_96MHz;
adapter->cc.shift = shift + INCPERIOD_SHIFT_96MHz;
break;
case e1000_pch_lpt: case e1000_pch_lpt:
if (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI) { if (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI) {
/* Stable 96MHz frequency */ /* Stable 96MHz frequency */
......
...@@ -39,6 +39,27 @@ ...@@ -39,6 +39,27 @@
#define E1000_WUFC_MC 0x00000008 /* Directed Multicast Wakeup Enable */ #define E1000_WUFC_MC 0x00000008 /* Directed Multicast Wakeup Enable */
#define E1000_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */ #define E1000_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */
/* Wake Up Status */
#define E1000_WUS_EX 0x00000004 /* Directed Exact */
#define E1000_WUS_ARPD 0x00000020 /* Directed ARP Request */
#define E1000_WUS_IPV4 0x00000040 /* Directed IPv4 */
#define E1000_WUS_IPV6 0x00000080 /* Directed IPv6 */
#define E1000_WUS_NSD 0x00000400 /* Directed IPv6 Neighbor Solicitation */
/* Packet types that are enabled for wake packet delivery */
#define WAKE_PKT_WUS ( \
E1000_WUS_EX | \
E1000_WUS_ARPD | \
E1000_WUS_IPV4 | \
E1000_WUS_IPV6 | \
E1000_WUS_NSD)
/* Wake Up Packet Length */
#define E1000_WUPL_MASK 0x00000FFF
/* Wake Up Packet Memory stores the first 128 bytes of the wake up packet */
#define E1000_WUPM_BYTES 128
/* Extended Device Control */ /* Extended Device Control */
#define E1000_CTRL_EXT_SDP2_DATA 0x00000040 /* Value of SW Defineable Pin 2 */ #define E1000_CTRL_EXT_SDP2_DATA 0x00000040 /* Value of SW Defineable Pin 2 */
#define E1000_CTRL_EXT_SDP3_DATA 0x00000080 /* Value of SW Defineable Pin 3 */ #define E1000_CTRL_EXT_SDP3_DATA 0x00000080 /* Value of SW Defineable Pin 3 */
......
...@@ -55,6 +55,10 @@ ...@@ -55,6 +55,10 @@
#define E1000_VF_RESET 0x01 /* VF requests reset */ #define E1000_VF_RESET 0x01 /* VF requests reset */
#define E1000_VF_SET_MAC_ADDR 0x02 /* VF requests to set MAC addr */ #define E1000_VF_SET_MAC_ADDR 0x02 /* VF requests to set MAC addr */
/* VF requests to clear all unicast MAC filters */
#define E1000_VF_MAC_FILTER_CLR (0x01 << E1000_VT_MSGINFO_SHIFT)
/* VF requests to add unicast MAC filter */
#define E1000_VF_MAC_FILTER_ADD (0x02 << E1000_VT_MSGINFO_SHIFT)
#define E1000_VF_SET_MULTICAST 0x03 /* VF requests to set MC addr */ #define E1000_VF_SET_MULTICAST 0x03 /* VF requests to set MC addr */
#define E1000_VF_SET_VLAN 0x04 /* VF requests to set VLAN */ #define E1000_VF_SET_VLAN 0x04 /* VF requests to set VLAN */
#define E1000_VF_SET_LPE 0x05 /* VF requests to set VMOLR.LPE */ #define E1000_VF_SET_LPE 0x05 /* VF requests to set VMOLR.LPE */
......
...@@ -111,6 +111,16 @@ struct vf_data_storage { ...@@ -111,6 +111,16 @@ struct vf_data_storage {
bool spoofchk_enabled; bool spoofchk_enabled;
}; };
/* Number of unicast MAC filters reserved for the PF in the RAR registers */
#define IGB_PF_MAC_FILTERS_RESERVED 3
struct vf_mac_filter {
struct list_head l;
int vf;
bool free;
u8 vf_mac[ETH_ALEN];
};
#define IGB_VF_FLAG_CTS 0x00000001 /* VF is clear to send data */ #define IGB_VF_FLAG_CTS 0x00000001 /* VF is clear to send data */
#define IGB_VF_FLAG_UNI_PROMISC 0x00000002 /* VF has unicast promisc */ #define IGB_VF_FLAG_UNI_PROMISC 0x00000002 /* VF has unicast promisc */
#define IGB_VF_FLAG_MULTI_PROMISC 0x00000004 /* VF has multicast promisc */ #define IGB_VF_FLAG_MULTI_PROMISC 0x00000004 /* VF has multicast promisc */
...@@ -449,6 +459,15 @@ struct igb_nfc_filter { ...@@ -449,6 +459,15 @@ struct igb_nfc_filter {
u16 action; u16 action;
}; };
struct igb_mac_addr {
u8 addr[ETH_ALEN];
u8 queue;
u8 state; /* bitmask */
};
#define IGB_MAC_STATE_DEFAULT 0x1
#define IGB_MAC_STATE_IN_USE 0x2
/* board specific private data structure */ /* board specific private data structure */
struct igb_adapter { struct igb_adapter {
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
...@@ -575,6 +594,10 @@ struct igb_adapter { ...@@ -575,6 +594,10 @@ struct igb_adapter {
/* lock for RX network flow classification filter */ /* lock for RX network flow classification filter */
spinlock_t nfc_lock; spinlock_t nfc_lock;
bool etype_bitmap[MAX_ETYPE_FILTER]; bool etype_bitmap[MAX_ETYPE_FILTER];
struct igb_mac_addr *mac_table;
struct vf_mac_filter vf_macs;
struct vf_mac_filter *vf_mac_list;
}; };
/* flags controlling PTP/1588 function */ /* flags controlling PTP/1588 function */
......
...@@ -161,11 +161,16 @@ static void igb_vlan_mode(struct net_device *netdev, ...@@ -161,11 +161,16 @@ static void igb_vlan_mode(struct net_device *netdev,
static int igb_vlan_rx_add_vid(struct net_device *, __be16, u16); static int igb_vlan_rx_add_vid(struct net_device *, __be16, u16);
static int igb_vlan_rx_kill_vid(struct net_device *, __be16, u16); static int igb_vlan_rx_kill_vid(struct net_device *, __be16, u16);
static void igb_restore_vlan(struct igb_adapter *); static void igb_restore_vlan(struct igb_adapter *);
static void igb_rar_set_qsel(struct igb_adapter *, u8 *, u32 , u8); static void igb_rar_set_index(struct igb_adapter *, u32);
static void igb_ping_all_vfs(struct igb_adapter *); static void igb_ping_all_vfs(struct igb_adapter *);
static void igb_msg_task(struct igb_adapter *); static void igb_msg_task(struct igb_adapter *);
static void igb_vmm_control(struct igb_adapter *); static void igb_vmm_control(struct igb_adapter *);
static int igb_set_vf_mac(struct igb_adapter *, int, unsigned char *); static int igb_set_vf_mac(struct igb_adapter *, int, unsigned char *);
static void igb_flush_mac_table(struct igb_adapter *);
static int igb_available_rars(struct igb_adapter *, u8);
static void igb_set_default_mac_filter(struct igb_adapter *);
static int igb_uc_sync(struct net_device *, const unsigned char *);
static int igb_uc_unsync(struct net_device *, const unsigned char *);
static void igb_restore_vf_multicasts(struct igb_adapter *adapter); static void igb_restore_vf_multicasts(struct igb_adapter *adapter);
static int igb_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac); static int igb_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac);
static int igb_ndo_set_vf_vlan(struct net_device *netdev, static int igb_ndo_set_vf_vlan(struct net_device *netdev,
...@@ -1153,6 +1158,8 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix) ...@@ -1153,6 +1158,8 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix)
pci_disable_sriov(adapter->pdev); pci_disable_sriov(adapter->pdev);
msleep(500); msleep(500);
kfree(adapter->vf_mac_list);
adapter->vf_mac_list = NULL;
kfree(adapter->vf_data); kfree(adapter->vf_data);
adapter->vf_data = NULL; adapter->vf_data = NULL;
wr32(E1000_IOVCTL, E1000_IOVCTL_REUSE_VFQ); wr32(E1000_IOVCTL, E1000_IOVCTL_REUSE_VFQ);
...@@ -1987,6 +1994,13 @@ void igb_reset(struct igb_adapter *adapter) ...@@ -1987,6 +1994,13 @@ void igb_reset(struct igb_adapter *adapter)
if (hw->mac.ops.init_hw(hw)) if (hw->mac.ops.init_hw(hw))
dev_err(&pdev->dev, "Hardware Error\n"); dev_err(&pdev->dev, "Hardware Error\n");
/* RAR registers were cleared during init_hw, clear mac table */
igb_flush_mac_table(adapter);
__dev_uc_unsync(adapter->netdev, NULL);
/* Recover default RAR entry */
igb_set_default_mac_filter(adapter);
/* Flow control settings reset on hardware reset, so guarantee flow /* Flow control settings reset on hardware reset, so guarantee flow
* control is off when forcing speed. * control is off when forcing speed.
*/ */
...@@ -2095,11 +2109,9 @@ static int igb_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], ...@@ -2095,11 +2109,9 @@ static int igb_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
/* guarantee we can provide a unique filter for the unicast address */ /* guarantee we can provide a unique filter for the unicast address */
if (is_unicast_ether_addr(addr) || is_link_local_ether_addr(addr)) { if (is_unicast_ether_addr(addr) || is_link_local_ether_addr(addr)) {
struct igb_adapter *adapter = netdev_priv(dev); struct igb_adapter *adapter = netdev_priv(dev);
struct e1000_hw *hw = &adapter->hw;
int vfn = adapter->vfs_allocated_count; int vfn = adapter->vfs_allocated_count;
int rar_entries = hw->mac.rar_entry_count - (vfn + 1);
if (netdev_uc_count(dev) >= rar_entries) if (netdev_uc_count(dev) >= igb_available_rars(adapter, vfn))
return -ENOMEM; return -ENOMEM;
} }
...@@ -2517,6 +2529,8 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2517,6 +2529,8 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto err_eeprom; goto err_eeprom;
} }
igb_set_default_mac_filter(adapter);
/* get firmware version for ethtool -i */ /* get firmware version for ethtool -i */
igb_set_fw_version(adapter); igb_set_fw_version(adapter);
...@@ -2761,6 +2775,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2761,6 +2775,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (hw->flash_address) if (hw->flash_address)
iounmap(hw->flash_address); iounmap(hw->flash_address);
err_sw_init: err_sw_init:
kfree(adapter->mac_table);
kfree(adapter->shadow_vfta); kfree(adapter->shadow_vfta);
igb_clear_interrupt_scheme(adapter); igb_clear_interrupt_scheme(adapter);
#ifdef CONFIG_PCI_IOV #ifdef CONFIG_PCI_IOV
...@@ -2796,6 +2811,8 @@ static int igb_disable_sriov(struct pci_dev *pdev) ...@@ -2796,6 +2811,8 @@ static int igb_disable_sriov(struct pci_dev *pdev)
msleep(500); msleep(500);
} }
kfree(adapter->vf_mac_list);
adapter->vf_mac_list = NULL;
kfree(adapter->vf_data); kfree(adapter->vf_data);
adapter->vf_data = NULL; adapter->vf_data = NULL;
adapter->vfs_allocated_count = 0; adapter->vfs_allocated_count = 0;
...@@ -2816,8 +2833,9 @@ static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs) ...@@ -2816,8 +2833,9 @@ static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs)
struct net_device *netdev = pci_get_drvdata(pdev); struct net_device *netdev = pci_get_drvdata(pdev);
struct igb_adapter *adapter = netdev_priv(netdev); struct igb_adapter *adapter = netdev_priv(netdev);
int old_vfs = pci_num_vf(pdev); int old_vfs = pci_num_vf(pdev);
struct vf_mac_filter *mac_list;
int err = 0; int err = 0;
int i; int num_vf_mac_filters, i;
if (!(adapter->flags & IGB_FLAG_HAS_MSIX) || num_vfs > 7) { if (!(adapter->flags & IGB_FLAG_HAS_MSIX) || num_vfs > 7) {
err = -EPERM; err = -EPERM;
...@@ -2845,6 +2863,38 @@ static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs) ...@@ -2845,6 +2863,38 @@ static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs)
goto out; goto out;
} }
/* Due to the limited number of RAR entries calculate potential
* number of MAC filters available for the VFs. Reserve entries
* for PF default MAC, PF MAC filters and at least one RAR entry
* for each VF for VF MAC.
*/
num_vf_mac_filters = adapter->hw.mac.rar_entry_count -
(1 + IGB_PF_MAC_FILTERS_RESERVED +
adapter->vfs_allocated_count);
adapter->vf_mac_list = kcalloc(num_vf_mac_filters,
sizeof(struct vf_mac_filter),
GFP_KERNEL);
mac_list = adapter->vf_mac_list;
INIT_LIST_HEAD(&adapter->vf_macs.l);
if (adapter->vf_mac_list) {
/* Initialize list of VF MAC filters */
for (i = 0; i < num_vf_mac_filters; i++) {
mac_list->vf = -1;
mac_list->free = true;
list_add(&mac_list->l, &adapter->vf_macs.l);
mac_list++;
}
} else {
/* If we could not allocate memory for the VF MAC filters
* we can continue without this feature but warn user.
*/
dev_err(&pdev->dev,
"Unable to allocate memory for VF MAC filter list\n");
}
/* only call pci_enable_sriov() if no VFs are allocated already */ /* only call pci_enable_sriov() if no VFs are allocated already */
if (!old_vfs) { if (!old_vfs) {
err = pci_enable_sriov(pdev, adapter->vfs_allocated_count); err = pci_enable_sriov(pdev, adapter->vfs_allocated_count);
...@@ -2861,6 +2911,8 @@ static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs) ...@@ -2861,6 +2911,8 @@ static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs)
goto out; goto out;
err_out: err_out:
kfree(adapter->vf_mac_list);
adapter->vf_mac_list = NULL;
kfree(adapter->vf_data); kfree(adapter->vf_data);
adapter->vf_data = NULL; adapter->vf_data = NULL;
adapter->vfs_allocated_count = 0; adapter->vfs_allocated_count = 0;
...@@ -2937,6 +2989,7 @@ static void igb_remove(struct pci_dev *pdev) ...@@ -2937,6 +2989,7 @@ static void igb_remove(struct pci_dev *pdev)
iounmap(hw->flash_address); iounmap(hw->flash_address);
pci_release_mem_regions(pdev); pci_release_mem_regions(pdev);
kfree(adapter->mac_table);
kfree(adapter->shadow_vfta); kfree(adapter->shadow_vfta);
free_netdev(netdev); free_netdev(netdev);
...@@ -3099,6 +3152,11 @@ static int igb_sw_init(struct igb_adapter *adapter) ...@@ -3099,6 +3152,11 @@ static int igb_sw_init(struct igb_adapter *adapter)
/* Assume MSI-X interrupts, will be checked during IRQ allocation */ /* Assume MSI-X interrupts, will be checked during IRQ allocation */
adapter->flags |= IGB_FLAG_HAS_MSIX; adapter->flags |= IGB_FLAG_HAS_MSIX;
adapter->mac_table = kzalloc(sizeof(struct igb_mac_addr) *
hw->mac.rar_entry_count, GFP_ATOMIC);
if (!adapter->mac_table)
return -ENOMEM;
igb_probe_vfs(adapter); igb_probe_vfs(adapter);
igb_init_queue_configuration(adapter); igb_init_queue_configuration(adapter);
...@@ -3810,8 +3868,7 @@ static void igb_configure_rx(struct igb_adapter *adapter) ...@@ -3810,8 +3868,7 @@ static void igb_configure_rx(struct igb_adapter *adapter)
int i; int i;
/* set the correct pool for the PF default MAC address in entry 0 */ /* set the correct pool for the PF default MAC address in entry 0 */
igb_rar_set_qsel(adapter, adapter->hw.mac.addr, 0, igb_set_default_mac_filter(adapter);
adapter->vfs_allocated_count);
/* Setup the HW Rx Head and Tail Descriptor Pointers and /* Setup the HW Rx Head and Tail Descriptor Pointers and
* the Base and Length of the Rx Descriptor Ring * the Base and Length of the Rx Descriptor Ring
...@@ -4051,8 +4108,7 @@ static int igb_set_mac(struct net_device *netdev, void *p) ...@@ -4051,8 +4108,7 @@ static int igb_set_mac(struct net_device *netdev, void *p)
memcpy(hw->mac.addr, addr->sa_data, netdev->addr_len); memcpy(hw->mac.addr, addr->sa_data, netdev->addr_len);
/* set the correct pool for the new PF MAC address in entry 0 */ /* set the correct pool for the new PF MAC address in entry 0 */
igb_rar_set_qsel(adapter, hw->mac.addr, 0, igb_set_default_mac_filter(adapter);
adapter->vfs_allocated_count);
return 0; return 0;
} }
...@@ -4096,49 +4152,6 @@ static int igb_write_mc_addr_list(struct net_device *netdev) ...@@ -4096,49 +4152,6 @@ static int igb_write_mc_addr_list(struct net_device *netdev)
return netdev_mc_count(netdev); return netdev_mc_count(netdev);
} }
/**
* igb_write_uc_addr_list - write unicast addresses to RAR table
* @netdev: network interface device structure
*
* Writes unicast address list to the RAR table.
* Returns: -ENOMEM on failure/insufficient address space
* 0 on no addresses written
* X on writing X addresses to the RAR table
**/
static int igb_write_uc_addr_list(struct net_device *netdev)
{
struct igb_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
unsigned int vfn = adapter->vfs_allocated_count;
unsigned int rar_entries = hw->mac.rar_entry_count - (vfn + 1);
int count = 0;
/* return ENOMEM indicating insufficient memory for addresses */
if (netdev_uc_count(netdev) > rar_entries)
return -ENOMEM;
if (!netdev_uc_empty(netdev) && rar_entries) {
struct netdev_hw_addr *ha;
netdev_for_each_uc_addr(ha, netdev) {
if (!rar_entries)
break;
igb_rar_set_qsel(adapter, ha->addr,
rar_entries--,
vfn);
count++;
}
}
/* write the addresses in reverse order to avoid write combining */
for (; rar_entries > 0 ; rar_entries--) {
wr32(E1000_RAH(rar_entries), 0);
wr32(E1000_RAL(rar_entries), 0);
}
wrfl();
return count;
}
static int igb_vlan_promisc_enable(struct igb_adapter *adapter) static int igb_vlan_promisc_enable(struct igb_adapter *adapter)
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
...@@ -4311,8 +4324,7 @@ static void igb_set_rx_mode(struct net_device *netdev) ...@@ -4311,8 +4324,7 @@ static void igb_set_rx_mode(struct net_device *netdev)
* sufficient space to store all the addresses then enable * sufficient space to store all the addresses then enable
* unicast promiscuous mode * unicast promiscuous mode
*/ */
count = igb_write_uc_addr_list(netdev); if (__dev_uc_sync(netdev, igb_uc_sync, igb_uc_unsync)) {
if (count < 0) {
rctl |= E1000_RCTL_UPE; rctl |= E1000_RCTL_UPE;
vmolr |= E1000_VMOLR_ROPE; vmolr |= E1000_VMOLR_ROPE;
} }
...@@ -6369,7 +6381,6 @@ static void igb_vf_reset_msg(struct igb_adapter *adapter, u32 vf) ...@@ -6369,7 +6381,6 @@ static void igb_vf_reset_msg(struct igb_adapter *adapter, u32 vf)
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
unsigned char *vf_mac = adapter->vf_data[vf].vf_mac_addresses; unsigned char *vf_mac = adapter->vf_data[vf].vf_mac_addresses;
int rar_entry = hw->mac.rar_entry_count - (vf + 1);
u32 reg, msgbuf[3]; u32 reg, msgbuf[3];
u8 *addr = (u8 *)(&msgbuf[1]); u8 *addr = (u8 *)(&msgbuf[1]);
...@@ -6377,7 +6388,7 @@ static void igb_vf_reset_msg(struct igb_adapter *adapter, u32 vf) ...@@ -6377,7 +6388,7 @@ static void igb_vf_reset_msg(struct igb_adapter *adapter, u32 vf)
igb_vf_reset(adapter, vf); igb_vf_reset(adapter, vf);
/* set vf mac address */ /* set vf mac address */
igb_rar_set_qsel(adapter, vf_mac, rar_entry, vf); igb_set_vf_mac(adapter, vf, vf_mac);
/* enable transmit and receive for vf */ /* enable transmit and receive for vf */
reg = rd32(E1000_VFTE); reg = rd32(E1000_VFTE);
...@@ -6397,18 +6408,238 @@ static void igb_vf_reset_msg(struct igb_adapter *adapter, u32 vf) ...@@ -6397,18 +6408,238 @@ static void igb_vf_reset_msg(struct igb_adapter *adapter, u32 vf)
igb_write_mbx(hw, msgbuf, 3, vf); igb_write_mbx(hw, msgbuf, 3, vf);
} }
static void igb_flush_mac_table(struct igb_adapter *adapter)
{
struct e1000_hw *hw = &adapter->hw;
int i;
for (i = 0; i < hw->mac.rar_entry_count; i++) {
adapter->mac_table[i].state &= ~IGB_MAC_STATE_IN_USE;
memset(adapter->mac_table[i].addr, 0, ETH_ALEN);
adapter->mac_table[i].queue = 0;
igb_rar_set_index(adapter, i);
}
}
static int igb_available_rars(struct igb_adapter *adapter, u8 queue)
{
struct e1000_hw *hw = &adapter->hw;
/* do not count rar entries reserved for VFs MAC addresses */
int rar_entries = hw->mac.rar_entry_count -
adapter->vfs_allocated_count;
int i, count = 0;
for (i = 0; i < rar_entries; i++) {
/* do not count default entries */
if (adapter->mac_table[i].state & IGB_MAC_STATE_DEFAULT)
continue;
/* do not count "in use" entries for different queues */
if ((adapter->mac_table[i].state & IGB_MAC_STATE_IN_USE) &&
(adapter->mac_table[i].queue != queue))
continue;
count++;
}
return count;
}
/* Set default MAC address for the PF in the first RAR entry */
static void igb_set_default_mac_filter(struct igb_adapter *adapter)
{
struct igb_mac_addr *mac_table = &adapter->mac_table[0];
ether_addr_copy(mac_table->addr, adapter->hw.mac.addr);
mac_table->queue = adapter->vfs_allocated_count;
mac_table->state = IGB_MAC_STATE_DEFAULT | IGB_MAC_STATE_IN_USE;
igb_rar_set_index(adapter, 0);
}
int igb_add_mac_filter(struct igb_adapter *adapter, const u8 *addr,
const u8 queue)
{
struct e1000_hw *hw = &adapter->hw;
int rar_entries = hw->mac.rar_entry_count -
adapter->vfs_allocated_count;
int i;
if (is_zero_ether_addr(addr))
return -EINVAL;
/* Search for the first empty entry in the MAC table.
* Do not touch entries at the end of the table reserved for the VF MAC
* addresses.
*/
for (i = 0; i < rar_entries; i++) {
if (adapter->mac_table[i].state & IGB_MAC_STATE_IN_USE)
continue;
ether_addr_copy(adapter->mac_table[i].addr, addr);
adapter->mac_table[i].queue = queue;
adapter->mac_table[i].state |= IGB_MAC_STATE_IN_USE;
igb_rar_set_index(adapter, i);
return i;
}
return -ENOSPC;
}
int igb_del_mac_filter(struct igb_adapter *adapter, const u8 *addr,
const u8 queue)
{
struct e1000_hw *hw = &adapter->hw;
int rar_entries = hw->mac.rar_entry_count -
adapter->vfs_allocated_count;
int i;
if (is_zero_ether_addr(addr))
return -EINVAL;
/* Search for matching entry in the MAC table based on given address
* and queue. Do not touch entries at the end of the table reserved
* for the VF MAC addresses.
*/
for (i = 0; i < rar_entries; i++) {
if (!(adapter->mac_table[i].state & IGB_MAC_STATE_IN_USE))
continue;
if (adapter->mac_table[i].queue != queue)
continue;
if (!ether_addr_equal(adapter->mac_table[i].addr, addr))
continue;
adapter->mac_table[i].state &= ~IGB_MAC_STATE_IN_USE;
memset(adapter->mac_table[i].addr, 0, ETH_ALEN);
adapter->mac_table[i].queue = 0;
igb_rar_set_index(adapter, i);
return 0;
}
return -ENOENT;
}
static int igb_uc_sync(struct net_device *netdev, const unsigned char *addr)
{
struct igb_adapter *adapter = netdev_priv(netdev);
int ret;
ret = igb_add_mac_filter(adapter, addr, adapter->vfs_allocated_count);
return min_t(int, ret, 0);
}
static int igb_uc_unsync(struct net_device *netdev, const unsigned char *addr)
{
struct igb_adapter *adapter = netdev_priv(netdev);
igb_del_mac_filter(adapter, addr, adapter->vfs_allocated_count);
return 0;
}
int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf,
const u32 info, const u8 *addr)
{
struct pci_dev *pdev = adapter->pdev;
struct vf_data_storage *vf_data = &adapter->vf_data[vf];
struct list_head *pos;
struct vf_mac_filter *entry = NULL;
int ret = 0;
switch (info) {
case E1000_VF_MAC_FILTER_CLR:
/* remove all unicast MAC filters related to the current VF */
list_for_each(pos, &adapter->vf_macs.l) {
entry = list_entry(pos, struct vf_mac_filter, l);
if (entry->vf == vf) {
entry->vf = -1;
entry->free = true;
igb_del_mac_filter(adapter, entry->vf_mac, vf);
}
}
break;
case E1000_VF_MAC_FILTER_ADD:
if (vf_data->flags & IGB_VF_FLAG_PF_SET_MAC) {
dev_warn(&pdev->dev,
"VF %d requested MAC filter but is administratively denied\n",
vf);
return -EINVAL;
}
if (!is_valid_ether_addr(addr)) {
dev_warn(&pdev->dev,
"VF %d attempted to set invalid MAC filter\n",
vf);
return -EINVAL;
}
/* try to find empty slot in the list */
list_for_each(pos, &adapter->vf_macs.l) {
entry = list_entry(pos, struct vf_mac_filter, l);
if (entry->free)
break;
}
if (entry && entry->free) {
entry->free = false;
entry->vf = vf;
ether_addr_copy(entry->vf_mac, addr);
ret = igb_add_mac_filter(adapter, addr, vf);
ret = min_t(int, ret, 0);
} else {
ret = -ENOSPC;
}
if (ret == -ENOSPC)
dev_warn(&pdev->dev,
"VF %d has requested MAC filter but there is no space for it\n",
vf);
break;
default:
ret = -EINVAL;
break;
}
return ret;
}
static int igb_set_vf_mac_addr(struct igb_adapter *adapter, u32 *msg, int vf) static int igb_set_vf_mac_addr(struct igb_adapter *adapter, u32 *msg, int vf)
{ {
struct pci_dev *pdev = adapter->pdev;
struct vf_data_storage *vf_data = &adapter->vf_data[vf];
u32 info = msg[0] & E1000_VT_MSGINFO_MASK;
/* The VF MAC Address is stored in a packed array of bytes /* The VF MAC Address is stored in a packed array of bytes
* starting at the second 32 bit word of the msg array * starting at the second 32 bit word of the msg array
*/ */
unsigned char *addr = (char *)&msg[1]; unsigned char *addr = (unsigned char *)&msg[1];
int err = -1; int ret = 0;
if (is_valid_ether_addr(addr)) if (!info) {
err = igb_set_vf_mac(adapter, vf, addr); if (vf_data->flags & IGB_VF_FLAG_PF_SET_MAC) {
dev_warn(&pdev->dev,
"VF %d attempted to override administratively set MAC address\nReload the VF driver to resume operations\n",
vf);
return -EINVAL;
}
return err; if (!is_valid_ether_addr(addr)) {
dev_warn(&pdev->dev,
"VF %d attempted to set invalid MAC\n",
vf);
return -EINVAL;
}
ret = igb_set_vf_mac(adapter, vf, addr);
} else {
ret = igb_set_vf_mac_filter(adapter, vf, info, addr);
}
return ret;
} }
static void igb_rcv_ack_from_vf(struct igb_adapter *adapter, u32 vf) static void igb_rcv_ack_from_vf(struct igb_adapter *adapter, u32 vf)
...@@ -6465,13 +6696,7 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf) ...@@ -6465,13 +6696,7 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf)
switch ((msgbuf[0] & 0xFFFF)) { switch ((msgbuf[0] & 0xFFFF)) {
case E1000_VF_SET_MAC_ADDR: case E1000_VF_SET_MAC_ADDR:
retval = -EINVAL; retval = igb_set_vf_mac_addr(adapter, msgbuf, vf);
if (!(vf_data->flags & IGB_VF_FLAG_PF_SET_MAC))
retval = igb_set_vf_mac_addr(adapter, msgbuf, vf);
else
dev_warn(&pdev->dev,
"VF %d attempted to override administratively set MAC address\nReload the VF driver to resume operations\n",
vf);
break; break;
case E1000_VF_SET_PROMISC: case E1000_VF_SET_PROMISC:
retval = igb_set_vf_promisc(adapter, msgbuf, vf); retval = igb_set_vf_promisc(adapter, msgbuf, vf);
...@@ -7760,6 +7985,36 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, ...@@ -7760,6 +7985,36 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake,
return 0; return 0;
} }
static void igb_deliver_wake_packet(struct net_device *netdev)
{
struct igb_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
struct sk_buff *skb;
u32 wupl;
wupl = rd32(E1000_WUPL) & E1000_WUPL_MASK;
/* WUPM stores only the first 128 bytes of the wake packet.
* Read the packet only if we have the whole thing.
*/
if ((wupl == 0) || (wupl > E1000_WUPM_BYTES))
return;
skb = netdev_alloc_skb_ip_align(netdev, E1000_WUPM_BYTES);
if (!skb)
return;
skb_put(skb, wupl);
/* Ensure reads are 32-bit aligned */
wupl = roundup(wupl, 4);
memcpy_fromio(skb->data, hw->hw_addr + E1000_WUPM_REG(0), wupl);
skb->protocol = eth_type_trans(skb, netdev);
netif_rx(skb);
}
#ifdef CONFIG_PM #ifdef CONFIG_PM
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int igb_suspend(struct device *dev) static int igb_suspend(struct device *dev)
...@@ -7789,7 +8044,7 @@ static int igb_resume(struct device *dev) ...@@ -7789,7 +8044,7 @@ static int igb_resume(struct device *dev)
struct net_device *netdev = pci_get_drvdata(pdev); struct net_device *netdev = pci_get_drvdata(pdev);
struct igb_adapter *adapter = netdev_priv(netdev); struct igb_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u32 err; u32 err, val;
pci_set_power_state(pdev, PCI_D0); pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev); pci_restore_state(pdev);
...@@ -7820,6 +8075,10 @@ static int igb_resume(struct device *dev) ...@@ -7820,6 +8075,10 @@ static int igb_resume(struct device *dev)
*/ */
igb_get_hw_control(adapter); igb_get_hw_control(adapter);
val = rd32(E1000_WUS);
if (val & WAKE_PKT_WUS)
igb_deliver_wake_packet(netdev);
wr32(E1000_WUS, ~0); wr32(E1000_WUS, ~0);
rtnl_lock(); rtnl_lock();
...@@ -8078,11 +8337,16 @@ static void igb_io_resume(struct pci_dev *pdev) ...@@ -8078,11 +8337,16 @@ static void igb_io_resume(struct pci_dev *pdev)
igb_get_hw_control(adapter); igb_get_hw_control(adapter);
} }
static void igb_rar_set_qsel(struct igb_adapter *adapter, u8 *addr, u32 index, /**
u8 qsel) * igb_rar_set_index - Sync RAL[index] and RAH[index] registers with MAC table
* @adapter: Pointer to adapter structure
* @index: Index of the RAR entry which need to be synced with MAC table
**/
static void igb_rar_set_index(struct igb_adapter *adapter, u32 index)
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u32 rar_low, rar_high; u32 rar_low, rar_high;
u8 *addr = adapter->mac_table[index].addr;
/* HW expects these to be in network order when they are plugged /* HW expects these to be in network order when they are plugged
* into the registers which are little endian. In order to guarantee * into the registers which are little endian. In order to guarantee
...@@ -8093,12 +8357,16 @@ static void igb_rar_set_qsel(struct igb_adapter *adapter, u8 *addr, u32 index, ...@@ -8093,12 +8357,16 @@ static void igb_rar_set_qsel(struct igb_adapter *adapter, u8 *addr, u32 index,
rar_high = le16_to_cpup((__le16 *)(addr + 4)); rar_high = le16_to_cpup((__le16 *)(addr + 4));
/* Indicate to hardware the Address is Valid. */ /* Indicate to hardware the Address is Valid. */
rar_high |= E1000_RAH_AV; if (adapter->mac_table[index].state & IGB_MAC_STATE_IN_USE) {
rar_high |= E1000_RAH_AV;
if (hw->mac.type == e1000_82575) if (hw->mac.type == e1000_82575)
rar_high |= E1000_RAH_POOL_1 * qsel; rar_high |= E1000_RAH_POOL_1 *
else adapter->mac_table[index].queue;
rar_high |= E1000_RAH_POOL_1 << qsel; else
rar_high |= E1000_RAH_POOL_1 <<
adapter->mac_table[index].queue;
}
wr32(E1000_RAL(index), rar_low); wr32(E1000_RAL(index), rar_low);
wrfl(); wrfl();
...@@ -8114,10 +8382,13 @@ static int igb_set_vf_mac(struct igb_adapter *adapter, ...@@ -8114,10 +8382,13 @@ static int igb_set_vf_mac(struct igb_adapter *adapter,
* towards the first, as a result a collision should not be possible * towards the first, as a result a collision should not be possible
*/ */
int rar_entry = hw->mac.rar_entry_count - (vf + 1); int rar_entry = hw->mac.rar_entry_count - (vf + 1);
unsigned char *vf_mac_addr = adapter->vf_data[vf].vf_mac_addresses;
memcpy(adapter->vf_data[vf].vf_mac_addresses, mac_addr, ETH_ALEN); ether_addr_copy(vf_mac_addr, mac_addr);
ether_addr_copy(adapter->mac_table[rar_entry].addr, mac_addr);
igb_rar_set_qsel(adapter, mac_addr, rar_entry, vf); adapter->mac_table[rar_entry].queue = vf;
adapter->mac_table[rar_entry].state |= IGB_MAC_STATE_IN_USE;
igb_rar_set_index(adapter, rar_entry);
return 0; return 0;
} }
......
...@@ -101,6 +101,8 @@ enum latency_range { ...@@ -101,6 +101,8 @@ enum latency_range {
#define IGBVF_MNG_VLAN_NONE (-1) #define IGBVF_MNG_VLAN_NONE (-1)
#define IGBVF_MAX_MAC_FILTERS 3
/* Number of packet split data buffers (not including the header buffer) */ /* Number of packet split data buffers (not including the header buffer) */
#define PS_PAGE_BUFFERS (MAX_PS_BUFFERS - 1) #define PS_PAGE_BUFFERS (MAX_PS_BUFFERS - 1)
...@@ -241,7 +243,6 @@ struct igbvf_adapter { ...@@ -241,7 +243,6 @@ struct igbvf_adapter {
/* OS defined structs */ /* OS defined structs */
struct net_device *netdev; struct net_device *netdev;
struct pci_dev *pdev; struct pci_dev *pdev;
struct net_device_stats net_stats;
spinlock_t stats_lock; /* prevent concurrent stats updates */ spinlock_t stats_lock; /* prevent concurrent stats updates */
/* structs defined in e1000_hw.h */ /* structs defined in e1000_hw.h */
......
...@@ -62,6 +62,10 @@ ...@@ -62,6 +62,10 @@
#define E1000_VF_RESET 0x01 /* VF requests reset */ #define E1000_VF_RESET 0x01 /* VF requests reset */
#define E1000_VF_SET_MAC_ADDR 0x02 /* VF requests PF to set MAC addr */ #define E1000_VF_SET_MAC_ADDR 0x02 /* VF requests PF to set MAC addr */
/* VF requests PF to clear all unicast MAC filters */
#define E1000_VF_MAC_FILTER_CLR (0x01 << E1000_VT_MSGINFO_SHIFT)
/* VF requests PF to add unicast MAC filter */
#define E1000_VF_MAC_FILTER_ADD (0x02 << E1000_VT_MSGINFO_SHIFT)
#define E1000_VF_SET_MULTICAST 0x03 /* VF requests PF to set MC addr */ #define E1000_VF_SET_MULTICAST 0x03 /* VF requests PF to set MC addr */
#define E1000_VF_SET_VLAN 0x04 /* VF requests PF to set VLAN */ #define E1000_VF_SET_VLAN 0x04 /* VF requests PF to set VLAN */
#define E1000_VF_SET_LPE 0x05 /* VF requests PF to set VMOLR.LPE */ #define E1000_VF_SET_LPE 0x05 /* VF requests PF to set VMOLR.LPE */
......
...@@ -400,8 +400,8 @@ static bool igbvf_clean_rx_irq(struct igbvf_adapter *adapter, ...@@ -400,8 +400,8 @@ static bool igbvf_clean_rx_irq(struct igbvf_adapter *adapter,
adapter->total_rx_packets += total_packets; adapter->total_rx_packets += total_packets;
adapter->total_rx_bytes += total_bytes; adapter->total_rx_bytes += total_bytes;
adapter->net_stats.rx_bytes += total_bytes; netdev->stats.rx_bytes += total_bytes;
adapter->net_stats.rx_packets += total_packets; netdev->stats.rx_packets += total_packets;
return cleaned; return cleaned;
} }
...@@ -864,8 +864,8 @@ static bool igbvf_clean_tx_irq(struct igbvf_ring *tx_ring) ...@@ -864,8 +864,8 @@ static bool igbvf_clean_tx_irq(struct igbvf_ring *tx_ring)
} }
} }
adapter->net_stats.tx_bytes += total_bytes; netdev->stats.tx_bytes += total_bytes;
adapter->net_stats.tx_packets += total_packets; netdev->stats.tx_packets += total_packets;
return count < tx_ring->count; return count < tx_ring->count;
} }
...@@ -1432,13 +1432,53 @@ static void igbvf_set_multi(struct net_device *netdev) ...@@ -1432,13 +1432,53 @@ static void igbvf_set_multi(struct net_device *netdev)
kfree(mta_list); kfree(mta_list);
} }
/**
* igbvf_set_uni - Configure unicast MAC filters
* @netdev: network interface device structure
*
* This routine is responsible for configuring the hardware for proper
* unicast filters.
**/
static int igbvf_set_uni(struct net_device *netdev)
{
struct igbvf_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
if (netdev_uc_count(netdev) > IGBVF_MAX_MAC_FILTERS) {
pr_err("Too many unicast filters - No Space\n");
return -ENOSPC;
}
/* Clear all unicast MAC filters */
hw->mac.ops.set_uc_addr(hw, E1000_VF_MAC_FILTER_CLR, NULL);
if (!netdev_uc_empty(netdev)) {
struct netdev_hw_addr *ha;
/* Add MAC filters one by one */
netdev_for_each_uc_addr(ha, netdev) {
hw->mac.ops.set_uc_addr(hw, E1000_VF_MAC_FILTER_ADD,
ha->addr);
udelay(200);
}
}
return 0;
}
static void igbvf_set_rx_mode(struct net_device *netdev)
{
igbvf_set_multi(netdev);
igbvf_set_uni(netdev);
}
/** /**
* igbvf_configure - configure the hardware for Rx and Tx * igbvf_configure - configure the hardware for Rx and Tx
* @adapter: private board structure * @adapter: private board structure
**/ **/
static void igbvf_configure(struct igbvf_adapter *adapter) static void igbvf_configure(struct igbvf_adapter *adapter)
{ {
igbvf_set_multi(adapter->netdev); igbvf_set_rx_mode(adapter->netdev);
igbvf_restore_vlan(adapter); igbvf_restore_vlan(adapter);
...@@ -1798,7 +1838,7 @@ void igbvf_update_stats(struct igbvf_adapter *adapter) ...@@ -1798,7 +1838,7 @@ void igbvf_update_stats(struct igbvf_adapter *adapter)
UPDATE_VF_COUNTER(VFGPRLBC, gprlbc); UPDATE_VF_COUNTER(VFGPRLBC, gprlbc);
/* Fill out the OS statistics structure */ /* Fill out the OS statistics structure */
adapter->net_stats.multicast = adapter->stats.mprc; adapter->netdev->stats.multicast = adapter->stats.mprc;
} }
static void igbvf_print_link_info(struct igbvf_adapter *adapter) static void igbvf_print_link_info(struct igbvf_adapter *adapter)
...@@ -2333,21 +2373,6 @@ static void igbvf_reset_task(struct work_struct *work) ...@@ -2333,21 +2373,6 @@ static void igbvf_reset_task(struct work_struct *work)
igbvf_reinit_locked(adapter); igbvf_reinit_locked(adapter);
} }
/**
* igbvf_get_stats - Get System Network Statistics
* @netdev: network interface device structure
*
* Returns the address of the device statistics structure.
* The statistics are actually updated from the timer callback.
**/
static struct net_device_stats *igbvf_get_stats(struct net_device *netdev)
{
struct igbvf_adapter *adapter = netdev_priv(netdev);
/* only return the current stats */
return &adapter->net_stats;
}
/** /**
* igbvf_change_mtu - Change the Maximum Transfer Unit * igbvf_change_mtu - Change the Maximum Transfer Unit
* @netdev: network interface device structure * @netdev: network interface device structure
...@@ -2635,8 +2660,7 @@ static const struct net_device_ops igbvf_netdev_ops = { ...@@ -2635,8 +2660,7 @@ static const struct net_device_ops igbvf_netdev_ops = {
.ndo_open = igbvf_open, .ndo_open = igbvf_open,
.ndo_stop = igbvf_close, .ndo_stop = igbvf_close,
.ndo_start_xmit = igbvf_xmit_frame, .ndo_start_xmit = igbvf_xmit_frame,
.ndo_get_stats = igbvf_get_stats, .ndo_set_rx_mode = igbvf_set_rx_mode,
.ndo_set_rx_mode = igbvf_set_multi,
.ndo_set_mac_address = igbvf_set_mac, .ndo_set_mac_address = igbvf_set_mac,
.ndo_change_mtu = igbvf_change_mtu, .ndo_change_mtu = igbvf_change_mtu,
.ndo_do_ioctl = igbvf_ioctl, .ndo_do_ioctl = igbvf_ioctl,
......
...@@ -36,6 +36,7 @@ static void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, u8 *, ...@@ -36,6 +36,7 @@ static void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, u8 *,
u32, u32, u32); u32, u32, u32);
static void e1000_rar_set_vf(struct e1000_hw *, u8 *, u32); static void e1000_rar_set_vf(struct e1000_hw *, u8 *, u32);
static s32 e1000_read_mac_addr_vf(struct e1000_hw *); static s32 e1000_read_mac_addr_vf(struct e1000_hw *);
static s32 e1000_set_uc_addr_vf(struct e1000_hw *hw, u32 subcmd, u8 *addr);
static s32 e1000_set_vfta_vf(struct e1000_hw *, u16, bool); static s32 e1000_set_vfta_vf(struct e1000_hw *, u16, bool);
/** /**
...@@ -66,6 +67,8 @@ static s32 e1000_init_mac_params_vf(struct e1000_hw *hw) ...@@ -66,6 +67,8 @@ static s32 e1000_init_mac_params_vf(struct e1000_hw *hw)
mac->ops.rar_set = e1000_rar_set_vf; mac->ops.rar_set = e1000_rar_set_vf;
/* read mac address */ /* read mac address */
mac->ops.read_mac_addr = e1000_read_mac_addr_vf; mac->ops.read_mac_addr = e1000_read_mac_addr_vf;
/* set mac filter */
mac->ops.set_uc_addr = e1000_set_uc_addr_vf;
/* set vlan filter table array */ /* set vlan filter table array */
mac->ops.set_vfta = e1000_set_vfta_vf; mac->ops.set_vfta = e1000_set_vfta_vf;
...@@ -337,6 +340,44 @@ static s32 e1000_read_mac_addr_vf(struct e1000_hw *hw) ...@@ -337,6 +340,44 @@ static s32 e1000_read_mac_addr_vf(struct e1000_hw *hw)
return E1000_SUCCESS; return E1000_SUCCESS;
} }
/**
* e1000_set_uc_addr_vf - Set or clear unicast filters
* @hw: pointer to the HW structure
* @sub_cmd: add or clear filters
* @addr: pointer to the filter MAC address
**/
static s32 e1000_set_uc_addr_vf(struct e1000_hw *hw, u32 sub_cmd, u8 *addr)
{
struct e1000_mbx_info *mbx = &hw->mbx;
u32 msgbuf[3], msgbuf_chk;
u8 *msg_addr = (u8 *)(&msgbuf[1]);
s32 ret_val;
memset(msgbuf, 0, sizeof(msgbuf));
msgbuf[0] |= sub_cmd;
msgbuf[0] |= E1000_VF_SET_MAC_ADDR;
msgbuf_chk = msgbuf[0];
if (addr)
memcpy(msg_addr, addr, ETH_ALEN);
ret_val = mbx->ops.write_posted(hw, msgbuf, 3);
if (!ret_val)
ret_val = mbx->ops.read_posted(hw, msgbuf, 3);
msgbuf[0] &= ~E1000_VT_MSGTYPE_CTS;
if (!ret_val) {
msgbuf[0] &= ~E1000_VT_MSGTYPE_CTS;
if (msgbuf[0] == (msgbuf_chk | E1000_VT_MSGTYPE_NACK))
return -ENOSPC;
}
return ret_val;
}
/** /**
* e1000_check_for_link_vf - Check for link for a virtual interface * e1000_check_for_link_vf - Check for link for a virtual interface
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
......
...@@ -179,6 +179,7 @@ struct e1000_mac_operations { ...@@ -179,6 +179,7 @@ struct e1000_mac_operations {
s32 (*get_bus_info)(struct e1000_hw *); s32 (*get_bus_info)(struct e1000_hw *);
s32 (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *); s32 (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *);
void (*update_mc_addr_list)(struct e1000_hw *, u8 *, u32, u32, u32); void (*update_mc_addr_list)(struct e1000_hw *, u8 *, u32, u32, u32);
s32 (*set_uc_addr)(struct e1000_hw *, u32, u8 *);
s32 (*reset_hw)(struct e1000_hw *); s32 (*reset_hw)(struct e1000_hw *);
s32 (*init_hw)(struct e1000_hw *); s32 (*init_hw)(struct e1000_hw *);
s32 (*setup_link)(struct e1000_hw *); s32 (*setup_link)(struct e1000_hw *);
......
...@@ -86,7 +86,6 @@ static void ixgb_set_multi(struct net_device *netdev); ...@@ -86,7 +86,6 @@ static void ixgb_set_multi(struct net_device *netdev);
static void ixgb_watchdog(unsigned long data); static void ixgb_watchdog(unsigned long data);
static netdev_tx_t ixgb_xmit_frame(struct sk_buff *skb, static netdev_tx_t ixgb_xmit_frame(struct sk_buff *skb,
struct net_device *netdev); struct net_device *netdev);
static struct net_device_stats *ixgb_get_stats(struct net_device *netdev);
static int ixgb_change_mtu(struct net_device *netdev, int new_mtu); static int ixgb_change_mtu(struct net_device *netdev, int new_mtu);
static int ixgb_set_mac(struct net_device *netdev, void *p); static int ixgb_set_mac(struct net_device *netdev, void *p);
static irqreturn_t ixgb_intr(int irq, void *data); static irqreturn_t ixgb_intr(int irq, void *data);
...@@ -367,7 +366,6 @@ static const struct net_device_ops ixgb_netdev_ops = { ...@@ -367,7 +366,6 @@ static const struct net_device_ops ixgb_netdev_ops = {
.ndo_open = ixgb_open, .ndo_open = ixgb_open,
.ndo_stop = ixgb_close, .ndo_stop = ixgb_close,
.ndo_start_xmit = ixgb_xmit_frame, .ndo_start_xmit = ixgb_xmit_frame,
.ndo_get_stats = ixgb_get_stats,
.ndo_set_rx_mode = ixgb_set_multi, .ndo_set_rx_mode = ixgb_set_multi,
.ndo_validate_addr = eth_validate_addr, .ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = ixgb_set_mac, .ndo_set_mac_address = ixgb_set_mac,
...@@ -1596,20 +1594,6 @@ ixgb_tx_timeout_task(struct work_struct *work) ...@@ -1596,20 +1594,6 @@ ixgb_tx_timeout_task(struct work_struct *work)
ixgb_up(adapter); ixgb_up(adapter);
} }
/**
* ixgb_get_stats - Get System Network Statistics
* @netdev: network interface device structure
*
* Returns the address of the device statistics structure.
* The statistics are actually updated from the timer callback.
**/
static struct net_device_stats *
ixgb_get_stats(struct net_device *netdev)
{
return &netdev->stats;
}
/** /**
* ixgb_change_mtu - Change the Maximum Transfer Unit * ixgb_change_mtu - Change the Maximum Transfer Unit
* @netdev: network interface device structure * @netdev: network interface device structure
......
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