Netdev List
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Disable rp_filter for IPsec packets
From: Michael Smith @ 2011-04-07 14:51 UTC (permalink / raw)
  To: netdev

The reverse path filter interferes with IPsec subnet-to-subnet tunnels,
especially when the link to the IPsec peer is on an interface other than
the one hosting the default route.

IPsec provides a much stronger anti-spoofing policy than rp_filter, so
this patch disables the rp_filter for packets with a security path.

Patch is against net-next.

(old discussion here: http://patchwork.ozlabs.org/patch/86826/)

Michael Smith (2):
  fib_validate_source(): pass sk_buff instead of mark
  Disable rp_filter for IPsec packets

 include/net/ip_fib.h    |    6 +++---
 include/net/xfrm.h      |    9 +++++++++
 net/ipv4/fib_frontend.c |   16 +++++++++-------
 net/ipv4/route.c        |   16 ++++++++--------
 4 files changed, 29 insertions(+), 18 deletions(-)


^ permalink raw reply

* [PATCH v2 2/2] Disable rp_filter for IPsec packets
From: Michael Smith @ 2011-04-07 14:51 UTC (permalink / raw)
  To: netdev
In-Reply-To: <1302187911-20688-2-git-send-email-msmith@cbnco.com>

The reverse path filter interferes with IPsec subnet-to-subnet tunnels,
especially when the link to the IPsec peer is on an interface other than
the one hosting the default route.

With dynamic routing, where the peer might be reachable through eth0
today and eth1 tomorrow, it's difficult to keep rp_filter enabled unless
fake routes to the remote subnets are configured on the interface
currently used to reach the peer.

IPsec provides a much stronger anti-spoofing policy than rp_filter, so
this patch disables the rp_filter for packets with a security path.

Signed-off-by: Michael Smith <msmith@cbnco.com>
---
 include/net/xfrm.h      |    9 +++++++++
 net/ipv4/fib_frontend.c |    6 +++++-
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 6ae4bc5..65ea313 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -957,6 +957,15 @@ struct sec_path {
 	struct xfrm_state	*xvec[XFRM_MAX_DEPTH];
 };
 
+static inline int secpath_exists(struct sk_buff *skb)
+{
+#ifdef CONFIG_XFRM
+	return skb->sp != NULL;
+#else
+	return 0;
+#endif
+}
+
 static inline struct sec_path *
 secpath_get(struct sec_path *sp)
 {
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index f162f84..2252471 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -44,6 +44,7 @@
 #include <net/arp.h>
 #include <net/ip_fib.h>
 #include <net/rtnetlink.h>
+#include <net/xfrm.h>
 
 #ifndef CONFIG_IP_MULTIPLE_TABLES
 
@@ -211,7 +212,10 @@ int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, u8 tos,
 	in_dev = __in_dev_get_rcu(dev);
 	if (in_dev) {
 		no_addr = in_dev->ifa_list == NULL;
-		rpf = IN_DEV_RPFILTER(in_dev);
+
+		/* Ignore rp_filter for packets protected by IPsec. */
+		rpf = secpath_exists(skb) ? 0 : IN_DEV_RPFILTER(in_dev);
+
 		accept_local = IN_DEV_ACCEPT_LOCAL(in_dev);
 		fl4.flowi4_mark = IN_DEV_SRC_VMARK(in_dev) ? skb->mark : 0;
 	}
-- 
1.6.3.2


^ permalink raw reply related

* [PATCH v2 1/2] fib_validate_source(): pass sk_buff instead of mark
From: Michael Smith @ 2011-04-07 14:51 UTC (permalink / raw)
  To: netdev
In-Reply-To: <1302187911-20688-1-git-send-email-msmith@cbnco.com>

This makes sk_buff available for other use in fib_validate_source().

Signed-off-by: Michael Smith <msmith@cbnco.com>
---
 include/net/ip_fib.h    |    6 +++---
 net/ipv4/fib_frontend.c |   10 ++++------
 net/ipv4/route.c        |   16 ++++++++--------
 3 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index e5d66ec..514627f 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -227,9 +227,9 @@ extern struct fib_table *fib_get_table(struct net *net, u32 id);
 /* Exported by fib_frontend.c */
 extern const struct nla_policy rtm_ipv4_policy[];
 extern void		ip_fib_init(void);
-extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
-			       struct net_device *dev, __be32 *spec_dst,
-			       u32 *itag, u32 mark);
+extern int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
+			       u8 tos, int oif, struct net_device *dev,
+			       __be32 *spec_dst, u32 *itag);
 extern void fib_select_default(struct fib_result *res);
 
 /* Exported by fib_semantics.c */
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 4510883..f162f84 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -188,9 +188,9 @@ EXPORT_SYMBOL(inet_dev_addr_type);
  * - check, that packet arrived from expected physical interface.
  * called with rcu_read_lock()
  */
-int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
-			struct net_device *dev, __be32 *spec_dst,
-			u32 *itag, u32 mark)
+int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, u8 tos,
+			int oif, struct net_device *dev, __be32 *spec_dst,
+			u32 *itag)
 {
 	struct in_device *in_dev;
 	struct flowi4 fl4;
@@ -202,7 +202,6 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
 
 	fl4.flowi4_oif = 0;
 	fl4.flowi4_iif = oif;
-	fl4.flowi4_mark = mark;
 	fl4.daddr = src;
 	fl4.saddr = dst;
 	fl4.flowi4_tos = tos;
@@ -214,8 +213,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
 		no_addr = in_dev->ifa_list == NULL;
 		rpf = IN_DEV_RPFILTER(in_dev);
 		accept_local = IN_DEV_ACCEPT_LOCAL(in_dev);
-		if (mark && !IN_DEV_SRC_VMARK(in_dev))
-			fl4.flowi4_mark = 0;
+		fl4.flowi4_mark = IN_DEV_SRC_VMARK(in_dev) ? skb->mark : 0;
 	}
 
 	if (in_dev == NULL)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 4b0c811..57447b7 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1871,8 +1871,8 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
 			goto e_inval;
 		spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK);
 	} else {
-		err = fib_validate_source(saddr, 0, tos, 0, dev, &spec_dst,
-					  &itag, 0);
+		err = fib_validate_source(skb, saddr, 0, tos, 0, dev, &spec_dst,
+					  &itag);
 		if (err < 0)
 			goto e_err;
 	}
@@ -1980,8 +1980,8 @@ static int __mkroute_input(struct sk_buff *skb,
 	}
 
 
-	err = fib_validate_source(saddr, daddr, tos, FIB_RES_OIF(*res),
-				  in_dev->dev, &spec_dst, &itag, skb->mark);
+	err = fib_validate_source(skb, saddr, daddr, tos, FIB_RES_OIF(*res),
+				  in_dev->dev, &spec_dst, &itag);
 	if (err < 0) {
 		ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr,
 					 saddr);
@@ -2148,9 +2148,9 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
 		goto brd_input;
 
 	if (res.type == RTN_LOCAL) {
-		err = fib_validate_source(saddr, daddr, tos,
+		err = fib_validate_source(skb, saddr, daddr, tos,
 					  net->loopback_dev->ifindex,
-					  dev, &spec_dst, &itag, skb->mark);
+					  dev, &spec_dst, &itag);
 		if (err < 0)
 			goto martian_source_keep_err;
 		if (err)
@@ -2174,8 +2174,8 @@ brd_input:
 	if (ipv4_is_zeronet(saddr))
 		spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK);
 	else {
-		err = fib_validate_source(saddr, 0, tos, 0, dev, &spec_dst,
-					  &itag, skb->mark);
+		err = fib_validate_source(skb, saddr, 0, tos, 0, dev, &spec_dst,
+					  &itag);
 		if (err < 0)
 			goto martian_source_keep_err;
 		if (err)
-- 
1.6.3.2


^ permalink raw reply related

* [PATCHv2 01/20] net-core: extending (hw_/wanted_/vlan_)features fields to a bitmap.
From: Mahesh Bandewar @ 2011-04-07 15:00 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar
In-Reply-To: <1302050665-10460-2-git-send-email-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>
---
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

* Re: [PATCH v2 14/16] Intel net drivers: convert to ndo_fix_features
From: Jeff Kirsher @ 2011-04-07 15:00 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: davem@davemloft.net, netdev@vger.kernel.org, Ben Hutchings
In-Reply-To: <20110407125127.GA16755@rere.qmqm.pl>

[-- Attachment #1: Type: text/plain, Size: 1912 bytes --]

On Thu, 2011-04-07 at 05:51 -0700, Michał Mirosław wrote:
> On Wed, Jan 26, 2011 at 01:47:46AM -0800, Jeff Kirsher wrote:
> > 2011/1/22 Michał Mirosław <mirq-linux@rere.qmqm.pl>:
> > > Private rx_csum flags are now duplicate of netdev->features & NETIF_F_RXCSUM.
> > > Removing this needs deeper surgery.
> > >
> > > Since ixgbevf doesn't change hardware state on RX csum enable/disable
> > > its reset is avoided.
> > >
> > > Things noticed:
> > >  - e1000, e1000e and ixgb have RX csum disabled by default
> > >  - HW VLAN acceleration probably can be toggled, but it's left as is
> > >  - the resets on RX csum offload change can probably be avoided
> > >  - there is A LOT of copy-and-pasted code here
> [...]
> > Upon initial reviews of the patch, we found issues with the e1000e
> > changes so far.  We are working to put together a patch to resolve the
> > issues (and to do the conversion to ndo_fix_features).  Based on the
> > initial work done by Michal, we can take care of the changes necessary
> > for the Intel Wired Ethernet drivers, and will wait for acceptance of
> > the net and ethtool changes before pushing the Intel patch.  Is that
> > acceptable?
> > 
> > For e1000e, this patch breaks the ability to manually override the
> > default behavior of disabling TSO for 10/100, and there is some
> > additional cleanup that can be done w.r.t. Rx csum flags.
> 
> I resent other patches after the ethtool changes got it 2.6.39-rc, but skipped
> this one based on your mail. Do you want me to resend parts not relevant
> to e1000e or can I drop it altogether from my queue?
> 
> Best Regards,
> Michał Mirosław

You can drop them from your queue.  We have been working on these
patches.  We found other issues with the other drivers as well, so we
are making the appropriate changes to get this conversion completed.

Thanks Michal.

Cheers,
Jeff

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply

* Re: [PATCH 07/19] timberdale: mfd_cell is now implicitly available to drivers
From: Samuel Ortiz @ 2011-04-07 15:03 UTC (permalink / raw)
  To: Grant Likely
  Cc: Felipe Balbi, Greg KH, Andres Salomon,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Mark Brown,
	khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	Peter Korsgaard, Mauro Carvalho Chehab, David Brownell,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-media-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	Mocean Laboratories
In-Reply-To: <20110407143515.GC26452-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>

On Thu, Apr 07, 2011 at 07:35:15AM -0700, Grant Likely wrote:
> > Below is a patch for the Xilinx SPI example. Although this would fix the
> > issue, we'd still have to do that on device per device basis. I had a similar
> > solution where MFD drivers would set a flag for sub drivers that don't need
> > any of the MFD bits. In that case the MFD core code would just forward the
> > platform data, instead of embedding it through an MFD cell.
> 
> platform_data is already a fiddly bit where you don't know what
> structure type platform_data points at; it is implicitly known and
> easy to get wrong.  This solution makes me *very* nervous
> because it would become even easier to get a mismatch on the
> platform_data pointer type.
How would that be more error prone than say a board file instantiating a
platform device after having set the platform_data pointer to point to an
implicitely know structure reference ?

Cheers,
Samuel.

P.S.: Would you be ok with something like the patch below ?

> > ---
> >  drivers/mfd/timberdale.c |    8 ++++----
> >  drivers/spi/xilinx_spi.c |   19 ++++++++++++++++++-
> >  include/linux/mfd/core.h |    3 +++
> >  3 files changed, 25 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/mfd/timberdale.c b/drivers/mfd/timberdale.c
> > index 94c6c8a..c9220ce 100644
> > --- a/drivers/mfd/timberdale.c
> > +++ b/drivers/mfd/timberdale.c
> > @@ -416,7 +416,7 @@ static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg0[] = {
> >  		.mfd_data = &timberdale_radio_platform_data,
> >  	},
> >  	{
> > -		.name = "xilinx_spi",
> > +		.name = "mfd_xilinx_spi",
> >  		.num_resources = ARRAY_SIZE(timberdale_spi_resources),
> >  		.resources = timberdale_spi_resources,
> >  		.mfd_data = &timberdale_xspi_platform_data,
> > @@ -476,7 +476,7 @@ static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg1[] = {
> >  		.mfd_data = &timberdale_radio_platform_data,
> >  	},
> >  	{
> > -		.name = "xilinx_spi",
> > +		.name = "mfd_xilinx_spi",
> >  		.num_resources = ARRAY_SIZE(timberdale_spi_resources),
> >  		.resources = timberdale_spi_resources,
> >  		.mfd_data = &timberdale_xspi_platform_data,
> > @@ -526,7 +526,7 @@ static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg2[] = {
> >  		.mfd_data = &timberdale_radio_platform_data,
> >  	},
> >  	{
> > -		.name = "xilinx_spi",
> > +		.name = "mfd_xilinx_spi",
> >  		.num_resources = ARRAY_SIZE(timberdale_spi_resources),
> >  		.resources = timberdale_spi_resources,
> >  		.mfd_data = &timberdale_xspi_platform_data,
> > @@ -570,7 +570,7 @@ static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg3[] = {
> >  		.mfd_data = &timberdale_radio_platform_data,
> >  	},
> >  	{
> > -		.name = "xilinx_spi",
> > +		.name = "mfd_xilinx_spi",
> >  		.num_resources = ARRAY_SIZE(timberdale_spi_resources),
> >  		.resources = timberdale_spi_resources,
> >  		.mfd_data = &timberdale_xspi_platform_data,
> > diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
> > index c69c6f2..3287b84 100644
> > --- a/drivers/spi/xilinx_spi.c
> > +++ b/drivers/spi/xilinx_spi.c
> > @@ -471,7 +471,11 @@ static int __devinit xilinx_spi_probe(struct platform_device *dev)
> >  	struct spi_master *master;
> >  	u8 i;
> >  
> > -	pdata = mfd_get_data(dev);
> > +	if (platform_get_device_id(dev) &&
> > +	    platform_get_device_id(dev)->driver_data & MFD_PLATFORM_DEVICE)
> > +		pdata = mfd_get_data(dev);
> > +	else
> > +		pdata = dev->dev.platform_data;
> >  	if (pdata) {
> >  		num_cs = pdata->num_chipselect;
> >  		little_endian = pdata->little_endian;
> > @@ -530,6 +534,18 @@ static int __devexit xilinx_spi_remove(struct platform_device *dev)
> >  /* work with hotplug and coldplug */
> >  MODULE_ALIAS("platform:" XILINX_SPI_NAME);
> >  
> > +static const struct platform_device_id xilinx_spi_id_table[] = {
> > +	{
> > +		.name	= XILINX_SPI_NAME,
> > +	},
> > +	{
> > +		.name	= "mfd_xilinx_spi",
> > +		.driver_data = MFD_PLATFORM_DEVICE,
> > +	},
> > +	{  },	/* Terminating Entry */
> > +};
> > +MODULE_DEVICE_TABLE(platform, xilinx_spi_id_table);
> > +
> >  static struct platform_driver xilinx_spi_driver = {
> >  	.probe = xilinx_spi_probe,
> >  	.remove = __devexit_p(xilinx_spi_remove),
> > @@ -538,6 +554,7 @@ static struct platform_driver xilinx_spi_driver = {
> >  		.owner = THIS_MODULE,
> >  		.of_match_table = xilinx_spi_of_match,
> >  	},
> > +	.id_table	= xilinx_spi_id_table,
> >  };
> >  
> >  static int __init xilinx_spi_pltfm_init(void)
> > diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
> > index ad1b19a..13f31f4 100644
> > --- a/include/linux/mfd/core.h
> > +++ b/include/linux/mfd/core.h
> > @@ -89,6 +89,9 @@ static inline const struct mfd_cell *mfd_get_cell(struct platform_device *pdev)
> >  	return pdev->dev.platform_data;
> >  }
> >  
> > +/* */
> > +#define MFD_PLATFORM_DEVICE BIT(0)
> > +
> >  /*
> >   * Given a platform device that's been created by mfd_add_devices(), fetch
> >   * the .mfd_data entry from the mfd_cell that created it.
> > 
> > 
> > -- 
> > Intel Open Source Technology Centre
> > http://oss.intel.com/

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

^ permalink raw reply

* Re: Low performance Intel 10GE NIC (3.2.10) on 2.6.38 Kernel
From: Alexander Duyck @ 2011-04-07 15:58 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Wei Gu, netdev, Kirsher, Jeffrey T
In-Reply-To: <1302176811.3357.15.camel@edumazet-laptop>

On 4/7/2011 4:46 AM, Eric Dumazet wrote:
> Le jeudi 07 avril 2011 à 19:15 +0800, Wei Gu a écrit :
>> Hi,
>> I compile the ixgbe driver into the kernel and run the test again and also change the copy to clone in the fw hook
>> This is the perf report while I was forwarding 150Kpps with
>> The attached file include the basic info about my test system. Please let me know if I did some thing wrong.
>>
>> +     71.91%          swapper  [kernel.kallsyms]            [k] poll_idle
>> +     10.43%          swapper  [kernel.kallsyms]            [k] intel_idle
>> -      8.00%     ksoftirqd/24  [kernel.kallsyms]            [k] _raw_spin_unlock_irqrestore
>> \u2592   - _raw_spin_unlock_irqrestore
>> \u2592      - 42.25% alloc_iova
>> \u2592           intel_alloc_iova
>> \u2592           __intel_map_single
>> \u2592           intel_map_page

I'm almost certain this is the issue here.  I am pretty sure the 
intel_map_page call indicates that you are running with the Intel IOMMU 
enabled.  As Eric suggested you can either rebuild your kernel with 
"CONFIG_DMAR=N", or pass the kernel the parameter "intel_iommu=off" in 
order to disable it so that it will instead just use SWIOTLB.

Thanks,

Alex


^ permalink raw reply

* Re: Low performance Intel 10GE NIC (3.2.10) on 2.6.38 Kernel
From: Eric Dumazet @ 2011-04-07 16:03 UTC (permalink / raw)
  To: Alexander Duyck; +Cc: Wei Gu, netdev, Kirsher, Jeffrey T
In-Reply-To: <4D9DDF43.9080302@intel.com>

Le jeudi 07 avril 2011 à 08:58 -0700, Alexander Duyck a écrit :
> On 4/7/2011 4:46 AM, Eric Dumazet wrote:
> > Le jeudi 07 avril 2011 à 19:15 +0800, Wei Gu a écrit :
> >> Hi,
> >> I compile the ixgbe driver into the kernel and run the test again and also change the copy to clone in the fw hook
> >> This is the perf report while I was forwarding 150Kpps with
> >> The attached file include the basic info about my test system. Please let me know if I did some thing wrong.
> >>
> >> +     71.91%          swapper  [kernel.kallsyms]            [k] poll_idle
> >> +     10.43%          swapper  [kernel.kallsyms]            [k] intel_idle
> >> -      8.00%     ksoftirqd/24  [kernel.kallsyms]            [k] _raw_spin_unlock_irqrestore
> >> \u2592   - _raw_spin_unlock_irqrestore
> >> \u2592      - 42.25% alloc_iova
> >> \u2592           intel_alloc_iova
> >> \u2592           __intel_map_single
> >> \u2592           intel_map_page
> 
> I'm almost certain this is the issue here.  I am pretty sure the 
> intel_map_page call indicates that you are running with the Intel IOMMU 
> enabled.  As Eric suggested you can either rebuild your kernel with 
> "CONFIG_DMAR=N", or pass the kernel the parameter "intel_iommu=off" in 
> order to disable it so that it will instead just use SWIOTLB.

What's the purpose of intel_iommu ?

Could this be speedup if ixgbe uses a perqueue iommu context instead of
a per device, so that we dont hit a single spinlock ?



^ permalink raw reply

* [RFC 1/6]Fix typo "recieve" in various parts of the kernel.
From: Justin P. Mattock @ 2011-04-07 16:09 UTC (permalink / raw)
  To: trivial
  Cc: linux-kernel, Justin P. Mattock, linux-input, linux-arm-kernel,
	linux-mtd, netdev, socketcan-core, linux-scsi, linux-usb

The patch below fixes some typos "recieve" in various parts of the kernel.
Note: these below are in actual code rather than comments(excpet for r852.c which
has a code fix, and comment).
compile tested as best as I can...

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
CC: linux-input@vger.kernel.org
CC: linux-arm-kernel@lists.infradead.org 
CC: linux-mtd@lists.infradead.org
CC: netdev@vger.kernel.org
CC: socketcan-core@lists.berlios.de
CC: linux-scsi@vger.kernel.org 
CC: linux-usb@vger.kernel.org
---
 drivers/input/misc/keyspan_remote.c |    2 +-
 drivers/mfd/ab8500-gpadc.c          |    2 +-
 drivers/mtd/nand/r852.c             |    6 +++---
 drivers/net/bnx2x/bnx2x_link.c      |    8 ++++----
 drivers/net/can/janz-ican3.c        |    4 ++--
 drivers/scsi/scsi_netlink.c         |    2 +-
 drivers/usb/misc/ftdi-elan.c        |   28 ++++++++++++++--------------
 drivers/uwb/reset.c                 |    2 +-
 8 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/input/misc/keyspan_remote.c b/drivers/input/misc/keyspan_remote.c
index a93c525..fc62256 100644
--- a/drivers/input/misc/keyspan_remote.c
+++ b/drivers/input/misc/keyspan_remote.c
@@ -312,7 +312,7 @@ static void keyspan_check_data(struct usb_keyspan *remote)
 			remote->data.tester = remote->data.tester >> 5;
 			remote->data.bits_left -= 5;
 		} else {
-			err("Bad message recieved, no stop bit found.\n");
+			err("Bad message received, no stop bit found.\n");
 		}
 
 		dev_dbg(&remote->udev->dev,
diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c
index bc93b2e..ea91ef1 100644
--- a/drivers/mfd/ab8500-gpadc.c
+++ b/drivers/mfd/ab8500-gpadc.c
@@ -314,7 +314,7 @@ int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 input)
 	/* wait for completion of conversion */
 	if (!wait_for_completion_timeout(&gpadc->ab8500_gpadc_complete, 2*HZ)) {
 		dev_err(gpadc->dev,
-			"timeout: didnt recieve GPADC conversion interrupt\n");
+			"timeout: didnt receive GPADC conversion interrupt\n");
 		ret = -EINVAL;
 		goto out;
 	}
diff --git a/drivers/mtd/nand/r852.c b/drivers/mtd/nand/r852.c
index 6322d1f..45a3f60 100644
--- a/drivers/mtd/nand/r852.c
+++ b/drivers/mtd/nand/r852.c
@@ -766,7 +766,7 @@ static irqreturn_t r852_irq(int irq, void *data)
 		ret = IRQ_HANDLED;
 		dev->card_detected = !!(card_status & R852_CARD_IRQ_INSERT);
 
-		/* we shouldn't recieve any interrupts if we wait for card
+		/* we shouldn't receive any interrupts if we wait for card
 			to settle */
 		WARN_ON(dev->card_unstable);
 
@@ -794,13 +794,13 @@ static irqreturn_t r852_irq(int irq, void *data)
 		ret = IRQ_HANDLED;
 
 		if (dma_status & R852_DMA_IRQ_ERROR) {
-			dbg("recieved dma error IRQ");
+			dbg("received dma error IRQ");
 			r852_dma_done(dev, -EIO);
 			complete(&dev->dma_done);
 			goto out;
 		}
 
-		/* recieved DMA interrupt out of nowhere? */
+		/* received DMA interrupt out of nowhere? */
 		WARN_ON_ONCE(dev->dma_stage == 0);
 
 		if (dev->dma_stage == 0)
diff --git a/drivers/net/bnx2x/bnx2x_link.c b/drivers/net/bnx2x/bnx2x_link.c
index f2f367d..d25491b 100644
--- a/drivers/net/bnx2x/bnx2x_link.c
+++ b/drivers/net/bnx2x/bnx2x_link.c
@@ -2385,7 +2385,7 @@ static void bnx2x_check_fallback_to_cl37(struct bnx2x_phy *phy,
 					 struct link_params *params)
 {
 	struct bnx2x *bp = params->bp;
-	u16 rx_status, ustat_val, cl37_fsm_recieved;
+	u16 rx_status, ustat_val, cl37_fsm_received;
 	DP(NETIF_MSG_LINK, "bnx2x_check_fallback_to_cl37\n");
 	/* Step 1: Make sure signal is detected */
 	CL22_RD_OVER_CL45(bp, phy,
@@ -2423,15 +2423,15 @@ static void bnx2x_check_fallback_to_cl37(struct bnx2x_phy *phy,
 	CL22_RD_OVER_CL45(bp, phy,
 			  MDIO_REG_BANK_REMOTE_PHY,
 			  MDIO_REMOTE_PHY_MISC_RX_STATUS,
-			  &cl37_fsm_recieved);
-	if ((cl37_fsm_recieved &
+			  &cl37_fsm_received);
+	if ((cl37_fsm_received &
 	     (MDIO_REMOTE_PHY_MISC_RX_STATUS_CL37_FSM_RECEIVED_OVER1G_MSG |
 	     MDIO_REMOTE_PHY_MISC_RX_STATUS_CL37_FSM_RECEIVED_BRCM_OUI_MSG)) !=
 	    (MDIO_REMOTE_PHY_MISC_RX_STATUS_CL37_FSM_RECEIVED_OVER1G_MSG |
 	      MDIO_REMOTE_PHY_MISC_RX_STATUS_CL37_FSM_RECEIVED_BRCM_OUI_MSG)) {
 		DP(NETIF_MSG_LINK, "No CL37 FSM were received. "
 			     "misc_rx_status(0x8330) = 0x%x\n",
-			 cl37_fsm_recieved);
+			 cl37_fsm_received);
 		return;
 	}
 	/*
diff --git a/drivers/net/can/janz-ican3.c b/drivers/net/can/janz-ican3.c
index 102b16c..98667f9 100644
--- a/drivers/net/can/janz-ican3.c
+++ b/drivers/net/can/janz-ican3.c
@@ -1050,7 +1050,7 @@ static void ican3_handle_inquiry(struct ican3_dev *mod, struct ican3_msg *msg)
 		complete(&mod->termination_comp);
 		break;
 	default:
-		dev_err(mod->dev, "recieved an unknown inquiry response\n");
+		dev_err(mod->dev, "received an unknown inquiry response\n");
 		break;
 	}
 }
@@ -1058,7 +1058,7 @@ static void ican3_handle_inquiry(struct ican3_dev *mod, struct ican3_msg *msg)
 static void ican3_handle_unknown_message(struct ican3_dev *mod,
 					struct ican3_msg *msg)
 {
-	dev_warn(mod->dev, "recieved unknown message: spec 0x%.2x length %d\n",
+	dev_warn(mod->dev, "received unknown message: spec 0x%.2x length %d\n",
 			   msg->spec, le16_to_cpu(msg->len));
 }
 
diff --git a/drivers/scsi/scsi_netlink.c b/drivers/scsi/scsi_netlink.c
index a2ed201..26a8a45 100644
--- a/drivers/scsi/scsi_netlink.c
+++ b/drivers/scsi/scsi_netlink.c
@@ -499,7 +499,7 @@ scsi_netlink_init(void)
 				SCSI_NL_GRP_CNT, scsi_nl_rcv_msg, NULL,
 				THIS_MODULE);
 	if (!scsi_nl_sock) {
-		printk(KERN_ERR "%s: register of recieve handler failed\n",
+		printk(KERN_ERR "%s: register of receive handler failed\n",
 				__func__);
 		netlink_unregister_notifier(&scsi_netlink_notifier);
 		return;
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c
index 7839c98..1871a30 100644
--- a/drivers/usb/misc/ftdi-elan.c
+++ b/drivers/usb/misc/ftdi-elan.c
@@ -187,7 +187,7 @@ struct usb_ftdi {
         u32 controlreg;
         u8 response[4 + 1024];
         int expected;
-        int recieved;
+        int received;
         int ed_found;
 };
 #define kref_to_usb_ftdi(d) container_of(d, struct usb_ftdi, kref)
@@ -353,7 +353,7 @@ static void ftdi_elan_abandon_targets(struct usb_ftdi *ftdi)
                         mutex_lock(&ftdi->u132_lock);
                 }
         }
-        ftdi->recieved = 0;
+        ftdi->received = 0;
         ftdi->expected = 4;
         ftdi->ed_found = 0;
         mutex_unlock(&ftdi->u132_lock);
@@ -411,7 +411,7 @@ static void ftdi_elan_flush_targets(struct usb_ftdi *ftdi)
                         }
                 }
         }
-        ftdi->recieved = 0;
+        ftdi->received = 0;
         ftdi->expected = 4;
         ftdi->ed_found = 0;
         mutex_unlock(&ftdi->u132_lock);
@@ -447,7 +447,7 @@ static void ftdi_elan_cancel_targets(struct usb_ftdi *ftdi)
                         }
                 }
         }
-        ftdi->recieved = 0;
+        ftdi->received = 0;
         ftdi->expected = 4;
         ftdi->ed_found = 0;
         mutex_unlock(&ftdi->u132_lock);
@@ -874,7 +874,7 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi,
                         mutex_unlock(&ftdi->u132_lock);
                         ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response,
                                 payload);
-                        ftdi->recieved = 0;
+                        ftdi->received = 0;
                         ftdi->expected = 4;
                         ftdi->ed_found = 0;
                         return ftdi->response;
@@ -890,7 +890,7 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi,
                         mutex_unlock(&ftdi->u132_lock);
                         ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response,
                                 payload);
-                        ftdi->recieved = 0;
+                        ftdi->received = 0;
                         ftdi->expected = 4;
                         ftdi->ed_found = 0;
                         return ftdi->response;
@@ -905,7 +905,7 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi,
                 mutex_unlock(&ftdi->u132_lock);
                 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response,
                         payload);
-                ftdi->recieved = 0;
+                ftdi->received = 0;
                 ftdi->expected = 4;
                 ftdi->ed_found = 0;
                 return ftdi->response;
@@ -914,7 +914,7 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi,
                 mutex_unlock(&ftdi->u132_lock);
                 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response,
                         payload);
-                ftdi->recieved = 0;
+                ftdi->received = 0;
                 ftdi->expected = 4;
                 ftdi->ed_found = 0;
                 return ftdi->response;
@@ -934,7 +934,7 @@ static char *have_ed_get_response(struct usb_ftdi *ftdi,
         if (target->active)
                 ftdi_elan_do_callback(ftdi, target, NULL, 0);
         target->abandoning = 0;
-        ftdi->recieved = 0;
+        ftdi->received = 0;
         ftdi->expected = 4;
         ftdi->ed_found = 0;
         return ftdi->response;
@@ -951,7 +951,7 @@ static char *have_ed_get_response(struct usb_ftdi *ftdi,
 */
 static int ftdi_elan_respond_engine(struct usb_ftdi *ftdi)
 {
-        u8 *b = ftdi->response + ftdi->recieved;
+        u8 *b = ftdi->response + ftdi->received;
         int bytes_read = 0;
         int retry_on_empty = 1;
         int retry_on_timeout = 3;
@@ -1043,11 +1043,11 @@ static int ftdi_elan_respond_engine(struct usb_ftdi *ftdi)
                 u8 c = ftdi->bulk_in_buffer[++ftdi->bulk_in_last];
                 bytes_read += 1;
                 ftdi->bulk_in_left -= 1;
-                if (ftdi->recieved == 0 && c == 0xFF) {
+                if (ftdi->received == 0 && c == 0xFF) {
                         goto have;
                 } else
                         *b++ = c;
-                if (++ftdi->recieved < ftdi->expected) {
+                if (++ftdi->received < ftdi->expected) {
                         goto have;
                 } else if (ftdi->ed_found) {
                         int ed_number = (ftdi->response[0] >> 5) & 0x03;
@@ -1069,7 +1069,7 @@ static int ftdi_elan_respond_engine(struct usb_ftdi *ftdi)
                         }
                         ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response,
                                 payload);
-                        ftdi->recieved = 0;
+                        ftdi->received = 0;
                         ftdi->expected = 4;
                         ftdi->ed_found = 0;
                         b = ftdi->response;
@@ -1089,7 +1089,7 @@ static int ftdi_elan_respond_engine(struct usb_ftdi *ftdi)
                         *respond->value = data;
                         *respond->result = 0;
                         complete(&respond->wait_completion);
-                        ftdi->recieved = 0;
+                        ftdi->received = 0;
                         ftdi->expected = 4;
                         ftdi->ed_found = 0;
                         b = ftdi->response;
diff --git a/drivers/uwb/reset.c b/drivers/uwb/reset.c
index 2784929..3de630b 100644
--- a/drivers/uwb/reset.c
+++ b/drivers/uwb/reset.c
@@ -52,7 +52,7 @@ const char *__strerror[] = {
 	"cancelled",
 	"invalid state",
 	"invalid size",
-	"ack not recieved",
+	"ack not received",
 	"no more asie notification",
 };
 
-- 
1.7.4.2


^ permalink raw reply related

* Re: Low performance Intel 10GE NIC (3.2.10) on 2.6.38 Kernel
From: Alexander Duyck @ 2011-04-07 16:20 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Wei Gu, netdev, Kirsher, Jeffrey T
In-Reply-To: <1302192218.3357.47.camel@edumazet-laptop>

On 4/7/2011 9:03 AM, Eric Dumazet wrote:
> Le jeudi 07 avril 2011 à 08:58 -0700, Alexander Duyck a écrit :
>> On 4/7/2011 4:46 AM, Eric Dumazet wrote:
>>> Le jeudi 07 avril 2011 à 19:15 +0800, Wei Gu a écrit :
>>>> Hi,
>>>> I compile the ixgbe driver into the kernel and run the test again and also change the copy to clone in the fw hook
>>>> This is the perf report while I was forwarding 150Kpps with
>>>> The attached file include the basic info about my test system. Please let me know if I did some thing wrong.
>>>>
>>>> +     71.91%          swapper  [kernel.kallsyms]            [k] poll_idle
>>>> +     10.43%          swapper  [kernel.kallsyms]            [k] intel_idle
>>>> -      8.00%     ksoftirqd/24  [kernel.kallsyms]            [k] _raw_spin_unlock_irqrestore
>>>> \u2592   - _raw_spin_unlock_irqrestore
>>>> \u2592      - 42.25% alloc_iova
>>>> \u2592           intel_alloc_iova
>>>> \u2592           __intel_map_single
>>>> \u2592           intel_map_page
>>
>> I'm almost certain this is the issue here.  I am pretty sure the
>> intel_map_page call indicates that you are running with the Intel IOMMU
>> enabled.  As Eric suggested you can either rebuild your kernel with
>> "CONFIG_DMAR=N", or pass the kernel the parameter "intel_iommu=off" in
>> order to disable it so that it will instead just use SWIOTLB.
>
> What's the purpose of intel_iommu ?
>
> Could this be speedup if ixgbe uses a perqueue iommu context instead of
> a per device, so that we dont hit a single spinlock ?

The intel_iommu is meant to be a security feature.  Primarily it is used 
in virtualzation where it allows KVM or Xen to direct assign a device 
without having to worry about the guest getting access to the hosts 
physical memory by submitting invalid DMA requests.

If virtualzation isn't in use I would recommend turning it off as it can 
have a negative impact especially on small packet performance due to the 
extra locking overhead that is required for DMA map and unmap calls.

Thanks,

Alex


^ permalink raw reply

* Re: [PATCH 07/19] timberdale: mfd_cell is now implicitly available to drivers
From: Grant Likely @ 2011-04-07 16:24 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: Andres Salomon, linux-kernel, Mark Brown, khali, ben-linux,
	Peter Korsgaard, Mauro Carvalho Chehab, David Brownell, linux-i2c,
	linux-media, netdev, spi-devel-general, Mocean Laboratories,
	Greg Kroah-Hartman
In-Reply-To: <20110405030428.GB29522@ponder.secretlab.ca>

On Mon, Apr 4, 2011 at 8:04 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Mon, Apr 04, 2011 at 12:03:15PM +0200, Samuel Ortiz wrote:
>> diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
>> index d96db98..734d254 100644
>> --- a/include/linux/platform_device.h
>> +++ b/include/linux/platform_device.h
>> @@ -14,6 +14,8 @@
>>  #include <linux/device.h>
>>  #include <linux/mod_devicetable.h>
>>
>> +struct mfd_cell;
>> +
>>  struct platform_device {
>>       const char      * name;
>>       int             id;
>> @@ -23,6 +25,9 @@ struct platform_device {
>>
>>       const struct platform_device_id *id_entry;
>>
>> +     /* MFD cell pointer */
>> +     struct mfd_cell *mfd_cell;
>> +
>
> Move this down to by the of_node pointer.  May as well collect all the
> supplemental data about the device in the same place.

So, okay.  wow.  I have *no* idea what I was smoking at this point in
time.  The of_node pointer is in struct device which is definitely not
the place to put the mfd_cell pointer (and you probably though I was
crazy when I suggested it).  Greg was totally right to complain about
moving it into struct device.  Sorry for causing trouble.

Move it back into struct platform_device and you should be good.  I
just talked to greg, and there should be any issues with locating it
there.

g.

^ permalink raw reply

* Re: Low performance Intel 10GE NIC (3.2.10) on 2.6.38 Kernel
From: Eric Dumazet @ 2011-04-07 16:37 UTC (permalink / raw)
  To: Alexander Duyck; +Cc: Wei Gu, netdev, Kirsher, Jeffrey T
In-Reply-To: <4D9DE465.1080008@intel.com>

Le jeudi 07 avril 2011 à 09:20 -0700, Alexander Duyck a écrit :

> The intel_iommu is meant to be a security feature.  Primarily it is used 
> in virtualzation where it allows KVM or Xen to direct assign a device 
> without having to worry about the guest getting access to the hosts 
> physical memory by submitting invalid DMA requests.
> 

I see

> If virtualzation isn't in use I would recommend turning it off as it can 
> have a negative impact especially on small packet performance due to the 
> extra locking overhead that is required for DMA map and unmap calls.

Sure, but then, if this thing is ON, we should copy small packets in
freshly allocated skbs and reuse old one in driver rx handler, to avoid
the expensive dma calls ?

[ The thing called copybreak ]

I understand tx path cost cannot be avoided, so it would not help Wei
use case.

Thanks !



^ permalink raw reply

* Re: [PATCH] xen: drop anti-dependency on X86_VISWS
From: H. Peter Anvin @ 2011-04-07 17:00 UTC (permalink / raw)
  To: Ian Campbell
  Cc: David Miller, eric.dumazet@gmail.com, mirq-linux@rere.qmqm.pl,
	netdev@vger.kernel.org, Jeremy Fitzhardinge,
	konrad.wilk@oracle.com, xen-devel@lists.xensource.com,
	virtualization@lists.linux-foundation.org,
	randy.dunlap@oracle.com, pazke@donpac.ru,
	linux-visws-devel@lists.sf.net, tglx@linutronix.de,
	mingo@redhat.com
In-Reply-To: <1302159483.31620.36.camel@localhost.localdomain>

On 04/06/2011 11:58 PM, Ian Campbell wrote:
> 
> I'm not sure why ELAN belongs in the EXTENDED_PLATFORM option space
> rather than in the CPU choice option, since its only impact seems to be
> on -march, MODULE_PROC_FAMILY and some cpufreq drivers which doesn't
> sound like an extended platform to me but does it appear to be
> deliberate (see 9e111f3e167a "x86: move ELAN to the
> NON_STANDARD_PLATFORM section", that was the old name for
> EXTENDED_PLATFORM).
> 

Historic... we used to have nonstandard A20M# handling on Elan, until it
was discovered that we could make it work without it.

	-hpa


-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply

* Re: [RFC net-next] qlge: use ethtool set_phys_id
From: Ron Mercer @ 2011-04-07 16:49 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, Linux Driver, netdev@vger.kernel.org
In-Reply-To: <20110406164750.11cfeef3@nehalam>

On Wed, Apr 06, 2011 at 04:47:50PM -0700, Stephen Hemminger wrote:
> This is a stab at replacing old ethtool phys_id with set_phys_id
> on the Qlogic 10Gb driver. Compile tested only.
> 
> Not sure if set_led_cfg will flash continuously, or needs
> to be replaced by ETHTOOL_ID_ON/ETHTOOL_ID_OFF
>

Stephen,
We are in the middle of a release cycle on another product.  We will
test this and get back to you next week.

Regards,
Ron Mercer

^ permalink raw reply

* [PATCH] net: atl*: convert to hw_features
From: Michał Mirosław @ 2011-04-07 17:32 UTC (permalink / raw)
  To: netdev; +Cc: Jay Cliburn, Chris Snook, Jie Yang

Things left as they were:
 - atl1: is RX checksum really enabled?
 - atl2: copy-paste from atl1, with-errors-on-modify I presume
 - atl1c: there's a bug: MTU can't be changed if device is not up

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/net/atl1c/atl1c_ethtool.c |    8 --------
 drivers/net/atl1c/atl1c_main.c    |   23 ++++++++++++++---------
 drivers/net/atl1e/atl1e_ethtool.c |    3 ---
 drivers/net/atl1e/atl1e_main.c    |   12 ++++--------
 drivers/net/atlx/atl1.c           |   15 +++++----------
 drivers/net/atlx/atl2.c           |   14 +-------------
 6 files changed, 24 insertions(+), 51 deletions(-)

diff --git a/drivers/net/atl1c/atl1c_ethtool.c b/drivers/net/atl1c/atl1c_ethtool.c
index 7c52150..3af5a33 100644
--- a/drivers/net/atl1c/atl1c_ethtool.c
+++ b/drivers/net/atl1c/atl1c_ethtool.c
@@ -113,11 +113,6 @@ static int atl1c_set_settings(struct net_device *netdev,
 	return 0;
 }
 
-static u32 atl1c_get_tx_csum(struct net_device *netdev)
-{
-	return (netdev->features & NETIF_F_HW_CSUM) != 0;
-}
-
 static u32 atl1c_get_msglevel(struct net_device *netdev)
 {
 	struct atl1c_adapter *adapter = netdev_priv(netdev);
@@ -307,9 +302,6 @@ static const struct ethtool_ops atl1c_ethtool_ops = {
 	.get_link               = ethtool_op_get_link,
 	.get_eeprom_len         = atl1c_get_eeprom_len,
 	.get_eeprom             = atl1c_get_eeprom,
-	.get_tx_csum            = atl1c_get_tx_csum,
-	.get_sg                 = ethtool_op_get_sg,
-	.set_sg                 = ethtool_op_set_sg,
 };
 
 void atl1c_set_ethtool_ops(struct net_device *netdev)
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c
index 7d9d506..894d485 100644
--- a/drivers/net/atl1c/atl1c_main.c
+++ b/drivers/net/atl1c/atl1c_main.c
@@ -484,6 +484,15 @@ static void atl1c_set_rxbufsize(struct atl1c_adapter *adapter,
 	adapter->rx_buffer_len = mtu > AT_RX_BUF_SIZE ?
 		roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE;
 }
+
+static u32 atl1c_fix_features(struct net_device *netdev, u32 features)
+{
+	if (netdev->mtu > MAX_TSO_FRAME_SIZE)
+		features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
+
+	return features;
+}
+
 /*
  * atl1c_change_mtu - Change the Maximum Transfer Unit
  * @netdev: network interface device structure
@@ -510,14 +519,8 @@ static int atl1c_change_mtu(struct net_device *netdev, int new_mtu)
 		netdev->mtu = new_mtu;
 		adapter->hw.max_frame_size = new_mtu;
 		atl1c_set_rxbufsize(adapter, netdev);
-		if (new_mtu > MAX_TSO_FRAME_SIZE) {
-			adapter->netdev->features &= ~NETIF_F_TSO;
-			adapter->netdev->features &= ~NETIF_F_TSO6;
-		} else {
-			adapter->netdev->features |= NETIF_F_TSO;
-			adapter->netdev->features |= NETIF_F_TSO6;
-		}
 		atl1c_down(adapter);
+		netdev_update_features(netdev);
 		atl1c_up(adapter);
 		clear_bit(__AT_RESETTING, &adapter->flags);
 		if (adapter->hw.ctrl_flags & ATL1C_FPGA_VERSION) {
@@ -2585,6 +2588,7 @@ static const struct net_device_ops atl1c_netdev_ops = {
 	.ndo_set_mac_address 	= atl1c_set_mac_addr,
 	.ndo_set_multicast_list = atl1c_set_multi,
 	.ndo_change_mtu		= atl1c_change_mtu,
+	.ndo_fix_features	= atl1c_fix_features,
 	.ndo_do_ioctl		= atl1c_ioctl,
 	.ndo_tx_timeout		= atl1c_tx_timeout,
 	.ndo_get_stats		= atl1c_get_stats,
@@ -2605,12 +2609,13 @@ static int atl1c_init_netdev(struct net_device *netdev, struct pci_dev *pdev)
 	atl1c_set_ethtool_ops(netdev);
 
 	/* TODO: add when ready */
-	netdev->features =	NETIF_F_SG	   |
+	netdev->hw_features =	NETIF_F_SG	   |
 				NETIF_F_HW_CSUM	   |
 				NETIF_F_HW_VLAN_TX |
-				NETIF_F_HW_VLAN_RX |
 				NETIF_F_TSO	   |
 				NETIF_F_TSO6;
+	netdev->features =	netdev->hw_features |
+				NETIF_F_HW_VLAN_RX;
 	return 0;
 }
 
diff --git a/drivers/net/atl1e/atl1e_ethtool.c b/drivers/net/atl1e/atl1e_ethtool.c
index 1209297..4778374 100644
--- a/drivers/net/atl1e/atl1e_ethtool.c
+++ b/drivers/net/atl1e/atl1e_ethtool.c
@@ -382,9 +382,6 @@ static const struct ethtool_ops atl1e_ethtool_ops = {
 	.get_eeprom_len         = atl1e_get_eeprom_len,
 	.get_eeprom             = atl1e_get_eeprom,
 	.set_eeprom             = atl1e_set_eeprom,
-	.set_tx_csum            = ethtool_op_set_tx_hw_csum,
-	.set_sg                 = ethtool_op_set_sg,
-	.set_tso                = ethtool_op_set_tso,
 };
 
 void atl1e_set_ethtool_ops(struct net_device *netdev)
diff --git a/drivers/net/atl1e/atl1e_main.c b/drivers/net/atl1e/atl1e_main.c
index 1ff001a..c05b2e7 100644
--- a/drivers/net/atl1e/atl1e_main.c
+++ b/drivers/net/atl1e/atl1e_main.c
@@ -1927,11 +1927,7 @@ void atl1e_down(struct atl1e_adapter *adapter)
 	 * reschedule our watchdog timer */
 	set_bit(__AT_DOWN, &adapter->flags);
 
-#ifdef NETIF_F_LLTX
 	netif_stop_queue(netdev);
-#else
-	netif_tx_disable(netdev);
-#endif
 
 	/* reset MAC to disable all RX/TX */
 	atl1e_reset_hw(&adapter->hw);
@@ -2223,10 +2219,10 @@ static int atl1e_init_netdev(struct net_device *netdev, struct pci_dev *pdev)
 	netdev->watchdog_timeo = AT_TX_WATCHDOG;
 	atl1e_set_ethtool_ops(netdev);
 
-	netdev->features = NETIF_F_SG | NETIF_F_HW_CSUM |
-		NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
-	netdev->features |= NETIF_F_LLTX;
-	netdev->features |= NETIF_F_TSO;
+	netdev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO |
+		NETIF_F_HW_VLAN_TX;
+	netdev->features = netdev->hw_features |
+		NETIF_F_HW_VLAN_RX | NETIF_F_LLTX;
 
 	return 0;
 }
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index e973d05..98334a1 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -2986,6 +2986,11 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
 	netdev->features |= NETIF_F_SG;
 	netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
 
+	netdev->hw_features = NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_TSO;
+
+	/* is this valid? see atl1_setup_mac_ctrl() */
+	netdev->features |= NETIF_F_RXCSUM;
+
 	/*
 	 * patch for some L1 of old version,
 	 * the final version of L1 may not need these
@@ -3595,12 +3600,6 @@ static int atl1_set_pauseparam(struct net_device *netdev,
 	return 0;
 }
 
-/* FIXME: is this right? -- CHS */
-static u32 atl1_get_rx_csum(struct net_device *netdev)
-{
-	return 1;
-}
-
 static void atl1_get_strings(struct net_device *netdev, u32 stringset,
 	u8 *data)
 {
@@ -3668,13 +3667,9 @@ static const struct ethtool_ops atl1_ethtool_ops = {
 	.set_ringparam		= atl1_set_ringparam,
 	.get_pauseparam		= atl1_get_pauseparam,
 	.set_pauseparam		= atl1_set_pauseparam,
-	.get_rx_csum		= atl1_get_rx_csum,
-	.set_tx_csum		= ethtool_op_set_tx_hw_csum,
 	.get_link		= ethtool_op_get_link,
-	.set_sg			= ethtool_op_set_sg,
 	.get_strings		= atl1_get_strings,
 	.nway_reset		= atl1_nway_reset,
 	.get_ethtool_stats	= atl1_get_ethtool_stats,
 	.get_sset_count		= atl1_get_sset_count,
-	.set_tso		= ethtool_op_set_tso,
 };
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c
index 937ef1a..02761dd 100644
--- a/drivers/net/atlx/atl2.c
+++ b/drivers/net/atlx/atl2.c
@@ -1411,9 +1411,8 @@ static int __devinit atl2_probe(struct pci_dev *pdev,
 
 	err = -EIO;
 
-#ifdef NETIF_F_HW_VLAN_TX
+	netdev->hw_features = NETIF_F_SG;
 	netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
-#endif
 
 	/* Init PHY as early as possible due to power saving issue  */
 	atl2_phy_init(&adapter->hw);
@@ -1840,11 +1839,6 @@ static int atl2_set_settings(struct net_device *netdev,
 	return 0;
 }
 
-static u32 atl2_get_tx_csum(struct net_device *netdev)
-{
-	return (netdev->features & NETIF_F_HW_CSUM) != 0;
-}
-
 static u32 atl2_get_msglevel(struct net_device *netdev)
 {
 	return 0;
@@ -2112,12 +2106,6 @@ static const struct ethtool_ops atl2_ethtool_ops = {
 	.get_eeprom_len		= atl2_get_eeprom_len,
 	.get_eeprom		= atl2_get_eeprom,
 	.set_eeprom		= atl2_set_eeprom,
-	.get_tx_csum		= atl2_get_tx_csum,
-	.get_sg			= ethtool_op_get_sg,
-	.set_sg			= ethtool_op_set_sg,
-#ifdef NETIF_F_TSO
-	.get_tso		= ethtool_op_get_tso,
-#endif
 };
 
 static void atl2_set_ethtool_ops(struct net_device *netdev)
-- 
1.7.2.5


^ permalink raw reply related

* Re: [PATCH 07/19] timberdale: mfd_cell is now implicitly available to drivers
From: Grant Likely @ 2011-04-07 18:06 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: Felipe Balbi, Greg KH, Andres Salomon,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Mark Brown,
	khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	Peter Korsgaard, Mauro Carvalho Chehab, David Brownell,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-media-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	Mocean Laboratories
In-Reply-To: <20110407150322.GB3923@sortiz-mobl>

On Thu, Apr 07, 2011 at 05:03:23PM +0200, Samuel Ortiz wrote:
> On Thu, Apr 07, 2011 at 07:35:15AM -0700, Grant Likely wrote:
> > > Below is a patch for the Xilinx SPI example. Although this would fix the
> > > issue, we'd still have to do that on device per device basis. I had a similar
> > > solution where MFD drivers would set a flag for sub drivers that don't need
> > > any of the MFD bits. In that case the MFD core code would just forward the
> > > platform data, instead of embedding it through an MFD cell.
> > 
> > platform_data is already a fiddly bit where you don't know what
> > structure type platform_data points at; it is implicitly known and
> > easy to get wrong.  This solution makes me *very* nervous
> > because it would become even easier to get a mismatch on the
> > platform_data pointer type.
> How would that be more error prone than say a board file instantiating a
> platform device after having set the platform_data pointer to point to an
> implicitely know structure reference ?

Yes, platform_data is already troublesome, but at least current
convention is a 1:1 relationship between driver and platform_data
type.  I still hate it and want something better, but it is what we
have.  The problem with what having a different platform_data pointer
depending on the instantiation means that it adds yet another level of
decision that needs to be made and is very easy to get wrong.

So, yes, platform_data is bad.  I don't want to see it get any worse.

> 
> Cheers,
> Samuel.
> 
> P.S.: Would you be ok with something like the patch below ?

Not really because it requires the driver to make the correct decision
about the platform_data type depending on the driver name.  It is easy
to get wrong and the compiler cannot help you catch it.

I've talked with Greg, and adding the mfd_cell pointer to
platform_device will be okay in the short term.  In the long term I'm
looking at creating a better way of attaching type-safe data to
devices that will pretty much eliminate this issue.

> 
> > > ---
> > >  drivers/mfd/timberdale.c |    8 ++++----
> > >  drivers/spi/xilinx_spi.c |   19 ++++++++++++++++++-
> > >  include/linux/mfd/core.h |    3 +++
> > >  3 files changed, 25 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/drivers/mfd/timberdale.c b/drivers/mfd/timberdale.c
> > > index 94c6c8a..c9220ce 100644
> > > --- a/drivers/mfd/timberdale.c
> > > +++ b/drivers/mfd/timberdale.c
> > > @@ -416,7 +416,7 @@ static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg0[] = {
> > >  		.mfd_data = &timberdale_radio_platform_data,
> > >  	},
> > >  	{
> > > -		.name = "xilinx_spi",
> > > +		.name = "mfd_xilinx_spi",
> > >  		.num_resources = ARRAY_SIZE(timberdale_spi_resources),
> > >  		.resources = timberdale_spi_resources,
> > >  		.mfd_data = &timberdale_xspi_platform_data,
> > > @@ -476,7 +476,7 @@ static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg1[] = {
> > >  		.mfd_data = &timberdale_radio_platform_data,
> > >  	},
> > >  	{
> > > -		.name = "xilinx_spi",
> > > +		.name = "mfd_xilinx_spi",
> > >  		.num_resources = ARRAY_SIZE(timberdale_spi_resources),
> > >  		.resources = timberdale_spi_resources,
> > >  		.mfd_data = &timberdale_xspi_platform_data,
> > > @@ -526,7 +526,7 @@ static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg2[] = {
> > >  		.mfd_data = &timberdale_radio_platform_data,
> > >  	},
> > >  	{
> > > -		.name = "xilinx_spi",
> > > +		.name = "mfd_xilinx_spi",
> > >  		.num_resources = ARRAY_SIZE(timberdale_spi_resources),
> > >  		.resources = timberdale_spi_resources,
> > >  		.mfd_data = &timberdale_xspi_platform_data,
> > > @@ -570,7 +570,7 @@ static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg3[] = {
> > >  		.mfd_data = &timberdale_radio_platform_data,
> > >  	},
> > >  	{
> > > -		.name = "xilinx_spi",
> > > +		.name = "mfd_xilinx_spi",
> > >  		.num_resources = ARRAY_SIZE(timberdale_spi_resources),
> > >  		.resources = timberdale_spi_resources,
> > >  		.mfd_data = &timberdale_xspi_platform_data,
> > > diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
> > > index c69c6f2..3287b84 100644
> > > --- a/drivers/spi/xilinx_spi.c
> > > +++ b/drivers/spi/xilinx_spi.c
> > > @@ -471,7 +471,11 @@ static int __devinit xilinx_spi_probe(struct platform_device *dev)
> > >  	struct spi_master *master;
> > >  	u8 i;
> > >  
> > > -	pdata = mfd_get_data(dev);
> > > +	if (platform_get_device_id(dev) &&
> > > +	    platform_get_device_id(dev)->driver_data & MFD_PLATFORM_DEVICE)
> > > +		pdata = mfd_get_data(dev);
> > > +	else
> > > +		pdata = dev->dev.platform_data;
> > >  	if (pdata) {
> > >  		num_cs = pdata->num_chipselect;
> > >  		little_endian = pdata->little_endian;
> > > @@ -530,6 +534,18 @@ static int __devexit xilinx_spi_remove(struct platform_device *dev)
> > >  /* work with hotplug and coldplug */
> > >  MODULE_ALIAS("platform:" XILINX_SPI_NAME);
> > >  
> > > +static const struct platform_device_id xilinx_spi_id_table[] = {
> > > +	{
> > > +		.name	= XILINX_SPI_NAME,
> > > +	},
> > > +	{
> > > +		.name	= "mfd_xilinx_spi",
> > > +		.driver_data = MFD_PLATFORM_DEVICE,
> > > +	},
> > > +	{  },	/* Terminating Entry */
> > > +};
> > > +MODULE_DEVICE_TABLE(platform, xilinx_spi_id_table);
> > > +
> > >  static struct platform_driver xilinx_spi_driver = {
> > >  	.probe = xilinx_spi_probe,
> > >  	.remove = __devexit_p(xilinx_spi_remove),
> > > @@ -538,6 +554,7 @@ static struct platform_driver xilinx_spi_driver = {
> > >  		.owner = THIS_MODULE,
> > >  		.of_match_table = xilinx_spi_of_match,
> > >  	},
> > > +	.id_table	= xilinx_spi_id_table,
> > >  };
> > >  
> > >  static int __init xilinx_spi_pltfm_init(void)
> > > diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
> > > index ad1b19a..13f31f4 100644
> > > --- a/include/linux/mfd/core.h
> > > +++ b/include/linux/mfd/core.h
> > > @@ -89,6 +89,9 @@ static inline const struct mfd_cell *mfd_get_cell(struct platform_device *pdev)
> > >  	return pdev->dev.platform_data;
> > >  }
> > >  
> > > +/* */
> > > +#define MFD_PLATFORM_DEVICE BIT(0)
> > > +
> > >  /*
> > >   * Given a platform device that's been created by mfd_add_devices(), fetch
> > >   * the .mfd_data entry from the mfd_cell that created it.
> > > 
> > > 
> > > -- 
> > > Intel Open Source Technology Centre
> > > http://oss.intel.com/
> 
> -- 
> Intel Open Source Technology Centre
> http://oss.intel.com/

^ permalink raw reply

* Re: [PATCH] xen: drop anti-dependency on X86_VISWS
From: Jeremy Fitzhardinge @ 2011-04-07 18:07 UTC (permalink / raw)
  To: Ian Campbell
  Cc: David Miller, randy.dunlap@oracle.com, Jeremy Fitzhardinge,
	eric.dumazet@gmail.com, konrad.wilk@oracle.com,
	netdev@vger.kernel.org, mirq-linux@rere.qmqm.pl,
	xen-devel@lists.xensource.com, hpa@zytor.com,
	linux-visws-devel@lists.sf.net, tglx@linutronix.de,
	virtualization@lists.linux-foundation.org, pazke@donpac.ru,
	mingo@redhat.com
In-Reply-To: <1302159483.31620.36.camel@localhost.localdomain>

On 04/06/2011 11:58 PM, Ian Campbell wrote:
> On Wed, 2011-04-06 at 22:45 +0100, David Miller wrote:
>> From: Ian Campbell <Ian.Campbell@eu.citrix.com>
>> Date: Mon, 4 Apr 2011 10:55:55 +0100
>>
>>> You mean the "!X86_VISWS" I presume? It doesn't make sense to me either.
>> No, I think 32-bit x86 allmodconfig elides XEN because of it's X86_TSC dependency.
> TSC is a real dependency of the Xen interfaces.

Not really.  The TSC register is a requirement, but that's going to be
present on any CPU which can boot Xen.  We don't need any of the
kernel's TSC machinery though.

    J

^ permalink raw reply

* [PATCH] iwl4965: drop a lone pr_err()
From: Paul Bolle @ 2011-04-07 18:40 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless, netdev, linux-kernel

iwl4965_rate_control_register() prints a message at KERN_ERR level. It
looks like it's just a debugging message, so pr_err() seems to be
overdone. But none of the similar functions in drivers/net/wireless
print a message, so let's just drop it.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
---
 drivers/net/wireless/iwlegacy/iwl-4965-rs.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
index 31ac672..8950939 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
@@ -2860,7 +2860,6 @@ static struct rate_control_ops rs_4965_ops = {
 
 int iwl4965_rate_control_register(void)
 {
-	pr_err("Registering 4965 rate control operations\n");
 	return ieee80211_rate_control_register(&rs_4965_ops);
 }
 
-- 
1.7.4

^ permalink raw reply related

* RE: [PATCH net-next 2/5] be2net: use common method to check for sriov function type
From: Ajit.Khaparde @ 2011-04-07 19:25 UTC (permalink / raw)
  To: bhutchings; +Cc: netdev
In-Reply-To: <1302183459.2878.7.camel@bwh-desktop>

________________________________________
From: Ben Hutchings [bhutchings@solarflare.com]
Sent: Thursday, April 07, 2011 8:37 AM
To: Khaparde, Ajit
Cc: netdev@vger.kernel.org
Subject: RE: [PATCH net-next 2/5] be2net: use common method to check for sriov function type

On Thu, 2011-04-07 at 05:34 -0700, Ajit.Khaparde@Emulex.Com wrote:
> ________________________________________
> > From: Ben Hutchings [bhutchings@solarflare.com]
> > Sent: Thursday, April 07, 2011 3:14 AM
> > To: Khaparde, Ajit
> > Cc: netdev@vger.kernel.org
> > Subject: Re: [PATCH net-next 2/5] be2net: use common method to check for sriov function type
>
> > On Wed, 2011-04-06 at 23:08 -0500, Ajit Khaparde wrote:
> >> Lancer and BE can both use SLI_INTF_REG to check a VF or a PF.
> > [...]
>
> > This seems pretty unreliable (both in the previous and the current
> > version).  You cannot rely on the whole of PCI config space being mapped
> > to a VM guest.  KVM certainly didn't do this when I used PCI pass-
> > through.
>
> That's interesting. I have been using the new method for a while now.
> And the older one has worked pretty well for a long time.
> Can you give some details about the adapter used?
> Let's start with the firmware version, lspci output.

> I've tried this with PFs on Solarflare adapters.

> The capability list is significantly changed.  The hex dump seems to
> show that config space beyond about offset 0x60 is still passed through
> unchanged, but I wouldn't want to rely on that remaining true.

Oh ok. I see some difference in the lspci output on my setup too.
And when I load my driver, the PF is identified properly when I assign it as a passthrough device in a VM.
It does not have the same capability list as in the KVM Hypervisor though.

-Ajit

> 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

* Re: [PATCH] net: enic: convert to hw_features
From: roprabhu @ 2011-04-07 19:52 UTC (permalink / raw)
  To: Michał Mirosław, netdev
  Cc: Christian Benvenuti, Vasanthy Kolluri, David Wang
In-Reply-To: <20110407124348.BB13A138ED@rere.qmqm.pl>

Thanks michal.

One small comment below,

On 4/7/11 5:43 AM, "Michał Mirosław" <mirq-linux@rere.qmqm.pl> wrote:

> As the driver uses GRO and not LRO, LRO settings are ignored anyway
> and are removed here to avoid confusion.
> 
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
>  drivers/net/enic/enic.h      |    1 -
>  drivers/net/enic/enic_main.c |   74 ++++-------------------------------------
>  drivers/net/enic/enic_res.c  |    4 +-
>  3 files changed, 10 insertions(+), 69 deletions(-)
> 
> diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
> index 178b94d..38b351c 100644
> --- a/drivers/net/enic/enic.h
> +++ b/drivers/net/enic/enic.h
> @@ -84,7 +84,6 @@ struct enic {
> unsigned int flags;
> unsigned int mc_count;
> unsigned int uc_count;
> - int csum_rx_enabled;
> u32 port_mtu;
> u32 rx_coalesce_usecs;
> u32 tx_coalesce_usecs;
> diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
> index 9a3a027..b224551 100644
> --- a/drivers/net/enic/enic_main.c
> +++ b/drivers/net/enic/enic_main.c
> @@ -251,56 +251,6 @@ static void enic_get_ethtool_stats(struct net_device
> *netdev,
> *(data++) = ((u64 *)&vstats->rx)[enic_rx_stats[i].offset];
>  }
>  
> -static u32 enic_get_rx_csum(struct net_device *netdev)
> -{
> - struct enic *enic = netdev_priv(netdev);
> - return enic->csum_rx_enabled;
> -}
> -
> -static int enic_set_rx_csum(struct net_device *netdev, u32 data)
> -{
> - struct enic *enic = netdev_priv(netdev);
> -
> - if (data && !ENIC_SETTING(enic, RXCSUM))
> -  return -EINVAL;
> -
> - enic->csum_rx_enabled = !!data;
> -
> - return 0;
> -}
> -
> -static int enic_set_tx_csum(struct net_device *netdev, u32 data)
> -{
> - struct enic *enic = netdev_priv(netdev);
> -
> - if (data && !ENIC_SETTING(enic, TXCSUM))
> -  return -EINVAL;
> -
> - if (data)
> -  netdev->features |= NETIF_F_HW_CSUM;
> - else
> -  netdev->features &= ~NETIF_F_HW_CSUM;
> -
> - return 0;
> -}
> -
> -static int enic_set_tso(struct net_device *netdev, u32 data)
> -{
> - struct enic *enic = netdev_priv(netdev);
> -
> - if (data && !ENIC_SETTING(enic, TSO))
> -  return -EINVAL;
> -
> - if (data)
> -  netdev->features |=
> -   NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN;
> - else
> -  netdev->features &=
> -   ~(NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN);
> -
> - return 0;
> -}
> -
>  static u32 enic_get_msglevel(struct net_device *netdev)
>  {
> struct enic *enic = netdev_priv(netdev);
> @@ -388,17 +338,8 @@ static const struct ethtool_ops enic_ethtool_ops = {
> .get_strings = enic_get_strings,
> .get_sset_count = enic_get_sset_count,
> .get_ethtool_stats = enic_get_ethtool_stats,
> - .get_rx_csum = enic_get_rx_csum,
> - .set_rx_csum = enic_set_rx_csum,
> - .get_tx_csum = ethtool_op_get_tx_csum,
> - .set_tx_csum = enic_set_tx_csum,
> - .get_sg = ethtool_op_get_sg,
> - .set_sg = ethtool_op_set_sg,
> - .get_tso = ethtool_op_get_tso,
> - .set_tso = enic_set_tso,
> .get_coalesce = enic_get_coalesce,
> .set_coalesce = enic_set_coalesce,
> - .get_flags = ethtool_op_get_flags,
>  };
>  
>  static void enic_free_wq_buf(struct vnic_wq *wq, struct vnic_wq_buf *buf)
> @@ -1309,7 +1250,7 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq,
> skb_put(skb, bytes_written);
> skb->protocol = eth_type_trans(skb, netdev);
>  
> -  if (enic->csum_rx_enabled && !csum_not_calc) {
> +  if ((netdev->features & NETIF_F_RXCSUM) && !csum_not_calc) {
> skb->csum = htons(checksum);
> skb->ip_summed = CHECKSUM_COMPLETE;
> }
> @@ -2438,17 +2379,18 @@ static int __devinit enic_probe(struct pci_dev *pdev,
> dev_info(dev, "loopback tag=0x%04x\n", enic->loop_tag);
> }
> if (ENIC_SETTING(enic, TXCSUM))
> -  netdev->features |= NETIF_F_SG | NETIF_F_HW_CSUM;
> +  netdev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM;
> if (ENIC_SETTING(enic, TSO))
> -  netdev->features |= NETIF_F_TSO |
> +  netdev->hw_features |= NETIF_F_TSO |
> NETIF_F_TSO6 | NETIF_F_TSO_ECN;
> - if (ENIC_SETTING(enic, LRO))
> -  netdev->features |= NETIF_F_GRO;
> + if (ENIC_SETTING(enic, RXCSUM))
> +  netdev->hw_features |= NETIF_F_RXCSUM;
> +
> + netdev->features |= netdev->hw_features;
> +
> if (using_dac)
> netdev->features |= NETIF_F_HIGHDMA;
>  
> - enic->csum_rx_enabled = ENIC_SETTING(enic, RXCSUM);
> -
> err = register_netdev(netdev);
> if (err) {
> dev_err(dev, "Cannot register net device, aborting\n");
> diff --git a/drivers/net/enic/enic_res.c b/drivers/net/enic/enic_res.c
> index f111a37..6e5c635 100644
> --- a/drivers/net/enic/enic_res.c
> +++ b/drivers/net/enic/enic_res.c
> @@ -98,9 +98,9 @@ int enic_get_vnic_config(struct enic *enic)
> "vNIC MAC addr %pM wq/rq %d/%d mtu %d\n",
> enic->mac_addr, c->wq_desc_count, c->rq_desc_count, c->mtu);
> dev_info(enic_get_dev(enic), "vNIC csum tx/rx %d/%d "
> -  "tso/lro %d/%d intr timer %d usec rss %d\n",
> +  "tso %d intr timer %d usec rss %d\n",
> ENIC_SETTING(enic, TXCSUM), ENIC_SETTING(enic, RXCSUM),
> -  ENIC_SETTING(enic, TSO), ENIC_SETTING(enic, LRO),
> +  ENIC_SETTING(enic, TSO),
> c->intr_timer_usec, ENIC_SETTING(enic, RSS));
>  
You are right about the driver using GRO and not LRO by default. But the
config entry from where enic gets this setting is still called LRO for
reasons out of the scope of the driver. Yes, I see that it can lead to
confusion. So, we will need to retain the ENIC_SETTING(enic, LRO) but fix
the name of that setting.  Thanks for pointing this out. We will fix this
and any other changes if required and resubmit.


> return 0;


^ permalink raw reply

* RE: [PATCH net-next 1/5] be2net: add rxhash support
From: Ajit.Khaparde @ 2011-04-07 19:57 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev
In-Reply-To: <1302152725.2701.60.camel@edumazet-laptop>

________________________________________
From: Eric Dumazet [eric.dumazet@gmail.com]
Sent: Thursday, April 07, 2011 12:05 AM
To: Khaparde, Ajit
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next 1/5] be2net: add rxhash support

> Le mercredi 06 avril 2011 à 23:07 -0500, Ajit Khaparde a écrit :
>> Add rxhash support,
>> Based on initial work by Eric Dumazet.
>>
>> Cc: Eric Dumazet <eric.dumazet@gmail.com>
>> Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
>> ---
>>  drivers/net/benet/be.h         |    5 +++++
>>  drivers/net/benet/be_ethtool.c |   13 +++++++++++++
>>  drivers/net/benet/be_main.c    |   17 ++++++++++++-----
>>  3 files changed, 30 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
>> index 0899d91..8941b98 100644
>> --- a/drivers/net/benet/be.h
>> +++ b/drivers/net/benet/be.h
>> @@ -485,6 +485,11 @@ static inline void be_vf_eth_addr_generate(struct be_adapter *adapter, u8 *mac)
>>       memcpy(mac, adapter->netdev->dev_addr, 3);
>>  }
>>
> +static inline bool be_multi_rxq(struct be_adapter *adapter)

> static inline bool be_multi_rxq(const struct be_adapter *adapter)


>> +{
>> +     return (adapter->num_rx_qs > 1);

>        return adapter->num_rx_qs > 1;

>> +}
>> +

> Other parts seems fine, thanks !

Thanks Eric.

Dave, do you want me to respin patch or you can accomodate Eric's suggestion?

Thanks
-Ajit

^ permalink raw reply

* Re: [RFC 1/6]Fix typo "recieve" in various parts of the kernel.
From: Uwe Kleine-König @ 2011-04-07 20:05 UTC (permalink / raw)
  To: Justin P. Mattock
  Cc: trivial, linux-scsi, netdev, linux-usb, linux-kernel,
	socketcan-core, linux-mtd, linux-input, linux-arm-kernel
In-Reply-To: <1302192567-842-1-git-send-email-justinmattock@gmail.com>

On Thu, Apr 07, 2011 at 09:09:22AM -0700, Justin P. Mattock wrote:
> The patch below fixes some typos "recieve" in various parts of the kernel.
> Note: these below are in actual code rather than comments(excpet for r852.c which
s/excpet/except/

> has a code fix, and comment).
> compile tested as best as I can...
I'm not a native speaker, but "as good as" sounds better in my ears.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH net-next 1/5] be2net: add rxhash support
From: David Miller @ 2011-04-07 20:11 UTC (permalink / raw)
  To: Ajit.Khaparde; +Cc: eric.dumazet, netdev
In-Reply-To: <49395329523DD64492581B505F80C86D5A5BCD3949@EXMAIL.ad.emulex.com>

From: <Ajit.Khaparde@Emulex.Com>
Date: Thu, 7 Apr 2011 12:57:27 -0700

> Dave, do you want me to respin patch or you can accomodate Eric's suggestion?

It's simple enough, I'll take care of it.

^ permalink raw reply

* Re: [PATCH] net: tg3: convert to hw_features
From: Matt Carlson @ 2011-04-07 20:23 UTC (permalink / raw)
  To: Micha?? Miros??aw; +Cc: netdev@vger.kernel.org, Matthew Carlson, Michael Chan
In-Reply-To: <20110407133507.13FDA13909@rere.qmqm.pl>

Nice cleanup.  I visually studied it for a bit and didn't find anything
wrong.

Acked-by: Matt Carlson <mcarlson@broadcom.com>

On Thu, Apr 07, 2011 at 06:35:07AM -0700, Micha?? Miros??aw wrote:
> Cleanup hint: Some features are calculated in tg3_get_invariants() and
> the rest in its caller --- tg3_init_one(). This is not changed here.
> 
> Signed-off-by: Micha?? Miros??aw <mirq-linux@rere.qmqm.pl>
> ---
> [build tested only]
> 
>  drivers/net/tg3.c |  135 +++++++++++++----------------------------------------
>  drivers/net/tg3.h |    2 -
>  2 files changed, 32 insertions(+), 105 deletions(-)
> 
> diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
> index d37ae87..38962af 100644
> --- a/drivers/net/tg3.c
> +++ b/drivers/net/tg3.c
> @@ -4816,7 +4816,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
>  			skb = copy_skb;
>  		}
>  
> -		if ((tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) &&
> +		if ((tp->dev->features & NETIF_F_RXCSUM) &&
>  		    (desc->type_flags & RXD_FLAG_TCPUDP_CSUM) &&
>  		    (((desc->ip_tcp_csum & RXD_TCPCSUM_MASK)
>  		      >> RXD_TCPCSUM_SHIFT) == 0xffff))
> @@ -6127,6 +6127,16 @@ dma_error:
>  	return NETDEV_TX_OK;
>  }
>  
> +static u32 tg3_fix_features(struct net_device *dev, u32 features)
> +{
> +	struct tg3 *tp = netdev_priv(dev);
> +
> +	if (dev->mtu > ETH_DATA_LEN && (tp->tg3_flags2 & TG3_FLG2_5780_CLASS))
> +		features &= ~NETIF_F_ALL_TSO;
> +
> +	return features;
> +}
> +
>  static inline void tg3_set_mtu(struct net_device *dev, struct tg3 *tp,
>  			       int new_mtu)
>  {
> @@ -6134,14 +6144,16 @@ static inline void tg3_set_mtu(struct net_device *dev, struct tg3 *tp,
>  
>  	if (new_mtu > ETH_DATA_LEN) {
>  		if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) {
> +			netdev_update_features(dev);
>  			tp->tg3_flags2 &= ~TG3_FLG2_TSO_CAPABLE;
> -			ethtool_op_set_tso(dev, 0);
>  		} else {
>  			tp->tg3_flags |= TG3_FLAG_JUMBO_RING_ENABLE;
>  		}
>  	} else {
> -		if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)
> +		if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) {
>  			tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE;
> +			netdev_update_features(dev);
> +		}
>  		tp->tg3_flags &= ~TG3_FLAG_JUMBO_RING_ENABLE;
>  	}
>  }
> @@ -10021,33 +10033,6 @@ static void tg3_set_msglevel(struct net_device *dev, u32 value)
>  	tp->msg_enable = value;
>  }
>  
> -static int tg3_set_tso(struct net_device *dev, u32 value)
> -{
> -	struct tg3 *tp = netdev_priv(dev);
> -
> -	if (!(tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE)) {
> -		if (value)
> -			return -EINVAL;
> -		return 0;
> -	}
> -	if ((dev->features & NETIF_F_IPV6_CSUM) &&
> -	    ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_2) ||
> -	     (tp->tg3_flags2 & TG3_FLG2_HW_TSO_3))) {
> -		if (value) {
> -			dev->features |= NETIF_F_TSO6;
> -			if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_3) ||
> -			    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
> -			    (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 &&
> -			     GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX) ||
> -			    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
> -			    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780)
> -				dev->features |= NETIF_F_TSO_ECN;
> -		} else
> -			dev->features &= ~(NETIF_F_TSO6 | NETIF_F_TSO_ECN);
> -	}
> -	return ethtool_op_set_tso(dev, value);
> -}
> -
>  static int tg3_nway_reset(struct net_device *dev)
>  {
>  	struct tg3 *tp = netdev_priv(dev);
> @@ -10270,50 +10255,6 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam
>  	return err;
>  }
>  
> -static u32 tg3_get_rx_csum(struct net_device *dev)
> -{
> -	struct tg3 *tp = netdev_priv(dev);
> -	return (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0;
> -}
> -
> -static int tg3_set_rx_csum(struct net_device *dev, u32 data)
> -{
> -	struct tg3 *tp = netdev_priv(dev);
> -
> -	if (tp->tg3_flags & TG3_FLAG_BROKEN_CHECKSUMS) {
> -		if (data != 0)
> -			return -EINVAL;
> -		return 0;
> -	}
> -
> -	spin_lock_bh(&tp->lock);
> -	if (data)
> -		tp->tg3_flags |= TG3_FLAG_RX_CHECKSUMS;
> -	else
> -		tp->tg3_flags &= ~TG3_FLAG_RX_CHECKSUMS;
> -	spin_unlock_bh(&tp->lock);
> -
> -	return 0;
> -}
> -
> -static int tg3_set_tx_csum(struct net_device *dev, u32 data)
> -{
> -	struct tg3 *tp = netdev_priv(dev);
> -
> -	if (tp->tg3_flags & TG3_FLAG_BROKEN_CHECKSUMS) {
> -		if (data != 0)
> -			return -EINVAL;
> -		return 0;
> -	}
> -
> -	if (tp->tg3_flags3 & TG3_FLG3_5755_PLUS)
> -		ethtool_op_set_tx_ipv6_csum(dev, data);
> -	else
> -		ethtool_op_set_tx_csum(dev, data);
> -
> -	return 0;
> -}
> -
>  static int tg3_get_sset_count(struct net_device *dev, int sset)
>  {
>  	switch (sset) {
> @@ -11390,11 +11331,6 @@ static const struct ethtool_ops tg3_ethtool_ops = {
>  	.set_ringparam		= tg3_set_ringparam,
>  	.get_pauseparam		= tg3_get_pauseparam,
>  	.set_pauseparam		= tg3_set_pauseparam,
> -	.get_rx_csum		= tg3_get_rx_csum,
> -	.set_rx_csum		= tg3_set_rx_csum,
> -	.set_tx_csum		= tg3_set_tx_csum,
> -	.set_sg			= ethtool_op_set_sg,
> -	.set_tso		= tg3_set_tso,
>  	.self_test		= tg3_self_test,
>  	.get_strings		= tg3_get_strings,
>  	.set_phys_id		= tg3_set_phys_id,
> @@ -13262,11 +13198,6 @@ done:
>  
>  static struct pci_dev * __devinit tg3_find_peer(struct tg3 *);
>  
> -static inline void vlan_features_add(struct net_device *dev, unsigned long flags)
> -{
> -	dev->vlan_features |= flags;
> -}
> -
>  static inline u32 tg3_rx_ret_ring_size(struct tg3 *tp)
>  {
>  	if (tp->tg3_flags3 & TG3_FLG3_LRG_PROD_RING_CAP)
> @@ -13513,16 +13444,14 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
>  	/* 5700 B0 chips do not support checksumming correctly due
>  	 * to hardware bugs.
>  	 */
> -	if (tp->pci_chip_rev_id == CHIPREV_ID_5700_B0)
> -		tp->tg3_flags |= TG3_FLAG_BROKEN_CHECKSUMS;
> -	else {
> -		unsigned long features = NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_GRO;
> +	if (tp->pci_chip_rev_id != CHIPREV_ID_5700_B0) {
> +		u32 features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
>  
> -		tp->tg3_flags |= TG3_FLAG_RX_CHECKSUMS;
>  		if (tp->tg3_flags3 & TG3_FLG3_5755_PLUS)
>  			features |= NETIF_F_IPV6_CSUM;
>  		tp->dev->features |= features;
> -		vlan_features_add(tp->dev, features);
> +		tp->dev->hw_features |= features;
> +		tp->dev->vlan_features |= features;
>  	}
>  
>  	/* Determine TSO capabilities */
> @@ -14794,6 +14723,7 @@ static const struct net_device_ops tg3_netdev_ops = {
>  	.ndo_do_ioctl		= tg3_ioctl,
>  	.ndo_tx_timeout		= tg3_tx_timeout,
>  	.ndo_change_mtu		= tg3_change_mtu,
> +	.ndo_fix_features	= tg3_fix_features,
>  #ifdef CONFIG_NET_POLL_CONTROLLER
>  	.ndo_poll_controller	= tg3_poll_controller,
>  #endif
> @@ -14824,6 +14754,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
>  	u32 sndmbx, rcvmbx, intmbx;
>  	char str[40];
>  	u64 dma_mask, persist_dma_mask;
> +	u32 hw_features = 0;
>  
>  	printk_once(KERN_INFO "%s\n", version);
>  
> @@ -14984,27 +14915,25 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
>  	 * is off by default, but can be enabled using ethtool.
>  	 */
>  	if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO) &&
> -	    (dev->features & NETIF_F_IP_CSUM)) {
> -		dev->features |= NETIF_F_TSO;
> -		vlan_features_add(dev, NETIF_F_TSO);
> -	}
> +	    (dev->features & NETIF_F_IP_CSUM))
> +		hw_features |= NETIF_F_TSO;
>  	if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_2) ||
>  	    (tp->tg3_flags2 & TG3_FLG2_HW_TSO_3)) {
> -		if (dev->features & NETIF_F_IPV6_CSUM) {
> -			dev->features |= NETIF_F_TSO6;
> -			vlan_features_add(dev, NETIF_F_TSO6);
> -		}
> +		if (dev->features & NETIF_F_IPV6_CSUM)
> +			hw_features |= NETIF_F_TSO6;
>  		if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_3) ||
>  		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
>  		    (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 &&
>  		     GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX) ||
>  			GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
> -		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) {
> -			dev->features |= NETIF_F_TSO_ECN;
> -			vlan_features_add(dev, NETIF_F_TSO_ECN);
> -		}
> +		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780)
> +			hw_features |= NETIF_F_TSO_ECN;
>  	}
>  
> +	dev->hw_features |= hw_features;
> +	dev->features |= hw_features;
> +	dev->vlan_features |= hw_features;
> +
>  	if (tp->pci_chip_rev_id == CHIPREV_ID_5705_A1 &&
>  	    !(tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) &&
>  	    !(tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH)) {
> @@ -15133,7 +15062,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
>  	}
>  
>  	netdev_info(dev, "RXcsums[%d] LinkChgREG[%d] MIirq[%d] ASF[%d] TSOcap[%d]\n",
> -		    (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0,
> +		    (dev->features & NETIF_F_RXCSUM) != 0,
>  		    (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) != 0,
>  		    (tp->phy_flags & TG3_PHYFLG_USE_MI_INTERRUPT) != 0,
>  		    (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0,
> diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
> index e7880d5..73dda27 100644
> --- a/drivers/net/tg3.h
> +++ b/drivers/net/tg3.h
> @@ -2883,7 +2883,6 @@ struct tg3 {
>  	u32				tg3_flags;
>  #define TG3_FLAG_TAGGED_STATUS		0x00000001
>  #define TG3_FLAG_TXD_MBOX_HWBUG		0x00000002
> -#define TG3_FLAG_RX_CHECKSUMS		0x00000004
>  #define TG3_FLAG_USE_LINKCHG_REG	0x00000008
>  #define TG3_FLAG_ENABLE_ASF		0x00000020
>  #define TG3_FLAG_ASPM_WORKAROUND	0x00000040
> @@ -2909,7 +2908,6 @@ struct tg3 {
>  #define TG3_FLAG_PAUSE_AUTONEG		0x02000000
>  #define TG3_FLAG_CPMU_PRESENT		0x04000000
>  #define TG3_FLAG_40BIT_DMA_BUG		0x08000000
> -#define TG3_FLAG_BROKEN_CHECKSUMS	0x10000000
>  #define TG3_FLAG_JUMBO_CAPABLE		0x20000000
>  #define TG3_FLAG_CHIP_RESETTING		0x40000000
>  #define TG3_FLAG_INIT_COMPLETE		0x80000000
> -- 
> 1.7.2.5
> 
> 


^ permalink raw reply

* Re: ipv6: Add support for RTA_PREFSRC
From: David Miller @ 2011-04-07 20:27 UTC (permalink / raw)
  To: dwalter; +Cc: netdev
In-Reply-To: <1302168237.31789.245.camel@localhost>

From: Daniel Walter <dwalter@barracuda.com>
Date: Thu, 7 Apr 2011 11:23:57 +0200

> On Wed, 2011-04-06 at 18:37 -0700, David Miller wrote:
>> From: Daniel Walter <dwalter@barracuda.com>
>> Date: Mon, 4 Apr 2011 09:56:44 +0200
>> 
>> > On Fri, 2011-04-01 at 20:46 -0700, David Miller wrote:
>> >> You can't change the layout of "struct in6_rtmsg", as that structure
>> >> is explicitly exported to user space and changing it will break every
>> >> application out there.
>> > 
>> > Hi,
>> > 
>> > I've kicked support for setting the preferred source via ioctl,
>> > to keep "struct in6_rtmsg" untouched.
>> > This reduces the RTA_PREFSRC support to netlink only, unless
>> > we break the struct.
>> > 
>> > Do you see any other way around this problem?
>> 
>> This is fine, adding new feature support to deprecated things like
>> the ioctl routing calls is undesirable anyways.
>> 
>> Since you do the prefsrc extraction in at least two places, make a
>> helper function that does the whole "if prefsrc.plen use prefsrc, else
>> use ipv6_dev_get_saddr()"
>> 
>> This would be akin to ipv4's FIB_RES_PREFSRC
> Hi,
> 
> I've moved the extraction into a helper function as suggested and did
> some cleanup.

Daniel, please, when you submit new versions of patches do make a full
and complete resubmission.

This means, write a new email, provide a full commit message, proper
Subject, and Signed-off-by: lines.

Don't just reply to my request with a new patch, that doesn't work
and your changes won't get tracked properly.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox