Skip to content

Commit

Permalink
net/switchdev: Export the same parent ID service function
Browse files Browse the repository at this point in the history
This helper serves to know if two switchdev port netdevices belong to the
same HW ASIC, e.g to figure out if forwarding offload is possible between them.

Signed-off-by: Or Gerlitz <[email protected]>
Signed-off-by: Saeed Mahameed <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
ogerlitz authored and davem330 committed Jul 14, 2016
1 parent 5c40348 commit 8438884
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions include/net/switchdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ void switchdev_port_fwd_mark_set(struct net_device *dev,
struct net_device *group_dev,
bool joining);

bool switchdev_port_same_parent_id(struct net_device *a,
struct net_device *b);
#else

static inline void switchdev_deferred_process(void)
Expand Down Expand Up @@ -351,6 +353,12 @@ static inline void switchdev_port_fwd_mark_set(struct net_device *dev,
{
}

static inline bool switchdev_port_same_parent_id(struct net_device *a,
struct net_device *b)
{
return false;
}

#endif

#endif /* _LINUX_SWITCHDEV_H_ */
5 changes: 3 additions & 2 deletions net/switchdev/switchdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1286,8 +1286,8 @@ void switchdev_fib_ipv4_abort(struct fib_info *fi)
}
EXPORT_SYMBOL_GPL(switchdev_fib_ipv4_abort);

static bool switchdev_port_same_parent_id(struct net_device *a,
struct net_device *b)
bool switchdev_port_same_parent_id(struct net_device *a,
struct net_device *b)
{
struct switchdev_attr a_attr = {
.orig_dev = a,
Expand Down Expand Up @@ -1323,6 +1323,7 @@ static u32 switchdev_port_fwd_mark_get(struct net_device *dev,

return dev->ifindex;
}
EXPORT_SYMBOL_GPL(switchdev_port_same_parent_id);

static void switchdev_port_fwd_mark_reset(struct net_device *group_dev,
u32 old_mark, u32 *reset_mark)
Expand Down

0 comments on commit 8438884

Please sign in to comment.