[PATCH 2/3] xfrm: Reset encapsulation field of the skb before transformation
The inner headers are invalid after a xfrm transformation. So reset the skb encapsulation field to ensure nobody tries to access the inner headers. Signed-off-by: Steffen Klassert--- net/xfrm/xfrm_output.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c index ff4a91f..637387b 100644 --- a/net/xfrm/xfrm_output.c +++ b/net/xfrm/xfrm_output.c @@ -99,6 +99,9 @@ static int xfrm_output_one(struct sk_buff *skb, int err) skb_dst_force(skb); + /* Inner headers are invalid now. */ + skb->encapsulation = 0; + err = x->type->output(x, skb); if (err == -EINPROGRESS) goto out; -- 1.9.1
[PATCH 1/3] flowcache: Avoid OOM condition under preasure
We can hit an OOM condition if we are under presure because we can not free the entries in gc_list fast enough. So add a counter for the not yet freed entries in the gc_list and refuse new allocations if the value is too high. Signed-off-by: Steffen Klassert--- include/net/netns/xfrm.h | 1 + net/core/flow.c | 14 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h index 730d82a..24cd394 100644 --- a/include/net/netns/xfrm.h +++ b/include/net/netns/xfrm.h @@ -80,6 +80,7 @@ struct netns_xfrm { struct flow_cache flow_cache_global; atomic_tflow_cache_genid; struct list_headflow_cache_gc_list; + atomic_tflow_cache_gc_count; spinlock_t flow_cache_gc_lock; struct work_struct flow_cache_gc_work; struct work_struct flow_cache_flush_work; diff --git a/net/core/flow.c b/net/core/flow.c index 1033725..3937b1b 100644 --- a/net/core/flow.c +++ b/net/core/flow.c @@ -92,8 +92,11 @@ static void flow_cache_gc_task(struct work_struct *work) list_splice_tail_init(>flow_cache_gc_list, _list); spin_unlock_bh(>flow_cache_gc_lock); - list_for_each_entry_safe(fce, n, _list, u.gc_list) + list_for_each_entry_safe(fce, n, _list, u.gc_list) { flow_entry_kill(fce, xfrm); + atomic_dec(>flow_cache_gc_count); + WARN_ON(atomic_read(>flow_cache_gc_count) < 0); + } } static void flow_cache_queue_garbage(struct flow_cache_percpu *fcp, @@ -101,6 +104,7 @@ static void flow_cache_queue_garbage(struct flow_cache_percpu *fcp, struct netns_xfrm *xfrm) { if (deleted) { + atomic_add(deleted, >flow_cache_gc_count); fcp->hash_count -= deleted; spin_lock_bh(>flow_cache_gc_lock); list_splice_tail(gc_list, >flow_cache_gc_list); @@ -232,6 +236,13 @@ flow_cache_lookup(struct net *net, const struct flowi *key, u16 family, u8 dir, if (fcp->hash_count > fc->high_watermark) flow_cache_shrink(fc, fcp); + if (fcp->hash_count > 2 * fc->high_watermark || + atomic_read(>xfrm.flow_cache_gc_count) > fc->high_watermark) { + atomic_inc(>xfrm.flow_cache_genid); + flo = ERR_PTR(-ENOBUFS); + goto ret_object; + } + fle = kmem_cache_alloc(flow_cachep, GFP_ATOMIC); if (fle) { fle->net = net; @@ -446,6 +457,7 @@ int flow_cache_init(struct net *net) INIT_WORK(>xfrm.flow_cache_gc_work, flow_cache_gc_task); INIT_WORK(>xfrm.flow_cache_flush_work, flow_cache_flush_task); mutex_init(>xfrm.flow_flush_sem); + atomic_set(>xfrm.flow_cache_gc_count, 0); fc->hash_shift = 10; fc->low_watermark = 2 * flow_cache_hash_size(fc); -- 1.9.1
[PATCH 3/3] vti: Add pmtu handling to vti_xmit.
We currently rely on the PMTU discovery of xfrm. However if a packet is locally sent, the PMTU mechanism of xfrm tries to do local socket notification what might not work for applications like ping that don't check for this. So add pmtu handling to vti_xmit to report MTU changes immediately. Reported-by: Mark McKinstrySigned-off-by: Steffen Klassert --- net/ipv4/ip_vti.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c index 5cf10b7..a917903 100644 --- a/net/ipv4/ip_vti.c +++ b/net/ipv4/ip_vti.c @@ -156,6 +156,7 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev, struct dst_entry *dst = skb_dst(skb); struct net_device *tdev;/* Device to other host */ int err; + int mtu; if (!dst) { dev->stats.tx_carrier_errors++; @@ -192,6 +193,23 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev, tunnel->err_count = 0; } + mtu = dst_mtu(dst); + if (skb->len > mtu) { + skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu); + if (skb->protocol == htons(ETH_P_IP)) { + icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, + htonl(mtu)); + } else { + if (mtu < IPV6_MIN_MTU) + mtu = IPV6_MIN_MTU; + + icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); + } + + dst_release(dst); + goto tx_error; + } + skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(dev))); skb_dst_set(skb, dst); skb->dev = skb_dst(skb)->dev; -- 1.9.1
pull request (net): ipsec 2016-05-04
1) The flowcache can hit an OOM condition if too many entries are in the gc_list. Fix this by counting the entries in the gc_list and refuse new allocations if the value is too high. 2) The inner headers are invalid after a xfrm transformation, so reset the skb encapsulation field to ensure nobody tries access the inner headers. Otherwise tunnel devices stacked on top of xfrm may build the outer headers based on wrong informations. 3) Add pmtu handling to vti, we need it to report pmtu informations for local generated packets. Please pull or let me know if there are problems. Thanks! The following changes since commit aac8d3c282e024c344c5b86dc1eab7af88bb9716: qmi_wwan: add "4G LTE usb-modem U901" (2016-02-16 20:39:32 -0500) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec.git master for you to fetch changes up to d6af1a31cc72fbd558c7eddbc36f61bf09d1cf6a: vti: Add pmtu handling to vti_xmit. (2016-03-31 08:59:56 +0200) Steffen Klassert (3): flowcache: Avoid OOM condition under preasure xfrm: Reset encapsulation field of the skb before transformation vti: Add pmtu handling to vti_xmit. include/net/netns/xfrm.h | 1 + net/core/flow.c | 14 +- net/ipv4/ip_vti.c| 18 ++ net/xfrm/xfrm_output.c | 3 +++ 4 files changed, 35 insertions(+), 1 deletion(-)
Re: [PATCH net-next] tcp: fix lockdep splat in tcp_snd_una_update()
From: Eric DumazetDate: Tue, 03 May 2016 16:56:03 -0700 > From: Eric Dumazet > > tcp_snd_una_update() and tcp_rcv_nxt_update() call > u64_stats_update_begin() either from process context or BH handler. > > This triggers a lockdep splat on 32bit & SMP builds. > > We could add u64_stats_update_begin_bh() variant but this would > slow down 32bit builds with useless local_disable_bh() and > local_enable_bh() pairs, since we own the socket lock at this point. > > I add sock_owned_by_me() helper to have proper lockdep support > even on 64bit builds, and new u64_stats_update_begin_raw() > and u64_stats_update_end_raw methods. > > Fixes: c10d9310edf5 ("tcp: do not assume TCP code is non preemptible") > Reported-by: Fabio Estevam > Diagnosed-by: Francois Romieu > Signed-off-by: Eric Dumazet Applied.
Re: [PATC net-next] tcp: must block bh in __inet_twsk_hashdance()
From: Eric DumazetDate: Tue, 03 May 2016 17:10:50 -0700 > From: Eric Dumazet > > __inet_twsk_hashdance() might be called from process context, > better block BH before acquiring bind hash and established locks > > Fixes: c10d9310edf5 ("tcp: do not assume TCP code is non preemptible") > Signed-off-by: Eric Dumazet Applied.
Re: [PATCH next-next 2/7] gre: Move utility functions to common headers
From: Jiri BencDate: Tue, 3 May 2016 13:29:44 +0200 > How do we resolve the conflict between net and net-next? I'd prefer > gre_parse_header to return the header length. I can submit a patch for > net-next that does this; that would substantially ease the merge. Jiri, I just did the net --> net-next merge. Please send me something on top of that which does what you like. Thanks.
[v9, 7/7] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0
The eSDHC of T4240-R1.0-R2.0 has incorrect vender version and spec version. Acturally the right version numbers should be VVN=0x13 and SVN = 0x1. This patch adds the GUTS driver support for eSDHC driver to get SVR(System version register). And fix host version to avoid that incorrect version numbers break down the ADMA data transfer. Signed-off-by: Yangbo LuAcked-by: Ulf Hansson Acked-by: Scott Wood --- Changes for v2: - Got SVR through iomap instead of dts Changes for v3: - Managed GUTS through syscon instead of iomap in eSDHC driver Changes for v4: - Got SVR by GUTS driver instead of SYSCON Changes for v5: - Changed to get SVR through API fsl_guts_get_svr() - Combined patch 4, patch 5 and patch 6 into one Changes for v6: - Added 'Acked-by: Ulf Hansson' Changes for v7: - None Changes for v8: - Added 'Acked-by: Scott Wood' Changes for v9: - None --- drivers/mmc/host/Kconfig | 1 + drivers/mmc/host/sdhci-of-esdhc.c | 23 +++ 2 files changed, 24 insertions(+) diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 0aa484c..e15e836 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -143,6 +143,7 @@ config MMC_SDHCI_OF_ESDHC depends on MMC_SDHCI_PLTFM depends on PPC || ARCH_MXC || ARCH_LAYERSCAPE select MMC_SDHCI_IO_ACCESSORS + select FSL_GUTS help This selects the Freescale eSDHC controller support. diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index 3f34d35..68cc020 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include #include "sdhci-pltfm.h" #include "sdhci-esdhc.h" @@ -28,6 +30,8 @@ struct sdhci_esdhc { u8 vendor_ver; u8 spec_ver; + u32 soc_ver; + u8 soc_rev; }; /** @@ -73,6 +77,8 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host, static u16 esdhc_readw_fixup(struct sdhci_host *host, int spec_reg, u32 value) { + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host); u16 ret; int shift = (spec_reg & 0x2) * 8; @@ -80,6 +86,13 @@ static u16 esdhc_readw_fixup(struct sdhci_host *host, ret = value & 0x; else ret = (value >> shift) & 0x; + + /* Workaround for T4240-R1.0-R2.0 eSDHC which has incorrect +* vendor version and spec version information. +*/ + if ((spec_reg == SDHCI_HOST_VERSION) && + (esdhc->soc_ver == SVR_T4240) && (esdhc->soc_rev <= 0x20)) + ret = (VENDOR_V_23 << SDHCI_VENDOR_VER_SHIFT) | SDHCI_SPEC_200; return ret; } @@ -567,10 +580,20 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host) struct sdhci_pltfm_host *pltfm_host; struct sdhci_esdhc *esdhc; u16 host_ver; + u32 svr; pltfm_host = sdhci_priv(host); esdhc = sdhci_pltfm_priv(pltfm_host); + fsl_guts_init(); + svr = fsl_guts_get_svr(); + if (svr) { + esdhc->soc_ver = SVR_SOC_VER(svr); + esdhc->soc_rev = SVR_REV(svr); + } else { + dev_err(>dev, "Failed to get SVR value!\n"); + } + host_ver = sdhci_readw(host, SDHCI_HOST_VERSION); esdhc->vendor_ver = (host_ver & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT; -- 2.1.0.27.g96db324
[v9, 1/7] Documentation: DT: update Freescale DCFG compatible
Update Freescale DCFG compatible with 'fsl,-dcfg' instead of 'fsl,ls1021a-dcfg' to include more chips such as ls1021a, ls1043a, and ls2080a. Signed-off-by: Yangbo Lu--- Changes for v8: - Added this patch Changes for v9: - Added a list for the possible compatibles --- Documentation/devicetree/bindings/arm/fsl.txt | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/arm/fsl.txt b/Documentation/devicetree/bindings/arm/fsl.txt index 752a685..465cba1 100644 --- a/Documentation/devicetree/bindings/arm/fsl.txt +++ b/Documentation/devicetree/bindings/arm/fsl.txt @@ -119,7 +119,11 @@ Freescale DCFG configuration and status for the device. Such as setting the secondary core start address and release the secondary core from holdoff and startup. Required properties: - - compatible: should be "fsl,ls1021a-dcfg" + - compatible: should be "fsl,-dcfg" +Possible compatibles: + "fsl,ls1021a-dcfg" + "fsl,ls1043a-dcfg" + "fsl,ls2080a-dcfg" - reg : should contain base address and length of DCFG memory-mapped registers Example: -- 2.1.0.27.g96db324
[v9, 6/7] MAINTAINERS: add entry for Freescale SoC driver
Add maintainer entry for Freescale SoC driver including the QE library and the GUTS driver now. Also add maintainer for QE library. Signed-off-by: Yangbo Lu--- Changes for v8: - Added this patch Changes for v9: - Added linux-arm mail list - Removed GUTS driver entry --- MAINTAINERS | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 42e65d1..ce91db7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4622,9 +4622,18 @@ F: drivers/net/ethernet/freescale/fec_ptp.c F: drivers/net/ethernet/freescale/fec.h F: Documentation/devicetree/bindings/net/fsl-fec.txt +FREESCALE SOC DRIVER +M: Scott Wood +L: linuxppc-...@lists.ozlabs.org +L: linux-arm-ker...@lists.infradead.org +S: Maintained +F: drivers/soc/fsl/ +F: include/linux/fsl/ + FREESCALE QUICC ENGINE LIBRARY +M: Qiang Zhao L: linuxppc-...@lists.ozlabs.org -S: Orphan +S: Maintained F: drivers/soc/fsl/qe/ F: include/soc/fsl/*qe*.h F: include/soc/fsl/*ucc*.h -- 2.1.0.27.g96db324
[v9, 2/7] ARM64: dts: ls2080a: add device configuration node
Add the dts node for device configuration unit that provides general purpose configuration and status for the device. Signed-off-by: Yangbo LuAcked-by: Scott Wood --- Changes for v5: - Added this patch Changes for v6: - None Changes for v7: - None Changes for v8: - Added 'Acked-by: Scott Wood' Changes for v9: - None --- arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi index 9d746c6..8724cf1 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi @@ -191,6 +191,12 @@ clocks = <>; }; + dcfg: dcfg@1e0 { + compatible = "fsl,ls2080a-dcfg", "syscon"; + reg = <0x0 0x1e0 0x0 0x1>; + little-endian; + }; + serial0: serial@21c0500 { compatible = "fsl,ns16550", "ns16550a"; reg = <0x0 0x21c0500 0x0 0x100>; -- 2.1.0.27.g96db324
[v9, 3/7] soc: fsl: add GUTS driver for QorIQ platforms
The global utilities block controls power management, I/O device enabling, power-onreset(POR) configuration monitoring, alternate function selection for multiplexed signals,and clock control. This patch adds GUTS driver to manage and access global utilities block. Signed-off-by: Yangbo LuAcked-by: Scott Wood --- Changes for v4: - Added this patch Changes for v5: - Modified copyright info - Changed MODULE_LICENSE to GPL - Changed EXPORT_SYMBOL_GPL to EXPORT_SYMBOL - Made FSL_GUTS user-invisible - Added a complete compatible list for GUTS - Stored guts info in file-scope variable - Added mfspr() getting SVR - Redefined GUTS APIs - Called fsl_guts_init rather than using platform driver - Removed useless parentheses - Removed useless 'extern' key words Changes for v6: - Made guts thread safe in fsl_guts_init Changes for v7: - Removed 'ifdef' for function declaration in guts.h Changes for v8: - Fixes lines longer than 80 characters checkpatch issue - Added 'Acked-by: Scott Wood' Changes for v9: - None --- drivers/soc/Kconfig | 2 +- drivers/soc/fsl/Kconfig | 8 +++ drivers/soc/fsl/Makefile | 1 + drivers/soc/fsl/guts.c | 119 include/linux/fsl/guts.h | 126 +-- 5 files changed, 207 insertions(+), 49 deletions(-) create mode 100644 drivers/soc/fsl/Kconfig create mode 100644 drivers/soc/fsl/guts.c diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig index cb58ef0..7106463 100644 --- a/drivers/soc/Kconfig +++ b/drivers/soc/Kconfig @@ -2,7 +2,7 @@ menu "SOC (System On Chip) specific Drivers" source "drivers/soc/bcm/Kconfig" source "drivers/soc/brcmstb/Kconfig" -source "drivers/soc/fsl/qe/Kconfig" +source "drivers/soc/fsl/Kconfig" source "drivers/soc/mediatek/Kconfig" source "drivers/soc/qcom/Kconfig" source "drivers/soc/rockchip/Kconfig" diff --git a/drivers/soc/fsl/Kconfig b/drivers/soc/fsl/Kconfig new file mode 100644 index 000..b313759 --- /dev/null +++ b/drivers/soc/fsl/Kconfig @@ -0,0 +1,8 @@ +# +# Freescale SOC drivers +# + +source "drivers/soc/fsl/qe/Kconfig" + +config FSL_GUTS + bool diff --git a/drivers/soc/fsl/Makefile b/drivers/soc/fsl/Makefile index 203307f..02afb7f 100644 --- a/drivers/soc/fsl/Makefile +++ b/drivers/soc/fsl/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_QUICC_ENGINE) += qe/ obj-$(CONFIG_CPM) += qe/ +obj-$(CONFIG_FSL_GUTS) += guts.o diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c new file mode 100644 index 000..fa155e6 --- /dev/null +++ b/drivers/soc/fsl/guts.c @@ -0,0 +1,119 @@ +/* + * Freescale QorIQ Platforms GUTS Driver + * + * Copyright (C) 2016 Freescale Semiconductor, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include + +struct guts { + struct ccsr_guts __iomem *regs; + bool little_endian; +}; + +static struct guts *guts; +static DEFINE_MUTEX(guts_lock); + +u32 fsl_guts_get_svr(void) +{ + u32 svr = 0; + + if (!guts || !guts->regs) { +#ifdef CONFIG_PPC + svr = mfspr(SPRN_SVR); +#endif + return svr; + } + + if (guts->little_endian) + svr = ioread32(>regs->svr); + else + svr = ioread32be(>regs->svr); + + return svr; +} +EXPORT_SYMBOL(fsl_guts_get_svr); + +/* + * Table for matching compatible strings, for device tree + * guts node, for Freescale QorIQ SOCs. + */ +static const struct of_device_id guts_of_match[] = { + /* For T4 & B4 Series SOCs */ + { .compatible = "fsl,qoriq-device-config-1.0", }, + /* For P Series SOCs */ + { .compatible = "fsl,qoriq-device-config-2.0", }, + { .compatible = "fsl,p1010-guts", }, + { .compatible = "fsl,p1020-guts", }, + { .compatible = "fsl,p1021-guts", }, + { .compatible = "fsl,p1022-guts", }, + { .compatible = "fsl,p1023-guts", }, + { .compatible = "fsl,p2020-guts", }, + /* For BSC Series SOCs */ + { .compatible = "fsl,bsc9131-guts", }, + { .compatible = "fsl,bsc9132-guts", }, + /* For MPC85xx Series SOCs */ + { .compatible = "fsl,mpc8536-guts", }, + { .compatible = "fsl,mpc8544-guts", }, + { .compatible = "fsl,mpc8548-guts", }, + { .compatible = "fsl,mpc8568-guts", }, + { .compatible = "fsl,mpc8569-guts", }, + { .compatible = "fsl,mpc8572-guts", }, + /* For Layerscape Series SOCs */ + { .compatible = "fsl,ls1021a-dcfg", }, + { .compatible =
[v9, 5/7] powerpc/fsl: move mpc85xx.h to include/linux/fsl
Move mpc85xx.h to include/linux/fsl and rename it to svr.h as a common header file. It has been used for mpc85xx and it will be used for ARM-based SoC as well. Signed-off-by: Yangbo LuAcked-by: Wolfram Sang Acked-by: Stephen Boyd Acked-by: Scott Wood Acked-by: Joerg Roedel --- Changes for v2: - None Changes for v3: - None Changes for v4: - None Changes for v5: - Changed to Move mpc85xx.h to include/linux/fsl/ - Adjusted '#include ' position in file Changes for v6: - None Changes for v7: - Added 'Acked-by: Wolfram Sang' for I2C part - Also applied to arch/powerpc/kernel/cpu_setup_fsl_booke.S Changes for v8: - Added 'Acked-by: Stephen Boyd' for clk part - Added 'Acked-by: Scott Wood' - Added 'Acked-by: Joerg Roedel' for iommu part Changes for v9: - None --- arch/powerpc/kernel/cpu_setup_fsl_booke.S | 2 +- drivers/clk/clk-qoriq.c | 3 +-- drivers/i2c/busses/i2c-mpc.c | 2 +- drivers/iommu/fsl_pamu.c | 3 +-- drivers/net/ethernet/freescale/gianfar.c | 2 +- arch/powerpc/include/asm/mpc85xx.h => include/linux/fsl/svr.h | 4 ++-- 6 files changed, 7 insertions(+), 9 deletions(-) rename arch/powerpc/include/asm/mpc85xx.h => include/linux/fsl/svr.h (97%) diff --git a/arch/powerpc/kernel/cpu_setup_fsl_booke.S b/arch/powerpc/kernel/cpu_setup_fsl_booke.S index 462aed9..2b0284e 100644 --- a/arch/powerpc/kernel/cpu_setup_fsl_booke.S +++ b/arch/powerpc/kernel/cpu_setup_fsl_booke.S @@ -13,13 +13,13 @@ * */ +#include #include #include #include #include #include #include -#include _GLOBAL(__e500_icache_setup) mfspr r0, SPRN_L1CSR1 diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c index 7bc1c45..fc7f722 100644 --- a/drivers/clk/clk-qoriq.c +++ b/drivers/clk/clk-qoriq.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -1148,8 +1149,6 @@ bad_args: } #ifdef CONFIG_PPC -#include - static const u32 a4510_svrs[] __initconst = { (SVR_P2040 << 8) | 0x10,/* P2040 1.0 */ (SVR_P2040 << 8) | 0x11,/* P2040 1.1 */ diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index 48ecffe..600704c 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c @@ -27,9 +27,9 @@ #include #include #include +#include #include -#include #include #define DRV_NAME "mpc-i2c" diff --git a/drivers/iommu/fsl_pamu.c b/drivers/iommu/fsl_pamu.c index a34355f..af8fb27 100644 --- a/drivers/iommu/fsl_pamu.c +++ b/drivers/iommu/fsl_pamu.c @@ -21,11 +21,10 @@ #include "fsl_pamu.h" #include +#include #include #include -#include - /* define indexes for each operation mapping scenario */ #define OMI_QMAN0x00 #define OMI_FMAN0x01 diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index d2f917a..2224b10 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -86,11 +86,11 @@ #include #include #include +#include #include #ifdef CONFIG_PPC #include -#include #endif #include #include diff --git a/arch/powerpc/include/asm/mpc85xx.h b/include/linux/fsl/svr.h similarity index 97% rename from arch/powerpc/include/asm/mpc85xx.h rename to include/linux/fsl/svr.h index 213f3a8..8d13836 100644 --- a/arch/powerpc/include/asm/mpc85xx.h +++ b/include/linux/fsl/svr.h @@ -9,8 +9,8 @@ * (at your option) any later version. */ -#ifndef __ASM_PPC_MPC85XX_H -#define __ASM_PPC_MPC85XX_H +#ifndef FSL_SVR_H +#define FSL_SVR_H #define SVR_REV(svr) ((svr) & 0xFF) /* SOC design resision */ #define SVR_MAJ(svr) (((svr) >> 4) & 0xF) /* Major revision field*/ -- 2.1.0.27.g96db324
[v9, 0/7] Fix eSDHC host version register bug
This patchset is used to fix a host version register bug in the T4240-R1.0-R2.0 eSDHC controller. To get the SoC version and revision, it's needed to add the GUTS driver to access the global utilities registers. So, the first four patches are to add the GUTS driver. The following patches except the updating MAINTAINERS patch are to enable GUTS driver support to get SVR in eSDHC driver and fix host version for T4240. Yangbo Lu (7): Documentation: DT: update Freescale DCFG compatible ARM64: dts: ls2080a: add device configuration node soc: fsl: add GUTS driver for QorIQ platforms dt: move guts devicetree doc out of powerpc directory powerpc/fsl: move mpc85xx.h to include/linux/fsl MAINTAINERS: add entry for Freescale SoC driver mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0 Documentation/devicetree/bindings/arm/fsl.txt | 6 +- .../bindings/{powerpc => soc}/fsl/guts.txt | 3 + MAINTAINERS| 11 +- arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi | 6 + arch/powerpc/kernel/cpu_setup_fsl_booke.S | 2 +- drivers/clk/clk-qoriq.c| 3 +- drivers/i2c/busses/i2c-mpc.c | 2 +- drivers/iommu/fsl_pamu.c | 3 +- drivers/mmc/host/Kconfig | 1 + drivers/mmc/host/sdhci-of-esdhc.c | 23 drivers/net/ethernet/freescale/gianfar.c | 2 +- drivers/soc/Kconfig| 2 +- drivers/soc/fsl/Kconfig| 8 ++ drivers/soc/fsl/Makefile | 1 + drivers/soc/fsl/guts.c | 119 +++ include/linux/fsl/guts.h | 126 + .../asm/mpc85xx.h => include/linux/fsl/svr.h | 4 +- 17 files changed, 262 insertions(+), 60 deletions(-) rename Documentation/devicetree/bindings/{powerpc => soc}/fsl/guts.txt (91%) create mode 100644 drivers/soc/fsl/Kconfig create mode 100644 drivers/soc/fsl/guts.c rename arch/powerpc/include/asm/mpc85xx.h => include/linux/fsl/svr.h (97%) -- 2.1.0.27.g96db324
[v9, 4/7] dt: move guts devicetree doc out of powerpc directory
Move guts devicetree doc to Documentation/devicetree/bindings/soc/fsl/ since it's used by not only PowerPC but also ARM. And add a specification for 'little-endian' property. Signed-off-by: Yangbo LuAcked-by: Scott Wood Acked-by: Rob Herring --- Changes for v4: - Added this patch Changes for v5: - Modified the description for little-endian property Changes for v6: - None Changes for v7: - None Changes for v8: - Added 'Acked-by: Scott Wood' - Added 'Acked-by: Rob Herring' Changes for v9: - None --- Documentation/devicetree/bindings/{powerpc => soc}/fsl/guts.txt | 3 +++ 1 file changed, 3 insertions(+) rename Documentation/devicetree/bindings/{powerpc => soc}/fsl/guts.txt (91%) diff --git a/Documentation/devicetree/bindings/powerpc/fsl/guts.txt b/Documentation/devicetree/bindings/soc/fsl/guts.txt similarity index 91% rename from Documentation/devicetree/bindings/powerpc/fsl/guts.txt rename to Documentation/devicetree/bindings/soc/fsl/guts.txt index b71b203..07adca9 100644 --- a/Documentation/devicetree/bindings/powerpc/fsl/guts.txt +++ b/Documentation/devicetree/bindings/soc/fsl/guts.txt @@ -25,6 +25,9 @@ Recommended properties: - fsl,liodn-bits : Indicates the number of defined bits in the LIODN registers, for those SOCs that have a PAMU device. + - little-endian : Indicates that the global utilities block is little + endian. The default is big endian. + Examples: global-utilities@e {/* global utilities block */ compatible = "fsl,mpc8548-guts"; -- 2.1.0.27.g96db324
RE: [PATCH] net: fec: only clear a queue's work bit if the queue was emptied
From: Uwe Kleine-KönigSent: Tuesday, May 03, 2016 10:39 PM > To: Fugang Duan ; David S . Miller > > Cc: ker...@pengutronix.de; netdev@vger.kernel.org > Subject: [PATCH] net: fec: only clear a queue's work bit if the queue was > emptied > > In the receive path a queue's work bit was cleared unconditionally even if > fec_enet_rx_queue only read out a part of the available packets from the > hardware. This resulted in not reading any packets in the next napi turn and > so > packets were delayed or lost. > > The obvious fix is to only clear a queue's bit when the queue was emptied. > > Fixes: 4d494cdc92b3 ("net: fec: change data structure to support multiqueue") > Signed-off-by: Uwe Kleine-König > --- > Hello, > > I created this patch against net/master. If you think it's to late to get it > into 4.6 > and it doesn't fit on net-next/master, just tell me and I will rebase. > > Best regards > Uwe > > > drivers/net/ethernet/freescale/fec_main.c | 10 -- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/freescale/fec_main.c > b/drivers/net/ethernet/freescale/fec_main.c > index 08243c2ff4b4..2a03857cca18 100644 > --- a/drivers/net/ethernet/freescale/fec_main.c > +++ b/drivers/net/ethernet/freescale/fec_main.c > @@ -1521,9 +1521,15 @@ fec_enet_rx(struct net_device *ndev, int budget) > struct fec_enet_private *fep = netdev_priv(ndev); > > for_each_set_bit(queue_id, >work_rx, FEC_ENET_MAX_RX_QS) { > - clear_bit(queue_id, >work_rx); > - pkt_received += fec_enet_rx_queue(ndev, > + int ret; > + > + ret = fec_enet_rx_queue(ndev, > budget - pkt_received, queue_id); > + > + if (ret < budget - pkt_received) > + clear_bit(queue_id, >work_rx); > + > + pkt_received += ret; > } > return pkt_received; > } > -- > 2.8.0.rc3 Tested-by: Fugang Duan Acked-by: Fugang Duan
Re: [PATCH net-next] tcp: fix lockdep splat in tcp_snd_una_update()
On Tue, May 3, 2016 at 8:56 PM, Eric Dumazetwrote: > From: Eric Dumazet > > tcp_snd_una_update() and tcp_rcv_nxt_update() call > u64_stats_update_begin() either from process context or BH handler. > > This triggers a lockdep splat on 32bit & SMP builds. > > We could add u64_stats_update_begin_bh() variant but this would > slow down 32bit builds with useless local_disable_bh() and > local_enable_bh() pairs, since we own the socket lock at this point. > > I add sock_owned_by_me() helper to have proper lockdep support > even on 64bit builds, and new u64_stats_update_begin_raw() > and u64_stats_update_end_raw methods. > > Fixes: c10d9310edf5 ("tcp: do not assume TCP code is non preemptible") > Reported-by: Fabio Estevam > Diagnosed-by: Francois Romieu > Signed-off-by: Eric Dumazet Thanks for the fix, Eric and Francois! This allows me to do NFS boot again: Tested-by: Fabio Estevam
Re: [REGRESSION] asix: Lots of asix_rx_fixup() errors and slow transmissions
On 2016-05-03 17:16, Dean Jenkins wrote: On 03/05/16 15:42, David B. Robins wrote: I don't think the first one is giving you problems (except as triggered by the second) but I had concerns about the second myself (and emailed the author off-list, but received no reply), and we did not take that commit for our own product. Sorry, I might have missed your original E-mail. Specifically, the second change, 3f30... (original patch: https://www.mail-archive.com/netdev@vger.kernel.org/msg80720.html) (1) appears to do the exact opposite of what it claims, i.e., instead of "resync if this looks like a header", it does "resync if this does NOT look like a (packet) header", where "looks like a header" means "bits 0-10 (size) are equal to the bitwise-NOT of bits 16-26", and (2) can happen by coincidence for 1/2048 32-bit values starting a continuation URB (easy to hit dealing with large volumes of video data as we were). It appears to expect the header for every URB whereas the rest of the code at least expects it only once per network packet (look at following code that only reads it for remaining == 0). David, I think that your interpretation is incorrect. Please see below. Here is the code snippet from the patch with my annotations between # #, I will try to explain my intentions. Feel free to point out any flaws: if (rx->remaining && (rx->remaining + sizeof(u32) <= skb->len)) { # Only runs when rx->remaining !=0 and the end of the Ethernet frame + next 32-bit header word is within the URB buffer. # # Therefore, this code does not run when the end of an Ethernet frame has been reached in the previous URB # # or when the end of the Ethernet frame + next 32-bit header word will be in a later URB buffer # It may well be. I don't have the setup with me now, but I can try tomorrow to reproduce an environment where I can add some more detailed logging. Since the URB length has to be >= than the remaining data plus a u32, the devices that John Stultz and I are using (AX88772B in my case) may be adding some additional data/padding after an Ethernet frame, expecting it to be discarded, and running into this check and its consequences. This may mean the device is badly behaved, if it is specified not to send anything extra; in any case, a well-intentioned error correction has gone badly, but I better understand the intent now. I am curious to know how often the device you are using benefits from this block of code. Regards, Dean David
Re: [PATCH] tcp: ensure non-empty connection request queue
On Tue, 2016-05-03 at 23:54 +0200, Peter Wu wrote: > When applications use listen() with a backlog of 0, the kernel would > set the maximum connection request queue to zero. This causes false > reports of SYN flooding (if tcp_syncookies is enabled) or packet drops > otherwise. > > Prior kernels enforce a minimum size of 8, so do that now as well. > > Fixes: ef547f2ac16b ("tcp: remove max_qlen_log") > Signed-off-by: Peter Wu> --- > Hi, > > This patch fixes a regression from Linux 4.4. Use of "qemu-arm -g 1234" > would trigger the following warning in dmesg: > > TCP: request_sock_TCP: Possible SYN flooding on port 1234. Sending > cookies. Check SNMP counters. > > For some users the "tcp: remove max_qlen_log" change already broke > applications[1]. While listen(3p) says that a backlog argument of 0 sets > the length to an "implementation-defined minimum value", I doubt that > "0" should be considered a valid value (as demonstrated in the above two > real-world applications that worked fine before). It is a hint anyway. > > This patch was tested on top of Linux v4.5 and removes the warning which > would otherwise be present (due to the inet_csk_reqsk_queue_is_full() > check in tcp_conn_request). > > I also looked at modifying the backlog value in inet_listen, but that > might have other unintended effects: > > - If TFO is enabled and tcp_fastopen==0x400, listen(fd, 0) currently >disables TFO (also possible via setsockopt). Forcing a minimum breaks >this path (unlikely to be a problem though since TFO users likely set >a much higher backlog). > - sk->sk_max_ack_backlog is also reported via tcp statistics and seems >really to be the hint rather than the actual interpreted value. > > Kind regards, > Peter > > [1]: > https://lkml.kernel.org/r/cann89i+okfw896-n5ksndeikzuidr8yx1jc089hjnggfdq0...@mail.gmail.com > --- > include/net/inet_connection_sock.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/net/inet_connection_sock.h > b/include/net/inet_connection_sock.h > index 49dcad4..ca0fdbc 100644 > --- a/include/net/inet_connection_sock.h > +++ b/include/net/inet_connection_sock.h > @@ -296,7 +296,7 @@ static inline int inet_csk_reqsk_queue_young(const struct > sock *sk) > > static inline int inet_csk_reqsk_queue_is_full(const struct sock *sk) > { > - return inet_csk_reqsk_queue_len(sk) >= sk->sk_max_ack_backlog; > + return inet_csk_reqsk_queue_len(sk) >= max(8U, sk->sk_max_ack_backlog); > } > > void inet_csk_reqsk_queue_drop(struct sock *sk, struct request_sock *req); Well, I believe I already gave my opinion on this. listen backlog is not a hint. This is a limit. It is the limit of outstanding children in accept queue. If backlog is 0, no child can be put in the accept queue. It is therefore Working As Intented.
[PATC net-next] tcp: must block bh in __inet_twsk_hashdance()
From: Eric Dumazet__inet_twsk_hashdance() might be called from process context, better block BH before acquiring bind hash and established locks Fixes: c10d9310edf5 ("tcp: do not assume TCP code is non preemptible") Signed-off-by: Eric Dumazet --- net/ipv4/inet_timewait_sock.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c index 99ee5c4a9b6844929a995b0b4b5bd693bb211123..2065816748066986f0356df168c2d76fe2d53d85 100644 --- a/net/ipv4/inet_timewait_sock.c +++ b/net/ipv4/inet_timewait_sock.c @@ -94,7 +94,7 @@ static void inet_twsk_add_bind_node(struct inet_timewait_sock *tw, } /* - * Enter the time wait state. This is called with locally disabled BH. + * Enter the time wait state. * Essentially we whip up a timewait bucket, copy the relevant info into it * from the SK, and mess with hash chains and list linkage. */ @@ -112,7 +112,7 @@ void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk, */ bhead = >bhash[inet_bhashfn(twsk_net(tw), inet->inet_num, hashinfo->bhash_size)]; - spin_lock(>lock); + spin_lock_bh(>lock); tw->tw_tb = icsk->icsk_bind_hash; WARN_ON(!icsk->icsk_bind_hash); inet_twsk_add_bind_node(tw, >tw_tb->owners); @@ -138,7 +138,7 @@ void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk, if (__sk_nulls_del_node_init_rcu(sk)) sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); - spin_unlock(lock); + spin_unlock_bh(lock); } EXPORT_SYMBOL_GPL(__inet_twsk_hashdance);
[PATCH net-next] tcp: fix lockdep splat in tcp_snd_una_update()
From: Eric Dumazettcp_snd_una_update() and tcp_rcv_nxt_update() call u64_stats_update_begin() either from process context or BH handler. This triggers a lockdep splat on 32bit & SMP builds. We could add u64_stats_update_begin_bh() variant but this would slow down 32bit builds with useless local_disable_bh() and local_enable_bh() pairs, since we own the socket lock at this point. I add sock_owned_by_me() helper to have proper lockdep support even on 64bit builds, and new u64_stats_update_begin_raw() and u64_stats_update_end_raw methods. Fixes: c10d9310edf5 ("tcp: do not assume TCP code is non preemptible") Reported-by: Fabio Estevam Diagnosed-by: Francois Romieu Signed-off-by: Eric Dumazet --- include/linux/u64_stats_sync.h | 14 ++ include/net/sock.h |7 ++- net/ipv4/tcp_input.c | 10 ++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h index df89c9bcba7db8dbde3bbf2b99f9af6ed562b112..d3a2bb712af3b9613b98ef9c3219f8dcd31568a5 100644 --- a/include/linux/u64_stats_sync.h +++ b/include/linux/u64_stats_sync.h @@ -89,6 +89,20 @@ static inline void u64_stats_update_end(struct u64_stats_sync *syncp) #endif } +static inline void u64_stats_update_begin_raw(struct u64_stats_sync *syncp) +{ +#if BITS_PER_LONG==32 && defined(CONFIG_SMP) + raw_write_seqcount_begin(>seq); +#endif +} + +static inline void u64_stats_update_end_raw(struct u64_stats_sync *syncp) +{ +#if BITS_PER_LONG==32 && defined(CONFIG_SMP) + raw_write_seqcount_end(>seq); +#endif +} + static inline unsigned int u64_stats_fetch_begin(const struct u64_stats_sync *syncp) { #if BITS_PER_LONG==32 && defined(CONFIG_SMP) diff --git a/include/net/sock.h b/include/net/sock.h index 45f5b492c65883cd22e2f615e019fe0d0ba31167..c9c8b19df27c558354687119db60c0716909ea3f 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1421,11 +1421,16 @@ static inline void unlock_sock_fast(struct sock *sk, bool slow) * accesses from user process context. */ -static inline bool sock_owned_by_user(const struct sock *sk) +static inline void sock_owned_by_me(const struct sock *sk) { #ifdef CONFIG_LOCKDEP WARN_ON_ONCE(!lockdep_sock_is_held(sk) && debug_locks); #endif +} + +static inline bool sock_owned_by_user(const struct sock *sk) +{ + sock_owned_by_me(sk); return sk->sk_lock.owned; } diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 6171f92be0903f5a5d17f027dbe6b31829bcc043..a914e0607895dd9321559f93c1008f8de13b73ad 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -3355,9 +3355,10 @@ static void tcp_snd_una_update(struct tcp_sock *tp, u32 ack) { u32 delta = ack - tp->snd_una; - u64_stats_update_begin(>syncp); + sock_owned_by_me((struct sock *)tp); + u64_stats_update_begin_raw(>syncp); tp->bytes_acked += delta; - u64_stats_update_end(>syncp); + u64_stats_update_end_raw(>syncp); tp->snd_una = ack; } @@ -3366,9 +3367,10 @@ static void tcp_rcv_nxt_update(struct tcp_sock *tp, u32 seq) { u32 delta = seq - tp->rcv_nxt; - u64_stats_update_begin(>syncp); + sock_owned_by_me((struct sock *)tp); + u64_stats_update_begin_raw(>syncp); tp->bytes_received += delta; - u64_stats_update_end(>syncp); + u64_stats_update_end_raw(>syncp); tp->rcv_nxt = seq; }
[PATCH] igb: adjust ptp timestamps for tx/rx latency
Table 7-62 on page 338 of the i210 datasheet lists TX and RX latencies for the various speeds the chip supports. To give better ptp timestamp accuracy, adjust the timestamps by the amounts Intel gives based on current link speed. Signed-off-by: Nathan Sullivan--- drivers/net/ethernet/intel/igb/igb.h |8 +++ drivers/net/ethernet/intel/igb/igb_ptp.c | 36 ++ 2 files changed, 44 insertions(+) diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h index 9413fa6..7cee61f9 100644 --- a/drivers/net/ethernet/intel/igb/igb.h +++ b/drivers/net/ethernet/intel/igb/igb.h @@ -91,6 +91,14 @@ struct igb_adapter; #define NVM_COMB_VER_OFF 0x0083 #define NVM_COMB_VER_PTR 0x003d +/* Transmit and receive latency (for PTP timestamps) */ +#define IGB_I210_TX_LATENCY_10 9542 +#define IGB_I210_TX_LATENCY_1001024 +#define IGB_I210_TX_LATENCY_1000 178 +#define IGB_I210_RX_LATENCY_10 20662 +#define IGB_I210_RX_LATENCY_1002213 +#define IGB_I210_RX_LATENCY_1000 448 + struct vf_data_storage { unsigned char vf_mac_addresses[ETH_ALEN]; u16 vf_mc_hashes[IGB_MAX_VF_MC_ENTRIES]; diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c index 22a8a29..76a896d 100644 --- a/drivers/net/ethernet/intel/igb/igb_ptp.c +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c @@ -722,11 +722,29 @@ static void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter) struct e1000_hw *hw = >hw; struct skb_shared_hwtstamps shhwtstamps; u64 regval; + int adjust = 0; regval = rd32(E1000_TXSTMPL); regval |= (u64)rd32(E1000_TXSTMPH) << 32; igb_ptp_systim_to_hwtstamp(adapter, , regval); + /* adjust timestamp for the TX latency based on link speed */ + if (adapter->hw.mac.type == e1000_i210) { + switch (adapter->link_speed) { + case SPEED_10: + adjust = IGB_I210_TX_LATENCY_10; + break; + case SPEED_100: + adjust = IGB_I210_TX_LATENCY_100; + break; + case SPEED_1000: + adjust = IGB_I210_TX_LATENCY_1000; + break; + } + } + + shhwtstamps.hwtstamp = ktime_sub_ns(shhwtstamps.hwtstamp, adjust); + skb_tstamp_tx(adapter->ptp_tx_skb, ); dev_kfree_skb_any(adapter->ptp_tx_skb); adapter->ptp_tx_skb = NULL; @@ -771,6 +789,7 @@ void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, struct igb_adapter *adapter = q_vector->adapter; struct e1000_hw *hw = >hw; u64 regval; + int adjust = 0; /* If this bit is set, then the RX registers contain the time stamp. No * other packet will be time stamped until we read these registers, so @@ -790,6 +809,23 @@ void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, igb_ptp_systim_to_hwtstamp(adapter, skb_hwtstamps(skb), regval); + /* adjust timestamp for the RX latency based on link speed */ + if (adapter->hw.mac.type == e1000_i210) { + switch (adapter->link_speed) { + case SPEED_10: + adjust = IGB_I210_RX_LATENCY_10; + break; + case SPEED_100: + adjust = IGB_I210_RX_LATENCY_100; + break; + case SPEED_1000: + adjust = IGB_I210_RX_LATENCY_1000; + break; + } + } + skb_hwtstamps(skb)->hwtstamp = + ktime_add_ns(skb_hwtstamps(skb)->hwtstamp, adjust); + /* Update the last_rx_timestamp timer in order to enable watchdog check * for error case of latched timestamp on a dropped packet. */ -- 1.7.10.4
[PATCH net v3 1/2] udp_tunnel: Remove redundant udp_tunnel_gro_complete().
The setting of the UDP tunnel GSO type is already performed by udp[46]_gro_complete(). Signed-off-by: Jarno Rajahalme--- drivers/net/geneve.c | 2 -- drivers/net/vxlan.c | 2 -- include/net/udp_tunnel.h | 9 - net/ipv4/fou.c | 2 -- 4 files changed, 15 deletions(-) diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index bc16889..98f1224 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -504,8 +504,6 @@ static int geneve_gro_complete(struct sk_buff *skb, int nhoff, int gh_len; int err = -ENOSYS; - udp_tunnel_gro_complete(skb, nhoff); - gh = (struct genevehdr *)(skb->data + nhoff); gh_len = geneve_hlen(gh); type = gh->proto_type; diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 1c0fa36..dd2d032 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -616,8 +616,6 @@ out: static int vxlan_gro_complete(struct sk_buff *skb, int nhoff, struct udp_offload *uoff) { - udp_tunnel_gro_complete(skb, nhoff); - return eth_gro_complete(skb, nhoff + sizeof(struct vxlanhdr)); } diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h index b831140..a114024 100644 --- a/include/net/udp_tunnel.h +++ b/include/net/udp_tunnel.h @@ -106,15 +106,6 @@ static inline struct sk_buff *udp_tunnel_handle_offloads(struct sk_buff *skb, return iptunnel_handle_offloads(skb, type); } -static inline void udp_tunnel_gro_complete(struct sk_buff *skb, int nhoff) -{ - struct udphdr *uh; - - uh = (struct udphdr *)(skb->data + nhoff - sizeof(struct udphdr)); - skb_shinfo(skb)->gso_type |= uh->check ? - SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL; -} - static inline void udp_tunnel_encap_enable(struct socket *sock) { #if IS_ENABLED(CONFIG_IPV6) diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c index a39068b..305d9ac 100644 --- a/net/ipv4/fou.c +++ b/net/ipv4/fou.c @@ -228,8 +228,6 @@ static int fou_gro_complete(struct sk_buff *skb, int nhoff, int err = -ENOSYS; const struct net_offload **offloads; - udp_tunnel_gro_complete(skb, nhoff); - rcu_read_lock(); offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads; ops = rcu_dereference(offloads[proto]); -- 2.7.4
[PATCH net v3 2/2] udp_offload: Set encapsulation before inner completes.
UDP tunnel segmentation code relies on the inner offsets being set for an UDP tunnel GSO packet, but the inner *_complete() functions will set the inner offsets only if 'encapsulation' is set before calling them. Currently, udp_gro_complete() sets 'encapsulation' only after the inner *_complete() functions are done. This causes the inner offsets having invalid values after udp_gro_complete() returns, which in turn will make it impossible to properly segment the packet in case it needs to be forwarded, which would be visible to the user either as invalid packets being sent or as packet loss. This patch fixes this by setting skb's 'encapsulation' in udp_gro_complete() before calling into the inner complete functions, and by making each possible UDP tunnel gro_complete() callback set the inner_mac_header to the beginning of the tunnel payload. Signed-off-by: Jarno Rajahalme--- v3: Added setting inner_mac_header from all possible callbacks to cover cases where there is no inner mac header. drivers/net/geneve.c | 3 +++ drivers/net/vxlan.c | 3 +++ include/linux/netdevice.h | 3 +++ net/ipv4/fou.c| 4 net/ipv4/udp_offload.c| 8 +--- 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index 98f1224..7b0a644 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -514,6 +514,9 @@ static int geneve_gro_complete(struct sk_buff *skb, int nhoff, err = ptype->callbacks.gro_complete(skb, nhoff + gh_len); rcu_read_unlock(); + + skb_set_inner_mac_header(skb, nhoff + gh_len); + return err; } diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index dd2d032..8ac261a 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -616,6 +616,9 @@ out: static int vxlan_gro_complete(struct sk_buff *skb, int nhoff, struct udp_offload *uoff) { + /* Sets 'skb->inner_mac_header' since we are always called with +* 'skb->encapsulation' set. +*/ return eth_gro_complete(skb, nhoff + sizeof(struct vxlanhdr)); } diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index b3c46b0..78181a8 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -2164,6 +2164,9 @@ struct packet_offload { struct udp_offload; +/* 'skb->encapsulation' is set before gro_complete() is called. gro_complete() + * must set 'skb->inner_mac_header' to the beginning of tunnel payload. + */ struct udp_offload_callbacks { struct sk_buff **(*gro_receive)(struct sk_buff **head, struct sk_buff *skb, diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c index 305d9ac..a6962cc 100644 --- a/net/ipv4/fou.c +++ b/net/ipv4/fou.c @@ -236,6 +236,8 @@ static int fou_gro_complete(struct sk_buff *skb, int nhoff, err = ops->callbacks.gro_complete(skb, nhoff); + skb_set_inner_mac_header(skb, nhoff); + out_unlock: rcu_read_unlock(); @@ -412,6 +414,8 @@ static int gue_gro_complete(struct sk_buff *skb, int nhoff, err = ops->callbacks.gro_complete(skb, nhoff + guehlen); + skb_set_inner_mac_header(skb, nhoff + guehlen); + out_unlock: rcu_read_unlock(); return err; diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index 0ed2daf..e330c0e 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c @@ -399,6 +399,11 @@ int udp_gro_complete(struct sk_buff *skb, int nhoff) uh->len = newlen; + /* Set encapsulation before calling into inner gro_complete() functions +* to make them set up the inner offsets. +*/ + skb->encapsulation = 1; + rcu_read_lock(); uo_priv = rcu_dereference(udp_offload_base); @@ -421,9 +426,6 @@ int udp_gro_complete(struct sk_buff *skb, int nhoff) if (skb->remcsum_offload) skb_shinfo(skb)->gso_type |= SKB_GSO_TUNNEL_REMCSUM; - skb->encapsulation = 1; - skb_set_inner_mac_header(skb, nhoff + sizeof(struct udphdr)); - return err; } -- 2.7.4
[PATCH 14/15] batman-adv: Merge batadv_v_ogm_orig_update into batadv_v_ogm_route_update
From: Simon WunderlichSince batadv_v_ogm_orig_update() was only called from one place and the calling function became very short, merge these two functions together. This should also reflect the protocol description of B.A.T.M.A.N. V better. Signed-off-by: Simon Wunderlich Signed-off-by: Marek Lindner Signed-off-by: Antonio Quartulli --- net/batman-adv/bat_v_ogm.c | 117 ++--- 1 file changed, 46 insertions(+), 71 deletions(-) diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c index 07c999734fba..4155fa57cf6d 100644 --- a/net/batman-adv/bat_v_ogm.c +++ b/net/batman-adv/bat_v_ogm.c @@ -234,73 +234,6 @@ void batadv_v_ogm_primary_iface_set(struct batadv_hard_iface *primary_iface) } /** - * batadv_v_ogm_orig_update - update the originator status based on the received - * OGM - * @bat_priv: the bat priv with all the soft interface information - * @orig_node: the originator to update - * @neigh_node: the neighbour the OGM has been received from (to update) - * @ogm2: the received OGM - * @if_outgoing: the interface where this OGM is going to be forwarded through - */ -static void -batadv_v_ogm_orig_update(struct batadv_priv *bat_priv, -struct batadv_orig_node *orig_node, -struct batadv_neigh_node *neigh_node, -const struct batadv_ogm2_packet *ogm2, -struct batadv_hard_iface *if_outgoing) -{ - struct batadv_neigh_ifinfo *router_ifinfo = NULL, *neigh_ifinfo = NULL; - struct batadv_neigh_node *router = NULL; - s32 neigh_seq_diff; - u32 neigh_last_seqno; - u32 router_last_seqno; - u32 router_throughput, neigh_throughput; - - batadv_dbg(BATADV_DBG_BATMAN, bat_priv, - "Searching and updating originator entry of received packet\n"); - - /* if this neighbor already is our next hop there is nothing -* to change -*/ - router = batadv_orig_router_get(orig_node, if_outgoing); - if (router == neigh_node) - goto out; - - /* don't consider neighbours with worse throughput. -* also switch route if this seqno is BATADV_V_MAX_ORIGDIFF newer than -* the last received seqno from our best next hop. -*/ - if (router) { - router_ifinfo = batadv_neigh_ifinfo_get(router, if_outgoing); - neigh_ifinfo = batadv_neigh_ifinfo_get(neigh_node, if_outgoing); - - /* if these are not allocated, something is wrong. */ - if (!router_ifinfo || !neigh_ifinfo) - goto out; - - neigh_last_seqno = neigh_ifinfo->bat_v.last_seqno; - router_last_seqno = router_ifinfo->bat_v.last_seqno; - neigh_seq_diff = neigh_last_seqno - router_last_seqno; - router_throughput = router_ifinfo->bat_v.throughput; - neigh_throughput = neigh_ifinfo->bat_v.throughput; - - if ((neigh_seq_diff < BATADV_OGM_MAX_ORIGDIFF) && - (router_throughput >= neigh_throughput)) - goto out; - } - - batadv_update_route(bat_priv, orig_node, if_outgoing, neigh_node); - -out: - if (router_ifinfo) - batadv_neigh_ifinfo_put(router_ifinfo); - if (neigh_ifinfo) - batadv_neigh_ifinfo_put(neigh_ifinfo); - if (router) - batadv_neigh_node_put(router); -} - -/** * batadv_v_forward_penalty - apply a penalty to the throughput metric forwarded * with B.A.T.M.A.N. V OGMs * @bat_priv: the bat priv with all the soft interface information @@ -546,6 +479,11 @@ static bool batadv_v_ogm_route_update(struct batadv_priv *bat_priv, struct batadv_neigh_node *router = NULL; struct batadv_orig_node *orig_neigh_node = NULL; struct batadv_neigh_node *orig_neigh_router = NULL; + struct batadv_neigh_ifinfo *router_ifinfo = NULL, *neigh_ifinfo = NULL; + u32 router_throughput, neigh_throughput; + u32 router_last_seqno; + u32 neigh_last_seqno; + s32 neigh_seq_diff; bool forward = false; orig_neigh_node = batadv_v_ogm_orig_get(bat_priv, ethhdr->h_source); @@ -565,11 +503,44 @@ static bool batadv_v_ogm_route_update(struct batadv_priv *bat_priv, goto out; } - /* Update routes, and check if the OGM is from the best next hop */ - batadv_v_ogm_orig_update(bat_priv, orig_node, neigh_node, ogm2, -if_outgoing); - + /* Mark the OGM to be considered for forwarding, and update routes +* if needed. +*/ forward = true; + + batadv_dbg(BATADV_DBG_BATMAN, bat_priv, + "Searching and updating originator entry of received packet\n"); + + /* if this neighbor already is our next
[PATCH 12/15] batman-adv: fix debuginfo macro style issue
From: Simon WunderlichStructure initialization within the macros should follow the general coding style used in the kernel: put the initialization of the first variable and the closing brace on a separate line. Reported-by: Antonio Quartulli Signed-off-by: Simon Wunderlich [s...@narfation.org: fix conflicts with current version] Signed-off-by: Sven Eckelmann Signed-off-by: Marek Lindner Signed-off-by: Antonio Quartulli --- net/batman-adv/debugfs.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/net/batman-adv/debugfs.c b/net/batman-adv/debugfs.c index 48253cf8341b..aa315da83429 100644 --- a/net/batman-adv/debugfs.c +++ b/net/batman-adv/debugfs.c @@ -365,14 +365,17 @@ static int batadv_nc_nodes_open(struct inode *inode, struct file *file) #define BATADV_DEBUGINFO(_name, _mode, _open) \ struct batadv_debuginfo batadv_debuginfo_##_name = { \ - .attr = { .name = __stringify(_name), \ - .mode = _mode, }, \ - .fops = { .owner = THIS_MODULE, \ - .open = _open,\ - .read = seq_read, \ - .llseek = seq_lseek, \ - .release = single_release,\ - } \ + .attr = { \ + .name = __stringify(_name), \ + .mode = _mode, \ + }, \ + .fops = { \ + .owner = THIS_MODULE, \ + .open = _open, \ + .read = seq_read, \ + .llseek = seq_lseek,\ + .release = single_release, \ + }, \ } /* the following attributes are general and therefore they will be directly -- 2.8.2
[PATCH 11/15] batman-adv: Fix function names on new line starting with '*'
From: Sven EckelmannSome really long function names in batman-adv require a newline between return type and the function name. This has lead to some lines starting with *batadv_... This * belongs to the return type and thus should be on the same line as the return type. Signed-off-by: Sven Eckelmann Signed-off-by: Marek Lindner Signed-off-by: Antonio Quartulli --- net/batman-adv/bridge_loop_avoidance.c | 6 +++--- net/batman-adv/main.c | 8 net/batman-adv/network-coding.c| 18 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 60d33232bd10..2c9aa671a49b 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c @@ -200,9 +200,9 @@ static void batadv_claim_put(struct batadv_bla_claim *claim) * * Return: claim if found or NULL otherwise. */ -static struct batadv_bla_claim -*batadv_claim_hash_find(struct batadv_priv *bat_priv, - struct batadv_bla_claim *data) +static struct batadv_bla_claim * +batadv_claim_hash_find(struct batadv_priv *bat_priv, + struct batadv_bla_claim *data) { struct batadv_hashtable *hash = bat_priv->bla.claim_hash; struct hlist_head *head; diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c index d64ddb961979..78c05a91ae6f 100644 --- a/net/batman-adv/main.c +++ b/net/batman-adv/main.c @@ -663,8 +663,8 @@ static void batadv_tvlv_handler_put(struct batadv_tvlv_handler *tvlv_handler) * * Return: tvlv handler if found or NULL otherwise. */ -static struct batadv_tvlv_handler -*batadv_tvlv_handler_get(struct batadv_priv *bat_priv, u8 type, u8 version) +static struct batadv_tvlv_handler * +batadv_tvlv_handler_get(struct batadv_priv *bat_priv, u8 type, u8 version) { struct batadv_tvlv_handler *tvlv_handler_tmp, *tvlv_handler = NULL; @@ -722,8 +722,8 @@ static void batadv_tvlv_container_put(struct batadv_tvlv_container *tvlv) * * Return: tvlv container if found or NULL otherwise. */ -static struct batadv_tvlv_container -*batadv_tvlv_container_get(struct batadv_priv *bat_priv, u8 type, u8 version) +static struct batadv_tvlv_container * +batadv_tvlv_container_get(struct batadv_priv *bat_priv, u8 type, u8 version) { struct batadv_tvlv_container *tvlv_tmp, *tvlv = NULL; diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c index 0d3bf4368e9b..1da8e0e1b18f 100644 --- a/net/batman-adv/network-coding.c +++ b/net/batman-adv/network-coding.c @@ -793,10 +793,10 @@ static bool batadv_can_nc_with_orig(struct batadv_priv *bat_priv, * * Return: the nc_node if found, NULL otherwise. */ -static struct batadv_nc_node -*batadv_nc_find_nc_node(struct batadv_orig_node *orig_node, - struct batadv_orig_node *orig_neigh_node, - bool in_coding) +static struct batadv_nc_node * +batadv_nc_find_nc_node(struct batadv_orig_node *orig_node, + struct batadv_orig_node *orig_neigh_node, + bool in_coding) { struct batadv_nc_node *nc_node, *nc_node_out = NULL; struct list_head *list; @@ -835,11 +835,11 @@ static struct batadv_nc_node * * Return: the nc_node if found or created, NULL in case of an error. */ -static struct batadv_nc_node -*batadv_nc_get_nc_node(struct batadv_priv *bat_priv, - struct batadv_orig_node *orig_node, - struct batadv_orig_node *orig_neigh_node, - bool in_coding) +static struct batadv_nc_node * +batadv_nc_get_nc_node(struct batadv_priv *bat_priv, + struct batadv_orig_node *orig_node, + struct batadv_orig_node *orig_neigh_node, + bool in_coding) { struct batadv_nc_node *nc_node; spinlock_t *lock; /* Used to lock list selected by "int in_coding" */ -- 2.8.2
[PATCH 10/15] batman-adv: Add kernel-doc for batadv_interface_rx
From: Sven EckelmannSigned-off-by: Sven Eckelmann Signed-off-by: Marek Lindner Signed-off-by: Antonio Quartulli --- net/batman-adv/soft-interface.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index e158235ada06..d78c560852d7 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c @@ -381,6 +381,24 @@ end: return NETDEV_TX_OK; } +/** + * batadv_interface_rx - receive ethernet frame on local batman-adv interface + * @soft_iface: local interface which will receive the ethernet frame + * @skb: ethernet frame for @soft_iface + * @recv_if: interface on which the batman-adv packet was received + * @hdr_size: size of already parsed batman-adv header + * @orig_node: originator from which the batman-adv packet was sent + * + * Sends a ethernet frame to the receive path of the local @soft_iface. + * skb->data has still point to the batman-adv header with the size @hdr_size. + * The caller has to have parsed this header already and made sure that at least + * @hdr_size bytes are still available for pull in @skb. + * + * The packet may still get dropped. This can happen when the encapsulated + * ethernet frame is invalid or contains again an batman-adv packet. Also + * unicast packets will be dropped directly when it was sent between two + * isolated clients. + */ void batadv_interface_rx(struct net_device *soft_iface, struct sk_buff *skb, struct batadv_hard_iface *recv_if, int hdr_size, struct batadv_orig_node *orig_node) -- 2.8.2
[PATCH 13/15] batman-adv: move and restructure batadv_v_ogm_forward
From: Simon WunderlichTo match our code better to the protocol description of B.A.T.M.A.N. V, move batadv_v_ogm_forward() out into batadv_v_ogm_process_per_outif() and move all checks directly deciding whether the OGM should be forwarded into batadv_v_ogm_forward(). Signed-off-by: Simon Wunderlich Signed-off-by: Marek Lindner Signed-off-by: Antonio Quartulli --- net/batman-adv/bat_v_ogm.c | 110 ++--- 1 file changed, 63 insertions(+), 47 deletions(-) diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c index d9bcbe6e7d65..07c999734fba 100644 --- a/net/batman-adv/bat_v_ogm.c +++ b/net/batman-adv/bat_v_ogm.c @@ -347,10 +347,12 @@ static u32 batadv_v_forward_penalty(struct batadv_priv *bat_priv, } /** - * batadv_v_ogm_forward - forward an OGM to the given outgoing interface + * batadv_v_ogm_forward - check conditions and forward an OGM to the given + * outgoing interface * @bat_priv: the bat priv with all the soft interface information * @ogm_received: previously received OGM to be forwarded - * @throughput: throughput to announce, may vary per outgoing interface + * @orig_node: the originator which has been updated + * @neigh_node: the neigh_node through with the OGM has been received * @if_incoming: the interface on which this OGM was received on * @if_outgoing: the interface to which the OGM has to be forwarded to * @@ -359,28 +361,57 @@ static u32 batadv_v_forward_penalty(struct batadv_priv *bat_priv, */ static void batadv_v_ogm_forward(struct batadv_priv *bat_priv, const struct batadv_ogm2_packet *ogm_received, -u32 throughput, +struct batadv_orig_node *orig_node, +struct batadv_neigh_node *neigh_node, struct batadv_hard_iface *if_incoming, struct batadv_hard_iface *if_outgoing) { + struct batadv_neigh_ifinfo *neigh_ifinfo = NULL; + struct batadv_orig_ifinfo *orig_ifinfo = NULL; + struct batadv_neigh_node *router = NULL; struct batadv_ogm2_packet *ogm_forward; unsigned char *skb_buff; struct sk_buff *skb; size_t packet_len; u16 tvlv_len; + /* only forward for specific interfaces, not for the default one. */ + if (if_outgoing == BATADV_IF_DEFAULT) + goto out; + + orig_ifinfo = batadv_orig_ifinfo_new(orig_node, if_outgoing); + if (!orig_ifinfo) + goto out; + + /* acquire possibly updated router */ + router = batadv_orig_router_get(orig_node, if_outgoing); + + /* strict rule: forward packets coming from the best next hop only */ + if (neigh_node != router) + goto out; + + /* don't forward the same seqno twice on one interface */ + if (orig_ifinfo->last_seqno_forwarded == ntohl(ogm_received->seqno)) + goto out; + + orig_ifinfo->last_seqno_forwarded = ntohl(ogm_received->seqno); + if (ogm_received->ttl <= 1) { batadv_dbg(BATADV_DBG_BATMAN, bat_priv, "ttl exceeded\n"); - return; + goto out; } + neigh_ifinfo = batadv_neigh_ifinfo_get(neigh_node, if_outgoing); + if (!neigh_ifinfo) + goto out; + tvlv_len = ntohs(ogm_received->tvlv_len); packet_len = BATADV_OGM2_HLEN + tvlv_len; skb = netdev_alloc_skb_ip_align(if_outgoing->net_dev, ETH_HLEN + packet_len); if (!skb) - return; + goto out; skb_reserve(skb, ETH_HLEN); skb_buff = skb_put(skb, packet_len); @@ -388,15 +419,23 @@ static void batadv_v_ogm_forward(struct batadv_priv *bat_priv, /* apply forward penalty */ ogm_forward = (struct batadv_ogm2_packet *)skb_buff; - ogm_forward->throughput = htonl(throughput); + ogm_forward->throughput = htonl(neigh_ifinfo->bat_v.throughput); ogm_forward->ttl--; batadv_dbg(BATADV_DBG_BATMAN, bat_priv, "Forwarding OGM2 packet on %s: throughput %u, ttl %u, received via %s\n", - if_outgoing->net_dev->name, throughput, ogm_forward->ttl, - if_incoming->net_dev->name); + if_outgoing->net_dev->name, ntohl(ogm_forward->throughput), + ogm_forward->ttl, if_incoming->net_dev->name); batadv_v_ogm_send_to_if(skb, if_outgoing); + +out: + if (orig_ifinfo) + batadv_orig_ifinfo_put(orig_ifinfo); + if (router) + batadv_neigh_node_put(router); + if (neigh_ifinfo) + batadv_neigh_ifinfo_put(neigh_ifinfo); } /** @@ -493,8 +532,10 @@ out: * @neigh_node: the neigh_node through with the OGM has been
[PATCH 15/15] batman-adv: Split batadv_iv_ogm_orig_del_if function
From: Sven Eckelmannbatadv_iv_ogm_orig_del_if handles two different buffers bcast_own and bcast_own_sum which should be resized. The error handling two for allocating these buffers causes the complexity of this function. This can be avoided completely when the function is split into a main function handling the locking, freeing and call of the subfunctions. The subfunction can then independently handle the resize of the buffers. This also allows to easily reuse the old buffer (which always is larger) in case a smaller buffer could not be allocated without increasing the code complexity. Signed-off-by: Sven Eckelmann Signed-off-by: Marek Lindner Signed-off-by: Antonio Quartulli --- net/batman-adv/bat_iv_ogm.c | 131 1 file changed, 84 insertions(+), 47 deletions(-) diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 682fcaec56e6..8c1710bba803 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -175,6 +176,79 @@ unlock: } /** + * batadv_iv_ogm_drop_bcast_own_entry - drop section of bcast_own + * @orig_node: the orig_node that has to be changed + * @max_if_num: the current amount of interfaces + * @del_if_num: the index of the interface being removed + */ +static void +batadv_iv_ogm_drop_bcast_own_entry(struct batadv_orig_node *orig_node, + int max_if_num, int del_if_num) +{ + size_t chunk_size; + size_t if_offset; + void *data_ptr; + + lockdep_assert_held(_node->bat_iv.ogm_cnt_lock); + + chunk_size = sizeof(unsigned long) * BATADV_NUM_WORDS; + data_ptr = kmalloc_array(max_if_num, chunk_size, GFP_ATOMIC); + if (!data_ptr) + /* use old buffer when new one could not be allocated */ + data_ptr = orig_node->bat_iv.bcast_own; + + /* copy first part */ + memmove(data_ptr, orig_node->bat_iv.bcast_own, del_if_num * chunk_size); + + /* copy second part */ + if_offset = (del_if_num + 1) * chunk_size; + memmove((char *)data_ptr + del_if_num * chunk_size, + (uint8_t *)orig_node->bat_iv.bcast_own + if_offset, + (max_if_num - del_if_num) * chunk_size); + + /* bcast_own was shrunk down in new buffer; free old one */ + if (orig_node->bat_iv.bcast_own != data_ptr) { + kfree(orig_node->bat_iv.bcast_own); + orig_node->bat_iv.bcast_own = data_ptr; + } +} + +/** + * batadv_iv_ogm_drop_bcast_own_sum_entry - drop section of bcast_own_sum + * @orig_node: the orig_node that has to be changed + * @max_if_num: the current amount of interfaces + * @del_if_num: the index of the interface being removed + */ +static void +batadv_iv_ogm_drop_bcast_own_sum_entry(struct batadv_orig_node *orig_node, + int max_if_num, int del_if_num) +{ + size_t if_offset; + void *data_ptr; + + lockdep_assert_held(_node->bat_iv.ogm_cnt_lock); + + data_ptr = kmalloc_array(max_if_num, sizeof(u8), GFP_ATOMIC); + if (!data_ptr) + /* use old buffer when new one could not be allocated */ + data_ptr = orig_node->bat_iv.bcast_own_sum; + + memmove(data_ptr, orig_node->bat_iv.bcast_own_sum, + del_if_num * sizeof(u8)); + + if_offset = (del_if_num + 1) * sizeof(u8); + memmove((char *)data_ptr + del_if_num * sizeof(u8), + orig_node->bat_iv.bcast_own_sum + if_offset, + (max_if_num - del_if_num) * sizeof(u8)); + + /* bcast_own_sum was shrunk down in new buffer; free old one */ + if (orig_node->bat_iv.bcast_own_sum != data_ptr) { + kfree(orig_node->bat_iv.bcast_own_sum); + orig_node->bat_iv.bcast_own_sum = data_ptr; + } +} + +/** * batadv_iv_ogm_orig_del_if - change the private structures of the orig_node to * exclude the removed interface * @orig_node: the orig_node that has to be changed @@ -186,60 +260,23 @@ unlock: static int batadv_iv_ogm_orig_del_if(struct batadv_orig_node *orig_node, int max_if_num, int del_if_num) { - int ret = -ENOMEM; - size_t chunk_size, if_offset; - void *data_ptr = NULL; - spin_lock_bh(_node->bat_iv.ogm_cnt_lock); - /* last interface was removed */ - if (max_if_num == 0) - goto free_bcast_own; - - chunk_size = sizeof(unsigned long) * BATADV_NUM_WORDS; - data_ptr = kmalloc_array(max_if_num, chunk_size, GFP_ATOMIC); - if (!data_ptr) - goto unlock; - - /* copy first part */ - memcpy(data_ptr, orig_node->bat_iv.bcast_own, del_if_num * chunk_size); - - /* copy second part */ - if_offset = (del_if_num + 1) *
[PATCH] tcp: ensure non-empty connection request queue
When applications use listen() with a backlog of 0, the kernel would set the maximum connection request queue to zero. This causes false reports of SYN flooding (if tcp_syncookies is enabled) or packet drops otherwise. Prior kernels enforce a minimum size of 8, so do that now as well. Fixes: ef547f2ac16b ("tcp: remove max_qlen_log") Signed-off-by: Peter Wu--- Hi, This patch fixes a regression from Linux 4.4. Use of "qemu-arm -g 1234" would trigger the following warning in dmesg: TCP: request_sock_TCP: Possible SYN flooding on port 1234. Sending cookies. Check SNMP counters. For some users the "tcp: remove max_qlen_log" change already broke applications[1]. While listen(3p) says that a backlog argument of 0 sets the length to an "implementation-defined minimum value", I doubt that "0" should be considered a valid value (as demonstrated in the above two real-world applications that worked fine before). It is a hint anyway. This patch was tested on top of Linux v4.5 and removes the warning which would otherwise be present (due to the inet_csk_reqsk_queue_is_full() check in tcp_conn_request). I also looked at modifying the backlog value in inet_listen, but that might have other unintended effects: - If TFO is enabled and tcp_fastopen==0x400, listen(fd, 0) currently disables TFO (also possible via setsockopt). Forcing a minimum breaks this path (unlikely to be a problem though since TFO users likely set a much higher backlog). - sk->sk_max_ack_backlog is also reported via tcp statistics and seems really to be the hint rather than the actual interpreted value. Kind regards, Peter [1]: https://lkml.kernel.org/r/cann89i+okfw896-n5ksndeikzuidr8yx1jc089hjnggfdq0...@mail.gmail.com --- include/net/inet_connection_sock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index 49dcad4..ca0fdbc 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h @@ -296,7 +296,7 @@ static inline int inet_csk_reqsk_queue_young(const struct sock *sk) static inline int inet_csk_reqsk_queue_is_full(const struct sock *sk) { - return inet_csk_reqsk_queue_len(sk) >= sk->sk_max_ack_backlog; + return inet_csk_reqsk_queue_len(sk) >= max(8U, sk->sk_max_ack_backlog); } void inet_csk_reqsk_queue_drop(struct sock *sk, struct request_sock *req); -- 1.9.1
Re: Cannot use NFS with linux-next 20160429
On Wed, 2016-05-04 at 00:31 +0200, Francois Romieu wrote: > Fabio Estevam <feste...@gmail.com> : > [...] > > Today's next shows some different info: > > > > [7.606456] #0: wm8962-audio > > [7.672659] VFS: Mounted root (nfs filesystem) readonly on device 0:14. > > [7.680860] devtmpfs: mounted > > [7.685664] Freeing unused kernel memory: 1024K (c0c0 - c0d0) > > [7.871481] > > [7.873004] = > > [7.877381] [ INFO: inconsistent lock state ] > > [7.881760] 4.6.0-rc6-next-20160503-2-g51d9962 #351 Not tainted > > [7.888043] - > > [7.892419] inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage. > > [7.898449] kworker/0:1H/179 [HC0[0]:SC0[0]:HE1:SE1] takes: > > [7.904040] (>seq#5){+.?...}, at: [] > > tcp_ack+0x134/0x129c > > [7.911166] {IN-SOFTIRQ-W} state was registered at: > > [7.916061] [] lock_acquire+0x78/0x98 > > [7.920816] [] tcp_snd_una_update+0x64/0xa8 > > [7.926092] [] tcp_ack+0x134/0x129c > > [7.930668] [] tcp_rcv_state_process+0x814/0xfc8 > > [7.936375] [] tcp_v4_do_rcv+0x64/0x1c8 > > [7.941305] [] tcp_v4_rcv+0xf00/0xfbc > > [7.946057] [] ip_local_deliver_finish+0xd4/0x550 > > [7.951859] [] ip_local_deliver+0xcc/0xdc > > [7.956957] [] ip_rcv_finish+0xc4/0x744 > > [7.961881] [] ip_rcv+0x4c8/0x7a8 > > [7.966284] [] __netif_receive_skb_core+0x514/0x8ec > > [7.972251] [] __netif_receive_skb+0x2c/0x8c > > [7.977614] [] netif_receive_skb_internal+0x7c/0x1f0 > > [7.983666] [] napi_gro_receive+0x88/0xdc > > [7.988764] [] fec_enet_rx_napi+0x390/0x9c8 > > [7.994036] [] net_rx_action+0x148/0x344 > > [7.999046] [] __do_softirq+0x130/0x2bc > [...] > > [8.165859] stack backtrace: > > [8.170247] CPU: 0 PID: 179 Comm: kworker/0:1H Not tainted > > 4.6.0-rc6-next-20160503-2-g51d9962 #351 > > [8.179572] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) > > [8.186137] Workqueue: rpciod rpc_async_schedule > > [8.190791] Backtrace: > > [8.193307] [] (dump_backtrace) from [] > > > (show_stack+0x18/0x1c) > > [8.200894] r6:6193 r5: r4: r3:eebdc800 > > [8.206692] [] (show_stack) from [] > > (dump_stack+0xb0/0xe8) > > [8.213961] [] (dump_stack) from [] > > (print_usage_bug+0x268/0x2dc) > > [8.221809] r8:0004 r7:eebdcd00 r6:eebdc800 r5:c0ae4bbc r4:c0ec6054 > > r3:eebdc800 > > [8.229712] [] (print_usage_bug) from [] > > (mark_lock+0x29c/0x6b0) > > [8.237472] r10:c016a1c8 r8:0004 r7:eebdc800 r6:1054 > > r5:eebdcd00 r4:0006 > > [8.245456] [] (mark_lock) from [] > > (__lock_acquire+0x550/0x17c8) > > [8.253216] r10:c0d21d9c r9:02be r8:c0e97784 r7:eebdc800 > > r6:c153a09c r5:eebdcd00 > > [8.261188] r4:0003 r3:0001 > > [8.264837] [] (__lock_acquire) from [] > > (lock_acquire+0x78/0x98) > > [8.272598] r10:0001 r9:c0752328 r8:2d738f6b r7:0001 > > r6:c0752328 r5:6113 > > [8.280568] r4: > > [8.283155] [] (lock_acquire) from [] > > (tcp_snd_una_update+0x64/0xa8) > > [8.291261] r7: r6:ee6b9500 r5:ee6b9500 r4:ee6b99cc > > [8.297050] [] (tcp_snd_una_update) from [] > > (tcp_ack+0x134/0x129c) > > [8.304984] r10:ee6b9570 r9:ee42f9c0 r8:2d738f6b r7:c0d02100 > > r6:0002 r5:ee6b9500 > > [8.312956] r4:0002 > > [8.315542] [] (tcp_ack) from [] > > (tcp_rcv_established+0x140/0x774) > > [8.323477] r10:ee6b9570 r9:ee42f9c0 r8:c0d6bfb3 r7:c155a080 > > r6:ee6e9a62 r5:ee42f9c0 > > [8.331448] r4:ee6b9500 > > [8.334039] [] (tcp_rcv_established) from [] > > (tcp_v4_do_rcv+0x160/0x1c8) > > [8.342494] r8:c0d6bfb3 r7:c155a080 r6:eea79600 r5:ee6b9500 r4:ee42f9c0 > > [8.349348] [] (tcp_v4_do_rcv) from [] > > (__release_sock+0x94/0x124) > > [8.357281] r6: r5:ee6b9500 r4: r3:c075e79c > > [8.363065] [] (__release_sock) from [] > > (release_sock+0x34/0xa4) > > The latter now runs with bh enabled. Ask Eric for a proper > replacement of u64_stats_update_ in tcp_snd_una_update. > > (it's 00:30 here) > Thanks Francois, I can fix this ;)
Re: Cannot use NFS with linux-next 20160429
Fabio Estevam <feste...@gmail.com> : [...] > Today's next shows some different info: > > [7.606456] #0: wm8962-audio > [7.672659] VFS: Mounted root (nfs filesystem) readonly on device 0:14. > [7.680860] devtmpfs: mounted > [7.685664] Freeing unused kernel memory: 1024K (c0c0 - c0d0) > [7.871481] > [7.873004] = > [7.877381] [ INFO: inconsistent lock state ] > [ 7.881760] 4.6.0-rc6-next-20160503-2-g51d9962 #351 Not tainted > [7.888043] - > [7.892419] inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage. > [7.898449] kworker/0:1H/179 [HC0[0]:SC0[0]:HE1:SE1] takes: > [7.904040] (>seq#5){+.?...}, at: [] tcp_ack+0x134/0x129c > [7.911166] {IN-SOFTIRQ-W} state was registered at: > [7.916061] [] lock_acquire+0x78/0x98 > [7.920816] [] tcp_snd_una_update+0x64/0xa8 > [7.926092] [] tcp_ack+0x134/0x129c > [7.930668] [] tcp_rcv_state_process+0x814/0xfc8 > [7.936375] [] tcp_v4_do_rcv+0x64/0x1c8 > [7.941305] [] tcp_v4_rcv+0xf00/0xfbc > [7.946057] [] ip_local_deliver_finish+0xd4/0x550 > [7.951859] [] ip_local_deliver+0xcc/0xdc > [7.956957] [] ip_rcv_finish+0xc4/0x744 > [7.961881] [] ip_rcv+0x4c8/0x7a8 > [7.966284] [] __netif_receive_skb_core+0x514/0x8ec > [7.972251] [] __netif_receive_skb+0x2c/0x8c > [7.977614] [] netif_receive_skb_internal+0x7c/0x1f0 > [7.983666] [] napi_gro_receive+0x88/0xdc > [7.988764] [] fec_enet_rx_napi+0x390/0x9c8 > [7.994036] [] net_rx_action+0x148/0x344 > [7.999046] [] __do_softirq+0x130/0x2bc [...] > [ 8.165859] stack backtrace: > [8.170247] CPU: 0 PID: 179 Comm: kworker/0:1H Not tainted > 4.6.0-rc6-next-20160503-2-g51d9962 #351 > [8.179572] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) > [8.186137] Workqueue: rpciod rpc_async_schedule > [8.190791] Backtrace: > [8.193307] [] (dump_backtrace) from [] > > (show_stack+0x18/0x1c) > [8.200894] r6:6193 r5: r4: r3:eebdc800 > [8.206692] [] (show_stack) from [] > (dump_stack+0xb0/0xe8) > [8.213961] [] (dump_stack) from [] > (print_usage_bug+0x268/0x2dc) > [8.221809] r8:0004 r7:eebdcd00 r6:eebdc800 r5:c0ae4bbc r4:c0ec6054 > r3:eebdc800 > [8.229712] [] (print_usage_bug) from [] > (mark_lock+0x29c/0x6b0) > [8.237472] r10:c016a1c8 r8:0004 r7:eebdc800 r6:1054 r5:eebdcd00 > r4:0006 > [8.245456] [] (mark_lock) from [] > (__lock_acquire+0x550/0x17c8) > [8.253216] r10:c0d21d9c r9:02be r8:c0e97784 r7:eebdc800 r6:c153a09c > r5:eebdcd00 > [8.261188] r4:0003 r3:0001 > [8.264837] [] (__lock_acquire) from [] > (lock_acquire+0x78/0x98) > [8.272598] r10:0001 r9:c0752328 r8:2d738f6b r7:0001 r6:c0752328 > r5:6113 > [8.280568] r4: > [8.283155] [] (lock_acquire) from [] > (tcp_snd_una_update+0x64/0xa8) > [8.291261] r7: r6:ee6b9500 r5:ee6b9500 r4:ee6b99cc > [8.297050] [] (tcp_snd_una_update) from [] > (tcp_ack+0x134/0x129c) > [8.304984] r10:ee6b9570 r9:ee42f9c0 r8:2d738f6b r7:c0d02100 r6:0002 > r5:ee6b9500 > [8.312956] r4:0002 > [8.315542] [] (tcp_ack) from [] > (tcp_rcv_established+0x140/0x774) > [8.323477] r10:ee6b9570 r9:ee42f9c0 r8:c0d6bfb3 r7:c155a080 r6:ee6e9a62 > r5:ee42f9c0 > [8.331448] r4:ee6b9500 > [8.334039] [] (tcp_rcv_established) from [] > (tcp_v4_do_rcv+0x160/0x1c8) > [8.342494] r8:c0d6bfb3 r7:c155a080 r6:eea79600 r5:ee6b9500 r4:ee42f9c0 > [8.349348] [] (tcp_v4_do_rcv) from [] > (__release_sock+0x94/0x124) > [8.357281] r6: r5:ee6b9500 r4: r3:c075e79c > [8.363065] [] (__release_sock) from [] > (release_sock+0x34/0xa4) The latter now runs with bh enabled. Ask Eric for a proper replacement of u64_stats_update_ in tcp_snd_una_update. (it's 00:30 here) -- Ueimor
Re: [PATCH nf-next 0/9] netfilter: remove per-netns conntrack tables, part 1
On Thu, Apr 28, 2016 at 07:13:39PM +0200, Florian Westphal wrote: > [ CCing netdev so netns folks can have a look too ] > > This patch series removes the per-netns connection tracking tables. > All conntrack objects are then stored in one global global table. > > This avoids the infamous 'vmalloc' when lots of namespaces are used: > We no longer allocate a new conntrack table for each namespace (with 64k > size this saves 512kb of memory per netns). > > - net namespace address is made part of conntrack hash, to spread > conntracks over entire table even if netns has overlapping ip addresses. > - lookup and iterators net_eq() to skip conntracks living in a different > namespace. > > Only the main conntrack table is converted here: > NAT bysrc and expectation hashes are still per namespace (will be unified > in a followup series). Also, this retains the per-namespace kmem cache > for the conntrack objects. This will also be resolved in a followup series. This rework in important, I'm going to place this batch in the tree so you can keep working on this. Thanks.
Re: [PATCH nf-next 5/9] netfilter: conntrack: small refactoring of conntrack seq_printf
On Tue, May 03, 2016 at 08:12:50PM +0200, Pablo Neira Ayuso wrote: > On Thu, Apr 28, 2016 at 07:13:44PM +0200, Florian Westphal wrote: > > The iteration process is lockless, so we test if the conntrack object is > > eligible for printing (e.g. is AF_INET) after obtaining the reference > > count. > > > > Once we put all conntracks into same hash table we might see more > > entries that need to be skipped. > > > > So add a helper and first perform the test in a lockless fashion > > for fast skip. > > > > Once we obtain the reference count, just repeat the check. > > > > Signed-off-by: Florian Westphal> > --- > > .../netfilter/nf_conntrack_l3proto_ipv4_compat.c | 24 > > +- > > 1 file changed, 19 insertions(+), 5 deletions(-) > > > > diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c > > b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c > > index f0dfe92..483cf79 100644 > > --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c > > +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c > > @@ -114,6 +114,19 @@ static inline void ct_show_secctx(struct seq_file *s, > > const struct nf_conn *ct) > > } > > #endif > > > > +static bool ct_seq_should_skip(const struct nf_conn *ct, > > + const struct nf_conntrack_tuple_hash *hash) > > +{ > > + /* we only want to print DIR_ORIGINAL */ > > + if (NF_CT_DIRECTION(hash)) > > + return true; > > + > > + if (nf_ct_l3num(ct) != AF_INET) > > + return true; > > + > > + return false; > > +} > > + > > static int ct_seq_show(struct seq_file *s, void *v) > > { > > struct nf_conntrack_tuple_hash *hash = v; > > @@ -123,14 +136,15 @@ static int ct_seq_show(struct seq_file *s, void *v) > > int ret = 0; > > > > NF_CT_ASSERT(ct); > > - if (unlikely(!atomic_inc_not_zero(>ct_general.use))) > > + if (ct_seq_should_skip(ct, hash)) > > return 0; > > > > + if (unlikely(!atomic_inc_not_zero(>ct_general.use))) > > + return 0; > > > > - /* we only want to print DIR_ORIGINAL */ > > - if (NF_CT_DIRECTION(hash)) > > - goto release; > > - if (nf_ct_l3num(ct) != AF_INET) > > + /* check if we raced w. object reuse */ > > + if (!nf_ct_is_confirmed(ct) || > > This refactoring includes this new check, is this intentional? It seems this check was previously missing, I can just amend the commit log with a couple of lines to document that this patch also includes this missing check. No problem.
Re: [PATCH nf-next 3/9] netfilter: conntrack: don't attempt to iterate over empty table
On Tue, May 03, 2016 at 07:55:59PM +0200, Florian Westphal wrote: > > Otherwise, every time we'll go container destruction path, we'll hit > > slow path, ie. scanning the full table. > > Yes, but I see no other choice. Fair enough, will place this in nf-next, thanks.
[PATCH 06/15] batman-adv: use to_delayed_work
From: Geliang TangUse to_delayed_work() instead of open-coding it. Signed-off-by: Geliang Tang Reviewed-by: Sven Eckelmann Signed-off-by: Marek Lindner Signed-off-by: Antonio Quartulli --- net/batman-adv/bridge_loop_avoidance.c | 2 +- net/batman-adv/distributed-arp-table.c | 2 +- net/batman-adv/network-coding.c| 2 +- net/batman-adv/originator.c| 2 +- net/batman-adv/send.c | 4 ++-- net/batman-adv/translation-table.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 56bc971e404b..cad8cb3a88f2 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c @@ -1303,7 +1303,7 @@ static void batadv_bla_periodic_work(struct work_struct *work) struct batadv_hard_iface *primary_if; int i; - delayed_work = container_of(work, struct delayed_work, work); + delayed_work = to_delayed_work(work); priv_bla = container_of(delayed_work, struct batadv_priv_bla, work); bat_priv = container_of(priv_bla, struct batadv_priv, bla); primary_if = batadv_primary_if_get_selected(bat_priv); diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index ce574e9cef3b..33f273e5354b 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c @@ -152,7 +152,7 @@ static void batadv_dat_purge(struct work_struct *work) struct batadv_priv_dat *priv_dat; struct batadv_priv *bat_priv; - delayed_work = container_of(work, struct delayed_work, work); + delayed_work = to_delayed_work(work); priv_dat = container_of(delayed_work, struct batadv_priv_dat, work); bat_priv = container_of(priv_dat, struct batadv_priv, dat); diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c index b41719b6487a..0d3bf4368e9b 100644 --- a/net/batman-adv/network-coding.c +++ b/net/batman-adv/network-coding.c @@ -714,7 +714,7 @@ static void batadv_nc_worker(struct work_struct *work) struct batadv_priv *bat_priv; unsigned long timeout; - delayed_work = container_of(work, struct delayed_work, work); + delayed_work = to_delayed_work(work); priv_nc = container_of(delayed_work, struct batadv_priv_nc, work); bat_priv = container_of(priv_nc, struct batadv_priv, nc); diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index e4cbb0753e37..5b802f0dc24b 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c @@ -1222,7 +1222,7 @@ static void batadv_purge_orig(struct work_struct *work) struct delayed_work *delayed_work; struct batadv_priv *bat_priv; - delayed_work = container_of(work, struct delayed_work, work); + delayed_work = to_delayed_work(work); bat_priv = container_of(delayed_work, struct batadv_priv, orig_work); _batadv_purge_orig(bat_priv); queue_delayed_work(batadv_event_workqueue, diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c index 3ce06e0a91b1..20076b4c5e1d 100644 --- a/net/batman-adv/send.c +++ b/net/batman-adv/send.c @@ -552,7 +552,7 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work) struct net_device *soft_iface; struct batadv_priv *bat_priv; - delayed_work = container_of(work, struct delayed_work, work); + delayed_work = to_delayed_work(work); forw_packet = container_of(delayed_work, struct batadv_forw_packet, delayed_work); soft_iface = forw_packet->if_incoming->soft_iface; @@ -604,7 +604,7 @@ void batadv_send_outstanding_bat_ogm_packet(struct work_struct *work) struct batadv_forw_packet *forw_packet; struct batadv_priv *bat_priv; - delayed_work = container_of(work, struct delayed_work, work); + delayed_work = to_delayed_work(work); forw_packet = container_of(delayed_work, struct batadv_forw_packet, delayed_work); bat_priv = netdev_priv(forw_packet->if_incoming->soft_iface); diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 29fd62839fac..d44ce84626c5 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c @@ -3226,7 +3226,7 @@ static void batadv_tt_purge(struct work_struct *work) struct batadv_priv_tt *priv_tt; struct batadv_priv *bat_priv; - delayed_work = container_of(work, struct delayed_work, work); + delayed_work = to_delayed_work(work); priv_tt = container_of(delayed_work, struct batadv_priv_tt, work); bat_priv = container_of(priv_tt, struct batadv_priv, tt); -- 2.8.2
[PATCH 07/15] batman-adv: fix wrong names in kerneldoc
Signed-off-by: Antonio Quartulli[s...@narfation.org: Fix additional names] Signed-off-by: Sven Eckelmann Signed-off-by: Marek Lindner --- net/batman-adv/bridge_loop_avoidance.c | 2 +- net/batman-adv/distributed-arp-table.c | 2 +- net/batman-adv/icmp_socket.c | 2 +- net/batman-adv/main.h | 3 ++- net/batman-adv/multicast.c | 11 ++- net/batman-adv/originator.c| 2 +- net/batman-adv/packet.h| 2 +- net/batman-adv/soft-interface.c| 2 +- 8 files changed, 14 insertions(+), 12 deletions(-) diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index cad8cb3a88f2..20b2fd9b3d72 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c @@ -1575,7 +1575,7 @@ int batadv_bla_is_backbone_gw(struct sk_buff *skb, } /** - * batadv_bla_init - free all bla structures + * batadv_bla_free - free all bla structures * @bat_priv: the bat priv with all the soft interface information * * for softinterface free or module unload diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index 33f273e5354b..f0548b4f66f4 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c @@ -717,7 +717,7 @@ void batadv_dat_status_update(struct net_device *net_dev) } /** - * batadv_gw_tvlv_ogm_handler_v1 - process incoming dat tvlv container + * batadv_dat_tvlv_ogm_handler_v1 - process incoming dat tvlv container * @bat_priv: the bat priv with all the soft interface information * @orig: the orig_node of the ogm * @flags: flags indicating the tvlv state (see batadv_tvlv_handler_flags) diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c index 8a5889d134bc..777aea10cd8f 100644 --- a/net/batman-adv/icmp_socket.c +++ b/net/batman-adv/icmp_socket.c @@ -333,7 +333,7 @@ err: } /** - * batadv_socket_receive_packet - schedule an icmp packet to be sent to + * batadv_socket_add_packet - schedule an icmp packet to be sent to * userspace on an icmp socket. * @socket_client: the socket this packet belongs to * @icmph: pointer to the header of the icmp packet diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index 38e5587675cc..07a6042d0ad6 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h @@ -296,7 +296,8 @@ static inline bool batadv_compare_eth(const void *data1, const void *data2) } /** - * has_timed_out - compares current time (jiffies) and timestamp + timeout + * batadv_has_timed_out - compares current time (jiffies) and timestamp + + * timeout * @timestamp: base value to compare with (in jiffies) * @timeout: added to base value before comparing (in milliseconds) * diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c index 8caa2c72efa3..c32f24fafe67 100644 --- a/net/batman-adv/multicast.c +++ b/net/batman-adv/multicast.c @@ -394,7 +394,8 @@ static int batadv_mcast_forw_mode_check(struct batadv_priv *bat_priv, } /** - * batadv_mcast_want_all_ip_count - count nodes with unspecific mcast interest + * batadv_mcast_forw_want_all_ip_count - count nodes with unspecific mcast + * interest * @bat_priv: the bat priv with all the soft interface information * @ethhdr: ethernet header of a packet * @@ -433,7 +434,7 @@ batadv_mcast_forw_tt_node_get(struct batadv_priv *bat_priv, } /** - * batadv_mcast_want_forw_ipv4_node_get - get a node with an ipv4 flag + * batadv_mcast_forw_ipv4_node_get - get a node with an ipv4 flag * @bat_priv: the bat priv with all the soft interface information * * Return: an orig_node which has the BATADV_MCAST_WANT_ALL_IPV4 flag set and @@ -460,7 +461,7 @@ batadv_mcast_forw_ipv4_node_get(struct batadv_priv *bat_priv) } /** - * batadv_mcast_want_forw_ipv6_node_get - get a node with an ipv6 flag + * batadv_mcast_forw_ipv6_node_get - get a node with an ipv6 flag * @bat_priv: the bat priv with all the soft interface information * * Return: an orig_node which has the BATADV_MCAST_WANT_ALL_IPV6 flag set @@ -487,7 +488,7 @@ batadv_mcast_forw_ipv6_node_get(struct batadv_priv *bat_priv) } /** - * batadv_mcast_want_forw_ip_node_get - get a node with an ipv4/ipv6 flag + * batadv_mcast_forw_ip_node_get - get a node with an ipv4/ipv6 flag * @bat_priv: the bat priv with all the soft interface information * @ethhdr: an ethernet header to determine the protocol family from * @@ -511,7 +512,7 @@ batadv_mcast_forw_ip_node_get(struct batadv_priv *bat_priv, } /** - * batadv_mcast_want_forw_unsnoop_node_get - get a node with an unsnoopable flag + * batadv_mcast_forw_unsnoop_node_get - get a node with an unsnoopable flag * @bat_priv: the bat priv with all the soft interface information * * Return: an orig_node which has the BATADV_MCAST_WANT_ALL_UNSNOOPABLES flag diff --git
[PATCH 09/15] batman-adv: Fix kerneldoc for batadv_compare_claim
From: Sven EckelmannSigned-off-by: Sven Eckelmann Signed-off-by: Marek Lindner Signed-off-by: Antonio Quartulli --- net/batman-adv/bridge_loop_avoidance.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 20b2fd9b3d72..60d33232bd10 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c @@ -120,7 +120,7 @@ static int batadv_compare_backbone_gw(const struct hlist_node *node, } /** - * batadv_compare_backbone_gw - compare address and vid of two claims + * batadv_compare_claim - compare address and vid of two claims * @node: list node of the first entry to compare * @data2: pointer to the second claims * -- 2.8.2
[PATCH 08/15] batman-adv: Fix checkpatch warning about 'unsigned' type
From: Sven Eckelmanncheckpatch.pl warns about the use of 'unsigned' as a short form for 'unsigned int'. Signed-off-by: Sven Eckelmann Signed-off-by: Marek Lindner Signed-off-by: Antonio Quartulli --- net/batman-adv/fragmentation.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c index e6956d0746a2..65536db1bff7 100644 --- a/net/batman-adv/fragmentation.c +++ b/net/batman-adv/fragmentation.c @@ -407,8 +407,8 @@ static struct sk_buff *batadv_frag_create(struct sk_buff *skb, unsigned int mtu) { struct sk_buff *skb_fragment; - unsigned header_size = sizeof(*frag_head); - unsigned fragment_size = mtu - header_size; + unsigned int header_size = sizeof(*frag_head); + unsigned int fragment_size = mtu - header_size; skb_fragment = netdev_alloc_skb(NULL, mtu + ETH_HLEN); if (!skb_fragment) @@ -444,15 +444,15 @@ bool batadv_frag_send_packet(struct sk_buff *skb, struct batadv_hard_iface *primary_if = NULL; struct batadv_frag_packet frag_header; struct sk_buff *skb_fragment; - unsigned mtu = neigh_node->if_incoming->net_dev->mtu; - unsigned header_size = sizeof(frag_header); - unsigned max_fragment_size, max_packet_size; + unsigned int mtu = neigh_node->if_incoming->net_dev->mtu; + unsigned int header_size = sizeof(frag_header); + unsigned int max_fragment_size, max_packet_size; bool ret = false; /* To avoid merge and refragmentation at next-hops we never send * fragments larger than BATADV_FRAG_MAX_FRAG_SIZE */ - mtu = min_t(unsigned, mtu, BATADV_FRAG_MAX_FRAG_SIZE); + mtu = min_t(unsigned int, mtu, BATADV_FRAG_MAX_FRAG_SIZE); max_fragment_size = mtu - header_size; max_packet_size = max_fragment_size * BATADV_FRAG_MAX_FRAGMENTS; -- 2.8.2
[PATCH 05/15] batman-adv: use list_for_each_entry_safe
From: Geliang TangUse list_for_each_entry_safe() instead of list_for_each_safe() to simplify the code. Signed-off-by: Geliang Tang Acked-by: Antonio Quartulli Reviewed-by: Sven Eckelmann Signed-off-by: Marek Lindner Signed-off-by: Antonio Quartulli --- net/batman-adv/icmp_socket.c | 22 +- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c index 14d0013b387e..8a5889d134bc 100644 --- a/net/batman-adv/icmp_socket.c +++ b/net/batman-adv/icmp_socket.c @@ -104,25 +104,21 @@ static int batadv_socket_open(struct inode *inode, struct file *file) static int batadv_socket_release(struct inode *inode, struct file *file) { - struct batadv_socket_client *socket_client = file->private_data; - struct batadv_socket_packet *socket_packet; - struct list_head *list_pos, *list_pos_tmp; + struct batadv_socket_client *client = file->private_data; + struct batadv_socket_packet *packet, *tmp; - spin_lock_bh(_client->lock); + spin_lock_bh(>lock); /* for all packets in the queue ... */ - list_for_each_safe(list_pos, list_pos_tmp, _client->queue_list) { - socket_packet = list_entry(list_pos, - struct batadv_socket_packet, list); - - list_del(list_pos); - kfree(socket_packet); + list_for_each_entry_safe(packet, tmp, >queue_list, list) { + list_del(>list); + kfree(packet); } - batadv_socket_client_hash[socket_client->index] = NULL; - spin_unlock_bh(_client->lock); + batadv_socket_client_hash[client->index] = NULL; + spin_unlock_bh(>lock); - kfree(socket_client); + kfree(client); module_put(THIS_MODULE); return 0; -- 2.8.2
[PATCH 01/15] MAINTAINERS: Mark BATMAN ADVANCED mailing list as moderated
From: Sven EckelmannThe mailing list of b.a.t.m@lists.open-mesh.org is moderated for non-subscribers and non-whitelisted addresses. Such mails will be delayed but the sender will not be informed about the moderation. Signed-off-by: Sven Eckelmann Signed-off-by: Antonio Quartulli --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index ab008013cfec..22688419873f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2203,7 +2203,7 @@ BATMAN ADVANCED M: Marek Lindner M: Simon Wunderlich M: Antonio Quartulli -L: b.a.t.m@lists.open-mesh.org +L: b.a.t.m@lists.open-mesh.org (moderated for non-subscribers) W: https://www.open-mesh.org/ Q: https://patchwork.open-mesh.org/project/batman/list/ S: Maintained -- 2.8.2
[PATCH 03/15] batman-adv: Start new development cycle
From: Simon WunderlichSigned-off-by: Simon Wunderlich Signed-off-by: Antonio Quartulli --- net/batman-adv/main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index db4533631834..38e5587675cc 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h @@ -24,7 +24,7 @@ #define BATADV_DRIVER_DEVICE "batman-adv" #ifndef BATADV_SOURCE_VERSION -#define BATADV_SOURCE_VERSION "2016.1" +#define BATADV_SOURCE_VERSION "2016.2" #endif /* B.A.T.M.A.N. parameters */ -- 2.8.2
pull request: batman-adv 20160504
Hello David, this is a pull request intended for net-next. In this batch you don't have any patch that depends on our fixes, therefore you can safely merge it even if the net tree has not been merged yet. In this patchset you basically have some cleanup work, code refactoring, style fixes and two updates for the MAINTAINERS file. Please pull or let me know of any problem! Thanks a lot, Antonio The following changes since commit e03179fe78d5b39dbf3e8b0b50f7c406514b15c7: net: ethernet: fec_mpc52xx: move to new ethtool api {get|set}_link_ksettings (2016-05-03 13:03:53 -0400) are available in the git repository at: git://git.open-mesh.org/linux-merge.git tags/batman-adv-for-davem for you to fetch changes up to 64ae74455371a40bc9f9c8325eb4c37f2978c95f: batman-adv: Split batadv_iv_ogm_orig_del_if function (2016-05-04 02:22:03 +0800) In this pull request you have: - two changes to the MAINTAINERS file where one marks our mailing list as moderated and the other adds a missing documentation file - kernel-doc fixes - code refactoring and various cleanups Antonio Quartulli (2): batman-adv: use static string for table headers batman-adv: fix wrong names in kerneldoc Geliang Tang (2): batman-adv: use list_for_each_entry_safe batman-adv: use to_delayed_work Simon Wunderlich (4): batman-adv: Start new development cycle batman-adv: fix debuginfo macro style issue batman-adv: move and restructure batadv_v_ogm_forward batman-adv: Merge batadv_v_ogm_orig_update into batadv_v_ogm_route_update Sven Eckelmann (7): MAINTAINERS: Mark BATMAN ADVANCED mailing list as moderated MAINTAINERS: Add BATMAN ADVANCED documentation files batman-adv: Fix checkpatch warning about 'unsigned' type batman-adv: Fix kerneldoc for batadv_compare_claim batman-adv: Add kernel-doc for batadv_interface_rx batman-adv: Fix function names on new line starting with '*' batman-adv: Split batadv_iv_ogm_orig_del_if function MAINTAINERS| 5 +- net/batman-adv/bat_iv_ogm.c| 123 +--- net/batman-adv/bat_v.c | 9 +- net/batman-adv/bat_v_ogm.c | 205 - net/batman-adv/bridge_loop_avoidance.c | 19 ++- net/batman-adv/debugfs.c | 19 +-- net/batman-adv/distributed-arp-table.c | 8 +- net/batman-adv/fragmentation.c | 12 +- net/batman-adv/icmp_socket.c | 24 ++-- net/batman-adv/main.c | 8 +- net/batman-adv/main.h | 5 +- net/batman-adv/multicast.c | 11 +- net/batman-adv/network-coding.c| 20 ++-- net/batman-adv/originator.c| 4 +- net/batman-adv/packet.h| 2 +- net/batman-adv/send.c | 4 +- net/batman-adv/soft-interface.c| 20 +++- net/batman-adv/translation-table.c | 11 +- 18 files changed, 277 insertions(+), 232 deletions(-)
[PATCH 04/15] batman-adv: use static string for table headers
Use a static string when showing table headers rather then a nonsense parametric one with fixed arguments. It is easier to grep and it does not need to be recomputed at runtime each time. Reported-by: Joe PerchesSigned-off-by: Antonio Quartulli [s...@narfation.org: fix conflicts with current version] Signed-off-by: Sven Eckelmann Signed-off-by: Marek Lindner --- net/batman-adv/bat_iv_ogm.c| 8 +++- net/batman-adv/bat_v.c | 9 - net/batman-adv/bridge_loop_avoidance.c | 7 +++ net/batman-adv/distributed-arp-table.c | 4 ++-- net/batman-adv/translation-table.c | 9 - 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index cb2d1b9b0340..682fcaec56e6 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -1829,9 +1829,8 @@ static void batadv_iv_ogm_orig_print(struct batadv_priv *bat_priv, int batman_count = 0; u32 i; - seq_printf(seq, " %-15s %s (%s/%i) %17s [%10s]: %20s ...\n", - "Originator", "last-seen", "#", BATADV_TQ_MAX_VALUE, - "Nexthop", "outgoingIF", "Potential nexthops"); + seq_puts(seq, +" Originator last-seen (#/255) Nexthop [outgoingIF]: Potential nexthops ...\n"); for (i = 0; i < hash->size; i++) { head = >table[i]; @@ -1911,8 +1910,7 @@ static void batadv_iv_neigh_print(struct batadv_priv *bat_priv, struct batadv_hard_iface *hard_iface; int batman_count = 0; - seq_printf(seq, " %10s%-13s %s\n", - "IF", "Neighbor", "last-seen"); + seq_puts(seq, " IFNeighbor last-seen\n"); rcu_read_lock(); list_for_each_entry_rcu(hard_iface, _hardif_list, list) { diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c index 3315b9a598af..246f9e959849 100644 --- a/net/batman-adv/bat_v.c +++ b/net/batman-adv/bat_v.c @@ -151,8 +151,8 @@ static void batadv_v_neigh_print(struct batadv_priv *bat_priv, struct batadv_hard_iface *hard_iface; int batman_count = 0; - seq_printf(seq, " %-15s %s (%11s) [%10s]\n", "Neighbor", - "last-seen", "throughput", "IF"); + seq_puts(seq, +" Neighborlast-seen ( throughput) [IF]\n"); rcu_read_lock(); list_for_each_entry_rcu(hard_iface, _hardif_list, list) { @@ -191,9 +191,8 @@ static void batadv_v_orig_print(struct batadv_priv *bat_priv, int batman_count = 0; u32 i; - seq_printf(seq, " %-15s %s (%11s) %17s [%10s]: %20s ...\n", - "Originator", "last-seen", "throughput", "Nexthop", - "outgoingIF", "Potential nexthops"); + seq_puts(seq, +" Originator last-seen ( throughput) Nexthop [outgoingIF]: Potential nexthops ...\n"); for (i = 0; i < hash->size; i++) { head = >table[i]; diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 0a6c8b824a00..56bc971e404b 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c @@ -1815,8 +1815,8 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) "Claims announced for the mesh %s (orig %pM, group id %#.4x)\n", net_dev->name, primary_addr, ntohs(bat_priv->bla.claim_dest.group)); - seq_printf(seq, " %-17s%-5s%-17s [o] (%-6s)\n", - "Client", "VID", "Originator", "CRC"); + seq_puts(seq, +" Client VID Originator[o] (CRC )\n"); for (i = 0; i < hash->size; i++) { head = >table[i]; @@ -1873,8 +1873,7 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset) "Backbones announced for the mesh %s (orig %pM, group id %#.4x)\n", net_dev->name, primary_addr, ntohs(bat_priv->bla.claim_dest.group)); - seq_printf(seq, " %-17s%-5s %-9s (%-6s)\n", - "Originator", "VID", "last seen", "CRC"); + seq_puts(seq, " Originator VID last seen (CRC )\n"); for (i = 0; i < hash->size; i++) { head = >table[i]; diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index e96d7c745b4a..ce574e9cef3b 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c @@ -814,8 +814,8 @@ int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset) goto out; seq_printf(seq, "Distributed ARP Table (%s):\n", net_dev->name); - seq_printf(seq, " %-7s
Re: [PATCH] fix infoleak in wireless
A: http://en.wikipedia.org/wiki/Top_post Q: Were do I find info about this thing called top-posting? A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? A: No. Q: Should I include quotations after my reply? http://daringfireball.net/2007/07/on_top On Tue, May 03, 2016 at 05:41:46PM -0400, Kangjie Lu wrote: > You are right. But wouldn't it be more general/better if we initialize the > allocation at very beginning? > To avoid information leaks, I think we are supposed to initialize all > allocations properly if > we are not sure how they are used. But the networking maintainers told you to fix the broken drivers instead. So please do that and send those patches to the correct developers and mailing lists. The fact that only 2 staging drivers got this wrong means that everyone knows how to use this api properly, so I agree with the maintainers here. thanks, greg k-h
Re: [PATCH] fix infoleak in wireless
On Tue, May 03, 2016 at 05:11:07PM -0400, Kangjie Lu wrote: > Opps, I did not notice the patch is not attached. > > From 34a82a734388d07eb10f91770f86938e38f7575a Mon Sep 17 00:00:00 2001 > From: Kangjie Lu> Date: Tue, 3 May 2016 14:15:18 -0400 > Subject: [PATCH] fix infoleak in wireless > MIME-Version: 1.0 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 8bit > > The 6-bytes array “mac_addr” is not initialized in the dump_station > implementations of “drivers/staging/wilc1000/wilc_wfi_cfgoperations.c” > and “drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c”, so all 6 > bytes may be leaked. > > Signed-off-by: Kangjie Lu > --- > net/wireless/nl80211.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c > index 056a730..2e92d14 100644 > --- a/net/wireless/nl80211.c > +++ b/net/wireless/nl80211.c > @@ -3905,6 +3905,7 @@ static int nl80211_dump_station(struct sk_buff *skb, > > while (1) { > memset(, 0, sizeof(sinfo)); > + eth_zero_addr(mac_addr); > err = rdev_dump_station(rdev, wdev->netdev, sta_idx, > mac_addr, ); > if (err == -ENOENT) Patch is corrupted :( Why not fix up the staging drivers, they are the real problem here, which is what I think the networking maintainers were telling you to do. thanks, greg k-h
Re: [REGRESSION] asix: Lots of asix_rx_fixup() errors and slow transmissions
On 03/05/16 15:42, David B. Robins wrote: I don't think the first one is giving you problems (except as triggered by the second) but I had concerns about the second myself (and emailed the author off-list, but received no reply), and we did not take that commit for our own product. Sorry, I might have missed your original E-mail. Specifically, the second change, 3f30... (original patch: https://www.mail-archive.com/netdev@vger.kernel.org/msg80720.html) (1) appears to do the exact opposite of what it claims, i.e., instead of "resync if this looks like a header", it does "resync if this does NOT look like a (packet) header", where "looks like a header" means "bits 0-10 (size) are equal to the bitwise-NOT of bits 16-26", and (2) can happen by coincidence for 1/2048 32-bit values starting a continuation URB (easy to hit dealing with large volumes of video data as we were). It appears to expect the header for every URB whereas the rest of the code at least expects it only once per network packet (look at following code that only reads it for remaining == 0). David, I think that your interpretation is incorrect. Please see below. Here is the code snippet from the patch with my annotations between # #, I will try to explain my intentions. Feel free to point out any flaws: if (rx->remaining && (rx->remaining + sizeof(u32) <= skb->len)) { # Only runs when rx->remaining !=0 and the end of the Ethernet frame + next 32-bit header word is within the URB buffer. # # Therefore, this code does not run when the end of an Ethernet frame has been reached in the previous URB # # or when the end of the Ethernet frame + next 32-bit header word will be in a later URB buffer # # offset is an index to the expected next 32-bit header word after the end of the Ethernet frame # offset = ((rx->remaining + 1) & 0xfffe) + sizeof(u32); # rx->header contains the expected 32-bit header value corrected for Endianness and alignment # rx->header = get_unaligned_le32(skb->data + offset); offset = 0; # check the data integrity of the size value from the header word # size = (u16)(rx->header & 0x7ff); # if the size value fails the integrity check then we are not looking at a valid header word so # # synchronisation has been lost # if (size != ((~rx->header >> 16) & 0x7ff)) { netdev_err(dev->net, "asix_rx_fixup() Data Header synchronisation was lost, remaining %d\n", rx->remaining); if (rx->ax_skb) { kfree_skb(rx->ax_skb); rx->ax_skb = NULL; /* Discard the incomplete netdev Ethernet frame * and assume the Data header is at the start of * the current URB socket buffer. */ } rx->remaining = 0; } } So that change made no sense to me, but I don't have significant kernel dev experience. Effectively it will drop/truncate every (2047/2048) split (longer than an URB) packet, and report an error for the second URB and then again for treating said second URB as a first URB for a packet. I would expect your problems will go away just removing the second change. You could also change the != to == in "if (size != ...)" but then you'd still have 1/2048 (depending on data patterns) false positives. The code only runs when the Ethernet frame spans across URBs and is checking that the next 32-bit header word is present and valid. Upon loss of synchronisation, the strategy is to assume that the 32-bit header is at the start of the URB buffer. Obviously, that might not be true every time but it is the most likely location especially when Ethernet frames are not spanning URBs at that point at time. Looking at the error messages: [ 239.037310] asix 1-1.1:1.0 eth0: asix_rx_fixup() Bad Header Length 0x54ebb5ec, offset 4 The offset 4 means that the 32-bit header word was invalid at the start of the URB buffer. This could be a consequence of data synchronisation being lost however, we would expect the timestamps between the error messages of "synchronisation was lost" and "Bad Header Length" to very close as they would be consecutive URBs. The evidence is showing 10ms gaps which does not suggest consecutive URBs. In other words, an Ethernet frame should not be spanned over a time gap of 10ms as that would be very inefficient. If that were true then there would be USB communications problem with the USB to Ethernet adaptor which I hope is not true. [ 239.027993] asix 1-1.1:1.0 eth0: asix_rx_fixup() Data Header synchronisation was lost, remaining 988 This error message consistently shows the remaining value to be 988, at least for the 3 examples provided by John. This does not suggest a random failure unless there are other examples of a non 988 remaining value error message. 988 is well within a Ethernet frame
[no subject]
�S著中��的高速�l展,不少企�I都在��子商�者@��行�I�l展�_�恚�市�龈�得非常激烈。 此�r,如何及�r�蚀_的找到客�粜畔�,��於企�I�碚f��得��常重要,因�檫@不�H可以���s�r�g成本,更重要的是可以��占先�C。 如果你缺少客�簦�也�]有客�糍Y料,那�N你已��慢你的同行一步了。 �]有捷�剑�只有付出汗水,天�崃四闳绾稳フ铱��簦� 很多人�x�窳穗���,�Q定付出自己的口舌,但�Y料�哪��恚}又出�F了,又一次迷失在了�ふ铱��舻碾��F中。 �F在是互���W的�r代!基於�W�j�@��大�於��Q生的外�Q��件,以��件���颍�以�W�j�榫�,以全球信息���欤� 架�O通往海外的康�f大道!你在�q豫、�^望的�r候,你的同行已��在用��件每天提取上�f�l客�粜畔⒘耍���再外�Q��件和平台展��一�映芍髁��r,你又失去了一次就��! 利用���H和各��主流搜索引擎,��入�a品�P�I字就即可批量提取客�糍Y料!全球200家下700多地主流引擎任您搜索�_�l! 如果您�ξa品以及服�崭信d趣,�g迎加我QQ。 QQ:2188578837 Contact number:0755-32913073
Re: [PATCH] fix infoleak in wireless
A: No. Q: Should I include quotations after my reply? http://daringfireball.net/2007/07/on_top On Tue, May 03, 2016 at 04:47:16PM -0400, Kangjie Lu wrote: > Hi Greg, > > Could you please take a look at this issue. > mac_addr is not initialized is some implementations of dump_station(), which > can be exploited by attackers for leaking information. You are going to have to give me more context here... Like the patch itself? thanks, greg k-h
[PATCH] fix infoleak in rtnetlink
The stack object “map” has a total size of 32 bytes. Its last 4 bytes are padding generated by compiler. These padding bytes are not initialized and sent out via “nla_put”. Signed-off-by: Kangjie Lu--- net/core/rtnetlink.c | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index a75f7e9..65763c2 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1180,14 +1180,16 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, static int rtnl_fill_link_ifmap(struct sk_buff *skb, struct net_device *dev) { - struct rtnl_link_ifmap map = { - .mem_start = dev->mem_start, - .mem_end = dev->mem_end, - .base_addr = dev->base_addr, - .irq = dev->irq, - .dma = dev->dma, - .port= dev->if_port, - }; + struct rtnl_link_ifmap map; + + memset(, 0, sizeof(map)); + map.mem_start = dev->mem_start; + map.mem_end = dev->mem_end; + map.base_addr = dev->base_addr; + map.irq = dev->irq; + map.dma = dev->dma; + map.port= dev->if_port; + if (nla_put(skb, IFLA_MAP, sizeof(map), )) return -EMSGSIZE; -- 1.9.1
Re: [PATCH] fix infoleak in wireless
On Tue, 2016-05-03 at 16:40 -0400, Kangjie Lu wrote: > The 6-bytes array “mac_addr” is not initialized in the dump_station > implementations of > “drivers/staging/wilc1000/wilc_wfi_cfgoperations.c” > and “drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c”, so all 6 > bytes may be leaked. Like I said to you before, this makes those implementations completely broken. I'm not going to apply this patch. If you want, feel free to send patches to Greg to remove those dump_station implementations that are completely broken and that can never do anything useful. johannes
[GIT] Networking
Some straggler bug fixes: 1) Batman-adv DAT must consider VLAN IDs when choosing candidate nodes, from Antonio Quartulli. 2) Fix botched reference counting of vlan objects and neigh nodes in batman-adv, from Sven Eckelmann. 3) netem can crash when it sees GSO packets, the fix is to segment then upon ->enqueue. Fix from Neil Horman with help from Eric Dumazet. 4) Fix VXLAN dependencies in mlx5 driver Kconfig, from Matthew Finlay. 5) Handle VXLAN ops outside of rcu lock, via a workqueue, in mlx5, since it can sleep. Fix also from Matthew Finlay. 6) Check mdiobus_scan() return values properly in pxa168_eth and macb drivers. From Sergei Shtylyov. 7) If the netdevice doesn't support checksumming, disable segmentation. From Alexandery Duyck. 8) Fix races between RDS tcp accept and sending, from Sowmini Varadhan. 9) In macb driver, probe MDIO bus before we register the netdev, otherwise we can try to open the device before it is really ready for that. Fix from Florian Fainelli. 10) Netlink attribute size for ILA "tunnels" not calculated properly, fix from Nicolas Dichtel. Please pull, thanks a lot! The following changes since commit 33656a1f2ee5346c742d63ddd0e0970c95a56b70: Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs (2016-05-02 09:59:57 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/davem/net for you to fetch changes up to 79e8dc8b80bff0bc5bbb90ca5e73044bf207c8ac: ipv6/ila: fix nlsize calculation for lwtunnel (2016-05-03 16:21:33 -0400) Alexander Duyck (2): net: Disable segmentation if checksumming is not supported vxlan: Add checksum check to the features check function Anna-Maria Gleixner (1): net: mvneta: Remove superfluous SMP function call Antonio Quartulli (2): batman-adv: fix DAT candidate selection (must use vid) batman-adv: B.A.T.M.A.N V - make sure iface is reactivated upon NETDEV_UP event David S. Miller (4): Merge tag 'batman-adv-fix-for-davem' of git://git.open-mesh.org/linux-merge Merge branch 'mlx5-fixes' Merge branch 'tunnel-csum-and-sg-offloads' Merge branch 'rds-fixes' Florian Fainelli (1): net: macb: Probe MDIO bus before registering netdev Gal Pressman (1): net/mlx5: Unmap only the relevant IO memory mapping Matthew Finlay (3): net/mlx5: Kconfig: Fix MLX5_EN/VXLAN build issue net/mlx5e: Implement a mlx5e workqueue net/mlx5e: Use workqueue for vxlan ops Neil Horman (1): netem: Segment GSO packets on enqueue Nicolas Dichtel (1): ipv6/ila: fix nlsize calculation for lwtunnel Sergei Shtylyov (2): pxa168_eth: fix mdiobus_scan() error check macb: fix mdiobus_scan() error check Sowmini Varadhan (2): RDS:TCP: Synchronize rds_tcp_accept_one with rds_send_xmit when resetting t_sock RDS: TCP: Synchronize accept() and connect() paths on t_conn_lock. Sven Eckelmann (2): batman-adv: Fix reference counting of vlan object for tt_local_entry batman-adv: Fix reference counting of hardif_neigh_node object for neigh_node drivers/net/ethernet/cadence/macb.c | 34 +- drivers/net/ethernet/marvell/mvneta.c | 6 ++ drivers/net/ethernet/marvell/pxa168_eth.c | 2 ++ drivers/net/ethernet/mellanox/mlx5/core/Kconfig | 1 + drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 34 +- drivers/net/ethernet/mellanox/mlx5/core/uar.c | 6 -- drivers/net/ethernet/mellanox/mlx5/core/vxlan.c | 50 ++ drivers/net/ethernet/mellanox/mlx5/core/vxlan.h | 11 +-- include/linux/if_ether.h | 5 + include/net/vxlan.h | 4 +++- net/batman-adv/bat_v.c| 12 net/batman-adv/distributed-arp-table.c| 17 ++--- net/batman-adv/hard-interface.c | 3 +++ net/batman-adv/originator.c | 16 +--- net/batman-adv/translation-table.c| 42 -- net/batman-adv/types.h| 7 +++ net/core/dev.c| 2 +- net/ipv6/ila/ila_lwt.c| 3 +-- net/rds/tcp.c | 3 ++- net/rds/tcp.h | 4 net/rds/tcp_connect.c | 8 net/rds/tcp_listen.c | 54 -- net/sched/sch_netem.c | 61 +++-- 24
[PATCH] fix infoleak in wireless
The 6-bytes array “mac_addr” is not initialized in the dump_station implementations of “drivers/staging/wilc1000/wilc_wfi_cfgoperations.c” and “drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c”, so all 6 bytes may be leaked. Signed-off-by: Kangjie Lu--- net/wireless/nl80211.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 056a730..2e92d14 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3905,6 +3905,7 @@ static int nl80211_dump_station(struct sk_buff *skb, while (1) { memset(, 0, sizeof(sinfo)); + eth_zero_addr(mac_addr); err = rdev_dump_station(rdev, wdev->netdev, sta_idx, mac_addr, ); if (err == -ENOENT) -- 1.9.1
[PATCH] fix infoleak in llc
The stack object “info” has a total size of 12 bytes. Its last byte is padding which is not initialized and leaked via “put_cmsg”. Signed-off-by: Kangjie Lu--- net/llc/af_llc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index b3c52e3..8ae3ed9 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c @@ -626,6 +626,7 @@ static void llc_cmsg_rcv(struct msghdr *msg, struct sk_buff *skb) if (llc->cmsg_flags & LLC_CMSG_PKTINFO) { struct llc_pktinfo info; + memset(, 0, sizeof(info)); info.lpi_ifindex = llc_sk(skb->sk)->dev->ifindex; llc_pdu_decode_dsap(skb, _sap); llc_pdu_decode_da(skb, info.lpi_mac); -- 1.9.1
[PATCH net] bridge: fix igmp / mld query parsing
With the newly introduced helper functions the skb pulling is hidden in the checksumming function - and undone before returning to the caller. The IGMP and MLD query parsing functions in the bridge still assumed that the skb is pointing to the beginning of the IGMP/MLD message while it is now kept at the beginning of the IPv4/6 header. If there is a querier somewhere else, then this either causes the multicast snooping to stay disabled even though it could be enabled. Or, if we have the querier enabled too, then this can create unnecessary IGMP / MLD query messages on the link. Fixing this by taking the offset between IP and IGMP/MLD header into account, too. Fixes: 9afd85c9e455 ("net: Export IGMP/MLD message validation code") Reported-by: Simon WunderlichSigned-off-by: Linus Lüssing --- net/bridge/br_multicast.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 03661d9..7105cdf 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -1271,6 +1271,7 @@ static int br_ip4_multicast_query(struct net_bridge *br, unsigned long max_delay; unsigned long now = jiffies; __be32 group; + int offset = skb_transport_offset(skb); int err = 0; spin_lock(>multicast_lock); @@ -1280,14 +1281,14 @@ static int br_ip4_multicast_query(struct net_bridge *br, group = ih->group; - if (skb->len == sizeof(*ih)) { + if (skb->len == offset + sizeof(*ih)) { max_delay = ih->code * (HZ / IGMP_TIMER_SCALE); if (!max_delay) { max_delay = 10 * HZ; group = 0; } - } else if (skb->len >= sizeof(*ih3)) { + } else if (skb->len >= offset + sizeof(*ih3)) { ih3 = igmpv3_query_hdr(skb); if (ih3->nsrcs) goto out; @@ -1350,6 +1351,7 @@ static int br_ip6_multicast_query(struct net_bridge *br, unsigned long now = jiffies; const struct in6_addr *group = NULL; bool is_general_query; + int offset = skb_transport_offset(skb); int err = 0; spin_lock(>multicast_lock); @@ -1357,8 +1359,8 @@ static int br_ip6_multicast_query(struct net_bridge *br, (port && port->state == BR_STATE_DISABLED)) goto out; - if (skb->len == sizeof(*mld)) { - if (!pskb_may_pull(skb, sizeof(*mld))) { + if (skb->len == offset + sizeof(*mld)) { + if (!pskb_may_pull(skb, offset + sizeof(*mld))) { err = -EINVAL; goto out; } @@ -1367,7 +1369,7 @@ static int br_ip6_multicast_query(struct net_bridge *br, if (max_delay) group = >mld_mca; } else { - if (!pskb_may_pull(skb, sizeof(*mld2q))) { + if (!pskb_may_pull(skb, offset + sizeof(*mld2q))) { err = -EINVAL; goto out; } -- 1.7.10.4
Re: [PATCH net] bridge: fix igmp / mld query parsing
On Tue, 3 May 2016 22:18:54 +0200 Linus Lüssingwrote: > diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c > index 03661d9..7105cdf 100644 > --- a/net/bridge/br_multicast.c > +++ b/net/bridge/br_multicast.c > @@ -1271,6 +1271,7 @@ static int br_ip4_multicast_query(struct net_bridge *br, > unsigned long max_delay; > unsigned long now = jiffies; > __be32 group; > + int offset = skb_transport_offset(skb); shouldn't this be unsigned?
Re: [PATCH net v1] ipv6/ila: fix nlsize calculation for lwtunnel
From: Nicolas DichtelDate: Tue, 3 May 2016 09:58:27 +0200 > The handler 'ila_fill_encap_info' adds one attribute: ILA_ATTR_LOCATOR. > > Fixes: 65d7ab8de582 ("net: Identifier Locator Addressing module") > CC: Tom Herbert > Signed-off-by: Nicolas Dichtel > --- > > RFC -> v1: > - rebase on last net tree Applied and queued up for -stable, thanks for reposting this Nicolas.
Re: [PATCH net-next] tcp: guarantee forward progress in tcp_sendmsg()
From: Eric DumazetDate: Mon, 02 May 2016 21:49:25 -0700 > From: Eric Dumazet > > Under high rx pressure, it is possible tcp_sendmsg() never has a > chance to allocate an skb and loop forever as sk_flush_backlog() > would always return true. > > Fix this by calling sk_flush_backlog() only if one skb had been > allocated and filled before last backlog check. > > Fixes: d41a69f1d390 ("tcp: make tcp_sendmsg() aware of socket backlog") > Signed-off-by: Eric Dumazet Applied.
Re: [PATCH net-next v2] ipv6: add new struct ipcm6_cookie
From: Wei WangDate: Mon, 2 May 2016 21:40:07 -0700 > From: Wei Wang > > In the sendmsg function of UDP, raw, ICMP and l2tp sockets, we use local > variables like hlimits, tclass, opt and dontfrag and pass them to > corresponding > functions like ip6_make_skb, ip6_append_data and xxx_push_pending_frames. > This is not a good practice and makes it hard to add new parameters. > This fix introduces a new struct ipcm6_cookie similar to ipcm_cookie in > ipv4 and include the above mentioned variables. And we only pass the > pointer to this structure to corresponding functions. This makes it easier > to add new parameters in the future and makes the function cleaner. > > Signed-off-by: Wei Wang Applied, thanks.
[PATCH] mdio_bus: don't return NULL from mdiobus_scan()
I've finally noticed that mdiobus_scan() also returns either NULL or error value on failure. Return ERR_PTR(-ENODEV) instead of NULL since this is the error value already filtered out by the callers that want to ignore the MDIO address scan failure... Signed-off-by: Sergei Shtylyov--- The patch is against DaveM's 'net-next.git' repo. drivers/net/phy/mdio_bus.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: net-next/drivers/net/phy/mdio_bus.c === --- net-next.orig/drivers/net/phy/mdio_bus.c +++ net-next/drivers/net/phy/mdio_bus.c @@ -435,7 +435,7 @@ struct phy_device *mdiobus_scan(struct m err = phy_device_register(phydev); if (err) { phy_device_free(phydev); - return NULL; + return ERR_PTR(-ENODEV); } return phydev;
Re: [PATCHv2 bluetooth-next 00/10] 6lowpan: introduce basic 6lowpan-nd
From: Marcel HoltmannDate: Mon, 2 May 2016 16:17:41 -0700 >> My proposal would be that the IPv6 patches go via net-next to reduce >> merge conflicts with maybe upcoming changes. If they are split up, they >> seem very much self contained and easy to review. The rest seems to be >> also very much self contained and can go in via bluetooth-next, then. >> What do you think? > > I am actually fine with having this all go via net-next. We only > have driver patches pending in bluetooth-next for the next merge > window. Which means I can just pull net-next back into > bluetooth-next at any time. Ok, just resubmit the series explicitly targetting net-next then. Thanks.
Re: [PATCH net] net: macb: Probe MDIO bus before registering netdev
From: Florian FainelliDate: Mon, 2 May 2016 18:38:45 -0700 > The current sequence makes us register for a network device prior to > registering and probing the MDIO bus which could lead to some unwanted > consequences, like a thread of execution calling into ndo_open before > register_netdev() returns, while the MDIO bus is not ready yet. > > Rework the sequence to register for the MDIO bus, and therefore attach > to a PHY prior to calling register_netdev(), which implies reworking the > error path a bit. > > Signed-off-by: Florian Fainelli Applied, thanks Florian.
Re: [PATCH net v2 0/2] RDS: TCP: sychronization during connection startup
From: Sowmini VaradhanDate: Mon, 2 May 2016 11:24:50 -0700 > This patch series ensures that the passive (accept) side of the > TCP connection used for RDS-TCP is correctly synchronized with > any concurrent active (connect) attempts for a given pair of peers. > > Patch 1 in the series makes sure that the t_sock in struct > rds_tcp_connection is only reset after any threads in rds_tcp_xmit > have completed (otherwise a null-ptr deref may be encountered). > Patch 2 synchronizes rds_tcp_accept_one() with the rds_tcp*connect() > path. > > v2: review comments from Santosh Shilimkar, other spelling corrections Series applied, thanks.
Re: [PATCH net-next] net: add __sock_wfree() helper
From: Eric DumazetDate: Mon, 02 May 2016 10:56:27 -0700 > From: Eric Dumazet > > Hosts sending lot of ACK packets exhibit high sock_wfree() cost > because of cache line miss to test SOCK_USE_WRITE_QUEUE > > We could move this flag close to sk_wmem_alloc but it is better > to perform the atomic_sub_and_test() on a clean cache line, > as it avoid one extra bus transaction. > > skb_orphan_partial() can also have a fast track for packets that either > are TCP acks, or already went through another skb_orphan_partial() > > Signed-off-by: Eric Dumazet Applied, thanks.
Re: [net-next PATCH v3 0/8] Fix Tunnel features and enable GSO partial for several drivers
From: Alexander DuyckDate: Mon, 02 May 2016 09:38:06 -0700 > v3: Moved 2 patches into series for net as they were generic fixes. > Added patch to disable GSO partial if frame is less than 2x size of MSS I'll therefore apply this series after my next net --> net-next merge. Thanks.
Re: [net PATCH 0/2] Fixes for tunnel checksum and segmentation offloads
From: Alexander DuyckDate: Mon, 02 May 2016 09:25:04 -0700 > This patch series is a subset of patches I had submitted for net-next. I > plan to drop these two patches from the v3 of "Fix Tunnel features and > enable GSO partial for several drivers" and I am instead submitting them > for net since these are truly fixes and likely will need to be backported > to stable branches. > > This series addresses 2 specific issues. The first is that we could > request TSO on a v4 inner header while not supporting checksum offload of > the outer IPv6 header. The second is that we could request an IPv6 inner > checksum offload without validating that we could actually support an inner > IPv6 checksum offload. Series applied, thanks.
Re: [PATCH net-next 0/3] tipc: redesign socket-level flow control
From: Jon MaloyDate: Mon, 2 May 2016 10:22:33 -0400 > The socket-level flow control in TIPC has long been due for a major > overhaul. This series fixes this. Series applied, thanks Jon.
Re: [PATCH 1/3] brcm80211: correct speed testing
From: Oliver NeukumDate: Mon, 2 May 2016 13:06:12 +0200 > Allow for SS+ USB > > Signed-off-by: Oliver Neukum Applied.
Re: [PATCH 2/3] usbnet: correct speed testing
From: Oliver NeukumDate: Mon, 2 May 2016 13:06:13 +0200 > Allow for SS+ USB > > Signed-off-by: Oliver Neukum Applied.
Re: [PATCH 3/3] rtl8152: correct speed testing
From: Oliver NeukumDate: Mon, 2 May 2016 13:06:14 +0200 > Allow for SS+ USB > > Signed-off-by: Oliver Neukum Applied.
Re: [PATCH net-next 1/1] qed: Apply tunnel configurations after PF start
From: Manish ChopraDate: Mon, 2 May 2016 06:16:04 -0400 > Configure and enable various tunnels on the > adapter after PF start. > > This change was missed as a part of > 'commit 464f664501816ef5fbbc00b8de96f4ae5a1c9325 > ("qed: Add infrastructure support for tunneling")' > > Signed-off-by: Manish Chopra > Signed-off-by: Yuval Mintz Applied.
Re: Cannot use NFS with linux-next 20160429
Hi Chuck, On Sun, May 1, 2016 at 4:52 PM, Chuck Lever <chuck.le...@oracle.com> wrote: > Hi Fabio- > >> On Apr 29, 2016, at 7:18 PM, Fabio Estevam <feste...@gmail.com> wrote: >> >> Hi, >> >> NFS is not working on a imx6q-sabresd board running linux-next 20160429: >> >> [ 15.753317] #0: wm8962-audio >> [ 15.759437] Root-NFS: no NFS server address > > At a glance, that looks like the NFSROOT mount options are > invalid? First, confirm what is specified on the kernel > cmdline. Yes, the kernel command line is correct. > > I'm not aware of any recent changes to NFSROOT. Often > these NFSROOT problems turn out to be related to churn in > the underlying Ethernet drivers or the generic code that > handles mounting the root filesystem at boot time. Today's next shows some different info: [7.606456] #0: wm8962-audio [7.672659] VFS: Mounted root (nfs filesystem) readonly on device 0:14. [7.680860] devtmpfs: mounted [7.685664] Freeing unused kernel memory: 1024K (c0c0 - c0d0) [7.871481] [7.873004] = [7.877381] [ INFO: inconsistent lock state ] [7.881760] 4.6.0-rc6-next-20160503-2-g51d9962 #351 Not tainted [7.888043] - [7.892419] inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage. [7.898449] kworker/0:1H/179 [HC0[0]:SC0[0]:HE1:SE1] takes: [7.904040] (>seq#5){+.?...}, at: [] tcp_ack+0x134/0x129c [7.911166] {IN-SOFTIRQ-W} state was registered at: [7.916061] [] lock_acquire+0x78/0x98 [7.920816] [] tcp_snd_una_update+0x64/0xa8 [7.926092] [] tcp_ack+0x134/0x129c [7.930668] [] tcp_rcv_state_process+0x814/0xfc8 [7.936375] [] tcp_v4_do_rcv+0x64/0x1c8 [7.941305] [] tcp_v4_rcv+0xf00/0xfbc [7.946057] [] ip_local_deliver_finish+0xd4/0x550 [7.951859] [] ip_local_deliver+0xcc/0xdc [7.956957] [] ip_rcv_finish+0xc4/0x744 [7.961881] [] ip_rcv+0x4c8/0x7a8 [7.966284] [] __netif_receive_skb_core+0x514/0x8ec [7.972251] [] __netif_receive_skb+0x2c/0x8c [7.977614] [] netif_receive_skb_internal+0x7c/0x1f0 [7.983666] [] napi_gro_receive+0x88/0xdc [7.988764] [] fec_enet_rx_napi+0x390/0x9c8 [7.994036] [] net_rx_action+0x148/0x344 [7.999046] [] __do_softirq+0x130/0x2bc [8.003976] [] irq_exit+0xc4/0x138 [8.008466] [] __handle_domain_irq+0x74/0xe4 [8.013838] [] gic_handle_irq+0x4c/0x9c [8.018763] [] __irq_svc+0x58/0x78 [8.023251] [] _raw_spin_unlock_irq+0x30/0x34 [8.028710] [] finish_task_switch+0xcc/0x274 [8.034072] [] __schedule+0x23c/0x6f8 [8.038823] [] schedule+0x3c/0xa0 [8.043224] [] schedule_preempt_disabled+0x10/0x14 [8.049103] [] cpu_startup_entry+0x1f4/0x24c [8.054468] [] rest_init+0x12c/0x16c [8.059130] [] start_kernel+0x340/0x3b0 [8.064059] [<1000807c>] 0x1000807c [8.067767] irq event stamp: 3601 [8.071099] hardirqs last enabled at (3601): [] _raw_spin_unlock_irqrestore+0x38/0x4c [8.079936] hardirqs last disabled at (3600): [] _raw_spin_lock_irqsave+0x24/0x54 [8.088336] softirqs last enabled at (3598): [] __release_sock+0x3c/0x124 [8.096128] softirqs last disabled at (3596): [] release_sock+0x20/0xa4 [8.103654] [8.103654] other info that might help us debug this: [8.110202] Possible unsafe locking scenario: [8.110202] [8.116140]CPU0 [8.118601] [8.121062] lock(>seq#5); [8.124547] [8.127182] lock(>seq#5); [8.130838] [8.130838] *** DEADLOCK *** [8.130838] [8.136785] 3 locks held by kworker/0:1H/179: [8.141157] #0: ("rpciod"){.+.+.+}, at: [] process_one_work+0x128/0x410 [8.148965] #1: ((>u.tk_work)){+.+.+.}, at: [] process_one_work+0x128/0x410 [8.157630] #2: (sk_lock-AF_INET-RPC){+.+...}, at: [] tcp_sendmsg+0x24/0xb5c [8.165859] [8.165859] stack backtrace: [8.170247] CPU: 0 PID: 179 Comm: kworker/0:1H Not tainted 4.6.0-rc6-next-20160503-2-g51d9962 #351 [8.179572] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) [8.186137] Workqueue: rpciod rpc_async_schedule [8.190791] Backtrace: [8.193307] [] (dump_backtrace) from [] (show_stack+0x18/0x1c) [8.200894] r6:6193 r5: r4: r3:eebdc800 [8.206692] [] (show_stack) from [] (dump_stack+0xb0/0xe8) [8.213961] [] (dump_stack) from [] (print_usage_bug+0x268/0x2dc) [8.221809] r8:0004 r7:eebdcd00 r6:eebdc800 r5:c0ae4bbc r4:c0ec6054 r3:eebdc800 [8.229712] [] (print_usage_bug) from [] (mark_lock+0x29c/0x6b0) [8.237472] r10:c016a1c8 r8:0004 r7:eebdc800 r6:1054 r5:eebdcd00 r4:0006 [8.245456] [] (mark_lock) from [] (__lock_acquire+0x550/0x17c8) [8.253216] r10:c0d21d9c r9:02be r8:c0e97784 r7:eebdc800 r6:c153a09c r5:eebdcd00 [8.26118
Re: [PATCH v2] net: mvneta: Remove superfluous SMP function call
From: Anna-Maria GleixnerDate: Mon, 2 May 2016 11:02:51 +0200 > Since commit 3b9d6da67e11 ("cpu/hotplug: Fix rollback during error-out > in __cpu_disable()") it is ensured that callbacks of CPU_ONLINE and > CPU_DOWN_PREPARE are processed on the hotplugged CPU. Due to this SMP > function calls are no longer required. > > Replace smp_call_function_single() with a direct call to > mvneta_percpu_enable() or mvneta_percpu_disable(). The functions do > not require to be called with interrupts disabled, therefore the > smp_call_function_single() calling convention is not preserved. > > Cc: Thomas Petazzoni > Cc: netdev@vger.kernel.org > Signed-off-by: Anna-Maria Gleixner Applied, thanks.
Re: [net-next PATCH v2 0/5] stmmac: dwmac-socfpga refactor+cleanup
From: Joachim EastwoodDate: Sun, 1 May 2016 22:58:18 +0200 > This patch aims to remove the init/exit callbacks from the dwmac- > socfpga driver and instead use standard PM callbacks. Doing this > will also allow us to cleanup the driver. > > Eventually the init/exit callbacks will be deprecated and removed > from all drivers dwmac-* except for dwmac-generic. Drivers will be > refactored to use standard PM and remove callbacks. > > This patch set should not change the behavior of the driver itself, > it only moves code around. The only exception to this is patch > number 4 which restores the resume callback behavior which was > changed in the "net: stmmac: socfpga: Remove re-registration of > reset controller" patch. I belive calling phy_resume() only > from the resume callback and not probe is the right thing to do. > > Changes from v1: > - Rebase on net-next > > One heads-up here: > The first patch changes the prototype of a couple of > functions used in Alexandre's "add Ethernet glue logic for > stm32 chip" patch [1] and will cause build failures for > dwmac-stm32.c if not fixed up! > If Alexandre's patch set is applied first I will gladly > rebase my patch set to account for his driver as well. > > [1] https://patchwork.ozlabs.org/patch/614405/ Series applied, thanks. stm32 will need to be respun, therefore.
Re: [PATCH 2/2] mac80211_hwsim: Allow managing radios from non-initial namespaces
On Tue, 2016-05-03 at 08:53 +0200, Martin Willi wrote: > > +static __net_init int hwsim_init_net(struct net *net) > +{ > + struct mac80211_hwsim_data *data; > + bool exists = true; > + int netgroup = 0; > + > + spin_lock_bh(_radio_lock); > + while (exists) { > + exists = false; > + list_for_each_entry(data, _radios, list) { > + if (netgroup == data->netgroup) { > + exists = true; > + netgroup++; > + break; > + } > + } > + } > + spin_unlock_bh(_radio_lock); > + > + *(int *)net_generic(net, hwsim_net_id) = netgroup; This seems somewhat awkward. Why not just take the maximum of all the netgroup IDs + 1? We'd run out of memory and radio IDs long before netgroup IDs even that way, and they're not actually visible anywhere so it doesn't matter. Actually though, *both* your approach and my suggestion don't seem safe: consider a new netns that doesn't have any hwsim radios yet. Now you create *another* one, but it would get the same netgroup. IOW, you should simply use a global counter. Surprising (net) namespaces don't have an index like that already, but I don't see one. > +static void __net_exit hwsim_exit_net(struct net *net) > +{ > + struct mac80211_hwsim_data *entry, *tmp; > + > + spin_lock_bh(_radio_lock); > + list_for_each_entry_safe(entry, tmp, _radios, list) { > + if (net_eq(wiphy_net(entry->hw->wiphy), net)) { > + list_del(>list); > + INIT_WORK(>destroy_work, > destroy_radio); > + schedule_work(>destroy_work); > + } > + } > + spin_unlock_bh(_radio_lock); > +} This changes today's default behaviour of moving the wiphys to the default namespace. Did you intend to destroy them based on the netgroup, i.e. based on the namespace that created them? Actually, maybe they should move back to the namespace that created them, if the namespace they are in is destroyed? But that's difficult, I don't mind this behaviour, but I'm not sure it's what we want by default for radios created in the init_net. johannes
Re: [PATCH] macb: fix mdiobus_scan() error check
From: Sergei ShtylyovDate: Sun, 01 May 2016 01:47:36 +0300 > Now mdiobus_scan() returns ERR_PTR(-ENODEV) instead of NULL if the PHY > device ID was read as all ones. As this was not an error before, this > value should be filtered out now in this driver. > > Fixes: b74766a0a0fe ("phylib: don't return NULL from get_phy_device()") > Signed-off-by: Sergei Shtylyov Applied.
Re: [PATCH] pxa168_eth: fix mdiobus_scan() error check
From: Sergei ShtylyovDate: Sat, 30 Apr 2016 23:35:11 +0300 > Since mdiobus_scan() returns either an error code or NULL on error, the > driver should check for both, not only for NULL, otherwise a crash is > imminent... > > Reported-by: Arnd Bergmann > Signed-off-by: Sergei Shtylyov Applied.
Re: [PATCH v6 00/21] Add HiSilicon RoCE driver
On Thu, Apr 28, 2016 at 08:09:35PM +0800, Lijun Ou wrote: > The HiSilicon Network Substem is a long term evolution IP which is > supposed to be used in HiSilicon ICT SoCs. HNS (HiSilicon Network > Sybsystem) also has a hardware support of performing RDMA with > RoCEE. > The driver for HiSilicon RoCEE(RoCE Engine) is a platform driver and > will support mulitple versions of SOCs in future. This version of driver > is meant to support Hip06 SoC(which confirms to RoCEEv1 hardware > specifications). Please read Dave's comment [1], it is valuable for your code as well. * Please use 'bool' and "true/false" [1] http://marc.info/?l=linux-rdma=146229367301442=2 Thanks signature.asc Description: Digital signature
[PATCH net-next v2] macvtap: add namespace support to the sysfs device class
When creating macvtaps that are expected to have the same ifindex in different network namespaces, only the first one will succeed. The others will fail with a sysfs_warn_dup warning due to them trying to create the following sysfs link (with 'NN' the ifindex of macvtapX): /sys/class/macvtap/tapNN -> /sys/devices/virtual/net/macvtapX/tapNN This is reproducible by running the following commands: ip netns add ns1 ip netns add ns2 ip link add veth0 type veth peer name veth1 ip link set veth0 netns ns1 ip link set veth1 netns ns2 ip netns exec ns1 ip l add link veth0 macvtap0 type macvtap ip netns exec ns2 ip l add link veth1 macvtap1 type macvtap The last command will fail with "RTNETLINK answers: File exists" (along with the kernel warning) but retrying it will work because the ifindex was incremented. The 'net' device class is isolated between network namespaces so each one has its own hierarchy of net devices. This isn't the case for the 'macvtap' device class. The problem occurs half-way through the netdev registration, when `macvtap_device_event` is called-back to create the 'tapNN' macvtap class device under the 'macvtapX' net class device. This patch adds namespace support to the 'macvtap' device class so that /sys/class/macvtap is no longer shared between net namespaces. However, making the macvtap sysfs class namespace-aware has the side effect of changing /sys/devices/virtual/net/macvtapX/tapNN into /sys/devices/virtual/net/macvtapX/macvtap/tapNN. This is due to Commit 24b1442 ("Driver-core: Always create class directories for classses that support namespaces") and the fact that class devices supporting namespaces are really not supposed to be placed directly under other class devices. To avoid breaking userland, a tapNN symlink pointing to macvtap/tapNN is created inside the macvtapX directory. Signed-off-by: Marc Angel--- drivers/net/macvtap.c | 35 +-- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 95394ed..b7ebfcd 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c @@ -129,7 +129,18 @@ static DEFINE_MUTEX(minor_lock); static DEFINE_IDR(minor_idr); #define GOODCOPY_LEN 128 -static struct class *macvtap_class; +static const void *macvtap_net_namespace(struct device *d) +{ + struct net_device *dev = to_net_dev(d->parent); + return dev_net(dev); +} + +static struct class macvtap_class = { + .name = "macvtap", + .owner = THIS_MODULE, + .ns_type = _ns_type_operations, + .namespace = macvtap_net_namespace, +}; static struct cdev macvtap_cdev; static const struct proto_ops macvtap_socket_ops; @@ -1274,6 +1285,7 @@ static int macvtap_device_event(struct notifier_block *unused, unsigned long event, void *ptr) { struct net_device *dev = netdev_notifier_info_to_dev(ptr); + const char *tap_name = kasprintf(GFP_KERNEL, "tap%d", dev->ifindex); struct macvlan_dev *vlan; struct device *classdev; dev_t devt; @@ -1295,16 +1307,21 @@ static int macvtap_device_event(struct notifier_block *unused, return notifier_from_errno(err); devt = MKDEV(MAJOR(macvtap_major), vlan->minor); - classdev = device_create(macvtap_class, >dev, devt, -dev, "tap%d", dev->ifindex); + classdev = device_create(_class, >dev, devt, +dev, tap_name); if (IS_ERR(classdev)) { macvtap_free_minor(vlan); return notifier_from_errno(PTR_ERR(classdev)); } + err = sysfs_create_link(>dev.kobj, >kobj, + dev_name(classdev)); + if (err) + return notifier_from_errno(err); break; case NETDEV_UNREGISTER: + sysfs_remove_link(>dev.kobj, tap_name); devt = MKDEV(MAJOR(macvtap_major), vlan->minor); - device_destroy(macvtap_class, devt); + device_destroy(_class, devt); macvtap_free_minor(vlan); break; } @@ -1330,11 +1347,9 @@ static int macvtap_init(void) if (err) goto out2; - macvtap_class = class_create(THIS_MODULE, "macvtap"); - if (IS_ERR(macvtap_class)) { - err = PTR_ERR(macvtap_class); + err = class_register(_class); + if (err) goto out3; - } err = register_netdevice_notifier(_notifier_block); if (err) @@ -1349,7 +1364,7 @@ static int macvtap_init(void) out5: unregister_netdevice_notifier(_notifier_block); out4: - class_unregister(macvtap_class); + class_unregister(_class); out3: cdev_del(_cdev); out2: @@ -1363,7 +1378,7 @@ static void
Re: [PATCHv2 bluetooth-next 05/10] ndisc: add addr_len parameter to ndisc_opt_addr_data
Hello. On 20/04/16 10:19, Alexander Aring wrote: This patch makes the address length as argument for the ndisc_opt_addr_data function. This is necessary to handle addresses which don't use dev->addr_len as address length. Cc: David S. MillerCc: Alexey Kuznetsov Cc: James Morris Cc: Hideaki YOSHIFUJI Cc: Patrick McHardy Signed-off-by: Alexander Aring --- include/net/ndisc.h | 5 +++-- net/ipv6/ndisc.c| 11 +++ net/ipv6/route.c| 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/include/net/ndisc.h b/include/net/ndisc.h index ef43e88..aac868e 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h @@ -134,12 +134,13 @@ static inline int ndisc_opt_addr_space(struct net_device *dev, } static inline u8 *ndisc_opt_addr_data(struct nd_opt_hdr *p, - struct net_device *dev) + struct net_device *dev, + unsigned char addr_len) { u8 *lladdr = (u8 *)(p + 1); int lladdrlen = p->nd_opt_len << 3; int prepad = ndisc_addr_option_pad(dev->type); - if (lladdrlen != ndisc_opt_addr_space(dev, dev->addr_len)) + if (lladdrlen != ndisc_opt_addr_space(dev, addr_len)) return NULL; return lladdr + prepad; } diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 69e20e3..4e91d5e 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -744,7 +744,8 @@ static void ndisc_recv_ns(struct sk_buff *skb) } if (ndopts.nd_opts_src_lladdr) { - lladdr = ndisc_opt_addr_data(ndopts.nd_opts_src_lladdr, dev); + lladdr = ndisc_opt_addr_data(ndopts.nd_opts_src_lladdr, dev, +dev->addr_len); if (!lladdr) { ND_PRINTK(2, warn, "NS: invalid link-layer address length\n"); @@ -916,7 +917,8 @@ static void ndisc_recv_na(struct sk_buff *skb) return; } if (ndopts.nd_opts_tgt_lladdr) { - lladdr = ndisc_opt_addr_data(ndopts.nd_opts_tgt_lladdr, dev); + lladdr = ndisc_opt_addr_data(ndopts.nd_opts_tgt_lladdr, dev, +dev->addr_len); if (!lladdr) { ND_PRINTK(2, warn, "NA: invalid link-layer address length\n"); @@ -1024,7 +1026,7 @@ static void ndisc_recv_rs(struct sk_buff *skb) if (ndopts.nd_opts_src_lladdr) { lladdr = ndisc_opt_addr_data(ndopts.nd_opts_src_lladdr, -skb->dev); +skb->dev, skb->dev->addr_len); if (!lladdr) goto out; } @@ -1322,7 +1324,8 @@ skip_linkparms: u8 *lladdr = NULL; if (ndopts.nd_opts_src_lladdr) { lladdr = ndisc_opt_addr_data(ndopts.nd_opts_src_lladdr, -skb->dev); +skb->dev, +skb->dev->addr_len); if (!lladdr) { ND_PRINTK(2, warn, "RA: invalid link-layer address length\n"); diff --git a/net/ipv6/route.c b/net/ipv6/route.c index ed44663..cc180b3 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -2157,7 +2157,7 @@ static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_bu lladdr = NULL; if (ndopts.nd_opts_tgt_lladdr) { lladdr = ndisc_opt_addr_data(ndopts.nd_opts_tgt_lladdr, -skb->dev); +skb->dev, skb->dev->addr_len); if (!lladdr) { net_dbg_ratelimited("rt6_redirect: invalid link-layer address length\n"); return; Reviewed-by: Stefan Schmidt regards Stefan Schmidt
Re: [PATCHv2 bluetooth-next 07/10] ipv6: introduce neighbour discovery ops
Hello. On 02/05/16 21:36, Hannes Frederic Sowa wrote: On 20.04.2016 10:19, Alexander Aring wrote: This patch introduces neighbour discovery ops callback structure. The structure contains at first receive and transmit handling for NS/NA and userspace option field functionality. These callback offers 6lowpan different handling, such as 802.15.4 short address handling or RFC6775 (Neighbor Discovery Optimization for IPv6 over 6LoWPANs). Cc: David S. MillerCc: Alexey Kuznetsov Cc: James Morris Cc: Hideaki YOSHIFUJI Cc: Patrick McHardy Signed-off-by: Alexander Aring --- include/linux/netdevice.h | 3 ++ include/net/ndisc.h | 96 +++ net/ipv6/addrconf.c | 1 + net/ipv6/ndisc.c | 71 --- net/ipv6/route.c | 2 +- 5 files changed, 144 insertions(+), 29 deletions(-) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 0052c42..bc60033 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1677,6 +1677,9 @@ struct net_device { #ifdef CONFIG_NET_L3_MASTER_DEV const struct l3mdev_ops *l3mdev_ops; #endif +#if IS_ENABLED(CONFIG_IPV6) + const struct ndisc_ops *ndisc_ops; +#endif const struct header_ops *header_ops; diff --git a/include/net/ndisc.h b/include/net/ndisc.h index aac868e..14ed016 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h @@ -110,7 +110,8 @@ struct ndisc_options { #define NDISC_OPT_SPACE(len) (((len)+2+7)&~7) -struct ndisc_options *ndisc_parse_options(u8 *opt, int opt_len, +struct ndisc_options *ndisc_parse_options(const struct net_device *dev, + u8 *opt, int opt_len, struct ndisc_options *ndopts); /* @@ -173,6 +174,93 @@ static inline struct neighbour *__ipv6_neigh_lookup(struct net_device *dev, cons return n; } +static inline int __ip6_ndisc_is_useropt(struct nd_opt_hdr *opt) +{ + return opt->nd_opt_type == ND_OPT_RDNSS || + opt->nd_opt_type == ND_OPT_DNSSL; +} + +#if IS_ENABLED(CONFIG_IPV6) +struct ndisc_ops { + int (*is_useropt)(struct nd_opt_hdr *opt); + void(*send_na)(struct net_device *dev, + const struct in6_addr *daddr, + const struct in6_addr *solicited_addr, + bool router, bool solicited, + bool override, bool inc_opt); + void(*recv_na)(struct sk_buff *skb); + void(*send_ns)(struct net_device *dev, + const struct in6_addr *solicit, + const struct in6_addr *daddr, + const struct in6_addr *saddr); + void(*recv_ns)(struct sk_buff *skb); +}; + +static inline int ndisc_is_useropt(const struct net_device *dev, + struct nd_opt_hdr *opt) +{ + if (likely(dev->ndisc_ops->is_useropt)) + return dev->ndisc_ops->is_useropt(opt); + else + return 0; +} + +static inline void ndisc_send_na(struct net_device *dev, +const struct in6_addr *daddr, +const struct in6_addr *solicited_addr, +bool router, bool solicited, bool override, +bool inc_opt) +{ + if (likely(dev->ndisc_ops->send_na)) + dev->ndisc_ops->send_na(dev, daddr, solicited_addr, router, + solicited, override, inc_opt); +} + +static inline void ndisc_recv_na(struct sk_buff *skb) +{ + if (likely(skb->dev->ndisc_ops->recv_na)) + skb->dev->ndisc_ops->recv_na(skb); +} + +static inline void ndisc_send_ns(struct net_device *dev, +const struct in6_addr *solicit, +const struct in6_addr *daddr, +const struct in6_addr *saddr) +{ + if (likely(dev->ndisc_ops->send_ns)) + dev->ndisc_ops->send_ns(dev, solicit, daddr, saddr); +} + +static inline void ndisc_recv_ns(struct sk_buff *skb) +{ + if (likely(skb->dev->ndisc_ops->recv_ns)) + skb->dev->ndisc_ops->recv_ns(skb); +} +#else +static inline int ndisc_is_useropt(const struct net_device *dev, + struct nd_opt_hdr *opt) +{ + return 0; +} + +static inline void ndisc_send_na(struct net_device *dev, +const struct in6_addr *daddr, +const struct in6_addr *solicited_addr, +bool router, bool solicited, bool override, +bool inc_opt) { } + +static inline void ndisc_recv_na(struct sk_buff
Re: [PATCHv2 bluetooth-next 06/10] ndisc: add addr_len parameter to ndisc_fill_addr_option
Hello. On 20/04/16 10:19, Alexander Aring wrote: This patch makes the address length as argument for the ndisc_fill_addr_option function. This is necessary to handle addresses which don't use dev->addr_len as address length. Cc: David S. MillerCc: Alexey Kuznetsov Cc: James Morris Cc: Hideaki YOSHIFUJI Cc: Patrick McHardy Signed-off-by: Alexander Aring --- net/ipv6/ndisc.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 4e91d5e..176c7c4 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -150,11 +150,11 @@ struct neigh_table nd_tbl = { }; EXPORT_SYMBOL_GPL(nd_tbl); -static void ndisc_fill_addr_option(struct sk_buff *skb, int type, void *data) +static void ndisc_fill_addr_option(struct sk_buff *skb, int type, void *data, + int data_len) { int pad = ndisc_addr_option_pad(skb->dev->type); - int data_len = skb->dev->addr_len; - int space = ndisc_opt_addr_space(skb->dev, skb->dev->addr_len); + int space = ndisc_opt_addr_space(skb->dev, data_len); u8 *opt = skb_put(skb, space); opt[0] = type; @@ -528,7 +528,7 @@ void ndisc_send_na(struct net_device *dev, const struct in6_addr *daddr, if (inc_opt) ndisc_fill_addr_option(skb, ND_OPT_TARGET_LL_ADDR, - dev->dev_addr); + dev->dev_addr, dev->addr_len); ndisc_send_skb(skb, daddr, src_addr); @@ -590,7 +590,7 @@ void ndisc_send_ns(struct net_device *dev, const struct in6_addr *solicit, if (inc_opt) ndisc_fill_addr_option(skb, ND_OPT_SOURCE_LL_ADDR, - dev->dev_addr); + dev->dev_addr, dev->addr_len); ndisc_send_skb(skb, daddr, saddr); } @@ -641,7 +641,7 @@ void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr, if (send_sllao) ndisc_fill_addr_option(skb, ND_OPT_SOURCE_LL_ADDR, - dev->dev_addr); + dev->dev_addr, dev->addr_len); ndisc_send_skb(skb, daddr, saddr); } @@ -1597,7 +1597,8 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target) */ if (ha) - ndisc_fill_addr_option(buff, ND_OPT_TARGET_LL_ADDR, ha); + ndisc_fill_addr_option(buff, ND_OPT_TARGET_LL_ADDR, ha, + dev->addr_len); /* * build redirect option and copy skb over to the new packet. Reviewed-by: Stefan Schmidt regards Stefan Schmidt
Re: [PATCHv2 bluetooth-next 04/10] ndisc: add addr_len parameter to ndisc_opt_addr_space
Hello. On 20/04/16 10:19, Alexander Aring wrote: This patch makes the address length as argument for the ndisc_opt_addr_space function. This is necessary to handle addresses which don't use dev->addr_len as address length. Cc: David S. MillerCc: Alexey Kuznetsov Cc: James Morris Cc: Hideaki YOSHIFUJI Cc: Patrick McHardy Signed-off-by: Alexander Aring --- include/net/ndisc.h | 8 net/ipv6/ndisc.c| 10 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/net/ndisc.h b/include/net/ndisc.h index 2d8edaa..ef43e88 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h @@ -127,10 +127,10 @@ static inline int ndisc_addr_option_pad(unsigned short type) } } -static inline int ndisc_opt_addr_space(struct net_device *dev) +static inline int ndisc_opt_addr_space(struct net_device *dev, + unsigned char addr_len) { - return NDISC_OPT_SPACE(dev->addr_len + - ndisc_addr_option_pad(dev->type)); + return NDISC_OPT_SPACE(addr_len + ndisc_addr_option_pad(dev->type)); } static inline u8 *ndisc_opt_addr_data(struct nd_opt_hdr *p, @@ -139,7 +139,7 @@ static inline u8 *ndisc_opt_addr_data(struct nd_opt_hdr *p, u8 *lladdr = (u8 *)(p + 1); int lladdrlen = p->nd_opt_len << 3; int prepad = ndisc_addr_option_pad(dev->type); - if (lladdrlen != ndisc_opt_addr_space(dev)) + if (lladdrlen != ndisc_opt_addr_space(dev, dev->addr_len)) return NULL; return lladdr + prepad; } diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index c245895..69e20e3 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -154,7 +154,7 @@ static void ndisc_fill_addr_option(struct sk_buff *skb, int type, void *data) { int pad = ndisc_addr_option_pad(skb->dev->type); int data_len = skb->dev->addr_len; - int space = ndisc_opt_addr_space(skb->dev); + int space = ndisc_opt_addr_space(skb->dev, skb->dev->addr_len); u8 *opt = skb_put(skb, space); opt[0] = type; @@ -509,7 +509,7 @@ void ndisc_send_na(struct net_device *dev, const struct in6_addr *daddr, if (!dev->addr_len) inc_opt = 0; if (inc_opt) - optlen += ndisc_opt_addr_space(dev); + optlen += ndisc_opt_addr_space(dev, dev->addr_len); skb = ndisc_alloc_skb(dev, sizeof(*msg) + optlen); if (!skb) @@ -574,7 +574,7 @@ void ndisc_send_ns(struct net_device *dev, const struct in6_addr *solicit, if (ipv6_addr_any(saddr)) inc_opt = false; if (inc_opt) - optlen += ndisc_opt_addr_space(dev); + optlen += ndisc_opt_addr_space(dev, dev->addr_len); skb = ndisc_alloc_skb(dev, sizeof(*msg) + optlen); if (!skb) @@ -626,7 +626,7 @@ void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr, } #endif if (send_sllao) - optlen += ndisc_opt_addr_space(dev); + optlen += ndisc_opt_addr_space(dev, dev->addr_len); skb = ndisc_alloc_skb(dev, sizeof(*msg) + optlen); if (!skb) @@ -1563,7 +1563,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target) memcpy(ha_buf, neigh->ha, dev->addr_len); read_unlock_bh(>lock); ha = ha_buf; - optlen += ndisc_opt_addr_space(dev); + optlen += ndisc_opt_addr_space(dev, dev->addr_len); } else read_unlock_bh(>lock); Reviewed-by: Stefan Schmidt regards Stefan Schmidt
Re: [PATCHv2 bluetooth-next 03/10] 6lowpan: remove ipv6 module request
Hello. On 20/04/16 10:19, Alexander Aring wrote: Since we use exported function from ipv6 kernel module we don't need to request the module anymore to have ipv6 functionality. Signed-off-by: Alexander Aring--- net/6lowpan/core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/6lowpan/core.c b/net/6lowpan/core.c index fbae31e..824d1bc 100644 --- a/net/6lowpan/core.c +++ b/net/6lowpan/core.c @@ -158,8 +158,6 @@ static int __init lowpan_module_init(void) return ret; } - request_module_nowait("ipv6"); - request_module_nowait("nhc_dest"); request_module_nowait("nhc_fragment"); request_module_nowait("nhc_hop"); Good point. Reviewed-by: Stefan Schmidt regards Stefan Schmidt
Re: [PATCHv2 bluetooth-next 02/10] 6lowpan: add 802.15.4 short addr slaac
Hello. On 20/04/16 10:19, Alexander Aring wrote: This patch adds the autoconfiguration if a valid 802.15.4 short address is available for 802.15.4 6LoWPAN interfaces. Cc: David S. MillerCc: Alexey Kuznetsov Cc: James Morris Cc: Hideaki YOSHIFUJI Cc: Patrick McHardy Signed-off-by: Alexander Aring --- include/net/addrconf.h | 3 +++ net/6lowpan/core.c | 46 ++ net/ipv6/addrconf.c| 5 +++-- 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 730d856..b1774eb 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -94,6 +94,9 @@ int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2, void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr); void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr); +void addrconf_add_linklocal(struct inet6_dev *idev, + const struct in6_addr *addr, u32 flags); + static inline int addrconf_ifid_eui48(u8 *eui, struct net_device *dev) { if (dev->addr_len != ETH_ALEN) diff --git a/net/6lowpan/core.c b/net/6lowpan/core.c index 7a240b3..fbae31e 100644 --- a/net/6lowpan/core.c +++ b/net/6lowpan/core.c @@ -14,6 +14,7 @@ #include #include +#include #include "6lowpan_i.h" @@ -72,16 +73,61 @@ void lowpan_unregister_netdev(struct net_device *dev) } EXPORT_SYMBOL(lowpan_unregister_netdev); +static int addrconf_ifid_802154_6lowpan(u8 *eui, struct net_device *dev) +{ + struct wpan_dev *wpan_dev = lowpan_802154_dev(dev)->wdev->ieee802154_ptr; + + /* Set short_addr autoconfiguration if short_addr is present only */ + if (!ieee802154_is_valid_src_short_addr(wpan_dev->short_addr)) + return -1; -EINVAL instead of -1? + + /* For either address format, all zero addresses MUST NOT be used */ + if (wpan_dev->pan_id == cpu_to_le16(0x) && + wpan_dev->short_addr == cpu_to_le16(0x)) + return -1; -EINVAL instead of -1? + + /* Alternatively, if no PAN ID is known, 16 zero bits may be used */ + if (wpan_dev->pan_id == cpu_to_le16(IEEE802154_PAN_ID_BROADCAST)) + memset(eui, 0, 2); + else + ieee802154_le16_to_be16(eui, _dev->pan_id); + + /* The "Universal/Local" (U/L) bit shall be set to zero */ + eui[0] &= ~2; + eui[2] = 0; + eui[3] = 0xFF; + eui[4] = 0xFE; + eui[5] = 0; + ieee802154_le16_to_be16([6], _dev->short_addr); + return 0; +} + static int lowpan_event(struct notifier_block *unused, unsigned long event, void *ptr) { struct net_device *dev = netdev_notifier_info_to_dev(ptr); + struct inet6_dev *idev; + struct in6_addr addr; int i; if (dev->type != ARPHRD_6LOWPAN) return NOTIFY_DONE; + idev = __in6_dev_get(dev); + if (!idev) + return NOTIFY_DONE; + switch (event) { + case NETDEV_UP: + case NETDEV_CHANGE: + /* (802.15.4 6LoWPAN short address slaac handling */ + if (lowpan_is_ll(dev, LOWPAN_LLTYPE_IEEE802154) && + addrconf_ifid_802154_6lowpan(addr.s6_addr + 8, dev) == 0) { I normally would like to get a define here instead of the magic number 8, but given how complex this if statement already is I think its fine to keep it. + __ipv6_addr_set_half(_addr32[0], +htonl(0xFE80), 0); + addrconf_add_linklocal(idev, , 0); + } + break; case NETDEV_DOWN: for (i = 0; i < LOWPAN_IPHC_CTX_TABLE_SIZE; i++) clear_bit(LOWPAN_IPHC_CTX_FLAG_ACTIVE, diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 27aed1a..54e18c2 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -2948,8 +2948,8 @@ static void init_loopback(struct net_device *dev) } } -static void addrconf_add_linklocal(struct inet6_dev *idev, - const struct in6_addr *addr, u32 flags) +void addrconf_add_linklocal(struct inet6_dev *idev, + const struct in6_addr *addr, u32 flags) { struct inet6_ifaddr *ifp; u32 addr_flags = flags | IFA_F_PERMANENT; @@ -2968,6 +2968,7 @@ static void addrconf_add_linklocal(struct inet6_dev *idev, in6_ifa_put(ifp); } } +EXPORT_SYMBOL(addrconf_add_linklocal); static bool ipv6_reserved_interfaceid(struct in6_addr address) { Reviewed-by: Stefan Schmidt regards Stefan Schmidt
Re: [PATCHv2 bluetooth-next 01/10] 6lowpan: add private neighbour data
Hello. On 20/04/16 10:19, Alexander Aring wrote: This patch will introduce a 6lowpan neighbour private data. Like the interface private data we handle private data for generic 6lowpan and for link-layer specific 6lowpan. The current first use case if to save the short address for a 802.15.4 6lowpan neighbour. Cc: David S. MillerSigned-off-by: Alexander Aring --- include/linux/netdevice.h | 3 +-- include/net/6lowpan.h | 24 net/bluetooth/6lowpan.c | 2 ++ net/ieee802154/6lowpan/core.c | 12 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 166402a..0052c42 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1487,8 +1487,7 @@ enum netdev_priv_flags { *@perm_addr: Permanent hw address *@addr_assign_type: Hw address assignment type *@addr_len: Hardware address length - * @neigh_priv_len;Used in neigh_alloc(), - * initialized only in atm/clip.c + * @neigh_priv_len;Used in neigh_alloc() *@dev_id:Used to differentiate devices that share *the same link layer address *@dev_port: Used to differentiate devices that share diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h index da84cf9..61c6517 100644 --- a/include/net/6lowpan.h +++ b/include/net/6lowpan.h @@ -98,6 +98,9 @@ static inline bool lowpan_is_iphc(u8 dispatch) #define LOWPAN_PRIV_SIZE(llpriv_size) \ (sizeof(struct lowpan_dev) + llpriv_size) +#define LOWPAN_NEIGH_PRIV_SIZE(llneigh_priv_size) \ + (sizeof(struct lowpan_neigh) + llneigh_priv_size) + enum lowpan_lltypes { LOWPAN_LLTYPE_BTLE, LOWPAN_LLTYPE_IEEE802154, @@ -141,6 +144,27 @@ struct lowpan_dev { u8 priv[0] __aligned(sizeof(void *)); }; +struct lowpan_neigh { + /* 6LoWPAN neigh private data */ + /* must be last */ + u8 priv[0] __aligned(sizeof(void *)); +}; + +struct lowpan_802154_neigh { + __le16 short_addr; +}; + +static inline struct lowpan_neigh *lowpan_neigh(void *neigh_priv) +{ + return neigh_priv; +} + +static inline +struct lowpan_802154_neigh *lowpan_802154_neigh(void *neigh_priv) +{ + return (struct lowpan_802154_neigh *)lowpan_neigh(neigh_priv)->priv; +} + static inline struct lowpan_dev *lowpan_dev(const struct net_device *dev) { diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c index 38e82dd..b7c4efa 100644 --- a/net/bluetooth/6lowpan.c +++ b/net/bluetooth/6lowpan.c @@ -833,6 +833,8 @@ static int setup_netdev(struct l2cap_chan *chan, struct lowpan_btle_dev **dev) list_add_rcu(&(*dev)->list, _6lowpan_devices); spin_unlock(_lock); + netdev->neigh_priv_len = LOWPAN_NEIGH_PRIV_SIZE(0); + err = lowpan_register_netdev(netdev, LOWPAN_LLTYPE_BTLE); if (err < 0) { BT_INFO("register_netdev failed %d", err); diff --git a/net/ieee802154/6lowpan/core.c b/net/ieee802154/6lowpan/core.c index dd085db..3162632 100644 --- a/net/ieee802154/6lowpan/core.c +++ b/net/ieee802154/6lowpan/core.c @@ -92,11 +92,21 @@ static int lowpan_stop(struct net_device *dev) return 0; } +static int lowpan_neigh_construct(struct neighbour *n) +{ + struct lowpan_802154_neigh *neigh = lowpan_802154_neigh(neighbour_priv(n)); + + /* default no short_addr is available for a neighbour */ + neigh->short_addr = cpu_to_le16(IEEE802154_ADDR_SHORT_UNSPEC); + return 0; +} + static const struct net_device_ops lowpan_netdev_ops = { .ndo_init = lowpan_dev_init, .ndo_start_xmit = lowpan_xmit, .ndo_open = lowpan_open, .ndo_stop = lowpan_stop, + .ndo_neigh_construct= lowpan_neigh_construct, }; static void lowpan_setup(struct net_device *ldev) @@ -161,6 +171,8 @@ static int lowpan_newlink(struct net *src_net, struct net_device *ldev, wdev->needed_headroom; ldev->needed_tailroom = wdev->needed_tailroom; + ldev->neigh_priv_len = LOWPAN_NEIGH_PRIV_SIZE(sizeof(struct lowpan_802154_neigh)); + ret = lowpan_register_netdevice(ldev, LOWPAN_LLTYPE_IEEE802154); if (ret < 0) { dev_put(wdev); Reviewed-by: Stefan Schmidt regards Stefan Schmidt
Re: [PATCH v1 net] net/mlx4: Avoid wrong virtual mappings
On Tue, May 3, 2016, David Millerwrote: > From: Or Gerlitz >> The patch changes the driver to do single allocation for potentially >> very large HW WQE descriptor buffers such as those used by the RDMA >> (mlx5_ib) driver. > I know exactly what this patch does and how, but thanks for trying to > teach me what it does anyways. Dave, This was more of a thinking out loud, not trying to teach you anything. As I said, we're aiming for net-next, and as such the re-spin to address your comment on bool vs int will be targeted there. Or.
Re: [PATCH nf-next 5/9] netfilter: conntrack: small refactoring of conntrack seq_printf
On Thu, Apr 28, 2016 at 07:13:44PM +0200, Florian Westphal wrote: > The iteration process is lockless, so we test if the conntrack object is > eligible for printing (e.g. is AF_INET) after obtaining the reference > count. > > Once we put all conntracks into same hash table we might see more > entries that need to be skipped. > > So add a helper and first perform the test in a lockless fashion > for fast skip. > > Once we obtain the reference count, just repeat the check. > > Signed-off-by: Florian Westphal> --- > .../netfilter/nf_conntrack_l3proto_ipv4_compat.c | 24 > +- > 1 file changed, 19 insertions(+), 5 deletions(-) > > diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c > b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c > index f0dfe92..483cf79 100644 > --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c > +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c > @@ -114,6 +114,19 @@ static inline void ct_show_secctx(struct seq_file *s, > const struct nf_conn *ct) > } > #endif > > +static bool ct_seq_should_skip(const struct nf_conn *ct, > +const struct nf_conntrack_tuple_hash *hash) > +{ > + /* we only want to print DIR_ORIGINAL */ > + if (NF_CT_DIRECTION(hash)) > + return true; > + > + if (nf_ct_l3num(ct) != AF_INET) > + return true; > + > + return false; > +} > + > static int ct_seq_show(struct seq_file *s, void *v) > { > struct nf_conntrack_tuple_hash *hash = v; > @@ -123,14 +136,15 @@ static int ct_seq_show(struct seq_file *s, void *v) > int ret = 0; > > NF_CT_ASSERT(ct); > - if (unlikely(!atomic_inc_not_zero(>ct_general.use))) > + if (ct_seq_should_skip(ct, hash)) > return 0; > > + if (unlikely(!atomic_inc_not_zero(>ct_general.use))) > + return 0; > > - /* we only want to print DIR_ORIGINAL */ > - if (NF_CT_DIRECTION(hash)) > - goto release; > - if (nf_ct_l3num(ct) != AF_INET) > + /* check if we raced w. object reuse */ > + if (!nf_ct_is_confirmed(ct) || This refactoring includes this new check, is this intentional? > + ct_seq_should_skip(ct, hash)) > goto release; > > l3proto = __nf_ct_l3proto_find(nf_ct_l3num(ct)); > -- > 2.7.3 >
Re: [PATCH nf-next 3/9] netfilter: conntrack: don't attempt to iterate over empty table
Pablo Neira Ayusowrote: > > I was thinking of the cleanup we do in the netns exit path > > (in nf_conntrack_cleanup_net_list() ). > > Right, but in that path we still have entries in the table. Not necessarily, they might have already been removed (timeout, close). > > If you don't like this I can move the check here: > > > > i_see_dead_people: > > busy = 0; > > list_for_each_entry(net, net_exit_list, exit_list) { > > // here > > if (atomic_read .. > 0) > >nf_ct_iterate_cleanup(net, kill_all, ... > > I don't mind about placing this or there, as I said, my question is > how often we will hit this optimization in a real scenario. > > If you think the answer is often, then this will help. I think the extra atomic_read in this code does no harm and saves us the entire scan. Also, in the exit path, when we hit the 'i_see_dead_people' label we restart the entire loop, so if we have 200 netns on the list and the last one caused that restart, we re-iterate needlesly for 199 netns... > Otherwise, every time we'll go container destruction path, we'll hit > slow path, ie. scanning the full table. Yes, but I see no other choice.
Re: [PATCH nf-next 3/9] netfilter: conntrack: don't attempt to iterate over empty table
On Tue, May 03, 2016 at 07:17:44PM +0200, Florian Westphal wrote: > Pablo Neira Ayusowrote: > > On Thu, Apr 28, 2016 at 07:13:42PM +0200, Florian Westphal wrote: > > > Once we place all conntracks into same table iteration becomes more > > > costly because the table contains conntracks that we are not interested > > > in (belonging to other netns). > > > > > > So don't bother scanning if the current namespace has no entries. > > > > > > Signed-off-by: Florian Westphal > > > --- > > > net/netfilter/nf_conntrack_core.c | 3 +++ > > > 1 file changed, 3 insertions(+) > > > > > > diff --git a/net/netfilter/nf_conntrack_core.c > > > b/net/netfilter/nf_conntrack_core.c > > > index 29fa08b..f2e75a5 100644 > > > --- a/net/netfilter/nf_conntrack_core.c > > > +++ b/net/netfilter/nf_conntrack_core.c > > > @@ -1428,6 +1428,9 @@ void nf_ct_iterate_cleanup(struct net *net, > > > > > > might_sleep(); > > > > > > + if (atomic_read(>ct.count) == 0) > > > + return; > > > > This optimization gets defeated with just one single conntrack (ie. > > net->ct.count == 1), so I wonder if this is practical thing. > > I was thinking of the cleanup we do in the netns exit path > (in nf_conntrack_cleanup_net_list() ). Right, but in that path we still have entries in the table. > If you don't like this I can move the check here: > > i_see_dead_people: > busy = 0; > list_for_each_entry(net, net_exit_list, exit_list) { > // here > if (atomic_read .. > 0) >nf_ct_iterate_cleanup(net, kill_all, ... I don't mind about placing this or there, as I said, my question is how often we will hit this optimization in a real scenario. If you think the answer is often, then this will help. Otherwise, every time we'll go container destruction path, we'll hit slow path, ie. scanning the full table. > > At the cost of consuming more memory per conntrack, we may consider > > adding a per-net list so this iteration doesn't become a problem. > > I don't think that will be needed. We don't have any such iterations > in the fast path. > > For dumps via ctnetlink it shouldn't be a big deal either, if needed > we can optimize that to use rcu readlocks only and 'upgrade' to locked > path only when we want to dump the candidate ct. > for deferred pruning). > early_drop will go away soon (i'll rework it to do the early_drop from > work queue). OK.
[PATCH v2 net-next] dmfe: kill DEVICE define
use net_device directly. Compile tested, objdiff shows no changes. Signed-off-by: Florian Westphal--- resending this separately as it's not related to the rest of the dev->trans_start removal series. drivers/net/ethernet/dec/tulip/dmfe.c | 39 --- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/drivers/net/ethernet/dec/tulip/dmfe.c b/drivers/net/ethernet/dec/tulip/dmfe.c index afd8e78..42c759e 100644 --- a/drivers/net/ethernet/dec/tulip/dmfe.c +++ b/drivers/net/ethernet/dec/tulip/dmfe.c @@ -192,9 +192,6 @@ (__CHK_IO_SIZE(((pci_dev)->device << 16) | (pci_dev)->vendor, \ (pci_dev)->revision)) -/* Sten Check */ -#define DEVICE net_device - /* Structure/enum declaration --- */ struct tx_desc { __le32 tdes0, tdes1, tdes2, tdes3; /* Data for the card */ @@ -313,10 +310,10 @@ static u8 SF_mode;/* Special Function: 1:VLAN, 2:RX Flow Control /* function declaration - */ -static int dmfe_open(struct DEVICE *); -static netdev_tx_t dmfe_start_xmit(struct sk_buff *, struct DEVICE *); -static int dmfe_stop(struct DEVICE *); -static void dmfe_set_filter_mode(struct DEVICE *); +static int dmfe_open(struct net_device *); +static netdev_tx_t dmfe_start_xmit(struct sk_buff *, struct net_device *); +static int dmfe_stop(struct net_device *); +static void dmfe_set_filter_mode(struct net_device *); static const struct ethtool_ops netdev_ethtool_ops; static u16 read_srom_word(void __iomem *, int); static irqreturn_t dmfe_interrupt(int , void *); @@ -326,8 +323,8 @@ static void poll_dmfe (struct net_device *dev); static void dmfe_descriptor_init(struct net_device *); static void allocate_rx_buffer(struct net_device *); static void update_cr6(u32, void __iomem *); -static void send_filter_frame(struct DEVICE *); -static void dm9132_id_table(struct DEVICE *); +static void send_filter_frame(struct net_device *); +static void dm9132_id_table(struct net_device *); static u16 dmfe_phy_read(void __iomem *, u8, u8, u32); static void dmfe_phy_write(void __iomem *, u8, u8, u16, u32); static void dmfe_phy_write_1bit(void __iomem *, u32); @@ -336,12 +333,12 @@ static u8 dmfe_sense_speed(struct dmfe_board_info *); static void dmfe_process_mode(struct dmfe_board_info *); static void dmfe_timer(unsigned long); static inline u32 cal_CRC(unsigned char *, unsigned int, u8); -static void dmfe_rx_packet(struct DEVICE *, struct dmfe_board_info *); -static void dmfe_free_tx_pkt(struct DEVICE *, struct dmfe_board_info *); +static void dmfe_rx_packet(struct net_device *, struct dmfe_board_info *); +static void dmfe_free_tx_pkt(struct net_device *, struct dmfe_board_info *); static void dmfe_reuse_skb(struct dmfe_board_info *, struct sk_buff *); -static void dmfe_dynamic_reset(struct DEVICE *); +static void dmfe_dynamic_reset(struct net_device *); static void dmfe_free_rxbuffer(struct dmfe_board_info *); -static void dmfe_init_dm910x(struct DEVICE *); +static void dmfe_init_dm910x(struct net_device *); static void dmfe_parse_srom(struct dmfe_board_info *); static void dmfe_program_DM9801(struct dmfe_board_info *, int); static void dmfe_program_DM9802(struct dmfe_board_info *); @@ -558,7 +555,7 @@ static void dmfe_remove_one(struct pci_dev *pdev) * The interface is opened whenever "ifconfig" actives it. */ -static int dmfe_open(struct DEVICE *dev) +static int dmfe_open(struct net_device *dev) { struct dmfe_board_info *db = netdev_priv(dev); const int irq = db->pdev->irq; @@ -617,7 +614,7 @@ static int dmfe_open(struct DEVICE *dev) * Enable Tx/Rx machine */ -static void dmfe_init_dm910x(struct DEVICE *dev) +static void dmfe_init_dm910x(struct net_device *dev) { struct dmfe_board_info *db = netdev_priv(dev); void __iomem *ioaddr = db->ioaddr; @@ -684,7 +681,7 @@ static void dmfe_init_dm910x(struct DEVICE *dev) */ static netdev_tx_t dmfe_start_xmit(struct sk_buff *skb, -struct DEVICE *dev) +struct net_device *dev) { struct dmfe_board_info *db = netdev_priv(dev); void __iomem *ioaddr = db->ioaddr; @@ -754,7 +751,7 @@ static netdev_tx_t dmfe_start_xmit(struct sk_buff *skb, * The interface is stopped when it is brought. */ -static int dmfe_stop(struct DEVICE *dev) +static int dmfe_stop(struct net_device *dev) { struct dmfe_board_info *db = netdev_priv(dev); void __iomem *ioaddr = db->ioaddr; @@ -798,7 +795,7 @@ static int dmfe_stop(struct DEVICE *dev) static irqreturn_t dmfe_interrupt(int irq, void *dev_id) { - struct DEVICE *dev = dev_id; + struct net_device *dev = dev_id; struct dmfe_board_info *db = netdev_priv(dev); void __iomem *ioaddr = db->ioaddr; unsigned long flags; @@ -879,7 +876,7 @@ static void poll_dmfe (struct net_device *dev)
Re: [PATCH net 0/4] Mellanox 100G mlx5 fixes for 4.6-rc
From: Saeed MahameedDate: Sun, 1 May 2016 22:59:53 +0300 > This small series provides some bug fixes for mlx5 driver. > > A small bug fix for iounmap of a null pointer, which dumps a warning on some > archs. > > One patch to fix the VXLAN/MLX5_EN dependency issue reported by Arnd. > > Two patches to fix the scheduling while atomic issue for > ndo_add/del_vxlan_port > NDOs. The first will add an internal mlx5e workqueue and the second will > delegate vxlan ports add/del requests to that workqueue. > > Note: ('net/mlx5: Kconfig: Fix MLX5_EN/VXLAN build issue') is only needed for > net > and not net-next as the issue was globally fixed for all device drivers by: > b7aade15485a ('vxlan: break dependency with netdev drivers') in net-next. > > Applied on top: f27337e16f2d ('ip_tunnel: fix preempt warning in ip tunnel > creation/updating') Series applied, thanks.
Re: [PATCH nf-next 3/9] netfilter: conntrack: don't attempt to iterate over empty table
Pablo Neira Ayusowrote: > On Thu, Apr 28, 2016 at 07:13:42PM +0200, Florian Westphal wrote: > > Once we place all conntracks into same table iteration becomes more > > costly because the table contains conntracks that we are not interested > > in (belonging to other netns). > > > > So don't bother scanning if the current namespace has no entries. > > > > Signed-off-by: Florian Westphal > > --- > > net/netfilter/nf_conntrack_core.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/net/netfilter/nf_conntrack_core.c > > b/net/netfilter/nf_conntrack_core.c > > index 29fa08b..f2e75a5 100644 > > --- a/net/netfilter/nf_conntrack_core.c > > +++ b/net/netfilter/nf_conntrack_core.c > > @@ -1428,6 +1428,9 @@ void nf_ct_iterate_cleanup(struct net *net, > > > > might_sleep(); > > > > + if (atomic_read(>ct.count) == 0) > > + return; > > This optimization gets defeated with just one single conntrack (ie. > net->ct.count == 1), so I wonder if this is practical thing. I was thinking of the cleanup we do in the netns exit path (in nf_conntrack_cleanup_net_list() ). If you don't like this I can move the check here: i_see_dead_people: busy = 0; list_for_each_entry(net, net_exit_list, exit_list) { // here if (atomic_read .. > 0) nf_ct_iterate_cleanup(net, kill_all, ... > At the cost of consuming more memory per conntrack, we may consider > adding a per-net list so this iteration doesn't become a problem. I don't think that will be needed. We don't have any such iterations in the fast path. For dumps via ctnetlink it shouldn't be a big deal either, if needed we can optimize that to use rcu readlocks only and 'upgrade' to locked path only when we want to dump the candidate ct. for deferred pruning). early_drop will go away soon (i'll rework it to do the early_drop from work queue).
Re: [PATCH] drivers: net: xgene: constify xgene_cle_ops structure
From: Julia LawallDate: Sun, 1 May 2016 14:36:28 +0200 > The xgene_cle_ops structure is never modified, so declare it as const. > > Done with the help of Coccinelle. > > Signed-off-by: Julia Lawall Applied.
Re: [PATCH nf-next 3/9] netfilter: conntrack: don't attempt to iterate over empty table
On Thu, Apr 28, 2016 at 07:13:42PM +0200, Florian Westphal wrote: > Once we place all conntracks into same table iteration becomes more > costly because the table contains conntracks that we are not interested > in (belonging to other netns). > > So don't bother scanning if the current namespace has no entries. > > Signed-off-by: Florian Westphal> --- > net/netfilter/nf_conntrack_core.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/net/netfilter/nf_conntrack_core.c > b/net/netfilter/nf_conntrack_core.c > index 29fa08b..f2e75a5 100644 > --- a/net/netfilter/nf_conntrack_core.c > +++ b/net/netfilter/nf_conntrack_core.c > @@ -1428,6 +1428,9 @@ void nf_ct_iterate_cleanup(struct net *net, > > might_sleep(); > > + if (atomic_read(>ct.count) == 0) > + return; This optimization gets defeated with just one single conntrack (ie. net->ct.count == 1), so I wonder if this is practical thing. At the cost of consuming more memory per conntrack, we may consider adding a per-net list so this iteration doesn't become a problem. > while ((ct = get_next_corpse(net, iter, data, )) != NULL) { > /* Time to push up daises... */ > if (del_timer(>timeout)) > -- > 2.7.3 > > -- > To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/4] net: ethernet: ucc: move to new ethtool api {get|set}_link_ksettings
From: Philippe ReynesDate: Sun, 1 May 2016 17:08:09 +0200 > The ethtool api {get|set}_settings is deprecated. > We move the ucc driver to new api {get|set}_link_ksettings. > > Signed-off-by: Philippe Reynes Applied.
Re: [PATCH 1/4] net: ethernet: gianfar: move to new ethtool api {get|set}_link_ksettings
From: Philippe ReynesDate: Sun, 1 May 2016 17:08:08 +0200 > The ethtool api {get|set}_settings is deprecated. > We move the gianfar driver to new api {get|set}_link_ksettings. > > Signed-off-by: Philippe Reynes Applied.
Re: [PATCH 4/4] net: ethernet: fec_mpc52xx: move to new ethtool api {get|set}_link_ksettings
From: Philippe ReynesDate: Sun, 1 May 2016 17:08:11 +0200 > The ethtool api {get|set}_settings is deprecated. > We move the fec_mpc52xx driver to new api {get|set}_link_ksettings. > > Signed-off-by: Philippe Reynes Applied.
Re: [PATCH RFT 1/2] phylib: add device reset GPIO support
On Fri, Apr 29, 2016 at 01:12:54AM +0300, Sergei Shtylyov wrote: > The PHY devices sometimes do have their reset signal (maybe even power > supply?) tied to some GPIO and sometimes it also does happen that a boot > loader does not leave it deasserted. So far this issue has been attacked > from (as I believe) a wrong angle: by teaching the MAC driver to manipulate > the GPIO in question; that solution, when applied to the device trees, led > to adding the PHY reset GPIO properties to the MAC device node, with one > exception: Cadence MACB driver which could handle the "reset-gpios" prop > in a PHY device subnode. I believe that the correct approach is to teach > the 'phylib' to get the MDIO device reset GPIO from the device tree node > corresponding to this device -- which this patch is doing... > > Note that I had to modify the AT803x PHY driver as it would stop working > otherwise as it made use of the reset GPIO for its own purposes... > > Signed-off-by: Sergei Shtylyov> > --- > Changes in version 2: > - reformatted the changelog; > - resolved rejects, refreshed the patch. > > Documentation/devicetree/bindings/net/phy.txt |2 + > Documentation/devicetree/bindings/net/phy.txt |2 + Acked-by: Rob Herring > drivers/net/phy/at803x.c | 19 ++ > drivers/net/phy/mdio_bus.c|4 +++ > drivers/net/phy/mdio_device.c | 27 +++-- > drivers/net/phy/phy_device.c | 33 > -- > drivers/of/of_mdio.c | 16 > include/linux/mdio.h |3 ++ > include/linux/phy.h |5 +++ > 8 files changed, 89 insertions(+), 20 deletions(-) > > Index: net-next/Documentation/devicetree/bindings/net/phy.txt > === > --- net-next.orig/Documentation/devicetree/bindings/net/phy.txt > +++ net-next/Documentation/devicetree/bindings/net/phy.txt > @@ -35,6 +35,8 @@ Optional Properties: > - broken-turn-around: If set, indicates the PHY device does not correctly >release the turn around line low at the end of a MDIO transaction. > > +- reset-gpios: The GPIO phandle and specifier for the PHY reset signal. > + > Example: > > ethernet-phy@0 { > Index: net-next/drivers/net/phy/at803x.c > === > --- net-next.orig/drivers/net/phy/at803x.c > +++ net-next/drivers/net/phy/at803x.c > @@ -65,7 +65,6 @@ MODULE_LICENSE("GPL"); > > struct at803x_priv { > bool phy_reset:1; > - struct gpio_desc *gpiod_reset; > }; > > struct at803x_context { > @@ -271,22 +270,10 @@ static int at803x_probe(struct phy_devic > { > struct device *dev = >mdio.dev; > struct at803x_priv *priv; > - struct gpio_desc *gpiod_reset; > > priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); > if (!priv) > return -ENOMEM; > - > - if (phydev->drv->phy_id != ATH8030_PHY_ID) > - goto does_not_require_reset_workaround; > - > - gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); > - if (IS_ERR(gpiod_reset)) > - return PTR_ERR(gpiod_reset); > - > - priv->gpiod_reset = gpiod_reset; > - > -does_not_require_reset_workaround: > phydev->priv = priv; > > return 0; > @@ -361,14 +348,14 @@ static void at803x_link_change_notify(st >*/ > if (phydev->drv->phy_id == ATH8030_PHY_ID) { > if (phydev->state == PHY_NOLINK) { > - if (priv->gpiod_reset && !priv->phy_reset) { > + if (phydev->mdio.reset && !priv->phy_reset) { > struct at803x_context context; > > at803x_context_save(phydev, ); > > - gpiod_set_value(priv->gpiod_reset, 1); > + phy_device_reset(phydev, 1); > msleep(1); > - gpiod_set_value(priv->gpiod_reset, 0); > + phy_device_reset(phydev, 0); > msleep(1); > > at803x_context_restore(phydev, ); > Index: net-next/drivers/net/phy/mdio_bus.c > === > --- net-next.orig/drivers/net/phy/mdio_bus.c > +++ net-next/drivers/net/phy/mdio_bus.c > @@ -35,6 +35,7 @@ > #include > #include > #include > +#include > > #include > > @@ -371,6 +372,9 @@ void mdiobus_unregister(struct mii_bus * > if (!mdiodev) > continue; > > + if (mdiodev->reset) > + gpiod_put(mdiodev->reset); > + > mdiodev->device_remove(mdiodev); > mdiodev->device_free(mdiodev); > } > Index: