From b9c5f41258c7149ed5d828d6d26ee6603a42c420 Mon Sep 17 00:00:00 2001 From: Max Laier Date: Fri, 24 Dec 2004 14:13:38 +0000 Subject: [PATCH] Enable sk(4) for ATLQ. Thoroughly tested by: Ender MFC after: 4 weeks --- share/man/man4/altq.4 | 5 +++-- sys/dev/sk/if_sk.c | 12 +++++++----- sys/pci/if_sk.c | 12 +++++++----- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/share/man/man4/altq.4 b/share/man/man4/altq.4 index b571b4907652..053cc732c393 100644 --- a/share/man/man4/altq.4 +++ b/share/man/man4/altq.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 21, 2004 +.Dd December 24, 2004 .Dt ALTQ 4 .Os .Sh NAME @@ -121,7 +121,8 @@ They have been applied to the following hardware drivers: .Xr rl 4 , .Xr sf 4 , .Xr sis 4 , -.Xr vr 4 +.Xr sk 4 , +.Xr vr 4 , .Xr wi 4 , and .Xr xl 4 . diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c index be66cfb7e8bd..e6274eba3146 100644 --- a/sys/dev/sk/if_sk.c +++ b/sys/dev/sk/if_sk.c @@ -1387,7 +1387,9 @@ sk_attach(dev) ifp->if_watchdog = sk_watchdog; ifp->if_init = sk_init; ifp->if_baudrate = 1000000000; - ifp->if_snd.ifq_maxlen = SK_TX_RING_CNT - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, SK_TX_RING_CNT - 1); + ifp->if_snd.ifq_drv_maxlen = SK_TX_RING_CNT - 1; + IFQ_SET_READY(&ifp->if_snd); callout_handle_init(&sc_if->sk_tick_ch); @@ -1844,7 +1846,7 @@ sk_start(ifp) idx = sc_if->sk_cdata.sk_tx_prod; while(sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf == NULL) { - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; @@ -1854,7 +1856,7 @@ sk_start(ifp) * for the NIC to drain the ring. */ if (sk_encap(sc_if, m_head, &idx)) { - IF_PREPEND(&ifp->if_snd, m_head); + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); ifp->if_flags |= IFF_OACTIVE; break; } @@ -2257,9 +2259,9 @@ sk_intr(xsc) CSR_WRITE_4(sc, SK_IMR, sc->sk_intrmask); - if (ifp0 != NULL && ifp0->if_snd.ifq_head != NULL) + if (ifp0 != NULL && !IFQ_DRV_IS_EMPTY(&ifp0->if_snd)) sk_start(ifp0); - if (ifp1 != NULL && ifp1->if_snd.ifq_head != NULL) + if (ifp1 != NULL && !IFQ_DRV_IS_EMPTY(&ifp1->if_snd)) sk_start(ifp1); SK_UNLOCK(sc); diff --git a/sys/pci/if_sk.c b/sys/pci/if_sk.c index be66cfb7e8bd..e6274eba3146 100644 --- a/sys/pci/if_sk.c +++ b/sys/pci/if_sk.c @@ -1387,7 +1387,9 @@ sk_attach(dev) ifp->if_watchdog = sk_watchdog; ifp->if_init = sk_init; ifp->if_baudrate = 1000000000; - ifp->if_snd.ifq_maxlen = SK_TX_RING_CNT - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, SK_TX_RING_CNT - 1); + ifp->if_snd.ifq_drv_maxlen = SK_TX_RING_CNT - 1; + IFQ_SET_READY(&ifp->if_snd); callout_handle_init(&sc_if->sk_tick_ch); @@ -1844,7 +1846,7 @@ sk_start(ifp) idx = sc_if->sk_cdata.sk_tx_prod; while(sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf == NULL) { - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; @@ -1854,7 +1856,7 @@ sk_start(ifp) * for the NIC to drain the ring. */ if (sk_encap(sc_if, m_head, &idx)) { - IF_PREPEND(&ifp->if_snd, m_head); + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); ifp->if_flags |= IFF_OACTIVE; break; } @@ -2257,9 +2259,9 @@ sk_intr(xsc) CSR_WRITE_4(sc, SK_IMR, sc->sk_intrmask); - if (ifp0 != NULL && ifp0->if_snd.ifq_head != NULL) + if (ifp0 != NULL && !IFQ_DRV_IS_EMPTY(&ifp0->if_snd)) sk_start(ifp0); - if (ifp1 != NULL && ifp1->if_snd.ifq_head != NULL) + if (ifp1 != NULL && !IFQ_DRV_IS_EMPTY(&ifp1->if_snd)) sk_start(ifp1); SK_UNLOCK(sc);