All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, eric.dumazet@gmail.com,
	Nicolas Dichtel <nicolas.dichtel@6wind.com>
Subject: [PATCH net-next v2 10/12] net: remove iflink field from struct net_device
Date: Thu,  2 Apr 2015 17:07:09 +0200	[thread overview]
Message-ID: <1427987231-3669-11-git-send-email-nicolas.dichtel@6wind.com> (raw)
In-Reply-To: <1427987231-3669-1-git-send-email-nicolas.dichtel@6wind.com>

Now that all users of iflink have the ndo_get_iflink handler available, it's
possible to remove this field.

By default, dev_get_iflink() returns the ifindex of the interface.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 include/linux/netdevice.h |  3 +--
 net/core/dev.c            | 13 ++-----------
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 788eb7a622ad..846a1f5bc9db 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1538,7 +1538,7 @@ struct net_device {
 	netdev_features_t	mpls_features;
 
 	int			ifindex;
-	int			iflink;
+	int			group;
 
 	struct net_device_stats	stats;
 
@@ -1741,7 +1741,6 @@ struct net_device {
 #endif
 	struct phy_device *phydev;
 	struct lock_class_key *qdisc_tx_busylock;
-	int group;
 	struct pm_qos_request	pm_qos_req;
 };
 #define to_net_dev(d) container_of(d, struct net_device, dev)
diff --git a/net/core/dev.c b/net/core/dev.c
index 77172d085760..3be107e0bc93 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -672,7 +672,7 @@ int dev_get_iflink(const struct net_device *dev)
 	if (dev->netdev_ops && dev->netdev_ops->ndo_get_iflink)
 		return dev->netdev_ops->ndo_get_iflink(dev);
 
-	return dev->iflink;
+	return dev->ifindex;
 }
 EXPORT_SYMBOL(dev_get_iflink);
 
@@ -6331,8 +6331,6 @@ int register_netdevice(struct net_device *dev)
 	spin_lock_init(&dev->addr_list_lock);
 	netdev_set_addr_lockdep_class(dev);
 
-	dev->iflink = -1;
-
 	ret = dev_get_valid_name(net, dev, dev->name);
 	if (ret < 0)
 		goto out;
@@ -6362,9 +6360,6 @@ int register_netdevice(struct net_device *dev)
 	else if (__dev_get_by_index(net, dev->ifindex))
 		goto err_uninit;
 
-	if (dev_get_iflink(dev) == -1)
-		dev->iflink = dev->ifindex;
-
 	/* Transfer changeable features to wanted_features and enable
 	 * software offloads (GSO and GRO).
 	 */
@@ -7077,12 +7072,8 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
 	dev_net_set(dev, net);
 
 	/* If there is an ifindex conflict assign a new one */
-	if (__dev_get_by_index(net, dev->ifindex)) {
-		int iflink = (dev_get_iflink(dev) == dev->ifindex);
+	if (__dev_get_by_index(net, dev->ifindex))
 		dev->ifindex = dev_new_index(net);
-		if (iflink)
-			dev->iflink = dev->ifindex;
-	}
 
 	/* Send a netdev-add uevent to the new namespace */
 	kobject_uevent(&dev->dev.kobj, KOBJ_ADD);
-- 
2.2.2

  parent reply	other threads:[~2015-04-02 15:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-03 15:41 [PATCH net-next] veth: set iflink to the peer veth Nicolas Dichtel
2015-02-03 16:12 ` Eric Dumazet
2015-02-03 16:21   ` Nicolas Dichtel
2015-04-02 15:06   ` [PATCH net-next v2 0/12] Remove iflink field from the net_device structure Nicolas Dichtel
2015-04-02 15:07     ` [PATCH net-next v2 01/12] dev: introduce dev_get_iflink() Nicolas Dichtel
2015-04-02 15:07     ` [PATCH net-next v2 02/12] ip6tnl,gre6,vti6: implement ndo_get_iflink Nicolas Dichtel
2015-04-02 15:07     ` [PATCH net-next v2 03/12] ipip,gre,vti,sit: " Nicolas Dichtel
2015-04-02 15:07     ` [PATCH net-next v2 04/12] ipmr,ip6mr: " Nicolas Dichtel
2015-04-02 15:07     ` [PATCH net-next v2 05/12] vlan: " Nicolas Dichtel
2015-04-02 15:07     ` [PATCH net-next v2 06/12] macvlan: " Nicolas Dichtel
2015-04-02 15:07     ` [PATCH net-next v2 07/12] ipvlan: " Nicolas Dichtel
2015-04-02 15:07     ` [PATCH net-next v2 08/12] infiniband/ipoib: " Nicolas Dichtel
2015-04-02 15:07     ` [PATCH net-next v2 09/12] dsa: " Nicolas Dichtel
2015-04-02 15:07     ` Nicolas Dichtel [this message]
2015-04-02 15:07     ` [PATCH net-next v2 11/12] dev: set iflink to 0 for virtual interfaces Nicolas Dichtel
2015-04-02 15:07     ` [PATCH net-next v2 12/12] veth: set iflink to the peer veth Nicolas Dichtel
2015-04-02 18:05     ` [PATCH net-next v2 0/12] Remove iflink field from the net_device structure David Miller

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=1427987231-3669-11-git-send-email-nicolas.dichtel@6wind.com \
    --to=nicolas.dichtel@6wind.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.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.