Netdev List
 help / color / mirror / Atom feed
* Re: ixgbe: Regression, unsupported SFP+ modules on 10Gbit/s X520 NIC no longer work with allow_unsupported_sfp=1
From: Jeff Kirsher @ 2013-02-15  0:28 UTC (permalink / raw)
  To: Stefan Behte
  Cc: netdev, Skidmore, Donald C, Duyck, Alexander H, Tantilov, Emil S,
	Keller, Jacob E
In-Reply-To: <D76AF9B3DDF5FF49833AC0A1396549060333A1C5@s554.babiel.com>

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

On Fri, 2013-02-15 at 01:10 +0100, Stefan Behte wrote:
> Hello,
> 
> I was told to send a mail, even though I had already opened
> https://bugzilla.kernel.org/show_bug.cgi?id=53901.
> 
> Someone patched the ixgbe driver, and now non-intel SFPs do not work
> anymore, again. The issue of intel "lock-in" was discussed before
> here:
> http://marc.info/?l=e1000-devel&m=132697406314730&w=2
> 
> A tested patch is attached.
> 
> Here is what I do:
> 
> # modinfo ixgbe | grep parm
> parm:           max_vfs:Maximum number of virtual functions to
> allocate per physical function - default is zero and maximum value is
> 63 (uint)
> parm:           allow_unsupported_sfp:Allow unsupported and untested
> SFP+ modules on 82599-based adapters (uint)
> parm:           debug:Debug level (0=none,...,16=all) (int)
> 
> # modprobe -r ixgbe
> # modprobe ixgbe allow_unsupported_sfp=0
> # dmesg | grep ixgbe
> [13690.355090] ixgbe: Intel(R) 10 Gigabit PCI Express Network Driver -
> version 3.9.15-k
> [13690.355092] ixgbe: Copyright (c) 1999-2012 Intel Corporation.
> [13690.373128] ixgbe 0000:02:00.0: failed to load because an
> unsupported SFP+ module type was detected.
> [13690.373177] ixgbe 0000:02:00.0: Reload the driver after installing
> a supported module.
> [13690.390987] ixgbe 0000:02:00.1: failed to load because an
> unsupported SFP+ module type was detected.
> [13690.391036] ixgbe 0000:02:00.1: Reload the driver after installing
> a supported module.
> 
> # modprobe -r ixgbe
> # modprobe ixgbe allow_unsupported_sfp=1
> # dmesg | grep ixgbe
> [13679.088849] dca service started, version 1.12.1
> [13679.091174] ixgbe: Intel(R) 10 Gigabit PCI Express Network Driver -
> version 3.9.15-k
> [13679.091177] ixgbe: Copyright (c) 1999-2012 Intel Corporation.
> [13679.109194] ixgbe 0000:02:00.0: failed to load because an
> unsupported SFP+ module type was detected.
> [13679.109243] ixgbe 0000:02:00.0: Reload the driver after installing
> a supported module.
> [13679.127399] ixgbe 0000:02:00.1: failed to load because an
> unsupported SFP+ module type was detected.
> [13679.127450] ixgbe 0000:02:00.1: Reload the driver after installing
> a supported module.
> [13690.352712] dca service started, version 1.12.1
> 
> 
> With the patch:
> 
> # modprobe -r ixgbe
> # modprobe ixgbe allow_unsupported_sfp=0
> # dmesg | grep ixgbe
> [13907.870087] ixgbe: Intel(R) 10 Gigabit PCI Express Network Driver -
> version 3.9.15-k
> [13907.870089] ixgbe: Copyright (c) 1999-2012 Intel Corporation.
> [13907.888106] ixgbe 0000:02:00.0: failed to load because an
> unsupported SFP+ module type was detected.
> [13907.888155] ixgbe 0000:02:00.0: Reload the driver after installing
> a supported module.
> [13907.906187] ixgbe 0000:02:00.1: failed to load because an
> unsupported SFP+ module type was detected.
> [13907.906237] ixgbe 0000:02:00.1: Reload the driver after installing
> a supported module.
> 
> 
> # modprobe -r ixgbe
> # modprobe ixgbe allow_unsupported_sfp=1
> # dmesg | grep ixgbe
> [13914.534758] ixgbe: Intel(R) 10 Gigabit PCI Express Network Driver -
> version3.9.15-k
> [13914.534761] ixgbe: Copyright (c) 1999-2012 Intel Corporation.
> [13914.552820] ixgbe 0000:02:00.0 (unregistered net_device): WARNING:
> Intel (R) Network Connections are quality tested using Intel (R)
> Ethernet Optics.  Using untested modules is not supported and may
> cause unstable operation or damage to
> the module or the adapter.  Intel Corporation is not responsible for
> any harm caused by using untested modules.
> [13917.741931] ixgbe 0000:02:00.0: irq 50 for MSI/MSI-X
> [13917.741938] ixgbe 0000:02:00.0: irq 51 for MSI/MSI-X
> [13917.741942] ixgbe 0000:02:00.0: irq 52 for MSI/MSI-X
> [13917.741951] ixgbe 0000:02:00.0: irq 53 for MSI/MSI-X
> [13917.741955] ixgbe 0000:02:00.0: irq 54 for MSI/MSI-X
> [13917.741960] ixgbe 0000:02:00.0: irq 55 for MSI/MSI-X
> [13917.741965] ixgbe 0000:02:00.0: irq 56 for MSI/MSI-X
> [13917.741969] ixgbe 0000:02:00.0: irq 57 for MSI/MSI-X
> [13917.741973] ixgbe 0000:02:00.0: irq 58 for MSI/MSI-X
> [13917.742002] ixgbe 0000:02:00.0: Multiqueue Enabled: Rx Queue count
> = 8, Tx Queue count = 8
> [13917.742126] ixgbe 0000:02:00.0: (PCI Express:5.0GT/s:Width x8)
> 90:e2:ba:37:3b:18
> [13917.742207] ixgbe 0000:02:00.0: MAC: 2, PHY: 14, SFP+: 65535, PBA
> No: E68793-005
> [13917.743461] ixgbe 0000:02:00.0: Intel(R) 10 Gigabit Network
> Connection
> [13917.761578] ixgbe 0000:02:00.1 (unregistered net_device): WARNING:
> Intel (R) Network Connections are quality tested using Intel (R)
> Ethernet Optics.  Using untested modules is not supported and may
> cause unstable operation or damage to the module or the adapter.
> Intel Corporation is not responsible for any harm caused by using
> untested modules.
> [13920.948726] ixgbe 0000:02:00.1: irq 59 for MSI/MSI-X
> [13920.948737] ixgbe 0000:02:00.1: irq 60 for MSI/MSI-X
> [13920.948742] ixgbe 0000:02:00.1: irq 61 for MSI/MSI-X
> [13920.948746] ixgbe 0000:02:00.1: irq 62 for MSI/MSI-X
> [13920.948751] ixgbe 0000:02:00.1: irq 63 for MSI/MSI-X
> [13920.948757] ixgbe 0000:02:00.1: irq 64 for MSI/MSI-X
> [13920.948761] ixgbe 0000:02:00.1: irq 65 for MSI/MSI-X
> [13920.948767] ixgbe 0000:02:00.1: irq 66 for MSI/MSI-X
> [13920.948774] ixgbe 0000:02:00.1: irq 67 for MSI/MSI-X
> [13920.948803] ixgbe 0000:02:00.1: Multiqueue Enabled: Rx Queue count
> = 8, Tx Queue count = 8
> [13920.948927] ixgbe 0000:02:00.1: (PCI Express:5.0GT/s:Width x8)
> 90:e2:ba:37:3b:19
> [13920.949008] ixgbe 0000:02:00.1: MAC: 2, PHY: 14, SFP+: 65535, PBA
> No: E68793-005
> [13920.950237] ixgbe 0000:02:00.1: Intel(R) 10 Gigabit Network
> Connection
> 
> And then I get two nice Interfaces. Please apply. :)
> 
> 
> Best regards,
> 
> Stefan Behte
> 
> Babiel GmbH
> Moskauer Strasse 27
> D-40227 Düsseldorf
> 
> Tel:    0211-179349 0
> Fax:    0211-179349 29
> E-Mail: S.Behte@babiel.com
> Internet: http://www.babiel.com
> 
Thanks Stefan, I will make sure that we take a look at the bugzilla.


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

^ permalink raw reply

* Re: [PATCH net-next 1/3] net: Add skb_unclone() helper function.
From: Eric Dumazet @ 2013-02-15  0:22 UTC (permalink / raw)
  To: Pravin B Shelar; +Cc: netdev, edumazet, jesse, bhutchings, mirqus
In-Reply-To: <1360871089-2020-1-git-send-email-pshelar@nicira.com>

On Thu, 2013-02-14 at 11:44 -0800, Pravin B Shelar wrote:
> This function will be used in next GRE_GSO patch. This patch does
> not change any functionality.
> 
> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
> ---
>  drivers/net/ppp/ppp_generic.c           |    3 +--
>  include/linux/skbuff.h                  |   10 ++++++++++
>  net/ipv4/ah4.c                          |    3 +--
>  net/ipv4/ip_fragment.c                  |    2 +-
>  net/ipv4/tcp_output.c                   |    2 +-
>  net/ipv4/xfrm4_input.c                  |    2 +-
>  net/ipv4/xfrm4_mode_tunnel.c            |    3 +--
>  net/ipv6/ah6.c                          |    3 +--
>  net/ipv6/netfilter/nf_conntrack_reasm.c |    2 +-
>  net/ipv6/reassembly.c                   |    2 +-
>  net/ipv6/xfrm6_mode_tunnel.c            |    3 +--
>  net/sched/act_ipt.c                     |    6 ++----
>  net/sched/act_pedit.c                   |    3 +--
>  13 files changed, 23 insertions(+), 21 deletions(-)

Acked-by: Eric Dumazet <edumazet@google.com>

^ permalink raw reply

* Re: [STABLE REQUEST] Merge to linux-3.4.y net: Downgrade CAP_SYS_MODULE deprecated message from error to warning.
From: Vinson Lee @ 2013-02-15  0:16 UTC (permalink / raw)
  To: Greg KH; +Cc: stable, davem, edumazet, mirq-linux, jpirko, therbert, netdev
In-Reply-To: <20130214233735.GA4390@kroah.com>

On Thu, Feb 14, 2013 at 3:37 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Thu, Feb 14, 2013 at 03:29:44PM -0800, Vinson Lee wrote:
>> Hi.
>>
>> I would like to nominate commit
>> 7cecb523adedcaf8acba5e14d47559d8bc3f40d7 for backport to stable
>> branches 3.4 and earlier.
>>
>> commit 7cecb523adedcaf8acba5e14d47559d8bc3f40d7
>> Author: Vinson Lee <vlee@twitter.com>
>> Date:   Wed Jun 27 14:32:07 2012 +0000
>>
>>     net: Downgrade CAP_SYS_MODULE deprecated message from error to warning.
>>
>>     Make logging level consistent with other deprecation messages in net
>>     subsystem.
>>
>>     Signed-off-by: Vinson Lee <vlee@twitter.com>
>>     Cc: David Mackey <tdmackey@twitter.com>
>>     Signed-off-by: David S. Miller <davem@davemloft.net>
>
> I fail to see how this patch meets the rules described in
> Documentation/stable_kernel_rules.txt.  What am I missing?
>
> thanks,
>
> greg k-h

I am logging different kernel log-level messages to different files
and monitoring them here. I see this message most often in the errors
pile. It's arguable that this is not a bug, but it is definitely
bothering me here. Please consider for backport but I would understand
if this request was turned down.

Cheers,
Vinson

^ permalink raw reply

* [PATCH 1/5 net-next v2] tg3: Add 57766 device support.
From: Michael Chan @ 2013-02-15  0:27 UTC (permalink / raw)
  To: davem; +Cc: netdev, nsujir, Michael Chan

From: Matt Carlson <mcarlson@broadcom.com>

The patch also adds a couple of fixes

 - For the 57766 and non Ax versions of 57765, bootcode needs to setup
   the PCIE Fast Training Sequence (FTS) value to prevent transmit hangs.
   Unfortunately, it does not have enough room in the selfboot case (i.e.
   devices with no NVRAM).  The driver needs to implement this.

 - For performance reasons, the 2k DMA engine mode on the 57766 should
   be enabled and dma size limited to 2k for standard sized packets.

Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
 drivers/net/ethernet/broadcom/tg3.c |   18 +++++++++++++++++-
 drivers/net/ethernet/broadcom/tg3.h |    2 ++
 2 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index b1b3bc0..6e676a7 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -332,6 +332,7 @@ static DEFINE_PCI_DEVICE_TABLE(tg3_pci_tbl) = {
 	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5719)},
 	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5720)},
 	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57762)},
+	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57766)},
 	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5762)},
 	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5725)},
 	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5727)},
@@ -9179,7 +9180,14 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
 		}
 
 		if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_57765_AX) {
-			u32 grc_mode = tr32(GRC_MODE);
+			u32 grc_mode;
+
+			/* Fix transmit hangs */
+			val = tr32(TG3_CPMU_PADRNG_CTL);
+			val |= TG3_CPMU_PADRNG_CTL_RDIV2;
+			tw32(TG3_CPMU_PADRNG_CTL, val);
+
+			grc_mode = tr32(GRC_MODE);
 
 			/* Access the lower 1K of DL PCIE block registers. */
 			val = grc_mode & ~GRC_MODE_PCIE_PORT_MASK;
@@ -9492,6 +9500,14 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
 	if (tg3_flag(tp, PCI_EXPRESS))
 		rdmac_mode |= RDMAC_MODE_FIFO_LONG_BURST;
 
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57766) {
+		tp->dma_limit = 0;
+		if (tp->dev->mtu <= ETH_DATA_LEN) {
+			rdmac_mode |= RDMAC_MODE_JMB_2K_MMRR;
+			tp->dma_limit = TG3_TX_BD_DMA_MAX_2K;
+		}
+	}
+
 	if (tg3_flag(tp, HW_TSO_1) ||
 	    tg3_flag(tp, HW_TSO_2) ||
 	    tg3_flag(tp, HW_TSO_3))
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h
index ef6ced2..b676728 100644
--- a/drivers/net/ethernet/broadcom/tg3.h
+++ b/drivers/net/ethernet/broadcom/tg3.h
@@ -1164,6 +1164,8 @@
 #define  CPMU_MUTEX_GNT_DRIVER		 0x00001000
 #define TG3_CPMU_PHY_STRAP		0x00003664
 #define TG3_CPMU_PHY_STRAP_IS_SERDES	 0x00000020
+#define TG3_CPMU_PADRNG_CTL		0x00003668
+#define  TG3_CPMU_PADRNG_CTL_RDIV2	 0x00040000
 /* 0x3664 --> 0x36b0 unused */
 
 #define TG3_CPMU_EEE_MODE		0x000036b0
-- 
1.7.1

^ permalink raw reply related

* [PATCH net-next 3/3] GRE: Add TCP segmentation offload for GRE
From: Pravin B Shelar @ 2013-02-14 19:45 UTC (permalink / raw)
  To: netdev; +Cc: edumazet, jesse, bhutchings, mirqus, Pravin B Shelar

Following patch adds GRE protocol offload handler so that
skb_gso_segment() can segment GRE packets.
SKB GSO CB is added to keep track of total header length so that
skb_segment can push entire header. e.g. in case of GRE, skb_segment
need to push inner and outer headers to every segment.
New NETIF_F_GRE_GSO feature is added for devices which support HW
GRE TSO offload. Currently none of devices support it therefore GRE GSO
always fall backs to software GSO.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
---
Fixed according to comments from Jesse and Eric.
v2-v3:
 - Use device features to segment inner packet.
 - Moved skb_mac_gso_segment to separate patch.
 - simplified gre_gso_segment().
 - Added NETIF_F_GRE_GSO feature.

v1-v2:
 - Factored a MAC layer handler out of skb_gso_segment().
 - Eliminated copy operation from gre_gso_segment().
 - Refresh header pointer after pskb_may_pull().
---
 include/linux/netdev_features.h |    3 +-
 include/linux/skbuff.h          |   17 ++++++
 net/core/dev.c                  |    1 +
 net/core/ethtool.c              |    1 +
 net/core/skbuff.c               |    6 ++-
 net/ipv4/af_inet.c              |    1 +
 net/ipv4/gre.c                  |  118 +++++++++++++++++++++++++++++++++++++++
 net/ipv4/ip_gre.c               |   83 +++++++++++++++++++++++++--
 net/ipv4/tcp.c                  |    1 +
 net/ipv4/udp.c                  |    3 +-
 net/ipv6/ip6_offload.c          |    1 +
 net/ipv6/udp_offload.c          |    3 +-
 12 files changed, 227 insertions(+), 11 deletions(-)

diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 5ac3212..3dd3934 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -41,7 +41,7 @@ enum {
 	NETIF_F_TSO_ECN_BIT,		/* ... TCP ECN support */
 	NETIF_F_TSO6_BIT,		/* ... TCPv6 segmentation */
 	NETIF_F_FSO_BIT,		/* ... FCoE segmentation */
-	NETIF_F_GSO_RESERVED1,		/* ... free (fill GSO_MASK to 8 bits) */
+	NETIF_F_GSO_GRE_BIT,		/* ... GRE with TSO */
 	/**/NETIF_F_GSO_LAST,		/* [can't be last bit, see GSO_MASK] */
 	NETIF_F_GSO_RESERVED2		/* ... free (fill GSO_MASK to 8 bits) */
 		= NETIF_F_GSO_LAST,
@@ -102,6 +102,7 @@ enum {
 #define NETIF_F_VLAN_CHALLENGED	__NETIF_F(VLAN_CHALLENGED)
 #define NETIF_F_RXFCS		__NETIF_F(RXFCS)
 #define NETIF_F_RXALL		__NETIF_F(RXALL)
+#define NETIF_F_GRE_GSO		__NETIF_F(GSO_GRE)
 
 /* Features valid for ethtool to change */
 /* = all defined minus driver/device-class-related */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index ca6ee7d..12c8b99 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -314,6 +314,8 @@ enum {
 	SKB_GSO_TCPV6 = 1 << 4,
 
 	SKB_GSO_FCOE = 1 << 5,
+
+	SKB_GSO_GRE = 1 << 6,
 };
 
 #if BITS_PER_LONG > 32
@@ -2732,6 +2734,21 @@ static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
 }
 #endif
 
+/* Keeps track of mac header offset relative to skb->head.
+ * It is useful for TSO of Tunneling protocol. e.g. GRE.
+ * For non-tunnel skb it points to skb_mac_header() and for
+ * tunnel skb it points to outer mac header. */
+struct skb_gso_cb {
+	int mac_offset;
+};
+#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb)
+
+static inline int skb_tnl_header_len(const struct sk_buff *inner_skb)
+{
+	return (skb_mac_header(inner_skb) - inner_skb->head) -
+		SKB_GSO_CB(inner_skb)->mac_offset;
+}
+
 static inline bool skb_is_gso(const struct sk_buff *skb)
 {
 	return skb_shinfo(skb)->gso_size;
diff --git a/net/core/dev.c b/net/core/dev.c
index 5425e41..a184f24 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2413,6 +2413,7 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
 			return ERR_PTR(err);
 	}
 
+	SKB_GSO_CB(skb)->mac_offset = skb_headroom(skb);
 	skb_reset_mac_header(skb);
 	skb->mac_len = skb->network_header - skb->mac_header;
 
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index d9d5520..3e9b2c3 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -77,6 +77,7 @@ static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]
 	[NETIF_F_TSO_ECN_BIT] =          "tx-tcp-ecn-segmentation",
 	[NETIF_F_TSO6_BIT] =             "tx-tcp6-segmentation",
 	[NETIF_F_FSO_BIT] =              "tx-fcoe-segmentation",
+	[NETIF_F_GSO_GRE_BIT] =		 "tx-gre-segmentation",
 
 	[NETIF_F_FCOE_CRC_BIT] =         "tx-checksum-fcoe-crc",
 	[NETIF_F_SCTP_CSUM_BIT] =        "tx-checksum-sctp",
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 6c1ad09..2a3ca33 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2738,6 +2738,7 @@ struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features)
 	unsigned int mss = skb_shinfo(skb)->gso_size;
 	unsigned int doffset = skb->data - skb_mac_header(skb);
 	unsigned int offset = doffset;
+	unsigned int tnl_hlen = skb_tnl_header_len(skb);
 	unsigned int headroom;
 	unsigned int len;
 	int sg = !!(features & NETIF_F_SG);
@@ -2814,7 +2815,10 @@ struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features)
 		skb_set_network_header(nskb, skb->mac_len);
 		nskb->transport_header = (nskb->network_header +
 					  skb_network_header_len(skb));
-		skb_copy_from_linear_data(skb, nskb->data, doffset);
+
+		skb_copy_from_linear_data_offset(skb, -tnl_hlen,
+						 nskb->data - tnl_hlen,
+						 doffset + tnl_hlen);
 
 		if (fskb != skb_shinfo(skb)->frag_list)
 			continue;
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index e6e5d85..e225a4e 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1287,6 +1287,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
 		       SKB_GSO_UDP |
 		       SKB_GSO_DODGY |
 		       SKB_GSO_TCP_ECN |
+		       SKB_GSO_GRE |
 		       0)))
 		goto out;
 
diff --git a/net/ipv4/gre.c b/net/ipv4/gre.c
index 42a4910..7a4c710 100644
--- a/net/ipv4/gre.c
+++ b/net/ipv4/gre.c
@@ -19,6 +19,7 @@
 #include <linux/in.h>
 #include <linux/ip.h>
 #include <linux/netdevice.h>
+#include <linux/if_tunnel.h>
 #include <linux/spinlock.h>
 #include <net/protocol.h>
 #include <net/gre.h>
@@ -26,6 +27,11 @@
 
 static const struct gre_protocol __rcu *gre_proto[GREPROTO_MAX] __read_mostly;
 static DEFINE_SPINLOCK(gre_proto_lock);
+struct gre_base_hdr {
+	__be16 flags;
+	__be16 protocol;
+};
+#define GRE_HEADER_SECTION 4
 
 int gre_add_protocol(const struct gre_protocol *proto, u8 version)
 {
@@ -112,12 +118,117 @@ static void gre_err(struct sk_buff *skb, u32 info)
 	rcu_read_unlock();
 }
 
+static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
+				       netdev_features_t features)
+{
+	struct sk_buff *segs = ERR_PTR(-EINVAL);
+	netdev_features_t enc_features;
+	int ghl = GRE_HEADER_SECTION;
+	struct gre_base_hdr *greh;
+	int mac_len = skb->mac_len;
+	int tnl_hlen;
+	bool csum;
+
+	if (unlikely(skb_shinfo(skb)->gso_type &
+				~(SKB_GSO_TCPV4 |
+				  SKB_GSO_TCPV6 |
+				  SKB_GSO_UDP |
+				  SKB_GSO_DODGY |
+				  SKB_GSO_TCP_ECN |
+				  SKB_GSO_GRE)))
+		goto out;
+
+	if (unlikely(!pskb_may_pull(skb, sizeof(*greh))))
+		goto out;
+
+	greh = (struct gre_base_hdr *)skb_transport_header(skb);
+
+	if (greh->flags & GRE_KEY)
+		ghl += GRE_HEADER_SECTION;
+	if (greh->flags & GRE_SEQ)
+		ghl += GRE_HEADER_SECTION;
+	if (greh->flags & GRE_CSUM) {
+		ghl += GRE_HEADER_SECTION;
+		csum = true;
+	} else
+		csum = false;
+
+	/* setup inner skb. */
+	if (greh->protocol == htons(ETH_P_TEB)) {
+		struct ethhdr *eth = eth_hdr(skb);
+		skb->protocol = eth->h_proto;
+	} else {
+		skb->protocol = greh->protocol;
+	}
+
+	skb->encapsulation = 0;
+
+	if (unlikely(!pskb_may_pull(skb, ghl)))
+		goto out;
+	__skb_pull(skb, ghl);
+	skb_reset_mac_header(skb);
+	skb_set_network_header(skb, skb_inner_network_offset(skb));
+	skb->mac_len = skb_inner_network_offset(skb);
+
+	/* segment inner packet. */
+	enc_features = skb->dev->hw_enc_features & netif_skb_features(skb);
+	segs = skb_mac_gso_segment(skb, enc_features);
+	if (!segs || IS_ERR(segs))
+		goto out;
+
+	skb = segs;
+	tnl_hlen = skb_tnl_header_len(skb);
+	do {
+		__skb_push(skb, ghl);
+		if (csum) {
+			__be32 *pcsum;
+
+			if (skb_has_shared_frag(skb)) {
+				int err;
+
+				err = __skb_linearize(skb);
+				if (err) {
+					kfree_skb(segs);
+					segs = ERR_PTR(err);
+					goto out;
+				}
+			}
+
+			greh = (struct gre_base_hdr *)(skb->data);
+			pcsum = (__be32 *)(greh + 1);
+			*pcsum = 0;
+			*(__sum16 *)pcsum = csum_fold(skb_checksum(skb, 0, skb->len, 0));
+		}
+		__skb_push(skb, tnl_hlen - ghl);
+
+		skb_reset_mac_header(skb);
+		skb_set_network_header(skb, mac_len);
+		skb->mac_len = mac_len;
+	} while ((skb = skb->next));
+out:
+	return segs;
+}
+
+static int gre_gso_send_check(struct sk_buff *skb)
+{
+	if (!skb->encapsulation)
+		return -EINVAL;
+	return 0;
+}
+
 static const struct net_protocol net_gre_protocol = {
 	.handler     = gre_rcv,
 	.err_handler = gre_err,
 	.netns_ok    = 1,
 };
 
+static const struct net_offload gre_offload = {
+	.callbacks = {
+		.gso_send_check =	gre_gso_send_check,
+		.gso_segment    =	gre_gso_segment,
+	},
+};
+
 static int __init gre_init(void)
 {
 	pr_info("GRE over IPv4 demultiplexor driver\n");
@@ -127,11 +238,18 @@ static int __init gre_init(void)
 		return -EAGAIN;
 	}
 
+	if (inet_add_offload(&gre_offload, IPPROTO_GRE)) {
+		pr_err("can't add protocol offload\n");
+		inet_del_protocol(&net_gre_protocol, IPPROTO_GRE);
+		return -EAGAIN;
+	}
+
 	return 0;
 }
 
 static void __exit gre_exit(void)
 {
+	inet_del_offload(&gre_offload, IPPROTO_GRE);
 	inet_del_protocol(&net_gre_protocol, IPPROTO_GRE);
 }
 
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 00a14b9..5e0c5f1 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -735,8 +735,33 @@ drop:
 	return 0;
 }
 
+static struct sk_buff *handle_offloads(struct sk_buff *skb)
+{
+	int err;
+
+	if (skb_is_gso(skb)) {
+		err = skb_unclone(skb, GFP_ATOMIC);
+		if (unlikely(err))
+			goto error;
+		skb_shinfo(skb)->gso_type |= SKB_GSO_GRE;
+		return skb;
+	} else if (skb->ip_summed == CHECKSUM_PARTIAL) {
+		err = skb_checksum_help(skb);
+		if (unlikely(err))
+			goto error;
+	}
+	skb->ip_summed = CHECKSUM_NONE;
+
+	return skb;
+
+error:
+	kfree_skb(skb);
+	return ERR_PTR(err);
+}
+
 static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
 {
+	struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats);
 	struct ip_tunnel *tunnel = netdev_priv(dev);
 	const struct iphdr  *old_iph;
 	const struct iphdr  *tiph;
@@ -751,10 +776,16 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
 	__be32 dst;
 	int    mtu;
 	u8     ttl;
+	int    err;
 
-	if (skb->ip_summed == CHECKSUM_PARTIAL &&
-	    skb_checksum_help(skb))
-		goto tx_error;
+	skb = handle_offloads(skb);
+	if (IS_ERR(skb))
+		return NETDEV_TX_OK;
+
+	if (!skb->encapsulation) {
+		skb_reset_inner_headers(skb);
+		skb->encapsulation = 1;
+	}
 
 	old_iph = ip_hdr(skb);
 
@@ -855,7 +886,8 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
 	if (skb->protocol == htons(ETH_P_IP)) {
 		df |= (old_iph->frag_off&htons(IP_DF));
 
-		if ((old_iph->frag_off&htons(IP_DF)) &&
+		if (!skb_is_gso(skb) &&
+		    (old_iph->frag_off&htons(IP_DF)) &&
 		    mtu < ntohs(old_iph->tot_len)) {
 			icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
 			ip_rt_put(rt);
@@ -875,7 +907,9 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
 			}
 		}
 
-		if (mtu >= IPV6_MIN_MTU && mtu < skb->len - tunnel->hlen + gre_hlen) {
+		if (!skb_is_gso(skb) &&
+		    mtu >= IPV6_MIN_MTU &&
+		    mtu < skb->len - tunnel->hlen + gre_hlen) {
 			icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
 			ip_rt_put(rt);
 			goto tx_error;
@@ -964,9 +998,19 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
 			*ptr = tunnel->parms.o_key;
 			ptr--;
 		}
-		if (tunnel->parms.o_flags&GRE_CSUM) {
+		/* Skip GRE checksum if skb is getting offloaded. */
+		if (!(skb_shinfo(skb)->gso_type & SKB_GSO_GRE) &&
+		    (tunnel->parms.o_flags&GRE_CSUM)) {
 			int offset = skb_transport_offset(skb);
 
+			if (skb_has_shared_frag(skb)) {
+				err = __skb_linearize(skb);
+				if (err) {
+					ip_rt_put(rt);
+					goto tx_error;
+				}
+			}
+
 			*ptr = 0;
 			*(__sum16 *)ptr = csum_fold(skb_checksum(skb, offset,
 								 skb->len - offset,
@@ -974,7 +1018,21 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
 		}
 	}
 
-	iptunnel_xmit(skb, dev);
+
+	nf_reset(skb);
+	ip_select_ident(iph, skb_dst(skb), NULL);
+
+	err = ip_local_out(skb);
+	if (likely(net_xmit_eval(err) == 0)) {
+		int pkt_len = skb->len - skb_transport_offset(skb);
+		u64_stats_update_begin(&tstats->syncp);
+		tstats->tx_bytes += pkt_len;
+		tstats->tx_packets++;
+		u64_stats_update_end(&tstats->syncp);
+	} else {
+		dev->stats.tx_errors++;
+		dev->stats.tx_aborted_errors++;
+	}
 	return NETDEV_TX_OK;
 
 #if IS_ENABLED(CONFIG_IPV6)
@@ -1044,6 +1102,14 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev)
 		mtu = 68;
 
 	tunnel->hlen = addend;
+	if (tunnel->parms.o_flags & GRE_SEQ) {
+		/* TCP offload with GRE SEQ is not supported. */
+		dev->features &= ~NETIF_F_GSO_SOFTWARE;
+		dev->hw_features &= ~NETIF_F_GSO_SOFTWARE;
+	} else {
+		dev->features |= NETIF_F_GSO_SOFTWARE;
+		dev->hw_features |= NETIF_F_GSO_SOFTWARE;
+	}
 
 	return mtu;
 }
@@ -1593,6 +1659,9 @@ static void ipgre_tap_setup(struct net_device *dev)
 
 	dev->iflink		= 0;
 	dev->features		|= NETIF_F_NETNS_LOCAL;
+
+	dev->features		|= GRE_FEATURES;
+	dev->hw_features	|= GRE_FEATURES;
 }
 
 static int ipgre_newlink(struct net *src_net, struct net_device *dev, struct nlattr *tb[],
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 1f0bedb..7a5ba48 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3043,6 +3043,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb,
 			       SKB_GSO_DODGY |
 			       SKB_GSO_TCP_ECN |
 			       SKB_GSO_TCPV6 |
+			       SKB_GSO_GRE |
 			       0) ||
 			     !(type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))))
 			goto out;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 6791aac..39a5e7a 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2305,7 +2305,8 @@ struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
 		/* Packet is from an untrusted source, reset gso_segs. */
 		int type = skb_shinfo(skb)->gso_type;
 
-		if (unlikely(type & ~(SKB_GSO_UDP | SKB_GSO_DODGY) ||
+		if (unlikely(type & ~(SKB_GSO_UDP | SKB_GSO_DODGY |
+				      SKB_GSO_GRE) ||
 			     !(type & (SKB_GSO_UDP))))
 			goto out;
 
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
index f26f0da..8234c1d 100644
--- a/net/ipv6/ip6_offload.c
+++ b/net/ipv6/ip6_offload.c
@@ -99,6 +99,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
 		     ~(SKB_GSO_UDP |
 		       SKB_GSO_DODGY |
 		       SKB_GSO_TCP_ECN |
+		       SKB_GSO_GRE |
 		       SKB_GSO_TCPV6 |
 		       0)))
 		goto out;
diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c
index 0c8934a..cf05cf0 100644
--- a/net/ipv6/udp_offload.c
+++ b/net/ipv6/udp_offload.c
@@ -56,7 +56,8 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
 		/* Packet is from an untrusted source, reset gso_segs. */
 		int type = skb_shinfo(skb)->gso_type;
 
-		if (unlikely(type & ~(SKB_GSO_UDP | SKB_GSO_DODGY) ||
+		if (unlikely(type & ~(SKB_GSO_UDP | SKB_GSO_DODGY |
+				      SKB_GSO_GRE) ||
 			     !(type & (SKB_GSO_UDP))))
 			goto out;
 
-- 
1.7.1

^ permalink raw reply related

* [PATCH net-next 2/3] net: factor out skb_mac_gso_segment() from skb_gso_segment()
From: Pravin B Shelar @ 2013-02-14 19:44 UTC (permalink / raw)
  To: netdev; +Cc: edumazet, jesse, bhutchings, mirqus, Pravin B Shelar

This function will be used in next GRE_GSO patch. This patch does
not change any functionality. It only exports skb_mac_gso_segment()
function.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
---
 include/linux/netdevice.h |    2 +
 net/core/dev.c            |   79 +++++++++++++++++++++++++++-----------------
 2 files changed, 50 insertions(+), 31 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9deb672..920361b 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2671,6 +2671,8 @@ extern void netdev_upper_dev_unlink(struct net_device *dev,
 extern int skb_checksum_help(struct sk_buff *skb);
 extern struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
 	netdev_features_t features, bool tx_path);
+extern struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
+					  netdev_features_t features);
 
 static inline
 struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features)
diff --git a/net/core/dev.c b/net/core/dev.c
index 2f31bf9..5425e41 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2327,37 +2327,20 @@ out:
 }
 EXPORT_SYMBOL(skb_checksum_help);
 
-/* openvswitch calls this on rx path, so we need a different check.
- */
-static inline bool skb_needs_check(struct sk_buff *skb, bool tx_path)
-{
-	if (tx_path)
-		return skb->ip_summed != CHECKSUM_PARTIAL;
-	else
-		return skb->ip_summed == CHECKSUM_NONE;
-}
-
 /**
- *	__skb_gso_segment - Perform segmentation on skb.
+ *	skb_mac_gso_segment - mac layer segmentation handler.
  *	@skb: buffer to segment
  *	@features: features for the output path (see dev->features)
- *	@tx_path: whether it is called in TX path
- *
- *	This function segments the given skb and returns a list of segments.
- *
- *	It may return NULL if the skb requires no segmentation.  This is
- *	only possible when GSO is used for verifying header integrity.
  */
-struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
-				  netdev_features_t features, bool tx_path)
+struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
+				    netdev_features_t features)
 {
 	struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT);
 	struct packet_offload *ptype;
 	__be16 type = skb->protocol;
-	int vlan_depth = ETH_HLEN;
-	int err;
 
 	while (type == htons(ETH_P_8021Q)) {
+		int vlan_depth = ETH_HLEN;
 		struct vlan_hdr *vh;
 
 		if (unlikely(!pskb_may_pull(skb, vlan_depth + VLAN_HLEN)))
@@ -2368,22 +2351,14 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
 		vlan_depth += VLAN_HLEN;
 	}
 
-	skb_reset_mac_header(skb);
-	skb->mac_len = skb->network_header - skb->mac_header;
 	__skb_pull(skb, skb->mac_len);
 
-	if (unlikely(skb_needs_check(skb, tx_path))) {
-		skb_warn_bad_offload(skb);
-
-		if (skb_header_cloned(skb) &&
-		    (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
-			return ERR_PTR(err);
-	}
-
 	rcu_read_lock();
 	list_for_each_entry_rcu(ptype, &offload_base, list) {
 		if (ptype->type == type && ptype->callbacks.gso_segment) {
 			if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) {
+				int err;
+
 				err = ptype->callbacks.gso_send_check(skb);
 				segs = ERR_PTR(err);
 				if (err || skb_gso_ok(skb, features))
@@ -2401,6 +2376,48 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
 
 	return segs;
 }
+EXPORT_SYMBOL(skb_mac_gso_segment);
+
+
+/* openvswitch calls this on rx path, so we need a different check.
+ */
+static inline bool skb_needs_check(struct sk_buff *skb, bool tx_path)
+{
+	if (tx_path)
+		return skb->ip_summed != CHECKSUM_PARTIAL;
+	else
+		return skb->ip_summed == CHECKSUM_NONE;
+}
+
+/**
+ *	__skb_gso_segment - Perform segmentation on skb.
+ *	@skb: buffer to segment
+ *	@features: features for the output path (see dev->features)
+ *	@tx_path: whether it is called in TX path
+ *
+ *	This function segments the given skb and returns a list of segments.
+ *
+ *	It may return NULL if the skb requires no segmentation.  This is
+ *	only possible when GSO is used for verifying header integrity.
+ */
+struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
+				  netdev_features_t features, bool tx_path)
+{
+	if (unlikely(skb_needs_check(skb, tx_path))) {
+		int err;
+
+		skb_warn_bad_offload(skb);
+
+		if (skb_header_cloned(skb) &&
+		    (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
+			return ERR_PTR(err);
+	}
+
+	skb_reset_mac_header(skb);
+	skb->mac_len = skb->network_header - skb->mac_header;
+
+	return skb_mac_gso_segment(skb, features);
+}
 EXPORT_SYMBOL(__skb_gso_segment);
 
 /* Take action when hardware reception checksum errors are detected. */
-- 
1.7.1

^ permalink raw reply related

* [PATCH net-next 1/3] net: Add skb_unclone() helper function.
From: Pravin B Shelar @ 2013-02-14 19:44 UTC (permalink / raw)
  To: netdev; +Cc: edumazet, jesse, bhutchings, mirqus, Pravin B Shelar

This function will be used in next GRE_GSO patch. This patch does
not change any functionality.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
---
 drivers/net/ppp/ppp_generic.c           |    3 +--
 include/linux/skbuff.h                  |   10 ++++++++++
 net/ipv4/ah4.c                          |    3 +--
 net/ipv4/ip_fragment.c                  |    2 +-
 net/ipv4/tcp_output.c                   |    2 +-
 net/ipv4/xfrm4_input.c                  |    2 +-
 net/ipv4/xfrm4_mode_tunnel.c            |    3 +--
 net/ipv6/ah6.c                          |    3 +--
 net/ipv6/netfilter/nf_conntrack_reasm.c |    2 +-
 net/ipv6/reassembly.c                   |    2 +-
 net/ipv6/xfrm6_mode_tunnel.c            |    3 +--
 net/sched/act_ipt.c                     |    6 ++----
 net/sched/act_pedit.c                   |    3 +--
 13 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index 0b2706a..4fd754e 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -1805,8 +1805,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
 		/* the filter instructions are constructed assuming
 		   a four-byte PPP header on each packet */
 		if (ppp->pass_filter || ppp->active_filter) {
-			if (skb_cloned(skb) &&
-			    pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
+			if (skb_unclone(skb, GFP_ATOMIC))
 				goto err;
 
 			*skb_push(skb, 2) = 0;
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 9da9952..ca6ee7d 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -804,6 +804,16 @@ static inline int skb_cloned(const struct sk_buff *skb)
 	       (atomic_read(&skb_shinfo(skb)->dataref) & SKB_DATAREF_MASK) != 1;
 }
 
+static inline int skb_unclone(struct sk_buff *skb, gfp_t pri)
+{
+	might_sleep_if(pri & __GFP_WAIT);
+
+	if (skb_cloned(skb))
+		return pskb_expand_head(skb, 0, 0, pri);
+
+	return 0;
+}
+
 /**
  *	skb_header_cloned - is the header a clone
  *	@skb: buffer to check
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
index a69b4e4..2e7f194 100644
--- a/net/ipv4/ah4.c
+++ b/net/ipv4/ah4.c
@@ -321,8 +321,7 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb)
 
 	/* We are going to _remove_ AH header to keep sockets happy,
 	 * so... Later this can change. */
-	if (skb_cloned(skb) &&
-	    pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
+	if (skb_unclone(skb, GFP_ATOMIC))
 		goto out;
 
 	skb->ip_summed = CHECKSUM_NONE;
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 1211613..b6d30ac 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -590,7 +590,7 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev,
 		goto out_oversize;
 
 	/* Head of list must not be cloned. */
-	if (skb_cloned(head) && pskb_expand_head(head, 0, 0, GFP_ATOMIC))
+	if (skb_unclone(head, GFP_ATOMIC))
 		goto out_nomem;
 
 	/* If the first fragment is fragmented itself, we split
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 6182d90..fd0cea1 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1331,7 +1331,7 @@ static void __pskb_trim_head(struct sk_buff *skb, int len)
 /* Remove acked data from a packet in the transmit queue. */
 int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len)
 {
-	if (skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
+	if (skb_unclone(skb, GFP_ATOMIC))
 		return -ENOMEM;
 
 	__pskb_trim_head(skb, len);
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
index 06814b6..1f12c8b 100644
--- a/net/ipv4/xfrm4_input.c
+++ b/net/ipv4/xfrm4_input.c
@@ -132,7 +132,7 @@ int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
 	 * header and optional ESP marker bytes) and then modify the
 	 * protocol to ESP, and then call into the transform receiver.
 	 */
-	if (skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
+	if (skb_unclone(skb, GFP_ATOMIC))
 		goto drop;
 
 	/* Now we can update and verify the packet length... */
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
index ddee0a0..1162ace 100644
--- a/net/ipv4/xfrm4_mode_tunnel.c
+++ b/net/ipv4/xfrm4_mode_tunnel.c
@@ -142,8 +142,7 @@ static int xfrm4_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
 	for_each_input_rcu(rcv_notify_handlers, handler)
 		handler->handler(skb);
 
-	if (skb_cloned(skb) &&
-	    (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
+	if (err = skb_unclone(skb, GFP_ATOMIC))
 		goto out;
 
 	if (x->props.flags & XFRM_STATE_DECAP_DSCP)
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index 3842331..bb02e17 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -521,8 +521,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
 
 	/* We are going to _remove_ AH header to keep sockets happy,
 	 * so... Later this can change. */
-	if (skb_cloned(skb) &&
-	    pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
+	if (skb_unclone(skb, GFP_ATOMIC))
 		goto out;
 
 	skb->ip_summed = CHECKSUM_NONE;
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index c674f15..b89a8c3 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -368,7 +368,7 @@ nf_ct_frag6_reasm(struct frag_queue *fq, struct net_device *dev)
 	}
 
 	/* Head of list must not be cloned. */
-	if (skb_cloned(head) && pskb_expand_head(head, 0, 0, GFP_ATOMIC)) {
+	if (skb_unclone(head, GFP_ATOMIC)) {
 		pr_debug("skb is cloned but can't expand head");
 		goto out_oom;
 	}
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index bab2c27..e354743 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -404,7 +404,7 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
 		goto out_oversize;
 
 	/* Head of list must not be cloned. */
-	if (skb_cloned(head) && pskb_expand_head(head, 0, 0, GFP_ATOMIC))
+	if (skb_unclone(head, GFP_ATOMIC))
 		goto out_oom;
 
 	/* If the first fragment is fragmented itself, we split
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c
index 9f2095b..93c41a8 100644
--- a/net/ipv6/xfrm6_mode_tunnel.c
+++ b/net/ipv6/xfrm6_mode_tunnel.c
@@ -69,8 +69,7 @@ static int xfrm6_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
 	if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
 		goto out;
 
-	if (skb_cloned(skb) &&
-	    (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
+	if (err = skb_unclone(skb, GFP_ATOMIC))
 		goto out;
 
 	if (x->props.flags & XFRM_STATE_DECAP_DSCP)
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index 0fb9e3f..e0f6de6 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -207,10 +207,8 @@ static int tcf_ipt(struct sk_buff *skb, const struct tc_action *a,
 	struct tcf_ipt *ipt = a->priv;
 	struct xt_action_param par;
 
-	if (skb_cloned(skb)) {
-		if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
-			return TC_ACT_UNSPEC;
-	}
+	if (skb_unclone(skb, GFP_ATOMIC))
+		return TC_ACT_UNSPEC;
 
 	spin_lock(&ipt->tcf_lock);
 
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index 0c3fadd..7ed78c9 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -131,8 +131,7 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
 	int i, munged = 0;
 	unsigned int off;
 
-	if (skb_cloned(skb) &&
-	    pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
+	if (skb_unclone(skb, GFP_ATOMIC))
 		return p->tcf_action;
 
 	off = skb_network_offset(skb);
-- 
1.7.1

^ permalink raw reply related

* [PATCH net-next 0/3] v3 GRE: TCP segmentation offload
From: Pravin B Shelar @ 2013-02-14 19:44 UTC (permalink / raw)
  To: netdev; +Cc: edumazet, jesse, bhutchings, mirqus, Pravin B Shelar

Following patches add TCP segmentation offload to GRE. These 
patches shows 20-25% performance improvement in netperf single
process TCP_STREAM test on 10G network.

Pravin B Shelar (3):
  net: Add skb_unclone() helper function.
  net: factor out skb_mac_gso_segment() from skb_gso_segment()
  GRE: Add TCP segmentation offload for GRE

 drivers/net/ppp/ppp_generic.c           |    3 +-
 include/linux/netdev_features.h         |    3 +-
 include/linux/netdevice.h               |    2 +
 include/linux/skbuff.h                  |   27 +++++++
 net/core/dev.c                          |   80 ++++++++++++--------
 net/core/ethtool.c                      |    1 +
 net/core/skbuff.c                       |    6 +-
 net/ipv4/af_inet.c                      |    1 +
 net/ipv4/ah4.c                          |    3 +-
 net/ipv4/gre.c                          |  122 +++++++++++++++++++++++++++++++
 net/ipv4/ip_fragment.c                  |    2 +-
 net/ipv4/ip_gre.c                       |   82 +++++++++++++++++++--
 net/ipv4/tcp.c                          |    1 +
 net/ipv4/tcp_output.c                   |    2 +-
 net/ipv4/udp.c                          |    3 +-
 net/ipv4/xfrm4_input.c                  |    2 +-
 net/ipv4/xfrm4_mode_tunnel.c            |    3 +-
 net/ipv6/ah6.c                          |    3 +-
 net/ipv6/ip6_offload.c                  |    1 +
 net/ipv6/netfilter/nf_conntrack_reasm.c |    2 +-
 net/ipv6/reassembly.c                   |    2 +-
 net/ipv6/udp_offload.c                  |    3 +-
 net/ipv6/xfrm6_mode_tunnel.c            |    3 +-
 net/sched/act_ipt.c                     |    6 +-
 net/sched/act_pedit.c                   |    3 +-
 25 files changed, 303 insertions(+), 63 deletions(-)

^ permalink raw reply

* Re: [PATCH v2 1/1] eventfd: implementation of EFD_MASK flag
From: Andy Lutomirski @ 2013-02-14 23:57 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Martin Sustrik, Alexander Viro, Sha Zhengju, linux-fsdevel,
	linux-kernel, netdev, Michael Kerrisk, Davide Libenzi, Eric Wong
In-Reply-To: <20130214145430.04f8750c.akpm@linux-foundation.org>

On Thu, Feb 14, 2013 at 2:54 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Fri,  8 Feb 2013 09:11:17 +0100
> Martin Sustrik <sustrik@250bpm.com> wrote:
>
>> When implementing network protocols in user space, one has to implement
>> fake user-space file descriptors to represent the sockets for the protocol.

>
>>       if (count < sizeof(ucnt))
>>               return -EINVAL;
>> @@ -293,8 +351,13 @@ static int eventfd_show_fdinfo(struct seq_file *m, struct file *f)
>>       int ret;
>>
>>       spin_lock_irq(&ctx->wqh.lock);
>> -     ret = seq_printf(m, "eventfd-count: %16llx\n",
>> -                      (unsigned long long)ctx->count);
>> +     if (ctx->flags & EFD_MASK) {
>> +             ret = seq_printf(m, "eventfd-mask: %x\n",
>> +                              (unsigned)ctx->mask.events);
>> +     } else {
>> +             ret = seq_printf(m, "eventfd-count: %16llx\n",
>> +                              (unsigned long long)ctx->count);
>> +     }
>>       spin_unlock_irq(&ctx->wqh.lock);
>
> This is a non-back-compatible userspace interface change.  A procfs
> file which previously displayed
>
>         eventfd-count: nnnn
>
> can now also display
>
>         eventfd-mask: nnnn
>
> So existing userspace could misbehave.
>
> Please fully describe the proposed interface change in the changelog.
> That description should include the full pathname of the procfs file
> and example before-and-after output and a discussion of whether and why
> the risk to existing userspace is acceptable.

I suspect that the fdinfo stuff is only used by criu, which will need
to be updated regardless.  (If the kernel adopts the policy "don't
break criu", then that may be the end of new kernel features.)

--Andy

^ permalink raw reply

* [PATCH v3] net: sh_eth: Add support of device tree probe
From: Nobuhiro Iwamatsu @ 2013-02-14 23:47 UTC (permalink / raw)
  To: netdev
  Cc: horms+renesas, magnus.damm, devicetree-discuss, kda,
	kuninori.morimoto.gx, Nobuhiro Iwamatsu

From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>

This adds support of device tree probe for Renesas sh-ether driver.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>

V3: - Remove empty sh_eth_parse_dt().
V3: - Removed sentnece of "needs-init" from document.
V2: - Removed ether_setup().
    - Fixed typo from "sh-etn" to "sh-eth".
	- Removed "needs-init" and sh-eth,endian from definition of DT.
	- Changed "sh-eth,edmac-endian" instead of "sh-eth,edmac-big-endain"
	  in definition of DT.
---
 Documentation/devicetree/bindings/net/sh_ether.txt |   39 +++++
 drivers/net/ethernet/renesas/sh_eth.c              |  150 ++++++++++++++++----
 2 files changed, 165 insertions(+), 24 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/sh_ether.txt

diff --git a/Documentation/devicetree/bindings/net/sh_ether.txt b/Documentation/devicetree/bindings/net/sh_ether.txt
new file mode 100644
index 0000000..f20d66a
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/sh_ether.txt
@@ -0,0 +1,39 @@
+* Renesas Electronics SuperH EMAC
+
+This file provides information, what the device node
+for the sh_eth interface contains.
+
+Required properties:
+- compatible:                   "renesas,sh-eth";
+- interrupt-parent:             The phandle for the interrupt controller that
+                                services interrupts for this device.
+- reg:                          Offset and length of the register set for the
+                                device.
+- interrupts:                   Interrupt mapping for the sh_eth interrupt
+                                sources (vector id).
+- phy-mode:                     String, operation mode of the PHY interface.
+- sh-eth,register-type:         String, register type of sh_eth.
+                                Please select "gigabit", "fast-sh4" or
+                                "fast-sh3-sh2".
+- sh-eth,phy-id:                PHY id.
+
+Optional properties:
+- local-mac-address:            6 bytes, mac address
+- sh-eth,no-ether-link:         Set link control by software. When device does
+                                not support ether-link, set.
+- sh-eth,ether-link-active-low: Set link check method.
+                                When detection of link is treated as active-low,
+                                set.
+- sh-eth,edmac-big-endian:      Set big endian for sh_eth dmac.
+                                It work as little endian when this is not set.
+
+Example (armadillo800eva):
+	sh-eth@e9a00000 {
+		compatible = "renesas,sh-eth";
+		interrupt-parent = <&intca>;
+		reg = <0xe9a00000 0x800>, <0xe9a01800 0x800>;
+		interrupts = <0x500>;
+		phy-mode = "mii";
+		sh-eth,register-type = "gigabit";
+		sh-eth,phy-id = <0>;
+	};
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 3d70586..b41249a 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1,7 +1,7 @@
 /*
  *  SuperH Ethernet device driver
  *
- *  Copyright (C) 2006-2012 Nobuhiro Iwamatsu
+ *  Copyright (C) 2006-2013 Nobuhiro Iwamatsu
  *  Copyright (C) 2008-2012 Renesas Solutions Corp.
  *
  *  This program is free software; you can redistribute it and/or modify it
@@ -31,6 +31,12 @@
 #include <linux/platform_device.h>
 #include <linux/mdio-bitbang.h>
 #include <linux/netdevice.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_platform.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/of_net.h>
 #include <linux/phy.h>
 #include <linux/cache.h>
 #include <linux/io.h>
@@ -2347,26 +2353,103 @@ static const struct net_device_ops sh_eth_netdev_ops = {
 	.ndo_change_mtu		= eth_change_mtu,
 };
 
+#ifdef CONFIG_OF
+
+static int
+sh_eth_of_get_register_type(struct device_node *np)
+{
+	const char *of_str;
+	int ret = of_property_read_string(np, "sh-eth,register-type", &of_str);
+	if (ret)
+		return ret;
+
+	if (of_str && !strcmp(of_str, "gigabit"))
+		return SH_ETH_REG_GIGABIT;
+
+	else if (of_str && !strcmp(of_str, "fast-sh4"))
+		return SH_ETH_REG_FAST_SH4;
+	else if (of_str && !strcmp(of_str, "fast-sh3-sh2"))
+		return SH_ETH_REG_FAST_SH3_SH2;
+	else
+		return -EINVAL;
+}
+
+static struct sh_eth_plat_data *
+sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
+{
+	int ret;
+	struct device_node *np = dev->of_node;
+	struct sh_eth_plat_data *pdata;
+
+	pdata = devm_kzalloc(dev, sizeof(struct sh_eth_plat_data),
+					GFP_KERNEL);
+	if (!pdata) {
+		dev_err(dev, "%s: failed to allocate config data\n", __func__);
+		return NULL;
+	}
+
+	pdata->phy_interface = of_get_phy_mode(np);
+
+	of_property_read_u32(np, "sh-eth,phy-id", &pdata->phy);
+
+	if (of_find_property(np, "sh-eth,edmac-big-endian", NULL))
+		pdata->edmac_endian = EDMAC_BIG_ENDIAN;
+	else
+		pdata->edmac_endian = EDMAC_LITTLE_ENDIAN;
+
+	if (of_find_property(np, "sh-eth,no-ether-link", NULL))
+		pdata->no_ether_link = 1;
+	else
+		pdata->no_ether_link = 0;
+
+	if (of_find_property(np, "sh-eth,ether-link-active-low", NULL))
+		pdata->ether_link_active_low = 1;
+	else
+		pdata->ether_link_active_low = 0;
+
+	ret = sh_eth_of_get_register_type(np);
+	if (ret < 0)
+		goto error;
+	pdata->register_type = ret;
+
+#ifdef CONFIG_OF_NET
+	if (!is_valid_ether_addr(ndev->dev_addr)) {
+		const char *macaddr = of_get_mac_address(np);
+		if (macaddr)
+			memcpy(pdata->mac_addr, macaddr, ETH_ALEN);
+	}
+#endif
+
+	return pdata;
+
+error:
+	devm_kfree(dev, pdata);
+	return NULL;
+}
+#endif
+
 static int sh_eth_drv_probe(struct platform_device *pdev)
 {
-	int ret, devno = 0;
+	int ret = 0, devno = 0;
 	struct resource *res;
 	struct net_device *ndev = NULL;
 	struct sh_eth_private *mdp = NULL;
 	struct sh_eth_plat_data *pd;
+	struct device_node *np = pdev->dev.of_node;
+
+	ndev = alloc_etherdev(sizeof(struct sh_eth_private));
+	if (!ndev) {
+		ret = -ENOMEM;
+		goto out;
+	}
 
+	mdp = netdev_priv(ndev);
 	/* get base addr */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (unlikely(res == NULL)) {
 		dev_err(&pdev->dev, "invalid resource\n");
 		ret = -EINVAL;
-		goto out;
-	}
-
-	ndev = alloc_etherdev(sizeof(struct sh_eth_private));
-	if (!ndev) {
-		ret = -ENOMEM;
-		goto out;
+		goto out_release;
 	}
 
 	/* The sh Ether-specific entries in the device structure. */
@@ -2383,27 +2466,41 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
 	}
 	ndev->irq = ret;
 
-	SET_NETDEV_DEV(ndev, &pdev->dev);
-
-	/* Fill in the fields of the device structure with ethernet values. */
-	ether_setup(ndev);
-
-	mdp = netdev_priv(ndev);
-	mdp->num_tx_ring = TX_RING_SIZE;
-	mdp->num_rx_ring = RX_RING_SIZE;
 	mdp->addr = ioremap(res->start, resource_size(res));
 	if (mdp->addr == NULL) {
 		ret = -ENOMEM;
 		dev_err(&pdev->dev, "ioremap failed.\n");
 		goto out_release;
 	}
+#ifdef CONFIG_OF
+	if (np && of_device_is_available(np)) {
+		pd = sh_eth_parse_dt(&pdev->dev, ndev);
+		if (pdev->dev.platform_data) {
+			struct sh_eth_plat_data *tmp =
+				pdev->dev.platform_data;
+			pd->set_mdio_gate = tmp->set_mdio_gate;
+			pd->needs_init = tmp->needs_init;
+		}
+	} else
+#endif
+		pd = (struct sh_eth_plat_data *)(pdev->dev.platform_data);
+
+	if (!pd) {
+		dev_err(&pdev->dev, "no setup data defined\n");
+		ret = -EINVAL;
+		goto out_release;
+	}
+
+	SET_NETDEV_DEV(ndev, &pdev->dev);
+
+	mdp->num_tx_ring = TX_RING_SIZE;
+	mdp->num_rx_ring = RX_RING_SIZE;
 
 	spin_lock_init(&mdp->lock);
 	mdp->pdev = pdev;
 	pm_runtime_enable(&pdev->dev);
 	pm_runtime_resume(&pdev->dev);
 
-	pd = (struct sh_eth_plat_data *)(pdev->dev.platform_data);
 	/* get PHY ID */
 	mdp->phy_id = pd->phy;
 	mdp->phy_interface = pd->phy_interface;
@@ -2412,6 +2509,8 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
 	mdp->no_ether_link = pd->no_ether_link;
 	mdp->ether_link_active_low = pd->ether_link_active_low;
 	mdp->reg_offset = sh_eth_get_register_offset(pd->register_type);
+	/* read and set MAC address */
+	read_mac_address(ndev, pd->mac_addr);
 
 	/* set cpu data */
 #if defined(SH_ETH_HAS_BOTH_MODULES)
@@ -2429,20 +2528,16 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
 	/* debug message level */
 	mdp->msg_enable = SH_ETH_DEF_MSG_ENABLE;
 
-	/* read and set MAC address */
-	read_mac_address(ndev, pd->mac_addr);
-
 	/* ioremap the TSU registers */
 	if (mdp->cd->tsu) {
 		struct resource *rtsu;
 		rtsu = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 		if (!rtsu) {
 			dev_err(&pdev->dev, "Not found TSU resource\n");
-			ret = -ENODEV;
 			goto out_release;
 		}
 		mdp->tsu_addr = ioremap(rtsu->start,
-					resource_size(rtsu));
+				resource_size(rtsu));
 		mdp->port = devno % 2;
 		ndev->features = NETIF_F_HW_VLAN_FILTER;
 	}
@@ -2522,17 +2617,24 @@ static int sh_eth_runtime_nop(struct device *dev)
 	return 0;
 }
 
-static struct dev_pm_ops sh_eth_dev_pm_ops = {
+static const struct dev_pm_ops sh_eth_dev_pm_ops = {
 	.runtime_suspend = sh_eth_runtime_nop,
 	.runtime_resume = sh_eth_runtime_nop,
 };
 
+static struct of_device_id sh_eth_match[] = {
+	{ .compatible = "renesas,sh-eth",},
+	{},
+};
+MODULE_DEVICE_TABLE(of, sh_eth_match);
+
 static struct platform_driver sh_eth_driver = {
 	.probe = sh_eth_drv_probe,
 	.remove = sh_eth_drv_remove,
 	.driver = {
 		   .name = CARDNAME,
 		   .pm = &sh_eth_dev_pm_ops,
+		   .of_match_table = sh_eth_match,
 	},
 };
 
-- 
1.7.10.4

^ permalink raw reply related

* Re: bonding inactive slaves vs rx_dropped
From: Jay Vosburgh @ 2013-02-14 23:43 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, eric.dumazet, andy
In-Reply-To: <20130214.171821.186191007478674738.davem@davemloft.net>

David Miller <davem@davemloft.net> wrote:

>From: Jay Vosburgh <fubar@us.ibm.com>
>Date: Thu, 14 Feb 2013 13:51:01 -0800
>
>> David Miller <davem@davemloft.net> wrote:
>> 
>>>People are starting to notice that rx_dropped now increments on every
>>>packet received on an bond's inactive slave.
>>>
>>>I'm actually fine with rx_dropped incrementing in this situation.
>>>
>>>The problem I want to address is that rx_dropped is encompassing
>>>several unrelated situations and thus has become less useful for
>>>diagnosis.
>>>
>>>I think we should add some new RX stats such that we can get at
>>>least a small amount of granularity for rx_dropped.
>>>
>>>This way team, bond, etc. can increment a new netdev_stats->rx_foo in
>>>this situation, and then someone doing diagnosis can see that
>>>rx_dropped and rx_foo are incrementing at similar rates.
>> 
>> 	This drop isn't really happening in bonding, though.  From
>> looking at the code, it comes about because, for the inactive slave, the
>> rx_handler call returns EXACT, and there aren't any exact match ptype
>> bindings, so __netif_receive_skb throws it away.  This isn't always the
>> case; sometimes there is an exact match, for things like iSCSI or FCoE
>> that are really determined to get the packet.
>
>This isn't even the whole story, it won't return 'exact' if the packet
>from the inactive slave is broadcast or multicast.

	It should; it returns EXACT if the packet is on an inactive
slave, with one exception: for a balance-alb mode inactive slave,
broadcast and multicast return EXACT, but unicast (technically, not
broadcast and not multicast) returns ANOTHER after assigning skb->dev to
the bond.

	This permits unicast traffic to pass on the inactive slave(s) in
alb mode, because its inactive slaves are really "mostly active," and we
only need to suppress broadcasts and multicasts.

	The 802.3ad LACPDU protocol handler will return CONSUME for the
skbs it handles, but that doesn't confuse any drop statistics.

>My general rule is that every special case increments a special
>'absurdity' statistic counter for the code :-)

	Gonna need a whole lot of those for bonding, then.  Maybe it
should have its own ethtool -S stats to handle all of the
bonding-internal absurdity.

>> 	We could probably add an, oh, rx_dropped_inactive, or some
>> variation on that theme, that is incremented at the end of
>> __netif_receive_skb if deliver_exact is set, e.g., something like:
>
>Yes, that looks fine to me.
>
>> 	There's the separate questions of whether there should be more
>> counters (e.g., drops in dev_skb_forward or enqueue_to_backlog), and how
>> to deliver the counter(s) to user space.
>
>Since there is some pain in adding counters, I think we should try to
>find a nice (very small) set of cases to cover all at once.

	There aren't a lot of places that increment rx_dropped outside
of the hardware device driver.  There's this case (__netif_receive_skb),
plus dev_forward_skb, enqueue_to_backlog and one other in
gro_cells_receive.  The dev_forward_skb case has two reasons:
skb_copy_ubufs failure, or !is_skb_forwardable.  Leaving both of the
dev_forward_skb reasons as one new counter, that leaves approximately:

	rx_dropped_inactive, rx_dropped_forward, rx_dropped_backlog and
rx_dropped_gro

	Is four too many?  Am I missing a case somewhere?

	-J

---
	-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com

^ permalink raw reply

* Re: [STABLE REQUEST] Merge to linux-3.4.y net: Downgrade CAP_SYS_MODULE deprecated message from error to warning.
From: Greg KH @ 2013-02-14 23:37 UTC (permalink / raw)
  To: Vinson Lee; +Cc: stable, davem, edumazet, mirq-linux, jpirko, therbert, netdev
In-Reply-To: <CAKixpbjutA_84JzM0Zjtw-Pxo8m3KCP9+R_aSJWTPaCqCsVbsw@mail.gmail.com>

On Thu, Feb 14, 2013 at 03:29:44PM -0800, Vinson Lee wrote:
> Hi.
> 
> I would like to nominate commit
> 7cecb523adedcaf8acba5e14d47559d8bc3f40d7 for backport to stable
> branches 3.4 and earlier.
> 
> commit 7cecb523adedcaf8acba5e14d47559d8bc3f40d7
> Author: Vinson Lee <vlee@twitter.com>
> Date:   Wed Jun 27 14:32:07 2012 +0000
> 
>     net: Downgrade CAP_SYS_MODULE deprecated message from error to warning.
> 
>     Make logging level consistent with other deprecation messages in net
>     subsystem.
> 
>     Signed-off-by: Vinson Lee <vlee@twitter.com>
>     Cc: David Mackey <tdmackey@twitter.com>
>     Signed-off-by: David S. Miller <davem@davemloft.net>

I fail to see how this patch meets the rules described in
Documentation/stable_kernel_rules.txt.  What am I missing?

thanks,

greg k-h

^ permalink raw reply

* [STABLE REQUEST] Merge to linux-3.4.y net: Downgrade CAP_SYS_MODULE deprecated message from error to warning.
From: Vinson Lee @ 2013-02-14 23:29 UTC (permalink / raw)
  To: stable; +Cc: davem, edumazet, mirq-linux, jpirko, therbert, netdev

Hi.

I would like to nominate commit
7cecb523adedcaf8acba5e14d47559d8bc3f40d7 for backport to stable
branches 3.4 and earlier.

commit 7cecb523adedcaf8acba5e14d47559d8bc3f40d7
Author: Vinson Lee <vlee@twitter.com>
Date:   Wed Jun 27 14:32:07 2012 +0000

    net: Downgrade CAP_SYS_MODULE deprecated message from error to warning.

    Make logging level consistent with other deprecation messages in net
    subsystem.

    Signed-off-by: Vinson Lee <vlee@twitter.com>
    Cc: David Mackey <tdmackey@twitter.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Cheers,
Vinson

^ permalink raw reply

* Re: [PATCH 1/5 net-next] tg3: Add 57766 device support.
From: Joe Perches @ 2013-02-14 23:16 UTC (permalink / raw)
  To: Nithin Nayak Sujir; +Cc: Michael Chan, davem, netdev
In-Reply-To: <511D6F85.6060201@broadcom.com>

On Thu, 2013-02-14 at 15:13 -0800, Nithin Nayak Sujir wrote:
> 
> On 02/14/2013 02:25 PM, Joe Perches wrote:
> > On Thu, 2013-02-14 at 14:13 -0800, Michael Chan wrote:
> >> From: Matt Carlson <mcarlson@broadcom.com>
> >>
> >> The patch also adds a couple of fixes
> >>
> >>   - For the 57766, bootcode needs to setup the PCIE Fast Training
> >>     Sequence (FTS) value to prevent transmit hangs. Unfortunately, it
> >>     does not have enough room in the selfboot case (i.e. devices with no
> >>     NVRAM).  The driver needs to implement this.
> > []
> >> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> > []
> >> @@ -9179,7 +9180,14 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
> >>   		}
> >>
> >>   		if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_57765_AX) {
> >> -			u32 grc_mode = tr32(GRC_MODE);
> >> +			u32 grc_mode;
> >> +
> >> +			/* Fix transmit hangs */
> >> +			val = tr32(TG3_CPMU_PADRNG_CTL);
> >> +			val |= TG3_CPMU_PADRNG_CTL_RDIV2;
> >> +			tw32(TG3_CPMU_PADRNG_CTL, val);
> >> +
> >
> > This seems to write this val to more devices than just
> > a 57766.  Intentional?
> >
> 
> Yes. In addition to the 57766, this fix applies to non-AX revisions of the 57765.
> 
> It's not apparent from the patch, but this code chunk is inside the conditional -
> 
> 	if (tg3_flag(tp, 57765_CLASS)) {
> 
> which is set for 57765 and 57766 devices.

I know. 

The commit message does not describe the patch correctly.
The commit message says "for the 57766".

^ permalink raw reply

* Re: [PATCH 1/5 net-next] tg3: Add 57766 device support.
From: Nithin Nayak Sujir @ 2013-02-14 23:13 UTC (permalink / raw)
  To: Joe Perches; +Cc: Michael Chan, davem, netdev
In-Reply-To: <1360880750.3051.7.camel@joe-AO722>



On 02/14/2013 02:25 PM, Joe Perches wrote:
> On Thu, 2013-02-14 at 14:13 -0800, Michael Chan wrote:
>> From: Matt Carlson <mcarlson@broadcom.com>
>>
>> The patch also adds a couple of fixes
>>
>>   - For the 57766, bootcode needs to setup the PCIE Fast Training
>>     Sequence (FTS) value to prevent transmit hangs. Unfortunately, it
>>     does not have enough room in the selfboot case (i.e. devices with no
>>     NVRAM).  The driver needs to implement this.
> []
>> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> []
>> @@ -9179,7 +9180,14 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
>>   		}
>>
>>   		if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_57765_AX) {
>> -			u32 grc_mode = tr32(GRC_MODE);
>> +			u32 grc_mode;
>> +
>> +			/* Fix transmit hangs */
>> +			val = tr32(TG3_CPMU_PADRNG_CTL);
>> +			val |= TG3_CPMU_PADRNG_CTL_RDIV2;
>> +			tw32(TG3_CPMU_PADRNG_CTL, val);
>> +
>
> This seems to write this val to more devices than just
> a 57766.  Intentional?
>

Yes. In addition to the 57766, this fix applies to non-AX revisions of the 57765.

It's not apparent from the patch, but this code chunk is inside the conditional -

	if (tg3_flag(tp, 57765_CLASS)) {

which is set for 57765 and 57766 devices.



>> +			grc_mode = tr32(GRC_MODE);
>>
>>   			/* Access the lower 1K of DL PCIE block registers. */
>>   			val = grc_mode & ~GRC_MODE_PCIE_PORT_MASK;
>
>
>

^ permalink raw reply

* Re: [PATCHi v2] net: sh_eth: Add support of device tree probe
From: Nobuhiro Iwamatsu @ 2013-02-14 23:07 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: netdev, devicetree-discuss, magnus.damm, kda, horms+renesas
In-Reply-To: <87mwv7ofgj.wl%kuninori.morimoto.gx@renesas.com>

On Thu, Feb 14, 2013 at 10:24 AM, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
>
> Hi Iwamatsu-san
>
> Thank you for this patch.
>
> Small comment from me
>
>> +#ifdef CONFIG_OF
> (snip)
>> +sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
>> +{
>> +     int ret;
>> +     struct device_node *np = dev->of_node;
>> +     struct sh_eth_plat_data *pdata;
> ...
>> +#else
>> +static struct sh_eth_plat_data *
>> +sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
>> +{
>> +     return NULL;
>> +}
>> +#endif
>
> (snip)
>
>>  static int sh_eth_drv_probe(struct platform_device *pdev)
>>  {
> ...
>> +#ifdef CONFIG_OF
>> +     if (np && of_device_is_available(np)) {
>> +             pd = sh_eth_parse_dt(&pdev->dev, ndev);
>> +             if (pdev->dev.platform_data) {
>> +                     struct sh_eth_plat_data *tmp =
>> +                             pdev->dev.platform_data;
>> +                     pd->set_mdio_gate = tmp->set_mdio_gate;
>> +                     pd->needs_init = tmp->needs_init;
>> +             }
>> +     } else
>> +#endif
>
> sh_eth_parse_dt() was defined for both CO NFIG_OF and !CONFIG_OF.
> But it is called only from CONFIG_OF ?
>
Because of_device_is_available depennds CONFIG_OF.
I already send a patch which add empty fuction of of_device_is_available.
If this was applied, your point does not need.

OK, I erase empty sh_eth_parse_dt, and if a patch is applied, I will
update this.

Regards,
 Nobuhiro

-- 
Nobuhiro Iwamatsu

^ permalink raw reply

* [PATCH 2/5 net-next v2] tg3: Expand EEE support for all 5717 B0
From: Michael Chan @ 2013-02-14 23:24 UTC (permalink / raw)
  To: davem; +Cc: netdev, nsujir

This chip supports Energy Efficient Ethernet.  The existing code only
supports a smaller set of devices with 5718 PCI ID.  Expand support for
all devices with the same 5717 B0 chip ID.

Signed-off-by: Michael Chan <mchan@broadocm.com>
---
 drivers/net/ethernet/broadcom/tg3.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 6e676a7..3004d69 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -14514,7 +14514,7 @@ static int tg3_phy_probe(struct tg3 *tp)
 	    (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
 	     GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720 ||
 	     GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762 ||
-	     (tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 &&
+	     (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 &&
 	      tp->pci_chip_rev_id != CHIPREV_ID_5717_A0) ||
 	     (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765 &&
 	      tp->pci_chip_rev_id != CHIPREV_ID_57765_A0)))
-- 
1.7.1

^ permalink raw reply related

* Re: [PATCH v2 1/1] eventfd: implementation of EFD_MASK flag
From: Andrew Morton @ 2013-02-14 22:54 UTC (permalink / raw)
  To: Martin Sustrik
  Cc: Alexander Viro, Sha Zhengju, linux-fsdevel, linux-kernel, netdev,
	Michael Kerrisk, Davide Libenzi, Andy Lutomirski, Eric Wong
In-Reply-To: <1360311077-14474-1-git-send-email-sustrik@250bpm.com>

On Fri,  8 Feb 2013 09:11:17 +0100
Martin Sustrik <sustrik@250bpm.com> wrote:

> When implementing network protocols in user space, one has to implement
> fake user-space file descriptors to represent the sockets for the protocol.
> 
> While all the BSD socket API functionality for such descriptors may be faked as
> well (myproto_send(), myproto_recv() etc.) this approach doesn't work for
> polling  (select, poll, epoll). And unfortunately, sockets that can't be polled
> on allow only for building the simplest possible applications. Basically, you
> can build a simple client, but once you want to implement a server handling
> many sockets in parallel, you are stuck.
> 
> However, to do polling, real system-level file descriptor is needed,
> not a fake one.
> 
> In theory, eventfd may be used for this purpose, except that it is well suited
> only for signaling POLLIN. With some hacking it can be also used to signal
> POLLOUT and POLLERR, but:
> 
> I.  There's no way to signal POLLPRI, POLLHUP etc.
> II. There's no way to signal arbitraty combination of POLL* flags. Most notably,
>     !POLLIN & !POLLOUT, which is a perfectly valid combination for a network
>     protocol (rx buffer is empty and tx buffer is full), cannot be signaled
>     using current implementation of eventfd.
> 
> This patch implements new EFD_MASK flag which attempts to solve this problem.
> 
> Additionally, when implementing network protocols in user space, there's a
> need to associate user-space state with the each "socket". If eventfd object is
> used as a reference to the socket, it should be possible to associate an opaque
> pointer to user-space data with it.
> 
> The semantics of EFD_MASK are as follows:
> 
> eventfd(2):
> 
> If eventfd is created with EFD_MASK flag set, it is initialised in such a way
> as to signal no events on the file descriptor when it is polled on. 'initval'
> argument is ignored.
> 
> write(2):
> 
> User is allowed to write only buffers containing the following structure:
> 
> struct efd_mask {
>   short events;
>   union {
>     void *ptr;
>     uint32_t u32;
>     uint64_t u64;
>   };
> };
> 
> The value of 'events' should be any combination of event flags as defined by
> poll(2) function (POLLIN, POLLOUT, POLLERR, POLLHUP etc.) Specified events will
> be signaled when polling (select, poll, epoll) on the eventfd is done later on.
> ptr, u32 and u63 are opaque data that are not interpreted by eventfd object.
> 
> read(2):
> 
> User is allowed to read an efd_mask structure from the eventfd marked by
> EFD_MASK. Returned value shall be the last one written to the eventfd.
> 
> select(2), poll(2) and similar:
> 
> When polling on the eventfd marked by EFD_MASK flag, all the events specified
> in last written 'events' field shall be signaled.
> 
> ...

This patch adds userspace interfaces which will require manpage
updates.  Please Cc Michael and work with him on getting those changes
completed.

>
> +/*  On x86-64 keep the same binary layout as on i386. */
> +#ifdef __x86_64__
> +#define EVENTFD_MASK_PACKED __packed
> +#else
> +#define EVENTFD_MASK_PACKED
> +#endif
> +
> +struct eventfd_mask {
> +	__u32 events;
> +	__u64 data;
> +} EVENTFD_MASK_PACKED;

The x86-64 specific thing is ugly.  I can find no explanation of why it
was done, but it should go away.  You could make `events' a u64, or
swap the order of the two fields and make the struct __packed on all
architectures.

Given that the size of the types is fixed, I see no compat issues here.

As this struct is known by userspace, this definition should appear in
a header which is available to usersapce: include/uapi/...

>  struct eventfd_ctx {
>  	struct kref kref;
>  	wait_queue_head_t wqh;
> -	/*
> -	 * Every time that a write(2) is performed on an eventfd, the
> -	 * value of the __u64 being written is added to "count" and a
> -	 * wakeup is performed on "wqh". A read(2) will return the "count"
> -	 * value to userspace, and will reset "count" to zero. The kernel
> -	 * side eventfd_signal() also, adds to the "count" counter and
> -	 * issue a wakeup.
> -	 */
> -	__u64 count;
> +	union {
> +		/*
> +		 * Every time that a write(2) is performed on an eventfd, the
> +		 * value of the __u64 being written is added to "count" and a
> +		 * wakeup is performed on "wqh". A read(2) will return the
> +		 * "count" value to userspace, and will reset "count" to zero.
> +		 * The kernel side eventfd_signal() also, adds to the "count"
> +		 * counter and issue a wakeup.
> +		 */
> +		__u64 count;
> +		struct eventfd_mask mask;

The nice explanation for `count' was retained, but is it appropriate
that `mask' have no explanation?

> +	};
>  	unsigned int flags;
>  };
>  
> ...
>
> @@ -230,13 +261,23 @@ static ssize_t eventfd_read(struct file *file, char __user *buf, size_t count,
>  	ssize_t res;
>  	__u64 cnt;
>  
> -	if (count < sizeof(cnt))
> -		return -EINVAL;
> -	res = eventfd_ctx_read(ctx, file->f_flags & O_NONBLOCK, &cnt);
> -	if (res < 0)
> +	if (ctx->flags & EFD_MASK) {
> +		spin_lock_irq(&ctx->wqh.lock);
> +		if (count < sizeof(ctx->mask))
> +			return -EINVAL;
> +		res = copy_to_user(buf, &ctx->mask, sizeof(ctx->mask)) ?
> +			-EFAULT : sizeof(ctx->mask);
> +		spin_unlock_irq(&ctx->wqh.lock);
>  		return res;

This code is crawling with bugs.

- can return with wqh.lock held -> dead kernel

- performs copy_to_user() under spinlock -> warning spew, kernel
  deadlocks.  It should go via a local temporary, as was done in
  eventfd_write().

This should have filled your screen with warnings when testing.  Either
it wasn't tested or its author forgot to read
Documentation/SubmitChecklist section 12.  Please do so ;)

(otoh maybe might_sleep and lockdep fail to detect copy_*_user under
spinlock when the copy doesn't fault.  If so, that's a big fail)

> -
> -	return put_user(cnt, (__u64 __user *) buf) ? -EFAULT : sizeof(cnt);
> +	} else {
> +		if (count < sizeof(cnt))
> +			return -EINVAL;
> +		res = eventfd_ctx_read(ctx, file->f_flags & O_NONBLOCK, &cnt);
> +		if (res < 0)
> +			return res;
> +		return put_user(cnt, (__u64 __user *) buf) ?
> +			-EFAULT : sizeof(cnt);
> +	}
>  }
>  
>  static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t count,
> @@ -246,6 +287,23 @@ static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t c
>  	ssize_t res;
>  	__u64 ucnt;
>  	DECLARE_WAITQUEUE(wait, current);
> +	struct eventfd_mask mask;
> +
> +	if (ctx->flags & EFD_MASK) {
> +		if (count < sizeof(mask))
> +			return -EINVAL;
> +		if (copy_from_user(&mask, buf, sizeof(mask)))
> +			return -EFAULT;
> +		if (mask.events & ~EFD_MASK_VALID_EVENTS)
> +			return -EINVAL;
> +		spin_lock_irq(&ctx->wqh.lock);
> +		memcpy(&ctx->mask, &mask, sizeof(ctx->mask));
> +		if (waitqueue_active(&ctx->wqh))
> +			wake_up_locked_poll(&ctx->wqh,
> +				(unsigned long)ctx->mask.events);
> +		spin_unlock_irq(&ctx->wqh.lock);
> +		return sizeof(ctx->mask);
> +	}

`mask' can be made local to this `if' block, which is nicer.

>  	if (count < sizeof(ucnt))
>  		return -EINVAL;
> @@ -293,8 +351,13 @@ static int eventfd_show_fdinfo(struct seq_file *m, struct file *f)
>  	int ret;
>  
>  	spin_lock_irq(&ctx->wqh.lock);
> -	ret = seq_printf(m, "eventfd-count: %16llx\n",
> -			 (unsigned long long)ctx->count);
> +	if (ctx->flags & EFD_MASK) {
> +		ret = seq_printf(m, "eventfd-mask: %x\n",
> +				 (unsigned)ctx->mask.events);
> +	} else {
> +		ret = seq_printf(m, "eventfd-count: %16llx\n",
> +				 (unsigned long long)ctx->count);
> +	}
>  	spin_unlock_irq(&ctx->wqh.lock);

This is a non-back-compatible userspace interface change.  A procfs
file which previously displayed

	eventfd-count: nnnn

can now also display

	eventfd-mask: nnnn

So existing userspace could misbehave.

Please fully describe the proposed interface change in the changelog. 
That description should include the full pathname of the procfs file
and example before-and-after output and a discussion of whether and why
the risk to existing userspace is acceptable.
 
> @@ -412,7 +475,12 @@ struct file *eventfd_file_create(unsigned int count, int flags)
>  
>  	kref_init(&ctx->kref);
>  	init_waitqueue_head(&ctx->wqh);
> -	ctx->count = count;
> +	if (flags & EFD_MASK) {
> +		ctx->mask.events = 0;
> +		ctx->mask.data = 0;
> +	} else {
> +		ctx->count = count;
> +	}
>  	ctx->flags = flags;
>  
>  	file = anon_inode_getfile("[eventfd]", &eventfd_fops, ctx,
> diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
> index 3c3ef19..b806d2b 100644
> --- a/include/linux/eventfd.h
> +++ b/include/linux/eventfd.h
> @@ -20,11 +20,12 @@
>   * shared O_* flags.
>   */
>  #define EFD_SEMAPHORE (1 << 0)
> +#define EFD_MASK (1 << 1)

Does this addition comply with the "CAREFUL:" immediately above it?

It would be best to add code comemntary describing what this constant does.

>  #define EFD_CLOEXEC O_CLOEXEC
>  #define EFD_NONBLOCK O_NONBLOCK
>  
>  #define EFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK)
> -#define EFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS | EFD_SEMAPHORE)
> +#define EFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS | EFD_SEMAPHORE | EFD_MASK)
>  
>  #ifdef CONFIG_EVENTFD


^ permalink raw reply

* Re: [PATCH 6/9] net: cwdavinci_cpdma: export symbols for cpsw
From: David Miller @ 2013-02-14 22:52 UTC (permalink / raw)
  To: arnd
  Cc: linux-arm-kernel, linux-kernel, arm, mugunthanvnm, hvaibhav,
	richardcochran, netdev
In-Reply-To: <1360882071-4072668-7-git-send-email-arnd@arndb.de>

From: Arnd Bergmann <arnd@arndb.de>
Date: Thu, 14 Feb 2013 23:47:48 +0100

> With the support for ARM AM33xx in multiplatform kernels
> in 3.9, an older bug appears in ARM allmodconfig:
> When the cpsw driver is built as a module with cpdma
> support enabled, it uses symbols that the cpdma driver
> does not export.
> 
> Without this patch, building allmodconfig results in:
> 
> ERROR: "cpdma_ctlr_int_ctrl" [drivers/net/ethernet/ti/ti_cpsw.ko] undefined!
> ERROR: "cpdma_control_set" [drivers/net/ethernet/ti/ti_cpsw.ko] undefined!
> ERROR: "cpdma_ctlr_eoi" [drivers/net/ethernet/ti/ti_cpsw.ko] undefined!
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply

* [PATCH 6/9] net: cwdavinci_cpdma: export symbols for cpsw
From: Arnd Bergmann @ 2013-02-14 22:47 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-kernel, arm, Arnd Bergmann, Mugunthan V N, Vaibhav Hiremath,
	Richard Cochran, netdev
In-Reply-To: <1360882071-4072668-1-git-send-email-arnd@arndb.de>

With the support for ARM AM33xx in multiplatform kernels
in 3.9, an older bug appears in ARM allmodconfig:
When the cpsw driver is built as a module with cpdma
support enabled, it uses symbols that the cpdma driver
does not export.

Without this patch, building allmodconfig results in:

ERROR: "cpdma_ctlr_int_ctrl" [drivers/net/ethernet/ti/ti_cpsw.ko] undefined!
ERROR: "cpdma_control_set" [drivers/net/ethernet/ti/ti_cpsw.ko] undefined!
ERROR: "cpdma_ctlr_eoi" [drivers/net/ethernet/ti/ti_cpsw.ko] undefined!

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Mugunthan V N <mugunthanvnm@ti.com>
Cc: Vaibhav Hiremath <hvaibhav@ti.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: netdev@vger.kernel.org
---
 drivers/net/ethernet/ti/davinci_cpdma.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
index 7d3bffd..8eeb7c9 100644
--- a/drivers/net/ethernet/ti/davinci_cpdma.c
+++ b/drivers/net/ethernet/ti/davinci_cpdma.c
@@ -492,11 +492,13 @@ int cpdma_ctlr_int_ctrl(struct cpdma_ctlr *ctlr, bool enable)
 	spin_unlock_irqrestore(&ctlr->lock, flags);
 	return 0;
 }
+EXPORT_SYMBOL_GPL(cpdma_ctlr_int_ctrl);
 
 void cpdma_ctlr_eoi(struct cpdma_ctlr *ctlr)
 {
 	dma_reg_write(ctlr, CPDMA_MACEOIVECTOR, 0);
 }
+EXPORT_SYMBOL_GPL(cpdma_ctlr_eoi);
 
 struct cpdma_chan *cpdma_chan_create(struct cpdma_ctlr *ctlr, int chan_num,
 				     cpdma_handler_fn handler)
@@ -1028,3 +1030,4 @@ unlock_ret:
 	spin_unlock_irqrestore(&ctlr->lock, flags);
 	return ret;
 }
+EXPORT_SYMBOL_GPL(cpdma_control_set);
-- 
1.8.1.2

^ permalink raw reply related

* [PATCH 0/9] arm-soc/for-next allyesconfig build regressions
From: Arnd Bergmann @ 2013-02-14 22:47 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-kernel, arm, Arnd Bergmann, Catalin Marinas, Dave Airlie,
	Marc Zyngier, Mark Brown, Mauro Carvalho Chehab, Paul Walmsley,
	Rob Clark, Russell King, Sascha Hauer, Shawn Guo, Tony Lindgren,
	netdev

These are the patches I still need to cleanly build allyesconfig
and allmodconfig on arm-soc/for-next. Please review and provide
Acks where appropriate so we can add the fixes directly to the
branches that introduce the problems, or apply them directly
to a maintainer tree where appropriate.

The bulk of these patches happen to be omap specific, which
does not mean that we had a lot of regressions in omap, but
that we just started including omap in the multiplatform
builds, which has uncovered a number of older problems that
we did not see before.

	Arnd

Arnd Bergmann (9):
  ARM: arch_timer: include linux/errno.h
  ARM: imx: MACH_MX31ADS_WM1133_EV1 needs REGULATOR_WM8350
  ARM: omap2: include linux/errno.h in hwmod_reset
  ARM: omap: add include guard for soc.h
  drm: export drm_vm_open_locked
  net: cwdavinci_cpdma: export symbols for cpsw
  remoteproc: omap: depend on OMAP_MBOX_FWK
  [HACK] ARM: imx: work around v7_cpu_resume link error
  [media] davinci: do not include mach/hardware.h

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rob Clark <rob@ti.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Tony Lindgren <tony@atomide.com>
Cc: netdev@vger.kernel.org

 arch/arm/kernel/arch_timer.c            | 1 +
 arch/arm/mach-imx/Kconfig               | 2 +-
 arch/arm/mach-imx/headsmp.S             | 4 +++-
 arch/arm/mach-omap2/omap_hwmod_reset.c  | 1 +
 arch/arm/mach-omap2/soc.h               | 3 +++
 drivers/gpu/drm/drm_vm.c                | 1 +
 drivers/media/platform/davinci/vpss.c   | 1 -
 drivers/net/ethernet/ti/davinci_cpdma.c | 3 +++
 drivers/remoteproc/Kconfig              | 2 +-
 9 files changed, 14 insertions(+), 4 deletions(-)

-- 
1.8.1.2

^ permalink raw reply

* Re: [PATCH 1/5 net-next] tg3: Add 57766 device support.
From: Joe Perches @ 2013-02-14 22:25 UTC (permalink / raw)
  To: Michael Chan, Matt Carlson; +Cc: davem, netdev, nsujir
In-Reply-To: <1360880022-12856-1-git-send-email-mchan@broadcom.com>

On Thu, 2013-02-14 at 14:13 -0800, Michael Chan wrote:
> From: Matt Carlson <mcarlson@broadcom.com>
> 
> The patch also adds a couple of fixes
> 
>  - For the 57766, bootcode needs to setup the PCIE Fast Training
>    Sequence (FTS) value to prevent transmit hangs. Unfortunately, it
>    does not have enough room in the selfboot case (i.e. devices with no
>    NVRAM).  The driver needs to implement this.
[]
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
[]
> @@ -9179,7 +9180,14 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
>  		}
>  
>  		if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_57765_AX) {
> -			u32 grc_mode = tr32(GRC_MODE);
> +			u32 grc_mode;
> +
> +			/* Fix transmit hangs */
> +			val = tr32(TG3_CPMU_PADRNG_CTL);
> +			val |= TG3_CPMU_PADRNG_CTL_RDIV2;
> +			tw32(TG3_CPMU_PADRNG_CTL, val);
> +

This seems to write this val to more devices than just
a 57766.  Intentional?

> +			grc_mode = tr32(GRC_MODE);
>  
>  			/* Access the lower 1K of DL PCIE block registers. */
>  			val = grc_mode & ~GRC_MODE_PCIE_PORT_MASK;

^ permalink raw reply

* Re: [PATCH 2/5 net-next] tg3: Add EEE support for 5717 B0
From: David Miller @ 2013-02-14 22:19 UTC (permalink / raw)
  To: mchan; +Cc: netdev, nsujir
In-Reply-To: <1360880022-12856-2-git-send-email-mchan@broadcom.com>

From: "Michael Chan" <mchan@broadcom.com>
Date: Thu, 14 Feb 2013 14:13:39 -0800

> This chip supports Energy Efficient Ethernet.
> 
> Signed-off-by: Michael Chan <mchan@broadocm.com>

This looks more like the correction of an existing test rather
than adding a new one.

If that's the case, construct your commit message to match.

Thanks.

^ permalink raw reply

* Re: bonding inactive slaves vs rx_dropped
From: David Miller @ 2013-02-14 22:18 UTC (permalink / raw)
  To: fubar; +Cc: netdev, eric.dumazet, andy
In-Reply-To: <4606.1360878661@death.nxdomain>

From: Jay Vosburgh <fubar@us.ibm.com>
Date: Thu, 14 Feb 2013 13:51:01 -0800

> David Miller <davem@davemloft.net> wrote:
> 
>>People are starting to notice that rx_dropped now increments on every
>>packet received on an bond's inactive slave.
>>
>>I'm actually fine with rx_dropped incrementing in this situation.
>>
>>The problem I want to address is that rx_dropped is encompassing
>>several unrelated situations and thus has become less useful for
>>diagnosis.
>>
>>I think we should add some new RX stats such that we can get at
>>least a small amount of granularity for rx_dropped.
>>
>>This way team, bond, etc. can increment a new netdev_stats->rx_foo in
>>this situation, and then someone doing diagnosis can see that
>>rx_dropped and rx_foo are incrementing at similar rates.
> 
> 	This drop isn't really happening in bonding, though.  From
> looking at the code, it comes about because, for the inactive slave, the
> rx_handler call returns EXACT, and there aren't any exact match ptype
> bindings, so __netif_receive_skb throws it away.  This isn't always the
> case; sometimes there is an exact match, for things like iSCSI or FCoE
> that are really determined to get the packet.

This isn't even the whole story, it won't return 'exact' if the packet
from the inactive slave is broadcast or multicast.

My general rule is that every special case increments a special
'absurdity' statistic counter for the code :-)

> 	We could probably add an, oh, rx_dropped_inactive, or some
> variation on that theme, that is incremented at the end of
> __netif_receive_skb if deliver_exact is set, e.g., something like:

Yes, that looks fine to me.

> 	There's the separate questions of whether there should be more
> counters (e.g., drops in dev_skb_forward or enqueue_to_backlog), and how
> to deliver the counter(s) to user space.

Since there is some pain in adding counters, I think we should try to
find a nice (very small) set of cases to cover all at once.

^ permalink raw reply

* Re: xen-netback: fix oopes during shutdown and error handling
From: Christopher S. Aker @ 2013-02-14 21:57 UTC (permalink / raw)
  To: David Vrabel
  Cc: Ian Campbell, Konrad Rzeszutek Wilk, netdev, xen-devel,
	Jan Beulich, Wei Liu
In-Reply-To: <1360847938-11185-1-git-send-email-david.vrabel@citrix.com>

On 2/14/13 8:18 AM, David Vrabel wrote:
> These two netback patches fix oopes that may occur during shutdown or
> if a specific fatal error occurs.

On 2/14/13 11:39 AM, Ian Campbell wrote:
> Although I would like to add a Tested-by: Christopher too if
> possible.

Tested-by: Christopher S. Aker <caker@theshore.net> (and team)

We are no longer able to trigger the last OOPs we provided by downing 
the vif.  Further testing of the other issues will take time, but we're 
deploying a few patched hosts now.

Thanks!
-Chris

^ 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