Initial commit
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"eth0":"ethernet"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Stop %i link failover
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Restart=no
|
||||
ExecCondition=/lib/systemd/systemd-networkd-wait-online --timeout 30 -i %i
|
||||
ExecStart=/usr/libexec/ncsi-netlink-ifindex %i --set -p 0 -c 0
|
||||
SyslogIdentifier=nsci-failover
|
||||
Type=oneshot
|
||||
|
||||
[Install]
|
||||
WantedBy=network.target
|
||||
@@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Set %i gigabit link speed
|
||||
After=network.target
|
||||
ConditionPathExists=/sys/class/net/%i
|
||||
|
||||
[Service]
|
||||
TimeoutSec=90s
|
||||
Restart=no
|
||||
ExecStart=/usr/libexec/ncsi-wait-and-set-speed %i
|
||||
SyslogIdentifier=nsci-linkspeed
|
||||
Type=oneshot
|
||||
|
||||
[Install]
|
||||
WantedBy=network.target
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
IFPATH="/sys/class/net/$1/ifindex"
|
||||
|
||||
if [ ! -f "${IFPATH}" ]
|
||||
then
|
||||
echo Error: "${IFPATH}" does not exist 1>&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
shift
|
||||
ncsi-netlink -x "$(cat "${IFPATH}")" "$@"
|
||||
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# This script tries to periodically set the passed in network interface to
|
||||
# 1 gigabit. It will run until it is successful or it hits its max retries.
|
||||
# This script is necessary because there is no clear indication from the kernel
|
||||
# NCSI stack when it is in a proper state for this speed setting to succeed
|
||||
|
||||
# This script expects 1 parameter
|
||||
# - Network interface to configure (i.e. eth0, eth1, ...)
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Required network interface not provided"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
netIface=$1
|
||||
|
||||
# 60s total: 12 tries with 5s sleeps
|
||||
for i in {1..12}
|
||||
do
|
||||
echo "attempt number $i: setting $netIface to 1 gigabit"
|
||||
rc=0
|
||||
# package 0, channel 0, oem command, see Intel I210 datasheet section 10.6.3.10.1
|
||||
/usr/libexec/ncsi-netlink-ifindex "$netIface" -p 0 -c 0 -o 00000157200001 || rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo "error code is $rc setting $netIface to 1 gigabit, sleep and retry"
|
||||
sleep 5
|
||||
else
|
||||
echo "success setting $netIface to 1 gigabit"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
echo "ERROR: all retry attempts exhausted, unable to configure $netIface to 1 gigabit"
|
||||
exit 1
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"eth0":"ethernet0",
|
||||
"eth1":"ethernet1"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"eth0":"eth0"
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/network:"
|
||||
|
||||
inherit obmc-phosphor-systemd
|
||||
|
||||
RDEPENDS:${PN} += "bash"
|
||||
|
||||
OBMC_NETWORK_INTERFACES ?= "eth0"
|
||||
OBMC_NETWORK_INTERFACES:append:p10bmc = " eth1"
|
||||
|
||||
FAILOVER_TMPL = "ncsi-failover@.service"
|
||||
LINKSPEED_TMPL = "ncsi-linkspeed@.service"
|
||||
|
||||
SRC_URI += " file://ncsi-netlink-ifindex"
|
||||
SRC_URI += " file://ncsi-wait-and-set-speed"
|
||||
SRC_URI:append:ibm-ac-server = " file://${FAILOVER_TMPL}"
|
||||
SRC_URI:append:p10bmc = " file://${LINKSPEED_TMPL}"
|
||||
|
||||
SYSTEMD_SERVICE:${PN}:append:ibm-ac-server = " ${FAILOVER_TMPL}"
|
||||
SYSTEMD_SERVICE:${PN}:append:p10bmc = " ${LINKSPEED_TMPL}"
|
||||
|
||||
FAILOVER_TGTFMT = "ncsi-failover@{0}.service"
|
||||
LINKSPEED_TGTFMT = "ncsi-linkspeed@{0}.service"
|
||||
FAILOVER_FMT = "../${FAILOVER_TMPL}:network.target.wants/${FAILOVER_TGTFMT}"
|
||||
LINKSPEED_FMT = "../${LINKSPEED_TMPL}:network.target.wants/${LINKSPEED_TGTFMT}"
|
||||
|
||||
SYSTEMD_LINK:${PN}:append:ibm-ac-server = "${@compose_list(d, 'FAILOVER_FMT', 'OBMC_NETWORK_INTERFACES')}"
|
||||
SYSTEMD_LINK:${PN}:append:p10bmc = "${@compose_list(d, 'LINKSPEED_FMT', 'OBMC_NETWORK_INTERFACES')}"
|
||||
|
||||
FILES:${PN} += "${libexecdir}/ncsi-netlink-ifindex"
|
||||
FILES:${PN} += "${libexecdir}/ncsi-wait-and-set-speed"
|
||||
FILES:${PN} += "${datadir}/network/*.json"
|
||||
|
||||
PACKAGECONFIG:append = " sync-mac"
|
||||
PACKAGECONFIG:append = " persist-mac"
|
||||
PACKAGECONFIG:append:p10bmc = " hyp-nw-config"
|
||||
|
||||
install_network_configuration(){
|
||||
install -d ${D}${datadir}/network/
|
||||
install -m 0644 ${WORKDIR}/inventory-object-map.json ${D}${datadir}/network/config.json
|
||||
}
|
||||
|
||||
do_install:append() {
|
||||
install -d ${D}${libexecdir}
|
||||
install -m 0755 ${WORKDIR}/ncsi-netlink-ifindex ${D}${libexecdir}
|
||||
install -m 0755 ${WORKDIR}/ncsi-wait-and-set-speed ${D}${libexecdir}
|
||||
}
|
||||
|
||||
SRC_URI:append:p10bmc = " file://inventory-object-map.json"
|
||||
do_install:append:p10bmc(){
|
||||
install_network_configuration
|
||||
}
|
||||
|
||||
SRC_URI:append:ibm-ac-server = " file://inventory-object-map.json"
|
||||
do_install:append:ibm-ac-server() {
|
||||
install_network_configuration
|
||||
}
|
||||
|
||||
SRC_URI:append:witherspoon-tacoma = " file://inventory-object-map.json"
|
||||
do_install:append:witherspoon-tacoma(){
|
||||
install_network_configuration
|
||||
}
|
||||
Reference in New Issue
Block a user