Re: [PATCH net] multicast: remove useless parameter for group add
From: Hangbin Liu Date: Fri, 20 Jul 2018 14:07:42 +0800 > Remove the mode parameter for igmp/igmp6_group_added as we can get it > from first parameter. > > Fixes: 6e2059b53f988 (ipv4/igmp: init group mode as INCLUDE when join source > group) > Fixes: c7ea20c9da5b9 (ipv6/mcast: init as INCLUDE when join SSM INCLUDE group) > Signed-off-by: Hangbin Liu This doesn't really fix a bug, it just removed an unnecessary parameter. Therefore, applied to net-next. Thanks.
Re: [PATCH] net: dsa: mv88e6xxx: fix races between lock and irq freeing
From: Uwe Kleine-König Date: Fri, 20 Jul 2018 11:53:15 +0200 > free_irq() waits until all handlers for this IRQ have completed. As the > relevant handler (mv88e6xxx_g1_irq_thread_fn()) takes the chip's reg_lock > it might never return if the thread calling free_irq() holds this lock. > > For the same reason kthread_cancel_delayed_work_sync() in the polling case > must not hold this lock. > > Also first free the irq (or stop the worker respectively) such that > mv88e6xxx_g1_irq_thread_work() isn't called any more before the irq > mappings are dropped in mv88e6xxx_g1_irq_free_common() to prevent the > worker thread to call handle_nested_irq(0) which results in a NULL-pointer > exception. > > Signed-off-by: Uwe Kleine-König Looks good. Note than the IRQ domain unmapping will do a synchronize_irq() which should cause the same deadlock as free_irq() will with the reg_lock held. Note also that g2 IRQ freeing gets the ordering right, and doesn't need a lock because it doesn't program any registers when tearing down it's IRQ. Applied and queued up for -stable, thanks.
[PATCH net] ipv6: use fib6_info_hold_safe() when necessary
From: Wei Wang In the code path where only rcu read lock is held, e.g. in the route lookup code path, it is not safe to directly call fib6_info_hold() because the fib6_info may already have been deleted but still exists in the rcu grace period. Holding reference to it could cause double free and crash the kernel. This patch adds a new function fib6_info_hold_safe() and replace fib6_info_hold() in all necessary places. Syzbot reported 3 crash traces because of this. One of them is: 8021q: adding VLAN 0 to HW filter on device team0 IPv6: ADDRCONF(NETDEV_CHANGE): team0: link becomes ready dst_release: dst:(ptrval) refcnt:-1 dst_release: dst:(ptrval) refcnt:-2 WARNING: CPU: 1 PID: 4845 at include/net/dst.h:239 dst_hold include/net/dst.h:239 [inline] WARNING: CPU: 1 PID: 4845 at include/net/dst.h:239 ip6_setup_cork+0xd66/0x1830 net/ipv6/ip6_output.c:1204 dst_release: dst:(ptrval) refcnt:-1 Kernel panic - not syncing: panic_on_warn set ... CPU: 1 PID: 4845 Comm: syz-executor493 Not tainted 4.18.0-rc3+ #10 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1c9/0x2b4 lib/dump_stack.c:113 panic+0x238/0x4e7 kernel/panic.c:184 dst_release: dst:(ptrval) refcnt:-2 dst_release: dst:(ptrval) refcnt:-3 __warn.cold.8+0x163/0x1ba kernel/panic.c:536 dst_release: dst:(ptrval) refcnt:-4 report_bug+0x252/0x2d0 lib/bug.c:186 fixup_bug arch/x86/kernel/traps.c:178 [inline] do_error_trap+0x1fc/0x4d0 arch/x86/kernel/traps.c:296 dst_release: dst:(ptrval) refcnt:-5 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:316 invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:992 RIP: 0010:dst_hold include/net/dst.h:239 [inline] RIP: 0010:ip6_setup_cork+0xd66/0x1830 net/ipv6/ip6_output.c:1204 Code: c1 ed 03 89 9d 18 ff ff ff 48 b8 00 00 00 00 00 fc ff df 41 c6 44 05 00 f8 e9 2d 01 00 00 4c 8b a5 c8 fe ff ff e8 1a f6 e6 fa <0f> 0b e9 6a fc ff ff e8 0e f6 e6 fa 48 8b 85 d0 fe ff ff 48 8d 78 RSP: 0018:8801a8fcf178 EFLAGS: 00010293 RAX: 8801a8eba5c0 RBX: RCX: 869511e6 RDX: RSI: 869515b6 RDI: 0005 RBP: 8801a8fcf2c8 R08: 8801a8eba5c0 R09: ed0035ac8338 R10: ed0035ac8338 R11: 8801ad6419c3 R12: 8801a8fcf720 R13: 8801a8fcf6a0 R14: 8801ad6419c0 R15: 8801ad641980 ip6_make_skb+0x2c8/0x600 net/ipv6/ip6_output.c:1768 udpv6_sendmsg+0x2c90/0x35f0 net/ipv6/udp.c:1376 inet_sendmsg+0x1a1/0x690 net/ipv4/af_inet.c:798 sock_sendmsg_nosec net/socket.c:641 [inline] sock_sendmsg+0xd5/0x120 net/socket.c:651 ___sys_sendmsg+0x51d/0x930 net/socket.c:2125 __sys_sendmmsg+0x240/0x6f0 net/socket.c:2220 __do_sys_sendmmsg net/socket.c:2249 [inline] __se_sys_sendmmsg net/socket.c:2246 [inline] __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2246 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x446ba9 Code: e8 cc bb 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 eb 08 fc ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:7fb39a469da8 EFLAGS: 0246 ORIG_RAX: 0133 RAX: ffda RBX: 006dcc54 RCX: 00446ba9 RDX: 00b8 RSI: 20001b00 RDI: 0003 RBP: 006dcc50 R08: 7fb39a46a700 R09: R10: R11: 0246 R12: 45c828efc7a64843 R13: e6eeb815b9d8a477 R14: 5068caf6f713c6fc R15: 0001 Dumping ftrace buffer: (ftrace buffer empty) Kernel Offset: disabled Rebooting in 86400 seconds.. Fixes: 93531c674315 (net/ipv6: separate handling of FIB entries from dst based routes) Reported-by: syzbot+902e2a1bcd4f7808c...@syzkaller.appspotmail.com Reported-by: syzbot+8ae62d67f647abeec...@syzkaller.appspotmail.com Reported-by: syzbot+3f08feb1408693067...@syzkaller.appspotmail.com Signed-off-by: Wei Wang Acked-by: Eric Dumazet --- include/net/ip6_fib.h | 5 + net/ipv6/addrconf.c | 3 ++- net/ipv6/route.c | 41 +++-- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 71b9043aa0e7..3d4930528db0 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h @@ -281,6 +281,11 @@ static inline void fib6_info_hold(struct fib6_info *f6i) atomic_inc(>fib6_ref); } +static inline bool fib6_info_hold_safe(struct fib6_info *f6i) +{ + return atomic_inc_not_zero(>fib6_ref); +} + static inline void fib6_info_release(struct fib6_info *f6i) { if (f6i && atomic_dec_and_test(>fib6_ref)) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 91580c62bb86..f66a1cae3366 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -2374,7 +2374,8 @@ static struct fib6_info *addrconf_get_prefix_route(const struct
Re: [PATCH 4/4] net: dsa: Add Lantiq / Intel DSA driver for vrx200
From: Hauke Mehrtens Date: Sat, 21 Jul 2018 21:13:58 +0200 > + // start the table access: Please stick to C-style comments, except perhaps in the SPDX identifiers. Thank you.
Re: [PATCH net] net: skb_segment() should not return NULL
From: Eric Dumazet Date: Thu, 19 Jul 2018 16:04:38 -0700 > syzbot caught a NULL deref [1], caused by skb_segment() > > skb_segment() has many "goto err;" that assume the @err variable > contains -ENOMEM. > > A successful call to __skb_linearize() should not clear @err, > otherwise a subsequent memory allocation error could return NULL. Ugh, good catch. > While we are at it, we might use -EINVAL instead of -ENOMEM when > MAX_SKB_FRAGS limit is reached. ... > Fixes: ddff00d42043 ("net: Move skb_has_shared_frag check out of GRE code and > into segmentation") > Signed-off-by: Eric Dumazet > Cc: Alexander Duyck > Reported-by: syzbot Applied and queued up for -stable.
Re: [PATCH net] net/ipv6: Fix linklocal to global address with VRF
From: dsah...@kernel.org Date: Thu, 19 Jul 2018 12:41:18 -0700 > From: David Ahern > > Example setup: > host: ip -6 addr add dev eth1 2001:db8:104::4 >where eth1 is enslaved to a VRF > > switch: ip -6 ro add 2001:db8:104::4/128 dev br1 > where br1 only has an LLA > >ping6 2001:db8:104::4 >ssh 2001:db8:104::4 > > (NOTE: UDP works fine if the PKTINFO has the address set to the global > address and ifindex is set to the index of eth1 with a destination an > LLA). > > For ICMP, icmp6_iif needs to be updated to check if skb->dev is an > L3 master. If it is then return the ifindex from rt6i_idev similar > to what is done for loopback. > > For TCP, restore the original tcp_v6_iif definition which is needed in > most places and add a new tcp_v6_iif_l3_slave that considers the > l3_slave variability. This latter check is only needed for socket > lookups. > > Fixes: 9ff74384600a ("net: vrf: Handle ipv6 multicast and link-local > addresses") > Signed-off-by: David Ahern Applied and queued up for -stable. > Dave: I can look at the backports to stable if needed. Please do, that will help me a lot.
Re: [net-next v5 3/3] net/tls: Remove redundant array allocation.
From: Vakul Garg Date: Thu, 19 Jul 2018 21:56:13 +0530 > In function decrypt_skb(), array allocation in case when sgout is NULL > is unnecessary. Instead, local variable sgin_arr[] can be used. > > Signed-off-by: Vakul Garg Hmmm... Dave, can you take a look at this? Do you think there might have been a reason you felt that you needed to dynamically allocate the scatterlists when you COW and skb and do in-place decryption? I guess this change is ok, nsg can only get smaller when the SKB is COW'd.
Re: [PATCH net-next 4/4] act_mirred: use ACT_MIRRED when possible
From: Paolo Abeni Date: Thu, 19 Jul 2018 15:02:29 +0200 > kernel openswitch datapath. ^^ "openvswitch"
Re: [PATCH net] net: phy: consider PHY_IGNORE_INTERRUPT in phy_start_aneg_priv
From: Heiner Kallweit Date: Thu, 19 Jul 2018 08:15:16 +0200 > The situation described in the comment can occur also with > PHY_IGNORE_INTERRUPT, therefore change the condition to include it. > > Signed-off-by: Heiner Kallweit Applied and queued up for -stable, thanks.
Re: [PATCH net 0/3] qed: Fix series II.
From: Sudarsana Reddy Kalluru Date: Wed, 18 Jul 2018 22:50:01 -0700 > The patch series fixes few issues in the qed driver. > > Please consider applying it to 'net' branch. Series applied, thanks.
Re: [PATCH 3/4] net: lantiq: Add Lantiq / Intel vrx200 Ethernet driver
On 07/21/2018 10:25 PM, John Crispin wrote: > > > On 21/07/18 21:13, Hauke Mehrtens wrote: >> + * Copyright (C) 2012 John Crispin > that is not my mail addr :-) > John Thanks for the information, I fixed your mail address. Hauke
Re: [PATCH 3/4] net: lantiq: Add Lantiq / Intel vrx200 Ethernet driver
On 21/07/18 21:13, Hauke Mehrtens wrote: + * Copyright (C) 2012 John Crispin that is not my mail addr :-) John
[PATCH 4/4] net: dsa: Add Lantiq / Intel DSA driver for vrx200
This adds the DSA driver for the GSWIP Switch found in the VRX200 SoC. This switch is integrated in the DSL SoC, this SoC uses a GSWIP version 2.0, there are other SoCs using different versions of this IP block, but this driver was only tested with the version found in the VRX200. Currently only the basic features are implemented which will forward all packages to the CPU and let the CPU do the forwarding. The hardware also support Layer 2 offloading which is not yet implemented in this driver. Signed-off-by: Hauke Mehrtens --- MAINTAINERS| 1 + drivers/net/dsa/Kconfig| 8 + drivers/net/dsa/Makefile | 1 + drivers/net/dsa/lantiq-gswip.c | 750 + drivers/net/dsa/lantiq_pce.h | 153 + 5 files changed, 913 insertions(+) create mode 100644 drivers/net/dsa/lantiq-gswip.c create mode 100644 drivers/net/dsa/lantiq_pce.h diff --git a/MAINTAINERS b/MAINTAINERS index cc0607a58c51..761446ff9dd7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8016,6 +8016,7 @@ S:Maintained F: net/dsa/tag_gswip.c F: drivers/net/ethernet/lantiq_xrx200.c F: drivers/net/dsa/lantiq_pce.h +F: drivers/net/dsa/intel-gswip.c LANTIQ MIPS ARCHITECTURE M: John Crispin diff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig index 2b81b97e994f..f1280aa3f9bd 100644 --- a/drivers/net/dsa/Kconfig +++ b/drivers/net/dsa/Kconfig @@ -23,6 +23,14 @@ config NET_DSA_LOOP This enables support for a fake mock-up switch chip which exercises the DSA APIs. +config NET_DSA_GSWIP + tristate "Intel / Lantiq GSWIP" + depends on NET_DSA + select NET_DSA_TAG_GSWIP + ---help--- + This enables support for the Intel / Lantiq GSWIP 2.0 found in + the xrx200 / VR9 SoC. + config NET_DSA_MT7530 tristate "Mediatek MT7530 Ethernet switch support" depends on NET_DSA diff --git a/drivers/net/dsa/Makefile b/drivers/net/dsa/Makefile index 15c2a831edf1..11143d860a95 100644 --- a/drivers/net/dsa/Makefile +++ b/drivers/net/dsa/Makefile @@ -5,6 +5,7 @@ obj-$(CONFIG_NET_DSA_LOOP) += dsa_loop.o ifdef CONFIG_NET_DSA_LOOP obj-$(CONFIG_FIXED_PHY)+= dsa_loop_bdinfo.o endif +obj-$(CONFIG_NET_DSA_GSWIP)+= lantiq-gswip.o obj-$(CONFIG_NET_DSA_MT7530) += mt7530.o obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o obj-$(CONFIG_NET_DSA_QCA8K)+= qca8k.o diff --git a/drivers/net/dsa/lantiq-gswip.c b/drivers/net/dsa/lantiq-gswip.c new file mode 100644 index ..b6e64ba7ff12 --- /dev/null +++ b/drivers/net/dsa/lantiq-gswip.c @@ -0,0 +1,750 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Lantiq / Intel GSWIP switch driver for VRX200 SoCs + * + * Copyright (C) 2010 Lantiq Deutschland + * Copyright (C) 2012 John Crispin + * Copyright (C) 2017 - 2018 Hauke Mehrtens + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "lantiq_pce.h" + + +/* GSWIP MDIO Registers */ +#define GSWIP_MDIO_GLOB0x00 +#define GSWIP_MDIO_GLOB_ENABLEBIT(15) +#define GSWIP_MDIO_CTRL0x08 +#define GSWIP_MDIO_CTRL_BUSY BIT(12) +#define GSWIP_MDIO_CTRL_RDBIT(11) +#define GSWIP_MDIO_CTRL_WRBIT(10) +#define GSWIP_MDIO_CTRL_PHYAD_MASK0x1f +#define GSWIP_MDIO_CTRL_PHYAD_SHIFT 5 +#define GSWIP_MDIO_CTRL_REGAD_MASK0x1f +#define GSWIP_MDIO_READ0x09 +#define GSWIP_MDIO_WRITE 0x0A +#define GSWIP_MDIO_MDC_CFG00x0B +#define GSWIP_MDIO_MDC_CFG10x0C +#define GSWIP_MDIO_PHYp(p) (0x15 - (p)) +#define GSWIP_MDIO_PHY_LINK_DOWN 0x4000 +#define GSWIP_MDIO_PHY_LINK_UP0x2000 +#define GSWIP_MDIO_PHY_SPEED_M10 0x +#define GSWIP_MDIO_PHY_SPEED_M100 0x0800 +#define GSWIP_MDIO_PHY_SPEED_G1 0x1000 +#define GSWIP_MDIO_PHY_FDUP_EN0x0200 +#define GSWIP_MDIO_PHY_FDUP_DIS 0x0600 +#define GSWIP_MDIO_PHY_FCONTX_EN 0x0100 +#define GSWIP_MDIO_PHY_FCONTX_DIS 0x0180 +#define GSWIP_MDIO_PHY_FCONRX_EN 0x0020 +#define GSWIP_MDIO_PHY_FCONRX_DIS 0x0060 +#define GSWIP_MDIO_PHY_LINK_MASK 0x6000 +#define GSWIP_MDIO_PHY_SPEED_MASK 0x1800 +#define GSWIP_MDIO_PHY_FDUP_MASK 0x0600 +#define GSWIP_MDIO_PHY_FCONTX_MASK0x0180 +#define GSWIP_MDIO_PHY_FCONRX_MASK0x0060 +#define GSWIP_MDIO_PHY_ADDR_MASK 0x001f +#define GSWIP_MDIO_PHY_MASK (GSWIP_MDIO_PHY_ADDR_MASK | \ +GSWIP_MDIO_PHY_FCONRX_MASK | \ +GSWIP_MDIO_PHY_FCONTX_MASK | \ +GSWIP_MDIO_PHY_LINK_MASK | \ +GSWIP_MDIO_PHY_SPEED_MASK | \ +GSWIP_MDIO_PHY_FDUP_MASK) + +/* GSWIP MII Registers */
[PATCH 3/4] net: lantiq: Add Lantiq / Intel vrx200 Ethernet driver
This drives the PMAC between the GSWIP Switch and the CPU in the VRX200 SoC. This is currently only the very basic version of the Ethernet driver. Signed-off-by: Hauke Mehrtens --- MAINTAINERS | 2 + arch/mips/lantiq/xway/sysctrl.c | 2 +- drivers/net/ethernet/Kconfig | 6 + drivers/net/ethernet/Makefile| 1 + drivers/net/ethernet/lantiq_xrx200.c | 609 +++ 5 files changed, 619 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/lantiq_xrx200.c diff --git a/MAINTAINERS b/MAINTAINERS index 741718ff9b79..cc0607a58c51 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8014,6 +8014,8 @@ M:Hauke Mehrtens L: netdev@vger.kernel.org S: Maintained F: net/dsa/tag_gswip.c +F: drivers/net/ethernet/lantiq_xrx200.c +F: drivers/net/dsa/lantiq_pce.h LANTIQ MIPS ARCHITECTURE M: John Crispin diff --git a/arch/mips/lantiq/xway/sysctrl.c b/arch/mips/lantiq/xway/sysctrl.c index e0af39b33e28..c704312ef7d5 100644 --- a/arch/mips/lantiq/xway/sysctrl.c +++ b/arch/mips/lantiq/xway/sysctrl.c @@ -536,7 +536,7 @@ void __init ltq_soc_init(void) clkdev_add_pmu(NULL, "ahb", 1, 0, PMU_AHBM | PMU_AHBS); clkdev_add_pmu("1da0.usif", "NULL", 1, 0, PMU_USIF); - clkdev_add_pmu("1e108000.eth", NULL, 0, 0, + clkdev_add_pmu("1e10b308.eth", NULL, 0, 0, PMU_SWITCH | PMU_PPE_DPLUS | PMU_PPE_DPLUM | PMU_PPE_EMA | PMU_PPE_TC | PMU_PPE_SLL01 | PMU_PPE_QSB | PMU_PPE_TOP); diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig index af766fd61151..1767f2ee1795 100644 --- a/drivers/net/ethernet/Kconfig +++ b/drivers/net/ethernet/Kconfig @@ -109,6 +109,12 @@ config LANTIQ_ETOP ---help--- Support for the MII0 inside the Lantiq SoC +config LANTIQ_XRX200 + tristate "Lantiq SoC XRX200 driver" + depends on SOC_TYPE_XWAY + ---help--- + Support for the PMAC of the GSWIP inside the Lantiq VRX200 VDSL SoC + source "drivers/net/ethernet/marvell/Kconfig" source "drivers/net/ethernet/mediatek/Kconfig" source "drivers/net/ethernet/mellanox/Kconfig" diff --git a/drivers/net/ethernet/Makefile b/drivers/net/ethernet/Makefile index 8fbfe9ce2fa5..839322f353ca 100644 --- a/drivers/net/ethernet/Makefile +++ b/drivers/net/ethernet/Makefile @@ -50,6 +50,7 @@ obj-$(CONFIG_NET_VENDOR_XSCALE) += xscale/ obj-$(CONFIG_JME) += jme.o obj-$(CONFIG_KORINA) += korina.o obj-$(CONFIG_LANTIQ_ETOP) += lantiq_etop.o +obj-$(CONFIG_LANTIQ_XRX200) += lantiq_xrx200.o obj-$(CONFIG_NET_VENDOR_MARVELL) += marvell/ obj-$(CONFIG_NET_VENDOR_MEDIATEK) += mediatek/ obj-$(CONFIG_NET_VENDOR_MELLANOX) += mellanox/ diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c new file mode 100644 index ..e31a6ce3c84c --- /dev/null +++ b/drivers/net/ethernet/lantiq_xrx200.c @@ -0,0 +1,609 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Lantiq / Intel PMAC driver for XRX200 SoCs + * + * Copyright (C) 2010 Lantiq Deutschland + * Copyright (C) 2012 John Crispin + * Copyright (C) 2017 - 2018 Hauke Mehrtens + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +/* DMA */ +#define XRX200_DMA_DATA_LEN0x600 +#define XRX200_DMA_RX 0 +#define XRX200_DMA_TX 1 + + +/* cpu port mac */ +#define PMAC_RX_IPG0x0024 +#define PMAC_RX_IPG_MASK 0xf + +#define PMAC_HD_CTL0x +/* Add Ethernet header to packets from DMA to PMAC */ +#define PMAC_HD_CTL_ADDBIT(0) +/* Add VLAN tag to Packets from DMA to PMAC */ +#define PMAC_HD_CTL_TAGBIT(1) +/* Add CRC to packets from DMA to PMAC */ +#define PMAC_HD_CTL_AC BIT(2) +/* Add status header to packets from PMAC to DMA */ +#define PMAC_HD_CTL_AS BIT(3) +/* Remove CRC from packets from PMAC to DMA */ +#define PMAC_HD_CTL_RC BIT(4) +/* Remove Layer-2 header from packets from PMAC to DMA */ +#define PMAC_HD_CTL_RL2BIT(5) +/* Status header is present from DMA to PMAC */ +#define PMAC_HD_CTL_RXSH BIT(6) +/* Add special tag from PMAC to switch */ +#define PMAC_HD_CTL_ASTBIT(7) +/* Remove specail Tag from PMAC to DMA */ +#define PMAC_HD_CTL_RSTBIT(8) +/* Check CRC from DMA to PMAC */ +#define PMAC_HD_CTL_CCRC BIT(9) +/* Enable reaction to Pause frames in the PMAC */ +#define PMAC_HD_CTL_FC BIT(10) + + +struct xrx200_chan { + int tx_free; + + struct tasklet_struct tasklet; + struct napi_struct napi; + struct ltq_dma_channel dma; + struct sk_buff *skb[LTQ_DESC_NUM]; + + struct xrx200_priv *priv; +}; + +struct xrx200_priv { + struct net_device_stats stats; + + struct clk *clk; + + struct xrx200_chan
[PATCH 0/4] net: Add support for Lantiq / Intel vrx200 network
This adds basic support for the GSWIP (Gigabit Switch) found in the VRX200 SoC. There are different versions of this IP core used in different SoCs, but this driver was currently only tested on the VRX200 SoC line, for other SoCs this driver probably need some adoptions to work. I also plan to add Layer 2 offloading to the DSA driver and later also layer 3 offloading which is supported by the PPE HW block. Hauke Mehrtens (4): MIPS: lantiq: Do not enable IRQs in dma open net: dsa: Add Lantiq / Intel GSWIP tag support net: lantiq: Add Lantiq / Intel vrx200 Ethernet driver net: dsa: Add Lantiq / Intel DSA driver for vrx200 MAINTAINERS | 9 + arch/mips/lantiq/xway/dma.c | 1 - arch/mips/lantiq/xway/sysctrl.c | 2 +- drivers/net/dsa/Kconfig | 8 + drivers/net/dsa/Makefile | 1 + drivers/net/dsa/lantiq-gswip.c | 750 +++ drivers/net/dsa/lantiq_pce.h | 153 +++ drivers/net/ethernet/Kconfig | 6 + drivers/net/ethernet/Makefile| 1 + drivers/net/ethernet/lantiq_etop.c | 1 + drivers/net/ethernet/lantiq_xrx200.c | 609 include/net/dsa.h| 1 + net/dsa/Kconfig | 3 + net/dsa/Makefile | 1 + net/dsa/dsa.c| 3 + net/dsa/dsa_priv.h | 3 + net/dsa/tag_gswip.c | 110 + 17 files changed, 1660 insertions(+), 2 deletions(-) create mode 100644 drivers/net/dsa/lantiq-gswip.c create mode 100644 drivers/net/dsa/lantiq_pce.h create mode 100644 drivers/net/ethernet/lantiq_xrx200.c create mode 100644 net/dsa/tag_gswip.c -- 2.11.0
[PATCH 2/4] net: dsa: Add Lantiq / Intel GSWIP tag support
This handles the tag added by the PMAC on the VRX200 SoC line. The GSWIP uses internally a GSWIP special tag which is located after the Ethernet header. The PMAC which connects the GSWIP to the CPU converts this special tag used by the GSWIP into the PMAC special tag which is added in front of the Ethernet header. This was tested with GSWIP 2.0 found in the VRX200 SoCs, other GSWIP versions use slightly different PMAC special tags Signed-off-by: Hauke Mehrtens --- MAINTAINERS | 6 +++ include/net/dsa.h | 1 + net/dsa/Kconfig | 3 ++ net/dsa/Makefile| 1 + net/dsa/dsa.c | 3 ++ net/dsa/dsa_priv.h | 3 ++ net/dsa/tag_gswip.c | 110 7 files changed, 127 insertions(+) create mode 100644 net/dsa/tag_gswip.c diff --git a/MAINTAINERS b/MAINTAINERS index 192d7f73fd01..741718ff9b79 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8009,6 +8009,12 @@ S: Maintained F: net/l3mdev F: include/net/l3mdev.h +LANTIQ / INTEL Ethernet drivers +M: Hauke Mehrtens +L: netdev@vger.kernel.org +S: Maintained +F: net/dsa/tag_gswip.c + LANTIQ MIPS ARCHITECTURE M: John Crispin L: linux-m...@linux-mips.org diff --git a/include/net/dsa.h b/include/net/dsa.h index fdbd6082945d..60bc8952e29b 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -35,6 +35,7 @@ enum dsa_tag_protocol { DSA_TAG_PROTO_BRCM_PREPEND, DSA_TAG_PROTO_DSA, DSA_TAG_PROTO_EDSA, + DSA_TAG_PROTO_GSWIP, DSA_TAG_PROTO_KSZ, DSA_TAG_PROTO_LAN9303, DSA_TAG_PROTO_MTK, diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig index 4183e4ba27a5..48c41918fb35 100644 --- a/net/dsa/Kconfig +++ b/net/dsa/Kconfig @@ -38,6 +38,9 @@ config NET_DSA_TAG_DSA config NET_DSA_TAG_EDSA bool +config NET_DSA_TAG_GSWIP + bool + config NET_DSA_TAG_KSZ bool diff --git a/net/dsa/Makefile b/net/dsa/Makefile index 9e4d3536f977..6e721f7a2947 100644 --- a/net/dsa/Makefile +++ b/net/dsa/Makefile @@ -9,6 +9,7 @@ dsa_core-$(CONFIG_NET_DSA_TAG_BRCM) += tag_brcm.o dsa_core-$(CONFIG_NET_DSA_TAG_BRCM_PREPEND) += tag_brcm.o dsa_core-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o dsa_core-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o +dsa_core-$(CONFIG_NET_DSA_TAG_GSWIP) += tag_gswip.o dsa_core-$(CONFIG_NET_DSA_TAG_KSZ) += tag_ksz.o dsa_core-$(CONFIG_NET_DSA_TAG_LAN9303) += tag_lan9303.o dsa_core-$(CONFIG_NET_DSA_TAG_MTK) += tag_mtk.o diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index e63c554e0623..81212109c507 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -54,6 +54,9 @@ const struct dsa_device_ops *dsa_device_ops[DSA_TAG_LAST] = { #ifdef CONFIG_NET_DSA_TAG_EDSA [DSA_TAG_PROTO_EDSA] = _netdev_ops, #endif +#ifdef CONFIG_NET_DSA_TAG_GSWIP + [DSA_TAG_PROTO_GSWIP] = _netdev_ops, +#endif #ifdef CONFIG_NET_DSA_TAG_KSZ [DSA_TAG_PROTO_KSZ] = _netdev_ops, #endif diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 3964c6f7a7c0..824ca07a30aa 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -205,6 +205,9 @@ extern const struct dsa_device_ops dsa_netdev_ops; /* tag_edsa.c */ extern const struct dsa_device_ops edsa_netdev_ops; +/* tag_gswip.c */ +extern const struct dsa_device_ops gswip_netdev_ops; + /* tag_ksz.c */ extern const struct dsa_device_ops ksz_netdev_ops; diff --git a/net/dsa/tag_gswip.c b/net/dsa/tag_gswip.c new file mode 100644 index ..cb559768c87f --- /dev/null +++ b/net/dsa/tag_gswip.c @@ -0,0 +1,110 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Intel / Lantiq GSWIP tag support + * + * Copyright (C) 2017 - 2018 Hauke Mehrtens + */ + +#include +#include +#include +#include + +#include "dsa_priv.h" + + +#define GSWIP_TX_HEADER_LEN4 + +/* special tag in TX path header */ +/* Byte 0 */ +#define GSWIP_TX_DPID_EN BIT(0) +#define GSWIP_TX_PORT_MAP_SHIFT1 +#define GSWIP_TX_PORT_MAP_MASK GENMASK(6, 1) + +/* Byte 1 */ +#define GSWIP_TX_CLASS_SHIFT 0 +#define GSWIP_TX_CLASS_MASKGENMASK(3, 0) +#define GSWIP_TX_CLASS_EN BIT(4) +#define GSWIP_TX_LRN_DIS BIT(5) +#define GSWIP_TX_PORT_MAP_SEL BIT(6) +#define GSWIP_TX_PORT_MAP_EN BIT(7) + +/* Byte 2 */ +#define GSWIP_TX_DPID_SHIFT0 /* destination group ID */ +#define GSWIP_TX_DPID_ELAN0 +#define GSWIP_TX_DPID_EWAN1 +#define GSWIP_TX_DPID_CPU 2 +#define GSWIP_TX_DPID_APP13 +#define GSWIP_TX_DPID_APP24 +#define GSWIP_TX_DPID_APP35 +#define GSWIP_TX_DPID_APP46 +#define GSWIP_TX_DPID_APP57 + +/* Byte 3 */ +#define GSWIP_TX_CRCGEN_DISBIT(23) +#define GSWIP_TX_SLPID_SHIFT 0 /* source port ID */ +#define GSWIP_TX_SLPID_CPU2 +#define GSWIP_TX_SLPID_APP1 3 +#define GSWIP_TX_SLPID_APP2 4 +#define
[PATCH 1/4] MIPS: lantiq: Do not enable IRQs in dma open
When a DMA channel is opened the IRQ should not get activated automatically, this allows it to pull data out manually without the help of interrupts. This is needed for a workaround in the vrx200 Ethernet driver. Signed-off-by: Hauke Mehrtens --- arch/mips/lantiq/xway/dma.c| 1 - drivers/net/ethernet/lantiq_etop.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/lantiq/xway/dma.c b/arch/mips/lantiq/xway/dma.c index 4b9fbb6744ad..3a90bb4edacc 100644 --- a/arch/mips/lantiq/xway/dma.c +++ b/arch/mips/lantiq/xway/dma.c @@ -106,7 +106,6 @@ ltq_dma_open(struct ltq_dma_channel *ch) spin_lock_irqsave(_dma_lock, flag); ltq_dma_w32(ch->nr, LTQ_DMA_CS); ltq_dma_w32_mask(0, DMA_CHAN_ON, LTQ_DMA_CCTRL); - ltq_dma_w32_mask(0, 1 << ch->nr, LTQ_DMA_IRNEN); spin_unlock_irqrestore(_dma_lock, flag); } EXPORT_SYMBOL_GPL(ltq_dma_open); diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c index afc810069440..c978a857a25c 100644 --- a/drivers/net/ethernet/lantiq_etop.c +++ b/drivers/net/ethernet/lantiq_etop.c @@ -438,6 +438,7 @@ ltq_etop_open(struct net_device *dev) if (!IS_TX(i) && (!IS_RX(i))) continue; ltq_dma_open(>dma); + ltq_dma_enable_irq(>dma); napi_enable(>napi); } phy_start(dev->phydev); -- 2.11.0
[PATCH v2 bpf 0/3] Introduce BPF_ANNOTATE_KV_PAIR
The series allows the BPF loader to figure out the btf_key_id and btf_value_id from a map's name by using BPF_ANNOTATE_KV_PAIR. It also removes the old 'typedef' way which requires two separate typedefs (one for the key and one for the value). By doing this, iproute2 and libbpf have one consistent way to figure out the btf_key_type_id and btf_value_type_id for a map. The first two patches are some prep/cleanup works. The last patch introduces BPF_ANNOTATE_KV_PAIR. v2: - Fix the incorrect '&&' check on container_type in bpf_map_find_btf_info(). - Expose the existing static btf_type_by_id() instead of creating a new one. Martin KaFai Lau (3): bpf: btf: Sync uapi btf.h to tools bpf: Replace [u]int32_t and [u]int64_t in libbpf bpf: Introduce BPF_ANNOTATE_KV_PAIR tools/include/uapi/linux/btf.h | 2 +- tools/lib/bpf/btf.c | 33 tools/lib/bpf/btf.h | 10 ++- tools/lib/bpf/libbpf.c | 85 +++- tools/lib/bpf/libbpf.h | 4 +- tools/testing/selftests/bpf/bpf_helpers.h| 9 +++ tools/testing/selftests/bpf/test_btf_haskv.c | 7 +- 7 files changed, 80 insertions(+), 70 deletions(-) -- 2.17.1
[PATCH v2 bpf 2/3] bpf: Replace [u]int32_t and [u]int64_t in libbpf
This patch replaces [u]int32_t and [u]int64_t usage with __[su]32 and __[su]64. The same change goes for [u]int16_t and [u]int8_t. Fixes: 8a138aed4a80 ("bpf: btf: Add BTF support to libbpf") Signed-off-by: Martin KaFai Lau --- tools/lib/bpf/btf.c| 28 +--- tools/lib/bpf/btf.h| 8 tools/lib/bpf/libbpf.c | 12 ++-- tools/lib/bpf/libbpf.h | 4 ++-- 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c index 8c54a4b6f187..ce77b5b57912 100644 --- a/tools/lib/bpf/btf.c +++ b/tools/lib/bpf/btf.c @@ -2,7 +2,6 @@ /* Copyright (c) 2018 Facebook */ #include -#include #include #include #include @@ -27,13 +26,13 @@ struct btf { struct btf_type **types; const char *strings; void *nohdr_data; - uint32_t nr_types; - uint32_t types_size; - uint32_t data_size; + __u32 nr_types; + __u32 types_size; + __u32 data_size; int fd; }; -static const char *btf_name_by_offset(const struct btf *btf, uint32_t offset) +static const char *btf_name_by_offset(const struct btf *btf, __u32 offset) { if (offset < btf->hdr->str_len) return >strings[offset]; @@ -151,7 +150,7 @@ static int btf_parse_type_sec(struct btf *btf, btf_print_fn_t err_log) while (next_type < end_type) { struct btf_type *t = next_type; - uint16_t vlen = BTF_INFO_VLEN(t->info); + __u16 vlen = BTF_INFO_VLEN(t->info); int err; next_type += sizeof(*t); @@ -191,7 +190,7 @@ static int btf_parse_type_sec(struct btf *btf, btf_print_fn_t err_log) } static const struct btf_type *btf_type_by_id(const struct btf *btf, -uint32_t type_id) +__u32 type_id) { if (type_id > btf->nr_types) return NULL; @@ -226,12 +225,12 @@ static int64_t btf_type_size(const struct btf_type *t) #define MAX_RESOLVE_DEPTH 32 -int64_t btf__resolve_size(const struct btf *btf, uint32_t type_id) +__s64 btf__resolve_size(const struct btf *btf, __u32 type_id) { const struct btf_array *array; const struct btf_type *t; - uint32_t nelems = 1; - int64_t size = -1; + __u32 nelems = 1; + __s64 size = -1; int i; t = btf_type_by_id(btf, type_id); @@ -271,9 +270,9 @@ int64_t btf__resolve_size(const struct btf *btf, uint32_t type_id) return nelems * size; } -int32_t btf__find_by_name(const struct btf *btf, const char *type_name) +__s32 btf__find_by_name(const struct btf *btf, const char *type_name) { - uint32_t i; + __u32 i; if (!strcmp(type_name, "void")) return 0; @@ -302,10 +301,9 @@ void btf__free(struct btf *btf) free(btf); } -struct btf *btf__new(uint8_t *data, uint32_t size, -btf_print_fn_t err_log) +struct btf *btf__new(__u8 *data, __u32 size, btf_print_fn_t err_log) { - uint32_t log_buf_size = 0; + __u32 log_buf_size = 0; char *log_buf = NULL; struct btf *btf; int err; diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h index 74bb344035bb..ed3a84370ccc 100644 --- a/tools/lib/bpf/btf.h +++ b/tools/lib/bpf/btf.h @@ -4,7 +4,7 @@ #ifndef __BPF_BTF_H #define __BPF_BTF_H -#include +#include #define BTF_ELF_SEC ".BTF" @@ -14,9 +14,9 @@ typedef int (*btf_print_fn_t)(const char *, ...) __attribute__((format(printf, 1, 2))); void btf__free(struct btf *btf); -struct btf *btf__new(uint8_t *data, uint32_t size, btf_print_fn_t err_log); -int32_t btf__find_by_name(const struct btf *btf, const char *type_name); -int64_t btf__resolve_size(const struct btf *btf, uint32_t type_id); +struct btf *btf__new(__u8 *data, __u32 size, btf_print_fn_t err_log); +__s32 btf__find_by_name(const struct btf *btf, const char *type_name); +__s64 btf__resolve_size(const struct btf *btf, __u32 type_id); int btf__fd(const struct btf *btf); #endif diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index a1e96b5de5ff..6deb4fe4fffe 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -216,8 +216,8 @@ struct bpf_map { size_t offset; int map_ifindex; struct bpf_map_def def; - uint32_t btf_key_type_id; - uint32_t btf_value_type_id; + __u32 btf_key_type_id; + __u32 btf_value_type_id; void *priv; bpf_map_clear_priv_t clear_priv; }; @@ -1016,8 +1016,8 @@ static int bpf_map_find_btf_info(struct bpf_map *map, const struct btf *btf) { struct bpf_map_def *def = >def; const size_t max_name = 256; - int64_t key_size, value_size; - int32_t key_id, value_id; + __s64 key_size, value_size; + __s32 key_id, value_id; char name[max_name]; /* Find key type by name from BTF */ @@ -2089,12 +2089,12 @@ const
[PATCH v2 bpf 3/3] bpf: Introduce BPF_ANNOTATE_KV_PAIR
This patch introduces BPF_ANNOTATE_KV_PAIR to signal the bpf loader about the btf key_type and value_type of a bpf map. Please refer to the changes in test_btf_haskv.c for its usage. Both iproute2 and libbpf loader will then have the same convention to find out the map's btf_key_type_id and btf_value_type_id from a map's name. Fixes: 8a138aed4a80 ("bpf: btf: Add BTF support to libbpf") Suggested-by: Daniel Borkmann Signed-off-by: Martin KaFai Lau --- tools/lib/bpf/btf.c | 7 +- tools/lib/bpf/btf.h | 2 + tools/lib/bpf/libbpf.c | 75 +++- tools/testing/selftests/bpf/bpf_helpers.h| 9 +++ tools/testing/selftests/bpf/test_btf_haskv.c | 7 +- 5 files changed, 56 insertions(+), 44 deletions(-) diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c index ce77b5b57912..321a99e648ed 100644 --- a/tools/lib/bpf/btf.c +++ b/tools/lib/bpf/btf.c @@ -189,8 +189,7 @@ static int btf_parse_type_sec(struct btf *btf, btf_print_fn_t err_log) return 0; } -static const struct btf_type *btf_type_by_id(const struct btf *btf, -__u32 type_id) +const struct btf_type *btf__type_by_id(const struct btf *btf, __u32 type_id) { if (type_id > btf->nr_types) return NULL; @@ -233,7 +232,7 @@ __s64 btf__resolve_size(const struct btf *btf, __u32 type_id) __s64 size = -1; int i; - t = btf_type_by_id(btf, type_id); + t = btf__type_by_id(btf, type_id); for (i = 0; i < MAX_RESOLVE_DEPTH && !btf_type_is_void_or_null(t); i++) { size = btf_type_size(t); @@ -258,7 +257,7 @@ __s64 btf__resolve_size(const struct btf *btf, __u32 type_id) return -EINVAL; } - t = btf_type_by_id(btf, type_id); + t = btf__type_by_id(btf, type_id); } if (size < 0) diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h index ed3a84370ccc..e2a09a155f84 100644 --- a/tools/lib/bpf/btf.h +++ b/tools/lib/bpf/btf.h @@ -9,6 +9,7 @@ #define BTF_ELF_SEC ".BTF" struct btf; +struct btf_type; typedef int (*btf_print_fn_t)(const char *, ...) __attribute__((format(printf, 1, 2))); @@ -16,6 +17,7 @@ typedef int (*btf_print_fn_t)(const char *, ...) void btf__free(struct btf *btf); struct btf *btf__new(__u8 *data, __u32 size, btf_print_fn_t err_log); __s32 btf__find_by_name(const struct btf *btf, const char *type_name); +const struct btf_type *btf__type_by_id(const struct btf *btf, __u32 id); __s64 btf__resolve_size(const struct btf *btf, __u32 type_id); int btf__fd(const struct btf *btf); diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 6deb4fe4fffe..d881d370616c 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -1014,68 +1015,72 @@ bpf_program__collect_reloc(struct bpf_program *prog, GElf_Shdr *shdr, static int bpf_map_find_btf_info(struct bpf_map *map, const struct btf *btf) { + const struct btf_type *container_type; + const struct btf_member *key, *value; struct bpf_map_def *def = >def; const size_t max_name = 256; + char container_name[max_name]; __s64 key_size, value_size; - __s32 key_id, value_id; - char name[max_name]; + __s32 container_id; - /* Find key type by name from BTF */ - if (snprintf(name, max_name, "%s_key", map->name) == max_name) { - pr_warning("map:%s length of BTF key_type:%s_key is too long\n", + if (snprintf(container_name, max_name, "btf_map_%s", map->name) == + max_name) { + pr_warning("map:%s length of 'btf_map_%s' is too long\n", map->name, map->name); return -EINVAL; } - key_id = btf__find_by_name(btf, name); - if (key_id < 0) { - pr_debug("map:%s key_type:%s cannot be found in BTF\n", -map->name, name); - return key_id; + container_id = btf__find_by_name(btf, container_name); + if (container_id < 0) { + pr_debug("map:%s container_name:%s cannot be found in BTF. Missing BPF_ANNOTATE_KV_PAIR?\n", +map->name, container_name); + return container_id; } - key_size = btf__resolve_size(btf, key_id); - if (key_size < 0) { - pr_warning("map:%s key_type:%s cannot get the BTF type_size\n", - map->name, name); - return key_size; + container_type = btf__type_by_id(btf, container_id); + if (!container_type) { + pr_warning("map:%s cannot find BTF type for container_id:%u\n", + map->name, container_id); + return -EINVAL; } - if
[PATCH v2 bpf 1/3] bpf: btf: Sync uapi btf.h to tools
This patch sync the uapi btf.h to tools/ Fixes: 36fc3c8c282c bpf: btf: Clean up BTF_INT_BITS() in uapi btf.h Signed-off-by: Martin KaFai Lau --- tools/include/uapi/linux/btf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/include/uapi/linux/btf.h b/tools/include/uapi/linux/btf.h index 0b5ddbe135a4..972265f32871 100644 --- a/tools/include/uapi/linux/btf.h +++ b/tools/include/uapi/linux/btf.h @@ -76,7 +76,7 @@ struct btf_type { */ #define BTF_INT_ENCODING(VAL) (((VAL) & 0x0f00) >> 24) #define BTF_INT_OFFSET(VAL)(((VAL & 0x00ff)) >> 16) -#define BTF_INT_BITS(VAL) ((VAL) & 0x) +#define BTF_INT_BITS(VAL) ((VAL) & 0x00ff) /* Attributes stored in the BTF_INT_ENCODING */ #define BTF_INT_SIGNED (1 << 0) -- 2.17.1
Re: [pull request][net 0/8] Mellanox, mlx5 fixes 2018-07-18
From: Saeed Mahameed Date: Wed, 18 Jul 2018 18:26:04 -0700 > The following series provides fixes to mlx5 core and net device driver. > > Please pull and let me know if there's any problem. Pulled, thanks Saeed. Based upon the thread with Or, it would be useful to do some auditing and make sure all tunnels set skb->encapsulation. > For -stable v4.7 > net/mlx5e: Don't allow aRFS for encapsulated packets > net/mlx5e: Fix quota counting in aRFS expire flow > > For -stable v4.15 > net/mlx5e: Only allow offloading decap egress (egdev) flows > net/mlx5e: Refine ets validation function > net/mlx5: Adjust clock overflow work period > > For -stable v4.17 > net/mlx5: E-Switch, UBSAN fix undefined behavior in mlx5_eswitch_mode Queued up. Thanks.
Re: [PATCH net-next 00/11] s390/qeth: updates 2018-07-19
From: Julian Wiedmann Date: Thu, 19 Jul 2018 12:43:47 +0200 > please apply one more round of qeth patches to net-next. > This brings additional performance improvements for the transmit code, > and some refactoring to pave the way for using netdev_priv. > Also, two minor fixes for rare corner cases. Series applied, thanks Julian.
Re: [PATCH bpf 3/3] bpf: Introduce BPF_ANNOTATE_KV_PAIR
On Fri, Jul 20, 2018 at 06:39:33PM -0700, Martin KaFai Lau wrote: > This patch introduces BPF_ANNOTATE_KV_PAIR to signal the > bpf loader about the btf key_type and value_type of a bpf map. > Please refer to the changes in test_btf_haskv.c for its usage. > Both iproute2 and libbpf loader will then have the same > convention to find out the map's btf_key_type_id and > btf_value_type_id from a map's name. > > Fixes: 8a138aed4a80 ("bpf: btf: Add BTF support to libbpf") > Suggested-by: Daniel Borkmann > Signed-off-by: Martin KaFai Lau > --- > tools/lib/bpf/btf.c | 8 +++ > tools/lib/bpf/btf.h | 1 + > tools/lib/bpf/libbpf.c | 71 +++- > tools/testing/selftests/bpf/bpf_helpers.h| 9 +++ > tools/testing/selftests/bpf/test_btf_haskv.c | 7 +- > 5 files changed, 59 insertions(+), 37 deletions(-) > > diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c > index ce77b5b57912..748f0b11361d 100644 > --- a/tools/lib/bpf/btf.c > +++ b/tools/lib/bpf/btf.c > @@ -288,6 +288,14 @@ __s32 btf__find_by_name(const struct btf *btf, const > char *type_name) > return -ENOENT; > } > > +const struct btf_type *btf__type_by_id(const struct btf *btf, __u32 id) > +{ > + if (!id || id > btf->nr_types) > + return ERR_PTR(-EINVAL); > + > + return btf->types[id]; > +} > + > void btf__free(struct btf *btf) > { > if (!btf) > diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h > index ed3a84370ccc..38ebf66613e4 100644 > --- a/tools/lib/bpf/btf.h > +++ b/tools/lib/bpf/btf.h > @@ -16,6 +16,7 @@ typedef int (*btf_print_fn_t)(const char *, ...) > void btf__free(struct btf *btf); > struct btf *btf__new(__u8 *data, __u32 size, btf_print_fn_t err_log); > __s32 btf__find_by_name(const struct btf *btf, const char *type_name); > +const struct btf_type *btf__type_by_id(const struct btf *btf, __u32 id); > __s64 btf__resolve_size(const struct btf *btf, __u32 type_id); > int btf__fd(const struct btf *btf); > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > index 6deb4fe4fffe..5ff7755efa6b 100644 > --- a/tools/lib/bpf/libbpf.c > +++ b/tools/lib/bpf/libbpf.c > @@ -36,6 +36,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -1014,63 +1015,69 @@ bpf_program__collect_reloc(struct bpf_program *prog, > GElf_Shdr *shdr, > > static int bpf_map_find_btf_info(struct bpf_map *map, const struct btf *btf) > { > + const struct btf_type *container_type; > + const struct btf_member *key, *value; > + __s32 key_id, value_id, container_id; > struct bpf_map_def *def = >def; > const size_t max_name = 256; > + char container_name[max_name]; > __s64 key_size, value_size; > - __s32 key_id, value_id; > - char name[max_name]; > > - /* Find key type by name from BTF */ > - if (snprintf(name, max_name, "%s_key", map->name) == max_name) { > - pr_warning("map:%s length of BTF key_type:%s_key is too long\n", > + if (snprintf(container_name, max_name, "btf_map_%s", map->name) == > + max_name) { > + pr_warning("map:%s length of 'btf_map_%s' is too long\n", > map->name, map->name); > return -EINVAL; > } > > - key_id = btf__find_by_name(btf, name); > - if (key_id < 0) { > - pr_debug("map:%s key_type:%s cannot be found in BTF\n", > - map->name, name); > - return key_id; > + container_id = btf__find_by_name(btf, container_name); > + if (container_id < 0) { > + pr_debug("map:%s container_name:%s cannot be found in BTF. > Missing BPF_ANNOTATE_KV_PAIR?\n", > + map->name, container_name); > + return container_id; > } > > - key_size = btf__resolve_size(btf, key_id); > - if (key_size < 0) { > - pr_warning("map:%s key_type:%s cannot get the BTF type_size\n", > -map->name, name); > - return key_size; > + container_type = btf__type_by_id(btf, container_id); > + if (IS_ERR(container_type)) { > + pr_warning("map:%s cannot find BTF type for container_id:%u\n", > +map->name, container_id); > + return PTR_ERR(container_type); > } > > - if (def->key_size != key_size) { > - pr_warning("map:%s key_type:%s has BTF type_size:%u != > key_size:%u\n", > -map->name, name, (unsigned int)key_size, > def->key_size); > + if (BTF_INFO_KIND(container_type->info) != BTF_KIND_STRUCT && > + BTF_INFO_VLEN(container_type->info) < 2) { There is a mistake in this check. I will spin v2. > + pr_warning("map:%s container_name:%s is an invalid container > struct\n", > +map->name, container_name); > return -EINVAL; > } > > - /*
RE: MY NAME IS MRS BELLA YOSTIN MOHAMMAD
Hello Dear. My Name is Mrs. Bella Yostin Mohammad, I got your contact from a business directory search and I decided to contact you directly. well am originally from South Africa, but based in London, i am searching for a reliable and honest and understanding person to go into partnership in investing or to guide me in setting up a lucrative business in the Middle east countries or the Arab countries,UAE or OMAN and Kuwait, my plan is for my Son to fly to your country to meet with you for the discussion and process of the investment. So am only soliciting for your guidance for partnership or to help me in investing in any lucrative business if you are interested. My Idea of business is to invest into Tourism business or Medical business or Real Estates business, this is my plan and i will be happy if you will help in explaining more of either of this business which is better for me to invest into in your country.all i want is to invest into a good business that will bring higher profit. like i explained above my plan is to send my Son down to meet with you so both of you will meet face to face and discuss more so we will know how to go about the process for the investment.. If you are willing to assist you will never regret assisting i and my son. mean why if you are interested reply back to me with your mobile number so that you and my son can discuss more in details. And also for my Son to make his arrangement to fly down to your country to meet with you over discussing about the investment. I look forward for your reply. Thanks with regards Mrs. Bella Yostin Mohammad
[PATCH net-next 2/2] net: phy: use helper phy_polling_mode
Make use of new helper phy_polling_mode(). Signed-off-by: Heiner Kallweit --- drivers/net/phy/phy.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 914fe8e6..7ade22a7 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -519,7 +519,7 @@ static int phy_start_aneg_priv(struct phy_device *phydev, bool sync) * negotiation may already be done and aneg interrupt may not be * generated. */ - if (phydev->irq != PHY_POLL && phydev->state == PHY_AN) { + if (!phy_polling_mode(phydev) && phydev->state == PHY_AN) { err = phy_aneg_done(phydev); if (err > 0) { trigger = true; @@ -977,7 +977,7 @@ void phy_state_machine(struct work_struct *work) needs_aneg = true; break; case PHY_NOLINK: - if (phydev->irq != PHY_POLL) + if (!phy_polling_mode(phydev)) break; err = phy_read_status(phydev); @@ -1018,7 +1018,7 @@ void phy_state_machine(struct work_struct *work) /* Only register a CHANGE if we are polling and link changed * since latest checking. */ - if (phydev->irq == PHY_POLL) { + if (phy_polling_mode(phydev)) { old_link = phydev->link; err = phy_read_status(phydev); if (err) @@ -1117,7 +1117,7 @@ void phy_state_machine(struct work_struct *work) * PHY, if PHY_IGNORE_INTERRUPT is set, then we will be moving * between states from phy_mac_interrupt() */ - if (phydev->irq == PHY_POLL) + if (phy_polling_mode(phydev)) queue_delayed_work(system_power_efficient_wq, >state_queue, PHY_STATE_TIME * HZ); } -- 2.18.0
[PATCH v2 net-next] net: phy: add GBit master / slave error detection
Certain PHY's have issues when operating in GBit slave mode and can be forced to master mode. Examples are RTL8211C, also the Micrel PHY driver has a DT setting to force master mode. If two such chips are link partners the autonegotiation will fail. Standard defines a self-clearing on read, latched-high bit to indicate this error. Check this bit to inform the user. Signed-off-by: Heiner Kallweit --- v2: - Use different error messages depending on whether local PHY uses manual master/slave configuration. --- drivers/net/phy/phy_device.c | 8 include/uapi/linux/mii.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index b9f5f40a..db1172db 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1555,6 +1555,14 @@ int genphy_read_status(struct phy_device *phydev) if (adv < 0) return adv; + if (lpagb & LPA_1000MSFAIL) { + if (adv & CTL1000_ENABLE_MASTER) + phydev_err(phydev, "Master/Slave resolution failed, maybe conflicting manual settings?\n"); + else + phydev_err(phydev, "Master/Slave resolution failed\n"); + return -ENOLINK; + } + phydev->lp_advertising = mii_stat1000_to_ethtool_lpa_t(lpagb); common_adv_gb = lpagb & adv << 2; diff --git a/include/uapi/linux/mii.h b/include/uapi/linux/mii.h index b5c2fdcf..a5062165 100644 --- a/include/uapi/linux/mii.h +++ b/include/uapi/linux/mii.h @@ -136,6 +136,7 @@ #define CTL1000_ENABLE_MASTER 0x1000 /* 1000BASE-T Status register */ +#define LPA_1000MSFAIL 0x8000 /* Master/Slave resolution failure */ #define LPA_1000LOCALRXOK 0x2000 /* Link partner local receiver status */ #define LPA_1000REMRXOK0x1000 /* Link partner remote receiver status */ #define LPA_1000FULL 0x0800 /* Link partner 1000BASE-T full duplex */ -- 2.18.0
[PATCH net-next 1/2] net: phy: add helper phy_polling_mode
Add a helper for checking whether polling is used to detect PHY status changes. Signed-off-by: Heiner Kallweit --- include/linux/phy.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/include/linux/phy.h b/include/linux/phy.h index 075c2f77..cd6f637c 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -824,6 +824,16 @@ static inline bool phy_interrupt_is_valid(struct phy_device *phydev) return phydev->irq != PHY_POLL && phydev->irq != PHY_IGNORE_INTERRUPT; } +/** + * phy_polling_mode - Convenience function for testing whether polling is + * used to detect PHY status changes + * @phydev: the phy_device struct + */ +static inline bool phy_polling_mode(struct phy_device *phydev) +{ + return phydev->irq == PHY_POLL; +} + /** * phy_is_internal - Convenience function for testing if a PHY is internal * @phydev: the phy_device struct -- 2.18.0
Re: [PATCH bpf] xdp: add NULL pointer check in __xdp_return()
2018-07-21 2:18 GMT+09:00 Martin KaFai Lau : > On Sat, Jul 21, 2018 at 01:04:45AM +0900, Taehee Yoo wrote: >> rhashtable_lookup() can return NULL. so that NULL pointer >> check routine should be added. >> >> Fixes: 02b55e5657c3 ("xdp: add MEM_TYPE_ZERO_COPY") >> Signed-off-by: Taehee Yoo >> --- >> net/core/xdp.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/net/core/xdp.c b/net/core/xdp.c >> index 9d1f220..1c12bc7 100644 >> --- a/net/core/xdp.c >> +++ b/net/core/xdp.c >> @@ -345,7 +345,8 @@ static void __xdp_return(void *data, struct xdp_mem_info >> *mem, bool napi_direct, >> rcu_read_lock(); >> /* mem->id is valid, checked in xdp_rxq_info_reg_mem_model() */ >> xa = rhashtable_lookup(mem_id_ht, >id, mem_id_rht_params); >> - xa->zc_alloc->free(xa->zc_alloc, handle); >> + if (xa) >> + xa->zc_alloc->free(xa->zc_alloc, handle); > hmm...It is not clear to me the "!xa" case don't have to be handled? Thank you for reviewing! Returning NULL pointer is bug case such as calling after use xdp_rxq_info_unreg(). so that, I think it can't handle at that moment. we can make __xdp_return to add WARN_ON_ONCE() or add return error code to driver. But I'm not sure if these is useful information. I might have misunderstood scenario of MEM_TYPE_ZERO_COPY because there is no use case of MEM_TYPE_ZERO_COPY yet. Thanks! > >> rcu_read_unlock(); >> default: >> /* Not possible, checked in xdp_rxq_info_reg_mem_model() */ >> -- >> 2.9.3 >>
Re: pull-request: bpf-next 2018-07-20
From: Daniel Borkmann Date: Sat, 21 Jul 2018 00:01:10 +0200 > The following pull-request contains BPF updates for your *net-next* tree. > > The main changes are: > > 1) Add sharing of BPF objects within one ASIC: this allows for reuse of >the same program on multiple ports of a device, and therefore gains >better code store utilization. On top of that, this now also enables >sharing of maps between programs attached to different ports of a >device, from Jakub. > > 2) Cleanup in libbpf and bpftool's Makefile to reduce unneeded feature >detections and unused variable exports, also from Jakub. > > 3) First batch of RCU annotation fixes in prog array handling, i.e. >there are several __rcu markers which are not correct as well as >some of the RCU handling, from Roman. > > 4) Two fixes in BPF sample files related to checking of the prog_cnt >upper limit from sample loader, from Dan. > > 5) Minor cleanup in sockmap to remove a set but not used variable, >from Colin. > > Please consider pulling these changes from: > > git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git Also pulled, thank you.
Re: pull-request: bpf 2018-07-20
From: Daniel Borkmann Date: Fri, 20 Jul 2018 23:24:43 +0200 > The following pull-request contains BPF updates for your *net* tree. > > The main changes are: > > 1) Fix in BPF Makefile to detect llvm-objcopy in a more robust way which is >needed for pahole's BTF converter and minor UAPI tweaks in BTF_INT_BITS() >to shrink the mask before eventual UAPI freeze, from Martin. > > 2) Fix a segfault in bpftool when prog pin id has no further arguments such >as id value or file specified, from Taeung. > > 3) Fix powerpc JIT handling of XADD which has jumps to exit path that would >potentially bypass verifier expectations e.g. with subprog calls. Also add >a test case to make sure XADD is not mangling src/dst register, from > Daniel. > > Please consider pulling these changes from: > > git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git Pulled, thanks Daniel.
[PATCH] net: Init backlog NAPI's gro_hash.
Based upon a patch by Sean Tranchetti. Fixes: d4546c2509b1 ("net: Convert GRO SKB handling to list_head.") Signed-off-by: David S. Miller --- net/core/dev.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 4f8b92d81d10..87c42c8249ae 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -6115,19 +6115,24 @@ static enum hrtimer_restart napi_watchdog(struct hrtimer *timer) return HRTIMER_NORESTART; } -void netif_napi_add(struct net_device *dev, struct napi_struct *napi, - int (*poll)(struct napi_struct *, int), int weight) +static void init_gro_hash(struct napi_struct *napi) { int i; - INIT_LIST_HEAD(>poll_list); - hrtimer_init(>timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED); - napi->timer.function = napi_watchdog; - napi->gro_bitmask = 0; for (i = 0; i < GRO_HASH_BUCKETS; i++) { INIT_LIST_HEAD(>gro_hash[i].list); napi->gro_hash[i].count = 0; } + napi->gro_bitmask = 0; +} + +void netif_napi_add(struct net_device *dev, struct napi_struct *napi, + int (*poll)(struct napi_struct *, int), int weight) +{ + INIT_LIST_HEAD(>poll_list); + hrtimer_init(>timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED); + napi->timer.function = napi_watchdog; + init_gro_hash(napi); napi->skb = NULL; napi->poll = poll; if (weight > NAPI_POLL_WEIGHT) @@ -9554,6 +9559,7 @@ static int __init net_dev_init(void) sd->cpu = i; #endif + init_gro_hash(>backlog); sd->backlog.poll = process_backlog; sd->backlog.weight = weight_p; } -- 2.17.1
Re: [PATCH net-next] net: gro: Initialize backlog NAPI's gro_list
From: Sean Tranchetti Date: Fri, 20 Jul 2018 17:53:23 -0600 > @@ -9556,6 +9556,7 @@ static int __init net_dev_init(void) > > sd->backlog.poll = process_backlog; > sd->backlog.weight = weight_p; > + INIT_LIST_HEAD(>backlog.gro_list); > } > > dev_boot_phase = 0; This is no longer a list, but a hash table. I'll code up the equivalent fix, thank you.