Netdev List
 help / color / mirror / Atom feed
* [PATCH 4/7] phy,exynos: Add dependency on HAS_IOMEM
From: Richard Weinberger @ 2014-01-14 15:45 UTC (permalink / raw)
  To: kishon, anton, dwmw2, richardcochran, lidza.louina, gregkh, jic23,
	davem
  Cc: sebastian.hesselbarth, florian, thomas.petazzoni, lars, marex,
	acourbot, netdev, linux-kernel, driverdev-devel, devel, linux-iio,
	Richard Weinberger
In-Reply-To: <1389714345-20165-1-git-send-email-richard@nod.at>

On archs like S390 or um this driver cannot build nor work.
Make it depend on HAS_IOMEM to bypass build failures.

drivers/built-in.o: In function `exynos_mipi_video_phy_probe':
drivers/phy/phy-exynos-mipi-video.c:130: undefined reference to `devm_ioremap_resource'

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 drivers/phy/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 330ef2d..a8b17ce 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -16,6 +16,7 @@ config GENERIC_PHY
 	  framework should select this config.
 
 config PHY_EXYNOS_MIPI_VIDEO
+	depends on HAS_IOMEM
 	tristate "S5P/EXYNOS SoC series MIPI CSI-2/DSI PHY driver"
 	help
 	  Support for MIPI CSI-2 and MIPI DSI DPHY found on Samsung S5P
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 6/7] power,goldfish: Add dependency on HAS_IOMEM
From: Richard Weinberger @ 2014-01-14 15:45 UTC (permalink / raw)
  To: kishon, anton, dwmw2, richardcochran, lidza.louina, gregkh, jic23,
	davem
  Cc: sebastian.hesselbarth, florian, thomas.petazzoni, lars, marex,
	acourbot, netdev, linux-kernel, driverdev-devel, devel, linux-iio,
	Richard Weinberger
In-Reply-To: <1389714345-20165-1-git-send-email-richard@nod.at>

On archs like S390 or um this driver cannot build nor work.
Make it depend on HAS_IOMEM to bypass build failures.

drivers/built-in.o: In function `goldfish_battery_probe':
drivers/power/goldfish_battery.c:181: undefined reference to `devm_ioremap'

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 drivers/power/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index 85ad58c..32c6294 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -377,6 +377,7 @@ config AB8500_BM
 config BATTERY_GOLDFISH
 	tristate "Goldfish battery driver"
 	depends on GOLDFISH || COMPILE_TEST
+	depends on HAS_IOMEM
 	help
 	  Say Y to enable support for the battery and AC power in the
 	  Goldfish emulator.
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 7/7] staging,lpc32xx_adc: Add dependency on HAS_IOMEM
From: Richard Weinberger @ 2014-01-14 15:45 UTC (permalink / raw)
  To: kishon, anton, dwmw2, richardcochran, lidza.louina, gregkh, jic23,
	davem
  Cc: sebastian.hesselbarth, florian, thomas.petazzoni, lars, marex,
	acourbot, netdev, linux-kernel, driverdev-devel, devel, linux-iio,
	Richard Weinberger
In-Reply-To: <1389714345-20165-1-git-send-email-richard@nod.at>

On archs like S390 or um this driver cannot build nor work.
Make it depend on HAS_IOMEM to bypass build failures.

drivers/built-in.o: In function `lpc32xx_adc_probe':
drivers/staging/iio/adc/lpc32xx_adc.c:149: undefined reference to `devm_ioremap'

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 drivers/staging/iio/adc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig
index 7d5d675..3633298 100644
--- a/drivers/staging/iio/adc/Kconfig
+++ b/drivers/staging/iio/adc/Kconfig
@@ -103,6 +103,7 @@ config AD7280
 config LPC32XX_ADC
 	tristate "NXP LPC32XX ADC"
 	depends on ARCH_LPC32XX || COMPILE_TEST
+	depends on HAS_IOMEM
 	help
 	  Say yes here to build support for the integrated ADC inside the
 	  LPC32XX SoC. Note that this feature uses the same hardware as the
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 3/7] staging,spear_adc: Add dependency on HAS_IOMEM
From: Richard Weinberger @ 2014-01-14 15:45 UTC (permalink / raw)
  To: kishon, anton, dwmw2, richardcochran, lidza.louina, gregkh, jic23,
	davem
  Cc: sebastian.hesselbarth, florian, thomas.petazzoni, lars, marex,
	acourbot, netdev, linux-kernel, driverdev-devel, devel, linux-iio,
	Richard Weinberger
In-Reply-To: <1389714345-20165-1-git-send-email-richard@nod.at>

On archs like S390 or um this driver cannot build nor work.
Make it depend on HAS_IOMEM to bypass build failures.

drivers/staging/iio/adc/spear_adc.c: In function ‘spear_adc_probe’:
drivers/staging/iio/adc/spear_adc.c:393:2: error: implicit declaration of function ‘iounmap’ [-Werror=implicit-function-declaration

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 drivers/staging/iio/adc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig
index e3d6430..7d5d675 100644
--- a/drivers/staging/iio/adc/Kconfig
+++ b/drivers/staging/iio/adc/Kconfig
@@ -128,6 +128,7 @@ config MXS_LRADC
 config SPEAR_ADC
 	tristate "ST SPEAr ADC"
 	depends on PLAT_SPEAR || COMPILE_TEST
+	depends on HAS_IOMEM
 	help
 	  Say yes here to build support for the integrated ADC inside the
 	  ST SPEAr SoC. Provides direct access via sysfs.
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 5/7] net,marvell: Add dependency on HAS_IOMEM
From: Richard Weinberger @ 2014-01-14 15:45 UTC (permalink / raw)
  To: kishon, anton, dwmw2, richardcochran, lidza.louina, gregkh, jic23,
	davem
  Cc: sebastian.hesselbarth, florian, thomas.petazzoni, lars, marex,
	acourbot, netdev, linux-kernel, driverdev-devel, devel, linux-iio,
	Richard Weinberger
In-Reply-To: <1389714345-20165-1-git-send-email-richard@nod.at>

On archs like S390 or um this driver cannot build nor work.
Make it depend on HAS_IOMEM to bypass build failures.

drivers/built-in.o: In function `orion_mdio_probe':
drivers/net/ethernet/marvell/mvmdio.c:228: undefined reference to `devm_ioremap'

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 drivers/net/ethernet/marvell/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/marvell/Kconfig b/drivers/net/ethernet/marvell/Kconfig
index a49e81b..6300fd2 100644
--- a/drivers/net/ethernet/marvell/Kconfig
+++ b/drivers/net/ethernet/marvell/Kconfig
@@ -33,6 +33,7 @@ config MV643XX_ETH
 
 config MVMDIO
 	tristate "Marvell MDIO interface support"
+	depends on HAS_IOMEM
 	select PHYLIB
 	---help---
 	  This driver supports the MDIO interface found in the network
-- 
1.8.1.4

^ permalink raw reply related

* Re: [PATCH] usbnet: Fix dma setup for fragmented packets that need a pad byte appended.
From: Bjørn Mork @ 2014-01-14 15:48 UTC (permalink / raw)
  To: David Laight; +Cc: 'Eric Dumazet', netdev
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D45B492@AcuExch.aculab.com>

David Laight <David.Laight@ACULAB.COM> writes:

> I couldn't find the original patch anywhere!
> I did do quite a lot of looking as well - if I'd found it I've
> have done something else.

You obviously haven't looked the one place you are supposed to always
look before submitting *anything*:
https://git.kernel.org/cgit/linux/kernel/git/davem/net.git/commit/?id=fdc3452cd2c7b2bfe0f378f92123f4f9a98fa2bd

I am not impressed...



Bjørn

^ permalink raw reply

* Re: [PATCH] netfilter: Add dependency on IPV6 for NF_TABLES_INET
From: Paul Gortmaker @ 2014-01-14 15:49 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Patrick McHardy
  Cc: David S. Miller, Jozsef Kadlecsik, netfilter, netdev,
	netfilter-devel
In-Reply-To: <20140114153454.GA9425@localhost>

On 14-01-14 10:34 AM, Pablo Neira Ayuso wrote:
> On Tue, Jan 14, 2014 at 11:35:42AM +0000, Patrick McHardy wrote:
>> Paul Gortmaker <paul.gortmaker@windriver.com> schrieb:
>>> Commit 1d49144c0aaa61be4e3ccbef9cc5c40b0ec5f2fe ("netfilter: nf_tables:
>>> add "inet" table for IPv4/IPv6") allows creation of non-IPV6 enabled
>>> .config files that will fail to configure/link as follows:
>>>
>>> warning: (NF_TABLES_INET) selects NF_TABLES_IPV6 which has unmet direct
>>> dependencies (NET && INET && IPV6 && NETFILTER && NF_TABLES)
>>> warning: (NF_TABLES_INET) selects NF_TABLES_IPV6 which has unmet direct
>>> dependencies (NET && INET && IPV6 && NETFILTER && NF_TABLES)
>>> warning: (NF_TABLES_INET) selects NF_TABLES_IPV6 which has unmet direct
>>> dependencies (NET && INET && IPV6 && NETFILTER && NF_TABLES)
>>> net/built-in.o: In function `nft_reject_eval':
>>> nft_reject.c:(.text+0x651e8): undefined reference to `nf_ip6_checksum'
>>> nft_reject.c:(.text+0x65270): undefined reference to `ip6_route_output'
>>> nft_reject.c:(.text+0x656c4): undefined reference to `ip6_dst_hoplimit'
>>> make: *** [vmlinux] Error 1
>>>
>>> Since the feature is to allow for a mixed IPV4 and IPV6 table, it
>>> seems sensible to make it depend on IPV6.
>>
>> Acked-by: Patrick McHardy <kaber@trash.net>
> 
> Applied, thanks.
> 
> @Paul: Please, use netfilter-devel ML instead next time. The netfilter
> ML is reserved for user questions only. Thanks.

Sure, I can do that.  But it would probably be better if
get_maintainer.pl didn't emit that particular address then.

^ permalink raw reply

* Re: build_skb() and data corruption
From: Arnd Bergmann @ 2014-01-14 15:51 UTC (permalink / raw)
  To: Jonas Jensen
  Cc: netdev, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, alexander.h.duyck, Florian Fainelli,
	Ben Hutchings
In-Reply-To: <CACmBeS1gTfdjwiCkHMViOnF6G2zjy3HSMm3NVq8Jiq5F22ynJA@mail.gmail.com>

On Tuesday 14 January 2014, Jonas Jensen wrote:
> Thanks for the replies, you led me to a new solution,
> 
> 
> I now think build_skb() is not the right choice, my motivation for
> using it in the first place, that I thought it meant getting away with
> not copying memory.
> 
> build_skb() is replaced by netdev_alloc_skb_ip_align() and memcpy()
> (derived from drivers/net/ethernet/realtek/r8169.c).
> 
> Read errors are gone, even without syncing DMA. Is it a good idea to
> do it anyway, i.e. leave calls to dma_sync_single_* in?

The calls to dma_sync_single_* in the moxart_rx() function are needed.
The call to arm_dma_ops.sync_single_for_device() in
moxart_mac_setup_desc_ring() is wrong, because the buffer is already
owned by the device at that point (just after dma_map_single), and
because you should use the official dma_* api rather than using
the arm_dma_ops struct.

	Arnd

^ permalink raw reply

* Re: [PATCH net-next v2 0/2] stmmac: fix kernel crashes for jumbo frames
From: Dinh Nguyen @ 2014-01-14 15:52 UTC (permalink / raw)
  To: Vince Bridgers
  Cc: devicetree, netdev, peppe.cavallaro, robh+dt, pawel.moll,
	mark.rutland, ijc+devicetree, galak, rayagond
In-Reply-To: <1389710409-14106-1-git-send-email-vbridgers2013@gmail.com>

Hi Vince

On Tue, 2014-01-14 at 08:40 -0600, Vince Bridgers wrote:
> These patches address two kernel crashes seen when using jumbo frames on 
> the Synopsys stmmac driver, and adds device tree configurability for the 
> maximum mtu. The Synopsys emac fifo sizes can be configured when a logic
> design is synthesized, but does not provide a way for a driver to query the
> exact fifo size. 
> 
> The crashes seen were due to two issues. 
> 
> 1) The dma buffer size was being set after the dma buffers were allocated.
> This caused a crash when changing the mtu since it was possible the buffers
> would subsequently be freed using an incorrect dma buffer size. This could
> also cause kernel panics due to memory corruption since a large mtu size could
> have been configured, but the dma buffers were not sized accordingly. 
> 
> 2) Jumbo frames were being enabled by default, but the dma buffers were not
> sized accordingly. This caused memory corruption in the context of certain
> types of network traffic, leading to kernel panics. 
> 
> I've tested these changes using automated, reproducible testware. I can
> demonstrate the panics described before the fixes and show that the fixes
> address the problems described. 
> 
> Testing and improvements continue through the use of the mentioned automated
> and reproducible testware. 
> 
> Vince Bridgers
> 
> Vince Bridgers (2):
>   dts: Add a binding for Synopsys emac max-frame-size
>   stmmac: Fix kernel crashes for jumbo frames
> 
>  Documentation/devicetree/bindings/net/stmmac.txt   |    5 +++++
>  drivers/net/ethernet/stmicro/stmmac/common.h       |    4 +++-
>  drivers/net/ethernet/stmicro/stmmac/dwmac1000.h    |    7 ++-----
>  .../net/ethernet/stmicro/stmmac/dwmac1000_core.c   |    7 ++++++-
>  .../net/ethernet/stmicro/stmmac/dwmac100_core.c    |    2 +-
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |   11 +++++++----
>  .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |    5 +++++
>  include/linux/stmmac.h                             |    1 +
>  8 files changed, 30 insertions(+), 12 deletions(-)


What has changed since v1? A version log would be nice.

Thanks,
Dinh

^ permalink raw reply

* Re: [PATCH net-next v2 1/2] dts: Add a binding for Synopsys emac max-frame-size
From: Dinh Nguyen @ 2014-01-14 15:57 UTC (permalink / raw)
  To: Vince Bridgers
  Cc: devicetree, netdev, peppe.cavallaro, robh+dt, pawel.moll,
	mark.rutland, ijc+devicetree, galak, rayagond
In-Reply-To: <1389710409-14106-2-git-send-email-vbridgers2013@gmail.com>

On Tue, 2014-01-14 at 08:40 -0600, Vince Bridgers wrote:
> This change adds a parameter for the Synopsys 10/100/1000
> stmmac Ethernet driver to configure the maximum frame
> size supported by the EMAC driver. Synopsys allows the FIFO
> sizes to be configured when the cores are built for a particular
> device, but do not provide a way for the driver to read
> information from the device about the maximum MTU size
> supported as limited by the device's FIFO size.
> 
> Signed-off-by: Vince Bridgers <vbridgers2013@gmail.com>
> ---
>  Documentation/devicetree/bindings/net/stmmac.txt |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/net/stmmac.txt b/Documentation/devicetree/bindings/net/stmmac.txt
> index eba0e5e..26a0ba9 100644
> --- a/Documentation/devicetree/bindings/net/stmmac.txt
> +++ b/Documentation/devicetree/bindings/net/stmmac.txt
> @@ -30,6 +30,10 @@ Required properties:
>  
>  Optional properties:
>  - mac-address: 6 bytes, mac address
> +- snps,max-frame-size:	Maximum frame size permitted. This parameter is useful 

I don't think max-frame-size should be a snps-only binding.

Dinh
> +			since different implementations of the Synopsys MAC may 
> +			have different FIFO sizes depending on the selections
> +			made in Synopsys Core Consultant.


>  
>  Examples:
>  
> @@ -40,5 +44,6 @@ Examples:
>  		interrupts = <24 23>;
>  		interrupt-names = "macirq", "eth_wake_irq";
>  		mac-address = [000000000000]; /* Filled in by U-Boot */
> +		snps,max-frame-size = <3800>;
>  		phy-mode = "gmii";
>  	};

^ permalink raw reply

* [PATCH net-next V4 2/3] net: Export gro_find_by_type helpers
From: Or Gerlitz @ 2014-01-14 16:00 UTC (permalink / raw)
  To: davem; +Cc: netdev, hkchu, edumazet, herbert, yanb, shlomop, therbert,
	Or Gerlitz
In-Reply-To: <1389715212-14504-1-git-send-email-ogerlitz@mellanox.com>

Export the gro_find_receive/complete_by_type helpers to they can be invoked
by the gro callbacks of encapsulation protocols such as vxlan.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 net/core/dev.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index aafc07a..03cab5f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3949,6 +3949,7 @@ struct packet_offload *gro_find_receive_by_type(__be16 type)
 	}
 	return NULL;
 }
+EXPORT_SYMBOL(gro_find_receive_by_type);
 
 struct packet_offload *gro_find_complete_by_type(__be16 type)
 {
@@ -3962,6 +3963,7 @@ struct packet_offload *gro_find_complete_by_type(__be16 type)
 	}
 	return NULL;
 }
+EXPORT_SYMBOL(gro_find_complete_by_type);
 
 static gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb)
 {
-- 
1.7.1

^ permalink raw reply related

* [PATCH net-next V3 0/3] net: Add GRO support for UDP encapsulating protocols
From: Or Gerlitz @ 2014-01-14 16:00 UTC (permalink / raw)
  To: davem; +Cc: netdev, hkchu, edumazet, herbert, yanb, shlomop, therbert,
	Or Gerlitz

This series adds GRO handlers for protocols that do UDP encapsulation, with the
intent of being able to coalesce packets which encapsulate packets belonging to
the same TCP session.

For GRO purposes, the destination UDP port takes the role of the ether type
field in the ethernet header or the next protocol in the IP header.

The UDP GRO handler will only attempt to coalesce packets whose destination
port is registered to have gro handler.

The patches done against net-next ae237b3ede64 "net: 3com: fix 
warning for incorrect type in argument"

Or.


v3 --> v4 changes:

  - applied feedback from Tom on some micro-optimizations that save 
    branches and goto directives in the udp gro logic

 - applied feedback from Eric on correct RCU programming for the 
   add/remove flow of the upper protocols udp gro handlers


v2 --> v3 changes:

 - moved to use linked list to store the udp gro handlers, this solves the
   problem of consuming 512KB of memory for the handlers.

 - use a mark on the skb GRO CB data to disallow running the udp gro_receive twice
   on a packet, this solves the problem of udp encapsulated packets whose inner VM
   packet is udp and happen to carry a port which has registered offloads - and flush it.

 - invoke the udp offload protocol registration and de-registration from the vxlan driver
   in a sleepable context 

For unclear some reason I got this warning when the vxlan driver deletes the
udp offload structure 
*** BLURB HERE ***

Or Gerlitz (3):
  net: Add GRO support for UDP encapsulating protocols
  net: Export gro_find_by_type helpers
  net: Add GRO support for vxlan traffic

 drivers/net/vxlan.c       |  117 +++++++++++++++++++++++++++++++--
 include/linux/netdevice.h |   10 +++-
 include/net/protocol.h    |    3 +
 include/net/vxlan.h       |    1 +
 net/core/dev.c            |    3 +
 net/ipv4/udp_offload.c    |  157 +++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 283 insertions(+), 8 deletions(-)

^ permalink raw reply

* [PATCH net-next V4 1/3] net: Add GRO support for UDP encapsulating protocols
From: Or Gerlitz @ 2014-01-14 16:00 UTC (permalink / raw)
  To: davem; +Cc: netdev, hkchu, edumazet, herbert, yanb, shlomop, therbert,
	Or Gerlitz
In-Reply-To: <1389715212-14504-1-git-send-email-ogerlitz@mellanox.com>

Add GRO handlers for protocols that do UDP encapsulation, with the intent of
being able to coalesce packets which encapsulate packets belonging to
the same TCP session.

For GRO purposes, the destination UDP port takes the role of the ether type
field in the ethernet header or the next protocol in the IP header.

The UDP GRO handler will only attempt to coalesce packets whose destination
port is registered to have gro handler.

Use a mark on the skb GRO CB data to disallow (flush) running the udp gro receive
code twice on a packet. This solves the problem of udp encapsulated packets whose
inner VM packet is udp and happen to carry a port which has registered offloads.

Signed-off-by: Shlomo Pongratz <shlomop@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 include/linux/netdevice.h |   10 +++-
 include/net/protocol.h    |    3 +
 net/core/dev.c            |    1 +
 net/ipv4/udp_offload.c    |  157 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 170 insertions(+), 1 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index a2a70cc..efb942f 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1652,7 +1652,10 @@ struct napi_gro_cb {
 	unsigned long age;
 
 	/* Used in ipv6_gro_receive() */
-	int	proto;
+	u16	proto;
+
+	/* Used in udp_gro_receive */
+	u16	udp_mark;
 
 	/* used to support CHECKSUM_COMPLETE for tunneling protocols */
 	__wsum	csum;
@@ -1691,6 +1694,11 @@ struct packet_offload {
 	struct list_head	 list;
 };
 
+struct udp_offload {
+	__be16			 port;
+	struct offload_callbacks callbacks;
+};
+
 /* often modified stats are per cpu, other are shared (netdev->stats) */
 struct pcpu_sw_netstats {
 	u64     rx_packets;
diff --git a/include/net/protocol.h b/include/net/protocol.h
index 0e5f866..a7e986b 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -108,6 +108,9 @@ int inet_del_offload(const struct net_offload *prot, unsigned char num);
 void inet_register_protosw(struct inet_protosw *p);
 void inet_unregister_protosw(struct inet_protosw *p);
 
+int  udp_add_offload(struct udp_offload *prot);
+void udp_del_offload(struct udp_offload *prot);
+
 #if IS_ENABLED(CONFIG_IPV6)
 int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char num);
 int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char num);
diff --git a/net/core/dev.c b/net/core/dev.c
index 87312dc..aafc07a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3858,6 +3858,7 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
 		NAPI_GRO_CB(skb)->same_flow = 0;
 		NAPI_GRO_CB(skb)->flush = 0;
 		NAPI_GRO_CB(skb)->free = 0;
+		NAPI_GRO_CB(skb)->udp_mark = 0;
 
 		pp = ptype->callbacks.gro_receive(&napi->gro_list, skb);
 		break;
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
index 79c62bd..11785ac 100644
--- a/net/ipv4/udp_offload.c
+++ b/net/ipv4/udp_offload.c
@@ -14,6 +14,16 @@
 #include <net/udp.h>
 #include <net/protocol.h>
 
+static DEFINE_SPINLOCK(udp_offload_lock);
+static struct udp_offload_priv *udp_offload_base __read_mostly;
+
+struct udp_offload_priv {
+	struct udp_offload	*offload;
+	struct rcu_head		rcu;
+	atomic_t		refcount;
+	struct udp_offload_priv __rcu *next;
+};
+
 static int udp4_ufo_send_check(struct sk_buff *skb)
 {
 	if (!pskb_may_pull(skb, sizeof(struct udphdr)))
@@ -89,10 +99,157 @@ out:
 	return segs;
 }
 
+int udp_add_offload(struct udp_offload *uo)
+{
+	struct udp_offload_priv **head = &udp_offload_base;
+	struct udp_offload_priv *new_offload = kzalloc(sizeof(*new_offload), GFP_KERNEL);
+
+	if (!new_offload)
+		return -ENOMEM;
+
+	new_offload->offload = uo;
+	atomic_set(&new_offload->refcount, 1);
+
+	spin_lock(&udp_offload_lock);
+	rcu_assign_pointer(new_offload->next, rcu_dereference(*head));
+	rcu_assign_pointer(*head, rcu_dereference(new_offload));
+	spin_unlock(&udp_offload_lock);
+
+	return 0;
+}
+EXPORT_SYMBOL(udp_add_offload);
+
+static void udp_offload_free_routine(struct rcu_head *head)
+{
+	struct udp_offload_priv *ou_priv = container_of(head, struct udp_offload_priv, rcu);
+	kfree(ou_priv);
+}
+
+static void udp_offload_put(struct udp_offload_priv *uo_priv)
+{
+	if (atomic_dec_and_test(&uo_priv->refcount))
+		call_rcu(&uo_priv->rcu, udp_offload_free_routine);
+}
+
+void udp_del_offload(struct udp_offload *uo)
+{
+	struct udp_offload_priv __rcu **head = &udp_offload_base;
+	struct udp_offload_priv *uo_priv;
+
+	spin_lock(&udp_offload_lock);
+
+	uo_priv = rcu_dereference(*head);
+	for (; uo_priv != NULL;
+		uo_priv = rcu_dereference(*head)) {
+
+		if (uo_priv->offload == uo) {
+			rcu_assign_pointer(*head, rcu_dereference(uo_priv->next));
+			udp_offload_put(uo_priv);
+			goto unlock;
+		}
+		head = &uo_priv->next;
+	}
+	pr_warn("udp_del_offload: didn't find offload for port %d\n", htons(uo->port));
+unlock:
+	spin_unlock(&udp_offload_lock);
+}
+EXPORT_SYMBOL(udp_del_offload);
+
+static struct sk_buff **udp_gro_receive(struct sk_buff **head, struct sk_buff *skb)
+{
+	struct udp_offload_priv *uo_priv;
+	struct sk_buff *p, **pp = NULL;
+	struct udphdr *uh, *uh2;
+	unsigned int hlen, off;
+	int flush = 1;
+
+	if (NAPI_GRO_CB(skb)->udp_mark ||
+	    (!skb->encapsulation && skb->ip_summed != CHECKSUM_COMPLETE))
+		goto out;
+
+	/* mark that this skb passed once through the udp gro layer */
+	NAPI_GRO_CB(skb)->udp_mark = 1;
+
+	off  = skb_gro_offset(skb);
+	hlen = off + sizeof(*uh);
+	uh   = skb_gro_header_fast(skb, off);
+	if (skb_gro_header_hard(skb, hlen)) {
+		uh = skb_gro_header_slow(skb, hlen, off);
+		if (unlikely(!uh))
+			goto out;
+	}
+
+	rcu_read_lock();
+	uo_priv = rcu_dereference(udp_offload_base);
+	for (; uo_priv != NULL; uo_priv = rcu_dereference(uo_priv->next)) {
+		if (uo_priv->offload->port == uh->dest &&
+		    uo_priv->offload->callbacks.gro_receive) {
+			atomic_inc(&uo_priv->refcount);
+			goto unflush;
+		}
+	}
+	rcu_read_unlock();
+	goto out;
+
+unflush:
+	rcu_read_unlock();
+	flush = 0;
+
+	for (p = *head; p; p = p->next) {
+		if (!NAPI_GRO_CB(p)->same_flow)
+			continue;
+
+		uh2 = (struct udphdr   *)(p->data + off);
+		if ((*(u32 *)&uh->source != *(u32 *)&uh2->source)) {
+			NAPI_GRO_CB(p)->same_flow = 0;
+			continue;
+		}
+	}
+
+	skb_gro_pull(skb, sizeof(struct udphdr)); /* pull encapsulating udp header */
+	pp = uo_priv->offload->callbacks.gro_receive(head, skb);
+	udp_offload_put(uo_priv);
+
+out:
+	NAPI_GRO_CB(skb)->flush |= flush;
+	return pp;
+}
+
+static int udp_gro_complete(struct sk_buff *skb, int nhoff)
+{
+	struct udp_offload_priv *uo_priv;
+	__be16 newlen = htons(skb->len - nhoff);
+	struct udphdr *uh = (struct udphdr *)(skb->data + nhoff);
+	int err = -ENOSYS;
+
+	uh->len = newlen;
+
+	rcu_read_lock();
+
+	uo_priv = rcu_dereference(udp_offload_base);
+	for (; uo_priv != NULL; uo_priv = rcu_dereference(uo_priv->next)) {
+		if (uo_priv->offload->port == uh->dest &&
+		    uo_priv->offload->callbacks.gro_complete)
+			goto found;
+	}
+
+	rcu_read_unlock();
+	return err;
+
+found:
+	atomic_inc(&uo_priv->refcount);
+	rcu_read_unlock();
+	err = uo_priv->offload->callbacks.gro_complete(skb, nhoff + sizeof(struct udphdr));
+	udp_offload_put(uo_priv);
+	return err;
+}
+
 static const struct net_offload udpv4_offload = {
 	.callbacks = {
 		.gso_send_check = udp4_ufo_send_check,
 		.gso_segment = udp4_ufo_fragment,
+		.gro_receive  =	udp_gro_receive,
+		.gro_complete =	udp_gro_complete,
 	},
 };
 
-- 
1.7.1

^ permalink raw reply related

* [PATCH net-next V4 3/3] net: Add GRO support for vxlan traffic
From: Or Gerlitz @ 2014-01-14 16:00 UTC (permalink / raw)
  To: davem; +Cc: netdev, hkchu, edumazet, herbert, yanb, shlomop, therbert,
	Or Gerlitz
In-Reply-To: <1389715212-14504-1-git-send-email-ogerlitz@mellanox.com>

Add GRO handlers for vxlann, by using the UDP GRO infrastructure.

For single TCP session that goes through vxlan tunneling I got nice
improvement from 6.8Gbs to 11.5Gbs

--> UDP/VXLAN GRO disabled
$ netperf  -H 192.168.52.147 -c -C

$ netperf -t TCP_STREAM -H 192.168.52.147 -c -C
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.52.147 () port 0 AF_INET
Recv   Send    Send                          Utilization       Service Demand
Socket Socket  Message  Elapsed              Send     Recv     Send    Recv
Size   Size    Size     Time     Throughput  local    remote   local   remote
bytes  bytes   bytes    secs.    10^6bits/s  % S      % S      us/KB   us/KB

 87380  65536  65536    10.00      6799.75   12.54    24.79    0.604   1.195

--> UDP/VXLAN GRO enabled

$ netperf -t TCP_STREAM -H 192.168.52.147 -c -C
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.52.147 () port 0 AF_INET
Recv   Send    Send                          Utilization       Service Demand
Socket Socket  Message  Elapsed              Send     Recv     Send    Recv
Size   Size    Size     Time     Throughput  local    remote   local   remote
bytes  bytes   bytes    secs.    10^6bits/s  % S      % S      us/KB   us/KB

 87380  65536  65536    10.00      11562.72   24.90    20.34    0.706   0.577

Signed-off-by: Shlomo Pongratz <shlomop@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/vxlan.c |  117 +++++++++++++++++++++++++++++++++++++++++++++++---
 include/net/vxlan.h |    1 +
 2 files changed, 111 insertions(+), 7 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 481f85d..27a25ce 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -40,6 +40,7 @@
 #include <net/net_namespace.h>
 #include <net/netns/generic.h>
 #include <net/vxlan.h>
+#include <net/protocol.h>
 #if IS_ENABLED(CONFIG_IPV6)
 #include <net/ipv6.h>
 #include <net/addrconf.h>
@@ -554,13 +555,106 @@ static int vxlan_fdb_append(struct vxlan_fdb *f,
 	return 1;
 }
 
+static struct sk_buff **vxlan_gro_receive(struct sk_buff **head, struct sk_buff *skb)
+{
+	struct sk_buff *p, **pp = NULL;
+	struct vxlanhdr *vh, *vh2;
+	struct ethhdr *eh, *eh2;
+	unsigned int hlen, off_vx, off_eth;
+	const struct packet_offload *ptype;
+	__be16 type;
+	int flush = 1;
+
+	off_vx = skb_gro_offset(skb);
+	hlen = off_vx + sizeof(*vh);
+	vh   = skb_gro_header_fast(skb, off_vx);
+	if (skb_gro_header_hard(skb, hlen)) {
+		vh = skb_gro_header_slow(skb, hlen, off_vx);
+		if (unlikely(!vh))
+			goto out;
+	}
+	skb_gro_pull(skb, sizeof(struct vxlanhdr)); /* pull vxlan header */
+
+	off_eth = skb_gro_offset(skb);
+	hlen = off_eth + sizeof(*eh);
+	eh   = skb_gro_header_fast(skb, off_eth);
+	if (skb_gro_header_hard(skb, hlen)) {
+		eh = skb_gro_header_slow(skb, hlen, off_eth);
+		if (unlikely(!eh))
+			goto out;
+	}
+
+	flush = 0;
+
+	for (p = *head; p; p = p->next) {
+		if (!NAPI_GRO_CB(p)->same_flow)
+			continue;
+
+		vh2 = (struct vxlanhdr *)(p->data + off_vx);
+		eh2 = (struct ethhdr   *)(p->data + off_eth);
+		if (vh->vx_vni != vh2->vx_vni || compare_ether_header(eh, eh2)) {
+			NAPI_GRO_CB(p)->same_flow = 0;
+			continue;
+		}
+		goto found;
+	}
+
+found:
+	type = eh->h_proto;
+
+	rcu_read_lock();
+	ptype = gro_find_receive_by_type(type);
+	if (ptype == NULL) {
+		flush = 1;
+		goto out_unlock;
+	}
+
+	skb_gro_pull(skb, sizeof(*eh)); /* pull inner eth header */
+	pp = ptype->callbacks.gro_receive(head, skb);
+
+out_unlock:
+	rcu_read_unlock();
+out:
+	NAPI_GRO_CB(skb)->flush |= flush;
+
+	return pp;
+}
+
+static int vxlan_gro_complete(struct sk_buff *skb, int nhoff)
+{
+	struct ethhdr *eh;
+	struct packet_offload *ptype;
+	__be16 type;
+	int vxlan_len  = sizeof(struct vxlanhdr) + sizeof(struct ethhdr);
+	int err = -ENOSYS;
+
+	eh = (struct ethhdr *)(skb->data + nhoff + sizeof(struct vxlanhdr));
+	type = eh->h_proto;
+
+	rcu_read_lock();
+	ptype = gro_find_complete_by_type(type);
+	if (ptype != NULL)
+		err = ptype->callbacks.gro_complete(skb, nhoff + vxlan_len);
+
+	rcu_read_unlock();
+	return err;
+}
+
 /* Notify netdevs that UDP port started listening */
-static void vxlan_notify_add_rx_port(struct sock *sk)
+static void vxlan_notify_add_rx_port(struct vxlan_sock *vs)
 {
 	struct net_device *dev;
+	struct sock *sk = vs->sock->sk;
 	struct net *net = sock_net(sk);
 	sa_family_t sa_family = sk->sk_family;
 	__be16 port = inet_sk(sk)->inet_sport;
+	int err;
+
+	if (sa_family == AF_INET) {
+		err = udp_add_offload(&vs->udp_offloads);
+		if (err)
+			pr_warn("vxlan: udp_add_offload failed with status %d\n", err);
+	}
 
 	rcu_read_lock();
 	for_each_netdev_rcu(net, dev) {
@@ -572,9 +666,10 @@ static void vxlan_notify_add_rx_port(struct sock *sk)
 }
 
 /* Notify netdevs that UDP port is no more listening */
-static void vxlan_notify_del_rx_port(struct sock *sk)
+static void vxlan_notify_del_rx_port(struct vxlan_sock *vs)
 {
 	struct net_device *dev;
+	struct sock *sk = vs->sock->sk;
 	struct net *net = sock_net(sk);
 	sa_family_t sa_family = sk->sk_family;
 	__be16 port = inet_sk(sk)->inet_sport;
@@ -586,6 +681,9 @@ static void vxlan_notify_del_rx_port(struct sock *sk)
 							    port);
 	}
 	rcu_read_unlock();
+
+	if (sa_family == AF_INET)
+		udp_del_offload(&vs->udp_offloads);
 }
 
 /* Add new entry to forwarding table -- assumes lock held */
@@ -964,7 +1062,7 @@ void vxlan_sock_release(struct vxlan_sock *vs)
 	spin_lock(&vn->sock_lock);
 	hlist_del_rcu(&vs->hlist);
 	rcu_assign_sk_user_data(vs->sock->sk, NULL);
-	vxlan_notify_del_rx_port(sk);
+	vxlan_notify_del_rx_port(vs);
 	spin_unlock(&vn->sock_lock);
 
 	queue_work(vxlan_wq, &vs->del_work);
@@ -1125,8 +1223,8 @@ static void vxlan_rcv(struct vxlan_sock *vs,
 	 * leave the CHECKSUM_UNNECESSARY, the device checksummed it
 	 * for us. Otherwise force the upper layers to verify it.
 	 */
-	if (skb->ip_summed != CHECKSUM_UNNECESSARY || !skb->encapsulation ||
-	    !(vxlan->dev->features & NETIF_F_RXCSUM))
+	if ((skb->ip_summed != CHECKSUM_UNNECESSARY && skb->ip_summed != CHECKSUM_PARTIAL) ||
+	    !skb->encapsulation || !(vxlan->dev->features & NETIF_F_RXCSUM))
 		skb->ip_summed = CHECKSUM_NONE;
 
 	skb->encapsulation = 0;
@@ -2304,7 +2402,7 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port,
 	struct sock *sk;
 	unsigned int h;
 
-	vs = kmalloc(sizeof(*vs), GFP_KERNEL);
+	vs = kzalloc(sizeof(*vs), GFP_KERNEL);
 	if (!vs)
 		return ERR_PTR(-ENOMEM);
 
@@ -2329,9 +2427,14 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port,
 	vs->data = data;
 	rcu_assign_sk_user_data(vs->sock->sk, vs);
 
+	/* Initialize the vxlan udp offloads structure */
+	vs->udp_offloads.port = port;
+	vs->udp_offloads.callbacks.gro_receive  = vxlan_gro_receive;
+	vs->udp_offloads.callbacks.gro_complete = vxlan_gro_complete;
+
 	spin_lock(&vn->sock_lock);
 	hlist_add_head_rcu(&vs->hlist, vs_head(net, port));
-	vxlan_notify_add_rx_port(sk);
+	vxlan_notify_add_rx_port(vs);
 	spin_unlock(&vn->sock_lock);
 
 	/* Mark socket as an encapsulation socket. */
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index 6b6d180..5deef1a 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -21,6 +21,7 @@ struct vxlan_sock {
 	struct rcu_head	  rcu;
 	struct hlist_head vni_list[VNI_HASH_SIZE];
 	atomic_t	  refcnt;
+	struct udp_offload udp_offloads;
 };
 
 struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port,
-- 
1.7.1

^ permalink raw reply related

* Re: [PATCH net-next v2 1/2] dts: Add a binding for Synopsys emac max-frame-size
From: Florian Fainelli @ 2014-01-14 16:07 UTC (permalink / raw)
  To: Dinh Nguyen
  Cc: Vince Bridgers, devicetree, netdev, peppe.cavallaro, robh+dt,
	pawel.moll, mark.rutland, ijc+devicetree, galak, rayagond
In-Reply-To: <1389715056.10673.9.camel@linux-builds1>

Le mardi 14 janvier 2014, 09:57:36 Dinh Nguyen a écrit :
> On Tue, 2014-01-14 at 08:40 -0600, Vince Bridgers wrote:
> > This change adds a parameter for the Synopsys 10/100/1000
> > stmmac Ethernet driver to configure the maximum frame
> > size supported by the EMAC driver. Synopsys allows the FIFO
> > sizes to be configured when the cores are built for a particular
> > device, but do not provide a way for the driver to read
> > information from the device about the maximum MTU size
> > supported as limited by the device's FIFO size.
> > 
> > Signed-off-by: Vince Bridgers <vbridgers2013@gmail.com>
> > ---
> > 
> >  Documentation/devicetree/bindings/net/stmmac.txt |    5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/net/stmmac.txt
> > b/Documentation/devicetree/bindings/net/stmmac.txt index eba0e5e..26a0ba9
> > 100644
> > --- a/Documentation/devicetree/bindings/net/stmmac.txt
> > +++ b/Documentation/devicetree/bindings/net/stmmac.txt
> > 
> > @@ -30,6 +30,10 @@ Required properties:
> >  Optional properties:
> >  - mac-address: 6 bytes, mac address
> > 
> > +- snps,max-frame-size:	Maximum frame size permitted. This parameter is
> > useful
> I don't think max-frame-size should be a snps-only binding.

Right, and I already made that comment to Vince. Maybe this is just an 
oversight and mistakenly resubmitted v2 instead of v3?
-- 
Florian

^ permalink raw reply

* Re: [PATCH net-next V3 0/3] net: Add GRO support for UDP encapsulating protocols
From: Or Gerlitz @ 2014-01-14 16:06 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <1389715212-14504-1-git-send-email-ogerlitz@mellanox.com>

On 14/01/2014 18:00, Or Gerlitz wrote:
> This series adds GRO handlers for protocols that do UDP encapsulation, with the
> intent of being able to coalesce packets which encapsulate packets belonging to
> the same TCP session.
>
> For GRO purposes, the destination UDP port takes the role of the ether type
> field in the ethernet header or the next protocol in the IP header.
>
> The UDP GRO handler will only attempt to coalesce packets whose destination
> port is registered to have gro handler.
>
> The patches done against net-next ae237b3ede64 "net: 3com: fix
> warning for incorrect type in argument"
>
> Or.
>
>
> v3 --> v4 changes:
>
>    - applied feedback from Tom on some micro-optimizations that save
>      branches and goto directives in the udp gro logic
>
>   - applied feedback from Eric on correct RCU programming for the
>     add/remove flow of the upper protocols udp gro handlers
>
>
> v2 --> v3 changes:
>
>   - moved to use linked list to store the udp gro handlers, this solves the
>     problem of consuming 512KB of memory for the handlers.
>
>   - use a mark on the skb GRO CB data to disallow running the udp gro_receive twice
>     on a packet, this solves the problem of udp encapsulated packets whose inner VM
>     packet is udp and happen to carry a port which has registered offloads - and flush it.
>
>   - invoke the udp offload protocol registration and de-registration from the vxlan driver
>     in a sleepable context
>
> For unclear some reason I got this warning when the vxlan driver deletes the
> udp offload structure
> *** BLURB HERE ***

Sorry for the spam, the above three lines are leftovers from the V3 
cover letter, same for the subject line of this
cover-letter which carries "V3" this *is* V4, will make sure to avoid 
such flushes (....) in the future.

Or.

>
> Or Gerlitz (3):
>    net: Add GRO support for UDP encapsulating protocols
>    net: Export gro_find_by_type helpers
>    net: Add GRO support for vxlan traffic
>
>   drivers/net/vxlan.c       |  117 +++++++++++++++++++++++++++++++--
>   include/linux/netdevice.h |   10 +++-
>   include/net/protocol.h    |    3 +
>   include/net/vxlan.h       |    1 +
>   net/core/dev.c            |    3 +
>   net/ipv4/udp_offload.c    |  157 +++++++++++++++++++++++++++++++++++++++++++++
>   6 files changed, 283 insertions(+), 8 deletions(-)
>

^ permalink raw reply

* Re: [PATCH net-next 09/10] can: use __dev_get_by_index instead of dev_get_by_index to find interface
From: Oliver Hartkopp @ 2014-01-14 16:11 UTC (permalink / raw)
  To: Ying Xue, davem
  Cc: vfalico, john.r.fastabend, stephen, antonio, dmitry.tarnyagin,
	johannes, netdev, linux-kernel
In-Reply-To: <1389685269-18600-10-git-send-email-ying.xue@windriver.com>



On 14.01.2014 08:41, Ying Xue wrote:
> As cgw_create_job() is always under rtnl_lock protection,
> __dev_get_by_index() instead of dev_get_by_index() should be used to
> find interface handler in it having us avoid to change interface
> reference counter.
> 
> Cc: Oliver Hartkopp <socketcan@hartkopp.net>
> Signed-off-by: Ying Xue <ying.xue@windriver.com>

Thanks for the simplification!

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>


> ---
>  net/can/gw.c |   15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/net/can/gw.c b/net/can/gw.c
> index 88c8a39..ac31891 100644
> --- a/net/can/gw.c
> +++ b/net/can/gw.c
> @@ -839,21 +839,21 @@ static int cgw_create_job(struct sk_buff *skb,  struct nlmsghdr *nlh)
>  	if (!gwj->ccgw.src_idx || !gwj->ccgw.dst_idx)
>  		goto out;
>  
> -	gwj->src.dev = dev_get_by_index(&init_net, gwj->ccgw.src_idx);
> +	gwj->src.dev = __dev_get_by_index(&init_net, gwj->ccgw.src_idx);
>  
>  	if (!gwj->src.dev)
>  		goto out;
>  
>  	if (gwj->src.dev->type != ARPHRD_CAN)
> -		goto put_src_out;
> +		goto out;
>  
> -	gwj->dst.dev = dev_get_by_index(&init_net, gwj->ccgw.dst_idx);
> +	gwj->dst.dev = __dev_get_by_index(&init_net, gwj->ccgw.dst_idx);
>  
>  	if (!gwj->dst.dev)
> -		goto put_src_out;
> +		goto out;
>  
>  	if (gwj->dst.dev->type != ARPHRD_CAN)
> -		goto put_src_dst_out;
> +		goto out;
>  
>  	gwj->limit_hops = limhops;
>  
> @@ -862,11 +862,6 @@ static int cgw_create_job(struct sk_buff *skb,  struct nlmsghdr *nlh)
>  	err = cgw_register_filter(gwj);
>  	if (!err)
>  		hlist_add_head_rcu(&gwj->list, &cgw_list);
> -
> -put_src_dst_out:
> -	dev_put(gwj->dst.dev);
> -put_src_out:
> -	dev_put(gwj->src.dev);
>  out:
>  	if (err)
>  		kmem_cache_free(cgw_cache, gwj);
> 

^ permalink raw reply

* [PATCH] [trivial] ixgbe: Fix format string in ixgbe_fcoe.c
From: Masanari Iida @ 2014-01-14 16:14 UTC (permalink / raw)
  To: jeffrey.t.kirsher, jesse.brandeburg, bruce.w.allan, e1000-devel,
	netdev, linux-kernel, trivial
  Cc: Masanari Iida

cppcheck detected following warning in ixgbe_fcoe.c
(warning) %d in format string (no. 1) requires 'int' but the
argument type is 'unsigned int'.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
index f58db45..0872617 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
@@ -585,7 +585,7 @@ static int ixgbe_fcoe_dma_pool_alloc(struct ixgbe_fcoe *fcoe,
 	struct dma_pool *pool;
 	char pool_name[32];
 
-	snprintf(pool_name, 32, "ixgbe_fcoe_ddp_%d", cpu);
+	snprintf(pool_name, 32, "ixgbe_fcoe_ddp_%u", cpu);
 
 	pool = dma_pool_create(pool_name, dev, IXGBE_FCPTR_MAX,
 			       IXGBE_FCPTR_ALIGN, PAGE_SIZE);
-- 
1.8.5.2.309.ga25014b

^ permalink raw reply related

* [PATCH net-next] openvswitch: Pad OVS_PACKET_ATTR_PACKET if linear copy was performed
From: Thomas Graf @ 2014-01-14 16:16 UTC (permalink / raw)
  To: Zoltan Kiss
  Cc: Thomas Graf, Jesse Gross, David Miller, dev@openvswitch.org,
	netdev
In-Reply-To: <52D52E0A.4050700@citrix.com>

While the zerocopy method is correctly omitted if user space
does not support unaligned Netlink messages. The attribute is
still not padded correctly as skb_zerocopy() will not ensure
padding and the attribute size is no longer pre calculated
though nla_reserve() which ensured padding previously.

This patch applies appropriate padding if a linear data copy
was performed in skb_zerocopy().

Signed-off-by: Thomas Graf <tgraf@suug.ch>
---
 net/openvswitch/datapath.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index df46928..24e93f5 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -396,7 +396,7 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
 		.dst_sk = ovs_dp_get_net(dp)->genl_sock,
 		.snd_portid = upcall_info->portid,
 	};
-	size_t len;
+	size_t len, plen;
 	unsigned int hlen;
 	int err, dp_ifindex;
 
@@ -466,6 +466,11 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
 
 	skb_zerocopy(user_skb, skb, skb->len, hlen);
 
+	/* Pad OVS_PACKET_ATTR_PACKET if linear copy was performed */
+	if (!(dp->user_features & OVS_DP_F_UNALIGNED) &&
+	    (plen = (ALIGN(user_skb->len, NLA_ALIGNTO) - user_skb->len)) > 0)
+		skb_put(user_skb, plen);
+
 	((struct nlmsghdr *) user_skb->data)->nlmsg_len = user_skb->len;
 
 	err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid);

^ permalink raw reply related

* Re: [PATCH net-next] openvswitch: Pad OVS_PACKET_ATTR_PACKET if linear copy was performed
From: Thomas Graf @ 2014-01-14 16:19 UTC (permalink / raw)
  To: Zoltan Kiss
  Cc: Thomas Graf, Jesse Gross, David Miller, dev@openvswitch.org,
	netdev
In-Reply-To: <20140114161640.GA24121@casper.infradead.org>

On 01/14/14 at 04:16pm, Thomas Graf wrote:
> While the zerocopy method is correctly omitted if user space
> does not support unaligned Netlink messages. The attribute is
> still not padded correctly as skb_zerocopy() will not ensure
> padding and the attribute size is no longer pre calculated
> though nla_reserve() which ensured padding previously.
> 
> This patch applies appropriate padding if a linear data copy
> was performed in skb_zerocopy().
> 
> Signed-off-by: Thomas Graf <tgraf@suug.ch>
> ---
>  net/openvswitch/datapath.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
> index df46928..24e93f5 100644
> --- a/net/openvswitch/datapath.c
> +++ b/net/openvswitch/datapath.c
> @@ -396,7 +396,7 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
>  		.dst_sk = ovs_dp_get_net(dp)->genl_sock,
>  		.snd_portid = upcall_info->portid,
>  	};
> -	size_t len;
> +	size_t len, plen;
>  	unsigned int hlen;
>  	int err, dp_ifindex;
>  
> @@ -466,6 +466,11 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
>  
>  	skb_zerocopy(user_skb, skb, skb->len, hlen);
>  
> +	/* Pad OVS_PACKET_ATTR_PACKET if linear copy was performed */
> +	if (!(dp->user_features & OVS_DP_F_UNALIGNED) &&
> +	    (plen = (ALIGN(user_skb->len, NLA_ALIGNTO) - user_skb->len)) > 0)
> +		skb_put(user_skb, plen);

While this fixes the padding issue, it leaves the padding
uninitialized, I will send v2 with an additional memset().

^ permalink raw reply

* [PATCH net-next v2] openvswitch: Pad OVS_PACKET_ATTR_PACKET if linear copy was performed
From: Thomas Graf @ 2014-01-14 16:27 UTC (permalink / raw)
  To: Zoltan Kiss
  Cc: Thomas Graf, Jesse Gross, David Miller, dev@openvswitch.org,
	netdev
In-Reply-To: <20140114161911.GB24121@casper.infradead.org>

While the zerocopy method is correctly omitted if user space
does not support unaligned Netlink messages. The attribute is
still not padded correctly as skb_zerocopy() will not ensure
padding and the attribute size is no longer pre calculated
though nla_reserve() which ensured padding previously.

This patch applies appropriate padding if a linear data copy
was performed in skb_zerocopy().

Signed-off-by: Thomas Graf <tgraf@suug.ch>
---
v2: initialize padding to 0's

 net/openvswitch/datapath.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index df46928..3ca9121 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -396,7 +396,7 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
 		.dst_sk = ovs_dp_get_net(dp)->genl_sock,
 		.snd_portid = upcall_info->portid,
 	};
-	size_t len;
+	size_t len, plen;
 	unsigned int hlen;
 	int err, dp_ifindex;
 
@@ -466,6 +466,11 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
 
 	skb_zerocopy(user_skb, skb, skb->len, hlen);
 
+	/* Pad OVS_PACKET_ATTR_PACKET if linear copy was performed */
+	if (!(dp->user_features & OVS_DP_F_UNALIGNED) &&
+	    (plen = (ALIGN(user_skb->len, NLA_ALIGNTO) - user_skb->len)) > 0)
+		memset(skb_put(user_skb, plen), 0, plen);
+
 	((struct nlmsghdr *) user_skb->data)->nlmsg_len = user_skb->len;
 
 	err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid);

^ permalink raw reply related

* Re: [PATCH net-next v2 1/2] dts: Add a binding for Synopsys emac max-frame-size
From: Vince Bridgers @ 2014-01-14 16:30 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Dinh Nguyen, devicetree, netdev, Giuseppe CAVALLARO, robh+dt,
	pawel.moll, mark.rutland, ijc+devicetree, Kumar Gala,
	Rayagond Kokatanur
In-Reply-To: <1890114.hPeOerbe4b@lenovo>

I'll address comments and resubmit.

Vince

On Tue, Jan 14, 2014 at 10:07 AM, Florian Fainelli <f.fainelli@gmail.com> wrote:
> Le mardi 14 janvier 2014, 09:57:36 Dinh Nguyen a écrit :
>> On Tue, 2014-01-14 at 08:40 -0600, Vince Bridgers wrote:
>> > This change adds a parameter for the Synopsys 10/100/1000
>> > stmmac Ethernet driver to configure the maximum frame
>> > size supported by the EMAC driver. Synopsys allows the FIFO
>> > sizes to be configured when the cores are built for a particular
>> > device, but do not provide a way for the driver to read
>> > information from the device about the maximum MTU size
>> > supported as limited by the device's FIFO size.
>> >
>> > Signed-off-by: Vince Bridgers <vbridgers2013@gmail.com>
>> > ---
>> >
>> >  Documentation/devicetree/bindings/net/stmmac.txt |    5 +++++
>> >  1 file changed, 5 insertions(+)
>> >
>> > diff --git a/Documentation/devicetree/bindings/net/stmmac.txt
>> > b/Documentation/devicetree/bindings/net/stmmac.txt index eba0e5e..26a0ba9
>> > 100644
>> > --- a/Documentation/devicetree/bindings/net/stmmac.txt
>> > +++ b/Documentation/devicetree/bindings/net/stmmac.txt
>> >
>> > @@ -30,6 +30,10 @@ Required properties:
>> >  Optional properties:
>> >  - mac-address: 6 bytes, mac address
>> >
>> > +- snps,max-frame-size:     Maximum frame size permitted. This parameter is
>> > useful
>> I don't think max-frame-size should be a snps-only binding.
>
> Right, and I already made that comment to Vince. Maybe this is just an
> oversight and mistakenly resubmitted v2 instead of v3?
> --
> Florian

^ permalink raw reply

* [PATCH net-next 1/2] net: add sysfs helpers for netdev_adjacent logic
From: Veaceslav Falico @ 2014-01-14 16:35 UTC (permalink / raw)
  To: netdev
  Cc: Veaceslav Falico, Ding Tianhong, David S. Miller, Eric Dumazet,
	Nicolas Dichtel, Cong Wang
In-Reply-To: <1389717360-13920-1-git-send-email-vfalico@redhat.com>

They clean up the code a bit and can be used further.

CC: Ding Tianhong <dingtianhong@huawei.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Eric Dumazet <edumazet@google.com>
CC: Nicolas Dichtel <nicolas.dichtel@6wind.com>
CC: Cong Wang <amwang@redhat.com>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
 net/core/dev.c | 57 ++++++++++++++++++++++++++++++---------------------------
 1 file changed, 30 insertions(+), 27 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 87312dc..c578d4e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4595,13 +4595,36 @@ struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev)
 }
 EXPORT_SYMBOL(netdev_master_upper_dev_get_rcu);
 
+int netdev_adjacent_sysfs_add(struct net_device *dev,
+			      struct net_device *adj_dev,
+			      struct list_head *dev_list)
+{
+	char linkname[IFNAMSIZ+7];
+	sprintf(linkname, dev_list == &dev->adj_list.upper ?
+		"upper_%s" : "lower_%s", adj_dev->name);
+	return sysfs_create_link(&(dev->dev.kobj), &(adj_dev->dev.kobj),
+				 linkname);
+}
+void netdev_adjacent_sysfs_del(struct net_device *dev,
+			       char *name,
+			       struct list_head *dev_list)
+{
+	char linkname[IFNAMSIZ+7];
+	sprintf(linkname, dev_list == &dev->adj_list.upper ?
+		"upper_%s" : "lower_%s", name);
+	sysfs_remove_link(&(dev->dev.kobj), linkname);
+}
+
+#define netdev_adjacent_is_neigh_list(dev, dev_list) \
+		(dev_list == &dev->adj_list.upper || \
+		 dev_list == &dev->adj_list.lower)
+
 static int __netdev_adjacent_dev_insert(struct net_device *dev,
 					struct net_device *adj_dev,
 					struct list_head *dev_list,
 					void *private, bool master)
 {
 	struct netdev_adjacent *adj;
-	char linkname[IFNAMSIZ+7];
 	int ret;
 
 	adj = __netdev_find_adj(dev, adj_dev, dev_list);
@@ -4624,16 +4647,8 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev,
 	pr_debug("dev_hold for %s, because of link added from %s to %s\n",
 		 adj_dev->name, dev->name, adj_dev->name);
 
-	if (dev_list == &dev->adj_list.lower) {
-		sprintf(linkname, "lower_%s", adj_dev->name);
-		ret = sysfs_create_link(&(dev->dev.kobj),
-					&(adj_dev->dev.kobj), linkname);
-		if (ret)
-			goto free_adj;
-	} else if (dev_list == &dev->adj_list.upper) {
-		sprintf(linkname, "upper_%s", adj_dev->name);
-		ret = sysfs_create_link(&(dev->dev.kobj),
-					&(adj_dev->dev.kobj), linkname);
+	if (netdev_adjacent_is_neigh_list(dev, dev_list)) {
+		ret = netdev_adjacent_sysfs_add(dev, adj_dev, dev_list);
 		if (ret)
 			goto free_adj;
 	}
@@ -4653,14 +4668,8 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev,
 	return 0;
 
 remove_symlinks:
-	if (dev_list == &dev->adj_list.lower) {
-		sprintf(linkname, "lower_%s", adj_dev->name);
-		sysfs_remove_link(&(dev->dev.kobj), linkname);
-	} else if (dev_list == &dev->adj_list.upper) {
-		sprintf(linkname, "upper_%s", adj_dev->name);
-		sysfs_remove_link(&(dev->dev.kobj), linkname);
-	}
-
+	if (netdev_adjacent_is_neigh_list(dev, dev_list))
+		netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list);
 free_adj:
 	kfree(adj);
 	dev_put(adj_dev);
@@ -4673,7 +4682,6 @@ static void __netdev_adjacent_dev_remove(struct net_device *dev,
 					 struct list_head *dev_list)
 {
 	struct netdev_adjacent *adj;
-	char linkname[IFNAMSIZ+7];
 
 	adj = __netdev_find_adj(dev, adj_dev, dev_list);
 
@@ -4693,13 +4701,8 @@ static void __netdev_adjacent_dev_remove(struct net_device *dev,
 	if (adj->master)
 		sysfs_remove_link(&(dev->dev.kobj), "master");
 
-	if (dev_list == &dev->adj_list.lower) {
-		sprintf(linkname, "lower_%s", adj_dev->name);
-		sysfs_remove_link(&(dev->dev.kobj), linkname);
-	} else if (dev_list == &dev->adj_list.upper) {
-		sprintf(linkname, "upper_%s", adj_dev->name);
-		sysfs_remove_link(&(dev->dev.kobj), linkname);
-	}
+	if (netdev_adjacent_is_neigh_list(dev, dev_list))
+		netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list);
 
 	list_del_rcu(&adj->list);
 	pr_debug("dev_put for %s, because link removed from %s to %s\n",
-- 
1.8.4

^ permalink raw reply related

* [PATCH net-next 2/2] net: rename sysfs symlinks on device name change
From: Veaceslav Falico @ 2014-01-14 16:36 UTC (permalink / raw)
  To: netdev
  Cc: Veaceslav Falico, Ding Tianhong, David S. Miller, Eric Dumazet,
	Nicolas Dichtel, Cong Wang
In-Reply-To: <1389717360-13920-1-git-send-email-vfalico@redhat.com>

Currently, we don't rename the upper/lower_ifc symlinks in
/sys/class/net/*/ , which might result stale/duplicate links/names.

Fix this by adding netdev_adjacent_rename_links(dev, oldname) which renames
all the upper/lower interface's links to dev from the upper/lower_oldname
to the new name.

We don't need a rollback because only we control these symlinks and if we
fail to rename them - sysfs will anyway complain.

Reported-by: Ding Tianhong <dingtianhong@huawei.com>
CC: Ding Tianhong <dingtianhong@huawei.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Eric Dumazet <edumazet@google.com>
CC: Nicolas Dichtel <nicolas.dichtel@6wind.com>
CC: Cong Wang <amwang@redhat.com>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
 include/linux/netdevice.h |  1 +
 net/core/dev.c            | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index a2a70cc..61f8338 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2937,6 +2937,7 @@ int netdev_master_upper_dev_link_private(struct net_device *dev,
 					 void *private);
 void netdev_upper_dev_unlink(struct net_device *dev,
 			     struct net_device *upper_dev);
+void netdev_adjacent_rename_links(struct net_device *dev, char *oldname);
 void *netdev_lower_dev_get_private(struct net_device *dev,
 				   struct net_device *lower_dev);
 int skb_checksum_help(struct sk_buff *skb);
diff --git a/net/core/dev.c b/net/core/dev.c
index c578d4e..5bf0950 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1117,6 +1117,8 @@ rollback:
 
 	write_seqcount_end(&devnet_rename_seq);
 
+	netdev_adjacent_rename_links(dev, oldname);
+
 	write_lock_bh(&dev_base_lock);
 	hlist_del_rcu(&dev->name_hlist);
 	write_unlock_bh(&dev_base_lock);
@@ -1136,6 +1138,7 @@ rollback:
 			err = ret;
 			write_seqcount_begin(&devnet_rename_seq);
 			memcpy(dev->name, oldname, IFNAMSIZ);
+			memcpy(oldname, newname, IFNAMSIZ);
 			goto rollback;
 		} else {
 			pr_err("%s: name change rollback failed: %d\n",
@@ -4971,6 +4974,26 @@ void netdev_upper_dev_unlink(struct net_device *dev,
 }
 EXPORT_SYMBOL(netdev_upper_dev_unlink);
 
+void netdev_adjacent_rename_links(struct net_device *dev, char *oldname)
+{
+	struct netdev_adjacent *iter;
+
+	list_for_each_entry(iter, &dev->adj_list.upper, list) {
+		netdev_adjacent_sysfs_del(iter->dev, oldname,
+					  &iter->dev->adj_list.lower);
+		netdev_adjacent_sysfs_add(iter->dev, dev,
+					  &iter->dev->adj_list.lower);
+	}
+
+	list_for_each_entry(iter, &dev->adj_list.lower, list) {
+		netdev_adjacent_sysfs_del(iter->dev, oldname,
+					  &iter->dev->adj_list.upper);
+		netdev_adjacent_sysfs_add(iter->dev, dev,
+					  &iter->dev->adj_list.upper);
+	}
+}
+EXPORT_SYMBOL(netdev_adjacent_rename_links);
+
 void *netdev_lower_dev_get_private(struct net_device *dev,
 				   struct net_device *lower_dev)
 {
-- 
1.8.4

^ permalink raw reply related

* [PATCH net-next 0/2] net: rename device's sysfs symlinks on name change
From: Veaceslav Falico @ 2014-01-14 16:35 UTC (permalink / raw)
  To: netdev
  Cc: Ding Tianhong, David S. Miller, Eric Dumazet, Nicolas Dichtel,
	Cong Wang, Veaceslav Falico

First patch only adds helper functions and cleans up the code a bit, second
one already does the renaming.

Reported-by: Ding Tianhong <dingtianhong@huawei.com>
CC: Ding Tianhong <dingtianhong@huawei.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Eric Dumazet <edumazet@google.com>
CC: Nicolas Dichtel <nicolas.dichtel@6wind.com>
CC: Cong Wang <amwang@redhat.com>
CC: netdev@vger.kernel.org
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>

---
 include/linux/netdevice.h |  1 +
 net/core/dev.c            | 80 +++++++++++++++++++++++++++++++----------------
 2 files changed, 54 insertions(+), 27 deletions(-)

^ 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