[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE4R7bDBasLS3s7Q8ehgFzfV-mZYCoOgbCm-qpFgkVhoAMe=UA@mail.gmail.com>
Date: Tue, 14 Apr 2015 00:59:32 -0700
From: Scott Feldman <sfeldma@...il.com>
To: roopa <roopa@...ulusnetworks.com>
Cc: Netdev <netdev@...r.kernel.org>,
Jiří Pírko <jiri@...nulli.us>,
Guenter Roeck <linux@...ck-us.net>,
Florian Fainelli <f.fainelli@...il.com>,
"Samudrala, Sridhar" <sridhar.samudrala@...el.com>,
"Arad, Ronen" <ronen.arad@...el.com>,
"andrew@...n.ch" <andrew@...n.ch>
Subject: Re: [PATCH net-next v4 19/24] switchdev: add new swdev_port_bridge_getlink
On Mon, Apr 13, 2015 at 10:47 PM, roopa <roopa@...ulusnetworks.com> wrote:
> On 4/12/15, 11:17 PM, sfeldma@...il.com wrote:
>>
>> From: Scott Feldman <sfeldma@...il.com>
>>
>> Like bridge_setlink, add swdev wrapper to handle bridge_getlink and call
>> into
>> port driver to get port attrs. For now, only BR_LEARNING and
>> BR_LEARNING_SYNC
>> are returned. To add more, we'll probably want to break away from
>> ndo_dflt_bridge_getlink() and build the netlink skb directly in the swdev
>> code.
>>
>> Signed-off-by: Scott Feldman <sfeldma@...il.com>
>> ---
>> include/net/switchdev.h | 9 +++++++++
>> net/switchdev/switchdev.c | 27 +++++++++++++++++++++++++++
>> 2 files changed, 36 insertions(+)
>>
>> diff --git a/include/net/switchdev.h b/include/net/switchdev.h
>> index 8c9814f..d04322e 100644
>> --- a/include/net/switchdev.h
>> +++ b/include/net/switchdev.h
>> @@ -121,6 +121,8 @@ int swdev_port_attr_get(struct net_device *dev, struct
>> swdev_attr *attr);
>> int swdev_port_attr_set(struct net_device *dev, struct swdev_attr
>> *attr);
>> int swdev_port_obj_add(struct net_device *dev, struct swdev_obj *obj);
>> int swdev_port_obj_del(struct net_device *dev, struct swdev_obj *obj);
>> +int swdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
>> + struct net_device *dev, u32 filter_mask);
>> int swdev_port_bridge_setlink(struct net_device *dev, struct nlmsghdr
>> *nlh,
>> u16 flags);
>> int swdev_port_bridge_dellink(struct net_device *dev, struct nlmsghdr
>> *nlh,
>> @@ -161,6 +163,13 @@ static inline int swdev_port_obj_del(struct
>> net_device *dev,
>> return -EOPNOTSUPP;
>> }
>> +static inline int swdev_port_bridge_getlink(struct sk_buff *skb, u32
>> pid,
>> + u32 seq, struct net_device
>> *dev,
>> + u32 filter_mask)
>> +{
>> + return -EOPNOTSUPP;
>> +}
>> +
>> static inline int swdev_port_bridge_setlink(struct net_device *dev,
>> struct nlmsghdr *nlh, u16
>> flags)
>> {
>> diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
>> index ae0ed06..6866e0c 100644
>> --- a/net/switchdev/switchdev.c
>> +++ b/net/switchdev/switchdev.c
>> @@ -371,6 +371,33 @@ int call_netdev_switch_notifiers(unsigned long val,
>> struct net_device *dev,
>> }
>> EXPORT_SYMBOL_GPL(call_netdev_switch_notifiers);
>> +/**
>> + * swdev_port_bridge_getlink - Get bridge port attributes
>> + *
>> + * @dev: port device
>> + *
>> + * Called for SELF on rtnl_bridge_getlink to get bridge port
>> + * attributes.
>> + */
>> +int swdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
>> + struct net_device *dev, u32 filter_mask)
>> +{
>> + struct swdev_attr attr = {
>> + .id = SWDEV_ATTR_PORT_BRIDGE_FLAGS,
>> + };
>> + u16 mode = BRIDGE_MODE_UNDEF;
>> + u32 mask = BR_LEARNING | BR_LEARNING_SYNC;
>> + int err;
>> +
>> + err = swdev_port_attr_get(dev, &attr);
>> + if (err)
>> + return err;
>> +
>> + return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode,
>> + attr.brport_flags, mask);
>> +}
>> +EXPORT_SYMBOL_GPL(swdev_port_bridge_getlink);
>
>
> This should ideally get vlans as well because setlink/dellink supports
> add/del vlans.
> This can however be an incremental patch. I think this was the point arad
> was making as well some time back.
Ronan (Arad) has this patch ready but he's waiting on my patchset to
go in before he submits it.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists