47 lines
1.6 KiB
Bash
Executable File
47 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
echo "--- Starting NXP DPAA1 Hardware Initialization ---"
|
|
|
|
# Only unbind the SFP ports (MAC 9 and 10)
|
|
# Leave MAC 3, 4, 5, 6 for Linux (Kubernetes management)
|
|
SFP_PORTS="9 10"
|
|
|
|
echo "Releasing SFP hardware ports from kernel..."
|
|
for port in $SFP_PORTS; do
|
|
if [ -e /sys/bus/platform/drivers/fsl-dpa-ethernet/fm0-port.$port ]; then
|
|
echo "fm0-port.$port" > /sys/bus/platform/drivers/fsl-dpa-ethernet/unbind 2>/dev/null || true
|
|
echo "Successfully unbound MAC $port"
|
|
else
|
|
echo "MAC $port already released or not found."
|
|
fi
|
|
done
|
|
|
|
# 1. PRE-REQUISITE: Unbind ports from the kernel
|
|
# This frees the hardware so FMC/VPP can claim it.
|
|
# MAC 3 usually maps to fm0-port.3 or similar in sysfs.
|
|
echo "Releasing hardware ports from kernel..."
|
|
for port in 3 4 5 6 9 10; do
|
|
# Try to unbind from the DPAA Ethernet driver if it exists
|
|
if [ -e /sys/bus/platform/drivers/fsl-dpa-ethernet/fm0-port.$port ]; then
|
|
echo "fm0-port.$port" > /sys/bus/platform/drivers/fsl-dpa-ethernet/unbind 2>/dev/null || true
|
|
fi
|
|
# Ensure the interface is DOWN
|
|
# Note: You may need to map MAC numbers to eth names (eth0, eth1, etc.)
|
|
done
|
|
|
|
# 2. Run FMC
|
|
if [ -f /etc/fmc/config.xml ]; then
|
|
echo "Applying FMC Configuration..."
|
|
cd /etc/fmc
|
|
# Using -l dbg1 helps see exactly why a port fails if it happens again
|
|
fmc -c /etc/fmc/config.xml -p /etc/fmc/policy.xml -a -l dbg1
|
|
echo "FMC Configuration applied successfully."
|
|
else
|
|
echo "ERROR: /etc/fmc/config.xml not found!"
|
|
exit 1
|
|
fi
|
|
|
|
echo "--- Starting VPP Forwarder ---"
|
|
exec vpp -c /etc/vpp/startup.conf
|