netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Taehee Yoo <ap420073@gmail.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net,
	jiri@resnulli.us, sd@queasysnail.net, roopa@cumulusnetworks.com,
	saeedm@mellanox.com, manishc@marvell.com, rahulv@marvell.com,
	kys@microsoft.com, haiyangz@microsoft.com,
	stephen@networkplumber.org, sashal@kernel.org, hare@suse.de,
	varun@chelsio.com, ubraun@linux.ibm.com, kgraul@linux.ibm.com,
	jay.vosburgh@canonical.com
Subject: Re: [PATCH net v3 09/11] net: core: add ignore flag to netdev_adjacent structure
Date: Fri, 20 Sep 2019 16:55:04 -0700	[thread overview]
Message-ID: <20190920165504.2ed552ac@cakuba.netronome.com> (raw)
In-Reply-To: <20190916134802.8252-10-ap420073@gmail.com>

On Mon, 16 Sep 2019 22:48:00 +0900, Taehee Yoo wrote:
> In order to link an adjacent node, netdev_upper_dev_link() is used
> and in order to unlink an adjacent node, netdev_upper_dev_unlink() is used.
> unlink operation does not fail, but link operation can fail.
> 
> In order to exchange adjacent nodes, we should unlink an old adjacent
> node first. then, link a new adjacent node.
> If link operation is failed, we should link an old adjacent node again.
> But this link operation can fail too.
> It eventually breaks the adjacent link relationship.
> 
> This patch adds an ignore flag into the netdev_adjacent structure.
> If this flag is set, netdev_upper_dev_link() ignores an old adjacent
> node for a moment.
> So we can skip unlink operation before link operation.
> 
> Signed-off-by: Taehee Yoo <ap420073@gmail.com>

Could this perhaps be achieved by creating prepare, commit, and abort
helpers? That would make the API look slightly more canonical.

netdev_adjacent_change_prepare(old, new, dev)
netdev_adjacent_change_commit(old, new, dev)
netdev_adjacent_change_abort(old, new, dev)

The current naming makes the operation a little harder to follow if one
is just reading the vxlan code.

Please let me know if I didn't read the code closely enough to
understand why that's not fitting here.

> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 5bb5756129af..4506810c301b 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -4319,6 +4319,10 @@ int netdev_master_upper_dev_link(struct net_device *dev,
>  				 struct netlink_ext_ack *extack);
>  void netdev_upper_dev_unlink(struct net_device *dev,
>  			     struct net_device *upper_dev);
> +void netdev_adjacent_dev_disable(struct net_device *upper_dev,
> +				 struct net_device *lower_dev);
> +void netdev_adjacent_dev_enable(struct net_device *upper_dev,
> +				struct net_device *lower_dev);
>  void netdev_adjacent_rename_links(struct net_device *dev, char *oldname);
>  void *netdev_lower_dev_get_private(struct net_device *dev,
>  				   struct net_device *lower_dev);

  parent reply	other threads:[~2019-09-20 23:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-16 13:47 [PATCH net v3 00/11] net: fix nested device bugs Taehee Yoo
2019-09-16 13:47 ` [PATCH net v3 01/11] net: core: limit nested device depth Taehee Yoo
2019-09-16 13:47 ` [PATCH net v3 02/11] vlan: use dynamic lockdep key instead of subclass Taehee Yoo
2019-09-16 13:47 ` [PATCH net v3 03/11] bonding: fix unexpected IFF_BONDING bit unset Taehee Yoo
2019-09-16 14:16   ` Jay Vosburgh
2019-09-16 14:49   ` Jiri Pirko
2019-09-16 15:03     ` Jay Vosburgh
2019-09-16 13:47 ` [PATCH net v3 04/11] bonding: use dynamic lockdep key instead of subclass Taehee Yoo
2019-09-16 13:47 ` [PATCH net v3 05/11] team: use dynamic lockdep key instead of static key Taehee Yoo
2019-09-16 13:47 ` [PATCH net v3 06/11] macsec: use dynamic lockdep key instead of subclass Taehee Yoo
2019-09-16 13:47 ` [PATCH net v3 07/11] macvlan: " Taehee Yoo
2019-09-16 13:47 ` [PATCH net v3 08/11] macsec: fix refcnt leak in module exit routine Taehee Yoo
2019-09-16 13:48 ` [PATCH net v3 09/11] net: core: add ignore flag to netdev_adjacent structure Taehee Yoo
2019-09-20 23:24   ` Jakub Kicinski
2019-09-20 23:55   ` Jakub Kicinski [this message]
2019-09-22 12:54     ` Taehee Yoo
2019-09-16 13:48 ` [PATCH net v3 10/11] vxlan: add adjacent link to limit depth level Taehee Yoo
2019-09-20 23:48   ` Jakub Kicinski
2019-09-22 12:35     ` Taehee Yoo
2019-09-16 13:48 ` [PATCH net v3 11/11] net: remove unnecessary variables and callback Taehee Yoo
2019-09-20 23:59 ` [PATCH net v3 00/11] net: fix nested device bugs Jakub Kicinski
2019-09-22 14:36   ` Taehee Yoo

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=20190920165504.2ed552ac@cakuba.netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=andy@greyhouse.net \
    --cc=ap420073@gmail.com \
    --cc=davem@davemloft.net \
    --cc=haiyangz@microsoft.com \
    --cc=hare@suse.de \
    --cc=j.vosburgh@gmail.com \
    --cc=jay.vosburgh@canonical.com \
    --cc=jiri@resnulli.us \
    --cc=kgraul@linux.ibm.com \
    --cc=kys@microsoft.com \
    --cc=manishc@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=rahulv@marvell.com \
    --cc=roopa@cumulusnetworks.com \
    --cc=saeedm@mellanox.com \
    --cc=sashal@kernel.org \
    --cc=sd@queasysnail.net \
    --cc=stephen@networkplumber.org \
    --cc=ubraun@linux.ibm.com \
    --cc=varun@chelsio.com \
    --cc=vfalico@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).