From 46aba95b768d057102b9f60f89626e84e47fba28 Mon Sep 17 00:00:00 2001 From: Vincenzo Maffione Date: Thu, 7 Nov 2019 20:09:41 +0000 Subject: [PATCH] MFC r354229 add valectl to the system commands The valectl(4) program is used to manage vale(4) switches. Add it to the system commands so that it can be used right away. This program was previously called vale-ctl, and stored in tools/tools/netmap Reviewed by: hrs, bcr, lwhsu, kevans Differential Revision: https://reviews.freebsd.org/D22146 --- share/man/man4/netmap.4 | 6 +++--- sys/dev/netmap/netmap_bdg.c | 2 +- sys/net/netmap_legacy.h | 10 +++++----- tools/tools/netmap/Makefile | 5 +---- tools/tools/netmap/README | 2 -- tools/tools/netmap/lb.8 | 4 ++-- usr.sbin/Makefile | 1 + usr.sbin/valectl/Makefile | 8 ++++++++ .../netmap/vale-ctl.4 => usr.sbin/valectl/valectl.8 | 10 +++++----- .../netmap/vale-ctl.c => usr.sbin/valectl/valectl.c | 8 +++----- 10 files changed, 29 insertions(+), 27 deletions(-) create mode 100644 usr.sbin/valectl/Makefile rename tools/tools/netmap/vale-ctl.4 => usr.sbin/valectl/valectl.8 (98%) rename tools/tools/netmap/vale-ctl.c => usr.sbin/valectl/valectl.c (97%) diff --git a/share/man/man4/netmap.4 b/share/man/man4/netmap.4 index cbdd554357d..706f76e5481 100644 --- a/share/man/man4/netmap.4 +++ b/share/man/man4/netmap.4 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 20, 2018 +.Dd October 26, 2019 .Dt NETMAP 4 .Os .Sh NAME @@ -1087,14 +1087,14 @@ changing port names, e.g., .Pp The following command attaches an interface and the host stack to a switch: -.Dl vale-ctl -h vale2:em0 +.Dl valectl -h vale2:em0 Other .Nm clients attached to the same switch can now communicate with the network card or the host. .Sh SEE ALSO .Xr vale 4 , -.Xr vale-ctl 4 , +.Xr valectl 8 , .Xr bridge 8 , .Xr lb 8 , .Xr nmreplay 8 , diff --git a/sys/dev/netmap/netmap_bdg.c b/sys/dev/netmap/netmap_bdg.c index 41faa1b5b56..96d6deedb76 100644 --- a/sys/dev/netmap/netmap_bdg.c +++ b/sys/dev/netmap/netmap_bdg.c @@ -1442,7 +1442,7 @@ netmap_bwrap_notify(struct netmap_kring *kring, int flags) /* nm_bdg_ctl callback for the bwrap. - * Called on bridge-attach and detach, as an effect of vale-ctl -[ahd]. + * Called on bridge-attach and detach, as an effect of valectl -[ahd]. * On attach, it needs to provide a fake netmap_priv_d structure and * perform a netmap_do_regif() on the bwrap. This will put both the * bwrap and the hwna in netmap mode, with the netmap rings shared diff --git a/sys/net/netmap_legacy.h b/sys/net/netmap_legacy.h index f1dd7d62589..115a09e5fba 100644 --- a/sys/net/netmap_legacy.h +++ b/sys/net/netmap_legacy.h @@ -116,13 +116,13 @@ * nr_cmd (in) if non-zero indicates a special command: * NETMAP_BDG_ATTACH and nr_name = vale*:ifname * attaches the NIC to the switch; nr_ringid specifies - * which rings to use. Used by vale-ctl -a ... + * which rings to use. Used by valectl -a ... * nr_arg1 = NETMAP_BDG_HOST also attaches the host port - * as in vale-ctl -h ... + * as in valectl -h ... * * NETMAP_BDG_DETACH and nr_name = vale*:ifname * disconnects a previously attached NIC. - * Used by vale-ctl -d ... + * Used by valectl -d ... * * NETMAP_BDG_LIST * list the configuration of VALE switches. @@ -133,10 +133,10 @@ * * NETMAP_BDG_NEWIF * create a persistent VALE port with name nr_name. - * Used by vale-ctl -n ... + * Used by valectl -n ... * * NETMAP_BDG_DELIF - * delete a persistent VALE port. Used by vale-ctl -d ... + * delete a persistent VALE port. Used by valectl -d ... * * nr_arg1, nr_arg2, nr_arg3 (in/out) command specific * diff --git a/tools/tools/netmap/Makefile b/tools/tools/netmap/Makefile index d479ac83a1a..2c0e6f4a28b 100644 --- a/tools/tools/netmap/Makefile +++ b/tools/tools/netmap/Makefile @@ -3,7 +3,7 @@ # # For multiple programs using a single source file each, # we can just define 'progs' and create custom targets. -PROGS = pkt-gen nmreplay bridge vale-ctl lb +PROGS = pkt-gen nmreplay bridge lb CLEANFILES = $(PROGS) *.o MAN= @@ -32,8 +32,5 @@ bridge: bridge.o nmreplay: nmreplay.o $(CC) $(CFLAGS) -o nmreplay nmreplay.o $(LDFLAGS) -vale-ctl: vale-ctl.o - $(CC) $(CFLAGS) -o vale-ctl vale-ctl.o - lb: lb.o pkt_hash.o $(CC) $(CFLAGS) -o lb lb.o pkt_hash.o $(LDFLAGS) diff --git a/tools/tools/netmap/README b/tools/tools/netmap/README index ca517f72f2f..ff84b11f2fc 100644 --- a/tools/tools/netmap/README +++ b/tools/tools/netmap/README @@ -6,8 +6,6 @@ This directory contains applications that use the netmap API bridge a two-port jumper wire, also using the netmap API - vale-ctl the program to control and inspect VALE switches - lb an L3/L4 load balancer nmreplay a tool to playback a pcap file to a netmap port diff --git a/tools/tools/netmap/lb.8 b/tools/tools/netmap/lb.8 index 91694cb9b2a..15153e6ffbb 100644 --- a/tools/tools/netmap/lb.8 +++ b/tools/tools/netmap/lb.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 28, 2018 +.Dd October 26, 2019 .Dt LB 8 .Os .Sh NAME @@ -111,7 +111,7 @@ If .Nm does not exit cleanly the ports will not be removed. Please use -.Xr vale-ctl 4 +.Xr valectl 8 to remove any stale persistent VALE port. .Sh SEE ALSO .Xr netmap 4 , diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index 94c63dd6dc0..3b9d5fe9744 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -96,6 +96,7 @@ SUBDIR= adduser \ trpt \ tzsetup \ ugidfw \ + valectl \ vigr \ vipw \ wake \ diff --git a/usr.sbin/valectl/Makefile b/usr.sbin/valectl/Makefile new file mode 100644 index 00000000000..026646948c0 --- /dev/null +++ b/usr.sbin/valectl/Makefile @@ -0,0 +1,8 @@ +# $FreeBSD$ + +PROG= valectl +MAN= valectl.8 + +WARNS?= 3 + +.include diff --git a/tools/tools/netmap/vale-ctl.4 b/usr.sbin/valectl/valectl.8 similarity index 98% rename from tools/tools/netmap/vale-ctl.4 rename to usr.sbin/valectl/valectl.8 index 67e07e59f14..4b5a8089782 100644 --- a/tools/tools/netmap/vale-ctl.4 +++ b/usr.sbin/valectl/valectl.8 @@ -24,15 +24,15 @@ .\" .\" $FreeBSD$ .\" -.Dd October 24, 2018 -.Dt VALE-CTL 4 +.Dd October 26, 2019 +.Dt VALECTL 8 .Os .Sh NAME -.Nm vale-ctl +.Nm valectl .Nd manage VALE switches provided by netmap .Sh SYNOPSIS .Bk -words -.Bl -tag -width "vale-ctl" +.Bl -tag -width "valectl" .It Nm .Op Fl g Ar valeSSS:PPP .Op Fl a Ar valeSSS:interface @@ -158,6 +158,6 @@ harware netmap ports. .Sh AUTHORS .An -nosplit .Nm -has been written by +was written by .An Michio Honda at NetApp. diff --git a/tools/tools/netmap/vale-ctl.c b/usr.sbin/valectl/valectl.c similarity index 97% rename from tools/tools/netmap/vale-ctl.c rename to usr.sbin/valectl/valectl.c index fc909144a3c..1e19dfef9e4 100644 --- a/tools/tools/netmap/vale-ctl.c +++ b/usr.sbin/valectl/valectl.c @@ -42,10 +42,8 @@ #include /* basename */ #include /* atoi, free */ -/* XXX cut and paste from pkt-gen.c because I'm not sure whether this - * program may include nm_util.h - */ -void parse_nmr_config(const char* conf, struct nmreq *nmr) +static void +parse_nmr_config(const char* conf, struct nmreq *nmr) { char *w, *tok; int i, v; @@ -201,7 +199,7 @@ usage(int errcode) { fprintf(stderr, "Usage:\n" - "vale-ctl arguments\n" + "valectl arguments\n" "\t-g interface interface name to get info\n" "\t-d interface interface name to be detached\n" "\t-a interface interface name to be attached\n" -- 2.45.0