Commit ae42d8d4 authored by Linus Torvalds's avatar Linus Torvalds

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:
  ehea: Fix a checksum issue on the receive path
  net: allow FEC driver to use fixed PHY support
  tg3: restore rx_dropped accounting
  b44: fix carrier detection on bind
  net: clear heap allocations for privileged ethtool actions
  NET: wimax, fix use after free
  ATM: iphase, remove sleep-inside-atomic
  ATM: mpc, fix use after free
  ATM: solos-pci, remove use after free
  net/fec: carrier off initially to avoid root mount failure
  r8169: use device model DMA API
  r8169: allocate with GFP_KERNEL flag when able to sleep
parents 0eead9ab 71085ce8
...@@ -3156,7 +3156,6 @@ static int __devinit ia_init_one(struct pci_dev *pdev, ...@@ -3156,7 +3156,6 @@ static int __devinit ia_init_one(struct pci_dev *pdev,
{ {
struct atm_dev *dev; struct atm_dev *dev;
IADEV *iadev; IADEV *iadev;
unsigned long flags;
int ret; int ret;
iadev = kzalloc(sizeof(*iadev), GFP_KERNEL); iadev = kzalloc(sizeof(*iadev), GFP_KERNEL);
...@@ -3188,19 +3187,14 @@ static int __devinit ia_init_one(struct pci_dev *pdev, ...@@ -3188,19 +3187,14 @@ static int __devinit ia_init_one(struct pci_dev *pdev,
ia_dev[iadev_count] = iadev; ia_dev[iadev_count] = iadev;
_ia_dev[iadev_count] = dev; _ia_dev[iadev_count] = dev;
iadev_count++; iadev_count++;
spin_lock_init(&iadev->misc_lock);
/* First fixes first. I don't want to think about this now. */
spin_lock_irqsave(&iadev->misc_lock, flags);
if (ia_init(dev) || ia_start(dev)) { if (ia_init(dev) || ia_start(dev)) {
IF_INIT(printk("IA register failed!\n");) IF_INIT(printk("IA register failed!\n");)
iadev_count--; iadev_count--;
ia_dev[iadev_count] = NULL; ia_dev[iadev_count] = NULL;
_ia_dev[iadev_count] = NULL; _ia_dev[iadev_count] = NULL;
spin_unlock_irqrestore(&iadev->misc_lock, flags);
ret = -EINVAL; ret = -EINVAL;
goto err_out_deregister_dev; goto err_out_deregister_dev;
} }
spin_unlock_irqrestore(&iadev->misc_lock, flags);
IF_EVENT(printk("iadev_count = %d\n", iadev_count);) IF_EVENT(printk("iadev_count = %d\n", iadev_count);)
iadev->next_board = ia_boards; iadev->next_board = ia_boards;
......
...@@ -1022,7 +1022,7 @@ typedef struct iadev_t { ...@@ -1022,7 +1022,7 @@ typedef struct iadev_t {
struct dle_q rx_dle_q; struct dle_q rx_dle_q;
struct free_desc_q *rx_free_desc_qhead; struct free_desc_q *rx_free_desc_qhead;
struct sk_buff_head rx_dma_q; struct sk_buff_head rx_dma_q;
spinlock_t rx_lock, misc_lock; spinlock_t rx_lock;
struct atm_vcc **rx_open; /* list of all open VCs */ struct atm_vcc **rx_open; /* list of all open VCs */
u16 num_rx_desc, rx_buf_sz, rxing; u16 num_rx_desc, rx_buf_sz, rxing;
u32 rx_pkt_ram, rx_tmp_cnt; u32 rx_pkt_ram, rx_tmp_cnt;
......
...@@ -444,6 +444,7 @@ static ssize_t console_show(struct device *dev, struct device_attribute *attr, ...@@ -444,6 +444,7 @@ static ssize_t console_show(struct device *dev, struct device_attribute *attr,
struct atm_dev *atmdev = container_of(dev, struct atm_dev, class_dev); struct atm_dev *atmdev = container_of(dev, struct atm_dev, class_dev);
struct solos_card *card = atmdev->dev_data; struct solos_card *card = atmdev->dev_data;
struct sk_buff *skb; struct sk_buff *skb;
unsigned int len;
spin_lock(&card->cli_queue_lock); spin_lock(&card->cli_queue_lock);
skb = skb_dequeue(&card->cli_queue[SOLOS_CHAN(atmdev)]); skb = skb_dequeue(&card->cli_queue[SOLOS_CHAN(atmdev)]);
...@@ -451,11 +452,12 @@ static ssize_t console_show(struct device *dev, struct device_attribute *attr, ...@@ -451,11 +452,12 @@ static ssize_t console_show(struct device *dev, struct device_attribute *attr,
if(skb == NULL) if(skb == NULL)
return sprintf(buf, "No data.\n"); return sprintf(buf, "No data.\n");
memcpy(buf, skb->data, skb->len); len = skb->len;
dev_dbg(&card->dev->dev, "len: %d\n", skb->len); memcpy(buf, skb->data, len);
dev_dbg(&card->dev->dev, "len: %d\n", len);
kfree_skb(skb); kfree_skb(skb);
return skb->len; return len;
} }
static int send_command(struct solos_card *card, int dev, const char *buf, size_t size) static int send_command(struct solos_card *card, int dev, const char *buf, size_t size)
......
...@@ -2170,8 +2170,6 @@ static int __devinit b44_init_one(struct ssb_device *sdev, ...@@ -2170,8 +2170,6 @@ static int __devinit b44_init_one(struct ssb_device *sdev,
dev->irq = sdev->irq; dev->irq = sdev->irq;
SET_ETHTOOL_OPS(dev, &b44_ethtool_ops); SET_ETHTOOL_OPS(dev, &b44_ethtool_ops);
netif_carrier_off(dev);
err = ssb_bus_powerup(sdev->bus, 0); err = ssb_bus_powerup(sdev->bus, 0);
if (err) { if (err) {
dev_err(sdev->dev, dev_err(sdev->dev,
...@@ -2213,6 +2211,8 @@ static int __devinit b44_init_one(struct ssb_device *sdev, ...@@ -2213,6 +2211,8 @@ static int __devinit b44_init_one(struct ssb_device *sdev,
goto err_out_powerdown; goto err_out_powerdown;
} }
netif_carrier_off(dev);
ssb_set_drvdata(sdev, dev); ssb_set_drvdata(sdev, dev);
/* Chip reset provides power to the b44 MAC & PCI cores, which /* Chip reset provides power to the b44 MAC & PCI cores, which
......
...@@ -533,8 +533,15 @@ static inline void ehea_fill_skb(struct net_device *dev, ...@@ -533,8 +533,15 @@ static inline void ehea_fill_skb(struct net_device *dev,
int length = cqe->num_bytes_transfered - 4; /*remove CRC */ int length = cqe->num_bytes_transfered - 4; /*remove CRC */
skb_put(skb, length); skb_put(skb, length);
skb->ip_summed = CHECKSUM_UNNECESSARY;
skb->protocol = eth_type_trans(skb, dev); skb->protocol = eth_type_trans(skb, dev);
/* The packet was not an IPV4 packet so a complemented checksum was
calculated. The value is found in the Internet Checksum field. */
if (cqe->status & EHEA_CQE_BLIND_CKSUM) {
skb->ip_summed = CHECKSUM_COMPLETE;
skb->csum = csum_unfold(~cqe->inet_checksum_value);
} else
skb->ip_summed = CHECKSUM_UNNECESSARY;
} }
static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array, static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array,
......
...@@ -150,6 +150,7 @@ struct ehea_rwqe { ...@@ -150,6 +150,7 @@ struct ehea_rwqe {
#define EHEA_CQE_TYPE_RQ 0x60 #define EHEA_CQE_TYPE_RQ 0x60
#define EHEA_CQE_STAT_ERR_MASK 0x700F #define EHEA_CQE_STAT_ERR_MASK 0x700F
#define EHEA_CQE_STAT_FAT_ERR_MASK 0xF #define EHEA_CQE_STAT_FAT_ERR_MASK 0xF
#define EHEA_CQE_BLIND_CKSUM 0x8000
#define EHEA_CQE_STAT_ERR_TCP 0x4000 #define EHEA_CQE_STAT_ERR_TCP 0x4000
#define EHEA_CQE_STAT_ERR_IP 0x2000 #define EHEA_CQE_STAT_ERR_IP 0x2000
#define EHEA_CQE_STAT_ERR_CRC 0x1000 #define EHEA_CQE_STAT_ERR_CRC 0x1000
......
...@@ -678,24 +678,37 @@ static int fec_enet_mii_probe(struct net_device *dev) ...@@ -678,24 +678,37 @@ static int fec_enet_mii_probe(struct net_device *dev)
{ {
struct fec_enet_private *fep = netdev_priv(dev); struct fec_enet_private *fep = netdev_priv(dev);
struct phy_device *phy_dev = NULL; struct phy_device *phy_dev = NULL;
int ret; char mdio_bus_id[MII_BUS_ID_SIZE];
char phy_name[MII_BUS_ID_SIZE + 3];
int phy_id;
fep->phy_dev = NULL; fep->phy_dev = NULL;
/* find the first phy */ /* check for attached phy */
phy_dev = phy_find_first(fep->mii_bus); for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) {
if (!phy_dev) { if ((fep->mii_bus->phy_mask & (1 << phy_id)))
printk(KERN_ERR "%s: no PHY found\n", dev->name); continue;
return -ENODEV; if (fep->mii_bus->phy_map[phy_id] == NULL)
continue;
if (fep->mii_bus->phy_map[phy_id]->phy_id == 0)
continue;
strncpy(mdio_bus_id, fep->mii_bus->id, MII_BUS_ID_SIZE);
break;
} }
/* attach the mac to the phy */ if (phy_id >= PHY_MAX_ADDR) {
ret = phy_connect_direct(dev, phy_dev, printk(KERN_INFO "%s: no PHY, assuming direct connection "
&fec_enet_adjust_link, 0, "to switch\n", dev->name);
PHY_INTERFACE_MODE_MII); strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE);
if (ret) { phy_id = 0;
printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); }
return ret;
snprintf(phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id);
phy_dev = phy_connect(dev, phy_name, &fec_enet_adjust_link, 0,
PHY_INTERFACE_MODE_MII);
if (IS_ERR(phy_dev)) {
printk(KERN_ERR "%s: could not attach to PHY\n", dev->name);
return PTR_ERR(phy_dev);
} }
/* mask with MAC supported features */ /* mask with MAC supported features */
...@@ -738,7 +751,7 @@ static int fec_enet_mii_init(struct platform_device *pdev) ...@@ -738,7 +751,7 @@ static int fec_enet_mii_init(struct platform_device *pdev)
fep->mii_bus->read = fec_enet_mdio_read; fep->mii_bus->read = fec_enet_mdio_read;
fep->mii_bus->write = fec_enet_mdio_write; fep->mii_bus->write = fec_enet_mdio_write;
fep->mii_bus->reset = fec_enet_mdio_reset; fep->mii_bus->reset = fec_enet_mdio_reset;
snprintf(fep->mii_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id); snprintf(fep->mii_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id + 1);
fep->mii_bus->priv = fep; fep->mii_bus->priv = fep;
fep->mii_bus->parent = &pdev->dev; fep->mii_bus->parent = &pdev->dev;
...@@ -1311,6 +1324,9 @@ fec_probe(struct platform_device *pdev) ...@@ -1311,6 +1324,9 @@ fec_probe(struct platform_device *pdev)
if (ret) if (ret)
goto failed_mii_init; goto failed_mii_init;
/* Carrier starts down, phylib will bring it up */
netif_carrier_off(ndev);
ret = register_netdev(ndev); ret = register_netdev(ndev);
if (ret) if (ret)
goto failed_register; goto failed_register;
......
...@@ -1212,7 +1212,8 @@ static void rtl8169_update_counters(struct net_device *dev) ...@@ -1212,7 +1212,8 @@ static void rtl8169_update_counters(struct net_device *dev)
if ((RTL_R8(ChipCmd) & CmdRxEnb) == 0) if ((RTL_R8(ChipCmd) & CmdRxEnb) == 0)
return; return;
counters = pci_alloc_consistent(tp->pci_dev, sizeof(*counters), &paddr); counters = dma_alloc_coherent(&tp->pci_dev->dev, sizeof(*counters),
&paddr, GFP_KERNEL);
if (!counters) if (!counters)
return; return;
...@@ -1233,7 +1234,8 @@ static void rtl8169_update_counters(struct net_device *dev) ...@@ -1233,7 +1234,8 @@ static void rtl8169_update_counters(struct net_device *dev)
RTL_W32(CounterAddrLow, 0); RTL_W32(CounterAddrLow, 0);
RTL_W32(CounterAddrHigh, 0); RTL_W32(CounterAddrHigh, 0);
pci_free_consistent(tp->pci_dev, sizeof(*counters), counters, paddr); dma_free_coherent(&tp->pci_dev->dev, sizeof(*counters), counters,
paddr);
} }
static void rtl8169_get_ethtool_stats(struct net_device *dev, static void rtl8169_get_ethtool_stats(struct net_device *dev,
...@@ -3292,15 +3294,15 @@ static int rtl8169_open(struct net_device *dev) ...@@ -3292,15 +3294,15 @@ static int rtl8169_open(struct net_device *dev)
/* /*
* Rx and Tx desscriptors needs 256 bytes alignment. * Rx and Tx desscriptors needs 256 bytes alignment.
* pci_alloc_consistent provides more. * dma_alloc_coherent provides more.
*/ */
tp->TxDescArray = pci_alloc_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray = dma_alloc_coherent(&pdev->dev, R8169_TX_RING_BYTES,
&tp->TxPhyAddr); &tp->TxPhyAddr, GFP_KERNEL);
if (!tp->TxDescArray) if (!tp->TxDescArray)
goto err_pm_runtime_put; goto err_pm_runtime_put;
tp->RxDescArray = pci_alloc_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray = dma_alloc_coherent(&pdev->dev, R8169_RX_RING_BYTES,
&tp->RxPhyAddr); &tp->RxPhyAddr, GFP_KERNEL);
if (!tp->RxDescArray) if (!tp->RxDescArray)
goto err_free_tx_0; goto err_free_tx_0;
...@@ -3334,12 +3336,12 @@ static int rtl8169_open(struct net_device *dev) ...@@ -3334,12 +3336,12 @@ static int rtl8169_open(struct net_device *dev)
err_release_ring_2: err_release_ring_2:
rtl8169_rx_clear(tp); rtl8169_rx_clear(tp);
err_free_rx_1: err_free_rx_1:
pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray,
tp->RxPhyAddr); tp->RxPhyAddr);
tp->RxDescArray = NULL; tp->RxDescArray = NULL;
err_free_tx_0: err_free_tx_0:
pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, dma_free_coherent(&pdev->dev, R8169_TX_RING_BYTES, tp->TxDescArray,
tp->TxPhyAddr); tp->TxPhyAddr);
tp->TxDescArray = NULL; tp->TxDescArray = NULL;
err_pm_runtime_put: err_pm_runtime_put:
pm_runtime_put_noidle(&pdev->dev); pm_runtime_put_noidle(&pdev->dev);
...@@ -3975,7 +3977,7 @@ static void rtl8169_free_rx_skb(struct rtl8169_private *tp, ...@@ -3975,7 +3977,7 @@ static void rtl8169_free_rx_skb(struct rtl8169_private *tp,
{ {
struct pci_dev *pdev = tp->pci_dev; struct pci_dev *pdev = tp->pci_dev;
pci_unmap_single(pdev, le64_to_cpu(desc->addr), tp->rx_buf_sz, dma_unmap_single(&pdev->dev, le64_to_cpu(desc->addr), tp->rx_buf_sz,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
dev_kfree_skb(*sk_buff); dev_kfree_skb(*sk_buff);
*sk_buff = NULL; *sk_buff = NULL;
...@@ -4000,7 +4002,7 @@ static inline void rtl8169_map_to_asic(struct RxDesc *desc, dma_addr_t mapping, ...@@ -4000,7 +4002,7 @@ static inline void rtl8169_map_to_asic(struct RxDesc *desc, dma_addr_t mapping,
static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev, static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev,
struct net_device *dev, struct net_device *dev,
struct RxDesc *desc, int rx_buf_sz, struct RxDesc *desc, int rx_buf_sz,
unsigned int align) unsigned int align, gfp_t gfp)
{ {
struct sk_buff *skb; struct sk_buff *skb;
dma_addr_t mapping; dma_addr_t mapping;
...@@ -4008,13 +4010,13 @@ static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev, ...@@ -4008,13 +4010,13 @@ static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev,
pad = align ? align : NET_IP_ALIGN; pad = align ? align : NET_IP_ALIGN;
skb = netdev_alloc_skb(dev, rx_buf_sz + pad); skb = __netdev_alloc_skb(dev, rx_buf_sz + pad, gfp);
if (!skb) if (!skb)
goto err_out; goto err_out;
skb_reserve(skb, align ? ((pad - 1) & (unsigned long)skb->data) : pad); skb_reserve(skb, align ? ((pad - 1) & (unsigned long)skb->data) : pad);
mapping = pci_map_single(pdev, skb->data, rx_buf_sz, mapping = dma_map_single(&pdev->dev, skb->data, rx_buf_sz,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
rtl8169_map_to_asic(desc, mapping, rx_buf_sz); rtl8169_map_to_asic(desc, mapping, rx_buf_sz);
...@@ -4039,7 +4041,7 @@ static void rtl8169_rx_clear(struct rtl8169_private *tp) ...@@ -4039,7 +4041,7 @@ static void rtl8169_rx_clear(struct rtl8169_private *tp)
} }
static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev,
u32 start, u32 end) u32 start, u32 end, gfp_t gfp)
{ {
u32 cur; u32 cur;
...@@ -4054,7 +4056,7 @@ static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, ...@@ -4054,7 +4056,7 @@ static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev,
skb = rtl8169_alloc_rx_skb(tp->pci_dev, dev, skb = rtl8169_alloc_rx_skb(tp->pci_dev, dev,
tp->RxDescArray + i, tp->RxDescArray + i,
tp->rx_buf_sz, tp->align); tp->rx_buf_sz, tp->align, gfp);
if (!skb) if (!skb)
break; break;
...@@ -4082,7 +4084,7 @@ static int rtl8169_init_ring(struct net_device *dev) ...@@ -4082,7 +4084,7 @@ static int rtl8169_init_ring(struct net_device *dev)
memset(tp->tx_skb, 0x0, NUM_TX_DESC * sizeof(struct ring_info)); memset(tp->tx_skb, 0x0, NUM_TX_DESC * sizeof(struct ring_info));
memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *)); memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *));
if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC) != NUM_RX_DESC) if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC, GFP_KERNEL) != NUM_RX_DESC)
goto err_out; goto err_out;
rtl8169_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1); rtl8169_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1);
...@@ -4099,7 +4101,8 @@ static void rtl8169_unmap_tx_skb(struct pci_dev *pdev, struct ring_info *tx_skb, ...@@ -4099,7 +4101,8 @@ static void rtl8169_unmap_tx_skb(struct pci_dev *pdev, struct ring_info *tx_skb,
{ {
unsigned int len = tx_skb->len; unsigned int len = tx_skb->len;
pci_unmap_single(pdev, le64_to_cpu(desc->addr), len, PCI_DMA_TODEVICE); dma_unmap_single(&pdev->dev, le64_to_cpu(desc->addr), len,
PCI_DMA_TODEVICE);
desc->opts1 = 0x00; desc->opts1 = 0x00;
desc->opts2 = 0x00; desc->opts2 = 0x00;
desc->addr = 0x00; desc->addr = 0x00;
...@@ -4243,7 +4246,8 @@ static int rtl8169_xmit_frags(struct rtl8169_private *tp, struct sk_buff *skb, ...@@ -4243,7 +4246,8 @@ static int rtl8169_xmit_frags(struct rtl8169_private *tp, struct sk_buff *skb,
txd = tp->TxDescArray + entry; txd = tp->TxDescArray + entry;
len = frag->size; len = frag->size;
addr = ((void *) page_address(frag->page)) + frag->page_offset; addr = ((void *) page_address(frag->page)) + frag->page_offset;
mapping = pci_map_single(tp->pci_dev, addr, len, PCI_DMA_TODEVICE); mapping = dma_map_single(&tp->pci_dev->dev, addr, len,
PCI_DMA_TODEVICE);
/* anti gcc 2.95.3 bugware (sic) */ /* anti gcc 2.95.3 bugware (sic) */
status = opts1 | len | (RingEnd * !((entry + 1) % NUM_TX_DESC)); status = opts1 | len | (RingEnd * !((entry + 1) % NUM_TX_DESC));
...@@ -4313,7 +4317,8 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, ...@@ -4313,7 +4317,8 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
tp->tx_skb[entry].skb = skb; tp->tx_skb[entry].skb = skb;
} }
mapping = pci_map_single(tp->pci_dev, skb->data, len, PCI_DMA_TODEVICE); mapping = dma_map_single(&tp->pci_dev->dev, skb->data, len,
PCI_DMA_TODEVICE);
tp->tx_skb[entry].len = len; tp->tx_skb[entry].len = len;
txd->addr = cpu_to_le64(mapping); txd->addr = cpu_to_le64(mapping);
...@@ -4477,8 +4482,8 @@ static inline bool rtl8169_try_rx_copy(struct sk_buff **sk_buff, ...@@ -4477,8 +4482,8 @@ static inline bool rtl8169_try_rx_copy(struct sk_buff **sk_buff,
if (!skb) if (!skb)
goto out; goto out;
pci_dma_sync_single_for_cpu(tp->pci_dev, addr, pkt_size, dma_sync_single_for_cpu(&tp->pci_dev->dev, addr, pkt_size,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
skb_copy_from_linear_data(*sk_buff, skb->data, pkt_size); skb_copy_from_linear_data(*sk_buff, skb->data, pkt_size);
*sk_buff = skb; *sk_buff = skb;
done = true; done = true;
...@@ -4549,11 +4554,11 @@ static int rtl8169_rx_interrupt(struct net_device *dev, ...@@ -4549,11 +4554,11 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
rtl8169_rx_csum(skb, desc); rtl8169_rx_csum(skb, desc);
if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) { if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) {
pci_dma_sync_single_for_device(pdev, addr, dma_sync_single_for_device(&pdev->dev, addr,
pkt_size, PCI_DMA_FROMDEVICE); pkt_size, PCI_DMA_FROMDEVICE);
rtl8169_mark_to_asic(desc, tp->rx_buf_sz); rtl8169_mark_to_asic(desc, tp->rx_buf_sz);
} else { } else {
pci_unmap_single(pdev, addr, tp->rx_buf_sz, dma_unmap_single(&pdev->dev, addr, tp->rx_buf_sz,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
tp->Rx_skbuff[entry] = NULL; tp->Rx_skbuff[entry] = NULL;
} }
...@@ -4583,7 +4588,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev, ...@@ -4583,7 +4588,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
count = cur_rx - tp->cur_rx; count = cur_rx - tp->cur_rx;
tp->cur_rx = cur_rx; tp->cur_rx = cur_rx;
delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx); delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx, GFP_ATOMIC);
if (!delta && count) if (!delta && count)
netif_info(tp, intr, dev, "no Rx buffer allocated\n"); netif_info(tp, intr, dev, "no Rx buffer allocated\n");
tp->dirty_rx += delta; tp->dirty_rx += delta;
...@@ -4769,10 +4774,10 @@ static int rtl8169_close(struct net_device *dev) ...@@ -4769,10 +4774,10 @@ static int rtl8169_close(struct net_device *dev)
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray,
tp->RxPhyAddr); tp->RxPhyAddr);
pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, dma_free_coherent(&pdev->dev, R8169_TX_RING_BYTES, tp->TxDescArray,
tp->TxPhyAddr); tp->TxPhyAddr);
tp->TxDescArray = NULL; tp->TxDescArray = NULL;
tp->RxDescArray = NULL; tp->RxDescArray = NULL;
......
...@@ -4666,7 +4666,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) ...@@ -4666,7 +4666,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
desc_idx, *post_ptr); desc_idx, *post_ptr);
drop_it_no_recycle: drop_it_no_recycle:
/* Other statistics kept track of by card. */ /* Other statistics kept track of by card. */
tp->net_stats.rx_dropped++; tp->rx_dropped++;
goto next_pkt; goto next_pkt;
} }
...@@ -4726,7 +4726,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) ...@@ -4726,7 +4726,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
if (len > (tp->dev->mtu + ETH_HLEN) && if (len > (tp->dev->mtu + ETH_HLEN) &&
skb->protocol != htons(ETH_P_8021Q)) { skb->protocol != htons(ETH_P_8021Q)) {
dev_kfree_skb(skb); dev_kfree_skb(skb);
goto next_pkt; goto drop_it_no_recycle;
} }
if (desc->type_flags & RXD_FLAG_VLAN && if (desc->type_flags & RXD_FLAG_VLAN &&
...@@ -9240,6 +9240,8 @@ static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *dev, ...@@ -9240,6 +9240,8 @@ static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *dev,
stats->rx_missed_errors = old_stats->rx_missed_errors + stats->rx_missed_errors = old_stats->rx_missed_errors +
get_stat64(&hw_stats->rx_discards); get_stat64(&hw_stats->rx_discards);
stats->rx_dropped = tp->rx_dropped;
return stats; return stats;
} }
......
...@@ -2759,7 +2759,7 @@ struct tg3 { ...@@ -2759,7 +2759,7 @@ struct tg3 {
/* begin "everything else" cacheline(s) section */ /* begin "everything else" cacheline(s) section */
struct rtnl_link_stats64 net_stats; unsigned long rx_dropped;
struct rtnl_link_stats64 net_stats_prev; struct rtnl_link_stats64 net_stats_prev;
struct tg3_ethtool_stats estats; struct tg3_ethtool_stats estats;
struct tg3_ethtool_stats estats_prev; struct tg3_ethtool_stats estats_prev;
......
...@@ -1244,16 +1244,16 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) ...@@ -1244,16 +1244,16 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb)
int i, result; int i, result;
struct device *dev = i2400m_dev(i2400m); struct device *dev = i2400m_dev(i2400m);
const struct i2400m_msg_hdr *msg_hdr; const struct i2400m_msg_hdr *msg_hdr;
size_t pl_itr, pl_size, skb_len; size_t pl_itr, pl_size;
unsigned long flags; unsigned long flags;
unsigned num_pls, single_last; unsigned num_pls, single_last, skb_len;
skb_len = skb->len; skb_len = skb->len;
d_fnstart(4, dev, "(i2400m %p skb %p [size %zu])\n", d_fnstart(4, dev, "(i2400m %p skb %p [size %u])\n",
i2400m, skb, skb_len); i2400m, skb, skb_len);
result = -EIO; result = -EIO;
msg_hdr = (void *) skb->data; msg_hdr = (void *) skb->data;
result = i2400m_rx_msg_hdr_check(i2400m, msg_hdr, skb->len); result = i2400m_rx_msg_hdr_check(i2400m, msg_hdr, skb_len);
if (result < 0) if (result < 0)
goto error_msg_hdr_check; goto error_msg_hdr_check;
result = -EIO; result = -EIO;
...@@ -1261,10 +1261,10 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) ...@@ -1261,10 +1261,10 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb)
pl_itr = sizeof(*msg_hdr) + /* Check payload descriptor(s) */ pl_itr = sizeof(*msg_hdr) + /* Check payload descriptor(s) */
num_pls * sizeof(msg_hdr->pld[0]); num_pls * sizeof(msg_hdr->pld[0]);
pl_itr = ALIGN(pl_itr, I2400M_PL_ALIGN); pl_itr = ALIGN(pl_itr, I2400M_PL_ALIGN);
if (pl_itr > skb->len) { /* got all the payload descriptors? */ if (pl_itr > skb_len) { /* got all the payload descriptors? */
dev_err(dev, "RX: HW BUG? message too short (%u bytes) for " dev_err(dev, "RX: HW BUG? message too short (%u bytes) for "
"%u payload descriptors (%zu each, total %zu)\n", "%u payload descriptors (%zu each, total %zu)\n",
skb->len, num_pls, sizeof(msg_hdr->pld[0]), pl_itr); skb_len, num_pls, sizeof(msg_hdr->pld[0]), pl_itr);
goto error_pl_descr_short; goto error_pl_descr_short;
} }
/* Walk each payload payload--check we really got it */ /* Walk each payload payload--check we really got it */
...@@ -1272,7 +1272,7 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) ...@@ -1272,7 +1272,7 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb)
/* work around old gcc warnings */ /* work around old gcc warnings */
pl_size = i2400m_pld_size(&msg_hdr->pld[i]); pl_size = i2400m_pld_size(&msg_hdr->pld[i]);
result = i2400m_rx_pl_descr_check(i2400m, &msg_hdr->pld[i], result = i2400m_rx_pl_descr_check(i2400m, &msg_hdr->pld[i],
pl_itr, skb->len); pl_itr, skb_len);
if (result < 0) if (result < 0)
goto error_pl_descr_check; goto error_pl_descr_check;
single_last = num_pls == 1 || i == num_pls - 1; single_last = num_pls == 1 || i == num_pls - 1;
...@@ -1290,16 +1290,16 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) ...@@ -1290,16 +1290,16 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb)
if (i < i2400m->rx_pl_min) if (i < i2400m->rx_pl_min)
i2400m->rx_pl_min = i; i2400m->rx_pl_min = i;
i2400m->rx_num++; i2400m->rx_num++;
i2400m->rx_size_acc += skb->len; i2400m->rx_size_acc += skb_len;
if (skb->len < i2400m->rx_size_min) if (skb_len < i2400m->rx_size_min)
i2400m->rx_size_min = skb->len; i2400m->rx_size_min = skb_len;
if (skb->len > i2400m->rx_size_max) if (skb_len > i2400m->rx_size_max)
i2400m->rx_size_max = skb->len; i2400m->rx_size_max = skb_len;
spin_unlock_irqrestore(&i2400m->rx_lock, flags); spin_unlock_irqrestore(&i2400m->rx_lock, flags);
error_pl_descr_check: error_pl_descr_check:
error_pl_descr_short: error_pl_descr_short:
error_msg_hdr_check: error_msg_hdr_check:
d_fnend(4, dev, "(i2400m %p skb %p [size %zu]) = %d\n", d_fnend(4, dev, "(i2400m %p skb %p [size %u]) = %d\n",
i2400m, skb, skb_len, result); i2400m, skb, skb_len, result);
return result; return result;
} }
......
...@@ -778,7 +778,7 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -778,7 +778,7 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb)
eg->packets_rcvd++; eg->packets_rcvd++;
mpc->eg_ops->put(eg); mpc->eg_ops->put(eg);
memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data)); memset(ATM_SKB(new_skb), 0, sizeof(struct atm_skb_data));
netif_rx(new_skb); netif_rx(new_skb);
} }
......
...@@ -397,7 +397,7 @@ static noinline_for_stack int ethtool_get_rxfh_indir(struct net_device *dev, ...@@ -397,7 +397,7 @@ static noinline_for_stack int ethtool_get_rxfh_indir(struct net_device *dev,
(KMALLOC_MAX_SIZE - sizeof(*indir)) / sizeof(*indir->ring_index)) (KMALLOC_MAX_SIZE - sizeof(*indir)) / sizeof(*indir->ring_index))
return -ENOMEM; return -ENOMEM;
full_size = sizeof(*indir) + sizeof(*indir->ring_index) * table_size; full_size = sizeof(*indir) + sizeof(*indir->ring_index) * table_size;
indir = kmalloc(full_size, GFP_USER); indir = kzalloc(full_size, GFP_USER);
if (!indir) if (!indir)
return -ENOMEM; return -ENOMEM;
...@@ -538,7 +538,7 @@ static int ethtool_get_rx_ntuple(struct net_device *dev, void __user *useraddr) ...@@ -538,7 +538,7 @@ static int ethtool_get_rx_ntuple(struct net_device *dev, void __user *useraddr)
gstrings.len = ret; gstrings.len = ret;
data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER); data = kzalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER);
if (!data) if (!data)
return -ENOMEM; return -ENOMEM;
...@@ -775,7 +775,7 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr) ...@@ -775,7 +775,7 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr)
if (regs.len > reglen) if (regs.len > reglen)
regs.len = reglen; regs.len = reglen;
regbuf = kmalloc(reglen, GFP_USER); regbuf = kzalloc(reglen, GFP_USER);
if (!regbuf) if (!regbuf)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment