Hi,
I'm trying to find a way such that I can setup the bridge with netplan when adding a created a DPNI assigned to Linux kernel.
For example:
1. Create internal network interface with specified mac address such that I can add a rule to rename this interface to 'eth-internal-1g':
root@evt1-3:~# ls-addni --no-link --mac-addr=0a:ad:54:53:52:00
Created interface: eth-internal-1g (object:dpni.0, endpoint: )
root@evt1-3:~# dmesg
[ 251.721856] fsl_mc_allocator dpbp.8: Adding to iommu group 8
[ 251.722573] fsl_mc_allocator dpmcp.25: Adding to iommu group 8
[ 251.722794] fsl_mc_allocator dpcon.143: Adding to iommu group 8
[ 251.722938] fsl_mc_allocator dpcon.142: Adding to iommu group 8
[ 251.723064] fsl_mc_allocator dpcon.141: Adding to iommu group 8
[ 251.723193] fsl_mc_allocator dpcon.140: Adding to iommu group 8
[ 251.723316] fsl_mc_allocator dpcon.139: Adding to iommu group 8
[ 251.723449] fsl_mc_allocator dpcon.138: Adding to iommu group 8
[ 251.723581] fsl_mc_allocator dpcon.137: Adding to iommu group 8
[ 251.723728] fsl_mc_allocator dpcon.136: Adding to iommu group 8
[ 251.723862] fsl_mc_allocator dpcon.135: Adding to iommu group 8
[ 251.723995] fsl_mc_allocator dpcon.134: Adding to iommu group 8
[ 251.724152] fsl_mc_allocator dpcon.133: Adding to iommu group 8
[ 251.724305] fsl_mc_allocator dpcon.132: Adding to iommu group 8
[ 251.724464] fsl_mc_allocator dpcon.131: Adding to iommu group 8
[ 251.724605] fsl_mc_allocator dpcon.130: Adding to iommu group 8
[ 251.724745] fsl_mc_allocator dpcon.129: Adding to iommu group 8
[ 251.724880] fsl_mc_allocator dpcon.128: Adding to iommu group 8
[ 251.726854] fsl_dpaa2_eth dpni.0: Adding to iommu group 8
[ 251.891594] fsl_dpaa2_eth dpni.0: Probed interface eth0
[ 251.894141] fsl_dpaa2_eth dpni.0 eth-internal-1g: renamed from eth0
2. Create a switch and add the newly created network interface and two DPMAC ports to the switch:
root@evt1-3:~# ls-addsw -i=3 dpmac.18 dpmac.17 dpni.0
Created ETHSW object dpsw.0 with the following 3 ports: eth-j5a,eth-j5b,eth0
root@evt1-3:~# dmesg
[ 438.655042] fsl_mc_allocator dpbp.9: Adding to iommu group 8
[ 438.655752] fsl_mc_allocator dpmcp.26: Adding to iommu group 8
[ 438.658254] dpaa2_ethsw dpsw.0: Adding to iommu group 8
[ 438.744750] dpaa2_ethsw dpsw.0 eth-j5b: renamed from eth0
[ 438.788444] dpaa2_ethsw dpsw.0: probed 3 port switch
[ 438.795564] dpaa2_ethsw dpsw.0 eth-j5a: renamed from eth1
I have rules in place to rename the DPMAC18 and DPMAC17 to eth-j5a and eth-j5b and the restool automatically creates a ethernet interface associated with the dpni.0 and its naming may or may not be deterministic (in this case it is eth0).
The next thing I want to do is add these interfaces to the bridge br0 but because the auto-created ethernet interface associated with the dpni that has no link attached depends on the Linux kernel enumeration I don't have a way to create a rule to rename this interface.
15: eth-internal-1g: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 0a:ad:54:53:52:00 brd ff:ff:ff:ff:ff:ff
16: eth-j5b: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 0a:ad:54:53:52:12 brd ff:ff:ff:ff:ff:ff
17: eth-j5a: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 0a:ad:54:53:52:11 brd ff:ff:ff:ff:ff:ff
18: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 86:9f:93:2b:fb:0c brd ff:ff:ff:ff:ff:ff
Is there a way to assign a MAC address for these ethernet interfaces associated with the dpni with --no-link option? Or is there any other way to make these interfaces associated with the switch port deterministic?
This still doesn't help with what I'm hoping to achieve.
I want to be able to setup a dpsw within the dpl_<switchname>.dts file such that on bootup this switch gets configured without having to use a script that will run through the procedure above.
For example, I understand that the following is a wrapper script that calls restool to create and update the dpni with a fixed mac-addr.
if [ -n "$mac_addr" ]; then
$restool dpni update $dpni --mac-addr=$mac_addr
fi
ls-addni --no-link --mac-addr=0a:ad:54:53:52:00
When I take a look at the dpl file generated via say: restool dprc generate-dpl dprc.1 > running_dpl.dts
I only see the dpni object like this:
/* ------------ DPNI --------------*/
dpni@0 {
compatible = "fsl,dpni";
type = "DPNI_TYPE_NIC";
num_queues = <16>;
num_tcs = <1>;
num_cgs = <1>;
mac_filter_entries = <16>;
vlan_filter_entries = <0>;
fs_entries = <64>;
qos_entries = <0>;
dist_key_size = <56>;
};
Is there any dpni object property in the dpl_xxx.dts file that allows me to specify a fixed mac-addr=< 0x0a 0xad 0x54 0x53 0x52 0x00 > similar to dpc_xxx.dts for dpmac objects property port_mac_address=<<0x0a 0xad 0x54 0x53 0x52 0x12>;??
There is no mac-addr in the generate_dpl.c API.
/* retrieve response parameters */
rsp_params = (struct dpni_rsp_get_attr *)cmd.params; attr->options = le32_to_cpu(rsp_params->options); attr->num_queues = rsp_params->num_queues; attr->num_rx_tcs = rsp_params->num_rx_tcs; attr->num_tx_tcs = rsp_params->num_tx_tcs; attr->mac_filter_entries = rsp_params->mac_filter_entries; attr->vlan_filter_entries = rsp_params->vlan_filter_entries; attr->qos_entries = rsp_params->qos_entries; attr->fs_entries = le16_to_cpu(rsp_params->fs_entries);
attr->qos_key_size = rsp_params->qos_key_size; attr->fs_key_size = rsp_params->fs_key_size; attr->wriop_version = le16_to_cpu(rsp_params->wriop_version);
attr->num_cgs = rsp_params->num_cgs;
attr->num_ceetm_ch = rsp_params->num_ceetm_ch;root@localhost:~# ls-listni
dprc.1/dpni.2 (interface: eth0)
dprc.1/dpni.1 (interface: eth1, end point: dpmac.2)
dprc.1/dpni.0 (interface: eth2, end point: dpmac.17) root@localhost:~# ifconfig eth0
eth0: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 0a:ad:54:53:52:00 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
root@localhost:~# restool dpni info dpni.2 | grep -i mac mac address: 00:00:05:00:00:05
mac_entries: 16
root@localhost:~# ifconfig eth0 hw ether 00:E0:0C:00:77:01 root@localhost:~# restool dpni info dpni.2 | grep -i mac mac address: 00:e0:0c:00:77:01
mac_entries: 16
attr->num_opr = le16_to_cpu(rsp_params->num_opr);
return 0;
When created one dpni with ls-addni -n, it will create an linux interface named eth<x>.
Customer can configure the mac address with "ifconfig eth<x> hw ether <mac-address>"
here is log
Please refer to the following procedure.
1. Create a DPNI for assigning to Linux kernel.
ls-addni --no-link
Output log:
Created interface: eth0 (object:dpni.1, endpoint: )
2. Create DPRC with DPNI attached.
source /usr/local/dpdk/dpaa2/dynamic_dpl.sh dpni
(...)
# ## # # ##################### Configured Interfaces ####################
Interface Name Endpoint Mac Address
============== ======== ==================
dpni.3 UNCONNECTED 00:00:00:00:5:1
3. Using the restool wrapper script, create a DPSW connected to the two DPNIs and a DPMAC.
ls-addsw dpni.1 dpni.3 dpmac.1
Created ETHSW object dpsw.0 with the following 3 ports: eth2,eth3,eth4
4. Configure the switch interfaces and add them to a bridge.
ip link set dev eth2 down
ip link set dev eth2 address 00:00:00:00:00:02
ip link set dev eth2 up
ip link set dev eth3 down
ip link set dev eth3 address 00:00:00:00:00:03
ip link set dev eth3 up
ip link set dev eth4 down
ip link set dev eth4 address 00:00:00:00:00:04
ip link set dev eth4 up
ip link add name br0 type bridge
ip link set dev br0 up
ip link set dev eth2 master br0
ip link set dev eth3 master br0
ip link set dev eth4 master br0