Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jan 2005 12:32:55 -0800
From:      Jon Simola <jsimola@gmail.com>
To:        freebsd-stable@freebsd.org
Subject:   ALTQ patch for if_vlan.c
Message-ID:  <8eea040805010512321bf5b953@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
I just whipped up this against
5.3-STABLE #1: Wed Dec 22 17:11:02 PST 2004

Would someone who knows a bit more about this than myself give it a
quick lookover and see if it appears sane? I'm mostly wondering about
the splimp() and splx() and whether it's required or excessive due to
the mtx_lock/unlock in the VLAN_LOCK/UNLOCK macros.

Due to a lack of equipment it's difficult for me to run a seperate
test environment, so any sort of review would be appreciated.

--- sys/net/if_vlan.c.orig      Wed Jan  5 12:25:19 2005
+++ sys/net/if_vlan.c   Wed Jan  5 12:53:45 2005
@@ -379,7 +379,10 @@
        ifp->if_init = vlan_ifinit;
        ifp->if_start = vlan_start;
        ifp->if_ioctl = vlan_ioctl;
-       ifp->if_snd.ifq_maxlen = ifqmaxlen;
+       IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
+       ifp->if_snd.ifq_drv_maxlen = 0;
+       IFQ_SET_READY(&ifp->if_snd);
+
        ether_ifattach(ifp, ifv->ifv_ac.ac_enaddr);
        /* Now undo some of the damage... */
        ifp->if_baudrate = 0;
@@ -423,11 +426,15 @@
 {
        int unit;
        struct ifvlan *ifv = ifp->if_softc;
+       int s;

        unit = ifp->if_dunit;

        VLAN_LOCK();
        LIST_REMOVE(ifv, ifv_list);
+       s = splimp();
+       IFQ_PURGE(&ifp->if_snd);
+       splx(s);
        vlan_unconfig(ifp);
        VLAN_UNLOCK();

@@ -458,12 +465,22 @@
        struct mbuf *m;
        int error;

+       if (ALTQ_IS_ENABLED(&ifp->if_snd)) {
+               IFQ_LOCK(&ifp->if_snd);
+               IFQ_POLL_NOLOCK(&ifp->if_snd, m);
+               if (m == NULL ) {
+                       IFQ_UNLOCK(&ifp->if_snd);
+                       return;
+               }
+               IFQ_UNLOCK(&ifp->if_snd);
+       }
+
        ifv = ifp->if_softc;
        p = ifv->ifv_p;

        ifp->if_flags |= IFF_OACTIVE;
        for (;;) {
-               IF_DEQUEUE(&ifp->if_snd, m);
+               IFQ_DEQUEUE(&ifp->if_snd, m);
                if (m == 0)
                        break;
                BPF_MTAP(ifp, m);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8eea040805010512321bf5b953>