EasyManua.ls Logo

NXP Semiconductors Layerscape LS1028A BSP - Page 100

NXP Semiconductors Layerscape LS1028A BSP
136 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Brings up the eno2 and eno3 ENETC interfaces
Assigns the bridge, switch port interfaces and eno3 to the same net namespace (swns)
#!/bin/bash
#
# Simple switch configuration
#
# Assume both ENETC and Felix drivers are already loaded
#
BRIDGE=br0
MAC_ROOT=bc:8d:bf:7c:5b
SW_NETNS=swns
EXEC_SWNS="ip netns exec $SW_NETNS"
# Create bridge namespace
ip netns add $SW_NETNS
# Create bridge device in net namespace
$EXEC_SWNS ip link add name $BRIDGE type bridge
$EXEC_SWNS ip link set $BRIDGE up
# Configure switch ports
# * set MAC address
# * bring up interface
# * move net device into the bridge net namespace
# * set bridge device as master
swps=($(ls /sys/bus/pci/devices/0000:00:00.5/net/))
nr=${#swps[@]}
for (( i=0; i<$nr; i++ ))
do
echo "adding ${swps[$i]} to brigde .."
ip link set ${swps[$i]} address $MAC_ROOT:$(echo "${swps[$i]}" | tr -dc '0-9')
ip link set ${swps[$i]} netns $SW_NETNS
$EXEC_SWNS ip link set ${swps[$i]} master $BRIDGE
$EXEC_SWNS ip link set ${swps[$i]} up
done
# bring up ENETC ports connected to switch ports
enetc2=$(ls /sys/bus/pci/devices/0000:00:00.2/net/)
ip link set $enetc2 up
# move ENETC port connected to switch CPU port in bridge ns
enetc3=$(ls /sys/bus/pci/devices/0000:00:00.6/net/)
ip link set $enetc3 netns $SW_NETNS
$EXEC_SWNS ip link set $enetc3 up
# Check configuration
$EXEC_SWNS bridge link show
The script output appears as follows:
br0: port 1(swp0) entered blocking state
br0: port 1(swp0) entered disabled state
device swp0 entered promiscuous mode
mscc_felix 0000:00:00.5 swp0: Unsupported PHY speed: 0
Vitesse VSC8514 1f8100000:10: attached PHY driver [Vitesse VSC8514] (mii_bus:phy_addr=1f8100000:10,
irq=POLL)
br0: port 1(swp0) entered blocking state
br0: port 1(swp0) entered forwarding state
Linux kernel
Layerscape LS1028A BSP User Guide, Rev. 0.3, 04/2019
100
NXP Semiconductors

Table of Contents

Related product manuals