From owner-svn-src-stable-11@freebsd.org Mon Apr 29 05:35:54 2019 Return-Path: Delivered-To: svn-src-stable-11@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 B0BAF1581716; Mon, 29 Apr 2019 05:35:54 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1CF928CC4C; Mon, 29 Apr 2019 05:35:54 +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 E6A331D9E8; Mon, 29 Apr 2019 05:35:53 +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 x3T5ZrMf034522; Mon, 29 Apr 2019 05:35:53 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x3T5Zrpm034518; Mon, 29 Apr 2019 05:35:53 GMT (envelope-from np@FreeBSD.org) Message-Id: <201904290535.x3T5Zrpm034518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 29 Apr 2019 05:35:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r346883 - stable/11/sys/dev/cxgbe X-SVN-Group: stable-11 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/11/sys/dev/cxgbe X-SVN-Commit-Revision: 346883 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1CF928CC4C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Apr 2019 05:35:54 -0000 Author: np Date: Mon Apr 29 05:35:52 2019 New Revision: 346883 URL: https://svnweb.freebsd.org/changeset/base/346883 Log: MFC r338218: cxgbev(4): Updates to the VF driver to cope with recent ifmedia and ctrlq changes in the base driver. Sponsored by: Chelsio Communications Modified: stable/11/sys/dev/cxgbe/adapter.h stable/11/sys/dev/cxgbe/t4_main.c stable/11/sys/dev/cxgbe/t4_sge.c stable/11/sys/dev/cxgbe/t4_vf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cxgbe/adapter.h ============================================================================== --- stable/11/sys/dev/cxgbe/adapter.h Mon Apr 29 05:26:27 2019 (r346882) +++ stable/11/sys/dev/cxgbe/adapter.h Mon Apr 29 05:35:52 2019 (r346883) @@ -1133,6 +1133,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: stable/11/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_main.c Mon Apr 29 05:26:27 2019 (r346882) +++ stable/11/sys/dev/cxgbe/t4_main.c Mon Apr 29 05:35:52 2019 (r346883) @@ -219,13 +219,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"); @@ -2150,7 +2148,7 @@ cxgbe_get_counter(struct ifnet *ifp, ift_counter c) * The kernel picks a media from the list we had provided but we still validate * the requeste. */ -static int +int cxgbe_media_change(struct ifnet *ifp) { struct vi_info *vi = ifp->if_softc; @@ -2339,7 +2337,7 @@ port_mword(struct port_info *pi, uint32_t speed) return (IFM_UNKNOWN); } -static void +void cxgbe_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) { struct vi_info *vi = ifp->if_softc; @@ -4532,7 +4530,9 @@ apply_link_config(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 { /* * An L1_CFG will almost always result in a link-change event if Modified: stable/11/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_sge.c Mon Apr 29 05:26:27 2019 (r346882) +++ stable/11/sys/dev/cxgbe/t4_sge.c Mon Apr 29 05:35:52 2019 (r346883) @@ -1053,8 +1053,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: stable/11/sys/dev/cxgbe/t4_vf.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_vf.c Mon Apr 29 05:26:27 2019 (r346882) +++ stable/11/sys/dev/cxgbe/t4_vf.c Mon Apr 29 05:35:52 2019 (r346883) @@ -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,