From owner-svn-src-all@freebsd.org Tue Sep 13 05:41:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AECBDBD8906; Tue, 13 Sep 2016 05:41:14 +0000 (UTC) (envelope-from sephe@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 mx1.freebsd.org (Postfix) with ESMTPS id 656CD7D4; Tue, 13 Sep 2016 05:41:14 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8D5fDdt002305; Tue, 13 Sep 2016 05:41:13 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8D5fDcV002304; Tue, 13 Sep 2016 05:41:13 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609130541.u8D5fDcV002304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 13 Sep 2016 05:41:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305761 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2016 05:41:14 -0000 Author: sephe Date: Tue Sep 13 05:41:13 2016 New Revision: 305761 URL: https://svnweb.freebsd.org/changeset/base/305761 Log: hyperv/hn: Regroup synthetic parts attach code. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7859 Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Sep 13 05:27:36 2016 (r305760) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Sep 13 05:41:13 2016 (r305761) @@ -523,12 +523,40 @@ netvsc_attach(device_t dev) goto failed; /* + * Create transaction context for NVS and RNDIS transactions. + */ + sc->hn_xact = vmbus_xact_ctx_create(bus_get_dma_tag(dev), + HN_XACT_REQ_SIZE, HN_XACT_RESP_SIZE, 0); + if (sc->hn_xact == NULL) + goto failed; + + /* * Attach the primary channel before attaching NVS and RNDIS. */ error = hn_chan_attach(sc, sc->hn_prichan); if (error) goto failed; + /* + * Attach NVS and RNDIS (synthetic parts). + */ + error = hv_rf_on_device_add(sc, &ring_cnt, ETHERMTU); + if (error) + goto failed; + + /* + * Set the # of TX/RX rings that could be used according to + * the # of channels that host offered. + */ + hn_set_ring_inuse(sc, ring_cnt); + + /* + * Attach the sub-channels, if any. + */ + error = hn_attach_subchans(sc); + if (error) + goto failed; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = hn_ioctl; ifp->if_init = hn_ifinit; @@ -563,31 +591,6 @@ netvsc_attach(device_t dev) IFCAP_LRO; ifp->if_hwassist = sc->hn_tx_ring[0].hn_csum_assist | CSUM_TSO; - sc->hn_xact = vmbus_xact_ctx_create(bus_get_dma_tag(dev), - HN_XACT_REQ_SIZE, HN_XACT_RESP_SIZE, 0); - if (sc->hn_xact == NULL) - goto failed; - - error = hv_rf_on_device_add(sc, &ring_cnt, ETHERMTU); - if (error) - goto failed; - KASSERT(ring_cnt > 0 && ring_cnt <= sc->hn_rx_ring_inuse, - ("invalid channel count %d, should be less than %d", - ring_cnt, sc->hn_rx_ring_inuse)); - - /* - * Set the # of TX/RX rings that could be used according to - * the # of channels that host offered. - */ - hn_set_ring_inuse(sc, ring_cnt); - - /* - * Attach the sub-channels, if any. - */ - error = hn_attach_subchans(sc); - if (error) - goto failed; - #if __FreeBSD_version >= 1100099 if (sc->hn_rx_ring_inuse > 1) { /*