On 15/05/15(Fri) 15:53, Martin Pieuchot wrote:
> Some more if_output() conversion.  The xl bits are here because I'd
> like to reduce the number of places where IFQ_ENQUEUE() is used.
> 
> After applying this diff you should only have a couple left.

Anyone?

> Ok?
> 
> Index: dev/usb/if_upl.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/usb/if_upl.c,v
> retrieving revision 1.64
> diff -u -p -r1.64 if_upl.c
> --- dev/usb/if_upl.c  10 Apr 2015 08:41:43 -0000      1.64
> +++ dev/usb/if_upl.c  15 May 2015 13:43:51 -0000
> @@ -888,28 +888,5 @@ int
>  upl_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
>          struct rtentry *rt0)
>  {
> -     int s, len, error;
> -
> -     DPRINTFN(10,("%s: %s: enter\n",
> -                  ((struct upl_softc *)ifp->if_softc)->sc_dev.dv_xname,
> -                  __func__));
> -
> -     len = m->m_pkthdr.len;
> -     s = splnet();
> -     /*
> -      * Queue message on interface, and start output if interface
> -      * not yet active.
> -      */
> -     IFQ_ENQUEUE(&ifp->if_snd, m, NULL, error);
> -     if (error) {
> -             /* mbuf is already freed */
> -             splx(s);
> -             return (error);
> -     }
> -     ifp->if_obytes += len;
> -     if ((ifp->if_flags & IFF_OACTIVE) == 0)
> -             (*ifp->if_start)(ifp);
> -     splx(s);
> -
> -     return (0);
> +     return (if_output(ifp, m));
>  }
> Index: dev/ic/xl.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/ic/xl.c,v
> retrieving revision 1.123
> diff -u -p -r1.123 xl.c
> --- dev/ic/xl.c       24 Mar 2015 11:23:02 -0000      1.123
> +++ dev/ic/xl.c       15 May 2015 13:43:24 -0000
> @@ -177,9 +177,6 @@ int xl_list_tx_init_90xB(struct xl_softc
>  void xl_wait(struct xl_softc *);
>  void xl_mediacheck(struct xl_softc *);
>  void xl_choose_xcvr(struct xl_softc *, int);
> -#ifdef notdef
> -void xl_testpacket(struct xl_softc *);
> -#endif
>  
>  int xl_miibus_readreg(struct device *, int, int);
>  void xl_miibus_writereg(struct device *, int, int, int);
> @@ -659,35 +656,6 @@ xl_iff_905b(struct xl_softc *sc)
>  
>       XL_SEL_WIN(7);
>  }
> -
> -#ifdef notdef
> -void
> -xl_testpacket(struct xl_softc *sc)
> -{
> -     struct mbuf     *m;
> -     struct ifnet    *ifp;
> -     int             error;
> -
> -     ifp = &sc->sc_arpcom.ac_if;
> -
> -     MGETHDR(m, M_DONTWAIT, MT_DATA);
> -
> -     if (m == NULL)
> -             return;
> -
> -     memcpy(mtod(m, struct ether_header *)->ether_dhost,
> -         &sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN);
> -     memcpy(mtod(m, struct ether_header *)->ether_shost,
> -         &sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN);
> -     mtod(m, struct ether_header *)->ether_type = htons(3);
> -     mtod(m, unsigned char *)[14] = 0;
> -     mtod(m, unsigned char *)[15] = 0;
> -     mtod(m, unsigned char *)[16] = 0xE3;
> -     m->m_len = m->m_pkthdr.len = sizeof(struct ether_header) + 3;
> -     IFQ_ENQUEUE(&ifp->if_snd, m, NULL, error);
> -     xl_start(ifp);
> -}
> -#endif
>  
>  void
>  xl_setcfg(struct xl_softc *sc)
> Index: net80211/ieee80211_input.c
> ===================================================================
> RCS file: /cvs/src/sys/net80211/ieee80211_input.c,v
> retrieving revision 1.133
> diff -u -p -r1.133 ieee80211_input.c
> --- net80211/ieee80211_input.c        14 Mar 2015 03:38:51 -0000      1.133
> +++ net80211/ieee80211_input.c        15 May 2015 13:43:51 -0000
> @@ -827,7 +827,6 @@ ieee80211_deliver_data(struct ieee80211c
>           !(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);
> @@ -843,18 +842,8 @@ ieee80211_deliver_data(struct ieee80211c
>                               m = NULL;
>                       }
>               }
> -             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 (m1 != NULL)
> +                     if_output(ifp, m1);
>       }
>  #endif
>       if (m != NULL) {
> Index: net80211/ieee80211_output.c
> ===================================================================
> RCS file: /cvs/src/sys/net80211/ieee80211_output.c,v
> retrieving revision 1.94
> diff -u -p -r1.94 ieee80211_output.c
> --- net80211/ieee80211_output.c       14 Mar 2015 03:38:51 -0000      1.94
> +++ net80211/ieee80211_output.c       15 May 2015 13:43:51 -0000
> @@ -113,8 +113,7 @@ ieee80211_output(struct ifnet *ifp, stru
>  {
>       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, stru
>                   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:
> 

Reply via email to