From owner-svn-src-all@freebsd.org Sun Oct 27 09:28:34 2019 Return-Path: Delivered-To: svn-src-all@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 A271E170F71; Sun, 27 Oct 2019 09:28:34 +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) 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 471CFt3rMPz4WCq; Sun, 27 Oct 2019 09:28:34 +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 66CE91F304; Sun, 27 Oct 2019 09:28:34 +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 x9R9SY5I020252; Sun, 27 Oct 2019 09:28:34 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9R9SXnl020247; Sun, 27 Oct 2019 09:28:33 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201910270928.x9R9SXnl020247@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Sun, 27 Oct 2019 09:28:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354128 - in stable/12: sys/dev/netmap tools/tools/netmap X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in stable/12: sys/dev/netmap tools/tools/netmap X-SVN-Commit-Revision: 354128 X-SVN-Commit-Repository: base 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.29 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: Sun, 27 Oct 2019 09:28:34 -0000 Author: vmaffione Date: Sun Oct 27 09:28:33 2019 New Revision: 354128 URL: https://svnweb.freebsd.org/changeset/base/354128 Log: MFC r353775 netmap: minor misc improvements - use ring->head rather than ring->cur in lb(8) - use strlcat() rather than strncat() - fix bandwidth computation in pkt-gen(8) Modified: stable/12/sys/dev/netmap/netmap.c stable/12/sys/dev/netmap/netmap_legacy.c stable/12/sys/dev/netmap/netmap_mem2.c stable/12/tools/tools/netmap/lb.c stable/12/tools/tools/netmap/pkt-gen.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/netmap/netmap.c ============================================================================== --- stable/12/sys/dev/netmap/netmap.c Sun Oct 27 08:35:29 2019 (r354127) +++ stable/12/sys/dev/netmap/netmap.c Sun Oct 27 09:28:33 2019 (r354128) @@ -3316,7 +3316,8 @@ nmreq_getoption(struct nmreq_header *hdr, uint16_t req if (!hdr->nr_options) return NULL; - opt_tab = (struct nmreq_option **)(hdr->nr_options) - (NETMAP_REQ_OPT_MAX + 1); + opt_tab = (struct nmreq_option **)((uintptr_t)hdr->nr_options) - + (NETMAP_REQ_OPT_MAX + 1); return opt_tab[reqtype]; } Modified: stable/12/sys/dev/netmap/netmap_legacy.c ============================================================================== --- stable/12/sys/dev/netmap/netmap_legacy.c Sun Oct 27 08:35:29 2019 (r354127) +++ stable/12/sys/dev/netmap/netmap_legacy.c Sun Oct 27 09:28:33 2019 (r354128) @@ -100,7 +100,7 @@ nmreq_register_from_legacy(struct nmreq *nmr, struct n /* No space for the pipe suffix. */ return ENOBUFS; } - strncat(hdr->nr_name, suffix, strlen(suffix)); + strlcat(hdr->nr_name, suffix, sizeof(hdr->nr_name)); req->nr_mode = NR_REG_ALL_NIC; req->nr_ringid = 0; } Modified: stable/12/sys/dev/netmap/netmap_mem2.c ============================================================================== --- stable/12/sys/dev/netmap/netmap_mem2.c Sun Oct 27 08:35:29 2019 (r354127) +++ stable/12/sys/dev/netmap/netmap_mem2.c Sun Oct 27 09:28:33 2019 (r354128) @@ -2447,8 +2447,8 @@ netmap_mem_pt_guest_ifp_del(struct netmap_mem_d *nmd, } else { ptnmd->pt_ifs = curr->next; } - nm_prinf("removed (ifp=%p,nifp_offset=%u)", - curr->ifp, curr->nifp_offset); + nm_prinf("removed (ifp=%s,nifp_offset=%u)", + curr->ifp->if_xname, curr->nifp_offset); nm_os_free(curr); ret = 0; break; Modified: stable/12/tools/tools/netmap/lb.c ============================================================================== --- stable/12/tools/tools/netmap/lb.c Sun Oct 27 08:35:29 2019 (r354127) +++ stable/12/tools/tools/netmap/lb.c Sun Oct 27 09:28:33 2019 (r354128) @@ -652,7 +652,7 @@ int main(int argc, char **argv) /* extract the base name */ char *nscan = strncmp(glob_arg.ifname, "netmap:", 7) ? glob_arg.ifname : glob_arg.ifname + 7; - strncpy(glob_arg.base_name, nscan, MAX_IFNAMELEN-1); + strncpy(glob_arg.base_name, nscan, MAX_IFNAMELEN - 1); for (nscan = glob_arg.base_name; *nscan && !index("-*^{}/@", *nscan); nscan++) ; *nscan = '\0'; @@ -948,8 +948,8 @@ run: struct netmap_ring *rxring = NETMAP_RXRING(rxport->nmd->nifp, i); //D("prepare to scan rings"); - int next_cur = rxring->cur; - struct netmap_slot *next_slot = &rxring->slot[next_cur]; + int next_head = rxring->head; + struct netmap_slot *next_slot = &rxring->slot[next_head]; const char *next_buf = NETMAP_BUF(rxring, next_slot->buf_idx); while (!nm_ring_empty(rxring)) { struct netmap_slot *rs = next_slot; @@ -963,14 +963,14 @@ run: non_ip++; // XXX ?? } // prefetch the buffer for the next round - next_cur = nm_ring_next(rxring, next_cur); - next_slot = &rxring->slot[next_cur]; + next_head = nm_ring_next(rxring, next_head); + next_slot = &rxring->slot[next_head]; next_buf = NETMAP_BUF(rxring, next_slot->buf_idx); __builtin_prefetch(next_buf); // 'B' is just a hashing seed rs->buf_idx = forward_packet(g, rs); rs->flags |= NS_BUF_CHANGED; - rxring->head = rxring->cur = next_cur; + rxring->head = rxring->cur = next_head; batch++; if (unlikely(batch >= glob_arg.batch)) { Modified: stable/12/tools/tools/netmap/pkt-gen.c ============================================================================== --- stable/12/tools/tools/netmap/pkt-gen.c Sun Oct 27 08:35:29 2019 (r354127) +++ stable/12/tools/tools/netmap/pkt-gen.c Sun Oct 27 09:28:33 2019 (r354128) @@ -2634,7 +2634,7 @@ main_thread(struct glob_arg *g) D("%spps %s(%spkts %sbps in %llu usec) %.2f avg_batch %d min_space", norm(b1, pps, normalize), b4, norm(b2, (double)x.pkts, normalize), - norm(b3, (double)x.bytes*8+(double)x.pkts*g->framing, normalize), + norm(b3, 1000000*((double)x.bytes*8+(double)x.pkts*g->framing)/usec, normalize), (unsigned long long)usec, abs, (int)cur.min_space); prev = cur; @@ -2973,6 +2973,7 @@ main(int arc, char **argv) g.options |= OPT_DUMP; break; case 'C': + D("WARNING: the 'C' option is deprecated, use the '+conf:' libnetmap option instead"); g.nmr_config = strdup(optarg); break; case 'H':