All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] RFC CPSW switchdev mode
@ 2018-05-24  6:56 Ilias Apalodimas
  2018-05-24  6:56 ` [PATCH 1/4] cpsw: move common headers definitions to cpsw_priv.h Ilias Apalodimas
                   ` (5 more replies)
  0 siblings, 6 replies; 53+ messages in thread
From: Ilias Apalodimas @ 2018-05-24  6:56 UTC (permalink / raw)
  To: netdev, grygorii.strashko, ivan.khoronzhuk, nsekhar, jiri, ivecera
  Cc: francois.ozog, yogeshs, spatton, Ilias Apalodimas

Hello, 

This is adding a new mode on the cpsw driver based around switchdev.
In order to enable this you need to enable CONFIG_NET_SWITCHDEV, 
CONFIG_BRIDGE_VLAN_FILTERING, CONFIG_TI_CPSW_SWITCHDEV
and add to udev config: 

SUBSYSTEM=="net", ACTION=="add", ATTR{phys_switch_id}=="0f011900", \
        ATTR{phys_port_name}!="", NAME="sw0$attr{phys_port_name}"
Since the phys_switch_id is based on cpsw version, users with different 
version will need to do 'ip -d link show dev sw0p0 | grep switchid' and 
replace with the correct value.

This patch creates 3 ports, sw0p0, sw0p1 and sw0p2.
sw0p1 and sw0p2 are the netdev interfaces connected to PHY devices
while sw0p0 is the switch 'cpu facing port'.
sw0p0 will be unable to receive and transmit traffic and it's not 100% within
switchdev scope but, it's used to configure switch cpu port individually as 
this is needed for various switch features and configuration scenarios.

Bridge setup:
ip link add name br0 type bridge
ip link set dev br0 type bridge ageing_time 1000
ip link set dev br0 type bridge vlan_filtering 1

ip link set dev sw0p1 up
ip link set dev sw0p2 up
ip link set dev sw0p0 up
ip link set dev sw0p0 master br0
ip link set dev sw0p2 master br0
ip link set dev sw0p1 master br0

ip link set br0 address $(cat /sys/class/net/sw0p1/address)
ifconfig br0 up

VLAN config:
untagged:
bridge vlan add dev sw0p1 vid 100 pvid untagged master
bridge vlan add dev sw0p2 vid 100 pvid untagged master

tagged:
bridge vlan add dev sw0p1 vid 100 master
bridge vlan add dev sw0p2 vid 100 master

IP address on br0:
bridge vlan add dev br0 vid 100 pvid untagged self
bridge vlan add dev sw0p0 vid 100 pvid untagged master
udhcpc -i br0

FDBs:
bridge fdb add aa:bb:cc:dd:ee:ff dev sw0p1 master vlan 100
bridge fdb add aa:bb:cc:dd:ee:fe dev sw0p2 master

MDBs:
single vlan:
bridge mdb add dev br0 port sw0p1 grp 239.1.1.1 permanent vid 100

all vlans:
bridge mdb add dev br0 port sw0p2 grp 239.1.1.1 permanent
bridge mdb add dev br0 port sw0p0 grp 239.1.1.1 permanent

Multicast:
setting multicast on and off will affect registered multicast
setting allmulti on and off will affect unregistered multicast
This muct occur before adding VLANs on the interfaces. If you change the
flag after the VLAN configuration you need to re-issue the VLAN config 
commands.

Promiscuous mode:
Adding/removing sw0p0 on the bridge will enable/disable ALE_P0_UNI_FLOOD

NFS:
The only way for NFS to work is by chrooting to a minimal environment when 
switch configuration that will affect connectivity is needed.
Assuming you are booting NFS with eth1 interface(the script is hacky and 
it's just there to prove NFS is doable).

setup.sh:
#!/bin/sh
mkdir proc
mount -t proc none /proc

ifconfig br0  > /dev/null
if [ $? -ne 0 ]; then
        echo "Setting up bridge"
        ip link add name br0 type bridge
        ip link set dev br0 type bridge ageing_time 1000
        ip link set dev br0 type bridge vlan_filtering 1

        ip link set eth1 down 
        ip link set eth1 name sw0p1 
        ip link set dev sw0p1 up
        ip link set dev sw0p2 up
        ip link set dev sw0p0 up
        ip link set dev sw0p0 master br0 
        ip link set dev sw0p2 master br0
        ip link set dev sw0p1 master br0
        ifconfig sw0p1 0.0.0.0
        udhchc -i br0
fi
umount /proc

run_nfs.sh:
#!/bin/sh
mkdir /tmp/root/bin -p
mkdir /tmp/root/lib -p

cp -r /lib/ /tmp/root/
cp -r /bin/ /tmp/root/
cp /sbin/ip /tmp/root/bin
cp /sbin/bridge /tmp/root/bin
cp /sbin/ifconfig /tmp/root/bin
cp /sbin/udhcpc /tmp/root/bin
cp /path/to/setup.sh /tmp/root/bin
chroot /tmp/root/ busybox sh /bin/run_nfs.sh

run ./run_nfs.sh

This is on top of 4.17-rc2 tree.

P.S: I am not 100% sure that the promiscuity handling is correct.
Please let me know if i should change anything on that

Ilias Apalodimas (4):
  cpsw: move common headers definitions to cpsw_priv.h
  cpsw_ale: add support functions for switchdev
  cpsw_switchdev: add switchdev support files
  cpsw: add switchdev support

 drivers/net/ethernet/ti/Kconfig          |   9 +
 drivers/net/ethernet/ti/Makefile         |   1 +
 drivers/net/ethernet/ti/cpsw.c           | 610 ++++++++++++++++++++++---------
 drivers/net/ethernet/ti/cpsw_ale.c       | 129 +++++++
 drivers/net/ethernet/ti/cpsw_ale.h       |   8 +
 drivers/net/ethernet/ti/cpsw_priv.h      | 148 ++++++++
 drivers/net/ethernet/ti/cpsw_switchdev.c | 299 +++++++++++++++
 drivers/net/ethernet/ti/cpsw_switchdev.h |   4 +
 8 files changed, 1039 insertions(+), 169 deletions(-)
 create mode 100644 drivers/net/ethernet/ti/cpsw_priv.h
 create mode 100644 drivers/net/ethernet/ti/cpsw_switchdev.c
 create mode 100644 drivers/net/ethernet/ti/cpsw_switchdev.h

-- 
2.7.4

^ permalink raw reply	[flat|nested] 53+ messages in thread

end of thread, other threads:[~2018-06-06  8:23 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-24  6:56 [PATCH 0/4] RFC CPSW switchdev mode Ilias Apalodimas
2018-05-24  6:56 ` [PATCH 1/4] cpsw: move common headers definitions to cpsw_priv.h Ilias Apalodimas
2018-05-24  6:56 ` [PATCH 2/4] cpsw_ale: add support functions for switchdev Ilias Apalodimas
2018-05-24  6:56 ` [PATCH 3/4] cpsw_switchdev: add switchdev support files Ilias Apalodimas
2018-05-24 10:00   ` Maxim Uvarov
2018-05-27  4:39   ` kbuild test robot
2018-05-24  6:56 ` [PATCH 4/4] cpsw: add switchdev support Ilias Apalodimas
2018-05-24 13:12   ` Andrew Lunn
2018-05-24 13:32     ` Ilias Apalodimas
2018-05-24 16:39       ` Andrew Lunn
2018-05-25  4:56         ` Ilias Apalodimas
2018-06-01 21:48           ` Florian Fainelli
2018-06-02 10:34             ` Ilias Apalodimas
2018-06-02 16:10               ` Florian Fainelli
2018-06-02 16:52                 ` Ilias Apalodimas
2018-06-05 21:03               ` Grygorii Strashko
2018-06-05 21:37                 ` Florian Fainelli
2018-05-24  8:05 ` [PATCH 0/4] RFC CPSW switchdev mode Jiri Pirko
2018-05-24  8:48   ` Ilias Apalodimas
2018-05-24 12:54     ` Andrew Lunn
2018-05-24 13:44       ` Ivan Vecera
2018-05-24 14:08         ` Ilias Apalodimas
2018-05-24 14:54           ` Andrew Lunn
2018-05-24 15:07             ` Ilias Apalodimas
2018-05-24 15:25               ` Andrew Lunn
2018-05-24 16:02                 ` Ilias Apalodimas
2018-05-24 16:33                   ` Andrew Lunn
2018-05-25  6:29                     ` Ilias Apalodimas
2018-05-25 10:28                       ` Ilias Apalodimas
2018-05-25 11:59                         ` Andrew Lunn
2018-05-25 12:09                       ` Andrew Lunn
2018-05-31 15:27                         ` Ilias Apalodimas
2018-06-02 23:28           ` Grygorii Strashko
2018-06-03  0:08             ` Andrew Lunn
2018-06-05 21:18               ` Grygorii Strashko
2018-06-05 21:28                 ` Andrew Lunn
2018-06-05 21:42                   ` Grygorii Strashko
2018-06-05 21:55                     ` Andrew Lunn
2018-06-03  0:26             ` Andrew Lunn
2018-06-05 23:23               ` Grygorii Strashko
2018-06-05 23:49                 ` Andrew Lunn
2018-06-06  8:23                 ` Ivan Khoronzhuk
2018-06-03  0:37             ` Andrew Lunn
2018-06-05 21:31               ` Grygorii Strashko
2018-06-05 21:37                 ` Andrew Lunn
2018-06-03  0:49             ` Andrew Lunn
2018-06-05 22:45               ` Grygorii Strashko
2018-06-05 23:40                 ` Andrew Lunn
2018-06-01 21:29 ` Grygorii Strashko
2018-06-02 14:08   ` Andrew Lunn
2018-06-05 22:59     ` Grygorii Strashko
2018-06-05 23:53       ` Andrew Lunn
2018-06-06  6:42         ` Ilias Apalodimas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.