Date: Thu, 22 Aug 2019 16:54:25 -0700 From: Gleb Smirnoff <glebius@freebsd.org> To: "Stephen J. Kiernan" <stevek@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351244 - head/sys/dev/usb/net Message-ID: <20190822235425.GP4556@FreeBSD.org> In-Reply-To: <201908200106.x7K16hWT067244@repo.freebsd.org> References: <201908200106.x7K16hWT067244@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--MGYHOYXEY6WxJCY8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Stephen, On Tue, Aug 20, 2019 at 01:06:43AM +0000, Stephen J. Kiernan wrote: S> Author: stevek S> Date: Tue Aug 20 01:06:43 2019 S> New Revision: 351244 S> URL: https://svnweb.freebsd.org/changeset/base/351244 S> S> Log: S> usb_ethernet.h includes a number of mii headers, but only does so in S> order to have struct mii_data available. However, it only really needs S> a forward declaration of struct mii_data for use in pointer form for S> the return type of a function prototype. S> S> Custom kernel configuration that have usb and fdt enabled, but no miibus, S> end up with compilation failures because miibus_if.h will not get S> generated. S> S> Due to the above, the following changes have been made to usb_ethernet.h: S> * remove the inclusion of mii headers S> * forward-declare struct mii_data S> * include net/ifq.h to satify the need for complete struct ifqueue This is a header (and structure) that is on a kill list :) Polluting another header moves us a bit backwards. Can you please take a look at the attached patch? It substitutes it for mbufq, as already done for many other drivers. -- Gleb Smirnoff --MGYHOYXEY6WxJCY8 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ue_rxq-mbufq.diff" Index: sys/dev/usb/net/if_axe.c =================================================================== --- sys/dev/usb/net/if_axe.c (revision 351411) +++ sys/dev/usb/net/if_axe.c (working copy) @@ -1149,7 +1149,7 @@ axe_rxeof(struct usb_ether *ue, struct usb_page_ca } } - _IF_ENQUEUE(&ue->ue_rxq, m); + (void)mbufq_enqueue(&ue->ue_rxq, m); return (0); } Index: sys/dev/usb/net/if_axge.c =================================================================== --- sys/dev/usb/net/if_axge.c (revision 351411) +++ sys/dev/usb/net/if_axge.c (working copy) @@ -1041,7 +1041,7 @@ axge_rxeof(struct usb_ether *ue, struct usb_page_c } if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); - _IF_ENQUEUE(&ue->ue_rxq, m); + (void)mbufq_enqueue(&ue->ue_rxq, m); } static void Index: sys/dev/usb/net/usb_ethernet.c =================================================================== --- sys/dev/usb/net/usb_ethernet.c (revision 351411) +++ sys/dev/usb/net/usb_ethernet.c (working copy) @@ -598,7 +598,7 @@ uether_rxmbuf(struct usb_ether *ue, struct mbuf *m m->m_pkthdr.len = m->m_len = len; /* enqueue for later when the lock can be released */ - _IF_ENQUEUE(&ue->ue_rxq, m); + (void)mbufq_enqueue(&ue->ue_rxq, m); return (0); } @@ -628,7 +628,7 @@ uether_rxbuf(struct usb_ether *ue, struct usb_page m->m_pkthdr.len = m->m_len = len; /* enqueue for later when the lock can be released */ - _IF_ENQUEUE(&ue->ue_rxq, m); + (void)mbufq_enqueue(&ue->ue_rxq, m); return (0); } @@ -641,7 +641,7 @@ uether_rxflush(struct usb_ether *ue) UE_LOCK_ASSERT(ue, MA_OWNED); for (;;) { - _IF_DEQUEUE(&ue->ue_rxq, m); + m = mbufq_dequeue(&ue->ue_rxq); if (m == NULL) break; Index: sys/dev/usb/net/usb_ethernet.h =================================================================== --- sys/dev/usb/net/usb_ethernet.h (revision 351411) +++ sys/dev/usb/net/usb_ethernet.h (working copy) @@ -46,7 +46,6 @@ #include <net/if_dl.h> #include <net/if_media.h> #include <net/if_types.h> -#include <net/ifq.h> #include <net/bpf.h> #include <net/ethernet.h> @@ -89,7 +88,7 @@ struct usb_ether { struct usb_process ue_tq; struct sysctl_ctx_list ue_sysctl_ctx; - struct ifqueue ue_rxq; + struct mbufq ue_rxq; struct usb_callout ue_watchdog; struct usb_ether_cfg_task ue_sync_task[2]; struct usb_ether_cfg_task ue_media_task[2]; Index: sys/sys/mbuf.h =================================================================== --- sys/sys/mbuf.h (revision 351411) +++ sys/sys/mbuf.h (working copy) @@ -1432,7 +1432,7 @@ static inline int mbufq_full(const struct mbufq *mq) { - return (mq->mq_len >= mq->mq_maxlen); + return (mq->mq_maxlen > 0 && mq->mq_len >= mq->mq_maxlen); } static inline int --MGYHOYXEY6WxJCY8--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190822235425.GP4556>