From owner-svn-src-head@freebsd.org Thu Aug 22 23:54:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 086D8D56A1; Thu, 22 Aug 2019 23:54:36 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46F1bb41h8z43tR; Thu, 22 Aug 2019 23:54:34 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id x7MNsQTP074840 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 22 Aug 2019 16:54:26 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x7MNsP44074839; Thu, 22 Aug 2019 16:54:25 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Thu, 22 Aug 2019 16:54:25 -0700 From: Gleb Smirnoff To: "Stephen J. Kiernan" 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> References: <201908200106.x7K16hWT067244@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MGYHOYXEY6WxJCY8" Content-Disposition: inline In-Reply-To: <201908200106.x7K16hWT067244@repo.freebsd.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-Rspamd-Queue-Id: 46F1bb41h8z43tR X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-2.91 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.91)[-0.911,0]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 23:54:36 -0000 --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 #include #include -#include #include #include @@ -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--