platform/kernel/linux-starfive.git
23 months agonet: ethernet: mtk_wed: add wcid overwritten support for wed v1
Sujuan Chen [Thu, 24 Nov 2022 03:18:14 +0000 (11:18 +0800)]
net: ethernet: mtk_wed: add wcid overwritten support for wed v1

All wed versions should enable the wcid overwritten feature,
since the wcid size is controlled by the wlan driver.

Tested-by: Sujuan Chen <sujuan.chen@mediatek.com>
Co-developed-by: Bo Jiao <bo.jiao@mediatek.com>
Signed-off-by: Bo Jiao <bo.jiao@mediatek.com>
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agoMerge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next...
David S. Miller [Fri, 25 Nov 2022 10:46:22 +0000 (10:46 +0000)]
Merge branch '100GbE' of git://git./linux/kernel/git/tnguy/next-queue

Tony Nguyen says:

====================
Intel Wired LAN Driver Updates 2022-11-23 (ice)

This series contains updates to ice driver only.

Karol adjusts check of PTP hardware to wait longer but check more often.

Brett removes use of driver defined link speed; instead using the values
from ethtool.h, utilizing static tables for indexing.

Ben adds tracking of stats in order to accumulate reported statistics that
were previously reset by hardware.

Marcin fixes issues setting RXDID when queues are asymmetric.

Anatolii re-introduces use of define over magic number; ICE_RLAN_BASE_S.
---
v3:
 - Dropped, previous, patch 2
v2:
Patch 5
 - Convert some allocations to non-managed
 - Remove combined error checking; add error checks for each call
 - Remove excess NULL checks
 - Remove unnecessary NULL sets and newlines
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agoMerge branch 'net-remove-kmap_atomic'
David S. Miller [Fri, 25 Nov 2022 10:44:01 +0000 (10:44 +0000)]
Merge branch 'net-remove-kmap_atomic'

Anirudh Venkataramanan says:

====================
net: Remove uses of kmap_atomic()

kmap_atomic() is being deprecated. This little series replaces the last
few uses of kmap_atomic() in the networking subsystem.

This series triggered a suggestion [1] that perhaps the Sun Cassini,
LDOM Virtual Switch Driver and the LDOM virtual network drivers should be
removed completely. I plan to do this in a follow up patchset. For
completeness, this series still includes kmap_atomic() conversions that
apply to the above referenced drivers. If for some reason we choose to not
remove these drivers, at least they won't be using kmap_atomic() anymore.

Also, the following maintainer entries for the Chelsio driver seem to be
defunct:

  Vinay Kumar Yadav <vinay.yadav@chelsio.com>
  Rohit Maheshwari <rohitm@chelsio.com>

I can submit a follow up patch to remove these entries, but thought
maybe the folks over at Chelsio would want to look into this first.

Changes v1 -> v2:
  Use memcpy_from_page() in patches 2/6 and 4/6
  Add new patch for the thunderbolt driver
  Update commit messages and cover letter
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: thunderbolt: Use kmap_local_page() instead of kmap_atomic()
Anirudh Venkataramanan [Wed, 23 Nov 2022 20:52:19 +0000 (12:52 -0800)]
net: thunderbolt: Use kmap_local_page() instead of kmap_atomic()

kmap_atomic() is being deprecated in favor of kmap_local_page(). Replace
kmap_atomic() and kunmap_atomic() with kmap_local_page() and kunmap_local()
respectively.

Note that kmap_atomic() disables preemption and page-fault processing, but
kmap_local_page() doesn't. When converting uses of kmap_atomic(), one has
to check if the code being executed between the map/unmap implicitly
depends on page-faults and/or preemption being disabled. If yes, then code
to disable page-faults and/or preemption should also be added for
functional correctness. That however doesn't appear to be the case here,
so just kmap_local_page() is used.

Also note that the page being mapped is not allocated by the driver, and so
the driver doesn't know if the page is in normal memory. This is the reason
kmap_local_page() is used as opposed to page_address().

I don't have hardware, so this change has only been compile tested.

Cc: Michael Jamet <michael.jamet@intel.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Yehezkel Bernat <YehezkelShB@gmail.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agosunvnet: Use kmap_local_page() instead of kmap_atomic()
Anirudh Venkataramanan [Wed, 23 Nov 2022 20:52:18 +0000 (12:52 -0800)]
sunvnet: Use kmap_local_page() instead of kmap_atomic()

kmap_atomic() is being deprecated in favor of kmap_local_page(). Replace
kmap_atomic() and kunmap_atomic() with kmap_local_page() and kunmap_local()
respectively.

Note that kmap_atomic() disables preemption and page-fault processing, but
kmap_local_page() doesn't. When converting uses of kmap_atomic(), one has
to check if the code being executed between the map/unmap implicitly
depends on page-faults and/or preemption being disabled. If yes, then code
to disable page-faults and/or preemption should also be added for
functional correctness. That however doesn't appear to be the case here,
so just kmap_local_page() is used.

Also note that the page being mapped is not allocated by the driver, and so
the driver doesn't know if the page is in normal memory. This is the reason
kmap_local_page() is used as opposed to page_address().

I don't have hardware, so this change has only been compile tested.

Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agocassini: Use memcpy_from_page() instead of k[un]map_atomic()
Anirudh Venkataramanan [Wed, 23 Nov 2022 20:52:17 +0000 (12:52 -0800)]
cassini: Use memcpy_from_page() instead of k[un]map_atomic()

kmap_atomic() is being deprecated in favor of kmap_local_page(). Replace
the map-memcpy-unmap usage pattern (done using k[un]map_atomic()) with
memcpy_from_page(), which internally uses kmap_local_page() and
kunmap_local(). This renders the variable 'vaddr' unnecessary, and so
remove this too.

Note that kmap_atomic() disables preemption and page-fault processing, but
kmap_local_page() doesn't. When converting uses of kmap_atomic(), one has
to check if the code being executed between the map/unmap implicitly
depends on page-faults and/or preemption being disabled. If yes, then code
to disable page-faults and/or preemption should also be added for
functional correctness. That however doesn't appear to be the case here,
so just memcpy_from_page() is used.

Also note that the page being mapped is not allocated by the driver, and so
the driver doesn't know if the page is in normal memory. This is the reason
kmap_local_page() is used (via memcpy_from_page()) as opposed to
page_address().

I don't have hardware, so this change has only been compile tested.

Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agocassini: Use page_address() instead of kmap_atomic()
Anirudh Venkataramanan [Wed, 23 Nov 2022 20:52:16 +0000 (12:52 -0800)]
cassini: Use page_address() instead of kmap_atomic()

Pages for Rx buffers are allocated in cas_page_alloc() using either
GFP_ATOMIC or GFP_KERNEL. Memory allocated with GFP_KERNEL/GFP_ATOMIC can't
come from highmem and so there's no need to kmap() them. Just use
page_address() instead. This makes the variable 'addr' unnecessary, so
remove it too.

Note that kmap_atomic() disables preemption and page-fault processing,
but page_address() doesn't. When removing uses of kmap_atomic(), one has to
check if the code being executed between the map/unmap implicitly depends
on page-faults and/or preemption being disabled. If yes, then code to
disable page-faults and/or preemption should also be added for functional
correctness. That however doesn't appear to be the case here, so just
page_address() is used.

I don't have hardware, so this change has only been compile tested.

Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agosfc: Use kmap_local_page() instead of kmap_atomic()
Anirudh Venkataramanan [Wed, 23 Nov 2022 20:52:15 +0000 (12:52 -0800)]
sfc: Use kmap_local_page() instead of kmap_atomic()

kmap_atomic() is being deprecated in favor of kmap_local_page(). Replace
kmap_atomic() and kunmap_atomic() with kmap_local_page() and kunmap_local()
respectively.

Note that kmap_atomic() disables preemption and page-fault processing, but
kmap_local_page() doesn't. When converting uses of kmap_atomic(), one has
to check if the code being executed between the map/unmap implicitly
depends on page-faults and/or preemption being disabled. If yes, then code
to disable page-faults and/or preemption should also be added for
functional correctness. That however doesn't appear to be the case here,
so just kmap_local_page() is used.

Also note that the page being mapped is not allocated by the driver, and so
the driver doesn't know if the page is in normal memory. This is the reason
kmap_local_page() is used as opposed to page_address().

I don't have hardware, so this change has only been compile tested.

Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Cc: Edward Cree <ecree.xilinx@gmail.com>
Cc: Martin Habets <habetsm.xilinx@gmail.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Acked-by: Martin Habets <habetsm.xilinx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agoch_ktls: Use memcpy_from_page() instead of k[un]map_atomic()
Anirudh Venkataramanan [Wed, 23 Nov 2022 20:52:14 +0000 (12:52 -0800)]
ch_ktls: Use memcpy_from_page() instead of k[un]map_atomic()

kmap_atomic() is being deprecated in favor of kmap_local_page(). Replace
the map-memcpy-unmap usage pattern (done using k[un]map_atomic()) with
memcpy_from_page(), which internally uses kmap_local_page() and
kunmap_local(). This renders the variables 'data' and 'vaddr' unnecessary,
and so remove these too.

Note that kmap_atomic() disables preemption and page-fault processing, but
kmap_local_page() doesn't. When converting uses of kmap_atomic(), one has
to check if the code being executed between the map/unmap implicitly
depends on page-faults and/or preemption being disabled. If yes, then code
to disable page-faults and/or preemption should also be added for
functional correctness. That however doesn't appear to be the case here,
so just memcpy_from_page() is used.

Also note that the page being mapped is not allocated by the driver, and so
the driver doesn't know if the page is in normal memory. This is the reason
kmap_local_page() is used (via memcpy_from_page()) as opposed to
page_address().

I don't have hardware, so this change has only been compile tested.

Cc: Ayush Sawal <ayush.sawal@chelsio.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Acked-by: Ayush Sawal <ayush.sawal@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agoMerge branch 'lan966x-extend-xdp-support'
David S. Miller [Fri, 25 Nov 2022 10:38:10 +0000 (10:38 +0000)]
Merge branch 'lan966x-extend-xdp-support'

Horatiu Vultur says:

====================
net: lan966x: Extend xdp support

Extend the current support of XDP in lan966x with the action XDP_TX and
XDP_REDIRECT.
The first patches just prepare the things such that it would be easier
to add XDP_TX and XDP_REDIRECT actions. Like adding XDP_PACKET_HEADROOM,
introduce helper functions, use the correct dma_dir for the page pool
The last 2 patches introduce the XDP actions XDP_TX and XDP_REDIRECT.

v4->v5:
- add iterator declaration inside for loops
- move the scope of port inside the function lan966x_fdma_rx_alloc_page_pool
- create union for skb and xdpf inside struct lan966x_tx_dcb_buf

v3->v4:
- use napi_consume_skb instead of dev_kfree_skb_any
- arrange members in struct lan966x_tx_dcb_buf not to have holes
- fix when xdp program is added the check for determining if page pool
  needs to be recreated was wrong
- change type for len in lan966x_tx_dcb_buf to u32

v2->v3:
- make sure to update rxq memory model
- update the page pool direction if there is any xdp program
- in case of action XDP_TX give back to reuse the page
- in case of action XDP_REDIRECT, remap the frame and make sure to
  unmap it when is transmitted.

v1->v2:
- use skb_reserve of using skb_put and skb_pull
- make sure that data_len doesn't include XDP_PACKET_HEADROOM
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: lan966x: Add support for XDP_REDIRECT
Horatiu Vultur [Wed, 23 Nov 2022 20:31:39 +0000 (21:31 +0100)]
net: lan966x: Add support for XDP_REDIRECT

Extend lan966x XDP support with the action XDP_REDIRECT. This is similar
with the XDP_TX, so a lot of functionality can be reused.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: lan966x: Add support for XDP_TX
Horatiu Vultur [Wed, 23 Nov 2022 20:31:38 +0000 (21:31 +0100)]
net: lan966x: Add support for XDP_TX

Extend lan966x XDP support with the action XDP_TX. In this case when the
received buffer needs to execute XDP_TX, the buffer will be moved to the
TX buffers. So a new RX buffer will be allocated.
When the TX finish with the frame, it would give back the buffer to the
page pool.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: lan966x: Update dma_dir of page_pool_params
Horatiu Vultur [Wed, 23 Nov 2022 20:31:37 +0000 (21:31 +0100)]
net: lan966x: Update dma_dir of page_pool_params

To add support for XDP_TX it is required to be able to write to the DMA
area therefore it is required that the pages will be mapped using
DMA_BIDIRECTIONAL flag.
Therefore check if there are any xdp programs on the interfaces and in
that case set DMA_BIDRECTIONAL otherwise use DMA_FROM_DEVICE.
Therefore when a new XDP program is added it is required to redo the
page_pool.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: lan966x: Update rxq memory model
Horatiu Vultur [Wed, 23 Nov 2022 20:31:36 +0000 (21:31 +0100)]
net: lan966x: Update rxq memory model

By default the rxq memory model is MEM_TYPE_PAGE_SHARED but to be able
to reuse pages on the TX side, when the XDP action XDP_TX it is required
to update the memory model to PAGE_POOL.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: lan966x: Add len field to lan966x_tx_dcb_buf
Horatiu Vultur [Wed, 23 Nov 2022 20:31:35 +0000 (21:31 +0100)]
net: lan966x: Add len field to lan966x_tx_dcb_buf

Currently when a frame was transmitted, it is required to unamp the
frame that was transmitted. The length of the frame was taken from the
transmitted skb. In the future we might not have an skb, therefore store
the length skb directly in the lan966x_tx_dcb_buf and use this one to
unamp the frame.
While at this, also arrange the members in lan966x_tx_dcb_buf not to
have any holes.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: lan966x: Introduce helper functions
Horatiu Vultur [Wed, 23 Nov 2022 20:31:34 +0000 (21:31 +0100)]
net: lan966x: Introduce helper functions

Introduce lan966x_fdma_tx_setup_dcb and lan966x_fdma_tx_start functions
and use of them inside lan966x_fdma_xmit. There is no functional change
in here.
They are introduced to be used when XDP_TX/REDIRECT actions are
introduced.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: lan966x: Add XDP_PACKET_HEADROOM
Horatiu Vultur [Wed, 23 Nov 2022 20:31:33 +0000 (21:31 +0100)]
net: lan966x: Add XDP_PACKET_HEADROOM

Update the page_pool params to allocate XDP_PACKET_HEADROOM space as
headroom for all received frames.
This is needed for when the XDP_TX and XDP_REDIRECT are implemented.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agoptp: idt82p33: remove PEROUT_ENABLE_OUTPUT_MASK
Min Li [Wed, 23 Nov 2022 19:52:07 +0000 (14:52 -0500)]
ptp: idt82p33: remove PEROUT_ENABLE_OUTPUT_MASK

PEROUT_ENABLE_OUTPUT_MASK was there to allow us to enable/disable
all the perout pins. But it is not standard procedure, we will
have to discard it.

Signed-off-by: Min Li <min.li.xe@renesas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agoptp: idt82p33: Add PTP_CLK_REQ_EXTTS support
Min Li [Wed, 23 Nov 2022 19:52:06 +0000 (14:52 -0500)]
ptp: idt82p33: Add PTP_CLK_REQ_EXTTS support

82P33 family of chips can trigger TOD read/write by external
signal from one of the IN12/13/14 pins, which are set user
space programs by calling PTP_PIN_SETFUNC through ptp_ioctl

Signed-off-by: Min Li <min.li.xe@renesas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agoMerge branch 'sparx5-tc-protocol-all'
David S. Miller [Fri, 25 Nov 2022 09:42:14 +0000 (09:42 +0000)]
Merge branch 'sparx5-tc-protocol-all'

Steen Hegelund says:

====================
net: TC protocol all support in Sparx5 IS2 VCAP

This provides support for the TC flower filters 'protocol all' clause in
the Sparx5 IS2 VCAP.

It builds on top of the initial IS2 VCAP support found in these series:

https://lore.kernel.org/all/20221020130904.1215072-1-steen.hegelund@microchip.com/
https://lore.kernel.org/all/20221109114116.3612477-1-steen.hegelund@microchip.com/
https://lore.kernel.org/all/20221111130519.1459549-1-steen.hegelund@microchip.com/
https://lore.kernel.org/all/20221117213114.699375-1-steen.hegelund@microchip.com/

Functionality:
==============

As the configuration for the Sparx5 IS2 VCAP consists of one (or more)
keyset(s) for each lookup/port per traffic classification, it is not
always possible to cover all protocols with just one ordinary VCAP rule.

To improve this situation the driver will try to find out what keysets a
rule will need to cover a TC flower "protocol all" filter and then compare
this set of keysets to what the hardware is currently configured for.

In case multiple keysets are needed then the driver can create a rule per
rule size (e.g. X6 and X12) and use a mask on the keyset type field to
allow the VCAP to match more than one keyset with just one rule.

This is possible because the keysets that have the same size typically has
many keys in common, so the VCAP rule keys can make a common match.

The result is that one TC filter command may create multiple IS2 VCAP rules
of different sizes that have a type field with a masked type id.

Delivery:
=========

This is current plan for delivering the full VCAP feature set of Sparx5:

- Sparx5 IS0 VCAP support
- TC policer and drop action support (depends on the Sparx5 QoS support
  upstreamed separately)
- Sparx5 ES0 VCAP support
- TC flower template support
- TC matchall filter support for mirroring and policing ports
- TC flower filter mirror action support
- Sparx5 ES2 VCAP support

Version History:
================
v2      Fixed a NULL return value compiler warning.
        Moved the new vcap_find_actionfield function a bit up in the file.

v1      Initial version
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: microchip: sparx5: Add VCAP filter keys KUNIT test
Steen Hegelund [Wed, 23 Nov 2022 15:25:45 +0000 (16:25 +0100)]
net: microchip: sparx5: Add VCAP filter keys KUNIT test

This tests the filtering of keys, either dropping unsupported keys or
dropping keys specified in a list.

Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: microchip: sparx5: Support for displaying a list of keysets
Steen Hegelund [Wed, 23 Nov 2022 15:25:44 +0000 (16:25 +0100)]
net: microchip: sparx5: Support for displaying a list of keysets

This will display a list of keyset in case the type_id field in the VCAP
rule has been wildcarded.

Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: microchip: sparx5: Support for TC protocol all
Steen Hegelund [Wed, 23 Nov 2022 15:25:43 +0000 (16:25 +0100)]
net: microchip: sparx5: Support for TC protocol all

This allows support of TC protocol all for the Sparx5 IS2 VCAP.

This is done by creating multiple rules that covers the rule size and
traffic types in the IS2.
Each rule size (e.g X16 and X6) may have multiple keysets and if there are
more than one the type field in the VCAP rule will be wildcarded to support
these keysets.

Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: microchip: sparx5: Support for copying and modifying rules in the API
Steen Hegelund [Wed, 23 Nov 2022 15:25:42 +0000 (16:25 +0100)]
net: microchip: sparx5: Support for copying and modifying rules in the API

This adds support for making a copy of a rule and modify keys and actions
to differentiate the copy.

Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agolib/test_rhashtable: Remove set but unused variable 'insert_retries'
Jiapeng Chong [Wed, 23 Nov 2022 09:37:02 +0000 (17:37 +0800)]
lib/test_rhashtable: Remove set but unused variable 'insert_retries'

Variable 'insert_retries' is not effectively used in the function, so
delete it.

lib/test_rhashtable.c:437:18: warning: variable 'insert_retries' set but not used.

Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3242
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: stmmac: use sysfs_streq() instead of strncmp()
Xu Panda [Tue, 22 Nov 2022 12:09:23 +0000 (20:09 +0800)]
net: stmmac: use sysfs_streq() instead of strncmp()

Replace the open-code with sysfs_streq().

Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
Signed-off-by: Yang Yang <yang.yang29@zte.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: phy: add Motorcomm YT8531S phy id.
Frank [Tue, 22 Nov 2022 08:42:32 +0000 (16:42 +0800)]
net: phy: add Motorcomm YT8531S phy id.

We added patch for motorcomm.c to support YT8531S. This patch has
been tested on AM335x platform which has one YT8531S interface
card and passed all test cases.
The tested cases indluding: YT8531S UTP function with support of
10M/100M/1000M; YT8531S Fiber function with support of 100M/1000M;
and YT8531S Combo function that supports auto detection of media type.

Since most functions of YT8531S are similar to YT8521 and we reuse some
codes for YT8521 in the patch file.

Signed-off-by: Frank <Frank.Sae@motor-comm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: use %pS for kfree_skb tracing event location
Stanislav Fomichev [Wed, 23 Nov 2022 04:09:47 +0000 (20:09 -0800)]
net: use %pS for kfree_skb tracing event location

For the cases where 'reason' doesn't give any clue, it's still
nice to be able to track the kfree_skb caller location. %p doesn't
help much so let's use %pS which prints the symbol+offset.

Signed-off-by: Stanislav Fomichev <sdf@google.com>
Link: https://lore.kernel.org/r/20221123040947.1015721-1-sdf@google.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
23 months agoMerge branch 'bonding-fix-bond-recovery-in-mode-2'
Jakub Kicinski [Thu, 24 Nov 2022 04:15:13 +0000 (20:15 -0800)]
Merge branch 'bonding-fix-bond-recovery-in-mode-2'

Jonathan Toppins says:

====================
bonding: fix bond recovery in mode 2

When a bond is configured with a non-zero updelay and in mode 2 the bond
never recovers after all slaves lose link. The first patch adds
selftests that demonstrate the issue and the second patch fixes the
issue by ignoring the updelay when there are no usable slaves.
====================

Link: https://lore.kernel.org/r/cover.1669147951.git.jtoppins@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agobonding: fix link recovery in mode 2 when updelay is nonzero
Jonathan Toppins [Tue, 22 Nov 2022 21:24:29 +0000 (16:24 -0500)]
bonding: fix link recovery in mode 2 when updelay is nonzero

Before this change when a bond in mode 2 lost link, all of its slaves
lost link, the bonding device would never recover even after the
expiration of updelay. This change removes the updelay when the bond
currently has no usable links. Conforming to bonding.txt section 13.1
paragraph 4.

Fixes: 41f891004063 ("bonding: ignore updelay param when there is no active slave")
Signed-off-by: Jonathan Toppins <jtoppins@redhat.com>
Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agoselftests: bonding: up/down delay w/ slave link flapping
Jonathan Toppins [Tue, 22 Nov 2022 20:25:04 +0000 (15:25 -0500)]
selftests: bonding: up/down delay w/ slave link flapping

Verify when a bond is configured with {up,down}delay and the link state
of slave members flaps if there are no remaining members up the bond
should immediately select a member to bring up. (from bonding.txt
section 13.1 paragraph 4)

Suggested-by: Liang Li <liali@redhat.com>
Signed-off-by: Jonathan Toppins <jtoppins@redhat.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agoethtool: avoiding integer overflow in ethtool_phys_id()
Maxim Korotkov [Tue, 22 Nov 2022 12:29:01 +0000 (15:29 +0300)]
ethtool: avoiding integer overflow in ethtool_phys_id()

The value of an arithmetic expression "n * id.data" is subject
to possible overflow due to a failure to cast operands to a larger data
type before performing arithmetic. Used macro for multiplication instead
operator for avoiding overflow.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Maxim Korotkov <korotkov.maxim.s@gmail.com>
Reviewed-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20221122122901.22294-1-korotkov.maxim.s@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agoMerge branch 'net-complete-conversion-to-i2c_probe_new'
Jakub Kicinski [Wed, 23 Nov 2022 20:50:11 +0000 (12:50 -0800)]
Merge branch 'net-complete-conversion-to-i2c_probe_new'

Jakub Kicinski says:

====================
net: Complete conversion to i2c_probe_new

Reposting for Uwe the networking slice of his mega-series:
https://lore.kernel.org/all/20221118224540.619276-1-uwe@kleine-koenig.org/
so that our build bot can confirm the obvious.

fix mlx5 -> mlxsw while at it.
====================

Link: https://lore.kernel.org/r/20221123045507.2091409-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonfc: st21nfca: i2c: Convert to i2c's .probe_new()
Uwe Kleine-König [Wed, 23 Nov 2022 04:55:07 +0000 (20:55 -0800)]
nfc: st21nfca: i2c: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonfc: st-nci: Convert to i2c's .probe_new()
Uwe Kleine-König [Wed, 23 Nov 2022 04:55:06 +0000 (20:55 -0800)]
nfc: st-nci: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonfc: s3fwrn5: Convert to i2c's .probe_new()
Uwe Kleine-König [Wed, 23 Nov 2022 04:55:05 +0000 (20:55 -0800)]
nfc: s3fwrn5: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonfc: pn544: Convert to i2c's .probe_new()
Uwe Kleine-König [Wed, 23 Nov 2022 04:55:04 +0000 (20:55 -0800)]
nfc: pn544: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonfc: pn533: Convert to i2c's .probe_new()
Uwe Kleine-König [Wed, 23 Nov 2022 04:55:03 +0000 (20:55 -0800)]
nfc: pn533: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agoNFC: nxp-nci: Convert to i2c's .probe_new()
Uwe Kleine-König [Wed, 23 Nov 2022 04:55:02 +0000 (20:55 -0800)]
NFC: nxp-nci: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonfc: mrvl: Convert to i2c's .probe_new()
Uwe Kleine-König [Wed, 23 Nov 2022 04:55:01 +0000 (20:55 -0800)]
nfc: mrvl: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonfc: microread: Convert to i2c's .probe_new()
Uwe Kleine-König [Wed, 23 Nov 2022 04:55:00 +0000 (20:55 -0800)]
nfc: microread: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet/mlxsw: Convert to i2c's .probe_new()
Uwe Kleine-König [Wed, 23 Nov 2022 04:54:59 +0000 (20:54 -0800)]
net/mlxsw: Convert to i2c's .probe_new()

.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: xrs700x: Convert to i2c's .probe_new()
Uwe Kleine-König [Wed, 23 Nov 2022 04:54:58 +0000 (20:54 -0800)]
net: dsa: xrs700x: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: microchip: ksz9477: Convert to i2c's .probe_new()
Uwe Kleine-König [Wed, 23 Nov 2022 04:54:57 +0000 (20:54 -0800)]
net: dsa: microchip: ksz9477: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: lan9303: Convert to i2c's .probe_new()
Uwe Kleine-König [Wed, 23 Nov 2022 04:54:56 +0000 (20:54 -0800)]
net: dsa: lan9303: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agoice: Use ICE_RLAN_BASE_S instead of magic number
Anatolii Gerasymenko [Thu, 3 Nov 2022 14:30:05 +0000 (15:30 +0100)]
ice: Use ICE_RLAN_BASE_S instead of magic number

Commit 72adf2421d9b ("ice: Move common functions out of ice_main.c part
2/7") moved an older version of ice_setup_rx_ctx() function with
usage of magic number 7.
Reimplement the commit 5ab522443bd1 ("ice: Cleanup magic number") to use
ICE_RLAN_BASE_S instead of magic number.

Signed-off-by: Anatolii Gerasymenko <anatolii.gerasymenko@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
23 months agoice: Fix configuring VIRTCHNL_OP_CONFIG_VSI_QUEUES with unbalanced queues
Marcin Szycik [Mon, 7 Nov 2022 16:10:38 +0000 (17:10 +0100)]
ice: Fix configuring VIRTCHNL_OP_CONFIG_VSI_QUEUES with unbalanced queues

Currently the VIRTCHNL_OP_CONFIG_VSI_QUEUES command may fail if there are
less RX queues than TX queues requested.

To fix it, only configure RXDID if RX queue exists.

Fixes: e753df8fbca5 ("ice: Add support Flex RXD")
Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
23 months agoice: Accumulate ring statistics over reset
Benjamin Mikailenko [Fri, 18 Nov 2022 21:20:02 +0000 (16:20 -0500)]
ice: Accumulate ring statistics over reset

Resets may occur with or without user interaction. For example, a TX hang
or reconfiguration of parameters will result in a reset. During reset, the
VSI is freed, freeing any statistics structures inside as well. This would
create an issue for the user where a reset happens in the background,
statistics set to zero, and the user checks ring statistics expecting them
to be populated.

To ensure this doesn't happen, accumulate ring statistics over reset.

Define a new ring statistics structure, ice_ring_stats. The new structure
lives in the VSI's parent, preserving ring statistics when VSI is freed.

1. Define a new structure vsi_ring_stats in the PF scope
2. Allocate/free stats only during probe, unload, or change in ring size
3. Replace previous ring statistics functionality with new structure

Signed-off-by: Benjamin Mikailenko <benjamin.mikailenko@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
23 months agoice: Accumulate HW and Netdev statistics over reset
Benjamin Mikailenko [Fri, 18 Nov 2022 21:20:01 +0000 (16:20 -0500)]
ice: Accumulate HW and Netdev statistics over reset

Resets happen with or without user interaction. For example, incidents
such as TX hang or a reconfiguration of parameters will result in a reset.
During reset, hardware and software statistics were set to zero. This
created an issue for the user where a reset happens in the background,
statistics set to zero, and the user checks statistics expecting them to
be populated.

To ensure this doesn't happen, keep accumulating stats over reset.

1. Remove function calls which reset hardware and netdev statistics.
2. Do not rollover statistics in ice_stat_update40 during reset.

Signed-off-by: Benjamin Mikailenko <benjamin.mikailenko@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
23 months agoice: Remove and replace ice speed defines with ethtool.h versions
Brett Creeley [Mon, 31 Oct 2022 17:09:12 +0000 (10:09 -0700)]
ice: Remove and replace ice speed defines with ethtool.h versions

The driver is currently using ICE_LINK_SPEED_* defines that mirror what
ethtool.h defines, with one exception ICE_LINK_SPEED_UNKNOWN.

This issue is fixed by the following changes:

1. replace ICE_LINK_SPEED_UNKNOWN with 0 because SPEED_UNKNOWN in
   ethtool.h is "-1" and that doesn't match the driver's expected behavior
2. transform ICE_LINK_SPEED_*MBPS to SPEED_* using static tables and
   fls()-1 to convert from BIT() to an index in a table.

Suggested-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Co-developed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
23 months agoice: Check for PTP HW lock more frequently
Karol Kolacinski [Mon, 3 Oct 2022 09:55:18 +0000 (11:55 +0200)]
ice: Check for PTP HW lock more frequently

It was observed that PTP HW semaphore can be held for ~50 ms in worst
case.
SW should wait longer and check more frequently if the HW lock is held.

Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
23 months agosfc: ensure type is valid before updating seen_gen
Edward Cree [Mon, 21 Nov 2022 21:37:08 +0000 (21:37 +0000)]
sfc: ensure type is valid before updating seen_gen

In the case of invalid or corrupted v2 counter update packets,
 efx_tc_rx_version_2() returns EFX_TC_COUNTER_TYPE_MAX.  In this case
 we should not attempt to update generation counts as this will write
 beyond the end of the seen_gen array.

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1527356 ("Memory - illegal accesses")
Fixes: 25730d8be5d8 ("sfc: add extra RX channel to receive MAE counter updates on ef100")
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agoppp: associate skb with a device at tx
Stanislav Fomichev [Mon, 21 Nov 2022 18:29:13 +0000 (10:29 -0800)]
ppp: associate skb with a device at tx

Syzkaller triggered flow dissector warning with the following:

r0 = openat$ppp(0xffffffffffffff9c, &(0x7f0000000000), 0xc0802, 0x0)
ioctl$PPPIOCNEWUNIT(r0, 0xc004743e, &(0x7f00000000c0))
ioctl$PPPIOCSACTIVE(r0, 0x40107446, &(0x7f0000000240)={0x2, &(0x7f0000000180)=[{0x20, 0x0, 0x0, 0xfffff034}, {0x6}]})
pwritev(r0, &(0x7f0000000040)=[{&(0x7f0000000140)='\x00!', 0x2}], 0x1, 0x0, 0x0)

[    9.485814] WARNING: CPU: 3 PID: 329 at net/core/flow_dissector.c:1016 __skb_flow_dissect+0x1ee0/0x1fa0
[    9.485929]  skb_get_poff+0x53/0xa0
[    9.485937]  bpf_skb_get_pay_offset+0xe/0x20
[    9.485944]  ? ppp_send_frame+0xc2/0x5b0
[    9.485949]  ? _raw_spin_unlock_irqrestore+0x40/0x60
[    9.485958]  ? __ppp_xmit_process+0x7a/0xe0
[    9.485968]  ? ppp_xmit_process+0x5b/0xb0
[    9.485974]  ? ppp_write+0x12a/0x190
[    9.485981]  ? do_iter_write+0x18e/0x2d0
[    9.485987]  ? __import_iovec+0x30/0x130
[    9.485997]  ? do_pwritev+0x1b6/0x240
[    9.486016]  ? trace_hardirqs_on+0x47/0x50
[    9.486023]  ? __x64_sys_pwritev+0x24/0x30
[    9.486026]  ? do_syscall_64+0x3d/0x80
[    9.486031]  ? entry_SYSCALL_64_after_hwframe+0x63/0xcd

Flow dissector tries to find skb net namespace either via device
or via socket. Neigher is set in ppp_send_frame, so let's manually
use ppp->dev.

Cc: Paul Mackerras <paulus@samba.org>
Cc: linux-ppp@vger.kernel.org
Reported-by: syzbot+41cab52ab62ee99ed24a@syzkaller.appspotmail.com
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agoDocumentation: devlink: Add blank line padding on numbered lists in Devlink Port...
Bagas Sanjaya [Mon, 21 Nov 2022 03:58:55 +0000 (10:58 +0700)]
Documentation: devlink: Add blank line padding on numbered lists in Devlink Port documentation

kernel test robot reported indentation warnings:

Documentation/networking/devlink/devlink-port.rst:220: WARNING: Unexpected indentation.
Documentation/networking/devlink/devlink-port.rst:222: WARNING: Block quote ends without a blank line; unexpected unindent.

These warnings cause lists (arbitration flow for which the warnings blame to
and 3-step subfunction setup) to be rendered inline instead. Also, for the
former list, automatic list numbering is messed up.

Fix these warnings by adding missing blank line padding.

Link: https://lore.kernel.org/linux-doc/202211200926.kfOPiVti-lkp@intel.com/
Fixes: 242dd64375b80a ("Documentation: Add documentation for new devlink-rate attributes")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agoMerge branch 'revert-veth-avoid-drop-packets-when-xdp_redirect-performs-and-its-fix'
Jakub Kicinski [Wed, 23 Nov 2022 04:42:11 +0000 (20:42 -0800)]
Merge branch 'revert-veth-avoid-drop-packets-when-xdp_redirect-performs-and-its-fix'

Heng Qi says:

====================
Revert "veth: Avoid drop packets when xdp_redirect performs" and its fix

This patch 2e0de6366ac16 enables napi of the peer veth automatically when
the veth loads the xdp, but it breaks down as reported by Paolo and John.
So reverting it and its fix, we will rework the patch and make it more
robust based on comments.
====================

Link: https://lore.kernel.org/r/20221122035015.19296-1-hengqi@linux.alibaba.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agoRevert "veth: Avoid drop packets when xdp_redirect performs"
Heng Qi [Tue, 22 Nov 2022 03:50:15 +0000 (11:50 +0800)]
Revert "veth: Avoid drop packets when xdp_redirect performs"

This reverts commit 2e0de6366ac16ab4d0abb2aaddbc8a1eba216d11.

Based on the issues reported by John and Paolo and their comments,
this patch and the corresponding fix 5e5dc33d5da are reverted, and
we'll remake it.

Signed-off-by: Heng Qi <hengqi@linux.alibaba.com>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agoRevert "bpf: veth driver panics when xdp prog attached before veth_open"
Heng Qi [Tue, 22 Nov 2022 03:50:14 +0000 (11:50 +0800)]
Revert "bpf: veth driver panics when xdp prog attached before veth_open"

This reverts commit 5e5dc33d5dacb34b0165061bc5a10efd2fd3b66f.

This patch fixes the panic maked by 2e0de6366ac16. Now Paolo
and Toke suggest reverting the patch 2e0de6366ac16 and making
it stronger, so do this first.

Signed-off-by: Heng Qi <hengqi@linux.alibaba.com>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agoMerge branch 'remove-dsa_priv-h'
Jakub Kicinski [Wed, 23 Nov 2022 04:41:57 +0000 (20:41 -0800)]
Merge branch 'remove-dsa_priv-h'

Vladimir Oltean says:

====================
Remove dsa_priv.h

After working on the "Autoload DSA tagging driver when dynamically
changing protocol" series:
https://patchwork.kernel.org/project/netdevbpf/cover/20221115011847.2843127-1-vladimir.oltean@nxp.com/

it became clear to me that the situation with DSA headers is a bit
messy, and I put the tagging protocol driver macros in a pretty random
temporary spot in dsa_priv.h.

Now is the time to make the net/dsa/ folder a bit more organized, and to
make tagging protocol driver modules include just headers they're going
to use.

Another thing is the merging and cleanup of dsa.c and dsa2.c. Before,
dsa.c had 589 lines and dsa2.c had 1817 lines. Now, the combined dsa.c
has 1749 lines, the rest went to some other places.

Sorry for the set size, I know the rules, but since this is basically
code movement for the most part, I thought more patches are better.
====================

Link: https://lore.kernel.org/r/20221121135555.1227271-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: kill off dsa_priv.h
Vladimir Oltean [Mon, 21 Nov 2022 13:55:55 +0000 (15:55 +0200)]
net: dsa: kill off dsa_priv.h

The last remnants in dsa_priv.h are a netlink-related definition for
which we create a new header, and DSA_MAX_NUM_OFFLOADING_BRIDGES which
is only used from dsa.c, so move it there.

Some inclusions need to be adjusted now that we no longer have headers
included transitively from dsa_priv.h.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: move tag_8021q headers to their proper place
Vladimir Oltean [Mon, 21 Nov 2022 13:55:54 +0000 (15:55 +0200)]
net: dsa: move tag_8021q headers to their proper place

tag_8021q definitions are all over the place. Some are exported to
linux/dsa/8021q.h (visible by DSA core, taggers, switch drivers and
everyone else), and some are in dsa_priv.h.

Move the structures that don't need external visibility into tag_8021q.c,
and the ones which don't need the world or switch drivers to see them
into tag_8021q.h.

We also have the tag_8021q.h inclusion from switch.c, which is basically
the entire reason why tag_8021q.c was built into DSA in commit
8b6e638b4be2 ("net: dsa: build tag_8021q.c as part of DSA core").
I still don't know how to better deal with that, so leave it alone.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: move definitions from dsa_priv.h to slave.c
Vladimir Oltean [Mon, 21 Nov 2022 13:55:53 +0000 (15:55 +0200)]
net: dsa: move definitions from dsa_priv.h to slave.c

There are some definitions in dsa_priv.h which are only used from
slave.c. So move them to slave.c.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: rename dsa2.c back into dsa.c and create its header
Vladimir Oltean [Mon, 21 Nov 2022 13:55:52 +0000 (15:55 +0200)]
net: dsa: rename dsa2.c back into dsa.c and create its header

The previous change moved the code into the larger file (dsa2.c) to
minimize the delta. Rename that now to dsa.c, and create dsa.h, where
all related definitions from dsa_priv.h go.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: merge dsa.c into dsa2.c
Vladimir Oltean [Mon, 21 Nov 2022 13:55:51 +0000 (15:55 +0200)]
net: dsa: merge dsa.c into dsa2.c

There is no longer a meaningful distinction between what goes into
dsa2.c and what goes into dsa.c. Merge the 2 into a single file.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: move notifier definitions to switch.h
Vladimir Oltean [Mon, 21 Nov 2022 13:55:50 +0000 (15:55 +0200)]
net: dsa: move notifier definitions to switch.h

Reduce bloat in dsa_priv.h by moving the cross-chip notifier data
structures to switch.h.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: move dsa_tree_notify() and dsa_broadcast() to switch.c
Vladimir Oltean [Mon, 21 Nov 2022 13:55:49 +0000 (15:55 +0200)]
net: dsa: move dsa_tree_notify() and dsa_broadcast() to switch.c

There isn't an intuitive place for these 2 cross-chip notifier functions
according to the function-to-file classification based on names
(dsa_switch_*() goes to switch.c), but I consider these to be part of
the cross-chip notifier handling, therefore part of switch.c. Move them
there to reduce bloat in dsa2.c (the place where all code with no better
place to go goes).

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: move headers exported by switch.c to switch.h
Vladimir Oltean [Mon, 21 Nov 2022 13:55:48 +0000 (15:55 +0200)]
net: dsa: move headers exported by switch.c to switch.h

Reduce code bloat in dsa_priv.h by moving the prototypes exported by
switch.h into their own header file.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: move tagging protocol code to tag.{c,h}
Vladimir Oltean [Mon, 21 Nov 2022 13:55:47 +0000 (15:55 +0200)]
net: dsa: move tagging protocol code to tag.{c,h}

It would be nice if tagging protocol drivers could include just the
header they need, since they are (mostly) data path and isolated from
most of the other DSA core code does.

Create a tag.c and a tag.h file which are meant to support tagging
protocol drivers.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: move headers exported by slave.c to slave.h
Vladimir Oltean [Mon, 21 Nov 2022 13:55:46 +0000 (15:55 +0200)]
net: dsa: move headers exported by slave.c to slave.h

Minimize the use of the bloated dsa_priv.h by moving the prototypes
exported by slave.c to their own header file.

This is just approximate to get the code structure right. There are some
interdependencies with static inline code left in dsa_priv.h, so leave
slave.h included from there for now.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: move headers exported by master.c to master.h
Vladimir Oltean [Mon, 21 Nov 2022 13:55:45 +0000 (15:55 +0200)]
net: dsa: move headers exported by c to master.h

Minimize the use of the bloated dsa_priv.h by moving the prototypes
exported by master.c to their own header file.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: move headers exported by port.c to port.h
Vladimir Oltean [Mon, 21 Nov 2022 13:55:44 +0000 (15:55 +0200)]
net: dsa: move headers exported by port.c to port.h

Minimize the use of the bloated dsa_priv.h by moving the prototypes
exported by port.c to their own header file.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: move rest of devlink setup/teardown to devlink.c
Vladimir Oltean [Mon, 21 Nov 2022 13:55:43 +0000 (15:55 +0200)]
net: dsa: move rest of devlink setup/teardown to devlink.c

The code that needed further refactoring into dedicated functions in
dsa2.c was left aside. Move it now to devlink.c, and make dsa2.c stop
including net/devlink.h.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: if ds->setup is true, ds->devlink is always non-NULL
Vladimir Oltean [Mon, 21 Nov 2022 13:55:42 +0000 (15:55 +0200)]
net: dsa: if ds->setup is true, ds->devlink is always non-NULL

Simplify dsa_switch_teardown() to remove the NULL checking for
ds->devlink.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: move bulk of devlink code to devlink.{c,h}
Vladimir Oltean [Mon, 21 Nov 2022 13:55:41 +0000 (15:55 +0200)]
net: dsa: move bulk of devlink code to devlink.{c,h}

dsa.c and dsa2.c are bloated with too much off-topic code. Identify all
code related to devlink and move it to a new devlink.c file.

Steer clear of the dsa_priv.h dumping ground antipattern and create a
dedicated devlink.h for it, which will be included only by the C files
which need it. Usage of dsa_priv.h will be minimized in later patches.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: modularize DSA_TAG_PROTO_NONE
Vladimir Oltean [Mon, 21 Nov 2022 13:55:40 +0000 (15:55 +0200)]
net: dsa: modularize DSA_TAG_PROTO_NONE

There is no reason that I can see why the no-op tagging protocol should
be registered manually, so make it a module and make all drivers which
have any sort of reference to DSA_TAG_PROTO_NONE select it.

Note that I don't know if ksz_get_tag_protocol() really needs this,
or if it's just the logic which is poorly written. All switches seem to
have their own tagging protocol, and DSA_TAG_PROTO_NONE is just a
fallback that never gets used.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: dsa: unexport dsa_dev_to_net_device()
Vladimir Oltean [Mon, 21 Nov 2022 13:55:39 +0000 (15:55 +0200)]
net: dsa: unexport dsa_dev_to_net_device()

dsa.o and dsa2.o are linked into the same dsa_core.o, there is no reason
to export this symbol when its only caller is local.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agodevlink: remove redundant health state set to error
Moshe Shemesh [Sun, 20 Nov 2022 08:36:52 +0000 (10:36 +0200)]
devlink: remove redundant health state set to error

Reporter health_state is set twice to error in devlink_health_report().
Remove second time as it is redundant.

Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
Reviewed-by: Eran Ben Elisha <eranbe@nvidia.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/1668933412-5498-1-git-send-email-moshe@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agotcp: Fix build break when CONFIG_IPV6=n
Saeed Mahameed [Tue, 22 Nov 2022 18:41:58 +0000 (10:41 -0800)]
tcp: Fix build break when CONFIG_IPV6=n

The cited commit caused the following build break when CONFIG_IPV6 was
disabled

net/ipv4/tcp_input.c: In function ‘tcp_syn_flood_action’:
include/net/sock.h:387:37: error: ‘const struct sock_common’ has no member named ‘skc_v6_rcv_saddr’; did you mean ‘skc_rcv_saddr’?

Fix by using inet6_rcv_saddr() macro which handles this situation
nicely.

Fixes: d9282e48c608 ("tcp: Add listening address to SYN flood message")
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
CC: Matthieu Baerts <matthieu.baerts@tessares.net>
CC: Jamie Bainbridge <jamie.bainbridge@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20221122184158.170798-1-saeed@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agoMerge branch 'i2c/client_device_id_helper-immutable' of git://git.kernel.org/pub...
Jakub Kicinski [Wed, 23 Nov 2022 03:50:20 +0000 (19:50 -0800)]
Merge branch 'i2c/client_device_id_helper-immutable' of git://git./linux/kernel/git/wsa/linux

Pull in a dependency for an API cleanup:
https://lore.kernel.org/all/20221118224540.619276-1-uwe@kleine-koenig.org/

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agoMerge branch 'cleanup-ocelot_stats-exposure'
Paolo Abeni [Tue, 22 Nov 2022 14:36:45 +0000 (15:36 +0100)]
Merge branch 'cleanup-ocelot_stats-exposure'

Colin Foster says:

====================
cleanup ocelot_stats exposure

The ocelot_stats structures became redundant across all users. Replace
this redundancy with a static const struct. After doing this, several
definitions inside include/soc/mscc/ocelot.h no longer needed to be
shared. Patch 2 removes them.

Checkpatch throws an error for a complicated macro not in parentheses. I
understand the reason for OCELOT_COMMON_STATS was to allow expansion, but
interestingly this patch set is essentially reverting the ability for
expansion. I'm keeping the macro in this set, but am open to remove it,
since it doesn't _actually_ provide any immediate benefits anymore.
====================

Link: https://lore.kernel.org/r/20221119231406.3167852-1-colin.foster@in-advantage.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
23 months agonet: mscc: ocelot: issue a warning if stats are incorrectly ordered
Colin Foster [Sat, 19 Nov 2022 23:14:06 +0000 (15:14 -0800)]
net: mscc: ocelot: issue a warning if stats are incorrectly ordered

Ocelot uses regmap_bulk_read() operations to efficiently read stats
registers. Currently the implementation relies on the stats layout to be
ordered to be most efficient.

Issue a warning if any future implementations happen to break this pattern.

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
Co-developed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
23 months agonet: mscc: ocelot: remove unnecessary exposure of stats structures
Colin Foster [Sat, 19 Nov 2022 23:14:05 +0000 (15:14 -0800)]
net: mscc: ocelot: remove unnecessary exposure of stats structures

Since commit 4d1d157fb6a4 ("net: mscc: ocelot: share the common stat
definitions between all drivers") there is no longer a need to share the
stats structures to the world. Relocate these definitions to inside
ocelot_stats.c instead of a global include header.

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
23 months agonet: mscc: ocelot: remove redundant stats_layout pointers
Colin Foster [Sat, 19 Nov 2022 23:14:04 +0000 (15:14 -0800)]
net: mscc: ocelot: remove redundant stats_layout pointers

Ever since commit 4d1d157fb6a4 ("net: mscc: ocelot: share the common stat
definitions between all drivers") the stats_layout entry in ocelot and
felix drivers have become redundant. Remove the unnecessary code.

Suggested-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
23 months agoselftests: net: Add cross-compilation support for BPF programs
Björn Töpel [Sat, 19 Nov 2022 17:18:41 +0000 (18:18 +0100)]
selftests: net: Add cross-compilation support for BPF programs

The selftests/net does not have proper cross-compilation support, and
does not properly state libbpf as a dependency. Mimic/copy the BPF
build from selftests/bpf, which has the nice side-effect that libbpf
is built as well.

Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
Reviewed-by: Anders Roxell <anders.roxell@linaro.org>
Link: https://lore.kernel.org/r/20221119171841.2014936-1-bjorn@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
23 months agosamples: pktgen: Use "grep -E" instead of "egrep"
Tiezhu Yang [Sat, 19 Nov 2022 02:55:04 +0000 (10:55 +0800)]
samples: pktgen: Use "grep -E" instead of "egrep"

The latest version of grep claims the egrep is now obsolete so the build
now contains warnings that look like:
egrep: warning: egrep is obsolescent; using grep -E
fix this up by moving the related file to use "grep -E" instead.

  sed -i "s/egrep/grep -E/g" `grep egrep -rwl samples/pktgen`

Here are the steps to install the latest grep:

  wget http://ftp.gnu.org/gnu/grep/grep-3.8.tar.gz
  tar xf grep-3.8.tar.gz
  cd grep-3.8 && ./configure && make
  sudo make install
  export PATH=/usr/local/bin:$PATH

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Link: https://lore.kernel.org/r/1668826504-32162-1-git-send-email-yangtiezhu@loongson.cn
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
23 months agoocteontx2-pf: Add additional checks while configuring ucast/bcast/mcast rules
Suman Ghosh [Fri, 18 Nov 2022 05:33:29 +0000 (11:03 +0530)]
octeontx2-pf: Add additional checks while configuring ucast/bcast/mcast rules

1. If a profile does not support DMAC extraction then avoid installing NPC
flow rules for unicast. Similarly, if LXMB(L2 and L3) extraction is not
supported by the profile then avoid installing broadcast and multicast
rules.
2. Allow MCAM entry insertion for promiscuous mode.
3. For the profiles where DMAC is not extracted in MKEX key default
unicast entry installed by AF is not valid. Hence do not use action
from the AF installed default unicast entry for such cases.
4. Adjacent packet header fields in a packet like IP header source
and destination addresses or UDP/TCP header source port and destination
can be extracted together in MKEX profile. Therefore MKEX profile can be
configured to in two ways:
a. Total of 4 bytes from start of UDP header(src port
   + destination port)
or
b. Two bytes from start and two bytes from offset 2

Signed-off-by: Suman Ghosh <sumang@marvell.com>
Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Link: https://lore.kernel.org/r/20221118053329.2288486-1-sumang@marvell.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
23 months agonet: bcmgenet: Clear RGMII_LINK upon link down
Florian Fainelli [Fri, 18 Nov 2022 21:37:54 +0000 (13:37 -0800)]
net: bcmgenet: Clear RGMII_LINK upon link down

Clear the RGMII_LINK bit upon detecting link down to be consistent with
setting the bit upon link up. We also move the clearing of the
out-of-band disable to the runtime initialization rather than for each
link up/down transition.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20221118213754.1383364-1-f.fainelli@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: microchip: sparx5: fix uninitialized variables
Dan Carpenter [Fri, 18 Nov 2022 15:12:52 +0000 (18:12 +0300)]
net: microchip: sparx5: fix uninitialized variables

Smatch complains that "err" can be uninitialized on these paths.  Also
it's just nicer to "return 0;" instead of "return err;"

Fixes: 3a344f99bb55 ("net: microchip: sparx5: Add support for TC flower ARP dissector")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/r/Y3eg9Ml/LmLR3L3C@kili
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agonet: fix __sock_gen_cookie()
Eric Dumazet [Fri, 18 Nov 2022 04:38:43 +0000 (04:38 +0000)]
net: fix __sock_gen_cookie()

I was mistaken how atomic64_try_cmpxchg(&sk_cookie, &res, new)
is working.

I was assuming @res would contain the final sk_cookie value,
regardless of the success of our cmpxchg()

We could do something like:

if (atomic64_try_cmpxchg(&sk_cookie, &res, new)
res = new;

But we can avoid a conditional and read sk_cookie again.

atomic64_cmpxchg(&sk_cookie, res, new);
res = atomic64_read(&sk_cookie);

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1527347 ("Error handling issues")
Fixes: 4ebf802cf1c6 ("net: __sock_gen_cookie() cleanup")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20221118043843.3703186-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
23 months agoMerge branch 'mptcp-netlink'
David S. Miller [Mon, 21 Nov 2022 13:09:08 +0000 (13:09 +0000)]
Merge branch 'mptcp-netlink'

Mat Martineau says:

====================
mptcp: More specific netlink command errors

This series makes the error reporting for the MPTCP_PM_CMD_ADD_ADDR netlink
command more specific, since there are multiple reasons the command could
fail.

Note that patch 2 adds a GENL_SET_ERR_MSG_FMT() macro to genetlink.h,
which is outside the MPTCP subsystem.

Patch 1 refactors in-kernel listening socket and endpoint creation to
simplify the second patch.

Patch 2 updates the error values returned by the in-kernel path manager
when it fails to create a local endpoint.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agomptcp: more detailed error reporting on endpoint creation
Paolo Abeni [Fri, 18 Nov 2022 18:46:08 +0000 (10:46 -0800)]
mptcp: more detailed error reporting on endpoint creation

Endpoint creation can fail for a number of reasons; in case of failure
append the error number to the extended ack message, using a newly
introduced generic helper.

Additionally let mptcp_pm_nl_append_new_local_addr() report different
error reasons.

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agomptcp: deduplicate error paths on endpoint creation
Paolo Abeni [Fri, 18 Nov 2022 18:46:07 +0000 (10:46 -0800)]
mptcp: deduplicate error paths on endpoint creation

When endpoint creation fails, we need to free the newly allocated
entry and eventually destroy the paired mptcp listener socket.

Consolidate such action in a single point let all the errors path
reach it.

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: Return errno in sk->sk_prot->get_port().
Kuniyuki Iwashima [Fri, 18 Nov 2022 18:25:06 +0000 (10:25 -0800)]
net: Return errno in sk->sk_prot->get_port().

We assume the correct errno is -EADDRINUSE when sk->sk_prot->get_port()
fails, so some ->get_port() functions return just 1 on failure and the
callers return -EADDRINUSE instead.

However, mptcp_get_port() can return -EINVAL.  Let's not ignore the error.

Note the only exception is inet_autobind(), all of whose callers return
-EAGAIN instead.

Fixes: cec37a6e41aa ("mptcp: Handle MP_CAPABLE options for outgoing connections")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: ethernet: renesas: rswitch: Fix MAC address info
Yoshihiro Shimoda [Fri, 18 Nov 2022 00:27:24 +0000 (09:27 +0900)]
net: ethernet: renesas: rswitch: Fix MAC address info

Smatch detected the following warning.

    drivers/net/ethernet/renesas/rswitch.c:1717 rswitch_init() warn:
    '%pM' cannot be followed by 'n'

The 'n' should be '\n'.

Reported-by: Dan Carpenter <error27@gmail.com>
Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Fixes: 3590918b5d07 ("net: ethernet: renesas: Add support for "Ethernet Switch"")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Saeed Mahameed <saeed@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agoMerge branch 'sarx5-VCAP-debugfs'
David S. Miller [Mon, 21 Nov 2022 11:33:02 +0000 (11:33 +0000)]
Merge branch 'sarx5-VCAP-debugfs'

netdev.vger.kernel.org archive mirror
Steen Hegelund says:

====================
net: Add support for VCAP debugFS in Sparx5

This provides support for getting VCAP instance, VCAP rule and VCAP port
keyset configuration information via the debug file system.

It builds on top of the initial IS2 VCAP support found in these series:

https://lore.kernel.org/all/20221020130904.1215072-1-steen.hegelund@microchip.com/
https://lore.kernel.org/all/20221109114116.3612477-1-steen.hegelund@microchip.com/
https://lore.kernel.org/all/20221111130519.1459549-1-steen.hegelund@microchip.com/

Functionality:
==============

The VCAP API exposes a /sys/kernel/debug/sparx5/vcaps folder containing
the following entries:

- raw_<vcap>_<instance>
    This is a raw dump of the VCAP instance with a line for each available
    VCAP rule.  This information is limited to the VCAP rule address, the
    rule size and the rule keyset name as this requires very little
    information from the VCAP cache.

    This can be used to detect if a valid rule is stored at the correct
    address.

- <vcap>_<instance>
    This dumps the VCAP instance configuration: address ranges, chain id
    ranges, word size of keys and actions etc, and for each VCAP rule the
    details of keys (values and masks) and actions are shown.

    This is useful when discovering if the expected rule is present and in
    which order it will be matched.

- <interface>
    This shows the keyset configuration per lookup and traffic type and the
    set of sticky bits (common for all interfaces). This is cleared when
    shown, so it is possible to sample over a period of time.

    It also shows if this port/lookup is enabled for matching in the VCAP.

    This can be used to find out which keyset the traffic being sent to a
    port, will be matched against, and if such traffic has been seen by one
    of the ports.

Delivery:
=========

This is current plan for delivering the full VCAP feature set of Sparx5:

- TC protocol all support for IS2 VCAP
- Sparx5 IS0 VCAP support
- TC policer and drop action support (depends on the Sparx5 QoS support
  upstreamed separately)
- Sparx5 ES0 VCAP support
- TC flower template support
- TC matchall filter support for mirroring and policing ports
- TC flower filter mirror action support
- Sparx5 ES2 VCAP support

Version History:
================
v2      Removed a 'support' folder (used for integration testing) that had
        been added in patch 6/8 by a mistake.
        Wrapped long lines.

v1      Initial version
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: microchip: sparx5: Add VCAP debugfs KUNIT test
Steen Hegelund [Thu, 17 Nov 2022 21:31:14 +0000 (22:31 +0100)]
net: microchip: sparx5: Add VCAP debugfs KUNIT test

This tests the functionality of the debugFS support:

- finding valid keyset on an address
- raw VCAP output
- full rule VCAP output

Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: microchip: sparx5: Add VCAP locking to protect rules
Steen Hegelund [Thu, 17 Nov 2022 21:31:13 +0000 (22:31 +0100)]
net: microchip: sparx5: Add VCAP locking to protect rules

This ensures that the VCAP cache and the lists maintained in the VCAP
instance is protected when accessed by different clients.

Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: microchip: sparx5: Add VCAP debugFS key/action support for the VCAP API
Steen Hegelund [Thu, 17 Nov 2022 21:31:12 +0000 (22:31 +0100)]
net: microchip: sparx5: Add VCAP debugFS key/action support for the VCAP API

This add support for displaying the keys and actions in a rule.
The keys and action display format will be determined by the size and the
type of the key or action. The longer keys will typically be displayed as a
hexadecimal byte array.

The actionset is not decoded in full as the Sparx5 IS2 only has one
supported action, so this will be added later with other VCAP types.

Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: microchip: sparx5: Add VCAP rule debugFS support for the VCAP API
Steen Hegelund [Thu, 17 Nov 2022 21:31:11 +0000 (22:31 +0100)]
net: microchip: sparx5: Add VCAP rule debugFS support for the VCAP API

This add support to show all rules in a VCAP instance. The information
shown is:

 - rule id
 - address range
 - size
 - chain id
 - keyset name, subword size, register span
 - actionset name, subword size, register span
 - counter value
 - sticky bit (one bit width counter)

Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: microchip: sparx5: Add raw VCAP debugFS support for the VCAP API
Steen Hegelund [Thu, 17 Nov 2022 21:31:10 +0000 (22:31 +0100)]
net: microchip: sparx5: Add raw VCAP debugFS support for the VCAP API

This adds support for decoding VCAP rules with a minimum number of
attributes: address, rule size and keyset.

This allows for a quick inspection of a VCAP instance to determine if the
rule are present and in the correct order.

Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 months agonet: microchip: sparx5: Add VCAP debugFS support
Steen Hegelund [Thu, 17 Nov 2022 21:31:09 +0000 (22:31 +0100)]
net: microchip: sparx5: Add VCAP debugFS support

Add a debugFS root folder for Sparx5 and add a vcap folder underneath with
the VCAP instances and the ports

Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>