Commit 76c3a449 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'NCN26000-PLCA-RS-support'

Piergiorgio Beruto says:

====================
net: add PLCA RS support and onsemi NCN26000

This patchset adds support for getting/setting the Physical Layer
Collision Avoidace (PLCA) Reconciliation Sublayer (RS) configuration and
status on Ethernet PHYs that supports it.

PLCA is a feature that provides improved media-access performance in terms
of throughput, latency and fairness for multi-drop (P2MP) half-duplex PHYs.
PLCA is defined in Clause 148 of the IEEE802.3 specifications as amended
by 802.3cg-2019. Currently, PLCA is supported by the 10BASE-T1S single-pair
Ethernet PHY defined in the same standard and related amendments. The OPEN
Alliance SIG TC14 defines additional specifications for the 10BASE-T1S PHY,
including a standard register map for PHYs that embeds the PLCA RS (see
PLCA management registers at https://www.opensig.org/about/specifications/

).

The changes proposed herein add the appropriate ethtool netlink interface
for configuring the PLCA RS on PHYs that supports it. A separate patchset
further modifies the ethtool userspace program to show and modify the
configuration/status of the PLCA RS.

Additionally, this patchset adds support for the onsemi NCN26000
Industrial Ethernet 10BASE-T1S PHY that uses the newly added PLCA
infrastructure.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents a6f53606 b53e7e8d
Loading
Loading
Loading
Loading
+138 −0
Original line number Diff line number Diff line
@@ -1716,6 +1716,141 @@ being used. Current supported options are toeplitz, xor or crc32.
ETHTOOL_A_RSS_INDIR attribute returns RSS indrection table where each byte
indicates queue number.

PLCA_GET_CFG
============

Gets the IEEE 802.3cg-2019 Clause 148 Physical Layer Collision Avoidance
(PLCA) Reconciliation Sublayer (RS) attributes.

Request contents:

  =====================================  ======  ==========================
  ``ETHTOOL_A_PLCA_HEADER``              nested  request header
  =====================================  ======  ==========================

Kernel response contents:

  ======================================  ======  =============================
  ``ETHTOOL_A_PLCA_HEADER``               nested  reply header
  ``ETHTOOL_A_PLCA_VERSION``              u16     Supported PLCA management
                                                  interface standard/version
  ``ETHTOOL_A_PLCA_ENABLED``              u8      PLCA Admin State
  ``ETHTOOL_A_PLCA_NODE_ID``              u32     PLCA unique local node ID
  ``ETHTOOL_A_PLCA_NODE_CNT``             u32     Number of PLCA nodes on the
                                                  network, including the
                                                  coordinator
  ``ETHTOOL_A_PLCA_TO_TMR``               u32     Transmit Opportunity Timer
                                                  value in bit-times (BT)
  ``ETHTOOL_A_PLCA_BURST_CNT``            u32     Number of additional packets
                                                  the node is allowed to send
                                                  within a single TO
  ``ETHTOOL_A_PLCA_BURST_TMR``            u32     Time to wait for the MAC to
                                                  transmit a new frame before
                                                  terminating the burst
  ======================================  ======  =============================

When set, the optional ``ETHTOOL_A_PLCA_VERSION`` attribute indicates which
standard and version the PLCA management interface complies to. When not set,
the interface is vendor-specific and (possibly) supplied by the driver.
The OPEN Alliance SIG specifies a standard register map for 10BASE-T1S PHYs
embedding the PLCA Reconcialiation Sublayer. See "10BASE-T1S PLCA Management
Registers" at https://www.opensig.org/about/specifications/.

When set, the optional ``ETHTOOL_A_PLCA_ENABLED`` attribute indicates the
administrative state of the PLCA RS. When not set, the node operates in "plain"
CSMA/CD mode. This option is corresponding to ``IEEE 802.3cg-2019`` 30.16.1.1.1
aPLCAAdminState / 30.16.1.2.1 acPLCAAdminControl.

When set, the optional ``ETHTOOL_A_PLCA_NODE_ID`` attribute indicates the
configured local node ID of the PHY. This ID determines which transmit
opportunity (TO) is reserved for the node to transmit into. This option is
corresponding to ``IEEE 802.3cg-2019`` 30.16.1.1.4 aPLCALocalNodeID. The valid
range for this attribute is [0 .. 255] where 255 means "not configured".

When set, the optional ``ETHTOOL_A_PLCA_NODE_CNT`` attribute indicates the
configured maximum number of PLCA nodes on the mixing-segment. This number
determines the total number of transmit opportunities generated during a
PLCA cycle. This attribute is relevant only for the PLCA coordinator, which is
the node with aPLCALocalNodeID set to 0. Follower nodes ignore this setting.
This option is corresponding to ``IEEE 802.3cg-2019`` 30.16.1.1.3
aPLCANodeCount. The valid range for this attribute is [1 .. 255].

When set, the optional ``ETHTOOL_A_PLCA_TO_TMR`` attribute indicates the
configured value of the transmit opportunity timer in bit-times. This value
must be set equal across all nodes sharing the medium for PLCA to work
correctly. This option is corresponding to ``IEEE 802.3cg-2019`` 30.16.1.1.5
aPLCATransmitOpportunityTimer. The valid range for this attribute is
[0 .. 255].

When set, the optional ``ETHTOOL_A_PLCA_BURST_CNT`` attribute indicates the
configured number of extra packets that the node is allowed to send during a
single transmit opportunity. By default, this attribute is 0, meaning that
the node can only send a sigle frame per TO. When greater than 0, the PLCA RS
keeps the TO after any transmission, waiting for the MAC to send a new frame
for up to aPLCABurstTimer BTs. This can only happen a number of times per PLCA
cycle up to the value of this parameter. After that, the burst is over and the
normal counting of TOs resumes. This option is corresponding to
``IEEE 802.3cg-2019`` 30.16.1.1.6 aPLCAMaxBurstCount. The valid range for this
attribute is [0 .. 255].

When set, the optional ``ETHTOOL_A_PLCA_BURST_TMR`` attribute indicates how
many bit-times the PLCA RS waits for the MAC to initiate a new transmission
when aPLCAMaxBurstCount is greater than 0. If the MAC fails to send a new
frame within this time, the burst ends and the counting of TOs resumes.
Otherwise, the new frame is sent as part of the current burst. This option
is corresponding to ``IEEE 802.3cg-2019`` 30.16.1.1.7 aPLCABurstTimer. The
valid range for this attribute is [0 .. 255]. Although, the value should be
set greater than the Inter-Frame-Gap (IFG) time of the MAC (plus some margin)
for PLCA burst mode to work as intended.

PLCA_SET_CFG
============

Sets PLCA RS parameters.

Request contents:

  ======================================  ======  =============================
  ``ETHTOOL_A_PLCA_HEADER``               nested  request header
  ``ETHTOOL_A_PLCA_ENABLED``              u8      PLCA Admin State
  ``ETHTOOL_A_PLCA_NODE_ID``              u8      PLCA unique local node ID
  ``ETHTOOL_A_PLCA_NODE_CNT``             u8      Number of PLCA nodes on the
                                                  netkork, including the
                                                  coordinator
  ``ETHTOOL_A_PLCA_TO_TMR``               u8      Transmit Opportunity Timer
                                                  value in bit-times (BT)
  ``ETHTOOL_A_PLCA_BURST_CNT``            u8      Number of additional packets
                                                  the node is allowed to send
                                                  within a single TO
  ``ETHTOOL_A_PLCA_BURST_TMR``            u8      Time to wait for the MAC to
                                                  transmit a new frame before
                                                  terminating the burst
  ======================================  ======  =============================

For a description of each attribute, see ``PLCA_GET_CFG``.

PLCA_GET_STATUS
===============

Gets PLCA RS status information.

Request contents:

  =====================================  ======  ==========================
  ``ETHTOOL_A_PLCA_HEADER``              nested  request header
  =====================================  ======  ==========================

Kernel response contents:

  ======================================  ======  =============================
  ``ETHTOOL_A_PLCA_HEADER``               nested  reply header
  ``ETHTOOL_A_PLCA_STATUS``               u8      PLCA RS operational status
  ======================================  ======  =============================

When set, the ``ETHTOOL_A_PLCA_STATUS`` attribute indicates whether the node is
detecting the presence of the BEACON on the network. This flag is
corresponding to ``IEEE 802.3cg-2019`` 30.16.1.1.2 aPLCAStatus.

Request translation
===================

@@ -1817,4 +1952,7 @@ are netlink only.
  n/a                                 ``ETHTOOL_MSG_PHC_VCLOCKS_GET``
  n/a                                 ``ETHTOOL_MSG_MODULE_GET``
  n/a                                 ``ETHTOOL_MSG_MODULE_SET``
  n/a                                 ``ETHTOOL_MSG_PLCA_GET_CFG``
  n/a                                 ``ETHTOOL_MSG_PLCA_SET_CFG``
  n/a                                 ``ETHTOOL_MSG_PLCA_GET_STATUS``
  =================================== =====================================
+14 −0
Original line number Diff line number Diff line
@@ -15584,6 +15584,13 @@ L: linux-mips@vger.kernel.org
S:	Maintained
F:	arch/mips/boot/dts/ralink/omega2p.dts
ONSEMI ETHERNET PHY DRIVERS
M:	Piergiorgio Beruto <piergiorgio.beruto@gmail.com>
L:	netdev@vger.kernel.org
S:	Supported
W:	http://www.onsemi.com
F:	drivers/net/phy/ncn*
OP-TEE DRIVER
M:	Jens Wiklander <jens.wiklander@linaro.org>
L:	op-tee@lists.trustedfirmware.org
@@ -16616,6 +16623,13 @@ S: Maintained
F:	Documentation/devicetree/bindings/iio/chemical/plantower,pms7003.yaml
F:	drivers/iio/chemical/pms7003.c
PLCA RECONCILIATION SUBLAYER (IEEE802.3 Clause 148)
M:	Piergiorgio Beruto <piergiorgio.beruto@gmail.com>
L:	netdev@vger.kernel.org
S:	Maintained
F:	drivers/net/phy/mdio-open-alliance.h
F:	net/ethtool/plca.c
PLDMFW LIBRARY
M:	Jacob Keller <jacob.e.keller@intel.com>
S:	Maintained
+7 −0
Original line number Diff line number Diff line
@@ -277,6 +277,13 @@ config NXP_TJA11XX_PHY
	help
	  Currently supports the NXP TJA1100 and TJA1101 PHY.

config NCN26000_PHY
	tristate "Onsemi 10BASE-T1S Ethernet PHY"
	help
	  Adds support for the onsemi 10BASE-T1S Ethernet PHY.
	  Currently supports the NCN26000 10BASE-T1S Industrial PHY
	  with MII interface.

config AT803X_PHY
	tristate "Qualcomm Atheros AR803X PHYs and QCA833x PHYs"
	depends on REGULATOR
+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ obj-$(CONFIG_MICROCHIP_T1_PHY) += microchip_t1.o
obj-$(CONFIG_MICROSEMI_PHY)	+= mscc/
obj-$(CONFIG_MOTORCOMM_PHY)	+= motorcomm.o
obj-$(CONFIG_NATIONAL_PHY)	+= national.o
obj-$(CONFIG_NCN26000_PHY)	+= ncn26000.o
obj-$(CONFIG_NXP_C45_TJA11XX_PHY)	+= nxp-c45-tja11xx.o
obj-$(CONFIG_NXP_TJA11XX_PHY)	+= nxp-tja11xx.o
obj-$(CONFIG_QSEMI_PHY)		+= qsemi.o
+46 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * mdio-open-alliance.h - definition of OPEN Alliance SIG standard registers
 */

#ifndef __MDIO_OPEN_ALLIANCE__
#define __MDIO_OPEN_ALLIANCE__

#include <linux/mdio.h>

/* NOTE: all OATC14 registers are located in MDIO_MMD_VEND2 */

/* Open Alliance TC14 (10BASE-T1S) registers */
#define MDIO_OATC14_PLCA_IDVER	0xca00  /* PLCA ID and version */
#define MDIO_OATC14_PLCA_CTRL0	0xca01	/* PLCA Control register 0 */
#define MDIO_OATC14_PLCA_CTRL1	0xca02	/* PLCA Control register 1 */
#define MDIO_OATC14_PLCA_STATUS	0xca03	/* PLCA Status register */
#define MDIO_OATC14_PLCA_TOTMR	0xca04	/* PLCA TO Timer register */
#define MDIO_OATC14_PLCA_BURST	0xca05	/* PLCA BURST mode register */

/* Open Alliance TC14 PLCA IDVER register */
#define MDIO_OATC14_PLCA_IDM	0xff00	/* PLCA MAP ID */
#define MDIO_OATC14_PLCA_VER	0x00ff	/* PLCA MAP version */

/* Open Alliance TC14 PLCA CTRL0 register */
#define MDIO_OATC14_PLCA_EN	BIT(15) /* PLCA enable */
#define MDIO_OATC14_PLCA_RST	BIT(14) /* PLCA reset */

/* Open Alliance TC14 PLCA CTRL1 register */
#define MDIO_OATC14_PLCA_NCNT	0xff00	/* PLCA node count */
#define MDIO_OATC14_PLCA_ID	0x00ff	/* PLCA local node ID */

/* Open Alliance TC14 PLCA STATUS register */
#define MDIO_OATC14_PLCA_PST	BIT(15)	/* PLCA status indication */

/* Open Alliance TC14 PLCA TOTMR register */
#define MDIO_OATC14_PLCA_TOT	0x00ff

/* Open Alliance TC14 PLCA BURST register */
#define MDIO_OATC14_PLCA_MAXBC	0xff00
#define MDIO_OATC14_PLCA_BTMR	0x00ff

/* Version Identifiers */
#define OATC14_IDM		0x0a00

#endif /* __MDIO_OPEN_ALLIANCE__ */
Loading