From: Jiri Pirko <jiri@resnulli.us>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next 02/11] net: Introduce new api for walking upper and lower devices
Date: Thu, 13 Oct 2016 09:30:29 +0200 [thread overview]
Message-ID: <20161013073029.GA1816@nanopsycho.orion> (raw)
In-Reply-To: <1476305519-28833-3-git-send-email-dsa@cumulusnetworks.com>
Wed, Oct 12, 2016 at 10:51:50PM CEST, dsa at 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 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.
>
>Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
[...]
>+int netdev_walk_all_lower_dev(struct net_device *dev,
>+ int (*fn)(struct net_device *dev,
>+ void *data),
>+ void *data)
>+{
>+ struct list_head *iter;
>+ struct net_device *ldev;
>+ int ret;
>+
>+ for (iter = &(dev)->adj_list.lower,
>+ ldev = netdev_next_lower_dev(dev, &(iter));
>+ ldev;
>+ ldev = netdev_next_lower_dev(dev, &(iter))) {
>+ /* first is the lower device itself */
>+ ret = fn(ldev, data);
>+ if (ret)
>+ return ret;
>+
>+ /* then look at all of its lower devices */
>+ ret = netdev_walk_all_lower_dev(ldev, fn, data);
I believe that Veaceslav's reason to collapse the upper/lower trees was
to avoid this recursivity. I also believe that the recursivity was a big
issue for DaveM and BenH. Something changed?
WARNING: multiple messages have this Message-ID (diff)
From: Jiri Pirko <jiri@resnulli.us>
To: David Ahern <dsa@cumulusnetworks.com>
Cc: jiri@mellanox.com, netdev@vger.kernel.org, davem@davemloft.net,
dledford@redhat.com, sean.hefty@intel.com,
hal.rosenstock@gmail.com, linux-rdma@vger.kernel.org,
j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net,
jeffrey.t.kirsher@intel.com, intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH net-next 02/11] net: Introduce new api for walking upper and lower devices
Date: Thu, 13 Oct 2016 09:30:29 +0200 [thread overview]
Message-ID: <20161013073029.GA1816@nanopsycho.orion> (raw)
In-Reply-To: <1476305519-28833-3-git-send-email-dsa@cumulusnetworks.com>
Wed, Oct 12, 2016 at 10:51:50PM CEST, dsa@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 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.
>
>Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
[...]
>+int netdev_walk_all_lower_dev(struct net_device *dev,
>+ int (*fn)(struct net_device *dev,
>+ void *data),
>+ void *data)
>+{
>+ struct list_head *iter;
>+ struct net_device *ldev;
>+ int ret;
>+
>+ for (iter = &(dev)->adj_list.lower,
>+ ldev = netdev_next_lower_dev(dev, &(iter));
>+ ldev;
>+ ldev = netdev_next_lower_dev(dev, &(iter))) {
>+ /* first is the lower device itself */
>+ ret = fn(ldev, data);
>+ if (ret)
>+ return ret;
>+
>+ /* then look at all of its lower devices */
>+ ret = netdev_walk_all_lower_dev(ldev, fn, data);
I believe that Veaceslav's reason to collapse the upper/lower trees was
to avoid this recursivity. I also believe that the recursivity was a big
issue for DaveM and BenH. Something changed?
next prev parent reply other threads:[~2016-10-13 7:30 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-12 20:51 [Intel-wired-lan] [PATCH net-next 00/11] net: Fix netdev adjacency tracking David Ahern
2016-10-12 20:51 ` David Ahern
2016-10-12 20:51 ` [Intel-wired-lan] [PATCH net-next 01/11] net: Remove refnr arg when inserting link adjacencies David Ahern
2016-10-12 20:51 ` David Ahern
2016-10-12 20:51 ` [Intel-wired-lan] [PATCH net-next 02/11] net: Introduce new api for walking upper and lower devices David Ahern
2016-10-12 20:51 ` David Ahern
2016-10-13 7:30 ` Jiri Pirko [this message]
2016-10-13 7:30 ` Jiri Pirko
2016-10-12 20:51 ` [Intel-wired-lan] [PATCH net-next 03/11] net: bonding: Flip to the new dev walk API David Ahern
2016-10-12 20:51 ` David Ahern
2016-10-12 20:51 ` [Intel-wired-lan] [PATCH net-next 04/11] IB/core: " David Ahern
2016-10-12 20:51 ` David Ahern
2016-10-12 20:51 ` [Intel-wired-lan] [PATCH net-next 05/11] IB/ipoib: Flip to " David Ahern
2016-10-12 20:51 ` David Ahern
2016-10-12 20:51 ` [Intel-wired-lan] [PATCH net-next 06/11] ixgbe: Flip to the " David Ahern
2016-10-12 20:51 ` David Ahern
2016-10-12 20:51 ` [Intel-wired-lan] [PATCH net-next 07/11] mlxsw: " David Ahern
2016-10-12 20:51 ` David Ahern
2016-10-12 20:51 ` [Intel-wired-lan] [PATCH net-next 08/11] rocker: " David Ahern
2016-10-12 20:51 ` David Ahern
2016-10-12 20:51 ` [Intel-wired-lan] [PATCH net-next 09/11] net: Remove all_adj_list and its references David Ahern
2016-10-12 20:51 ` David Ahern
2016-10-12 20:51 ` [Intel-wired-lan] [PATCH net-next 10/11] net: Add warning if any lower device is still in adjacency list David Ahern
2016-10-12 20:51 ` David Ahern
2016-10-12 20:51 ` [Intel-wired-lan] [PATCH net-next 11/11] net: dev: Improve debug statements for adjacency tracking David Ahern
2016-10-12 20:51 ` David Ahern
2016-10-13 7:34 ` [Intel-wired-lan] [PATCH net-next 00/11] net: Fix netdev " Jiri Pirko
2016-10-13 7:34 ` Jiri Pirko
2016-10-13 14:32 ` [Intel-wired-lan] " David Ahern
2016-10-13 14:32 ` David Ahern
2016-10-14 14:17 ` [Intel-wired-lan] " David Miller
2016-10-14 14:17 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2016-10-15 1:28 [Intel-wired-lan] [PATCH v2 " David Ahern
2016-10-15 1:28 ` [Intel-wired-lan] [PATCH net-next 02/11] net: Introduce new api for walking upper and lower devices David Ahern
2016-10-17 12:21 ` Stephen Hemminger
2016-10-17 14:42 ` David Miller
2016-10-18 0:42 ` David Ahern
2016-10-18 2:15 [Intel-wired-lan] [PATCH v3 net-next 00/11] net: Fix netdev adjacency tracking David Ahern
2016-10-18 2:15 ` [Intel-wired-lan] [PATCH net-next 02/11] net: Introduce new api for walking upper and lower devices David Ahern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161013073029.GA1816@nanopsycho.orion \
--to=jiri@resnulli.us \
--cc=intel-wired-lan@osuosl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.