summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sun/sunvnet.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-08-14 17:25:21 -0600
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-14 17:25:21 -0600
commitad15afb8b9e80bec6c4337369f63207ff59c44ae (patch)
treecdd378c1a6f07cc580033730995e2c883379248d /drivers/net/ethernet/sun/sunvnet.c
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/sun/sunvnet.c')
-rw-r--r--drivers/net/ethernet/sun/sunvnet.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
index d813bfb1a84..23c89ab5a6a 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");
MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_MODULE_VERSION);
+/* Heuristic for the number of times to exponentially backoff and
+ * retry sending an LDC trigger when EAGAIN is encountered
+ */
+#define VNET_MAX_RETRIES 10
+
/* Ordered from largest major to lowest */
static struct vio_version vnet_versions[] = {
{ .major = 1, .minor = 0 },
@@ -260,6 +265,7 @@ static int vnet_send_ack(struct vnet_port *port, struct vio_dring_state *dr,
.state = vio_dring_state,
};
int err, delay;
+ int retries = 0;
hdr.seq = dr->snd_nxt;
delay = 1;
@@ -272,6 +278,13 @@ static int vnet_send_ack(struct vnet_port *port, struct vio_dring_state *dr,
udelay(delay);
if ((delay <<= 1) > 128)
delay = 128;
+ if (retries++ > VNET_MAX_RETRIES) {
+ pr_info("ECONNRESET %x:%x:%x:%x:%x:%x\n",
+ port->raddr[0], port->raddr[1],
+ port->raddr[2], port->raddr[3],
+ port->raddr[4], port->raddr[5]);
+ err = -ECONNRESET;
+ }
} while (err == -EAGAIN);
return err;
@@ -475,8 +488,9 @@ static int handle_mcast(struct vnet_port *port, void *msgbuf)
return 0;
}
-static void maybe_tx_wakeup(struct vnet *vp)
+static void maybe_tx_wakeup(unsigned long param)
{
+ struct vnet *vp = (struct vnet *)param;
struct net_device *dev = vp->dev;
netif_tx_lock(dev);
@@ -573,8 +587,13 @@ static void vnet_event(void *arg, int event)
break;
}
spin_unlock(&vio->lock);
+ /* Kick off a tasklet to wake the queue. We cannot call
+ * maybe_tx_wakeup directly here because we could deadlock on
+ * netif_tx_lock() with dev_watchdog()
+ */
if (unlikely(tx_wakeup && err != -ECONNRESET))
- maybe_tx_wakeup(port->vp);
+ tasklet_schedule(&port->vp->vnet_tx_wakeup);
+
local_irq_restore(flags);
}
@@ -593,6 +612,7 @@ static int __vnet_tx_trigger(struct vnet_port *port)
.end_idx = (u32) -1,
};
int err, delay;
+ int retries = 0;
hdr.seq = dr->snd_nxt;
delay = 1;
@@ -605,6 +625,8 @@ static int __vnet_tx_trigger(struct vnet_port *port)
udelay(delay);
if ((delay <<= 1) > 128)
delay = 128;
+ if (retries++ > VNET_MAX_RETRIES)
+ break;
} while (err == -EAGAIN);
return err;
@@ -691,7 +713,15 @@ static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev)
memset(tx_buf+VNET_PACKET_SKIP+skb->len, 0, len - skb->len);
}
- d->hdr.ack = VIO_ACK_ENABLE;
+ /* We don't rely on the ACKs to free the skb in vnet_start_xmit(),
+ * thus it is safe to not set VIO_ACK_ENABLE for each transmission:
+ * the protocol itself does not require it as long as the peer
+ * sends a VIO_SUBTYPE_ACK for VIO_DRING_STOPPED.
+ *
+ * An ACK for every packet in the ring is expensive as the
+ * sending of LDC messages is slow and affects performance.
+ */
+ d->hdr.ack = VIO_ACK_DISABLE;
d->size = len;
d->ncookies = port->tx_bufs[dr->prod].ncookies;
for (i = 0; i < d->ncookies; i++)
@@ -1046,6 +1076,7 @@ static struct vnet *vnet_new(const u64 *local_mac)
vp = netdev_priv(dev);
spin_lock_init(&vp->lock);
+ tasklet_init(&vp->vnet_tx_wakeup, maybe_tx_wakeup, (unsigned long)vp);
vp->dev = dev;
INIT_LIST_HEAD(&vp->port_list);
@@ -1105,6 +1136,7 @@ static void vnet_cleanup(void)
vp = list_first_entry(&vnet_list, struct vnet, list);
list_del(&vp->list);
dev = vp->dev;
+ tasklet_kill(&vp->vnet_tx_wakeup);
/* vio_unregister_driver() should have cleaned up port_list */
BUG_ON(!list_empty(&vp->port_list));
unregister_netdev(dev);