Skip to content

Commit

Permalink
The multiqueue locking design does not work well with IGB_LEGACY_TX s…
Browse files Browse the repository at this point in the history
…ince the per queue locking still allow concurrent access to ifp->ifp_snd.

Ticket #7166
Ticket #7149
Ticket #6257
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=148807
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213257
  • Loading branch information
loos-br committed Jan 31, 2017
1 parent 9138480 commit 215ddb0
Showing 1 changed file with 29 additions and 19 deletions.
48 changes: 29 additions & 19 deletions sys/dev/e1000/if_igb.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,19 +801,21 @@ igb_resume(device_t dev)

if ((ifp->if_flags & IFF_UP) &&
(ifp->if_drv_flags & IFF_DRV_RUNNING) && adapter->link_active) {
#ifndef IGB_LEGACY_TX
for (int i = 0; i < adapter->num_queues; i++, txr++) {
IGB_TX_LOCK(txr);
#ifndef IGB_LEGACY_TX
/* Process the stack queue only if not depleted */
if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) &&
!drbr_empty(ifp, txr->br))
igb_mq_start_locked(ifp, txr);
#else
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
igb_start_locked(txr, ifp);
#endif
IGB_TX_UNLOCK(txr);
}
#else
IGB_TX_LOCK(txr);
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
igb_start_locked(txr, ifp);
IGB_TX_UNLOCK(txr);
#endif
}
IGB_CORE_UNLOCK(adapter);

Expand Down Expand Up @@ -1411,11 +1413,12 @@ igb_handle_que(void *context, int pending)
if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) &&
!drbr_empty(ifp, txr->br))
igb_mq_start_locked(ifp, txr);
IGB_TX_UNLOCK(txr);
#else
IGB_TX_UNLOCK(txr);
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
igb_start_locked(txr, ifp);
igb_start(ifp);
#endif
IGB_TX_UNLOCK(txr);
/* Do we need another? */
if (more) {
taskqueue_enqueue(que->tq, &que->que_task);
Expand Down Expand Up @@ -1455,19 +1458,21 @@ igb_handle_link_locked(struct adapter *adapter)
adapter->hw.mac.get_link_status = 1;
igb_update_link_status(adapter);
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && adapter->link_active) {
#ifndef IGB_LEGACY_TX
for (int i = 0; i < adapter->num_queues; i++, txr++) {
IGB_TX_LOCK(txr);
#ifndef IGB_LEGACY_TX
/* Process the stack queue only if not depleted */
if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) &&
!drbr_empty(ifp, txr->br))
igb_mq_start_locked(ifp, txr);
#else
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
igb_start_locked(txr, ifp);
#endif
IGB_TX_UNLOCK(txr);
}
#else
IGB_TX_LOCK(txr);
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
igb_start_locked(txr, ifp);
IGB_TX_UNLOCK(txr);
#endif
}
}

Expand Down Expand Up @@ -1549,6 +1554,7 @@ igb_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
}
IGB_CORE_UNLOCK(adapter);

#ifndef IGB_LEGACY_TX
for (int i = 0; i < adapter->num_queues; i++) {
que = &adapter->queues[i];
txr = que->txr;
Expand All @@ -1559,15 +1565,18 @@ igb_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
do {
more = igb_txeof(txr);
} while (loop-- && more);
#ifndef IGB_LEGACY_TX
if (!drbr_empty(ifp, txr->br))
igb_mq_start_locked(ifp, txr);
#else
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
igb_start_locked(txr, ifp);
#endif
IGB_TX_UNLOCK(txr);
}
#else
que = &adapter->queues[0];
txr = que->txr;
IGB_TX_LOCK(txr);
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
igb_start_locked(txr, ifp);
IGB_TX_UNLOCK(txr);
#endif

return POLL_RETURN_COUNT(rx_done);
}
Expand Down Expand Up @@ -1603,11 +1612,12 @@ igb_msix_que(void *arg)
if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) &&
!drbr_empty(ifp, txr->br))
igb_mq_start_locked(ifp, txr);
IGB_TX_UNLOCK(txr);
#else
IGB_TX_UNLOCK(txr);
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
igb_start_locked(txr, ifp);
igb_start(ifp);
#endif
IGB_TX_UNLOCK(txr);

more_rx = igb_rxeof(que, adapter->rx_process_limit, NULL);

Expand Down

0 comments on commit 215ddb0

Please sign in to comment.