Skip to content

Commit

Permalink
udev scripts: Support network interfaces rename on DPU only
Browse files Browse the repository at this point in the history
Avoid renaming network interfaces unless operating on a BlueField DPU.

Signed-off-by: Vladimir Sokolovsky <[email protected]>
  • Loading branch information
vladsokolovsky committed Mar 8, 2024
1 parent f625b89 commit d7adfdf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
7 changes: 7 additions & 0 deletions udev/scripts/auxdev-sf-netdev-rename
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
SFNUM=$1
IFINDEX=$2

PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin

is_bf=`lspci -s 00:00.0 2> /dev/null | grep -wq "PCI bridge: Mellanox Technologies" && echo 1 || echo 0`
if [ $is_bf -ne 1 ]; then
exit 0
fi

for sf_ndev in `ls /sys/class/net/`; do
_ifindex=`cat /sys/class/net/$sf_ndev/ifindex | head -1 2>/dev/null`
if [ "$_ifindex" = "$IFINDEX" ]
Expand Down
7 changes: 7 additions & 0 deletions udev/scripts/sf-rep-netdev-rename
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
PORT_NAME=$1
IFINDEX=$2

PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin

is_bf=`lspci -s 00:00.0 2> /dev/null | grep -wq "PCI bridge: Mellanox Technologies" && echo 1 || echo 0`
if [ $is_bf -ne 1 ]; then
exit 0
fi

for rep_ndev in `ls /sys/class/net/`; do
_ifindex=`cat /sys/class/net/$rep_ndev/ifindex | head -1 2>/dev/null`
if [ "$_ifindex" = "$IFINDEX" ]
Expand Down
8 changes: 6 additions & 2 deletions udev/scripts/vf-net-link-name.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ PORT_NAME=`echo ${1} | sed -e "s/c[[:digit:]]\+//"`
IFINDEX=$3

# need the PATH for BF ARM lspci to work
PATH=/bin:/sbin:/usr/bin:/usr/sbin
PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin

is_bf=`lspci -s 00:00.0 2> /dev/null | grep -wq "PCI bridge: Mellanox Technologies" && echo 1 || echo 0`
if [ $is_bf -ne 1 ]; then
exit 0
fi

if [[ "$ID_NET_DRIVER" != *"mlx5"* ]]; then
exit 1
Expand Down Expand Up @@ -46,7 +51,6 @@ function get_mh_bf_rep_name() {
done
}

is_bf=`lspci -s 00:00.0 2> /dev/null | grep -wq "PCI bridge: Mellanox Technologies" && echo 1 || echo 0`
if [ $is_bf -eq 1 ]; then
num_of_pf=`lspci 2> /dev/null | grep -w "network" | wc -l`
if [ $num_of_pf -gt 2 ]; then
Expand Down

0 comments on commit d7adfdf

Please sign in to comment.