Commit Graph

25 Commits

Author SHA1 Message Date
Andrey Zhizhikin ce0c0d68c7 This is the 5.4.99 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmAs43QACgkQONu9yGCS
 aT4omw/+JPBAZB5ClIOSDuf3/yJkbigVRFNVmQJy4/cluG32cxlcpudoau7AXq3N
 0Sn/rfSdldl5eI98OTA+Y0yPIsVnQJdei228A5gmULkkc+rEFugorSJKRmmA7tH0
 VdZ1C4NlhhmjoIT/W8mMNzv14dtyGQvRbT+zzfxqwqL6tF9+alcdBYTP/Z691K6x
 8Csfe05MZ8VkvBizStaTXC+dtMhU917Ikd5i5v4ZzaesZJcUTLS7J82FhtKeoz7q
 tDoA/Bl+pN1KjyIIE61/zJ8DKzBtOeuo1PWJFpO+EBVhKVosr3oWJfTAiM7Fsnu5
 dbKHYPsbe3mB79JdQibr7TpU7vSjDr5a/HTuYtp7WM1R5IssiFeVOdpXTGim/s/E
 Flao5LYSUcj0X/Io6TyUnxQWw8sJz3PGKYiLUn8/9DBpzNFzynQ+vuapXCoGxJzh
 W108q32PIx2ZTJsD5RUUqZbytG/zKzI1+SxXo2uOhs9/k5qT+35Yp9epsE2Cp8v1
 Oiw3P/ZUDNk6zPj0dsHcTsqTofRK07l71HnM8iIbCWSPw834IoGBuB8c3H7HaHn4
 v5M4tMTDAaKi/e09K92fR6SZDgZz8D0N+sLLneA4NEASXIJanCUwcgVCUbja+BO1
 H1hiYTTZQa7kOkSxBa/wGsWkdfvOpOvCSFr+c6LPmB9sHMe4K8o=
 =3BI0
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdQaENiSDAlGTDEbB7G51OISzHs0FAmAtjOoACgkQ7G51OISz
 Hs3p0w/+J3WWl9sa+L25ZY92AZDQWMFEIlsiyKrVVgC3dRhtEr2iWylMFsFRCS3K
 IYTcHxe3MrhnaRycXZ25I0jse3doAFkTbsEl3WcjabI4/xARUW77vedz5CvxBBH9
 5Spjn5qs5zfmxHTss4qbta1zEq7PjtoJEpFVDhlhK6VXKXz07QZrRnSAztde030R
 vg9OaJFyQauPguySXISBg/XXLJEJ3j5NO3PnAW5eJKJyguQF/ujFNsv5s80297BT
 vc7kNdyy7Zz+C8dem65WMsB9egcuqt6jwjadePGz/5mhUxaj+IESJnkZ3ezCSgMI
 NDdIROT228RScO5BVEHXZHKsAdyIKibdZ7Ta7P607buvBRSd7+eV6/QkbndNYxva
 40NBGTlevffBBBl3KXbZTSJX4IrUCr45kfwNXrHGo588aiSrOoYPbr3Tq0TsWyvc
 hkDOb5XARlvyun4vvL5cKmfOV7I6MrnGs07chQ8Xd732SIhRwgzsZg7cM3kzmceB
 cEV1d+2uTmxzzldW34fU/xWPSDb/dFKjOKrsttMNM3lbL58oPS17eu4zjSQ/vO72
 x/h8KY6Uc1ceja/fWZrk4t1fusMNJZ/NPxPVjOFJpMgz90aGMMQDm4bVM6yW1x4r
 zTr1iR6q9N/+S6Y2Vc2LEuEhB2fC9q9kuFbp8Evk8DPSotQT514=
 =FE60
 -----END PGP SIGNATURE-----

Merge tag 'v5.4.99' into 5.4-2.3.x-imx

This is the 5.4.99 stable release

Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
2021-02-17 21:38:47 +00:00
Vladimir Oltean 6107338c2f net: enetc: initialize the RFS and RSS memories
[ Upstream commit 07bf34a50e327975b21a9dee64d220c3dcb72ee9 ]

Michael tried to enable Advanced Error Reporting through the ENETC's
Root Complex Event Collector, and the system started spitting out single
bit correctable ECC errors coming from the ENETC interfaces:

pcieport 0000:00:1f.0: AER: Multiple Corrected error received: 0000:00:00.0
fsl_enetc 0000:00:00.0: PCIe Bus Error: severity=Corrected, type=Transaction Layer, (Receiver ID)
fsl_enetc 0000:00:00.0:   device [1957:e100] error status/mask=00004000/00000000
fsl_enetc 0000:00:00.0:    [14] CorrIntErr
fsl_enetc 0000:00:00.1: PCIe Bus Error: severity=Corrected, type=Transaction Layer, (Receiver ID)
fsl_enetc 0000:00:00.1:   device [1957:e100] error status/mask=00004000/00000000
fsl_enetc 0000:00:00.1:    [14] CorrIntErr

Further investigating the port correctable memory error detect register
(PCMEDR) shows that these AER errors have an associated SOURCE_ID of 6
(RFS/RSS):

$ devmem 0x1f8010e10 32
0xC0000006
$ devmem 0x1f8050e10 32
0xC0000006

Discussion with the hardware design engineers reveals that on LS1028A,
the hardware does not do initialization of that RFS/RSS memory, and that
software should clear/initialize the entire table before starting to
operate. That comes as a bit of a surprise, since the driver does not do
initialization of the RFS memory. Also, the initialization of the
Receive Side Scaling is done only partially.

Even though the entire ENETC IP has a single shared flow steering
memory, the flow steering service should returns matches only for TCAM
entries that are within the range of the Station Interface that is doing
the search. Therefore, it should be sufficient for a Station Interface
to initialize all of its own entries in order to avoid any ECC errors,
and only the Station Interfaces in use should need initialization.

There are Physical Station Interfaces associated with PCIe PFs and
Virtual Station Interfaces associated with PCIe VFs. We let the PF
driver initialize the entire port's memory, which includes the RFS
entries which are going to be used by the VF.

Reported-by: Michael Walle <michael@walle.cc>
Fixes: d4fd0404c1 ("enetc: Introduce basic PF and VF ENETC ethernet drivers")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Michael Walle <michael@walle.cc>
Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Link: https://lore.kernel.org/r/20210204134511.2640309-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-02-17 10:35:17 +01:00
Claudiu Manoil e8b86b4d87 enetc: Remove the mdio bus on PF probe bailout
[ Upstream commit 26cb7085c8984e5b71d65c374a135134ed8cabb3 ]

For ENETC ports that register an external MDIO bus,
the bus doesn't get removed on the error bailout path
of enetc_pf_probe().

This issue became much more visible after recent:
commit 07095c025ac2 ("net: enetc: Use DT protocol information to set up the ports")
Before this commit, one could make probing fail on the error
path only by having register_netdev() fail, which is unlikely.
But after this commit, because it moved the enetc_of_phy_get()
call up in the probing sequence, now we can trigger an mdiobus_free()
bug just by forcing enetc_alloc_msix() to return error, i.e. with the
'pci=nomsi' kernel bootarg (since ENETC relies on MSI support to work),
as the calltrace below shows:

kernel BUG at /home/eiz/work/enetc/net/drivers/net/phy/mdio_bus.c:648!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
[...]
Hardware name: LS1028A RDB Board (DT)
pstate: 80000005 (Nzcv daif -PAN -UAO BTYPE=--)
pc : mdiobus_free+0x50/0x58
lr : devm_mdiobus_free+0x14/0x20
[...]
Call trace:
 mdiobus_free+0x50/0x58
 devm_mdiobus_free+0x14/0x20
 release_nodes+0x138/0x228
 devres_release_all+0x38/0x60
 really_probe+0x1c8/0x368
 driver_probe_device+0x5c/0xc0
 device_driver_attach+0x74/0x80
 __driver_attach+0x8c/0xd8
 bus_for_each_dev+0x7c/0xd8
 driver_attach+0x24/0x30
 bus_add_driver+0x154/0x200
 driver_register+0x64/0x120
 __pci_register_driver+0x44/0x50
 enetc_pf_driver_init+0x24/0x30
 do_one_initcall+0x60/0x1c0
 kernel_init_freeable+0x1fc/0x274
 kernel_init+0x14/0x110
 ret_from_fork+0x10/0x34

Fixes: ebfcb23d62 ("enetc: Add ENETC PF level external MDIO support")
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-07-29 10:18:34 +02: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 28e8743fb8)
2020-02-26 04:17:48 +08:00
Claudiu Manoil 39c38d3a7b enetc: Make MDIO accessors more generic and export to include/linux/fsl
Within the LS1028A SoC, the register map for the ENETC MDIO controller
is instantiated a few times: for the central (external) MDIO controller,
for the internal bus of each standalone ENETC port, and for the internal
bus of the Felix switch.

Refactoring is needed to support multiple MDIO buses from multiple
drivers. The enetc_hw structure is made an opaque type and a smaller
enetc_mdio_priv is created.

'mdio_base' - MDIO registers base address - is being parameterized, to
be able to work with different MDIO register bases.

The ENETC MDIO bus operations are exported from the fsl-enetc-mdio
kernel object, the same that registers the central MDIO controller (the
dedicated PF). The ENETC main driver has been changed to select it, and
use its exported helpers to further register its private MDIO bus. The
DSA Felix driver will do the same.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Conflicts:
	drivers/net/ethernet/freescale/enetc/enetc_mdio.c
	drivers/net/ethernet/freescale/enetc/enetc_mdio.h
	drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c
	drivers/net/ethernet/freescale/enetc/enetc_pf.c
	drivers/net/ethernet/freescale/enetc/enetc_pf.h

mostly with the previous (downstream version of this commit) patch
572ee5d842 ("enetc: Make mdio accessors more generic"), which couldn't
be reverted cleanly due to the existing downstream workaround for the
MDIO erratum.

(cherry picked from commit 344355a498)
2020-02-26 04:17:36 +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
Claudiu Manoil 7a5abf6a72 enetc: Remove mdio bus on PF probe error path
Fixes following kernel panic on the probing error
path, when pci=nomsi bootarg is used (which is
not supporrted by the enetc dirver):

fsl_enetc 0000:00:00.0: MSIX alloc failed
------------[ cut here ]------------
kernel BUG at drivers/net/phy/mdio_bus.c:487!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
Modules linked in:
Process swapper/0 (pid: 1, stack limit = 0x(____ptrval____))
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.68-00004-g85dc4876e6e6 #1
Hardware name: LS1028A RDB Board (DT)
pstate: 80000005 (Nzcv daif -PAN -UAO)
pc : mdiobus_free+0x5c/0x60
lr : _devm_mdiobus_free+0x20/0x30
[...]
Call trace:
 mdiobus_free+0x5c/0x60
 _devm_mdiobus_free+0x20/0x30
 release_nodes+0x148/0x238
 devres_release_all+0x3c/0x68
 really_probe+0x90/0x2a0
 driver_probe_device+0x5c/0x100
 __driver_attach+0xf0/0xf8
 bus_for_each_dev+0x84/0xd8
 driver_attach+0x30/0x40
 bus_add_driver+0x1c4/0x230
 driver_register+0x64/0x110
 __pci_register_driver+0x58/0x68
 enetc_pf_driver_init+0x28/0x30
 do_one_initcall+0x54/0x268
 kernel_init_freeable+0x2d0/0x37c
 kernel_init+0x18/0x118
 ret_from_fork+0x10/0x1c
Code: 97e0dd79 f9400bf3 a8c27bfd d65f03c0 (d4210000)
---[ end trace 1e4e5729f059b773 ]---

Fixes: ebfcb23d62 ("enetc: Add ENETC PF level external MDIO support")
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-12-02 18:04:22 +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 2d468e7227 enetc: Enable live mac addr change for PF
Use device flag IFF_LIVE_ADDR_CHANGE to signal that
the device supports changing the primary mac address
for a ENETC port, when the PF eth interface is running.
This capability is required by certain applications,
like bonding mode 6 (Adaptive Load Balancing).

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-12-02 18:04:21 +08:00
Alex Marginean d05ad46efd enetc: Handle USXGMII protocol
Adds USXGMII protocol which is now supported in Linux.  XGMII is kept for
compatibility although there is no plain XGMII support in ENETC.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
2019-12-02 18:04:21 +08:00
Alex Marginean 501d929c03 enetc: Use DT protocol information to set up the ports
Use DT information rather than in-band information from bootloader to
set up MAC for XGMII. For RGMII use the DT indication in addition to
RGMII defaults in hardware.
However, this implies that PHY connection information needs to be
extracted before netdevice creation, when the ENETC Port MAC is
being configured.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-12-02 18:04:20 +08:00
Claudiu Manoil 9cf9459fe2 enetc: Drop redundant device node check
The existence of the DT port node is the first thing checked
at probe time, and probing won't continue if the node is missing.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-12-02 18:04:20 +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 48d4784a7e enetc: Fix if_mode extraction
If if_mode not found then just handle it as fixed link
(i.e mac2mac connection).

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
Dan Carpenter ced81eb84d enetc: Fix a signedness bug in enetc_of_get_phy()
The "priv->if_mode" is type phy_interface_t which is an enum.  In this
context GCC will treat the enum as an unsigned int so this error
handling is never triggered.

Fixes: d4fd0404c1 ("enetc: Introduce basic PF and VF ENETC ethernet drivers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-09-27 10:03:41 +02:00
Claudiu Manoil 231ece36f5 enetc: Add mdio bus driver for the PCIe MDIO endpoint
ENETC ports can manage the MDIO bus via local register
interface.  However there's also a centralized way
to manage the MDIO bus, via the MDIO PCIe endpoint
device integrated by the same root complex that also
integrates the ENETC ports (eth controllers).

Depending on board design and use case, centralized
access to MDIO may be better than using local ENETC
port registers.  For instance, on the LS1028A QDS board
where MDIO muxing is required.  Also, the LS1028A on-chip
switch doesn't have a local MDIO register interface.

The current patch registers the above PCIe endpoint as a
separate MDIO bus and provides a driver for it by re-using
the code used for local MDIO access.  It also allows the
ENETC port PHYs to be managed by this driver if the local
"mdio" node is missing from the ENETC port node.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-02 18:22:18 -07: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
Claudiu Manoil 5d91eebc5d enetc: Allow to disable Tx SG
The fact that the Tx SG flag is fixed to 'on' is only
an oversight. Non-SG mode is also supported. Fix this
by allowing to turn SG off.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-15 09:14:29 -07:00
Claudiu Manoil ebfcb23d62 enetc: Add ENETC PF level external MDIO support
Each ENETC PF has its own MDIO interface, the corresponding
MDIO registers are mapped in the ENETC's Port register block.
The current patch adds a driver for these PF level MDIO buses,
so that each PF can manage directly its own external link.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-01 11:21:32 -08: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 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