Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: dsahern@gmail.com, stephen@networkplumber.org
Cc: netdev@vger.kernel.org, oss-drivers@netronome.com,
	Jakub Kicinski <jakub.kicinski@netronome.com>
Subject: [PATCH iproute2-next] ip: link: add support for netdevsim device type
Date: Tue,  2 Jan 2018 14:54:52 -0800	[thread overview]
Message-ID: <20180102225452.14312-1-jakub.kicinski@netronome.com> (raw)

netdevsim is a new software device for testing kernel APIs
without any hardware attached.  Allow users to create such
devices.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
---
I think I forgot to send this out..

 ip/Makefile           |  2 +-
 ip/ipaddress.c        |  2 +-
 ip/iplink.c           |  2 +-
 ip/iplink_netdevsim.c | 16 ++++++++++++++++
 man/man8/ip-link.8.in |  6 +++++-
 5 files changed, 24 insertions(+), 4 deletions(-)
 create mode 100644 ip/iplink_netdevsim.c

diff --git a/ip/Makefile b/ip/Makefile
index a653c1bdd967..77fadeed2e62 100644
--- a/ip/Makefile
+++ b/ip/Makefile
@@ -10,7 +10,7 @@ IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \
     link_iptnl.o link_gre6.o iplink_bond.o iplink_bond_slave.o iplink_hsr.o \
     iplink_bridge.o iplink_bridge_slave.o ipfou.o iplink_ipvlan.o \
     iplink_geneve.o iplink_vrf.o iproute_lwtunnel.o ipmacsec.o ipila.o \
-    ipvrf.o iplink_xstats.o ipseg6.o
+    ipvrf.o iplink_xstats.o ipseg6.o iplink_netdevsim.o
 
 RTMONOBJ=rtmon.o
 
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index f150d9190b76..c35b6b3f1b10 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -78,7 +78,7 @@ static void usage(void)
 	fprintf(stderr, "          bridge | bond | ipoib | ip6tnl | ipip | sit | vxlan | lowpan |\n");
 	fprintf(stderr, "          gre | gretap | erspan | ip6gre | ip6gretap | ip6erspan | vti |\n");
 	fprintf(stderr, "          nlmon | can | bond_slave | ipvlan | geneve | bridge_slave |\n");
-	fprintf(stderr, "          hsr | macsec\n");
+	fprintf(stderr, "          hsr | macsec | netdevsim\n");
 
 	exit(-1);
 }
diff --git a/ip/iplink.c b/ip/iplink.c
index 06b344275bb6..8768b93f8f74 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -122,7 +122,7 @@ void iplink_usage(void)
 			"          bridge | bond | team | ipoib | ip6tnl | ipip | sit | vxlan |\n"
 			"          gre | gretap | erspan | ip6gre | ip6gretap | ip6erspan |\n"
 			"          vti | nlmon | team_slave | bond_slave | ipvlan | geneve |\n"
-			"          bridge_slave | vrf | macsec }\n");
+			"          bridge_slave | vrf | macsec | netdevsim }\n");
 	}
 	exit(-1);
 }
diff --git a/ip/iplink_netdevsim.c b/ip/iplink_netdevsim.c
new file mode 100644
index 000000000000..34486081f6d4
--- /dev/null
+++ b/ip/iplink_netdevsim.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "utils.h"
+#include "ip_common.h"
+
+static void netdevsim_print_help(struct link_util *lu,
+				 int argc, char **argv, FILE *f)
+{
+	fprintf(f, "Usage: ... netdevsim\n");
+}
+
+struct link_util netdevsim_link_util = {
+	.id		= "netdevsim",
+	.print_help	= netdevsim_print_help,
+};
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index 0086b3dfa09d..fc6694c0c72d 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -217,7 +217,8 @@ ip-link \- network device configuration
 .BR lowpan " |"
 .BR geneve " |"
 .BR vrf " |"
-.BR macsec " ]"
+.BR macsec " |"
+.BR netdevsim " ]"
 
 .ti -8
 .IR ETYPE " := [ " TYPE " |"
@@ -337,6 +338,9 @@ specifies the type of the new device.
 .sp
 .BR vrf
 - Interface for L3 VRF domains
+.sp
+.BR netdevsim
+- Interface for netdev API tests
 .in -8
 
 .TP
-- 
2.15.1

             reply	other threads:[~2018-01-02 22:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-02 22:54 Jakub Kicinski [this message]
2018-01-03  4:51 ` [PATCH iproute2-next] ip: link: add support for netdevsim device type David Ahern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180102225452.14312-1-jakub.kicinski@netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=dsahern@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox