Release 4.11 net/dsa/slave.c
/*
* net/dsa/slave.c - Slave device handling
* Copyright (c) 2008-2009 Marvell Semiconductor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/list.h>
#include <linux/etherdevice.h>
#include <linux/netdevice.h>
#include <linux/phy.h>
#include <linux/phy_fixed.h>
#include <linux/of_net.h>
#include <linux/of_mdio.h>
#include <linux/mdio.h>
#include <linux/list.h>
#include <net/rtnetlink.h>
#include <net/switchdev.h>
#include <net/pkt_cls.h>
#include <net/tc_act/tc_mirred.h>
#include <linux/if_bridge.h>
#include <linux/netpoll.h>
#include "dsa_priv.h"
static bool dsa_slave_dev_check(struct net_device *dev);
static int dsa_slave_notify(struct net_device *dev, unsigned long e, void *v)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct raw_notifier_head *nh = &p->dp->ds->dst->nh;
int err;
err = raw_notifier_call_chain(nh, e, v);
return notifier_to_errno(err);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vivien Didelot | 65 | 100.00% | 1 | 100.00% |
Total | 65 | 100.00% | 1 | 100.00% |
/* slave mii_bus handling ***************************************************/
static int dsa_slave_phy_read(struct mii_bus *bus, int addr, int reg)
{
struct dsa_switch *ds = bus->priv;
if (ds->phys_mii_mask & (1 << addr))
return ds->ops->phy_read(ds, addr, reg);
return 0xffff;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Lennert Buytenhek | 53 | 96.36% | 1 | 33.33% |
Vivien Didelot | 1 | 1.82% | 1 | 33.33% |
Florian Fainelli | 1 | 1.82% | 1 | 33.33% |
Total | 55 | 100.00% | 3 | 100.00% |
static int dsa_slave_phy_write(struct mii_bus *bus, int addr, int reg, u16 val)
{
struct dsa_switch *ds = bus->priv;
if (ds->phys_mii_mask & (1 << addr))
return ds->ops->phy_write(ds, addr, reg, val);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Lennert Buytenhek | 58 | 96.67% | 1 | 33.33% |
Florian Fainelli | 1 | 1.67% | 1 | 33.33% |
Vivien Didelot | 1 | 1.67% | 1 | 33.33% |
Total | 60 | 100.00% | 3 | 100.00% |
void dsa_slave_mii_bus_init(struct dsa_switch *ds)
{
ds->slave_mii_bus->priv = (void *)ds;
ds->slave_mii_bus->name = "dsa slave smi";
ds->slave_mii_bus->read = dsa_slave_phy_read;
ds->slave_mii_bus->write = dsa_slave_phy_write;
snprintf(ds->slave_mii_bus->id, MII_BUS_ID_SIZE, "dsa-%d.%d",
ds->dst->tree, ds->index);
ds->slave_mii_bus->parent = ds->dev;
ds->slave_mii_bus->phy_mask = ~ds->phys_mii_mask;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Lennert Buytenhek | 70 | 77.78% | 1 | 20.00% |
Vivien Didelot | 11 | 12.22% | 1 | 20.00% |
Florian Fainelli | 8 | 8.89% | 2 | 40.00% |
Andrew Lunn | 1 | 1.11% | 1 | 20.00% |
Total | 90 | 100.00% | 5 | 100.00% |
/* slave device handling ****************************************************/
static int dsa_slave_get_iflink(const struct net_device *dev)
{
struct dsa_slave_priv *p = netdev_priv(dev);
return p->dp->ds->dst->master_netdev->ifindex;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Lennert Buytenhek | 29 | 82.86% | 2 | 50.00% |
Nicolas Dichtel | 3 | 8.57% | 1 | 25.00% |
Vivien Didelot | 3 | 8.57% | 1 | 25.00% |
Total | 35 | 100.00% | 4 | 100.00% |
static inline bool dsa_port_is_bridged(struct dsa_port *dp)
{
return !!dp->bridge_dev;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Florian Fainelli | 16 | 84.21% | 1 | 50.00% |
Vivien Didelot | 3 | 15.79% | 1 | 50.00% |
Total | 19 | 100.00% | 2 | 100.00% |
static void dsa_slave_set_state(struct net_device *dev, u8 state)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_port *dp = p->dp;
struct dsa_switch *ds = dp->ds;
int port = dp->index;
if (ds->ops->port_stp_state_set)
ds->ops->port_stp_state_set(ds, port, state);
if (ds->ops->port_fast_age) {
/* Fast age FDB entries or flush appropriate forwarding database
* for the given port, if we are moving it from Learning or
* Forwarding state, to Disabled or Blocking or Listening state.
*/
if ((dp->stp_state == BR_STATE_LEARNING ||
dp->stp_state == BR_STATE_FORWARDING) &&
(state == BR_STATE_DISABLED ||
state == BR_STATE_BLOCKING ||
state == BR_STATE_LISTENING))
ds->ops->port_fast_age(ds, port);
}
dp->stp_state = state;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vivien Didelot | 128 | 100.00% | 3 | 100.00% |
Total | 128 | 100.00% | 3 | 100.00% |
static int dsa_slave_open(struct net_device *dev)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct net_device *master = p->dp->ds->dst->master_netdev;
struct dsa_switch *ds = p->dp->ds;
u8 stp_state = dsa_port_is_bridged(p->dp) ?
BR_STATE_BLOCKING : BR_STATE_FORWARDING;
int err;
if (!(master->flags & IFF_UP))
return -ENETDOWN;
if (!ether_addr_equal(dev->dev_addr, master->dev_addr)) {
err = dev_uc_add(master, dev->dev_addr);
if (err < 0)
goto out;
}
if (dev->flags & IFF_ALLMULTI) {
err = dev_set_allmulti(master, 1);
if (err < 0)
goto del_unicast;
}
if (dev->flags & IFF_PROMISC) {
err = dev_set_promiscuity(master, 1);
if (err < 0)
goto clear_allmulti;
}
if (ds->ops->port_enable) {
err = ds->ops->port_enable(ds, p->dp->index, p->phy);
if (err)
goto clear_promisc;
}
dsa_slave_set_state(dev, stp_state);
if (p->phy)
phy_start(p->phy);
return 0;
clear_promisc:
if (dev->flags & IFF_PROMISC)
dev_set_promiscuity(master, -1);
clear_allmulti:
if (dev->flags & IFF_ALLMULTI)
dev_set_allmulti(master, -1);
del_unicast:
if (!ether_addr_equal(dev->dev_addr, master->dev_addr))
dev_uc_del(master, dev->dev_addr);
out:
return err;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Lennert Buytenhek | 188 | 63.09% | 3 | 23.08% |
Florian Fainelli | 87 | 29.19% | 3 | 23.08% |
Vivien Didelot | 15 | 5.03% | 4 | 30.77% |
Joe Perches | 4 | 1.34% | 1 | 7.69% |
Gilad Ben-Yossef | 2 | 0.67% | 1 | 7.69% |
Jiri Pirko | 2 | 0.67% | 1 | 7.69% |
Total | 298 | 100.00% | 13 | 100.00% |
static int dsa_slave_close(struct net_device *dev)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct net_device *master = p->dp->ds->dst->master_netdev;
struct dsa_switch *ds = p->dp->ds;
if (p->phy)
phy_stop(p->phy);
dev_mc_unsync(master, dev);
dev_uc_unsync(master, dev);
if (dev->flags & IFF_ALLMULTI)
dev_set_allmulti(master, -1);
if (dev->flags & IFF_PROMISC)
dev_set_promiscuity(master, -1);
if (!ether_addr_equal(dev->dev_addr, master->dev_addr))
dev_uc_del(master, dev->dev_addr);
if (ds->ops->port_disable)
ds->ops->port_disable(ds, p->dp->index, p->phy);
dsa_slave_set_state(dev, BR_STATE_DISABLED);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Lennert Buytenhek | 101 | 60.84% | 3 | 27.27% |
Florian Fainelli | 48 | 28.92% | 3 | 27.27% |
Vivien Didelot | 13 | 7.83% | 3 | 27.27% |
Jiri Pirko | 2 | 1.20% | 1 | 9.09% |
Joe Perches | 2 | 1.20% | 1 | 9.09% |
Total | 166 | 100.00% | 11 | 100.00% |
static void dsa_slave_change_rx_flags(struct net_device *dev, int change)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct net_device *master = p->dp->ds->dst->master_netdev;
if (change & IFF_ALLMULTI)
dev_set_allmulti(master, dev->flags & IFF_ALLMULTI ? 1 : -1);
if (change & IFF_PROMISC)
dev_set_promiscuity(master, dev->flags & IFF_PROMISC ? 1 : -1);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Lennert Buytenhek | 80 | 96.39% | 2 | 66.67% |
Vivien Didelot | 3 | 3.61% | 1 | 33.33% |
Total | 83 | 100.00% | 3 | 100.00% |
static void dsa_slave_set_rx_mode(struct net_device *dev)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct net_device *master = p->dp->ds->dst->master_netdev;
dev_mc_sync(master, dev);
dev_uc_sync(master, dev);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Lennert Buytenhek | 46 | 92.00% | 2 | 50.00% |
Vivien Didelot | 3 | 6.00% | 1 | 25.00% |
Jiri Pirko | 1 | 2.00% | 1 | 25.00% |
Total | 50 | 100.00% | 4 | 100.00% |
static int dsa_slave_set_mac_address(struct net_device *dev, void *a)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct net_device *master = p->dp->ds->dst->master_netdev;
struct sockaddr *addr = a;
int err;
if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL;
if (!(dev->flags & IFF_UP))
goto out;
if (!ether_addr_equal(addr->sa_data, master->dev_addr)) {
err = dev_uc_add(master, addr->sa_data);
if (err < 0)
return err;
}
if (!ether_addr_equal(dev->dev_addr, master->dev_addr))
dev_uc_del(master, dev->dev_addr);
out:
ether_addr_copy(dev->dev_addr, addr->sa_data);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Lennert Buytenhek | 99 | 64.71% | 3 | 42.86% |
Florian Fainelli | 48 | 31.37% | 1 | 14.29% |
Vivien Didelot | 3 | 1.96% | 1 | 14.29% |
Joe Perches | 2 | 1.31% | 1 | 14.29% |
Jiri Pirko | 1 | 0.65% | 1 | 14.29% |
Total | 153 | 100.00% | 7 | 100.00% |
static int dsa_slave_port_vlan_add(struct net_device *dev,
const struct switchdev_obj_port_vlan *vlan,
struct switchdev_trans *trans)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_port *dp = p->dp;
struct dsa_switch *ds = dp->ds;
if (switchdev_trans_ph_prepare(trans)) {
if (!ds->ops->port_vlan_prepare || !ds->ops->port_vlan_add)
return -EOPNOTSUPP;
return ds->ops->port_vlan_prepare(ds, dp->index, vlan, trans);
}
ds->ops->port_vlan_add(ds, dp->index, vlan, trans);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vivien Didelot | 106 | 90.60% | 6 | 66.67% |
Jiri Pirko | 11 | 9.40% | 3 | 33.33% |
Total | 117 | 100.00% | 9 | 100.00% |
static int dsa_slave_port_vlan_del(struct net_device *dev,
const struct switchdev_obj_port_vlan *vlan)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_switch *ds = p->dp->ds;
if (!ds->ops->port_vlan_del)
return -EOPNOTSUPP;
return ds->ops->port_vlan_del(ds, p->dp->index, vlan);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vivien Didelot | 68 | 98.55% | 5 | 83.33% |
Jiri Pirko | 1 | 1.45% | 1 | 16.67% |
Total | 69 | 100.00% | 6 | 100.00% |
static int dsa_slave_port_vlan_dump(struct net_device *dev,
struct switchdev_obj_port_vlan *vlan,
switchdev_obj_dump_cb_t *cb)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_switch *ds = p->dp->ds;
if (ds->ops->port_vlan_dump)
return ds->ops->port_vlan_dump(ds, p->dp->index, vlan, cb);
return -EOPNOTSUPP;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vivien Didelot | 71 | 97.26% | 5 | 71.43% |
Jiri Pirko | 2 | 2.74% | 2 | 28.57% |
Total | 73 | 100.00% | 7 | 100.00% |
static int dsa_slave_port_fdb_add(struct net_device *dev,
const struct switchdev_obj_port_fdb *fdb,
struct switchdev_trans *trans)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_switch *ds = p->dp->ds;
if (switchdev_trans_ph_prepare(trans)) {
if (!ds->ops->port_fdb_prepare || !ds->ops->port_fdb_add)
return -EOPNOTSUPP;
return ds->ops->port_fdb_prepare(ds, p->dp->index, fdb, trans);
}
ds->ops->port_fdb_add(ds, p->dp->index, fdb, trans);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vivien Didelot | 61 | 53.51% | 9 | 69.23% |
Guenter Roeck | 35 | 30.70% | 1 | 7.69% |
David S. Miller | 12 | 10.53% | 1 | 7.69% |
Jiri Pirko | 6 | 5.26% | 2 | 15.38% |
Total | 114 | 100.00% | 13 | 100.00% |
static int dsa_slave_port_fdb_del(struct net_device *dev,
const struct switchdev_obj_port_fdb *fdb)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_switch *ds = p->dp->ds;
int ret = -EOPNOTSUPP;
if (ds->ops->port_fdb_del)
ret = ds->ops->port_fdb_del(ds, p->dp->index, fdb);
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Guenter Roeck | 55 | 74.32% | 1 | 14.29% |
Vivien Didelot | 18 | 24.32% | 5 | 71.43% |
Jiri Pirko | 1 | 1.35% | 1 | 14.29% |
Total | 74 | 100.00% | 7 | 100.00% |
static int dsa_slave_port_fdb_dump(struct net_device *dev,
struct switchdev_obj_port_fdb *fdb,
switchdev_obj_dump_cb_t *cb)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_switch *ds = p->dp->ds;
if (ds->ops->port_fdb_dump)
return ds->ops->port_fdb_dump(ds, p->dp->index, fdb, cb);
return -EOPNOTSUPP;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vivien Didelot | 36 | 49.32% | 5 | 55.56% |
Guenter Roeck | 33 | 45.21% | 1 | 11.11% |
Jiri Pirko | 2 | 2.74% | 2 | 22.22% |
David S. Miller | 2 | 2.74% | 1 | 11.11% |
Total | 73 | 100.00% | 9 | 100.00% |
static int dsa_slave_port_mdb_add(struct net_device *dev,
const struct switchdev_obj_port_mdb *mdb,
struct switchdev_trans *trans)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_switch *ds = p->dp->ds;
if (switchdev_trans_ph_prepare(trans)) {
if (!ds->ops->port_mdb_prepare || !ds->ops->port_mdb_add)
return -EOPNOTSUPP;
return ds->ops->port_mdb_prepare(ds, p->dp->index, mdb, trans);
}
ds->ops->port_mdb_add(ds, p->dp->index, mdb, trans);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vivien Didelot | 114 | 100.00% | 2 | 100.00% |
Total | 114 | 100.00% | 2 | 100.00% |
static int dsa_slave_port_mdb_del(struct net_device *dev,
const struct switchdev_obj_port_mdb *mdb)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_switch *ds = p->dp->ds;
if (ds->ops->port_mdb_del)
return ds->ops->port_mdb_del(ds, p->dp->index, mdb);
return -EOPNOTSUPP;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vivien Didelot | 68 | 100.00% | 2 | 100.00% |
Total | 68 | 100.00% | 2 | 100.00% |
static int dsa_slave_port_mdb_dump(struct net_device *dev,
struct switchdev_obj_port_mdb *mdb,
switchdev_obj_dump_cb_t *cb)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_switch *ds = p->dp->ds;
if (ds->ops->port_mdb_dump)
return ds->ops->port_mdb_dump(ds, p->dp->index, mdb, cb);
return -EOPNOTSUPP;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vivien Didelot | 73 | 100.00% | 2 | 100.00% |
Total | 73 | 100.00% | 2 | 100.00% |
static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
struct dsa_slave_priv *p = netdev_priv(dev);
if (p->phy != NULL)
return phy_mii_ioctl(p->phy, ifr, cmd);
return -EOPNOTSUPP;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David S. Miller | 31 | 58.49% | 1 | 50.00% |
Florian Fainelli | 22 | 41.51% | 1 | 50.00% |
Total | 53 | 100.00% | 2 | 100.00% |
static int dsa_slave_stp_state_set(struct net_device *dev,
const struct switchdev_attr *attr,
struct switchdev_trans *trans)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_switch *ds = p->dp->ds;
if (switchdev_trans_ph_prepare(trans))
return ds->ops->port_stp_state_set ? 0 : -EOPNOTSUPP;
dsa_slave_set_state(dev, attr->u.stp_state);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Florian Fainelli | 40 | 52.63% | 1 | 20.00% |
Vivien Didelot | 36 | 47.37% | 4 | 80.00% |
Total | 76 | 100.00% | 5 | 100.00% |
static int dsa_slave_vlan_filtering(struct net_device *dev,
const struct switchdev_attr *attr,
struct switchdev_trans *trans)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_switch *ds = p->dp->ds;
/* bridge skips -EOPNOTSUPP, so skip the prepare phase */
if (switchdev_trans_ph_prepare(trans))
return 0;
if (ds->ops->port_vlan_filtering)
return ds->ops->port_vlan_filtering(ds, p->dp->index,
attr->u.vlan_filtering);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vivien Didelot | 87 | 100.00% | 3 | 100.00% |
Total | 87 | 100.00% | 3 | 100.00% |
static int dsa_fastest_ageing_time(struct dsa_switch *ds,
unsigned int ageing_time)
{
int i;
for (i = 0; i < ds->num_ports; ++i) {
struct dsa_port *dp = &ds->ports[i];
if (dp && dp->ageing_time && dp->ageing_time < ageing_time)
ageing_time = dp->ageing_time;
}
return ageing_time;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vivien Didelot | 71 | 100.00% | 2 | 100.00% |
Total | 71 | 100.00% | 2 | 100.00% |
static int dsa_slave_ageing_time(struct net_device *dev,
const struct switchdev_attr *attr,
struct switchdev_trans *trans)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_switch *ds = p->dp->ds;
unsigned long ageing_jiffies = clock_t_to_jiffies(attr->u.ageing_time);
unsigned int ageing_time = jiffies_to_msecs(ageing_jiffies);
/* bridge skips -EOPNOTSUPP, so skip the prepare phase */
if (switchdev_trans_ph_prepare(trans))
return 0;
/* Keep the fastest ageing time in case of multiple bridges */
p->dp->ageing_time = ageing_time;
ageing_time = dsa_fastest_ageing_time(ds, ageing_time);
if (ds->ops->set_ageing_time)
return ds->ops->set_ageing_time(ds, ageing_time);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vivien Didelot | 117 | 100.00% | 3 | 100.00% |
Total | 117 | 100.00% | 3 | 100.00% |
static int dsa_slave_port_attr_set(struct net_device *dev,
const struct switchdev_attr *attr,
struct switchdev_trans *trans)
{
int ret;
switch (attr->id) {
case SWITCHDEV_ATTR_ID_PORT_STP_STATE:
ret = dsa_slave_stp_state_set(dev, attr, trans);
break;
case SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING:
ret = dsa_slave_vlan_filtering(dev, attr, trans);
break;
case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME:
ret = dsa_slave_ageing_time(dev, attr, trans);
break;
default:
ret = -EOPNOTSUPP;
break;
}
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Scott Feldman | 37 | 42.05% | 1 | 11.11% |
Vivien Didelot | 36 | 40.91% | 4 | 44.44% |
David S. Miller | 8 | 9.09% | 1 | 11.11% |
Jiri Pirko | 7 | 7.95% | 3 | 33.33% |
Total | 88 | 100.00% | 9 | 100.00% |
static int dsa_slave_port_obj_add(struct net_device *dev,
const struct switchdev_obj *obj,
struct switchdev_trans *trans)
{
int err;
/* For the prepare phase, ensure the full set of changes is feasable in
* one go in order to signal a failure properly. If an operation is not
* supported, return -EOPNOTSUPP.
*/
switch (obj->id) {
case SWITCHDEV_OBJ_ID_PORT_FDB:
err = dsa_slave_port_fdb_add(dev,
SWITCHDEV_OBJ_PORT_FDB(obj),
trans);
break;
case SWITCHDEV_OBJ_ID_PORT_MDB:
err = dsa_slave_port_mdb_add(dev, SWITCHDEV_OBJ_PORT_MDB(obj),
trans);
break;
case SWITCHDEV_OBJ_ID_PORT_VLAN:
err = dsa_slave_port_vlan_add(dev,
SWITCHDEV_OBJ_PORT_VLAN(obj),
trans);
break;
default:
err = -EOPNOTSUPP;
break;
}
return err;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vivien Didelot | 77 | 78.57% | 4 | 44.44% |
Jiri Pirko | 21 | 21.43% | 5 | 55.56% |
Total | 98 | 100.00% | 9 | 100.00% |
static int dsa_slave_port_obj_del(struct net_device *dev,
const struct switchdev_obj *obj)
{
int err;
switch (obj->id) {
case SWITCHDEV_OBJ_ID_PORT_FDB:
err = dsa_slave_port_fdb_del(dev,
SWITCHDEV_OBJ_PORT_FDB(obj));
break;
case SWITCHDEV_OBJ_ID_PORT_MDB:
err = dsa_slave_port_mdb_del(dev, SWITCHDEV_OBJ_PORT_MDB(obj));
break;
case SWITCHDEV_OBJ_ID_PORT_VLAN:
err = dsa_slave_port_vlan_del(dev,
SWITCHDEV_OBJ_PORT_VLAN(obj));
break;
default:
err = -EOPNOTSUPP;
break;
}
return err;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vivien Didelot | 74 | 86.05% | 4 | 57.14% |
Jiri Pirko | 12 | 13.95% | 3 | 42.86% |
Total | 86 | 100.00% | 7 | 100.00% |
static int dsa_slave_port_obj_dump(struct net_device *dev,
struct switchdev_obj *obj,
switchdev_obj_dump_cb_t *cb)
{
int err;
switch (obj->id) {
case SWITCHDEV_OBJ_ID_PORT_FDB:
err = dsa_slave_port_fdb_dump(dev,
SWITCHDEV_OBJ_PORT_FDB(obj),
cb);
break;
case SWITCHDEV_OBJ_ID_PORT_MDB:
err = dsa_slave_port_mdb_dump(dev, SWITCHDEV_OBJ_PORT_MDB(obj),
cb);
break;
case SWITCHDEV_OBJ_ID_PORT_VLAN:
err = dsa_slave_port_vlan_dump(dev,
SWITCHDEV_OBJ_PORT_VLAN(obj),
cb);
break;
default:
err = -EOPNOTSUPP;
break;
}
return err;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vivien Didelot | 82 | 86.32% | 4 | 57.14% |
Jiri Pirko | 13 | 13.68% | 3 | 42.86% |
Total | 95 | 100.00% | 7 | 100.00% |
static int dsa_slave_bridge_port_join(struct net_device *dev,
struct net_device *br)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_notifier_bridge_info info = {
.sw_index = p->dp->ds->index,
.port = p->dp->index,
.br = br,
};
int err;
/* Here the port is already bridged. Reflect the current configuration
* so that drivers can program their chips accordingly.
*/
p->dp->bridge_dev = br;
err = dsa_slave_notify(dev, DSA_NOTIFIER_BRIDGE_JOIN, &info);
/* The bridging is rolled back on error */
if (err)
p->dp->bridge_dev = NULL;
return err;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vivien Didelot | 53 | 54.64% | 4 | 80.00% |
Florian Fainelli | 44 | 45.36% | 1 | 20.00% |
Total | 97 | 100.00% | 5 | 100.00% |
static void dsa_slave_bridge_port_leave(struct net_device *dev,
struct net_device *br)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_notifier_bridge_info info = {
.sw_index = p->dp->ds->index,
.port = p->dp->index,
.br = br,
};
int err;
/* Here the port is already unbridged. Reflect the current configuration
* so that drivers can program their chips accordingly.
*/
p->dp->bridge_dev = NULL;
err =