bridge: add flags argument to ndo_bridge_setlink and ndo_bridge_dellink
[deliverable/linux.git] / include / net / switchdev.h
CommitLineData
007f790c
JP
1/*
2 * include/net/switchdev.h - Switch device API
3 * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 */
10#ifndef _LINUX_SWITCHDEV_H_
11#define _LINUX_SWITCHDEV_H_
12
13#include <linux/netdevice.h>
03bf0c28
JP
14#include <linux/notifier.h>
15
3aeb6617
JP
16enum netdev_switch_notifier_type {
17 NETDEV_SWITCH_FDB_ADD = 1,
18 NETDEV_SWITCH_FDB_DEL,
19};
20
03bf0c28
JP
21struct netdev_switch_notifier_info {
22 struct net_device *dev;
23};
24
3aeb6617
JP
25struct netdev_switch_notifier_fdb_info {
26 struct netdev_switch_notifier_info info; /* must be first */
27 const unsigned char *addr;
28 u16 vid;
29};
30
03bf0c28
JP
31static inline struct net_device *
32netdev_switch_notifier_info_to_dev(const struct netdev_switch_notifier_info *info)
33{
34 return info->dev;
35}
007f790c
JP
36
37#ifdef CONFIG_NET_SWITCHDEV
38
39int netdev_switch_parent_id_get(struct net_device *dev,
40 struct netdev_phys_item_id *psid);
38dcf357 41int netdev_switch_port_stp_update(struct net_device *dev, u8 state);
03bf0c28
JP
42int register_netdev_switch_notifier(struct notifier_block *nb);
43int unregister_netdev_switch_notifier(struct notifier_block *nb);
44int call_netdev_switch_notifiers(unsigned long val, struct net_device *dev,
45 struct netdev_switch_notifier_info *info);
007f790c
JP
46
47#else
48
49static inline int netdev_switch_parent_id_get(struct net_device *dev,
50 struct netdev_phys_item_id *psid)
51{
52 return -EOPNOTSUPP;
53}
54
38dcf357
SF
55static inline int netdev_switch_port_stp_update(struct net_device *dev,
56 u8 state)
57{
58 return -EOPNOTSUPP;
59}
60
03bf0c28
JP
61static inline int register_netdev_switch_notifier(struct notifier_block *nb)
62{
63 return 0;
64}
65
66static inline int unregister_netdev_switch_notifier(struct notifier_block *nb)
67{
68 return 0;
69}
70
71static inline int call_netdev_switch_notifiers(unsigned long val, struct net_device *dev,
27c00132 72 struct netdev_switch_notifier_info *info)
03bf0c28
JP
73{
74 return NOTIFY_DONE;
75}
76
007f790c
JP
77#endif
78
79#endif /* _LINUX_SWITCHDEV_H_ */
This page took 0.043706 seconds and 5 git commands to generate.