- ccw_init - handle portno option in NM configs and use DRIVER environment variable

Related: RHEL-76751
This commit is contained in:
Dan Horák 2026-06-08 11:50:05 +02:00
parent 5d6190bae4
commit f61cc4b4e3

View File

@ -1,6 +1,7 @@
#! /bin/sh
[ -z "$DEVPATH" ] && exit 0
[ -z "$DRIVER" ] && exit 0
[ "$SUBSYSTEM" != "ccw" ] && exit 0
[ -e /etc/ccw.conf ] && MODE="dracut" || MODE="normal"
@ -78,6 +79,7 @@ elif [ $MODE = "normal" ]; then
NETTYPE=$(sed -nr "/^\[ethernet\]/ { :l /^s390-nettype[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" $CONFIG_FILE)
SUBCHANNELS=$(sed -nr "/^\[ethernet\]/ { :l /^s390-subchannels[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" $CONFIG_FILE | sed -e "s/;/,/g" -e "s/,$//")
LAYER2=$(sed -nr "/^\[ethernet-s390-options\]/ { :l /^layer2[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" $CONFIG_FILE)
PORTNO=$(sed -nr "/^\[ethernet-s390-options\]/ { :l /^portno[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" $CONFIG_FILE)
else
exit 1
fi
@ -115,6 +117,10 @@ if [ "$NETTYPE" = "ctc" -a -n "$CTCPROT" ]; then
OPTIONS="$OPTIONS protocol=$CTCPROT"
fi
if [ -n "$PORTNO" ]; then
OPTIONS="$OPTIONS portno=$PORTNO"
fi
# SUBCHANNELS is only set on mainframe ccwgroup devices
[ -z "$SUBCHANNELS" -o -z "$NETTYPE" ] && exit 0
if [ "$NETTYPE" = "ctc" ]; then
@ -148,8 +154,6 @@ if [ -e $SYSDIR/online ]; then
[ "$on" = "1" ] && exit 0
fi
DRIVER=$(readlink $DEVPATH/driver)
DRIVER=${DRIVER##*/}
if [ "$DRIVER" = "lcs" -a "$NETTYPE" = "ctc" ]; then
echo "$CHANNEL" > /sys/bus/ccw/drivers/lcs/unbind
echo "$CHANNEL" > /sys/bus/ccw/drivers/ctcm/bind