switchdev - no more sdk

24
Elad Raz, Jiri Pirko Kernel TLV | 2016 Switchdev No More SDK

Upload: kernel-tlv

Post on 17-Feb-2017

302 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Switchdev - No More SDK

Elad Raz, Jiri Pirko

Kernel TLV | 2016

Switchdev – No More SDK

Page 2: Switchdev - No More SDK

© 2016 Mellanox Technologies 2

Switchdev is here to stay

What?

Why?

Where?

Page 3: Switchdev - No More SDK

© 2016 Mellanox Technologies 3

Switchdev is here to stay

What?

Why?

Where?

Page 4: Switchdev - No More SDK

© 2016 Mellanox Technologies 4

Switchdev is here to stay

What?

64 net-devicesDoing skb rx/tx, ethtool, port state and ndo offload

Page 5: Switchdev - No More SDK

© 2016 Mellanox Technologies 5

Switchdev is here to stay

What?

switchdev_ops.1D/.1Q Bridging – VLANs, PVID, FDB, IGMP…

Routing – FIB offload

and more

Page 6: Switchdev - No More SDK

© 2016 Mellanox Technologies 6

Switchdev is here to stay

What?

In-kernel implementation

NO MORE SDK!drivers/net/ethernet/mellanox/mlxsw

Page 7: Switchdev - No More SDK

© 2016 Mellanox Technologies 7

Switchdev is here to stay

Devlinkset port type, port splitter, shared buffers, etc.

What?

Page 8: Switchdev - No More SDK

© 2016 Mellanox Technologies 8

Switchdev is here to stay

QoS, Shared bufferDCBNL interface implementation

What?

Page 9: Switchdev - No More SDK

© 2016 Mellanox Technologies 9

Switchdev is here to stay

L3 offloadfix the current switchdev model, include VRF support

What?

Page 10: Switchdev - No More SDK

© 2016 Mellanox Technologies 10

Switchdev is here to stay

What?

Why?

Where?

pen

Page 11: Switchdev - No More SDK

© 2016 Mellanox Technologies 11

Switchdev is here to stay

Why?

Community based

Open-source

Standard behavior

Standard API

Page 12: Switchdev - No More SDK

© 2016 Mellanox Technologies 12

Switchdev is here to stay

What?

Why?

Where?

Page 13: Switchdev - No More SDK

© 2016 Mellanox Technologies 13

Switchdev is here to stay

Where?

Flowstc cls_flower + selected acts offload

Page 14: Switchdev - No More SDK

© 2016 Mellanox Technologies 14

Switchdev is here to stay

Where?

(e)BPF?

Page 15: Switchdev - No More SDK

© 2016 Mellanox Technologies 15

SWITCHDEV

commit 007f790c8276271de26416f90d55561bcc96588a

Author: Jiri Pirko <[email protected]>

Date: Fri Nov 28 14:34:17 2014 +0100

net: introduce generic switch devices support

The goal of this is to provide a possibility to support various switch

chips. Drivers should implement relevant ndos to do so. Now there is

only one ndo defined:

- for getting physical switch id is in place.

Note that user can use random port netdevice to access the switch.

Signed-off-by: Jiri Pirko <[email protected]>

Reviewed-by: Thomas Graf <[email protected]>

Acked-by: Andy Gospodarek <[email protected]>

Signed-off-by: David S. Miller <[email protected]>

Page 16: Switchdev - No More SDK

© 2016 Mellanox Technologies 16

ROCKER

commit 4b8ac9660af07be6f6602b523929793eed314997

Author: Jiri Pirko <[email protected]>

Date: Fri Nov 28 14:34:26 2014 +0100

rocker: introduce rocker switch driver

This patch introduces the first driver to benefit from the switchdev

infrastructure and to implement newly introduced switch ndos. This is a

driver for emulated switch chip implemented in qemu:

https://github.com/sfeldma/qemu-rocker/

This patch is a result of joint work with Scott Feldman.

Signed-off-by: Scott Feldman <[email protected]>

Signed-off-by: Jiri Pirko <[email protected]>

Reviewed-by: Thomas Graf <[email protected]>

Reviewed-by: John Fastabend <[email protected]>

Signed-off-by: David S. Miller <[email protected]>

Page 17: Switchdev - No More SDK

© 2016 Mellanox Technologies 17

MLXSW

commit 93c1edb27f9e7ef7f276b91763c93242bbda71cb

Author: Jiri Pirko <[email protected]>

Date: Wed Jul 29 23:33:46 2015 +0200

mlxsw: Introduce Mellanox switch driver core

Add core components of Mellanox switch driver infrastructure.

Core infrastructure is designed so that it can be used by multiple

bus drivers (PCI now, I2C and SGMII are planned to be implemented

in the future). Multiple switch kind drivers can be registered as well.

This core serves as a glue between buses and drivers.

Signed-off-by: Jiri Pirko <[email protected]>

Signed-off-by: Ido Schimmel <[email protected]>

Signed-off-by: Elad Raz <[email protected]>

Reviewed-by: Scott Feldman <[email protected]>

Signed-off-by: David S. Miller <[email protected]>

Page 18: Switchdev - No More SDK

© 2016 Mellanox Technologies 18

ndo_ops

static const struct net_device_ops mlxsw_sp_port_netdev_ops = {

.ndo_open = mlxsw_sp_port_open,

.ndo_stop = mlxsw_sp_port_stop,

.ndo_start_xmit = mlxsw_sp_port_xmit,

.ndo_set_rx_mode = mlxsw_sp_set_rx_mode,

.ndo_set_mac_address = mlxsw_sp_port_set_mac_address,

.ndo_change_mtu = mlxsw_sp_port_change_mtu,

.ndo_get_stats64 = mlxsw_sp_port_get_stats64,

.ndo_vlan_rx_add_vid = mlxsw_sp_port_add_vid,

.ndo_vlan_rx_kill_vid = mlxsw_sp_port_kill_vid,

.ndo_fdb_add = switchdev_port_fdb_add,

.ndo_fdb_del = switchdev_port_fdb_del,

.ndo_fdb_dump = switchdev_port_fdb_dump,

.ndo_bridge_setlink = switchdev_port_bridge_setlink,

.ndo_bridge_getlink = switchdev_port_bridge_getlink,

.ndo_bridge_dellink = switchdev_port_bridge_dellink,

};

Page 19: Switchdev - No More SDK

© 2016 Mellanox Technologies 19

switchdev_ops

static const struct switchdev_ops mlxsw_sp_port_switchdev_ops = {

.switchdev_port_attr_get = mlxsw_sp_port_attr_get,

.switchdev_port_attr_set = mlxsw_sp_port_attr_set,

.switchdev_port_obj_add = mlxsw_sp_port_obj_add,

.switchdev_port_obj_del = mlxsw_sp_port_obj_del,

.switchdev_port_obj_dump = mlxsw_sp_port_obj_dump,

};

Page 20: Switchdev - No More SDK

© 2016 Mellanox Technologies 20

switchdev_attr

enum switchdev_attr_id {

SWITCHDEV_ATTR_ID_UNDEFINED,

SWITCHDEV_ATTR_ID_PORT_PARENT_ID,

SWITCHDEV_ATTR_ID_PORT_STP_STATE,

SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS,

SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME,

SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING,

};

struct switchdev_attr {

struct net_device *orig_dev;

enum switchdev_attr_id id;

u32 flags;

void *complete_priv;

void (*complete)(struct net_device *dev, int err, void *priv);

union {

struct netdev_phys_item_id ppid; /* PORT_PARENT_ID */

u8 stp_state; /* PORT_STP_STATE */

unsigned long brport_flags; /* PORT_BRIDGE_FLAGS */

u32 ageing_time; /* BRIDGE_AGEING_TIME */

bool vlan_filtering; /* BRIDGE_VLAN_FILTERING */

} u;

};

Page 21: Switchdev - No More SDK

© 2016 Mellanox Technologies 21

switchdev_obj

enum switchdev_obj_id {

SWITCHDEV_OBJ_ID_UNDEFINED,

SWITCHDEV_OBJ_ID_PORT_VLAN,

SWITCHDEV_OBJ_ID_IPV4_FIB,

SWITCHDEV_OBJ_ID_PORT_FDB,

SWITCHDEV_OBJ_ID_PORT_MDB,

};

struct switchdev_obj {

struct net_device *orig_dev;

enum switchdev_obj_id id;

u32 flags;

void *complete_priv;

void (*complete)(struct net_device *dev, int err, void *priv);

};

/* SWITCHDEV_OBJ_ID_PORT_FDB */

struct switchdev_obj_port_fdb {

struct switchdev_obj obj;

unsigned char addr[ETH_ALEN];

u16 vid;

u16 ndm_state;

};

Page 22: Switchdev - No More SDK

© 2016 Mellanox Technologies 22

call_switchdev_notifiers

info.addr = mac;

info.vid = vid;

notifier_type = adding ? SWITCHDEV_FDB_ADD : SWITCHDEV_FDB_DEL;

call_switchdev_notifiers(notifier_type, dev, &info.info);

Page 23: Switchdev - No More SDK

© 2016 Mellanox Technologies 23

NETDEV_CHANGEUPPER

register_netdevice_notifier informs using

NETDEV_(PRE)CHANGEUPPER about:

• VLANs

• Bridges

• LAGs (Team/bond)

Page 24: Switchdev - No More SDK

Thank You