Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Browse files Browse the repository at this point in the history
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
  igb: remove sysfs entry that was used to set the number of vfs
  igbvf: add new driver to support 82576 virtual functions
  drivers/net/eql.c: Fix a dev leakage.
  niu: Fix unused variable warning.
  r6040: set MODULE_VERSION
  bnx2: Don't use reserved names
  FEC driver: add missing #endif
  niu: Fix error handling
  mv643xx_eth: don't reset the rx coal timer on interface up
  smsc911x: correct debugging message on mii read timeout
  ethoc: fix library build errors
  netfilter: ctnetlink: fix regression in expectation handling
  netfilter: fix selection of "LED" target in netfilter
  netfilter: ip6tables regression fix
  • Loading branch information
Linus Torvalds committed Apr 9, 2009
2 parents a219ee8 + 2a3abf6 commit c71d9ca
Show file tree
Hide file tree
Showing 24 changed files with 5,266 additions and 148 deletions.
23 changes: 23 additions & 0 deletions drivers/net/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,8 @@ config ETHOC
depends on NET_ETHERNET && HAS_IOMEM
select MII
select PHYLIB
select CRC32
select BITREVERSE
help
Say Y here if you want to use the OpenCores 10/100 Mbps Ethernet MAC.

Expand Down Expand Up @@ -2056,6 +2058,27 @@ config IGB_DCA
driver. DCA is a method for warming the CPU cache before data
is used, with the intent of lessening the impact of cache misses.

config IGBVF
tristate "Intel(R) 82576 Virtual Function Ethernet support"
depends on PCI
---help---
This driver supports Intel(R) 82576 virtual functions. For more
information on how to identify your adapter, go to the Adapter &
Driver ID Guide at:

<http://support.intel.com/support/network/adapter/pro100/21397.htm>

For general information and support, go to the Intel support
website at:

<http://support.intel.com>

More specific information on configuring the driver is in
<file:Documentation/networking/e1000.txt>.

To compile this driver as a module, choose M here. The module
will be called igbvf.

source "drivers/net/ixp2000/Kconfig"

config MYRI_SBUS
Expand Down
1 change: 1 addition & 0 deletions drivers/net/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ obj-$(CONFIG_E1000) += e1000/
obj-$(CONFIG_E1000E) += e1000e/
obj-$(CONFIG_IBM_NEW_EMAC) += ibm_newemac/
obj-$(CONFIG_IGB) += igb/
obj-$(CONFIG_IGBVF) += igbvf/
obj-$(CONFIG_IXGBE) += ixgbe/
obj-$(CONFIG_IXGB) += ixgb/
obj-$(CONFIG_IP1000) += ipg.o
Expand Down
26 changes: 13 additions & 13 deletions drivers/net/bnx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -3427,8 +3427,8 @@ static int __devinit
bnx2_request_firmware(struct bnx2 *bp)
{
const char *mips_fw_file, *rv2p_fw_file;
const struct bnx2_mips_fw_file *mips;
const struct bnx2_rv2p_fw_file *rv2p;
const struct bnx2_mips_fw_file *mips_fw;
const struct bnx2_rv2p_fw_file *rv2p_fw;
int rc;

if (CHIP_NUM(bp) == CHIP_NUM_5709) {
Expand All @@ -3452,21 +3452,21 @@ bnx2_request_firmware(struct bnx2 *bp)
rv2p_fw_file);
return rc;
}
mips = (const struct bnx2_mips_fw_file *) bp->mips_firmware->data;
rv2p = (const struct bnx2_rv2p_fw_file *) bp->rv2p_firmware->data;
if (bp->mips_firmware->size < sizeof(*mips) ||
check_mips_fw_entry(bp->mips_firmware, &mips->com) ||
check_mips_fw_entry(bp->mips_firmware, &mips->cp) ||
check_mips_fw_entry(bp->mips_firmware, &mips->rxp) ||
check_mips_fw_entry(bp->mips_firmware, &mips->tpat) ||
check_mips_fw_entry(bp->mips_firmware, &mips->txp)) {
mips_fw = (const struct bnx2_mips_fw_file *) bp->mips_firmware->data;
rv2p_fw = (const struct bnx2_rv2p_fw_file *) bp->rv2p_firmware->data;
if (bp->mips_firmware->size < sizeof(*mips_fw) ||
check_mips_fw_entry(bp->mips_firmware, &mips_fw->com) ||
check_mips_fw_entry(bp->mips_firmware, &mips_fw->cp) ||
check_mips_fw_entry(bp->mips_firmware, &mips_fw->rxp) ||
check_mips_fw_entry(bp->mips_firmware, &mips_fw->tpat) ||
check_mips_fw_entry(bp->mips_firmware, &mips_fw->txp)) {
printk(KERN_ERR PFX "Firmware file \"%s\" is invalid\n",
mips_fw_file);
return -EINVAL;
}
if (bp->rv2p_firmware->size < sizeof(*rv2p) ||
check_fw_section(bp->rv2p_firmware, &rv2p->proc1.rv2p, 8, true) ||
check_fw_section(bp->rv2p_firmware, &rv2p->proc2.rv2p, 8, true)) {
if (bp->rv2p_firmware->size < sizeof(*rv2p_fw) ||
check_fw_section(bp->rv2p_firmware, &rv2p_fw->proc1.rv2p, 8, true) ||
check_fw_section(bp->rv2p_firmware, &rv2p_fw->proc2.rv2p, 8, true)) {
printk(KERN_ERR PFX "Firmware file \"%s\" is invalid\n",
rv2p_fw_file);
return -EINVAL;
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/eql.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ static int eql_s_slave_cfg(struct net_device *dev, slave_config_t __user *scp)
}
spin_unlock_bh(&eql->queue.lock);

dev_put(slave_dev);

return ret;
}

Expand Down
1 change: 1 addition & 0 deletions drivers/net/fec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,7 @@ static void __inline__ fec_phy_ack_intr(void)
icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
*icrp = 0x0d000000;
}
#endif

#ifdef CONFIG_M5272
static void __inline__ fec_get_mac(struct net_device *dev)
Expand Down
159 changes: 54 additions & 105 deletions drivers/net/igb/igb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,13 @@ static struct notifier_block dca_notifier = {
/* for netdump / net console */
static void igb_netpoll(struct net_device *);
#endif

#ifdef CONFIG_PCI_IOV
static ssize_t igb_set_num_vfs(struct device *, struct device_attribute *,
const char *, size_t);
static ssize_t igb_show_num_vfs(struct device *, struct device_attribute *,
char *);
DEVICE_ATTR(num_vfs, S_IRUGO | S_IWUSR, igb_show_num_vfs, igb_set_num_vfs);
#endif
static unsigned int max_vfs = 0;
module_param(max_vfs, uint, 0);
MODULE_PARM_DESC(max_vfs, "Maximum number of virtual functions to allocate "
"per physical function");
#endif /* CONFIG_PCI_IOV */

static pci_ers_result_t igb_io_error_detected(struct pci_dev *,
pci_channel_state_t);
static pci_ers_result_t igb_io_slot_reset(struct pci_dev *);
Expand Down Expand Up @@ -671,6 +670,21 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter)

/* If we can't do MSI-X, try MSI */
msi_only:
#ifdef CONFIG_PCI_IOV
/* disable SR-IOV for non MSI-X configurations */
if (adapter->vf_data) {
struct e1000_hw *hw = &adapter->hw;
/* disable iov and allow time for transactions to clear */
pci_disable_sriov(adapter->pdev);
msleep(500);

kfree(adapter->vf_data);
adapter->vf_data = NULL;
wr32(E1000_IOVCTL, E1000_IOVCTL_REUSE_VFQ);
msleep(100);
dev_info(&adapter->pdev->dev, "IOV Disabled\n");
}
#endif
adapter->num_rx_queues = 1;
adapter->num_tx_queues = 1;
if (!pci_enable_msi(adapter->pdev))
Expand Down Expand Up @@ -1238,6 +1252,39 @@ static int __devinit igb_probe(struct pci_dev *pdev,
if (err)
goto err_sw_init;

#ifdef CONFIG_PCI_IOV
/* since iov functionality isn't critical to base device function we
* can accept failure. If it fails we don't allow iov to be enabled */
if (hw->mac.type == e1000_82576) {
/* 82576 supports a maximum of 7 VFs in addition to the PF */
unsigned int num_vfs = (max_vfs > 7) ? 7 : max_vfs;
int i;
unsigned char mac_addr[ETH_ALEN];

if (num_vfs)
adapter->vf_data = kcalloc(num_vfs,
sizeof(struct vf_data_storage),
GFP_KERNEL);
if (!adapter->vf_data) {
dev_err(&pdev->dev, "Could not allocate VF private "
"data - IOV enable failed\n");
} else {
err = pci_enable_sriov(pdev, num_vfs);
if (!err) {
adapter->vfs_allocated_count = num_vfs;
dev_info(&pdev->dev, "%d vfs allocated\n", num_vfs);
for (i = 0; i < adapter->vfs_allocated_count; i++) {
random_ether_addr(mac_addr);
igb_set_vf_mac(adapter, i, mac_addr);
}
} else {
kfree(adapter->vf_data);
adapter->vf_data = NULL;
}
}
}

#endif
/* setup the private structure */
err = igb_sw_init(adapter);
if (err)
Expand Down Expand Up @@ -1397,19 +1444,6 @@ static int __devinit igb_probe(struct pci_dev *pdev,
if (err)
goto err_register;

#ifdef CONFIG_PCI_IOV
/* since iov functionality isn't critical to base device function we
* can accept failure. If it fails we don't allow iov to be enabled */
if (hw->mac.type == e1000_82576) {
err = pci_enable_sriov(pdev, 0);
if (!err)
err = device_create_file(&netdev->dev,
&dev_attr_num_vfs);
if (err)
dev_err(&pdev->dev, "Failed to initialize IOV\n");
}

#endif
#ifdef CONFIG_IGB_DCA
if (dca_add_requester(&pdev->dev) == 0) {
adapter->flags |= IGB_FLAG_DCA_ENABLED;
Expand Down Expand Up @@ -5422,89 +5456,4 @@ static void igb_vmm_control(struct igb_adapter *adapter)
igb_vmdq_set_replication_pf(hw, true);
}

#ifdef CONFIG_PCI_IOV
static ssize_t igb_show_num_vfs(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct igb_adapter *adapter = netdev_priv(to_net_dev(dev));

return sprintf(buf, "%d\n", adapter->vfs_allocated_count);
}

static ssize_t igb_set_num_vfs(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct net_device *netdev = to_net_dev(dev);
struct igb_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
struct pci_dev *pdev = adapter->pdev;
unsigned int num_vfs, i;
unsigned char mac_addr[ETH_ALEN];
int err;

sscanf(buf, "%u", &num_vfs);

if (num_vfs > 7)
num_vfs = 7;

/* value unchanged do nothing */
if (num_vfs == adapter->vfs_allocated_count)
return count;

if (netdev->flags & IFF_UP)
igb_close(netdev);

igb_reset_interrupt_capability(adapter);
igb_free_queues(adapter);
adapter->tx_ring = NULL;
adapter->rx_ring = NULL;
adapter->vfs_allocated_count = 0;

/* reclaim resources allocated to VFs since we are changing count */
if (adapter->vf_data) {
/* disable iov and allow time for transactions to clear */
pci_disable_sriov(pdev);
msleep(500);

kfree(adapter->vf_data);
adapter->vf_data = NULL;
wr32(E1000_IOVCTL, E1000_IOVCTL_REUSE_VFQ);
msleep(100);
dev_info(&pdev->dev, "IOV Disabled\n");
}

if (num_vfs) {
adapter->vf_data = kcalloc(num_vfs,
sizeof(struct vf_data_storage),
GFP_KERNEL);
if (!adapter->vf_data) {
dev_err(&pdev->dev, "Could not allocate VF private "
"data - IOV enable failed\n");
} else {
err = pci_enable_sriov(pdev, num_vfs);
if (!err) {
adapter->vfs_allocated_count = num_vfs;
dev_info(&pdev->dev, "%d vfs allocated\n", num_vfs);
for (i = 0; i < adapter->vfs_allocated_count; i++) {
random_ether_addr(mac_addr);
igb_set_vf_mac(adapter, i, mac_addr);
}
} else {
kfree(adapter->vf_data);
adapter->vf_data = NULL;
}
}
}

igb_set_interrupt_capability(adapter);
igb_alloc_queues(adapter);
igb_reset(adapter);

if (netdev->flags & IFF_UP)
igb_open(netdev);

return count;
}
#endif /* CONFIG_PCI_IOV */
/* igb_main.c */
38 changes: 38 additions & 0 deletions drivers/net/igbvf/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
################################################################################
#
# Intel(R) 82576 Virtual Function Linux driver
# Copyright(c) 2009 Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
#
# The full GNU General Public License is included in this distribution in
# the file called "COPYING".
#
# Contact Information:
# e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
# Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
#
################################################################################

#
# Makefile for the Intel(R) 82576 VF ethernet driver
#

obj-$(CONFIG_IGBVF) += igbvf.o

igbvf-objs := vf.o \
mbx.o \
ethtool.o \
netdev.o

Loading

0 comments on commit c71d9ca

Please sign in to comment.