-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add switchdev-configuration-after-NM service #202
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
mode: 0755 | ||
overwrite: true | ||
path: "/usr/local/bin/switchdev-configuration-after-NM.sh" | ||
contents: | ||
inline: | | ||
#!/bin/bash | ||
set -eux | ||
input="/etc/sriov_config.json" | ||
|
||
if [ ! -f $input ]; then | ||
echo "File /etc/sriov_config.json not exist." | ||
exit | ||
fi | ||
|
||
# Required for NetworkManager configuration(e.g. bond) to settle down | ||
sleep 3 | ||
|
||
jq -c '.interfaces[]' $input | while read iface; | ||
do | ||
eswitch_mode=$(echo $iface | jq '.eSwitchMode' -r) | ||
if [[ "$eswitch_mode" == "switchdev" ]]; then | ||
pci_addr=$(echo $iface | jq '.pciAddress' -r) | ||
name=$(echo $iface | jq '.name' -r) | ||
|
||
echo "load VF driver for $pci_addr" | ||
VfDirs=$(ls /sys/bus/pci/devices/${pci_addr} | grep virtfn) | ||
|
||
# load VF driver | ||
for VfDir in $VfDirs | ||
do | ||
VfPciAddr=$(basename "$( readlink -f /sys/bus/pci/devices/${pci_addr}/$VfDir )") | ||
echo $VfPciAddr > /sys/bus/pci/drivers_probe | ||
done | ||
fi | ||
done |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
mode: 0755 | ||
overwrite: true | ||
path: "/usr/local/bin/configure-switchdev.sh" | ||
path: "/usr/local/bin/switchdev-configuration-before-NM.sh" | ||
contents: | ||
inline: | | ||
#!/bin/bash | ||
|
@@ -72,12 +72,5 @@ contents: | |
|
||
# turn hw-tc-offload on | ||
/usr/sbin/ethtool -K ${name} hw-tc-offload on | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not related to this PR, but we could probably save some time during boot if we set
if this sounds like something we like, i can open an enhancement on it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good to me. Can There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. need to re-enable sriov_drivers_autoprobe before binding driver in L75 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done #214 |
||
# load VF driver | ||
for VfDir in $VfDirs | ||
do | ||
VfPciAddr=$(basename "$( readlink -f /sys/bus/pci/devices/${pci_addr}/$VfDir )") | ||
echo $VfPciAddr > /sys/bus/pci/drivers_probe | ||
done | ||
fi | ||
done |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
contents: | | ||
[Unit] | ||
Description=Binds SRIOV VFs to switchdev driver | ||
# Removal of this file signals firstboot completion | ||
ConditionPathExists=!/etc/ignition-machine-config-encapsulated.json | ||
# This service is used to rebind SR-IOV netdev driver after switchdev and NetworkManager configurations | ||
Wants=NetworkManager.service | ||
After=NetworkManager.service | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/local/bin/switchdev-configuration-after-NM.sh | ||
StandardOutput=journal+console | ||
StandardError=journal+console | ||
|
||
[Install] | ||
WantedBy=network-online.target | ||
enabled: true | ||
name: switchdev-configuration-after-NM.service |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
contents: | | ||
[Unit] | ||
Description=Configures SRIOV NIC into switchdev mode | ||
Description=Configures SRIOV NIC to switchdev mode | ||
# Removal of this file signals firstboot completion | ||
ConditionPathExists=!/etc/ignition-machine-config-encapsulated.json | ||
# This service is used to move a SRIOV NIC into switchdev mode | ||
# This service is used to move a SRIOV NIC to switchdev mode | ||
Wants=network-pre.target | ||
Before=network-pre.target | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/local/bin/configure-switchdev.sh | ||
ExecStart=/usr/local/bin/switchdev-configuration-before-NM.sh | ||
StandardOutput=journal+console | ||
StandardError=journal+console | ||
|
||
[Install] | ||
WantedBy=network-online.target | ||
enabled: true | ||
name: switchdev-configuration.service | ||
name: switchdev-configuration-before-NM.service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if we dont have this sleep ? do you know what configurations need to settle down ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happened was that VF LAG didn't take effect (there is the dmesg indicating the error).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adrianchiris any follow-up questions ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no additional questions. VF Lag has some quirks :(