Skip to content

Commit

Permalink
fix a bug that ALTQ introduced into the dc driver.
Browse files Browse the repository at this point in the history
this bug affects only DAVICOM chips that just can't do
scatter/gather DMA correctly.

report by Bartosz Gorzynski <bartoszg@terminator.jeremi.pl>
  • Loading branch information
kjc committed May 17, 2001
1 parent a01923e commit 1e2ff11
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions freebsd4/sys/pci/if_dc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1913,12 +1913,7 @@ static int dc_attach(dev)
ifp->if_init = dc_init;
ifp->if_baudrate = 10000000;
IFQ_SET_MAXLEN(&ifp->if_snd, DC_TX_LIST_CNT - 1);
#ifdef ALTQ
/* dc_coal breaks the poll-and-dequeue rule,
so don't enable ALTQ for those chips */
if ((sc->dc_flags & DC_TX_COALESCE) == 0)
#endif
IFQ_SET_READY(&ifp->if_snd);
IFQ_SET_READY(&ifp->if_snd);

/*
* Do MII setup. If this is a 21143, check for a PHY on the
Expand Down Expand Up @@ -2823,9 +2818,11 @@ static void dc_start(ifp)

if (sc->dc_flags & DC_TX_COALESCE) {
#ifdef ALTQ
/* note: dc_coal breaks the poll-and-dequeue rule
and ALTQ is disabled in dc_attach for those chips */
/* note: dc_coal breaks the poll-and-dequeue rule.
* if dc_coal fails, we lose the packet.
*/
#endif
IFQ_DEQUEUE(&ifp->if_snd, m_head);
if (dc_coal(sc, &m_head)) {
ifp->if_flags |= IFF_OACTIVE;
break;
Expand All @@ -2838,7 +2835,10 @@ static void dc_start(ifp)
}

/* now we are committed to transmit the packet */
IFQ_DEQUEUE(&ifp->if_snd, m_head);
if (sc->dc_flags & DC_TX_COALESCE) {
/* if mbuf is coalesced, it is already dequeued */
} else
IFQ_DEQUEUE(&ifp->if_snd, m_head);

/*
* If there's a BPF listener, bounce a copy of this frame
Expand Down
18 changes: 9 additions & 9 deletions openbsd/sys/dev/ic/dc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1466,12 +1466,7 @@ void dc_attach_common(sc)
ifp->if_watchdog = dc_watchdog;
ifp->if_baudrate = 10000000;
IFQ_SET_MAXLEN(&ifp->if_snd, DC_TX_LIST_CNT - 1);
#ifdef ALTQ
/* dc_coal breaks the poll-and-dequeue rule,
so don't enable ALTQ for those chips */
if ((sc->dc_flags & DC_TX_COALESCE) == 0)
#endif
IFQ_SET_READY(&ifp->if_snd);
IFQ_SET_READY(&ifp->if_snd);
bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ);

sc->sc_mii.mii_ifp = ifp;
Expand Down Expand Up @@ -2322,9 +2317,11 @@ void dc_start(ifp)

if (sc->dc_flags & DC_TX_COALESCE) {
#ifdef ALTQ
/* note: dc_coal breaks the poll-and-dequeue rule
and ALTQ is disabled in dc_attach for those chips */
/* note: dc_coal breaks the poll-and-dequeue rule.
* if dc_coal fails, we lose the packet.
*/
#endif
IFQ_DEQUEUE(&ifp->if_snd, m_head);
if (dc_coal(sc, &m_head)) {
ifp->if_flags |= IFF_OACTIVE;
break;
Expand All @@ -2337,7 +2334,10 @@ void dc_start(ifp)
}

/* now we are committed to transmit the packet */
IFQ_DEQUEUE(&ifp->if_snd, m_head);
if (sc->dc_flags & DC_TX_COALESCE) {
/* if mbuf is coalesced, it is already dequeued */
} else
IFQ_DEQUEUE(&ifp->if_snd, m_head);

/*
* If there's a BPF listener, bounce a copy of this frame
Expand Down

0 comments on commit 1e2ff11

Please sign in to comment.