aboutsummaryrefslogtreecommitdiff
path: root/sbin/ifconfig
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2020-10-22 09:47:12 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2020-10-22 09:47:12 +0000
commita92c4bb62ad107d867863f04937f65f23bce0837 (patch)
tree0a6b9d9a76269b2e60f01f2fbf93bdf7eddaa46c /sbin/ifconfig
parent18b8496c23fa9e88c3ac6d6e477896683c4f3847 (diff)
downloadsrc-a92c4bb62ad107d867863f04937f65f23bce0837.tar.gz
src-a92c4bb62ad107d867863f04937f65f23bce0837.zip
Add support for IP over infiniband, IPoIB, to lagg(4). Currently only
the failover protocol is supported due to limitations in the IPoIB architecture. Refer to the lagg(4) manual page for how to configure and use this new feature. A new network interface type, IFT_INFINIBANDLAG, has been added, similar to the existing IFT_IEEE8023ADLAG . ifconfig(8) has been updated to accept a new laggtype argument when creating lagg(4) network interfaces. This new argument is used to distinguish between ethernet and infiniband type of lagg(4) network interface. The laggtype argument is optional and defaults to ethernet. The lagg(4) command line syntax is backwards compatible. Differential Revision: https://reviews.freebsd.org/D26254 Reviewed by: melifaro@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking
Notes
Notes: svn path=/head/; revision=366933
Diffstat (limited to 'sbin/ifconfig')
-rw-r--r--sbin/ifconfig/ifconfig.88
-rw-r--r--sbin/ifconfig/iflagg.c31
2 files changed, 37 insertions, 2 deletions
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index 2978fbdb5691..da7e3f049a59 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -28,7 +28,7 @@
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
.\" $FreeBSD$
.\"
-.Dd September 17, 2020
+.Dd October 21, 2020
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -2481,6 +2481,12 @@ Set to 0 to disable.
.Pp
The following parameters are specific to lagg interfaces:
.Bl -tag -width indent
+.It Cm laggtype Ar type
+When creating a lagg interface the type can be specified as either
+.Cm ethernet
+or
+.Cm infiniband .
+If not specified ethernet is the default lagg type.
.It Cm laggport Ar interface
Add the interface named by
.Ar interface
diff --git a/sbin/ifconfig/iflagg.c b/sbin/ifconfig/iflagg.c
index a892ffd21eb0..63a5928a5d44 100644
--- a/sbin/ifconfig/iflagg.c
+++ b/sbin/ifconfig/iflagg.c
@@ -30,7 +30,11 @@ static const char rcsid[] =
#include "ifconfig.h"
-char lacpbuf[120]; /* LACP peer '[(a,a,a),(p,p,p)]' */
+static struct iflaggparam params = {
+ .lagg_type = LAGG_TYPE_DEFAULT,
+};
+
+static char lacpbuf[120]; /* LACP peer '[(a,a,a),(p,p,p)]' */
static void
setlaggport(const char *val, int d, int s, const struct afswtch *afp)
@@ -301,7 +305,31 @@ lagg_status(int s)
}
}
+static
+DECL_CMD_FUNC(setlaggtype, arg, d)
+{
+ static const struct lagg_types lt[] = LAGG_TYPES;
+ int i;
+
+ for (i = 0; i < nitems(lt); i++) {
+ if (strcmp(arg, lt[i].lt_name) == 0) {
+ params.lagg_type = lt[i].lt_value;
+ return;
+ }
+ }
+ errx(1, "invalid lagg type: %s", arg);
+}
+
+static void
+lagg_create(int s, struct ifreq *ifr)
+{
+ ifr->ifr_data = (caddr_t) &params;
+ if (ioctl(s, SIOCIFCREATE2, ifr) < 0)
+ err(1, "SIOCIFCREATE2");
+}
+
static struct cmd lagg_cmds[] = {
+ DEF_CLONE_CMD_ARG("laggtype", setlaggtype),
DEF_CMD_ARG("laggport", setlaggport),
DEF_CMD_ARG("-laggport", unsetlaggport),
DEF_CMD_ARG("laggproto", setlaggproto),
@@ -335,4 +363,5 @@ lagg_ctor(void)
for (i = 0; i < nitems(lagg_cmds); i++)
cmd_register(&lagg_cmds[i]);
af_register(&af_lagg);
+ clone_setdefcallback("lagg", lagg_create);
}