Skip to content

Commit ad15afb

Browse files
committed
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 ...
2 parents 899552d + a61ebdf commit ad15afb

File tree

44 files changed

+332
-214
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+332
-214
lines changed

drivers/net/ethernet/apm/xgene/xgene_enet_main.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,11 @@ static struct xgene_enet_desc_ring *xgene_enet_create_desc_ring(
581581
struct xgene_enet_desc_ring *ring;
582582
struct xgene_enet_pdata *pdata = netdev_priv(ndev);
583583
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;
585589

586590
ring = devm_kzalloc(dev, sizeof(struct xgene_enet_desc_ring),
587591
GFP_KERNEL);
@@ -593,7 +597,6 @@ static struct xgene_enet_desc_ring *xgene_enet_create_desc_ring(
593597
ring->cfgsize = cfgsize;
594598
ring->id = ring_id;
595599

596-
size = xgene_enet_get_ring_size(dev, cfgsize);
597600
ring->desc_addr = dma_zalloc_coherent(dev, size, &ring->dma,
598601
GFP_KERNEL);
599602
if (!ring->desc_addr) {

drivers/net/ethernet/broadcom/tg3.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14093,8 +14093,9 @@ static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *dev,
1409314093

1409414094
spin_lock_bh(&tp->lock);
1409514095
if (!tp->hw_stats) {
14096+
*stats = tp->net_stats_prev;
1409614097
spin_unlock_bh(&tp->lock);
14097-
return &tp->net_stats_prev;
14098+
return stats;
1409814099
}
1409914100

1410014101
tg3_get_nstats(tp, stats);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#
22
# Makefile for the eHEA ethernet device driver for IBM eServer System p
33
#
4-
ehea-y = ehea_main.o ehea_phyp.o ehea_qmr.o ehea_ethtool.o ehea_phyp.o
4+
ehea-y = ehea_main.o ehea_phyp.o ehea_qmr.o ehea_ethtool.o
55
obj-$(CONFIG_EHEA) += ehea.o
66

drivers/net/ethernet/intel/e1000e/manage.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static u8 e1000_calculate_checksum(u8 *buffer, u32 length)
4747
* e1000_mng_enable_host_if - Checks host interface is enabled
4848
* @hw: pointer to the HW structure
4949
*
50-
* Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND
50+
* Returns 0 upon success, else -E1000_ERR_HOST_INTERFACE_COMMAND
5151
*
5252
* This function checks whether the HOST IF is enabled for command operation
5353
* 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)
7878
}
7979

8080
if (i == E1000_MNG_DHCP_COMMAND_TIMEOUT) {
81-
e_dbg("Previous command timeout failed .\n");
81+
e_dbg("Previous command timeout failed.\n");
8282
return -E1000_ERR_HOST_INTERFACE_COMMAND;
8383
}
8484

drivers/net/ethernet/intel/i40e/i40e_fcoe.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <scsi/fc/fc_fcoe.h>
3434
#include <scsi/libfc.h>
3535
#include <scsi/libfcoe.h>
36+
#include <uapi/linux/dcbnl.h>
3637

3738
#include "i40e.h"
3839
#include "i40e_fcoe.h"

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4415,30 +4415,30 @@ static void i40e_print_link_message(struct i40e_vsi *vsi, bool isup)
44154415

44164416
switch (vsi->back->hw.phy.link_info.link_speed) {
44174417
case I40E_LINK_SPEED_40GB:
4418-
strncpy(speed, "40 Gbps", SPEED_SIZE);
4418+
strlcpy(speed, "40 Gbps", SPEED_SIZE);
44194419
break;
44204420
case I40E_LINK_SPEED_10GB:
4421-
strncpy(speed, "10 Gbps", SPEED_SIZE);
4421+
strlcpy(speed, "10 Gbps", SPEED_SIZE);
44224422
break;
44234423
case I40E_LINK_SPEED_1GB:
4424-
strncpy(speed, "1000 Mbps", SPEED_SIZE);
4424+
strlcpy(speed, "1000 Mbps", SPEED_SIZE);
44254425
break;
44264426
default:
44274427
break;
44284428
}
44294429

44304430
switch (vsi->back->hw.fc.current_mode) {
44314431
case I40E_FC_FULL:
4432-
strncpy(fc, "RX/TX", FC_SIZE);
4432+
strlcpy(fc, "RX/TX", FC_SIZE);
44334433
break;
44344434
case I40E_FC_TX_PAUSE:
4435-
strncpy(fc, "TX", FC_SIZE);
4435+
strlcpy(fc, "TX", FC_SIZE);
44364436
break;
44374437
case I40E_FC_RX_PAUSE:
4438-
strncpy(fc, "RX", FC_SIZE);
4438+
strlcpy(fc, "RX", FC_SIZE);
44394439
break;
44404440
default:
4441-
strncpy(fc, "None", FC_SIZE);
4441+
strlcpy(fc, "None", FC_SIZE);
44424442
break;
44434443
}
44444444

@@ -5839,7 +5839,7 @@ static void i40e_send_version(struct i40e_pf *pf)
58395839
dv.minor_version = DRV_VERSION_MINOR;
58405840
dv.build_version = DRV_VERSION_BUILD;
58415841
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));
58435843
i40e_aq_send_driver_version(&pf->hw, &dv, NULL);
58445844
}
58455845

@@ -6293,7 +6293,7 @@ static int i40e_vsi_alloc_arrays(struct i40e_vsi *vsi, bool alloc_qvectors)
62936293

62946294
if (alloc_qvectors) {
62956295
/* 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;
62976297
vsi->q_vectors = kzalloc(size, GFP_KERNEL);
62986298
if (!vsi->q_vectors) {
62996299
ret = -ENOMEM;

drivers/net/ethernet/intel/i40e/i40e_nvm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ i40e_status i40e_read_nvm_buffer(struct i40e_hw *hw, u16 offset,
251251
*
252252
* Writes a 16 bit words buffer to the Shadow RAM using the admin command.
253253
**/
254-
i40e_status i40e_write_nvm_aq(struct i40e_hw *hw, u8 module_pointer,
255-
u32 offset, u16 words, void *data,
256-
bool last_command)
254+
static i40e_status i40e_write_nvm_aq(struct i40e_hw *hw, u8 module_pointer,
255+
u32 offset, u16 words, void *data,
256+
bool last_command)
257257
{
258258
i40e_status ret_code = I40E_ERR_NVM;
259259

drivers/net/ethernet/myricom/myri10ge/myri10ge.c

Lines changed: 58 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,10 @@ static int myri10ge_dma_test(struct myri10ge_priv *mgp, int test_type)
873873
return -ENOMEM;
874874
dmatest_bus = pci_map_page(mgp->pdev, dmatest_page, 0, PAGE_SIZE,
875875
DMA_BIDIRECTIONAL);
876+
if (unlikely(pci_dma_mapping_error(mgp->pdev, dmatest_bus))) {
877+
__free_page(dmatest_page);
878+
return -ENOMEM;
879+
}
876880

877881
/* Run a small DMA test.
878882
* 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,
12941298
int bytes, int watchdog)
12951299
{
12961300
struct page *page;
1301+
dma_addr_t bus;
12971302
int idx;
12981303
#if MYRI10GE_ALLOC_SIZE > 4096
12991304
int end_offset;
@@ -1318,11 +1323,21 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
13181323
rx->watchdog_needed = 1;
13191324
return;
13201325
}
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+
13211337
rx->page = page;
13221338
rx->page_offset = 0;
1323-
rx->bus = pci_map_page(mgp->pdev, page, 0,
1324-
MYRI10GE_ALLOC_SIZE,
1325-
PCI_DMA_FROMDEVICE);
1339+
rx->bus = bus;
1340+
13261341
}
13271342
rx->info[idx].page = rx->page;
13281343
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,
27642779
mb();
27652780
}
27662781

2782+
static 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+
27672811
/*
27682812
* Transmit a packet. We need to split the packet so that a single
27692813
* 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,
27872831
u32 low;
27882832
__be32 high_swapped;
27892833
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;
27912835
u16 pseudo_hdr_offset, cksum_offset, queue;
27922836
int cum_len, seglen, boundary, rdma_count;
27932837
u8 flags, odd_flag;
@@ -2884,9 +2928,12 @@ static netdev_tx_t myri10ge_xmit(struct sk_buff *skb,
28842928

28852929
/* map the skb for DMA */
28862930
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+
28872935
idx = tx->req & tx->mask;
28882936
tx->info[idx].skb = skb;
2889-
bus = pci_map_single(mgp->pdev, skb->data, len, PCI_DMA_TODEVICE);
28902937
dma_unmap_addr_set(&tx->info[idx], bus, bus);
28912938
dma_unmap_len_set(&tx->info[idx], len, len);
28922939

@@ -2985,12 +3032,16 @@ static netdev_tx_t myri10ge_xmit(struct sk_buff *skb,
29853032
break;
29863033

29873034
/* map next fragment for DMA */
2988-
idx = (count + tx->req) & tx->mask;
29893035
frag = &skb_shinfo(skb)->frags[frag_idx];
29903036
frag_idx++;
29913037
len = skb_frag_size(frag);
29923038
bus = skb_frag_dma_map(&mgp->pdev->dev, frag, 0, len,
29933039
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;
29943045
dma_unmap_addr_set(&tx->info[idx], bus, bus);
29953046
dma_unmap_len_set(&tx->info[idx], len, len);
29963047
}
@@ -3021,31 +3072,8 @@ static netdev_tx_t myri10ge_xmit(struct sk_buff *skb,
30213072
return NETDEV_TX_OK;
30223073

30233074
abort_linearize:
3024-
/* Free any DMA resources we've alloced and clear out the skb
3025-
* slot so as to not trip up assertions, and to avoid a
3026-
* double-free if linearizing fails */
3075+
myri10ge_unmap_tx_dma(mgp, tx, idx);
30273076

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);
30493077
if (skb_is_gso(skb)) {
30503078
netdev_err(mgp->dev, "TSO but wanted to linearize?!?!?\n");
30513079
goto drop;

drivers/net/ethernet/sun/sunvnet.c

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ MODULE_DESCRIPTION("Sun LDOM virtual network driver");
3232
MODULE_LICENSE("GPL");
3333
MODULE_VERSION(DRV_MODULE_VERSION);
3434

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+
3540
/* Ordered from largest major to lowest */
3641
static struct vio_version vnet_versions[] = {
3742
{ .major = 1, .minor = 0 },
@@ -260,6 +265,7 @@ static int vnet_send_ack(struct vnet_port *port, struct vio_dring_state *dr,
260265
.state = vio_dring_state,
261266
};
262267
int err, delay;
268+
int retries = 0;
263269

264270
hdr.seq = dr->snd_nxt;
265271
delay = 1;
@@ -272,6 +278,13 @@ static int vnet_send_ack(struct vnet_port *port, struct vio_dring_state *dr,
272278
udelay(delay);
273279
if ((delay <<= 1) > 128)
274280
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+
}
275288
} while (err == -EAGAIN);
276289

277290
return err;
@@ -475,8 +488,9 @@ static int handle_mcast(struct vnet_port *port, void *msgbuf)
475488
return 0;
476489
}
477490

478-
static void maybe_tx_wakeup(struct vnet *vp)
491+
static void maybe_tx_wakeup(unsigned long param)
479492
{
493+
struct vnet *vp = (struct vnet *)param;
480494
struct net_device *dev = vp->dev;
481495

482496
netif_tx_lock(dev);
@@ -573,8 +587,13 @@ static void vnet_event(void *arg, int event)
573587
break;
574588
}
575589
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+
*/
576594
if (unlikely(tx_wakeup && err != -ECONNRESET))
577-
maybe_tx_wakeup(port->vp);
595+
tasklet_schedule(&port->vp->vnet_tx_wakeup);
596+
578597
local_irq_restore(flags);
579598
}
580599

@@ -593,6 +612,7 @@ static int __vnet_tx_trigger(struct vnet_port *port)
593612
.end_idx = (u32) -1,
594613
};
595614
int err, delay;
615+
int retries = 0;
596616

597617
hdr.seq = dr->snd_nxt;
598618
delay = 1;
@@ -605,6 +625,8 @@ static int __vnet_tx_trigger(struct vnet_port *port)
605625
udelay(delay);
606626
if ((delay <<= 1) > 128)
607627
delay = 128;
628+
if (retries++ > VNET_MAX_RETRIES)
629+
break;
608630
} while (err == -EAGAIN);
609631

610632
return err;
@@ -691,7 +713,15 @@ static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev)
691713
memset(tx_buf+VNET_PACKET_SKIP+skb->len, 0, len - skb->len);
692714
}
693715

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;
695725
d->size = len;
696726
d->ncookies = port->tx_bufs[dr->prod].ncookies;
697727
for (i = 0; i < d->ncookies; i++)
@@ -1046,6 +1076,7 @@ static struct vnet *vnet_new(const u64 *local_mac)
10461076
vp = netdev_priv(dev);
10471077

10481078
spin_lock_init(&vp->lock);
1079+
tasklet_init(&vp->vnet_tx_wakeup, maybe_tx_wakeup, (unsigned long)vp);
10491080
vp->dev = dev;
10501081

10511082
INIT_LIST_HEAD(&vp->port_list);
@@ -1105,6 +1136,7 @@ static void vnet_cleanup(void)
11051136
vp = list_first_entry(&vnet_list, struct vnet, list);
11061137
list_del(&vp->list);
11071138
dev = vp->dev;
1139+
tasklet_kill(&vp->vnet_tx_wakeup);
11081140
/* vio_unregister_driver() should have cleaned up port_list */
11091141
BUG_ON(!list_empty(&vp->port_list));
11101142
unregister_netdev(dev);

0 commit comments

Comments
 (0)