[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87zia7rg6x.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>
Date: Wed, 06 Sep 2017 11:37:42 -0400
From: Vivien Didelot <vivien.didelot@...oirfairelinux.com>
To: Andrew Lunn <andrew@...n.ch>, netdev <netdev@...r.kernel.org>
Cc: jiri@...nulli.us, nikolay@...ulusnetworks.com,
Florian Fainelli <f.fainelli@...il.com>,
Andrew Lunn <andrew@...n.ch>
Subject: Re: [PATCH v2 rfc 4/8] net: dsa: slave: Handle switchdev host mdb add/del
Hi Andrew,
Andrew Lunn <andrew@...n.ch> writes:
> Add code to handle switchdev host mdb add/del. As with normal mdb
> add/del, send a notification to the switch layer.
>
> Signed-off-by: Andrew Lunn <andrew@...n.ch>
> ---
> net/dsa/dsa_priv.h | 7 +++++++
> net/dsa/port.c | 26 ++++++++++++++++++++++++++
> net/dsa/slave.c | 6 ++++++
> 3 files changed, 39 insertions(+)
>
> diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
> index 9c3eeb72462d..0ffe49f78d14 100644
> --- a/net/dsa/dsa_priv.h
> +++ b/net/dsa/dsa_priv.h
> @@ -24,6 +24,8 @@ enum {
> DSA_NOTIFIER_FDB_DEL,
> DSA_NOTIFIER_MDB_ADD,
> DSA_NOTIFIER_MDB_DEL,
> + DSA_NOTIFIER_HOST_MDB_ADD,
> + DSA_NOTIFIER_HOST_MDB_DEL,
> DSA_NOTIFIER_VLAN_ADD,
> DSA_NOTIFIER_VLAN_DEL,
> };
> @@ -131,6 +133,11 @@ int dsa_port_mdb_add(struct dsa_port *dp,
> struct switchdev_trans *trans);
> int dsa_port_mdb_del(struct dsa_port *dp,
> const struct switchdev_obj_port_mdb *mdb);
> +int dsa_host_mdb_add(struct dsa_port *dp,
> + const struct switchdev_obj_port_mdb *mdb,
> + struct switchdev_trans *trans);
> +int dsa_host_mdb_del(struct dsa_port *dp,
> + const struct switchdev_obj_port_mdb *mdb);
> int dsa_port_vlan_add(struct dsa_port *dp,
> const struct switchdev_obj_port_vlan *vlan,
> struct switchdev_trans *trans);
> diff --git a/net/dsa/port.c b/net/dsa/port.c
> index 659676ba3f8b..5b18b9fe2219 100644
> --- a/net/dsa/port.c
> +++ b/net/dsa/port.c
> @@ -199,6 +199,32 @@ int dsa_port_mdb_del(struct dsa_port *dp,
> return dsa_port_notify(dp, DSA_NOTIFIER_MDB_DEL, &info);
> }
>
> +int dsa_host_mdb_add(struct dsa_port *dp,
> + const struct switchdev_obj_port_mdb *mdb,
> + struct switchdev_trans *trans)
> +{
> + struct dsa_notifier_mdb_info info = {
> + .sw_index = dp->ds->index,
> + .port = dp->index,
> + .trans = trans,
> + .mdb = mdb,
> + };
> +
> + return dsa_port_notify(dp, DSA_NOTIFIER_HOST_MDB_ADD, &info);
> +}
> +
> +int dsa_host_mdb_del(struct dsa_port *dp,
> + const struct switchdev_obj_port_mdb *mdb)
> +{
> + struct dsa_notifier_mdb_info info = {
> + .sw_index = dp->ds->index,
> + .port = dp->index,
> + .mdb = mdb,
> + };
> +
> + return dsa_port_notify(dp, DSA_NOTIFIER_HOST_MDB_DEL, &info);
> +}
> +
> int dsa_port_vlan_add(struct dsa_port *dp,
> const struct switchdev_obj_port_vlan *vlan,
> struct switchdev_trans *trans)
> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> index 78e78a6e6833..2e07be149415 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/slave.c
> @@ -330,6 +330,9 @@ static int dsa_slave_port_obj_add(struct net_device *dev,
> case SWITCHDEV_OBJ_ID_PORT_MDB:
> err = dsa_port_mdb_add(dp, SWITCHDEV_OBJ_PORT_MDB(obj), trans);
> break;
> + case SWITCHDEV_OBJ_ID_HOST_MDB:
> + err = dsa_host_mdb_add(dp, SWITCHDEV_OBJ_PORT_MDB(obj), trans);
> + break;
If SWITCHDEV_OBJ_ID_HOST_MDB is really necessary,
case SWITCHDEV_OBJ_ID_HOST_MDB:
err = dsa_port_mdb_add(dp->cpu_dp, SWITCHDEV_OBJ_PORT_MDB(obj), trans);
break;
should be enough. DSA_NOTIFIER_HOST_MDB_* are not necessary.
Thanks,
Vivien
Powered by blists - more mailing lists