Support the single driver switch

In order to select between the in-tree and OOT drivers for the single
driver, a cmdline parameter ice, i40e and iavf need be used. If
cmdline parameter [ice, i40e, iavf] is set to OOT, the OOT driver
[ice, i40e, iavf] will be loaded by "insmod" command before udevd
is started, and that ensures that the OOT drivers will be loaded
rather than the in-tree drivers.

The default drivers will be the in-tree drivers if there is not
multi-drivers-switch, ice, iavf and i40e in the cmdline parameters
or they are not set correct.

Note: multi-drivers-switch will have high priority than the single
driver parameter.  For example, if multi-drivers-switch is set to
cvl-4.0.1, even if ice=in-tree, the drivers will be switch to the
OOT bundle cvl-4.0.1.

The bundle drivers switch:
1. switch to the OOT bundle(ice, iavf and i40e all will be switch to
the OOT driver).
  multi-drivers-switch=cvl-4.0.1
2. switch to the single driver.
multi-drivers-switch must not be set to cvl-4.0.1,or the OOT bundle
will be loaded.
1) ice
   * switch the ice driver to the OOT version
      ice=OOT
      multi-drivers-switch=xxx(any value except cvl-4.0.1) or delete
      multi-drivers-switch boot arg.
   * switch the ice driver to the in-tree version
      ice=in-tree
      multi-drivers-switch=xxx(any value except cvl-4.0.1) or delete
      multi-drivers-switch boot arg.
2) i40e
   * switch the i40e driver to the OOT version
      i40e=OOT
      multi-drivers-switch=xxx(any value except cvl-4.0.1) or delete
      multi-drivers-switch boot arg.
   * switch the i40e driver to the in-tree version
      i40e=in-tree
      multi-drivers-switch=xxx(any value except cvl-4.0.1) or delete
      multi-drivers-switch boot arg.
3) iavf
   * switch the iavf driver to the OOT version
      iavf=OOT
      multi-drivers-switch=xxx(any value except cvl-4.0.1) or delete
      multi-drivers-switch boot arg.
   * switch the iavf driver to the in-tree version
      iavf=in-tree
      multi-drivers-switch=xxx(any value except cvl-4.0.1) or delete
      multi-drivers-switch boot arg.
3. switch to the in-tree bundle(ice, iavf, i40e are all the in-tree
   drivers).
      multi-drivers-switch is not set cvl-4.0.1, ice is not set OOT,
      iavf is not set OOT, i40e is not set OOT.

Story: 2011056
Task: 50000

Change-Id: I927b0754d132796141caa2036bf626da527068ee
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
This commit is contained in:
Jiping Ma 2024-04-29 22:43:36 -04:00
parent 8bac1a85a8
commit 73a51b94ec
2 changed files with 191 additions and 0 deletions

View File

@ -0,0 +1,190 @@
From 5b7aeae688aa99057e6eea3365756c2ecbe876cd Mon Sep 17 00:00:00 2001
From: Jiping Ma <jiping.ma2@windriver.com>
Date: Thu, 25 Apr 2024 23:05:07 -0700
Subject: [PATCH] Support the single driver switch
In order to select between the in-tree and OOT drivers for the single
driver, a cmdline parameter ice, i40e and iavf need be used. If
cmdline parameter [ice, i40e, iavf] is set to OOT, the OOT driver
[ice, i40e, iavf] will be loaded by "insmod" command before udevd
is started, and that ensures that the OOT drivers will be loaded
rather than the in-tree drivers.
The default drivers will be the in-tree drivers if there is not
multi-drivers-switch, ice, iavf and i40e in the cmdline parameters
or they are not set correct.
Note: multi-drivers-switch will have high priority than the single
driver parameter. For example, if multi-drivers-switch is set to
cvl-4.0.1, even if ice=in-tree, the drivers will be switch to the
OOT bundle cvl-4.0.1.
The bundle drivers switch:
1. switch to the OOT bundle(ice, iavf and i40e all will be switch to
the OOT driver).
multi-drivers-switch=cvl-4.0.1
2. switch to the single driver.
multi-drivers-switch must not be set to cvl-4.0.1or the OOT bundle
will be loaded.
1) ice
* switch the ice driver to the OOT version
ice=OOT
multi-drivers-switch=xxx(any value except cvl-4.0.1) or delete
multi-drivers-switch boot arg.
* switch the ice driver to the in-tree version
ice=in-tree
multi-drivers-switch=xxx(any value except cvl-4.0.1) or delete
multi-drivers-switch boot arg.
2) i40e
* switch the i40e driver to the OOT version
i40e=OOT
multi-drivers-switch=xxx(any value except cvl-4.0.1) or delete
multi-drivers-switch boot arg.
* switch the i40e driver to the in-tree version
i40e=in-tree
multi-drivers-switch=xxx(any value except cvl-4.0.1) or delete
multi-drivers-switch boot arg.
3) iavf
* switch the iavf driver to the OOT version
iavf=OOT
multi-drivers-switch=xxx(any value except cvl-4.0.1) or delete
multi-drivers-switch boot arg.
* switch the iavf driver to the in-tree version
iavf=in-tree
multi-drivers-switch=xxx(any value except cvl-4.0.1) or delete
multi-drivers-switch boot arg.
3. switch to the in-tree bundle(ice, iavf, i40e are all the in-tree
drivers).
multi-drivers-switch is not set cvl-4.0.1, ice is not set OOT,
iavf is not set OOT, i40e is not set OOT.
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
---
init-ostree-install.sh | 32 ++++++++++++++++++++++++++++++--
init-ostree.sh | 31 +++++++++++++++++++++++++++++--
2 files changed, 59 insertions(+), 4 deletions(-)
diff --git a/init-ostree-install.sh b/init-ostree-install.sh
index c9172de..66dfa26 100644
--- a/init-ostree-install.sh
+++ b/init-ostree-install.sh
@@ -476,6 +476,28 @@ do_mount_fs() {
[[ -e /proc/mounts ]] && { grep -q -e "^$1 $2 $1" /proc/mounts && { log_info "$2 ($1) already mounted"; return 0; } }
mount -t "$1" "$1" "$2" || fatal "Error mounting $2"
}
+
+multi_drivers_switch() {
+ if grep -s -q '\si40e=' /proc/cmdline ; then
+ if [ ${I40E_VERSION} == "OOT" ]; then
+ insmod /lib/modules/"$(uname -r)"/weak-updates/i40e-*/i40e.ko
+ echo "OOT i40e driver have been activated"
+ fi
+ fi
+ if grep -s -q '\sice=' /proc/cmdline ; then
+ if [ ${ICE_VERSION} == "OOT" ]; then
+ insmod /lib/modules/"$(uname -r)"/weak-updates/ice-*/ice.ko
+ echo "OOT ice driver have been activated"
+ fi
+ fi
+ if grep -s -q '\siavf=' /proc/cmdline ; then
+ if [ ${IAVF_VERSION} == "OOT" ]; then
+ insmod /lib/modules/"$(uname -r)"/weak-updates/iavf-*/iavf.ko
+ echo "OOT iavf driver have been activated"
+ fi
+ fi
+}
+
network_modules() {
if grep -s -q '\smulti-drivers-switch=' /proc/cmdline ; then
if [ -d /lib/modules/"$(uname -r)"/weak-updates/ice-"${DRIVER_VERSION}" ]; then
@@ -484,12 +506,12 @@ network_modules() {
insmod /lib/modules/"$(uname -r)"/weak-updates/iavf-"${DRIVER_VERSION}"/iavf.ko
echo "OOT NIC ${DRIVER_VERSION} drivers have been activated"
else
+ multi_drivers_switch
ln -s /lib/firmware/updates/intel/ice/ddp/ice-*.pkg /lib/firmware/intel/ice/ddp/ice.pkg
- echo "In-tree NIC drivers have been activated"
fi
else
+ multi_drivers_switch
ln -s /lib/firmware/updates/intel/ice/ddp/ice-*.pkg /lib/firmware/intel/ice/ddp/ice.pkg
- echo "In-tree NIC drivers have been activated"
fi
}
@@ -748,6 +770,12 @@ read_args() {
OSTREE_VAR_DEVICE=$optarg ;;
multi-drivers-switch=*)
DRIVER_VERSION=$optarg ;;
+ i40e=*)
+ I40E_VERSION=$optarg ;;
+ ice=*)
+ ICE_VERSION=$optarg ;;
+ iavf=*)
+ IAVF_VERSION=$optarg ;;
esac
done
# defaults if not set
diff --git a/init-ostree.sh b/init-ostree.sh
index c74f350..64ca70f 100644
--- a/init-ostree.sh
+++ b/init-ostree.sh
@@ -67,6 +67,27 @@ do_mount_fs() {
mount -t "$1" "$1" "$2"
}
+multi_drivers_switch() {
+ if grep -s -q '\si40e=' /proc/cmdline ; then
+ if [ ${I40E_VERSION} == "OOT" ]; then
+ insmod /lib/modules/"$(uname -r)"/weak-updates/i40e-*/i40e.ko
+ echo "OOT i40e driver have been activated"
+ fi
+ fi
+ if grep -s -q '\sice=' /proc/cmdline ; then
+ if [ ${ICE_VERSION} == "OOT" ]; then
+ insmod /lib/modules/"$(uname -r)"/weak-updates/ice-*/ice.ko
+ echo "OOT ice driver have been activated"
+ fi
+ fi
+ if grep -s -q '\siavf=' /proc/cmdline ; then
+ if [ ${IAVF_VERSION} == "OOT" ]; then
+ insmod /lib/modules/"$(uname -r)"/weak-updates/iavf-*/iavf.ko
+ echo "OOT iavf driver have been activated"
+ fi
+ fi
+}
+
network_modules() {
if grep -s -q '\smulti-drivers-switch=' /proc/cmdline ; then
if [ -d /lib/modules/"$(uname -r)"/weak-updates/ice-"${DRIVER_VERSION}" ]; then
@@ -75,12 +96,12 @@ network_modules() {
insmod /lib/modules/"$(uname -r)"/weak-updates/iavf-"${DRIVER_VERSION}"/iavf.ko
echo "OOT NIC ${DRIVER_VERSION} drivers have been activated"
else
+ multi_drivers_switch
ln -s /lib/firmware/updates/intel/ice/ddp/ice-*.pkg /lib/firmware/intel/ice/ddp/ice.pkg
- echo "In-tree NIC drivers have been activated"
fi
else
+ multi_drivers_switch
ln -s /lib/firmware/updates/intel/ice/ddp/ice-*.pkg /lib/firmware/intel/ice/ddp/ice.pkg
- echo "In-tree NIC drivers have been activated"
fi
}
@@ -211,6 +232,12 @@ read_args() {
MULTIPATH=$optarg ;;
multi-drivers-switch=*)
DRIVER_VERSION=$optarg ;;
+ i40e=*)
+ I40E_VERSION=$optarg ;;
+ ice=*)
+ ICE_VERSION=$optarg ;;
+ iavf=*)
+ IAVF_VERSION=$optarg ;;
ostree_var=*)
OSTREE_VAR_DEVICE=${optarg} ;;
esac
--
2.42.0

View File

@ -16,3 +16,4 @@
0016-init-ostree-install.sh-skip-eject-operation-through-.patch
0017-Allow-adjusting-boot-order.patch
0018-Support-OOT-and-In-tree-drivers-switch.patch
0019-Support-the-single-driver-switch.patch