openwrt/staging/blogic.git
4 years agonet: fix skb_panic to output real address
Jesper Dangaard Brouer [Mon, 27 Apr 2020 16:37:43 +0000 (18:37 +0200)]
net: fix skb_panic to output real address

In skb_panic() the real pointer values are really needed to diagnose
issues, e.g. data and head are related (to calculate headroom). The
hashed versions of the addresses doesn't make much sense here. The
patch use the printk specifier %px to print the actual address.

The printk documentation on %px:
https://www.kernel.org/doc/html/latest/core-api/printk-formats.html#unmodified-addresses

Fixes: ad67b74d2469 ("printk: hash addresses printed with %p")
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethernet: stmmac: simplify phy modes management for stm32
Christophe Roullier [Mon, 27 Apr 2020 10:00:38 +0000 (12:00 +0200)]
net: ethernet: stmmac: simplify phy modes management for stm32

No new feature, just to simplify stm32 part to be easier to use.
Add by default all Ethernet clocks in DT, and activate or not in function
of phy mode, clock frequency, if property "st,ext-phyclk" is set or not.
Keep backward compatibility
--------------------------------------------------------------------------
|PHY_MODE |    Normal | PHY wo crystal|   PHY wo crystal   |  No 125Mhz  |
|         |       |      25MHz    |        50MHz       |  from PHY   |
--------------------------------------------------------------------------
|  MII    |  -    |     eth-ck    |       n/a          |     n/a  |
|         |       | st,ext-phyclk |                    |             |
--------------------------------------------------------------------------
|  GMII   |  -    |     eth-ck    |       n/a          |     n/a  |
|         |       | st,ext-phyclk |                    |             |
--------------------------------------------------------------------------
| RGMII   |  -    |     eth-ck    |       n/a          |     eth-ck  |
|         |      | st,ext-phyclk |                    |st,eth-clk-sel|
|         |      |               |                    |       or     |
|         |      |               |                    | st,ext-phyclk|
----------------==--------------------------------------------------------
| RMII    |  -   |     eth-ck    |      eth-ck        |       n/a    |
|         |       | st,ext-phyclk | st,eth-ref-clk-sel |              |
|         |       |               | or st,ext-phyclk   |              |
--------------------------------------------------------------------------

Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
Acked-by: Alexandre TORGUE <alexandre.torgue@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: Replace the limit of TCP_LINGER2 with TCP_FIN_TIMEOUT_MAX
Cambda Zhu [Fri, 24 Apr 2020 08:06:16 +0000 (16:06 +0800)]
net: Replace the limit of TCP_LINGER2 with TCP_FIN_TIMEOUT_MAX

This patch changes the behavior of TCP_LINGER2 about its limit. The
sysctl_tcp_fin_timeout used to be the limit of TCP_LINGER2 but now it's
only the default value. A new macro named TCP_FIN_TIMEOUT_MAX is added
as the limit of TCP_LINGER2, which is 2 minutes.

Since TCP_LINGER2 used sysctl_tcp_fin_timeout as the default value
and the limit in the past, the system administrator cannot set the
default value for most of sockets and let some sockets have a greater
timeout. It might be a mistake that let the sysctl to be the limit of
the TCP_LINGER2. Maybe we can add a new sysctl to set the max of
TCP_LINGER2, but FIN-WAIT-2 timeout is usually no need to be too long
and 2 minutes are legal considering TCP specs.

Changes in v3:
- Remove the new socket option and change the TCP_LINGER2 behavior so
  that the timeout can be set to value between sysctl_tcp_fin_timeout
  and 2 minutes.

Changes in v2:
- Add int overflow check for the new socket option.

Changes in v1:
- Add a new socket option to set timeout greater than
  sysctl_tcp_fin_timeout.

Signed-off-by: Cambda Zhu <cambda@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'r8169-improve-user-message-handling'
David S. Miller [Fri, 1 May 2020 19:53:06 +0000 (12:53 -0700)]
Merge branch 'r8169-improve-user-message-handling'

Heiner Kallweit says:

====================
r8169: improve user message handling

Series improves few aspects of handling messages to users.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: switch from netif_xxx message functions to netdev_xxx
Heiner Kallweit [Fri, 1 May 2020 17:26:22 +0000 (19:26 +0200)]
r8169: switch from netif_xxx message functions to netdev_xxx

Considering the few messages we have in the driver, there's not really
a benefit in being able to control them on a message type level.
Therefore simplify the code and switch to the netdev_xxx message
functions. In addition add net_ratelimit() to messages that can be
printed from a hot path.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: remove "out of memory" error message from rtl_request_firmware
Heiner Kallweit [Fri, 1 May 2020 17:24:47 +0000 (19:24 +0200)]
r8169: remove "out of memory" error message from rtl_request_firmware

When preparing an unrelated change, checkpatch complained about this
redundant out-of-memory message. Therefore remove it.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: simplify counter handling
Heiner Kallweit [Fri, 1 May 2020 17:23:36 +0000 (19:23 +0200)]
r8169: simplify counter handling

The counter handling functions can only fail if rtl8169_do_counters()
times out. In the poll function we emit an error message in case of
timeout, therefore we don't have to propagate the timeout all the
way up just to print another message basically saying the same.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: remove redundant driver message when entering promiscuous mode
Heiner Kallweit [Fri, 1 May 2020 17:22:29 +0000 (19:22 +0200)]
r8169: remove redundant driver message when entering promiscuous mode

Net core -  __dev_set_promiscuity - prints a message already when
promiscuous mode in entered/left, therefore we don't have to do this
in the driver too. Also the driver message would be misleading
(would be because "link" message level is disabled per default)
because it would print "promisc mode enabled" even if it's being
left. Reason is that __dev_change_flags() calls dev_set_rx_mode()
before touching the promisc flag.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-ReST-part-three'
David S. Miller [Fri, 1 May 2020 19:24:43 +0000 (12:24 -0700)]
Merge branch 'net-ReST-part-three'

Mauro Carvalho Chehab says:

====================
net: manually convert files to ReST format - part 3 (final)

That's the third part (and the final one) of my work to convert the networking
text files into ReST. it is based on linux-next next-20200430 branch.

The full series (including those ones) are at:

https://git.linuxtv.org/mchehab/experimental.git/log/?h=net-docs

The  built output documents, on html format is at:

https://www.infradead.org/~mchehab/kernel_docs/networking/
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: arcnet-hardware.rst: don't duplicate chapter names
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:59 +0000 (16:44 +0200)]
docs: networking: arcnet-hardware.rst: don't duplicate chapter names

Since changeset 58ad30cf91f0 ("docs: fix reference to core-api/namespaces.rst"),
auto-references for chapters are generated. This is a nice feature, but
has a drawback: no chapters can have the same sumber.

So, we need to change two chapter titles, to avoid warnings when
building the docs.

Fixes: 58ad30cf91f0 ("docs: fix reference to core-api/namespaces.rst")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: docs: add page_pool.rst to index.rst
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:58 +0000 (16:44 +0200)]
net: docs: add page_pool.rst to index.rst

This file is already in ReST format. Add it to the net
index.rst, in order to make it part of the documentation
body.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert toshiba/spider_net.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:57 +0000 (16:44 +0200)]
docs: networking: device drivers: convert toshiba/spider_net.txt to ReST

- add SPDX header;
- adjust title markup;
- mark code blocks and literals as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert ti/tlan.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:56 +0000 (16:44 +0200)]
docs: networking: device drivers: convert ti/tlan.txt to ReST

- add SPDX header;
- adjust titles and chapters, adding proper markups;
- mark tables as such;
- mark code blocks and literals as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert ti/cpsw.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:55 +0000 (16:44 +0200)]
docs: networking: device drivers: convert ti/cpsw.txt to ReST

- add SPDX header;
- adjust titles and chapters, adding proper markups;
- mark code blocks and literals as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert ti/cpsw_switchdev.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:54 +0000 (16:44 +0200)]
docs: networking: device drivers: convert ti/cpsw_switchdev.txt to ReST

- add SPDX header;
- adjust titles and chapters, adding proper markups;
- use :field: markup;
- mark code blocks and literals as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert smsc/smc9.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:53 +0000 (16:44 +0200)]
docs: networking: device drivers: convert smsc/smc9.txt to ReST

- add SPDX header;
- mark code blocks and literals as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert sb1000.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:52 +0000 (16:44 +0200)]
docs: networking: device drivers: convert sb1000.txt to ReST

- add SPDX header;
- add a document title;
- adjust titles and chapters, adding proper markups;
- mark code blocks and literals as such;
- mark lists as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert qualcomm/rmnet.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:51 +0000 (16:44 +0200)]
docs: networking: device drivers: convert qualcomm/rmnet.txt to ReST

- add SPDX header;
- add a document title;
- mark code blocks and literals as such;
- mark tables as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert neterion/vxge.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:50 +0000 (16:44 +0200)]
docs: networking: device drivers: convert neterion/vxge.txt to ReST

- add SPDX header;
- adjust titles and chapters, adding proper markups;
- comment out text-only TOC from html/pdf output;
- mark code blocks and literals as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert neterion/s2io.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:49 +0000 (16:44 +0200)]
docs: networking: device drivers: convert neterion/s2io.txt to ReST

- add SPDX header;
- add a document title;
- comment out text-only TOC from html/pdf output;
- mark code blocks and literals as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert microsoft/netvsc.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:48 +0000 (16:44 +0200)]
docs: networking: device drivers: convert microsoft/netvsc.txt to ReST

- add SPDX header;
- adjust titles and chapters, adding proper markups;
- mark code blocks and literals as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert intel/ipw2200.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:47 +0000 (16:44 +0200)]
docs: networking: device drivers: convert intel/ipw2200.txt to ReST

- add SPDX header;
- adjust titles and chapters, adding proper markups;
- comment out text-only TOC from html/pdf output;
- use copyright symbol;
- use :field: markup;
- mark code blocks and literals as such;
- mark tables as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert intel/ipw2100.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:46 +0000 (16:44 +0200)]
docs: networking: device drivers: convert intel/ipw2100.txt to ReST

- add SPDX header;
- adjust titles and chapters, adding proper markups;
- comment out text-only TOC from html/pdf output;
- use copyright symbol;
- use :field: markup;
- mark code blocks and literals as such;
- mark tables as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert freescale/gianfar.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:45 +0000 (16:44 +0200)]
docs: networking: device drivers: convert freescale/gianfar.txt to ReST

- add SPDX header;
- adjust titles and chapters, adding proper markups;
- use :field: markup;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert freescale/dpaa.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:44 +0000 (16:44 +0200)]
docs: networking: device drivers: convert freescale/dpaa.txt to ReST

- add SPDX header;
- adjust titles and chapters, adding proper markups;
- mark code blocks and literals as such;
- use :field: markup;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert dlink/dl2k.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:43 +0000 (16:44 +0200)]
docs: networking: device drivers: convert dlink/dl2k.txt to ReST

- add SPDX header;
- mark code blocks and literals as such;
- mark lists as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert dec/dmfe.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:42 +0000 (16:44 +0200)]
docs: networking: device drivers: convert dec/dmfe.txt to ReST

- add SPDX header;
- adjust titles and chapters, adding proper markups;
- comment out text-only TOC from html/pdf output;
- mark code blocks and literals as such;
- mark tables as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert dec/de4x5.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:41 +0000 (16:44 +0200)]
docs: networking: device drivers: convert dec/de4x5.txt to ReST

- add SPDX header;
- add a document title;
- mark code blocks and literals as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert davicom/dm9000.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:40 +0000 (16:44 +0200)]
docs: networking: device drivers: convert davicom/dm9000.txt to ReST

- add SPDX header;
- add a document title;
- mark lists as such;
- mark tables as such;
- mark code blocks and literals as such;
- use the right horizontal tag markup;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert cirrus/cs89x0.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:39 +0000 (16:44 +0200)]
docs: networking: device drivers: convert cirrus/cs89x0.txt to ReST

- add SPDX header;
- adjust title markup;
- mark code blocks and literals as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert chelsio/cxgb.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:38 +0000 (16:44 +0200)]
docs: networking: device drivers: convert chelsio/cxgb.txt to ReST

- add SPDX header;
- use copyright symbol;
- adjust titles and chapters, adding proper markups;
- comment out text-only TOC from html/pdf output;
- mark code blocks and literals as such;
- add notes markups;
- mark tables as such;
- mark lists as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert aquantia/atlantic.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:37 +0000 (16:44 +0200)]
docs: networking: device drivers: convert aquantia/atlantic.txt to ReST

- add SPDX header;
- use copyright symbol;
- adjust title and its markup;
- comment out text-only TOC from html/pdf output;
- mark code blocks and literals as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert amazon/ena.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:36 +0000 (16:44 +0200)]
docs: networking: device drivers: convert amazon/ena.txt to ReST

- add SPDX header;
- adjust titles and chapters, adding proper markups;
- mark code blocks and literals as such;
- mark tables as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert 3com/vortex.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:35 +0000 (16:44 +0200)]
docs: networking: device drivers: convert 3com/vortex.txt to ReST

- add SPDX header;
- add a document title;
- mark code blocks and literals as such;
- mark tables as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: device drivers: convert 3com/3c509.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:34 +0000 (16:44 +0200)]
docs: networking: device drivers: convert 3com/3c509.txt to ReST

- add SPDX header;
- adjust titles and chapters, adding proper markups;
- mark code blocks and literals as such;
- add notes markups;
- mark tables as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: convert z8530drv.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:33 +0000 (16:44 +0200)]
docs: networking: convert z8530drv.txt to ReST

- add SPDX header;
- use copyright symbol;
- adjust titles and chapters, adding proper markups;
- mark tables as such;
- mark code blocks and literals as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: convert xfrm_sysctl.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:32 +0000 (16:44 +0200)]
docs: networking: convert xfrm_sysctl.txt to ReST

Not much to be done here:

- add SPDX header;
- add a document title;
- add a chapter's markup;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: convert xfrm_sync.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:31 +0000 (16:44 +0200)]
docs: networking: convert xfrm_sync.txt to ReST

- add SPDX header;
- add a document title;
- adjust titles and chapters, adding proper markups;
- mark code blocks and literals as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: convert xfrm_proc.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:30 +0000 (16:44 +0200)]
docs: networking: convert xfrm_proc.txt to ReST

- add SPDX header;
- adjust title markup;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: convert xfrm_device.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:29 +0000 (16:44 +0200)]
docs: networking: convert xfrm_device.txt to ReST

- add SPDX header;
- mark code blocks and literals as such;
- mark tables as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: convert x25.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:28 +0000 (16:44 +0200)]
docs: networking: convert x25.txt to ReST

Not much to be done here:
- add SPDX header;
- add a document title;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: convert x25-iface.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:27 +0000 (16:44 +0200)]
docs: networking: convert x25-iface.txt to ReST

Not much to be done here:

- add SPDX header;
- adjust title markup;
- remove a tail whitespace;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: convert vxlan.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:26 +0000 (16:44 +0200)]
docs: networking: convert vxlan.txt to ReST

- add SPDX header;
- adjust title markup;
- mark code blocks and literals as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: convert vrf.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:25 +0000 (16:44 +0200)]
docs: networking: convert vrf.txt to ReST

- add SPDX header;
- adjust title markup;
- Add a subtitle for the first section;
- mark code blocks and literals as such;
- adjust identation, whitespaces and blank lines;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Acked-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: convert udplite.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:24 +0000 (16:44 +0200)]
docs: networking: convert udplite.txt to ReST

- add SPDX header;
- adjust titles and chapters, adding proper markups;
- mark lists as such;
- mark tables as such;
- mark code blocks and literals as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: networking: convert tuntap.txt to ReST
Mauro Carvalho Chehab [Fri, 1 May 2020 14:44:23 +0000 (16:44 +0200)]
docs: networking: convert tuntap.txt to ReST

- add SPDX header;
- use copyright symbol;
- adjust titles and chapters, adding proper markups;
- mark code blocks and literals as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: remove not needed parameter in rtl8169_set_magic_reg
Heiner Kallweit [Fri, 1 May 2020 08:11:28 +0000 (10:11 +0200)]
r8169: remove not needed parameter in rtl8169_set_magic_reg

Remove a not needed parameter in rtl8169_set_magic_reg.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agohinic: Use kmemdup instead of kzalloc and memcpy
Zou Wei [Wed, 29 Apr 2020 03:35:28 +0000 (11:35 +0800)]
hinic: Use kmemdup instead of kzalloc and memcpy

Fixes coccicheck warnings:

 drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:452:17-24: WARNING opportunity for kmemdup
 drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:458:23-30: WARNING opportunity for kmemdup

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agohinic: make symbol 'dump_mox_reg' static
Zheng Bin [Wed, 29 Apr 2020 01:58:24 +0000 (09:58 +0800)]
hinic: make symbol 'dump_mox_reg' static

Fix sparse warnings:

drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:601:6: warning: symbol 'dump_mox_reg' was not declared. Should it be static?

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: bcm54140: add second PHY ID
Michael Walle [Tue, 28 Apr 2020 23:06:59 +0000 (01:06 +0200)]
net: phy: bcm54140: add second PHY ID

This PHY has two PHY IDs depending on its mode. Adjust the mask so that
it includes both IDs.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: bcm54140: apply the workaround on b0 chips
Michael Walle [Tue, 28 Apr 2020 23:06:58 +0000 (01:06 +0200)]
net: phy: bcm54140: apply the workaround on b0 chips

The lower three bits of the phy_id specifies the chip stepping. The
workaround is specifically for the B0 stepping. Apply it only on these
chips.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: bcm54140: fix phy_id_mask
Michael Walle [Tue, 28 Apr 2020 23:06:57 +0000 (01:06 +0200)]
net: phy: bcm54140: fix phy_id_mask

Broadcom defines the bits for this PHY as follows:
  { oui[24:3], model[6:0], revision[2:0] }

Thus we have to mask the lower three bits only.

Fixes: 6937602ed3f9 ("net: phy: add Broadcom BCM54140 support")
Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: bcm54140: use genphy_soft_reset()
Michael Walle [Tue, 28 Apr 2020 23:06:56 +0000 (01:06 +0200)]
net: phy: bcm54140: use genphy_soft_reset()

Set the .soft_reset() op to be sure there will be a reset even if there
is no hardware reset line registered.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: at803x: add downshift support
Michael Walle [Tue, 28 Apr 2020 21:15:02 +0000 (23:15 +0200)]
net: phy: at803x: add downshift support

The AR8031 and AR8035 support the link speed downshift. Add driver
support for it. One peculiarity of these PHYs is that it needs a
software reset after changing the setting, thus add the .soft_reset()
op and do a phy_init_hw() if necessary.

This was tested on a custom board with the AR8031.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: configure PME_SIGNAL for RTL8125 too
Heiner Kallweit [Tue, 28 Apr 2020 20:55:59 +0000 (22:55 +0200)]
r8169: configure PME_SIGNAL for RTL8125 too

RTL8125 supports the same PME_SIGNAL handling as all later RTL8168
chip variants.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: improve max jumbo packet size definition
Heiner Kallweit [Tue, 28 Apr 2020 20:54:12 +0000 (22:54 +0200)]
r8169: improve max jumbo packet size definition

Sync definition of max jumbo packet size with vendor driver and reserve
22 bytes for VLAN ethernet header plus checksum.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: usb: ax88179_178a: Implement ethtool_ops set_eeprom
Bjorn Andersson [Tue, 28 Apr 2020 07:01:39 +0000 (00:01 -0700)]
net: usb: ax88179_178a: Implement ethtool_ops set_eeprom

The vendor driver does upon failing to read a valid MAC address from
EEPROM write the netdev's address back to EEPROM and invoking a EEPROM
reload operation. Based on this we can implement the ethtool_ops
set_eeprom and provide the means to populate the EEPROM from within
Linux.

It's worth noting that ax88179_get_eeprom() will return some default
data unless the content of the EEPROM is deemed "complete", so until the
EEPROM is fully populated (e.g. by running ethtool -e | ethtool -E)
data written with ax88179_set_eeprom() will appear not to stick.

The implementation is based on asix_set_eeprom(), from asix_common.c

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodpaa2-eth: fix error return code in setup_dpni()
Wei Yongjun [Mon, 27 Apr 2020 10:43:22 +0000 (10:43 +0000)]
dpaa2-eth: fix error return code in setup_dpni()

Fix to return negative error code -ENOMEM from the error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ll_temac: Fix return value check in temac_probe()
Wei Yongjun [Mon, 27 Apr 2020 09:40:52 +0000 (09:40 +0000)]
net: ll_temac: Fix return value check in temac_probe()

In case of error, the function devm_ioremap() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should
be replaced with NULL test.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Esben Haabendal <esben@geanix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethernet: fec: Revert "net: ethernet: fec: Replace interrupt driven MDIO with...
Fugang Duan [Mon, 27 Apr 2020 14:08:04 +0000 (22:08 +0800)]
net: ethernet: fec: Revert "net: ethernet: fec: Replace interrupt driven MDIO with polled IO"

This reverts commit 29ae6bd1b0d8a57d7c00ab12cbb949fc41986eef.

The commit breaks ethernet function on i.MX6SX, i.MX7D, i.MX8MM,
i.MX8MQ, and i.MX8QXP platforms. Boot yocto system by NFS mounting
rootfs will be failed with the commit.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: lpc-enet: fix error return code in lpc_mii_init()
Wei Yongjun [Mon, 27 Apr 2020 12:15:07 +0000 (12:15 +0000)]
net: lpc-enet: fix error return code in lpc_mii_init()

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: b7370112f519 ("lpc32xx: Added ethernet driver")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoice: Fix error return code in ice_add_prof()
Wei Yongjun [Mon, 27 Apr 2020 12:12:28 +0000 (12:12 +0000)]
ice: Fix error return code in ice_add_prof()

Fix to return a error code from the error handling case
instead of 0, as done elsewhere in this function.

Fixes: 31ad4e4ee1e4 ("ice: Allocate flow profile")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoocteontx2-pf: Fix error return code in otx2_probe()
Wei Yongjun [Mon, 27 Apr 2020 12:11:10 +0000 (12:11 +0000)]
octeontx2-pf: Fix error return code in otx2_probe()

Fix to return negative error code -ENOMEM from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 5a6d7c9daef3 ("octeontx2-pf: Mailbox communication with AF")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodpaa_eth: Fix comparing pointer to 0
Aishwarya Ramakrishnan [Mon, 27 Apr 2020 10:32:30 +0000 (16:02 +0530)]
dpaa_eth: Fix comparing pointer to 0

Fixes coccicheck warning:
./drivers/net/ethernet/freescale/dpaa/dpaa_eth.c:2110:30-31:
WARNING comparing pointer to 0

Avoid pointer type value compared to 0.

Signed-off-by: Aishwarya Ramakrishnan <aishwaryarj100@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoptp_qoriq: output PPS signal on FIPER2 in default
Yangbo Lu [Mon, 27 Apr 2020 03:39:03 +0000 (11:39 +0800)]
ptp_qoriq: output PPS signal on FIPER2 in default

Output PPS signal on FIPER2 (Fixed Period Interval Pulse) in default
which is more desired by user.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'netlink-validation-improvements-refactoring'
David S. Miller [Fri, 1 May 2020 00:51:42 +0000 (17:51 -0700)]
Merge branch 'netlink-validation-improvements-refactoring'

Johannes Berg says:

====================
netlink validation improvements/refactoring

Alright, this is the resend now, really just changing

 - the WARN_ON_ONCE() as spotted by Jakub;
 - mark the export patch no longer RFC.
   I wasn't actually sure if you meant this one too, and I really
   should dig out and polish the code that showed it in userspace.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonetlink: add infrastructure to expose policies to userspace
Johannes Berg [Thu, 30 Apr 2020 20:13:12 +0000 (22:13 +0200)]
netlink: add infrastructure to expose policies to userspace

Add, and use in generic netlink, helpers to dump out a netlink
policy to userspace, including all the range validation data,
nested policies etc.

This lets userspace discover what the kernel understands.

For families/commands other than generic netlink, the helpers
need to be used directly in an appropriate command, or we can
add some infrastructure (a new netlink family) that those can
register their policies with for introspection. I'm not that
familiar with non-generic netlink, so that's left out for now.

The data exposed to userspace also includes min and max length
for binary/string data, I've done that instead of letting the
userspace tools figure out whether min/max is intended based
on the type so that we can extend this later in the kernel, we
might want to just use the range data for example.

Because of this, I opted to not directly expose the NLA_*
values, even if some of them are already exposed via BPF, as
with min/max length we don't need to have different types here
for NLA_BINARY/NLA_MIN_LEN/NLA_EXACT_LEN, we just make them
all NL_ATTR_TYPE_BINARY with min/max length optionally set.

Similarly, we don't really need NLA_MSECS, and perhaps can
remove it in the future - but not if we encode it into the
userspace API now. It gets mapped to NL_ATTR_TYPE_U64 here.

Note that the exposing here corresponds to the strict policy
interpretation, and NLA_UNSPEC items are omitted entirely.
To get those, change them to NLA_MIN_LEN which behaves in
exactly the same way, but is exposed.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonetlink: factor out policy range helpers
Johannes Berg [Thu, 30 Apr 2020 20:13:11 +0000 (22:13 +0200)]
netlink: factor out policy range helpers

Add helpers to get the policy's signed/unsigned range
validation data.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonetlink: remove NLA_EXACT_LEN_WARN
Johannes Berg [Thu, 30 Apr 2020 20:13:10 +0000 (22:13 +0200)]
netlink: remove NLA_EXACT_LEN_WARN

Use a validation type instead, so we can later expose
the NLA_* values to userspace for policy descriptions.

Some transformations were done with this spatch:

    @@
    identifier p;
    expression X, L, A;
    @@
    struct nla_policy p[X] = {
    [A] =
    -{ .type = NLA_EXACT_LEN_WARN, .len = L },
    +NLA_POLICY_EXACT_LEN_WARN(L),
    ...
    };

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonetlink: allow NLA_MSECS to have range validation
Johannes Berg [Thu, 30 Apr 2020 20:13:09 +0000 (22:13 +0200)]
netlink: allow NLA_MSECS to have range validation

Since NLA_MSECS is really equivalent to NLA_U64, allow
it to have range validation as well.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonetlink: extend policy range validation
Johannes Berg [Thu, 30 Apr 2020 20:13:08 +0000 (22:13 +0200)]
netlink: extend policy range validation

Using a pointer to a struct indicating the min/max values,
extend the ability to do range validation for arbitrary
values. Small values in the s16 range can be kept in the
policy directly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonl80211: link recursive netlink nested policy
Johannes Berg [Thu, 30 Apr 2020 20:13:07 +0000 (22:13 +0200)]
nl80211: link recursive netlink nested policy

Now that we have limited recursive policy validation to avoid
stack overflows, change nl80211 to actually link the nested
policy (linking back to itself eventually), which allows some
code cleanups.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonetlink: limit recursion depth in policy validation
Johannes Berg [Thu, 30 Apr 2020 20:13:06 +0000 (22:13 +0200)]
netlink: limit recursion depth in policy validation

Now that we have nested policies, we can theoretically
recurse forever parsing attributes if a (sub-)policy
refers back to a higher level one. This is a situation
that has happened in nl80211, and we've avoided it there
by not linking it.

Add some code to netlink parsing to limit recursion depth.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonetlink: remove type-unsafe validation_data pointer
Johannes Berg [Thu, 30 Apr 2020 20:13:05 +0000 (22:13 +0200)]
netlink: remove type-unsafe validation_data pointer

In the netlink policy, we currently have a void *validation_data
that's pointing to different things:
 * a u32 value for bitfield32,
 * the netlink policy for nested/nested array
 * the string for NLA_REJECT

Remove the pointer and place appropriate type-safe items in the
union instead.

While at it, completely dissolve the pointer for the bitfield32
case and just put the value there directly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-dsa-b53-ARL-improvements'
David S. Miller [Fri, 1 May 2020 00:43:29 +0000 (17:43 -0700)]
Merge branch 'net-dsa-b53-ARL-improvements'

Florian Fainelli says:

====================
net: dsa: b53: ARL improvements

This patch series improves the b53 driver ARL search code by
renaming the ARL entries to be reflective of what they are: bins, and
then introduce the number of buckets so we can properly bound check ARL
searches.

The final patch removes an unused argument.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: b53: Remove is_static argument to b53_read_op()
Florian Fainelli [Thu, 30 Apr 2020 18:49:11 +0000 (11:49 -0700)]
net: dsa: b53: Remove is_static argument to b53_read_op()

This argument is not used.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: b53: Bound check ARL searches
Florian Fainelli [Thu, 30 Apr 2020 18:49:10 +0000 (11:49 -0700)]
net: dsa: b53: Bound check ARL searches

ARL searches are done by reading two ARL entries at a time, do not cap
the search at 1024 which would only limit us to half of the possible ARL
capacity, but use b53_max_arl_entries() instead which does the right
multiplication between bins and indexes.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: b53: Provide number of ARL buckets
Florian Fainelli [Thu, 30 Apr 2020 18:49:09 +0000 (11:49 -0700)]
net: dsa: b53: Provide number of ARL buckets

In preparation for doing proper upper bound checking of FDB/MDB entries
being added to the ARL, provide the number of ARL buckets for each
switch chip we support. All chips have 1024 buckets, except 7278 which
has only 256.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: b53: Rename num_arl_entries to num_arl_bins
Florian Fainelli [Thu, 30 Apr 2020 18:49:08 +0000 (11:49 -0700)]
net: dsa: b53: Rename num_arl_entries to num_arl_bins

The variable currently holds the number of ARL bins per ARL buckets,
which is different from the number of ARL entries which would be bins
times buckets. We will be adding a num_arl_buckets in a subsequent patch
so get variables straight now.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'r8169-refactor-and-improve-interrupt-coalescing'
David S. Miller [Fri, 1 May 2020 00:39:15 +0000 (17:39 -0700)]
Merge branch 'r8169-refactor-and-improve-interrupt-coalescing'

Heiner Kallweit says:

====================
r8169: refactor and improve interrupt coalescing

Refactor and improve interrupt coalescing.
====================

Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: add check for invalid parameter combination in rtl_set_coalesce
Heiner Kallweit [Thu, 30 Apr 2020 19:59:48 +0000 (21:59 +0200)]
r8169: add check for invalid parameter combination in rtl_set_coalesce

Realtek provided information about a HW constraint that time limit must
not be set to 0 if the frame limit is >0. Add a check for this and
reject invalid parameter combinations.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: improve rtl_set_coalesce
Heiner Kallweit [Thu, 30 Apr 2020 19:58:47 +0000 (21:58 +0200)]
r8169: improve rtl_set_coalesce

Use FIELD_PREP() to make the code better readable, and avoid the loop.
No functional change intended.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: improve interrupt coalescing parameter handling
Heiner Kallweit [Thu, 30 Apr 2020 19:58:06 +0000 (21:58 +0200)]
r8169: improve interrupt coalescing parameter handling

The chip supports only frame limits 0, 4, 8, .. 60 internally.
Returning EINVAL for all val % 4 != 0 seems to be a little bit too
unfriendly to the user. Therefore round up the frame limit to the next
supported value. In addition round up the time limit, else a very low
limit could be rounded down to 0, and interpreted as "ignore value"
by the chip.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: improve rtl_coalesce_choose_scale
Heiner Kallweit [Thu, 30 Apr 2020 19:57:32 +0000 (21:57 +0200)]
r8169: improve rtl_coalesce_choose_scale

The time limit provided by userspace is multiplied with 1000,
what could result in an overflow. Therefore change the time limit
parameter unit from ns to us, and avoid the problematic operation.
If there's no matching scale because provided time limit is too big,
return ERANGE instead of EINVAL to provide a hint to the user what's
wrong.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: improve rtl_get_coalesce
Heiner Kallweit [Thu, 30 Apr 2020 19:56:58 +0000 (21:56 +0200)]
r8169: improve rtl_get_coalesce

Use FIELD_GET() macro to make the code better readable. In addition
change the logic to round the time limit up, not down. Reason is that
a time limit <1us would be rounded to 0 currently, what would be
interpreted as "no time limit set".

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: merge scale for tx and rx irq coalescing
Heiner Kallweit [Thu, 30 Apr 2020 19:56:20 +0000 (21:56 +0200)]
r8169: merge scale for tx and rx irq coalescing

Rx and tx scale are the same always. Simplify the code by using one
scale for rx and tx only.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: don't pass net_device to irq coalescing sub-functions
Heiner Kallweit [Thu, 30 Apr 2020 19:55:36 +0000 (21:55 +0200)]
r8169: don't pass net_device to irq coalescing sub-functions

The net_device argument is just used to get a struct rtl8169_private
pointer via netdev_priv(). Therefore pass the struct rtl8169_private
pointer directly.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agohsr: remove hsr interface if all slaves are removed
Taehee Yoo [Thu, 30 Apr 2020 17:37:02 +0000 (17:37 +0000)]
hsr: remove hsr interface if all slaves are removed

When all hsr slave interfaces are removed, hsr interface doesn't work.
At that moment, it's fine to remove an unused hsr interface automatically
for saving resources.
That's a common behavior of virtual interfaces.

Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'tcp-sack-compression-changes'
David S. Miller [Thu, 30 Apr 2020 20:24:01 +0000 (13:24 -0700)]
Merge branch 'tcp-sack-compression-changes'

Eric Dumazet says:

====================
tcp: sack compression changes

Patch series refines SACK compression.

We had issues with missing SACK when TCP option space is tight.

Uses hrtimer slack to improve performance.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotcp: add hrtimer slack to sack compression
Eric Dumazet [Thu, 30 Apr 2020 17:35:43 +0000 (10:35 -0700)]
tcp: add hrtimer slack to sack compression

Add a sysctl to control hrtimer slack, default of 100 usec.

This gives the opportunity to reduce system overhead,
and help very short RTT flows.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotcp: tcp_sack_new_ofo_skb() should be more conservative
Eric Dumazet [Thu, 30 Apr 2020 17:35:42 +0000 (10:35 -0700)]
tcp: tcp_sack_new_ofo_skb() should be more conservative

Currently, tcp_sack_new_ofo_skb() sends an ack if prior
acks were 'compressed', if room has to be made in tp->selective_acks[]

But there is no guarantee all four sack ranges can be included
in SACK option. As a matter of fact, when TCP timestamps option
is used, only three SACK ranges can be included.

Lets assume only two ranges can be included, and force the ack:

- When we touch more than 2 ranges in the reordering
  done if tcp_sack_extend() could be done.

- If we have at least 2 ranges when adding a new one.

This enforces that before a range is in third or fourth
position, at least one ACK packet included it in first/second
position.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotcp: add tp->dup_ack_counter
Eric Dumazet [Thu, 30 Apr 2020 17:35:41 +0000 (10:35 -0700)]
tcp: add tp->dup_ack_counter

In commit 86de5921a3d5 ("tcp: defer SACK compression after DupThresh")
I added a TCP_FASTRETRANS_THRESH bias to tp->compressed_ack in order
to enable sack compression only after 3 dupacks.

Since we plan to relax this rule for flows that involve
stacks not requiring this old rule, this patch adds
a distinct tp->dup_ack_counter.

This means the TCP_FASTRETRANS_THRESH value is now used
in a single location that a future patch can adjust:

if (tp->dup_ack_counter < TCP_FASTRETRANS_THRESH) {
tp->dup_ack_counter++;
goto send_now;
}

This patch also introduces tcp_sack_compress_send_ack()
helper to ease following patch comprehension.

This patch refines LINUX_MIB_TCPACKCOMPRESSED to not
count the acks that we had to send if the timer expires
or tcp_sack_compress_send_ack() is sending an ack.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge tag 'mlx5-updates-2020-04-30' of git://git.kernel.org/pub/scm/linux/kernel...
David S. Miller [Thu, 30 Apr 2020 20:15:16 +0000 (13:15 -0700)]
Merge tag 'mlx5-updates-2020-04-30' of git://git./linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
mlx5-updates-2020-04-30

1) Add release all pages support, From Eran.
   to release all FW pages at once on driver unload, when supported by FW.

2) From Maxim and Tariq, Trivial Data path cleanup and code improvements
   in preparation for their next features, TLS offload and TX performance
    improvements

3) Multiple cleanups.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'mlxsw-Prepare-SPAN-API-for-upcoming-changes'
David S. Miller [Thu, 30 Apr 2020 20:02:32 +0000 (13:02 -0700)]
Merge branch 'mlxsw-Prepare-SPAN-API-for-upcoming-changes'

Ido Schimmel says:

====================
mlxsw: Prepare SPAN API for upcoming changes

Switched port analyzer (SPAN) is used for packet mirroring. Over mlxsw
this is achieved by attaching tc-mirred action to either matchall or
flower classifier.

The current API used to configure SPAN consists of two functions:
mlxsw_sp_span_mirror_add() and mlxsw_sp_span_mirror_del().

These two functions pack a lot of different operations:

* SPAN agent configuration: Determining the egress port and optional
  headers that need to encapsulate the mirrored packet (when mirroring
  to a gretap, for example)

* Egress mirror buffer configuration: Allocating / freeing a buffer when
  port is analyzed (inspected) at egress

* SPAN agent binding: Binding the SPAN agent to a trigger, if any. The
  current triggers are incoming / outgoing packet and they are only used
  for matchall-based mirroring

This non-modular design makes it difficult to extend the API for future
changes, such as new mirror targets (CPU) and new global triggers (early
dropped packets, for example).

Therefore, this patch set gradually adds APIs for above mentioned
operations and then converts the two existing users to use it instead of
the old API. No functional changes intended. Tested with existing
mirroring selftests.

Patch set overview:

Patches #1-#5 gradually add the new API
Patches #6-#8 convert existing users to use the new API
Patch #9 removes the old API
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum_span: Remove old SPAN API
Ido Schimmel [Thu, 30 Apr 2020 17:01:16 +0000 (20:01 +0300)]
mlxsw: spectrum_span: Remove old SPAN API

Remove the old SPAN API now that matchall-based and flower-based
mirroring were converted to use the new API.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum_span: Use new analyzed ports list during speed / MTU change
Ido Schimmel [Thu, 30 Apr 2020 17:01:15 +0000 (20:01 +0300)]
mlxsw: spectrum_span: Use new analyzed ports list during speed / MTU change

As previously explained, each port whose outgoing traffic is analyzed
needs to have an egress mirror buffer.

The size of the egress mirror buffer is calculated based on various
parameters, two of which are the speed and the MTU of the port.

Therefore, when the MTU or the speed of a port change, the SPAN code is
called to see if the egress mirror buffer of the port needs to be
adjusted.

Currently, this is done by traversing all the SPAN agents and for each
SPAN agent the list of bound ports is traversed.

Instead of the above, traverse the recently added list of analyzed
ports.

This will later allow us to remove the old SPAN API.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum_acl: Convert flower-based mirroring to new SPAN API
Ido Schimmel [Thu, 30 Apr 2020 17:01:14 +0000 (20:01 +0300)]
mlxsw: spectrum_acl: Convert flower-based mirroring to new SPAN API

In flower-based mirroring, mirroring is done with ACLs and the SPAN
agent is not bound to a port. Instead its identifier is specified in an
ACL action.

Convert this type of mirroring to use the new API.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum: Convert matchall-based mirroring to new SPAN API
Ido Schimmel [Thu, 30 Apr 2020 17:01:13 +0000 (20:01 +0300)]
mlxsw: spectrum: Convert matchall-based mirroring to new SPAN API

In matchall-based mirroring, mirroring is not done with ACLs, but a SPAN
agent is bound to the ingress / egress of a port and all incoming /
outgoing traffic is mirrored.

Convert this type of mirroring to use the new API.

First the SPAN agent is resolved, then the port is marked as analyzed
and its egress mirror buffer is potentially allocated. Lastly, the
binding is performed.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum_span: Add APIs to bind / unbind a SPAN agent
Ido Schimmel [Thu, 30 Apr 2020 17:01:12 +0000 (20:01 +0300)]
mlxsw: spectrum_span: Add APIs to bind / unbind a SPAN agent

Currently, a SPAN agent can only be bound to a per-port trigger where
the trigger is either an incoming packet (INGRESS) or an outgoing packet
(EGRESS) to / from the port.

A follow-up patch set will introduce the concept of global triggers and
per-{port, TC} enablement. With global triggers, the trigger entry is
only keyed by a trigger and not by a port and a trigger. The trigger can
be, for example, a packet that was early dropped.

While the binding between the SPAN agent and the trigger is performed
only once, the trigger entry needs to be reference counted, as the
trigger can be enabled on multiple ports.

Add APIs to bind / unbind a SPAN agent to a trigger and reference count
the trigger entry in preparation for global triggers.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum_span: Wrap buffer change in a function
Ido Schimmel [Thu, 30 Apr 2020 17:01:11 +0000 (20:01 +0300)]
mlxsw: spectrum_span: Wrap buffer change in a function

The code that adjusts the egress buffer size is not symmetric at the
moment. The update is done via a call to
mlxsw_sp_span_port_buffer_update(), but the disablement is done inline
by invoking the write to SBIB register directly.

Wrap the disablement code in mlxsw_sp_span_port_buffer_disable().

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Suggested-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>