1
0
Fork 0
Commit Graph

18 Commits (5552df2bf59d36b8b29a8ce26868e651e73e0528)

Author SHA1 Message Date
Andrey Zhizhikin 5552df2bf5 This is the 5.4.85 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl/glK0ACgkQONu9yGCS
 aT5W7A/9Fosi7yNmr9UI/IjjcvDzy2ecA/8Je/WHx9Q5AGUvPhaO9hiciuic3vIQ
 hh8TgKl/8+ZHuiKGXi89G1S7VIeZrCqz55wBpWSgaPsZ9zJzHFh65aSIsoN+Rlmy
 FLHr7BKxchmNgvtVcoO8gpgV2NsxRmJ8+NKWXIRmVzBe5oyyLLOtVsN96htq8jrx
 IrqqtpjVSzlP2enEVPsC0Xw6piK5xaWriQS5W8S1y5awP6Dets+T8CWlBvuoaBCH
 KzISleJF/R5sP4U4+4j6OwEzzPUqxMnCsYrATUOcu/pGGqwRZCVtY4JhxccMCZw6
 Q5gsvbcVTrz3IFyhMI7KL28+YvAOeQ67zOim6ucztgNXDYCMbc+uTxCDRERPr5Pl
 oiCfW42X8Z3Alt8KugDhjh6XYmMVS3u5tOQEaNoPC1mv+WGMJy6Szsq+NgJfbeqC
 8Fszz/1MQtPBBk/wVOvtNybNy+0W4sBGaUq98TtrfnfZtsuM/FrJiCgXTB9pqGxH
 Bq6R8BUsGeFEWzDDe29BoFJBXGpZ8Ox0/LKmBM7z2jWBZldH6DC54LhWaQgsLAMO
 UPGVCtfKNQXnJ/0bO5RSgikD9iTQyFBs5nhreJcXMsTPxI/5wXEkw6MDrvYXLTHE
 C6H6TarzGwlUcicc+UYCVplSTy+4D1sGbH95Rz0cMJHRyojKl8E=
 =9HIQ
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdQaENiSDAlGTDEbB7G51OISzHs0FAl/gyMIACgkQ7G51OISz
 Hs0J4g//Y3R4XyO45gq0EtLAQy5rwTb+qO58phDIwC+puIedDTJnLo9IaDB3kyTa
 98++yv4VoWcgLLCsCtgqDube2Csyvx2Dl0JgDMR7L998VXxnVuht3vhUkcd081XR
 EJoNfpBva8uIeqB6LiGg9+jGEc0s5vUCXH3Ijt3ync8vZxrz8PSBruP8AKSOjjbo
 zvRUsCJugYyOrbg2bTswBNTgAOMB+SbtQkOPzQ19/uVzHSGFAUKp41XTVTsbaX62
 9UQQLDfUACvCyGXze50QTC4lRJZNl0PuUhQdz6WSu4DDF1I4QRf5onf39fffPHtU
 XwiCoa0mDwOJLr2An1xITdjQzudWRrp7Bt7JbfjTmcfAa5JPXVnXP12fdJeSm0w2
 ZJoH5A3o2iEq1Q+Fk6FOIEhPLm4ktGHegxo7eZOuBzPGtWTvqqE/ngzyfw/NovGP
 579YtIbY6+2pw3FF4Havv/adRKPcrFZNbiqGgOWpeCB+i7BfJQ4tSNJigtQwLvrf
 yVWJ2e+I9B3z+/HqPKU8OtCWf3R3vT4CvN1bInRFodeSsXUxQraXwKPP/bxOI57C
 TrS5/1pKStntol1IKSCVgXIh66GRt11hPKQHEOcOjG4u0VUSBb9uHoyBo0BTuhXW
 5EOj2hzc/DXye5HmGEQlqnMzSHVg6qn+eKhZKkxCqQLMIjKeAM8=
 =xf26
 -----END PGP SIGNATURE-----

Merge tag 'v5.4.85' into 5.4-2.2.x-imx

This is the 5.4.85 stable release

Conflicts (correct auto-resolve):
- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:
Ustream commit 318d90218b ("net: stmmac: free tx skb buffer in
stmmac_resume()") overlapped NXP commit dd7c2b79a9 ("MLK-24217 net:
ethernet: stmmac: free tx skb buffer in stmmac_resume()"), causing
double-declaration of the function to be present in the code.
Replace the NXP commit with upstream one.

Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
2020-12-21 16:06:12 +00:00
Claudiu Manoil cb327f83cf enetc: Fix reporting of h/w packet counters
[ Upstream commit eb96b686fc ]

Noticed some inconsistencies in packet statistics reporting.
This patch adds the missing Tx packet counter registers to
ethtool reporting and fixes the information strings for a
few of them.

Fixes: 16eb4c85c9 ("enetc: Add ethtool statistics")
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Link: https://lore.kernel.org/r/20201204171505.21389-1-claudiu.manoil@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-12-21 13:27:04 +01:00
Alex Marginean 54b5ce65e2 LF-924: net/enetc: Set MAC Rx FIFO to recommended value
On LS1028A the MAC Rx FIFO defaults to value 2, which is too high and may
lead to Rx lock-up under traffic.  Set it to 1 instead, as recommended by
the hardware team.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
(cherry picked from commit 28e8743fb8a199523b7a211b4eaf14c4cd454c90)
2020-02-26 04:17:48 +08:00
Po Liu 95b33c0bba enetc: add support tsn capabilities qbv/qci/qbu/cbs
Support Qbv/Qci/Qbu/Credit Base Shaper etc.
This patch using the generic netlink adapt layer driver net/tsn/*
and include/net/tsn.h interface load by user space. The user space
refer the include/uapi/linux/tsn.h.

Signed-off-by: Po Liu <Po.Liu@nxp.com>
2019-12-04 17:49:44 +08:00
Po Liu fb1919ab79 enetc: add support Credit Based Shaper(CBS) for hardware offload
The ENETC hardware support the Credit Based Shaper(CBS) which part
of the IEEE-802.1Qav. The CBS driver was loaded by the sch_cbs
interface when set in the QOS in the kernel.

Here is an example command to set 20Mbits bandwidth in 1Gbits port
for taffic class 7:

tc qdisc add dev eth0 root handle 1: mqprio \
	   num_tc 8 map 0 1 2 3 4 5 6 7 hw 1

tc qdisc replace dev eth0 parent 1:8 cbs \
	   locredit -1470 hicredit 30 \
	   sendslope -980000 idleslope 20000 offload 1

Signed-off-by: Po Liu <Po.Liu@nxp.com>
Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-04 17:49:41 +08:00
Vladimir Oltean 9308f989b0 enetc: Replace enetc_gregs with a readers-writer lock
The LS1028A MDIO errata tells us that any MDIO register access must not
be concurrent with any other ENETC register access.

That has been handled so far by a number of per-CPU spinlocks over the
ENETC register map. This came as an optimization over a single spinlock,
because the regular register accesses can still be concurrent with one
another, as long as they aren't concurrent with MDIO.

But this logic is broken in RT, because the enetc_rd_reg_wa and
enetc_wr_reg_wa functions can be preempted in any context, and when they
resume they may not run on the same CPU.

This renders the logic to take the per-CPU spinlock pointless, since the
spinlock may not be the correct one (corresponding to this CPU) after
preemption has occurred.

The following splat is telling us the same thing:

[   19.073928] BUG: using smp_processor_id() in preemptible [00000000] code: systemd-network/3423
[   19.073932] caller is debug_smp_processor_id+0x1c/0x30
[   19.073935] CPU: 1 PID: 3423 Comm: systemd-network Not tainted 4.19.68-rt26 #1
[   19.073936] Hardware name: LS1028A RDB Board (DT)
[   19.073938] Call trace:
[   19.073940]  dump_backtrace+0x0/0x1a0
[   19.073942]  show_stack+0x24/0x30
[   19.073945]  dump_stack+0x9c/0xdc
[   19.073948]  check_preemption_disabled+0xe0/0x100
[   19.073951]  debug_smp_processor_id+0x1c/0x30
[   19.073954]  enetc_open+0x1b0/0xbc0
[   19.073957]  __dev_open+0xdc/0x160
[   19.073960]  __dev_change_flags+0x160/0x1d0
[   19.073963]  dev_change_flags+0x34/0x70
[   19.073966]  do_setlink+0x2a0/0xcd0
[   19.073969]  rtnl_setlink+0xe4/0x140
[   19.073972]  rtnetlink_rcv_msg+0x18c/0x500
[   19.073975]  netlink_rcv_skb+0x60/0x120
[   19.073978]  rtnetlink_rcv+0x28/0x40
[   19.073982]  netlink_unicast+0x194/0x210
[   19.073985]  netlink_sendmsg+0x194/0x330
[   19.073987]  sock_sendmsg+0x34/0x50
[   19.073990]  __sys_sendto+0xe4/0x150
[   19.073992]  __arm64_sys_sendto+0x30/0x40
[   19.073996]  el0_svc_common+0xa4/0x1a0
[   19.073999]  el0_svc_handler+0x38/0x80
[   19.074002]  el0_svc+0x8/0xc

But there already exists a spinlock optimized for the single writer,
multiple readers case: the rwlock_t. The writer in this case is the MDIO
access code (irrelevant whether that MDIO access is a register read or
write), and the reader is everybody else.

This patch also fixes two more existing bugs in the errata workaround:
- The MDIO access code was not unlocking the per-CPU spinlocks in the
  reverse order of their locking order.
- The per-CPU spinlock array was not initialized.

Fixes: 5ec0d668d62e ("enetc: WA for MDIO register access issue")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-12-02 18:04:22 +08:00
Alex Marginean 7e2622ca82 enetc: WA for MDIO register access issue
Due to a hardware issue access to MDIO registers concurrent with other
ENETC register access may lead to the MDIO access being dropped or
corrupted.  The workaround introduces locking for all register access in
ENETC space.  To reduce performance impact, code except MDIO uses per-cpu
locks, MDIO code having to acquire all per-CPU locks to perform an access.
To further reduce the performance impact, datapath functions acquire the
per-cpu lock fewer times and use _hot accessors.  All the rest of the code
uses the _wa accessors which lock every time a register is accessed.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
2019-12-02 18:04:21 +08:00
Claudiu Manoil d49dbe7946 enetc: Initialize SerDes for SGMII and SXGMII protocols
ENETC has ethernet MACs capable of SGMII and SXGMII but
in order to use these protocols some serdes configurations
need to be performed.
The serdes is configurable via an internal MDIO bus
connected to an internal PCS device, all reads/writes are
performed at address 0.
This patch basically removes the dependecy on a bootloader
regarding serdes initialization.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-12-02 18:04:19 +08:00
Claudiu Manoil 572ee5d842 enetc: Make mdio accessors more generic
Refactoring needed to support multiple MDIO buses.
'mdio_base' - MDIO registers base address - is being parameterized.
The MDIO accessors are made more generic to be able to work with
different MDIO register bases.
Some includes get cleaned up in the process.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-12-02 18:04:19 +08:00
Po Liu 2695b0ed9d enetc: update TSN Qbv PSPEED set according to adjust link speed
ENETC has a register PSPEED to indicate the link speed of hardware.
It is need to update accordingly. PSPEED field needs to be updated
with the port speed for QBV scheduling purposes. Or else there is
chance for gate slot not free by frame taking the MAC if PSPEED and
phy speed not match. So update PSPEED when link adjust. This is
implement by the adjust_link.

Signed-off-by: Po Liu <Po.Liu@nxp.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:18 +08:00
Po Liu faf3c36220 enetc: Configure the Time-Aware Scheduler via tc-taprio offload
ENETC supports in hardware for time-based egress shaping according
to IEEE 802.1Qbv. This patch implement the Qbv enablement by the
hardware offload method qdisc tc-taprio method.
Also update cbdr writeback to up level since control bd ring may
writeback data to control bd ring.

Signed-off-by: Po Liu <Po.Liu@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:18 +08:00
Camelia Groza cbe9e83594 enetc: Enable TC offloading with mqprio
Add support to configure multiple prioritized TX traffic
classes with mqprio.

Configure one BD ring per TC for the moment, one netdev
queue per TC.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-28 17:11:02 -07:00
Y.b. Lu d398231219 enetc: add hardware timestamping support
This patch is to add hardware timestamping support
for ENETC. On Rx, timestamping is enabled for all
frames. On Tx, we only instruct the hardware to
timestamp the frames marked accordingly by the stack.

Because the RX BD ring dynamic allocation has not been
supported and it is too expensive to use extended RX BDs
if timestamping is not used, a Kconfig option is used to
enable extended RX BDs in order to support hardware
timestamping. This option will be removed once RX BD
ring dynamic allocation is implemented.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-24 13:16:32 -07:00
Yangbo Lu 19971f5ea0 enetc: add PTP clock driver
This patch is to add PTP clock driver for ENETC.
The driver reused QorIQ PTP clock driver.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-02-12 12:58:48 -05:00
Claudiu Manoil d382563f54 enetc: Add RFS and RSS support
A ternary match table is used for RFS. If multiple entries in the table
match, the entry with the lowest numerical values index is chosen as the
matching entry.  Entries in the table are identified using an index
which takes a value from 0 to PRFSCAPR[NUM_RFS]-1 when accessed by the
PSI (PF).
Portions of the RFS table can be assigned to each SI by the PSI (PF)
driver in PSIaRFSCFGR.  Assignments are cumulative, the entries assigned
to SIn start after those assigned to SIn-1.  The total assignments to
all SIs must be equal to or less than the number available to the port
as found in PRFSCAPR.

For RSS, the Toeplitz hash function used requires two inputs, a 40B
random secret key that is supplied through the PRSSKR0-9 registers as well
as the relevant pieces of the packet header (n-tuple).  The 6 LSB bits of
the hash function result will then be used as a pointer to obtain the tag
referenced in the 64 entry indirection table.  The result will provide a
winning group which will be used to help route the received packet.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-01-24 21:55:53 -08:00
Claudiu Manoil beb74ac878 enetc: Add vf to pf messaging support
VSIs (VFs) may send a message to the PSI (PF) for general notification
or to gain access to hardware resources which requires host inspection.
These messages may vary in size and are handled as a partition copy
between two memory regions owned by the respective participants.
The PSI will respond with fail or success and a 16-bit message code.
The patch implements the vf to pf messaging mechanism above and, as the
first application making use of this support, it enables the VF to
configure its own primary MAC address.

Signed-off-by: Catalin Horghidan <catalin.horghidan@nxp.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-01-24 21:55:53 -08:00
Claudiu Manoil 16eb4c85c9 enetc: Add ethtool statistics
This adds most h/w statistics counters: non-privileged SI conters, as
well as privileged Port and MAC counters available only to the PF.
Per ring software stats are also included.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-01-24 21:55:53 -08:00
Claudiu Manoil d4fd0404c1 enetc: Introduce basic PF and VF ENETC ethernet drivers
ENETC is a multi-port virtualized Ethernet controller supporting GbE
designs and Time-Sensitive Networking (TSN) functionality.
ENETC is operating as an SR-IOV multi-PF capable Root Complex Integrated
Endpoint (RCIE).  As such, it contains multiple physical (PF) and
virtual (VF) PCIe functions, discoverable by standard PCI Express.

Introduce basic PF and VF ENETC ethernet drivers.  The PF has access to
the ENETC Port registers and resources and makes the required privileged
configurations for the underlying VF devices.  Common functionality is
controlled through so called System Interface (SI) register blocks, PFs
and VFs own a SI each.  Though SI register blocks are almost identical,
there are a few privileged SI level controls that are accessible only to
PFs, and so the distinction is made between PF SIs (PSI) and VF SIs (VSI).
As such, the bulk of the code, including datapath processing, basic h/w
offload support and generic pci related configuration, is shared between
the 2 drivers and is factored out in common source files (i.e. enetc.c).

Major functionalities included (for both drivers):
MSI-X support for Rx and Tx processing, assignment of Rx/Tx BD ring pairs
to MSI-X entries, multi-queue support, Rx S/G (Rx frame fragmentation) and
jumbo frame (up to 9600B) support, Rx paged allocation and reuse, Tx S/G
support (NETIF_F_SG), Rx and Tx checksum offload, PF MAC filtering and
initial control ring support, VLAN extraction/ insertion, PF Rx VLAN
CTAG filtering, VF mac address config support, VF VLAN isolation support,
etc.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-01-24 21:55:53 -08:00