diff options
author | Simon Horman <simon.horman@netronome.com> | 2017-06-29 22:08:11 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-07-01 08:51:32 -0700 |
commit | d643a75ac2bcc559994405d29c50ed086aeae434 (patch) | |
tree | 4bbea8edf3f410b77335260fad10fa3acbb8adad /include/net | |
parent | 7f304b9efabbad584b093289d135bebdc09b222e (diff) | |
download | linux-d643a75ac2bcc559994405d29c50ed086aeae434.tar.bz2 |
net: switchdev: add SET_SWITCHDEV_OPS helper
Add a helper to allow switchdev ops to be set if NET_SWITCHDEV is configured
and do nothing otherwise. This allows for slightly cleaner code which
uses switchdev but does not select NET_SWITCHDEV.
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Acked-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/switchdev.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/net/switchdev.h b/include/net/switchdev.h index c784a6ac6ef1..8ae9e3b6392e 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -217,6 +217,8 @@ void switchdev_port_fwd_mark_set(struct net_device *dev, bool switchdev_port_same_parent_id(struct net_device *a, struct net_device *b); + +#define SWITCHDEV_SET_OPS(netdev, ops) ((netdev)->switchdev_ops = (ops)) #else static inline void switchdev_deferred_process(void) @@ -322,6 +324,8 @@ static inline bool switchdev_port_same_parent_id(struct net_device *a, return false; } +#define SWITCHDEV_SET_OPS(netdev, ops) do {} while (0) + #endif #endif /* _LINUX_SWITCHDEV_H_ */ |