switchdev: add support for fdb add/del/dump via switchdev_port_obj ops.
- introduce port fdb obj and generic switchdev_port_fdb_add/del/dump() - use switchdev_port_fdb_add/del/dump in rocker/team/bonding ndo ops. - add support for fdb obj in switchdev_port_obj_add/del/dump() - switch rocker to implement fdb ops via switchdev_ops v3: updated to sync with named union changes. Signed-off-by: Sridhar Samudrala <sridhar.samudrala@intel.com> Signed-off-by: Scott Feldman <sfeldma@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
5d48ef3e95
commit
45d4122ca7
@@ -47,11 +47,13 @@ enum switchdev_obj_id {
|
||||
SWITCHDEV_OBJ_UNDEFINED,
|
||||
SWITCHDEV_OBJ_PORT_VLAN,
|
||||
SWITCHDEV_OBJ_IPV4_FIB,
|
||||
SWITCHDEV_OBJ_PORT_FDB,
|
||||
};
|
||||
|
||||
struct switchdev_obj {
|
||||
enum switchdev_obj_id id;
|
||||
enum switchdev_trans trans;
|
||||
int (*cb)(struct net_device *dev, struct switchdev_obj *obj);
|
||||
union {
|
||||
struct switchdev_obj_vlan { /* PORT_VLAN */
|
||||
u16 flags;
|
||||
@@ -67,6 +69,10 @@ struct switchdev_obj {
|
||||
u32 nlflags;
|
||||
u32 tb_id;
|
||||
} ipv4_fib;
|
||||
struct switchdev_obj_fdb { /* PORT_FDB */
|
||||
const unsigned char *addr;
|
||||
u16 vid;
|
||||
} fdb;
|
||||
} u;
|
||||
};
|
||||
|
||||
@@ -80,6 +86,8 @@ struct switchdev_obj {
|
||||
* @switchdev_port_obj_add: Add an object to port (see switchdev_obj).
|
||||
*
|
||||
* @switchdev_port_obj_del: Delete an object from port (see switchdev_obj).
|
||||
*
|
||||
* @switchdev_port_obj_dump: Dump port objects (see switchdev_obj).
|
||||
*/
|
||||
struct switchdev_ops {
|
||||
int (*switchdev_port_attr_get)(struct net_device *dev,
|
||||
@@ -90,6 +98,8 @@ struct switchdev_ops {
|
||||
struct switchdev_obj *obj);
|
||||
int (*switchdev_port_obj_del)(struct net_device *dev,
|
||||
struct switchdev_obj *obj);
|
||||
int (*switchdev_port_obj_dump)(struct net_device *dev,
|
||||
struct switchdev_obj *obj);
|
||||
};
|
||||
|
||||
enum switchdev_notifier_type {
|
||||
@@ -121,6 +131,7 @@ int switchdev_port_attr_set(struct net_device *dev,
|
||||
struct switchdev_attr *attr);
|
||||
int switchdev_port_obj_add(struct net_device *dev, struct switchdev_obj *obj);
|
||||
int switchdev_port_obj_del(struct net_device *dev, struct switchdev_obj *obj);
|
||||
int switchdev_port_obj_dump(struct net_device *dev, struct switchdev_obj *obj);
|
||||
int register_switchdev_notifier(struct notifier_block *nb);
|
||||
int unregister_switchdev_notifier(struct notifier_block *nb);
|
||||
int call_switchdev_notifiers(unsigned long val, struct net_device *dev,
|
||||
@@ -137,6 +148,15 @@ int switchdev_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi,
|
||||
int switchdev_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi,
|
||||
u8 tos, u8 type, u32 tb_id);
|
||||
void switchdev_fib_ipv4_abort(struct fib_info *fi);
|
||||
int switchdev_port_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
|
||||
struct net_device *dev, const unsigned char *addr,
|
||||
u16 vid, u16 nlm_flags);
|
||||
int switchdev_port_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
|
||||
struct net_device *dev, const unsigned char *addr,
|
||||
u16 vid);
|
||||
int switchdev_port_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,
|
||||
struct net_device *dev,
|
||||
struct net_device *filter_dev, int idx);
|
||||
|
||||
#else
|
||||
|
||||
@@ -164,6 +184,12 @@ static inline int switchdev_port_obj_del(struct net_device *dev,
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline int switchdev_port_obj_dump(struct net_device *dev,
|
||||
struct switchdev_obj *obj)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline int register_switchdev_notifier(struct notifier_block *nb)
|
||||
{
|
||||
return 0;
|
||||
@@ -221,6 +247,30 @@ static inline void switchdev_fib_ipv4_abort(struct fib_info *fi)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int switchdev_port_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
|
||||
struct net_device *dev,
|
||||
const unsigned char *addr,
|
||||
u16 vid, u16 nlm_flags)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline int switchdev_port_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
|
||||
struct net_device *dev,
|
||||
const unsigned char *addr, u16 vid)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline int switchdev_port_fdb_dump(struct sk_buff *skb,
|
||||
struct netlink_callback *cb,
|
||||
struct net_device *dev,
|
||||
struct net_device *filter_dev,
|
||||
int idx)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_SWITCHDEV_H_ */
|
||||
|
||||
Reference in New Issue
Block a user