Skip to content

Commit

Permalink
[Mellanox] [202211] Replace iproute2 supplied by SDK to iproute2 down…
Browse files Browse the repository at this point in the history
…loaded from Debian repository (sonic-net#14726) (sonic-net#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.
  • Loading branch information
liorghub authored May 2, 2023
1 parent 70082d8 commit d7d8d77
Show file tree
Hide file tree
Showing 14 changed files with 519 additions and 61 deletions.
2 changes: 1 addition & 1 deletion platform/mellanox/docker-syncd-mlnx.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions platform/mellanox/iproute2.dep
Original file line number Diff line number Diff line change
@@ -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 changes: 26 additions & 0 deletions platform/mellanox/iproute2.mk
Original file line number Diff line number Diff line change
@@ -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 changes: 46 additions & 0 deletions platform/mellanox/iproute2/Makefile
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
@@ -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

19 changes: 19 additions & 0 deletions platform/mellanox/iproute2/patch/0003-Fix-version-identifier.patch
Original file line number Diff line number Diff line change
@@ -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

Loading

0 comments on commit d7d8d77

Please sign in to comment.