From owner-svn-src-head@freebsd.org Sun May 6 00:47:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52BD0FC14ED; Sun, 6 May 2018 00:47:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 01EB674EEB; Sun, 6 May 2018 00:47:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0E17251DB; Sun, 6 May 2018 00:47:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w460ldRk084802; Sun, 6 May 2018 00:47:39 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w460ldT7084800; Sun, 6 May 2018 00:47:39 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201805060047.w460ldT7084800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 6 May 2018 00:47:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333287 - head/sys/dev/bxe X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/bxe X-SVN-Commit-Revision: 333287 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 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: Sun, 06 May 2018 00:47:40 -0000 Author: markj Date: Sun May 6 00:47:39 2018 New Revision: 333287 URL: https://svnweb.freebsd.org/changeset/base/333287 Log: Add netdump support to bxe(4). Tested with a NetXtreme II BCM57810 adapter. Reviewed by: davidcs MFC after: 1 month Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D15257 Modified: head/sys/dev/bxe/bxe.c head/sys/dev/bxe/bxe.h Modified: head/sys/dev/bxe/bxe.c ============================================================================== --- head/sys/dev/bxe/bxe.c Sun May 6 00:45:41 2018 (r333286) +++ head/sys/dev/bxe/bxe.c Sun May 6 00:47:39 2018 (r333287) @@ -236,6 +236,8 @@ MODULE_DEPEND(bxe, pci, 1, 1, 1); MODULE_DEPEND(bxe, ether, 1, 1, 1); DRIVER_MODULE(bxe, pci, bxe_driver, bxe_devclass, 0, 0); +NETDUMP_DEFINE(bxe); + /* resources needed for unloading a previously loaded device */ #define BXE_PREV_WAIT_NEEDED 1 @@ -12789,6 +12791,9 @@ bxe_init_ifnet(struct bxe_softc *sc) /* attach to the Ethernet interface list */ ether_ifattach(ifp, sc->link_params.mac_addr); + /* Attach driver netdump methods. */ + NETDUMP_SET(ifp, bxe); + return (0); } @@ -19186,3 +19191,57 @@ bxe_eioctl(struct cdev *dev, u_long cmd, caddr_t data, return (rval); } + +#ifdef NETDUMP +static void +bxe_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) +{ + struct bxe_softc *sc; + + sc = if_getsoftc(ifp); + BXE_CORE_LOCK(sc); + *nrxr = sc->num_queues; + *ncl = NETDUMP_MAX_IN_FLIGHT; + *clsize = sc->fp[0].mbuf_alloc_size; + BXE_CORE_UNLOCK(sc); +} + +static void +bxe_netdump_event(struct ifnet *ifp __unused, enum netdump_ev event __unused) +{ +} + +static int +bxe_netdump_transmit(struct ifnet *ifp, struct mbuf *m) +{ + struct bxe_softc *sc; + int error; + + sc = if_getsoftc(ifp); + if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING || !sc->link_vars.link_up) + return (ENOENT); + + error = bxe_tx_encap(&sc->fp[0], &m); + if (error != 0 && m != NULL) + m_freem(m); + return (error); +} + +static int +bxe_netdump_poll(struct ifnet *ifp, int count) +{ + struct bxe_softc *sc; + int i; + + sc = if_getsoftc(ifp); + if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0 || + !sc->link_vars.link_up) + return (ENOENT); + + for (i = 0; i < sc->num_queues; i++) + (void)bxe_rxeof(sc, &sc->fp[0]); + (void)bxe_txeof(sc, &sc->fp[0]); + return (0); +} +#endif /* NETDUMP */ Modified: head/sys/dev/bxe/bxe.h ============================================================================== --- head/sys/dev/bxe/bxe.h Sun May 6 00:45:41 2018 (r333286) +++ head/sys/dev/bxe/bxe.h Sun May 6 00:47:39 2018 (r333287) @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include