Re: [PATCH net-next v4 06/11] net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver

From: Peter Ujfalusi
Date: Thu Mar 19 2020 - 09:12:11 EST


Hi Grygorii,

On 19/03/2020 15.09, Grygorii Strashko wrote:
>
>
> On 19/03/2020 13:46, Peter Ujfalusi wrote:
>> Hi Grygorii,
>>
>> On 17/03/2020 9.27, Grygorii Strashko wrote:
>>> The TI AM65x/J721E SoCs Gigabit Ethernet Switch subsystem (CPSW2G
>>> NUSS) has
>>> two ports - One Ethernet port (port 1) with selectable RGMII and RMII
>>> interfaces and an internal Communications Port Programming Interface
>>> (CPPI)
>>> port (Host port 0) and with ALE in between. It also contains
>>> Â - Management Data Input/Output (MDIO) interface for physical layer
>>> device
>>> (PHY) management;
>>> Â - Updated Address Lookup Engine (ALE) module;
>>> Â - (TBD) New version of Common platform time sync (CPTS) module.
>>>
>>> On the TI am65x/J721E SoCs CPSW NUSS Ethernet subsystem into device MCU
>>> domain named MCU_CPSW0.
>>>
>>> Host Port 0 CPPI Packet Streaming Interface interface supports 8 TX
>>> channels and one RX channels operating by TI am654 NAVSS Unified DMA
>>> Peripheral Root Complex (UDMA-P) controller.
>>>
>>> Introduced driver provides standard Linux net_device to user space
>>> and supports:
>>> Â - ifconfig up/down
>>> Â - MAC address configuration
>>> Â - ethtool operation:
>>> ÂÂÂ --driver
>>> ÂÂÂ --change
>>> ÂÂÂ --register-dump
>>> ÂÂÂ --negotiate phy
>>> ÂÂÂ --statistics
>>> ÂÂÂ --set-eee phy
>>> ÂÂÂ --show-ring
>>> ÂÂÂ --show-channels
>>> ÂÂÂ --set-channels
>>> Â - net_device ioctl mii-control
>>> Â - promisc mode
>>>
>>> Â - rx checksum offload for non-fragmented IPv4/IPv6 TCP/UDP packets.
>>> ÂÂÂ The CPSW NUSS can verify IPv4/IPv6 TCP/UDP packets checksum and
>>> fills
>>> ÂÂÂ csum information for each packet in psdata[2] word:
>>> ÂÂÂ - BIT(16) CHECKSUM_ERROR - indicates csum error
>>> ÂÂÂ - BIT(17) FRAGMENT -Â indicates fragmented packet
>>> ÂÂÂ - BIT(18) TCP_UDP_N -Â Indicates TCP packet was detected
>>>  - BIT(19) IPV6_VALID, BIT(20) IPV4_VALID - indicates IPv6/IPv4
>>> packet
>>> ÂÂÂ - BIT(15, 0) CHECKSUM_ADD - This is the value that was summed
>>> ÂÂÂ during the checksum computation. This value is FFFFh for non
>>> fragmented
>>> ÂÂÂ IPV4/6 UDP/TCP packets with no checksum error.
>>>
>>> ÂÂÂ RX csum offload can be disabled:
>>> ÂÂÂÂ ethtool -K <dev> rx-checksum on|off
>>>
>>> Â - tx checksum offload support for IPv4/IPv6 TCP/UDP packets (J721E
>>> only).
>>>  TX csum HW offload can be enabled/disabled:
>>> ÂÂÂÂ ethtool -K <dev> tx-checksum-ip-generic on|off
>>>
>>> Â - multiq and switch between round robin/prio modes for cppi tx
>>> queues by
>>> ÂÂÂ using Netdev private flag "p0-rx-ptype-rrobin" to switch between
>>> ÂÂÂ Round Robin and Fixed priority modes:
>>> ÂÂÂÂ # ethtool --show-priv-flags eth0
>>> ÂÂÂÂ Private flags for eth0:
>>> ÂÂÂÂ p0-rx-ptype-rrobin: on
>>> ÂÂÂÂ # ethtool --set-priv-flags eth0 p0-rx-ptype-rrobin off
>>>
>>> ÂÂÂ Number of TX DMA channels can be changed using "ethtool -L eth0
>>> tx <N>".
>>>
>>> Â - GRO support: the napi_gro_receive() and napi_complete_done() are
>>> used.
>>>
>>> Signed-off-by: Grygorii Strashko <grygorii.strashko@xxxxxx>
>>> ---
>>> Â drivers/net/ethernet/ti/KconfigÂÂÂÂÂÂÂÂÂÂÂÂ |ÂÂ 19 +-
>>> Â drivers/net/ethernet/ti/MakefileÂÂÂÂÂÂÂÂÂÂÂ |ÂÂÂ 3 +
>>> Â drivers/net/ethernet/ti/am65-cpsw-ethtool.c |Â 747 +++++++
>>> Â drivers/net/ethernet/ti/am65-cpsw-nuss.cÂÂÂ | 1965 +++++++++++++++++++
>>> Â drivers/net/ethernet/ti/am65-cpsw-nuss.hÂÂÂ |Â 143 ++
>>> Â drivers/net/ethernet/ti/k3-udma-desc-pool.c |Â 126 ++
>>> Â drivers/net/ethernet/ti/k3-udma-desc-pool.h |ÂÂ 30 +
>>
>> I would rather loose the 'udma' from the name and API. It is more like
>> CPPI5 descriptor pool than UDMA. UDMA is just happen to use CPPI5.
>> Probably ti-cppi5-desc-pool?
>
> ok. I'll update and re-send

Thank you!
Probably drop the ti- prefix as well from the filename as it is under a
ti directory?

>>
>>> Â 7 files changed, 3031 insertions(+), 2 deletions(-)
>>> Â create mode 100644 drivers/net/ethernet/ti/am65-cpsw-ethtool.c
>>> Â create mode 100644 drivers/net/ethernet/ti/am65-cpsw-nuss.c
>>> Â create mode 100644 drivers/net/ethernet/ti/am65-cpsw-nuss.h
>>> Â create mode 100644 drivers/net/ethernet/ti/k3-udma-desc-pool.c
>>> Â create mode 100644 drivers/net/ethernet/ti/k3-udma-desc-pool.h
>>
>>> diff --git a/drivers/net/ethernet/ti/Kconfig
>>> b/drivers/net/ethernet/ti/Kconfig
>>> index 8a6ca16eee3b..89cec778cf2d 100644
>>> --- a/drivers/net/ethernet/ti/Kconfig
>>> +++ b/drivers/net/ethernet/ti/Kconfig
>>> @@ -6,7 +6,7 @@
>>> Â config NET_VENDOR_TI
>>> ÂÂÂÂÂ bool "Texas Instruments (TI) devices"
>>> ÂÂÂÂÂ default y
>>> -ÂÂÂ depends on PCI || EISA || AR7 || ARCH_DAVINCI || ARCH_OMAP2PLUS
>>> || ARCH_KEYSTONE
>>> +ÂÂÂ depends on PCI || EISA || AR7 || ARCH_DAVINCI || ARCH_OMAP2PLUS
>>> || ARCH_KEYSTONE || ARCH_K3
>>> ÂÂÂÂÂ ---help---
>>> ÂÂÂÂÂÂÂ If you have a network (Ethernet) card belonging to this
>>> class, say Y.
>>> Â @@ -31,7 +31,7 @@ config TI_DAVINCI_EMAC
>>> Â Â config TI_DAVINCI_MDIO
>>> ÂÂÂÂÂ tristate "TI DaVinci MDIO Support"
>>> -ÂÂÂ depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || ARCH_KEYSTONE ||
>>> COMPILE_TEST
>>> +ÂÂÂ depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || ARCH_KEYSTONE ||
>>> ARCH_K3 || COMPILE_TEST
>>> ÂÂÂÂÂ select PHYLIB
>>> ÂÂÂÂÂ ---help---
>>> ÂÂÂÂÂÂÂ This driver supports TI's DaVinci MDIO module.
>>> @@ -95,6 +95,21 @@ config TI_CPTS_MOD
>>> ÂÂÂÂÂ imply PTP_1588_CLOCK
>>> ÂÂÂÂÂ default m
>>> Â +config TI_K3_AM65_CPSW_NUSS
>>> +ÂÂÂ tristate "TI K3 AM654x/J721E CPSW Ethernet driver"
>>> +ÂÂÂ depends on ARCH_K3 && OF && TI_K3_UDMA_GLUE_LAYER
>>> +ÂÂÂ select TI_DAVINCI_MDIO
>>> +ÂÂÂ imply PHY_TI_GMII_SEL
>>> +ÂÂÂ help
>>> +ÂÂÂÂÂ This driver supports TI K3 AM654/J721E CPSW2G Ethernet SubSystem.
>>> +ÂÂÂÂÂ The two-port Gigabit Ethernet MAC (MCU_CPSW0) subsystem provides
>>> +ÂÂÂÂÂ Ethernet packet communication for the device: One Ethernet port
>>> +ÂÂÂÂÂ (port 1) with selectable RGMII and RMII interfaces and an
>>> internal
>>> +ÂÂÂÂÂ Communications Port Programming Interface (CPPI) port (port 0).
>>> +
>>> +ÂÂÂÂÂ To compile this driver as a module, choose M here: the module
>>> +ÂÂÂÂÂ will be called ti-am65-cpsw-nuss.
>>> +
>>> Â config TI_KEYSTONE_NETCP
>>> ÂÂÂÂÂ tristate "TI Keystone NETCP Core Support"
>>> ÂÂÂÂÂ select TI_DAVINCI_MDIO
>>> diff --git a/drivers/net/ethernet/ti/Makefile
>>> b/drivers/net/ethernet/ti/Makefile
>>> index ecf776ad8689..6362a9b0bb8a 100644
>>> --- a/drivers/net/ethernet/ti/Makefile
>>> +++ b/drivers/net/ethernet/ti/Makefile
>>> @@ -23,3 +23,6 @@ obj-$(CONFIG_TI_KEYSTONE_NETCP) += keystone_netcp.o
>>> Â keystone_netcp-y := netcp_core.o cpsw_ale.o
>>> Â obj-$(CONFIG_TI_KEYSTONE_NETCP_ETHSS) += keystone_netcp_ethss.o
>>> Â keystone_netcp_ethss-y := netcp_ethss.o netcp_sgmii.o
>>> netcp_xgbepcsr.o cpsw_ale.o
>>> +
>>> +obj-$(CONFIG_TI_K3_AM65_CPSW_NUSS) += ti-am65-cpsw-nuss.o
>>> +ti-am65-cpsw-nuss-y := am65-cpsw-nuss.o cpsw_sl.o
>>> am65-cpsw-ethtool.o cpsw_ale.o k3-udma-desc-pool.o
>>
>> Would not be better to have the desc-pool (silent) Kconfig selectable?
>> The not yet upstream icssg-prueth also needs the same desc-pool library
>> as cpsw.
>>
>
> I'd prefer not to add new Kconfig options unless required.
> This driver simply not work without it, so no Kconfig option for now.

OK, fair enough.

- PÃter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki