Use if_output() instead of rerolling it.
authormpi <mpi@openbsd.org>
Tue, 26 May 2015 15:34:00 +0000 (15:34 +0000)
committermpi <mpi@openbsd.org>
Tue, 26 May 2015 15:34:00 +0000 (15:34 +0000)
ok stsp@

sys/net80211/ieee80211_input.c
sys/net80211/ieee80211_output.c

index c4e29f3..aae9847 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ieee80211_input.c,v 1.133 2015/03/14 03:38:51 jsg Exp $       */
+/*     $OpenBSD: ieee80211_input.c,v 1.134 2015/05/26 15:34:00 mpi Exp $       */
 
 /*-
  * Copyright (c) 2001 Atsushi Onoe
@@ -827,7 +827,6 @@ ieee80211_deliver_data(struct ieee80211com *ic, struct mbuf *m,
            !(ic->ic_flags & IEEE80211_F_NOBRIDGE) &&
            eh->ether_type != htons(ETHERTYPE_PAE)) {
                struct ieee80211_node *ni1;
-               int error, len;
 
                if (ETHER_IS_MULTICAST(eh->ether_dhost)) {
                        m1 = m_copym2(m, 0, M_COPYALL, M_DONTWAIT);
@@ -844,16 +843,8 @@ ieee80211_deliver_data(struct ieee80211com *ic, struct mbuf *m,
                        }
                }
                if (m1 != NULL) {
-                       len = m1->m_pkthdr.len;
-                       IFQ_ENQUEUE(&ifp->if_snd, m1, NULL, error);
-                       if (error)
-                               ifp->if_oerrors++;
-                       else {
-                               if (m != NULL)
-                                       ifp->if_omcasts++;
-                               ifp->if_obytes += len;
-                               if_start(ifp);
-                       }
+                       if (if_output(ifp, m1))
+                                ifp->if_oerrors++;
                }
        }
 #endif
index cadb64c..82bd609 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ieee80211_output.c,v 1.94 2015/03/14 03:38:51 jsg Exp $       */
+/*     $OpenBSD: ieee80211_output.c,v 1.95 2015/05/26 15:34:00 mpi Exp $       */
 /*     $NetBSD: ieee80211_output.c,v 1.13 2004/05/31 11:02:55 dyoung Exp $     */
 
 /*-
@@ -113,8 +113,7 @@ ieee80211_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
 {
        struct ieee80211_frame *wh;
        struct m_tag *mtag;
-       int s, len, error = 0;
-       u_short mflags;
+       int error = 0;
 
        /* Interface has to be up and running */
        if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) !=
@@ -143,30 +142,7 @@ ieee80211_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
                    IEEE80211_FC0_TYPE_CTL)
                        return (EINVAL);
 
-               /*
-                * Queue message on interface without adding any
-                * further headers, and start output if interface not
-                * yet active.
-                */
-               mflags = m->m_flags;
-               len = m->m_pkthdr.len;
-               s = splnet();
-               IFQ_ENQUEUE(&ifp->if_snd, m, NULL, error);
-               if (error) {
-                       /* mbuf is already freed */
-                       splx(s);
-                       printf("%s: failed to queue raw tx frame\n",
-                           ifp->if_xname);
-                       return (error);
-               }
-               ifp->if_obytes += len;
-               if (mflags & M_MCAST)
-                       ifp->if_omcasts++;
-               if ((ifp->if_flags & IFF_OACTIVE) == 0)
-                       (*ifp->if_start)(ifp);
-               splx(s);
-
-               return (error);
+               return (if_output(ifp, m));
        }
 
  fallback: