Skip to contentSkip to conversation

net: remove COMPAT_NET_DEV_OPS

PATCH In review Alexander Beregalov 4 participants 7 messages May 23, 2009 – May 25, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: remove COMPAT_NET_DEV_OPS

All drivers are already converted to new net_device_ops API and nobody uses old API anymore.

---
 drivers/net/Kconfig       |    9 --------
 include/linux/netdevice.h |   38 ----------------------------------
 net/802/fddi.c            |    4 ---
 net/802/hippi.c           |    5 ----
 net/8021q/vlan_dev.c      |    1 -
 net/appletalk/dev.c       |   11 ---------
 net/core/dev.c            |   50 ---------------------------------------------
 net/ethernet/eth.c        |    5 ----
 8 files changed, 0 insertions(+), 123 deletions(-)
drivers/net/Kconfig +0 -9
index 0fb446e..efa659f 100644
@@ -25,15 +25,6 @@ menuconfig NETDEVICES
 # that for each of the symbols.
 if NETDEVICES
 
-config COMPAT_NET_DEV_OPS
-       default y
-       bool "Enable older network device API compatibility"
-       ---help---
-          This option enables kernel compatibility with older network devices
-          that do not use net_device_ops interface.
-
-	  If unsure, say Y.
-
 config IFB
 	tristate "Intermediate Functional Block support"
 	depends on NET_CLS_ACT
include/linux/netdevice.h +0 -38
index f8574e7..ae3c209 100644
@@ -901,44 +901,6 @@ struct net_device
 	/* max exchange id for FCoE LRO by ddp */
 	unsigned int		fcoe_ddp_xid;
 #endif
-
-#ifdef CONFIG_COMPAT_NET_DEV_OPS
-	struct {
-		int			(*init)(struct net_device *dev);
-		void			(*uninit)(struct net_device *dev);
-		int			(*open)(struct net_device *dev);
-		int			(*stop)(struct net_device *dev);
-		int			(*hard_start_xmit) (struct sk_buff *skb,
-							    struct net_device *dev);
-		u16			(*select_queue)(struct net_device *dev,
-							struct sk_buff *skb);
-		void			(*change_rx_flags)(struct net_device *dev,
-							   int flags);
-		void			(*set_rx_mode)(struct net_device *dev);
-		void			(*set_multicast_list)(struct net_device *dev);
-		int			(*set_mac_address)(struct net_device *dev,
-							   void *addr);
-		int			(*validate_addr)(struct net_device *dev);
-		int			(*do_ioctl)(struct net_device *dev,
-						    struct ifreq *ifr, int cmd);
-		int			(*set_config)(struct net_device *dev,
-						      struct ifmap *map);
-		int			(*change_mtu)(struct net_device *dev, int new_mtu);
-		int			(*neigh_setup)(struct net_device *dev,
-						       struct neigh_parms *);
-		void			(*tx_timeout) (struct net_device *dev);
-		struct net_device_stats* (*get_stats)(struct net_device *dev);
-		void			(*vlan_rx_register)(struct net_device *dev,
-							    struct vlan_group *grp);
-		void			(*vlan_rx_add_vid)(struct net_device *dev,
-							   unsigned short vid);
-		void			(*vlan_rx_kill_vid)(struct net_device *dev,
-							    unsigned short vid);
-#ifdef CONFIG_NET_POLL_CONTROLLER
-		void                    (*poll_controller)(struct net_device *dev);
-#endif
-	};
-#endif
 };
 #define to_net_dev(d) container_of(d, struct net_device, dev)
 
net/802/fddi.c +0 -4
index 539e606..3ef0ab0 100644
@@ -185,10 +185,6 @@ static const struct header_ops fddi_header_ops = {
 static void fddi_setup(struct net_device *dev)
 {
 	dev->header_ops		= &fddi_header_ops;
-#ifdef CONFIG_COMPAT_NET_DEV_OPS
-	dev->change_mtu		= fddi_change_mtu,
-#endif
-
 	dev->type		= ARPHRD_FDDI;
 	dev->hard_header_len	= FDDI_K_SNAP_HLEN+3;	/* Assume 802.2 SNAP hdr len + 3 pad bytes */
 	dev->mtu		= FDDI_K_SNAP_DLEN;	/* Assume max payload of 802.2 SNAP frame */
net/802/hippi.c +0 -5
index 313b9eb..cd3e8e9 100644
@@ -193,11 +193,6 @@ static const struct header_ops hippi_header_ops = {
 
 static void hippi_setup(struct net_device *dev)
 {
-#ifdef CONFIG_COMPAT_NET_DEV_OPS
-	dev->change_mtu			= hippi_change_mtu;
-	dev->set_mac_address 		= hippi_mac_addr;
-	dev->neigh_setup 		= hippi_neigh_setup_dev;
-#endif
 	dev->header_ops			= &hippi_header_ops;
 
 	/*
net/8021q/vlan_dev.c +0 -1
index ff7572a..1e2ad4c 100644
@@ -644,7 +644,6 @@ static int vlan_dev_init(struct net_device *dev)
 		dev->hard_header_len = real_dev->hard_header_len + VLAN_HLEN;
 		dev->netdev_ops         = &vlan_netdev_ops;
 	}
-	netdev_resync_ops(dev);
 
 	if (is_vlan_dev(real_dev))
 		subclass = 1;
net/appletalk/dev.c +0 -11
index 72277d7..6c8016f 100644
@@ -9,21 +9,10 @@
 #include <linux/if_arp.h>
 #include <linux/if_ltalk.h>
 
-#ifdef CONFIG_COMPAT_NET_DEV_OPS
-static int ltalk_change_mtu(struct net_device *dev, int mtu)
-{
-	return -EINVAL;
-}
-#endif
-
 static void ltalk_setup(struct net_device *dev)
 {
 	/* Fill in the fields of the device structure with localtalk-generic values. */
 
-#ifdef CONFIG_COMPAT_NET_DEV_OPS
-	dev->change_mtu		= ltalk_change_mtu;
-#endif
-
 	dev->type		= ARPHRD_LOCALTLK;
 	dev->hard_header_len 	= LTALK_HLEN;
 	dev->mtu		= LTALK_MTU;
net/core/dev.c +0 -50

62 lines not on this page · raw message

net/ethernet/eth.c +0 -5
index 280352a..5a883af 100644
@@ -337,11 +337,6 @@ const struct header_ops eth_header_ops ____cacheline_aligned = {
 void ether_setup(struct net_device *dev)
 {
 	dev->header_ops		= &eth_header_ops;
-#ifdef CONFIG_COMPAT_NET_DEV_OPS
-	dev->change_mtu		= eth_change_mtu;
-	dev->set_mac_address 	= eth_mac_addr;
-	dev->validate_addr	= eth_validate_addr;
-#endif
 	dev->type		= ARPHRD_ETHER;
 	dev->hard_header_len 	= ETH_HLEN;
 	dev->mtu		= ETH_DATA_LEN;
Signature · 1 line
1.6.3.1
#1 lore raw
Quoted 4 lines · On Sat, 23 May 2009 18:17:39 +0400 Alexander Beregalov <[email protected]>…

All drivers are already converted to new net_device_ops API and nobody uses old API anymore.

This go through the feature-removal-schedule process, to allow other drivers that live outside the tree some notice for change.

#2 lore raw

PATCH 1/1 Mark COMPAT_NET_DEV_OPS option for removal

Mark the flag as deprecated and default off so users won't use it by default. Make the message that was a informational into a full warning with backtrace, so any usage gets noticed.

Documentation/feature-removal-schedule.txt +11 -0
@@ -437,3 +437,14 @@ Why:	Superseded by tdfxfb. I2C/DDC suppo
 	driver but this caused driver conflicts.
 Who:	Jean Delvare <[email protected]>
 	Krzysztof Helt <[email protected]>
+
+---------------------------
+
+What:   COMPAT_NET_DEV_OPS interface
+When:   December 2009
+Why:    All network drivers in tree have been converted to the net_device_ops
+        interface. The compatiablity interface is no longer needed.
+
+	The interface will maintained for a short period to get out of
+        tree drivers to convert.
+Who:    Stephen Hemminger <[email protected]>
drivers/net/Kconfig +5 -6
@@ -26,13 +26,12 @@ menuconfig NETDEVICES
 if NETDEVICES
 
 config COMPAT_NET_DEV_OPS
-       default y
-       bool "Enable older network device API compatibility"
+       bool "Enable older network device API compatibility (DEPRECATED)"
+       default n
        ---help---
-          This option enables kernel compatibility with older network devices
-          that do not use net_device_ops interface.
-
-	  If unsure, say Y.
+          This option enables backward compatibility with older network devices
+          that do not use net_device_ops interface. All devices should be
+          converted to the net_device_ops.
 
 config IFB
 	tristate "Intermediate Functional Block support"
net/core/dev.c +3 -7
@@ -4653,20 +4653,16 @@ int register_netdevice(struct net_device
 	dev->iflink = -1;
 
 #ifdef CONFIG_COMPAT_NET_DEV_OPS
+	WARN(!dev->netdev_ops, "%s: not using net_device_ops\n", dev->name);
 	/* Netdevice_ops API compatibility support.
 	 * This is temporary until all network devices are converted.
 	 */
-	if (dev->netdev_ops) {
+	if (dev->netdev_ops)
 		netdev_resync_ops(dev);
-	} else {
-		char drivername[64];
-		pr_info("%s (%s): not using net_device_ops yet\n",
-			dev->name, netdev_drivername(dev, drivername, 64));
-
+	else
 		/* This works only because net_device_ops and the
 		   compatibility structure are the same. */
 		dev->netdev_ops = (void *) &(dev->init);
-	}
 #endif
 
 	/* Init, if this function is available */
maintainer NAK
#3 lore raw

Re: [PATCH] Mark COMPAT_NET_DEV_OPS option for removal

From: Stephen Hemminger <[email protected]>
Date: Sat, 23 May 2009 08:12:21 -0700

Quoted 5 lines

Mark the flag as deprecated and default off so users won't use it by default. Make the message that was a informational into a full warning with backtrace, so any usage gets noticed.

NAK, we're just going to toss this now in 2.6.31, there is nothing to gain by keeping this stuff around. It's an internal API change rather than something visible to users.

And it results in a clear compilation error for stale external code not yet converted.

#4 lore raw
In reply to Stephen Hemminger
Quoted 10 lines · Stephen Hemminger
Quoted 4 lines · On Sat, 23 May 2009 18:17:39 +0400 Alexander Beregalov <[email protected]>…

All drivers are already converted to new net_device_ops API and nobody uses old API anymore.

This go through the feature-removal-schedule process, to allow other drivers that live outside the tree some notice for change.

I don't think so. We do tons of API changes and don't do such a process around it. Removal of the old pointers gives a clear compilation breakage so it's not even dangerous.

maintainer
#5 lore raw

From: Christoph Hellwig <[email protected]>
Date: Sat, 23 May 2009 12:55:31 -0400

Quoted 7 lines · Stephen Hemminger
Quoted 6 lines
Quoted 3 lines · On Sat, 23 May 2009 18:17:39 +0400 Alexander Beregalov <[email protected]>…

All drivers are already converted to new net_device_ops API and nobody uses old API anymore.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

This go through the feature-removal-schedule process, to allow other drivers that live outside the tree some notice for change.

I don't think so. We do tons of API changes and don't do such a process around it. Removal of the old pointers gives a clear compilation breakage so it's not even dangerous.

I completely agree and plan to get rid of this compat ops stuff for 2.6.31