[Mellanox] [202211] Replace iproute2 supplied by SDK to iproute2 downloaded from Debian repository (#14726) (#14724)
- Why I did it Mellanox syncd container will be based on Debian iproute2 plus patches instead of Nvidia internal version of iproute2 - How I did it Download iproute2 from Debian repository, apply patches and compile to create a new target. The target is then deployed in syncd container of Mellanox switches only. The new target is called IPROUTE2_MLNX. - How to verify it Compile and load on switch, verify interfaces network devices created successfully. Verify LLDP shows connections to neighbors. Verify ping between 2 hosts over 2 router ports is successful.
This commit is contained in:
parent
70082d8362
commit
d7d8d7754d
@ -19,7 +19,7 @@
|
||||
DOCKER_SYNCD_PLATFORM_CODE = mlnx
|
||||
include $(PLATFORM_PATH)/../template/docker-syncd-bullseye.mk
|
||||
|
||||
$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) $(MFT)
|
||||
$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) $(MFT) $(IPROUTE2_MLNX)
|
||||
|
||||
ifeq ($(ENABLE_ASAN), y)
|
||||
$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD_DBG)
|
||||
|
10
platform/mellanox/iproute2.dep
Normal file
10
platform/mellanox/iproute2.dep
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
SPATH := $($(IPROUTE2_MLNX)_SRC_PATH)
|
||||
DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_PATH)/iproute2.mk $(PLATFORM_PATH)/iproute2.dep
|
||||
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
|
||||
DEP_FILES += $(shell git ls-files $(SPATH))
|
||||
|
||||
$(IPROUTE2_MLNX)_CACHE_MODE := GIT_CONTENT_SHA
|
||||
$(IPROUTE2_MLNX)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
|
||||
$(IPROUTE2_MLNX)_DEP_FILES := $(DEP_FILES)
|
||||
|
26
platform/mellanox/iproute2.mk
Normal file
26
platform/mellanox/iproute2.mk
Normal file
@ -0,0 +1,26 @@
|
||||
#
|
||||
# Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
# Apache-2.0
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
IPROUTE2_MLNX_VERSION = 5.10.0
|
||||
IPROUTE2_MLNX_VERSION_FULL = $(IPROUTE2_MLNX_VERSION)-4~bpo10+1
|
||||
|
||||
export IPROUTE2_MLNX_VERSION
|
||||
export IPROUTE2_MLNX_VERSION_FULL
|
||||
|
||||
IPROUTE2_MLNX = iproute2-mlnx_$(IPROUTE2_MLNX_VERSION_FULL)_$(CONFIGURED_ARCH).deb
|
||||
$(IPROUTE2_MLNX)_SRC_PATH = $(PLATFORM_PATH)/iproute2
|
||||
SONIC_MAKE_DEBS += $(IPROUTE2_MLNX)
|
46
platform/mellanox/iproute2/Makefile
Normal file
46
platform/mellanox/iproute2/Makefile
Normal file
@ -0,0 +1,46 @@
|
||||
#
|
||||
# Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
# Apache-2.0
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
SHELL = /bin/bash
|
||||
.ONESHELL:
|
||||
.SHELLFLAGS += -e
|
||||
|
||||
MAIN_TARGET = iproute2-mlnx_$(IPROUTE2_MLNX_VERSION_FULL)_$(CONFIGURED_ARCH).deb
|
||||
|
||||
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
|
||||
# Remove any stale files
|
||||
rm -rf iproute2*
|
||||
|
||||
# Download iproute2 from debian repository
|
||||
dget http://deb.debian.org/debian/pool/main/i/iproute2/iproute2_$(IPROUTE2_MLNX_VERSION_FULL).dsc
|
||||
|
||||
pushd iproute2-$(IPROUTE2_MLNX_VERSION)
|
||||
|
||||
# Create git repository to apply patches with stg
|
||||
git init
|
||||
git add -f *
|
||||
git commit -qm "initial commit"
|
||||
|
||||
# Apply Patches
|
||||
stg init
|
||||
stg import -s ../patch/series
|
||||
|
||||
# Build debian
|
||||
dpkg-buildpackage -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR)
|
||||
|
||||
mv ../$(MAIN_TARGET) $(DEST)/
|
||||
popd
|
@ -0,0 +1,54 @@
|
||||
From 28e58b34f1168de182c37eff640180b6064a800d Mon Sep 17 00:00:00 2001
|
||||
From: liora <liora@nvidia.com>
|
||||
Date: Tue, 18 Apr 2023 13:01:16 +0000
|
||||
Subject: [PATCH 1/1] Remove arpd from iproute2 package
|
||||
|
||||
---
|
||||
debian/control | 3 +--
|
||||
debian/iproute2.install | 1 -
|
||||
misc/Makefile | 4 ----
|
||||
3 files changed, 1 insertion(+), 7 deletions(-)
|
||||
|
||||
diff --git a/debian/control b/debian/control
|
||||
index b5e8b0a..e735c26 100644
|
||||
--- a/debian/control
|
||||
+++ b/debian/control
|
||||
@@ -28,8 +28,7 @@ Build-Depends: bison,
|
||||
Package: iproute2
|
||||
Priority: important
|
||||
Architecture: linux-any
|
||||
-Provides: arpd
|
||||
-Conflicts: arpd, iproute (<< 20130000-1)
|
||||
+Conflicts: iproute (<< 20130000-1)
|
||||
Replaces: iproute
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}, libcap2-bin,
|
||||
Recommends: ${ipmods:Recommends}
|
||||
diff --git a/debian/iproute2.install b/debian/iproute2.install
|
||||
index f9e8c26..fba201d 100644
|
||||
--- a/debian/iproute2.install
|
||||
+++ b/debian/iproute2.install
|
||||
@@ -1,6 +1,5 @@
|
||||
etc/
|
||||
usr/include/iproute2/
|
||||
-sbin/arpd /usr/sbin
|
||||
sbin/bridge
|
||||
sbin/devlink
|
||||
sbin/genl /usr/sbin
|
||||
diff --git a/misc/Makefile b/misc/Makefile
|
||||
index 50dae79..1f3898f 100644
|
||||
--- a/misc/Makefile
|
||||
+++ b/misc/Makefile
|
||||
@@ -6,10 +6,6 @@ TARGETS=ss nstat ifstat rtacct lnstat
|
||||
|
||||
include ../config.mk
|
||||
|
||||
-ifeq ($(HAVE_BERKELEY_DB),y)
|
||||
- TARGETS += arpd
|
||||
-endif
|
||||
-
|
||||
all: $(TARGETS)
|
||||
|
||||
ss: $(SSOBJ)
|
||||
--
|
||||
2.30.2
|
||||
|
@ -0,0 +1,50 @@
|
||||
From 6676c4a200df54a06c96faa9a30baaefc61a91b5 Mon Sep 17 00:00:00 2001
|
||||
From: liora <liora@nvidia.com>
|
||||
Date: Thu, 27 Apr 2023 03:34:10 +0000
|
||||
Subject: [PATCH 1/1] Rename iproute2 debian package
|
||||
|
||||
---
|
||||
debian/control | 4 ++--
|
||||
debian/{iproute2.install => iproute2-mlnx.install} | 0
|
||||
debian/rules | 2 +-
|
||||
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||
rename debian/{iproute2.install => iproute2-mlnx.install} (100%)
|
||||
|
||||
diff --git a/debian/control b/debian/control
|
||||
index e735c26..4b03a6f 100644
|
||||
--- a/debian/control
|
||||
+++ b/debian/control
|
||||
@@ -25,11 +25,11 @@ Build-Depends: bison,
|
||||
po-debconf,
|
||||
zlib1g-dev,
|
||||
|
||||
-Package: iproute2
|
||||
+Package: iproute2-mlnx
|
||||
Priority: important
|
||||
Architecture: linux-any
|
||||
Conflicts: iproute (<< 20130000-1)
|
||||
-Replaces: iproute
|
||||
+Replaces: iproute, iproute2
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}, libcap2-bin,
|
||||
Recommends: ${ipmods:Recommends}
|
||||
Suggests: iproute2-doc
|
||||
diff --git a/debian/iproute2.install b/debian/iproute2-mlnx.install
|
||||
similarity index 100%
|
||||
rename from debian/iproute2.install
|
||||
rename to debian/iproute2-mlnx.install
|
||||
diff --git a/debian/rules b/debian/rules
|
||||
index d940d3c..8bd4f84 100755
|
||||
--- a/debian/rules
|
||||
+++ b/debian/rules
|
||||
@@ -34,7 +34,7 @@ override_dh_clean:
|
||||
|
||||
override_dh_shlibdeps:
|
||||
dh_shlibdeps -a -Xq_atm.so -Xm_xt.so -Xm_ipt.so
|
||||
- dh_shlibdeps -a -- -pipmods -dRecommends -e debian/iproute2/usr/lib/tc/m_xt.so -e debian/iproute2/usr/lib/tc/q_atm.so -xlibc6
|
||||
+ dh_shlibdeps -a -- -pipmods -dRecommends -e debian/iproute2-mlnx/usr/lib/tc/m_xt.so -e debian/iproute2-mlnx/usr/lib/tc/q_atm.so -xlibc6
|
||||
|
||||
override_dh_auto_test:
|
||||
# upstream test suite needs root and leaves machine unclean, skip it
|
||||
--
|
||||
2.30.2
|
||||
|
@ -0,0 +1,19 @@
|
||||
From e10409ea82c16c0e48316a0b4d71a0f649f92a54 Mon Sep 17 00:00:00 2001
|
||||
From: liora <liora@nvidia.com>
|
||||
Date: Mon, 17 Apr 2023 05:17:27 +0000
|
||||
Subject: [PATCH 1/1] Fix version identifier
|
||||
|
||||
---
|
||||
include/version.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/version.h b/include/version.h
|
||||
index 89d0597..cf7afbb 100644
|
||||
--- a/include/version.h
|
||||
+++ b/include/version.h
|
||||
@@ -1 +1 @@
|
||||
-static const char version[] = "5.9.0";
|
||||
+static const char version[] = "5.10.0";
|
||||
--
|
||||
2.30.2
|
||||
|
@ -0,0 +1,303 @@
|
||||
Subject: Added sx_netdev and sx_bridge support to iproute2
|
||||
|
||||
---
|
||||
Makefile | 3 +-
|
||||
include/version.h | 2 +-
|
||||
ip/Makefile | 2 +
|
||||
ip/iplink.c | 1 +
|
||||
ip/iplink_sx_bridge.c | 99 +++++++++++++++++++++++++++++++++
|
||||
ip/iplink_sxnet.c | 123 +++++++++++++++++++++++++++++++++++++++++
|
||||
6 files changed, 228 insertions(+), 2 deletions(-)
|
||||
create mode 100644 ip/iplink_sx_bridge.c
|
||||
create mode 100644 ip/iplink_sxnet.c
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 5b040415..e3c38a90 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -51,6 +51,7 @@ DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
|
||||
CCOPTS = -O2 -pipe
|
||||
WFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes
|
||||
WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2
|
||||
+WFLAGS += -Werror
|
||||
|
||||
CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS)
|
||||
YACCFLAGS = -d -t -v
|
||||
@@ -89,7 +90,7 @@ install: all
|
||||
install -m 0755 -d $(DESTDIR)$(ARPDDIR)
|
||||
install -m 0755 -d $(DESTDIR)$(HDRDIR)
|
||||
@for i in $(SUBDIRS); do $(MAKE) -C $$i install; done
|
||||
- install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONFDIR)
|
||||
+ install -m 0644 $(shell find -L etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONFDIR)
|
||||
install -m 0755 -d $(DESTDIR)$(BASH_COMPDIR)
|
||||
install -m 0644 bash-completion/tc $(DESTDIR)$(BASH_COMPDIR)
|
||||
install -m 0644 bash-completion/devlink $(DESTDIR)$(BASH_COMPDIR)
|
||||
diff --git a/include/version.h b/include/version.h
|
||||
index cf7afbbf..964c230e 100644
|
||||
--- a/include/version.h
|
||||
+++ b/include/version.h
|
||||
@@ -1 +1 @@
|
||||
-static const char version[] = "5.10.0";
|
||||
+static const char version[] = "5.10.0-sx-netdev";
|
||||
diff --git a/ip/Makefile b/ip/Makefile
|
||||
index 4cad619c..46173c3a 100644
|
||||
--- a/ip/Makefile
|
||||
+++ b/ip/Makefile
|
||||
@@ -13,6 +13,8 @@ IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \
|
||||
ipvrf.o iplink_xstats.o ipseg6.o iplink_netdevsim.o iplink_rmnet.o \
|
||||
ipnexthop.o ipmptcp.o iplink_bareudp.o
|
||||
|
||||
+IPOBJ+=iplink_sxnet.o iplink_sx_bridge.o
|
||||
+
|
||||
RTMONOBJ=rtmon.o
|
||||
|
||||
include ../config.mk
|
||||
diff --git a/ip/iplink.c b/ip/iplink.c
|
||||
index d6b766de..5d8199ec 100644
|
||||
--- a/ip/iplink.c
|
||||
+++ b/ip/iplink.c
|
||||
@@ -126,6 +126,7 @@ void iplink_usage(void)
|
||||
" gre | gretap | erspan | ip6gre | ip6gretap | ip6erspan |\n"
|
||||
" vti | nlmon | team_slave | bond_slave | bridge_slave |\n"
|
||||
" ipvlan | ipvtap | geneve | bareudp | vrf | macsec | netdevsim | rmnet |\n"
|
||||
+ " sx_netdev | sx_bridge | \n"
|
||||
" xfrm }\n");
|
||||
}
|
||||
exit(-1);
|
||||
diff --git a/ip/iplink_sx_bridge.c b/ip/iplink_sx_bridge.c
|
||||
new file mode 100644
|
||||
index 00000000..1750f78a
|
||||
--- /dev/null
|
||||
+++ b/ip/iplink_sx_bridge.c
|
||||
@@ -0,0 +1,99 @@
|
||||
+/*
|
||||
+ * iplink_sx_bridge.c Mellanox switch netdev device support
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License
|
||||
+ * as published by the Free Software Foundation; either version
|
||||
+ * 2 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * Authors: Tamar Warshai <tamard@mellanox.com>
|
||||
+ */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <sys/socket.h>
|
||||
+#include <linux/if_link.h>
|
||||
+
|
||||
+#include "rt_names.h"
|
||||
+#include "utils.h"
|
||||
+#include "ip_common.h"
|
||||
+
|
||||
+/* ip link add [dev_name] type sx_bridge id [bridge_id]*/
|
||||
+enum {
|
||||
+ IFLA_SX_BRIDGE_UNSPEC,
|
||||
+ IFLA_SX_BRIDGE_ID,
|
||||
+ __IFLA_SX_BRIDGE_MAX
|
||||
+};
|
||||
+#define IFLA_SX_BRIDGE_MAX (__IFLA_SX_BRIDGE_MAX - 1)
|
||||
+
|
||||
+
|
||||
+static void print_explain(FILE *f)
|
||||
+{
|
||||
+ fprintf(f, "Usage: ... sx_bridge id BRIDGE\n");
|
||||
+ fprintf(f, "\n");
|
||||
+ fprintf(f, "Where: BRIDGE := Bridge ID\n");
|
||||
+}
|
||||
+
|
||||
+static void explain(void)
|
||||
+{
|
||||
+ print_explain(stderr);
|
||||
+}
|
||||
+
|
||||
+static int sx_bridge_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||
+ struct nlmsghdr *n)
|
||||
+{
|
||||
+ int bridge_set = 0;
|
||||
+ __u16 bridge = 0;
|
||||
+
|
||||
+ while (argc > 0) {
|
||||
+ if (!matches(*argv, "id")) {
|
||||
+ NEXT_ARG();
|
||||
+ if (get_u16(&bridge, *argv, 0))
|
||||
+ invarg("invalid id", *argv);
|
||||
+ bridge_set = 1;
|
||||
+ } else {
|
||||
+ fprintf(stderr, "sx_bridge: unknown command \"%s\"?\n", *argv);
|
||||
+ explain();
|
||||
+ return -1;
|
||||
+ }
|
||||
+ argc--, argv++;
|
||||
+ }
|
||||
+
|
||||
+ if (!bridge_set) {
|
||||
+ fprintf(stderr, "sx_bridge: missing virtual network identifier\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ addattr16(n, 1024, IFLA_SX_BRIDGE_ID, bridge);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void sx_bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
||||
+{
|
||||
+ __u16 i;
|
||||
+
|
||||
+ if (!tb)
|
||||
+ return;
|
||||
+
|
||||
+ if (tb[IFLA_SX_BRIDGE_ID] && (RTA_PAYLOAD(tb[IFLA_SX_BRIDGE_ID]) < sizeof(__u16))) {
|
||||
+ i = rta_getattr_u16(tb[IFLA_SX_BRIDGE_ID]);
|
||||
+ fprintf(f, "id %u ", i);
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static void sx_bridge_print_help(struct link_util *lu, int argc, char **argv,
|
||||
+ FILE *f)
|
||||
+{
|
||||
+ print_explain(f);
|
||||
+}
|
||||
+
|
||||
+struct link_util sx_bridge_link_util = {
|
||||
+ .id = "sx_bridge",
|
||||
+ .maxattr = IFLA_SX_BRIDGE_MAX,
|
||||
+ .parse_opt = sx_bridge_parse_opt,
|
||||
+ .print_opt = sx_bridge_print_opt,
|
||||
+ .print_help = sx_bridge_print_help,
|
||||
+};
|
||||
diff --git a/ip/iplink_sxnet.c b/ip/iplink_sxnet.c
|
||||
new file mode 100644
|
||||
index 00000000..59ed0a17
|
||||
--- /dev/null
|
||||
+++ b/ip/iplink_sxnet.c
|
||||
@@ -0,0 +1,123 @@
|
||||
+/*
|
||||
+ * iplink_sxnet.c Mellanox switch netdev device support
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License
|
||||
+ * as published by the Free Software Foundation; either version
|
||||
+ * 2 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * Authors: Elad Raz <eladr@mellanox.com>
|
||||
+ */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <sys/socket.h>
|
||||
+#include <linux/if_link.h>
|
||||
+
|
||||
+#include "rt_names.h"
|
||||
+#include "utils.h"
|
||||
+#include "ip_common.h"
|
||||
+
|
||||
+/* ip link add eth_p1 type sx_netdev swid 0 port 0x10001*/
|
||||
+enum {
|
||||
+ IFLA_SX_NETDEV_UNSPEC,
|
||||
+ IFLA_SX_NETDEV_SWID,
|
||||
+ IFLA_SX_NETDEV_PORT,
|
||||
+ __IFLA_SX_NETDEV_MAX
|
||||
+};
|
||||
+#define IFLA_SX_NETDEV_MAX (__IFLA_SX_NETDEV_MAX - 1)
|
||||
+
|
||||
+
|
||||
+static void print_explain(FILE *f)
|
||||
+{
|
||||
+ fprintf(f, "Usage: ... sx_netdev [ swid SWID ] port PORT\n");
|
||||
+ fprintf(f, "\n");
|
||||
+ fprintf(f, "Where: SWID := 0-8\n");
|
||||
+ fprintf(f, " PORT := Logical port number\n");
|
||||
+}
|
||||
+
|
||||
+static void explain(void)
|
||||
+{
|
||||
+ print_explain(stderr);
|
||||
+}
|
||||
+
|
||||
+static int sx_netdev_parse_opt(struct link_util *lu, int argc, char **argv, struct nlmsghdr *n)
|
||||
+{
|
||||
+ __u32 swid = 0;
|
||||
+ __u32 port = 0;
|
||||
+ int port_set = 0;
|
||||
+
|
||||
+ while (argc > 0) {
|
||||
+ if (!matches(*argv, "swid")) {
|
||||
+ NEXT_ARG();
|
||||
+ if (get_u32(&swid, *argv, 0) ||
|
||||
+ (swid >= 8)) {
|
||||
+ invarg("invalid swid", *argv);
|
||||
+ }
|
||||
+ } else if (!matches(*argv, "port")) {
|
||||
+ NEXT_ARG();
|
||||
+ if (get_u32(&port, *argv, 0)) {
|
||||
+ invarg("invalid port", *argv);
|
||||
+ }
|
||||
+ port_set = 1;
|
||||
+ } else if (!matches(*argv, "type")) {
|
||||
+ NEXT_ARG();
|
||||
+ if (strcasecmp(*argv, "l2") == 0 || strcasecmp(*argv, "l3") == 0) {
|
||||
+ printf("sx_netdev: port type \"%s\" is obsolete\n", *argv);
|
||||
+ } else {
|
||||
+ invarg("invalid type", *argv);
|
||||
+ }
|
||||
+ } else {
|
||||
+ fprintf(stderr, "sx_netdev: unknown command \"%s\"?\n", *argv);
|
||||
+ explain();
|
||||
+ return -1;
|
||||
+ }
|
||||
+ argc--, argv++;
|
||||
+ }
|
||||
+
|
||||
+ if (!port_set) {
|
||||
+ fprintf(stderr, "sx_netdev: missing virtual network identifier\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ addattr32(n, 1024, IFLA_SX_NETDEV_SWID, swid);
|
||||
+
|
||||
+ if (port_set) {
|
||||
+ addattr32(n, 1024, IFLA_SX_NETDEV_PORT, port);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void sx_netdev_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
||||
+{
|
||||
+ __u32 i;
|
||||
+
|
||||
+ if (!tb) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (tb[IFLA_SX_NETDEV_SWID] && (RTA_PAYLOAD(tb[IFLA_SX_NETDEV_SWID]) < sizeof(__u32))) {
|
||||
+ i = rta_getattr_u32(tb[IFLA_SX_NETDEV_SWID]);
|
||||
+ fprintf(f, "swid %u ", i);
|
||||
+ }
|
||||
+
|
||||
+ if (tb[IFLA_SX_NETDEV_PORT] && (RTA_PAYLOAD(tb[IFLA_SX_NETDEV_PORT]) < sizeof(__u32))) {
|
||||
+ i = rta_getattr_u32(tb[IFLA_SX_NETDEV_PORT]);
|
||||
+ fprintf(f, "port %X ", i);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void sx_netdev_print_help(struct link_util *lu, int argc, char **argv, FILE *f)
|
||||
+{
|
||||
+ print_explain(f);
|
||||
+}
|
||||
+
|
||||
+struct link_util sx_netdev_link_util = {
|
||||
+ .id = "sx_netdev",
|
||||
+ .maxattr = IFLA_SX_NETDEV_MAX,
|
||||
+ .parse_opt = sx_netdev_parse_opt,
|
||||
+ .print_opt = sx_netdev_print_opt,
|
||||
+ .print_help = sx_netdev_print_help,
|
||||
+};
|
||||
--
|
||||
2.8.4
|
||||
|
5
platform/mellanox/iproute2/patch/series
Normal file
5
platform/mellanox/iproute2/patch/series
Normal file
@ -0,0 +1,5 @@
|
||||
0001-Remove-arpd-from-iproute2-package.patch
|
||||
0002-Rename-iproute2-debian-package.patch
|
||||
0003-Fix-version-identifier.patch
|
||||
0004-Added-sx_netdev-and-sx_bridge-support-to-iproute2.patch
|
||||
|
@ -29,6 +29,7 @@ include $(PLATFORM_PATH)/mlnx-ffb.mk
|
||||
include $(PLATFORM_PATH)/issu-version.mk
|
||||
include $(PLATFORM_PATH)/mlnx-onie-fw-update.mk
|
||||
include $(PLATFORM_PATH)/mlnx-ssd-fw-update.mk
|
||||
include $(PLATFORM_PATH)/iproute2.mk
|
||||
include $(PLATFORM_PATH)/install-pending-fw.mk
|
||||
|
||||
SONIC_ALL += $(SONIC_ONE_IMAGE) \
|
||||
|
@ -1,27 +0,0 @@
|
||||
.ONESHELL:
|
||||
SHELL = /bin/bash
|
||||
|
||||
MAIN_TARGET = iproute2_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb
|
||||
DERIVED_TARGETS = iproute2-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb iproute2-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb
|
||||
PACKAGE_NAME = iproute2-3.19.0
|
||||
|
||||
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
|
||||
# get sources
|
||||
rm -rf $(PACKAGE_NAME)-$(MLNX_SDK_VERSION)-$(MLNX_SDK_ISSU_VERSION)
|
||||
|
||||
wget -c $(MLNX_SDK_SOURCE_BASE_URL)/$(PACKAGE_NAME)-$(MLNX_SDK_VERSION)-$(MLNX_SDK_ISSU_VERSION).tar.gz -O - | tar -xz
|
||||
|
||||
# build
|
||||
pushd $(PACKAGE_NAME)-$(MLNX_SDK_VERSION)-$(MLNX_SDK_ISSU_VERSION)
|
||||
|
||||
if [ -f autogen.sh ]; then
|
||||
./autogen.sh
|
||||
fi
|
||||
|
||||
debuild -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS)
|
||||
|
||||
popd
|
||||
|
||||
mv $(DERIVED_TARGETS) $* $(DEST)/
|
||||
|
||||
$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)
|
@ -31,27 +31,6 @@ $(APPLIBS_DBGSYM)_DEP_FLAGS := $(MLNX_SDK_COMMON_FLAGS_LIST)
|
||||
$(APPLIBS_DBGSYM)_DEP_FILES := $(DEP_FILES)
|
||||
endif
|
||||
|
||||
# IPROUTE2_MLNX
|
||||
|
||||
SPATH := $($(IPROUTE2_MLNX)_SRC_PATH)
|
||||
DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_PATH)/sdk.mk $(PLATFORM_PATH)/sdk.dep
|
||||
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
|
||||
DEP_FILES += $(shell git ls-files -- $(SPATH))
|
||||
|
||||
$(IPROUTE2_MLNX)_CACHE_MODE := GIT_CONTENT_SHA
|
||||
$(IPROUTE2_MLNX)_DEP_FLAGS := $(MLNX_SDK_COMMON_FLAGS_LIST)
|
||||
$(IPROUTE2_MLNX)_DEP_FILES := $(DEP_FILES)
|
||||
|
||||
$(IPROUTE2_MLNX_DEV)_CACHE_MODE := GIT_CONTENT_SHA
|
||||
$(IPROUTE2_MLNX_DEV)_DEP_FLAGS := $(MLNX_SDK_COMMON_FLAGS_LIST)
|
||||
$(IPROUTE2_MLNX_DEV)_DEP_FILES := $(DEP_FILES)
|
||||
|
||||
ifeq ($(SDK_FROM_SRC),y)
|
||||
$(IPROUTE2_MLNX_DBGSYM)_CACHE_MODE := GIT_CONTENT_SHA
|
||||
$(IPROUTE2_MLNX_DBGSYM)_DEP_FLAGS := $(MLNX_SDK_COMMON_FLAGS_LIST)
|
||||
$(IPROUTE2_MLNX_DBGSYM)_DEP_FILES := $(DEP_FILES)
|
||||
endif
|
||||
|
||||
# SX_COMPLIB
|
||||
|
||||
SPATH := $($(SX_COMPLIB)_SRC_PATH)
|
||||
|
@ -33,16 +33,16 @@ endif
|
||||
|
||||
export MLNX_SDK_SOURCE_BASE_URL MLNX_SDK_VERSION MLNX_SDK_ISSU_VERSION MLNX_SDK_DEB_VERSION MLNX_ASSETS_GITHUB_URL
|
||||
|
||||
MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_COMPLIB) $(SX_EXAMPLES) \
|
||||
MLNX_SDK_RDEBS += $(APPLIBS) $(SX_COMPLIB) $(SX_EXAMPLES) \
|
||||
$(SX_GEN_UTILS) $(SX_SCEW) $(SXD_LIBS) $(WJH_LIBS) $(SX_ACL_HELPER) \
|
||||
$(SX_HASH_CALC)
|
||||
|
||||
MLNX_SDK_DEBS += $(APPLIBS_DEV) $(IPROUTE2_MLNX_DEV) $(SX_COMPLIB_DEV) \
|
||||
MLNX_SDK_DEBS += $(APPLIBS_DEV) $(SX_COMPLIB_DEV) \
|
||||
$(SX_COMPLIB_DEV_STATIC) $(SX_EXAMPLES_DEV) $(SX_GEN_UTILS_DEV) \
|
||||
$(SX_SCEW_DEV) $(SX_SCEW_DEV_STATIC) $(SXD_LIBS_DEV)\
|
||||
$(SXD_LIBS_DEV_STATIC) $(WJH_LIBS_DEV) $(SX_ACL_HELPER_DEV) $(SX_HASH_CALC)
|
||||
|
||||
MLNX_SDK_DBG_DEBS += $(APPLIBS_DBGSYM) $(IPROUTE2_MLNX_DBGSYM) $(SX_COMPLIB_DBGSYM) \
|
||||
MLNX_SDK_DBG_DEBS += $(APPLIBS_DBGSYM) $(SX_COMPLIB_DBGSYM) \
|
||||
$(SX_EXAMPLES_DBGSYM) $(SX_GEN_UTILS_DBGSYM) $(SX_SCEW_DBGSYM) \
|
||||
$(SXD_LIBS_DBGSYM) $(WJH_LIBS_DBGSYM) $(SX_ACL_HELPER_DBGSYM) \
|
||||
$(SX_HASH_CALC_DBGSYM)
|
||||
@ -58,15 +58,6 @@ ifeq ($(SDK_FROM_SRC),y)
|
||||
$(eval $(call add_derived_package,$(APPLIBS),$(APPLIBS_DBGSYM)))
|
||||
endif
|
||||
|
||||
IPROUTE2_MLNX = iproute2_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb
|
||||
$(IPROUTE2_MLNX)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/iproute2
|
||||
IPROUTE2_MLNX_DEV = iproute2-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb
|
||||
$(eval $(call add_derived_package,$(IPROUTE2_MLNX),$(IPROUTE2_MLNX_DEV)))
|
||||
IPROUTE2_MLNX_DBGSYM = iproute2-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb
|
||||
ifeq ($(SDK_FROM_SRC),y)
|
||||
$(eval $(call add_derived_package,$(IPROUTE2_MLNX),$(IPROUTE2_MLNX_DBGSYM)))
|
||||
endif
|
||||
|
||||
SX_COMPLIB = sx-complib_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb
|
||||
$(SX_COMPLIB)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/sx-complib
|
||||
SX_COMPLIB_DEV = sx-complib-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb
|
||||
|
@ -196,6 +196,7 @@ RUN apt-get update && apt-get install -y \
|
||||
libdb-dev \
|
||||
libiptc-dev \
|
||||
libxtables-dev \
|
||||
libbpf-dev \
|
||||
# For mellanox sai build
|
||||
libtool-bin \
|
||||
libxml2-dev \
|
||||
|
Loading…
Reference in New Issue
Block a user