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: (35 commits)
  NET: SB1250: Initialize .owner
  vxge: show startup message with KERN_INFO
  ll_temac: Fix missing iounmaps
  bridge: Clear IPCB before possible entry into IP stack
  bridge br_multicast: BUG: unable to handle kernel NULL pointer dereference
  net: Fix definition of netif_vdbg() when VERBOSE_DEBUG is defined
  net/ne: fix memory leak in ne_drv_probe()
  xfrm: fix xfrm by MARK logic
  virtio_net: fix oom handling on tx
  virtio_net: do not reschedule rx refill forever
  s2io: resolve statistics issues
  linux/net.h: fix kernel-doc warnings
  net: decreasing real_num_tx_queues needs to flush qdisc
  sched: qdisc_reset_all_tx is calling qdisc_reset without qdisc_lock
  qlge: fix a eeh handler to not add a pending timer
  qlge: Replacing add_timer() to mod_timer()
  usbnet: Set parent device early for netdev_printk()
  net: Revert "rndis_host: Poll status channel before control channel"
  netfilter: ip6t_REJECT: fix a dst leak in ipv6 REJECT
  drivers: bluetooth: bluecard_cs.c: Fixed include error, changed to linux/io.h
  ...
This commit is contained in:
Linus Torvalds 2010-07-07 19:56:00 -07:00
commit 2aa72f6121
36 changed files with 328 additions and 185 deletions

View File

@ -37,7 +37,7 @@
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <asm/io.h> #include <linux/io.h>
#include <pcmcia/cs_types.h> #include <pcmcia/cs_types.h>
#include <pcmcia/cs.h> #include <pcmcia/cs.h>

View File

@ -244,7 +244,7 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data,
if (rel) { if (rel) {
hdr[0] |= 0x80 + bcsp->msgq_txseq; hdr[0] |= 0x80 + bcsp->msgq_txseq;
BT_DBG("Sending packet with seqno %u", bcsp->msgq_txseq); BT_DBG("Sending packet with seqno %u", bcsp->msgq_txseq);
bcsp->msgq_txseq = ++(bcsp->msgq_txseq) & 0x07; bcsp->msgq_txseq = (bcsp->msgq_txseq + 1) & 0x07;
} }
if (bcsp->use_crc) if (bcsp->use_crc)

View File

@ -340,7 +340,8 @@ static void rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp)
if ((client_info->assigned) && if ((client_info->assigned) &&
(client_info->ip_src == arp->ip_dst) && (client_info->ip_src == arp->ip_dst) &&
(client_info->ip_dst == arp->ip_src)) { (client_info->ip_dst == arp->ip_src) &&
(compare_ether_addr_64bits(client_info->mac_dst, arp->mac_src))) {
/* update the clients MAC address */ /* update the clients MAC address */
memcpy(client_info->mac_dst, arp->mac_src, ETH_ALEN); memcpy(client_info->mac_dst, arp->mac_src, ETH_ALEN);
client_info->ntt = 1; client_info->ntt = 1;

View File

@ -168,7 +168,7 @@ static int arp_ip_count;
static int bond_mode = BOND_MODE_ROUNDROBIN; static int bond_mode = BOND_MODE_ROUNDROBIN;
static int xmit_hashtype = BOND_XMIT_POLICY_LAYER2; static int xmit_hashtype = BOND_XMIT_POLICY_LAYER2;
static int lacp_fast; static int lacp_fast;
static int disable_netpoll = 1;
const struct bond_parm_tbl bond_lacp_tbl[] = { const struct bond_parm_tbl bond_lacp_tbl[] = {
{ "slow", AD_LACP_SLOW}, { "slow", AD_LACP_SLOW},
@ -1742,6 +1742,13 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
bond_set_carrier(bond); bond_set_carrier(bond);
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
/*
* Netpoll and bonding is broken, make sure it is not initialized
* until it is fixed.
*/
if (disable_netpoll) {
bond_dev->priv_flags |= IFF_DISABLE_NETPOLL;
} else {
if (slaves_support_netpoll(bond_dev)) { if (slaves_support_netpoll(bond_dev)) {
bond_dev->priv_flags &= ~IFF_DISABLE_NETPOLL; bond_dev->priv_flags &= ~IFF_DISABLE_NETPOLL;
if (bond_dev->npinfo) if (bond_dev->npinfo)
@ -1752,6 +1759,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
slave_dev->name); slave_dev->name);
pr_info("Disabling netpoll support for %s\n", bond_dev->name); pr_info("Disabling netpoll support for %s\n", bond_dev->name);
} }
}
#endif #endif
read_unlock(&bond->lock); read_unlock(&bond->lock);
@ -1950,6 +1958,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
read_lock_bh(&bond->lock); read_lock_bh(&bond->lock);
/* Make sure netpoll over stays disabled until fixed. */
if (!disable_netpoll)
if (slaves_support_netpoll(bond_dev)) if (slaves_support_netpoll(bond_dev))
bond_dev->priv_flags &= ~IFF_DISABLE_NETPOLL; bond_dev->priv_flags &= ~IFF_DISABLE_NETPOLL;
read_unlock_bh(&bond->lock); read_unlock_bh(&bond->lock);

View File

@ -3684,10 +3684,6 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
/* signal that we are down to the interrupt handler */ /* signal that we are down to the interrupt handler */
set_bit(__IXGBE_DOWN, &adapter->state); set_bit(__IXGBE_DOWN, &adapter->state);
/* power down the optics */
if (hw->phy.multispeed_fiber)
hw->mac.ops.disable_tx_laser(hw);
/* disable receive for all VFs and wait one second */ /* disable receive for all VFs and wait one second */
if (adapter->num_vfs) { if (adapter->num_vfs) {
/* ping all the active vfs to let them know we are going down */ /* ping all the active vfs to let them know we are going down */
@ -3742,6 +3738,10 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
(IXGBE_READ_REG(hw, IXGBE_DMATXCTL) & (IXGBE_READ_REG(hw, IXGBE_DMATXCTL) &
~IXGBE_DMATXCTL_TE)); ~IXGBE_DMATXCTL_TE));
/* power down the optics */
if (hw->phy.multispeed_fiber)
hw->mac.ops.disable_tx_laser(hw);
/* clear n-tuple filters that are cached */ /* clear n-tuple filters that are cached */
ethtool_ntuple_flush(netdev); ethtool_ntuple_flush(netdev);
@ -4001,7 +4001,7 @@ static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter)
done: done:
/* Notify the stack of the (possibly) reduced Tx Queue count. */ /* Notify the stack of the (possibly) reduced Tx Queue count. */
adapter->netdev->real_num_tx_queues = adapter->num_tx_queues; netif_set_real_num_tx_queues(adapter->netdev, adapter->num_tx_queues);
} }
static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter, static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
@ -5195,7 +5195,6 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
ixgbe_free_all_tx_resources(adapter); ixgbe_free_all_tx_resources(adapter);
ixgbe_free_all_rx_resources(adapter); ixgbe_free_all_rx_resources(adapter);
} }
ixgbe_clear_interrupt_scheme(adapter);
#ifdef CONFIG_PM #ifdef CONFIG_PM
retval = pci_save_state(pdev); retval = pci_save_state(pdev);
@ -5230,6 +5229,8 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
*enable_wake = !!wufc; *enable_wake = !!wufc;
ixgbe_clear_interrupt_scheme(adapter);
ixgbe_release_hw_control(adapter); ixgbe_release_hw_control(adapter);
pci_disable_device(pdev); pci_disable_device(pdev);
@ -6023,7 +6024,6 @@ static void ixgbe_tx_queue(struct ixgbe_adapter *adapter,
static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb, static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb,
int queue, u32 tx_flags) int queue, u32 tx_flags)
{ {
/* Right now, we support IPv4 only */
struct ixgbe_atr_input atr_input; struct ixgbe_atr_input atr_input;
struct tcphdr *th; struct tcphdr *th;
struct iphdr *iph = ip_hdr(skb); struct iphdr *iph = ip_hdr(skb);
@ -6032,6 +6032,9 @@ static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb,
u32 src_ipv4_addr, dst_ipv4_addr; u32 src_ipv4_addr, dst_ipv4_addr;
u8 l4type = 0; u8 l4type = 0;
/* Right now, we support IPv4 only */
if (skb->protocol != htons(ETH_P_IP))
return;
/* check if we're UDP or TCP */ /* check if we're UDP or TCP */
if (iph->protocol == IPPROTO_TCP) { if (iph->protocol == IPPROTO_TCP) {
th = tcp_hdr(skb); th = tcp_hdr(skb);

View File

@ -964,7 +964,7 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
np = of_parse_phandle(op->dev.of_node, "llink-connected", 0); np = of_parse_phandle(op->dev.of_node, "llink-connected", 0);
if (!np) { if (!np) {
dev_err(&op->dev, "could not find DMA node\n"); dev_err(&op->dev, "could not find DMA node\n");
goto nodev; goto err_iounmap;
} }
/* Setup the DMA register accesses, could be DCR or memory mapped */ /* Setup the DMA register accesses, could be DCR or memory mapped */
@ -978,7 +978,7 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
dev_dbg(&op->dev, "MEM base: %p\n", lp->sdma_regs); dev_dbg(&op->dev, "MEM base: %p\n", lp->sdma_regs);
} else { } else {
dev_err(&op->dev, "unable to map DMA registers\n"); dev_err(&op->dev, "unable to map DMA registers\n");
goto nodev; goto err_iounmap;
} }
} }
@ -987,7 +987,7 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
if ((lp->rx_irq == NO_IRQ) || (lp->tx_irq == NO_IRQ)) { if ((lp->rx_irq == NO_IRQ) || (lp->tx_irq == NO_IRQ)) {
dev_err(&op->dev, "could not determine irqs\n"); dev_err(&op->dev, "could not determine irqs\n");
rc = -ENOMEM; rc = -ENOMEM;
goto nodev; goto err_iounmap_2;
} }
of_node_put(np); /* Finished with the DMA node; drop the reference */ of_node_put(np); /* Finished with the DMA node; drop the reference */
@ -997,7 +997,7 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
if ((!addr) || (size != 6)) { if ((!addr) || (size != 6)) {
dev_err(&op->dev, "could not find MAC address\n"); dev_err(&op->dev, "could not find MAC address\n");
rc = -ENODEV; rc = -ENODEV;
goto nodev; goto err_iounmap_2;
} }
temac_set_mac_address(ndev, (void *)addr); temac_set_mac_address(ndev, (void *)addr);
@ -1013,7 +1013,7 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
rc = sysfs_create_group(&lp->dev->kobj, &temac_attr_group); rc = sysfs_create_group(&lp->dev->kobj, &temac_attr_group);
if (rc) { if (rc) {
dev_err(lp->dev, "Error creating sysfs files\n"); dev_err(lp->dev, "Error creating sysfs files\n");
goto nodev; goto err_iounmap_2;
} }
rc = register_netdev(lp->ndev); rc = register_netdev(lp->ndev);
@ -1026,6 +1026,11 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
err_register_ndev: err_register_ndev:
sysfs_remove_group(&lp->dev->kobj, &temac_attr_group); sysfs_remove_group(&lp->dev->kobj, &temac_attr_group);
err_iounmap_2:
if (lp->sdma_regs)
iounmap(lp->sdma_regs);
err_iounmap:
iounmap(lp->regs);
nodev: nodev:
free_netdev(ndev); free_netdev(ndev);
ndev = NULL; ndev = NULL;
@ -1044,6 +1049,9 @@ static int __devexit temac_of_remove(struct of_device *op)
of_node_put(lp->phy_node); of_node_put(lp->phy_node);
lp->phy_node = NULL; lp->phy_node = NULL;
dev_set_drvdata(&op->dev, NULL); dev_set_drvdata(&op->dev, NULL);
iounmap(lp->regs);
if (lp->sdma_regs)
iounmap(lp->sdma_regs);
free_netdev(ndev); free_netdev(ndev);
return 0; return 0;
} }

View File

@ -289,6 +289,7 @@ struct mv643xx_eth_shared_private {
unsigned int t_clk; unsigned int t_clk;
int extended_rx_coal_limit; int extended_rx_coal_limit;
int tx_bw_control; int tx_bw_control;
int tx_csum_limit;
}; };
#define TX_BW_CONTROL_ABSENT 0 #define TX_BW_CONTROL_ABSENT 0
@ -776,13 +777,16 @@ static int txq_submit_skb(struct tx_queue *txq, struct sk_buff *skb)
l4i_chk = 0; l4i_chk = 0;
if (skb->ip_summed == CHECKSUM_PARTIAL) { if (skb->ip_summed == CHECKSUM_PARTIAL) {
int hdr_len;
int tag_bytes; int tag_bytes;
BUG_ON(skb->protocol != htons(ETH_P_IP) && BUG_ON(skb->protocol != htons(ETH_P_IP) &&
skb->protocol != htons(ETH_P_8021Q)); skb->protocol != htons(ETH_P_8021Q));
tag_bytes = (void *)ip_hdr(skb) - (void *)skb->data - ETH_HLEN; hdr_len = (void *)ip_hdr(skb) - (void *)skb->data;
if (unlikely(tag_bytes & ~12)) { tag_bytes = hdr_len - ETH_HLEN;
if (skb->len - hdr_len > mp->shared->tx_csum_limit ||
unlikely(tag_bytes & ~12)) {
if (skb_checksum_help(skb) == 0) if (skb_checksum_help(skb) == 0)
goto no_csum; goto no_csum;
kfree_skb(skb); kfree_skb(skb);
@ -2666,6 +2670,7 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
* Detect hardware parameters. * Detect hardware parameters.
*/ */
msp->t_clk = (pd != NULL && pd->t_clk != 0) ? pd->t_clk : 133000000; msp->t_clk = (pd != NULL && pd->t_clk != 0) ? pd->t_clk : 133000000;
msp->tx_csum_limit = pd->tx_csum_limit ? pd->tx_csum_limit : 9 * 1024;
infer_hw_params(msp); infer_hw_params(msp);
platform_set_drvdata(pdev, msp); platform_set_drvdata(pdev, msp);

View File

@ -806,8 +806,10 @@ static int __init ne_drv_probe(struct platform_device *pdev)
dev->base_addr = res->start; dev->base_addr = res->start;
dev->irq = platform_get_irq(pdev, 0); dev->irq = platform_get_irq(pdev, 0);
} else { } else {
if (this_dev < 0 || this_dev >= MAX_NE_CARDS) if (this_dev < 0 || this_dev >= MAX_NE_CARDS) {
free_netdev(dev);
return -EINVAL; return -EINVAL;
}
dev->base_addr = io[this_dev]; dev->base_addr = io[this_dev];
dev->irq = irq[this_dev]; dev->irq = irq[this_dev];
dev->mem_end = bad[this_dev]; dev->mem_end = bad[this_dev];

View File

@ -4611,8 +4611,7 @@ static void ql_timer(unsigned long data)
return; return;
} }
qdev->timer.expires = jiffies + (5*HZ); mod_timer(&qdev->timer, jiffies + (5*HZ));
add_timer(&qdev->timer);
} }
static int __devinit qlge_probe(struct pci_dev *pdev, static int __devinit qlge_probe(struct pci_dev *pdev,
@ -4713,6 +4712,8 @@ static void ql_eeh_close(struct net_device *ndev)
netif_stop_queue(ndev); netif_stop_queue(ndev);
} }
/* Disabling the timer */
del_timer_sync(&qdev->timer);
if (test_bit(QL_ADAPTER_UP, &qdev->flags)) if (test_bit(QL_ADAPTER_UP, &qdev->flags))
cancel_delayed_work_sync(&qdev->asic_reset_work); cancel_delayed_work_sync(&qdev->asic_reset_work);
cancel_delayed_work_sync(&qdev->mpi_reset_work); cancel_delayed_work_sync(&qdev->mpi_reset_work);
@ -4808,8 +4809,7 @@ static void qlge_io_resume(struct pci_dev *pdev)
netif_err(qdev, ifup, qdev->ndev, netif_err(qdev, ifup, qdev->ndev,
"Device was not running prior to EEH.\n"); "Device was not running prior to EEH.\n");
} }
qdev->timer.expires = jiffies + (5*HZ); mod_timer(&qdev->timer, jiffies + (5*HZ));
add_timer(&qdev->timer);
netif_device_attach(ndev); netif_device_attach(ndev);
} }
@ -4871,8 +4871,7 @@ static int qlge_resume(struct pci_dev *pdev)
return err; return err;
} }
qdev->timer.expires = jiffies + (5*HZ); mod_timer(&qdev->timer, jiffies + (5*HZ));
add_timer(&qdev->timer);
netif_device_attach(ndev); netif_device_attach(ndev);
return 0; return 0;

View File

@ -3130,7 +3130,6 @@ static void tx_intr_handler(struct fifo_info *fifo_data)
pkt_cnt++; pkt_cnt++;
/* Updating the statistics block */ /* Updating the statistics block */
nic->dev->stats.tx_bytes += skb->len;
swstats->mem_freed += skb->truesize; swstats->mem_freed += skb->truesize;
dev_kfree_skb_irq(skb); dev_kfree_skb_irq(skb);
@ -4901,48 +4900,81 @@ static void s2io_updt_stats(struct s2io_nic *sp)
* Return value: * Return value:
* pointer to the updated net_device_stats structure. * pointer to the updated net_device_stats structure.
*/ */
static struct net_device_stats *s2io_get_stats(struct net_device *dev) static struct net_device_stats *s2io_get_stats(struct net_device *dev)
{ {
struct s2io_nic *sp = netdev_priv(dev); struct s2io_nic *sp = netdev_priv(dev);
struct config_param *config = &sp->config;
struct mac_info *mac_control = &sp->mac_control; struct mac_info *mac_control = &sp->mac_control;
struct stat_block *stats = mac_control->stats_info; struct stat_block *stats = mac_control->stats_info;
int i; u64 delta;
/* Configure Stats for immediate updt */ /* Configure Stats for immediate updt */
s2io_updt_stats(sp); s2io_updt_stats(sp);
/* Using sp->stats as a staging area, because reset (due to mtu /* A device reset will cause the on-adapter statistics to be zero'ed.
change, for example) will clear some hardware counters */ * This can be done while running by changing the MTU. To prevent the
dev->stats.tx_packets += le32_to_cpu(stats->tmac_frms) - * system from having the stats zero'ed, the driver keeps a copy of the
sp->stats.tx_packets; * last update to the system (which is also zero'ed on reset). This
sp->stats.tx_packets = le32_to_cpu(stats->tmac_frms); * enables the driver to accurately know the delta between the last
* update and the current update.
*/
delta = ((u64) le32_to_cpu(stats->rmac_vld_frms_oflow) << 32 |
le32_to_cpu(stats->rmac_vld_frms)) - sp->stats.rx_packets;
sp->stats.rx_packets += delta;
dev->stats.rx_packets += delta;
dev->stats.tx_errors += le32_to_cpu(stats->tmac_any_err_frms) - delta = ((u64) le32_to_cpu(stats->tmac_frms_oflow) << 32 |
sp->stats.tx_errors; le32_to_cpu(stats->tmac_frms)) - sp->stats.tx_packets;
sp->stats.tx_errors = le32_to_cpu(stats->tmac_any_err_frms); sp->stats.tx_packets += delta;
dev->stats.tx_packets += delta;
dev->stats.rx_errors += le64_to_cpu(stats->rmac_drop_frms) - delta = ((u64) le32_to_cpu(stats->rmac_data_octets_oflow) << 32 |
sp->stats.rx_errors; le32_to_cpu(stats->rmac_data_octets)) - sp->stats.rx_bytes;
sp->stats.rx_errors = le64_to_cpu(stats->rmac_drop_frms); sp->stats.rx_bytes += delta;
dev->stats.rx_bytes += delta;
dev->stats.multicast = le32_to_cpu(stats->rmac_vld_mcst_frms) - delta = ((u64) le32_to_cpu(stats->tmac_data_octets_oflow) << 32 |
sp->stats.multicast; le32_to_cpu(stats->tmac_data_octets)) - sp->stats.tx_bytes;
sp->stats.multicast = le32_to_cpu(stats->rmac_vld_mcst_frms); sp->stats.tx_bytes += delta;
dev->stats.tx_bytes += delta;
dev->stats.rx_length_errors = le64_to_cpu(stats->rmac_long_frms) - delta = le64_to_cpu(stats->rmac_drop_frms) - sp->stats.rx_errors;
sp->stats.rx_length_errors; sp->stats.rx_errors += delta;
sp->stats.rx_length_errors = le64_to_cpu(stats->rmac_long_frms); dev->stats.rx_errors += delta;
/* collect per-ring rx_packets and rx_bytes */ delta = ((u64) le32_to_cpu(stats->tmac_any_err_frms_oflow) << 32 |
dev->stats.rx_packets = dev->stats.rx_bytes = 0; le32_to_cpu(stats->tmac_any_err_frms)) - sp->stats.tx_errors;
for (i = 0; i < config->rx_ring_num; i++) { sp->stats.tx_errors += delta;
struct ring_info *ring = &mac_control->rings[i]; dev->stats.tx_errors += delta;
dev->stats.rx_packets += ring->rx_packets; delta = le64_to_cpu(stats->rmac_drop_frms) - sp->stats.rx_dropped;
dev->stats.rx_bytes += ring->rx_bytes; sp->stats.rx_dropped += delta;
} dev->stats.rx_dropped += delta;
delta = le64_to_cpu(stats->tmac_drop_frms) - sp->stats.tx_dropped;
sp->stats.tx_dropped += delta;
dev->stats.tx_dropped += delta;
/* The adapter MAC interprets pause frames as multicast packets, but
* does not pass them up. This erroneously increases the multicast
* packet count and needs to be deducted when the multicast frame count
* is queried.
*/
delta = (u64) le32_to_cpu(stats->rmac_vld_mcst_frms_oflow) << 32 |
le32_to_cpu(stats->rmac_vld_mcst_frms);
delta -= le64_to_cpu(stats->rmac_pause_ctrl_frms);
delta -= sp->stats.multicast;
sp->stats.multicast += delta;
dev->stats.multicast += delta;
delta = ((u64) le32_to_cpu(stats->rmac_usized_frms_oflow) << 32 |
le32_to_cpu(stats->rmac_usized_frms)) +
le64_to_cpu(stats->rmac_long_frms) - sp->stats.rx_length_errors;
sp->stats.rx_length_errors += delta;
dev->stats.rx_length_errors += delta;
delta = le64_to_cpu(stats->rmac_fcs_err_frms) - sp->stats.rx_crc_errors;
sp->stats.rx_crc_errors += delta;
dev->stats.rx_crc_errors += delta;
return &dev->stats; return &dev->stats;
} }
@ -7455,15 +7487,11 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
} }
} }
/* Updating statistics */
ring_data->rx_packets++;
rxdp->Host_Control = 0; rxdp->Host_Control = 0;
if (sp->rxd_mode == RXD_MODE_1) { if (sp->rxd_mode == RXD_MODE_1) {
int len = RXD_GET_BUFFER0_SIZE_1(rxdp->Control_2); int len = RXD_GET_BUFFER0_SIZE_1(rxdp->Control_2);
ring_data->rx_bytes += len;
skb_put(skb, len); skb_put(skb, len);
} else if (sp->rxd_mode == RXD_MODE_3B) { } else if (sp->rxd_mode == RXD_MODE_3B) {
int get_block = ring_data->rx_curr_get_info.block_index; int get_block = ring_data->rx_curr_get_info.block_index;
int get_off = ring_data->rx_curr_get_info.offset; int get_off = ring_data->rx_curr_get_info.offset;
@ -7472,7 +7500,6 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
unsigned char *buff = skb_push(skb, buf0_len); unsigned char *buff = skb_push(skb, buf0_len);
struct buffAdd *ba = &ring_data->ba[get_block][get_off]; struct buffAdd *ba = &ring_data->ba[get_block][get_off];
ring_data->rx_bytes += buf0_len + buf2_len;
memcpy(buff, ba->ba_0, buf0_len); memcpy(buff, ba->ba_0, buf0_len);
skb_put(skb, buf2_len); skb_put(skb, buf2_len);
} }

View File

@ -745,10 +745,6 @@ struct ring_info {
/* Buffer Address store. */ /* Buffer Address store. */
struct buffAdd **ba; struct buffAdd **ba;
/* per-Ring statistics */
unsigned long rx_packets;
unsigned long rx_bytes;
} ____cacheline_aligned; } ____cacheline_aligned;
/* Fifo specific structure */ /* Fifo specific structure */

View File

@ -2671,6 +2671,7 @@ static struct platform_driver sbmac_driver = {
.remove = __exit_p(sbmac_remove), .remove = __exit_p(sbmac_remove),
.driver = { .driver = {
.name = sbmac_string, .name = sbmac_string,
.owner = THIS_MODULE,
}, },
}; };

View File

@ -104,10 +104,8 @@ static void rndis_msg_indicate(struct usbnet *dev, struct rndis_indicate *msg,
int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen) int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen)
{ {
struct cdc_state *info = (void *) &dev->data; struct cdc_state *info = (void *) &dev->data;
struct usb_cdc_notification notification;
int master_ifnum; int master_ifnum;
int retval; int retval;
int partial;
unsigned count; unsigned count;
__le32 rsp; __le32 rsp;
u32 xid = 0, msg_len, request_id; u32 xid = 0, msg_len, request_id;
@ -135,17 +133,13 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen)
if (unlikely(retval < 0 || xid == 0)) if (unlikely(retval < 0 || xid == 0))
return retval; return retval;
/* Some devices don't respond on the control channel until // FIXME Seems like some devices discard responses when
* polled on the status channel, so do that first. */ // we time out and cancel our "get response" requests...
retval = usb_interrupt_msg( // so, this is fragile. Probably need to poll for status.
dev->udev,
usb_rcvintpipe(dev->udev, dev->status->desc.bEndpointAddress),
&notification, sizeof(notification), &partial,
RNDIS_CONTROL_TIMEOUT_MS);
if (unlikely(retval < 0))
return retval;
/* Poll the control channel; the request probably completed immediately */ /* ignore status endpoint, just poll the control channel;
* the request probably completed immediately
*/
rsp = buf->msg_type | RNDIS_MSG_COMPLETION; rsp = buf->msg_type | RNDIS_MSG_COMPLETION;
for (count = 0; count < 10; count++) { for (count = 0; count < 10; count++) {
memset(buf, 0, CONTROL_BUFFER_SIZE); memset(buf, 0, CONTROL_BUFFER_SIZE);

View File

@ -1293,6 +1293,9 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
goto out; goto out;
} }
/* netdev_printk() needs this so do it as early as possible */
SET_NETDEV_DEV(net, &udev->dev);
dev = netdev_priv(net); dev = netdev_priv(net);
dev->udev = xdev; dev->udev = xdev;
dev->intf = udev; dev->intf = udev;
@ -1377,8 +1380,6 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
dev->rx_urb_size = dev->hard_mtu; dev->rx_urb_size = dev->hard_mtu;
dev->maxpacket = usb_maxpacket (dev->udev, dev->out, 1); dev->maxpacket = usb_maxpacket (dev->udev, dev->out, 1);
SET_NETDEV_DEV(net, &udev->dev);
if ((dev->driver_info->flags & FLAG_WLAN) != 0) if ((dev->driver_info->flags & FLAG_WLAN) != 0)
SET_NETDEV_DEVTYPE(net, &wlan_type); SET_NETDEV_DEVTYPE(net, &wlan_type);
if ((dev->driver_info->flags & FLAG_WWAN) != 0) if ((dev->driver_info->flags & FLAG_WWAN) != 0)

View File

@ -415,7 +415,7 @@ static int add_recvbuf_mergeable(struct virtnet_info *vi, gfp_t gfp)
static bool try_fill_recv(struct virtnet_info *vi, gfp_t gfp) static bool try_fill_recv(struct virtnet_info *vi, gfp_t gfp)
{ {
int err; int err;
bool oom = false; bool oom;
do { do {
if (vi->mergeable_rx_bufs) if (vi->mergeable_rx_bufs)
@ -425,10 +425,9 @@ static bool try_fill_recv(struct virtnet_info *vi, gfp_t gfp)
else else
err = add_recvbuf_small(vi, gfp); err = add_recvbuf_small(vi, gfp);
if (err < 0) { oom = err == -ENOMEM;
oom = true; if (err < 0)
break; break;
}
++vi->num; ++vi->num;
} while (err > 0); } while (err > 0);
if (unlikely(vi->num > vi->max)) if (unlikely(vi->num > vi->max))
@ -563,7 +562,6 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
struct virtnet_info *vi = netdev_priv(dev); struct virtnet_info *vi = netdev_priv(dev);
int capacity; int capacity;
again:
/* Free up any pending old buffers before queueing new ones. */ /* Free up any pending old buffers before queueing new ones. */
free_old_xmit_skbs(vi); free_old_xmit_skbs(vi);
@ -572,14 +570,20 @@ again:
/* This can happen with OOM and indirect buffers. */ /* This can happen with OOM and indirect buffers. */
if (unlikely(capacity < 0)) { if (unlikely(capacity < 0)) {
netif_stop_queue(dev); if (net_ratelimit()) {
dev_warn(&dev->dev, "Unexpected full queue\n"); if (likely(capacity == -ENOMEM)) {
if (unlikely(!virtqueue_enable_cb(vi->svq))) { dev_warn(&dev->dev,
virtqueue_disable_cb(vi->svq); "TX queue failure: out of memory\n");
netif_start_queue(dev); } else {
goto again; dev->stats.tx_fifo_errors++;
dev_warn(&dev->dev,
"Unexpected TX queue failure: %d\n",
capacity);
} }
return NETDEV_TX_BUSY; }
dev->stats.tx_dropped++;
kfree_skb(skb);
return NETDEV_TX_OK;
} }
virtqueue_kick(vi->svq); virtqueue_kick(vi->svq);

View File

@ -4517,9 +4517,9 @@ vxge_starter(void)
char version[32]; char version[32];
snprintf(version, 32, "%s", DRV_VERSION); snprintf(version, 32, "%s", DRV_VERSION);
printk(KERN_CRIT "%s: Copyright(c) 2002-2009 Neterion Inc\n", printk(KERN_INFO "%s: Copyright(c) 2002-2009 Neterion Inc\n",
VXGE_DRIVER_NAME); VXGE_DRIVER_NAME);
printk(KERN_CRIT "%s: Driver version: %s\n", printk(KERN_INFO "%s: Driver version: %s\n",
VXGE_DRIVER_NAME, version); VXGE_DRIVER_NAME, version);
verify_bandwidth(); verify_bandwidth();

View File

@ -445,6 +445,7 @@ void ath_deinit_leds(struct ath_softc *sc);
#define SC_OP_TSF_RESET BIT(11) #define SC_OP_TSF_RESET BIT(11)
#define SC_OP_BT_PRIORITY_DETECTED BIT(12) #define SC_OP_BT_PRIORITY_DETECTED BIT(12)
#define SC_OP_BT_SCAN BIT(13) #define SC_OP_BT_SCAN BIT(13)
#define SC_OP_ANI_RUN BIT(14)
/* Powersave flags */ /* Powersave flags */
#define PS_WAIT_FOR_BEACON BIT(0) #define PS_WAIT_FOR_BEACON BIT(0)

View File

@ -336,6 +336,10 @@ set_timer:
static void ath_start_ani(struct ath_common *common) static void ath_start_ani(struct ath_common *common)
{ {
unsigned long timestamp = jiffies_to_msecs(jiffies); unsigned long timestamp = jiffies_to_msecs(jiffies);
struct ath_softc *sc = (struct ath_softc *) common->priv;
if (!(sc->sc_flags & SC_OP_ANI_RUN))
return;
common->ani.longcal_timer = timestamp; common->ani.longcal_timer = timestamp;
common->ani.shortcal_timer = timestamp; common->ani.shortcal_timer = timestamp;
@ -872,11 +876,13 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
/* Reset rssi stats */ /* Reset rssi stats */
sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER; sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER;
sc->sc_flags |= SC_OP_ANI_RUN;
ath_start_ani(common); ath_start_ani(common);
} else { } else {
ath_print(common, ATH_DBG_CONFIG, "Bss Info DISASSOC\n"); ath_print(common, ATH_DBG_CONFIG, "Bss Info DISASSOC\n");
common->curaid = 0; common->curaid = 0;
/* Stop ANI */ /* Stop ANI */
sc->sc_flags &= ~SC_OP_ANI_RUN;
del_timer_sync(&common->ani.timer); del_timer_sync(&common->ani.timer);
} }
} }
@ -1478,8 +1484,10 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
if (vif->type == NL80211_IFTYPE_AP || if (vif->type == NL80211_IFTYPE_AP ||
vif->type == NL80211_IFTYPE_ADHOC || vif->type == NL80211_IFTYPE_ADHOC ||
vif->type == NL80211_IFTYPE_MONITOR) vif->type == NL80211_IFTYPE_MONITOR) {
sc->sc_flags |= SC_OP_ANI_RUN;
ath_start_ani(common); ath_start_ani(common);
}
out: out:
mutex_unlock(&sc->mutex); mutex_unlock(&sc->mutex);
@ -1500,6 +1508,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
mutex_lock(&sc->mutex); mutex_lock(&sc->mutex);
/* Stop ANI */ /* Stop ANI */
sc->sc_flags &= ~SC_OP_ANI_RUN;
del_timer_sync(&common->ani.timer); del_timer_sync(&common->ani.timer);
/* Reclaim beacon resources */ /* Reclaim beacon resources */

View File

@ -212,11 +212,7 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv)
static void iwlagn_rts_tx_cmd_flag(struct ieee80211_tx_info *info, static void iwlagn_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
__le32 *tx_flags) __le32 *tx_flags)
{ {
if ((info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) ||
(info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT))
*tx_flags |= TX_CMD_FLG_RTS_CTS_MSK; *tx_flags |= TX_CMD_FLG_RTS_CTS_MSK;
else
*tx_flags &= ~TX_CMD_FLG_RTS_CTS_MSK;
} }
/* Calc max signal level (dBm) among 3 possible receivers */ /* Calc max signal level (dBm) among 3 possible receivers */

View File

@ -1314,7 +1314,6 @@ void iwl_configure_filter(struct ieee80211_hw *hw,
changed_flags, *total_flags); changed_flags, *total_flags);
CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK);
CHK(FIF_ALLMULTI, RXON_FILTER_ACCEPT_GRP_MSK);
CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK); CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK);
CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK); CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK);
@ -1329,6 +1328,12 @@ void iwl_configure_filter(struct ieee80211_hw *hw,
mutex_unlock(&priv->mutex); mutex_unlock(&priv->mutex);
/*
* Receiving all multicast frames is always enabled by the
* default flags setup in iwl_connection_init_rx_config()
* since we currently do not support programming multicast
* filters into the device.
*/
*total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS |
FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL;
} }

View File

@ -98,7 +98,8 @@ static void tx_poll_start(struct vhost_net *net, struct socket *sock)
static void handle_tx(struct vhost_net *net) static void handle_tx(struct vhost_net *net)
{ {
struct vhost_virtqueue *vq = &net->dev.vqs[VHOST_NET_VQ_TX]; struct vhost_virtqueue *vq = &net->dev.vqs[VHOST_NET_VQ_TX];
unsigned head, out, in, s; unsigned out, in, s;
int head;
struct msghdr msg = { struct msghdr msg = {
.msg_name = NULL, .msg_name = NULL,
.msg_namelen = 0, .msg_namelen = 0,
@ -135,6 +136,9 @@ static void handle_tx(struct vhost_net *net)
ARRAY_SIZE(vq->iov), ARRAY_SIZE(vq->iov),
&out, &in, &out, &in,
NULL, NULL); NULL, NULL);
/* On error, stop handling until the next kick. */
if (unlikely(head < 0))
break;
/* Nothing new? Wait for eventfd to tell us they refilled. */ /* Nothing new? Wait for eventfd to tell us they refilled. */
if (head == vq->num) { if (head == vq->num) {
wmem = atomic_read(&sock->sk->sk_wmem_alloc); wmem = atomic_read(&sock->sk->sk_wmem_alloc);
@ -192,7 +196,8 @@ static void handle_tx(struct vhost_net *net)
static void handle_rx(struct vhost_net *net) static void handle_rx(struct vhost_net *net)
{ {
struct vhost_virtqueue *vq = &net->dev.vqs[VHOST_NET_VQ_RX]; struct vhost_virtqueue *vq = &net->dev.vqs[VHOST_NET_VQ_RX];
unsigned head, out, in, log, s; unsigned out, in, log, s;
int head;
struct vhost_log *vq_log; struct vhost_log *vq_log;
struct msghdr msg = { struct msghdr msg = {
.msg_name = NULL, .msg_name = NULL,
@ -228,6 +233,9 @@ static void handle_rx(struct vhost_net *net)
ARRAY_SIZE(vq->iov), ARRAY_SIZE(vq->iov),
&out, &in, &out, &in,
vq_log, &log); vq_log, &log);
/* On error, stop handling until the next kick. */
if (unlikely(head < 0))
break;
/* OK, now we need to know about added descriptors. */ /* OK, now we need to know about added descriptors. */
if (head == vq->num) { if (head == vq->num) {
if (unlikely(vhost_enable_notify(vq))) { if (unlikely(vhost_enable_notify(vq))) {

View File

@ -736,12 +736,12 @@ static int translate_desc(struct vhost_dev *dev, u64 addr, u32 len,
mem = rcu_dereference(dev->memory); mem = rcu_dereference(dev->memory);
while ((u64)len > s) { while ((u64)len > s) {
u64 size; u64 size;
if (ret >= iov_size) { if (unlikely(ret >= iov_size)) {
ret = -ENOBUFS; ret = -ENOBUFS;
break; break;
} }
reg = find_region(mem, addr, len); reg = find_region(mem, addr, len);
if (!reg) { if (unlikely(!reg)) {
ret = -EFAULT; ret = -EFAULT;
break; break;
} }
@ -780,7 +780,7 @@ static unsigned next_desc(struct vring_desc *desc)
return next; return next;
} }
static unsigned get_indirect(struct vhost_dev *dev, struct vhost_virtqueue *vq, static int get_indirect(struct vhost_dev *dev, struct vhost_virtqueue *vq,
struct iovec iov[], unsigned int iov_size, struct iovec iov[], unsigned int iov_size,
unsigned int *out_num, unsigned int *in_num, unsigned int *out_num, unsigned int *in_num,
struct vhost_log *log, unsigned int *log_num, struct vhost_log *log, unsigned int *log_num,
@ -791,7 +791,7 @@ static unsigned get_indirect(struct vhost_dev *dev, struct vhost_virtqueue *vq,
int ret; int ret;
/* Sanity check */ /* Sanity check */
if (indirect->len % sizeof desc) { if (unlikely(indirect->len % sizeof desc)) {
vq_err(vq, "Invalid length in indirect descriptor: " vq_err(vq, "Invalid length in indirect descriptor: "
"len 0x%llx not multiple of 0x%zx\n", "len 0x%llx not multiple of 0x%zx\n",
(unsigned long long)indirect->len, (unsigned long long)indirect->len,
@ -801,7 +801,7 @@ static unsigned get_indirect(struct vhost_dev *dev, struct vhost_virtqueue *vq,
ret = translate_desc(dev, indirect->addr, indirect->len, vq->indirect, ret = translate_desc(dev, indirect->addr, indirect->len, vq->indirect,
ARRAY_SIZE(vq->indirect)); ARRAY_SIZE(vq->indirect));
if (ret < 0) { if (unlikely(ret < 0)) {
vq_err(vq, "Translation failure %d in indirect.\n", ret); vq_err(vq, "Translation failure %d in indirect.\n", ret);
return ret; return ret;
} }
@ -813,7 +813,7 @@ static unsigned get_indirect(struct vhost_dev *dev, struct vhost_virtqueue *vq,
count = indirect->len / sizeof desc; count = indirect->len / sizeof desc;
/* Buffers are chained via a 16 bit next field, so /* Buffers are chained via a 16 bit next field, so
* we can have at most 2^16 of these. */ * we can have at most 2^16 of these. */
if (count > USHRT_MAX + 1) { if (unlikely(count > USHRT_MAX + 1)) {
vq_err(vq, "Indirect buffer length too big: %d\n", vq_err(vq, "Indirect buffer length too big: %d\n",
indirect->len); indirect->len);
return -E2BIG; return -E2BIG;
@ -821,19 +821,19 @@ static unsigned get_indirect(struct vhost_dev *dev, struct vhost_virtqueue *vq,
do { do {
unsigned iov_count = *in_num + *out_num; unsigned iov_count = *in_num + *out_num;
if (++found > count) { if (unlikely(++found > count)) {
vq_err(vq, "Loop detected: last one at %u " vq_err(vq, "Loop detected: last one at %u "
"indirect size %u\n", "indirect size %u\n",
i, count); i, count);
return -EINVAL; return -EINVAL;
} }
if (memcpy_fromiovec((unsigned char *)&desc, vq->indirect, if (unlikely(memcpy_fromiovec((unsigned char *)&desc, vq->indirect,
sizeof desc)) { sizeof desc))) {
vq_err(vq, "Failed indirect descriptor: idx %d, %zx\n", vq_err(vq, "Failed indirect descriptor: idx %d, %zx\n",
i, (size_t)indirect->addr + i * sizeof desc); i, (size_t)indirect->addr + i * sizeof desc);
return -EINVAL; return -EINVAL;
} }
if (desc.flags & VRING_DESC_F_INDIRECT) { if (unlikely(desc.flags & VRING_DESC_F_INDIRECT)) {
vq_err(vq, "Nested indirect descriptor: idx %d, %zx\n", vq_err(vq, "Nested indirect descriptor: idx %d, %zx\n",
i, (size_t)indirect->addr + i * sizeof desc); i, (size_t)indirect->addr + i * sizeof desc);
return -EINVAL; return -EINVAL;
@ -841,7 +841,7 @@ static unsigned get_indirect(struct vhost_dev *dev, struct vhost_virtqueue *vq,
ret = translate_desc(dev, desc.addr, desc.len, iov + iov_count, ret = translate_desc(dev, desc.addr, desc.len, iov + iov_count,
iov_size - iov_count); iov_size - iov_count);
if (ret < 0) { if (unlikely(ret < 0)) {
vq_err(vq, "Translation failure %d indirect idx %d\n", vq_err(vq, "Translation failure %d indirect idx %d\n",
ret, i); ret, i);
return ret; return ret;
@ -857,7 +857,7 @@ static unsigned get_indirect(struct vhost_dev *dev, struct vhost_virtqueue *vq,
} else { } else {
/* If it's an output descriptor, they're all supposed /* If it's an output descriptor, they're all supposed
* to come before any input descriptors. */ * to come before any input descriptors. */
if (*in_num) { if (unlikely(*in_num)) {
vq_err(vq, "Indirect descriptor " vq_err(vq, "Indirect descriptor "
"has out after in: idx %d\n", i); "has out after in: idx %d\n", i);
return -EINVAL; return -EINVAL;
@ -873,9 +873,10 @@ static unsigned get_indirect(struct vhost_dev *dev, struct vhost_virtqueue *vq,
* number of output then some number of input descriptors, it's actually two * number of output then some number of input descriptors, it's actually two
* iovecs, but we pack them into one and note how many of each there were. * iovecs, but we pack them into one and note how many of each there were.
* *
* This function returns the descriptor number found, or vq->num (which * This function returns the descriptor number found, or vq->num (which is
* is never a valid descriptor number) if none was found. */ * never a valid descriptor number) if none was found. A negative code is
unsigned vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq, * returned on error. */
int vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq,
struct iovec iov[], unsigned int iov_size, struct iovec iov[], unsigned int iov_size,
unsigned int *out_num, unsigned int *in_num, unsigned int *out_num, unsigned int *in_num,
struct vhost_log *log, unsigned int *log_num) struct vhost_log *log, unsigned int *log_num)
@ -887,16 +888,16 @@ unsigned vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq,
/* Check it isn't doing very strange things with descriptor numbers. */ /* Check it isn't doing very strange things with descriptor numbers. */
last_avail_idx = vq->last_avail_idx; last_avail_idx = vq->last_avail_idx;
if (get_user(vq->avail_idx, &vq->avail->idx)) { if (unlikely(get_user(vq->avail_idx, &vq->avail->idx))) {
vq_err(vq, "Failed to access avail idx at %p\n", vq_err(vq, "Failed to access avail idx at %p\n",
&vq->avail->idx); &vq->avail->idx);
return vq->num; return -EFAULT;
} }
if ((u16)(vq->avail_idx - last_avail_idx) > vq->num) { if (unlikely((u16)(vq->avail_idx - last_avail_idx) > vq->num)) {
vq_err(vq, "Guest moved used index from %u to %u", vq_err(vq, "Guest moved used index from %u to %u",
last_avail_idx, vq->avail_idx); last_avail_idx, vq->avail_idx);
return vq->num; return -EFAULT;
} }
/* If there's nothing new since last we looked, return invalid. */ /* If there's nothing new since last we looked, return invalid. */
@ -908,18 +909,19 @@ unsigned vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq,
/* Grab the next descriptor number they're advertising, and increment /* Grab the next descriptor number they're advertising, and increment
* the index we've seen. */ * the index we've seen. */
if (get_user(head, &vq->avail->ring[last_avail_idx % vq->num])) { if (unlikely(get_user(head,
&vq->avail->ring[last_avail_idx % vq->num]))) {
vq_err(vq, "Failed to read head: idx %d address %p\n", vq_err(vq, "Failed to read head: idx %d address %p\n",
last_avail_idx, last_avail_idx,
&vq->avail->ring[last_avail_idx % vq->num]); &vq->avail->ring[last_avail_idx % vq->num]);
return vq->num; return -EFAULT;
} }
/* If their number is silly, that's an error. */ /* If their number is silly, that's an error. */
if (head >= vq->num) { if (unlikely(head >= vq->num)) {
vq_err(vq, "Guest says index %u > %u is available", vq_err(vq, "Guest says index %u > %u is available",
head, vq->num); head, vq->num);
return vq->num; return -EINVAL;
} }
/* When we start there are none of either input nor output. */ /* When we start there are none of either input nor output. */
@ -930,41 +932,41 @@ unsigned vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq,
i = head; i = head;
do { do {
unsigned iov_count = *in_num + *out_num; unsigned iov_count = *in_num + *out_num;
if (i >= vq->num) { if (unlikely(i >= vq->num)) {
vq_err(vq, "Desc index is %u > %u, head = %u", vq_err(vq, "Desc index is %u > %u, head = %u",
i, vq->num, head); i, vq->num, head);
return vq->num; return -EINVAL;
} }
if (++found > vq->num) { if (unlikely(++found > vq->num)) {
vq_err(vq, "Loop detected: last one at %u " vq_err(vq, "Loop detected: last one at %u "
"vq size %u head %u\n", "vq size %u head %u\n",
i, vq->num, head); i, vq->num, head);
return vq->num; return -EINVAL;
} }
ret = copy_from_user(&desc, vq->desc + i, sizeof desc); ret = copy_from_user(&desc, vq->desc + i, sizeof desc);
if (ret) { if (unlikely(ret)) {
vq_err(vq, "Failed to get descriptor: idx %d addr %p\n", vq_err(vq, "Failed to get descriptor: idx %d addr %p\n",
i, vq->desc + i); i, vq->desc + i);
return vq->num; return -EFAULT;
} }
if (desc.flags & VRING_DESC_F_INDIRECT) { if (desc.flags & VRING_DESC_F_INDIRECT) {
ret = get_indirect(dev, vq, iov, iov_size, ret = get_indirect(dev, vq, iov, iov_size,
out_num, in_num, out_num, in_num,
log, log_num, &desc); log, log_num, &desc);
if (ret < 0) { if (unlikely(ret < 0)) {
vq_err(vq, "Failure detected " vq_err(vq, "Failure detected "
"in indirect descriptor at idx %d\n", i); "in indirect descriptor at idx %d\n", i);
return vq->num; return ret;
} }
continue; continue;
} }
ret = translate_desc(dev, desc.addr, desc.len, iov + iov_count, ret = translate_desc(dev, desc.addr, desc.len, iov + iov_count,
iov_size - iov_count); iov_size - iov_count);
if (ret < 0) { if (unlikely(ret < 0)) {
vq_err(vq, "Translation failure %d descriptor idx %d\n", vq_err(vq, "Translation failure %d descriptor idx %d\n",
ret, i); ret, i);
return vq->num; return ret;
} }
if (desc.flags & VRING_DESC_F_WRITE) { if (desc.flags & VRING_DESC_F_WRITE) {
/* If this is an input descriptor, /* If this is an input descriptor,
@ -978,10 +980,10 @@ unsigned vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq,
} else { } else {
/* If it's an output descriptor, they're all supposed /* If it's an output descriptor, they're all supposed
* to come before any input descriptors. */ * to come before any input descriptors. */
if (*in_num) { if (unlikely(*in_num)) {
vq_err(vq, "Descriptor has out after in: " vq_err(vq, "Descriptor has out after in: "
"idx %d\n", i); "idx %d\n", i);
return vq->num; return -EINVAL;
} }
*out_num += ret; *out_num += ret;
} }

View File

@ -120,7 +120,7 @@ long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, unsigned long arg);
int vhost_vq_access_ok(struct vhost_virtqueue *vq); int vhost_vq_access_ok(struct vhost_virtqueue *vq);
int vhost_log_access_ok(struct vhost_dev *); int vhost_log_access_ok(struct vhost_dev *);
unsigned vhost_get_vq_desc(struct vhost_dev *, struct vhost_virtqueue *, int vhost_get_vq_desc(struct vhost_dev *, struct vhost_virtqueue *,
struct iovec iov[], unsigned int iov_count, struct iovec iov[], unsigned int iov_count,
unsigned int *out_num, unsigned int *in_num, unsigned int *out_num, unsigned int *in_num,
struct vhost_log *log, unsigned int *log_num); struct vhost_log *log, unsigned int *log_num);

View File

@ -379,6 +379,8 @@ struct ethtool_rxnfc {
__u32 flow_type; __u32 flow_type;
/* The rx flow hash value or the rule DB size */ /* The rx flow hash value or the rule DB size */
__u64 data; __u64 data;
/* The following fields are not valid and must not be used for
* the ETHTOOL_{G,X}RXFH commands. */
struct ethtool_rx_flow_spec fs; struct ethtool_rx_flow_spec fs;
__u32 rule_cnt; __u32 rule_cnt;
__u32 rule_locs[0]; __u32 rule_locs[0];

View File

@ -19,6 +19,11 @@ struct mv643xx_eth_shared_platform_data {
struct mbus_dram_target_info *dram; struct mbus_dram_target_info *dram;
struct platform_device *shared_smi; struct platform_device *shared_smi;
unsigned int t_clk; unsigned int t_clk;
/*
* Max packet size for Tx IP/Layer 4 checksum, when set to 0, default
* limit of 9KiB will be used.
*/
int tx_csum_limit;
}; };
#define MV643XX_ETH_PHY_ADDR_DEFAULT 0 #define MV643XX_ETH_PHY_ADDR_DEFAULT 0

View File

@ -129,10 +129,9 @@ struct socket_wq {
* @type: socket type (%SOCK_STREAM, etc) * @type: socket type (%SOCK_STREAM, etc)
* @flags: socket flags (%SOCK_ASYNC_NOSPACE, etc) * @flags: socket flags (%SOCK_ASYNC_NOSPACE, etc)
* @ops: protocol specific socket operations * @ops: protocol specific socket operations
* @fasync_list: Asynchronous wake up list
* @file: File back pointer for gc * @file: File back pointer for gc
* @sk: internal networking protocol agnostic socket representation * @sk: internal networking protocol agnostic socket representation
* @wait: wait queue for several uses * @wq: wait queue for several uses
*/ */
struct socket { struct socket {
socket_state state; socket_state state;

View File

@ -1656,6 +1656,9 @@ static inline int netif_is_multiqueue(const struct net_device *dev)
return (dev->num_tx_queues > 1); return (dev->num_tx_queues > 1);
} }
extern void netif_set_real_num_tx_queues(struct net_device *dev,
unsigned int txq);
/* Use this variant when it is known for sure that it /* Use this variant when it is known for sure that it
* is executing from hardware interrupt context or with hardware interrupts * is executing from hardware interrupt context or with hardware interrupts
* disabled. * disabled.
@ -2329,7 +2332,7 @@ do { \
#endif #endif
#if defined(VERBOSE_DEBUG) #if defined(VERBOSE_DEBUG)
#define netif_vdbg netdev_dbg #define netif_vdbg netif_dbg
#else #else
#define netif_vdbg(priv, type, dev, format, args...) \ #define netif_vdbg(priv, type, dev, format, args...) \
({ \ ({ \

View File

@ -313,12 +313,24 @@ extern void qdisc_calculate_pkt_len(struct sk_buff *skb,
extern void tcf_destroy(struct tcf_proto *tp); extern void tcf_destroy(struct tcf_proto *tp);
extern void tcf_destroy_chain(struct tcf_proto **fl); extern void tcf_destroy_chain(struct tcf_proto **fl);
/* Reset all TX qdiscs of a device. */ /* Reset all TX qdiscs greater then index of a device. */
static inline void qdisc_reset_all_tx_gt(struct net_device *dev, unsigned int i)
{
struct Qdisc *qdisc;
for (; i < dev->num_tx_queues; i++) {
qdisc = netdev_get_tx_queue(dev, i)->qdisc;
if (qdisc) {
spin_lock_bh(qdisc_lock(qdisc));
qdisc_reset(qdisc);
spin_unlock_bh(qdisc_lock(qdisc));
}
}
}
static inline void qdisc_reset_all_tx(struct net_device *dev) static inline void qdisc_reset_all_tx(struct net_device *dev)
{ {
unsigned int i; qdisc_reset_all_tx_gt(dev, 0);
for (i = 0; i < dev->num_tx_queues; i++)
qdisc_reset(netdev_get_tx_queue(dev, i)->qdisc);
} }
/* Are all TX queues of the device empty? */ /* Are all TX queues of the device empty? */

View File

@ -1586,7 +1586,7 @@ static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb)
static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m) static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m)
{ {
if (attrs[XFRMA_MARK]) if (attrs[XFRMA_MARK])
memcpy(m, nla_data(attrs[XFRMA_MARK]), sizeof(m)); memcpy(m, nla_data(attrs[XFRMA_MARK]), sizeof(struct xfrm_mark));
else else
m->v = m->m = 0; m->v = m->m = 0;

View File

@ -99,6 +99,15 @@ static struct net_bridge_mdb_entry *__br_mdb_ip_get(
return NULL; return NULL;
} }
static struct net_bridge_mdb_entry *br_mdb_ip_get(
struct net_bridge_mdb_htable *mdb, struct br_ip *dst)
{
if (!mdb)
return NULL;
return __br_mdb_ip_get(mdb, dst, br_ip_hash(mdb, dst));
}
static struct net_bridge_mdb_entry *br_mdb_ip4_get( static struct net_bridge_mdb_entry *br_mdb_ip4_get(
struct net_bridge_mdb_htable *mdb, __be32 dst) struct net_bridge_mdb_htable *mdb, __be32 dst)
{ {
@ -107,7 +116,7 @@ static struct net_bridge_mdb_entry *br_mdb_ip4_get(
br_dst.u.ip4 = dst; br_dst.u.ip4 = dst;
br_dst.proto = htons(ETH_P_IP); br_dst.proto = htons(ETH_P_IP);
return __br_mdb_ip_get(mdb, &br_dst, __br_ip4_hash(mdb, dst)); return br_mdb_ip_get(mdb, &br_dst);
} }
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
@ -119,23 +128,17 @@ static struct net_bridge_mdb_entry *br_mdb_ip6_get(
ipv6_addr_copy(&br_dst.u.ip6, dst); ipv6_addr_copy(&br_dst.u.ip6, dst);
br_dst.proto = htons(ETH_P_IPV6); br_dst.proto = htons(ETH_P_IPV6);
return __br_mdb_ip_get(mdb, &br_dst, __br_ip6_hash(mdb, dst)); return br_mdb_ip_get(mdb, &br_dst);
} }
#endif #endif
static struct net_bridge_mdb_entry *br_mdb_ip_get(
struct net_bridge_mdb_htable *mdb, struct br_ip *dst)
{
return __br_mdb_ip_get(mdb, dst, br_ip_hash(mdb, dst));
}
struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br, struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct net_bridge_mdb_htable *mdb = br->mdb; struct net_bridge_mdb_htable *mdb = br->mdb;
struct br_ip ip; struct br_ip ip;
if (!mdb || br->multicast_disabled) if (br->multicast_disabled)
return NULL; return NULL;
if (BR_INPUT_SKB_CB(skb)->igmp) if (BR_INPUT_SKB_CB(skb)->igmp)

View File

@ -591,6 +591,9 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff *skb,
pskb_trim_rcsum(skb, len); pskb_trim_rcsum(skb, len);
/* BUG: Should really parse the IP options here. */
memset(IPCB(skb), 0, sizeof(struct inet_skb_parm));
nf_bridge_put(skb->nf_bridge); nf_bridge_put(skb->nf_bridge);
if (!nf_bridge_alloc(skb)) if (!nf_bridge_alloc(skb))
return NF_DROP; return NF_DROP;

View File

@ -1553,6 +1553,24 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
rcu_read_unlock(); rcu_read_unlock();
} }
/*
* Routine to help set real_num_tx_queues. To avoid skbs mapped to queues
* greater then real_num_tx_queues stale skbs on the qdisc must be flushed.
*/
void netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq)
{
unsigned int real_num = dev->real_num_tx_queues;
if (unlikely(txq > dev->num_tx_queues))
;
else if (txq > real_num)
dev->real_num_tx_queues = txq;
else if (txq < real_num) {
dev->real_num_tx_queues = txq;
qdisc_reset_all_tx_gt(dev, txq);
}
}
EXPORT_SYMBOL(netif_set_real_num_tx_queues);
static inline void __netif_reschedule(struct Qdisc *q) static inline void __netif_reschedule(struct Qdisc *q)
{ {

View File

@ -318,23 +318,33 @@ out:
} }
static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev, static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,
void __user *useraddr) u32 cmd, void __user *useraddr)
{ {
struct ethtool_rxnfc cmd; struct ethtool_rxnfc info;
size_t info_size = sizeof(info);
if (!dev->ethtool_ops->set_rxnfc) if (!dev->ethtool_ops->set_rxnfc)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (copy_from_user(&cmd, useraddr, sizeof(cmd))) /* struct ethtool_rxnfc was originally defined for
* ETHTOOL_{G,S}RXFH with only the cmd, flow_type and data
* members. User-space might still be using that
* definition. */
if (cmd == ETHTOOL_SRXFH)
info_size = (offsetof(struct ethtool_rxnfc, data) +
sizeof(info.data));
if (copy_from_user(&info, useraddr, info_size))
return -EFAULT; return -EFAULT;
return dev->ethtool_ops->set_rxnfc(dev, &cmd); return dev->ethtool_ops->set_rxnfc(dev, &info);
} }
static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev, static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev,
void __user *useraddr) u32 cmd, void __user *useraddr)
{ {
struct ethtool_rxnfc info; struct ethtool_rxnfc info;
size_t info_size = sizeof(info);
const struct ethtool_ops *ops = dev->ethtool_ops; const struct ethtool_ops *ops = dev->ethtool_ops;
int ret; int ret;
void *rule_buf = NULL; void *rule_buf = NULL;
@ -342,11 +352,20 @@ static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev,
if (!ops->get_rxnfc) if (!ops->get_rxnfc)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (copy_from_user(&info, useraddr, sizeof(info))) /* struct ethtool_rxnfc was originally defined for
* ETHTOOL_{G,S}RXFH with only the cmd, flow_type and data
* members. User-space might still be using that
* definition. */
if (cmd == ETHTOOL_GRXFH)
info_size = (offsetof(struct ethtool_rxnfc, data) +
sizeof(info.data));
if (copy_from_user(&info, useraddr, info_size))
return -EFAULT; return -EFAULT;
if (info.cmd == ETHTOOL_GRXCLSRLALL) { if (info.cmd == ETHTOOL_GRXCLSRLALL) {
if (info.rule_cnt > 0) { if (info.rule_cnt > 0) {
if (info.rule_cnt <= KMALLOC_MAX_SIZE / sizeof(u32))
rule_buf = kmalloc(info.rule_cnt * sizeof(u32), rule_buf = kmalloc(info.rule_cnt * sizeof(u32),
GFP_USER); GFP_USER);
if (!rule_buf) if (!rule_buf)
@ -359,7 +378,7 @@ static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev,
goto err_out; goto err_out;
ret = -EFAULT; ret = -EFAULT;
if (copy_to_user(useraddr, &info, sizeof(info))) if (copy_to_user(useraddr, &info, info_size))
goto err_out; goto err_out;
if (rule_buf) { if (rule_buf) {
@ -1516,12 +1535,12 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
case ETHTOOL_GRXCLSRLCNT: case ETHTOOL_GRXCLSRLCNT:
case ETHTOOL_GRXCLSRULE: case ETHTOOL_GRXCLSRULE:
case ETHTOOL_GRXCLSRLALL: case ETHTOOL_GRXCLSRLALL:
rc = ethtool_get_rxnfc(dev, useraddr); rc = ethtool_get_rxnfc(dev, ethcmd, useraddr);
break; break;
case ETHTOOL_SRXFH: case ETHTOOL_SRXFH:
case ETHTOOL_SRXCLSRLDEL: case ETHTOOL_SRXCLSRLDEL:
case ETHTOOL_SRXCLSRLINS: case ETHTOOL_SRXCLSRLINS:
rc = ethtool_set_rxnfc(dev, useraddr); rc = ethtool_set_rxnfc(dev, ethcmd, useraddr);
break; break;
case ETHTOOL_GGRO: case ETHTOOL_GGRO:
rc = ethtool_get_gro(dev, useraddr); rc = ethtool_get_gro(dev, useraddr);

View File

@ -108,6 +108,8 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
u8 *xprth = skb_network_header(skb) + iph->ihl * 4; u8 *xprth = skb_network_header(skb) + iph->ihl * 4;
memset(fl, 0, sizeof(struct flowi)); memset(fl, 0, sizeof(struct flowi));
fl->mark = skb->mark;
if (!(iph->frag_off & htons(IP_MF | IP_OFFSET))) { if (!(iph->frag_off & htons(IP_MF | IP_OFFSET))) {
switch (iph->protocol) { switch (iph->protocol) {
case IPPROTO_UDP: case IPPROTO_UDP:

View File

@ -97,9 +97,11 @@ static void send_reset(struct net *net, struct sk_buff *oldskb)
fl.fl_ip_dport = otcph.source; fl.fl_ip_dport = otcph.source;
security_skb_classify_flow(oldskb, &fl); security_skb_classify_flow(oldskb, &fl);
dst = ip6_route_output(net, NULL, &fl); dst = ip6_route_output(net, NULL, &fl);
if (dst == NULL) if (dst == NULL || dst->error) {
dst_release(dst);
return; return;
if (dst->error || xfrm_lookup(net, &dst, &fl, NULL, 0)) }
if (xfrm_lookup(net, &dst, &fl, NULL, 0))
return; return;
hh_len = (dst->dev->hard_header_len + 15)&~15; hh_len = (dst->dev->hard_header_len + 15)&~15;

View File

@ -124,6 +124,8 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
u8 nexthdr = nh[IP6CB(skb)->nhoff]; u8 nexthdr = nh[IP6CB(skb)->nhoff];
memset(fl, 0, sizeof(struct flowi)); memset(fl, 0, sizeof(struct flowi));
fl->mark = skb->mark;
ipv6_addr_copy(&fl->fl6_dst, reverse ? &hdr->saddr : &hdr->daddr); ipv6_addr_copy(&fl->fl6_dst, reverse ? &hdr->saddr : &hdr->daddr);
ipv6_addr_copy(&fl->fl6_src, reverse ? &hdr->daddr : &hdr->saddr); ipv6_addr_copy(&fl->fl6_src, reverse ? &hdr->daddr : &hdr->saddr);