]> git.karo-electronics.de Git - linux-beck.git/commit
net: Introduce new api for walking upper and lower devices
authorDavid Ahern <dsa@cumulusnetworks.com>
Tue, 18 Oct 2016 02:15:44 +0000 (19:15 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 18 Oct 2016 15:44:58 +0000 (11:44 -0400)
commit1a3f060c1a47dba4e12ac21ce62b57666b9c4e95
treee0293fad952087cce74a7d4badac11e3ce3ee4b6
parent790510d99f39cee7f275d001aa5024032ed9bb48
net: Introduce new api for walking upper and lower devices

This patch introduces netdev_walk_all_upper_dev_rcu,
netdev_walk_all_lower_dev and netdev_walk_all_lower_dev_rcu. These
functions recursively walk the adj_list of devices to determine all upper
and lower devices.

The functions take a callback function that is invoked for each device
in the list. If the callback returns non-0, the walk is terminated and
the functions return that code back to callers.

v3
- simplified netdev_has_upper_dev_all_rcu and __netdev_has_upper_dev and
  removed typecast as suggested by Stephen

v2
- fixed definition of netdev_next_lower_dev_rcu to mirror the upper_dev
  version.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdevice.h
net/core/dev.c