mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-26 02:25:00 -05:00
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>
This commit is contained in:
parent
7f304b9efa
commit
d643a75ac2
1 changed files with 4 additions and 0 deletions
|
@ -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_ */
|
||||
|
|
Loading…
Add table
Reference in a new issue