# DPSW on CEX7

**URL:** <https://community.solid-run.com/t/dpsw-on-cex7/407>\
**Category:** NXP LX2160\
**Tags:** NXP-LX2160\
**Created:** [July 28, 2022, 5:24am UTC](https://community.solid-run.com/t/dpsw-on-cex7/407 "2022-07-28T05:24:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lechtchinski.Dmitri](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@Lechtchinski.Dmitri](https://community.solid-run.com/u/Lechtchinski.Dmitri)\
**Post date:** [July 28, 2022, 5:24am UTC](https://community.solid-run.com/t/dpsw-on-cex7/407/1 "2022-07-28T05:24:36Z")

</div>

Hi,

I’m trying a simple setup with a DPSW on CEX7 board.  
I have a network cable connected to a host PC via MAC17.

On boot, I perform the following:  
`ifconfig eth0 192.168.0.100 netmask 255.255.255.0`  
After this I have ping to my host.

Now I want to create a switch as follows:  
DPNI \<–\> DPSW \<–\> DPMAC

So first I destroy the default dpni.0 connected to dpmac.17:

```auto
echo dpni.0 > /sys/bus/fsl-mc/drivers/fsl_dpaa2_eth/unbind
restool dpni destroy dpni.0

```

And then I create a new one:  
`ls-addni -n`  
Finally I create a switch with two ports:  
`ls-addsw -i=2 dpmac.17 dpni.0`  
And setup the IP for the DPNI  
`ifconfig eth0 192.168.0.100 netmask 255.255.255.0`

However, there is no ping and the link seems to be down.

```auto
root@localhost:~# restool dpni info dpni.0
dpni version: 7.17
dpni id: 0
plugged state: plugged
endpoint state: 0
endpoint: dpsw.0.1, link is down
link status: 0 - down
mac address: 22:15:87:c8:a7:35
...

```

```auto
root@localhost:~# restool dpmac info dpmac.17
dpmac version: 4.7
dpmac object id/portal id: 17
plugged state: plugged
endpoint state: 0
endpoint: dpsw.0.0, link is down
DPMAC link type: DPMAC_LINK_TYPE_PHY
DPMAC ethernet interface: DPMAC_ETH_IF_RGMII
MAC address: d0:63:b4:03:b6:e7
...

```

A similar sequence has worked for me in the past on NXP LX2 RDB, however I no longer have access to that board so I can’t compare the results.

Any ideas how to make this work?

Thanks  
Dmitri

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [July 28, 2022, 3:03pm UTC](https://community.solid-run.com/t/dpsw-on-cex7/407/2 "2022-07-28T15:03:34Z")

</div>

are you setting the link up after you re-create the network interface? You would need to manually use `ip link set eth0` or whatever interface is created after bringing up the DPSW interface.

---

<div class="post-metadata">

**Author:** ![Lechtchinski.Dmitri](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@Lechtchinski.Dmitri](https://community.solid-run.com/u/Lechtchinski.Dmitri)\
**Post date:** [July 28, 2022, 3:28pm UTC](https://community.solid-run.com/t/dpsw-on-cex7/407/3 "2022-07-28T15:28:14Z")

</div>

Yes, as I described above I perform `ifconfig eth0 ...` to set up the Iink, I believe it has the same functionality as `ip link ...`.  
Again, same sequence worked for me on NXP RDB.

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [July 28, 2022, 3:33pm UTC](https://community.solid-run.com/t/dpsw-on-cex7/407/4 "2022-07-28T15:33:05Z")

</div>

no that ifconfig command only adds the ip address to the interface. The interface also needs to be brought up which can be done by adding `up` to the options. However I do recommend you learn to use the ip command set, ifconfig has been deprecated in favor of iproute2 for over a decade now.

---

<div class="post-metadata">

**Author:** ![Lechtchinski.Dmitri](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@Lechtchinski.Dmitri](https://community.solid-run.com/u/Lechtchinski.Dmitri)\
**Post date:** [July 31, 2022, 4:10am UTC](https://community.solid-run.com/t/dpsw-on-cex7/407/5 "2022-07-31T04:10:12Z")

</div>

I’ve rerun the test with ip commands.

Destroy default dpni.0

```auto
echo dpni.0 > /sys/bus/fsl-mc/drivers/fsl_dpaa2_eth/unbind
restool dpni destroy dpni.0

```

Create new DPNI  
`ls-addni -n`  
Create switch  
`ls-addsw -i=2 dpmac.17 dpni.0`  
Add IP address and enable interfaces

```auto
ip addr add 192.168.0.100/24 dev eth0
ip link set eth1 up
ip link set eth2 up
ip link set eth0 up

```

Still, there is no ping to host.  
Is there something else I’m missing?

See “`ip addr show`” and “`restool dpsw info dpsw.0`” commands output, all interfaces are shown as “up”:

```auto
root@localhost:~# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 06:c6:7a:01:cc:d9 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.100/24 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::4c6:7aff:fe01:ccd9/64 scope link 
       valid_lft forever preferred_lft forever
5: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether d0:63:b4:03:b6:e7 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::d263:b4ff:fe03:b6e7/64 scope link 
       valid_lft forever preferred_lft forever
6: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 96:6a:b0:be:f4:63 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::946a:b0ff:febe:f463/64 scope link 
       valid_lft forever preferred_lft forever

root@localhost:~# restool dpsw info dpsw.0
dpsw version: 8.9
dpsw id: 0
plugged state: plugged
endpoints:
interface 0:
	connection: dpmac.17
	link state: up
	Taildrop enabled: false
	Taildrop units: BUFFERS
	Taildrop threshold: 192
	max frame length: 1536
	dpsw_cnt_ing_frame: 0
	dpsw_cnt_ing_byte: 0
	dpsw_cnt_ing_fltr_frame: 183
	dpsw_cnt_ing_frame_discard: 0
	dpsw_cnt_ing_mcast_frame: 0
	dpsw_cnt_ing_mcast_byte: 0
	dpsw_cnt_ing_bcast_frame: 0
	dpsw_cnt_ing_bcast_bytes: 0
	dpsw_cnt_egr_frame: 0
	dpsw_cnt_egr_byte: 0
	dpsw_cnt_egr_frame_discard: 0
	dpsw_cnt_egr_stp_frame_discard: 0
	dpsw_cnt_ing_no_buffer_discard: 0
interface 1:
	connection: dpni.0
	link state: up
	Taildrop enabled: false
	Taildrop units: BUFFERS
	Taildrop threshold: 192
	max frame length: 1536
	dpsw_cnt_ing_frame: 0
	dpsw_cnt_ing_byte: 0
	dpsw_cnt_ing_fltr_frame: 22
	dpsw_cnt_ing_frame_discard: 0
	dpsw_cnt_ing_mcast_frame: 0
	dpsw_cnt_ing_mcast_byte: 0
	dpsw_cnt_ing_bcast_frame: 0
	dpsw_cnt_ing_bcast_bytes: 0
	dpsw_cnt_egr_frame: 0
	dpsw_cnt_egr_byte: 0
	dpsw_cnt_egr_frame_discard: 0
	dpsw_cnt_egr_stp_frame_discard: 0
	dpsw_cnt_ing_no_buffer_discard: 0
dpsw_attr.options value is: 0
max VLANs: 16
max FDBs: 1
max FDB entries: 1024
FDB aging time: 300
max FDB MC groups: 32
frame storage memory size: 768
number of interfaces: 2
current number of VLANs: 1
current number of FDBs: 1
component_type: DPSW_COMPONENT_TYPE_C_VLAN

```

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [August 4, 2022, 9:40am UTC](https://community.solid-run.com/t/dpsw-on-cex7/407/6 "2022-08-04T09:40:59Z")

</div>

Sorry this just took me a bit to get around to. With recent kernels and changes to the driver you need to bind the interface to a bridge for dpaa2 switch drivers to work. Please see step 4 of this guide, [NXP](https://docs.nxp.com/bundle/GUID-3FFCCD77-5220-414D-8664-09E6FB1B02C6/page/GUID-204F380E-690A-4356-AA6B-C926960DF384.html)

With this setup I am seeing a fully switched interface on the HoneyComb when running tcpdump on the br0 interface I see no traffic between other devices connected to the complex but IP packets going to and coming from the br0 ip address as visible and have connectivity to the fully network.

---

<div class="post-metadata">

**Author:** ![Lechtchinski.Dmitri](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@Lechtchinski.Dmitri](https://community.solid-run.com/u/Lechtchinski.Dmitri)\
**Post date:** [August 17, 2022, 4:12am UTC](https://community.solid-run.com/t/dpsw-on-cex7/407/7 "2022-08-17T04:12:05Z")

</div>

Hi, sorry for the late response.  
I now have it working with the instructions you linked, thanks!  
Detailing the sequence here for future reference:

Destroy default dpni.0

```auto
echo dpni.0 > /sys/bus/fsl-mc/drivers/fsl_dpaa2_eth/unbind
restool dpni destroy dpni.0

```

Create new DPNI

```auto
ls-addni -n

```

Create switch

```auto
ls-addsw -i=2 dpmac.17 dpni.0

```

Configure the switch interfaces and add them to a bridge

```auto
ip link set dev eth1 down
ip link set dev eth1 address 00:00:00:00:00:02
ip link set dev eth1 up
ip link set dev eth2 down
ip link set dev eth2 address 00:00:00:00:00:03
ip link set dev eth2 up
ip link add name br0 type bridge
ip link set dev br0 up
ip link set dev eth1 master br0
ip link set dev eth2 master br0

```

Add IP address and enable interface

```auto
ip addr add 192.168.0.100/24 dev eth0
ip link set eth0 up

```

Ping host

```auto
ping 192.168.0.1
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=128 time=0.547 ms
64 bytes from 192.168.0.1: icmp_seq=2 ttl=128 time=0.454 ms
64 bytes from 192.168.0.1: icmp_seq=3 ttl=128 time=0.458 ms
64 bytes from 192.168.0.1: icmp_seq=4 ttl=128 time=0.454 ms

```
