From owner-svn-src-head@freebsd.org Thu Jun 25 19:44:25 2020 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 7F2AA3432E9; Thu, 25 Jun 2020 19:44:25 +0000 (UTC) (envelope-from vmaffione@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 49t9Sn2CVfz4Vtv; Thu, 25 Jun 2020 19:44:25 +0000 (UTC) (envelope-from vmaffione@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 28B038806; Thu, 25 Jun 2020 19:44:25 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05PJiPHD083568; Thu, 25 Jun 2020 19:44:25 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05PJiOkA083567; Thu, 25 Jun 2020 19:44:24 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <202006251944.05PJiOkA083567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Thu, 25 Jun 2020 19:44:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362622 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 362622 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.33 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, 25 Jun 2020 19:44:25 -0000 Author: vmaffione Date: Thu Jun 25 19:44:24 2020 New Revision: 362622 URL: https://svnweb.freebsd.org/changeset/base/362622 Log: iflib: netmap: add support for partial ring openings Reviewed by: gallatin MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D25254 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Thu Jun 25 19:35:43 2020 (r362621) +++ head/sys/net/iflib.c Thu Jun 25 19:44:24 2020 (r362622) @@ -1189,7 +1189,7 @@ iflib_netmap_attach(if_ctx_t ctx) return (netmap_attach(&na)); } -static void +static int iflib_netmap_txq_init(if_ctx_t ctx, iflib_txq_t txq) { struct netmap_adapter *na = NA(ctx->ifc_ifp); @@ -1197,7 +1197,7 @@ iflib_netmap_txq_init(if_ctx_t ctx, iflib_txq_t txq) slot = netmap_reset(na, NR_TX, txq->ift_id, 0); if (slot == NULL) - return; + return (0); for (int i = 0; i < ctx->ifc_softc_ctx.isc_ntxd[0]; i++) { /* @@ -1211,21 +1211,24 @@ iflib_netmap_txq_init(if_ctx_t ctx, iflib_txq_t txq) netmap_load_map(na, txq->ift_buf_tag, txq->ift_sds.ifsd_map[i], NMB(na, slot + si)); } + return (1); } -static void +static int iflib_netmap_rxq_init(if_ctx_t ctx, iflib_rxq_t rxq) { struct netmap_adapter *na = NA(ctx->ifc_ifp); - struct netmap_kring *kring = na->rx_rings[rxq->ifr_id]; + struct netmap_kring *kring; struct netmap_slot *slot; uint32_t nm_i; slot = netmap_reset(na, NR_RX, rxq->ifr_id, 0); if (slot == NULL) - return; + return (0); + kring = na->rx_rings[rxq->ifr_id]; nm_i = netmap_idx_n2k(kring, 0); netmap_fl_refill(rxq, kring, nm_i, true); + return (1); } static void @@ -1256,8 +1259,8 @@ iflib_netmap_timer_adjust(if_ctx_t ctx, iflib_txq_t tx #define iflib_netmap_detach(ifp) netmap_detach(ifp) #else -#define iflib_netmap_txq_init(ctx, txq) -#define iflib_netmap_rxq_init(ctx, rxq) +#define iflib_netmap_txq_init(ctx, txq) (0) +#define iflib_netmap_rxq_init(ctx, rxq) (0) #define iflib_netmap_detach(ifp) #define iflib_netmap_attach(ctx) (0) @@ -2368,10 +2371,8 @@ iflib_init_locked(if_ctx_t ctx) IFDI_INIT(ctx); MPASS(if_getdrvflags(ifp) == i); for (i = 0, rxq = ctx->ifc_rxqs; i < sctx->isc_nrxqsets; i++, rxq++) { - /* XXX this should really be done on a per-queue basis */ - if (if_getcapenable(ifp) & IFCAP_NETMAP) { - MPASS(rxq->ifr_id == i); - iflib_netmap_rxq_init(ctx, rxq); + if (iflib_netmap_rxq_init(ctx, rxq) > 0) { + /* This rxq is in netmap mode. Skip normal init. */ continue; } for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++) {