aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-08-14 19:25:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-14 19:25:21 -0400
commitad15afb8b9e80bec6c4337369f63207ff59c44ae (patch)
treecdd378c1a6f07cc580033730995e2c883379248d /drivers/net/ethernet
parent899552d6e84babd24611fd36ac7051068cb1eb2d (diff)
parenta61ebdfdb13a051f707b408d464f63b991aa21e3 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: "I'm sending this out, in particular, to get the iwlwifi fix propagated: 1) Fix build due to missing include in i40e driver, from Lucas Tanure. 2) Memory leak in openvswitch port allocation, from Chirstoph Jaeger. 3) Check DMA mapping errors in myri10ge, from Stanislaw Gruszka. 4) Fix various deadlock scenerios in sunvnet driver, from Sowmini Varadhan. 5) Fix cxgb4i build failures with incompatible Kconfig settings of the driver vs ipv6, from Anish Bhatt. 6) Fix generation of ACK packet timestamps in the presence of TSO which will be split up, from Willem de Bruijn. 7) Don't enable sched scan in iwlwifi driver, it causes firmware crashes in some revisions. From Emmanuel Grumbach. 8) Revert a macvlan simplification that causes crashes. 9) Handle RTT calculations properly in the presence of repair'd SKBs, from Andrey Vagin. 10) SIT tunnel lookup uses wrong device index in compares, from Shmulik Ladkani. 11) Handle MTU reductions in TCP properly for ipv4 mapped ipv6 sockets, from Neal Cardwell. 12) Add missing annotations in rhashtable code, from Thomas Graf. 13) Fix false interpretation of two RTOs as being from the same TCP loss event in the FRTO code, from Neal Cardwell" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (42 commits) netlink: Annotate RCU locking for seq_file walker rhashtable: fix annotations for rht_for_each_entry_rcu() rhashtable: unexport and make rht_obj() static rhashtable: RCU annotations for next pointers tcp: fix ssthresh and undo for consecutive short FRTO episodes tcp: don't allow syn packets without timestamps to pass tcp_tw_recycle logic tcp: fix tcp_release_cb() to dispatch via address family for mtu_reduced() sit: Fix ipip6_tunnel_lookup device matching criteria net: ethernet: ibm: ehea: Remove duplicate object from Makefile net: xgene: Check negative return value of xgene_enet_get_ring_size() tcp: don't use timestamp from repaired skb-s to calculate RTT (v2) net: xilinx: Remove .owner field for driver Revert "macvlan: simplify the structure port" iwlwifi: mvm: disable scheduled scan to prevent firmware crash xen-netback: remove loop waiting function xen-netback: don't stop dealloc kthread too early xen-netback: move NAPI add/remove calls xen-netback: fix debugfs entry creation xen-netback: fix debugfs write length check net-timestamp: fix missing tcp fragmentation cases ...
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/apm/xgene/xgene_enet_main.c7
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c3
-rw-r--r--drivers/net/ethernet/ibm/ehea/Makefile2
-rw-r--r--drivers/net/ethernet/intel/e1000e/manage.c4
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_fcoe.c1
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c18
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_nvm.c6
-rw-r--r--drivers/net/ethernet/myricom/myri10ge/myri10ge.c88
-rw-r--r--drivers/net/ethernet/sun/sunvnet.c38
-rw-r--r--drivers/net/ethernet/sun/sunvnet.h4
-rw-r--r--drivers/net/ethernet/xilinx/ll_temac_main.c1
-rw-r--r--drivers/net/ethernet/xilinx/xilinx_axienet_main.c1
-rw-r--r--drivers/net/ethernet/xilinx/xilinx_emaclite.c1
13 files changed, 120 insertions, 54 deletions
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index af7c40ac1455..e1a8f4e19983 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -581,7 +581,11 @@ static struct xgene_enet_desc_ring *xgene_enet_create_desc_ring(
581 struct xgene_enet_desc_ring *ring; 581 struct xgene_enet_desc_ring *ring;
582 struct xgene_enet_pdata *pdata = netdev_priv(ndev); 582 struct xgene_enet_pdata *pdata = netdev_priv(ndev);
583 struct device *dev = ndev_to_dev(ndev); 583 struct device *dev = ndev_to_dev(ndev);
584 u32 size; 584 int size;
585
586 size = xgene_enet_get_ring_size(dev, cfgsize);
587 if (size < 0)
588 return NULL;
585 589
586 ring = devm_kzalloc(dev, sizeof(struct xgene_enet_desc_ring), 590 ring = devm_kzalloc(dev, sizeof(struct xgene_enet_desc_ring),
587 GFP_KERNEL); 591 GFP_KERNEL);
@@ -593,7 +597,6 @@ static struct xgene_enet_desc_ring *xgene_enet_create_desc_ring(
593 ring->cfgsize = cfgsize; 597 ring->cfgsize = cfgsize;
594 ring->id = ring_id; 598 ring->id = ring_id;
595 599
596 size = xgene_enet_get_ring_size(dev, cfgsize);
597 ring->desc_addr = dma_zalloc_coherent(dev, size, &ring->dma, 600 ring->desc_addr = dma_zalloc_coherent(dev, size, &ring->dma,
598 GFP_KERNEL); 601 GFP_KERNEL);
599 if (!ring->desc_addr) { 602 if (!ring->desc_addr) {
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index a3dd5dc64f4c..4296b3d26f02 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -14093,8 +14093,9 @@ static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *dev,
14093 14093
14094 spin_lock_bh(&tp->lock); 14094 spin_lock_bh(&tp->lock);
14095 if (!tp->hw_stats) { 14095 if (!tp->hw_stats) {
14096 *stats = tp->net_stats_prev;
14096 spin_unlock_bh(&tp->lock); 14097 spin_unlock_bh(&tp->lock);
14097 return &tp->net_stats_prev; 14098 return stats;
14098 } 14099 }
14099 14100
14100 tg3_get_nstats(tp, stats); 14101 tg3_get_nstats(tp, stats);
diff --git a/drivers/net/ethernet/ibm/ehea/Makefile b/drivers/net/ethernet/ibm/ehea/Makefile
index 775d9969b5c2..cd473e295242 100644
--- a/drivers/net/ethernet/ibm/ehea/Makefile
+++ b/drivers/net/ethernet/ibm/ehea/Makefile
@@ -1,6 +1,6 @@
1# 1#
2# Makefile for the eHEA ethernet device driver for IBM eServer System p 2# Makefile for the eHEA ethernet device driver for IBM eServer System p
3# 3#
4ehea-y = ehea_main.o ehea_phyp.o ehea_qmr.o ehea_ethtool.o ehea_phyp.o 4ehea-y = ehea_main.o ehea_phyp.o ehea_qmr.o ehea_ethtool.o
5obj-$(CONFIG_EHEA) += ehea.o 5obj-$(CONFIG_EHEA) += ehea.o
6 6
diff --git a/drivers/net/ethernet/intel/e1000e/manage.c b/drivers/net/ethernet/intel/e1000e/manage.c
index 58856032298d..06edfca1a35e 100644
--- a/drivers/net/ethernet/intel/e1000e/manage.c
+++ b/drivers/net/ethernet/intel/e1000e/manage.c
@@ -47,7 +47,7 @@ static u8 e1000_calculate_checksum(u8 *buffer, u32 length)
47 * e1000_mng_enable_host_if - Checks host interface is enabled 47 * e1000_mng_enable_host_if - Checks host interface is enabled
48 * @hw: pointer to the HW structure 48 * @hw: pointer to the HW structure
49 * 49 *
50 * Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND 50 * Returns 0 upon success, else -E1000_ERR_HOST_INTERFACE_COMMAND
51 * 51 *
52 * This function checks whether the HOST IF is enabled for command operation 52 * This function checks whether the HOST IF is enabled for command operation
53 * and also checks whether the previous command is completed. It busy waits 53 * and also checks whether the previous command is completed. It busy waits
@@ -78,7 +78,7 @@ static s32 e1000_mng_enable_host_if(struct e1000_hw *hw)
78 } 78 }
79 79
80 if (i == E1000_MNG_DHCP_COMMAND_TIMEOUT) { 80 if (i == E1000_MNG_DHCP_COMMAND_TIMEOUT) {
81 e_dbg("Previous command timeout failed .\n"); 81 e_dbg("Previous command timeout failed.\n");
82 return -E1000_ERR_HOST_INTERFACE_COMMAND; 82 return -E1000_ERR_HOST_INTERFACE_COMMAND;
83 } 83 }
84 84
diff --git a/drivers/net/ethernet/intel/i40e/i40e_fcoe.c b/drivers/net/ethernet/intel/i40e/i40e_fcoe.c
index 6938fc1ad877..5d01db1d789b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_fcoe.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_fcoe.c
@@ -33,6 +33,7 @@
33#include <scsi/fc/fc_fcoe.h> 33#include <scsi/fc/fc_fcoe.h>
34#include <scsi/libfc.h> 34#include <scsi/libfc.h>
35#include <scsi/libfcoe.h> 35#include <scsi/libfcoe.h>
36#include <uapi/linux/dcbnl.h>
36 37
37#include "i40e.h" 38#include "i40e.h"
38#include "i40e_fcoe.h" 39#include "i40e_fcoe.h"
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 51bc03072ed3..871474f6fe62 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -4415,13 +4415,13 @@ static void i40e_print_link_message(struct i40e_vsi *vsi, bool isup)
4415 4415
4416 switch (vsi->back->hw.phy.link_info.link_speed) { 4416 switch (vsi->back->hw.phy.link_info.link_speed) {
4417 case I40E_LINK_SPEED_40GB: 4417 case I40E_LINK_SPEED_40GB:
4418 strncpy(speed, "40 Gbps", SPEED_SIZE); 4418 strlcpy(speed, "40 Gbps", SPEED_SIZE);
4419 break; 4419 break;
4420 case I40E_LINK_SPEED_10GB: 4420 case I40E_LINK_SPEED_10GB:
4421 strncpy(speed, "10 Gbps", SPEED_SIZE); 4421 strlcpy(speed, "10 Gbps", SPEED_SIZE);
4422 break; 4422 break;
4423 case I40E_LINK_SPEED_1GB: 4423 case I40E_LINK_SPEED_1GB:
4424 strncpy(speed, "1000 Mbps", SPEED_SIZE); 4424 strlcpy(speed, "1000 Mbps", SPEED_SIZE);
4425 break; 4425 break;
4426 default: 4426 default:
4427 break; 4427 break;
@@ -4429,16 +4429,16 @@ static void i40e_print_link_message(struct i40e_vsi *vsi, bool isup)
4429 4429
4430 switch (vsi->back->hw.fc.current_mode) { 4430 switch (vsi->back->hw.fc.current_mode) {
4431 case I40E_FC_FULL: 4431 case I40E_FC_FULL:
4432 strncpy(fc, "RX/TX", FC_SIZE); 4432 strlcpy(fc, "RX/TX", FC_SIZE);
4433 break; 4433 break;
4434 case I40E_FC_TX_PAUSE: 4434 case I40E_FC_TX_PAUSE:
4435 strncpy(fc, "TX", FC_SIZE); 4435 strlcpy(fc, "TX", FC_SIZE);
4436 break; 4436 break;
4437 case I40E_FC_RX_PAUSE: 4437 case I40E_FC_RX_PAUSE:
4438 strncpy(fc, "RX", FC_SIZE); 4438 strlcpy(fc, "RX", FC_SIZE);
4439 break; 4439 break;
4440 default: 4440 default:
4441 strncpy(fc, "None", FC_SIZE); 4441 strlcpy(fc, "None", FC_SIZE);
4442 break; 4442 break;
4443 } 4443 }
4444 4444
@@ -5839,7 +5839,7 @@ static void i40e_send_version(struct i40e_pf *pf)
5839 dv.minor_version = DRV_VERSION_MINOR; 5839 dv.minor_version = DRV_VERSION_MINOR;
5840 dv.build_version = DRV_VERSION_BUILD; 5840 dv.build_version = DRV_VERSION_BUILD;
5841 dv.subbuild_version = 0; 5841 dv.subbuild_version = 0;
5842 strncpy(dv.driver_string, DRV_VERSION, sizeof(dv.driver_string)); 5842 strlcpy(dv.driver_string, DRV_VERSION, sizeof(dv.driver_string));
5843 i40e_aq_send_driver_version(&pf->hw, &dv, NULL); 5843 i40e_aq_send_driver_version(&pf->hw, &dv, NULL);
5844} 5844}
5845 5845
@@ -6293,7 +6293,7 @@ static int i40e_vsi_alloc_arrays(struct i40e_vsi *vsi, bool alloc_qvectors)
6293 6293
6294 if (alloc_qvectors) { 6294 if (alloc_qvectors) {
6295 /* allocate memory for q_vector pointers */ 6295 /* allocate memory for q_vector pointers */
6296 size = sizeof(struct i40e_q_vectors *) * vsi->num_q_vectors; 6296 size = sizeof(struct i40e_q_vector *) * vsi->num_q_vectors;
6297 vsi->q_vectors = kzalloc(size, GFP_KERNEL); 6297 vsi->q_vectors = kzalloc(size, GFP_KERNEL);
6298 if (!vsi->q_vectors) { 6298 if (!vsi->q_vectors) {
6299 ret = -ENOMEM; 6299 ret = -ENOMEM;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
index 97bda3dffd49..25c4f9a3011f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
@@ -251,9 +251,9 @@ i40e_status i40e_read_nvm_buffer(struct i40e_hw *hw, u16 offset,
251 * 251 *
252 * Writes a 16 bit words buffer to the Shadow RAM using the admin command. 252 * Writes a 16 bit words buffer to the Shadow RAM using the admin command.
253 **/ 253 **/
254i40e_status i40e_write_nvm_aq(struct i40e_hw *hw, u8 module_pointer, 254static i40e_status i40e_write_nvm_aq(struct i40e_hw *hw, u8 module_pointer,
255 u32 offset, u16 words, void *data, 255 u32 offset, u16 words, void *data,
256 bool last_command) 256 bool last_command)
257{ 257{
258 i40e_status ret_code = I40E_ERR_NVM; 258 i40e_status ret_code = I40E_ERR_NVM;
259 259
diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
index 69c26f04d8ce..679db026f4be 100644
--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
@@ -873,6 +873,10 @@ static int myri10ge_dma_test(struct myri10ge_priv *mgp, int test_type)
873 return -ENOMEM; 873 return -ENOMEM;
874 dmatest_bus = pci_map_page(mgp->pdev, dmatest_page, 0, PAGE_SIZE, 874 dmatest_bus = pci_map_page(mgp->pdev, dmatest_page, 0, PAGE_SIZE,
875 DMA_BIDIRECTIONAL); 875 DMA_BIDIRECTIONAL);
876 if (unlikely(pci_dma_mapping_error(mgp->pdev, dmatest_bus))) {
877 __free_page(dmatest_page);
878 return -ENOMEM;
879 }
876 880
877 /* Run a small DMA test. 881 /* Run a small DMA test.
878 * The magic multipliers to the length tell the firmware 882 * The magic multipliers to the length tell the firmware
@@ -1294,6 +1298,7 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
1294 int bytes, int watchdog) 1298 int bytes, int watchdog)
1295{ 1299{
1296 struct page *page; 1300 struct page *page;
1301 dma_addr_t bus;
1297 int idx; 1302 int idx;
1298#if MYRI10GE_ALLOC_SIZE > 4096 1303#if MYRI10GE_ALLOC_SIZE > 4096
1299 int end_offset; 1304 int end_offset;
@@ -1318,11 +1323,21 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
1318 rx->watchdog_needed = 1; 1323 rx->watchdog_needed = 1;
1319 return; 1324 return;
1320 } 1325 }
1326
1327 bus = pci_map_page(mgp->pdev, page, 0,
1328 MYRI10GE_ALLOC_SIZE,
1329 PCI_DMA_FROMDEVICE);
1330 if (unlikely(pci_dma_mapping_error(mgp->pdev, bus))) {
1331 __free_pages(page, MYRI10GE_ALLOC_ORDER);
1332 if (rx->fill_cnt - rx->cnt < 16)
1333 rx->watchdog_needed = 1;
1334 return;
1335 }
1336
1321 rx->page = page; 1337 rx->page = page;
1322 rx->page_offset = 0; 1338 rx->page_offset = 0;
1323 rx->bus = pci_map_page(mgp->pdev, page, 0, 1339 rx->bus = bus;
1324 MYRI10GE_ALLOC_SIZE, 1340
1325 PCI_DMA_FROMDEVICE);
1326 } 1341 }
1327 rx->info[idx].page = rx->page; 1342 rx->info[idx].page = rx->page;
1328 rx->info[idx].page_offset = rx->page_offset; 1343 rx->info[idx].page_offset = rx->page_offset;
@@ -2764,6 +2779,35 @@ myri10ge_submit_req(struct myri10ge_tx_buf *tx, struct mcp_kreq_ether_send *src,
2764 mb(); 2779 mb();
2765} 2780}
2766 2781
2782static void myri10ge_unmap_tx_dma(struct myri10ge_priv *mgp,
2783 struct myri10ge_tx_buf *tx, int idx)
2784{
2785 unsigned int len;
2786 int last_idx;
2787
2788 /* Free any DMA resources we've alloced and clear out the skb slot */
2789 last_idx = (idx + 1) & tx->mask;
2790 idx = tx->req & tx->mask;
2791 do {
2792 len = dma_unmap_len(&tx->info[idx], len);
2793 if (len) {
2794 if (tx->info[idx].skb != NULL)
2795 pci_unmap_single(mgp->pdev,
2796 dma_unmap_addr(&tx->info[idx],
2797 bus), len,
2798 PCI_DMA_TODEVICE);
2799 else
2800 pci_unmap_page(mgp->pdev,
2801 dma_unmap_addr(&tx->info[idx],
2802 bus), len,
2803 PCI_DMA_TODEVICE);
2804 dma_unmap_len_set(&tx->info[idx], len, 0);
2805 tx->info[idx].skb = NULL;
2806 }
2807 idx = (idx + 1) & tx->mask;
2808 } while (idx != last_idx);
2809}
2810
2767/* 2811/*
2768 * Transmit a packet. We need to split the packet so that a single 2812 * Transmit a packet. We need to split the packet so that a single
2769 * segment does not cross myri10ge->tx_boundary, so this makes segment 2813 * segment does not cross myri10ge->tx_boundary, so this makes segment
@@ -2787,7 +2831,7 @@ static netdev_tx_t myri10ge_xmit(struct sk_buff *skb,
2787 u32 low; 2831 u32 low;
2788 __be32 high_swapped; 2832 __be32 high_swapped;
2789 unsigned int len; 2833 unsigned int len;
2790 int idx, last_idx, avail, frag_cnt, frag_idx, count, mss, max_segments; 2834 int idx, avail, frag_cnt, frag_idx, count, mss, max_segments;
2791 u16 pseudo_hdr_offset, cksum_offset, queue; 2835 u16 pseudo_hdr_offset, cksum_offset, queue;
2792 int cum_len, seglen, boundary, rdma_count; 2836 int cum_len, seglen, boundary, rdma_count;
2793 u8 flags, odd_flag; 2837 u8 flags, odd_flag;
@@ -2884,9 +2928,12 @@ again:
2884 2928
2885 /* map the skb for DMA */ 2929 /* map the skb for DMA */
2886 len = skb_headlen(skb); 2930 len = skb_headlen(skb);
2931 bus = pci_map_single(mgp->pdev, skb->data, len, PCI_DMA_TODEVICE);
2932 if (unlikely(pci_dma_mapping_error(mgp->pdev, bus)))
2933 goto drop;
2934
2887 idx = tx->req & tx->mask; 2935 idx = tx->req & tx->mask;
2888 tx->info[idx].skb = skb; 2936 tx->info[idx].skb = skb;
2889 bus = pci_map_single(mgp->pdev, skb->data, len, PCI_DMA_TODEVICE);
2890 dma_unmap_addr_set(&tx->info[idx], bus, bus); 2937 dma_unmap_addr_set(&tx->info[idx], bus, bus);
2891 dma_unmap_len_set(&tx->info[idx], len, len); 2938 dma_unmap_len_set(&tx->info[idx], len, len);
2892 2939
@@ -2985,12 +3032,16 @@ again:
2985 break; 3032 break;
2986 3033
2987 /* map next fragment for DMA */ 3034 /* map next fragment for DMA */
2988 idx = (count + tx->req) & tx->mask;
2989 frag = &skb_shinfo(skb)->frags[frag_idx]; 3035 frag = &skb_shinfo(skb)->frags[frag_idx];
2990 frag_idx++; 3036 frag_idx++;
2991 len = skb_frag_size(frag); 3037 len = skb_frag_size(frag);
2992 bus = skb_frag_dma_map(&mgp->pdev->dev, frag, 0, len, 3038 bus = skb_frag_dma_map(&mgp->pdev->dev, frag, 0, len,
2993 DMA_TO_DEVICE); 3039 DMA_TO_DEVICE);
3040 if (unlikely(pci_dma_mapping_error(mgp->pdev, bus))) {
3041 myri10ge_unmap_tx_dma(mgp, tx, idx);
3042 goto drop;
3043 }
3044 idx = (count + tx->req) & tx->mask;
2994 dma_unmap_addr_set(&tx->info[idx], bus, bus); 3045 dma_unmap_addr_set(&tx->info[idx], bus, bus);
2995 dma_unmap_len_set(&tx->info[idx], len, len); 3046 dma_unmap_len_set(&tx->info[idx], len, len);
2996 } 3047 }
@@ -3021,31 +3072,8 @@ again:
3021 return NETDEV_TX_OK; 3072 return NETDEV_TX_OK;
3022 3073
3023abort_linearize: 3074abort_linearize:
3024 /* Free any DMA resources we've alloced and clear out the skb 3075 myri10ge_unmap_tx_dma(mgp, tx, idx);
3025 * slot so as to not trip up assertions, and to avoid a
3026 * double-free if linearizing fails */
3027 3076
3028 last_idx = (idx + 1) & tx->mask;
3029 idx = tx->req & tx->mask;
3030 tx->info[idx].skb = NULL;
3031 do {
3032 len = dma_unmap_len(&tx->info[idx], len);
3033 if (len) {
3034 if (tx->info[idx].skb != NULL)
3035 pci_unmap_single(mgp->pdev,
3036 dma_unmap_addr(&tx->info[idx],
3037 bus), len,
3038 PCI_DMA_TODEVICE);
3039 else
3040 pci_unmap_page(mgp->pdev,
3041 dma_unmap_addr(&tx->info[idx],
3042 bus), len,
3043 PCI_DMA_TODEVICE);
3044 dma_unmap_len_set(&tx->info[idx], len, 0);
3045 tx->info[idx].skb = NULL;
3046 }
3047 idx = (idx + 1) & tx->mask;
3048 } while (idx != last_idx);
3049 if (skb_is_gso(skb)) { 3077 if (skb_is_gso(skb)) {
3050 netdev_err(mgp->dev, "TSO but wanted to linearize?!?!?\n"); 3078 netdev_err(mgp->dev, "TSO but wanted to linearize?!?!?\n");
3051 goto drop; 3079 goto drop;
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
index d813bfb1a847..23c89ab5a6ad 100644
--- a/drivers/net/ethernet/sun/sunvnet.c
+++ b/drivers/net/ethernet/sun/sunvnet.c
@@ -32,6 +32,11 @@ MODULE_DESCRIPTION("Sun LDOM virtual network driver");
32MODULE_LICENSE("GPL"); 32MODULE_LICENSE("GPL");
33MODULE_VERSION(DRV_MODULE_VERSION); 33MODULE_VERSION(DRV_MODULE_VERSION);
34 34
35/* Heuristic for the number of times to exponentially backoff and
36 * retry sending an LDC trigger when EAGAIN is encountered
37 */
38#define VNET_MAX_RETRIES 10
39
35/* Ordered from largest major to lowest */ 40/* Ordered from largest major to lowest */
36static struct vio_version vnet_versions[] = { 41static struct vio_version vnet_versions[] = {
37 { .major = 1, .minor = 0 }, 42 { .major = 1, .minor = 0 },
@@ -260,6 +265,7 @@ static int vnet_send_ack(struct vnet_port *port, struct vio_dring_state *dr,
260 .state = vio_dring_state, 265 .state = vio_dring_state,
261 }; 266 };
262 int err, delay; 267 int err, delay;
268 int retries = 0;
263 269
264 hdr.seq = dr->snd_nxt; 270 hdr.seq = dr->snd_nxt;
265 delay = 1; 271 delay = 1;
@@ -272,6 +278,13 @@ static int vnet_send_ack(struct vnet_port *port, struct vio_dring_state *dr,
272 udelay(delay); 278 udelay(delay);
273 if ((delay <<= 1) > 128) 279 if ((delay <<= 1) > 128)
274 delay = 128; 280 delay = 128;
281 if (retries++ > VNET_MAX_RETRIES) {
282 pr_info("ECONNRESET %x:%x:%x:%x:%x:%x\n",
283 port->raddr[0], port->raddr[1],
284 port->raddr[2], port->raddr[3],
285 port->raddr[4], port->raddr[5]);
286 err = -ECONNRESET;
287 }
275 } while (err == -EAGAIN); 288 } while (err == -EAGAIN);
276 289
277 return err; 290 return err;
@@ -475,8 +488,9 @@ static int handle_mcast(struct vnet_port *port, void *msgbuf)
475 return 0; 488 return 0;
476} 489}
477 490
478static void maybe_tx_wakeup(struct vnet *vp) 491static void maybe_tx_wakeup(unsigned long param)
479{ 492{
493 struct vnet *vp = (struct vnet *)param;
480 struct net_device *dev = vp->dev; 494 struct net_device *dev = vp->dev;
481 495
482 netif_tx_lock(dev); 496 netif_tx_lock(dev);
@@ -573,8 +587,13 @@ static void vnet_event(void *arg, int event)
573 break; 587 break;
574 } 588 }
575 spin_unlock(&vio->lock); 589 spin_unlock(&vio->lock);
590 /* Kick off a tasklet to wake the queue. We cannot call
591 * maybe_tx_wakeup directly here because we could deadlock on
592 * netif_tx_lock() with dev_watchdog()
593 */
576 if (unlikely(tx_wakeup && err != -ECONNRESET)) 594 if (unlikely(tx_wakeup && err != -ECONNRESET))
577 maybe_tx_wakeup(port->vp); 595 tasklet_schedule(&port->vp->vnet_tx_wakeup);
596
578 local_irq_restore(flags); 597 local_irq_restore(flags);
579} 598}
580 599
@@ -593,6 +612,7 @@ static int __vnet_tx_trigger(struct vnet_port *port)
593 .end_idx = (u32) -1, 612 .end_idx = (u32) -1,
594 }; 613 };
595 int err, delay; 614 int err, delay;
615 int retries = 0;
596 616
597 hdr.seq = dr->snd_nxt; 617 hdr.seq = dr->snd_nxt;
598 delay = 1; 618 delay = 1;
@@ -605,6 +625,8 @@ static int __vnet_tx_trigger(struct vnet_port *port)
605 udelay(delay); 625 udelay(delay);
606 if ((delay <<= 1) > 128) 626 if ((delay <<= 1) > 128)
607 delay = 128; 627 delay = 128;
628 if (retries++ > VNET_MAX_RETRIES)
629 break;
608 } while (err == -EAGAIN); 630 } while (err == -EAGAIN);
609 631
610 return err; 632 return err;
@@ -691,7 +713,15 @@ static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev)
691 memset(tx_buf+VNET_PACKET_SKIP+skb->len, 0, len - skb->len); 713 memset(tx_buf+VNET_PACKET_SKIP+skb->len, 0, len - skb->len);
692 } 714 }
693 715
694 d->hdr.ack = VIO_ACK_ENABLE; 716 /* We don't rely on the ACKs to free the skb in vnet_start_xmit(),
717 * thus it is safe to not set VIO_ACK_ENABLE for each transmission:
718 * the protocol itself does not require it as long as the peer
719 * sends a VIO_SUBTYPE_ACK for VIO_DRING_STOPPED.
720 *
721 * An ACK for every packet in the ring is expensive as the
722 * sending of LDC messages is slow and affects performance.
723 */
724 d->hdr.ack = VIO_ACK_DISABLE;
695 d->size = len; 725 d->size = len;
696 d->ncookies = port->tx_bufs[dr->prod].ncookies; 726 d->ncookies = port->tx_bufs[dr->prod].ncookies;
697 for (i = 0; i < d->ncookies; i++) 727 for (i = 0; i < d->ncookies; i++)
@@ -1046,6 +1076,7 @@ static struct vnet *vnet_new(const u64 *local_mac)
1046 vp = netdev_priv(dev); 1076 vp = netdev_priv(dev);
1047 1077
1048 spin_lock_init(&vp->lock); 1078 spin_lock_init(&vp->lock);
1079 tasklet_init(&vp->vnet_tx_wakeup, maybe_tx_wakeup, (unsigned long)vp);
1049 vp->dev = dev; 1080 vp->dev = dev;
1050 1081
1051 INIT_LIST_HEAD(&vp->port_list); 1082 INIT_LIST_HEAD(&vp->port_list);
@@ -1105,6 +1136,7 @@ static void vnet_cleanup(void)
1105 vp = list_first_entry(&vnet_list, struct vnet, list); 1136 vp = list_first_entry(&vnet_list, struct vnet, list);
1106 list_del(&vp->list); 1137 list_del(&vp->list);
1107 dev = vp->dev; 1138 dev = vp->dev;
1139 tasklet_kill(&vp->vnet_tx_wakeup);
1108 /* vio_unregister_driver() should have cleaned up port_list */ 1140 /* vio_unregister_driver() should have cleaned up port_list */
1109 BUG_ON(!list_empty(&vp->port_list)); 1141 BUG_ON(!list_empty(&vp->port_list));
1110 unregister_netdev(dev); 1142 unregister_netdev(dev);
diff --git a/drivers/net/ethernet/sun/sunvnet.h b/drivers/net/ethernet/sun/sunvnet.h
index d347a5bf24b0..de5c2c64996f 100644
--- a/drivers/net/ethernet/sun/sunvnet.h
+++ b/drivers/net/ethernet/sun/sunvnet.h
@@ -1,6 +1,8 @@
1#ifndef _SUNVNET_H 1#ifndef _SUNVNET_H
2#define _SUNVNET_H 2#define _SUNVNET_H
3 3
4#include <linux/interrupt.h>
5
4#define DESC_NCOOKIES(entry_size) \ 6#define DESC_NCOOKIES(entry_size) \
5 ((entry_size) - sizeof(struct vio_net_desc)) 7 ((entry_size) - sizeof(struct vio_net_desc))
6 8
@@ -78,6 +80,8 @@ struct vnet {
78 80
79 struct list_head list; 81 struct list_head list;
80 u64 local_mac; 82 u64 local_mac;
83
84 struct tasklet_struct vnet_tx_wakeup;
81}; 85};
82 86
83#endif /* _SUNVNET_H */ 87#endif /* _SUNVNET_H */
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 36f4459520c3..fda5891835d4 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -1170,7 +1170,6 @@ static struct platform_driver temac_of_driver = {
1170 .probe = temac_of_probe, 1170 .probe = temac_of_probe,
1171 .remove = temac_of_remove, 1171 .remove = temac_of_remove,
1172 .driver = { 1172 .driver = {
1173 .owner = THIS_MODULE,
1174 .name = "xilinx_temac", 1173 .name = "xilinx_temac",
1175 .of_match_table = temac_of_match, 1174 .of_match_table = temac_of_match,
1176 }, 1175 },
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 30e8608ff050..c8fd94133ecd 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -1645,7 +1645,6 @@ static struct platform_driver axienet_of_driver = {
1645 .probe = axienet_of_probe, 1645 .probe = axienet_of_probe,
1646 .remove = axienet_of_remove, 1646 .remove = axienet_of_remove,
1647 .driver = { 1647 .driver = {
1648 .owner = THIS_MODULE,
1649 .name = "xilinx_axienet", 1648 .name = "xilinx_axienet",
1650 .of_match_table = axienet_of_match, 1649 .of_match_table = axienet_of_match,
1651 }, 1650 },
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 782bb9373cd8..28dbbdc393eb 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1245,7 +1245,6 @@ MODULE_DEVICE_TABLE(of, xemaclite_of_match);
1245static struct platform_driver xemaclite_of_driver = { 1245static struct platform_driver xemaclite_of_driver = {
1246 .driver = { 1246 .driver = {
1247 .name = DRIVER_NAME, 1247 .name = DRIVER_NAME,
1248 .owner = THIS_MODULE,
1249 .of_match_table = xemaclite_of_match, 1248 .of_match_table = xemaclite_of_match,
1250 }, 1249 },
1251 .probe = xemaclite_of_probe, 1250 .probe = xemaclite_of_probe,