Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (60 commits)
  net: restore gnet_stats_basic to previous definition
  NETROM: Fix use of static buffer
  e1000e: fix use of pci_enable_pcie_error_reporting
  e1000e: WoL does not work on 82577/82578 with manageability enabled
  cnic: Fix locking in init/exit calls.
  cnic: Fix locking in start/stop calls.
  bnx2: Use mutex on slow path cnic calls.
  cnic: Refine registration with bnx2.
  cnic: Fix symbol_put_addr() panic on ia64.
  gre: Fix MTU calculation for bound GRE tunnels
  pegasus: Add new device ID.
  drivers/net: fixed drivers that support netpoll use ndo_start_xmit()
  via-velocity: Fix test of mii_status bit VELOCITY_DUPLEX_FULL
  rt2x00: fix memory corruption in rf cache, add a sanity check
  ixgbe: Fix receive on real device when VLANs are configured
  ixgbe: Do not return 0 in ixgbe_fcoe_ddp() upon FCP_RSP in DDP completion
  netxen: free napi resources during detach
  netxen: remove netxen workqueue
  ixgbe: fix issues setting rx-usecs with legacy interrupts
  can: fix oops caused by wrong rtnl newlink usage
  ...
This commit is contained in:
Linus Torvalds 2009-08-18 13:55:01 -07:00
commit 8486a0f95c
69 changed files with 524 additions and 351 deletions

View file

@ -904,7 +904,7 @@ F: drivers/input/misc/ati_remote2.c
ATLX ETHERNET DRIVERS ATLX ETHERNET DRIVERS
M: Jay Cliburn <jcliburn@gmail.com> M: Jay Cliburn <jcliburn@gmail.com>
M: Chris Snook <csnook@redhat.com> M: Chris Snook <chris.snook@gmail.com>
M: Jie Yang <jie.yang@atheros.com> M: Jie Yang <jie.yang@atheros.com>
L: atl1-devel@lists.sourceforge.net L: atl1-devel@lists.sourceforge.net
W: http://sourceforge.net/projects/atl1 W: http://sourceforge.net/projects/atl1
@ -3563,6 +3563,9 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git
S: Maintained S: Maintained
F: net/ F: net/
F: include/net/ F: include/net/
F: include/linux/in.h
F: include/linux/net.h
F: include/linux/netdevice.h
NETWORKING [IPv4/IPv6] NETWORKING [IPv4/IPv6]
M: "David S. Miller" <davem@davemloft.net> M: "David S. Miller" <davem@davemloft.net>
@ -3598,6 +3601,8 @@ W: http://www.linuxfoundation.org/en/Net
T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git
S: Odd Fixes S: Odd Fixes
F: drivers/net/ F: drivers/net/
F: include/linux/if_*
F: include/linux/*device.h
NETXEN (1/10) GbE SUPPORT NETXEN (1/10) GbE SUPPORT
M: Dhananjay Phadke <dhananjay@netxen.com> M: Dhananjay Phadke <dhananjay@netxen.com>

View file

@ -235,6 +235,7 @@ enum vortex_chips {
CH_3C900B_FL, CH_3C900B_FL,
CH_3C905_1, CH_3C905_1,
CH_3C905_2, CH_3C905_2,
CH_3C905B_TX,
CH_3C905B_1, CH_3C905B_1,
CH_3C905B_2, CH_3C905B_2,
@ -307,6 +308,8 @@ static struct vortex_chip_info {
PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, }, PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, },
{"3c905 Boomerang 100baseT4", {"3c905 Boomerang 100baseT4",
PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, }, PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, },
{"3C905B-TX Fast Etherlink XL PCI",
PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
{"3c905B Cyclone 100baseTx", {"3c905B Cyclone 100baseTx",
PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, }, PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
@ -389,6 +392,7 @@ static struct pci_device_id vortex_pci_tbl[] = {
{ 0x10B7, 0x900A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C900B_FL }, { 0x10B7, 0x900A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C900B_FL },
{ 0x10B7, 0x9050, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905_1 }, { 0x10B7, 0x9050, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905_1 },
{ 0x10B7, 0x9051, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905_2 }, { 0x10B7, 0x9051, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905_2 },
{ 0x10B7, 0x9054, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_TX },
{ 0x10B7, 0x9055, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_1 }, { 0x10B7, 0x9055, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_1 },
{ 0x10B7, 0x9058, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_2 }, { 0x10B7, 0x9058, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_2 },

View file

@ -515,7 +515,7 @@ rx_status_loop:
dma_addr_t mapping; dma_addr_t mapping;
struct sk_buff *skb, *new_skb; struct sk_buff *skb, *new_skb;
struct cp_desc *desc; struct cp_desc *desc;
unsigned buflen; const unsigned buflen = cp->rx_buf_sz;
skb = cp->rx_skb[rx_tail]; skb = cp->rx_skb[rx_tail];
BUG_ON(!skb); BUG_ON(!skb);
@ -549,8 +549,7 @@ rx_status_loop:
pr_debug("%s: rx slot %d status 0x%x len %d\n", pr_debug("%s: rx slot %d status 0x%x len %d\n",
dev->name, rx_tail, status, len); dev->name, rx_tail, status, len);
buflen = cp->rx_buf_sz + NET_IP_ALIGN; new_skb = netdev_alloc_skb(dev, buflen + NET_IP_ALIGN);
new_skb = netdev_alloc_skb(dev, buflen);
if (!new_skb) { if (!new_skb) {
dev->stats.rx_dropped++; dev->stats.rx_dropped++;
goto rx_next; goto rx_next;

View file

@ -232,11 +232,11 @@ static void atl1c_get_drvinfo(struct net_device *netdev,
{ {
struct atl1c_adapter *adapter = netdev_priv(netdev); struct atl1c_adapter *adapter = netdev_priv(netdev);
strncpy(drvinfo->driver, atl1c_driver_name, sizeof(drvinfo->driver)); strlcpy(drvinfo->driver, atl1c_driver_name, sizeof(drvinfo->driver));
strncpy(drvinfo->version, atl1c_driver_version, strlcpy(drvinfo->version, atl1c_driver_version,
sizeof(drvinfo->version)); sizeof(drvinfo->version));
strncpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
strncpy(drvinfo->bus_info, pci_name(adapter->pdev), strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
sizeof(drvinfo->bus_info)); sizeof(drvinfo->bus_info));
drvinfo->n_stats = 0; drvinfo->n_stats = 0;
drvinfo->testinfo_len = 0; drvinfo->testinfo_len = 0;

View file

@ -3378,11 +3378,11 @@ static void atl1_get_drvinfo(struct net_device *netdev,
{ {
struct atl1_adapter *adapter = netdev_priv(netdev); struct atl1_adapter *adapter = netdev_priv(netdev);
strncpy(drvinfo->driver, ATLX_DRIVER_NAME, sizeof(drvinfo->driver)); strlcpy(drvinfo->driver, ATLX_DRIVER_NAME, sizeof(drvinfo->driver));
strncpy(drvinfo->version, ATLX_DRIVER_VERSION, strlcpy(drvinfo->version, ATLX_DRIVER_VERSION,
sizeof(drvinfo->version)); sizeof(drvinfo->version));
strncpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
strncpy(drvinfo->bus_info, pci_name(adapter->pdev), strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
sizeof(drvinfo->bus_info)); sizeof(drvinfo->bus_info));
drvinfo->eedump_len = ATL1_EEDUMP_LEN; drvinfo->eedump_len = ATL1_EEDUMP_LEN;
} }

View file

@ -952,9 +952,10 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
int rc = NETDEV_TX_OK; int rc = NETDEV_TX_OK;
dma_addr_t mapping; dma_addr_t mapping;
u32 len, entry, ctrl; u32 len, entry, ctrl;
unsigned long flags;
len = skb->len; len = skb->len;
spin_lock_irq(&bp->lock); spin_lock_irqsave(&bp->lock, flags);
/* This is a hard error, log it. */ /* This is a hard error, log it. */
if (unlikely(TX_BUFFS_AVAIL(bp) < 1)) { if (unlikely(TX_BUFFS_AVAIL(bp) < 1)) {
@ -1027,7 +1028,7 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
dev->trans_start = jiffies; dev->trans_start = jiffies;
out_unlock: out_unlock:
spin_unlock_irq(&bp->lock); spin_unlock_irqrestore(&bp->lock, flags);
return rc; return rc;

View file

@ -399,9 +399,11 @@ static int bnx2_unregister_cnic(struct net_device *dev)
struct bnx2_napi *bnapi = &bp->bnx2_napi[0]; struct bnx2_napi *bnapi = &bp->bnx2_napi[0];
struct cnic_eth_dev *cp = &bp->cnic_eth_dev; struct cnic_eth_dev *cp = &bp->cnic_eth_dev;
mutex_lock(&bp->cnic_lock);
cp->drv_state = 0; cp->drv_state = 0;
bnapi->cnic_present = 0; bnapi->cnic_present = 0;
rcu_assign_pointer(bp->cnic_ops, NULL); rcu_assign_pointer(bp->cnic_ops, NULL);
mutex_unlock(&bp->cnic_lock);
synchronize_rcu(); synchronize_rcu();
return 0; return 0;
} }
@ -429,13 +431,13 @@ bnx2_cnic_stop(struct bnx2 *bp)
struct cnic_ops *c_ops; struct cnic_ops *c_ops;
struct cnic_ctl_info info; struct cnic_ctl_info info;
rcu_read_lock(); mutex_lock(&bp->cnic_lock);
c_ops = rcu_dereference(bp->cnic_ops); c_ops = bp->cnic_ops;
if (c_ops) { if (c_ops) {
info.cmd = CNIC_CTL_STOP_CMD; info.cmd = CNIC_CTL_STOP_CMD;
c_ops->cnic_ctl(bp->cnic_data, &info); c_ops->cnic_ctl(bp->cnic_data, &info);
} }
rcu_read_unlock(); mutex_unlock(&bp->cnic_lock);
} }
static void static void
@ -444,8 +446,8 @@ bnx2_cnic_start(struct bnx2 *bp)
struct cnic_ops *c_ops; struct cnic_ops *c_ops;
struct cnic_ctl_info info; struct cnic_ctl_info info;
rcu_read_lock(); mutex_lock(&bp->cnic_lock);
c_ops = rcu_dereference(bp->cnic_ops); c_ops = bp->cnic_ops;
if (c_ops) { if (c_ops) {
if (!(bp->flags & BNX2_FLAG_USING_MSIX)) { if (!(bp->flags & BNX2_FLAG_USING_MSIX)) {
struct bnx2_napi *bnapi = &bp->bnx2_napi[0]; struct bnx2_napi *bnapi = &bp->bnx2_napi[0];
@ -455,7 +457,7 @@ bnx2_cnic_start(struct bnx2 *bp)
info.cmd = CNIC_CTL_START_CMD; info.cmd = CNIC_CTL_START_CMD;
c_ops->cnic_ctl(bp->cnic_data, &info); c_ops->cnic_ctl(bp->cnic_data, &info);
} }
rcu_read_unlock(); mutex_unlock(&bp->cnic_lock);
} }
#else #else
@ -7663,6 +7665,9 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
spin_lock_init(&bp->phy_lock); spin_lock_init(&bp->phy_lock);
spin_lock_init(&bp->indirect_lock); spin_lock_init(&bp->indirect_lock);
#ifdef BCM_CNIC
mutex_init(&bp->cnic_lock);
#endif
INIT_WORK(&bp->reset_task, bnx2_reset_task); INIT_WORK(&bp->reset_task, bnx2_reset_task);
dev->base_addr = dev->mem_start = pci_resource_start(pdev, 0); dev->base_addr = dev->mem_start = pci_resource_start(pdev, 0);

View file

@ -6902,6 +6902,7 @@ struct bnx2 {
u32 idle_chk_status_idx; u32 idle_chk_status_idx;
#ifdef BCM_CNIC #ifdef BCM_CNIC
struct mutex cnic_lock;
struct cnic_eth_dev cnic_eth_dev; struct cnic_eth_dev cnic_eth_dev;
#endif #endif

View file

@ -611,11 +611,18 @@ nla_put_failure:
return -EMSGSIZE; return -EMSGSIZE;
} }
static int can_newlink(struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[])
{
return -EOPNOTSUPP;
}
static struct rtnl_link_ops can_link_ops __read_mostly = { static struct rtnl_link_ops can_link_ops __read_mostly = {
.kind = "can", .kind = "can",
.maxtype = IFLA_CAN_MAX, .maxtype = IFLA_CAN_MAX,
.policy = can_policy, .policy = can_policy,
.setup = can_setup, .setup = can_setup,
.newlink = can_newlink,
.changelink = can_changelink, .changelink = can_changelink,
.fill_info = can_fill_info, .fill_info = can_fill_info,
.fill_xstats = can_fill_xstats, .fill_xstats = can_fill_xstats,

View file

@ -138,6 +138,16 @@ static struct cnic_dev *cnic_from_netdev(struct net_device *netdev)
return NULL; return NULL;
} }
static inline void ulp_get(struct cnic_ulp_ops *ulp_ops)
{
atomic_inc(&ulp_ops->ref_count);
}
static inline void ulp_put(struct cnic_ulp_ops *ulp_ops)
{
atomic_dec(&ulp_ops->ref_count);
}
static void cnic_ctx_wr(struct cnic_dev *dev, u32 cid_addr, u32 off, u32 val) static void cnic_ctx_wr(struct cnic_dev *dev, u32 cid_addr, u32 off, u32 val)
{ {
struct cnic_local *cp = dev->cnic_priv; struct cnic_local *cp = dev->cnic_priv;
@ -358,6 +368,7 @@ int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops)
} }
read_unlock(&cnic_dev_lock); read_unlock(&cnic_dev_lock);
atomic_set(&ulp_ops->ref_count, 0);
rcu_assign_pointer(cnic_ulp_tbl[ulp_type], ulp_ops); rcu_assign_pointer(cnic_ulp_tbl[ulp_type], ulp_ops);
mutex_unlock(&cnic_lock); mutex_unlock(&cnic_lock);
@ -379,6 +390,8 @@ int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops)
int cnic_unregister_driver(int ulp_type) int cnic_unregister_driver(int ulp_type)
{ {
struct cnic_dev *dev; struct cnic_dev *dev;
struct cnic_ulp_ops *ulp_ops;
int i = 0;
if (ulp_type >= MAX_CNIC_ULP_TYPE) { if (ulp_type >= MAX_CNIC_ULP_TYPE) {
printk(KERN_ERR PFX "cnic_unregister_driver: Bad type %d\n", printk(KERN_ERR PFX "cnic_unregister_driver: Bad type %d\n",
@ -386,7 +399,8 @@ int cnic_unregister_driver(int ulp_type)
return -EINVAL; return -EINVAL;
} }
mutex_lock(&cnic_lock); mutex_lock(&cnic_lock);
if (!cnic_ulp_tbl[ulp_type]) { ulp_ops = cnic_ulp_tbl[ulp_type];
if (!ulp_ops) {
printk(KERN_ERR PFX "cnic_unregister_driver: Type %d has not " printk(KERN_ERR PFX "cnic_unregister_driver: Type %d has not "
"been registered\n", ulp_type); "been registered\n", ulp_type);
goto out_unlock; goto out_unlock;
@ -411,6 +425,14 @@ int cnic_unregister_driver(int ulp_type)
mutex_unlock(&cnic_lock); mutex_unlock(&cnic_lock);
synchronize_rcu(); synchronize_rcu();
while ((atomic_read(&ulp_ops->ref_count) != 0) && (i < 20)) {
msleep(100);
i++;
}
if (atomic_read(&ulp_ops->ref_count) != 0)
printk(KERN_WARNING PFX "%s: Failed waiting for ref count to go"
" to zero.\n", dev->netdev->name);
return 0; return 0;
out_unlock: out_unlock:
@ -466,6 +488,7 @@ EXPORT_SYMBOL(cnic_register_driver);
static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type) static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type)
{ {
struct cnic_local *cp = dev->cnic_priv; struct cnic_local *cp = dev->cnic_priv;
int i = 0;
if (ulp_type >= MAX_CNIC_ULP_TYPE) { if (ulp_type >= MAX_CNIC_ULP_TYPE) {
printk(KERN_ERR PFX "cnic_unregister_device: Bad type %d\n", printk(KERN_ERR PFX "cnic_unregister_device: Bad type %d\n",
@ -486,6 +509,15 @@ static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type)
synchronize_rcu(); synchronize_rcu();
while (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type]) &&
i < 20) {
msleep(100);
i++;
}
if (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type]))
printk(KERN_WARNING PFX "%s: Failed waiting for ULP up call"
" to complete.\n", dev->netdev->name);
return 0; return 0;
} }
EXPORT_SYMBOL(cnic_unregister_driver); EXPORT_SYMBOL(cnic_unregister_driver);
@ -1076,18 +1108,23 @@ static void cnic_ulp_stop(struct cnic_dev *dev)
if (cp->cnic_uinfo) if (cp->cnic_uinfo)
cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL);
rcu_read_lock();
for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) {
struct cnic_ulp_ops *ulp_ops; struct cnic_ulp_ops *ulp_ops;
ulp_ops = rcu_dereference(cp->ulp_ops[if_type]); mutex_lock(&cnic_lock);
if (!ulp_ops) ulp_ops = cp->ulp_ops[if_type];
if (!ulp_ops) {
mutex_unlock(&cnic_lock);
continue; continue;
}
set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]);
mutex_unlock(&cnic_lock);
if (test_and_clear_bit(ULP_F_START, &cp->ulp_flags[if_type])) if (test_and_clear_bit(ULP_F_START, &cp->ulp_flags[if_type]))
ulp_ops->cnic_stop(cp->ulp_handle[if_type]); ulp_ops->cnic_stop(cp->ulp_handle[if_type]);
clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]);
} }
rcu_read_unlock();
} }
static void cnic_ulp_start(struct cnic_dev *dev) static void cnic_ulp_start(struct cnic_dev *dev)
@ -1095,18 +1132,23 @@ static void cnic_ulp_start(struct cnic_dev *dev)
struct cnic_local *cp = dev->cnic_priv; struct cnic_local *cp = dev->cnic_priv;
int if_type; int if_type;
rcu_read_lock();
for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) {
struct cnic_ulp_ops *ulp_ops; struct cnic_ulp_ops *ulp_ops;
ulp_ops = rcu_dereference(cp->ulp_ops[if_type]); mutex_lock(&cnic_lock);
if (!ulp_ops || !ulp_ops->cnic_start) ulp_ops = cp->ulp_ops[if_type];
if (!ulp_ops || !ulp_ops->cnic_start) {
mutex_unlock(&cnic_lock);
continue; continue;
}
set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]);
mutex_unlock(&cnic_lock);
if (!test_and_set_bit(ULP_F_START, &cp->ulp_flags[if_type])) if (!test_and_set_bit(ULP_F_START, &cp->ulp_flags[if_type]))
ulp_ops->cnic_start(cp->ulp_handle[if_type]); ulp_ops->cnic_start(cp->ulp_handle[if_type]);
clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]);
} }
rcu_read_unlock();
} }
static int cnic_ctl(void *data, struct cnic_ctl_info *info) static int cnic_ctl(void *data, struct cnic_ctl_info *info)
@ -1116,22 +1158,18 @@ static int cnic_ctl(void *data, struct cnic_ctl_info *info)
switch (info->cmd) { switch (info->cmd) {
case CNIC_CTL_STOP_CMD: case CNIC_CTL_STOP_CMD:
cnic_hold(dev); cnic_hold(dev);
mutex_lock(&cnic_lock);
cnic_ulp_stop(dev); cnic_ulp_stop(dev);
cnic_stop_hw(dev); cnic_stop_hw(dev);
mutex_unlock(&cnic_lock);
cnic_put(dev); cnic_put(dev);
break; break;
case CNIC_CTL_START_CMD: case CNIC_CTL_START_CMD:
cnic_hold(dev); cnic_hold(dev);
mutex_lock(&cnic_lock);
if (!cnic_start_hw(dev)) if (!cnic_start_hw(dev))
cnic_ulp_start(dev); cnic_ulp_start(dev);
mutex_unlock(&cnic_lock);
cnic_put(dev); cnic_put(dev);
break; break;
default: default:
@ -1145,19 +1183,23 @@ static void cnic_ulp_init(struct cnic_dev *dev)
int i; int i;
struct cnic_local *cp = dev->cnic_priv; struct cnic_local *cp = dev->cnic_priv;
rcu_read_lock();
for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) { for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) {
struct cnic_ulp_ops *ulp_ops; struct cnic_ulp_ops *ulp_ops;
ulp_ops = rcu_dereference(cnic_ulp_tbl[i]); mutex_lock(&cnic_lock);
if (!ulp_ops || !ulp_ops->cnic_init) ulp_ops = cnic_ulp_tbl[i];
if (!ulp_ops || !ulp_ops->cnic_init) {
mutex_unlock(&cnic_lock);
continue; continue;
}
ulp_get(ulp_ops);
mutex_unlock(&cnic_lock);
if (!test_and_set_bit(ULP_F_INIT, &cp->ulp_flags[i])) if (!test_and_set_bit(ULP_F_INIT, &cp->ulp_flags[i]))
ulp_ops->cnic_init(dev); ulp_ops->cnic_init(dev);
ulp_put(ulp_ops);
} }
rcu_read_unlock();
} }
static void cnic_ulp_exit(struct cnic_dev *dev) static void cnic_ulp_exit(struct cnic_dev *dev)
@ -1165,19 +1207,23 @@ static void cnic_ulp_exit(struct cnic_dev *dev)
int i; int i;
struct cnic_local *cp = dev->cnic_priv; struct cnic_local *cp = dev->cnic_priv;
rcu_read_lock();
for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) { for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) {
struct cnic_ulp_ops *ulp_ops; struct cnic_ulp_ops *ulp_ops;
ulp_ops = rcu_dereference(cnic_ulp_tbl[i]); mutex_lock(&cnic_lock);
if (!ulp_ops || !ulp_ops->cnic_exit) ulp_ops = cnic_ulp_tbl[i];
if (!ulp_ops || !ulp_ops->cnic_exit) {
mutex_unlock(&cnic_lock);
continue; continue;
}
ulp_get(ulp_ops);
mutex_unlock(&cnic_lock);
if (test_and_clear_bit(ULP_F_INIT, &cp->ulp_flags[i])) if (test_and_clear_bit(ULP_F_INIT, &cp->ulp_flags[i]))
ulp_ops->cnic_exit(dev); ulp_ops->cnic_exit(dev);
ulp_put(ulp_ops);
} }
rcu_read_unlock();
} }
static int cnic_cm_offload_pg(struct cnic_sock *csk) static int cnic_cm_offload_pg(struct cnic_sock *csk)
@ -2393,6 +2439,37 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev)
return 0; return 0;
} }
static int cnic_register_netdev(struct cnic_dev *dev)
{
struct cnic_local *cp = dev->cnic_priv;
struct cnic_eth_dev *ethdev = cp->ethdev;
int err;
if (!ethdev)
return -ENODEV;
if (ethdev->drv_state & CNIC_DRV_STATE_REGD)
return 0;
err = ethdev->drv_register_cnic(dev->netdev, cp->cnic_ops, dev);
if (err)
printk(KERN_ERR PFX "%s: register_cnic failed\n",
dev->netdev->name);
return err;
}
static void cnic_unregister_netdev(struct cnic_dev *dev)
{
struct cnic_local *cp = dev->cnic_priv;
struct cnic_eth_dev *ethdev = cp->ethdev;
if (!ethdev)
return;
ethdev->drv_unregister_cnic(dev->netdev);
}
static int cnic_start_hw(struct cnic_dev *dev) static int cnic_start_hw(struct cnic_dev *dev)
{ {
struct cnic_local *cp = dev->cnic_priv; struct cnic_local *cp = dev->cnic_priv;
@ -2402,13 +2479,6 @@ static int cnic_start_hw(struct cnic_dev *dev)
if (test_bit(CNIC_F_CNIC_UP, &dev->flags)) if (test_bit(CNIC_F_CNIC_UP, &dev->flags))
return -EALREADY; return -EALREADY;
err = ethdev->drv_register_cnic(dev->netdev, cp->cnic_ops, dev);
if (err) {
printk(KERN_ERR PFX "%s: register_cnic failed\n",
dev->netdev->name);
goto err2;
}
dev->regview = ethdev->io_base; dev->regview = ethdev->io_base;
cp->chip_id = ethdev->chip_id; cp->chip_id = ethdev->chip_id;
pci_dev_get(dev->pcidev); pci_dev_get(dev->pcidev);
@ -2438,18 +2508,13 @@ static int cnic_start_hw(struct cnic_dev *dev)
return 0; return 0;
err1: err1:
ethdev->drv_unregister_cnic(dev->netdev);
cp->free_resc(dev); cp->free_resc(dev);
pci_dev_put(dev->pcidev); pci_dev_put(dev->pcidev);
err2:
return err; return err;
} }
static void cnic_stop_bnx2_hw(struct cnic_dev *dev) static void cnic_stop_bnx2_hw(struct cnic_dev *dev)
{ {
struct cnic_local *cp = dev->cnic_priv;
struct cnic_eth_dev *ethdev = cp->ethdev;
cnic_disable_bnx2_int_sync(dev); cnic_disable_bnx2_int_sync(dev);
cnic_reg_wr_ind(dev, BNX2_CP_SCRATCH + 0x20, 0); cnic_reg_wr_ind(dev, BNX2_CP_SCRATCH + 0x20, 0);
@ -2461,8 +2526,6 @@ static void cnic_stop_bnx2_hw(struct cnic_dev *dev)
cnic_setup_5709_context(dev, 0); cnic_setup_5709_context(dev, 0);
cnic_free_irq(dev); cnic_free_irq(dev);
ethdev->drv_unregister_cnic(dev->netdev);
cnic_free_resc(dev); cnic_free_resc(dev);
} }
@ -2543,7 +2606,7 @@ static struct cnic_dev *init_bnx2_cnic(struct net_device *dev)
probe = symbol_get(bnx2_cnic_probe); probe = symbol_get(bnx2_cnic_probe);
if (probe) { if (probe) {
ethdev = (*probe)(dev); ethdev = (*probe)(dev);
symbol_put_addr(probe); symbol_put(bnx2_cnic_probe);
} }
if (!ethdev) if (!ethdev)
return NULL; return NULL;
@ -2646,10 +2709,12 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event,
else if (event == NETDEV_UNREGISTER) else if (event == NETDEV_UNREGISTER)
cnic_ulp_exit(dev); cnic_ulp_exit(dev);
else if (event == NETDEV_UP) { else if (event == NETDEV_UP) {
mutex_lock(&cnic_lock); if (cnic_register_netdev(dev) != 0) {
cnic_put(dev);
goto done;
}
if (!cnic_start_hw(dev)) if (!cnic_start_hw(dev))
cnic_ulp_start(dev); cnic_ulp_start(dev);
mutex_unlock(&cnic_lock);
} }
rcu_read_lock(); rcu_read_lock();
@ -2668,10 +2733,9 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event,
rcu_read_unlock(); rcu_read_unlock();
if (event == NETDEV_GOING_DOWN) { if (event == NETDEV_GOING_DOWN) {
mutex_lock(&cnic_lock);
cnic_ulp_stop(dev); cnic_ulp_stop(dev);
cnic_stop_hw(dev); cnic_stop_hw(dev);
mutex_unlock(&cnic_lock); cnic_unregister_netdev(dev);
} else if (event == NETDEV_UNREGISTER) { } else if (event == NETDEV_UNREGISTER) {
write_lock(&cnic_dev_lock); write_lock(&cnic_dev_lock);
list_del_init(&dev->list); list_del_init(&dev->list);
@ -2703,6 +2767,7 @@ static void cnic_release(void)
} }
cnic_ulp_exit(dev); cnic_ulp_exit(dev);
cnic_unregister_netdev(dev);
list_del_init(&dev->list); list_del_init(&dev->list);
cnic_free_dev(dev); cnic_free_dev(dev);
} }

View file

@ -176,6 +176,7 @@ struct cnic_local {
unsigned long ulp_flags[MAX_CNIC_ULP_TYPE]; unsigned long ulp_flags[MAX_CNIC_ULP_TYPE];
#define ULP_F_INIT 0 #define ULP_F_INIT 0
#define ULP_F_START 1 #define ULP_F_START 1
#define ULP_F_CALL_PENDING 2
struct cnic_ulp_ops *ulp_ops[MAX_CNIC_ULP_TYPE]; struct cnic_ulp_ops *ulp_ops[MAX_CNIC_ULP_TYPE];
/* protected by ulp_lock */ /* protected by ulp_lock */

View file

@ -290,6 +290,7 @@ struct cnic_ulp_ops {
void (*iscsi_nl_send_msg)(struct cnic_dev *dev, u32 msg_type, void (*iscsi_nl_send_msg)(struct cnic_dev *dev, u32 msg_type,
char *data, u16 data_size); char *data, u16 data_size);
struct module *owner; struct module *owner;
atomic_t ref_count;
}; };
extern int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops); extern int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops);

View file

@ -338,10 +338,7 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw)
{ {
struct e1000_nvm_info *nvm = &hw->nvm; struct e1000_nvm_info *nvm = &hw->nvm;
struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
union ich8_hws_flash_status hsfsts; u32 gfpreg, sector_base_addr, sector_end_addr;
u32 gfpreg;
u32 sector_base_addr;
u32 sector_end_addr;
u16 i; u16 i;
/* Can't read flash registers if the register set isn't mapped. */ /* Can't read flash registers if the register set isn't mapped. */
@ -375,20 +372,6 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw)
/* Adjust to word count */ /* Adjust to word count */
nvm->flash_bank_size /= sizeof(u16); nvm->flash_bank_size /= sizeof(u16);
/*
* Make sure the flash bank size does not overwrite the 4k
* sector ranges. We may have 64k allotted to us but we only care
* about the first 2 4k sectors. Therefore, if we have anything less
* than 64k set in the HSFSTS register, we will reduce the bank size
* down to 4k and let the rest remain unused. If berasesz == 3, then
* we are working in 64k mode. Otherwise we are not.
*/
if (nvm->flash_bank_size > E1000_ICH8_SHADOW_RAM_WORDS) {
hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
if (hsfsts.hsf_status.berasesz != 3)
nvm->flash_bank_size = E1000_ICH8_SHADOW_RAM_WORDS;
}
nvm->word_size = E1000_ICH8_SHADOW_RAM_WORDS; nvm->word_size = E1000_ICH8_SHADOW_RAM_WORDS;
/* Clear shadow ram */ /* Clear shadow ram */
@ -594,8 +577,8 @@ static DEFINE_MUTEX(nvm_mutex);
**/ **/
static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
{ {
u32 extcnf_ctrl; u32 extcnf_ctrl, timeout = PHY_CFG_TIMEOUT;
u32 timeout = PHY_CFG_TIMEOUT; s32 ret_val = 0;
might_sleep(); might_sleep();
@ -603,28 +586,46 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
while (timeout) { while (timeout) {
extcnf_ctrl = er32(EXTCNF_CTRL); extcnf_ctrl = er32(EXTCNF_CTRL);
if (!(extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG))
if (!(extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)) {
extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG;
ew32(EXTCNF_CTRL, extcnf_ctrl);
extcnf_ctrl = er32(EXTCNF_CTRL);
if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)
break; break;
}
mdelay(1); mdelay(1);
timeout--; timeout--;
} }
if (!timeout) { if (!timeout) {
hw_dbg(hw, "FW or HW has locked the resource for too long.\n"); hw_dbg(hw, "SW/FW/HW has locked the resource for too long.\n");
extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; ret_val = -E1000_ERR_CONFIG;
ew32(EXTCNF_CTRL, extcnf_ctrl); goto out;
mutex_unlock(&nvm_mutex);
return -E1000_ERR_CONFIG;
} }
return 0; timeout = PHY_CFG_TIMEOUT * 2;
extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG;
ew32(EXTCNF_CTRL, extcnf_ctrl);
while (timeout) {
extcnf_ctrl = er32(EXTCNF_CTRL);
if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)
break;
mdelay(1);
timeout--;
}
if (!timeout) {
hw_dbg(hw, "Failed to acquire the semaphore.\n");
extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
ew32(EXTCNF_CTRL, extcnf_ctrl);
ret_val = -E1000_ERR_CONFIG;
goto out;
}
out:
if (ret_val)
mutex_unlock(&nvm_mutex);
return ret_val;
} }
/** /**
@ -1306,7 +1307,7 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
struct e1000_nvm_info *nvm = &hw->nvm; struct e1000_nvm_info *nvm = &hw->nvm;
struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
u32 act_offset; u32 act_offset;
s32 ret_val; s32 ret_val = 0;
u32 bank = 0; u32 bank = 0;
u16 i, word; u16 i, word;
@ -1321,12 +1322,15 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
goto out; goto out;
ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
if (ret_val) if (ret_val) {
goto release; hw_dbg(hw, "Could not detect valid bank, assuming bank 0\n");
bank = 0;
}
act_offset = (bank) ? nvm->flash_bank_size : 0; act_offset = (bank) ? nvm->flash_bank_size : 0;
act_offset += offset; act_offset += offset;
ret_val = 0;
for (i = 0; i < words; i++) { for (i = 0; i < words; i++) {
if ((dev_spec->shadow_ram) && if ((dev_spec->shadow_ram) &&
(dev_spec->shadow_ram[offset+i].modified)) { (dev_spec->shadow_ram[offset+i].modified)) {
@ -1341,7 +1345,6 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
} }
} }
release:
e1000_release_swflag_ich8lan(hw); e1000_release_swflag_ich8lan(hw);
out: out:
@ -1592,7 +1595,6 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
{ {
struct e1000_nvm_info *nvm = &hw->nvm; struct e1000_nvm_info *nvm = &hw->nvm;
struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
s32 ret_val;
u16 i; u16 i;
if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) || if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) ||
@ -1601,17 +1603,11 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
return -E1000_ERR_NVM; return -E1000_ERR_NVM;
} }
ret_val = e1000_acquire_swflag_ich8lan(hw);
if (ret_val)
return ret_val;
for (i = 0; i < words; i++) { for (i = 0; i < words; i++) {
dev_spec->shadow_ram[offset+i].modified = 1; dev_spec->shadow_ram[offset+i].modified = 1;
dev_spec->shadow_ram[offset+i].value = data[i]; dev_spec->shadow_ram[offset+i].value = data[i];
} }
e1000_release_swflag_ich8lan(hw);
return 0; return 0;
} }
@ -1652,8 +1648,8 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
*/ */
ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
if (ret_val) { if (ret_val) {
e1000_release_swflag_ich8lan(hw); hw_dbg(hw, "Could not detect valid bank, assuming bank 0\n");
goto out; bank = 0;
} }
if (bank == 0) { if (bank == 0) {
@ -2039,12 +2035,8 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank)
iteration = 1; iteration = 1;
break; break;
case 2: case 2:
if (hw->mac.type == e1000_ich9lan) {
sector_size = ICH_FLASH_SEG_SIZE_8K; sector_size = ICH_FLASH_SEG_SIZE_8K;
iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_8K; iteration = 1;
} else {
return -E1000_ERR_NVM;
}
break; break;
case 3: case 3:
sector_size = ICH_FLASH_SEG_SIZE_64K; sector_size = ICH_FLASH_SEG_SIZE_64K;
@ -2056,7 +2048,7 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank)
/* Start with the base address, then add the sector offset. */ /* Start with the base address, then add the sector offset. */
flash_linear_addr = hw->nvm.flash_base_addr; flash_linear_addr = hw->nvm.flash_base_addr;
flash_linear_addr += (bank) ? (sector_size * iteration) : 0; flash_linear_addr += (bank) ? flash_bank_size : 0;
for (j = 0; j < iteration ; j++) { for (j = 0; j < iteration ; j++) {
do { do {

View file

@ -4538,8 +4538,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake)
/* Allow time for pending master requests to run */ /* Allow time for pending master requests to run */
e1000e_disable_pcie_master(&adapter->hw); e1000e_disable_pcie_master(&adapter->hw);
if ((adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) && if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) {
!(hw->mac.ops.check_mng_mode(hw))) {
/* enable wakeup by the PHY */ /* enable wakeup by the PHY */
retval = e1000_init_phy_wakeup(adapter, wufc); retval = e1000_init_phy_wakeup(adapter, wufc);
if (retval) if (retval)
@ -4557,7 +4556,8 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake)
*enable_wake = !!wufc; *enable_wake = !!wufc;
/* make sure adapter isn't asleep if manageability is enabled */ /* make sure adapter isn't asleep if manageability is enabled */
if (adapter->flags & FLAG_MNG_PT_ENABLED) if ((adapter->flags & FLAG_MNG_PT_ENABLED) ||
(hw->mac.ops.check_mng_mode(hw)))
*enable_wake = true; *enable_wake = true;
if (adapter->hw.phy.type == e1000_phy_igp_3) if (adapter->hw.phy.type == e1000_phy_igp_3)
@ -4670,14 +4670,6 @@ static int e1000_resume(struct pci_dev *pdev)
return err; return err;
} }
/* AER (Advanced Error Reporting) hooks */
err = pci_enable_pcie_error_reporting(pdev);
if (err) {
dev_err(&pdev->dev, "pci_enable_pcie_error_reporting failed "
"0x%x\n", err);
/* non-fatal, continue */
}
pci_set_master(pdev); pci_set_master(pdev);
pci_enable_wake(pdev, PCI_D3hot, 0); pci_enable_wake(pdev, PCI_D3hot, 0);
@ -4990,6 +4982,14 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
if (err) if (err)
goto err_pci_reg; goto err_pci_reg;
/* AER (Advanced Error Reporting) hooks */
err = pci_enable_pcie_error_reporting(pdev);
if (err) {
dev_err(&pdev->dev, "pci_enable_pcie_error_reporting failed "
"0x%x\n", err);
/* non-fatal, continue */
}
pci_set_master(pdev); pci_set_master(pdev);
/* PCI config space info */ /* PCI config space info */
err = pci_save_state(pdev); err = pci_save_state(pdev);

View file

@ -285,6 +285,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct fec_enet_private *fep = netdev_priv(dev); struct fec_enet_private *fep = netdev_priv(dev);
struct bufdesc *bdp; struct bufdesc *bdp;
void *bufaddr;
unsigned short status; unsigned short status;
unsigned long flags; unsigned long flags;
@ -312,7 +313,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
status &= ~BD_ENET_TX_STATS; status &= ~BD_ENET_TX_STATS;
/* Set buffer length and buffer pointer */ /* Set buffer length and buffer pointer */
bdp->cbd_bufaddr = __pa(skb->data); bufaddr = skb->data;
bdp->cbd_datlen = skb->len; bdp->cbd_datlen = skb->len;
/* /*
@ -320,11 +321,11 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
* 4-byte boundaries. Use bounce buffers to copy data * 4-byte boundaries. Use bounce buffers to copy data
* and get it aligned. Ugh. * and get it aligned. Ugh.
*/ */
if (bdp->cbd_bufaddr & FEC_ALIGNMENT) { if (((unsigned long) bufaddr) & FEC_ALIGNMENT) {
unsigned int index; unsigned int index;
index = bdp - fep->tx_bd_base; index = bdp - fep->tx_bd_base;
memcpy(fep->tx_bounce[index], (void *)skb->data, skb->len); memcpy(fep->tx_bounce[index], (void *)skb->data, skb->len);
bdp->cbd_bufaddr = __pa(fep->tx_bounce[index]); bufaddr = fep->tx_bounce[index];
} }
/* Save skb pointer */ /* Save skb pointer */
@ -336,7 +337,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Push the data cache so the CPM does not get stale memory /* Push the data cache so the CPM does not get stale memory
* data. * data.
*/ */
bdp->cbd_bufaddr = dma_map_single(&dev->dev, skb->data, bdp->cbd_bufaddr = dma_map_single(&dev->dev, bufaddr,
FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE); FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE);
/* Send it on its way. Tell FEC it's ready, interrupt when done, /* Send it on its way. Tell FEC it's ready, interrupt when done,

View file

@ -936,6 +936,7 @@ int startup_gfar(struct net_device *dev)
struct gfar __iomem *regs = priv->regs; struct gfar __iomem *regs = priv->regs;
int err = 0; int err = 0;
u32 rctrl = 0; u32 rctrl = 0;
u32 tctrl = 0;
u32 attrs = 0; u32 attrs = 0;
gfar_write(&regs->imask, IMASK_INIT_CLEAR); gfar_write(&regs->imask, IMASK_INIT_CLEAR);
@ -1111,11 +1112,19 @@ int startup_gfar(struct net_device *dev)
rctrl |= RCTRL_PADDING(priv->padding); rctrl |= RCTRL_PADDING(priv->padding);
} }
/* keep vlan related bits if it's enabled */
if (priv->vlgrp) {
rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT;
tctrl |= TCTRL_VLINS;
}
/* Init rctrl based on our settings */ /* Init rctrl based on our settings */
gfar_write(&priv->regs->rctrl, rctrl); gfar_write(&priv->regs->rctrl, rctrl);
if (dev->features & NETIF_F_IP_CSUM) if (dev->features & NETIF_F_IP_CSUM)
gfar_write(&priv->regs->tctrl, TCTRL_INIT_CSUM); tctrl |= TCTRL_INIT_CSUM;
gfar_write(&priv->regs->tctrl, tctrl);
/* Set the extraction length and index */ /* Set the extraction length and index */
attrs = ATTRELI_EL(priv->rx_stash_size) | attrs = ATTRELI_EL(priv->rx_stash_size) |
@ -1450,7 +1459,6 @@ static void gfar_vlan_rx_register(struct net_device *dev,
/* Enable VLAN tag extraction */ /* Enable VLAN tag extraction */
tempval = gfar_read(&priv->regs->rctrl); tempval = gfar_read(&priv->regs->rctrl);
tempval |= RCTRL_VLEX;
tempval |= (RCTRL_VLEX | RCTRL_PRSDEP_INIT); tempval |= (RCTRL_VLEX | RCTRL_PRSDEP_INIT);
gfar_write(&priv->regs->rctrl, tempval); gfar_write(&priv->regs->rctrl, tempval);
} else { } else {

View file

@ -115,7 +115,7 @@ static int __init w83977af_init(void)
IRDA_DEBUG(0, "%s()\n", __func__ ); IRDA_DEBUG(0, "%s()\n", __func__ );
for (i=0; (io[i] < 2000) && (i < ARRAY_SIZE(dev_self)); i++) { for (i=0; i < ARRAY_SIZE(dev_self) && io[i] < 2000; i++) {
if (w83977af_open(i, io[i], irq[i], dma[i]) == 0) if (w83977af_open(i, io[i], irq[i], dma[i]) == 0)
return 0; return 0;
} }

View file

@ -136,6 +136,8 @@ struct ixgbe_ring {
u8 queue_index; /* needed for multiqueue queue management */ u8 queue_index; /* needed for multiqueue queue management */
#define IXGBE_RING_RX_PS_ENABLED (u8)(1)
u8 flags; /* per ring feature flags */
u16 head; u16 head;
u16 tail; u16 tail;

View file

@ -1948,6 +1948,7 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
struct ethtool_coalesce *ec) struct ethtool_coalesce *ec)
{ {
struct ixgbe_adapter *adapter = netdev_priv(netdev); struct ixgbe_adapter *adapter = netdev_priv(netdev);
struct ixgbe_q_vector *q_vector;
int i; int i;
if (ec->tx_max_coalesced_frames_irq) if (ec->tx_max_coalesced_frames_irq)
@ -1982,8 +1983,12 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
adapter->itr_setting = 0; adapter->itr_setting = 0;
} }
for (i = 0; i < adapter->num_msix_vectors - NON_Q_VECTORS; i++) { /* MSI/MSIx Interrupt Mode */
struct ixgbe_q_vector *q_vector = adapter->q_vector[i]; if (adapter->flags &
(IXGBE_FLAG_MSIX_ENABLED | IXGBE_FLAG_MSI_ENABLED)) {
int 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->txr_count && !q_vector->rxr_count) if (q_vector->txr_count && !q_vector->rxr_count)
/* tx vector gets half the rate */ /* tx vector gets half the rate */
q_vector->eitr = (adapter->eitr_param >> 1); q_vector->eitr = (adapter->eitr_param >> 1);
@ -1992,6 +1997,12 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
q_vector->eitr = adapter->eitr_param; q_vector->eitr = adapter->eitr_param;
ixgbe_write_eitr(q_vector); ixgbe_write_eitr(q_vector);
} }
/* Legacy Interrupt Mode */
} else {
q_vector = adapter->q_vector[0];
q_vector->eitr = adapter->eitr_param;
ixgbe_write_eitr(q_vector);
}
return 0; return 0;
} }

View file

@ -336,7 +336,7 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter,
/* return 0 to bypass going to ULD for DDPed data */ /* return 0 to bypass going to ULD for DDPed data */
if (fcstat == IXGBE_RXDADV_STAT_FCSTAT_DDP) if (fcstat == IXGBE_RXDADV_STAT_FCSTAT_DDP)
rc = 0; rc = 0;
else else if (ddp->len)
rc = ddp->len; rc = ddp->len;
} }

View file

@ -492,12 +492,12 @@ static void ixgbe_receive_skb(struct ixgbe_q_vector *q_vector,
skb_record_rx_queue(skb, ring->queue_index); skb_record_rx_queue(skb, ring->queue_index);
if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) { if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) {
if (adapter->vlgrp && is_vlan && (tag != 0)) if (adapter->vlgrp && is_vlan && (tag & VLAN_VID_MASK))
vlan_gro_receive(napi, adapter->vlgrp, tag, skb); vlan_gro_receive(napi, adapter->vlgrp, tag, skb);
else else
napi_gro_receive(napi, skb); napi_gro_receive(napi, skb);
} else { } else {
if (adapter->vlgrp && is_vlan && (tag != 0)) if (adapter->vlgrp && is_vlan && (tag & VLAN_VID_MASK))
vlan_hwaccel_rx(skb, adapter->vlgrp, tag); vlan_hwaccel_rx(skb, adapter->vlgrp, tag);
else else
netif_rx(skb); netif_rx(skb);
@ -585,7 +585,7 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter,
rx_desc = IXGBE_RX_DESC_ADV(*rx_ring, i); rx_desc = IXGBE_RX_DESC_ADV(*rx_ring, i);
if (!bi->page_dma && if (!bi->page_dma &&
(adapter->flags & IXGBE_FLAG_RX_PS_ENABLED)) { (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED)) {
if (!bi->page) { if (!bi->page) {
bi->page = alloc_page(GFP_ATOMIC); bi->page = alloc_page(GFP_ATOMIC);
if (!bi->page) { if (!bi->page) {
@ -629,7 +629,7 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter,
} }
/* Refresh the desc even if buffer_addrs didn't change because /* Refresh the desc even if buffer_addrs didn't change because
* each write-back erases this info. */ * each write-back erases this info. */
if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) {
rx_desc->read.pkt_addr = cpu_to_le64(bi->page_dma); rx_desc->read.pkt_addr = cpu_to_le64(bi->page_dma);
rx_desc->read.hdr_addr = cpu_to_le64(bi->dma); rx_desc->read.hdr_addr = cpu_to_le64(bi->dma);
} else { } else {
@ -726,7 +726,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
break; break;
(*work_done)++; (*work_done)++;
if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) {
hdr_info = le16_to_cpu(ixgbe_get_hdr_info(rx_desc)); hdr_info = le16_to_cpu(ixgbe_get_hdr_info(rx_desc));
len = (hdr_info & IXGBE_RXDADV_HDRBUFLEN_MASK) >> len = (hdr_info & IXGBE_RXDADV_HDRBUFLEN_MASK) >>
IXGBE_RXDADV_HDRBUFLEN_SHIFT; IXGBE_RXDADV_HDRBUFLEN_SHIFT;
@ -798,7 +798,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
rx_ring->stats.packets++; rx_ring->stats.packets++;
rx_ring->stats.bytes += skb->len; rx_ring->stats.bytes += skb->len;
} else { } else {
if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) {
rx_buffer_info->skb = next_buffer->skb; rx_buffer_info->skb = next_buffer->skb;
rx_buffer_info->dma = next_buffer->dma; rx_buffer_info->dma = next_buffer->dma;
next_buffer->skb = skb; next_buffer->skb = skb;
@ -1898,46 +1898,19 @@ static void ixgbe_configure_tx(struct ixgbe_adapter *adapter)
#define IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT 2 #define IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT 2
static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter, int index) static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter,
struct ixgbe_ring *rx_ring)
{ {
struct ixgbe_ring *rx_ring;
u32 srrctl; u32 srrctl;
int queue0 = 0; int index;
unsigned long mask;
struct ixgbe_ring_feature *feature = adapter->ring_feature; struct ixgbe_ring_feature *feature = adapter->ring_feature;
if (adapter->hw.mac.type == ixgbe_mac_82599EB) { index = rx_ring->reg_idx;
if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
int dcb_i = feature[RING_F_DCB].indices; unsigned long mask;
if (dcb_i == 8)
queue0 = index >> 4;
else if (dcb_i == 4)
queue0 = index >> 5;
else
dev_err(&adapter->pdev->dev, "Invalid DCB "
"configuration\n");
#ifdef IXGBE_FCOE
if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) {
struct ixgbe_ring_feature *f;
rx_ring = &adapter->rx_ring[queue0];
f = &adapter->ring_feature[RING_F_FCOE];
if ((queue0 == 0) && (index > rx_ring->reg_idx))
queue0 = f->mask + index -
rx_ring->reg_idx - 1;
}
#endif /* IXGBE_FCOE */
} else {
queue0 = index;
}
} else {
mask = (unsigned long) feature[RING_F_RSS].mask; mask = (unsigned long) feature[RING_F_RSS].mask;
queue0 = index & mask;
index = index & mask; index = index & mask;
} }
rx_ring = &adapter->rx_ring[queue0];
srrctl = IXGBE_READ_REG(&adapter->hw, IXGBE_SRRCTL(index)); srrctl = IXGBE_READ_REG(&adapter->hw, IXGBE_SRRCTL(index));
srrctl &= ~IXGBE_SRRCTL_BSIZEHDR_MASK; srrctl &= ~IXGBE_SRRCTL_BSIZEHDR_MASK;
@ -1946,7 +1919,7 @@ static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter, int index)
srrctl |= (IXGBE_RX_HDR_SIZE << IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT) & srrctl |= (IXGBE_RX_HDR_SIZE << IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT) &
IXGBE_SRRCTL_BSIZEHDR_MASK; IXGBE_SRRCTL_BSIZEHDR_MASK;
if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) {
#if (PAGE_SIZE / 2) > IXGBE_MAX_RXBUFFER #if (PAGE_SIZE / 2) > IXGBE_MAX_RXBUFFER
srrctl |= IXGBE_MAX_RXBUFFER >> IXGBE_SRRCTL_BSIZEPKT_SHIFT; srrctl |= IXGBE_MAX_RXBUFFER >> IXGBE_SRRCTL_BSIZEPKT_SHIFT;
#else #else
@ -2002,6 +1975,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
{ {
u64 rdba; u64 rdba;
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw = &adapter->hw;
struct ixgbe_ring *rx_ring;
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
int i, j; int i, j;
@ -2018,11 +1992,6 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
/* Decide whether to use packet split mode or not */ /* Decide whether to use packet split mode or not */
adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED; adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED;
#ifdef IXGBE_FCOE
if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED)
adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED;
#endif /* IXGBE_FCOE */
/* Set the RX buffer length according to the mode */ /* Set the RX buffer length according to the mode */
if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) {
rx_buf_len = IXGBE_RX_HDR_SIZE; rx_buf_len = IXGBE_RX_HDR_SIZE;
@ -2070,29 +2039,35 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
* the Base and Length of the Rx Descriptor Ring * the Base and Length of the Rx Descriptor Ring
*/ */
for (i = 0; i < adapter->num_rx_queues; i++) { for (i = 0; i < adapter->num_rx_queues; i++) {
rdba = adapter->rx_ring[i].dma; rx_ring = &adapter->rx_ring[i];
j = adapter->rx_ring[i].reg_idx; rdba = rx_ring->dma;
j = rx_ring->reg_idx;
IXGBE_WRITE_REG(hw, IXGBE_RDBAL(j), (rdba & DMA_BIT_MASK(32))); IXGBE_WRITE_REG(hw, IXGBE_RDBAL(j), (rdba & DMA_BIT_MASK(32)));
IXGBE_WRITE_REG(hw, IXGBE_RDBAH(j), (rdba >> 32)); IXGBE_WRITE_REG(hw, IXGBE_RDBAH(j), (rdba >> 32));
IXGBE_WRITE_REG(hw, IXGBE_RDLEN(j), rdlen); IXGBE_WRITE_REG(hw, IXGBE_RDLEN(j), rdlen);
IXGBE_WRITE_REG(hw, IXGBE_RDH(j), 0); IXGBE_WRITE_REG(hw, IXGBE_RDH(j), 0);
IXGBE_WRITE_REG(hw, IXGBE_RDT(j), 0); IXGBE_WRITE_REG(hw, IXGBE_RDT(j), 0);
adapter->rx_ring[i].head = IXGBE_RDH(j); rx_ring->head = IXGBE_RDH(j);
adapter->rx_ring[i].tail = IXGBE_RDT(j); rx_ring->tail = IXGBE_RDT(j);
adapter->rx_ring[i].rx_buf_len = rx_buf_len; rx_ring->rx_buf_len = rx_buf_len;
if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED)
rx_ring->flags |= IXGBE_RING_RX_PS_ENABLED;
#ifdef IXGBE_FCOE #ifdef IXGBE_FCOE
if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) { if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) {
struct ixgbe_ring_feature *f; struct ixgbe_ring_feature *f;
f = &adapter->ring_feature[RING_F_FCOE]; f = &adapter->ring_feature[RING_F_FCOE];
if ((rx_buf_len < IXGBE_FCOE_JUMBO_FRAME_SIZE) && if ((i >= f->mask) && (i < f->mask + f->indices)) {
(i >= f->mask) && (i < f->mask + f->indices)) rx_ring->flags &= ~IXGBE_RING_RX_PS_ENABLED;
adapter->rx_ring[i].rx_buf_len = if (rx_buf_len < IXGBE_FCOE_JUMBO_FRAME_SIZE)
rx_ring->rx_buf_len =
IXGBE_FCOE_JUMBO_FRAME_SIZE; IXGBE_FCOE_JUMBO_FRAME_SIZE;
} }
}
#endif /* IXGBE_FCOE */ #endif /* IXGBE_FCOE */
ixgbe_configure_srrctl(adapter, j); ixgbe_configure_srrctl(adapter, rx_ring);
} }
if (hw->mac.type == ixgbe_mac_82598EB) { if (hw->mac.type == ixgbe_mac_82598EB) {
@ -2168,7 +2143,8 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) {
/* Enable 82599 HW-RSC */ /* Enable 82599 HW-RSC */
for (i = 0; i < adapter->num_rx_queues; i++) { for (i = 0; i < adapter->num_rx_queues; i++) {
j = adapter->rx_ring[i].reg_idx; rx_ring = &adapter->rx_ring[i];
j = rx_ring->reg_idx;
rscctrl = IXGBE_READ_REG(hw, IXGBE_RSCCTL(j)); rscctrl = IXGBE_READ_REG(hw, IXGBE_RSCCTL(j));
rscctrl |= IXGBE_RSCCTL_RSCEN; rscctrl |= IXGBE_RSCCTL_RSCEN;
/* /*
@ -2176,7 +2152,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
* total size of max desc * buf_len is not greater * total size of max desc * buf_len is not greater
* than 65535 * than 65535
*/ */
if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) {
#if (MAX_SKB_FRAGS > 16) #if (MAX_SKB_FRAGS > 16)
rscctrl |= IXGBE_RSCCTL_MAXDESC_16; rscctrl |= IXGBE_RSCCTL_MAXDESC_16;
#elif (MAX_SKB_FRAGS > 8) #elif (MAX_SKB_FRAGS > 8)

View file

@ -506,6 +506,7 @@ static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
} }
/* Adjust size of last fragment to match actual length */ /* Adjust size of last fragment to match actual length */
if (nr > 0)
skb_frags_rx[nr - 1].size = length - skb_frags_rx[nr - 1].size = length -
priv->frag_info[nr - 1].frag_prefix_size; priv->frag_info[nr - 1].frag_prefix_size;
return nr; return nr;

View file

@ -1254,7 +1254,7 @@ struct netxen_adapter {
u8 mc_enabled; u8 mc_enabled;
u8 max_mc_count; u8 max_mc_count;
u8 rss_supported; u8 rss_supported;
u8 resv2; u8 link_changed;
u32 resv3; u32 resv3;
u8 has_link_events; u8 has_link_events;

View file

@ -184,13 +184,6 @@ void netxen_free_sw_resources(struct netxen_adapter *adapter)
kfree(recv_ctx->rds_rings); kfree(recv_ctx->rds_rings);
skip_rds: skip_rds:
if (recv_ctx->sds_rings == NULL)
goto skip_sds;
for(ring = 0; ring < adapter->max_sds_rings; ring++)
recv_ctx->sds_rings[ring].consumer = 0;
skip_sds:
if (adapter->tx_ring == NULL) if (adapter->tx_ring == NULL)
return; return;

View file

@ -94,10 +94,6 @@ static struct pci_device_id netxen_pci_tbl[] __devinitdata = {
MODULE_DEVICE_TABLE(pci, netxen_pci_tbl); MODULE_DEVICE_TABLE(pci, netxen_pci_tbl);
static struct workqueue_struct *netxen_workq;
#define SCHEDULE_WORK(tp) queue_work(netxen_workq, tp)
#define FLUSH_SCHEDULED_WORK() flush_workqueue(netxen_workq)
static void netxen_watchdog(unsigned long); static void netxen_watchdog(unsigned long);
static uint32_t crb_cmd_producer[4] = { static uint32_t crb_cmd_producer[4] = {
@ -171,6 +167,8 @@ netxen_free_sds_rings(struct netxen_recv_context *recv_ctx)
{ {
if (recv_ctx->sds_rings != NULL) if (recv_ctx->sds_rings != NULL)
kfree(recv_ctx->sds_rings); kfree(recv_ctx->sds_rings);
recv_ctx->sds_rings = NULL;
} }
static int static int
@ -192,6 +190,21 @@ netxen_napi_add(struct netxen_adapter *adapter, struct net_device *netdev)
return 0; return 0;
} }
static void
netxen_napi_del(struct netxen_adapter *adapter)
{
int ring;
struct nx_host_sds_ring *sds_ring;
struct netxen_recv_context *recv_ctx = &adapter->recv_ctx;
for (ring = 0; ring < adapter->max_sds_rings; ring++) {
sds_ring = &recv_ctx->sds_rings[ring];
netif_napi_del(&sds_ring->napi);
}
netxen_free_sds_rings(&adapter->recv_ctx);
}
static void static void
netxen_napi_enable(struct netxen_adapter *adapter) netxen_napi_enable(struct netxen_adapter *adapter)
{ {
@ -260,7 +273,7 @@ nx_update_dma_mask(struct netxen_adapter *adapter)
change = 0; change = 0;
shift = NXRD32(adapter, CRB_DMA_SHIFT); shift = NXRD32(adapter, CRB_DMA_SHIFT);
if (shift >= 32) if (shift > 32)
return 0; return 0;
if (NX_IS_REVISION_P3(adapter->ahw.revision_id) && (shift > 9)) if (NX_IS_REVISION_P3(adapter->ahw.revision_id) && (shift > 9))
@ -272,7 +285,7 @@ nx_update_dma_mask(struct netxen_adapter *adapter)
old_mask = pdev->dma_mask; old_mask = pdev->dma_mask;
old_cmask = pdev->dev.coherent_dma_mask; old_cmask = pdev->dev.coherent_dma_mask;
mask = (1ULL<<(32+shift)) - 1; mask = DMA_BIT_MASK(32+shift);
err = pci_set_dma_mask(pdev, mask); err = pci_set_dma_mask(pdev, mask);
if (err) if (err)
@ -880,7 +893,6 @@ netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev)
spin_unlock(&adapter->tx_clean_lock); spin_unlock(&adapter->tx_clean_lock);
del_timer_sync(&adapter->watchdog_timer); del_timer_sync(&adapter->watchdog_timer);
FLUSH_SCHEDULED_WORK();
} }
@ -894,10 +906,12 @@ netxen_nic_attach(struct netxen_adapter *adapter)
struct nx_host_tx_ring *tx_ring; struct nx_host_tx_ring *tx_ring;
err = netxen_init_firmware(adapter); err = netxen_init_firmware(adapter);
if (err != 0) { if (err)
printk(KERN_ERR "Failed to init firmware\n"); return err;
return -EIO;
} err = netxen_napi_add(adapter, netdev);
if (err)
return err;
if (adapter->fw_major < 4) if (adapter->fw_major < 4)
adapter->max_rds_rings = 3; adapter->max_rds_rings = 3;
@ -961,6 +975,7 @@ netxen_nic_detach(struct netxen_adapter *adapter)
netxen_free_hw_resources(adapter); netxen_free_hw_resources(adapter);
netxen_release_rx_buffers(adapter); netxen_release_rx_buffers(adapter);
netxen_nic_free_irq(adapter); netxen_nic_free_irq(adapter);
netxen_napi_del(adapter);
netxen_free_sw_resources(adapter); netxen_free_sw_resources(adapter);
adapter->is_up = 0; adapter->is_up = 0;
@ -1105,9 +1120,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
netdev->irq = adapter->msix_entries[0].vector; netdev->irq = adapter->msix_entries[0].vector;
if (netxen_napi_add(adapter, netdev))
goto err_out_disable_msi;
init_timer(&adapter->watchdog_timer); init_timer(&adapter->watchdog_timer);
adapter->watchdog_timer.function = &netxen_watchdog; adapter->watchdog_timer.function = &netxen_watchdog;
adapter->watchdog_timer.data = (unsigned long)adapter; adapter->watchdog_timer.data = (unsigned long)adapter;
@ -1177,6 +1189,9 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
unregister_netdev(netdev); unregister_netdev(netdev);
cancel_work_sync(&adapter->watchdog_task);
cancel_work_sync(&adapter->tx_timeout_task);
if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) {
netxen_nic_detach(adapter); netxen_nic_detach(adapter);
} }
@ -1185,7 +1200,6 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
netxen_free_adapter_offload(adapter); netxen_free_adapter_offload(adapter);
netxen_teardown_intr(adapter); netxen_teardown_intr(adapter);
netxen_free_sds_rings(&adapter->recv_ctx);
netxen_cleanup_pci_map(adapter); netxen_cleanup_pci_map(adapter);
@ -1211,6 +1225,9 @@ netxen_nic_suspend(struct pci_dev *pdev, pm_message_t state)
if (netif_running(netdev)) if (netif_running(netdev))
netxen_nic_down(adapter, netdev); netxen_nic_down(adapter, netdev);
cancel_work_sync(&adapter->watchdog_task);
cancel_work_sync(&adapter->tx_timeout_task);
if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC)
netxen_nic_detach(adapter); netxen_nic_detach(adapter);
@ -1549,11 +1566,6 @@ static int netxen_nic_check_temp(struct netxen_adapter *adapter)
"%s: Device temperature %d degrees C exceeds" "%s: Device temperature %d degrees C exceeds"
" maximum allowed. Hardware has been shut down.\n", " maximum allowed. Hardware has been shut down.\n",
netdev->name, temp_val); netdev->name, temp_val);
netif_device_detach(netdev);
netxen_nic_down(adapter, netdev);
netxen_nic_detach(adapter);
rv = 1; rv = 1;
} else if (temp_state == NX_TEMP_WARN) { } else if (temp_state == NX_TEMP_WARN) {
if (adapter->temp == NX_TEMP_NORMAL) { if (adapter->temp == NX_TEMP_NORMAL) {
@ -1587,10 +1599,7 @@ void netxen_advert_link_change(struct netxen_adapter *adapter, int linkup)
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_stop_queue(netdev); netif_stop_queue(netdev);
} }
adapter->link_changed = !adapter->has_link_events;
if (!adapter->has_link_events)
netxen_nic_set_link_parameters(adapter);
} else if (!adapter->ahw.linkup && linkup) { } else if (!adapter->ahw.linkup && linkup) {
printk(KERN_INFO "%s: %s NIC Link is up\n", printk(KERN_INFO "%s: %s NIC Link is up\n",
netxen_nic_driver_name, netdev->name); netxen_nic_driver_name, netdev->name);
@ -1599,9 +1608,7 @@ void netxen_advert_link_change(struct netxen_adapter *adapter, int linkup)
netif_carrier_on(netdev); netif_carrier_on(netdev);
netif_wake_queue(netdev); netif_wake_queue(netdev);
} }
adapter->link_changed = !adapter->has_link_events;
if (!adapter->has_link_events)
netxen_nic_set_link_parameters(adapter);
} }
} }
@ -1628,11 +1635,36 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter)
netxen_advert_link_change(adapter, linkup); netxen_advert_link_change(adapter, linkup);
} }
static void netxen_nic_thermal_shutdown(struct netxen_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
netif_device_detach(netdev);
netxen_nic_down(adapter, netdev);
netxen_nic_detach(adapter);
}
static void netxen_watchdog(unsigned long v) static void netxen_watchdog(unsigned long v)
{ {
struct netxen_adapter *adapter = (struct netxen_adapter *)v; struct netxen_adapter *adapter = (struct netxen_adapter *)v;
SCHEDULE_WORK(&adapter->watchdog_task); if (netxen_nic_check_temp(adapter))
goto do_sched;
if (!adapter->has_link_events) {
netxen_nic_handle_phy_intr(adapter);
if (adapter->link_changed)
goto do_sched;
}
if (netif_running(adapter->netdev))
mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ);
return;
do_sched:
schedule_work(&adapter->watchdog_task);
} }
void netxen_watchdog_task(struct work_struct *work) void netxen_watchdog_task(struct work_struct *work)
@ -1640,11 +1672,13 @@ void netxen_watchdog_task(struct work_struct *work)
struct netxen_adapter *adapter = struct netxen_adapter *adapter =
container_of(work, struct netxen_adapter, watchdog_task); container_of(work, struct netxen_adapter, watchdog_task);
if (netxen_nic_check_temp(adapter)) if (adapter->temp == NX_TEMP_PANIC) {
netxen_nic_thermal_shutdown(adapter);
return; return;
}
if (!adapter->has_link_events) if (adapter->link_changed)
netxen_nic_handle_phy_intr(adapter); netxen_nic_set_link_parameters(adapter);
if (netif_running(adapter->netdev)) if (netif_running(adapter->netdev))
mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ);
@ -1652,9 +1686,8 @@ void netxen_watchdog_task(struct work_struct *work)
static void netxen_tx_timeout(struct net_device *netdev) static void netxen_tx_timeout(struct net_device *netdev)
{ {
struct netxen_adapter *adapter = (struct netxen_adapter *) struct netxen_adapter *adapter = netdev_priv(netdev);
netdev_priv(netdev); schedule_work(&adapter->tx_timeout_task);
SCHEDULE_WORK(&adapter->tx_timeout_task);
} }
static void netxen_tx_timeout_task(struct work_struct *work) static void netxen_tx_timeout_task(struct work_struct *work)
@ -1811,9 +1844,6 @@ static int __init netxen_init_module(void)
{ {
printk(KERN_INFO "%s\n", netxen_nic_driver_string); printk(KERN_INFO "%s\n", netxen_nic_driver_string);
if ((netxen_workq = create_singlethread_workqueue("netxen")) == NULL)
return -ENOMEM;
return pci_register_driver(&netxen_driver); return pci_register_driver(&netxen_driver);
} }
@ -1822,7 +1852,6 @@ module_init(netxen_init_module);
static void __exit netxen_exit_module(void) static void __exit netxen_exit_module(void)
{ {
pci_unregister_driver(&netxen_driver); pci_unregister_driver(&netxen_driver);
destroy_workqueue(netxen_workq);
} }
module_exit(netxen_exit_module); module_exit(netxen_exit_module);

View file

@ -1839,7 +1839,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
lp->chip_version = chip_version; lp->chip_version = chip_version;
lp->msg_enable = pcnet32_debug; lp->msg_enable = pcnet32_debug;
if ((cards_found >= MAX_UNITS) if ((cards_found >= MAX_UNITS)
|| (options[cards_found] > sizeof(options_mapping))) || (options[cards_found] >= sizeof(options_mapping)))
lp->options = PCNET32_PORT_ASEL; lp->options = PCNET32_PORT_ASEL;
else else
lp->options = options_mapping[options[cards_found]]; lp->options = options_mapping[options[cards_found]];

View file

@ -652,8 +652,9 @@ tulip_start_xmit(struct sk_buff *skb, struct net_device *dev)
int entry; int entry;
u32 flag; u32 flag;
dma_addr_t mapping; dma_addr_t mapping;
unsigned long flags;
spin_lock_irq(&tp->lock); spin_lock_irqsave(&tp->lock, flags);
/* Calculate the next Tx descriptor entry. */ /* Calculate the next Tx descriptor entry. */
entry = tp->cur_tx % TX_RING_SIZE; entry = tp->cur_tx % TX_RING_SIZE;
@ -688,7 +689,7 @@ tulip_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Trigger an immediate transmit demand. */ /* Trigger an immediate transmit demand. */
iowrite32(0, tp->base_addr + CSR1); iowrite32(0, tp->base_addr + CSR1);
spin_unlock_irq(&tp->lock); spin_unlock_irqrestore(&tp->lock, flags);
dev->trans_start = jiffies; dev->trans_start = jiffies;

View file

@ -1048,20 +1048,15 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
return err; return err;
} }
static int tun_get_iff(struct net *net, struct file *file, struct ifreq *ifr) static int tun_get_iff(struct net *net, struct tun_struct *tun,
struct ifreq *ifr)
{ {
struct tun_struct *tun = tun_get(file);
if (!tun)
return -EBADFD;
DBG(KERN_INFO "%s: tun_get_iff\n", tun->dev->name); DBG(KERN_INFO "%s: tun_get_iff\n", tun->dev->name);
strcpy(ifr->ifr_name, tun->dev->name); strcpy(ifr->ifr_name, tun->dev->name);
ifr->ifr_flags = tun_flags(tun); ifr->ifr_flags = tun_flags(tun);
tun_put(tun);
return 0; return 0;
} }
@ -1105,8 +1100,8 @@ static int set_offload(struct net_device *dev, unsigned long arg)
return 0; return 0;
} }
static int tun_chr_ioctl(struct inode *inode, struct file *file, static long tun_chr_ioctl(struct file *file, unsigned int cmd,
unsigned int cmd, unsigned long arg) unsigned long arg)
{ {
struct tun_file *tfile = file->private_data; struct tun_file *tfile = file->private_data;
struct tun_struct *tun; struct tun_struct *tun;
@ -1128,34 +1123,32 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
(unsigned int __user*)argp); (unsigned int __user*)argp);
} }
rtnl_lock();
tun = __tun_get(tfile); tun = __tun_get(tfile);
if (cmd == TUNSETIFF && !tun) { if (cmd == TUNSETIFF && !tun) {
int err;
ifr.ifr_name[IFNAMSIZ-1] = '\0'; ifr.ifr_name[IFNAMSIZ-1] = '\0';
rtnl_lock(); ret = tun_set_iff(tfile->net, file, &ifr);
err = tun_set_iff(tfile->net, file, &ifr);
rtnl_unlock();
if (err) if (ret)
return err; goto unlock;
if (copy_to_user(argp, &ifr, sizeof(ifr))) if (copy_to_user(argp, &ifr, sizeof(ifr)))
return -EFAULT; ret = -EFAULT;
return 0; goto unlock;
} }
ret = -EBADFD;
if (!tun) if (!tun)
return -EBADFD; goto unlock;
DBG(KERN_INFO "%s: tun_chr_ioctl cmd %d\n", tun->dev->name, cmd); DBG(KERN_INFO "%s: tun_chr_ioctl cmd %d\n", tun->dev->name, cmd);
ret = 0; ret = 0;
switch (cmd) { switch (cmd) {
case TUNGETIFF: case TUNGETIFF:
ret = tun_get_iff(current->nsproxy->net_ns, file, &ifr); ret = tun_get_iff(current->nsproxy->net_ns, tun, &ifr);
if (ret) if (ret)
break; break;
@ -1201,7 +1194,6 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
case TUNSETLINK: case TUNSETLINK:
/* Only allow setting the type when the interface is down */ /* Only allow setting the type when the interface is down */
rtnl_lock();
if (tun->dev->flags & IFF_UP) { if (tun->dev->flags & IFF_UP) {
DBG(KERN_INFO "%s: Linktype set failed because interface is up\n", DBG(KERN_INFO "%s: Linktype set failed because interface is up\n",
tun->dev->name); tun->dev->name);
@ -1211,7 +1203,6 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
DBG(KERN_INFO "%s: linktype set to %d\n", tun->dev->name, tun->dev->type); DBG(KERN_INFO "%s: linktype set to %d\n", tun->dev->name, tun->dev->type);
ret = 0; ret = 0;
} }
rtnl_unlock();
break; break;
#ifdef TUN_DEBUG #ifdef TUN_DEBUG
@ -1220,9 +1211,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
break; break;
#endif #endif
case TUNSETOFFLOAD: case TUNSETOFFLOAD:
rtnl_lock();
ret = set_offload(tun->dev, arg); ret = set_offload(tun->dev, arg);
rtnl_unlock();
break; break;
case TUNSETTXFILTER: case TUNSETTXFILTER:
@ -1230,9 +1219,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
ret = -EINVAL; ret = -EINVAL;
if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV)
break; break;
rtnl_lock();
ret = update_filter(&tun->txflt, (void __user *)arg); ret = update_filter(&tun->txflt, (void __user *)arg);
rtnl_unlock();
break; break;
case SIOCGIFHWADDR: case SIOCGIFHWADDR:
@ -1248,9 +1235,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
DBG(KERN_DEBUG "%s: set hw address: %pM\n", DBG(KERN_DEBUG "%s: set hw address: %pM\n",
tun->dev->name, ifr.ifr_hwaddr.sa_data); tun->dev->name, ifr.ifr_hwaddr.sa_data);
rtnl_lock();
ret = dev_set_mac_address(tun->dev, &ifr.ifr_hwaddr); ret = dev_set_mac_address(tun->dev, &ifr.ifr_hwaddr);
rtnl_unlock();
break; break;
case TUNGETSNDBUF: case TUNGETSNDBUF:
@ -1273,6 +1258,9 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
break; break;
}; };
unlock:
rtnl_unlock();
if (tun)
tun_put(tun); tun_put(tun);
return ret; return ret;
} }
@ -1361,7 +1349,7 @@ static const struct file_operations tun_fops = {
.write = do_sync_write, .write = do_sync_write,
.aio_write = tun_chr_aio_write, .aio_write = tun_chr_aio_write,
.poll = tun_chr_poll, .poll = tun_chr_poll,
.ioctl = tun_chr_ioctl, .unlocked_ioctl = tun_chr_ioctl,
.open = tun_chr_open, .open = tun_chr_open,
.release = tun_chr_close, .release = tun_chr_close,
.fasync = tun_chr_fasync .fasync = tun_chr_fasync

View file

@ -3111,10 +3111,11 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
u8 __iomem *bd; /* BD pointer */ u8 __iomem *bd; /* BD pointer */
u32 bd_status; u32 bd_status;
u8 txQ = 0; u8 txQ = 0;
unsigned long flags;
ugeth_vdbg("%s: IN", __func__); ugeth_vdbg("%s: IN", __func__);
spin_lock_irq(&ugeth->lock); spin_lock_irqsave(&ugeth->lock, flags);
dev->stats.tx_bytes += skb->len; dev->stats.tx_bytes += skb->len;
@ -3171,7 +3172,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
uccf = ugeth->uccf; uccf = ugeth->uccf;
out_be16(uccf->p_utodr, UCC_FAST_TOD); out_be16(uccf->p_utodr, UCC_FAST_TOD);
#endif #endif
spin_unlock_irq(&ugeth->lock); spin_unlock_irqrestore(&ugeth->lock, flags);
return 0; return 0;
} }

View file

@ -250,6 +250,8 @@ PEGASUS_DEV( "IO DATA USB ET/TX", VENDOR_IODATA, 0x0904,
DEFAULT_GPIO_RESET ) DEFAULT_GPIO_RESET )
PEGASUS_DEV( "IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913, PEGASUS_DEV( "IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913,
DEFAULT_GPIO_RESET | PEGASUS_II ) DEFAULT_GPIO_RESET | PEGASUS_II )
PEGASUS_DEV( "IO DATA USB ETX-US2", VENDOR_IODATA, 0x092a,
DEFAULT_GPIO_RESET | PEGASUS_II )
PEGASUS_DEV( "Kingston KNU101TX Ethernet", VENDOR_KINGSTON, 0x000a, PEGASUS_DEV( "Kingston KNU101TX Ethernet", VENDOR_KINGSTON, 0x000a,
DEFAULT_GPIO_RESET) DEFAULT_GPIO_RESET)
PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002, PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002,

View file

@ -1218,6 +1218,7 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev)
struct rhine_private *rp = netdev_priv(dev); struct rhine_private *rp = netdev_priv(dev);
void __iomem *ioaddr = rp->base; void __iomem *ioaddr = rp->base;
unsigned entry; unsigned entry;
unsigned long flags;
/* Caution: the write order is important here, set the field /* Caution: the write order is important here, set the field
with the "ownership" bits last. */ with the "ownership" bits last. */
@ -1261,7 +1262,7 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev)
cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN)); cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN));
/* lock eth irq */ /* lock eth irq */
spin_lock_irq(&rp->lock); spin_lock_irqsave(&rp->lock, flags);
wmb(); wmb();
rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn); rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn);
wmb(); wmb();
@ -1280,7 +1281,7 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev)
dev->trans_start = jiffies; dev->trans_start = jiffies;
spin_unlock_irq(&rp->lock); spin_unlock_irqrestore(&rp->lock, flags);
if (debug > 4) { if (debug > 4) {
printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n", printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n",

View file

@ -1778,7 +1778,7 @@ static void velocity_error(struct velocity_info *vptr, int status)
* mode * mode
*/ */
if (vptr->rev_id < REV_ID_VT3216_A0) { if (vptr->rev_id < REV_ID_VT3216_A0) {
if (vptr->mii_status | VELOCITY_DUPLEX_FULL) if (vptr->mii_status & VELOCITY_DUPLEX_FULL)
BYTE_REG_BITS_ON(TCR_TB2BDIS, &regs->TCR); BYTE_REG_BITS_ON(TCR_TB2BDIS, &regs->TCR);
else else
BYTE_REG_BITS_OFF(TCR_TB2BDIS, &regs->TCR); BYTE_REG_BITS_OFF(TCR_TB2BDIS, &regs->TCR);

View file

@ -1967,13 +1967,14 @@ static int ar9170_conf_tx(struct ieee80211_hw *hw, u16 queue,
int ret; int ret;
mutex_lock(&ar->mutex); mutex_lock(&ar->mutex);
if ((param) && !(queue > __AR9170_NUM_TXQ)) { if (queue < __AR9170_NUM_TXQ) {
memcpy(&ar->edcf[ar9170_qos_hwmap[queue]], memcpy(&ar->edcf[ar9170_qos_hwmap[queue]],
param, sizeof(*param)); param, sizeof(*param));
ret = ar9170_set_qos(ar); ret = ar9170_set_qos(ar);
} else } else {
ret = -EINVAL; ret = -EINVAL;
}
mutex_unlock(&ar->mutex); mutex_unlock(&ar->mutex);
return ret; return ret;

View file

@ -598,11 +598,15 @@ static int ar9170_usb_request_firmware(struct ar9170_usb *aru)
err = request_firmware(&aru->init_values, "ar9170-1.fw", err = request_firmware(&aru->init_values, "ar9170-1.fw",
&aru->udev->dev); &aru->udev->dev);
if (err) {
dev_err(&aru->udev->dev, "file with init values not found.\n");
return err;
}
err = request_firmware(&aru->firmware, "ar9170-2.fw", &aru->udev->dev); err = request_firmware(&aru->firmware, "ar9170-2.fw", &aru->udev->dev);
if (err) { if (err) {
release_firmware(aru->init_values); release_firmware(aru->init_values);
dev_err(&aru->udev->dev, "file with init values not found.\n"); dev_err(&aru->udev->dev, "firmware file not found.\n");
return err; return err;
} }

View file

@ -6226,7 +6226,7 @@ static void ipw_add_scan_channels(struct ipw_priv *priv,
}; };
u8 channel; u8 channel;
while (channel_index < IPW_SCAN_CHANNELS) { while (channel_index < IPW_SCAN_CHANNELS - 1) {
channel = channel =
priv->speed_scan[priv->speed_scan_pos]; priv->speed_scan[priv->speed_scan_pos];
if (channel == 0) { if (channel == 0) {

View file

@ -1,7 +1,6 @@
/* Copyright (C) 2006, Red Hat, Inc. */ /* Copyright (C) 2006, Red Hat, Inc. */
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/ieee80211.h> #include <linux/ieee80211.h>
#include <linux/if_arp.h> #include <linux/if_arp.h>
@ -44,21 +43,21 @@ static int get_common_rates(struct lbs_private *priv,
u16 *rates_size) u16 *rates_size)
{ {
u8 *card_rates = lbs_bg_rates; u8 *card_rates = lbs_bg_rates;
size_t num_card_rates = sizeof(lbs_bg_rates);
int ret = 0, i, j; int ret = 0, i, j;
u8 tmp[(ARRAY_SIZE(lbs_bg_rates) - 1) * (*rates_size - 1)]; u8 tmp[30];
size_t tmp_size = 0; size_t tmp_size = 0;
/* For each rate in card_rates that exists in rate1, copy to tmp */ /* For each rate in card_rates that exists in rate1, copy to tmp */
for (i = 0; i < ARRAY_SIZE(lbs_bg_rates) && card_rates[i]; i++) { for (i = 0; card_rates[i] && (i < num_card_rates); i++) {
for (j = 0; j < *rates_size && rates[j]; j++) { for (j = 0; rates[j] && (j < *rates_size); j++) {
if (rates[j] == card_rates[i]) if (rates[j] == card_rates[i])
tmp[tmp_size++] = card_rates[i]; tmp[tmp_size++] = card_rates[i];
} }
} }
lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size); lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size);
lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, num_card_rates);
ARRAY_SIZE(lbs_bg_rates));
lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size); lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size);
lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate); lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate);
@ -70,7 +69,10 @@ static int get_common_rates(struct lbs_private *priv,
lbs_pr_alert("Previously set fixed data rate %#x isn't " lbs_pr_alert("Previously set fixed data rate %#x isn't "
"compatible with the network.\n", priv->cur_rate); "compatible with the network.\n", priv->cur_rate);
ret = -1; ret = -1;
goto done;
} }
ret = 0;
done: done:
memset(rates, 0, *rates_size); memset(rates, 0, *rates_size);
*rates_size = min_t(int, tmp_size, *rates_size); *rates_size = min_t(int, tmp_size, *rates_size);
@ -320,7 +322,7 @@ static int lbs_associate(struct lbs_private *priv,
rates = (struct mrvl_ie_rates_param_set *) pos; rates = (struct mrvl_ie_rates_param_set *) pos;
rates->header.type = cpu_to_le16(TLV_TYPE_RATES); rates->header.type = cpu_to_le16(TLV_TYPE_RATES);
memcpy(&rates->rates, &bss->rates, MAX_RATES); memcpy(&rates->rates, &bss->rates, MAX_RATES);
tmplen = min_t(u16, ARRAY_SIZE(rates->rates), MAX_RATES); tmplen = MAX_RATES;
if (get_common_rates(priv, rates->rates, &tmplen)) { if (get_common_rates(priv, rates->rates, &tmplen)) {
ret = -1; ret = -1;
goto done; goto done;
@ -596,7 +598,7 @@ static int lbs_adhoc_join(struct lbs_private *priv,
/* Copy Data rates from the rates recorded in scan response */ /* Copy Data rates from the rates recorded in scan response */
memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates)); memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates));
ratesize = min_t(u16, ARRAY_SIZE(cmd.bss.rates), MAX_RATES); ratesize = min_t(u16, sizeof(cmd.bss.rates), MAX_RATES);
memcpy(cmd.bss.rates, bss->rates, ratesize); memcpy(cmd.bss.rates, bss->rates, ratesize);
if (get_common_rates(priv, cmd.bss.rates, &ratesize)) { if (get_common_rates(priv, cmd.bss.rates, &ratesize)) {
lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n"); lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n");

View file

@ -56,8 +56,8 @@ struct rxpd {
u8 bss_type; u8 bss_type;
/* BSS number */ /* BSS number */
u8 bss_num; u8 bss_num;
} bss; } __attribute__ ((packed)) bss;
} u; } __attribute__ ((packed)) u;
/* SNR */ /* SNR */
u8 snr; u8 snr;

View file

@ -261,7 +261,7 @@ struct mwl8k_vif {
*/ */
}; };
#define MWL8K_VIF(_vif) (struct mwl8k_vif *)(&((_vif)->drv_priv)) #define MWL8K_VIF(_vif) ((struct mwl8k_vif *)&((_vif)->drv_priv))
static const struct ieee80211_channel mwl8k_channels[] = { static const struct ieee80211_channel mwl8k_channels[] = {
{ .center_freq = 2412, .hw_value = 1, }, { .center_freq = 2412, .hw_value = 1, },
@ -1012,6 +1012,8 @@ static int rxq_process(struct ieee80211_hw *hw, int index, int limit)
rmb(); rmb();
skb = rxq->rx_skb[rxq->rx_head]; skb = rxq->rx_skb[rxq->rx_head];
if (skb == NULL)
break;
rxq->rx_skb[rxq->rx_head] = NULL; rxq->rx_skb[rxq->rx_head] = NULL;
rxq->rx_head = (rxq->rx_head + 1) % MWL8K_RX_DESCS; rxq->rx_head = (rxq->rx_head + 1) % MWL8K_RX_DESCS;
@ -1591,6 +1593,9 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd)
timeout = wait_for_completion_timeout(&cmd_wait, timeout = wait_for_completion_timeout(&cmd_wait,
msecs_to_jiffies(MWL8K_CMD_TIMEOUT_MS)); msecs_to_jiffies(MWL8K_CMD_TIMEOUT_MS));
pci_unmap_single(priv->pdev, dma_addr, dma_size,
PCI_DMA_BIDIRECTIONAL);
result = &cmd->result; result = &cmd->result;
if (!timeout) { if (!timeout) {
spin_lock_irq(&priv->fw_lock); spin_lock_irq(&priv->fw_lock);
@ -1610,8 +1615,6 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd)
*result); *result);
} }
pci_unmap_single(priv->pdev, dma_addr, dma_size,
PCI_DMA_BIDIRECTIONAL);
return rc; return rc;
} }
@ -1654,18 +1657,18 @@ static int mwl8k_cmd_get_hw_spec(struct ieee80211_hw *hw)
memset(cmd->perm_addr, 0xff, sizeof(cmd->perm_addr)); memset(cmd->perm_addr, 0xff, sizeof(cmd->perm_addr));
cmd->ps_cookie = cpu_to_le32(priv->cookie_dma); cmd->ps_cookie = cpu_to_le32(priv->cookie_dma);
cmd->rx_queue_ptr = cpu_to_le32(priv->rxq[0].rx_desc_dma); cmd->rx_queue_ptr = cpu_to_le32(priv->rxq[0].rx_desc_dma);
cmd->num_tx_queues = MWL8K_TX_QUEUES; cmd->num_tx_queues = cpu_to_le32(MWL8K_TX_QUEUES);
for (i = 0; i < MWL8K_TX_QUEUES; i++) for (i = 0; i < MWL8K_TX_QUEUES; i++)
cmd->tx_queue_ptrs[i] = cpu_to_le32(priv->txq[i].tx_desc_dma); cmd->tx_queue_ptrs[i] = cpu_to_le32(priv->txq[i].tx_desc_dma);
cmd->num_tx_desc_per_queue = MWL8K_TX_DESCS; cmd->num_tx_desc_per_queue = cpu_to_le32(MWL8K_TX_DESCS);
cmd->total_rx_desc = MWL8K_RX_DESCS; cmd->total_rx_desc = cpu_to_le32(MWL8K_RX_DESCS);
rc = mwl8k_post_cmd(hw, &cmd->header); rc = mwl8k_post_cmd(hw, &cmd->header);
if (!rc) { if (!rc) {
SET_IEEE80211_PERM_ADDR(hw, cmd->perm_addr); SET_IEEE80211_PERM_ADDR(hw, cmd->perm_addr);
priv->num_mcaddrs = le16_to_cpu(cmd->num_mcaddrs); priv->num_mcaddrs = le16_to_cpu(cmd->num_mcaddrs);
priv->fw_rev = cmd->fw_rev; priv->fw_rev = le32_to_cpu(cmd->fw_rev);
priv->hw_rev = cmd->hw_rev; priv->hw_rev = cmd->hw_rev;
priv->region_code = le16_to_cpu(cmd->region_code); priv->region_code = le16_to_cpu(cmd->region_code);
} }
@ -3216,15 +3219,19 @@ static int mwl8k_configure_filter_wt(struct work_struct *wt)
struct dev_addr_list *mclist = worker->mclist; struct dev_addr_list *mclist = worker->mclist;
struct mwl8k_priv *priv = hw->priv; struct mwl8k_priv *priv = hw->priv;
struct mwl8k_vif *mv_vif;
int rc = 0; int rc = 0;
if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { if (changed_flags & FIF_BCN_PRBRESP_PROMISC) {
if (*total_flags & FIF_BCN_PRBRESP_PROMISC) if (*total_flags & FIF_BCN_PRBRESP_PROMISC)
rc = mwl8k_cmd_set_pre_scan(hw); rc = mwl8k_cmd_set_pre_scan(hw);
else { else {
mv_vif = MWL8K_VIF(priv->vif); u8 *bssid;
rc = mwl8k_cmd_set_post_scan(hw, mv_vif->bssid);
bssid = "\x00\x00\x00\x00\x00\x00";
if (priv->vif != NULL)
bssid = MWL8K_VIF(priv->vif)->bssid;
rc = mwl8k_cmd_set_post_scan(hw, bssid);
} }
} }
@ -3726,6 +3733,8 @@ static void __devexit mwl8k_remove(struct pci_dev *pdev)
ieee80211_stop_queues(hw); ieee80211_stop_queues(hw);
ieee80211_unregister_hw(hw);
/* Remove tx reclaim tasklet */ /* Remove tx reclaim tasklet */
tasklet_kill(&priv->tx_reclaim_task); tasklet_kill(&priv->tx_reclaim_task);
@ -3739,8 +3748,6 @@ static void __devexit mwl8k_remove(struct pci_dev *pdev)
for (i = 0; i < MWL8K_TX_QUEUES; i++) for (i = 0; i < MWL8K_TX_QUEUES; i++)
mwl8k_txq_reclaim(hw, i, 1); mwl8k_txq_reclaim(hw, i, 1);
ieee80211_unregister_hw(hw);
for (i = 0; i < MWL8K_TX_QUEUES; i++) for (i = 0; i < MWL8K_TX_QUEUES; i++)
mwl8k_txq_deinit(hw, i); mwl8k_txq_deinit(hw, i);

View file

@ -849,13 +849,15 @@ struct rt2x00_dev {
static inline void rt2x00_rf_read(struct rt2x00_dev *rt2x00dev, static inline void rt2x00_rf_read(struct rt2x00_dev *rt2x00dev,
const unsigned int word, u32 *data) const unsigned int word, u32 *data)
{ {
*data = rt2x00dev->rf[word]; BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32));
*data = rt2x00dev->rf[word - 1];
} }
static inline void rt2x00_rf_write(struct rt2x00_dev *rt2x00dev, static inline void rt2x00_rf_write(struct rt2x00_dev *rt2x00dev,
const unsigned int word, u32 data) const unsigned int word, u32 data)
{ {
rt2x00dev->rf[word] = data; BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32));
rt2x00dev->rf[word - 1] = data;
} }
/* /*

View file

@ -120,6 +120,9 @@ static int __devinit zorro8390_init_one(struct zorro_dev *z,
for (i = ARRAY_SIZE(cards)-1; i >= 0; i--) for (i = ARRAY_SIZE(cards)-1; i >= 0; i--)
if (z->id == cards[i].id) if (z->id == cards[i].id)
break; break;
if (i < 0)
return -ENODEV;
board = z->resource.start; board = z->resource.start;
ioaddr = board+cards[i].offset; ioaddr = board+cards[i].offset;
dev = alloc_ei_netdev(); dev = alloc_ei_netdev();

View file

@ -19,6 +19,11 @@ enum {
* @packets: number of seen packets * @packets: number of seen packets
*/ */
struct gnet_stats_basic struct gnet_stats_basic
{
__u64 bytes;
__u32 packets;
};
struct gnet_stats_basic_packed
{ {
__u64 bytes; __u64 bytes;
__u32 packets; __u32 packets;

View file

@ -16,7 +16,7 @@ struct tcf_common {
u32 tcfc_capab; u32 tcfc_capab;
int tcfc_action; int tcfc_action;
struct tcf_t tcfc_tm; struct tcf_t tcfc_tm;
struct gnet_stats_basic tcfc_bstats; struct gnet_stats_basic_packed tcfc_bstats;
struct gnet_stats_queue tcfc_qstats; struct gnet_stats_queue tcfc_qstats;
struct gnet_stats_rate_est tcfc_rate_est; struct gnet_stats_rate_est tcfc_rate_est;
spinlock_t tcfc_lock; spinlock_t tcfc_lock;

View file

@ -28,7 +28,7 @@ extern int gnet_stats_start_copy_compat(struct sk_buff *skb, int type,
spinlock_t *lock, struct gnet_dump *d); spinlock_t *lock, struct gnet_dump *d);
extern int gnet_stats_copy_basic(struct gnet_dump *d, extern int gnet_stats_copy_basic(struct gnet_dump *d,
struct gnet_stats_basic *b); struct gnet_stats_basic_packed *b);
extern int gnet_stats_copy_rate_est(struct gnet_dump *d, extern int gnet_stats_copy_rate_est(struct gnet_dump *d,
struct gnet_stats_rate_est *r); struct gnet_stats_rate_est *r);
extern int gnet_stats_copy_queue(struct gnet_dump *d, extern int gnet_stats_copy_queue(struct gnet_dump *d,
@ -37,14 +37,14 @@ extern int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len);
extern int gnet_stats_finish_copy(struct gnet_dump *d); extern int gnet_stats_finish_copy(struct gnet_dump *d);
extern int gen_new_estimator(struct gnet_stats_basic *bstats, extern int gen_new_estimator(struct gnet_stats_basic_packed *bstats,
struct gnet_stats_rate_est *rate_est, struct gnet_stats_rate_est *rate_est,
spinlock_t *stats_lock, struct nlattr *opt); spinlock_t *stats_lock, struct nlattr *opt);
extern void gen_kill_estimator(struct gnet_stats_basic *bstats, extern void gen_kill_estimator(struct gnet_stats_basic_packed *bstats,
struct gnet_stats_rate_est *rate_est); struct gnet_stats_rate_est *rate_est);
extern int gen_replace_estimator(struct gnet_stats_basic *bstats, extern int gen_replace_estimator(struct gnet_stats_basic_packed *bstats,
struct gnet_stats_rate_est *rate_est, struct gnet_stats_rate_est *rate_est,
spinlock_t *stats_lock, struct nlattr *opt); spinlock_t *stats_lock, struct nlattr *opt);
extern bool gen_estimator_active(const struct gnet_stats_basic *bstats, extern bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats,
const struct gnet_stats_rate_est *rate_est); const struct gnet_stats_rate_est *rate_est);
#endif #endif

View file

@ -8,7 +8,7 @@ struct xt_rateest {
spinlock_t lock; spinlock_t lock;
struct gnet_estimator params; struct gnet_estimator params;
struct gnet_stats_rate_est rstats; struct gnet_stats_rate_est rstats;
struct gnet_stats_basic bstats; struct gnet_stats_basic_packed bstats;
}; };
extern struct xt_rateest *xt_rateest_lookup(const char *name); extern struct xt_rateest *xt_rateest_lookup(const char *name);

View file

@ -72,7 +72,7 @@ struct Qdisc
*/ */
unsigned long state; unsigned long state;
struct sk_buff_head q; struct sk_buff_head q;
struct gnet_stats_basic bstats; struct gnet_stats_basic_packed bstats;
struct gnet_stats_queue qstats; struct gnet_stats_queue qstats;
}; };

View file

@ -1238,6 +1238,7 @@ static int atalk_getname(struct socket *sock, struct sockaddr *uaddr,
return -ENOBUFS; return -ENOBUFS;
*uaddr_len = sizeof(struct sockaddr_at); *uaddr_len = sizeof(struct sockaddr_at);
memset(&sat.sat_zero, 0, sizeof(sat.sat_zero));
if (peer) { if (peer) {
if (sk->sk_state != TCP_ESTABLISHED) if (sk->sk_state != TCP_ESTABLISHED)

View file

@ -401,6 +401,7 @@ static int raw_getname(struct socket *sock, struct sockaddr *uaddr,
if (peer) if (peer)
return -EOPNOTSUPP; return -EOPNOTSUPP;
memset(addr, 0, sizeof(*addr));
addr->can_family = AF_CAN; addr->can_family = AF_CAN;
addr->can_ifindex = ro->ifindex; addr->can_ifindex = ro->ifindex;

View file

@ -81,7 +81,7 @@
struct gen_estimator struct gen_estimator
{ {
struct list_head list; struct list_head list;
struct gnet_stats_basic *bstats; struct gnet_stats_basic_packed *bstats;
struct gnet_stats_rate_est *rate_est; struct gnet_stats_rate_est *rate_est;
spinlock_t *stats_lock; spinlock_t *stats_lock;
int ewma_log; int ewma_log;
@ -165,7 +165,7 @@ static void gen_add_node(struct gen_estimator *est)
} }
static static
struct gen_estimator *gen_find_node(const struct gnet_stats_basic *bstats, struct gen_estimator *gen_find_node(const struct gnet_stats_basic_packed *bstats,
const struct gnet_stats_rate_est *rate_est) const struct gnet_stats_rate_est *rate_est)
{ {
struct rb_node *p = est_root.rb_node; struct rb_node *p = est_root.rb_node;
@ -202,7 +202,7 @@ struct gen_estimator *gen_find_node(const struct gnet_stats_basic *bstats,
* *
* NOTE: Called under rtnl_mutex * NOTE: Called under rtnl_mutex
*/ */
int gen_new_estimator(struct gnet_stats_basic *bstats, int gen_new_estimator(struct gnet_stats_basic_packed *bstats,
struct gnet_stats_rate_est *rate_est, struct gnet_stats_rate_est *rate_est,
spinlock_t *stats_lock, spinlock_t *stats_lock,
struct nlattr *opt) struct nlattr *opt)
@ -262,7 +262,7 @@ static void __gen_kill_estimator(struct rcu_head *head)
* *
* NOTE: Called under rtnl_mutex * NOTE: Called under rtnl_mutex
*/ */
void gen_kill_estimator(struct gnet_stats_basic *bstats, void gen_kill_estimator(struct gnet_stats_basic_packed *bstats,
struct gnet_stats_rate_est *rate_est) struct gnet_stats_rate_est *rate_est)
{ {
struct gen_estimator *e; struct gen_estimator *e;
@ -292,7 +292,7 @@ EXPORT_SYMBOL(gen_kill_estimator);
* *
* Returns 0 on success or a negative error code. * Returns 0 on success or a negative error code.
*/ */
int gen_replace_estimator(struct gnet_stats_basic *bstats, int gen_replace_estimator(struct gnet_stats_basic_packed *bstats,
struct gnet_stats_rate_est *rate_est, struct gnet_stats_rate_est *rate_est,
spinlock_t *stats_lock, struct nlattr *opt) spinlock_t *stats_lock, struct nlattr *opt)
{ {
@ -308,7 +308,7 @@ EXPORT_SYMBOL(gen_replace_estimator);
* *
* Returns true if estimator is active, and false if not. * Returns true if estimator is active, and false if not.
*/ */
bool gen_estimator_active(const struct gnet_stats_basic *bstats, bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats,
const struct gnet_stats_rate_est *rate_est) const struct gnet_stats_rate_est *rate_est)
{ {
ASSERT_RTNL(); ASSERT_RTNL();

View file

@ -106,16 +106,21 @@ gnet_stats_start_copy(struct sk_buff *skb, int type, spinlock_t *lock,
* if the room in the socket buffer was not sufficient. * if the room in the socket buffer was not sufficient.
*/ */
int int
gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic *b) gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic_packed *b)
{ {
if (d->compat_tc_stats) { if (d->compat_tc_stats) {
d->tc_stats.bytes = b->bytes; d->tc_stats.bytes = b->bytes;
d->tc_stats.packets = b->packets; d->tc_stats.packets = b->packets;
} }
if (d->tail) if (d->tail) {
return gnet_stats_copy(d, TCA_STATS_BASIC, b, sizeof(*b)); struct gnet_stats_basic sb;
memset(&sb, 0, sizeof(sb));
sb.bytes = b->bytes;
sb.packets = b->packets;
return gnet_stats_copy(d, TCA_STATS_BASIC, &sb, sizeof(sb));
}
return 0; return 0;
} }

View file

@ -1159,6 +1159,7 @@ static void __exit dccp_fini(void)
kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep); kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep);
dccp_ackvec_exit(); dccp_ackvec_exit();
dccp_sysctl_exit(); dccp_sysctl_exit();
percpu_counter_destroy(&dccp_orphan_count);
} }
module_init(dccp_init); module_init(dccp_init);

View file

@ -520,6 +520,7 @@ static int econet_getname(struct socket *sock, struct sockaddr *uaddr,
if (peer) if (peer)
return -EOPNOTSUPP; return -EOPNOTSUPP;
memset(sec, 0, sizeof(*sec));
mutex_lock(&econet_mutex); mutex_lock(&econet_mutex);
sk = sock->sk; sk = sock->sk;

View file

@ -136,7 +136,7 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg,
unsigned int cmd) unsigned int cmd)
{ {
struct ifreq ifr; struct ifreq ifr;
int ret = -EINVAL; int ret = -ENOIOCTLCMD;
struct net_device *dev; struct net_device *dev;
if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
@ -146,8 +146,10 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg,
dev_load(sock_net(sk), ifr.ifr_name); dev_load(sock_net(sk), ifr.ifr_name);
dev = dev_get_by_name(sock_net(sk), ifr.ifr_name); dev = dev_get_by_name(sock_net(sk), ifr.ifr_name);
if (dev->type == ARPHRD_IEEE802154 ||
dev->type == ARPHRD_IEEE802154_PHY) if ((dev->type == ARPHRD_IEEE802154 ||
dev->type == ARPHRD_IEEE802154_PHY) &&
dev->netdev_ops->ndo_do_ioctl)
ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd); ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd);
if (!ret && copy_to_user(arg, &ifr, sizeof(struct ifreq))) if (!ret && copy_to_user(arg, &ifr, sizeof(struct ifreq)))

View file

@ -377,6 +377,18 @@ int ieee802154_dgram_deliver(struct net_device *dev, struct sk_buff *skb)
return ret; return ret;
} }
static int dgram_getsockopt(struct sock *sk, int level, int optname,
char __user *optval, int __user *optlen)
{
return -EOPNOTSUPP;
}
static int dgram_setsockopt(struct sock *sk, int level, int optname,
char __user *optval, int __user optlen)
{
return -EOPNOTSUPP;
}
struct proto ieee802154_dgram_prot = { struct proto ieee802154_dgram_prot = {
.name = "IEEE-802.15.4-MAC", .name = "IEEE-802.15.4-MAC",
.owner = THIS_MODULE, .owner = THIS_MODULE,
@ -391,5 +403,7 @@ struct proto ieee802154_dgram_prot = {
.connect = dgram_connect, .connect = dgram_connect,
.disconnect = dgram_disconnect, .disconnect = dgram_disconnect,
.ioctl = dgram_ioctl, .ioctl = dgram_ioctl,
.getsockopt = dgram_getsockopt,
.setsockopt = dgram_setsockopt,
}; };

View file

@ -238,6 +238,18 @@ void ieee802154_raw_deliver(struct net_device *dev, struct sk_buff *skb)
read_unlock(&raw_lock); read_unlock(&raw_lock);
} }
static int raw_getsockopt(struct sock *sk, int level, int optname,
char __user *optval, int __user *optlen)
{
return -EOPNOTSUPP;
}
static int raw_setsockopt(struct sock *sk, int level, int optname,
char __user *optval, int __user optlen)
{
return -EOPNOTSUPP;
}
struct proto ieee802154_raw_prot = { struct proto ieee802154_raw_prot = {
.name = "IEEE-802.15.4-RAW", .name = "IEEE-802.15.4-RAW",
.owner = THIS_MODULE, .owner = THIS_MODULE,
@ -250,5 +262,7 @@ struct proto ieee802154_raw_prot = {
.unhash = raw_unhash, .unhash = raw_unhash,
.connect = raw_connect, .connect = raw_connect,
.disconnect = raw_disconnect, .disconnect = raw_disconnect,
.getsockopt = raw_getsockopt,
.setsockopt = raw_setsockopt,
}; };

View file

@ -951,7 +951,7 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev)
addend += 4; addend += 4;
} }
dev->needed_headroom = addend + hlen; dev->needed_headroom = addend + hlen;
mtu -= dev->hard_header_len - addend; mtu -= dev->hard_header_len + addend;
if (mtu < 68) if (mtu < 68)
mtu = 68; mtu = 68;

View file

@ -715,6 +715,7 @@ static int irda_getname(struct socket *sock, struct sockaddr *uaddr,
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct irda_sock *self = irda_sk(sk); struct irda_sock *self = irda_sk(sk);
memset(&saddr, 0, sizeof(saddr));
if (peer) { if (peer) {
if (sk->sk_state != TCP_ESTABLISHED) if (sk->sk_state != TCP_ESTABLISHED)
return -ENOTCONN; return -ENOTCONN;

View file

@ -381,6 +381,14 @@ static void ieee80211_agg_splice_packets(struct ieee80211_local *local,
&local->hw, queue, &local->hw, queue,
IEEE80211_QUEUE_STOP_REASON_AGGREGATION); IEEE80211_QUEUE_STOP_REASON_AGGREGATION);
if (!(sta->ampdu_mlme.tid_state_tx[tid] & HT_ADDBA_REQUESTED_MSK))
return;
if (WARN(!sta->ampdu_mlme.tid_tx[tid],
"TID %d gone but expected when splicing aggregates from"
"the pending queue\n", tid))
return;
if (!skb_queue_empty(&sta->ampdu_mlme.tid_tx[tid]->pending)) { if (!skb_queue_empty(&sta->ampdu_mlme.tid_tx[tid]->pending)) {
spin_lock_irqsave(&local->queue_stop_reason_lock, flags); spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
/* mark queue as pending, it is stopped already */ /* mark queue as pending, it is stopped already */

View file

@ -74,7 +74,7 @@ static unsigned int
xt_rateest_tg(struct sk_buff *skb, const struct xt_target_param *par) xt_rateest_tg(struct sk_buff *skb, const struct xt_target_param *par)
{ {
const struct xt_rateest_target_info *info = par->targinfo; const struct xt_rateest_target_info *info = par->targinfo;
struct gnet_stats_basic *stats = &info->est->bstats; struct gnet_stats_basic_packed *stats = &info->est->bstats;
spin_lock_bh(&info->est->lock); spin_lock_bh(&info->est->lock);
stats->bytes += skb->len; stats->bytes += skb->len;

View file

@ -847,6 +847,7 @@ static int nr_getname(struct socket *sock, struct sockaddr *uaddr,
sax->fsa_ax25.sax25_family = AF_NETROM; sax->fsa_ax25.sax25_family = AF_NETROM;
sax->fsa_ax25.sax25_ndigis = 1; sax->fsa_ax25.sax25_ndigis = 1;
sax->fsa_ax25.sax25_call = nr->user_addr; sax->fsa_ax25.sax25_call = nr->user_addr;
memset(sax->fsa_digipeater, 0, sizeof(sax->fsa_digipeater));
sax->fsa_digipeater[0] = nr->dest_addr; sax->fsa_digipeater[0] = nr->dest_addr;
*uaddr_len = sizeof(struct full_sockaddr_ax25); *uaddr_len = sizeof(struct full_sockaddr_ax25);
} else { } else {

View file

@ -630,23 +630,23 @@ out:
return dev; return dev;
} }
static ax25_digi *nr_call_to_digi(int ndigis, ax25_address *digipeaters) static ax25_digi *nr_call_to_digi(ax25_digi *digi, int ndigis,
ax25_address *digipeaters)
{ {
static ax25_digi ax25_digi;
int i; int i;
if (ndigis == 0) if (ndigis == 0)
return NULL; return NULL;
for (i = 0; i < ndigis; i++) { for (i = 0; i < ndigis; i++) {
ax25_digi.calls[i] = digipeaters[i]; digi->calls[i] = digipeaters[i];
ax25_digi.repeated[i] = 0; digi->repeated[i] = 0;
} }
ax25_digi.ndigi = ndigis; digi->ndigi = ndigis;
ax25_digi.lastrepeat = -1; digi->lastrepeat = -1;
return &ax25_digi; return digi;
} }
/* /*
@ -656,6 +656,7 @@ int nr_rt_ioctl(unsigned int cmd, void __user *arg)
{ {
struct nr_route_struct nr_route; struct nr_route_struct nr_route;
struct net_device *dev; struct net_device *dev;
ax25_digi digi;
int ret; int ret;
switch (cmd) { switch (cmd) {
@ -673,13 +674,15 @@ int nr_rt_ioctl(unsigned int cmd, void __user *arg)
ret = nr_add_node(&nr_route.callsign, ret = nr_add_node(&nr_route.callsign,
nr_route.mnemonic, nr_route.mnemonic,
&nr_route.neighbour, &nr_route.neighbour,
nr_call_to_digi(nr_route.ndigis, nr_route.digipeaters), nr_call_to_digi(&digi, nr_route.ndigis,
nr_route.digipeaters),
dev, nr_route.quality, dev, nr_route.quality,
nr_route.obs_count); nr_route.obs_count);
break; break;
case NETROM_NEIGH: case NETROM_NEIGH:
ret = nr_add_neigh(&nr_route.callsign, ret = nr_add_neigh(&nr_route.callsign,
nr_call_to_digi(nr_route.ndigis, nr_route.digipeaters), nr_call_to_digi(&digi, nr_route.ndigis,
nr_route.digipeaters),
dev, nr_route.quality); dev, nr_route.quality);
break; break;
default: default:

View file

@ -96,7 +96,7 @@ struct net_device *phonet_device_get(struct net *net)
{ {
struct phonet_device_list *pndevs = phonet_device_list(net); struct phonet_device_list *pndevs = phonet_device_list(net);
struct phonet_device *pnd; struct phonet_device *pnd;
struct net_device *dev; struct net_device *dev = NULL;
spin_lock_bh(&pndevs->lock); spin_lock_bh(&pndevs->lock);
list_for_each_entry(pnd, &pndevs->list, list) { list_for_each_entry(pnd, &pndevs->list, list) {

View file

@ -954,6 +954,7 @@ static int rose_getname(struct socket *sock, struct sockaddr *uaddr,
struct rose_sock *rose = rose_sk(sk); struct rose_sock *rose = rose_sk(sk);
int n; int n;
memset(srose, 0, sizeof(*srose));
if (peer != 0) { if (peer != 0) {
if (sk->sk_state != TCP_ESTABLISHED) if (sk->sk_state != TCP_ESTABLISHED)
return -ENOTCONN; return -ENOTCONN;

View file

@ -49,7 +49,7 @@ struct atm_flow_data {
struct socket *sock; /* for closing */ struct socket *sock; /* for closing */
u32 classid; /* x:y type ID */ u32 classid; /* x:y type ID */
int ref; /* reference count */ int ref; /* reference count */
struct gnet_stats_basic bstats; struct gnet_stats_basic_packed bstats;
struct gnet_stats_queue qstats; struct gnet_stats_queue qstats;
struct atm_flow_data *next; struct atm_flow_data *next;
struct atm_flow_data *excess; /* flow for excess traffic; struct atm_flow_data *excess; /* flow for excess traffic;

View file

@ -128,7 +128,7 @@ struct cbq_class
long avgidle; long avgidle;
long deficit; /* Saved deficit for WRR */ long deficit; /* Saved deficit for WRR */
psched_time_t penalized; psched_time_t penalized;
struct gnet_stats_basic bstats; struct gnet_stats_basic_packed bstats;
struct gnet_stats_queue qstats; struct gnet_stats_queue qstats;
struct gnet_stats_rate_est rate_est; struct gnet_stats_rate_est rate_est;
struct tc_cbq_xstats xstats; struct tc_cbq_xstats xstats;

View file

@ -22,7 +22,7 @@ struct drr_class {
unsigned int refcnt; unsigned int refcnt;
unsigned int filter_cnt; unsigned int filter_cnt;
struct gnet_stats_basic bstats; struct gnet_stats_basic_packed bstats;
struct gnet_stats_queue qstats; struct gnet_stats_queue qstats;
struct gnet_stats_rate_est rate_est; struct gnet_stats_rate_est rate_est;
struct list_head alist; struct list_head alist;

View file

@ -116,7 +116,7 @@ struct hfsc_class
struct Qdisc_class_common cl_common; struct Qdisc_class_common cl_common;
unsigned int refcnt; /* usage count */ unsigned int refcnt; /* usage count */
struct gnet_stats_basic bstats; struct gnet_stats_basic_packed bstats;
struct gnet_stats_queue qstats; struct gnet_stats_queue qstats;
struct gnet_stats_rate_est rate_est; struct gnet_stats_rate_est rate_est;
unsigned int level; /* class level in hierarchy */ unsigned int level; /* class level in hierarchy */

View file

@ -74,7 +74,7 @@ enum htb_cmode {
struct htb_class { struct htb_class {
struct Qdisc_class_common common; struct Qdisc_class_common common;
/* general class parameters */ /* general class parameters */
struct gnet_stats_basic bstats; struct gnet_stats_basic_packed bstats;
struct gnet_stats_queue qstats; struct gnet_stats_queue qstats;
struct gnet_stats_rate_est rate_est; struct gnet_stats_rate_est rate_est;
struct tc_htb_xstats xstats; /* our special stats */ struct tc_htb_xstats xstats; /* our special stats */

View file

@ -160,6 +160,7 @@ static void sctp_proc_exit(void)
remove_proc_entry("sctp", init_net.proc_net); remove_proc_entry("sctp", init_net.proc_net);
} }
#endif #endif
percpu_counter_destroy(&sctp_sockets_allocated);
} }
/* Private helper to extract ipv4 address and stash them in /* Private helper to extract ipv4 address and stash them in

View file

@ -16,7 +16,7 @@ static inline unsigned int __xfrm6_addr_hash(xfrm_address_t *addr)
static inline unsigned int __xfrm4_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr) static inline unsigned int __xfrm4_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr)
{ {
return ntohl(daddr->a4 ^ saddr->a4); return ntohl(daddr->a4 + saddr->a4);
} }
static inline unsigned int __xfrm6_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr) static inline unsigned int __xfrm6_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr)