Brcm ASP 2.0 Ethernet Controller
Subsystems (7)
Justin Chen
maintainerv6 cover Brcm ASP 2.0 Ethernet Controller
Add support for the Broadcom ASP 2.0 Ethernet controller which is first introduced with 72165.
Florian Fainelli (2):
dt-bindings: net: Brcm ASP 2.0 Ethernet controller
net: phy: bcm7xxx: Add EPHY entry for 74165
Justin Chen (4):
dt-bindings: net: brcm,unimac-mdio: Add asp-v2.0
net: bcmasp: Add support for ASP2.0 Ethernet controller
net: phy: mdio-bcm-unimac: Add asp v2.0 support
MAINTAINERS: ASP 2.0 Ethernet driver maintainers
.../devicetree/bindings/net/brcm,asp-v2.0.yaml | 153 ++ .../devicetree/bindings/net/brcm,unimac-mdio.yaml | 2 + MAINTAINERS | 9 + drivers/net/ethernet/broadcom/Kconfig | 11 + drivers/net/ethernet/broadcom/Makefile | 1 + drivers/net/ethernet/broadcom/asp2/Makefile | 2 + drivers/net/ethernet/broadcom/asp2/bcmasp.c | 1467 ++++++++++++++++++++ drivers/net/ethernet/broadcom/asp2/bcmasp.h | 638 +++++++++ .../net/ethernet/broadcom/asp2/bcmasp_ethtool.c | 568 ++++++++ drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c | 1393 +++++++++++++++++++ .../net/ethernet/broadcom/asp2/bcmasp_intf_defs.h | 238 ++++ drivers/net/mdio/mdio-bcm-unimac.c | 2 + drivers/net/phy/bcm7xxx.c | 1 + include/linux/brcmphy.h | 1 + 14 files changed, 4486 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml create mode 100644 drivers/net/ethernet/broadcom/asp2/Makefile create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp.c create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp.h create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp_intf_defs.h
Signature · 1 line
2.7.4
Justin Chen
maintainerPATCH v6 1/6 dt-bindings: net: brcm,unimac-mdio: Add asp-v2.0
The ASP 2.0 Ethernet controller uses a brcm unimac.
--- Documentation/devicetree/bindings/net/brcm,unimac-mdio.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/net/brcm,unimac-mdio.yaml +2 -0
@@ -22,6 +22,8 @@ properties: - brcm,genet-mdio-v3 - brcm,genet-mdio-v4 - brcm,genet-mdio-v5 + - brcm,asp-v2.0-mdio + - brcm,asp-v2.1-mdio - brcm,unimac-mdio reg:
Signature · 1 line
2.7.4
Justin Chen
maintainerPATCH v6 2/6 dt-bindings: net: Brcm ASP 2.0 Ethernet controller
In reply to Justin ChenFrom: Florian Fainelli <[email protected]>
Add a binding document for the Broadcom ASP 2.0 Ethernet controller.
---
v6
- Moved compatible to the top
- Changed quotes to be consistent
- Elaborated on brcm,channel description
v5
- Fix compatible string yaml format to properly capture what we want
v4
- Adjust compatible string example to reference SoC and HW ver
v3
- Minor formatting issues
- Change channel prop to brcm,channel for vendor specific format
- Removed redundant v2.0 from compat string
- Fix ranges field
v2
- Minor formatting issues
.../devicetree/bindings/net/brcm,asp-v2.0.yaml | 153 +++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml
Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml new file +153 -0
@@ -0,0 +1,153 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/brcm,asp-v2.0.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Broadcom ASP 2.0 Ethernet controller + +maintainers: + - Justin Chen <[email protected]> + - Florian Fainelli <[email protected]> + +description: Broadcom Ethernet controller first introduced with 72165 + +properties: + compatible: + oneOf: + - items: + - enum: + - brcm,bcm74165-asp + - const: brcm,asp-v2.1 + - items: + - enum: + - brcm,bcm72165-asp + - const: brcm,asp-v2.0 + + "#address-cells": + const: 1 + "#size-cells": + const: 1 + + reg: + maxItems: 1 + + ranges: true + + interrupts: + minItems: 1 + items: + - description: RX/TX interrupt + - description: Port 0 Wake-on-LAN + - description: Port 1 Wake-on-LAN + + clocks: + maxItems: 1 + + ethernet-ports: + type: object + properties: + "#address-cells": + const: 1 + "#size-cells": + const: 0 + + patternProperties: + "^port@[0-9]+$": + type: object + + $ref: ethernet-controller.yaml# + + properties: + reg: + maxItems: 1 + description: Port number + + brcm,channel: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + ASP Channel Number + + The depacketizer channel that consumes packets from + the unimac/port. + + required: + - reg + - brcm,channel + + additionalProperties: false + +patternProperties: + "^mdio@[0-9a-f]+$": + type: object + $ref: brcm,unimac-mdio.yaml + + description: + ASP internal UniMAC MDIO bus + +required: + - compatible + - reg + - interrupts + - clocks + - ranges + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + + ethernet@9c00000 { + compatible = "brcm,bcm72165-asp", "brcm,asp-v2.0"; + reg = <0x9c00000 0x1fff14>; + interrupts = <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>; + ranges = <0x0 0x9c00000 0x1fff14>; + clocks = <&scmi 14>; + #address-cells = <1>; + #size-cells = <1>; + + mdio@c614 { + compatible = "brcm,asp-v2.0-mdio"; + reg = <0xc614 0x8>; + reg-names = "mdio"; + #address-cells = <1>; + #size-cells = <0>; + + phy0: ethernet-phy@1 { + reg = <1>; + }; + }; + + mdio@ce14 { + compatible = "brcm,asp-v2.0-mdio"; + reg = <0xce14 0x8>; + reg-names = "mdio"; + #address-cells = <1>; + #size-cells = <0>; + + phy1: ethernet-phy@1 { + reg = <1>; + }; + }; + + ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + brcm,channel = <8>; + phy-mode = "rgmii"; + phy-handle = <&phy0>; + }; + + port@1 { + reg = <1>; + brcm,channel = <9>; + phy-mode = "rgmii"; + phy-handle = <&phy1>; + }; + }; + };
Signature · 1 line
2.7.4
Rob Herring
maintainerRe: [PATCH net-next v6 2/6] dt-bindings: net: Brcm ASP 2.0 Ethernet controller
Quoted 88 lines · Justin Chen
From: Florian Fainelli <[email protected]>
Add a binding document for the Broadcom ASP 2.0 Ethernet controller.
Reviewed-by Conor Dooley <[email protected]>Signed-off-by Florian Fainelli <[email protected]>Signed-off-by Justin Chen <[email protected]>---
v6
- Moved compatible to the top
- Changed quotes to be consistent
- Elaborated on brcm,channel descriptionv5
- Fix compatible string yaml format to properly capture what we wantv4
- Adjust compatible string example to reference SoC and HW verv3
- Minor formatting issues
- Change channel prop to brcm,channel for vendor specific format
- Removed redundant v2.0 from compat string
- Fix ranges fieldv2
- Minor formatting issues.../devicetree/bindings/net/brcm,asp-v2.0.yaml | 153 +++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/brcm,asp-v2.0.yamlDocumentation/devicetree/bindings/net/brcm,asp-v2.0.yaml new file +49
-0@@ -0,0 +1,153 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/brcm,asp-v2.0.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Broadcom ASP 2.0 Ethernet controller + +maintainers: + - Justin Chen <[email protected]> + - Florian Fainelli <[email protected]> + +description: Broadcom Ethernet controller first introduced with 72165 + +properties: + compatible: + oneOf: + - items: + - enum: + - brcm,bcm74165-asp + - const: brcm,asp-v2.1 + - items: + - enum: + - brcm,bcm72165-asp + - const: brcm,asp-v2.0 + + "#address-cells": + const: 1 + "#size-cells": + const: 1 + + reg: + maxItems: 1 + + ranges: true + + interrupts: + minItems: 1 + items: + - description: RX/TX interrupt + - description: Port 0 Wake-on-LAN + - description: Port 1 Wake-on-LAN + + clocks: + maxItems: 1 + + ethernet-ports: + type: object + properties:
Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml line 59
Quoted 10 lines
Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml new file +10
-0+ "#address-cells": + const: 1 + "#size-cells": + const: 0 + + patternProperties: + "^port@[0-9]+$": + type: object + + $ref: ethernet-controller.yaml#
unevaluatedProperties: false
Quoted 19 lines
Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml new file +19
-0+ + properties: + reg: + maxItems: 1 + description: Port number + + brcm,channel: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + ASP Channel Number + + The depacketizer channel that consumes packets from + the unimac/port. + + required: + - reg + - brcm,channel + + additionalProperties: false
Justin Chen
maintainerPATCH v6 3/6 net: bcmasp: Add support for ASP2.0 Ethernet controller
In reply to Justin ChenAdd support for the Broadcom ASP 2.0 Ethernet controller which is first introduced with 72165. This controller features two distinct Ethernet ports that can be independently operated.
This patch supports:
- Wake-on-LAN using magic packets
- basic ethtool operations (link, counters, message level)
- MAC destination address filtering (promiscuous, ALL_MULTI, etc.)
---
v6
- Fixed a reserved mac filter indexing error
- Removed tx_lock
- Simplified tx_timeout hook
- Removed get_stats
- Fixed phy ioctl
- Fixed dev -> ndev typo
- Fixed set_wol double disable
v5
- Remove unnecessary parenthesis
- Use bool for bcmasp_netfilt_check_dup()
v4
- Address sparse warnings
- Fix one more reverse xmas tree violation
- Improve error logic for bcmasp_netfilt_get_reg_offset()
- Remove inlines
v3
- Fix logic error with net stats where some stats were missing
- General clean up addressing formatting/spelling/consistency
- Use dev_err_probe to save a few LoCs
- Use put_unaligned when updating net stats
v2
- Replace a couple functions with helper functions
- Fix a few WoL issues
drivers/net/ethernet/broadcom/Kconfig | 11 + drivers/net/ethernet/broadcom/Makefile | 1 + drivers/net/ethernet/broadcom/asp2/Makefile | 2 + drivers/net/ethernet/broadcom/asp2/bcmasp.c | 1467 ++++++++++++++++++++ drivers/net/ethernet/broadcom/asp2/bcmasp.h | 638 +++++++++ .../net/ethernet/broadcom/asp2/bcmasp_ethtool.c | 568 ++++++++ drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c | 1393 +++++++++++++++++++ .../net/ethernet/broadcom/asp2/bcmasp_intf_defs.h | 238 ++++ 8 files changed, 4318 insertions(+) create mode 100644 drivers/net/ethernet/broadcom/asp2/Makefile create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp.c create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp.h create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp_intf_defs.h
drivers/net/ethernet/broadcom/Kconfig +11 -0
@@ -255,4 +255,15 @@ config BNXT_HWMON Say Y if you want to expose the thermal sensor data on NetXtreme-C/E devices, via the hwmon sysfs interface. +config BCMASP + tristate "Broadcom ASP 2.0 Ethernet support" + default ARCH_BRCMSTB + depends on OF + select MII + select PHYLIB + select MDIO_BCM_UNIMAC + help + This configuration enables the Broadcom ASP 2.0 Ethernet controller + driver which is present in Broadcom STB SoCs such as 72165. + endif # NET_VENDOR_BROADCOM
drivers/net/ethernet/broadcom/Makefile +1 -0
@@ -17,3 +17,4 @@ obj-$(CONFIG_BGMAC_BCMA) += bgmac-bcma.o bgmac-bcma-mdio.o obj-$(CONFIG_BGMAC_PLATFORM) += bgmac-platform.o obj-$(CONFIG_SYSTEMPORT) += bcmsysport.o obj-$(CONFIG_BNXT) += bnxt/ +obj-$(CONFIG_BCMASP) += asp2/
drivers/net/ethernet/broadcom/asp2/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +obj-$(CONFIG_BCMASP) += bcm-asp.o +bcm-asp-objs := bcmasp.o bcmasp_intf.o bcmasp_ethtool.o
drivers/net/ethernet/broadcom/asp2/bcmasp.c new file +1467 -0
1,467 lines not on this page · raw message
drivers/net/ethernet/broadcom/asp2/bcmasp.h new file +638 -0
638 lines not on this page · raw message
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +568 -0
568 lines not on this page · raw message
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +1393 -0
306 lines not on this page · raw message
drivers/net/ethernet/broadcom/asp2/bcmasp_intf_defs.h new file +238 -0
238 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.7.4
Part of the diff is not shown here. View the raw message.
Jakub Kicinski
maintainerRe: [PATCH net-next v6 3/6] net: bcmasp: Add support for ASP2.0 Ethernet controller
Quoted 6 lines · On Thu, 1 Jun 2023 15:12:28 -0700 Justin Chen wrote:
drivers/net/ethernet/broadcom/asp2/bcmasp.c new file +6
-0+ ports_node =of_find_node_by_name (dev->of_node,"ethernet-ports" ); +if (!ports_node) { +dev_warn (dev,"No ports found\n" ); +return 0 ; + } +
drivers/net/ethernet/broadcom/asp2/bcmasp.c line 1302
Quoted 10 lines
drivers/net/ethernet/broadcom/asp2/bcmasp.c new file +10
-0+for_each_available_child_of_node (ports_node, intf_node) { +of_property_read_u32 (intf_node,"reg" , &port); +if (!bcmasp_is_port_valid (priv, port)) { +dev_warn (dev,"%pOF: %d is an invalid port\n" , + intf_node, port); +continue ; + } + + priv->intf_count++; + }
I think that you're leaking ports_node,
/**
* of_find_node_by_name - Find a node by its "name" property
* @from: The node to start searching from or NULL; the node
* you pass will not be searched, only the next one
* will. Typically, you pass what the previous call
* returned. of_node_put() will be called on @from.
* @name: The name string to match against
*
* Return: A node pointer with refcount incremented, use
* of_node_put() on it when done.
*/
Signature · 1 line
pw-bot: cr
Jakub Kicinski
maintainerRe: [PATCH net-next v6 3/6] net: bcmasp: Add support for ASP2.0 Ethernet controller
In reply to Justin Chendrivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 87
Quoted 10 lines · On Thu, 1 Jun 2023 15:12:28 -0700 Justin Chen wrote:
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +10
-0+/* general stats */ +STAT_NETDEV (rx_packets), +STAT_NETDEV (tx_packets), +STAT_NETDEV (rx_bytes), +STAT_NETDEV (tx_bytes), +STAT_NETDEV (rx_errors), +STAT_NETDEV (tx_errors), +STAT_NETDEV (rx_dropped), +STAT_NETDEV (tx_dropped), + STAT_NETDEV(multicast),
please don't report standard interface stats in ethtool -S
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 98
Quoted 11 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +11
-0+/* UniMAC RSV counters */ +STAT_BCMASP_MIB_RX ("rx_64_octets" , mib.rx.pkt_cnt.cnt_64), +STAT_BCMASP_MIB_RX ("rx_65_127_oct" , mib.rx.pkt_cnt.cnt_127), +STAT_BCMASP_MIB_RX ("rx_128_255_oct" , mib.rx.pkt_cnt.cnt_255), +STAT_BCMASP_MIB_RX ("rx_256_511_oct" , mib.rx.pkt_cnt.cnt_511), +STAT_BCMASP_MIB_RX ("rx_512_1023_oct" , mib.rx.pkt_cnt.cnt_1023), +STAT_BCMASP_MIB_RX ("rx_1024_1518_oct" , mib.rx.pkt_cnt.cnt_1518), +STAT_BCMASP_MIB_RX ("rx_vlan_1519_1522_oct" , mib.rx.pkt_cnt.cnt_mgv), +STAT_BCMASP_MIB_RX ("rx_1522_2047_oct" , mib.rx.pkt_cnt.cnt_2047), +STAT_BCMASP_MIB_RX ("rx_2048_4095_oct" , mib.rx.pkt_cnt.cnt_4095), + STAT_BCMASP_MIB_RX("rx_4096_9216_oct", mib.rx.pkt_cnt.cnt_9216),
these should also be removed, and you should implement @get_rmon_stats.
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 103
Quoted 5 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +5
-0+STAT_BCMASP_MIB_RX ("rx_pkts" , mib.rx.pkt), +STAT_BCMASP_MIB_RX ("rx_bytes" , mib.rx.bytes), +STAT_BCMASP_MIB_RX ("rx_multicast" , mib.rx.mca), +STAT_BCMASP_MIB_RX ("rx_broadcast" , mib.rx.bca), + STAT_BCMASP_MIB_RX("rx_fcs", mib.rx.fcs),
there's a FCS error statistic in the standard stats, no need to duplicate
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 105
Quoted 2 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +2
-0+STAT_BCMASP_MIB_RX ("rx_control" , mib.rx.cf), + STAT_BCMASP_MIB_RX("rx_pause", mib.rx.pf),
@get_pause_stats
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 112
Quoted 7 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +7
-0+STAT_BCMASP_MIB_RX ("rx_unknown" , mib.rx.uo), +STAT_BCMASP_MIB_RX ("rx_align" , mib.rx.aln), +STAT_BCMASP_MIB_RX ("rx_outrange" , mib.rx.flr), +STAT_BCMASP_MIB_RX ("rx_code" , mib.rx.cde), +STAT_BCMASP_MIB_RX ("rx_carrier" , mib.rx.fcr), +STAT_BCMASP_MIB_RX ("rx_oversize" , mib.rx.ovr), + STAT_BCMASP_MIB_RX("rx_jabber", mib.rx.jbr),
these look like candidates from standard stats, too. Please read thru:
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 117
Quoted 5 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +5
-0+STAT_BCMASP_MIB_RX ("rx_mtu_err" , mib.rx.mtue), +STAT_BCMASP_MIB_RX ("rx_good_pkts" , mib.rx.pok), +STAT_BCMASP_MIB_RX ("rx_unicast" , mib.rx.uc), +STAT_BCMASP_MIB_RX ("rx_ppp" , mib.rx.ppp), + STAT_BCMASP_MIB_RX("rx_crc", mib.rx.rcrc),
hm, what's the difference between rx_crc and rx_fcs ?
Florian Fainelli
maintainerRe: [PATCH net-next v6 3/6] net: bcmasp: Add support for ASP2.0 Ethernet controller
Quoted 55 lines · Jakub Kicinski
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 87
Quoted 10 lines · On Thu, 1 Jun 2023 15:12:28 -0700 Justin Chen wrote:
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +10
-0+/* general stats */ +STAT_NETDEV (rx_packets), +STAT_NETDEV (tx_packets), +STAT_NETDEV (rx_bytes), +STAT_NETDEV (tx_bytes), +STAT_NETDEV (rx_errors), +STAT_NETDEV (tx_errors), +STAT_NETDEV (rx_dropped), +STAT_NETDEV (tx_dropped), + STAT_NETDEV(multicast),please don't report standard interface stats in ethtool -S
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 98
Quoted 11 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +11
-0+/* UniMAC RSV counters */ +STAT_BCMASP_MIB_RX ("rx_64_octets" , mib.rx.pkt_cnt.cnt_64), +STAT_BCMASP_MIB_RX ("rx_65_127_oct" , mib.rx.pkt_cnt.cnt_127), +STAT_BCMASP_MIB_RX ("rx_128_255_oct" , mib.rx.pkt_cnt.cnt_255), +STAT_BCMASP_MIB_RX ("rx_256_511_oct" , mib.rx.pkt_cnt.cnt_511), +STAT_BCMASP_MIB_RX ("rx_512_1023_oct" , mib.rx.pkt_cnt.cnt_1023), +STAT_BCMASP_MIB_RX ("rx_1024_1518_oct" , mib.rx.pkt_cnt.cnt_1518), +STAT_BCMASP_MIB_RX ("rx_vlan_1519_1522_oct" , mib.rx.pkt_cnt.cnt_mgv), +STAT_BCMASP_MIB_RX ("rx_1522_2047_oct" , mib.rx.pkt_cnt.cnt_2047), +STAT_BCMASP_MIB_RX ("rx_2048_4095_oct" , mib.rx.pkt_cnt.cnt_4095), + STAT_BCMASP_MIB_RX("rx_4096_9216_oct", mib.rx.pkt_cnt.cnt_9216),these should also be removed, and you should implement @get_rmon_stats.
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 103
Quoted 5 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +5
-0+STAT_BCMASP_MIB_RX ("rx_pkts" , mib.rx.pkt), +STAT_BCMASP_MIB_RX ("rx_bytes" , mib.rx.bytes), +STAT_BCMASP_MIB_RX ("rx_multicast" , mib.rx.mca), +STAT_BCMASP_MIB_RX ("rx_broadcast" , mib.rx.bca), + STAT_BCMASP_MIB_RX("rx_fcs", mib.rx.fcs),there's a FCS error statistic in the standard stats, no need to duplicate
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 105
Quoted 2 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +2
-0+STAT_BCMASP_MIB_RX ("rx_control" , mib.rx.cf), + STAT_BCMASP_MIB_RX("rx_pause", mib.rx.pf),@get_pause_stats
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 112
Quoted 7 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +7
-0+STAT_BCMASP_MIB_RX ("rx_unknown" , mib.rx.uo), +STAT_BCMASP_MIB_RX ("rx_align" , mib.rx.aln), +STAT_BCMASP_MIB_RX ("rx_outrange" , mib.rx.flr), +STAT_BCMASP_MIB_RX ("rx_code" , mib.rx.cde), +STAT_BCMASP_MIB_RX ("rx_carrier" , mib.rx.fcr), +STAT_BCMASP_MIB_RX ("rx_oversize" , mib.rx.ovr), + STAT_BCMASP_MIB_RX("rx_jabber", mib.rx.jbr),these look like candidates from standard stats, too. Please read thru:
Quoted 7 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 117
Quoted 5 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +5
-0+STAT_BCMASP_MIB_RX ("rx_mtu_err" , mib.rx.mtue), +STAT_BCMASP_MIB_RX ("rx_good_pkts" , mib.rx.pok), +STAT_BCMASP_MIB_RX ("rx_unicast" , mib.rx.uc), +STAT_BCMASP_MIB_RX ("rx_ppp" , mib.rx.ppp), + STAT_BCMASP_MIB_RX("rx_crc", mib.rx.rcrc),hm, what's the difference between
rx_crcandrx_fcs?
Since you are going to respin to address Jakub's feedback, we should also consider using the shared unimac.h header file. We could even make a library out of it for standardized statistics once this driver gets accepted.
Signature · 1 line
Florian
Justin Chen
maintainerRe: [PATCH net-next v6 3/6] net: bcmasp: Add support for ASP2.0 Ethernet controller
In reply to Jakub KicinskiQuoted 14 lines · Jakub Kicinski
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 87
Quoted 10 lines · On Thu, 1 Jun 2023 15:12:28 -0700 Justin Chen wrote:
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +10
-0+/* general stats */ +STAT_NETDEV (rx_packets), +STAT_NETDEV (tx_packets), +STAT_NETDEV (rx_bytes), +STAT_NETDEV (tx_bytes), +STAT_NETDEV (rx_errors), +STAT_NETDEV (tx_errors), +STAT_NETDEV (rx_dropped), +STAT_NETDEV (tx_dropped), + STAT_NETDEV(multicast),please don't report standard interface stats in ethtool -S
These are not netdev statistics but MAC block counters. Guess it is not clear with the naming here, will fix this. We have a use case where the MAC traffic may be redirected from the associated net dev, so the counters may not be the same.
Quoted 14 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 98
Quoted 11 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +11
-0+/* UniMAC RSV counters */ +STAT_BCMASP_MIB_RX ("rx_64_octets" , mib.rx.pkt_cnt.cnt_64), +STAT_BCMASP_MIB_RX ("rx_65_127_oct" , mib.rx.pkt_cnt.cnt_127), +STAT_BCMASP_MIB_RX ("rx_128_255_oct" , mib.rx.pkt_cnt.cnt_255), +STAT_BCMASP_MIB_RX ("rx_256_511_oct" , mib.rx.pkt_cnt.cnt_511), +STAT_BCMASP_MIB_RX ("rx_512_1023_oct" , mib.rx.pkt_cnt.cnt_1023), +STAT_BCMASP_MIB_RX ("rx_1024_1518_oct" , mib.rx.pkt_cnt.cnt_1518), +STAT_BCMASP_MIB_RX ("rx_vlan_1519_1522_oct" , mib.rx.pkt_cnt.cnt_mgv), +STAT_BCMASP_MIB_RX ("rx_1522_2047_oct" , mib.rx.pkt_cnt.cnt_2047), +STAT_BCMASP_MIB_RX ("rx_2048_4095_oct" , mib.rx.pkt_cnt.cnt_4095), + STAT_BCMASP_MIB_RX("rx_4096_9216_oct", mib.rx.pkt_cnt.cnt_9216),these should also be removed, and you should implement @get_rmon_stats.
Quoted 9 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 103
Quoted 5 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +5
-0+STAT_BCMASP_MIB_RX ("rx_pkts" , mib.rx.pkt), +STAT_BCMASP_MIB_RX ("rx_bytes" , mib.rx.bytes), +STAT_BCMASP_MIB_RX ("rx_multicast" , mib.rx.mca), +STAT_BCMASP_MIB_RX ("rx_broadcast" , mib.rx.bca), + STAT_BCMASP_MIB_RX("rx_fcs", mib.rx.fcs),there's a FCS error statistic in the standard stats, no need to duplicate
Same comment as above
Quoted 16 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 105
Quoted 2 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +2
-0+STAT_BCMASP_MIB_RX ("rx_control" , mib.rx.cf), + STAT_BCMASP_MIB_RX("rx_pause", mib.rx.pf),@get_pause_stats
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 112
Quoted 7 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +7
-0+STAT_BCMASP_MIB_RX ("rx_unknown" , mib.rx.uo), +STAT_BCMASP_MIB_RX ("rx_align" , mib.rx.aln), +STAT_BCMASP_MIB_RX ("rx_outrange" , mib.rx.flr), +STAT_BCMASP_MIB_RX ("rx_code" , mib.rx.cde), +STAT_BCMASP_MIB_RX ("rx_carrier" , mib.rx.fcr), +STAT_BCMASP_MIB_RX ("rx_oversize" , mib.rx.ovr), + STAT_BCMASP_MIB_RX("rx_jabber", mib.rx.jbr),these look like candidates from standard stats, too. Please read thru:
Quoted 2 lines
Looks like the way we are doing stats are a bit outdated. Thanks for pointing it out. I got a bit of refactoring to do.
Quoted 7 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 117
Quoted 5 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +5
-0+STAT_BCMASP_MIB_RX ("rx_mtu_err" , mib.rx.mtue), +STAT_BCMASP_MIB_RX ("rx_good_pkts" , mib.rx.pok), +STAT_BCMASP_MIB_RX ("rx_unicast" , mib.rx.uc), +STAT_BCMASP_MIB_RX ("rx_ppp" , mib.rx.ppp), + STAT_BCMASP_MIB_RX("rx_crc", mib.rx.rcrc),hm, what's the difference between
rx_crcandrx_fcs?
This looks like some debug feature that really has nothing to do with verifying crcs. I will remove it.
Apologies, probably should have done my due diligence with each stats instead of blindly including everything.
Thanks,
Justin
Jakub Kicinski
maintainerRe: [PATCH net-next v6 3/6] net: bcmasp: Add support for ASP2.0 Ethernet controller
Quoted 16 lines · On Tue, 6 Jun 2023 15:58:21 -0700 Justin Chen wrote:
Quoted 14 lines · Jakub Kicinski
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 87
Quoted 10 lines · On Thu, 1 Jun 2023 15:12:28 -0700 Justin Chen wrote:
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +10
-0+/* general stats */ +STAT_NETDEV (rx_packets), +STAT_NETDEV (tx_packets), +STAT_NETDEV (rx_bytes), +STAT_NETDEV (tx_bytes), +STAT_NETDEV (rx_errors), +STAT_NETDEV (tx_errors), +STAT_NETDEV (rx_dropped), +STAT_NETDEV (tx_dropped), + STAT_NETDEV(multicast),please don't report standard interface stats in ethtool -S
Quoted 4 lines
These are not netdev statistics but MAC block counters. Guess it is not clear with the naming here, will fix this. We have a use case where the MAC traffic may be redirected from the associated net dev, so the counters may not be the same.
You seem to be dumping straight from the stats member of struct net_device:
+ if (s->type == BCMASP_STAT_NETDEV)
+ p = (char *)&dev->stats;
No?
Also - can you describe how you can have multiple netdevs for the same MAC?
Justin Chen
maintainerRe: [PATCH net-next v6 3/6] net: bcmasp: Add support for ASP2.0 Ethernet controller
Quoted 28 lines · Jakub Kicinski
Quoted 16 lines · On Tue, 6 Jun 2023 15:58:21 -0700 Justin Chen wrote:
Quoted 14 lines · Jakub Kicinski
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 87
Quoted 10 lines · On Thu, 1 Jun 2023 15:12:28 -0700 Justin Chen wrote:
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +10
-0+/* general stats */ +STAT_NETDEV (rx_packets), +STAT_NETDEV (tx_packets), +STAT_NETDEV (rx_bytes), +STAT_NETDEV (tx_bytes), +STAT_NETDEV (rx_errors), +STAT_NETDEV (tx_errors), +STAT_NETDEV (rx_dropped), +STAT_NETDEV (tx_dropped), + STAT_NETDEV(multicast),please don't report standard interface stats in ethtool -S
Quoted 4 lines
These are not netdev statistics but MAC block counters. Guess it is not clear with the naming here, will fix this. We have a use case where the MAC traffic may be redirected from the associated net dev, so the counters may not be the same.
You seem to be dumping straight from the stats member of struct
net_device:drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +2
-0+if (s->type ==BCMASP_STAT_NETDEV ) + p = (char *)&dev->stats;
Quoted 2 lines
No?
Woops I got it mixed up. Yes these stats are redundant. What I was describing is
+ STAT_BCMASP_MIB_RX("rx_pkts", mib.rx.pkt),
and equivalent.
Quoted 2 lines
Also - can you describe how you can have multiple netdevs for the same MAC?
Not netdevs per se, but packets can be redirected to an offload co-processor.
Jakub Kicinski
maintainerRe: [PATCH net-next v6 3/6] net: bcmasp: Add support for ASP2.0 Ethernet controller
Quoted 5 lines · On Tue, 6 Jun 2023 18:35:51 -0700 Justin Chen wrote:
Quoted 2 lines
Also - can you describe how you can have multiple netdevs for the same MAC?
Not netdevs per se, but packets can be redirected to an offload co-processor.
How is the redirecting configured?
Could you split this patch into basic netdev datapath,
and then as separate patches support for ethtool configuration features, each with its own patch? This will make it easier for area experts to review.
The base patch can probably include these:
+ .get_drvinfo = bcmasp_get_drvinfo,
+ .get_link = ethtool_op_get_link,
+ .get_link_ksettings = phy_ethtool_get_link_ksettings,
+ .set_link_ksettings = phy_ethtool_set_link_ksettings,
+ .get_msglevel = bcmasp_get_msglevel,
+ .set_msglevel = bcmasp_set_msglevel,
WoL can be a separate patch:
+ .get_wol = bcmasp_get_wol,
+ .set_wol = bcmasp_set_wol,
Stats a separate patch:
+ .get_strings = bcmasp_get_strings,
+ .get_ethtool_stats = bcmasp_get_ethtool_stats,
+ .get_sset_count = bcmasp_get_sset_count,
+ .nway_reset = phy_ethtool_nway_reset,
Flow steering separate:
+ .get_rxnfc = bcmasp_get_rxnfc,
+ .set_rxnfc = bcmasp_set_rxnfc,
EEE separate:
+ .set_eee = bcmasp_set_eee,
+ .get_eee = bcmasp_get_eee,
Justin Chen
maintainerRe: [PATCH net-next v6 3/6] net: bcmasp: Add support for ASP2.0 Ethernet controller
Quoted 9 lines · Jakub Kicinski
Quoted 5 lines · On Tue, 6 Jun 2023 18:35:51 -0700 Justin Chen wrote:
Quoted 2 lines
Also - can you describe how you can have multiple netdevs for the same MAC?
Not netdevs per se, but packets can be redirected to an offload co-processor.
How is the redirecting configured?
Through filters that can be programmed by the Host cpu or co-processor.
Quoted 33 lines
Could you split this patch into basic netdev datapath,
and then as separate patches support for ethtool configuration features, each with its own patch? This will make it easier for area experts to review.The base patch can probably include these:
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +6
-0+ .get_drvinfo = bcmasp_get_drvinfo, + .get_link = ethtool_op_get_link, + .get_link_ksettings = phy_ethtool_get_link_ksettings, + .set_link_ksettings = phy_ethtool_set_link_ksettings, + .get_msglevel = bcmasp_get_msglevel, + .set_msglevel = bcmasp_set_msglevel,WoL can be a separate patch:
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +2
-0+ .get_wol = bcmasp_get_wol, + .set_wol = bcmasp_set_wol,Stats a separate patch:
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +4
-0+ .get_strings = bcmasp_get_strings, + .get_ethtool_stats = bcmasp_get_ethtool_stats, + .get_sset_count = bcmasp_get_sset_count, + .nway_reset = phy_ethtool_nway_reset,Flow steering separate:
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +2
-0+ .get_rxnfc = bcmasp_get_rxnfc, + .set_rxnfc = bcmasp_set_rxnfc,EEE separate:
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 567
Quoted 2 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +2
-0+ .set_eee = bcmasp_set_eee, + .get_eee = bcmasp_get_eee,
Will do.
Jakub Kicinski
maintainerRe: [PATCH net-next v6 3/6] net: bcmasp: Add support for ASP2.0 Ethernet controller
Quoted 6 lines · On Tue, 6 Jun 2023 19:33:13 -0700 Justin Chen wrote:
Quoted 4 lines
Quoted 2 lines
Not netdevs per se, but packets can be redirected to an offload co-processor.
How is the redirecting configured?
Through filters that can be programmed by the Host cpu or co-processor.
How are the filter programmed by the host (in terms of user API)?
Justin Chen
maintainerRe: [PATCH net-next v6 3/6] net: bcmasp: Add support for ASP2.0 Ethernet controller
Quoted 9 lines · Jakub Kicinski
Quoted 6 lines · On Tue, 6 Jun 2023 19:33:13 -0700 Justin Chen wrote:
Quoted 4 lines
Quoted 2 lines
Not netdevs per se, but packets can be redirected to an offload co-processor.
How is the redirecting configured?
Through filters that can be programmed by the Host cpu or co-processor.
How are the filter programmed by the host (in terms of user API)?
You are stumbling upon my next objective here. This patch set does not support this because it wasn't clear how to do it. The plan was to get the base driver merged first then introduce a way to specify an offload channel.
If you must know, I introduced a rxnfc flow_spec ring cookie to specify an offload filter. Not sure if this is the right way to do it or not, but figured this would be a future discussion.
Jakub Kicinski
maintainerRe: [PATCH net-next v6 3/6] net: bcmasp: Add support for ASP2.0 Ethernet controller
Quoted 8 lines · On Tue, 6 Jun 2023 21:22:45 -0700 Justin Chen wrote:
Quoted 3 lines
Quoted 1 line
Through filters that can be programmed by the Host cpu or co-processor.
How are the filter programmed by the host (in terms of user API)?
You are stumbling upon my next objective here. This patch set does not support this because it wasn't clear how to do it. The plan was to get the base driver merged first then introduce a way to specify an offload channel.
Alright.
Quoted 3 lines
If you must know, I introduced a rxnfc
flow_specring cookie to specify an offload filter. Not sure if this is the right way to do it or not, but figured this would be a future discussion.
We clean leave it for later indeed, but in case you're wondering - that's unlikely to fly. My preference will be to expose the accelerator port as a switch port, with a netdev and forward using TC flower etc. With the netdev in place you'll have a place to report stats and all the necessary diagnostics, which otherwise get crammed into random places. I believe Florian asked about this in the past, I hope I'm being consistent with my answer here :P
Justin Chen
maintainerPATCH v6 4/6 net: phy: mdio-bcm-unimac: Add asp v2.0 support
In reply to Justin ChenAdd mdio compat string for ASP 2.0 ethernet driver.
--- drivers/net/mdio/mdio-bcm-unimac.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/mdio/mdio-bcm-unimac.c +2 -0
@@ -334,6 +334,8 @@ static SIMPLE_DEV_PM_OPS(unimac_mdio_pm_ops, unimac_mdio_suspend, unimac_mdio_resume);static const struct of_device_id unimac_mdio_ids[] = { + { .compatible ="brcm,asp-v2.1-mdio" , }, + { .compatible ="brcm,asp-v2.0-mdio" , }, { .compatible ="brcm,genet-mdio-v5" , }, { .compatible ="brcm,genet-mdio-v4" , }, { .compatible ="brcm,genet-mdio-v3" , },
Signature · 1 line
2.7.4
Justin Chen
maintainerPATCH v6 5/6 net: phy: bcm7xxx: Add EPHY entry for 74165
In reply to Justin ChenFrom: Florian Fainelli <[email protected]>
74165 is a 16nm process SoC with a 10/100 integrated Ethernet PHY, utilize the recently defined 16nm EPHY macro to configure that PHY.
--- drivers/net/phy/bcm7xxx.c | 1 + include/linux/brcmphy.h | 1 + 2 files changed, 2 insertions(+)
drivers/net/phy/bcm7xxx.c +1 -0
@@ -913,6 +913,7 @@ static struct phy_driver bcm7xxx_driver[] = {BCM7XXX_28NM_GPHY (PHY_ID_BCM7278 ,"Broadcom BCM7278" ),BCM7XXX_28NM_GPHY (PHY_ID_BCM7364 ,"Broadcom BCM7364" ),BCM7XXX_28NM_GPHY (PHY_ID_BCM7366 ,"Broadcom BCM7366" ), +BCM7XXX_16NM_EPHY (PHY_ID_BCM74165 ,"Broadcom BCM74165" ),BCM7XXX_28NM_GPHY (PHY_ID_BCM74371 ,"Broadcom BCM74371" ),BCM7XXX_28NM_GPHY (PHY_ID_BCM7439 ,"Broadcom BCM7439" ), BCM7XXX_28NM_GPHY(PHY_ID_BCM7439_2, "Broadcom BCM7439 (2)"),
include/linux/brcmphy.h +1 -0
@@ -44,6 +44,7 @@#define PHY_ID_BCM7366 0x600d8490#define PHY_ID_BCM7346 0x600d8650#define PHY_ID_BCM7362 0x600d84b0 +#define PHY_ID_BCM74165 0x359052c0#define PHY_ID_BCM7425 0x600d86b0#define PHY_ID_BCM7429 0x600d8730#define PHY_ID_BCM7435 0x600d8750
Signature · 1 line
2.7.4
Justin Chen
maintainerPATCH v6 6/6 MAINTAINERS: ASP 2.0 Ethernet driver maintainers
In reply to Justin ChenAdd maintainers entry for ASP 2.0 Ethernet driver.
---
v3
- Change from gmail to broadcom emails
MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
@@ -4198,6 +4198,15 @@ F: drivers/net/mdio/mdio-bcm-unimac.c F: include/linux/platform_data/bcmgenet.h F: include/linux/platform_data/mdio-bcm-unimac.h +BROADCOM ASP 2.0 ETHERNET DRIVER +M: Justin Chen <[email protected]> +M: Florian Fainelli <[email protected]> +L: [email protected] +L: [email protected] +S: Supported +F: Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml +F: drivers/net/ethernet/broadcom/asp2/ + BROADCOM IPROC ARM ARCHITECTURE M: Ray Jui <[email protected]> M: Scott Branden <[email protected]>
Signature · 1 line
2.7.4