From owner-svn-src-head@freebsd.org Thu Aug 23 00:58:12 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 430C5109B0CD; Thu, 23 Aug 2018 00:58:12 +0000 (UTC) (envelope-from np@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 EA18775F95; Thu, 23 Aug 2018 00:58:11 +0000 (UTC) (envelope-from np@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 CBB771AC71; Thu, 23 Aug 2018 00:58:11 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7N0wBwj033105; Thu, 23 Aug 2018 00:58:11 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7N0wAfC033101; Thu, 23 Aug 2018 00:58:10 GMT (envelope-from np@FreeBSD.org) Message-Id: <201808230058.w7N0wAfC033101@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 23 Aug 2018 00:58:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338218 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 338218 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.27 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, 23 Aug 2018 00:58:12 -0000 Author: np Date: Thu Aug 23 00:58:10 2018 New Revision: 338218 URL: https://svnweb.freebsd.org/changeset/base/338218 Log: cxgbev(4): Updates to the VF driver to cope with recent ifmedia and ctrlq changes in the base driver. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c head/sys/dev/cxgbe/t4_vf.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Thu Aug 23 00:05:13 2018 (r338217) +++ head/sys/dev/cxgbe/adapter.h Thu Aug 23 00:58:10 2018 (r338218) @@ -1180,6 +1180,8 @@ int alloc_atid(struct adapter *, void *); void *lookup_atid(struct adapter *, int); void free_atid(struct adapter *, int); void release_tid(struct adapter *, int, struct sge_wrq *); +int cxgbe_media_change(struct ifnet *); +void cxgbe_media_status(struct ifnet *, struct ifmediareq *); #ifdef DEV_NETMAP /* t4_netmap.c */ Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Thu Aug 23 00:05:13 2018 (r338217) +++ head/sys/dev/cxgbe/t4_main.c Thu Aug 23 00:58:10 2018 (r338218) @@ -215,13 +215,11 @@ static driver_t vcc_driver = { sizeof(struct vi_info) }; -/* ifnet + media interface */ +/* ifnet interface */ static void cxgbe_init(void *); static int cxgbe_ioctl(struct ifnet *, unsigned long, caddr_t); static int cxgbe_transmit(struct ifnet *, struct mbuf *); static void cxgbe_qflush(struct ifnet *); -static int cxgbe_media_change(struct ifnet *); -static void cxgbe_media_status(struct ifnet *, struct ifmediareq *); MALLOC_DEFINE(M_CXGBE, "cxgbe", "Chelsio T4/T5 Ethernet driver and services"); @@ -2066,7 +2064,7 @@ cxgbe_get_counter(struct ifnet *ifp, ift_counter c) * The kernel picks a media from the list we had provided so we do not have to * validate the request. */ -static int +int cxgbe_media_change(struct ifnet *ifp) { struct vi_info *vi = ifp->if_softc; @@ -2263,7 +2261,7 @@ port_mword(struct port_info *pi, uint16_t speed) return (IFM_UNKNOWN); } -static void +void cxgbe_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) { struct vi_info *vi = ifp->if_softc; @@ -4378,7 +4376,9 @@ apply_l1cfg(struct port_info *pi) #endif rc = -t4_link_l1cfg(sc, sc->mbox, pi->tx_chan, lc); if (rc != 0) { - device_printf(pi->dev, "l1cfg failed: %d\n", rc); + /* Don't complain if the VF driver gets back an EPERM. */ + if (!(sc->flags & IS_VF) || rc != FW_EPERM) + device_printf(pi->dev, "l1cfg failed: %d\n", rc); } else { lc->fc = lc->requested_fc; lc->fec = lc->requested_fec; Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Thu Aug 23 00:05:13 2018 (r338217) +++ head/sys/dev/cxgbe/t4_sge.c Thu Aug 23 00:58:10 2018 (r338218) @@ -1079,8 +1079,10 @@ t4_teardown_adapter_queues(struct adapter *sc) sc->flags &= ~ADAP_SYSCTL_CTX; } - for_each_port(sc, i) - free_wrq(sc, &sc->sge.ctrlq[i]); + if (!(sc->flags & IS_VF)) { + for_each_port(sc, i) + free_wrq(sc, &sc->sge.ctrlq[i]); + } free_fwq(sc); return (0); Modified: head/sys/dev/cxgbe/t4_vf.c ============================================================================== --- head/sys/dev/cxgbe/t4_vf.c Thu Aug 23 00:05:13 2018 (r338217) +++ head/sys/dev/cxgbe/t4_vf.c Thu Aug 23 00:58:10 2018 (r338218) @@ -637,6 +637,10 @@ t4vf_attach(device_t dev) mtx_init(&pi->pi_lock, pi->lockname, 0, MTX_DEF); sc->chan_map[pi->tx_chan] = i; + /* All VIs on this port share this media. */ + ifmedia_init(&pi->media, IFM_IMASK, cxgbe_media_change, + cxgbe_media_status); + pi->dev = device_add_child(dev, sc->names->vf_ifnet_name, -1); if (pi->dev == NULL) { device_printf(dev,