Skip to content

Commit cbc2465

Browse files
committed
Merge branch 'rocker-next'
Jiri Pirko says: ==================== introduce rocker switch driver with hardware accelerated datapath api - phase 1: bridge fdb offload This patchset is just the first phase of switch and switch-ish device support api in kernel. Note that the api will extend. So what this patchset includes: - introduce switchdev api skeleton for implementing switch drivers - introduce rocker switch driver which implements switchdev api fdb and bridge set/get link ndos As to the discussion if there is need to have specific class of device representing the switch itself, so far we found no need to introduce that. But we are generally ok with the idea and when the time comes and it will be needed, it can be easily introduced without any disturbance. This patchset introduces switch id export through rtnetlink and sysfs, which is similar to what we have for port id in SR-IOV. I will send iproute2 patchset for showing the switch id for port netdevs once this is applied. This applies also for the PF_BRIDGE and fdb iproute2 patches. iproute2 patches are now available here: https://github.com/jpirko/iproute2-rocker For detailed description and version history, please see individual patches. In v4 I reordered the patches leaving rocker patches on the end of the patchset. In v5 I only fixed whitespace issues of patch #13 We have a TODO for related items we want to work on in near future: https://etherpad.wikimedia.org/p/netdev-swdev-todo ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents cd4c910 + 51ace88 commit cbc2465

File tree

35 files changed

+5366
-105
lines changed

35 files changed

+5366
-105
lines changed

Documentation/ABI/testing/sysfs-class-net

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,11 @@ Contact: [email protected]
216216
Description:
217217
Indicates the interface protocol type as a decimal value. See
218218
include/uapi/linux/if_arp.h for all possible values.
219+
220+
What: /sys/class/net/<iface>/phys_switch_id
221+
Date: November 2014
222+
KernelVersion: 3.19
223+
224+
Description:
225+
Indicates the unique physical switch identifier of a switch this
226+
port belongs to, as a string.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
Switch (and switch-ish) device drivers HOWTO
2+
===========================
3+
4+
Please note that the word "switch" is here used in very generic meaning.
5+
This include devices supporting L2/L3 but also various flow offloading chips,
6+
including switches embedded into SR-IOV NICs.
7+
8+
Lets describe a topology a bit. Imagine the following example:
9+
10+
+----------------------------+ +---------------+
11+
| SOME switch chip | | CPU |
12+
+----------------------------+ +---------------+
13+
port1 port2 port3 port4 MNGMNT | PCI-E |
14+
| | | | | +---------------+
15+
PHY PHY | | | | NIC0 NIC1
16+
| | | | | |
17+
| | +- PCI-E -+ | |
18+
| +------- MII -------+ |
19+
+------------- MII ------------+
20+
21+
In this example, there are two independent lines between the switch silicon
22+
and CPU. NIC0 and NIC1 drivers are not aware of a switch presence. They are
23+
separate from the switch driver. SOME switch chip is by managed by a driver
24+
via PCI-E device MNGMNT. Note that MNGMNT device, NIC0 and NIC1 may be
25+
connected to some other type of bus.
26+
27+
Now, for the previous example show the representation in kernel:
28+
29+
+----------------------------+ +---------------+
30+
| SOME switch chip | | CPU |
31+
+----------------------------+ +---------------+
32+
sw0p0 sw0p1 sw0p2 sw0p3 MNGMNT | PCI-E |
33+
| | | | | +---------------+
34+
PHY PHY | | | | eth0 eth1
35+
| | | | | |
36+
| | +- PCI-E -+ | |
37+
| +------- MII -------+ |
38+
+------------- MII ------------+
39+
40+
Lets call the example switch driver for SOME switch chip "SOMEswitch". This
41+
driver takes care of PCI-E device MNGMNT. There is a netdevice instance sw0pX
42+
created for each port of a switch. These netdevices are instances
43+
of "SOMEswitch" driver. sw0pX netdevices serve as a "representation"
44+
of the switch chip. eth0 and eth1 are instances of some other existing driver.
45+
46+
The only difference of the switch-port netdevice from the ordinary netdevice
47+
is that is implements couple more NDOs:
48+
49+
ndo_switch_parent_id_get - This returns the same ID for two port netdevices
50+
of the same physical switch chip. This is
51+
mandatory to be implemented by all switch drivers
52+
and serves the caller for recognition of a port
53+
netdevice.
54+
ndo_switch_parent_* - Functions that serve for a manipulation of the switch
55+
chip itself (it can be though of as a "parent" of the
56+
port, therefore the name). They are not port-specific.
57+
Caller might use arbitrary port netdevice of the same
58+
switch and it will make no difference.
59+
ndo_switch_port_* - Functions that serve for a port-specific manipulation.

MAINTAINERS

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7865,6 +7865,13 @@ F: drivers/hid/hid-roccat*
78657865
F: include/linux/hid-roccat*
78667866
F: Documentation/ABI/*/sysfs-driver-hid-roccat*
78677867

7868+
ROCKER DRIVER
7869+
M: Jiri Pirko <[email protected]>
7870+
M: Scott Feldman <[email protected]>
7871+
7872+
S: Supported
7873+
F: drivers/net/ethernet/rocker/
7874+
78687875
ROCKETPORT DRIVER
78697876
P: Comtrol Corp.
78707877
W: http://www.comtrol.com
@@ -9059,6 +9066,13 @@ F: lib/swiotlb.c
90599066
F: arch/*/kernel/pci-swiotlb.c
90609067
F: include/linux/swiotlb.h
90619068

9069+
SWITCHDEV
9070+
M: Jiri Pirko <[email protected]>
9071+
9072+
S: Supported
9073+
F: net/switchdev/
9074+
F: include/net/switchdev.h
9075+
90629076
SYNOPSYS ARC ARCHITECTURE
90639077
M: Vineet Gupta <[email protected]>
90649078
S: Supported

drivers/net/ethernet/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ source "drivers/net/ethernet/qualcomm/Kconfig"
155155
source "drivers/net/ethernet/realtek/Kconfig"
156156
source "drivers/net/ethernet/renesas/Kconfig"
157157
source "drivers/net/ethernet/rdc/Kconfig"
158+
source "drivers/net/ethernet/rocker/Kconfig"
158159

159160
config S6GMAC
160161
tristate "S6105 GMAC ethernet support"

drivers/net/ethernet/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ obj-$(CONFIG_NET_VENDOR_QUALCOMM) += qualcomm/
6565
obj-$(CONFIG_NET_VENDOR_REALTEK) += realtek/
6666
obj-$(CONFIG_SH_ETH) += renesas/
6767
obj-$(CONFIG_NET_VENDOR_RDC) += rdc/
68+
obj-$(CONFIG_NET_VENDOR_ROCKER) += rocker/
6869
obj-$(CONFIG_S6GMAC) += s6gmac.o
6970
obj-$(CONFIG_NET_VENDOR_SAMSUNG) += samsung/
7071
obj-$(CONFIG_NET_VENDOR_SEEQ) += seeq/

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12537,7 +12537,7 @@ static int bnx2x_validate_addr(struct net_device *dev)
1253712537
}
1253812538

1253912539
static int bnx2x_get_phys_port_id(struct net_device *netdev,
12540-
struct netdev_phys_port_id *ppid)
12540+
struct netdev_phys_item_id *ppid)
1254112541
{
1254212542
struct bnx2x *bp = netdev_priv(netdev);
1254312543

drivers/net/ethernet/emulex/benet/be_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4367,7 +4367,8 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
43674367

43684368
return ndo_dflt_bridge_getlink(skb, pid, seq, dev,
43694369
hsw_mode == PORT_FWD_TYPE_VEPA ?
4370-
BRIDGE_MODE_VEPA : BRIDGE_MODE_VEB);
4370+
BRIDGE_MODE_VEPA : BRIDGE_MODE_VEB,
4371+
0, 0);
43714372
}
43724373

43734374
#ifdef CONFIG_BE2NET_VXLAN

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7511,7 +7511,7 @@ static void i40e_del_vxlan_port(struct net_device *netdev,
75117511

75127512
#endif
75137513
static int i40e_get_phys_port_id(struct net_device *netdev,
7514-
struct netdev_phys_port_id *ppid)
7514+
struct netdev_phys_item_id *ppid)
75157515
{
75167516
struct i40e_netdev_priv *np = netdev_priv(netdev);
75177517
struct i40e_pf *pf = np->vsi->back;
@@ -7536,7 +7536,7 @@ static int i40e_get_phys_port_id(struct net_device *netdev,
75367536
*/
75377537
static int i40e_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
75387538
struct net_device *dev,
7539-
const unsigned char *addr,
7539+
const unsigned char *addr, u16 vid,
75407540
u16 flags)
75417541
{
75427542
struct i40e_netdev_priv *np = netdev_priv(dev);

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7708,7 +7708,7 @@ static int ixgbe_set_features(struct net_device *netdev,
77087708

77097709
static int ixgbe_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
77107710
struct net_device *dev,
7711-
const unsigned char *addr,
7711+
const unsigned char *addr, u16 vid,
77127712
u16 flags)
77137713
{
77147714
/* guarantee we can provide a unique filter for the unicast address */
@@ -7717,7 +7717,7 @@ static int ixgbe_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
77177717
return -ENOMEM;
77187718
}
77197719

7720-
return ndo_dflt_fdb_add(ndm, tb, dev, addr, flags);
7720+
return ndo_dflt_fdb_add(ndm, tb, dev, addr, vid, flags);
77217721
}
77227722

77237723
static int ixgbe_ndo_bridge_setlink(struct net_device *dev,
@@ -7778,7 +7778,7 @@ static int ixgbe_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
77787778
else
77797779
mode = BRIDGE_MODE_VEPA;
77807780

7781-
return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode);
7781+
return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0);
77827782
}
77837783

77847784
static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev)

drivers/net/ethernet/mellanox/mlx4/en_netdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2259,7 +2259,7 @@ static int mlx4_en_set_vf_link_state(struct net_device *dev, int vf, int link_st
22592259

22602260
#define PORT_ID_BYTE_LEN 8
22612261
static int mlx4_en_get_phys_port_id(struct net_device *dev,
2262-
struct netdev_phys_port_id *ppid)
2262+
struct netdev_phys_item_id *ppid)
22632263
{
22642264
struct mlx4_en_priv *priv = netdev_priv(dev);
22652265
struct mlx4_dev *mdev = priv->mdev->dev;

drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,13 +376,14 @@ static int qlcnic_set_mac(struct net_device *netdev, void *p)
376376
}
377377

378378
static int qlcnic_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
379-
struct net_device *netdev, const unsigned char *addr)
379+
struct net_device *netdev,
380+
const unsigned char *addr, u16 vid)
380381
{
381382
struct qlcnic_adapter *adapter = netdev_priv(netdev);
382383
int err = -EOPNOTSUPP;
383384

384385
if (!adapter->fdb_mac_learn)
385-
return ndo_dflt_fdb_del(ndm, tb, netdev, addr);
386+
return ndo_dflt_fdb_del(ndm, tb, netdev, addr, vid);
386387

387388
if ((adapter->flags & QLCNIC_ESWITCH_ENABLED) ||
388389
qlcnic_sriov_check(adapter)) {
@@ -401,13 +402,13 @@ static int qlcnic_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
401402

402403
static int qlcnic_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
403404
struct net_device *netdev,
404-
const unsigned char *addr, u16 flags)
405+
const unsigned char *addr, u16 vid, u16 flags)
405406
{
406407
struct qlcnic_adapter *adapter = netdev_priv(netdev);
407408
int err = 0;
408409

409410
if (!adapter->fdb_mac_learn)
410-
return ndo_dflt_fdb_add(ndm, tb, netdev, addr, flags);
411+
return ndo_dflt_fdb_add(ndm, tb, netdev, addr, vid, flags);
411412

412413
if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED) &&
413414
!qlcnic_sriov_check(adapter)) {
@@ -460,7 +461,7 @@ static void qlcnic_82xx_cancel_idc_work(struct qlcnic_adapter *adapter)
460461
}
461462

462463
static int qlcnic_get_phys_port_id(struct net_device *netdev,
463-
struct netdev_phys_port_id *ppid)
464+
struct netdev_phys_item_id *ppid)
464465
{
465466
struct qlcnic_adapter *adapter = netdev_priv(netdev);
466467
struct qlcnic_hardware_context *ahw = adapter->ahw;

drivers/net/ethernet/rocker/Kconfig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#
2+
# Rocker device configuration
3+
#
4+
5+
config NET_VENDOR_ROCKER
6+
bool "Rocker devices"
7+
default y
8+
---help---
9+
If you have a network device belonging to this class, say Y.
10+
11+
Note that the answer to this question doesn't directly affect the
12+
kernel: saying N will just cause the configurator to skip all
13+
the questions about Rocker devices. If you say Y, you will be asked for
14+
your specific card in the following questions.
15+
16+
if NET_VENDOR_ROCKER
17+
18+
config ROCKER
19+
tristate "Rocker switch driver (EXPERIMENTAL)"
20+
depends on PCI && NET_SWITCHDEV
21+
---help---
22+
This driver supports Rocker switch device.
23+
24+
To compile this driver as a module, choose M here: the
25+
module will be called rocker.
26+
27+
endif # NET_VENDOR_ROCKER

drivers/net/ethernet/rocker/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#
2+
# Makefile for the Rocker network device drivers.
3+
#
4+
5+
obj-$(CONFIG_ROCKER) += rocker.o

0 commit comments

Comments
 (0)