net: dsa: Add Airoha AN8855 support
Subsystems (6)
v5 cover net: dsa: Add Airoha AN8855 support
This small series add the initial support for the Airoha AN8855 Switch.
It's a 5 port Gigabit Switch with SGMII/HSGMII upstream port.
This is starting to get in the wild and there are already some router having this switch chip.
It's conceptually similar to mediatek switch but register and bits are different. And there is that massive Hell that is the PCS configuration.
Saddly for that part we have absolutely NO documentation currently.
There is this special thing where PHY needs to be calibrated with values from the switch efuse. (the thing have a whole cpu timer and MCU)
Changes v5:
- Add devm_dsa_register_switch() patch
- Add Reviewed-by tag for DT patch
Changes v4:
- Set regmap readable_table static (mute compilation warning)
- Add support for port_bridge flags (LEARNING, FLOOD)
- Reset fdb struct in fdb_dump
- Drop support_asym_pause in port_enable
- Add define for get_phy_flags
- Fix bug for port not inititially part of a bridge
(in an8855_setup the port matrix was always cleared but
the CPU port was never initially added)
- Disable learning and flood for user port by default
- Set CPU port to flood and learning by default
- Correctly AND force duplex and flow control in an8855_phylink_mac_link_up
- Drop RGMII from pcs_config
- Check ret in "Disable AN if not in autoneg"
- Use devm_mutex_init
- Fix typo for AN8855_PORT_CHECK_MODE
- Better define AN8855_STP_LISTENING = AN8855_STP_BLOCKING
- Fix typo in AN8855_PHY_EN_DOWN_SHIFT
- Use paged helper for PHY
- Skip calibration in config_init if priv not defined
Changes v3:
- Out of RFC
- Switch PHY code to select_page API
- Better describe masks and bits in PHY driver for ADC register
- Drop raw values and use define for mii read/write
- Switch to absolute PHY address
- Replace raw values with mask and bits for pcs_config
- Fix typo for ext-surge property name
- Drop support for relocating Switch base PHY address on the bus Changes v2:
- Drop mutex guard patch
- Drop guard usage in DSA driver
- Use __mdiobus_write/read
- Check return condition and return errors for mii read/write
- Fix wrong logic for EEE
- Fix link_down (don't force link down with autoneg)
- Fix forcing speed on sgmii autoneg
- Better document link speed for sgmii reg
- Use standard define for sgmii reg
- Imlement nvmem support to expose switch EFUSE
- Rework PHY calibration with the use of NVMEM producer/consumer
- Update DT with new NVMEM property
- Move aneg validation for 2500-basex in pcs_config
- Move r50Ohm table and function to PHY driver
Christian Marangi (4):
net: dsa: add devm_dsa_register_switch()
dt-bindings: net: dsa: Add Airoha AN8855 Gigabit Switch documentation
net: dsa: Add Airoha AN8855 5-Port Gigabit DSA Switch driver
net: phy: Add Airoha AN8855 Internal Switch Gigabit PHY
.../bindings/net/dsa/airoha,an8855.yaml | 242 ++ MAINTAINERS | 11 + drivers/net/dsa/Kconfig | 9 + drivers/net/dsa/Makefile | 1 + drivers/net/dsa/an8855.c | 2129 +++++++++++++++++ drivers/net/dsa/an8855.h | 638 +++++ drivers/net/phy/Kconfig | 5 + drivers/net/phy/Makefile | 1 + drivers/net/phy/air_an8855.c | 268 +++ include/net/dsa.h | 1 + net/dsa/dsa.c | 19 + 11 files changed, 3324 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/dsa/airoha,an8855.yaml create mode 100644 drivers/net/dsa/an8855.c create mode 100644 drivers/net/dsa/an8855.h create mode 100644 drivers/net/phy/air_an8855.c
Signature · 1 line
2.45.2
PATCH v5 1/4 net: dsa: add devm_dsa_register_switch()
Some DSA driver can be simplified if devres takes care of unregistering the DSA switch. This permits to effectively drop the remove OP from driver that just execute the dsa_unregister_switch() and nothing else.
--- include/net/dsa.h | 1 + net/dsa/dsa.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+)
include/net/dsa.h +1 -0
@@ -1355,6 +1355,7 @@ static inline void dsa_tag_generic_flow_dissect(const struct sk_buff *skb,void dsa_unregister_switch (struct dsa_switch *ds);int dsa_register_switch (struct dsa_switch *ds); +int devm_dsa_register_switch (struct device *dev,struct dsa_switch *ds);void dsa_switch_shutdown (struct dsa_switch *ds);struct dsa_switch *dsa_switch_find (int tree_index,int sw_index);void dsa_flush_workqueue (void );
net/dsa/dsa.c +19 -0
@@ -1544,6 +1544,25 @@ int dsa_register_switch(struct dsa_switch *ds) }EXPORT_SYMBOL_GPL (dsa_register_switch); +static void devm_dsa_unregister_switch (void *data) +{ +struct dsa_switch *ds = data; + +dsa_unregister_switch (ds); +} + +int devm_dsa_register_switch (struct device *dev,struct dsa_switch *ds) +{ +int err; + + err =dsa_register_switch (ds); +if (err) +return err; + +return devm_add_action_or_reset (dev, devm_dsa_unregister_switch, ds); +} +EXPORT_SYMBOL_GPL (dsa_register_switch); +static void dsa_switch_remove (struct dsa_switch *ds) {struct dsa_switch_tree *dst = ds->dst;
Signature · 1 line
2.45.2
kernel test robot
build botRe: [net-next PATCH v5 1/4] net: dsa: add devm_dsa_register_switch()
kernel test robot noticed the following build errors:
Hi Christian,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Christian-Marangi/net-dsa-add-devm_dsa_register_switch/20241113-045219 base: net-next/main patch link: https://lore.kernel.org/r/20241112204743.6710-2-ansuelsmth%40gmail.com patch subject: [net-next PATCH v5 1/4] net: dsa: add devm_dsa_register_switch() config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20241117/[email protected]/config) compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241117/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from net/dsa/dsa.c:10:
In file included from include/linux/device.h:32:
In file included from include/linux/device/driver.h:21:
In file included from include/linux/module.h:19:
In file included from include/linux/elf.h:6:
In file included from arch/s390/include/asm/elf.h:181:
In file included from arch/s390/include/asm/mmu_context.h:11:
In file included from arch/s390/include/asm/pgalloc.h:18:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
505 | item];
| ~~~~
include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
512 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
524 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
525 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
In file included from net/dsa/dsa.c:14:
In file included from include/linux/netdevice.h:38:
In file included from include/net/net_namespace.h:43:
In file included from include/linux/skbuff.h:28:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:95:
include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
548 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
561 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
| ^
include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
102 | #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
| ^
In file included from net/dsa/dsa.c:14:
In file included from include/linux/netdevice.h:38:
In file included from include/net/net_namespace.h:43:
In file included from include/linux/skbuff.h:28:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:95:
include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
574 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
| ^
include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
| ^
In file included from net/dsa/dsa.c:14:
In file included from include/linux/netdevice.h:38:
In file included from include/net/net_namespace.h:43:
In file included from include/linux/skbuff.h:28:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:95:
include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
585 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
595 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
605 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:693:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
693 | readsb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:701:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
701 | readsw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:709:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
709 | readsl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:718:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
718 | writesb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:727:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
727 | writesw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:736:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
736 | writesl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
>> <inline asm>:4:33: error: symbol '__export_symbol_dsa_register_switch' is already defined 4 | .section ".export_symbol","a" ; __export_symbol_dsa_register_switch: ; .asciz "GPL" ; .asciz "" ; .balign 8 ; .quad dsa_register_switch ; .previous
| ^
16 warnings and 1 error generated.
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH v5 2/4 dt-bindings: net: dsa: Add Airoha AN8855 Gigabit Switch documentation
In reply to Christian MarangiAdd Airoha AN8855 5 port Gigabit Switch documentation.
The switch node requires an additional mdio node to describe each internal PHY absolute address on the bus.
Calibration values might be stored in switch EFUSE and internal PHY might need to be calibrated, in such case, airoha,ext-surge needs to be enabled and relative NVMEM cells needs to be defined in nvmem-layout node.
--- .../bindings/net/dsa/airoha,an8855.yaml | 242 ++++++++++++++++++ 1 file changed, 242 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/dsa/airoha,an8855.yaml
Documentation/devicetree/bindings/net/dsa/airoha,an8855.yaml new file +242 -0
@@ -0,0 +1,242 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/dsa/airoha,an8855.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Airoha AN8855 Gigabit switch + +maintainers: + - Christian Marangi <[email protected]> + +description: > + Airoha AN8855 is a 5-port Gigabit Switch. + + The switch node requires an additional mdio node to describe each internal + PHY relative offset as the PHY address for the switch match the one for + the PHY ports. On top of internal PHY address, the switch base PHY address + is added. + + Also the switch base PHY address can be configured and changed after the + first initialization. On reset, the switch PHY address is ALWAYS 1. + +properties: + compatible: + const: airoha,an8855 + + reg: + maxItems: 1 + + reset-gpios: + description: + GPIO to be used to reset the whole device + maxItems: 1 + + airoha,ext-surge: + $ref: /schemas/types.yaml#/definitions/flag + description: + Calibrate the internal PHY with the calibration values stored in EFUSE + for the r50Ohm values. + + '#nvmem-cell-cells': + const: 0 + + nvmem-layout: + $ref: /schemas/nvmem/layouts/nvmem-layout.yaml + description: + NVMEM Layout for exposed EFUSE. (for example to propagate calibration + value for r50Ohm for internal PHYs) + + mdio: + $ref: /schemas/net/mdio.yaml# + unevaluatedProperties: false + description: + Define the absolute address of the internal PHY for each port. + +$ref: dsa.yaml# + +required: + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + switch@1 { + compatible = "airoha,an8855"; + reg = <1>; + reset-gpios = <&pio 39 0>; + + airoha,ext-surge; + + #nvmem-cell-cells = <0>; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + shift_sel_port0_tx_a: shift-sel-port0-tx-a@c { + reg = <0xc 0x4>; + }; + + shift_sel_port0_tx_b: shift-sel-port0-tx-b@10 { + reg = <0x10 0x4>; + }; + + shift_sel_port0_tx_c: shift-sel-port0-tx-c@14 { + reg = <0x14 0x4>; + }; + + shift_sel_port0_tx_d: shift-sel-port0-tx-d@18 { + reg = <0x18 0x4>; + }; + + shift_sel_port1_tx_a: shift-sel-port1-tx-a@1c { + reg = <0x1c 0x4>; + }; + + shift_sel_port1_tx_b: shift-sel-port1-tx-b@20 { + reg = <0x20 0x4>; + }; + + shift_sel_port1_tx_c: shift-sel-port1-tx-c@24 { + reg = <0x24 0x4>; + }; + + shift_sel_port1_tx_d: shift-sel-port1-tx-d@28 { + reg = <0x28 0x4>; + }; + + shift_sel_port2_tx_a: shift-sel-port2-tx-a@2c { + reg = <0x2c 0x4>; + }; + + shift_sel_port2_tx_b: shift-sel-port2-tx-b@30 { + reg = <0x30 0x4>; + }; + + shift_sel_port2_tx_c: shift-sel-port2-tx-c@34 { + reg = <0x34 0x4>; + }; + + shift_sel_port2_tx_d: shift-sel-port2-tx-d@38 { + reg = <0x38 0x4>; + }; + + shift_sel_port3_tx_a: shift-sel-port3-tx-a@4c { + reg = <0x4c 0x4>; + }; + + shift_sel_port3_tx_b: shift-sel-port3-tx-b@50 { + reg = <0x50 0x4>; + }; + + shift_sel_port3_tx_c: shift-sel-port3-tx-c@54 { + reg = <0x54 0x4>; + }; + + shift_sel_port3_tx_d: shift-sel-port3-tx-d@58 { + reg = <0x58 0x4>; + }; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + phy-mode = "internal"; + phy-handle = <&internal_phy1>; + }; + + port@1 { + reg = <1>; + label = "lan2"; + phy-mode = "internal"; + phy-handle = <&internal_phy2>; + }; + + port@2 { + reg = <2>; + label = "lan3"; + phy-mode = "internal"; + phy-handle = <&internal_phy3>; + }; + + port@3 { + reg = <3>; + label = "lan4"; + phy-mode = "internal"; + phy-handle = <&internal_phy4>; + }; + + port@5 { + reg = <5>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + internal_phy1: phy@1 { + reg = <1>; + + nvmem-cells = <&shift_sel_port0_tx_a>, + <&shift_sel_port0_tx_b>, + <&shift_sel_port0_tx_c>, + <&shift_sel_port0_tx_d>; + nvmem-cell-names = "tx_a", "tx_b", "tx_c", "tx_d"; + }; + + internal_phy2: phy@2 { + reg = <2>; + + nvmem-cells = <&shift_sel_port1_tx_a>, + <&shift_sel_port1_tx_b>, + <&shift_sel_port1_tx_c>, + <&shift_sel_port1_tx_d>; + nvmem-cell-names = "tx_a", "tx_b", "tx_c", "tx_d"; + }; + + internal_phy3: phy@3 { + reg = <3>; + + nvmem-cells = <&shift_sel_port2_tx_a>, + <&shift_sel_port2_tx_b>, + <&shift_sel_port2_tx_c>, + <&shift_sel_port2_tx_d>; + nvmem-cell-names = "tx_a", "tx_b", "tx_c", "tx_d"; + }; + + internal_phy4: phy@4 { + reg = <4>; + + nvmem-cells = <&shift_sel_port3_tx_a>, + <&shift_sel_port3_tx_b>, + <&shift_sel_port3_tx_c>, + <&shift_sel_port3_tx_d>; + nvmem-cell-names = "tx_a", "tx_b", "tx_c", "tx_d"; + }; + }; + }; + };
Signature · 1 line
2.45.2
PATCH v5 3/4 net: dsa: Add Airoha AN8855 5-Port Gigabit DSA Switch driver
In reply to Christian MarangiAdd Airoha AN8855 5-Port Gigabit DSA switch.
The switch is also a nvmem-provider as it does have EFUSE to calibrate the internal PHYs.
--- MAINTAINERS | 10 + drivers/net/dsa/Kconfig | 9 + drivers/net/dsa/Makefile | 1 + drivers/net/dsa/an8855.c | 2129 ++++++++++++++++++++++++++++++++++++++ drivers/net/dsa/an8855.h | 638 ++++++++++++ 5 files changed, 2787 insertions(+) create mode 100644 drivers/net/dsa/an8855.c create mode 100644 drivers/net/dsa/an8855.h
MAINTAINERS +10 -0
@@ -717,6 +717,16 @@ S: Supported F: fs/aio.c F: include/linux/*aio*.h +AIROHA DSA DRIVER +M: Christian Marangi <[email protected]> +L: [email protected] (moderated for non-subscribers) +L: [email protected] (moderated for non-subscribers) +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/net/dsa/airoha,an8855.yaml +F: drivers/net/dsa/an8855.c +F: drivers/net/dsa/an8855.h + AIROHA ETHERNET DRIVER M: Lorenzo Bianconi <[email protected]> L: [email protected] (moderated for non-subscribers)
drivers/net/dsa/Kconfig +9 -0
@@ -24,6 +24,15 @@ config NET_DSA_LOOP This enables support for a fake mock-up switch chip which exercises the DSA APIs. + +config NET_DSA_AN8855 + tristate "Airoha AN8855 Ethernet switch support" + depends on NET_DSA + select NET_DSA_TAG_MTK + help + This enables support for the Airoha AN8855 Ethernet switch + chip. + source "drivers/net/dsa/hirschmann/Kconfig" config NET_DSA_LANTIQ_GSWIP
drivers/net/dsa/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-$(CONFIG_NET_DSA_LOOP) += dsa_loop.o ifdef CONFIG_NET_DSA_LOOP obj-$(CONFIG_FIXED_PHY) += dsa_loop_bdinfo.o endif +obj-$(CONFIG_NET_DSA_AN8855) += an8855.o obj-$(CONFIG_NET_DSA_LANTIQ_GSWIP) += lantiq_gswip.o obj-$(CONFIG_NET_DSA_MT7530) += mt7530.o obj-$(CONFIG_NET_DSA_MT7530_MDIO) += mt7530-mdio.o
drivers/net/dsa/an8855.c new file +2129 -0
2,129 lines not on this page · raw message
drivers/net/dsa/an8855.h new file +638 -0
638 lines not on this page · raw message
Signature · 1 line
2.45.2
Jakub Kicinski
maintainerRe: [net-next PATCH v5 3/4] net: dsa: Add Airoha AN8855 5-Port Gigabit DSA Switch driver
drivers/net/dsa/an8855.c line 27
Quoted 2 lines · On Tue, 12 Nov 2024 21:47:26 +0100 Christian Marangi wrote:
drivers/net/dsa/an8855.c new file +2
-0+MIB_DESC (1 ,0x00 ,"TxDrop" ), + MIB_DESC(1, 0x04, "TxCrcErr"),
What is a CRC Tx error :o
Just out of curiosity, not saying its worng.
drivers/net/dsa/an8855.c line 31
Quoted 4 lines
drivers/net/dsa/an8855.c new file +4
-0+MIB_DESC (1 ,0x08 ,"TxUnicast" ), +MIB_DESC (1 ,0x0c ,"TxMulticast" ), +MIB_DESC (1 ,0x10 ,"TxBroadcast" ), + MIB_DESC(1, 0x14, "TxCollision"),
Why can't these be rtnl stats, please keep in mind that we ask that people don't duplicate in ethtool -S what can be exposed via standard stats
drivers/net/dsa/an8855.c line 44
Quoted 13 lines
drivers/net/dsa/an8855.c new file +13
-0+MIB_DESC (1 ,0x18 ,"TxSingleCollision" ), +MIB_DESC (1 ,0x1c ,"TxMultipleCollision" ), +MIB_DESC (1 ,0x20 ,"TxDeferred" ), +MIB_DESC (1 ,0x24 ,"TxLateCollision" ), +MIB_DESC (1 ,0x28 ,"TxExcessiveCollistion" ), +MIB_DESC (1 ,0x2c ,"TxPause" ), +MIB_DESC (1 ,0x30 ,"TxPktSz64" ), +MIB_DESC (1 ,0x34 ,"TxPktSz65To127" ), +MIB_DESC (1 ,0x38 ,"TxPktSz128To255" ), +MIB_DESC (1 ,0x3c ,"TxPktSz256To511" ), +MIB_DESC (1 ,0x40 ,"TxPktSz512To1023" ), +MIB_DESC (1 ,0x44 ,"TxPktSz1024To1518" ), + MIB_DESC(1, 0x48, "TxPktSz1519ToMax"),
we have standard stats for rmon, too
Quoted 33 lines
drivers/net/dsa/an8855.c new file +33
-0+MIB_DESC (2 ,0x4c ,"TxBytes" ), +MIB_DESC (1 ,0x54 ,"TxOversizeDrop" ), +MIB_DESC (2 ,0x58 ,"TxBadPktBytes" ), +MIB_DESC (1 ,0x80 ,"RxDrop" ), +MIB_DESC (1 ,0x84 ,"RxFiltering" ), +MIB_DESC (1 ,0x88 ,"RxUnicast" ), +MIB_DESC (1 ,0x8c ,"RxMulticast" ), +MIB_DESC (1 ,0x90 ,"RxBroadcast" ), +MIB_DESC (1 ,0x94 ,"RxAlignErr" ), +MIB_DESC (1 ,0x98 ,"RxCrcErr" ), +MIB_DESC (1 ,0x9c ,"RxUnderSizeErr" ), +MIB_DESC (1 ,0xa0 ,"RxFragErr" ), +MIB_DESC (1 ,0xa4 ,"RxOverSzErr" ), +MIB_DESC (1 ,0xa8 ,"RxJabberErr" ), +MIB_DESC (1 ,0xac ,"RxPause" ), +MIB_DESC (1 ,0xb0 ,"RxPktSz64" ), +MIB_DESC (1 ,0xb4 ,"RxPktSz65To127" ), +MIB_DESC (1 ,0xb8 ,"RxPktSz128To255" ), +MIB_DESC (1 ,0xbc ,"RxPktSz256To511" ), +MIB_DESC (1 ,0xc0 ,"RxPktSz512To1023" ), +MIB_DESC (1 ,0xc4 ,"RxPktSz1024To1518" ), +MIB_DESC (1 ,0xc8 ,"RxPktSz1519ToMax" ), +MIB_DESC (2 ,0xcc ,"RxBytes" ), +MIB_DESC (1 ,0xd4 ,"RxCtrlDrop" ), +MIB_DESC (1 ,0xd8 ,"RxIngressDrop" ), +MIB_DESC (1 ,0xdc ,"RxArlDrop" ), +MIB_DESC (1 ,0xe0 ,"FlowControlDrop" ), +MIB_DESC (1 ,0xe4 ,"WredDrop" ), +MIB_DESC (1 ,0xe8 ,"MirrorDrop" ), +MIB_DESC (2 ,0xec ,"RxBadPktBytes" ), +MIB_DESC (1 ,0xf4 ,"RxsFlowSamplingPktDrop" ), +MIB_DESC (1 ,0xf8 ,"RxsFlowTotalPktDrop" ), + MIB_DESC(1, 0xfc, "PortControlDrop"),
Signature · 1 line
pw-bot: cr
Re: [net-next PATCH v5 3/4] net: dsa: Add Airoha AN8855 5-Port Gigabit DSA Switch driver
Quoted 7 lines · Jakub Kicinski
drivers/net/dsa/an8855.c line 27
Quoted 2 lines · On Tue, 12 Nov 2024 21:47:26 +0100 Christian Marangi wrote:
drivers/net/dsa/an8855.c new file +2
-0+MIB_DESC (1 ,0x00 ,"TxDrop" ), + MIB_DESC(1, 0x04, "TxCrcErr"),What is a CRC Tx error :o
Just out of curiosity, not saying its worng.
From Documentation, FCS error frame due to TX FIFO underrun.
Quoted 9 lines
drivers/net/dsa/an8855.c line 31
Quoted 4 lines
drivers/net/dsa/an8855.c new file +4
-0+MIB_DESC (1 ,0x08 ,"TxUnicast" ), +MIB_DESC (1 ,0x0c ,"TxMulticast" ), +MIB_DESC (1 ,0x10 ,"TxBroadcast" ), + MIB_DESC(1, 0x14, "TxCollision"),Why can't these be rtnl stats, please keep in mind that we ask that people don't duplicate in ethtool -S what can be exposed via standard stats
Ok I will search for this but it does sounds like something new and not used by other DSA driver, any hint on where to look for examples?
Quoted 51 lines
drivers/net/dsa/an8855.c line 44
Quoted 13 lines
drivers/net/dsa/an8855.c new file +13
-0+MIB_DESC (1 ,0x18 ,"TxSingleCollision" ), +MIB_DESC (1 ,0x1c ,"TxMultipleCollision" ), +MIB_DESC (1 ,0x20 ,"TxDeferred" ), +MIB_DESC (1 ,0x24 ,"TxLateCollision" ), +MIB_DESC (1 ,0x28 ,"TxExcessiveCollistion" ), +MIB_DESC (1 ,0x2c ,"TxPause" ), +MIB_DESC (1 ,0x30 ,"TxPktSz64" ), +MIB_DESC (1 ,0x34 ,"TxPktSz65To127" ), +MIB_DESC (1 ,0x38 ,"TxPktSz128To255" ), +MIB_DESC (1 ,0x3c ,"TxPktSz256To511" ), +MIB_DESC (1 ,0x40 ,"TxPktSz512To1023" ), +MIB_DESC (1 ,0x44 ,"TxPktSz1024To1518" ), + MIB_DESC(1, 0x48, "TxPktSz1519ToMax"),we have standard stats for rmon, too
Quoted 33 lines
drivers/net/dsa/an8855.c new file +33
-0+MIB_DESC (2 ,0x4c ,"TxBytes" ), +MIB_DESC (1 ,0x54 ,"TxOversizeDrop" ), +MIB_DESC (2 ,0x58 ,"TxBadPktBytes" ), +MIB_DESC (1 ,0x80 ,"RxDrop" ), +MIB_DESC (1 ,0x84 ,"RxFiltering" ), +MIB_DESC (1 ,0x88 ,"RxUnicast" ), +MIB_DESC (1 ,0x8c ,"RxMulticast" ), +MIB_DESC (1 ,0x90 ,"RxBroadcast" ), +MIB_DESC (1 ,0x94 ,"RxAlignErr" ), +MIB_DESC (1 ,0x98 ,"RxCrcErr" ), +MIB_DESC (1 ,0x9c ,"RxUnderSizeErr" ), +MIB_DESC (1 ,0xa0 ,"RxFragErr" ), +MIB_DESC (1 ,0xa4 ,"RxOverSzErr" ), +MIB_DESC (1 ,0xa8 ,"RxJabberErr" ), +MIB_DESC (1 ,0xac ,"RxPause" ), +MIB_DESC (1 ,0xb0 ,"RxPktSz64" ), +MIB_DESC (1 ,0xb4 ,"RxPktSz65To127" ), +MIB_DESC (1 ,0xb8 ,"RxPktSz128To255" ), +MIB_DESC (1 ,0xbc ,"RxPktSz256To511" ), +MIB_DESC (1 ,0xc0 ,"RxPktSz512To1023" ), +MIB_DESC (1 ,0xc4 ,"RxPktSz1024To1518" ), +MIB_DESC (1 ,0xc8 ,"RxPktSz1519ToMax" ), +MIB_DESC (2 ,0xcc ,"RxBytes" ), +MIB_DESC (1 ,0xd4 ,"RxCtrlDrop" ), +MIB_DESC (1 ,0xd8 ,"RxIngressDrop" ), +MIB_DESC (1 ,0xdc ,"RxArlDrop" ), +MIB_DESC (1 ,0xe0 ,"FlowControlDrop" ), +MIB_DESC (1 ,0xe4 ,"WredDrop" ), +MIB_DESC (1 ,0xe8 ,"MirrorDrop" ), +MIB_DESC (2 ,0xec ,"RxBadPktBytes" ), +MIB_DESC (1 ,0xf4 ,"RxsFlowSamplingPktDrop" ), +MIB_DESC (1 ,0xf8 ,"RxsFlowTotalPktDrop" ), + MIB_DESC(1, 0xfc, "PortControlDrop"),Signature · 1 line
pw-bot: cr
Signature · 1 line
Ansuel
Jakub Kicinski
maintainerRe: [net-next PATCH v5 3/4] net: dsa: Add Airoha AN8855 5-Port Gigabit DSA Switch driver
Quoted 10 lines · On Fri, 15 Nov 2024 22:59:18 +0100 Christian Marangi wrote:
Quoted 7 lines · Jakub Kicinski
drivers/net/dsa/an8855.c line 27
Quoted 2 lines · On Tue, 12 Nov 2024 21:47:26 +0100 Christian Marangi wrote:
drivers/net/dsa/an8855.c new file +2
-0+MIB_DESC (1 ,0x00 ,"TxDrop" ), + MIB_DESC(1, 0x04, "TxCrcErr"),What is a CRC Tx error :o
Just out of curiosity, not saying its worng.From Documentation, FCS error frame due to TX FIFO underrun.
Interesting
Quoted 10 lines
Quoted 9 lines
drivers/net/dsa/an8855.c line 31
Quoted 4 lines
drivers/net/dsa/an8855.c new file +4
-0+MIB_DESC (1 ,0x08 ,"TxUnicast" ), +MIB_DESC (1 ,0x0c ,"TxMulticast" ), +MIB_DESC (1 ,0x10 ,"TxBroadcast" ), + MIB_DESC(1, 0x14, "TxCollision"),Why can't these be rtnl stats, please keep in mind that we ask that people don't duplicate in ethtool -S what can be exposed via standard stats
Quoted 2 lines
Ok I will search for this but it does sounds like something new and not used by other DSA driver, any hint on where to look for examples?
It's relatively recent but I think the ops are plumbed thru to DSA. Take a look at all the *_stats members of struct dsa_switch_ops, most of them take a fixed format struct to fill in and the struct has some extra kdoc on which field is what.
Re: [net-next PATCH v5 3/4] net: dsa: Add Airoha AN8855 5-Port Gigabit DSA Switch driver
Quoted 10 lines · Jakub Kicinski
Quoted 9 lines · On Fri, 15 Nov 2024 22:59:18 +0100 Christian Marangi wrote:
Quoted 7 lines · Jakub Kicinski
drivers/net/dsa/an8855.c line 27
Quoted 2 lines · On Tue, 12 Nov 2024 21:47:26 +0100 Christian Marangi wrote:
drivers/net/dsa/an8855.c new file +2
-0+MIB_DESC (1 ,0x00 ,"TxDrop" ), + MIB_DESC(1, 0x04, "TxCrcErr"),What is a CRC Tx error :o
Just out of curiosity, not saying its worng.
Quoted 4 lines
Quoted 1 line
From Documentation, FCS error frame due to TX FIFO underrun.
Interesting
Seems it's even supported in stats.
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
drivers/net/dsa/an8855.c line 31
Quoted 4 lines
drivers/net/dsa/an8855.c new file +4
-0+MIB_DESC (1 ,0x08 ,"TxUnicast" ), +MIB_DESC (1 ,0x0c ,"TxMulticast" ), +MIB_DESC (1 ,0x10 ,"TxBroadcast" ), + MIB_DESC(1, 0x14, "TxCollision"),Why can't these be rtnl stats, please keep in mind that we ask that people don't duplicate in ethtool -S what can be exposed via standard stats
Quoted 7 lines
Quoted 2 lines
Ok I will search for this but it does sounds like something new and not used by other DSA driver, any hint on where to look for examples?
It's relatively recent but I think the ops are plumbed thru to DSA. Take a look at all the
*_statsmembers of structdsa_switch_ops, most of them take a fixed format struct to fill in and the struct has some extra kdoc on which field is what.
Thanks for the follow-up, they are the get_stats64 I assume, quite different to the ethtools one as we need a poll logic. Ok I will check what to drop and rework it.
Signature · 1 line
Ansuel
Jakub Kicinski
maintainerRe: [net-next PATCH v5 3/4] net: dsa: Add Airoha AN8855 5-Port Gigabit DSA Switch driver
Quoted 11 lines · On Sat, 16 Nov 2024 00:03:55 +0100 Christian Marangi wrote:
Quoted 7 lines
Quoted 2 lines
Ok I will search for this but it does sounds like something new and not used by other DSA driver, any hint on where to look for examples?
It's relatively recent but I think the ops are plumbed thru to DSA. Take a look at all the
*_statsmembers of structdsa_switch_ops, most of them take a fixed format struct to fill in and the struct has some extra kdoc on which field is what.Thanks for the follow-up, they are the
get_stats64I assume, quite different to the ethtools one as we need a poll logic. Ok I will check what to drop and rework it.
https://elixir.bootlin.com/linux/v6.12-rc1/source/include/net/dsa.h#L915-L927
am I looking in the wrong place?
Re: [net-next PATCH v5 3/4] net: dsa: Add Airoha AN8855 5-Port Gigabit DSA Switch driver
Quoted 9 lines · Jakub Kicinski
Quoted 8 lines · On Sat, 16 Nov 2024 00:03:55 +0100 Christian Marangi wrote:
Quoted 7 lines
Quoted 2 lines
Ok I will search for this but it does sounds like something new and not used by other DSA driver, any hint on where to look for examples?
It's relatively recent but I think the ops are plumbed thru to DSA. Take a look at all the
*_statsmembers of structdsa_switch_ops, most of them take a fixed format struct to fill in and the struct has some extra kdoc on which field is what.
Quoted 7 lines
Quoted 3 lines
Thanks for the follow-up, they are the
get_stats64I assume, quite different to the ethtools one as we need a poll logic. Ok I will check what to drop and rework it.https://elixir.bootlin.com/linux/v6.12-rc1/source/include/net/dsa.h#L915-L927
am I looking in the wrong place?
Yep should be those.
Signature · 1 line
Ansuel
PATCH v5 4/4 net: phy: Add Airoha AN8855 Internal Switch Gigabit PHY
In reply to Christian MarangiAdd support for Airoha AN8855 Internal Switch Gigabit PHY.
This is a simple PHY driver to configure and calibrate the PHY for the AN8855 Switch with the use of NVMEM cells.
--- MAINTAINERS | 1 + drivers/net/phy/Kconfig | 5 + drivers/net/phy/Makefile | 1 + drivers/net/phy/air_an8855.c | 268 +++++++++++++++++++++++++++++++++++ 4 files changed, 275 insertions(+) create mode 100644 drivers/net/phy/air_an8855.c
MAINTAINERS +1 -0
@@ -726,6 +726,7 @@ S: Maintained F: Documentation/devicetree/bindings/net/dsa/airoha,an8855.yaml F: drivers/net/dsa/an8855.c F: drivers/net/dsa/an8855.h +F: drivers/net/phy/air_an8855.c AIROHA ETHERNET DRIVER M: Lorenzo Bianconi <[email protected]>
drivers/net/phy/Kconfig +5 -0
@@ -79,6 +79,11 @@ config SFP comment "MII PHY device drivers" +config AIR_AN8855_PHY + tristate "Airoha AN8855 Internal Gigabit PHY" + help + Currently supports the internal Airoha AN8855 Switch PHY. + config AIR_EN8811H_PHY tristate "Airoha EN8811H 2.5 Gigabit PHY" help
drivers/net/phy/Makefile +1 -0
@@ -35,6 +35,7 @@ obj-y += $(sfp-obj-y) $(sfp-obj-m) obj-$(CONFIG_ADIN_PHY) += adin.o obj-$(CONFIG_ADIN1100_PHY) += adin1100.o +obj-$(CONFIG_AIR_AN8855_PHY) += air_an8855.o obj-$(CONFIG_AIR_EN8811H_PHY) += air_en8811h.o obj-$(CONFIG_AMD_PHY) += amd.o obj-$(CONFIG_AMCC_QT2025_PHY) += qt2025.o
drivers/net/phy/air_an8855.c new file +268 -0
268 lines not on this page · raw message
Signature · 1 line
2.45.2