Netdev List
 help / color / mirror / Atom feed
* Re: [GIT] Networking
From: pr-tracker-bot @ 2019-08-07  0:30 UTC (permalink / raw)
  To: David Miller; +Cc: torvalds, akpm, netdev, linux-kernel
In-Reply-To: <20190806.163557.192717542972894245.davem@davemloft.net>

The pull request you sent on Tue, 06 Aug 2019 16:35:57 -0700 (PDT):

> git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git refs/heads/master

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/33920f1ec5bf47c5c0a1d2113989bdd9dfb3fae9

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker

^ permalink raw reply

* Re: [PATCH net] inet: frags: re-introduce skb coalescing for local delivery
From: Florian Westphal @ 2019-08-07  0:28 UTC (permalink / raw)
  To: Guillaume Nault
  Cc: netdev, Florian Westphal, Eric Dumazet, Peter Oskolkov,
	Alexander Aring
In-Reply-To: <22d8da10c97214edd0677e6478093ad9376180ef.1564758715.git.gnault@redhat.com>

Guillaume Nault <gnault@redhat.com> wrote:
> Before commit d4289fcc9b16 ("net: IP6 defrag: use rbtrees for IPv6
> defrag"), a netperf UDP_STREAM test[0] using big IPv6 datagrams (thus
> generating many fragments) and running over an IPsec tunnel, reported
> more than 6Gbps throughput. After that patch, the same test gets only
> 9Mbps when receiving on a be2net nic (driver can make a big difference
> here, for example, ixgbe doesn't seem to be affected).
> 
> By reusing the IPv4 defragmentation code, IPv6 lost fragment coalescing
> (IPv4 fragment coalescing was dropped by commit 14fe22e33462 ("Revert
> "ipv4: use skb coalescing in defragmentation"")).

[..]

> This patch is quite conservative and only coalesces skbs for local
> IPv4 and IPv6 delivery (in order to avoid changing skb geometry when
> forwarding). Coalescing could be extended in the future if need be, as
> more scenarios would probably benefit from it.

No objections from my side, so:

Acked-by: Florian Westphal <fw@strlen.de>

^ permalink raw reply

* Re: [PATCH bpf-next v5 0/3] selftests/bpf: switch test_progs back to stdio
From: Alexei Starovoitov @ 2019-08-07  0:23 UTC (permalink / raw)
  To: Stanislav Fomichev
  Cc: Network Development, bpf, David S. Miller, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko
In-Reply-To: <20190806174529.8341-1-sdf@google.com>

On Tue, Aug 6, 2019 at 10:45 AM Stanislav Fomichev <sdf@google.com> wrote:
>
> I was looking into converting test_sockops* to test_progs framework
> and that requires using cgroup_helpers.c which rely on stdio/stderr.
> Let's use open_memstream to override stdout into buffer during
> subtests instead of custom test_{v,}printf wrappers. That lets
> us continue to use stdio in the subtests and dump it on failure
> if required.
>
> That would also fix bpf_find_map which currently uses printf to
> signal failure (missed during test_printf conversion).

Applied. Thanks

^ permalink raw reply

* [PATCH net-next] net/ncsi: allow to customize BMC MAC Address offset
From: Tao Ren @ 2019-08-07  0:21 UTC (permalink / raw)
  To: Samuel Mendoza-Jonas, David S . Miller, netdev, linux-kernel,
	openbmc, William Kennington, Joel Stanley
  Cc: Tao Ren

Currently BMC's MAC address is calculated by adding 1 to NCSI NIC's base
MAC address when CONFIG_NCSI_OEM_CMD_GET_MAC option is enabled. The logic
doesn't work for platforms with different BMC MAC offset: for example,
Facebook Yamp BMC's MAC address is calculated by adding 2 to NIC's base
MAC address ("BaseMAC + 1" is reserved for Host use).

This patch adds NET_NCSI_MC_MAC_OFFSET config option to customize offset
between NIC's Base MAC address and BMC's MAC address. Its default value is
set to 1 to avoid breaking existing users.

Signed-off-by: Tao Ren <taoren@fb.com>
---
 net/ncsi/Kconfig    |  8 ++++++++
 net/ncsi/ncsi-rsp.c | 15 +++++++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/net/ncsi/Kconfig b/net/ncsi/Kconfig
index 2f1e5756c03a..be8efe1ed99e 100644
--- a/net/ncsi/Kconfig
+++ b/net/ncsi/Kconfig
@@ -17,3 +17,11 @@ config NCSI_OEM_CMD_GET_MAC
 	---help---
 	  This allows to get MAC address from NCSI firmware and set them back to
 		controller.
+config NET_NCSI_MC_MAC_OFFSET
+	int
+	prompt "Offset of Management Controller's MAC Address"
+	depends on NCSI_OEM_CMD_GET_MAC
+	default 1
+	help
+	  This defines the offset between Network Controller's (base) MAC
+	  address and Management Controller's MAC address.
diff --git a/net/ncsi/ncsi-rsp.c b/net/ncsi/ncsi-rsp.c
index 7581bf919885..24a791f9ebf5 100644
--- a/net/ncsi/ncsi-rsp.c
+++ b/net/ncsi/ncsi-rsp.c
@@ -656,6 +656,11 @@ static int ncsi_rsp_handler_oem_bcm_gma(struct ncsi_request *nr)
 	struct ncsi_rsp_oem_pkt *rsp;
 	struct sockaddr saddr;
 	int ret = 0;
+#ifdef CONFIG_NET_NCSI_MC_MAC_OFFSET
+	int mac_offset = CONFIG_NET_NCSI_MC_MAC_OFFSET;
+#else
+	int mac_offset = 1;
+#endif
 
 	/* Get the response header */
 	rsp = (struct ncsi_rsp_oem_pkt *)skb_network_header(nr->rsp);
@@ -663,8 +668,14 @@ static int ncsi_rsp_handler_oem_bcm_gma(struct ncsi_request *nr)
 	saddr.sa_family = ndev->type;
 	ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
 	memcpy(saddr.sa_data, &rsp->data[BCM_MAC_ADDR_OFFSET], ETH_ALEN);
-	/* Increase mac address by 1 for BMC's address */
-	eth_addr_inc((u8 *)saddr.sa_data);
+
+	/* Management Controller's MAC address is calculated by adding
+	 * the offset to Network Controller's (base) MAC address.
+	 * Note: negative offset is "ignored", and BMC will use the Base
+	 * MAC address in this case.
+	 */
+	while (mac_offset-- > 0)
+		eth_addr_inc((u8 *)saddr.sa_data);
 	if (!is_valid_ether_addr((const u8 *)saddr.sa_data))
 		return -ENXIO;
 
-- 
2.17.1


^ permalink raw reply related

* [PATCH bpf 2/2] tools: bpftool: add error message on pin failure
From: Jakub Kicinski @ 2019-08-07  0:19 UTC (permalink / raw)
  To: alexei.starovoitov, daniel
  Cc: netdev, bpf, oss-drivers, Jakub Kicinski, Andy Lutomirski,
	Quentin Monnet
In-Reply-To: <20190807001923.19483-1-jakub.kicinski@netronome.com>

No error message is currently printed if the pin syscall
itself fails. It got lost in the loadall refactoring.

Fixes: 77380998d91d ("bpftool: add loadall command")
Reported-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
---
CC: luto@kernel.org, sdf@google.com

 tools/bpf/bpftool/common.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/common.c b/tools/bpf/bpftool/common.c
index c52a6ffb8949..6a71324be628 100644
--- a/tools/bpf/bpftool/common.c
+++ b/tools/bpf/bpftool/common.c
@@ -204,7 +204,11 @@ int do_pin_fd(int fd, const char *name)
 	if (err)
 		return err;
 
-	return bpf_obj_pin(fd, name);
+	err = bpf_obj_pin(fd, name);
+	if (err)
+		p_err("can't pin the object (%s): %s", name, strerror(errno));
+
+	return err;
 }
 
 int do_pin_any(int argc, char **argv, int (*get_fd_by_id)(__u32))
-- 
2.21.0


^ permalink raw reply related

* [PATCH bpf 1/2] tools: bpftool: fix error message (prog -> object)
From: Jakub Kicinski @ 2019-08-07  0:19 UTC (permalink / raw)
  To: alexei.starovoitov, daniel
  Cc: netdev, bpf, oss-drivers, Jakub Kicinski, Quentin Monnet
In-Reply-To: <20190807001923.19483-1-jakub.kicinski@netronome.com>

Change an error message to work for any object being
pinned not just programs.

Fixes: 71bb428fe2c1 ("tools: bpf: add bpftool")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
---
 tools/bpf/bpftool/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/common.c b/tools/bpf/bpftool/common.c
index 5215e0870bcb..c52a6ffb8949 100644
--- a/tools/bpf/bpftool/common.c
+++ b/tools/bpf/bpftool/common.c
@@ -237,7 +237,7 @@ int do_pin_any(int argc, char **argv, int (*get_fd_by_id)(__u32))
 
 	fd = get_fd_by_id(id);
 	if (fd < 0) {
-		p_err("can't get prog by id (%u): %s", id, strerror(errno));
+		p_err("can't open object by id (%u): %s", id, strerror(errno));
 		return -1;
 	}
 
-- 
2.21.0


^ permalink raw reply related

* [PATCH bpf 0/2] tools: bpftool: fix pinning error messages
From: Jakub Kicinski @ 2019-08-07  0:19 UTC (permalink / raw)
  To: alexei.starovoitov, daniel; +Cc: netdev, bpf, oss-drivers, Jakub Kicinski

Hi!

First make sure we don't use "prog" in error messages because
the pinning operation could be performed on a map. Second add
back missing error message if pin syscall failed.

Jakub Kicinski (2):
  tools: bpftool: fix error message (prog -> object)
  tools: bpftool: add error message on pin failure

 tools/bpf/bpftool/common.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

-- 
2.21.0


^ permalink raw reply

* Re: [PATCH v2 0/3] arm/arm64: Add support for function error injection
From: Masami Hiramatsu @ 2019-08-07  0:08 UTC (permalink / raw)
  To: Leo Yan
  Cc: Russell King, Oleg Nesterov, Catalin Marinas, Will Deacon,
	Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
	x86, Arnd Bergmann, Alexei Starovoitov, Daniel Borkmann,
	Martin KaFai Lau, Song Liu, Yonghong Song, Naveen N. Rao,
	linux-arm-kernel, linux-kernel, linuxppc-dev, linux-arch, netdev,
	bpf, clang-built-linux
In-Reply-To: <20190806100015.11256-1-leo.yan@linaro.org>

On Tue,  6 Aug 2019 18:00:12 +0800
Leo Yan <leo.yan@linaro.org> wrote:

> This small patch set is to add support for function error injection;
> this can be used to eanble more advanced debugging feature, e.g.
> CONFIG_BPF_KPROBE_OVERRIDE.
> 
> The patch 01/03 is to consolidate the function definition which can be
> suared cross architectures, patches 02,03/03 are used for enabling
> function error injection on arm64 and arm architecture respectively.
> 
> I tested on arm64 platform Juno-r2 and one of my laptop with x86
> architecture with below steps; I don't test for Arm architecture so
> only pass compilation.
> 
> - Enable kernel configuration:
>   CONFIG_BPF_KPROBE_OVERRIDE
>   CONFIG_BTRFS_FS
>   CONFIG_BPF_EVENTS=y
>   CONFIG_KPROBES=y
>   CONFIG_KPROBE_EVENTS=y
>   CONFIG_BPF_KPROBE_OVERRIDE=y
> 
> - Build samples/bpf on with Debian rootFS:
>   # cd $kernel
>   # make headers_install
>   # make samples/bpf/ LLC=llc-7 CLANG=clang-7
> 
> - Run the sample tracex7:
>   # dd if=/dev/zero of=testfile.img bs=1M seek=1000 count=1
>   # DEVICE=$(losetup --show -f testfile.img)
>   # mkfs.btrfs -f $DEVICE
>   # ./tracex7 testfile.img
>   [ 1975.211781] BTRFS error (device (efault)): open_ctree failed
>   mount: /mnt/linux-kernel/linux-cs-dev/samples/bpf/tmpmnt: mount(2) system call failed: Cannot allocate memory.
> 
> Changes from v1:
> * Consolidated the function definition into asm-generic header (Will);
> * Used APIs to access pt_regs elements (Will);
> * Fixed typos in the comments (Will).

This looks good to me.

Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>

Thank you!

> 
> 
> Leo Yan (3):
>   error-injection: Consolidate override function definition
>   arm64: Add support for function error injection
>   arm: Add support for function error injection
> 
>  arch/arm/Kconfig                           |  1 +
>  arch/arm/include/asm/ptrace.h              |  5 +++++
>  arch/arm/lib/Makefile                      |  2 ++
>  arch/arm/lib/error-inject.c                | 19 +++++++++++++++++++
>  arch/arm64/Kconfig                         |  1 +
>  arch/arm64/include/asm/ptrace.h            |  5 +++++
>  arch/arm64/lib/Makefile                    |  2 ++
>  arch/arm64/lib/error-inject.c              | 18 ++++++++++++++++++
>  arch/powerpc/include/asm/error-injection.h | 13 -------------
>  arch/x86/include/asm/error-injection.h     | 13 -------------
>  include/asm-generic/error-injection.h      |  6 ++++++
>  include/linux/error-injection.h            |  6 +++---
>  12 files changed, 62 insertions(+), 29 deletions(-)
>  create mode 100644 arch/arm/lib/error-inject.c
>  create mode 100644 arch/arm64/lib/error-inject.c
>  delete mode 100644 arch/powerpc/include/asm/error-injection.h
>  delete mode 100644 arch/x86/include/asm/error-injection.h
> 
> -- 
> 2.17.1
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

^ permalink raw reply

* Re: [PATCH net-next v4 2/2] net: phy: broadcom: add 1000Base-X support for BCM54616S
From: Tao Ren @ 2019-08-07  0:00 UTC (permalink / raw)
  To: Heiner Kallweit, Andrew Lunn, Florian Fainelli, David S . Miller,
	Arun Parameswaran, Justin Chen, Vladimir Oltean,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	openbmc@lists.ozlabs.org
In-Reply-To: <36d81485-ec23-eb7b-583e-3dd0f90ca562@gmail.com>

On 8/6/19 3:00 PM, Heiner Kallweit wrote:
> On 06.08.2019 23:09, Tao Ren wrote:
>> The BCM54616S PHY cannot work properly in RGMII->1000Base-KX mode (for
>> example, on Facebook CMM BMC platform), mainly because genphy functions
>> are designed for copper links, and 1000Base-X (clause 37) auto negotiation
>> needs to be handled differently.
>>
>> This patch enables 1000Base-X support for BCM54616S by customizing 3
>> driver callbacks:
>>
>>   - probe: probe callback detects PHY's operation mode based on
>>     INTERF_SEL[1:0] pins and 1000X/100FX selection bit in SerDES 100-FX
>>     Control register.
>>
>>   - config_aneg: bcm54616s_config_aneg_1000bx function is added for auto
>>     negotiation in 1000Base-X mode.
>>
>>   - read_status: BCM54616S and BCM5482 PHY share the same read_status
>>     callback which manually set link speed and duplex mode in 1000Base-X
>>     mode.
>>
>> Signed-off-by: Tao Ren <taoren@fb.com>
>> ---
>>  Changes in v4:
>>   - add bcm54616s_config_aneg_1000bx() to deal with auto negotiation in
>>     1000Base-X mode.
>>  Changes in v3:
>>   - rename bcm5482_read_status to bcm54xx_read_status so the callback can
>>     be shared by BCM5482 and BCM54616S.
>>  Changes in v2:
>>   - Auto-detect PHY operation mode instead of passing DT node.
>>   - move PHY mode auto-detect logic from config_init to probe callback.
>>   - only set speed (not including duplex) in read_status callback.
>>   - update patch description with more background to avoid confusion.
>>   - patch #1 in the series ("net: phy: broadcom: set features explicitly
>>     for BCM54616") is dropped: the fix should go to get_features callback
>>     which may potentially depend on this patch.
>>
>>  drivers/net/phy/broadcom.c | 62 ++++++++++++++++++++++++++++++++++----
>>  include/linux/brcmphy.h    | 10 ++++--
>>  2 files changed, 64 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
>> index 937d0059e8ac..bf61ed8451e5 100644
>> --- a/drivers/net/phy/broadcom.c
>> +++ b/drivers/net/phy/broadcom.c
>> @@ -383,9 +383,9 @@ static int bcm5482_config_init(struct phy_device *phydev)
>>  		/*
>>  		 * Select 1000BASE-X register set (primary SerDes)
>>  		 */
>> -		reg = bcm_phy_read_shadow(phydev, BCM5482_SHD_MODE);
>> -		bcm_phy_write_shadow(phydev, BCM5482_SHD_MODE,
>> -				     reg | BCM5482_SHD_MODE_1000BX);
>> +		reg = bcm_phy_read_shadow(phydev, BCM54XX_SHD_MODE);
>> +		bcm_phy_write_shadow(phydev, BCM54XX_SHD_MODE,
>> +				     reg | BCM54XX_SHD_MODE_1000BX);
>>  
>>  		/*
>>  		 * LED1=ACTIVITYLED, LED3=LINKSPD[2]
>> @@ -409,7 +409,7 @@ static int bcm5482_config_init(struct phy_device *phydev)
>>  	return err;
>>  }
>>  
>> -static int bcm5482_read_status(struct phy_device *phydev)
>> +static int bcm54xx_read_status(struct phy_device *phydev)
>>  {
>>  	int err;
>>  
>> @@ -451,12 +451,60 @@ static int bcm5481_config_aneg(struct phy_device *phydev)
>>  	return ret;
>>  }
>>  
>> +static int bcm54616s_probe(struct phy_device *phydev)
>> +{
>> +	int val, intf_sel;
>> +
>> +	val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_MODE);
>> +	if (val < 0)
>> +		return val;
>> +
>> +	/* The PHY is strapped in RGMII to fiber mode when INTERF_SEL[1:0]
>> +	 * is 01b.
>> +	 */
>> +	intf_sel = (val & BCM54XX_SHD_INTF_SEL_MASK) >> 1;
>> +	if (intf_sel == 1) {
>> +		val = bcm_phy_read_shadow(phydev, BCM54616S_SHD_100FX_CTRL);
>> +		if (val < 0)
>> +			return val;
>> +
>> +		/* Bit 0 of the SerDes 100-FX Control register, when set
>> +		 * to 1, sets the MII/RGMII -> 100BASE-FX configuration.
>> +		 * When this bit is set to 0, it sets the GMII/RGMII ->
>> +		 * 1000BASE-X configuration.
>> +		 */
>> +		if (!(val & BCM54616S_100FX_MODE))
>> +			phydev->dev_flags |= PHY_BCM_FLAGS_MODE_1000BX;
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>> +static int bcm54616s_config_aneg_1000bx(struct phy_device *phydev)
>> +{
>> +	int err;
>> +	int adv = 0;
>> +
>> +	if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
>> +			      phydev->supported))
>> +		adv |= ADVERTISE_1000XFULL;
>> +
>> +	err = phy_modify_changed(phydev, MII_ADVERTISE, 0, adv);
> 
> The "0" parameter is wrong, it must be ADVERTISE_1000XFULL.
> First you reset the bit, and then you set it or not.

Got it. Will fix it in patch v5. Thanks.

>> +	if (err > 0)
>> +		err = genphy_restart_aneg(phydev);
>> +
>> +	return err;
>> +}
>> +
>>  static int bcm54616s_config_aneg(struct phy_device *phydev)
>>  {
>>  	int ret;
>>  
>>  	/* Aneg firsly. */
>> -	ret = genphy_config_aneg(phydev);
>> +	if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX)
>> +		ret = bcm54616s_config_aneg_1000bx(phydev);
>> +	else
>> +		ret = genphy_config_aneg(phydev);
>>  
>>  	/* Then we can set up the delay. */
>>  	bcm54xx_config_clock_delay(phydev);
>> @@ -655,6 +703,8 @@ static struct phy_driver broadcom_drivers[] = {
>>  	.config_aneg	= bcm54616s_config_aneg,
>>  	.ack_interrupt	= bcm_phy_ack_intr,
>>  	.config_intr	= bcm_phy_config_intr,
>> +	.read_status	= bcm54xx_read_status,
> 
> If you use aneg, you should also read what was negotiated.
> But this function reads neither negotiated duplex mode nor
> pause settings.

Let me see how to fix it.. Will come back soon..


Thanks,

Tao

^ permalink raw reply

* Re: linux-next: Signed-off-by missing for commit in the net-next tree
From: Yifeng Sun @ 2019-08-06 23:37 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: David Miller, Networking, Linux Next Mailing List,
	Linux Kernel Mailing List
In-Reply-To: <20190807093037.65ac614e@canb.auug.org.au>

Hi Stephen,

My apologies, thanks for the email. Please add the signed-off if you can.

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>

Thanks,
Yifeng

On Tue, Aug 6, 2019 at 4:30 PM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Hi all,
>
> Commit
>
>   aa733660dbd8 ("openvswitch: Print error when ovs_execute_actions() fails")
>
> is missing a Signed-off-by from its author.
>
> --
> Cheers,
> Stephen Rothwell

^ permalink raw reply

* Re: [PATCH net-next v6 5/6] flow_offload: support get multi-subsystem block
From: wenxu @ 2019-08-06 23:36 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: jakub.kicinski, jiri, netfilter-devel, netdev
In-Reply-To: <20190806161000.3csoy3jlpq6cletq@salvia>


在 2019/8/7 0:10, Pablo Neira Ayuso 写道:
> On Sun, Aug 04, 2019 at 09:24:00PM +0800, wenxu@ucloud.cn wrote:
>> diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h
>> index 8f1a7b8..6022dd0 100644
>> --- a/include/net/flow_offload.h
>> +++ b/include/net/flow_offload.h
> [...]
>> @@ -282,6 +282,8 @@ int flow_block_cb_setup_simple(struct flow_block_offload *f,
>>  }
>>  EXPORT_SYMBOL(flow_block_cb_setup_simple);
>>  
>> +static LIST_HEAD(block_ing_cb_list);
>> +
>>  static struct rhashtable indr_setup_block_ht;
>>  
>>  struct flow_indr_block_cb {
>> @@ -295,7 +297,6 @@ struct flow_indr_block_dev {
>>  	struct rhash_head ht_node;
>>  	struct net_device *dev;
>>  	unsigned int refcnt;
>> -	flow_indr_block_ing_cmd_t  *block_ing_cmd_cb;
>>  	struct list_head cb_list;
>>  };
>>  
>> @@ -389,6 +390,22 @@ static void flow_indr_block_cb_del(struct flow_indr_block_cb *indr_block_cb)
>>  	kfree(indr_block_cb);
>>  }
>>  
>> +static void flow_block_ing_cmd(struct net_device *dev,
>> +			       flow_indr_block_bind_cb_t *cb,
>> +			       void *cb_priv,
>> +			       enum flow_block_command command)
>> +{
>> +	struct flow_indr_block_ing_entry *entry;
>> +
>> +	rcu_read_lock();
>> +
> unnecessary empty line.
>
>> +	list_for_each_entry_rcu(entry, &block_ing_cb_list, list) {
>> +		entry->cb(dev, cb, cb_priv, command);
>> +	}
>> +
>> +	rcu_read_unlock();
> OK, there's rcu_read_lock here...
>
>> +}
>> +
>>  int __flow_indr_block_cb_register(struct net_device *dev, void *cb_priv,
>>  				  flow_indr_block_bind_cb_t *cb,
>>  				  void *cb_ident)
>> @@ -406,10 +423,8 @@ int __flow_indr_block_cb_register(struct net_device *dev, void *cb_priv,
>>  	if (err)
>>  		goto err_dev_put;
>>  
>> -	if (indr_dev->block_ing_cmd_cb)
>> -		indr_dev->block_ing_cmd_cb(dev, indr_block_cb->cb,
>> -					   indr_block_cb->cb_priv,
>> -					   FLOW_BLOCK_BIND);
>> +	flow_block_ing_cmd(dev, indr_block_cb->cb, indr_block_cb->cb_priv,
>> +			   FLOW_BLOCK_BIND);
>>  
>>  	return 0;
>>  
>> @@ -448,10 +463,8 @@ void __flow_indr_block_cb_unregister(struct net_device *dev,
>>  	if (!indr_block_cb)
>>  		return;
>>  
>> -	if (indr_dev->block_ing_cmd_cb)
>> -		indr_dev->block_ing_cmd_cb(dev, indr_block_cb->cb,
>> -					   indr_block_cb->cb_priv,
>> -					   FLOW_BLOCK_UNBIND);
>> +	flow_block_ing_cmd(dev, indr_block_cb->cb, indr_block_cb->cb_priv,
>> +			   FLOW_BLOCK_UNBIND);
>>  
>>  	flow_indr_block_cb_del(indr_block_cb);
>>  	flow_indr_block_dev_put(indr_dev);
>> @@ -469,7 +482,6 @@ void flow_indr_block_cb_unregister(struct net_device *dev,
>>  EXPORT_SYMBOL_GPL(flow_indr_block_cb_unregister);
>>  
>>  void flow_indr_block_call(struct net_device *dev,
>> -			  flow_indr_block_ing_cmd_t cb,
>>  			  struct flow_block_offload *bo,
>>  			  enum flow_block_command command)
>>  {
>> @@ -480,15 +492,24 @@ void flow_indr_block_call(struct net_device *dev,
>>  	if (!indr_dev)
>>  		return;
>>  
>> -	indr_dev->block_ing_cmd_cb = command == FLOW_BLOCK_BIND
>> -				     ? cb : NULL;
>> -
>>  	list_for_each_entry(indr_block_cb, &indr_dev->cb_list, list)
>>  		indr_block_cb->cb(dev, indr_block_cb->cb_priv, TC_SETUP_BLOCK,
>>  				  bo);
>>  }
>>  EXPORT_SYMBOL_GPL(flow_indr_block_call);
>>  
>> +void flow_indr_add_block_ing_cb(struct flow_indr_block_ing_entry *entry)
>> +{
> ... but registration does not protect the list with a mutex.
>
>> +	list_add_tail_rcu(&entry->list, &block_ing_cb_list);
>> +}
>> +EXPORT_SYMBOL_GPL(flow_indr_add_block_ing_cb);

flow_indr_add_block_ing_cb called from tc and nft in different order.
 subsys_initcall(tc_filter_init) and nf_tables_module_init 
It will be called at the same time? 

And any nft need flow_indr_del_block_ing_cb. It also does nedd the lock?


^ permalink raw reply

* [GIT] Networking
From: David Miller @ 2019-08-06 23:35 UTC (permalink / raw)
  To: torvalds; +Cc: akpm, netdev, linux-kernel


Yeah I should have sent a pull request last week, so there is a lot
more here than usual.  Sorry about that:

1) Fix memory leak in ebtables compat code, from Wenwen Wang.

2) Several kTLS bug fixes from Jakub Kicinski (circular close on
   disconnect etc.)

3) Force slave speed check on link state recovery in bonding 802.3ad
   mode, from Thomas Falcon.

4) Clear RX descriptor bits before assigning buffers to them in
   stmmac, from Jose Abreu.

5) Several missing of_node_put() calls, mostly wrt. for_each_*()
   OF loops, from Nishka Dasgupta.

6) Double kfree_skb() in peak_usb can driver, from Stephane Grosjean.

7) Need to hold sock across skb->destructor invocation, from Cong
   Wang.

8) IP header length needs to be validated in ipip tunnel xmit, from
   Haishuang Yan.

9) Use after free in ip6 tunnel driver, also from Haishuang Yan.

10) Do not use MSI interrupts on r8169 chips before RTL8168d, from
    Heiner Kallweit.

11) Upon bridge device init failure, we need to delete the local fdb.
    From Nikolay Aleksandrov.

12) Handle erros from of_get_mac_address() properly in stmmac, from
    Martin Blumenstingl.

13) Handle concurrent rename vs. dump in netfilter ipset, from Jozsef
    Kadlecsik.

14) Setting NETIF_F_LLTX on mac80211 causes complete breakage with
    some devices, so revert.  From Johannes Berg.

15) Fix deadlock in rxrpc, from David Howells.

16) Fix Kconfig deps of enetc driver, we must have PHYLIB.  From Yue
    Haibing.

17) Fix mvpp2 crash on module removal, from Matteo Croce.

18) Fix race in genphy_update_link, from Heiner Kallweit.

19)  bpf_xdp_adjust_head() stopped working with generic XDP when we
     fixes generic XDP to support stacked devices properly, fix from
     Jesper Dangaard Brouer.

20) Unbalanced RCU locking in rt6_update_exception_stamp_rt(), from
    David Ahern.

21) Several memory leaks in new sja1105 driver, from Vladimir Oltean.

Please pull, thanks a lot!

The following changes since commit 7b5cf701ea9c395c792e2a7e3b7caf4c68b87721:

  Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip (2019-07-22 09:30:34 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git 

for you to fetch changes up to feac1d680233a48603213d52230f92222462a1c8:

  Merge branch 'sja1105-fixes' (2019-08-06 14:37:02 -0700)

----------------------------------------------------------------
Alexei Starovoitov (1):
      Merge branch 'fix-gso_segs'

Alexis Bauvin (1):
      tun: mark small packets as owned by the tap sock

Andreas Schwab (1):
      net: phy: mscc: initialize stats array

Andrii Nakryiko (3):
      libbpf: fix SIGSEGV when BTF loading fails, but .BTF.ext exists
      libbpf: sanitize VAR to conservative 1-byte INT
      libbpf: silence GCC8 warning about string truncation

Andy Shevchenko (1):
      net: thunderx: Use fwnode_get_mac_address()

Ariel Levkovich (1):
      net/mlx5e: Prevent encap flow counter update async to user query

Arnaldo Carvalho de Melo (2):
      libbpf: Fix endianness macro usage for some compilers
      libbpf: Avoid designated initializers for unnamed union members

Arnaud Patard (1):
      drivers/net/ethernet/marvell/mvmdio.c: Fix non OF case

Arnd Bergmann (2):
      ovs: datapath: hide clang frame-overflow warnings
      compat_ioctl: pppoe: fix PPPOEIOCSFWD handling

Arseny Solokha (1):
      net: phylink: don't start and stop SGMII PHYs in SFP modules twice

Aya Levin (1):
      net/mlx5e: Fix matching of speed to PRM link modes

Bob Ham (1):
      net: usb: qmi_wwan: Add the BroadMobi BM818 card

Brian Norris (2):
      mac80211: don't WARN on short WMM parameters from AP
      mwifiex: fix 802.11n/WPA detection

Catherine Sullivan (1):
      gve: Fix case where desc_cnt and data_cnt can get out of sync

Chen-Yu Tsai (1):
      net: ethernet: sun4i-emac: Support phy-handle property for finding PHYs

Chris Packham (1):
      fsl/fman: Remove comment referring to non-existent function

Christophe JAILLET (3):
      net: ethernet: et131x: Use GFP_KERNEL instead of GFP_ATOMIC when allocating tx_ring->tcb_ring
      net: ag71xx: Use GFP_KERNEL instead of GFP_ATOMIC in 'ag71xx_rings_init()'
      net: cxgb3_main: Fix a resource leak in a error path in 'init_one()'

Claudiu Manoil (1):
      ocelot: Cancel delayed work before wq destruction

Colin Ian King (3):
      rocker: fix memory leaks of fib_work on two error return paths
      iwlwifi: mvm: fix comparison of u32 variable with less than zero
      mlxsw: spectrum_ptp: fix duplicated check on orig_egr_types

Cong Wang (2):
      netrom: hold sock when setting skb->destructor
      ife: error out when nla attributes are empty

Daniel Borkmann (1):
      Merge branch 'bpf-sockmap-tls-fixes'

David Ahern (1):
      ipv6: Fix unbalanced rcu locking in rt6_update_exception_stamp_rt

David Howells (2):
      rxrpc: Fix potential deadlock
      rxrpc: Fix the lack of notification when sendmsg() fails on a DATA packet

David S. Miller (20):
      Merge branch 'stmmac-fixes'
      Revert "net: hns: fix LED configuration for marvell phy"
      Merge branch 'selftests-forwarding-GRE-multipath-fixes'
      Merge tag 'linux-can-fixes-for-5.3-20190724' of git://git.kernel.org/.../mkl/linux-can
      Merge branch 'dim-fixes'
      Merge git://git.kernel.org/.../bpf/bpf
      Merge tag 'mlx5-fixes-2019-07-25' of git://git.kernel.org/.../saeed/linux
      Merge tag 'rxrpc-fixes-20190730' of git://git.kernel.org/.../dhowells/linux-fs
      Merge branch 'mlxsw-Two-small-fixes'
      Merge git://git.kernel.org/.../pablo/nf
      Merge tag 'mac80211-for-davem-2019-07-31' of git://git.kernel.org/.../jberg/mac80211
      Merge branch 'net-Manufacturer-names-and-spelling-fixes'
      Merge branch 'net-fix-regressions-for-generic-XDP'
      Merge tag 'linux-can-fixes-for-5.3-20190802' of git://git.kernel.org/.../mkl/linux-can
      Merge tag 'wireless-drivers-for-davem-2019-08-06' of git://git.kernel.org/.../kvalo/wireless-drivers
      Merge branch 'stmmac-fixes'
      Merge branch 'Fix-batched-event-generation-for-vlan-action'
      Merge branch 'hisilicon-fixes'
      Merge branch 'flow_offload-action-fixes'
      Merge branch 'sja1105-fixes'

Denis Kirjanov (2):
      net: usb: pegasus: fix improper read if get_registers() fail
      be2net: disable bh with spin_lock in be_process_mcc

Dexuan Cui (1):
      hv_sock: Fix hang when a connection is closed

Dmytro Linkin (1):
      net: sched: use temporary variable for actions indexes

Edward Srouji (1):
      net/mlx5: Fix modify_cq_in alignment

Emmanuel Grumbach (8):
      iwlwifi: mvm: prepare the ground for more RSS notifications
      iwlwifi: mvm: add a new RSS sync notification for NSSN sync
      iwlwiif: mvm: refactor iwl_mvm_notify_rx_queue
      iwlwifi: mvm: add a loose synchronization of the NSSN across Rx queues
      iwlwifi: mvm: fix frame drop from the reordering buffer
      iwlwifi: don't unmap as page memory that was mapped as single
      iwlwifi: mvm: fix an out-of-bound access
      iwlwifi: mvm: fix a use-after-free bug in iwl_mvm_tx_tso_segment

Enrico Weigelt (1):
      net: sctp: drop unneeded likely() call around IS_ERR()

Eric Dumazet (2):
      bpf: fix access to skb_shared_info->gso_segs
      selftests/bpf: add another gso_segs access

Florian Westphal (1):
      netfilter: ebtables: also count base chain policies

Frode Isaksen (1):
      net: stmmac: Use netif_tx_napi_add() for TX polling function

Geert Uytterhoeven (9):
      net: mediatek: Drop unneeded dependency on NET_VENDOR_MEDIATEK
      net: 8390: Fix manufacturer name in Kconfig help text
      net: amd: Spelling s/case/cause/
      net: apple: Fix manufacturer name in Kconfig help text
      net: broadcom: Fix manufacturer name in Kconfig help text
      net: ixp4xx: Spelling s/XSacle/XScale/
      net: nixge: Spelling s/Instrument/Instruments/
      net: packetengines: Fix manufacturer spelling and capitalization
      net: samsung: Spelling s/case/cause/

Gregory Greenman (4):
      iwlwifi: mvm: add a wrapper around rs_tx_status to handle locks
      iwlwifi: mvm: send LQ command always ASYNC
      iwlwifi: mvm: replace RS mutex with a spin_lock
      iwlwifi: mvm: fix possible out-of-bounds read when accessing lq_info

Gustavo A. R. Silva (11):
      arcnet: com90xx: Mark expected switch fall-throughs
      arcnet: com90io: Mark expected switch fall-throughs
      arcnet: arc-rimi: Mark expected switch fall-throughs
      arcnet: com20020-isa: Mark expected switch fall-throughs
      net/af_iucv: mark expected switch fall-throughs
      net: ehea: Mark expected switch fall-through
      net: spider_net: Mark expected switch fall-through
      net: wan: sdla: Mark expected switch fall-through
      net: hamradio: baycom_epp: Mark expected switch fall-through
      net: smc911x: Mark expected switch fall-through
      atm: iphase: Fix Spectre v1 vulnerability

Haishuang Yan (3):
      ip6_gre: reload ipv6h in prepare_ip6gre_xmit_ipv6
      ipip: validate header length in ipip_tunnel_xmit
      ip6_tunnel: fix possible use-after-free on xmit

Heiner Kallweit (3):
      Revert ("r8169: remove 1000/Half from supported modes")
      r8169: don't use MSI before RTL8168d
      net: phy: fix race in genphy_update_link

Hubert Feurstein (3):
      net: phy: fixed_phy: print gpio error only if gpio node is present
      net: dsa: mv88e6xxx: use link-down-define instead of plain value
      net: dsa: mv88e6xxx: drop adjust_link to enabled phylink

Ido Schimmel (3):
      selftests: forwarding: gre_multipath: Enable IPv4 forwarding
      selftests: forwarding: gre_multipath: Fix flower filters
      drop_monitor: Add missing uAPI file to MAINTAINERS file

Ihab Zhaika (1):
      iwlwifi: add 3 new IDs for the 9000 series (iwl9260_2ac_160_cfg)

Ilya Leoshkevich (2):
      selftests/bpf: fix sendmsg6_prog on s390
      bpf: fix narrower loads on s390

Ilya Maximets (1):
      libbpf: fix using uninitialized ioctl results

Jakub Kicinski (12):
      net/tls: don't arm strparser immediately in tls_set_sw_offload()
      net/tls: don't call tls_sk_proto_close for hw record offload
      selftests/tls: add a test for ULP but no keys
      selftests/tls: test error codes around TLS ULP installation
      selftests/tls: add a bidirectional test
      selftests/tls: close the socket with open record
      selftests/tls: add shutdown tests
      net/tls: add myself as a co-maintainer
      selftests/net: add missing gitignores (ipv6_flowlabel)
      selftests/tls: fix TLS tests with CONFIG_TLS=n
      net/tls: partially revert fix transition through disconnect with close
      selftests/tls: add a litmus test for the socket reuse through shutdown

Jesper Dangaard Brouer (5):
      MAINTAINERS: Remove mailing-list entry for XDP (eXpress Data Path)
      bpf: fix XDP vlan selftests test_xdp_vlan.sh
      selftests/bpf: add wrapper scripts for test_xdp_vlan.sh
      selftests/bpf: reduce time to execute test_xdp_vlan.sh
      net: fix bpf_xdp_adjust_head regression for generic-XDP

Jia-Ju Bai (5):
      isdn: mISDN: hfcsusb: Fix possible null-pointer dereferences in start_isoc_chain()
      net: rds: Fix possible null-pointer dereferences in rds_rdma_cm_event_handler_cmn()
      mac80211_hwsim: Fix possible null-pointer dereferences in hwsim_dump_radio_nl()
      net: sched: Fix a possible null-pointer dereference in dequeue_func()
      net: phy: phy_led_triggers: Fix a possible null-pointer dereference in phy_led_trigger_change_speed()

Jiangfeng Xiao (3):
      net: hisilicon: make hip04_tx_reclaim non-reentrant
      net: hisilicon: fix hip04-xmit never return TX_BUSY
      net: hisilicon: Fix dma_map_single failed on arm64

Jiri Pirko (2):
      net: fix ifindex collision during namespace removal
      mlxsw: spectrum: Fix error path in mlxsw_sp_module_init()

Joakim Zhang (1):
      can: flexcan: fix stop mode acknowledgment

Johan Hovold (1):
      NFC: nfcmrvl: fix gpio-handling regression

Johannes Berg (3):
      Revert "mac80211: set NETIF_F_LLTX when using intermediate tx queues"
      iwlwifi: mvm: disable TX-AMSDU on older NICs
      iwlwifi: fix locking in delayed GTK setting

John Fastabend (7):
      net/tls: remove close callback sock unlock/lock around TX work flush
      net/tls: remove sock unlock/lock around strp_done()
      net/tls: fix transition through disconnect with close
      bpf: sockmap, sock_map_delete needs to use xchg
      bpf: sockmap, synchronize_rcu before free'ing map
      bpf: sockmap, only create entry if ulp is not already enabled
      bpf: sockmap/tls, close can race with map free

Jon Maloy (1):
      tipc: fix unitilized skb list crash

Jose Abreu (7):
      net: stmmac: RX Descriptors need to be clean before setting buffers
      net: stmmac: Use kcalloc() instead of kmalloc_array()
      net: stmmac: Do not cut down 1G modes
      net: stmmac: Sync RX Buffer upon allocation
      net: stmmac: xgmac: Fix XGMAC selftests
      net: stmmac: Fix issues when number of Queues >= 4
      net: stmmac: tc: Do not return a fragment entry

Jozsef Kadlecsik (1):
      netfilter: ipset: Fix rename concurrency with listing

Juliana Rodrigueiro (1):
      isdn: hfcsusb: Fix mISDN driver crash caused by transfer buffer on the stack

Kalle Valo (1):
      Merge tag 'iwlwifi-fixes-for-kvalo-2019-07-30' of git://git.kernel.org/.../iwlwifi/iwlwifi-fixes

Kevin Lo (1):
      r8152: fix typo in register name

Leon Romanovsky (1):
      lib/dim: Fix -Wunused-const-variable warnings

Luca Coelho (2):
      iwlwifi: mvm: don't send GEO_TX_POWER_LIMIT on version < 41
      iwlwifi: mvm: fix version check for GEO_TX_POWER_LIMIT support

Manikanta Pubbisetty (1):
      {nl,mac}80211: fix interface combinations on crypto controlled devices

Maor Gottlieb (1):
      net/mlx5: Add missing RDMA_RX capabilities

Mark Zhang (1):
      net/mlx5: Use reversed order when unregister devices

Martin Blumenstingl (1):
      net: stmmac: manage errors returned by of_get_mac_address()

Masahiro Yamada (1):
      netfilter: add include guard to xt_connlabel.h

Matteo Croce (3):
      mvpp2: refactor MTU change code
      mvpp2: refactor the HW checksum setup
      mvpp2: fix panic on module removal

Mauro Rossi (1):
      iwlwifi: dbg_ini: fix compile time assert build errors

Maxime Chevallier (1):
      net: mvpp2: Don't check for 3 consecutive Idle frames for 10G links

Michal Kalderon (1):
      qed: RDMA - Fix the hw_ver returned in device attributes

Mordechay Goodstein (1):
      iwlwifi: mvm: avoid races in rate init and rate perform

Navid Emamdoost (2):
      st21nfca_connectivity_event_received: null check the allocation
      st_nci_hci_connectivity_event_received: null check the allocation

Nikita Yushchenko (1):
      can: rcar_canfd: fix possible IRQ storm on high load

Nikolay Aleksandrov (3):
      net: bridge: delete local fdb on device init failure
      net: bridge: mcast: don't delete permanent entries when fast leave is enabled
      net: bridge: move default pvid init/deinit to NETDEV_REGISTER/UNREGISTER

Nishka Dasgupta (3):
      net: dsa: mv88e6xxx: chip: Add of_node_put() before return
      net: dsa: sja1105: sja1105_main: Add of_node_put()
      net: dsa: qca8k: Add of_node_put() in qca8k_setup_mdio_bus()

Pablo Neira Ayuso (1):
      Merge branch 'master' of git://blackhole.kfki.hu/nf

Paul Bolle (1):
      gigaset: stop maintaining seperately

Pavel Machek (1):
      net/ipv4: cleanup error condition testing

Petr Machata (2):
      mlxsw: spectrum_ptp: Increase parsing depth when PTP is enabled
      mlxsw: spectrum_buffers: Further reduce pool size on Spectrum-2

Phil Sutter (2):
      netfilter: nf_tables: Make nft_meta expression more robust
      netfilter: nft_meta_bridge: Eliminate 'out' label

Qian Cai (2):
      net/socket: fix GCC8+ Wpacked-not-aligned warnings
      net/mlx5e: always initialize frag->last_in_page

Rasmus Villemoes (1):
      can: dev: call netif_carrier_off() in register_candev()

René van Dorst (1):
      net: phylink: Fix flow control for fixed-link

Roman Mashak (2):
      net sched: update vlan action for batched events operations
      tc-testing: updated vlan action tests with batch create/delete

Shahar S Matityahu (2):
      iwlwifi: dbg_ini: move iwl_dbg_tlv_load_bin out of debug override ifdef
      iwlwifi: dbg_ini: move iwl_dbg_tlv_free outside of debugfs ifdef

Stefano Brivio (2):
      netfilter: ipset: Actually allow destination MAC address for hash:ip,mac sets too
      netfilter: ipset: Copy the right MAC address in bitmap:ip,mac and hash:ip,mac sets

Stephane Grosjean (1):
      can: peak_usb: fix potential double kfree_skb()

Subash Abhinov Kasiviswanathan (1):
      net: qualcomm: rmnet: Fix incorrect UL checksum offload logic

Sudarsana Reddy Kalluru (1):
      bnx2x: Disable multi-cos feature.

Takashi Iwai (1):
      sky2: Disable MSI on ASUS P6T

Taras Kondratiuk (1):
      tipc: compat: allow tipc commands without arguments

Tariq Toukan (4):
      net/mlx5e: Fix wrong max num channels indication
      net/mlx5e: kTLS, Call WARN_ONCE on netdev mismatch
      nfp: tls: rename tls packet counters
      Documentation: TLS: fix stat counters description

Thomas Falcon (1):
      bonding: Force slave speed check after link state recovery for 802.3ad

Tomas Bortoli (2):
      can: peak_usb: pcan_usb_fd: Fix info-leaks to USB devices
      can: peak_usb: pcan_usb_pro: Fix info-leaks to USB devices

Ursula Braun (2):
      net/smc: do not schedule tx_work in SMC_CLOSED state
      net/smc: avoid fallback in case of non-blocking connect

Vlad Buslov (2):
      net: sched: police: allow accessing police->params with rtnl
      net: sched: sample: allow accessing psample_group with rtnl

Vladimir Oltean (5):
      net: dsa: sja1105: Fix broken learning with vlan_filtering disabled
      net: dsa: sja1105: Use the LOCKEDS bit for SJA1105 E/T as well
      net: dsa: sja1105: Really fix panic on unregistering PTP clock
      net: dsa: sja1105: Fix memory leak on meta state machine normal path
      net: dsa: sja1105: Fix memory leak on meta state machine error path

Wang Xiayang (3):
      can: sja1000: force the string buffer NULL-terminated
      can: peak_usb: force the string buffer NULL-terminated
      net/ethernet/qlogic/qed: force the string buffer NULL-terminated

Weitao Hou (1):
      can: mcp251x: add error check when wq alloc failed

Wen Yang (1):
      can: flexcan: fix an use-after-free in flexcan_setup_stop_mode()

Wenwen Wang (1):
      netfilter: ebtables: fix a memory leak bug in compat

Yamin Friedman (1):
      linux/dim: Fix overflow in dim calculation

Yonglong Liu (1):
      net: hns: fix LED configuration for marvell phy

YueHaibing (3):
      can: gw: Fix error path of cgw_module_init
      enetc: Fix build error without PHYLIB
      enetc: Select PHYLIB while CONFIG_FSL_ENETC_VF is set

xiaofeis (1):
      net: dsa: qca8k: enable port flow control

 Documentation/networking/tls-offload.rst                      |  23 +++-
 MAINTAINERS                                                   |  10 +-
 drivers/atm/iphase.c                                          |   8 +-
 drivers/isdn/hardware/mISDN/hfcsusb.c                         |  13 +-
 drivers/net/arcnet/arc-rimi.c                                 |   3 +
 drivers/net/arcnet/com20020-isa.c                             |   6 +
 drivers/net/arcnet/com90io.c                                  |   2 +
 drivers/net/arcnet/com90xx.c                                  |   3 +
 drivers/net/bonding/bond_main.c                               |   9 ++
 drivers/net/can/dev.c                                         |   2 +
 drivers/net/can/flexcan.c                                     |  39 ++++--
 drivers/net/can/rcar/rcar_canfd.c                             |   9 +-
 drivers/net/can/sja1000/peak_pcmcia.c                         |   2 +-
 drivers/net/can/spi/mcp251x.c                                 |  49 ++++----
 drivers/net/can/usb/peak_usb/pcan_usb_core.c                  |  10 +-
 drivers/net/can/usb/peak_usb/pcan_usb_fd.c                    |   2 +-
 drivers/net/can/usb/peak_usb/pcan_usb_pro.c                   |   2 +-
 drivers/net/dsa/mv88e6xxx/chip.c                              |  29 +----
 drivers/net/dsa/qca8k.c                                       |  10 +-
 drivers/net/dsa/sja1105/sja1105_dynamic_config.c              |  14 ++-
 drivers/net/dsa/sja1105/sja1105_main.c                        | 143 +++++++++------------
 drivers/net/dsa/sja1105/sja1105_ptp.c                         |   7 +-
 drivers/net/ethernet/8390/Kconfig                             |   4 +-
 drivers/net/ethernet/agere/et131x.c                           |   2 +-
 drivers/net/ethernet/allwinner/sun4i-emac.c                   |   4 +-
 drivers/net/ethernet/amd/Kconfig                              |   2 +-
 drivers/net/ethernet/apple/Kconfig                            |   4 +-
 drivers/net/ethernet/atheros/ag71xx.c                         |   2 +-
 drivers/net/ethernet/broadcom/Kconfig                         |   6 +-
 drivers/net/ethernet/broadcom/bcmsysport.c                    |   2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c               |   3 +-
 drivers/net/ethernet/broadcom/bnxt/bnxt.c                     |   2 +-
 drivers/net/ethernet/broadcom/genet/bcmgenet.c                |   2 +-
 drivers/net/ethernet/cavium/thunder/thunder_bgx.c             |  18 +--
 drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c               |   5 +-
 drivers/net/ethernet/emulex/benet/be_cmds.c                   |   6 +-
 drivers/net/ethernet/emulex/benet/be_main.c                   |   2 -
 drivers/net/ethernet/freescale/enetc/Kconfig                  |   2 +
 drivers/net/ethernet/freescale/fman/fman.c                    |   3 -
 drivers/net/ethernet/google/gve/gve.h                         |   8 +-
 drivers/net/ethernet/google/gve/gve_ethtool.c                 |   4 +-
 drivers/net/ethernet/google/gve/gve_rx.c                      |  34 +++--
 drivers/net/ethernet/hisilicon/hip04_eth.c                    |  28 +++--
 drivers/net/ethernet/ibm/ehea/ehea_main.c                     |   2 +-
 drivers/net/ethernet/marvell/mvmdio.c                         |  31 +++--
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c               |  87 ++++++-------
 drivers/net/ethernet/marvell/sky2.c                           |   7 ++
 drivers/net/ethernet/mediatek/Kconfig                         |   1 -
 drivers/net/ethernet/mellanox/mlx5/core/dev.c                 |   2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en.h                  |  12 +-
 drivers/net/ethernet/mellanox/mlx5/core/en/params.h           |   5 +-
 drivers/net/ethernet/mellanox/mlx5/core/en/port.c             |  27 ++--
 drivers/net/ethernet/mellanox/mlx5/core/en/port.h             |   6 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c    |   2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c          |  69 +++++++----
 drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c       |   3 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c             |  41 +++----
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c              |   2 +
 drivers/net/ethernet/mellanox/mlx5/core/en_stats.c            |   8 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c               |   4 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c             |   4 +-
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.h             |   5 +-
 drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c         |   5 +
 drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c         |   7 +-
 drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c    |   1 +
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c                |   2 +-
 drivers/net/ethernet/mellanox/mlxsw/spectrum.h                |   4 +
 drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c        |   4 +-
 drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c            |   1 +
 drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.h            |   1 +
 drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c      |  76 +++++++++---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c            |  17 +++
 drivers/net/ethernet/mscc/ocelot.c                            |   1 +
 drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c          |   4 +-
 drivers/net/ethernet/ni/Kconfig                               |   2 +-
 drivers/net/ethernet/packetengines/Kconfig                    |   6 +-
 drivers/net/ethernet/packetengines/Makefile                   |   2 +-
 drivers/net/ethernet/qlogic/qed/qed_int.c                     |   2 +-
 drivers/net/ethernet/qlogic/qed/qed_rdma.c                    |   2 +-
 drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c          |  13 +-
 drivers/net/ethernet/realtek/r8169_main.c                     |  14 ++-
 drivers/net/ethernet/rocker/rocker_main.c                     |   2 +
 drivers/net/ethernet/samsung/Kconfig                          |   2 +-
 drivers/net/ethernet/smsc/smc911x.c                           |   1 +
 drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c             |   4 +
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h                |   7 +-
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c           |  87 +++++++++++--
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c             |  50 ++++----
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c         |   7 ++
 drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c               |   2 +-
 drivers/net/ethernet/toshiba/spider_net.c                     |   1 +
 drivers/net/ethernet/xscale/Kconfig                           |   2 +-
 drivers/net/hamradio/baycom_epp.c                             |   3 +-
 drivers/net/phy/fixed_phy.c                                   |   6 +-
 drivers/net/phy/mscc.c                                        |  16 +--
 drivers/net/phy/phy_device.c                                  |   6 +
 drivers/net/phy/phy_led_triggers.c                            |   3 +-
 drivers/net/phy/phylink.c                                     |  10 +-
 drivers/net/ppp/pppoe.c                                       |   3 +
 drivers/net/ppp/pppox.c                                       |  13 ++
 drivers/net/ppp/pptp.c                                        |   3 +
 drivers/net/tun.c                                             |   9 +-
 drivers/net/usb/pegasus.c                                     |   2 +-
 drivers/net/usb/qmi_wwan.c                                    |   1 +
 drivers/net/usb/r8152.c                                       |  12 +-
 drivers/net/wan/sdla.c                                        |   1 +
 drivers/net/wireless/intel/iwlwifi/fw/api/rx.h                |   3 +-
 drivers/net/wireless/intel/iwlwifi/fw/dbg.c                   |  22 ++--
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c                  |   4 +-
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c                   |  29 +++--
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c             |  58 ++++++---
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h                  |   8 +-
 drivers/net/wireless/intel/iwlwifi/mvm/nvm.c                  |   2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c                  |   4 +-
 drivers/net/wireless/intel/iwlwifi/mvm/rs.c                   | 539 +++++++++++++++++++++++++++++++++++++++++++-------------------------------------
 drivers/net/wireless/intel/iwlwifi/mvm/rs.h                   |   3 +-
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c                 | 185 ++++++++++++++++++++--------
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c                  |   6 +-
 drivers/net/wireless/intel/iwlwifi/mvm/sta.h                  |  12 +-
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c                   |   3 +-
 drivers/net/wireless/intel/iwlwifi/mvm/utils.c                |   4 +-
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c                 |   3 +
 drivers/net/wireless/intel/iwlwifi/pcie/tx.c                  |   2 +
 drivers/net/wireless/mac80211_hwsim.c                         |   8 +-
 drivers/net/wireless/marvell/mwifiex/main.h                   |   1 +
 drivers/net/wireless/marvell/mwifiex/scan.c                   |   3 +-
 drivers/nfc/nfcmrvl/main.c                                    |   4 +-
 drivers/nfc/nfcmrvl/uart.c                                    |   4 +-
 drivers/nfc/nfcmrvl/usb.c                                     |   1 +
 drivers/nfc/st-nci/se.c                                       |   2 +
 drivers/nfc/st21nfca/se.c                                     |   2 +
 fs/compat_ioctl.c                                             |   3 -
 include/linux/dim.h                                           |  56 ---------
 include/linux/filter.h                                        |  13 ++
 include/linux/if_pppox.h                                      |   3 +
 include/linux/if_rmnet.h                                      |   4 +-
 include/linux/mlx5/fs.h                                       |   1 +
 include/linux/mlx5/mlx5_ifc.h                                 |   6 +-
 include/linux/skmsg.h                                         |   8 +-
 include/net/cfg80211.h                                        |  15 +++
 include/net/tc_act/tc_police.h                                |   4 +-
 include/net/tc_act/tc_sample.h                                |   2 +-
 include/net/tcp.h                                             |   3 +
 include/net/tls.h                                             |  13 +-
 include/uapi/linux/netfilter/xt_connlabel.h                   |   6 +
 include/uapi/linux/socket.h                                   |  19 ++-
 kernel/bpf/verifier.c                                         |   4 +-
 lib/dim/dim.c                                                 |   4 +-
 lib/dim/net_dim.c                                             |  56 +++++++++
 net/bridge/br.c                                               |   5 +-
 net/bridge/br_multicast.c                                     |   3 +
 net/bridge/br_private.h                                       |   9 +-
 net/bridge/br_vlan.c                                          |  29 +++--
 net/bridge/netfilter/ebtables.c                               |  32 +++--
 net/bridge/netfilter/nft_meta_bridge.c                        |  10 +-
 net/can/gw.c                                                  |  48 +++++---
 net/core/dev.c                                                |  17 ++-
 net/core/filter.c                                             |   6 +-
 net/core/skmsg.c                                              |   4 +-
 net/core/sock_map.c                                           |  19 ++-
 net/dsa/tag_sja1105.c                                         |  12 +-
 net/ipv4/inet_fragment.c                                      |   2 +-
 net/ipv4/ipip.c                                               |   3 +
 net/ipv4/tcp_ulp.c                                            |  13 ++
 net/ipv6/ip6_gre.c                                            |   3 +-
 net/ipv6/ip6_tunnel.c                                         |   6 +-
 net/ipv6/route.c                                              |   2 +-
 net/iucv/af_iucv.c                                            |  14 ++-
 net/l2tp/l2tp_ppp.c                                           |   3 +
 net/mac80211/iface.c                                          |   1 -
 net/mac80211/mlme.c                                           |  10 ++
 net/mac80211/util.c                                           |   7 +-
 net/netfilter/ipset/ip_set_bitmap_ipmac.c                     |   2 +-
 net/netfilter/ipset/ip_set_core.c                             |   2 +-
 net/netfilter/ipset/ip_set_hash_ipmac.c                       |   6 +-
 net/netfilter/nft_meta.c                                      |  16 +--
 net/netrom/af_netrom.c                                        |   1 +
 net/openvswitch/datapath.c                                    |  15 +--
 net/rds/rdma_transport.c                                      |   5 +-
 net/rxrpc/ar-internal.h                                       |   1 +
 net/rxrpc/peer_event.c                                        |   2 +-
 net/rxrpc/peer_object.c                                       |  18 +++
 net/rxrpc/sendmsg.c                                           |   1 +
 net/sched/act_bpf.c                                           |   9 +-
 net/sched/act_connmark.c                                      |   9 +-
 net/sched/act_csum.c                                          |   9 +-
 net/sched/act_ct.c                                            |   9 +-
 net/sched/act_ctinfo.c                                        |   9 +-
 net/sched/act_gact.c                                          |   8 +-
 net/sched/act_ife.c                                           |  13 +-
 net/sched/act_mirred.c                                        |  13 +-
 net/sched/act_mpls.c                                          |   8 +-
 net/sched/act_nat.c                                           |   9 +-
 net/sched/act_pedit.c                                         |  10 +-
 net/sched/act_police.c                                        |   8 +-
 net/sched/act_sample.c                                        |  10 +-
 net/sched/act_simple.c                                        |  10 +-
 net/sched/act_skbedit.c                                       |  11 +-
 net/sched/act_skbmod.c                                        |  11 +-
 net/sched/act_tunnel_key.c                                    |   8 +-
 net/sched/act_vlan.c                                          |  25 ++--
 net/sched/sch_codel.c                                         |   6 +-
 net/sctp/socket.c                                             |   4 +-
 net/smc/af_smc.c                                              |  15 ++-
 net/tipc/netlink_compat.c                                     |  11 +-
 net/tipc/socket.c                                             |   3 +-
 net/tls/tls_main.c                                            |  97 +++++++++------
 net/tls/tls_sw.c                                              |  83 +++++++++----
 net/vmw_vsock/hyperv_transport.c                              |   8 ++
 net/wireless/core.c                                           |   6 +-
 net/wireless/nl80211.c                                        |   4 +-
 net/wireless/util.c                                           |  27 +++-
 tools/lib/bpf/btf.c                                           |   5 +-
 tools/lib/bpf/libbpf.c                                        |  34 +++--
 tools/lib/bpf/xsk.c                                           |  11 +-
 tools/testing/selftests/bpf/Makefile                          |   3 +-
 tools/testing/selftests/bpf/progs/sendmsg6_prog.c             |   3 +-
 tools/testing/selftests/bpf/test_xdp_vlan.sh                  |  57 +++++++--
 tools/testing/selftests/bpf/test_xdp_vlan_mode_generic.sh     |   9 ++
 tools/testing/selftests/bpf/test_xdp_vlan_mode_native.sh      |   9 ++
 tools/testing/selftests/bpf/verifier/ctx_skb.c                |  11 ++
 tools/testing/selftests/net/.gitignore                        |   4 +-
 tools/testing/selftests/net/forwarding/gre_multipath.sh       |  28 +++--
 tools/testing/selftests/net/tls.c                             | 223 +++++++++++++++++++++++++++++++++
 tools/testing/selftests/tc-testing/tc-tests/actions/vlan.json |  94 ++++++++++++++
 225 files changed, 2402 insertions(+), 1274 deletions(-)
 create mode 100755 tools/testing/selftests/bpf/test_xdp_vlan_mode_generic.sh
 create mode 100755 tools/testing/selftests/bpf/test_xdp_vlan_mode_native.sh

^ permalink raw reply

* Re: [net] ixgbe: fix possible deadlock in ixgbe_service_task()
From: David Miller @ 2019-08-06 21:51 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: ap420073, netdev, nhorman, sassmann, andrewx.bowers
In-Reply-To: <20190805200403.23512-1-jeffrey.t.kirsher@intel.com>

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Mon,  5 Aug 2019 13:04:03 -0700

> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index cbaf712d6529..3386e752e458 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -7898,9 +7898,7 @@ static void ixgbe_service_task(struct work_struct *work)
>  	}
>  	if (ixgbe_check_fw_error(adapter)) {
>  		if (!test_bit(__IXGBE_DOWN, &adapter->state)) {
> -			rtnl_lock();
>  			unregister_netdev(adapter->netdev);
> -			rtnl_unlock();
>  		}

Please remove the (now unnecessary) curly braces for this basic block.

Thank you.

^ permalink raw reply

* linux-next: Signed-off-by missing for commit in the net-next tree
From: Stephen Rothwell @ 2019-08-06 23:30 UTC (permalink / raw)
  To: David Miller, Networking
  Cc: Linux Next Mailing List, Linux Kernel Mailing List, Yifeng Sun

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

Hi all,

Commit

  aa733660dbd8 ("openvswitch: Print error when ovs_execute_actions() fails")

is missing a Signed-off-by from its author.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply

* Re: [PATCH v1 2/2] net: npcm: add NPCM7xx EMC 10/100 Ethernet driver
From: Willem de Bruijn @ 2019-08-06 22:51 UTC (permalink / raw)
  To: Avi Fishman
  Cc: Patrick Venture, Nancy Yuen, Benjamin Fair, David Miller,
	Rob Herring, Mark Rutland, Greg Kroah-Hartman, Tomer Maimon,
	Tali Perry, OpenBMC Maillist, Network Development, devicetree,
	linux-kernel, Thomas Gleixner
In-Reply-To: <CAKKbWA6hjxupFQNnTUOfeKLXd2wtZ9+g7uUpe34CeErn5kBAaA@mail.gmail.com>

> > Does this device support stacked VLAN?
> I am not familiar with stacked VLAN.
> Our HW for sure there is no support. can the SW stack handle it for me?
> Does it mean that  the packets can be larger?

If the device does not support it, I believe it's fine to leave it to S/W.

> > Is this really the device maximum?
>
> The device can support upto 64KB, but of course I will not allocate
> for each RX data such a big buffer.
> Can I know what is the maximum value the network stack may request? I
> saw many driver allocating 1536 for each packet.

The maximum is the minimum of the link layer and device h/w limits,
but you indeed don't want to allocate for worst case if that is highly
unlikely.

Your choice of 1500 is fine for this initial commit, really. More on
MTU below with ndo_change_mtu

> > > +       rxd_offset = (readl((ether->reg + REG_CRXDSA)) -
> > > +                     readl((ether->reg + REG_RXDLSA)))
> > > +               / sizeof(struct npcm7xx_txbd);
> > > +       DUMP_PRINT("RXD offset    %6d\n", rxd_offset);
> > > +       DUMP_PRINT("cur_rx        %6d\n", ether->cur_rx);
> > > +       DUMP_PRINT("rx_err        %6d\n", ether->rx_err);
> > > +       ether->rx_err = 0;
> > > +       DUMP_PRINT("rx_berr       %6d\n", ether->rx_berr);
> > > +       ether->rx_berr = 0;
> > > +       DUMP_PRINT("rx_stuck      %6d\n", ether->rx_stuck);
> > > +       ether->rx_stuck = 0;
> > > +       DUMP_PRINT("rdu           %6d\n", ether->rdu);
> > > +       ether->rdu = 0;
> > > +       DUMP_PRINT("rxov rx       %6d\n", ether->rxov);
> > > +       ether->rxov = 0;
> > > +       /* debug counters */
> > > +       DUMP_PRINT("rx_int_count  %6d\n", ether->rx_int_count);
> > > +       ether->rx_int_count = 0;
> > > +       DUMP_PRINT("rx_err_count  %6d\n", ether->rx_err_count);
> > > +       ether->rx_err_count = 0;
> >
> > Basic counters like tx_packets and rx_errors are probably better
> > exported regardless of debug level as net_device_stats. And then don't
> > need to be copied in debug output.
>
> They are also exported there, see below ether->stats.tx_packets++; and
> ether->stats.rx_errors++;
> those are different counters for debug since we had HW issues that we
> needed to workaround and might need them for future use.
> Currently the driver is stable on millions of parts in the field.
>
> >
> > Less standard counters like tx interrupt count are probably better
> > candidates for ethtool -S.
>
> I don't have support for ethtool.
> is it a must? it is quite some work and this driver is already in the
> field for quite some years.

Your driver includes a struct ethtool_ops. Implementing its callback
.get_ethtool_stats seems straightforward?

David also requested using standard infrastructure over this custom
debug logic. Ethool stats appear the most logical choice to me. But
there may be others.

> > > +static struct sk_buff *get_new_skb(struct net_device *netdev, u32 i)
> > > +{
> > > +       __le32 buffer;
> > > +       struct npcm7xx_ether *ether = netdev_priv(netdev);
> > > +       struct sk_buff *skb = netdev_alloc_skb(netdev,
> > > +               roundup(MAX_PACKET_SIZE_W_CRC, 4));
> > > +
> > > +       if (unlikely(!skb)) {
> > > +               if (net_ratelimit())
> > > +                       netdev_warn(netdev, "failed to allocate rx skb\n");
> >
> > can use net_warn_ratelimited (here and elsewhere)
>
> should I replace every netdev_warn/err/info with net_warn/err/inf_ratelimited?
> I saw in drivers that are using net_warn_ratelimited, that many time
> uses also netdev_warn/err/info

They probably use the second in non-ratelimited cases?

> > > +static irqreturn_t npcm7xx_tx_interrupt(int irq, void *dev_id)
> > > +{
> > > +       struct npcm7xx_ether *ether;
> > > +       struct platform_device *pdev;
> > > +       struct net_device *netdev;
> > > +       __le32 status;
> > > +       unsigned long flags;
> > > +
> > > +       netdev = dev_id;
> > > +       ether = netdev_priv(netdev);
> > > +       pdev = ether->pdev;
> > > +
> > > +       npcm7xx_get_and_clear_int(netdev, &status, 0xFFFF0000);
> > > +
> > > +       ether->tx_int_count++;
> > > +
> > > +       if (status & MISTA_EXDEF)
> > > +               dev_err(&pdev->dev, "emc defer exceed interrupt status=0x%08X\n"
> > > +                       , status);
> > > +       else if (status & MISTA_TXBERR) {
> > > +               dev_err(&pdev->dev, "emc bus error interrupt status=0x%08X\n",
> > > +                       status);
> > > +#ifdef CONFIG_NPCM7XX_EMC_ETH_DEBUG
> > > +               npcm7xx_info_print(netdev);
> > > +#endif
> > > +               spin_lock_irqsave(&ether->lock, flags);
> >
> > irqsave in hard interrupt context?
>
> I need to protect my REG_MIEN register that is changed in other places.
> I think that spin_lock_irqsave() is relevant when working in SMP,
> since other CPU may still be running.
> Isn't it?

This is an interesting case. The hardware interrupt handler will not
interrupt itself. But it is architecture dependent whether all
interrupts are disabled when a particular interrupt handler is running
(as per the unreliable guide to locking).

So even in absence of SMP, this would indeed need spin_lock_irqsave if
there are multiple hardware interrupt handlers potentially accessing
the same data. That sounds unlikely in general, but does happen here
for REG_MIEN, in npcm7xx_tx_interrupt and npcm7xx_rx_interrupt. So I
was mistaken, this is not only the most conservative locking method,
it is indeed required.

>
> >
> > > +               writel(0, (ether->reg + REG_MIEN)); /* disable any interrupt */
> > > +               spin_unlock_irqrestore(&ether->lock, flags);
> > > +               ether->need_reset = 1;
> > > +       } else if (status & ~(MISTA_TXINTR | MISTA_TXCP | MISTA_TDU))
> > > +               dev_err(&pdev->dev, "emc other error interrupt status=0x%08X\n",
> > > +                       status);
> > > +
> > > +    /* if we got MISTA_TXCP | MISTA_TDU remove those interrupt and call napi */
> >
> > The goal of napi is to keep interrupts disabled until napi completes.
>
> We have a HW issue that because of it I still enabled TX complete interrupt,
> I will see if I can disable all interrupts and only leave the error interrupts

Please do. I'm not sure what happens when trying to schedule napi
while it is already scheduled or running. Even in the best case
(nothing), these spurious interrupts are inefficient.

> >
> > > +       if (status & (MISTA_TXCP | MISTA_TDU) &
> > > +           readl((ether->reg + REG_MIEN))) {
> > > +               __le32 reg_mien;
> > > +
> > > +               spin_lock_irqsave(&ether->lock, flags);
> > > +               reg_mien = readl((ether->reg + REG_MIEN));
> > > +               if (reg_mien & ENTDU)
> > > +                       /* Disable TDU interrupt */
> > > +                       writel(reg_mien & (~ENTDU), (ether->reg + REG_MIEN));
> > > +
> > > +               spin_unlock_irqrestore(&ether->lock, flags);
> > > +
> > > +               if (status & MISTA_TXCP)
> > > +                       ether->tx_cp_i++;
> > > +               if (status & MISTA_TDU)
> > > +                       ether->tx_tdu_i++;
> > > +       } else {
> > > +               dev_dbg(&pdev->dev, "status=0x%08X\n", status);
> > > +       }
> > > +
> > > +       napi_schedule(&ether->napi);
> > > +
> > > +       return IRQ_HANDLED;
> > > +}
> > > +
> > > +static irqreturn_t npcm7xx_rx_interrupt(int irq, void *dev_id)
> > > +{
> > > +       struct net_device *netdev = (struct net_device *)dev_id;
> > > +       struct npcm7xx_ether *ether = netdev_priv(netdev);
> > > +       struct platform_device *pdev = ether->pdev;
> > > +       __le32 status;
> > > +       unsigned long flags;
> > > +       unsigned int any_err = 0;
> > > +       __le32 rxfsm;
> > > +
> > > +       npcm7xx_get_and_clear_int(netdev, &status, 0xFFFF);
> >
> > Same here
>
> in non error case I do leave only the error interrupts and schedule napi.

Oh, so the Rx interrupt remains suppressed. Then that's fine.

> > > +static const struct net_device_ops npcm7xx_ether_netdev_ops = {
> > > +       .ndo_open               = npcm7xx_ether_open,
> > > +       .ndo_stop               = npcm7xx_ether_close,
> > > +       .ndo_start_xmit         = npcm7xx_ether_start_xmit,
> > > +       .ndo_get_stats          = npcm7xx_ether_stats,
> > > +       .ndo_set_rx_mode        = npcm7xx_ether_set_rx_mode,
> > > +       .ndo_set_mac_address    = npcm7xx_set_mac_address,
> > > +       .ndo_do_ioctl           = npcm7xx_ether_ioctl,
> > > +       .ndo_validate_addr      = eth_validate_addr,
> > > +       .ndo_change_mtu         = eth_change_mtu,
> >
> > This is marked as deprecated. Also in light of the hardcoded
> > MAX_PACKET_SIZE, probably want to set dev->max_mtu.
>
> can I just not set .ndo_change_mtu? or I must add my own implementation?
> setting of dev->max_mtu, can be done in probe, yes?

It's fine to just not have it. The patchset that introduced max_mtu
(61e84623ace3, a52ad514fdf3) removed many.

One reason to have a callback function is to bring the device down/up
with different sized rx buffers.

But handling that might be too much extra complexity for the initial
patch. It's fine to keep the fixed rx alloc size as is.

> BTW, I see that currently the mtu is 1500 but I do get transactions
> with len of 1514 (I didn't compile with VLAN)

That is to be expected, as MTU excludes link layer header (and FCS,
and perhaps also vlan?)

^ permalink raw reply

* [PATCH v2] net: sched: sch_taprio: fix memleak in error path for sched list parse
From: Ivan Khoronzhuk @ 2019-08-06 22:45 UTC (permalink / raw)
  To: vinicius.gomes, davem
  Cc: jhs, xiyou.wangcong, jiri, netdev, linux-kernel, Ivan Khoronzhuk

In error case, all entries should be freed from the sched list
before deleting it. For simplicity use rcu way.

Fixes: 5a781ccbd19e46 ("tc: Add support for configuring the taprio scheduler")
Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 net/sched/sch_taprio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index c39db507ba3f..e25d414ae12f 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -1195,7 +1195,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 	spin_unlock_bh(qdisc_lock(sch));
 
 free_sched:
-	kfree(new_admin);
+	if (new_admin)
+		call_rcu(&new_admin->rcu, taprio_free_sched_cb);
 
 	return err;
 }
-- 
2.17.1


^ permalink raw reply related

* Re: [PATCH] net: sched: sch_taprio: fix memleak in error path for sched list parse
From: Ivan Khoronzhuk @ 2019-08-06 22:42 UTC (permalink / raw)
  To: David Miller
  Cc: vinicius.gomes, jhs, xiyou.wangcong, jiri, netdev, linux-kernel
In-Reply-To: <20190806.114114.1672670570404825284.davem@davemloft.net>

On Tue, Aug 06, 2019 at 11:41:14AM -0700, David Miller wrote:
>From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
>Date: Tue,  6 Aug 2019 13:04:25 +0300
>
>> Based on net/master
>
>I wonder about that because:
Applies cleanly on net/master, but line num is not correct.
I've sent v2.

>
>> --- a/net/sched/sch_taprio.c
>> +++ b/net/sched/sch_taprio.c
>> @@ -1451,7 +1451,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
>>  	spin_unlock_bh(qdisc_lock(sch));
>>
>>  free_sched:
>> -	kfree(new_admin);
>> +	if (new_admin)
>> +		call_rcu(&new_admin->rcu, taprio_free_sched_cb);
>>
>>  	return err;
>
>In my tree the context around line 1451 is:
>
>	nla_nest_end(skb, sched_nest);
>
>done:
>	rcu_read_unlock();
>
>	return nla_nest_end(skb, nest);
>
>
>which is part of function taprio_dump().
>
>Please respin this properly against current 'net' sources.

-- 
Regards,
Ivan Khoronzhuk

^ permalink raw reply

* Re: [PATCH -next] iwlwifi: dbg: work around clang bug by marking debug strings static
From: Nick Desaulniers @ 2019-08-06 22:37 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Michael Ellerman, Kalle Valo, Luca Coelho, Arnd Bergmann,
	Nathan Chancellor, Emmanuel Grumbach, Intel Linux Wireless,
	David S. Miller, Shahar S Matityahu, Sara Sharon, linux-wireless,
	netdev, LKML, clang-built-linux
In-Reply-To: <3a2b6d4f9356d54ab8e83fbf25ba9c5f50181f0d.camel@sipsolutions.net>

On Thu, Aug 1, 2019 at 12:11 AM Johannes Berg <johannes@sipsolutions.net> wrote:
>
>
> > Luca, you said this was already fixed in your internal tree, and the fix
> > would appear soon in next, but I don't see anything in linux-next?
>
> Luca is still on vacation, but I just sent out a version of the patch we
> had applied internally.
>
> Also turns out it wasn't actually _fixed_, just _moved_, so those
> internal patches wouldn't have helped anyway.

Thanks for the report. Do you have a link?
I'll rebase my patch then.
-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply

* Re: [PATCH net] netdevsim: Restore per-network namespace accounting for fib entries
From: Jakub Kicinski @ 2019-08-06 22:32 UTC (permalink / raw)
  To: David Ahern; +Cc: davem, netdev, jiri, David Ahern
In-Reply-To: <20190806191517.8713-1-dsahern@kernel.org>

On Tue,  6 Aug 2019 12:15:17 -0700, David Ahern wrote:
> From: David Ahern <dsahern@gmail.com>
> 
> Prior to the commit in the fixes tag, the resource controller in netdevsim
> tracked fib entries and rules per network namespace. Restore that behavior.
> 
> Fixes: 5fc494225c1e ("netdevsim: create devlink instance per netdevsim instance")
> Signed-off-by: David Ahern <dsahern@gmail.com>

Thanks.

Let's see what Jiri says, but to me this patch seems to indeed restore
the original per-namespace accounting when the more natural way forward
may perhaps be to make nsim only count the fib entries where

	fib_info->net == devlink_net(devlink)

> -void nsim_fib_destroy(struct nsim_fib_data *data)
> +int nsim_fib_init(void)
>  {
> -	unregister_fib_notifier(&data->fib_nb);
> -	kfree(data);
> +	int err;
> +
> +	err = register_pernet_subsys(&nsim_fib_net_ops);
> +	if (err < 0) {
> +		pr_err("Failed to register pernet subsystem\n");
> +		goto err_out;
> +	}
> +
> +	err = register_fib_notifier(&nsim_fib_nb, nsim_fib_dump_inconsistent);
> +	if (err < 0) {
> +		pr_err("Failed to register fib notifier\n");

		unregister_pernet_subsys(&nsim_fib_net_ops);
?

> +		goto err_out;
> +	}
> +
> +err_out:
> +	return err;
>  }

^ permalink raw reply

* Re: [PATCH net-next v2] ibmveth: Allow users to update reported speed and duplex
From: Jakub Kicinski @ 2019-08-06 22:15 UTC (permalink / raw)
  To: Thomas Falcon; +Cc: mpe, netdev, linuxppc-dev
In-Reply-To: <1565108588-17331-1-git-send-email-tlfalcon@linux.ibm.com>

On Tue,  6 Aug 2019 11:23:08 -0500, Thomas Falcon wrote:
> Reported ethtool link settings for the ibmveth driver are currently
> hardcoded and no longer reflect the actual capabilities of supported
> hardware. There is no interface designed for retrieving this information
> from device firmware nor is there any way to update current settings
> to reflect observed or expected link speeds.
> 
> To avoid breaking existing configurations, retain current values as
> default settings but let users update them to match the expected
> capabilities of underlying hardware if needed. This update would
> allow the use of configurations that rely on certain link speed
> settings, such as LACP. This patch is based on the implementation
> in virtio_net.
> 
> Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com>

Looks like this is the third copy of the same code virtio and
netvsc have :(  Is there a chance we could factor this out into
helpers in the core?

^ permalink raw reply

* Re: [PATCH net-next 5/5] r8152: change rx_frag_head_sz and rx_max_agg_num dynamically
From: Jakub Kicinski @ 2019-08-06 22:10 UTC (permalink / raw)
  To: Hayes Wang; +Cc: netdev, nic_swsd, linux-kernel, linux-usb
In-Reply-To: <1394712342-15778-294-albertk@realtek.com>

On Tue, 6 Aug 2019 19:18:04 +0800, Hayes Wang wrote:
> Let rx_frag_head_sz and rx_max_agg_num could be modified dynamically
> through the sysfs.
> 
> Signed-off-by: Hayes Wang <hayeswang@realtek.com>

Please don't expose those via sysfs. Ethtool's copybreak and descriptor
count should be applicable here, I think.

^ permalink raw reply

* Re: [PATCH net-next 4/5] r8152: support skb_add_rx_frag
From: Jakub Kicinski @ 2019-08-06 22:08 UTC (permalink / raw)
  To: Hayes Wang; +Cc: netdev, nic_swsd, linux-kernel, linux-usb
In-Reply-To: <1394712342-15778-293-albertk@realtek.com>

On Tue, 6 Aug 2019 19:18:03 +0800, Hayes Wang wrote:
> Use skb_add_rx_frag() to reduce the memory copy for rx data.
> 
> Use a new list of rx_used to store the rx buffer which couldn't be
> reused yet.
> 
> Besides, the total number of rx buffer may be increased or decreased
> dynamically. And it is limited by RTL8152_MAX_RX_AGG.
> 
> Signed-off-by: Hayes Wang <hayeswang@realtek.com>

> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index 401e56112365..1615900c8592 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
> @@ -584,6 +584,9 @@ enum rtl_register_content {
>  #define TX_ALIGN		4
>  #define RX_ALIGN		8
>  
> +#define RTL8152_MAX_RX_AGG	(10 * RTL8152_MAX_RX)
> +#define RTL8152_RXFG_HEADSZ	256
> +
>  #define INTR_LINK		0x0004
>  
>  #define RTL8152_REQT_READ	0xc0
> @@ -720,7 +723,7 @@ struct r8152 {
>  	struct net_device *netdev;
>  	struct urb *intr_urb;
>  	struct tx_agg tx_info[RTL8152_MAX_TX];
> -	struct list_head rx_info;
> +	struct list_head rx_info, rx_used;

I don't see where entries on the rx_used list get freed when driver is
unloaded, could you explain how that's taken care of?

>  	struct list_head rx_done, tx_free;
>  	struct sk_buff_head tx_queue, rx_queue;
>  	spinlock_t rx_lock, tx_lock;
> @@ -1476,7 +1479,7 @@ static void free_rx_agg(struct r8152 *tp, struct rx_agg *agg)
>  	list_del(&agg->info_list);
>  
>  	usb_free_urb(agg->urb);
> -	__free_pages(agg->page, get_order(tp->rx_buf_sz));
> +	put_page(agg->page);
>  	kfree(agg);
>  
>  	atomic_dec(&tp->rx_count);
> @@ -1493,7 +1496,7 @@ static struct rx_agg *alloc_rx_agg(struct r8152 *tp, gfp_t mflags)
>  	if (rx_agg) {
>  		unsigned long flags;
>  
> -		rx_agg->page = alloc_pages(mflags, order);
> +		rx_agg->page = alloc_pages(mflags | __GFP_COMP, order);
>  		if (!rx_agg->page)
>  			goto free_rx;
>  
> @@ -1951,6 +1954,50 @@ static u8 r8152_rx_csum(struct r8152 *tp, struct rx_desc *rx_desc)
>  	return checksum;
>  }
>  
> +static inline bool rx_count_exceed(struct r8152 *tp)
> +{
> +	return atomic_read(&tp->rx_count) > RTL8152_MAX_RX;
> +}
> +
> +static inline int agg_offset(struct rx_agg *agg, void *addr)
> +{
> +	return (int)(addr - agg->buffer);
> +}
> +
> +static struct rx_agg *rtl_get_free_rx(struct r8152 *tp, gfp_t mflags)
> +{
> +	struct list_head *cursor, *next;
> +	struct rx_agg *agg_free = NULL;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&tp->rx_lock, flags);
> +
> +	list_for_each_safe(cursor, next, &tp->rx_used) {
> +		struct rx_agg *agg;
> +
> +		agg = list_entry(cursor, struct rx_agg, list);
> +
> +		if (page_count(agg->page) == 1) {
> +			if (!agg_free) {
> +				list_del_init(cursor);
> +				agg_free = agg;
> +				continue;
> +			} else if (rx_count_exceed(tp)) {

nit: else unnecessary after continue

> +				list_del_init(cursor);
> +				free_rx_agg(tp, agg);
> +			}
> +			break;
> +		}
> +	}
> +
> +	spin_unlock_irqrestore(&tp->rx_lock, flags);
> +
> +	if (!agg_free && atomic_read(&tp->rx_count) < RTL8152_MAX_RX_AGG)
> +		agg_free = alloc_rx_agg(tp, mflags);
> +
> +	return agg_free;
> +}
> +
>  static int rx_bottom(struct r8152 *tp, int budget)
>  {
>  	unsigned long flags;

^ permalink raw reply

* Re: [PATCH net-next v4 2/2] net: phy: broadcom: add 1000Base-X support for BCM54616S
From: Heiner Kallweit @ 2019-08-06 22:00 UTC (permalink / raw)
  To: Tao Ren, Andrew Lunn, Florian Fainelli, David S . Miller,
	Arun Parameswaran, Justin Chen, Vladimir Oltean, netdev,
	linux-kernel, openbmc
In-Reply-To: <20190806210931.3723590-1-taoren@fb.com>

On 06.08.2019 23:09, Tao Ren wrote:
> The BCM54616S PHY cannot work properly in RGMII->1000Base-KX mode (for
> example, on Facebook CMM BMC platform), mainly because genphy functions
> are designed for copper links, and 1000Base-X (clause 37) auto negotiation
> needs to be handled differently.
> 
> This patch enables 1000Base-X support for BCM54616S by customizing 3
> driver callbacks:
> 
>   - probe: probe callback detects PHY's operation mode based on
>     INTERF_SEL[1:0] pins and 1000X/100FX selection bit in SerDES 100-FX
>     Control register.
> 
>   - config_aneg: bcm54616s_config_aneg_1000bx function is added for auto
>     negotiation in 1000Base-X mode.
> 
>   - read_status: BCM54616S and BCM5482 PHY share the same read_status
>     callback which manually set link speed and duplex mode in 1000Base-X
>     mode.
> 
> Signed-off-by: Tao Ren <taoren@fb.com>
> ---
>  Changes in v4:
>   - add bcm54616s_config_aneg_1000bx() to deal with auto negotiation in
>     1000Base-X mode.
>  Changes in v3:
>   - rename bcm5482_read_status to bcm54xx_read_status so the callback can
>     be shared by BCM5482 and BCM54616S.
>  Changes in v2:
>   - Auto-detect PHY operation mode instead of passing DT node.
>   - move PHY mode auto-detect logic from config_init to probe callback.
>   - only set speed (not including duplex) in read_status callback.
>   - update patch description with more background to avoid confusion.
>   - patch #1 in the series ("net: phy: broadcom: set features explicitly
>     for BCM54616") is dropped: the fix should go to get_features callback
>     which may potentially depend on this patch.
> 
>  drivers/net/phy/broadcom.c | 62 ++++++++++++++++++++++++++++++++++----
>  include/linux/brcmphy.h    | 10 ++++--
>  2 files changed, 64 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
> index 937d0059e8ac..bf61ed8451e5 100644
> --- a/drivers/net/phy/broadcom.c
> +++ b/drivers/net/phy/broadcom.c
> @@ -383,9 +383,9 @@ static int bcm5482_config_init(struct phy_device *phydev)
>  		/*
>  		 * Select 1000BASE-X register set (primary SerDes)
>  		 */
> -		reg = bcm_phy_read_shadow(phydev, BCM5482_SHD_MODE);
> -		bcm_phy_write_shadow(phydev, BCM5482_SHD_MODE,
> -				     reg | BCM5482_SHD_MODE_1000BX);
> +		reg = bcm_phy_read_shadow(phydev, BCM54XX_SHD_MODE);
> +		bcm_phy_write_shadow(phydev, BCM54XX_SHD_MODE,
> +				     reg | BCM54XX_SHD_MODE_1000BX);
>  
>  		/*
>  		 * LED1=ACTIVITYLED, LED3=LINKSPD[2]
> @@ -409,7 +409,7 @@ static int bcm5482_config_init(struct phy_device *phydev)
>  	return err;
>  }
>  
> -static int bcm5482_read_status(struct phy_device *phydev)
> +static int bcm54xx_read_status(struct phy_device *phydev)
>  {
>  	int err;
>  
> @@ -451,12 +451,60 @@ static int bcm5481_config_aneg(struct phy_device *phydev)
>  	return ret;
>  }
>  
> +static int bcm54616s_probe(struct phy_device *phydev)
> +{
> +	int val, intf_sel;
> +
> +	val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_MODE);
> +	if (val < 0)
> +		return val;
> +
> +	/* The PHY is strapped in RGMII to fiber mode when INTERF_SEL[1:0]
> +	 * is 01b.
> +	 */
> +	intf_sel = (val & BCM54XX_SHD_INTF_SEL_MASK) >> 1;
> +	if (intf_sel == 1) {
> +		val = bcm_phy_read_shadow(phydev, BCM54616S_SHD_100FX_CTRL);
> +		if (val < 0)
> +			return val;
> +
> +		/* Bit 0 of the SerDes 100-FX Control register, when set
> +		 * to 1, sets the MII/RGMII -> 100BASE-FX configuration.
> +		 * When this bit is set to 0, it sets the GMII/RGMII ->
> +		 * 1000BASE-X configuration.
> +		 */
> +		if (!(val & BCM54616S_100FX_MODE))
> +			phydev->dev_flags |= PHY_BCM_FLAGS_MODE_1000BX;
> +	}
> +
> +	return 0;
> +}
> +
> +static int bcm54616s_config_aneg_1000bx(struct phy_device *phydev)
> +{
> +	int err;
> +	int adv = 0;
> +
> +	if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
> +			      phydev->supported))
> +		adv |= ADVERTISE_1000XFULL;
> +
> +	err = phy_modify_changed(phydev, MII_ADVERTISE, 0, adv);

The "0" parameter is wrong, it must be ADVERTISE_1000XFULL.
First you reset the bit, and then you set it or not.

> +	if (err > 0)
> +		err = genphy_restart_aneg(phydev);
> +
> +	return err;
> +}
> +
>  static int bcm54616s_config_aneg(struct phy_device *phydev)
>  {
>  	int ret;
>  
>  	/* Aneg firsly. */
> -	ret = genphy_config_aneg(phydev);
> +	if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX)
> +		ret = bcm54616s_config_aneg_1000bx(phydev);
> +	else
> +		ret = genphy_config_aneg(phydev);
>  
>  	/* Then we can set up the delay. */
>  	bcm54xx_config_clock_delay(phydev);
> @@ -655,6 +703,8 @@ static struct phy_driver broadcom_drivers[] = {
>  	.config_aneg	= bcm54616s_config_aneg,
>  	.ack_interrupt	= bcm_phy_ack_intr,
>  	.config_intr	= bcm_phy_config_intr,
> +	.read_status	= bcm54xx_read_status,

If you use aneg, you should also read what was negotiated.
But this function reads neither negotiated duplex mode nor
pause settings.

> +	.probe		= bcm54616s_probe,
>  }, {
>  	.phy_id		= PHY_ID_BCM5464,
>  	.phy_id_mask	= 0xfffffff0,
> @@ -689,7 +739,7 @@ static struct phy_driver broadcom_drivers[] = {
>  	.name		= "Broadcom BCM5482",
>  	/* PHY_GBIT_FEATURES */
>  	.config_init	= bcm5482_config_init,
> -	.read_status	= bcm5482_read_status,
> +	.read_status	= bcm54xx_read_status,
>  	.ack_interrupt	= bcm_phy_ack_intr,
>  	.config_intr	= bcm_phy_config_intr,
>  }, {
> diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
> index 6db2d9a6e503..b475e7f20d28 100644
> --- a/include/linux/brcmphy.h
> +++ b/include/linux/brcmphy.h
> @@ -200,9 +200,15 @@
>  #define BCM5482_SHD_SSD		0x14	/* 10100: Secondary SerDes control */
>  #define BCM5482_SHD_SSD_LEDM	0x0008	/* SSD LED Mode enable */
>  #define BCM5482_SHD_SSD_EN	0x0001	/* SSD enable */
> -#define BCM5482_SHD_MODE	0x1f	/* 11111: Mode Control Register */
> -#define BCM5482_SHD_MODE_1000BX	0x0001	/* Enable 1000BASE-X registers */
>  
> +/* 10011: SerDes 100-FX Control Register */
> +#define BCM54616S_SHD_100FX_CTRL	0x13
> +#define	BCM54616S_100FX_MODE		BIT(0)	/* 100-FX SerDes Enable */
> +
> +/* 11111: Mode Control Register */
> +#define BCM54XX_SHD_MODE		0x1f
> +#define BCM54XX_SHD_INTF_SEL_MASK	GENMASK(2, 1)	/* INTERF_SEL[1:0] */
> +#define BCM54XX_SHD_MODE_1000BX		BIT(0)	/* Enable 1000-X registers */
>  
>  /*
>   * EXPANSION SHADOW ACCESS REGISTERS.  (PHY REG 0x15, 0x16, and 0x17)
> 


^ permalink raw reply

* Re: [PATCH v4 3/4] net: phy: realtek: Add helpers for accessing RTL8211E extension pages
From: Matthias Kaehlcke @ 2019-08-06 21:58 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: David S . Miller, Rob Herring, Mark Rutland, Andrew Lunn,
	Florian Fainelli, netdev, devicetree, linux-kernel,
	Douglas Anderson
In-Reply-To: <71d817b9-7bcc-9f83-331d-1c3958c41f51@gmail.com>

On Sun, Aug 04, 2019 at 10:33:30AM +0200, Heiner Kallweit wrote:
> On 01.08.2019 21:07, Matthias Kaehlcke wrote:
> > The RTL8211E has extension pages, which can be accessed after
> > selecting a page through a custom method. Add a function to
> > modify bits in a register of an extension page and a helper for
> > selecting an ext page. Use rtl8211e_modify_ext_paged() in
> > rtl8211e_config_init() instead of doing things 'manually'.
> > 
> > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> > ---
> > Changes in v4:
> > - don't add constant RTL8211E_EXT_PAGE, it's only used once,
> >   use a literal instead
> > - pass 'oldpage' to phy_restore_page() in rtl8211e_select_ext_page(),
> >   not 'page'
> > - return 'oldpage' in rtl8211e_select_ext_page()
> > - use __phy_modify() in rtl8211e_modify_ext_paged() instead of
> >   reimplementing __phy_modify_changed()
> > - in rtl8211e_modify_ext_paged() return directly when
> >   rtl8211e_select_ext_page() fails
> > ---
> >  drivers/net/phy/realtek.c | 48 +++++++++++++++++++++++++++------------
> >  1 file changed, 34 insertions(+), 14 deletions(-)
> > 
> > diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
> > index a669945eb829..e09d3b0da2c7 100644
> > --- a/drivers/net/phy/realtek.c
> > +++ b/drivers/net/phy/realtek.c
> > @@ -53,6 +53,36 @@ static int rtl821x_write_page(struct phy_device *phydev, int page)
> >  	return __phy_write(phydev, RTL821x_PAGE_SELECT, page);
> >  }
> >  
> > +static int rtl8211e_select_ext_page(struct phy_device *phydev, int page)
> 
> The "extended page" mechanism doesn't exist on RTL8211E only. A prefix
> rtl821x like in other functions may be better therefore.

Sounds good, I'll change it in the next revision

Thanks

Matthias

^ permalink raw reply

* Re: [PATCH net-next v4 2/2] net: phy: broadcom: add 1000Base-X support for BCM54616S
From: Tao Ren @ 2019-08-06 21:42 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, Heiner Kallweit, David S . Miller,
	Arun Parameswaran, Justin Chen, Vladimir Oltean,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	openbmc@lists.ozlabs.org
In-Reply-To: <20190806210931.3723590-1-taoren@fb.com>

Hi Andrew / Heiner / Vladimir,

On 8/6/19 2:09 PM, Tao Ren wrote:
> The BCM54616S PHY cannot work properly in RGMII->1000Base-KX mode (for
> example, on Facebook CMM BMC platform), mainly because genphy functions
> are designed for copper links, and 1000Base-X (clause 37) auto negotiation
> needs to be handled differently.
> 
> This patch enables 1000Base-X support for BCM54616S by customizing 3
> driver callbacks:
> 
>   - probe: probe callback detects PHY's operation mode based on
>     INTERF_SEL[1:0] pins and 1000X/100FX selection bit in SerDES 100-FX
>     Control register.
> 
>   - config_aneg: bcm54616s_config_aneg_1000bx function is added for auto
>     negotiation in 1000Base-X mode.
> 
>   - read_status: BCM54616S and BCM5482 PHY share the same read_status
>     callback which manually set link speed and duplex mode in 1000Base-X
>     mode.
> 
> Signed-off-by: Tao Ren <taoren@fb.com>

I customized config_aneg function for BCM54616S 1000Base-X mode and link-down issue is also fixed: the patch is tested on Facebook CMM and Minipack BMC and everything looks normal. Please kindly review when you have bandwidth and let me know if you have further suggestions.

BTW, I would be happy to help if we decide to add a set of genphy functions for clause 37, although that may mean I need more help/guidance from you :-)


Cheers,

Tao

^ permalink raw reply


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