From 9060c14ccf1d34deb457e582e3c42628a0b85586 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 8 Jun 2021 18:03:29 +0200 Subject: [PATCH] initrd: support infiniband pkeys Introduce a new "ib.pkey=." command line argument to create a Infiniband partition. The new connection has IPv4 and IPv6 enabled by default. Unlike for VLANs, the generator doesn't create a connection for the parent Infiniband interface. See also: https://github.com/dracutdevs/dracut/pull/1538 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/884 --- man/nm-initrd-generator.xml | 11 ++++ src/nm-initrd-generator/nmi-cmdline-reader.c | 52 +++++++++++++++++++ .../tests/test-cmdline-reader.c | 35 +++++++++++++ 3 files changed, 98 insertions(+) diff --git a/man/nm-initrd-generator.xml b/man/nm-initrd-generator.xml index 2cee98fb5d..5a758357ed 100644 --- a/man/nm-initrd-generator.xml +++ b/man/nm-initrd-generator.xml @@ -142,6 +142,7 @@ + @@ -184,6 +185,16 @@ the command line wins. + + NetworkManager supports the + =PARENT.PKEY + argument to set up an Infiniband partition on IPoIB parent + device PARENT using the specified + partition key PKEY. The partition + key must be in hexadecimal notation without leading "0x", for + example "ib.pkey=ib0.8004". + + diff --git a/src/nm-initrd-generator/nmi-cmdline-reader.c b/src/nm-initrd-generator/nmi-cmdline-reader.c index 3dd257cba7..8cdabbb312 100644 --- a/src/nm-initrd-generator/nmi-cmdline-reader.c +++ b/src/nm-initrd-generator/nmi-cmdline-reader.c @@ -916,6 +916,56 @@ reader_parse_vlan(Reader *reader, char *argument) g_ptr_array_add(reader->vlan_parents, g_strdup(phy)); } +static void +reader_parse_ib_pkey(Reader *reader, char *argument) +{ + NMConnection * connection; + NMSettingInfiniband *s_ib; + char * ifname; + gs_free char * parent = NULL; + char * pkey; + gint64 pkey_int; + + /* At the moment we only support ib.pkey=.; + * in the future we want to possibly support other options: + * ib.pkey=.: