netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/20] extending (hw_/wanted_/vlan_)features fields to a bitmap.
@ 2011-04-06  0:44 Mahesh Bandewar
  2011-04-06  0:44 ` [PATCH 01/20] net-core: " Mahesh Bandewar
  0 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar


Extend "*features" from word to a BITMAP. This will eliminate the current upper
bound. Also making it a bitmap will allow us to use (set/test/clear)_bit()
macros/inline functions. So operation -
    dev->features |= NETIF_F_SG
can be performed like-
    set_bit(NETIF_F_SG_BIT, dev->feature);

Again it's not as easy as it looks since operations like -
   bitmap = bitmap-a & bitmap-b 
will be difficult but at the same time it would be imposible to use |=
operations for multi-word flags too. Bitmap will make it easier to manage
multi-word features but will need some macro / wrapper writing to achieve
complex bit manipulations. 

Since the use of "features" is wide-spread, this can not be done in one shot.
So breaking the work into following 4 steps of which first two steps will be
achieved by this patch. Third step is the one which will take longer.

(1) convert hw_features and wanted_features to a bitmap but maintain the
    backword compatibility with legacy_* option. 
(2) Define fake macros for vlan_features and features until all the work of
    converion is not complete.
(3) Complete the conversion.
(4) Define bitmaps for features and vlan_features.

We can add step (5) which is to convert the use of legacy_* stuff and use the
newer way only.


Mahesh Bandewar (20):
  net-core: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  net-ipv4: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  net-ipv6: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  net-vlan: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  net-bridge: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  net-decnet: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  net-dsa: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  net-l2tp: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  net-phonet: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  net-sctp: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  net-wireless: extending (hw_/wanted_/vlan_)features fields to a
    bitmap.
  loopback: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  veth: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  jme: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  sungem: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  sunhme: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  usb-smsc75xx: extending (hw_/wanted_/vlan_)features fields to a
    bitmap.
  usb-smsc95xx: extending (hw_/wanted_/vlan_)features fields to a
    bitmap.
  virtio_net: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  xen: extending (hw_/wanted_/vlan_)features fields to a bitmap.

 drivers/net/jme.c                  |   12 ++--
 drivers/net/loopback.c             |    4 +-
 drivers/net/sungem.c               |    7 +-
 drivers/net/sunhme.c               |    8 +-
 drivers/net/usb/smsc75xx.c         |   12 ++--
 drivers/net/usb/smsc95xx.c         |   12 ++--
 drivers/net/veth.c                 |    6 +-
 drivers/net/virtio_net.c           |   21 ++++---
 drivers/net/xen-netfront.c         |    8 +-
 include/linux/if_vlan.h            |    4 +-
 include/linux/netdevice.h          |  110 +++++++++++++++++++++++++-----------
 net/8021q/vlan.c                   |   12 ++--
 net/8021q/vlan_dev.c               |    9 ++-
 net/bridge/br_device.c             |    2 +-
 net/bridge/br_if.c                 |    4 +-
 net/core/dev.c                     |   51 +++++++++--------
 net/core/ethtool.c                 |   97 ++++++++++++++++----------------
 net/core/net-sysfs.c               |    4 +-
 net/core/sock.c                    |    2 +-
 net/dccp/ipv6.c                    |    2 +-
 net/decnet/af_decnet.c             |    2 +-
 net/decnet/dn_nsp_out.c            |    2 +-
 net/dsa/slave.c                    |    4 +-
 net/ipv4/ip_gre.c                  |    6 +-
 net/ipv4/ip_output.c               |   12 ++--
 net/ipv4/ipip.c                    |    4 +-
 net/ipv4/ipmr.c                    |    2 +-
 net/ipv4/netfilter/nf_nat_helper.c |    2 +-
 net/ipv6/ip6_output.c              |    6 +-
 net/ipv6/ip6_tunnel.c              |    2 +-
 net/ipv6/ip6mr.c                   |    2 +-
 net/ipv6/sit.c                     |    4 +-
 net/l2tp/l2tp_core.c               |    2 +-
 net/phonet/pep-gprs.c              |    2 +-
 net/sctp/output.c                  |    4 +-
 net/wireless/core.c                |   10 ++--
 36 files changed, 251 insertions(+), 202 deletions(-)

-- 
1.7.3.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 01/20] net-core: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44 [PATCH 00/20] extending (hw_/wanted_/vlan_)features fields to a bitmap Mahesh Bandewar
@ 2011-04-06  0:44 ` Mahesh Bandewar
  2011-04-06  0:44   ` [PATCH 02/20] net-ipv4: " Mahesh Bandewar
                     ` (3 more replies)
  0 siblings, 4 replies; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 include/linux/netdevice.h |  110 +++++++++++++++++++++++++++++++-------------
 net/core/dev.c            |   51 +++++++++++----------
 net/core/ethtool.c        |   97 ++++++++++++++++++++-------------------
 net/core/net-sysfs.c      |    4 +-
 net/core/sock.c           |    2 +-
 5 files changed, 155 insertions(+), 109 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 09d2624..637bf2a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -980,6 +980,42 @@ struct net_device_ops {
 						    u32 features);
 };
 
+enum netdev_features {
+	NETIF_F_SG_BIT,			/* Scatter/gather IO. */
+	NETIF_F_IP_CSUM_BIT,		/* Can checksum TCP/UDP over IPv4. */
+	NETIF_F_NO_CSUM_BIT,		/* Does not require checksum. F.e. loopack. */
+	NETIF_F_HW_CSUM_BIT,		/* Can checksum all the packets. */
+	NETIF_F_IPV6_CSUM_BIT,		/* Can checksum TCP/UDP over IPV6 */
+	NETIF_F_HIGHDMA_BIT,		/* Can DMA to high memory. */
+	NETIF_F_FRAGLIST_BIT,		/* Scatter/gather IO. */
+	NETIF_F_HW_VLAN_TX_BIT,		/* Transmit VLAN hw acceleration */
+	NETIF_F_HW_VLAN_RX_BIT,		/* Receive VLAN hw acceleration */
+	NETIF_F_HW_VLAN_FILTER_BIT,	/* Receive filtering on VLAN */
+	NETIF_F_VLAN_CHALLENGED_BIT,	/* Device cannot handle VLAN packets */
+	NETIF_F_GSO_BIT,		/* Enable software GSO. */
+	NETIF_F_LLTX_BIT,		/* LockLess TX - deprecated. Please */
+					/* do not use LLTX in new drivers */
+	NETIF_F_NETNS_LOCAL_BIT,	/* Does not change network namespaces */
+	NETIF_F_GRO_BIT,		/* Generic receive offload */
+	NETIF_F_LRO_BIT,		/* large receive offload */
+	/* the GSO_MASK reserves bits 16 through 23 */
+	RESERVED1_BIT,
+	RESERVED2_BIT,
+	RESERVED3_BIT,
+	RESERVED4_BIT,
+	RESERVED5_BIT,
+	RESERVED6_BIT,
+	RESERVED7_BIT,
+	RESERVED8_BIT,
+	NETIF_F_FCOE_CRC_BIT,		/* FCoE CRC32 */
+	NETIF_F_SCTP_CSUM_BIT,		/* SCTP checksum offload */
+	NETIF_F_FCOE_MTU_BIT,		/* Supports max FCoE MTU, 2158 bytes*/
+	NETIF_F_NTUPLE_BIT,		/* N-tuple filters supported */
+	NETIF_F_RXHASH_BIT,		/* Receive hashing offload */
+	NETIF_F_RXCSUM_BIT,		/* Receive checksumming offload */
+	NETIF_F_NOCACHE_COPY_BIT,	/* Use no-cache copyfromuser */
+};
+
 /*
  *	The DEVICE structure.
  *	Actually, this whole structure is a big mistake.  It mixes I/O
@@ -1029,44 +1065,51 @@ struct net_device {
 	struct list_head	napi_list;
 	struct list_head	unreg_list;
 
+#define DEV_FEATURE_WORDS	2
+#define	DEV_FEATURE_BITS	(DEV_FEATURE_WORDS*sizeof(long)*BITS_PER_BYTE)
+#define LEGACY_FEATURE_WORD	0
+
 	/* currently active device features */
-	u32			features;
+	unsigned long 		features;
 	/* user-changeable features */
-	u32			hw_features;
+	DECLARE_BITMAP(hw_feature, DEV_FEATURE_BITS);
 	/* user-requested features */
-	u32			wanted_features;
+	DECLARE_BITMAP(wanted_feature, DEV_FEATURE_BITS);
 	/* VLAN feature mask */
-	u32			vlan_features;
+	unsigned long 		vlan_features;
+
+#define legacy_features		features
+#define legacy_hw_features	hw_feature[LEGACY_FEATURE_WORD]
+#define legacy_wanted_features	wanted_feature[LEGACY_FEATURE_WORD]
+#define legacy_vlan_features	vlan_features
 
 	/* Net device feature bits; if you change something,
 	 * also update netdev_features_strings[] in ethtool.c */
 
-#define NETIF_F_SG		1	/* Scatter/gather IO. */
-#define NETIF_F_IP_CSUM		2	/* Can checksum TCP/UDP over IPv4. */
-#define NETIF_F_NO_CSUM		4	/* Does not require checksum. F.e. loopack. */
-#define NETIF_F_HW_CSUM		8	/* Can checksum all the packets. */
-#define NETIF_F_IPV6_CSUM	16	/* Can checksum TCP/UDP over IPV6 */
-#define NETIF_F_HIGHDMA		32	/* Can DMA to high memory. */
-#define NETIF_F_FRAGLIST	64	/* Scatter/gather IO. */
-#define NETIF_F_HW_VLAN_TX	128	/* Transmit VLAN hw acceleration */
-#define NETIF_F_HW_VLAN_RX	256	/* Receive VLAN hw acceleration */
-#define NETIF_F_HW_VLAN_FILTER	512	/* Receive filtering on VLAN */
-#define NETIF_F_VLAN_CHALLENGED	1024	/* Device cannot handle VLAN packets */
-#define NETIF_F_GSO		2048	/* Enable software GSO. */
-#define NETIF_F_LLTX		4096	/* LockLess TX - deprecated. Please */
-					/* do not use LLTX in new drivers */
-#define NETIF_F_NETNS_LOCAL	8192	/* Does not change network namespaces */
-#define NETIF_F_GRO		16384	/* Generic receive offload */
-#define NETIF_F_LRO		32768	/* large receive offload */
-
+#define NETIF_F_SG		(1 << NETIF_F_SG_BIT)
+#define NETIF_F_IP_CSUM		(1 << NETIF_F_IP_CSUM_BIT)
+#define NETIF_F_NO_CSUM		(1 << NETIF_F_NO_CSUM_BIT)
+#define NETIF_F_HW_CSUM		(1 << NETIF_F_HW_CSUM_BIT)
+#define NETIF_F_IPV6_CSUM	(1 << NETIF_F_IPV6_CSUM_BIT)
+#define NETIF_F_HIGHDMA		(1 << NETIF_F_HIGHDMA_BIT)
+#define NETIF_F_FRAGLIST	(1 << NETIF_F_FRAGLIST_BIT)
+#define NETIF_F_HW_VLAN_TX	(1 << NETIF_F_HW_VLAN_TX_BIT)
+#define NETIF_F_HW_VLAN_RX	(1 << NETIF_F_HW_VLAN_RX_BIT)
+#define NETIF_F_HW_VLAN_FILTER	(1 << NETIF_F_HW_VLAN_FILTER_BIT)
+#define NETIF_F_VLAN_CHALLENGED	(1 << NETIF_F_VLAN_CHALLENGED_BIT)
+#define NETIF_F_GSO		(1 << NETIF_F_GSO_BIT)
+#define NETIF_F_LLTX		(1 << NETIF_F_LLTX_BIT)
+#define NETIF_F_NETNS_LOCAL	(1 << NETIF_F_NETNS_LOCAL_BIT)
+#define NETIF_F_GRO		(1 << NETIF_F_GRO_BIT)
+#define NETIF_F_LRO		(1 << NETIF_F_LRO_BIT)
 /* the GSO_MASK reserves bits 16 through 23 */
-#define NETIF_F_FCOE_CRC	(1 << 24) /* FCoE CRC32 */
-#define NETIF_F_SCTP_CSUM	(1 << 25) /* SCTP checksum offload */
-#define NETIF_F_FCOE_MTU	(1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
-#define NETIF_F_NTUPLE		(1 << 27) /* N-tuple filters supported */
-#define NETIF_F_RXHASH		(1 << 28) /* Receive hashing offload */
-#define NETIF_F_RXCSUM		(1 << 29) /* Receive checksumming offload */
-#define NETIF_F_NOCACHE_COPY	(1 << 30) /* Use no-cache copyfromuser */
+#define NETIF_F_FCOE_CRC	(1 << NETIF_F_FCOE_CRC_BIT)
+#define NETIF_F_SCTP_CSUM	(1 << NETIF_F_SCTP_CSUM_BIT)
+#define NETIF_F_FCOE_MTU	(1 << NETIF_F_FCOE_MTU_BIT)
+#define NETIF_F_NTUPLE		(1 << NETIF_F_NTUPLE_BIT)
+#define NETIF_F_RXHASH		(1 << NETIF_F_RXHASH_BIT)
+#define NETIF_F_RXCSUM		(1 << NETIF_F_RXCSUM_BIT)
+#define NETIF_F_NOCACHE_COPY	(1 << NETIF_F_NOCACHE_COPY_BIT)
 
 	/* Segmentation offload features */
 #define NETIF_F_GSO_SHIFT	16
@@ -2376,13 +2419,13 @@ static inline void netif_tx_unlock_bh(struct net_device *dev)
 }
 
 #define HARD_TX_LOCK(dev, txq, cpu) {			\
-	if ((dev->features & NETIF_F_LLTX) == 0) {	\
+	if ((dev->legacy_features & NETIF_F_LLTX) == 0) {	\
 		__netif_tx_lock(txq, cpu);		\
 	}						\
 }
 
 #define HARD_TX_UNLOCK(dev, txq) {			\
-	if ((dev->features & NETIF_F_LLTX) == 0) {	\
+	if ((dev->legacy_features & NETIF_F_LLTX) == 0) {	\
 		__netif_tx_unlock(txq);			\
 	}						\
 }
@@ -2547,7 +2590,8 @@ extern void linkwatch_run_queue(void);
 
 static inline u32 netdev_get_wanted_features(struct net_device *dev)
 {
-	return (dev->features & ~dev->hw_features) | dev->wanted_features;
+	return (dev->legacy_features & ~dev->legacy_hw_features) |
+	    dev->legacy_wanted_features;
 }
 u32 netdev_increment_features(u32 all, u32 one, u32 mask);
 u32 netdev_fix_features(struct net_device *dev, u32 features);
@@ -2600,7 +2644,7 @@ static inline int dev_ethtool_get_settings(struct net_device *dev,
 
 static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev)
 {
-	if (dev->features & NETIF_F_RXCSUM)
+	if (dev->legacy_features & NETIF_F_RXCSUM)
 		return 1;
 	if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum)
 		return 0;
diff --git a/net/core/dev.c b/net/core/dev.c
index 5d0b4f6..8cad38d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1315,7 +1315,7 @@ void dev_disable_lro(struct net_device *dev)
 		return;
 
 	__ethtool_set_flags(dev, flags & ~ETH_FLAG_LRO);
-	WARN_ON(dev->features & NETIF_F_LRO);
+	WARN_ON(dev->legacy_features & NETIF_F_LRO);
 }
 EXPORT_SYMBOL(dev_disable_lro);
 
@@ -1871,7 +1871,7 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, u32 features)
 			dev->ethtool_ops->get_drvinfo(dev, &info);
 
 		WARN(1, "%s: caps=(0x%lx, 0x%lx) len=%d data_len=%d ip_summed=%d\n",
-		     info.driver, dev ? dev->features : 0L,
+		     info.driver, dev ? dev->legacy_features : 0L,
 		     skb->sk ? skb->sk->sk_route_caps : 0L,
 		     skb->len, skb->data_len, skb->ip_summed);
 
@@ -1926,7 +1926,7 @@ static int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
 {
 #ifdef CONFIG_HIGHMEM
 	int i;
-	if (!(dev->features & NETIF_F_HIGHDMA)) {
+	if (!(dev->legacy_features & NETIF_F_HIGHDMA)) {
 		for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
 			if (PageHighMem(skb_shinfo(skb)->frags[i].page))
 				return 1;
@@ -2043,7 +2043,7 @@ static u32 harmonize_features(struct sk_buff *skb, __be16 protocol, u32 features
 u32 netif_skb_features(struct sk_buff *skb)
 {
 	__be16 protocol = skb->protocol;
-	u32 features = skb->dev->features;
+	u32 features = skb->dev->legacy_features;
 
 	if (protocol == htons(ETH_P_8021Q)) {
 		struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
@@ -2052,7 +2052,7 @@ u32 netif_skb_features(struct sk_buff *skb)
 		return harmonize_features(skb, protocol, features);
 	}
 
-	features &= (skb->dev->vlan_features | NETIF_F_HW_VLAN_TX);
+	features &= (skb->dev->legacy_vlan_features | NETIF_F_HW_VLAN_TX);
 
 	if (protocol != htons(ETH_P_8021Q)) {
 		return harmonize_features(skb, protocol, features);
@@ -2589,7 +2589,7 @@ set_rps_cpu(struct net_device *dev, struct sk_buff *skb,
 
 		/* Should we steer this flow to a different hardware queue? */
 		if (!skb_rx_queue_recorded(skb) || !dev->rx_cpu_rmap ||
-		    !(dev->features & NETIF_F_NTUPLE))
+		    !(dev->legacy_features & NETIF_F_NTUPLE))
 			goto out;
 		rxq_index = cpu_rmap_lookup_index(dev->rx_cpu_rmap, next_cpu);
 		if (rxq_index == skb_get_rx_queue(skb))
@@ -3350,7 +3350,7 @@ enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
 	int mac_len;
 	enum gro_result ret;
 
-	if (!(skb->dev->features & NETIF_F_GRO) || netpoll_rx_on(skb))
+	if (!(skb->dev->legacy_features & NETIF_F_GRO) || netpoll_rx_on(skb))
 		goto normal;
 
 	if (skb_is_gso(skb) || skb_has_frag_list(skb))
@@ -5249,11 +5249,11 @@ int __netdev_update_features(struct net_device *dev)
 	/* driver might be less strict about feature dependencies */
 	features = netdev_fix_features(dev, features);
 
-	if (dev->features == features)
+	if (dev->legacy_features == features)
 		return 0;
 
 	netdev_info(dev, "Features changed: 0x%08x -> 0x%08x\n",
-		dev->features, features);
+		dev->legacy_features, features);
 
 	if (dev->netdev_ops->ndo_set_features)
 		err = dev->netdev_ops->ndo_set_features(dev, features);
@@ -5261,12 +5261,12 @@ int __netdev_update_features(struct net_device *dev)
 	if (unlikely(err < 0)) {
 		netdev_err(dev,
 			"set_features() failed (%d); wanted 0x%08x, left 0x%08x\n",
-			err, features, dev->features);
+			err, features, dev->legacy_features);
 		return -1;
 	}
 
 	if (!err)
-		dev->features = features;
+		dev->legacy_features = features;
 
 	return 1;
 }
@@ -5415,29 +5415,30 @@ int register_netdevice(struct net_device *dev)
 	/* Transfer changeable features to wanted_features and enable
 	 * software offloads (GSO and GRO).
 	 */
-	dev->hw_features |= NETIF_F_SOFT_FEATURES;
-	dev->features |= NETIF_F_SOFT_FEATURES;
-	dev->wanted_features = dev->features & dev->hw_features;
+	dev->legacy_hw_features |= NETIF_F_SOFT_FEATURES;
+	dev->legacy_features |= NETIF_F_SOFT_FEATURES;
+	dev->legacy_wanted_features =
+		dev->legacy_features & dev->legacy_hw_features;
 
 	/* Avoid warning from netdev_fix_features() for GSO without SG */
-	if (!(dev->wanted_features & NETIF_F_SG)) {
-		dev->wanted_features &= ~NETIF_F_GSO;
-		dev->features &= ~NETIF_F_GSO;
+	if (!(dev->legacy_wanted_features & NETIF_F_SG)) {
+		dev->legacy_wanted_features &= ~NETIF_F_GSO;
+		dev->legacy_features &= ~NETIF_F_GSO;
 	}
 
 	/* Turn on no cache copy if HW is doing checksum */
-	dev->hw_features |= NETIF_F_NOCACHE_COPY;
-	if ((dev->features & NETIF_F_ALL_CSUM) &&
-	    !(dev->features & NETIF_F_NO_CSUM)) {
-		dev->wanted_features |= NETIF_F_NOCACHE_COPY;
-		dev->features |= NETIF_F_NOCACHE_COPY;
+	dev->legacy_hw_features |= NETIF_F_NOCACHE_COPY;
+	if ((dev->legacy_features & NETIF_F_ALL_CSUM) &&
+	    !(dev->legacy_features & NETIF_F_NO_CSUM)) {
+		dev->legacy_wanted_features |= NETIF_F_NOCACHE_COPY;
+		dev->legacy_features |= NETIF_F_NOCACHE_COPY;
 	}
 
 	/* Enable GRO and NETIF_F_HIGHDMA for vlans by default,
 	 * vlan_dev_init() will do the dev->features check, so these features
 	 * are enabled only if supported by underlying device.
 	 */
-	dev->vlan_features |= (NETIF_F_GRO | NETIF_F_HIGHDMA);
+	dev->legacy_vlan_features |= (NETIF_F_GRO | NETIF_F_HIGHDMA);
 
 	ret = call_netdevice_notifiers(NETDEV_POST_INIT, dev);
 	ret = notifier_to_errno(ret);
@@ -6019,7 +6020,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
 
 	/* Don't allow namespace local devices to be moved. */
 	err = -EINVAL;
-	if (dev->features & NETIF_F_NETNS_LOCAL)
+	if (dev->legacy_features & NETIF_F_NETNS_LOCAL)
 		goto out;
 
 	/* Ensure the device has been registrered */
@@ -6352,7 +6353,7 @@ static void __net_exit default_device_exit(struct net *net)
 		char fb_name[IFNAMSIZ];
 
 		/* Ignore unmoveable devices (i.e. loopback) */
-		if (dev->features & NETIF_F_NETNS_LOCAL)
+		if (dev->legacy_features & NETIF_F_NETNS_LOCAL)
 			continue;
 
 		/* Leave virtual devices for the generic cleanup */
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 719670a..fd03c53 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -36,16 +36,16 @@ EXPORT_SYMBOL(ethtool_op_get_link);
 
 u32 ethtool_op_get_tx_csum(struct net_device *dev)
 {
-	return (dev->features & NETIF_F_ALL_CSUM) != 0;
+	return (dev->legacy_features & NETIF_F_ALL_CSUM) != 0;
 }
 EXPORT_SYMBOL(ethtool_op_get_tx_csum);
 
 int ethtool_op_set_tx_csum(struct net_device *dev, u32 data)
 {
 	if (data)
-		dev->features |= NETIF_F_IP_CSUM;
+		dev->legacy_features |= NETIF_F_IP_CSUM;
 	else
-		dev->features &= ~NETIF_F_IP_CSUM;
+		dev->legacy_features &= ~NETIF_F_IP_CSUM;
 
 	return 0;
 }
@@ -54,9 +54,9 @@ EXPORT_SYMBOL(ethtool_op_set_tx_csum);
 int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data)
 {
 	if (data)
-		dev->features |= NETIF_F_HW_CSUM;
+		dev->legacy_features |= NETIF_F_HW_CSUM;
 	else
-		dev->features &= ~NETIF_F_HW_CSUM;
+		dev->legacy_features &= ~NETIF_F_HW_CSUM;
 
 	return 0;
 }
@@ -65,9 +65,9 @@ EXPORT_SYMBOL(ethtool_op_set_tx_hw_csum);
 int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data)
 {
 	if (data)
-		dev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
+		dev->legacy_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
 	else
-		dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
+		dev->legacy_features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
 
 	return 0;
 }
@@ -75,16 +75,16 @@ EXPORT_SYMBOL(ethtool_op_set_tx_ipv6_csum);
 
 u32 ethtool_op_get_sg(struct net_device *dev)
 {
-	return (dev->features & NETIF_F_SG) != 0;
+	return (dev->legacy_features & NETIF_F_SG) != 0;
 }
 EXPORT_SYMBOL(ethtool_op_get_sg);
 
 int ethtool_op_set_sg(struct net_device *dev, u32 data)
 {
 	if (data)
-		dev->features |= NETIF_F_SG;
+		dev->legacy_features |= NETIF_F_SG;
 	else
-		dev->features &= ~NETIF_F_SG;
+		dev->legacy_features &= ~NETIF_F_SG;
 
 	return 0;
 }
@@ -92,16 +92,16 @@ EXPORT_SYMBOL(ethtool_op_set_sg);
 
 u32 ethtool_op_get_tso(struct net_device *dev)
 {
-	return (dev->features & NETIF_F_TSO) != 0;
+	return (dev->legacy_features & NETIF_F_TSO) != 0;
 }
 EXPORT_SYMBOL(ethtool_op_get_tso);
 
 int ethtool_op_set_tso(struct net_device *dev, u32 data)
 {
 	if (data)
-		dev->features |= NETIF_F_TSO;
+		dev->legacy_features |= NETIF_F_TSO;
 	else
-		dev->features &= ~NETIF_F_TSO;
+		dev->legacy_features &= ~NETIF_F_TSO;
 
 	return 0;
 }
@@ -109,16 +109,16 @@ EXPORT_SYMBOL(ethtool_op_set_tso);
 
 u32 ethtool_op_get_ufo(struct net_device *dev)
 {
-	return (dev->features & NETIF_F_UFO) != 0;
+	return (dev->legacy_features & NETIF_F_UFO) != 0;
 }
 EXPORT_SYMBOL(ethtool_op_get_ufo);
 
 int ethtool_op_set_ufo(struct net_device *dev, u32 data)
 {
 	if (data)
-		dev->features |= NETIF_F_UFO;
+		dev->legacy_features |= NETIF_F_UFO;
 	else
-		dev->features &= ~NETIF_F_UFO;
+		dev->legacy_features &= ~NETIF_F_UFO;
 	return 0;
 }
 EXPORT_SYMBOL(ethtool_op_set_ufo);
@@ -137,7 +137,7 @@ u32 ethtool_op_get_flags(struct net_device *dev)
 	 * by a simple masking operation
 	 */
 
-	return dev->features & flags_dup_features;
+	return dev->legacy_features & flags_dup_features;
 }
 EXPORT_SYMBOL(ethtool_op_get_flags);
 
@@ -148,7 +148,7 @@ EXPORT_SYMBOL(ethtool_op_get_flags);
  */
 bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported)
 {
-	u32 features = dev->features & flags_dup_features;
+	u32 features = dev->legacy_features & flags_dup_features;
 	/* "data" can contain only flags_dup_features bits,
 	 * see __ethtool_set_flags */
 
@@ -161,7 +161,7 @@ int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported)
 	if (ethtool_invalid_flags(dev, data, supported))
 		return -EINVAL;
 
-	dev->features = ((dev->features & ~flags_dup_features) |
+	dev->legacy_features = ((dev->legacy_features & ~flags_dup_features) |
 			 (data & flags_dup_features));
 	return 0;
 }
@@ -261,9 +261,9 @@ static int ethtool_get_features(struct net_device *dev, void __user *useraddr)
 	};
 	struct ethtool_get_features_block features[ETHTOOL_DEV_FEATURE_WORDS] = {
 		{
-			.available = dev->hw_features,
-			.requested = dev->wanted_features,
-			.active = dev->features,
+			.available = dev->legacy_hw_features,
+			.requested = dev->legacy_wanted_features,
+			.active = dev->legacy_features,
 			.never_changed = NETIF_F_NEVER_CHANGE,
 		},
 	};
@@ -310,16 +310,17 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr)
 	if (ethtool_set_features_compat(dev, features))
 		ret |= ETHTOOL_F_COMPAT;
 
-	if (features[0].valid & ~dev->hw_features) {
-		features[0].valid &= dev->hw_features;
+	if (features[0].valid & ~dev->legacy_hw_features) {
+		features[0].valid &= dev->legacy_hw_features;
 		ret |= ETHTOOL_F_UNSUPPORTED;
 	}
 
-	dev->wanted_features &= ~features[0].valid;
-	dev->wanted_features |= features[0].valid & features[0].requested;
+	dev->legacy_wanted_features &= ~features[0].valid;
+	dev->legacy_wanted_features |= features[0].valid & features[0].requested;
 	__netdev_update_features(dev);
 
-	if ((dev->wanted_features ^ dev->features) & features[0].valid)
+	if ((dev->legacy_wanted_features ^ dev->legacy_features)
+			& features[0].valid)
 		ret |= ETHTOOL_F_WISH;
 
 	return ret;
@@ -445,7 +446,7 @@ static void *__ethtool_get_one_feature_actor(struct net_device *dev, u32 ethcmd)
 
 static u32 __ethtool_get_rx_csum_oldbug(struct net_device *dev)
 {
-	return !!(dev->features & NETIF_F_ALL_CSUM);
+	return !!(dev->legacy_features & NETIF_F_ALL_CSUM);
 }
 
 static int ethtool_get_one_feature(struct net_device *dev,
@@ -454,11 +455,11 @@ static int ethtool_get_one_feature(struct net_device *dev,
 	u32 mask = ethtool_get_feature_mask(ethcmd);
 	struct ethtool_value edata = {
 		.cmd = ethcmd,
-		.data = !!(dev->features & mask),
+		.data = !!(dev->legacy_features & mask),
 	};
 
 	/* compatibility with discrete get_ ops */
-	if (!(dev->hw_features & mask)) {
+	if (!(dev->legacy_hw_features & mask)) {
 		u32 (*actor)(struct net_device *);
 
 		actor = __ethtool_get_one_feature_actor(dev, ethcmd);
@@ -492,12 +493,12 @@ static int ethtool_set_one_feature(struct net_device *dev,
 		return -EFAULT;
 
 	mask = ethtool_get_feature_mask(ethcmd);
-	mask &= dev->hw_features;
+	mask &= dev->legacy_hw_features;
 	if (mask) {
 		if (edata.data)
-			dev->wanted_features |= mask;
+			dev->legacy_wanted_features |= mask;
 		else
-			dev->wanted_features &= ~mask;
+			dev->legacy_wanted_features &= ~mask;
 
 		__netdev_update_features(dev);
 		return 0;
@@ -537,19 +538,19 @@ int __ethtool_set_flags(struct net_device *dev, u32 data)
 
 	/* legacy set_flags() op */
 	if (dev->ethtool_ops->set_flags) {
-		if (unlikely(dev->hw_features & flags_dup_features))
+		if (unlikely(dev->legacy_hw_features & flags_dup_features))
 			netdev_warn(dev,
 				"driver BUG: mixed hw_features and set_flags()\n");
 		return dev->ethtool_ops->set_flags(dev, data);
 	}
 
 	/* allow changing only bits set in hw_features */
-	changed = (data ^ dev->wanted_features) & flags_dup_features;
-	if (changed & ~dev->hw_features)
-		return (changed & dev->hw_features) ? -EINVAL : -EOPNOTSUPP;
+	changed = (data ^ dev->legacy_wanted_features) & flags_dup_features;
+	if (changed & ~dev->legacy_hw_features)
+		return (changed & dev->legacy_hw_features) ? -EINVAL : -EOPNOTSUPP;
 
-	dev->wanted_features =
-		(dev->wanted_features & ~changed) | data;
+	dev->legacy_wanted_features =
+		(dev->legacy_wanted_features & ~changed) | data;
 
 	__netdev_update_features(dev);
 
@@ -908,7 +909,7 @@ static noinline_for_stack int ethtool_set_rx_ntuple(struct net_device *dev,
 	struct ethtool_rx_ntuple_flow_spec_container *fsc = NULL;
 	int ret;
 
-	if (!(dev->features & NETIF_F_NTUPLE))
+	if (!(dev->legacy_features & NETIF_F_NTUPLE))
 		return -EINVAL;
 
 	if (copy_from_user(&cmd, useraddr, sizeof(cmd)))
@@ -1475,7 +1476,7 @@ static int __ethtool_set_sg(struct net_device *dev, u32 data)
 	if (!dev->ethtool_ops->set_sg)
 		return -EOPNOTSUPP;
 
-	if (data && !(dev->features & NETIF_F_ALL_CSUM))
+	if (data && !(dev->legacy_features & NETIF_F_ALL_CSUM))
 		return -EINVAL;
 
 	if (!data && dev->ethtool_ops->set_tso) {
@@ -1514,7 +1515,7 @@ static int __ethtool_set_rx_csum(struct net_device *dev, u32 data)
 		return -EOPNOTSUPP;
 
 	if (!data)
-		dev->features &= ~NETIF_F_GRO;
+		dev->legacy_features &= ~NETIF_F_GRO;
 
 	return dev->ethtool_ops->set_rx_csum(dev, data);
 }
@@ -1524,7 +1525,7 @@ static int __ethtool_set_tso(struct net_device *dev, u32 data)
 	if (!dev->ethtool_ops->set_tso)
 		return -EOPNOTSUPP;
 
-	if (data && !(dev->features & NETIF_F_SG))
+	if (data && !(dev->legacy_features & NETIF_F_SG))
 		return -EINVAL;
 
 	return dev->ethtool_ops->set_tso(dev, data);
@@ -1534,10 +1535,10 @@ static int __ethtool_set_ufo(struct net_device *dev, u32 data)
 {
 	if (!dev->ethtool_ops->set_ufo)
 		return -EOPNOTSUPP;
-	if (data && !(dev->features & NETIF_F_SG))
+	if (data && !(dev->legacy_features & NETIF_F_SG))
 		return -EINVAL;
-	if (data && !((dev->features & NETIF_F_GEN_CSUM) ||
-		(dev->features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))
+	if (data && !((dev->legacy_features & NETIF_F_GEN_CSUM) ||
+		(dev->legacy_features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))
 			== (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM)))
 		return -EINVAL;
 	return dev->ethtool_ops->set_ufo(dev, data);
@@ -1805,7 +1806,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
 		if (rc  < 0)
 			return rc;
 	}
-	old_features = dev->features;
+	old_features = dev->legacy_features;
 
 	switch (ethcmd) {
 	case ETHTOOL_GSET:
@@ -1960,7 +1961,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
 	if (dev->ethtool_ops->complete)
 		dev->ethtool_ops->complete(dev);
 
-	if (old_features != dev->features)
+	if (old_features != dev->legacy_features)
 		netdev_features_change(dev);
 
 	return rc;
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 5ceb257..088a2d4 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -99,7 +99,7 @@ NETDEVICE_SHOW(addr_assign_type, fmt_dec);
 NETDEVICE_SHOW(addr_len, fmt_dec);
 NETDEVICE_SHOW(iflink, fmt_dec);
 NETDEVICE_SHOW(ifindex, fmt_dec);
-NETDEVICE_SHOW(features, fmt_hex);
+NETDEVICE_SHOW(legacy_features, fmt_hex);
 NETDEVICE_SHOW(type, fmt_dec);
 NETDEVICE_SHOW(link_mode, fmt_dec);
 
@@ -316,7 +316,7 @@ static struct device_attribute net_class_attributes[] = {
 	__ATTR(ifalias, S_IRUGO | S_IWUSR, show_ifalias, store_ifalias),
 	__ATTR(iflink, S_IRUGO, show_iflink, NULL),
 	__ATTR(ifindex, S_IRUGO, show_ifindex, NULL),
-	__ATTR(features, S_IRUGO, show_features, NULL),
+	__ATTR(legacy_features, S_IRUGO, show_legacy_features, NULL),
 	__ATTR(type, S_IRUGO, show_type, NULL),
 	__ATTR(link_mode, S_IRUGO, show_link_mode, NULL),
 	__ATTR(address, S_IRUGO, show_address, NULL),
diff --git a/net/core/sock.c b/net/core/sock.c
index 7dfed79..4f067df 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1301,7 +1301,7 @@ EXPORT_SYMBOL_GPL(sk_clone);
 void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
 {
 	__sk_dst_set(sk, dst);
-	sk->sk_route_caps = dst->dev->features;
+	sk->sk_route_caps = dst->dev->legacy_features;
 	if (sk->sk_route_caps & NETIF_F_GSO)
 		sk->sk_route_caps |= NETIF_F_GSO_SOFTWARE;
 	sk->sk_route_caps &= ~sk->sk_route_nocaps;
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 02/20] net-ipv4: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44 ` [PATCH 01/20] net-core: " Mahesh Bandewar
@ 2011-04-06  0:44   ` Mahesh Bandewar
  2011-04-06  0:44     ` [PATCH 03/20] net-ipv6: " Mahesh Bandewar
  2011-04-06  1:27   ` [PATCH 01/20] net-core: " Ben Hutchings
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 net/ipv4/ip_gre.c                  |    6 +++---
 net/ipv4/ip_output.c               |   12 ++++++------
 net/ipv4/ipip.c                    |    4 ++--
 net/ipv4/ipmr.c                    |    2 +-
 net/ipv4/netfilter/nf_nat_helper.c |    2 +-
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index da5941f..e358cbf 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -1260,7 +1260,7 @@ static void ipgre_tunnel_setup(struct net_device *dev)
 	dev->flags		= IFF_NOARP;
 	dev->iflink		= 0;
 	dev->addr_len		= 4;
-	dev->features		|= NETIF_F_NETNS_LOCAL;
+	dev->legacy_features	|= NETIF_F_NETNS_LOCAL;
 	dev->priv_flags		&= ~IFF_XMIT_DST_RELEASE;
 }
 
@@ -1506,7 +1506,7 @@ static void ipgre_tap_setup(struct net_device *dev)
 	dev->destructor 	= ipgre_dev_free;
 
 	dev->iflink		= 0;
-	dev->features		|= NETIF_F_NETNS_LOCAL;
+	dev->legacy_features	|= NETIF_F_NETNS_LOCAL;
 }
 
 static int ipgre_newlink(struct net *src_net, struct net_device *dev, struct nlattr *tb[],
@@ -1533,7 +1533,7 @@ static int ipgre_newlink(struct net *src_net, struct net_device *dev, struct nla
 
 	/* Can use a lockless transmit, unless we generate output sequences */
 	if (!(nt->parms.o_flags & GRE_SEQ))
-		dev->features |= NETIF_F_LLTX;
+		dev->legacy_features |= NETIF_F_LLTX;
 
 	err = register_netdevice(dev);
 	if (err)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 86a2843..cb83f7f 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -816,7 +816,7 @@ static int __ip_append_data(struct sock *sk, struct sk_buff_head *queue,
 	 */
 	if (transhdrlen &&
 	    length + fragheaderlen <= mtu &&
-	    rt->dst.dev->features & NETIF_F_V4_CSUM &&
+	    rt->dst.dev->legacy_features & NETIF_F_V4_CSUM &&
 	    !exthdrlen)
 		csummode = CHECKSUM_PARTIAL;
 
@@ -825,7 +825,7 @@ static int __ip_append_data(struct sock *sk, struct sk_buff_head *queue,
 	cork->length += length;
 	if (((length > mtu) || (skb && skb_is_gso(skb))) &&
 	    (sk->sk_protocol == IPPROTO_UDP) &&
-	    (rt->dst.dev->features & NETIF_F_UFO)) {
+	    (rt->dst.dev->legacy_features & NETIF_F_UFO)) {
 		err = ip_ufo_append_data(sk, queue, getfrag, from, length,
 					 hh_len, fragheaderlen, transhdrlen,
 					 mtu, flags);
@@ -873,7 +873,7 @@ alloc_new_skb:
 			fraglen = datalen + fragheaderlen;
 
 			if ((flags & MSG_MORE) &&
-			    !(rt->dst.dev->features&NETIF_F_SG))
+			    !(rt->dst.dev->legacy_features & NETIF_F_SG))
 				alloclen = mtu;
 			else
 				alloclen = fraglen;
@@ -960,7 +960,7 @@ alloc_new_skb:
 		if (copy > length)
 			copy = length;
 
-		if (!(rt->dst.dev->features&NETIF_F_SG)) {
+		if (!(rt->dst.dev->legacy_features & NETIF_F_SG)) {
 			unsigned int off;
 
 			off = skb->len;
@@ -1131,7 +1131,7 @@ ssize_t	ip_append_page(struct sock *sk, struct page *page,
 	if (inet->cork.flags & IPCORK_OPT)
 		opt = inet->cork.opt;
 
-	if (!(rt->dst.dev->features&NETIF_F_SG))
+	if (!(rt->dst.dev->legacy_features & NETIF_F_SG))
 		return -EOPNOTSUPP;
 
 	hh_len = LL_RESERVED_SPACE(rt->dst.dev);
@@ -1151,7 +1151,7 @@ ssize_t	ip_append_page(struct sock *sk, struct page *page,
 	inet->cork.length += size;
 	if ((size + skb->len > mtu) &&
 	    (sk->sk_protocol == IPPROTO_UDP) &&
-	    (rt->dst.dev->features & NETIF_F_UFO)) {
+	    (rt->dst.dev->legacy_features & NETIF_F_UFO)) {
 		skb_shinfo(skb)->gso_size = mtu - fragheaderlen;
 		skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
 	}
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index bfc17c5..37360d6 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -751,8 +751,8 @@ static void ipip_tunnel_setup(struct net_device *dev)
 	dev->flags		= IFF_NOARP;
 	dev->iflink		= 0;
 	dev->addr_len		= 4;
-	dev->features		|= NETIF_F_NETNS_LOCAL;
-	dev->features		|= NETIF_F_LLTX;
+	dev->legacy_features	|= NETIF_F_NETNS_LOCAL;
+	dev->legacy_features	|= NETIF_F_LLTX;
 	dev->priv_flags		&= ~IFF_XMIT_DST_RELEASE;
 }
 
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 1f62eae..f94b754 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -469,7 +469,7 @@ static void reg_vif_setup(struct net_device *dev)
 	dev->flags		= IFF_NOARP;
 	dev->netdev_ops		= &reg_vif_netdev_ops,
 	dev->destructor		= free_netdev;
-	dev->features		|= NETIF_F_NETNS_LOCAL;
+	dev->legacy_features	|= NETIF_F_NETNS_LOCAL;
 }
 
 static struct net_device *ipmr_reg_vif(struct net *net, struct mr_table *mrt)
diff --git a/net/ipv4/netfilter/nf_nat_helper.c b/net/ipv4/netfilter/nf_nat_helper.c
index 31427fb..7c4e698 100644
--- a/net/ipv4/netfilter/nf_nat_helper.c
+++ b/net/ipv4/netfilter/nf_nat_helper.c
@@ -160,7 +160,7 @@ static void nf_nat_csum(struct sk_buff *skb, struct iphdr *iph, void *data,
 
 	if (skb->ip_summed != CHECKSUM_PARTIAL) {
 		if (!(rt->rt_flags & RTCF_LOCAL) &&
-		    skb->dev->features & NETIF_F_V4_CSUM) {
+		    skb->dev->legacy_features & NETIF_F_V4_CSUM) {
 			skb->ip_summed = CHECKSUM_PARTIAL;
 			skb->csum_start = skb_headroom(skb) +
 					  skb_network_offset(skb) +
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 03/20] net-ipv6: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44   ` [PATCH 02/20] net-ipv4: " Mahesh Bandewar
@ 2011-04-06  0:44     ` Mahesh Bandewar
  2011-04-06  0:44       ` [PATCH 04/20] net-vlan: " Mahesh Bandewar
  0 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 net/dccp/ipv6.c       |    2 +-
 net/ipv6/ip6_output.c |    6 +++---
 net/ipv6/ip6_tunnel.c |    2 +-
 net/ipv6/ip6mr.c      |    2 +-
 net/ipv6/sit.c        |    4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index de1b7e3..254a6df 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -555,7 +555,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
 	 */
 
 	__ip6_dst_store(newsk, dst, NULL, NULL);
-	newsk->sk_route_caps = dst->dev->features & ~(NETIF_F_IP_CSUM |
+	newsk->sk_route_caps = dst->dev->legacy_features & ~(NETIF_F_IP_CSUM |
 						      NETIF_F_TSO);
 	newdp6 = (struct dccp6_sock *)newsk;
 	newinet = inet_sk(newsk);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 1820887..ba1183d 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1276,7 +1276,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
 		}
 
 		if (proto == IPPROTO_UDP &&
-		    (rt->dst.dev->features & NETIF_F_UFO)) {
+		    (rt->dst.dev->legacy_features & NETIF_F_UFO)) {
 
 			err = ip6_ufo_append_data(sk, getfrag, from, length,
 						  hh_len, fragheaderlen,
@@ -1322,7 +1322,7 @@ alloc_new_skb:
 
 			fraglen = datalen + fragheaderlen;
 			if ((flags & MSG_MORE) &&
-			    !(rt->dst.dev->features&NETIF_F_SG))
+			    !(rt->dst.dev->legacy_features & NETIF_F_SG))
 				alloclen = mtu;
 			else
 				alloclen = datalen + fragheaderlen;
@@ -1419,7 +1419,7 @@ alloc_new_skb:
 		if (copy > length)
 			copy = length;
 
-		if (!(rt->dst.dev->features&NETIF_F_SG)) {
+		if (!(rt->dst.dev->legacy_features & NETIF_F_SG)) {
 			unsigned int off;
 
 			off = skb->len;
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index c1b1bd3..6ae9598 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1385,7 +1385,7 @@ static void ip6_tnl_dev_setup(struct net_device *dev)
 		dev->mtu-=8;
 	dev->flags |= IFF_NOARP;
 	dev->addr_len = sizeof(struct in6_addr);
-	dev->features |= NETIF_F_NETNS_LOCAL;
+	dev->legacy_features |= NETIF_F_NETNS_LOCAL;
 	dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
 }
 
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 29e4859..d137089 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -719,7 +719,7 @@ static void reg_vif_setup(struct net_device *dev)
 	dev->flags		= IFF_NOARP;
 	dev->netdev_ops		= &reg_vif_netdev_ops;
 	dev->destructor		= free_netdev;
-	dev->features		|= NETIF_F_NETNS_LOCAL;
+	dev->legacy_features	|= NETIF_F_NETNS_LOCAL;
 }
 
 static struct net_device *ip6mr_reg_vif(struct net *net, struct mr6_table *mrt)
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 43b3337..38aba2f 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1139,8 +1139,8 @@ static void ipip6_tunnel_setup(struct net_device *dev)
 	dev->priv_flags	       &= ~IFF_XMIT_DST_RELEASE;
 	dev->iflink		= 0;
 	dev->addr_len		= 4;
-	dev->features		|= NETIF_F_NETNS_LOCAL;
-	dev->features		|= NETIF_F_LLTX;
+	dev->legacy_features	|= NETIF_F_NETNS_LOCAL;
+	dev->legacy_features	|= NETIF_F_LLTX;
 }
 
 static int ipip6_tunnel_init(struct net_device *dev)
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 04/20] net-vlan: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44     ` [PATCH 03/20] net-ipv6: " Mahesh Bandewar
@ 2011-04-06  0:44       ` Mahesh Bandewar
  2011-04-06  0:44         ` [PATCH 05/20] net-bridge: " Mahesh Bandewar
  0 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 include/linux/if_vlan.h |    4 ++--
 net/8021q/vlan.c        |   12 ++++++------
 net/8021q/vlan_dev.c    |    9 +++++----
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 635e1fa..1c71568 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -276,7 +276,7 @@ static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb,
  */
 static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
 {
-	if (skb->dev->features & NETIF_F_HW_VLAN_TX) {
+	if (skb->dev->legacy_features & NETIF_F_HW_VLAN_TX) {
 		return __vlan_hwaccel_put_tag(skb, vlan_tci);
 	} else {
 		return __vlan_put_tag(skb, vlan_tci);
@@ -332,7 +332,7 @@ static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb,
  */
 static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
 {
-	if (skb->dev->features & NETIF_F_HW_VLAN_TX) {
+	if (skb->dev->legacy_features & NETIF_F_HW_VLAN_TX) {
 		return __vlan_hwaccel_get_tag(skb, vlan_tci);
 	} else {
 		return __vlan_get_tag(skb, vlan_tci);
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index e47600b..93325b8 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -119,7 +119,7 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head)
 	 * HW accelerating devices or SW vlan input packet processing if
 	 * VLAN is not 0 (leave it there for 802.1p).
 	 */
-	if (vlan_id && (real_dev->features & NETIF_F_HW_VLAN_FILTER))
+	if (vlan_id && (real_dev->legacy_features & NETIF_F_HW_VLAN_FILTER))
 		ops->ndo_vlan_rx_kill_vid(real_dev, vlan_id);
 
 	grp->nr_vlans--;
@@ -151,12 +151,12 @@ int vlan_check_real_dev(struct net_device *real_dev, u16 vlan_id)
 	const char *name = real_dev->name;
 	const struct net_device_ops *ops = real_dev->netdev_ops;
 
-	if (real_dev->features & NETIF_F_VLAN_CHALLENGED) {
+	if (real_dev->legacy_features & NETIF_F_VLAN_CHALLENGED) {
 		pr_info("8021q: VLANs not supported on %s\n", name);
 		return -EOPNOTSUPP;
 	}
 
-	if ((real_dev->features & NETIF_F_HW_VLAN_FILTER) &&
+	if ((real_dev->legacy_features & NETIF_F_HW_VLAN_FILTER) &&
 	    (!ops->ndo_vlan_rx_add_vid || !ops->ndo_vlan_rx_kill_vid)) {
 		pr_info("8021q: Device %s has buggy VLAN hw accel\n", name);
 		return -EOPNOTSUPP;
@@ -212,7 +212,7 @@ int register_vlan_dev(struct net_device *dev)
 			ops->ndo_vlan_rx_register(real_dev, ngrp);
 		rcu_assign_pointer(real_dev->vlgrp, ngrp);
 	}
-	if (real_dev->features & NETIF_F_HW_VLAN_FILTER)
+	if (real_dev->legacy_features & NETIF_F_HW_VLAN_FILTER)
 		ops->ndo_vlan_rx_add_vid(real_dev, vlan_id);
 
 	return 0;
@@ -329,7 +329,7 @@ static void vlan_transfer_features(struct net_device *dev,
 {
 	vlandev->gso_max_size = dev->gso_max_size;
 
-	if (dev->features & NETIF_F_HW_VLAN_TX)
+	if (dev->legacy_features & NETIF_F_HW_VLAN_TX)
 		vlandev->hard_header_len = dev->hard_header_len;
 	else
 		vlandev->hard_header_len = dev->hard_header_len + VLAN_HLEN;
@@ -375,7 +375,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
 		__vlan_device_event(dev, event);
 
 	if ((event == NETDEV_UP) &&
-	    (dev->features & NETIF_F_HW_VLAN_FILTER) &&
+	    (dev->legacy_features & NETIF_F_HW_VLAN_FILTER) &&
 	    dev->netdev_ops->ndo_vlan_rx_add_vid) {
 		pr_info("8021q: adding VLAN 0 to HW filter on device %s\n",
 			dev->name);
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index b84a46b..52f2f44 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -704,8 +704,9 @@ static int vlan_dev_init(struct net_device *dev)
 					  (1<<__LINK_STATE_DORMANT))) |
 		      (1<<__LINK_STATE_PRESENT);
 
-	dev->hw_features = real_dev->vlan_features & NETIF_F_ALL_TX_OFFLOADS;
-	dev->features |= real_dev->vlan_features | NETIF_F_LLTX;
+	dev->legacy_hw_features =
+		real_dev->legacy_vlan_features & NETIF_F_ALL_TX_OFFLOADS;
+	dev->legacy_features |= real_dev->legacy_vlan_features | NETIF_F_LLTX;
 	dev->gso_max_size = real_dev->gso_max_size;
 
 	/* ipv6 shared card related stuff */
@@ -721,7 +722,7 @@ static int vlan_dev_init(struct net_device *dev)
 #endif
 
 	dev->needed_headroom = real_dev->needed_headroom;
-	if (real_dev->features & NETIF_F_HW_VLAN_TX) {
+	if (real_dev->legacy_features & NETIF_F_HW_VLAN_TX) {
 		dev->header_ops      = real_dev->header_ops;
 		dev->hard_header_len = real_dev->hard_header_len;
 	} else {
@@ -763,7 +764,7 @@ static u32 vlan_dev_fix_features(struct net_device *dev, u32 features)
 {
 	struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
 
-	features &= (real_dev->features | NETIF_F_LLTX);
+	features &= (real_dev->legacy_features | NETIF_F_LLTX);
 	if (dev_ethtool_get_rx_csum(real_dev))
 		features |= NETIF_F_RXCSUM;
 
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 05/20] net-bridge: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44       ` [PATCH 04/20] net-vlan: " Mahesh Bandewar
@ 2011-04-06  0:44         ` Mahesh Bandewar
  2011-04-06  0:44           ` [PATCH 06/20] net-decnet: " Mahesh Bandewar
  0 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 net/bridge/br_device.c |    2 +-
 net/bridge/br_if.c     |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 45cfd54..e509040 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -387,7 +387,7 @@ void br_dev_setup(struct net_device *dev)
 	dev->tx_queue_len = 0;
 	dev->priv_flags = IFF_EBRIDGE;
 
-	dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
+	dev->legacy_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
 			NETIF_F_GSO_MASK | NETIF_F_NO_CSUM | NETIF_F_LLTX |
 			NETIF_F_NETNS_LOCAL | NETIF_F_GSO | NETIF_F_HW_VLAN_TX;
 
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 7f5379c..17d94b0 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -304,11 +304,11 @@ void br_features_recompute(struct net_bridge *br)
 
 	list_for_each_entry(p, &br->port_list, list) {
 		features = netdev_increment_features(features,
-						     p->dev->features, mask);
+						     p->dev->legacy_features, mask);
 	}
 
 done:
-	br->dev->features = netdev_fix_features(br->dev, features);
+	br->dev->legacy_features = netdev_fix_features(br->dev, features);
 }
 
 /* called with RTNL */
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 06/20] net-decnet: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44         ` [PATCH 05/20] net-bridge: " Mahesh Bandewar
@ 2011-04-06  0:44           ` Mahesh Bandewar
  2011-04-06  0:44             ` [PATCH 07/20] net-dsa: " Mahesh Bandewar
  0 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 net/decnet/af_decnet.c  |    2 +-
 net/decnet/dn_nsp_out.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index ea3b6ee..5f0a6f9 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -955,7 +955,7 @@ static int __dn_connect(struct sock *sk, struct sockaddr_dn *addr, int addrlen,
 	fld.flowidn_proto = DNPROTO_NSP;
 	if (dn_route_output_sock(&sk->sk_dst_cache, &fld, sk, flags) < 0)
 		goto out;
-	sk->sk_route_caps = sk->sk_dst_cache->dev->features;
+	sk->sk_route_caps = sk->sk_dst_cache->dev->legacy_features;
 	sock->state = SS_CONNECTING;
 	scp->state = DN_CI;
 	scp->segsize_loc = dst_metric_advmss(sk->sk_dst_cache);
diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c
index bd78836..4f70026 100644
--- a/net/decnet/dn_nsp_out.c
+++ b/net/decnet/dn_nsp_out.c
@@ -99,7 +99,7 @@ try_again:
 	fld.flowidn_proto = DNPROTO_NSP;
 	if (dn_route_output_sock(&sk->sk_dst_cache, &fld, sk, 0) == 0) {
 		dst = sk_dst_get(sk);
-		sk->sk_route_caps = dst->dev->features;
+		sk->sk_route_caps = dst->dev->legacy_features;
 		goto try_again;
 	}
 
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 07/20] net-dsa: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44           ` [PATCH 06/20] net-decnet: " Mahesh Bandewar
@ 2011-04-06  0:44             ` Mahesh Bandewar
  2011-04-06  0:44               ` [PATCH 08/20] net-l2tp: " Mahesh Bandewar
  0 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 net/dsa/slave.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 64ca2a6..fb40250 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -349,7 +349,7 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
 	if (slave_dev == NULL)
 		return slave_dev;
 
-	slave_dev->features = master->vlan_features;
+	slave_dev->legacy_features = master->legacy_vlan_features;
 	SET_ETHTOOL_OPS(slave_dev, &dsa_slave_ethtool_ops);
 	memcpy(slave_dev->dev_addr, master->dev_addr, ETH_ALEN);
 	slave_dev->tx_queue_len = 0;
@@ -375,7 +375,7 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
 	}
 
 	SET_NETDEV_DEV(slave_dev, parent);
-	slave_dev->vlan_features = master->vlan_features;
+	slave_dev->legacy_vlan_features = master->legacy_vlan_features;
 
 	p = netdev_priv(slave_dev);
 	p->dev = slave_dev;
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 08/20] net-l2tp: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44             ` [PATCH 07/20] net-dsa: " Mahesh Bandewar
@ 2011-04-06  0:44               ` Mahesh Bandewar
  2011-04-06  0:44                 ` [PATCH 09/20] net-phonet: " Mahesh Bandewar
  0 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 net/l2tp/l2tp_core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index c64ce0a..265cda5 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1081,7 +1081,7 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len
 		if (sk->sk_no_check == UDP_CSUM_NOXMIT)
 			skb->ip_summed = CHECKSUM_NONE;
 		else if ((skb_dst(skb) && skb_dst(skb)->dev) &&
-			 (!(skb_dst(skb)->dev->features & NETIF_F_V4_CSUM))) {
+			 (!(skb_dst(skb)->dev->legacy_features & NETIF_F_V4_CSUM))) {
 			skb->ip_summed = CHECKSUM_COMPLETE;
 			csum = skb_checksum(skb, 0, udp_len, 0);
 			uh->check = csum_tcpudp_magic(inet->inet_saddr,
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 09/20] net-phonet: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44               ` [PATCH 08/20] net-l2tp: " Mahesh Bandewar
@ 2011-04-06  0:44                 ` Mahesh Bandewar
  2011-04-06  0:44                   ` [PATCH 10/20] net-sctp: " Mahesh Bandewar
  0 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 net/phonet/pep-gprs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/phonet/pep-gprs.c b/net/phonet/pep-gprs.c
index d012089..d0fcbe5 100644
--- a/net/phonet/pep-gprs.c
+++ b/net/phonet/pep-gprs.c
@@ -236,7 +236,7 @@ static const struct net_device_ops gprs_netdev_ops = {
 
 static void gprs_setup(struct net_device *dev)
 {
-	dev->features		= NETIF_F_FRAGLIST;
+	dev->legacy_features	= NETIF_F_FRAGLIST;
 	dev->type		= ARPHRD_PHONET_PIPE;
 	dev->flags		= IFF_POINTOPOINT | IFF_NOARP;
 	dev->mtu		= GPRS_DEFAULT_MTU;
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 10/20] net-sctp: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44                 ` [PATCH 09/20] net-phonet: " Mahesh Bandewar
@ 2011-04-06  0:44                   ` Mahesh Bandewar
  2011-04-06  0:44                     ` [PATCH 11/20] net-wireless: " Mahesh Bandewar
  0 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 net/sctp/output.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sctp/output.c b/net/sctp/output.c
index 60600d3..36efd46 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -501,7 +501,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
 	 * by CRC32-C as described in <draft-ietf-tsvwg-sctpcsum-02.txt>.
 	 */
 	if (!sctp_checksum_disable &&
-	    !(dst->dev->features & (NETIF_F_NO_CSUM | NETIF_F_SCTP_CSUM))) {
+	    !(dst->dev->legacy_features & (NETIF_F_NO_CSUM | NETIF_F_SCTP_CSUM))) {
 		__u32 crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len);
 
 		/* 3) Put the resultant value into the checksum field in the
@@ -509,7 +509,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
 		 */
 		sh->checksum = sctp_end_cksum(crc32);
 	} else {
-		if (dst->dev->features & NETIF_F_SCTP_CSUM) {
+		if (dst->dev->legacy_features & NETIF_F_SCTP_CSUM) {
 			/* no need to seed psuedo checksum for SCTP */
 			nskb->ip_summed = CHECKSUM_PARTIAL;
 			nskb->csum_start = (skb_transport_header(nskb) -
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 11/20] net-wireless: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44                   ` [PATCH 10/20] net-sctp: " Mahesh Bandewar
@ 2011-04-06  0:44                     ` Mahesh Bandewar
  2011-04-06  0:44                       ` [PATCH 12/20] loopback: " Mahesh Bandewar
  0 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 net/wireless/core.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/wireless/core.c b/net/wireless/core.c
index fe01de2..f5b619d 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -235,11 +235,11 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
 		return -EOPNOTSUPP;
 
 	list_for_each_entry(wdev, &rdev->netdev_list, list) {
-		wdev->netdev->features &= ~NETIF_F_NETNS_LOCAL;
+		wdev->netdev->legacy_features &= ~NETIF_F_NETNS_LOCAL;
 		err = dev_change_net_namespace(wdev->netdev, net, "wlan%d");
 		if (err)
 			break;
-		wdev->netdev->features |= NETIF_F_NETNS_LOCAL;
+		wdev->netdev->legacy_features |= NETIF_F_NETNS_LOCAL;
 	}
 
 	if (err) {
@@ -248,11 +248,11 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
 
 		list_for_each_entry_continue_reverse(wdev, &rdev->netdev_list,
 						     list) {
-			wdev->netdev->features &= ~NETIF_F_NETNS_LOCAL;
+			wdev->netdev->legacy_features &= ~NETIF_F_NETNS_LOCAL;
 			err = dev_change_net_namespace(wdev->netdev, net,
 							"wlan%d");
 			WARN_ON(err);
-			wdev->netdev->features |= NETIF_F_NETNS_LOCAL;
+			wdev->netdev->legacy_features |= NETIF_F_NETNS_LOCAL;
 		}
 
 		return err;
@@ -697,7 +697,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
 		list_add_rcu(&wdev->list, &rdev->netdev_list);
 		rdev->devlist_generation++;
 		/* can only change netns with wiphy */
-		dev->features |= NETIF_F_NETNS_LOCAL;
+		dev->legacy_features |= NETIF_F_NETNS_LOCAL;
 
 		if (sysfs_create_link(&dev->dev.kobj, &rdev->wiphy.dev.kobj,
 				      "phy80211")) {
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 12/20] loopback: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44                     ` [PATCH 11/20] net-wireless: " Mahesh Bandewar
@ 2011-04-06  0:44                       ` Mahesh Bandewar
  2011-04-06  0:44                         ` [PATCH 13/20] veth: " Mahesh Bandewar
  0 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 drivers/net/loopback.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index ea0dc45..673fbcc 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -165,8 +165,8 @@ static void loopback_setup(struct net_device *dev)
 	dev->type		= ARPHRD_LOOPBACK;	/* 0x0001*/
 	dev->flags		= IFF_LOOPBACK;
 	dev->priv_flags	       &= ~IFF_XMIT_DST_RELEASE;
-	dev->hw_features	= NETIF_F_ALL_TSO | NETIF_F_UFO;
-	dev->features 		= NETIF_F_SG | NETIF_F_FRAGLIST
+	dev->legacy_hw_features	= NETIF_F_ALL_TSO | NETIF_F_UFO;
+	dev->legacy_features	= NETIF_F_SG | NETIF_F_FRAGLIST
 		| NETIF_F_ALL_TSO
 		| NETIF_F_UFO
 		| NETIF_F_NO_CSUM
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 13/20] veth: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44                       ` [PATCH 12/20] loopback: " Mahesh Bandewar
@ 2011-04-06  0:44                         ` Mahesh Bandewar
  2011-04-06  0:44                           ` [PATCH 14/20] jme: " Mahesh Bandewar
  0 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 drivers/net/veth.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 6542288..a0acfe8 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -131,7 +131,7 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
 	/* don't change ip_summed == CHECKSUM_PARTIAL, as that
 	   will cause bad checksum on forwarded packets */
 	if (skb->ip_summed == CHECKSUM_NONE &&
-	    rcv->features & NETIF_F_RXCSUM)
+	    rcv->legacy_features & NETIF_F_RXCSUM)
 		skb->ip_summed = CHECKSUM_UNNECESSARY;
 
 	length = skb->len;
@@ -265,10 +265,10 @@ static void veth_setup(struct net_device *dev)
 
 	dev->netdev_ops = &veth_netdev_ops;
 	dev->ethtool_ops = &veth_ethtool_ops;
-	dev->features |= NETIF_F_LLTX;
+	dev->legacy_features |= NETIF_F_LLTX;
 	dev->destructor = veth_dev_free;
 
-	dev->hw_features = NETIF_F_NO_CSUM | NETIF_F_SG | NETIF_F_RXCSUM;
+	dev->legacy_hw_features = NETIF_F_NO_CSUM | NETIF_F_SG | NETIF_F_RXCSUM;
 }
 
 /*
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 14/20] jme: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44                         ` [PATCH 13/20] veth: " Mahesh Bandewar
@ 2011-04-06  0:44                           ` Mahesh Bandewar
  2011-04-06  0:44                             ` [PATCH 15/20] sungem: " Mahesh Bandewar
  0 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 drivers/net/jme.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index be4773f..10b972e 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -741,7 +741,7 @@ jme_set_clean_rxdesc(struct jme_adapter *jme, int i)
 	rxdesc->desc1.bufaddrl	= cpu_to_le32(
 					(__u64)rxbi->mapping & 0xFFFFFFFFUL);
 	rxdesc->desc1.datalen	= cpu_to_le16(rxbi->len);
-	if (jme->dev->features & NETIF_F_HIGHDMA)
+	if (jme->dev->legacy_features & NETIF_F_HIGHDMA)
 		rxdesc->desc1.flags = RXFLAG_64BIT;
 	wmb();
 	rxdesc->desc1.flags	|= RXFLAG_OWN | RXFLAG_INT;
@@ -1917,7 +1917,7 @@ jme_map_tx_skb(struct jme_adapter *jme, struct sk_buff *skb, int idx)
 	struct jme_ring *txring = &(jme->txring[0]);
 	struct txdesc *txdesc = txring->desc, *ctxdesc;
 	struct jme_buffer_info *txbi = txring->bufinf, *ctxbi;
-	u8 hidma = jme->dev->features & NETIF_F_HIGHDMA;
+	u8 hidma = jme->dev->legacy_features & NETIF_F_HIGHDMA;
 	int i, nr_frags = skb_shinfo(skb)->nr_frags;
 	int mask = jme->tx_ring_mask;
 	struct skb_frag_struct *frag;
@@ -2911,13 +2911,13 @@ jme_init_one(struct pci_dev *pdev,
 	netdev->netdev_ops = &jme_netdev_ops;
 	netdev->ethtool_ops		= &jme_ethtool_ops;
 	netdev->watchdog_timeo		= TX_TIMEOUT;
-	netdev->hw_features		=	NETIF_F_IP_CSUM |
+	netdev->legacy_hw_features		=	NETIF_F_IP_CSUM |
 						NETIF_F_IPV6_CSUM |
 						NETIF_F_SG |
 						NETIF_F_TSO |
 						NETIF_F_TSO6 |
 						NETIF_F_RXCSUM;
-	netdev->features		=	NETIF_F_IP_CSUM |
+	netdev->legacy_features		=	NETIF_F_IP_CSUM |
 						NETIF_F_IPV6_CSUM |
 						NETIF_F_SG |
 						NETIF_F_TSO |
@@ -2925,7 +2925,7 @@ jme_init_one(struct pci_dev *pdev,
 						NETIF_F_HW_VLAN_TX |
 						NETIF_F_HW_VLAN_RX;
 	if (using_dac)
-		netdev->features	|=	NETIF_F_HIGHDMA;
+		netdev->legacy_features	|=	NETIF_F_HIGHDMA;
 
 	SET_NETDEV_DEV(netdev, &pdev->dev);
 	pci_set_drvdata(pdev, netdev);
@@ -3002,7 +3002,7 @@ jme_init_one(struct pci_dev *pdev,
 	jme->reg_gpreg1 = GPREG1_DEFAULT;
 
 	if (jme->reg_rxmcs & RXMCS_CHECKSUM)
-		netdev->features |= NETIF_F_RXCSUM;
+		netdev->legacy_features |= NETIF_F_RXCSUM;
 
 	/*
 	 * Get Max Read Req Size from PCI Config Space
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 15/20] sungem: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44                           ` [PATCH 14/20] jme: " Mahesh Bandewar
@ 2011-04-06  0:44                             ` Mahesh Bandewar
  2011-04-06  0:44                               ` [PATCH 16/20] sunhme: " Mahesh Bandewar
  0 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 drivers/net/sungem.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index a935426..8ee36c1 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -3146,10 +3146,11 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
 			    gp->phy_mii.def ? gp->phy_mii.def->name : "no");
 
 	/* GEM can do it all... */
-	dev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM;
-	dev->features |= dev->hw_features | NETIF_F_RXCSUM | NETIF_F_LLTX;
+	dev->legacy_hw_features = NETIF_F_SG | NETIF_F_HW_CSUM;
+	dev->legacy_features |=
+		dev->legacy_hw_features | NETIF_F_RXCSUM | NETIF_F_LLTX;
 	if (pci_using_dac)
-		dev->features |= NETIF_F_HIGHDMA;
+		dev->legacy_features |= NETIF_F_HIGHDMA;
 
 	return 0;
 
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 16/20] sunhme: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44                             ` [PATCH 15/20] sungem: " Mahesh Bandewar
@ 2011-04-06  0:44                               ` Mahesh Bandewar
  2011-04-06  0:44                                 ` [PATCH 17/20] usb-smsc75xx: " Mahesh Bandewar
  0 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 drivers/net/sunhme.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 80e907d..9d05f86 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -2788,8 +2788,8 @@ static int __devinit happy_meal_sbus_probe_one(struct platform_device *op, int i
 	dev->ethtool_ops = &hme_ethtool_ops;
 
 	/* Happy Meal can do it all... */
-	dev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM;
-	dev->features |= dev->hw_features | NETIF_F_RXCSUM;
+	dev->legacy_hw_features = NETIF_F_SG | NETIF_F_HW_CSUM;
+	dev->legacy_features |= dev->legacy_hw_features | NETIF_F_RXCSUM;
 
 	dev->irq = op->archdata.irqs[0];
 
@@ -3114,8 +3114,8 @@ static int __devinit happy_meal_pci_probe(struct pci_dev *pdev,
 	dev->dma = 0;
 
 	/* Happy Meal can do it all... */
-	dev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM;
-	dev->features |= dev->hw_features | NETIF_F_RXCSUM;
+	dev->legacy_hw_features = NETIF_F_SG | NETIF_F_HW_CSUM;
+	dev->legacy_features |= dev->legacy_hw_features | NETIF_F_RXCSUM;
 
 #if defined(CONFIG_SBUS) && defined(CONFIG_PCI)
 	/* Hook up PCI register/descriptor accessors. */
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 17/20] usb-smsc75xx: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44                               ` [PATCH 16/20] sunhme: " Mahesh Bandewar
@ 2011-04-06  0:44                                 ` Mahesh Bandewar
  2011-04-06  0:44                                   ` [PATCH 18/20] usb-smsc95xx: " Mahesh Bandewar
  0 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 drivers/net/usb/smsc75xx.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 860a20c..9c22f04 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -927,7 +927,7 @@ static int smsc75xx_reset(struct usbnet *dev)
 	netif_dbg(dev, ifup, dev->net, "RFE_CTL set to 0x%08x", pdata->rfe_ctl);
 
 	/* Enable or disable checksum offload engines */
-	smsc75xx_set_features(dev->net, dev->net->features);
+	smsc75xx_set_features(dev->net, dev->net->legacy_features);
 
 	smsc75xx_set_multicast(dev->net);
 
@@ -1030,15 +1030,15 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf)
 	INIT_WORK(&pdata->set_multicast, smsc75xx_deferred_multicast_write);
 
 	if (DEFAULT_TX_CSUM_ENABLE) {
-		dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
+		dev->net->legacy_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
 		if (DEFAULT_TSO_ENABLE)
-			dev->net->features |= NETIF_F_SG |
+			dev->net->legacy_features |= NETIF_F_SG |
 				NETIF_F_TSO | NETIF_F_TSO6;
 	}
 	if (DEFAULT_RX_CSUM_ENABLE)
-		dev->net->features |= NETIF_F_RXCSUM;
+		dev->net->legacy_features |= NETIF_F_RXCSUM;
 
-	dev->net->hw_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
+	dev->net->legacy_hw_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
 		NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_RXCSUM;
 
 	/* Init all registers */
@@ -1065,7 +1065,7 @@ static void smsc75xx_unbind(struct usbnet *dev, struct usb_interface *intf)
 static void smsc75xx_rx_csum_offload(struct usbnet *dev, struct sk_buff *skb,
 				     u32 rx_cmd_a, u32 rx_cmd_b)
 {
-	if (!(dev->net->features & NETIF_F_RXCSUM) ||
+	if (!(dev->net->legacy_features & NETIF_F_RXCSUM) ||
 	    unlikely(rx_cmd_a & RX_CMD_A_LCSM)) {
 		skb->ip_summed = CHECKSUM_NONE;
 	} else {
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 18/20] usb-smsc95xx: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44                                 ` [PATCH 17/20] usb-smsc75xx: " Mahesh Bandewar
@ 2011-04-06  0:44                                   ` Mahesh Bandewar
  2011-04-06  0:44                                     ` [PATCH 19/20] virtio_net: " Mahesh Bandewar
  0 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 drivers/net/usb/smsc95xx.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 708f208..ffdc654 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -933,7 +933,7 @@ static int smsc95xx_reset(struct usbnet *dev)
 	}
 
 	/* Enable or disable checksum offload engines */
-	smsc95xx_set_features(dev->net, dev->net->features);
+	smsc95xx_set_features(dev->net, dev->net->legacy_features);
 
 	smsc95xx_set_multicast(dev->net);
 
@@ -1000,11 +1000,11 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
 	spin_lock_init(&pdata->mac_cr_lock);
 
 	if (DEFAULT_TX_CSUM_ENABLE)
-		dev->net->features |= NETIF_F_HW_CSUM;
+		dev->net->legacy_features |= NETIF_F_HW_CSUM;
 	if (DEFAULT_RX_CSUM_ENABLE)
-		dev->net->features |= NETIF_F_RXCSUM;
+		dev->net->legacy_features |= NETIF_F_RXCSUM;
 
-	dev->net->hw_features = NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
+	dev->net->legacy_hw_features = NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
 
 	smsc95xx_init_mac_address(dev);
 
@@ -1079,7 +1079,7 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
 
 			/* last frame in this batch */
 			if (skb->len == size) {
-				if (dev->net->features & NETIF_F_RXCSUM)
+				if (dev->net->legacy_features & NETIF_F_RXCSUM)
 					smsc95xx_rx_csum_offload(skb);
 				skb_trim(skb, skb->len - 4); /* remove fcs */
 				skb->truesize = size + sizeof(struct sk_buff);
@@ -1097,7 +1097,7 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
 			ax_skb->data = packet;
 			skb_set_tail_pointer(ax_skb, size);
 
-			if (dev->net->features & NETIF_F_RXCSUM)
+			if (dev->net->legacy_features & NETIF_F_RXCSUM)
 				smsc95xx_rx_csum_offload(ax_skb);
 			skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */
 			ax_skb->truesize = size + sizeof(struct sk_buff);
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 19/20] virtio_net: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44                                   ` [PATCH 18/20] usb-smsc95xx: " Mahesh Bandewar
@ 2011-04-06  0:44                                     ` Mahesh Bandewar
  2011-04-06  0:44                                       ` [PATCH 20/20] xen: " Mahesh Bandewar
  0 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 drivers/net/virtio_net.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 0cb0b06..36eed90 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -892,33 +892,34 @@ static int virtnet_probe(struct virtio_device *vdev)
 
 	/* Set up network device as normal. */
 	dev->netdev_ops = &virtnet_netdev;
-	dev->features = NETIF_F_HIGHDMA;
+	dev->legacy_features = NETIF_F_HIGHDMA;
 	SET_ETHTOOL_OPS(dev, &virtnet_ethtool_ops);
 	SET_NETDEV_DEV(dev, &vdev->dev);
 
 	/* Do we support "hardware" checksums? */
 	if (virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) {
 		/* This opens up the world of extra features. */
-		dev->hw_features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST;
+		dev->legacy_hw_features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST;
 		if (csum)
-			dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST;
+			dev->legacy_features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST;
 
 		if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) {
-			dev->hw_features |= NETIF_F_TSO | NETIF_F_UFO
+			dev->legacy_hw_features |= NETIF_F_TSO | NETIF_F_UFO
 				| NETIF_F_TSO_ECN | NETIF_F_TSO6;
 		}
 		/* Individual feature bits: what can host handle? */
 		if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO4))
-			dev->hw_features |= NETIF_F_TSO;
+			dev->legacy_hw_features |= NETIF_F_TSO;
 		if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO6))
-			dev->hw_features |= NETIF_F_TSO6;
+			dev->legacy_hw_features |= NETIF_F_TSO6;
 		if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN))
-			dev->hw_features |= NETIF_F_TSO_ECN;
+			dev->legacy_hw_features |= NETIF_F_TSO_ECN;
 		if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_UFO))
-			dev->hw_features |= NETIF_F_UFO;
+			dev->legacy_hw_features |= NETIF_F_UFO;
 
 		if (gso)
-			dev->features |= dev->hw_features & (NETIF_F_ALL_TSO|NETIF_F_UFO);
+			dev->legacy_features |=
+				dev->legacy_hw_features & (NETIF_F_ALL_TSO|NETIF_F_UFO);
 		/* (!csum && gso) case will be fixed by register_netdev() */
 	}
 
@@ -965,7 +966,7 @@ static int virtnet_probe(struct virtio_device *vdev)
 		vi->cvq = vqs[2];
 
 		if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VLAN))
-			dev->features |= NETIF_F_HW_VLAN_FILTER;
+			dev->legacy_features |= NETIF_F_HW_VLAN_FILTER;
 	}
 
 	err = register_netdev(dev);
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 20/20] xen: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44                                     ` [PATCH 19/20] virtio_net: " Mahesh Bandewar
@ 2011-04-06  0:44                                       ` Mahesh Bandewar
  0 siblings, 0 replies; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 drivers/net/xen-netfront.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index db9a763..2b7e5b1 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -193,7 +193,7 @@ static void xennet_sysfs_delif(struct net_device *netdev);
 
 static int xennet_can_sg(struct net_device *dev)
 {
-	return dev->features & NETIF_F_SG;
+	return dev->legacy_features & NETIF_F_SG;
 }
 
 
@@ -1247,9 +1247,9 @@ static struct net_device * __devinit xennet_create_dev(struct xenbus_device *dev
 	netdev->netdev_ops	= &xennet_netdev_ops;
 
 	netif_napi_add(netdev, &np->napi, xennet_poll, 64);
-	netdev->features        = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
+	netdev->legacy_features        = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
 				  NETIF_F_GSO_ROBUST;
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->legacy_hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
 
 	/*
          * Assume that all hw features are available for now. This set
@@ -1257,7 +1257,7 @@ static struct net_device * __devinit xennet_create_dev(struct xenbus_device *dev
          * xennet_connect() which is the earliest point where we can
          * negotiate with the backend regarding supported features.
          */
-	netdev->features |= netdev->hw_features;
+	netdev->legacy_features |= netdev->legacy_hw_features;
 
 	SET_ETHTOOL_OPS(netdev, &xennet_ethtool_ops);
 	SET_NETDEV_DEV(netdev, &dev->dev);
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/20] net-core: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44 ` [PATCH 01/20] net-core: " Mahesh Bandewar
  2011-04-06  0:44   ` [PATCH 02/20] net-ipv4: " Mahesh Bandewar
@ 2011-04-06  1:27   ` Ben Hutchings
  2011-04-06  1:35     ` Mahesh Bandewar
  2011-04-06 10:29   ` Michał Mirosław
  2011-04-07 15:00   ` [PATCHv2 " Mahesh Bandewar
  3 siblings, 1 reply; 27+ messages in thread
From: Ben Hutchings @ 2011-04-06  1:27 UTC (permalink / raw)
  To: Mahesh Bandewar; +Cc: David Miller, netdev

On Tue, 2011-04-05 at 17:44 -0700, Mahesh Bandewar wrote:
> Converting current use of (hw_/wanted_/vlan_)features to
> legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
[...]
> @@ -1029,44 +1065,51 @@ struct net_device {
>  	struct list_head	napi_list;
>  	struct list_head	unreg_list;
>  
> +#define DEV_FEATURE_WORDS	2
> +#define	DEV_FEATURE_BITS	(DEV_FEATURE_WORDS*sizeof(long)*BITS_PER_BYTE)
> +#define LEGACY_FEATURE_WORD	0
> +
>  	/* currently active device features */
> -	u32			features;
> +	unsigned long 		features;
>  	/* user-changeable features */
> -	u32			hw_features;
> +	DECLARE_BITMAP(hw_feature, DEV_FEATURE_BITS);
[...]

Sorry, you can't get rid of hw_features without converting all the
callers at the same time.  All code has to remain compilable after each
single commit.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/20] net-core: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  1:27   ` [PATCH 01/20] net-core: " Ben Hutchings
@ 2011-04-06  1:35     ` Mahesh Bandewar
  2011-04-06  1:45       ` Ben Hutchings
  0 siblings, 1 reply; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06  1:35 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: David Miller, netdev

On Tue, Apr 5, 2011 at 6:27 PM, Ben Hutchings <bhutchings@solarflare.com> wrote:
> On Tue, 2011-04-05 at 17:44 -0700, Mahesh Bandewar wrote:
>> Converting current use of (hw_/wanted_/vlan_)features to
>> legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
> [...]
>> @@ -1029,44 +1065,51 @@ struct net_device {
>>       struct list_head        napi_list;
>>       struct list_head        unreg_list;
>>
>> +#define DEV_FEATURE_WORDS    2
>> +#define      DEV_FEATURE_BITS        (DEV_FEATURE_WORDS*sizeof(long)*BITS_PER_BYTE)
>> +#define LEGACY_FEATURE_WORD  0
>> +
>>       /* currently active device features */
>> -     u32                     features;
>> +     unsigned long           features;
>>       /* user-changeable features */
>> -     u32                     hw_features;
>> +     DECLARE_BITMAP(hw_feature, DEV_FEATURE_BITS);
> [...]
>
> Sorry, you can't get rid of hw_features without converting all the
> callers at the same time.  All code has to remain compilable after each
> single commit.
>
I thought I did! My "make allyesconfig; make all" went through. Did I
miss something?


> Ben.
>
> --
> Ben Hutchings, Senior Software Engineer, Solarflare
> Not speaking for my employer; that's the marketing department's job.
> They asked us to note that Solarflare product names are trademarked.
>
>

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/20] net-core: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  1:35     ` Mahesh Bandewar
@ 2011-04-06  1:45       ` Ben Hutchings
  0 siblings, 0 replies; 27+ messages in thread
From: Ben Hutchings @ 2011-04-06  1:45 UTC (permalink / raw)
  To: Mahesh Bandewar; +Cc: David Miller, netdev

On Tue, 2011-04-05 at 18:35 -0700, Mahesh Bandewar wrote:
> On Tue, Apr 5, 2011 at 6:27 PM, Ben Hutchings <bhutchings@solarflare.com> wrote:
> > On Tue, 2011-04-05 at 17:44 -0700, Mahesh Bandewar wrote:
> >> Converting current use of (hw_/wanted_/vlan_)features to
> >> legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
> > [...]
> >> @@ -1029,44 +1065,51 @@ struct net_device {
> >>       struct list_head        napi_list;
> >>       struct list_head        unreg_list;
> >>
> >> +#define DEV_FEATURE_WORDS    2
> >> +#define      DEV_FEATURE_BITS        (DEV_FEATURE_WORDS*sizeof(long)*BITS_PER_BYTE)
> >> +#define LEGACY_FEATURE_WORD  0
> >> +
> >>       /* currently active device features */
> >> -     u32                     features;
> >> +     unsigned long           features;
> >>       /* user-changeable features */
> >> -     u32                     hw_features;
> >> +     DECLARE_BITMAP(hw_feature, DEV_FEATURE_BITS);
> > [...]
> >
> > Sorry, you can't get rid of hw_features without converting all the
> > callers at the same time.  All code has to remain compilable after each
> > single commit.
> >
> I thought I did! My "make allyesconfig; make all" went through. Did I
> miss something?

After 1 commit, or after all 20?

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/20] net-core: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44 ` [PATCH 01/20] net-core: " Mahesh Bandewar
  2011-04-06  0:44   ` [PATCH 02/20] net-ipv4: " Mahesh Bandewar
  2011-04-06  1:27   ` [PATCH 01/20] net-core: " Ben Hutchings
@ 2011-04-06 10:29   ` Michał Mirosław
  2011-04-06 17:34     ` Mahesh Bandewar
  2011-04-07 15:00   ` [PATCHv2 " Mahesh Bandewar
  3 siblings, 1 reply; 27+ messages in thread
From: Michał Mirosław @ 2011-04-06 10:29 UTC (permalink / raw)
  To: Mahesh Bandewar; +Cc: David Miller, netdev

2011/4/6 Mahesh Bandewar <maheshb@google.com>:
> Converting current use of (hw_/wanted_/vlan_)features to
> legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
>
> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
> ---
>  include/linux/netdevice.h |  110 +++++++++++++++++++++++++++++++-------------
>  net/core/dev.c            |   51 +++++++++++----------
>  net/core/ethtool.c        |   97 ++++++++++++++++++++-------------------
>  net/core/net-sysfs.c      |    4 +-
>  net/core/sock.c           |    2 +-
>  5 files changed, 155 insertions(+), 109 deletions(-)
>
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 09d2624..637bf2a 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -980,6 +980,42 @@ struct net_device_ops {
>                                                    u32 features);
>  };
>
> +enum netdev_features {
> +       NETIF_F_SG_BIT,                 /* Scatter/gather IO. */
> +       NETIF_F_IP_CSUM_BIT,            /* Can checksum TCP/UDP over IPv4. */
> +       NETIF_F_NO_CSUM_BIT,            /* Does not require checksum. F.e. loopack. */
> +       NETIF_F_HW_CSUM_BIT,            /* Can checksum all the packets. */
> +       NETIF_F_IPV6_CSUM_BIT,          /* Can checksum TCP/UDP over IPV6 */
> +       NETIF_F_HIGHDMA_BIT,            /* Can DMA to high memory. */
> +       NETIF_F_FRAGLIST_BIT,           /* Scatter/gather IO. */
> +       NETIF_F_HW_VLAN_TX_BIT,         /* Transmit VLAN hw acceleration */
> +       NETIF_F_HW_VLAN_RX_BIT,         /* Receive VLAN hw acceleration */
> +       NETIF_F_HW_VLAN_FILTER_BIT,     /* Receive filtering on VLAN */
> +       NETIF_F_VLAN_CHALLENGED_BIT,    /* Device cannot handle VLAN packets */
> +       NETIF_F_GSO_BIT,                /* Enable software GSO. */
> +       NETIF_F_LLTX_BIT,               /* LockLess TX - deprecated. Please */
> +                                       /* do not use LLTX in new drivers */
> +       NETIF_F_NETNS_LOCAL_BIT,        /* Does not change network namespaces */
> +       NETIF_F_GRO_BIT,                /* Generic receive offload */
> +       NETIF_F_LRO_BIT,                /* large receive offload */
> +       /* the GSO_MASK reserves bits 16 through 23 */
> +       RESERVED1_BIT,
> +       RESERVED2_BIT,
> +       RESERVED3_BIT,
> +       RESERVED4_BIT,
> +       RESERVED5_BIT,
> +       RESERVED6_BIT,
> +       RESERVED7_BIT,
> +       RESERVED8_BIT,
> +       NETIF_F_FCOE_CRC_BIT,           /* FCoE CRC32 */
> +       NETIF_F_SCTP_CSUM_BIT,          /* SCTP checksum offload */
> +       NETIF_F_FCOE_MTU_BIT,           /* Supports max FCoE MTU, 2158 bytes*/
> +       NETIF_F_NTUPLE_BIT,             /* N-tuple filters supported */
> +       NETIF_F_RXHASH_BIT,             /* Receive hashing offload */
> +       NETIF_F_RXCSUM_BIT,             /* Receive checksumming offload */
> +       NETIF_F_NOCACHE_COPY_BIT,       /* Use no-cache copyfromuser */
> +};
> +

This should be a separate cleanup patch. And after that, for the
conversion you would add as a last entry:
NETIF_F_NUM_BITS and use it later (see below).

>  /*
>  *     The DEVICE structure.
>  *     Actually, this whole structure is a big mistake.  It mixes I/O
> @@ -1029,44 +1065,51 @@ struct net_device {
>        struct list_head        napi_list;
>        struct list_head        unreg_list;
>
> +#define DEV_FEATURE_WORDS      2
> +#define        DEV_FEATURE_BITS        (DEV_FEATURE_WORDS*sizeof(long)*BITS_PER_BYTE)
> +#define LEGACY_FEATURE_WORD    0
> +

#define DEV_FEATURE_WORDS BITS_TO_LONGS(NETIF_F_NUM_BITS)
#define DEV_FEATURE_BITS (DEV_FEATURE_WORDS*BITS_PER_LONG)

Though using bitmaps will make a mess for 32 versus 64 bit archs. It
would be better to stick to u32 as the base type instead of long.

[...]
> @@ -2376,13 +2419,13 @@ static inline void netif_tx_unlock_bh(struct net_device *dev)
>  }
>
>  #define HARD_TX_LOCK(dev, txq, cpu) {                  \
> -       if ((dev->features & NETIF_F_LLTX) == 0) {      \
> +       if ((dev->legacy_features & NETIF_F_LLTX) == 0) {       \
[...]

For those type of conversion there is really no point in using the
macro. Changing it to
dev->features[0] instead of dev->legacy_features needs the same effort
but avoids the
cleanup later. Flags in other feature words could have names line
NETIF_F2_xxx so that
it would be clear in which word they belong.

Best Regards,
Michał Mirosław

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/20] net-core: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06 10:29   ` Michał Mirosław
@ 2011-04-06 17:34     ` Mahesh Bandewar
  0 siblings, 0 replies; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-06 17:34 UTC (permalink / raw)
  To: Michał Mirosław; +Cc: David Miller, netdev

On Wed, Apr 6, 2011 at 3:29 AM, Michał Mirosław <mirqus@gmail.com> wrote:
> 2011/4/6 Mahesh Bandewar <maheshb@google.com>:
>> Converting current use of (hw_/wanted_/vlan_)features to
>> legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
>>
>> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
>> ---
>>  include/linux/netdevice.h |  110 +++++++++++++++++++++++++++++++-------------
>>  net/core/dev.c            |   51 +++++++++++----------
>>  net/core/ethtool.c        |   97 ++++++++++++++++++++-------------------
>>  net/core/net-sysfs.c      |    4 +-
>>  net/core/sock.c           |    2 +-
>>  5 files changed, 155 insertions(+), 109 deletions(-)
>>
>> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
>> index 09d2624..637bf2a 100644
>> --- a/include/linux/netdevice.h
>> +++ b/include/linux/netdevice.h
>> @@ -980,6 +980,42 @@ struct net_device_ops {
>>                                                    u32 features);
>>  };
>>
>> +enum netdev_features {
>> +       NETIF_F_SG_BIT,                 /* Scatter/gather IO. */
>> +       NETIF_F_IP_CSUM_BIT,            /* Can checksum TCP/UDP over IPv4. */
>> +       NETIF_F_NO_CSUM_BIT,            /* Does not require checksum. F.e. loopack. */
>> +       NETIF_F_HW_CSUM_BIT,            /* Can checksum all the packets. */
>> +       NETIF_F_IPV6_CSUM_BIT,          /* Can checksum TCP/UDP over IPV6 */
>> +       NETIF_F_HIGHDMA_BIT,            /* Can DMA to high memory. */
>> +       NETIF_F_FRAGLIST_BIT,           /* Scatter/gather IO. */
>> +       NETIF_F_HW_VLAN_TX_BIT,         /* Transmit VLAN hw acceleration */
>> +       NETIF_F_HW_VLAN_RX_BIT,         /* Receive VLAN hw acceleration */
>> +       NETIF_F_HW_VLAN_FILTER_BIT,     /* Receive filtering on VLAN */
>> +       NETIF_F_VLAN_CHALLENGED_BIT,    /* Device cannot handle VLAN packets */
>> +       NETIF_F_GSO_BIT,                /* Enable software GSO. */
>> +       NETIF_F_LLTX_BIT,               /* LockLess TX - deprecated. Please */
>> +                                       /* do not use LLTX in new drivers */
>> +       NETIF_F_NETNS_LOCAL_BIT,        /* Does not change network namespaces */
>> +       NETIF_F_GRO_BIT,                /* Generic receive offload */
>> +       NETIF_F_LRO_BIT,                /* large receive offload */
>> +       /* the GSO_MASK reserves bits 16 through 23 */
>> +       RESERVED1_BIT,
>> +       RESERVED2_BIT,
>> +       RESERVED3_BIT,
>> +       RESERVED4_BIT,
>> +       RESERVED5_BIT,
>> +       RESERVED6_BIT,
>> +       RESERVED7_BIT,
>> +       RESERVED8_BIT,
>> +       NETIF_F_FCOE_CRC_BIT,           /* FCoE CRC32 */
>> +       NETIF_F_SCTP_CSUM_BIT,          /* SCTP checksum offload */
>> +       NETIF_F_FCOE_MTU_BIT,           /* Supports max FCoE MTU, 2158 bytes*/
>> +       NETIF_F_NTUPLE_BIT,             /* N-tuple filters supported */
>> +       NETIF_F_RXHASH_BIT,             /* Receive hashing offload */
>> +       NETIF_F_RXCSUM_BIT,             /* Receive checksumming offload */
>> +       NETIF_F_NOCACHE_COPY_BIT,       /* Use no-cache copyfromuser */
>> +};
>> +
>
> This should be a separate cleanup patch. And after that, for the
> conversion you would add as a last entry:
> NETIF_F_NUM_BITS and use it later (see below).
>
I like the idea of NETIF_F_NUM_BITS and I'll change the #defines
accordingly. Couple of bitmaps are defined in this patch and NUM_BITS
will be required to define those bitmaps. This is reason why I have
defined above enum now rather than waiting for the cleanup phase. Also
it should not change radically in that time span.

>>  /*
>>  *     The DEVICE structure.
>>  *     Actually, this whole structure is a big mistake.  It mixes I/O
>> @@ -1029,44 +1065,51 @@ struct net_device {
>>        struct list_head        napi_list;
>>        struct list_head        unreg_list;
>>
>> +#define DEV_FEATURE_WORDS      2
>> +#define        DEV_FEATURE_BITS        (DEV_FEATURE_WORDS*sizeof(long)*BITS_PER_BYTE)
>> +#define LEGACY_FEATURE_WORD    0
>> +
>
> #define DEV_FEATURE_WORDS BITS_TO_LONGS(NETIF_F_NUM_BITS)
> #define DEV_FEATURE_BITS (DEV_FEATURE_WORDS*BITS_PER_LONG)
>
Yes, this is good!

> Though using bitmaps will make a mess for 32 versus 64 bit archs. It
> would be better to stick to u32 as the base type instead of long.
>
Once it's a bitmap; type shouldn't matter and each arch and it's
specific macros/inlines should handle them properly, no?
(I changed the base type since DECLARE_BITMAP() declares 'unsigned
long' and we can make use of readily avaialble set/test/clear_bit
macros)

> [...]
>> @@ -2376,13 +2419,13 @@ static inline void netif_tx_unlock_bh(struct net_device *dev)
>>  }
>>
>>  #define HARD_TX_LOCK(dev, txq, cpu) {                  \
>> -       if ((dev->features & NETIF_F_LLTX) == 0) {      \
>> +       if ((dev->legacy_features & NETIF_F_LLTX) == 0) {       \
> [...]
>
> For those type of conversion there is really no point in using the
> macro. Changing it to
> dev->features[0] instead of dev->legacy_features needs the same effort
> but avoids the
> cleanup later. Flags in other feature words could have names line
> NETIF_F2_xxx so that
> it would be clear in which word they belong.
>
I know! But changing all at once in zillion places is hard. This will
let us make changes progressively. I'm expecting the following
progress path -

(1) (Current patch)
+ #define legacy_feactures          features
+ #define legacy_vlan_features    vlan_features

Slowly make all the changes (relatively easy but a lengthy process!).
So the places where vlan_features, features fields are used will
compile and at the same time updates, where legacy_vlan_features,
legacy_features fields are used, will compile too. Once all is changes
are in place -

(2) Relatively small change
-  unsigned long       features;
+ DECLARE_BITMAP(feature, DEV_FEATURE_BITS);
-  unsigned long        vlan_features;
+ DECLARE_BITMAP(vlan_feature, DEV_FEATURE_BITS);
-  #define   legacy_features          features
+ #define   legacy_features          feature[0]
- #define    legacy_vlan_features  vlan_features
+ #define   legacy_vlan_features  vlan_feature[0]

At this moment old fields are gone and are replaced by the bitmaps and
the legacy usage is indicated by the use "legacy_*" fields. This
should eventually be changed to use the (set/test/clear)_bit()
macros/inlines. So the above place should look like -

#define HARD_TX_LOCK(dev, txq, cpu) {                  \
-       if ((dev->legacy_features & NETIF_F_LLTX) == 0) {       \
+      if (!test_bit(dev->feature, NETIF_F_LLTX_BIT) {      \


Thanks,
--mahesh..

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCHv2 01/20] net-core: extending (hw_/wanted_/vlan_)features fields to a bitmap.
  2011-04-06  0:44 ` [PATCH 01/20] net-core: " Mahesh Bandewar
                     ` (2 preceding siblings ...)
  2011-04-06 10:29   ` Michał Mirosław
@ 2011-04-07 15:00   ` Mahesh Bandewar
  3 siblings, 0 replies; 27+ messages in thread
From: Mahesh Bandewar @ 2011-04-07 15:00 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
Changes since v1:
 Added NETIF_F_NUM_BITS.

 include/linux/netdevice.h |  111 +++++++++++++++++++++++++++++++-------------
 net/core/dev.c            |   51 +++++++++++----------
 net/core/ethtool.c        |   97 ++++++++++++++++++++-------------------
 net/core/net-sysfs.c      |    4 +-
 net/core/sock.c           |    2 +-
 5 files changed, 156 insertions(+), 109 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 09d2624..e27daaf 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -980,6 +980,43 @@ struct net_device_ops {
 						    u32 features);
 };
 
+enum netdev_features {
+	NETIF_F_SG_BIT,			/* Scatter/gather IO. */
+	NETIF_F_IP_CSUM_BIT,		/* Can checksum TCP/UDP over IPv4. */
+	NETIF_F_NO_CSUM_BIT,		/* Does not require checksum. F.e. loopack. */
+	NETIF_F_HW_CSUM_BIT,		/* Can checksum all the packets. */
+	NETIF_F_IPV6_CSUM_BIT,		/* Can checksum TCP/UDP over IPV6 */
+	NETIF_F_HIGHDMA_BIT,		/* Can DMA to high memory. */
+	NETIF_F_FRAGLIST_BIT,		/* Scatter/gather IO. */
+	NETIF_F_HW_VLAN_TX_BIT,		/* Transmit VLAN hw acceleration */
+	NETIF_F_HW_VLAN_RX_BIT,		/* Receive VLAN hw acceleration */
+	NETIF_F_HW_VLAN_FILTER_BIT,	/* Receive filtering on VLAN */
+	NETIF_F_VLAN_CHALLENGED_BIT,	/* Device cannot handle VLAN packets */
+	NETIF_F_GSO_BIT,		/* Enable software GSO. */
+	NETIF_F_LLTX_BIT,		/* LockLess TX - deprecated. Please */
+					/* do not use LLTX in new drivers */
+	NETIF_F_NETNS_LOCAL_BIT,	/* Does not change network namespaces */
+	NETIF_F_GRO_BIT,		/* Generic receive offload */
+	NETIF_F_LRO_BIT,		/* large receive offload */
+	/* the GSO_MASK reserves bits 16 through 23 */
+	RESERVED1_BIT,
+	RESERVED2_BIT,
+	RESERVED3_BIT,
+	RESERVED4_BIT,
+	RESERVED5_BIT,
+	RESERVED6_BIT,
+	RESERVED7_BIT,
+	RESERVED8_BIT,
+	NETIF_F_FCOE_CRC_BIT,		/* FCoE CRC32 */
+	NETIF_F_SCTP_CSUM_BIT,		/* SCTP checksum offload */
+	NETIF_F_FCOE_MTU_BIT,		/* Supports max FCoE MTU, 2158 bytes*/
+	NETIF_F_NTUPLE_BIT,		/* N-tuple filters supported */
+	NETIF_F_RXHASH_BIT,		/* Receive hashing offload */
+	NETIF_F_RXCSUM_BIT,		/* Receive checksumming offload */
+	NETIF_F_NOCACHE_COPY_BIT,	/* Use no-cache copyfromuser */
+	NETIF_F_NUM_BITS,		/* (LAST VALUE) Total bits in use */
+};
+
 /*
  *	The DEVICE structure.
  *	Actually, this whole structure is a big mistake.  It mixes I/O
@@ -1029,44 +1066,51 @@ struct net_device {
 	struct list_head	napi_list;
 	struct list_head	unreg_list;
 
+#define DEV_FEATURE_WORDS	BITS_TO_LONGS(NETIF_F_NUM_BITS)
+#define DEV_FEATURE_BITS	(DEV_FEATURE_WORDS*BITS_PER_LONG)
+#define LEGACY_FEATURE_WORD	0
+
 	/* currently active device features */
-	u32			features;
+	unsigned long 		features;
 	/* user-changeable features */
-	u32			hw_features;
+	DECLARE_BITMAP(hw_feature, DEV_FEATURE_BITS);
 	/* user-requested features */
-	u32			wanted_features;
+	DECLARE_BITMAP(wanted_feature, DEV_FEATURE_BITS);
 	/* VLAN feature mask */
-	u32			vlan_features;
+	unsigned long 		vlan_features;
+
+#define legacy_features		features
+#define legacy_hw_features	hw_feature[LEGACY_FEATURE_WORD]
+#define legacy_wanted_features	wanted_feature[LEGACY_FEATURE_WORD]
+#define legacy_vlan_features	vlan_features
 
 	/* Net device feature bits; if you change something,
 	 * also update netdev_features_strings[] in ethtool.c */
 
-#define NETIF_F_SG		1	/* Scatter/gather IO. */
-#define NETIF_F_IP_CSUM		2	/* Can checksum TCP/UDP over IPv4. */
-#define NETIF_F_NO_CSUM		4	/* Does not require checksum. F.e. loopack. */
-#define NETIF_F_HW_CSUM		8	/* Can checksum all the packets. */
-#define NETIF_F_IPV6_CSUM	16	/* Can checksum TCP/UDP over IPV6 */
-#define NETIF_F_HIGHDMA		32	/* Can DMA to high memory. */
-#define NETIF_F_FRAGLIST	64	/* Scatter/gather IO. */
-#define NETIF_F_HW_VLAN_TX	128	/* Transmit VLAN hw acceleration */
-#define NETIF_F_HW_VLAN_RX	256	/* Receive VLAN hw acceleration */
-#define NETIF_F_HW_VLAN_FILTER	512	/* Receive filtering on VLAN */
-#define NETIF_F_VLAN_CHALLENGED	1024	/* Device cannot handle VLAN packets */
-#define NETIF_F_GSO		2048	/* Enable software GSO. */
-#define NETIF_F_LLTX		4096	/* LockLess TX - deprecated. Please */
-					/* do not use LLTX in new drivers */
-#define NETIF_F_NETNS_LOCAL	8192	/* Does not change network namespaces */
-#define NETIF_F_GRO		16384	/* Generic receive offload */
-#define NETIF_F_LRO		32768	/* large receive offload */
-
+#define NETIF_F_SG		(1 << NETIF_F_SG_BIT)
+#define NETIF_F_IP_CSUM		(1 << NETIF_F_IP_CSUM_BIT)
+#define NETIF_F_NO_CSUM		(1 << NETIF_F_NO_CSUM_BIT)
+#define NETIF_F_HW_CSUM		(1 << NETIF_F_HW_CSUM_BIT)
+#define NETIF_F_IPV6_CSUM	(1 << NETIF_F_IPV6_CSUM_BIT)
+#define NETIF_F_HIGHDMA		(1 << NETIF_F_HIGHDMA_BIT)
+#define NETIF_F_FRAGLIST	(1 << NETIF_F_FRAGLIST_BIT)
+#define NETIF_F_HW_VLAN_TX	(1 << NETIF_F_HW_VLAN_TX_BIT)
+#define NETIF_F_HW_VLAN_RX	(1 << NETIF_F_HW_VLAN_RX_BIT)
+#define NETIF_F_HW_VLAN_FILTER	(1 << NETIF_F_HW_VLAN_FILTER_BIT)
+#define NETIF_F_VLAN_CHALLENGED	(1 << NETIF_F_VLAN_CHALLENGED_BIT)
+#define NETIF_F_GSO		(1 << NETIF_F_GSO_BIT)
+#define NETIF_F_LLTX		(1 << NETIF_F_LLTX_BIT)
+#define NETIF_F_NETNS_LOCAL	(1 << NETIF_F_NETNS_LOCAL_BIT)
+#define NETIF_F_GRO		(1 << NETIF_F_GRO_BIT)
+#define NETIF_F_LRO		(1 << NETIF_F_LRO_BIT)
 /* the GSO_MASK reserves bits 16 through 23 */
-#define NETIF_F_FCOE_CRC	(1 << 24) /* FCoE CRC32 */
-#define NETIF_F_SCTP_CSUM	(1 << 25) /* SCTP checksum offload */
-#define NETIF_F_FCOE_MTU	(1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
-#define NETIF_F_NTUPLE		(1 << 27) /* N-tuple filters supported */
-#define NETIF_F_RXHASH		(1 << 28) /* Receive hashing offload */
-#define NETIF_F_RXCSUM		(1 << 29) /* Receive checksumming offload */
-#define NETIF_F_NOCACHE_COPY	(1 << 30) /* Use no-cache copyfromuser */
+#define NETIF_F_FCOE_CRC	(1 << NETIF_F_FCOE_CRC_BIT)
+#define NETIF_F_SCTP_CSUM	(1 << NETIF_F_SCTP_CSUM_BIT)
+#define NETIF_F_FCOE_MTU	(1 << NETIF_F_FCOE_MTU_BIT)
+#define NETIF_F_NTUPLE		(1 << NETIF_F_NTUPLE_BIT)
+#define NETIF_F_RXHASH		(1 << NETIF_F_RXHASH_BIT)
+#define NETIF_F_RXCSUM		(1 << NETIF_F_RXCSUM_BIT)
+#define NETIF_F_NOCACHE_COPY	(1 << NETIF_F_NOCACHE_COPY_BIT)
 
 	/* Segmentation offload features */
 #define NETIF_F_GSO_SHIFT	16
@@ -2376,13 +2420,13 @@ static inline void netif_tx_unlock_bh(struct net_device *dev)
 }
 
 #define HARD_TX_LOCK(dev, txq, cpu) {			\
-	if ((dev->features & NETIF_F_LLTX) == 0) {	\
+	if ((dev->legacy_features & NETIF_F_LLTX) == 0) {	\
 		__netif_tx_lock(txq, cpu);		\
 	}						\
 }
 
 #define HARD_TX_UNLOCK(dev, txq) {			\
-	if ((dev->features & NETIF_F_LLTX) == 0) {	\
+	if ((dev->legacy_features & NETIF_F_LLTX) == 0) {	\
 		__netif_tx_unlock(txq);			\
 	}						\
 }
@@ -2547,7 +2591,8 @@ extern void linkwatch_run_queue(void);
 
 static inline u32 netdev_get_wanted_features(struct net_device *dev)
 {
-	return (dev->features & ~dev->hw_features) | dev->wanted_features;
+	return (dev->legacy_features & ~dev->legacy_hw_features) |
+	    dev->legacy_wanted_features;
 }
 u32 netdev_increment_features(u32 all, u32 one, u32 mask);
 u32 netdev_fix_features(struct net_device *dev, u32 features);
@@ -2600,7 +2645,7 @@ static inline int dev_ethtool_get_settings(struct net_device *dev,
 
 static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev)
 {
-	if (dev->features & NETIF_F_RXCSUM)
+	if (dev->legacy_features & NETIF_F_RXCSUM)
 		return 1;
 	if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum)
 		return 0;
diff --git a/net/core/dev.c b/net/core/dev.c
index 5d0b4f6..8cad38d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1315,7 +1315,7 @@ void dev_disable_lro(struct net_device *dev)
 		return;
 
 	__ethtool_set_flags(dev, flags & ~ETH_FLAG_LRO);
-	WARN_ON(dev->features & NETIF_F_LRO);
+	WARN_ON(dev->legacy_features & NETIF_F_LRO);
 }
 EXPORT_SYMBOL(dev_disable_lro);
 
@@ -1871,7 +1871,7 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, u32 features)
 			dev->ethtool_ops->get_drvinfo(dev, &info);
 
 		WARN(1, "%s: caps=(0x%lx, 0x%lx) len=%d data_len=%d ip_summed=%d\n",
-		     info.driver, dev ? dev->features : 0L,
+		     info.driver, dev ? dev->legacy_features : 0L,
 		     skb->sk ? skb->sk->sk_route_caps : 0L,
 		     skb->len, skb->data_len, skb->ip_summed);
 
@@ -1926,7 +1926,7 @@ static int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
 {
 #ifdef CONFIG_HIGHMEM
 	int i;
-	if (!(dev->features & NETIF_F_HIGHDMA)) {
+	if (!(dev->legacy_features & NETIF_F_HIGHDMA)) {
 		for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
 			if (PageHighMem(skb_shinfo(skb)->frags[i].page))
 				return 1;
@@ -2043,7 +2043,7 @@ static u32 harmonize_features(struct sk_buff *skb, __be16 protocol, u32 features
 u32 netif_skb_features(struct sk_buff *skb)
 {
 	__be16 protocol = skb->protocol;
-	u32 features = skb->dev->features;
+	u32 features = skb->dev->legacy_features;
 
 	if (protocol == htons(ETH_P_8021Q)) {
 		struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
@@ -2052,7 +2052,7 @@ u32 netif_skb_features(struct sk_buff *skb)
 		return harmonize_features(skb, protocol, features);
 	}
 
-	features &= (skb->dev->vlan_features | NETIF_F_HW_VLAN_TX);
+	features &= (skb->dev->legacy_vlan_features | NETIF_F_HW_VLAN_TX);
 
 	if (protocol != htons(ETH_P_8021Q)) {
 		return harmonize_features(skb, protocol, features);
@@ -2589,7 +2589,7 @@ set_rps_cpu(struct net_device *dev, struct sk_buff *skb,
 
 		/* Should we steer this flow to a different hardware queue? */
 		if (!skb_rx_queue_recorded(skb) || !dev->rx_cpu_rmap ||
-		    !(dev->features & NETIF_F_NTUPLE))
+		    !(dev->legacy_features & NETIF_F_NTUPLE))
 			goto out;
 		rxq_index = cpu_rmap_lookup_index(dev->rx_cpu_rmap, next_cpu);
 		if (rxq_index == skb_get_rx_queue(skb))
@@ -3350,7 +3350,7 @@ enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
 	int mac_len;
 	enum gro_result ret;
 
-	if (!(skb->dev->features & NETIF_F_GRO) || netpoll_rx_on(skb))
+	if (!(skb->dev->legacy_features & NETIF_F_GRO) || netpoll_rx_on(skb))
 		goto normal;
 
 	if (skb_is_gso(skb) || skb_has_frag_list(skb))
@@ -5249,11 +5249,11 @@ int __netdev_update_features(struct net_device *dev)
 	/* driver might be less strict about feature dependencies */
 	features = netdev_fix_features(dev, features);
 
-	if (dev->features == features)
+	if (dev->legacy_features == features)
 		return 0;
 
 	netdev_info(dev, "Features changed: 0x%08x -> 0x%08x\n",
-		dev->features, features);
+		dev->legacy_features, features);
 
 	if (dev->netdev_ops->ndo_set_features)
 		err = dev->netdev_ops->ndo_set_features(dev, features);
@@ -5261,12 +5261,12 @@ int __netdev_update_features(struct net_device *dev)
 	if (unlikely(err < 0)) {
 		netdev_err(dev,
 			"set_features() failed (%d); wanted 0x%08x, left 0x%08x\n",
-			err, features, dev->features);
+			err, features, dev->legacy_features);
 		return -1;
 	}
 
 	if (!err)
-		dev->features = features;
+		dev->legacy_features = features;
 
 	return 1;
 }
@@ -5415,29 +5415,30 @@ int register_netdevice(struct net_device *dev)
 	/* Transfer changeable features to wanted_features and enable
 	 * software offloads (GSO and GRO).
 	 */
-	dev->hw_features |= NETIF_F_SOFT_FEATURES;
-	dev->features |= NETIF_F_SOFT_FEATURES;
-	dev->wanted_features = dev->features & dev->hw_features;
+	dev->legacy_hw_features |= NETIF_F_SOFT_FEATURES;
+	dev->legacy_features |= NETIF_F_SOFT_FEATURES;
+	dev->legacy_wanted_features =
+		dev->legacy_features & dev->legacy_hw_features;
 
 	/* Avoid warning from netdev_fix_features() for GSO without SG */
-	if (!(dev->wanted_features & NETIF_F_SG)) {
-		dev->wanted_features &= ~NETIF_F_GSO;
-		dev->features &= ~NETIF_F_GSO;
+	if (!(dev->legacy_wanted_features & NETIF_F_SG)) {
+		dev->legacy_wanted_features &= ~NETIF_F_GSO;
+		dev->legacy_features &= ~NETIF_F_GSO;
 	}
 
 	/* Turn on no cache copy if HW is doing checksum */
-	dev->hw_features |= NETIF_F_NOCACHE_COPY;
-	if ((dev->features & NETIF_F_ALL_CSUM) &&
-	    !(dev->features & NETIF_F_NO_CSUM)) {
-		dev->wanted_features |= NETIF_F_NOCACHE_COPY;
-		dev->features |= NETIF_F_NOCACHE_COPY;
+	dev->legacy_hw_features |= NETIF_F_NOCACHE_COPY;
+	if ((dev->legacy_features & NETIF_F_ALL_CSUM) &&
+	    !(dev->legacy_features & NETIF_F_NO_CSUM)) {
+		dev->legacy_wanted_features |= NETIF_F_NOCACHE_COPY;
+		dev->legacy_features |= NETIF_F_NOCACHE_COPY;
 	}
 
 	/* Enable GRO and NETIF_F_HIGHDMA for vlans by default,
 	 * vlan_dev_init() will do the dev->features check, so these features
 	 * are enabled only if supported by underlying device.
 	 */
-	dev->vlan_features |= (NETIF_F_GRO | NETIF_F_HIGHDMA);
+	dev->legacy_vlan_features |= (NETIF_F_GRO | NETIF_F_HIGHDMA);
 
 	ret = call_netdevice_notifiers(NETDEV_POST_INIT, dev);
 	ret = notifier_to_errno(ret);
@@ -6019,7 +6020,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
 
 	/* Don't allow namespace local devices to be moved. */
 	err = -EINVAL;
-	if (dev->features & NETIF_F_NETNS_LOCAL)
+	if (dev->legacy_features & NETIF_F_NETNS_LOCAL)
 		goto out;
 
 	/* Ensure the device has been registrered */
@@ -6352,7 +6353,7 @@ static void __net_exit default_device_exit(struct net *net)
 		char fb_name[IFNAMSIZ];
 
 		/* Ignore unmoveable devices (i.e. loopback) */
-		if (dev->features & NETIF_F_NETNS_LOCAL)
+		if (dev->legacy_features & NETIF_F_NETNS_LOCAL)
 			continue;
 
 		/* Leave virtual devices for the generic cleanup */
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 719670a..fd03c53 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -36,16 +36,16 @@ EXPORT_SYMBOL(ethtool_op_get_link);
 
 u32 ethtool_op_get_tx_csum(struct net_device *dev)
 {
-	return (dev->features & NETIF_F_ALL_CSUM) != 0;
+	return (dev->legacy_features & NETIF_F_ALL_CSUM) != 0;
 }
 EXPORT_SYMBOL(ethtool_op_get_tx_csum);
 
 int ethtool_op_set_tx_csum(struct net_device *dev, u32 data)
 {
 	if (data)
-		dev->features |= NETIF_F_IP_CSUM;
+		dev->legacy_features |= NETIF_F_IP_CSUM;
 	else
-		dev->features &= ~NETIF_F_IP_CSUM;
+		dev->legacy_features &= ~NETIF_F_IP_CSUM;
 
 	return 0;
 }
@@ -54,9 +54,9 @@ EXPORT_SYMBOL(ethtool_op_set_tx_csum);
 int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data)
 {
 	if (data)
-		dev->features |= NETIF_F_HW_CSUM;
+		dev->legacy_features |= NETIF_F_HW_CSUM;
 	else
-		dev->features &= ~NETIF_F_HW_CSUM;
+		dev->legacy_features &= ~NETIF_F_HW_CSUM;
 
 	return 0;
 }
@@ -65,9 +65,9 @@ EXPORT_SYMBOL(ethtool_op_set_tx_hw_csum);
 int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data)
 {
 	if (data)
-		dev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
+		dev->legacy_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
 	else
-		dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
+		dev->legacy_features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
 
 	return 0;
 }
@@ -75,16 +75,16 @@ EXPORT_SYMBOL(ethtool_op_set_tx_ipv6_csum);
 
 u32 ethtool_op_get_sg(struct net_device *dev)
 {
-	return (dev->features & NETIF_F_SG) != 0;
+	return (dev->legacy_features & NETIF_F_SG) != 0;
 }
 EXPORT_SYMBOL(ethtool_op_get_sg);
 
 int ethtool_op_set_sg(struct net_device *dev, u32 data)
 {
 	if (data)
-		dev->features |= NETIF_F_SG;
+		dev->legacy_features |= NETIF_F_SG;
 	else
-		dev->features &= ~NETIF_F_SG;
+		dev->legacy_features &= ~NETIF_F_SG;
 
 	return 0;
 }
@@ -92,16 +92,16 @@ EXPORT_SYMBOL(ethtool_op_set_sg);
 
 u32 ethtool_op_get_tso(struct net_device *dev)
 {
-	return (dev->features & NETIF_F_TSO) != 0;
+	return (dev->legacy_features & NETIF_F_TSO) != 0;
 }
 EXPORT_SYMBOL(ethtool_op_get_tso);
 
 int ethtool_op_set_tso(struct net_device *dev, u32 data)
 {
 	if (data)
-		dev->features |= NETIF_F_TSO;
+		dev->legacy_features |= NETIF_F_TSO;
 	else
-		dev->features &= ~NETIF_F_TSO;
+		dev->legacy_features &= ~NETIF_F_TSO;
 
 	return 0;
 }
@@ -109,16 +109,16 @@ EXPORT_SYMBOL(ethtool_op_set_tso);
 
 u32 ethtool_op_get_ufo(struct net_device *dev)
 {
-	return (dev->features & NETIF_F_UFO) != 0;
+	return (dev->legacy_features & NETIF_F_UFO) != 0;
 }
 EXPORT_SYMBOL(ethtool_op_get_ufo);
 
 int ethtool_op_set_ufo(struct net_device *dev, u32 data)
 {
 	if (data)
-		dev->features |= NETIF_F_UFO;
+		dev->legacy_features |= NETIF_F_UFO;
 	else
-		dev->features &= ~NETIF_F_UFO;
+		dev->legacy_features &= ~NETIF_F_UFO;
 	return 0;
 }
 EXPORT_SYMBOL(ethtool_op_set_ufo);
@@ -137,7 +137,7 @@ u32 ethtool_op_get_flags(struct net_device *dev)
 	 * by a simple masking operation
 	 */
 
-	return dev->features & flags_dup_features;
+	return dev->legacy_features & flags_dup_features;
 }
 EXPORT_SYMBOL(ethtool_op_get_flags);
 
@@ -148,7 +148,7 @@ EXPORT_SYMBOL(ethtool_op_get_flags);
  */
 bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported)
 {
-	u32 features = dev->features & flags_dup_features;
+	u32 features = dev->legacy_features & flags_dup_features;
 	/* "data" can contain only flags_dup_features bits,
 	 * see __ethtool_set_flags */
 
@@ -161,7 +161,7 @@ int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported)
 	if (ethtool_invalid_flags(dev, data, supported))
 		return -EINVAL;
 
-	dev->features = ((dev->features & ~flags_dup_features) |
+	dev->legacy_features = ((dev->legacy_features & ~flags_dup_features) |
 			 (data & flags_dup_features));
 	return 0;
 }
@@ -261,9 +261,9 @@ static int ethtool_get_features(struct net_device *dev, void __user *useraddr)
 	};
 	struct ethtool_get_features_block features[ETHTOOL_DEV_FEATURE_WORDS] = {
 		{
-			.available = dev->hw_features,
-			.requested = dev->wanted_features,
-			.active = dev->features,
+			.available = dev->legacy_hw_features,
+			.requested = dev->legacy_wanted_features,
+			.active = dev->legacy_features,
 			.never_changed = NETIF_F_NEVER_CHANGE,
 		},
 	};
@@ -310,16 +310,17 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr)
 	if (ethtool_set_features_compat(dev, features))
 		ret |= ETHTOOL_F_COMPAT;
 
-	if (features[0].valid & ~dev->hw_features) {
-		features[0].valid &= dev->hw_features;
+	if (features[0].valid & ~dev->legacy_hw_features) {
+		features[0].valid &= dev->legacy_hw_features;
 		ret |= ETHTOOL_F_UNSUPPORTED;
 	}
 
-	dev->wanted_features &= ~features[0].valid;
-	dev->wanted_features |= features[0].valid & features[0].requested;
+	dev->legacy_wanted_features &= ~features[0].valid;
+	dev->legacy_wanted_features |= features[0].valid & features[0].requested;
 	__netdev_update_features(dev);
 
-	if ((dev->wanted_features ^ dev->features) & features[0].valid)
+	if ((dev->legacy_wanted_features ^ dev->legacy_features)
+			& features[0].valid)
 		ret |= ETHTOOL_F_WISH;
 
 	return ret;
@@ -445,7 +446,7 @@ static void *__ethtool_get_one_feature_actor(struct net_device *dev, u32 ethcmd)
 
 static u32 __ethtool_get_rx_csum_oldbug(struct net_device *dev)
 {
-	return !!(dev->features & NETIF_F_ALL_CSUM);
+	return !!(dev->legacy_features & NETIF_F_ALL_CSUM);
 }
 
 static int ethtool_get_one_feature(struct net_device *dev,
@@ -454,11 +455,11 @@ static int ethtool_get_one_feature(struct net_device *dev,
 	u32 mask = ethtool_get_feature_mask(ethcmd);
 	struct ethtool_value edata = {
 		.cmd = ethcmd,
-		.data = !!(dev->features & mask),
+		.data = !!(dev->legacy_features & mask),
 	};
 
 	/* compatibility with discrete get_ ops */
-	if (!(dev->hw_features & mask)) {
+	if (!(dev->legacy_hw_features & mask)) {
 		u32 (*actor)(struct net_device *);
 
 		actor = __ethtool_get_one_feature_actor(dev, ethcmd);
@@ -492,12 +493,12 @@ static int ethtool_set_one_feature(struct net_device *dev,
 		return -EFAULT;
 
 	mask = ethtool_get_feature_mask(ethcmd);
-	mask &= dev->hw_features;
+	mask &= dev->legacy_hw_features;
 	if (mask) {
 		if (edata.data)
-			dev->wanted_features |= mask;
+			dev->legacy_wanted_features |= mask;
 		else
-			dev->wanted_features &= ~mask;
+			dev->legacy_wanted_features &= ~mask;
 
 		__netdev_update_features(dev);
 		return 0;
@@ -537,19 +538,19 @@ int __ethtool_set_flags(struct net_device *dev, u32 data)
 
 	/* legacy set_flags() op */
 	if (dev->ethtool_ops->set_flags) {
-		if (unlikely(dev->hw_features & flags_dup_features))
+		if (unlikely(dev->legacy_hw_features & flags_dup_features))
 			netdev_warn(dev,
 				"driver BUG: mixed hw_features and set_flags()\n");
 		return dev->ethtool_ops->set_flags(dev, data);
 	}
 
 	/* allow changing only bits set in hw_features */
-	changed = (data ^ dev->wanted_features) & flags_dup_features;
-	if (changed & ~dev->hw_features)
-		return (changed & dev->hw_features) ? -EINVAL : -EOPNOTSUPP;
+	changed = (data ^ dev->legacy_wanted_features) & flags_dup_features;
+	if (changed & ~dev->legacy_hw_features)
+		return (changed & dev->legacy_hw_features) ? -EINVAL : -EOPNOTSUPP;
 
-	dev->wanted_features =
-		(dev->wanted_features & ~changed) | data;
+	dev->legacy_wanted_features =
+		(dev->legacy_wanted_features & ~changed) | data;
 
 	__netdev_update_features(dev);
 
@@ -908,7 +909,7 @@ static noinline_for_stack int ethtool_set_rx_ntuple(struct net_device *dev,
 	struct ethtool_rx_ntuple_flow_spec_container *fsc = NULL;
 	int ret;
 
-	if (!(dev->features & NETIF_F_NTUPLE))
+	if (!(dev->legacy_features & NETIF_F_NTUPLE))
 		return -EINVAL;
 
 	if (copy_from_user(&cmd, useraddr, sizeof(cmd)))
@@ -1475,7 +1476,7 @@ static int __ethtool_set_sg(struct net_device *dev, u32 data)
 	if (!dev->ethtool_ops->set_sg)
 		return -EOPNOTSUPP;
 
-	if (data && !(dev->features & NETIF_F_ALL_CSUM))
+	if (data && !(dev->legacy_features & NETIF_F_ALL_CSUM))
 		return -EINVAL;
 
 	if (!data && dev->ethtool_ops->set_tso) {
@@ -1514,7 +1515,7 @@ static int __ethtool_set_rx_csum(struct net_device *dev, u32 data)
 		return -EOPNOTSUPP;
 
 	if (!data)
-		dev->features &= ~NETIF_F_GRO;
+		dev->legacy_features &= ~NETIF_F_GRO;
 
 	return dev->ethtool_ops->set_rx_csum(dev, data);
 }
@@ -1524,7 +1525,7 @@ static int __ethtool_set_tso(struct net_device *dev, u32 data)
 	if (!dev->ethtool_ops->set_tso)
 		return -EOPNOTSUPP;
 
-	if (data && !(dev->features & NETIF_F_SG))
+	if (data && !(dev->legacy_features & NETIF_F_SG))
 		return -EINVAL;
 
 	return dev->ethtool_ops->set_tso(dev, data);
@@ -1534,10 +1535,10 @@ static int __ethtool_set_ufo(struct net_device *dev, u32 data)
 {
 	if (!dev->ethtool_ops->set_ufo)
 		return -EOPNOTSUPP;
-	if (data && !(dev->features & NETIF_F_SG))
+	if (data && !(dev->legacy_features & NETIF_F_SG))
 		return -EINVAL;
-	if (data && !((dev->features & NETIF_F_GEN_CSUM) ||
-		(dev->features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))
+	if (data && !((dev->legacy_features & NETIF_F_GEN_CSUM) ||
+		(dev->legacy_features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))
 			== (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM)))
 		return -EINVAL;
 	return dev->ethtool_ops->set_ufo(dev, data);
@@ -1805,7 +1806,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
 		if (rc  < 0)
 			return rc;
 	}
-	old_features = dev->features;
+	old_features = dev->legacy_features;
 
 	switch (ethcmd) {
 	case ETHTOOL_GSET:
@@ -1960,7 +1961,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
 	if (dev->ethtool_ops->complete)
 		dev->ethtool_ops->complete(dev);
 
-	if (old_features != dev->features)
+	if (old_features != dev->legacy_features)
 		netdev_features_change(dev);
 
 	return rc;
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 5ceb257..088a2d4 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -99,7 +99,7 @@ NETDEVICE_SHOW(addr_assign_type, fmt_dec);
 NETDEVICE_SHOW(addr_len, fmt_dec);
 NETDEVICE_SHOW(iflink, fmt_dec);
 NETDEVICE_SHOW(ifindex, fmt_dec);
-NETDEVICE_SHOW(features, fmt_hex);
+NETDEVICE_SHOW(legacy_features, fmt_hex);
 NETDEVICE_SHOW(type, fmt_dec);
 NETDEVICE_SHOW(link_mode, fmt_dec);
 
@@ -316,7 +316,7 @@ static struct device_attribute net_class_attributes[] = {
 	__ATTR(ifalias, S_IRUGO | S_IWUSR, show_ifalias, store_ifalias),
 	__ATTR(iflink, S_IRUGO, show_iflink, NULL),
 	__ATTR(ifindex, S_IRUGO, show_ifindex, NULL),
-	__ATTR(features, S_IRUGO, show_features, NULL),
+	__ATTR(legacy_features, S_IRUGO, show_legacy_features, NULL),
 	__ATTR(type, S_IRUGO, show_type, NULL),
 	__ATTR(link_mode, S_IRUGO, show_link_mode, NULL),
 	__ATTR(address, S_IRUGO, show_address, NULL),
diff --git a/net/core/sock.c b/net/core/sock.c
index 7dfed79..4f067df 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1301,7 +1301,7 @@ EXPORT_SYMBOL_GPL(sk_clone);
 void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
 {
 	__sk_dst_set(sk, dst);
-	sk->sk_route_caps = dst->dev->features;
+	sk->sk_route_caps = dst->dev->legacy_features;
 	if (sk->sk_route_caps & NETIF_F_GSO)
 		sk->sk_route_caps |= NETIF_F_GSO_SOFTWARE;
 	sk->sk_route_caps &= ~sk->sk_route_nocaps;
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2011-04-07 15:00 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-06  0:44 [PATCH 00/20] extending (hw_/wanted_/vlan_)features fields to a bitmap Mahesh Bandewar
2011-04-06  0:44 ` [PATCH 01/20] net-core: " Mahesh Bandewar
2011-04-06  0:44   ` [PATCH 02/20] net-ipv4: " Mahesh Bandewar
2011-04-06  0:44     ` [PATCH 03/20] net-ipv6: " Mahesh Bandewar
2011-04-06  0:44       ` [PATCH 04/20] net-vlan: " Mahesh Bandewar
2011-04-06  0:44         ` [PATCH 05/20] net-bridge: " Mahesh Bandewar
2011-04-06  0:44           ` [PATCH 06/20] net-decnet: " Mahesh Bandewar
2011-04-06  0:44             ` [PATCH 07/20] net-dsa: " Mahesh Bandewar
2011-04-06  0:44               ` [PATCH 08/20] net-l2tp: " Mahesh Bandewar
2011-04-06  0:44                 ` [PATCH 09/20] net-phonet: " Mahesh Bandewar
2011-04-06  0:44                   ` [PATCH 10/20] net-sctp: " Mahesh Bandewar
2011-04-06  0:44                     ` [PATCH 11/20] net-wireless: " Mahesh Bandewar
2011-04-06  0:44                       ` [PATCH 12/20] loopback: " Mahesh Bandewar
2011-04-06  0:44                         ` [PATCH 13/20] veth: " Mahesh Bandewar
2011-04-06  0:44                           ` [PATCH 14/20] jme: " Mahesh Bandewar
2011-04-06  0:44                             ` [PATCH 15/20] sungem: " Mahesh Bandewar
2011-04-06  0:44                               ` [PATCH 16/20] sunhme: " Mahesh Bandewar
2011-04-06  0:44                                 ` [PATCH 17/20] usb-smsc75xx: " Mahesh Bandewar
2011-04-06  0:44                                   ` [PATCH 18/20] usb-smsc95xx: " Mahesh Bandewar
2011-04-06  0:44                                     ` [PATCH 19/20] virtio_net: " Mahesh Bandewar
2011-04-06  0:44                                       ` [PATCH 20/20] xen: " Mahesh Bandewar
2011-04-06  1:27   ` [PATCH 01/20] net-core: " Ben Hutchings
2011-04-06  1:35     ` Mahesh Bandewar
2011-04-06  1:45       ` Ben Hutchings
2011-04-06 10:29   ` Michał Mirosław
2011-04-06 17:34     ` Mahesh Bandewar
2011-04-07 15:00   ` [PATCHv2 " Mahesh Bandewar

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).