From owner-svn-src-all@freebsd.org Wed Nov 25 21:23:59 2020 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 2CD32474777; Wed, 25 Nov 2020 21:23:59 +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 4ChDR30lDvz4W8h; Wed, 25 Nov 2020 21:23:59 +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 0C72218035; Wed, 25 Nov 2020 21:23:59 +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 0APLNw41061821; Wed, 25 Nov 2020 21:23:58 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0APLNwlL061820; Wed, 25 Nov 2020 21:23:58 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <202011252123.0APLNwlL061820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Wed, 25 Nov 2020 21:23:58 +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: r368035 - stable/12/tools/tools/netmap X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/tools/tools/netmap X-SVN-Commit-Revision: 368035 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.34 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: Wed, 25 Nov 2020 21:23:59 -0000 Author: vmaffione Date: Wed Nov 25 21:23:58 2020 New Revision: 368035 URL: https://svnweb.freebsd.org/changeset/base/368035 Log: MFC r367934 netmap: nmreplay: switch to libnetmap Use the newer libnetmap (included in base) rather than the older nm_open()/nm_close() defined in netmap_user.h Modified: stable/12/tools/tools/netmap/nmreplay.c Directory Properties: stable/12/ (props changed) Modified: stable/12/tools/tools/netmap/nmreplay.c ============================================================================== --- stable/12/tools/tools/netmap/nmreplay.c Wed Nov 25 21:23:13 2020 (r368034) +++ stable/12/tools/tools/netmap/nmreplay.c Wed Nov 25 21:23:58 2020 (r368035) @@ -106,12 +106,27 @@ #define DDD(_fmt, ...) ED("--DDD-- " _fmt, ##__VA_ARGS__) #define _GNU_SOURCE // for CPU_SET() etc +#include +#include +#include +#include /* log, exp etc. */ +#include +#ifdef __FreeBSD__ +#include /* pthread w/ affinity */ +#include /* cpu_set */ +#endif /* __FreeBSD__ */ +#include #include -#define NETMAP_WITH_LIBS -#include +#include +#include /* memcpy */ +#include +#include +#include #include +#include // setpriority +#include +#include - /* * * A packet in the queue is q_pkt plus the payload. @@ -242,15 +257,6 @@ static struct nm_pcap_file *readpcap(const char *fn); static void destroy_pcap(struct nm_pcap_file *file); -#include -#include -#include -#include -#include -#include /* memcpy */ - -#include - #define NS_SCALE 1000000000UL /* nanoseconds in 1s */ static void destroy_pcap(struct nm_pcap_file *pf) @@ -435,18 +441,6 @@ static int verbose = 0; static int do_abort = 0; -#include -#include -#include -#include - -#include // setpriority - -#ifdef __FreeBSD__ -#include /* pthread w/ affinity */ -#include /* cpu_set */ -#endif /* __FreeBSD__ */ - #ifdef linux #define cpuset_t cpu_set_t #endif @@ -566,7 +560,7 @@ struct _qs { /* shared queue */ struct nm_pcap_file *pcap; /* the pcap struct */ /* parameters for reading from the netmap port */ - struct nm_desc *src_port; /* netmap descriptor */ + struct nmport_d *src_port; /* netmap descriptor */ const char * prod_ifname; /* interface name or pcap file */ struct netmap_ring *rxring; /* current ring being handled */ uint32_t si; /* ring index */ @@ -640,8 +634,8 @@ struct pipe_args { int cons_core; /* core for cons() */ int prod_core; /* core for prod() */ - struct nm_desc *pa; /* netmap descriptor */ - struct nm_desc *pb; + struct nmport_d *pa; /* netmap descriptor */ + struct nmport_d *pb; struct _qs q; }; @@ -843,7 +837,7 @@ fail: if (q->buf != NULL) { free(q->buf); } - nm_close(pa->pb); + nmport_close(pa->pb); return (NULL); } @@ -893,7 +887,7 @@ cons(void *_pa) continue; } /* XXX copy is inefficient but simple */ - if (nm_inject(pa->pb, (char *)(p + 1), p->pktlen) == 0) { + if (nmport_inject(pa->pb, (char *)(p + 1), p->pktlen) == 0) { RD(1, "inject failed len %d now %ld tx %ld h %ld t %ld next %ld", (int)p->pktlen, (u_long)q->cons_now, (u_long)p->pt_tx, (u_long)q->_head, (u_long)q->_tail, (u_long)p->next); @@ -939,7 +933,7 @@ nmreplay_main(void *_a) pcap_prod((void*)a); destroy_pcap(q->pcap); q->pcap = NULL; - a->pb = nm_open(q->cons_ifname, NULL, 0, NULL); + a->pb = nmport_open(q->cons_ifname); if (a->pb == NULL) { EEE("cannot open netmap on %s", q->cons_ifname); do_abort = 1; // XXX any better way ? @@ -1372,7 +1366,6 @@ parse_bw(const char *arg) * 24 useful random bits. */ -#include /* log, exp etc. */ static inline uint64_t my_random24(void) /* 24 useful bits */ {