[PATCH net-next 02/11] net: Introduce new api for walking upper and lower devices

2016-10-17 Thread David Ahern
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.

Re: [PATCH net-next 02/11] net: Introduce new api for walking upper and lower devices

2016-10-17 Thread David Ahern
On 10/17/16 6:21 AM, Stephen Hemminger wrote: > > No if/else needed. No cast of void * ptr need. Use const if possible? > so much of the stack does not use const and trying to add it for this API does not work -- the upper or lower device is passed to the callbacks and those callbacks invoke

Re: [PATCH net-next 02/11] net: Introduce new api for walking upper and lower devices

2016-10-17 Thread David Miller
From: Stephen Hemminger Date: Mon, 17 Oct 2016 05:21:21 -0700 > You should write this more succinctly as: > > static bool __netdev_has_upper_dev(struct net_device *upper_dev, void *data) > { > struct net_device *dev = data; > > return upper_dev == dev; >

Re: [PATCH net-next 02/11] net: Introduce new api for walking upper and lower devices

2016-10-17 Thread Stephen Hemminger
On Fri, 14 Oct 2016 18:28:42 -0700 David Ahern wrote: > > /** > + * netdev_has_upper_dev_all - Check if device is linked to an upper device > + * @dev: device > + * @upper_dev: upper device to check > + * > + * Find out if a device is linked to specified upper device

[PATCH net-next 02/11] net: Introduce new api for walking upper and lower devices

2016-10-14 Thread David Ahern
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.

Re: [PATCH net-next 02/11] net: Introduce new api for walking upper and lower devices

2016-10-13 Thread Jiri Pirko
Wed, Oct 12, 2016 at 10:51:50PM CEST, d...@cumulusnetworks.com wrote: >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

[PATCH net-next 02/11] net: Introduce new api for walking upper and lower devices

2016-10-12 Thread David Ahern
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.