From 63bea6a96753d317493e55c47f357c8327ed75ed Mon Sep 17 00:00:00 2001 From: luigi Date: Mon, 9 Jun 2014 15:09:05 +0000 Subject: [PATCH] MFC svn 267065 and 267187 make sure ifp->if_transmit returns 0 if a buffer is enqueued. This should also be merged to stable/9. After this fix, drivers still known to have this bug are igxbe/ixv and i40e. Drivers using if_transmit are correct, and so are most of the other drivers that reassing if_transmit. Among other things, this bug causes panics when using netmap emulation on top of generic drivers. --- sys/dev/e1000/if_igb.c | 4 ++-- sys/dev/ixgbe/ixgbe.c | 4 ++-- sys/dev/virtio/network/if_vtnet.c | 3 +-- sys/dev/vmware/vmxnet3/if_vmx.c | 3 +-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/dev/e1000/if_igb.c b/sys/dev/e1000/if_igb.c index 3b6af174ca78..15d71cead638 100644 --- a/sys/dev/e1000/if_igb.c +++ b/sys/dev/e1000/if_igb.c @@ -988,12 +988,12 @@ igb_mq_start(struct ifnet *ifp, struct mbuf *m) if (err) return (err); if (IGB_TX_TRYLOCK(txr)) { - err = igb_mq_start_locked(ifp, txr); + igb_mq_start_locked(ifp, txr); IGB_TX_UNLOCK(txr); } else taskqueue_enqueue(que->tq, &txr->txq_task); - return (err); + return (0); } static int diff --git a/sys/dev/ixgbe/ixgbe.c b/sys/dev/ixgbe/ixgbe.c index 5b9fa01e2301..597256a4249c 100644 --- a/sys/dev/ixgbe/ixgbe.c +++ b/sys/dev/ixgbe/ixgbe.c @@ -831,12 +831,12 @@ ixgbe_mq_start(struct ifnet *ifp, struct mbuf *m) if (err) return (err); if (IXGBE_TX_TRYLOCK(txr)) { - err = ixgbe_mq_start_locked(ifp, txr); + ixgbe_mq_start_locked(ifp, txr); IXGBE_TX_UNLOCK(txr); } else taskqueue_enqueue(que->tq, &txr->txq_task); - return (err); + return (0); } static int diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 055a2e334ada..9e1ad26b5a3e 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -2260,7 +2260,6 @@ vtnet_txq_mq_start_locked(struct vtnet_txq *txq, struct mbuf *m) while ((m = drbr_peek(ifp, br)) != NULL) { if (virtqueue_full(vq)) { drbr_putback(ifp, br, m); - error = ENOBUFS; break; } @@ -2283,7 +2282,7 @@ vtnet_txq_mq_start_locked(struct vtnet_txq *txq, struct mbuf *m) txq->vtntx_watchdog = VTNET_TX_TIMEOUT; } - return (error); + return (0); } static int diff --git a/sys/dev/vmware/vmxnet3/if_vmx.c b/sys/dev/vmware/vmxnet3/if_vmx.c index 3acc6729ad15..e8d213e6ab84 100644 --- a/sys/dev/vmware/vmxnet3/if_vmx.c +++ b/sys/dev/vmware/vmxnet3/if_vmx.c @@ -2933,7 +2933,6 @@ vmxnet3_txq_mq_start_locked(struct vmxnet3_txqueue *txq, struct mbuf *m) /* Assume worse case if this mbuf is the head of a chain. */ if (m->m_next != NULL && avail < VMXNET3_TX_MAXSEGS) { drbr_putback(ifp, br, m); - error = ENOBUFS; break; } @@ -2956,7 +2955,7 @@ vmxnet3_txq_mq_start_locked(struct vmxnet3_txqueue *txq, struct mbuf *m) txq->vxtxq_watchdog = VMXNET3_WATCHDOG_TIMEOUT; } - return (error); + return (0); } static int