Commit a00f6fcc authored by David S. Miller's avatar David S. Miller

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next

Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates

This series contains updates to igb, igbvf, i40e, ixgbe and ixgbevf.

Dan Carpenter provides a patch for igbvf to fix a bug found by a static
checker.  If the new MTU is very large, then "new_mtu + ETH_HLEN +
ETH_FCS_LEN" can wrap and the check on the next line can underflow.

Wei Yongjun provides 2 patches, the first against igbvf adds a missing
iounmap() before the return from igbvf_probe().  The second against
i40e, removes the include <linux/version.h> because it is not needed.

Carolyn provides a patch for igb to fix a call to set the master/slave
mode for all m88 generation 2 PHY's and removes the call for I210
devices which do not need it.

Stefan Assmann provides a patch for igb to fix an issue which was broke
by:
   commit fa44f2f1
   Author: Greg Rose <gregory.v.rose@intel.com>
   Date:   Thu Jan 17 01:03:06 2013 -0800
   igb: Enable SR-IOV configuration via PCI sysfs interface
which breaks the reloading of igb when VFs are assigned to a guest, in
several ways.

Jacob provides a patch for ixgbe and ixgbevf.  First, against ixgbe,
cleans up ixgbe_enumerate_functions to reduce code complexity.  The
second, against ixgbevf, adds support for ethtool's get_coalesce and
set_coalesce command for the ixgbevf driver.

Yijing Wang provides a patch for ixgbe to use pcie_capability_read_word()
to simplify the code.

Emil provides a ixgbe patch to fix an issue where the logic used to
detect changes in rx-usecs was incorrect and was masked by the call to
ixgbe_update_rsc().

Don provides 2 patches for ixgbevf.  First creates a new function to set
PSRTYPE.  The second bumps the ixgbevf driver version.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 7f294054 9e6fcae7
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
#include <linux/sctp.h> #include <linux/sctp.h>
#include <linux/pkt_sched.h> #include <linux/pkt_sched.h>
#include <linux/ipv6.h> #include <linux/ipv6.h>
#include <linux/version.h>
#include <net/checksum.h> #include <net/checksum.h>
#include <net/ip6_checksum.h> #include <net/ip6_checksum.h>
#include <linux/ethtool.h> #include <linux/ethtool.h>
......
...@@ -708,11 +708,6 @@ s32 igb_copper_link_setup_m88(struct e1000_hw *hw) ...@@ -708,11 +708,6 @@ s32 igb_copper_link_setup_m88(struct e1000_hw *hw)
hw_dbg("Error committing the PHY changes\n"); hw_dbg("Error committing the PHY changes\n");
goto out; goto out;
} }
if (phy->type == e1000_phy_i210) {
ret_val = igb_set_master_slave_mode(hw);
if (ret_val)
return ret_val;
}
out: out:
return ret_val; return ret_val;
...@@ -806,6 +801,9 @@ s32 igb_copper_link_setup_m88_gen2(struct e1000_hw *hw) ...@@ -806,6 +801,9 @@ s32 igb_copper_link_setup_m88_gen2(struct e1000_hw *hw)
hw_dbg("Error committing the PHY changes\n"); hw_dbg("Error committing the PHY changes\n");
return ret_val; return ret_val;
} }
ret_val = igb_set_master_slave_mode(hw);
if (ret_val)
return ret_val;
return 0; return 0;
} }
......
...@@ -182,6 +182,7 @@ static void igb_check_vf_rate_limit(struct igb_adapter *); ...@@ -182,6 +182,7 @@ static void igb_check_vf_rate_limit(struct igb_adapter *);
#ifdef CONFIG_PCI_IOV #ifdef CONFIG_PCI_IOV
static int igb_vf_configure(struct igb_adapter *adapter, int vf); static int igb_vf_configure(struct igb_adapter *adapter, int vf);
static int igb_pci_enable_sriov(struct pci_dev *dev, int num_vfs);
#endif #endif
#ifdef CONFIG_PM #ifdef CONFIG_PM
...@@ -2429,7 +2430,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2429,7 +2430,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
} }
#ifdef CONFIG_PCI_IOV #ifdef CONFIG_PCI_IOV
static int igb_disable_sriov(struct pci_dev *pdev) static int igb_disable_sriov(struct pci_dev *pdev)
{ {
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);
...@@ -2470,27 +2471,19 @@ static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs) ...@@ -2470,27 +2471,19 @@ static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs)
int err = 0; int err = 0;
int i; int i;
if (!adapter->msix_entries) { if (!adapter->msix_entries || num_vfs > 7) {
err = -EPERM; err = -EPERM;
goto out; goto out;
} }
if (!num_vfs) if (!num_vfs)
goto out; goto out;
else if (old_vfs && old_vfs == num_vfs)
goto out;
else if (old_vfs && old_vfs != num_vfs)
err = igb_disable_sriov(pdev);
if (err)
goto out;
if (num_vfs > 7) { if (old_vfs) {
err = -EPERM; dev_info(&pdev->dev, "%d pre-allocated VFs found - override max_vfs setting of %d\n",
goto out; old_vfs, max_vfs);
} adapter->vfs_allocated_count = old_vfs;
} else
adapter->vfs_allocated_count = num_vfs; adapter->vfs_allocated_count = num_vfs;
adapter->vf_data = kcalloc(adapter->vfs_allocated_count, adapter->vf_data = kcalloc(adapter->vfs_allocated_count,
sizeof(struct vf_data_storage), GFP_KERNEL); sizeof(struct vf_data_storage), GFP_KERNEL);
...@@ -2504,10 +2497,12 @@ static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs) ...@@ -2504,10 +2497,12 @@ static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs)
goto out; goto out;
} }
err = pci_enable_sriov(pdev, adapter->vfs_allocated_count); /* only call pci_enable_sriov() if no VFs are allocated already */
if (err) if (!old_vfs) {
goto err_out; err = pci_enable_sriov(pdev, adapter->vfs_allocated_count);
if (err)
goto err_out;
}
dev_info(&pdev->dev, "%d VFs allocated\n", dev_info(&pdev->dev, "%d VFs allocated\n",
adapter->vfs_allocated_count); adapter->vfs_allocated_count);
for (i = 0; i < adapter->vfs_allocated_count; i++) for (i = 0; i < adapter->vfs_allocated_count; i++)
...@@ -2623,7 +2618,7 @@ static void igb_probe_vfs(struct igb_adapter *adapter) ...@@ -2623,7 +2618,7 @@ static void igb_probe_vfs(struct igb_adapter *adapter)
return; return;
pci_sriov_set_totalvfs(pdev, 7); pci_sriov_set_totalvfs(pdev, 7);
igb_enable_sriov(pdev, max_vfs); igb_pci_enable_sriov(pdev, max_vfs);
#endif /* CONFIG_PCI_IOV */ #endif /* CONFIG_PCI_IOV */
} }
......
...@@ -2343,10 +2343,9 @@ static int igbvf_change_mtu(struct net_device *netdev, int new_mtu) ...@@ -2343,10 +2343,9 @@ static int igbvf_change_mtu(struct net_device *netdev, int new_mtu)
struct igbvf_adapter *adapter = netdev_priv(netdev); struct igbvf_adapter *adapter = netdev_priv(netdev);
int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
if ((new_mtu < 68) || (max_frame > MAX_JUMBO_FRAME_SIZE)) { if (new_mtu < 68 || new_mtu > INT_MAX - ETH_HLEN - ETH_FCS_LEN ||
dev_err(&adapter->pdev->dev, "Invalid MTU setting\n"); max_frame > MAX_JUMBO_FRAME_SIZE)
return -EINVAL; return -EINVAL;
}
#define MAX_STD_JUMBO_FRAME_SIZE 9234 #define MAX_STD_JUMBO_FRAME_SIZE 9234
if (max_frame > MAX_STD_JUMBO_FRAME_SIZE) { if (max_frame > MAX_STD_JUMBO_FRAME_SIZE) {
...@@ -2699,7 +2698,7 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2699,7 +2698,7 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (ei->get_variants) { if (ei->get_variants) {
err = ei->get_variants(adapter); err = ei->get_variants(adapter);
if (err) if (err)
goto err_ioremap; goto err_get_variants;
} }
/* setup adapter struct */ /* setup adapter struct */
...@@ -2796,6 +2795,7 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2796,6 +2795,7 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
kfree(adapter->rx_ring); kfree(adapter->rx_ring);
err_sw_init: err_sw_init:
igbvf_reset_interrupt_capability(adapter); igbvf_reset_interrupt_capability(adapter);
err_get_variants:
iounmap(adapter->hw.hw_addr); iounmap(adapter->hw.hw_addr);
err_ioremap: err_ioremap:
free_netdev(netdev); free_netdev(netdev);
......
...@@ -2257,13 +2257,13 @@ static int ixgbe_set_coalesce(struct net_device *netdev, ...@@ -2257,13 +2257,13 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
#if IS_ENABLED(CONFIG_BQL) #if IS_ENABLED(CONFIG_BQL)
/* detect ITR changes that require update of TXDCTL.WTHRESH */ /* detect ITR changes that require update of TXDCTL.WTHRESH */
if ((adapter->tx_itr_setting > 1) && if ((adapter->tx_itr_setting != 1) &&
(adapter->tx_itr_setting < IXGBE_100K_ITR)) { (adapter->tx_itr_setting < IXGBE_100K_ITR)) {
if ((tx_itr_prev == 1) || if ((tx_itr_prev == 1) ||
(tx_itr_prev > IXGBE_100K_ITR)) (tx_itr_prev >= IXGBE_100K_ITR))
need_reset = true; need_reset = true;
} else { } else {
if ((tx_itr_prev > 1) && if ((tx_itr_prev != 1) &&
(tx_itr_prev < IXGBE_100K_ITR)) (tx_itr_prev < IXGBE_100K_ITR))
need_reset = true; need_reset = true;
} }
......
...@@ -153,7 +153,6 @@ MODULE_VERSION(DRV_VERSION); ...@@ -153,7 +153,6 @@ MODULE_VERSION(DRV_VERSION);
static int ixgbe_read_pci_cfg_word_parent(struct ixgbe_adapter *adapter, static int ixgbe_read_pci_cfg_word_parent(struct ixgbe_adapter *adapter,
u32 reg, u16 *value) u32 reg, u16 *value)
{ {
int pos = 0;
struct pci_dev *parent_dev; struct pci_dev *parent_dev;
struct pci_bus *parent_bus; struct pci_bus *parent_bus;
...@@ -165,11 +164,10 @@ static int ixgbe_read_pci_cfg_word_parent(struct ixgbe_adapter *adapter, ...@@ -165,11 +164,10 @@ static int ixgbe_read_pci_cfg_word_parent(struct ixgbe_adapter *adapter,
if (!parent_dev) if (!parent_dev)
return -1; return -1;
pos = pci_find_capability(parent_dev, PCI_CAP_ID_EXP); if (!pci_is_pcie(parent_dev))
if (!pos)
return -1; return -1;
pci_read_config_word(parent_dev, pos + reg, value); pcie_capability_read_word(parent_dev, reg, value);
return 0; return 0;
} }
...@@ -7362,19 +7360,16 @@ static const struct net_device_ops ixgbe_netdev_ops = { ...@@ -7362,19 +7360,16 @@ static const struct net_device_ops ixgbe_netdev_ops = {
**/ **/
static inline int ixgbe_enumerate_functions(struct ixgbe_adapter *adapter) static inline int ixgbe_enumerate_functions(struct ixgbe_adapter *adapter)
{ {
struct ixgbe_hw *hw = &adapter->hw;
struct list_head *entry; struct list_head *entry;
int physfns = 0; int physfns = 0;
/* Some cards can not use the generic count PCIe functions method, and /* Some cards can not use the generic count PCIe functions method,
* so must be hardcoded to the correct value. * because they are behind a parent switch, so we hardcode these with
* the correct number of functions.
*/ */
switch (hw->device_id) { if (ixgbe_pcie_from_parent(&adapter->hw)) {
case IXGBE_DEV_ID_82599_SFP_SF_QP:
case IXGBE_DEV_ID_82599_QSFP_SF_QP:
physfns = 4; physfns = 4;
break; } else {
default:
list_for_each(entry, &adapter->pdev->bus_list) { list_for_each(entry, &adapter->pdev->bus_list) {
struct pci_dev *pdev = struct pci_dev *pdev =
list_entry(entry, struct pci_dev, bus_list); list_entry(entry, struct pci_dev, bus_list);
......
...@@ -634,6 +634,85 @@ static int ixgbevf_nway_reset(struct net_device *netdev) ...@@ -634,6 +634,85 @@ static int ixgbevf_nway_reset(struct net_device *netdev)
return 0; return 0;
} }
static int ixgbevf_get_coalesce(struct net_device *netdev,
struct ethtool_coalesce *ec)
{
struct ixgbevf_adapter *adapter = netdev_priv(netdev);
/* only valid if in constant ITR mode */
if (adapter->rx_itr_setting <= 1)
ec->rx_coalesce_usecs = adapter->rx_itr_setting;
else
ec->rx_coalesce_usecs = adapter->rx_itr_setting >> 2;
/* if in mixed tx/rx queues per vector mode, report only rx settings */
if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count)
return 0;
/* only valid if in constant ITR mode */
if (adapter->tx_itr_setting <= 1)
ec->tx_coalesce_usecs = adapter->tx_itr_setting;
else
ec->tx_coalesce_usecs = adapter->tx_itr_setting >> 2;
return 0;
}
static int ixgbevf_set_coalesce(struct net_device *netdev,
struct ethtool_coalesce *ec)
{
struct ixgbevf_adapter *adapter = netdev_priv(netdev);
struct ixgbevf_q_vector *q_vector;
int num_vectors, i;
u16 tx_itr_param, rx_itr_param;
/* don't accept tx specific changes if we've got mixed RxTx vectors */
if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count
&& ec->tx_coalesce_usecs)
return -EINVAL;
if ((ec->rx_coalesce_usecs > (IXGBE_MAX_EITR >> 2)) ||
(ec->tx_coalesce_usecs > (IXGBE_MAX_EITR >> 2)))
return -EINVAL;
if (ec->rx_coalesce_usecs > 1)
adapter->rx_itr_setting = ec->rx_coalesce_usecs << 2;
else
adapter->rx_itr_setting = ec->rx_coalesce_usecs;
if (adapter->rx_itr_setting == 1)
rx_itr_param = IXGBE_20K_ITR;
else
rx_itr_param = adapter->rx_itr_setting;
if (ec->tx_coalesce_usecs > 1)
adapter->tx_itr_setting = ec->tx_coalesce_usecs << 2;
else
adapter->tx_itr_setting = ec->tx_coalesce_usecs;
if (adapter->tx_itr_setting == 1)
tx_itr_param = IXGBE_10K_ITR;
else
tx_itr_param = adapter->tx_itr_setting;
num_vectors = adapter->num_msix_vectors - NON_Q_VECTORS;
for (i = 0; i < num_vectors; i++) {
q_vector = adapter->q_vector[i];
if (q_vector->tx.count && !q_vector->rx.count)
/* tx only */
q_vector->itr = tx_itr_param;
else
/* rx only or mixed */
q_vector->itr = rx_itr_param;
ixgbevf_write_eitr(q_vector);
}
return 0;
}
static const struct ethtool_ops ixgbevf_ethtool_ops = { static const struct ethtool_ops ixgbevf_ethtool_ops = {
.get_settings = ixgbevf_get_settings, .get_settings = ixgbevf_get_settings,
.get_drvinfo = ixgbevf_get_drvinfo, .get_drvinfo = ixgbevf_get_drvinfo,
...@@ -649,6 +728,8 @@ static const struct ethtool_ops ixgbevf_ethtool_ops = { ...@@ -649,6 +728,8 @@ static const struct ethtool_ops ixgbevf_ethtool_ops = {
.get_sset_count = ixgbevf_get_sset_count, .get_sset_count = ixgbevf_get_sset_count,
.get_strings = ixgbevf_get_strings, .get_strings = ixgbevf_get_strings,
.get_ethtool_stats = ixgbevf_get_ethtool_stats, .get_ethtool_stats = ixgbevf_get_ethtool_stats,
.get_coalesce = ixgbevf_get_coalesce,
.set_coalesce = ixgbevf_set_coalesce,
}; };
void ixgbevf_set_ethtool_ops(struct net_device *netdev) void ixgbevf_set_ethtool_ops(struct net_device *netdev)
......
...@@ -293,6 +293,8 @@ void ixgbevf_free_tx_resources(struct ixgbevf_adapter *, struct ixgbevf_ring *); ...@@ -293,6 +293,8 @@ void ixgbevf_free_tx_resources(struct ixgbevf_adapter *, struct ixgbevf_ring *);
void ixgbevf_update_stats(struct ixgbevf_adapter *adapter); void ixgbevf_update_stats(struct ixgbevf_adapter *adapter);
int ethtool_ioctl(struct ifreq *ifr); int ethtool_ioctl(struct ifreq *ifr);
extern void ixgbevf_write_eitr(struct ixgbevf_q_vector *q_vector);
void ixgbe_napi_add_all(struct ixgbevf_adapter *adapter); void ixgbe_napi_add_all(struct ixgbevf_adapter *adapter);
void ixgbe_napi_del_all(struct ixgbevf_adapter *adapter); void ixgbe_napi_del_all(struct ixgbevf_adapter *adapter);
......
...@@ -58,7 +58,7 @@ const char ixgbevf_driver_name[] = "ixgbevf"; ...@@ -58,7 +58,7 @@ const char ixgbevf_driver_name[] = "ixgbevf";
static const char ixgbevf_driver_string[] = static const char ixgbevf_driver_string[] =
"Intel(R) 10 Gigabit PCI Express Virtual Function Network Driver"; "Intel(R) 10 Gigabit PCI Express Virtual Function Network Driver";
#define DRV_VERSION "2.7.12-k" #define DRV_VERSION "2.11.3-k"
const char ixgbevf_driver_version[] = DRV_VERSION; const char ixgbevf_driver_version[] = DRV_VERSION;
static char ixgbevf_copyright[] = static char ixgbevf_copyright[] =
"Copyright (c) 2009 - 2012 Intel Corporation."; "Copyright (c) 2009 - 2012 Intel Corporation.";
...@@ -580,7 +580,7 @@ static int ixgbevf_poll(struct napi_struct *napi, int budget) ...@@ -580,7 +580,7 @@ static int ixgbevf_poll(struct napi_struct *napi, int budget)
* ixgbevf_write_eitr - write VTEITR register in hardware specific way * ixgbevf_write_eitr - write VTEITR register in hardware specific way
* @q_vector: structure containing interrupt and ring information * @q_vector: structure containing interrupt and ring information
*/ */
static void ixgbevf_write_eitr(struct ixgbevf_q_vector *q_vector) void ixgbevf_write_eitr(struct ixgbevf_q_vector *q_vector)
{ {
struct ixgbevf_adapter *adapter = q_vector->adapter; struct ixgbevf_adapter *adapter = q_vector->adapter;
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw = &adapter->hw;
...@@ -1082,6 +1082,21 @@ static void ixgbevf_configure_srrctl(struct ixgbevf_adapter *adapter, int index) ...@@ -1082,6 +1082,21 @@ static void ixgbevf_configure_srrctl(struct ixgbevf_adapter *adapter, int index)
IXGBE_WRITE_REG(hw, IXGBE_VFSRRCTL(index), srrctl); IXGBE_WRITE_REG(hw, IXGBE_VFSRRCTL(index), srrctl);
} }
static void ixgbevf_setup_psrtype(struct ixgbevf_adapter *adapter)
{
struct ixgbe_hw *hw = &adapter->hw;
/* PSRTYPE must be initialized in 82599 */
u32 psrtype = IXGBE_PSRTYPE_TCPHDR | IXGBE_PSRTYPE_UDPHDR |
IXGBE_PSRTYPE_IPV4HDR | IXGBE_PSRTYPE_IPV6HDR |
IXGBE_PSRTYPE_L2HDR;
if (adapter->num_rx_queues > 1)
psrtype |= 1 << 29;
IXGBE_WRITE_REG(hw, IXGBE_VFPSRTYPE, psrtype);
}
static void ixgbevf_set_rx_buffer_len(struct ixgbevf_adapter *adapter) static void ixgbevf_set_rx_buffer_len(struct ixgbevf_adapter *adapter)
{ {
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw = &adapter->hw;
...@@ -1129,8 +1144,7 @@ static void ixgbevf_configure_rx(struct ixgbevf_adapter *adapter) ...@@ -1129,8 +1144,7 @@ static void ixgbevf_configure_rx(struct ixgbevf_adapter *adapter)
int i, j; int i, j;
u32 rdlen; u32 rdlen;
/* PSRTYPE must be initialized in 82599 */ ixgbevf_setup_psrtype(adapter);
IXGBE_WRITE_REG(hw, IXGBE_VFPSRTYPE, 0);
/* set_rx_buffer_len must be called before ring initialization */ /* set_rx_buffer_len must be called before ring initialization */
ixgbevf_set_rx_buffer_len(adapter); ixgbevf_set_rx_buffer_len(adapter);
......
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