From a9a7b8a1c41209a7f5fb25852571a5e3957bcc25 Mon Sep 17 00:00:00 2001 From: Jeff Henning Date: Wed, 6 Sep 2023 12:52:42 +0000 Subject: [PATCH] Fix eth0 hardware numbering using udev for AS4630-54PE platform. --- .../as4630-54pe/udev/70-persistent-net.rules | 3 +++ .../as4630-54pe/utils/restart_ixgbe.sh | 9 +++++++++ .../broadcom/sonic-platform-modules-accton/debian/rules | 3 +++ .../debian/sonic-platform-accton-as4630-54pe.postinst | 2 ++ 4 files changed, 17 insertions(+) create mode 100644 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/udev/70-persistent-net.rules create mode 100755 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/restart_ixgbe.sh diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/udev/70-persistent-net.rules b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/udev/70-persistent-net.rules new file mode 100644 index 000000000000..438ec0b42a69 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/udev/70-persistent-net.rules @@ -0,0 +1,3 @@ +ACTION=="add", SUBSYSTEM=="net", DRIVERS=="ixgbe", KERNELS=="0000:08:00.0", NAME:="eth0" +ACTION=="add", SUBSYSTEM=="net", DRIVERS=="ixgbe", KERNELS=="0000:06:00.1", NAME:="eth1" +ACTION=="add", SUBSYSTEM=="net", DRIVERS=="ixgbe", KERNELS=="0000:06:00.0", NAME:="eth3" diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/restart_ixgbe.sh b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/restart_ixgbe.sh new file mode 100755 index 000000000000..de38f4ee6004 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/restart_ixgbe.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +/etc/init.d/netfilter-persistent stop +modprobe -r ixgbe +udevadm control --reload-rules +udevadm trigger +modprobe ixgbe +/etc/init.d/netfilter-persistent start + diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/rules b/platform/broadcom/sonic-platform-modules-accton/debian/rules index 8cd7611bb6e3..6d9c78bcb13c 100755 --- a/platform/broadcom/sonic-platform-modules-accton/debian/rules +++ b/platform/broadcom/sonic-platform-modules-accton/debian/rules @@ -25,6 +25,7 @@ MODULE_DIRS += as5835-54x as9716-32d as9726-32d as5835-54t as7312-54xs as7315-27 MODULE_DIR := modules UTILS_DIR := utils SERVICE_DIR := service +UDEV_DIR := udev CONF_DIR := conf %: @@ -69,9 +70,11 @@ binary-indep: dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/local/bin; \ dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} lib/systemd/system; \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} etc/udev/rules.d; \ cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \ cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ + cp $(MOD_SRC_DIR)/$${mod}/$(UDEV_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/etc/udev/rules.d/; \ $(PYTHON3) $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \ done) # Resuming debhelper scripts diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.postinst b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.postinst index 23bebd3b295c..1a87abf9ada5 100644 --- a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.postinst +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.postinst @@ -1,8 +1,10 @@ # Special arrangement to make PDDF mode default # Disable monitor, monitor-fan, monitor-psu (not enabling them would imply they will be disabled by default) # Enable pddf-platform-monitor +# Retrigger eth0-eth2 renumbering depmod -a systemctl enable pddf-platform-init.service systemctl start pddf-platform-init.service systemctl enable as4630-54pe-pddf-platform-monitor.service systemctl start as4630-54pe-pddf-platform-monitor.service +/usr/local/bin/restart_ixgbe.sh