]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: dsa: move mib_desc/mib_list to device specific source
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Sat, 28 Feb 2026 20:09:44 +0000 (21:09 +0100)
committerRobert Marko <robimarko@gmail.com>
Tue, 3 Mar 2026 12:06:32 +0000 (13:06 +0100)
The device specific mib descriptors are located in dsa.c and
rtldsa_get_mib_desc() selects the right decriptor for the caller
based on family_id from the private structure. That makes not
much sense and is not wanted

Move the descriptors into their corresponding files and link
them directly to the config structure. Simplify the selector
by directly returning the linked data.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22219
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.c
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl839x.c
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c

index e04ee062eec349e3c8537bb024ffeefaea55f4db..1188066bce91374dba26ee3229b7ac477ad07c6c 100644 (file)
@@ -62,363 +62,6 @@ static void rtldsa_enable_phy_polling(struct rtl838x_switch_priv *priv)
                sw_w32_mask(0, BIT(7), RTL839X_SMI_GLB_CTRL);
 }
 
-const struct rtldsa_mib_list_item rtldsa_838x_mib_list[] = {
-       MIB_LIST_ITEM("dot1dTpPortInDiscards", MIB_ITEM(MIB_REG_STD, 0xec, 1)),
-       MIB_LIST_ITEM("ifOutDiscards", MIB_ITEM(MIB_REG_STD, 0xd0, 1)),
-       MIB_LIST_ITEM("DropEvents", MIB_ITEM(MIB_REG_STD, 0xa8, 1)),
-       MIB_LIST_ITEM("tx_BroadcastPkts", MIB_ITEM(MIB_REG_STD, 0xa4, 1)),
-       MIB_LIST_ITEM("tx_MulticastPkts", MIB_ITEM(MIB_REG_STD, 0xa0, 1)),
-       MIB_LIST_ITEM("tx_UndersizePkts", MIB_ITEM(MIB_REG_STD, 0x98, 1)),
-       MIB_LIST_ITEM("rx_UndersizeDropPkts", MIB_ITEM(MIB_REG_STD, 0x90, 1)),
-       MIB_LIST_ITEM("tx_OversizePkts", MIB_ITEM(MIB_REG_STD, 0x8c, 1)),
-       MIB_LIST_ITEM("Collisions", MIB_ITEM(MIB_REG_STD, 0x7c, 1)),
-       MIB_LIST_ITEM("rx_MacDiscards", MIB_ITEM(MIB_REG_STD, 0x40, 1))
-};
-
-const struct rtldsa_mib_desc rtldsa_838x_mib = {
-       .symbol_errors = MIB_ITEM(MIB_REG_STD, 0xb8, 1),
-
-       .if_in_octets = MIB_ITEM(MIB_REG_STD, 0xf8, 2),
-       .if_out_octets = MIB_ITEM(MIB_REG_STD, 0xf0, 2),
-       .if_in_ucast_pkts = MIB_ITEM(MIB_REG_STD, 0xe8, 1),
-       .if_in_mcast_pkts = MIB_ITEM(MIB_REG_STD, 0xe4, 1),
-       .if_in_bcast_pkts = MIB_ITEM(MIB_REG_STD, 0xe0, 1),
-       .if_out_ucast_pkts = MIB_ITEM(MIB_REG_STD, 0xdc, 1),
-       .if_out_mcast_pkts = MIB_ITEM(MIB_REG_STD, 0xd8, 1),
-       .if_out_bcast_pkts = MIB_ITEM(MIB_REG_STD, 0xd4, 1),
-       .if_out_discards = MIB_ITEM(MIB_REG_STD, 0xd0, 1),
-       .single_collisions = MIB_ITEM(MIB_REG_STD, 0xcc, 1),
-       .multiple_collisions = MIB_ITEM(MIB_REG_STD, 0xc8, 1),
-       .deferred_transmissions = MIB_ITEM(MIB_REG_STD, 0xc4, 1),
-       .late_collisions = MIB_ITEM(MIB_REG_STD, 0xc0, 1),
-       .excessive_collisions = MIB_ITEM(MIB_REG_STD, 0xbc, 1),
-       .crc_align_errors = MIB_ITEM(MIB_REG_STD, 0x9c, 1),
-
-       .unsupported_opcodes = MIB_ITEM(MIB_REG_STD, 0xb4, 1),
-
-       .rx_undersize_pkts = MIB_ITEM(MIB_REG_STD, 0x94, 1),
-       .rx_oversize_pkts = MIB_ITEM(MIB_REG_STD, 0x88, 1),
-       .rx_fragments = MIB_ITEM(MIB_REG_STD, 0x84, 1),
-       .rx_jabbers = MIB_ITEM(MIB_REG_STD, 0x80, 1),
-
-       .tx_pkts = {
-               MIB_ITEM(MIB_REG_STD, 0x78, 1),
-               MIB_ITEM(MIB_REG_STD, 0x70, 1),
-               MIB_ITEM(MIB_REG_STD, 0x68, 1),
-               MIB_ITEM(MIB_REG_STD, 0x60, 1),
-               MIB_ITEM(MIB_REG_STD, 0x58, 1),
-               MIB_ITEM(MIB_REG_STD, 0x50, 1),
-               MIB_ITEM(MIB_REG_STD, 0x48, 1)
-       },
-       .rx_pkts = {
-               MIB_ITEM(MIB_REG_STD, 0x74, 1),
-               MIB_ITEM(MIB_REG_STD, 0x6c, 1),
-               MIB_ITEM(MIB_REG_STD, 0x64, 1),
-               MIB_ITEM(MIB_REG_STD, 0x5c, 1),
-               MIB_ITEM(MIB_REG_STD, 0x54, 1),
-               MIB_ITEM(MIB_REG_STD, 0x4c, 1),
-               MIB_ITEM(MIB_REG_STD, 0x44, 1)
-       },
-       .rmon_ranges = {
-               { 0, 64 },
-               { 65, 127 },
-               { 128, 255 },
-               { 256, 511 },
-               { 512, 1023 },
-               { 1024, 1518 },
-               { 1519, 10000 }
-       },
-
-       .drop_events = MIB_ITEM(MIB_REG_STD, 0xa8, 1),
-       .collisions = MIB_ITEM(MIB_REG_STD, 0x7c, 1),
-
-       .rx_pause_frames = MIB_ITEM(MIB_REG_STD, 0xb0, 1),
-       .tx_pause_frames = MIB_ITEM(MIB_REG_STD, 0xac, 1),
-
-       .list_count = ARRAY_SIZE(rtldsa_838x_mib_list),
-       .list = rtldsa_838x_mib_list
-};
-
-const struct rtldsa_mib_list_item rtldsa_839x_mib_list[] = {
-       MIB_LIST_ITEM("ifOutDiscards", MIB_ITEM(MIB_REG_STD, 0xd4, 1)),
-       MIB_LIST_ITEM("dot1dTpPortInDiscards", MIB_ITEM(MIB_REG_STD, 0xd0, 1)),
-       MIB_LIST_ITEM("DropEvents", MIB_ITEM(MIB_REG_STD, 0xa8, 1)),
-       MIB_LIST_ITEM("tx_BroadcastPkts", MIB_ITEM(MIB_REG_STD, 0xa4, 1)),
-       MIB_LIST_ITEM("tx_MulticastPkts", MIB_ITEM(MIB_REG_STD, 0xa0, 1)),
-       MIB_LIST_ITEM("tx_UndersizePkts", MIB_ITEM(MIB_REG_STD, 0x98, 1)),
-       MIB_LIST_ITEM("rx_UndersizeDropPkts", MIB_ITEM(MIB_REG_STD, 0x90, 1)),
-       MIB_LIST_ITEM("tx_OversizePkts", MIB_ITEM(MIB_REG_STD, 0x8c, 1)),
-       MIB_LIST_ITEM("Collisions", MIB_ITEM(MIB_REG_STD, 0x7c, 1)),
-       MIB_LIST_ITEM("rx_LengthFieldError", MIB_ITEM(MIB_REG_STD, 0x40, 1)),
-       MIB_LIST_ITEM("rx_FalseCarrierTimes", MIB_ITEM(MIB_REG_STD, 0x3c, 1)),
-       MIB_LIST_ITEM("rx_UnderSizeOctets", MIB_ITEM(MIB_REG_STD, 0x38, 1)),
-       MIB_LIST_ITEM("tx_Fragments", MIB_ITEM(MIB_REG_STD, 0x34, 1)),
-       MIB_LIST_ITEM("tx_Jabbers", MIB_ITEM(MIB_REG_STD, 0x30, 1)),
-       MIB_LIST_ITEM("tx_CRCAlignErrors", MIB_ITEM(MIB_REG_STD, 0x2c, 1)),
-       MIB_LIST_ITEM("rx_FramingErrors", MIB_ITEM(MIB_REG_STD, 0x28, 1)),
-       MIB_LIST_ITEM("rx_MacDiscards", MIB_ITEM(MIB_REG_STD, 0x24, 1))
-};
-
-const struct rtldsa_mib_desc rtldsa_839x_mib = {
-       .symbol_errors = MIB_ITEM(MIB_REG_STD, 0xb8, 1),
-
-       .if_in_octets = MIB_ITEM(MIB_REG_STD, 0xf8, 2),
-       .if_out_octets = MIB_ITEM(MIB_REG_STD, 0xf0, 2),
-       .if_in_ucast_pkts = MIB_ITEM(MIB_REG_STD, 0xec, 1),
-       .if_in_mcast_pkts = MIB_ITEM(MIB_REG_STD, 0xe8, 1),
-       .if_in_bcast_pkts = MIB_ITEM(MIB_REG_STD, 0xe4, 1),
-       .if_out_ucast_pkts = MIB_ITEM(MIB_REG_STD, 0xe0, 1),
-       .if_out_mcast_pkts = MIB_ITEM(MIB_REG_STD, 0xdc, 1),
-       .if_out_bcast_pkts = MIB_ITEM(MIB_REG_STD, 0xd8, 1),
-       .if_out_discards = MIB_ITEM(MIB_REG_STD, 0xd4, 1),
-       .single_collisions = MIB_ITEM(MIB_REG_STD, 0xcc, 1),
-       .multiple_collisions = MIB_ITEM(MIB_REG_STD, 0xc8, 1),
-       .deferred_transmissions = MIB_ITEM(MIB_REG_STD, 0xc4, 1),
-       .late_collisions = MIB_ITEM(MIB_REG_STD, 0xc0, 1),
-       .excessive_collisions = MIB_ITEM(MIB_REG_STD, 0xbc, 1),
-       .crc_align_errors = MIB_ITEM(MIB_REG_STD, 0x9c, 1),
-
-       .unsupported_opcodes = MIB_ITEM(MIB_REG_STD, 0xb4, 1),
-
-       .rx_undersize_pkts = MIB_ITEM(MIB_REG_STD, 0x94, 1),
-       .rx_oversize_pkts = MIB_ITEM(MIB_REG_STD, 0x88, 1),
-       .rx_fragments = MIB_ITEM(MIB_REG_STD, 0x84, 1),
-       .rx_jabbers = MIB_ITEM(MIB_REG_STD, 0x80, 1),
-
-       .tx_pkts = {
-               MIB_ITEM(MIB_REG_STD, 0x78, 1),
-               MIB_ITEM(MIB_REG_STD, 0x70, 1),
-               MIB_ITEM(MIB_REG_STD, 0x68, 1),
-               MIB_ITEM(MIB_REG_STD, 0x60, 1),
-               MIB_ITEM(MIB_REG_STD, 0x58, 1),
-               MIB_ITEM(MIB_REG_STD, 0x50, 1),
-               MIB_ITEM(MIB_REG_STD, 0x48, 1)
-       },
-       .rx_pkts = {
-               MIB_ITEM(MIB_REG_STD, 0x74, 1),
-               MIB_ITEM(MIB_REG_STD, 0x6c, 1),
-               MIB_ITEM(MIB_REG_STD, 0x64, 1),
-               MIB_ITEM(MIB_REG_STD, 0x5c, 1),
-               MIB_ITEM(MIB_REG_STD, 0x54, 1),
-               MIB_ITEM(MIB_REG_STD, 0x4c, 1),
-               MIB_ITEM(MIB_REG_STD, 0x44, 1)
-       },
-       .rmon_ranges = {
-               { 0, 64 },
-               { 65, 127 },
-               { 128, 255 },
-               { 256, 511 },
-               { 512, 1023 },
-               { 1024, 1518 },
-               { 1519, 12288 }
-       },
-
-       .drop_events = MIB_ITEM(MIB_REG_STD, 0xa8, 1),
-       .collisions = MIB_ITEM(MIB_REG_STD, 0x7c, 1),
-
-       .rx_pause_frames = MIB_ITEM(MIB_REG_STD, 0xb0, 1),
-       .tx_pause_frames = MIB_ITEM(MIB_REG_STD, 0xac, 1),
-
-       .list_count = ARRAY_SIZE(rtldsa_839x_mib_list),
-       .list = rtldsa_839x_mib_list
-};
-
-const struct rtldsa_mib_list_item rtldsa_930x_mib_list[] = {
-       MIB_LIST_ITEM("ifOutDiscards", MIB_ITEM(MIB_REG_STD, 0xbc, 1)),
-       MIB_LIST_ITEM("dot1dTpPortInDiscards", MIB_ITEM(MIB_REG_STD, 0xb8, 1)),
-       MIB_LIST_ITEM("DropEvents", MIB_ITEM(MIB_REG_STD, 0x90, 1)),
-       MIB_LIST_ITEM("tx_BroadcastPkts", MIB_ITEM(MIB_REG_STD, 0x8c, 1)),
-       MIB_LIST_ITEM("tx_MulticastPkts", MIB_ITEM(MIB_REG_STD, 0x88, 1)),
-       MIB_LIST_ITEM("tx_CRCAlignErrors", MIB_ITEM(MIB_REG_STD, 0x84, 1)),
-       MIB_LIST_ITEM("tx_UndersizePkts", MIB_ITEM(MIB_REG_STD, 0x7c, 1)),
-       MIB_LIST_ITEM("tx_OversizePkts", MIB_ITEM(MIB_REG_STD, 0x74, 1)),
-       MIB_LIST_ITEM("tx_Fragments", MIB_ITEM(MIB_REG_STD, 0x6c, 1)),
-       MIB_LIST_ITEM("tx_Jabbers", MIB_ITEM(MIB_REG_STD, 0x64, 1)),
-       MIB_LIST_ITEM("tx_Collisions", MIB_ITEM(MIB_REG_STD, 0x5c, 1)),
-       MIB_LIST_ITEM("rx_UndersizeDropPkts", MIB_ITEM(MIB_REG_PRV, 0x7c, 1)),
-       MIB_LIST_ITEM("tx_PktsFlexibleOctetsSet1", MIB_ITEM(MIB_REG_PRV, 0x68, 1)),
-       MIB_LIST_ITEM("rx_PktsFlexibleOctetsSet1", MIB_ITEM(MIB_REG_PRV, 0x64, 1)),
-       MIB_LIST_ITEM("tx_PktsFlexibleOctetsCRCSet1", MIB_ITEM(MIB_REG_PRV, 0x60, 1)),
-       MIB_LIST_ITEM("rx_PktsFlexibleOctetsCRCSet1", MIB_ITEM(MIB_REG_PRV, 0x5c, 1)),
-       MIB_LIST_ITEM("tx_PktsFlexibleOctetsSet0", MIB_ITEM(MIB_REG_PRV, 0x58, 1)),
-       MIB_LIST_ITEM("rx_PktsFlexibleOctetsSet0", MIB_ITEM(MIB_REG_PRV, 0x54, 1)),
-       MIB_LIST_ITEM("tx_PktsFlexibleOctetsCRCSet0", MIB_ITEM(MIB_REG_PRV, 0x50, 1)),
-       MIB_LIST_ITEM("rx_PktsFlexibleOctetsCRCSet0", MIB_ITEM(MIB_REG_PRV, 0x4c, 1)),
-       MIB_LIST_ITEM("LengthFieldError", MIB_ITEM(MIB_REG_PRV, 0x48, 1)),
-       MIB_LIST_ITEM("FalseCarrierTimes", MIB_ITEM(MIB_REG_PRV, 0x44, 1)),
-       MIB_LIST_ITEM("UndersizeOctets", MIB_ITEM(MIB_REG_PRV, 0x40, 1)),
-       MIB_LIST_ITEM("FramingErrors", MIB_ITEM(MIB_REG_PRV, 0x3c, 1)),
-       MIB_LIST_ITEM("ParserErrors", MIB_ITEM(MIB_REG_PRV, 0x38, 1)),
-       MIB_LIST_ITEM("rx_MacDiscards", MIB_ITEM(MIB_REG_PRV, 0x34, 1)),
-       MIB_LIST_ITEM("rx_MacIPGShortDrop", MIB_ITEM(MIB_REG_PRV, 0x30, 1))
-};
-
-const struct rtldsa_mib_desc rtldsa_930x_mib = {
-       .symbol_errors = MIB_ITEM(MIB_REG_STD, 0xa0, 1),
-
-       .if_in_octets = MIB_ITEM(MIB_REG_STD, 0xf8, 2),
-       .if_out_octets = MIB_ITEM(MIB_REG_STD, 0xf0, 2),
-       .if_in_ucast_pkts = MIB_ITEM(MIB_REG_STD, 0xe8, 2),
-       .if_in_mcast_pkts = MIB_ITEM(MIB_REG_STD, 0xe0, 2),
-       .if_in_bcast_pkts = MIB_ITEM(MIB_REG_STD, 0xd8, 2),
-       .if_out_ucast_pkts = MIB_ITEM(MIB_REG_STD, 0xd0, 2),
-       .if_out_mcast_pkts = MIB_ITEM(MIB_REG_STD, 0xc8, 2),
-       .if_out_bcast_pkts = MIB_ITEM(MIB_REG_STD, 0xc0, 2),
-       .if_out_discards = MIB_ITEM(MIB_REG_STD, 0xbc, 1),
-       .single_collisions = MIB_ITEM(MIB_REG_STD, 0xb4, 1),
-       .multiple_collisions = MIB_ITEM(MIB_REG_STD, 0xb0, 1),
-       .deferred_transmissions = MIB_ITEM(MIB_REG_STD, 0xac, 1),
-       .late_collisions = MIB_ITEM(MIB_REG_STD, 0xa8, 1),
-       .excessive_collisions = MIB_ITEM(MIB_REG_STD, 0xa4, 1),
-       .crc_align_errors = MIB_ITEM(MIB_REG_STD, 0x80, 1),
-       .rx_pkts_over_max_octets = MIB_ITEM(MIB_REG_PRV, 0x6c, 1),
-
-       .unsupported_opcodes = MIB_ITEM(MIB_REG_STD, 0x9c, 1),
-
-       .rx_undersize_pkts = MIB_ITEM(MIB_REG_STD, 0x78, 1),
-       .rx_oversize_pkts = MIB_ITEM(MIB_REG_STD, 0x70, 1),
-       .rx_fragments = MIB_ITEM(MIB_REG_STD, 0x68, 1),
-       .rx_jabbers = MIB_ITEM(MIB_REG_STD, 0x60, 1),
-
-       .tx_pkts = {
-               MIB_ITEM(MIB_REG_STD, 0x58, 1),
-               MIB_ITEM(MIB_REG_STD, 0x50, 1),
-               MIB_ITEM(MIB_REG_STD, 0x48, 1),
-               MIB_ITEM(MIB_REG_STD, 0x40, 1),
-               MIB_ITEM(MIB_REG_STD, 0x38, 1),
-               MIB_ITEM(MIB_REG_STD, 0x30, 1),
-               MIB_ITEM(MIB_REG_PRV, 0x78, 1),
-               MIB_ITEM(MIB_REG_PRV, 0x70, 1)
-       },
-       .rx_pkts = {
-               MIB_ITEM(MIB_REG_STD, 0x54, 1),
-               MIB_ITEM(MIB_REG_STD, 0x4c, 1),
-               MIB_ITEM(MIB_REG_STD, 0x44, 1),
-               MIB_ITEM(MIB_REG_STD, 0x3c, 1),
-               MIB_ITEM(MIB_REG_STD, 0x34, 1),
-               MIB_ITEM(MIB_REG_STD, 0x2c, 1),
-               MIB_ITEM(MIB_REG_PRV, 0x74, 1),
-               MIB_ITEM(MIB_REG_PRV, 0x6c, 1),
-       },
-       .rmon_ranges = {
-               { 0, 64 },
-               { 65, 127 },
-               { 128, 255 },
-               { 256, 511 },
-               { 512, 1023 },
-               { 1024, 1518 },
-               { 1519, 12288 },
-               { 12289, 65535 }
-       },
-
-       .drop_events = MIB_ITEM(MIB_REG_STD, 0x90, 1),
-       .collisions = MIB_ITEM(MIB_REG_STD, 0x5c, 1),
-
-       .rx_pause_frames = MIB_ITEM(MIB_REG_STD, 0x98, 1),
-       .tx_pause_frames = MIB_ITEM(MIB_REG_STD, 0x94, 1),
-
-       .list_count = ARRAY_SIZE(rtldsa_930x_mib_list),
-       .list = rtldsa_930x_mib_list
-};
-
-const struct rtldsa_mib_list_item rtldsa_931x_mib_list[] = {
-       MIB_LIST_ITEM("ifOutDiscards", MIB_ITEM(MIB_TBL_STD, 36, 1)),
-       MIB_LIST_ITEM("dot1dTpPortInDiscards", MIB_ITEM(MIB_TBL_STD, 35, 1)),
-       MIB_LIST_ITEM("DropEvents", MIB_ITEM(MIB_TBL_STD, 25, 1)),
-       MIB_LIST_ITEM("tx_BroadcastPkts", MIB_ITEM(MIB_TBL_STD, 24, 1)),
-       MIB_LIST_ITEM("tx_MulticastPkts", MIB_ITEM(MIB_TBL_STD, 23, 1)),
-       MIB_LIST_ITEM("tx_CRCAlignErrors", MIB_ITEM(MIB_TBL_STD, 22, 1)),
-       MIB_LIST_ITEM("tx_UndersizePkts", MIB_ITEM(MIB_TBL_STD, 20, 1)),
-       MIB_LIST_ITEM("tx_OversizePkts", MIB_ITEM(MIB_TBL_STD, 18, 1)),
-       MIB_LIST_ITEM("tx_Fragments", MIB_ITEM(MIB_TBL_STD, 16, 1)),
-       MIB_LIST_ITEM("tx_Jabbers", MIB_ITEM(MIB_TBL_STD, 14, 1)),
-       MIB_LIST_ITEM("tx_Collisions", MIB_ITEM(MIB_TBL_STD, 12, 1)),
-
-       MIB_LIST_ITEM("rx_UndersizeDropPkts", MIB_ITEM(MIB_TBL_PRV, 27, 1)),
-       MIB_LIST_ITEM("tx_PktsFlexibleOctetsSet1", MIB_ITEM(MIB_TBL_PRV, 22, 1)),
-       MIB_LIST_ITEM("rx_PktsFlexibleOctetsSet1", MIB_ITEM(MIB_TBL_PRV, 21, 1)),
-       MIB_LIST_ITEM("tx_PktsFlexibleOctetsCRCSet1", MIB_ITEM(MIB_TBL_PRV, 28, 1)),
-       MIB_LIST_ITEM("rx_PktsFlexibleOctetsCRCSet1", MIB_ITEM(MIB_TBL_PRV, 27, 1)),
-       MIB_LIST_ITEM("tx_PktsFlexibleOctetsSet0", MIB_ITEM(MIB_TBL_PRV, 18, 1)),
-       MIB_LIST_ITEM("rx_PktsFlexibleOctetsSet0", MIB_ITEM(MIB_TBL_PRV, 17, 1)),
-       MIB_LIST_ITEM("tx_PktsFlexibleOctetsCRCSet0", MIB_ITEM(MIB_TBL_PRV, 16, 1)),
-       MIB_LIST_ITEM("rx_PktsFlexibleOctetsCRCSet0", MIB_ITEM(MIB_TBL_PRV, 15, 1)),
-       MIB_LIST_ITEM("LengthFieldError", MIB_ITEM(MIB_TBL_PRV, 14, 1)),
-       MIB_LIST_ITEM("FalseCarrierTimes", MIB_ITEM(MIB_TBL_PRV, 13, 1)),
-       MIB_LIST_ITEM("UndersizeOctets", MIB_ITEM(MIB_TBL_PRV, 12, 1)),
-       MIB_LIST_ITEM("FramingErrors", MIB_ITEM(MIB_TBL_PRV, 11, 1)),
-       MIB_LIST_ITEM("rx_MacDiscards", MIB_ITEM(MIB_TBL_PRV, 9, 1)),
-       MIB_LIST_ITEM("rx_MacIPGShortDrop", MIB_ITEM(MIB_TBL_PRV, 8, 1))
-};
-
-const struct rtldsa_mib_desc rtldsa_931x_mib = {
-       .symbol_errors = MIB_ITEM(MIB_TBL_STD, 29, 1),
-
-       .if_in_octets = MIB_ITEM(MIB_TBL_STD, 51, 2),
-       .if_out_octets = MIB_ITEM(MIB_TBL_STD, 49, 2),
-       .if_in_ucast_pkts = MIB_ITEM(MIB_TBL_STD, 47, 2),
-       .if_in_mcast_pkts = MIB_ITEM(MIB_TBL_STD, 45, 2),
-       .if_in_bcast_pkts = MIB_ITEM(MIB_TBL_STD, 43, 2),
-       .if_out_ucast_pkts = MIB_ITEM(MIB_TBL_STD, 41, 2),
-       .if_out_mcast_pkts = MIB_ITEM(MIB_TBL_STD, 39, 2),
-       .if_out_bcast_pkts = MIB_ITEM(MIB_TBL_STD, 37, 2),
-       .if_out_discards = MIB_ITEM(MIB_TBL_STD, 36, 1),
-       .single_collisions = MIB_ITEM(MIB_TBL_STD, 35, 1),
-       .multiple_collisions = MIB_ITEM(MIB_TBL_STD, 33, 1),
-       .deferred_transmissions = MIB_ITEM(MIB_TBL_STD, 32, 1),
-       .late_collisions = MIB_ITEM(MIB_TBL_STD, 31, 1),
-       .excessive_collisions = MIB_ITEM(MIB_TBL_STD, 30, 1),
-       .crc_align_errors = MIB_ITEM(MIB_TBL_STD, 21, 1),
-       .rx_pkts_over_max_octets = MIB_ITEM(MIB_TBL_PRV, 23, 1),
-
-       .unsupported_opcodes = MIB_ITEM(MIB_TBL_STD, 28, 1),
-
-       .rx_undersize_pkts = MIB_ITEM(MIB_TBL_STD, 19, 1),
-       .rx_oversize_pkts = MIB_ITEM(MIB_TBL_STD, 17, 1),
-       .rx_fragments = MIB_ITEM(MIB_TBL_STD, 15, 1),
-       .rx_jabbers = MIB_ITEM(MIB_TBL_STD, 13, 1),
-
-       .tx_pkts = {
-               MIB_ITEM(MIB_TBL_STD, 11, 1),
-               MIB_ITEM(MIB_TBL_STD, 9, 1),
-               MIB_ITEM(MIB_TBL_STD, 7, 1),
-               MIB_ITEM(MIB_TBL_STD, 5, 1),
-               MIB_ITEM(MIB_TBL_STD, 3, 1),
-               MIB_ITEM(MIB_TBL_STD, 1, 1),
-               MIB_ITEM(MIB_TBL_PRV, 26, 1),
-               MIB_ITEM(MIB_TBL_PRV, 24, 1)
-       },
-       .rx_pkts = {
-               MIB_ITEM(MIB_TBL_STD, 10, 1),
-               MIB_ITEM(MIB_TBL_STD, 8, 1),
-               MIB_ITEM(MIB_TBL_STD, 6, 1),
-               MIB_ITEM(MIB_TBL_STD, 4, 1),
-               MIB_ITEM(MIB_TBL_STD, 2, 1),
-               MIB_ITEM(MIB_TBL_STD, 0, 1),
-               MIB_ITEM(MIB_TBL_PRV, 25, 1),
-               MIB_ITEM(MIB_TBL_PRV, 23, 1),
-       },
-       .rmon_ranges = {
-               { 0, 64 },
-               { 65, 127 },
-               { 128, 255 },
-               { 256, 511 },
-               { 512, 1023 },
-               { 1024, 1518 },
-               { 1519, 12288 },
-               { 12289, 65535 }
-       },
-
-       .drop_events = MIB_ITEM(MIB_TBL_STD, 25, 1),
-       .collisions = MIB_ITEM(MIB_TBL_STD, 12, 1),
-
-       .rx_pause_frames = MIB_ITEM(MIB_TBL_STD, 27, 1),
-       .tx_pause_frames = MIB_ITEM(MIB_TBL_STD, 26, 1),
-
-       .list_count = ARRAY_SIZE(rtldsa_931x_mib_list),
-       .list = rtldsa_931x_mib_list
-};
-
 /* DSA callbacks */
 
 static enum dsa_tag_protocol rtldsa_get_tag_protocol(struct dsa_switch *ds,
@@ -888,18 +531,7 @@ static void rtldsa_93xx_phylink_mac_link_up(struct dsa_switch *ds, int port,
 
 static const struct rtldsa_mib_desc *rtldsa_get_mib_desc(struct rtl838x_switch_priv *priv)
 {
-       switch (priv->family_id) {
-       case RTL8380_FAMILY_ID:
-               return &rtldsa_838x_mib;
-       case RTL8390_FAMILY_ID:
-               return &rtldsa_839x_mib;
-       case RTL9300_FAMILY_ID:
-               return &rtldsa_930x_mib;
-       case RTL9310_FAMILY_ID:
-               return &rtldsa_931x_mib;
-       default:
-               return NULL;
-       }
+       return priv->r->mib_desc;
 }
 
 static bool rtldsa_read_mib_item(struct rtl838x_switch_priv *priv, int port,
index 8c408e5608683a3848da65efd126c35b480679b2..e6564284d23d49bfbd3af050f9da3b359042abef 100644 (file)
@@ -111,6 +111,83 @@ static enum template_field_id fixed_templates[N_FIXED_TEMPLATES][N_FIXED_FIELDS]
        },
 };
 
+const struct rtldsa_mib_list_item rtldsa_838x_mib_list[] = {
+       MIB_LIST_ITEM("dot1dTpPortInDiscards", MIB_ITEM(MIB_REG_STD, 0xec, 1)),
+       MIB_LIST_ITEM("ifOutDiscards", MIB_ITEM(MIB_REG_STD, 0xd0, 1)),
+       MIB_LIST_ITEM("DropEvents", MIB_ITEM(MIB_REG_STD, 0xa8, 1)),
+       MIB_LIST_ITEM("tx_BroadcastPkts", MIB_ITEM(MIB_REG_STD, 0xa4, 1)),
+       MIB_LIST_ITEM("tx_MulticastPkts", MIB_ITEM(MIB_REG_STD, 0xa0, 1)),
+       MIB_LIST_ITEM("tx_UndersizePkts", MIB_ITEM(MIB_REG_STD, 0x98, 1)),
+       MIB_LIST_ITEM("rx_UndersizeDropPkts", MIB_ITEM(MIB_REG_STD, 0x90, 1)),
+       MIB_LIST_ITEM("tx_OversizePkts", MIB_ITEM(MIB_REG_STD, 0x8c, 1)),
+       MIB_LIST_ITEM("Collisions", MIB_ITEM(MIB_REG_STD, 0x7c, 1)),
+       MIB_LIST_ITEM("rx_MacDiscards", MIB_ITEM(MIB_REG_STD, 0x40, 1))
+};
+
+const struct rtldsa_mib_desc rtldsa_838x_mib_desc = {
+       .symbol_errors = MIB_ITEM(MIB_REG_STD, 0xb8, 1),
+
+       .if_in_octets = MIB_ITEM(MIB_REG_STD, 0xf8, 2),
+       .if_out_octets = MIB_ITEM(MIB_REG_STD, 0xf0, 2),
+       .if_in_ucast_pkts = MIB_ITEM(MIB_REG_STD, 0xe8, 1),
+       .if_in_mcast_pkts = MIB_ITEM(MIB_REG_STD, 0xe4, 1),
+       .if_in_bcast_pkts = MIB_ITEM(MIB_REG_STD, 0xe0, 1),
+       .if_out_ucast_pkts = MIB_ITEM(MIB_REG_STD, 0xdc, 1),
+       .if_out_mcast_pkts = MIB_ITEM(MIB_REG_STD, 0xd8, 1),
+       .if_out_bcast_pkts = MIB_ITEM(MIB_REG_STD, 0xd4, 1),
+       .if_out_discards = MIB_ITEM(MIB_REG_STD, 0xd0, 1),
+       .single_collisions = MIB_ITEM(MIB_REG_STD, 0xcc, 1),
+       .multiple_collisions = MIB_ITEM(MIB_REG_STD, 0xc8, 1),
+       .deferred_transmissions = MIB_ITEM(MIB_REG_STD, 0xc4, 1),
+       .late_collisions = MIB_ITEM(MIB_REG_STD, 0xc0, 1),
+       .excessive_collisions = MIB_ITEM(MIB_REG_STD, 0xbc, 1),
+       .crc_align_errors = MIB_ITEM(MIB_REG_STD, 0x9c, 1),
+
+       .unsupported_opcodes = MIB_ITEM(MIB_REG_STD, 0xb4, 1),
+
+       .rx_undersize_pkts = MIB_ITEM(MIB_REG_STD, 0x94, 1),
+       .rx_oversize_pkts = MIB_ITEM(MIB_REG_STD, 0x88, 1),
+       .rx_fragments = MIB_ITEM(MIB_REG_STD, 0x84, 1),
+       .rx_jabbers = MIB_ITEM(MIB_REG_STD, 0x80, 1),
+
+       .tx_pkts = {
+               MIB_ITEM(MIB_REG_STD, 0x78, 1),
+               MIB_ITEM(MIB_REG_STD, 0x70, 1),
+               MIB_ITEM(MIB_REG_STD, 0x68, 1),
+               MIB_ITEM(MIB_REG_STD, 0x60, 1),
+               MIB_ITEM(MIB_REG_STD, 0x58, 1),
+               MIB_ITEM(MIB_REG_STD, 0x50, 1),
+               MIB_ITEM(MIB_REG_STD, 0x48, 1)
+       },
+       .rx_pkts = {
+               MIB_ITEM(MIB_REG_STD, 0x74, 1),
+               MIB_ITEM(MIB_REG_STD, 0x6c, 1),
+               MIB_ITEM(MIB_REG_STD, 0x64, 1),
+               MIB_ITEM(MIB_REG_STD, 0x5c, 1),
+               MIB_ITEM(MIB_REG_STD, 0x54, 1),
+               MIB_ITEM(MIB_REG_STD, 0x4c, 1),
+               MIB_ITEM(MIB_REG_STD, 0x44, 1)
+       },
+       .rmon_ranges = {
+               { 0, 64 },
+               { 65, 127 },
+               { 128, 255 },
+               { 256, 511 },
+               { 512, 1023 },
+               { 1024, 1518 },
+               { 1519, 10000 }
+       },
+
+       .drop_events = MIB_ITEM(MIB_REG_STD, 0xa8, 1),
+       .collisions = MIB_ITEM(MIB_REG_STD, 0x7c, 1),
+
+       .rx_pause_frames = MIB_ITEM(MIB_REG_STD, 0xb0, 1),
+       .tx_pause_frames = MIB_ITEM(MIB_REG_STD, 0xac, 1),
+
+       .list_count = ARRAY_SIZE(rtldsa_838x_mib_list),
+       .list = rtldsa_838x_mib_list
+};
+
 void rtldsa_838x_print_matrix(void)
 {
        unsigned volatile int *ptr8;
@@ -1723,6 +1800,7 @@ const struct rtldsa_config rtldsa_838x_cfg = {
        .stat_port_rst = RTL838X_STAT_PORT_RST,
        .stat_rst = RTL838X_STAT_RST,
        .stat_port_std_mib = RTL838X_STAT_PORT_STD_MIB,
+       .mib_desc = &rtldsa_838x_mib_desc,
        .stat_counters_lock = rtldsa_counters_lock_register,
        .stat_counters_unlock = rtldsa_counters_unlock_register,
        .stat_update_counters_atomically = rtldsa_update_counters_atomically,
index 594b43cebcf6812bb620c20f73a94d6f74e3b142..119e4210c2832eec4181cdf4c75cc3074f811d06 100644 (file)
@@ -1262,6 +1262,7 @@ struct rtldsa_config {
        int stat_rst;
        int stat_port_std_mib;
        int stat_port_prv_mib;
+       const struct rtldsa_mib_desc *mib_desc;
        u64 (*stat_port_table_read)(int port, unsigned int mib_size, unsigned int offset, bool is_pvt);
        void (*stat_counters_lock)(struct rtl838x_switch_priv *priv, int port);
        void (*stat_counters_unlock)(struct rtl838x_switch_priv *priv, int port);
index 72185d3e8989d997e8a0c3c26c447762acd5e67e..ac8509db8cff58874969961194e6565bfe58658a 100644 (file)
@@ -117,6 +117,90 @@ static enum template_field_id fixed_templates[N_FIXED_TEMPLATES][N_FIXED_FIELDS]
        },
 };
 
+const struct rtldsa_mib_list_item rtldsa_839x_mib_list[] = {
+       MIB_LIST_ITEM("ifOutDiscards", MIB_ITEM(MIB_REG_STD, 0xd4, 1)),
+       MIB_LIST_ITEM("dot1dTpPortInDiscards", MIB_ITEM(MIB_REG_STD, 0xd0, 1)),
+       MIB_LIST_ITEM("DropEvents", MIB_ITEM(MIB_REG_STD, 0xa8, 1)),
+       MIB_LIST_ITEM("tx_BroadcastPkts", MIB_ITEM(MIB_REG_STD, 0xa4, 1)),
+       MIB_LIST_ITEM("tx_MulticastPkts", MIB_ITEM(MIB_REG_STD, 0xa0, 1)),
+       MIB_LIST_ITEM("tx_UndersizePkts", MIB_ITEM(MIB_REG_STD, 0x98, 1)),
+       MIB_LIST_ITEM("rx_UndersizeDropPkts", MIB_ITEM(MIB_REG_STD, 0x90, 1)),
+       MIB_LIST_ITEM("tx_OversizePkts", MIB_ITEM(MIB_REG_STD, 0x8c, 1)),
+       MIB_LIST_ITEM("Collisions", MIB_ITEM(MIB_REG_STD, 0x7c, 1)),
+       MIB_LIST_ITEM("rx_LengthFieldError", MIB_ITEM(MIB_REG_STD, 0x40, 1)),
+       MIB_LIST_ITEM("rx_FalseCarrierTimes", MIB_ITEM(MIB_REG_STD, 0x3c, 1)),
+       MIB_LIST_ITEM("rx_UnderSizeOctets", MIB_ITEM(MIB_REG_STD, 0x38, 1)),
+       MIB_LIST_ITEM("tx_Fragments", MIB_ITEM(MIB_REG_STD, 0x34, 1)),
+       MIB_LIST_ITEM("tx_Jabbers", MIB_ITEM(MIB_REG_STD, 0x30, 1)),
+       MIB_LIST_ITEM("tx_CRCAlignErrors", MIB_ITEM(MIB_REG_STD, 0x2c, 1)),
+       MIB_LIST_ITEM("rx_FramingErrors", MIB_ITEM(MIB_REG_STD, 0x28, 1)),
+       MIB_LIST_ITEM("rx_MacDiscards", MIB_ITEM(MIB_REG_STD, 0x24, 1))
+};
+
+const struct rtldsa_mib_desc rtldsa_839x_mib_desc = {
+       .symbol_errors = MIB_ITEM(MIB_REG_STD, 0xb8, 1),
+
+       .if_in_octets = MIB_ITEM(MIB_REG_STD, 0xf8, 2),
+       .if_out_octets = MIB_ITEM(MIB_REG_STD, 0xf0, 2),
+       .if_in_ucast_pkts = MIB_ITEM(MIB_REG_STD, 0xec, 1),
+       .if_in_mcast_pkts = MIB_ITEM(MIB_REG_STD, 0xe8, 1),
+       .if_in_bcast_pkts = MIB_ITEM(MIB_REG_STD, 0xe4, 1),
+       .if_out_ucast_pkts = MIB_ITEM(MIB_REG_STD, 0xe0, 1),
+       .if_out_mcast_pkts = MIB_ITEM(MIB_REG_STD, 0xdc, 1),
+       .if_out_bcast_pkts = MIB_ITEM(MIB_REG_STD, 0xd8, 1),
+       .if_out_discards = MIB_ITEM(MIB_REG_STD, 0xd4, 1),
+       .single_collisions = MIB_ITEM(MIB_REG_STD, 0xcc, 1),
+       .multiple_collisions = MIB_ITEM(MIB_REG_STD, 0xc8, 1),
+       .deferred_transmissions = MIB_ITEM(MIB_REG_STD, 0xc4, 1),
+       .late_collisions = MIB_ITEM(MIB_REG_STD, 0xc0, 1),
+       .excessive_collisions = MIB_ITEM(MIB_REG_STD, 0xbc, 1),
+       .crc_align_errors = MIB_ITEM(MIB_REG_STD, 0x9c, 1),
+
+       .unsupported_opcodes = MIB_ITEM(MIB_REG_STD, 0xb4, 1),
+
+       .rx_undersize_pkts = MIB_ITEM(MIB_REG_STD, 0x94, 1),
+       .rx_oversize_pkts = MIB_ITEM(MIB_REG_STD, 0x88, 1),
+       .rx_fragments = MIB_ITEM(MIB_REG_STD, 0x84, 1),
+       .rx_jabbers = MIB_ITEM(MIB_REG_STD, 0x80, 1),
+
+       .tx_pkts = {
+               MIB_ITEM(MIB_REG_STD, 0x78, 1),
+               MIB_ITEM(MIB_REG_STD, 0x70, 1),
+               MIB_ITEM(MIB_REG_STD, 0x68, 1),
+               MIB_ITEM(MIB_REG_STD, 0x60, 1),
+               MIB_ITEM(MIB_REG_STD, 0x58, 1),
+               MIB_ITEM(MIB_REG_STD, 0x50, 1),
+               MIB_ITEM(MIB_REG_STD, 0x48, 1)
+       },
+       .rx_pkts = {
+               MIB_ITEM(MIB_REG_STD, 0x74, 1),
+               MIB_ITEM(MIB_REG_STD, 0x6c, 1),
+               MIB_ITEM(MIB_REG_STD, 0x64, 1),
+               MIB_ITEM(MIB_REG_STD, 0x5c, 1),
+               MIB_ITEM(MIB_REG_STD, 0x54, 1),
+               MIB_ITEM(MIB_REG_STD, 0x4c, 1),
+               MIB_ITEM(MIB_REG_STD, 0x44, 1)
+       },
+       .rmon_ranges = {
+               { 0, 64 },
+               { 65, 127 },
+               { 128, 255 },
+               { 256, 511 },
+               { 512, 1023 },
+               { 1024, 1518 },
+               { 1519, 12288 }
+       },
+
+       .drop_events = MIB_ITEM(MIB_REG_STD, 0xa8, 1),
+       .collisions = MIB_ITEM(MIB_REG_STD, 0x7c, 1),
+
+       .rx_pause_frames = MIB_ITEM(MIB_REG_STD, 0xb0, 1),
+       .tx_pause_frames = MIB_ITEM(MIB_REG_STD, 0xac, 1),
+
+       .list_count = ARRAY_SIZE(rtldsa_839x_mib_list),
+       .list = rtldsa_839x_mib_list
+};
+
 void rtldsa_839x_print_matrix(void)
 {
        volatile u64 *ptr9;
@@ -1654,6 +1738,7 @@ const struct rtldsa_config rtldsa_839x_cfg = {
        .stat_port_rst = RTL839X_STAT_PORT_RST,
        .stat_rst = RTL839X_STAT_RST,
        .stat_port_std_mib = RTL839X_STAT_PORT_STD_MIB,
+       .mib_desc = &rtldsa_839x_mib_desc,
        .stat_counters_lock = rtldsa_counters_lock_register,
        .stat_counters_unlock = rtldsa_counters_unlock_register,
        .stat_update_counters_atomically = rtldsa_update_counters_atomically,
index e148efe9d238e3b64f1e5d631537beded577c414..7368f31a9f8d6aca14be4547b7ded26aa2fdd4e7 100644 (file)
@@ -124,6 +124,104 @@ static enum template_field_id fixed_templates[N_FIXED_TEMPLATES][N_FIXED_FIELDS]
        },
 };
 
+const struct rtldsa_mib_list_item rtldsa_930x_mib_list[] = {
+       MIB_LIST_ITEM("ifOutDiscards", MIB_ITEM(MIB_REG_STD, 0xbc, 1)),
+       MIB_LIST_ITEM("dot1dTpPortInDiscards", MIB_ITEM(MIB_REG_STD, 0xb8, 1)),
+       MIB_LIST_ITEM("DropEvents", MIB_ITEM(MIB_REG_STD, 0x90, 1)),
+       MIB_LIST_ITEM("tx_BroadcastPkts", MIB_ITEM(MIB_REG_STD, 0x8c, 1)),
+       MIB_LIST_ITEM("tx_MulticastPkts", MIB_ITEM(MIB_REG_STD, 0x88, 1)),
+       MIB_LIST_ITEM("tx_CRCAlignErrors", MIB_ITEM(MIB_REG_STD, 0x84, 1)),
+       MIB_LIST_ITEM("tx_UndersizePkts", MIB_ITEM(MIB_REG_STD, 0x7c, 1)),
+       MIB_LIST_ITEM("tx_OversizePkts", MIB_ITEM(MIB_REG_STD, 0x74, 1)),
+       MIB_LIST_ITEM("tx_Fragments", MIB_ITEM(MIB_REG_STD, 0x6c, 1)),
+       MIB_LIST_ITEM("tx_Jabbers", MIB_ITEM(MIB_REG_STD, 0x64, 1)),
+       MIB_LIST_ITEM("tx_Collisions", MIB_ITEM(MIB_REG_STD, 0x5c, 1)),
+       MIB_LIST_ITEM("rx_UndersizeDropPkts", MIB_ITEM(MIB_REG_PRV, 0x7c, 1)),
+       MIB_LIST_ITEM("tx_PktsFlexibleOctetsSet1", MIB_ITEM(MIB_REG_PRV, 0x68, 1)),
+       MIB_LIST_ITEM("rx_PktsFlexibleOctetsSet1", MIB_ITEM(MIB_REG_PRV, 0x64, 1)),
+       MIB_LIST_ITEM("tx_PktsFlexibleOctetsCRCSet1", MIB_ITEM(MIB_REG_PRV, 0x60, 1)),
+       MIB_LIST_ITEM("rx_PktsFlexibleOctetsCRCSet1", MIB_ITEM(MIB_REG_PRV, 0x5c, 1)),
+       MIB_LIST_ITEM("tx_PktsFlexibleOctetsSet0", MIB_ITEM(MIB_REG_PRV, 0x58, 1)),
+       MIB_LIST_ITEM("rx_PktsFlexibleOctetsSet0", MIB_ITEM(MIB_REG_PRV, 0x54, 1)),
+       MIB_LIST_ITEM("tx_PktsFlexibleOctetsCRCSet0", MIB_ITEM(MIB_REG_PRV, 0x50, 1)),
+       MIB_LIST_ITEM("rx_PktsFlexibleOctetsCRCSet0", MIB_ITEM(MIB_REG_PRV, 0x4c, 1)),
+       MIB_LIST_ITEM("LengthFieldError", MIB_ITEM(MIB_REG_PRV, 0x48, 1)),
+       MIB_LIST_ITEM("FalseCarrierTimes", MIB_ITEM(MIB_REG_PRV, 0x44, 1)),
+       MIB_LIST_ITEM("UndersizeOctets", MIB_ITEM(MIB_REG_PRV, 0x40, 1)),
+       MIB_LIST_ITEM("FramingErrors", MIB_ITEM(MIB_REG_PRV, 0x3c, 1)),
+       MIB_LIST_ITEM("ParserErrors", MIB_ITEM(MIB_REG_PRV, 0x38, 1)),
+       MIB_LIST_ITEM("rx_MacDiscards", MIB_ITEM(MIB_REG_PRV, 0x34, 1)),
+       MIB_LIST_ITEM("rx_MacIPGShortDrop", MIB_ITEM(MIB_REG_PRV, 0x30, 1))
+};
+
+const struct rtldsa_mib_desc rtldsa_930x_mib_desc = {
+       .symbol_errors = MIB_ITEM(MIB_REG_STD, 0xa0, 1),
+
+       .if_in_octets = MIB_ITEM(MIB_REG_STD, 0xf8, 2),
+       .if_out_octets = MIB_ITEM(MIB_REG_STD, 0xf0, 2),
+       .if_in_ucast_pkts = MIB_ITEM(MIB_REG_STD, 0xe8, 2),
+       .if_in_mcast_pkts = MIB_ITEM(MIB_REG_STD, 0xe0, 2),
+       .if_in_bcast_pkts = MIB_ITEM(MIB_REG_STD, 0xd8, 2),
+       .if_out_ucast_pkts = MIB_ITEM(MIB_REG_STD, 0xd0, 2),
+       .if_out_mcast_pkts = MIB_ITEM(MIB_REG_STD, 0xc8, 2),
+       .if_out_bcast_pkts = MIB_ITEM(MIB_REG_STD, 0xc0, 2),
+       .if_out_discards = MIB_ITEM(MIB_REG_STD, 0xbc, 1),
+       .single_collisions = MIB_ITEM(MIB_REG_STD, 0xb4, 1),
+       .multiple_collisions = MIB_ITEM(MIB_REG_STD, 0xb0, 1),
+       .deferred_transmissions = MIB_ITEM(MIB_REG_STD, 0xac, 1),
+       .late_collisions = MIB_ITEM(MIB_REG_STD, 0xa8, 1),
+       .excessive_collisions = MIB_ITEM(MIB_REG_STD, 0xa4, 1),
+       .crc_align_errors = MIB_ITEM(MIB_REG_STD, 0x80, 1),
+       .rx_pkts_over_max_octets = MIB_ITEM(MIB_REG_PRV, 0x6c, 1),
+
+       .unsupported_opcodes = MIB_ITEM(MIB_REG_STD, 0x9c, 1),
+
+       .rx_undersize_pkts = MIB_ITEM(MIB_REG_STD, 0x78, 1),
+       .rx_oversize_pkts = MIB_ITEM(MIB_REG_STD, 0x70, 1),
+       .rx_fragments = MIB_ITEM(MIB_REG_STD, 0x68, 1),
+       .rx_jabbers = MIB_ITEM(MIB_REG_STD, 0x60, 1),
+
+       .tx_pkts = {
+               MIB_ITEM(MIB_REG_STD, 0x58, 1),
+               MIB_ITEM(MIB_REG_STD, 0x50, 1),
+               MIB_ITEM(MIB_REG_STD, 0x48, 1),
+               MIB_ITEM(MIB_REG_STD, 0x40, 1),
+               MIB_ITEM(MIB_REG_STD, 0x38, 1),
+               MIB_ITEM(MIB_REG_STD, 0x30, 1),
+               MIB_ITEM(MIB_REG_PRV, 0x78, 1),
+               MIB_ITEM(MIB_REG_PRV, 0x70, 1)
+       },
+       .rx_pkts = {
+               MIB_ITEM(MIB_REG_STD, 0x54, 1),
+               MIB_ITEM(MIB_REG_STD, 0x4c, 1),
+               MIB_ITEM(MIB_REG_STD, 0x44, 1),
+               MIB_ITEM(MIB_REG_STD, 0x3c, 1),
+               MIB_ITEM(MIB_REG_STD, 0x34, 1),
+               MIB_ITEM(MIB_REG_STD, 0x2c, 1),
+               MIB_ITEM(MIB_REG_PRV, 0x74, 1),
+               MIB_ITEM(MIB_REG_PRV, 0x6c, 1),
+       },
+       .rmon_ranges = {
+               { 0, 64 },
+               { 65, 127 },
+               { 128, 255 },
+               { 256, 511 },
+               { 512, 1023 },
+               { 1024, 1518 },
+               { 1519, 12288 },
+               { 12289, 65535 }
+       },
+
+       .drop_events = MIB_ITEM(MIB_REG_STD, 0x90, 1),
+       .collisions = MIB_ITEM(MIB_REG_STD, 0x5c, 1),
+
+       .rx_pause_frames = MIB_ITEM(MIB_REG_STD, 0x98, 1),
+       .tx_pause_frames = MIB_ITEM(MIB_REG_STD, 0x94, 1),
+
+       .list_count = ARRAY_SIZE(rtldsa_930x_mib_list),
+       .list = rtldsa_930x_mib_list
+};
+
 void rtldsa_930x_print_matrix(void)
 {
        struct table_reg *r = rtl_table_get(RTL9300_TBL_0, 6);
@@ -2656,6 +2754,7 @@ const struct rtldsa_config rtldsa_930x_cfg = {
        .stat_rst = RTL930X_STAT_RST,
        .stat_port_std_mib = RTL930X_STAT_PORT_MIB_CNTR,
        .stat_port_prv_mib = RTL930X_STAT_PORT_PRVTE_CNTR,
+       .mib_desc = &rtldsa_930x_mib_desc,
        .stat_counters_lock = rtldsa_counters_lock_register,
        .stat_counters_unlock = rtldsa_counters_unlock_register,
        .stat_update_counters_atomically = rtldsa_update_counters_atomically,
index 4d3ea0232a60bd9ddcef7c54ec215c50b93cc795..18fc77c6bc0a8bfcf108fe2d048a7e1160eb98c8 100644 (file)
@@ -115,6 +115,104 @@ static enum template_field_id fixed_templates[N_FIXED_TEMPLATES][N_FIXED_FIELDS_
        },
 };
 
+const struct rtldsa_mib_list_item rtldsa_931x_mib_list[] = {
+       MIB_LIST_ITEM("ifOutDiscards", MIB_ITEM(MIB_TBL_STD, 36, 1)),
+       MIB_LIST_ITEM("dot1dTpPortInDiscards", MIB_ITEM(MIB_TBL_STD, 35, 1)),
+       MIB_LIST_ITEM("DropEvents", MIB_ITEM(MIB_TBL_STD, 25, 1)),
+       MIB_LIST_ITEM("tx_BroadcastPkts", MIB_ITEM(MIB_TBL_STD, 24, 1)),
+       MIB_LIST_ITEM("tx_MulticastPkts", MIB_ITEM(MIB_TBL_STD, 23, 1)),
+       MIB_LIST_ITEM("tx_CRCAlignErrors", MIB_ITEM(MIB_TBL_STD, 22, 1)),
+       MIB_LIST_ITEM("tx_UndersizePkts", MIB_ITEM(MIB_TBL_STD, 20, 1)),
+       MIB_LIST_ITEM("tx_OversizePkts", MIB_ITEM(MIB_TBL_STD, 18, 1)),
+       MIB_LIST_ITEM("tx_Fragments", MIB_ITEM(MIB_TBL_STD, 16, 1)),
+       MIB_LIST_ITEM("tx_Jabbers", MIB_ITEM(MIB_TBL_STD, 14, 1)),
+       MIB_LIST_ITEM("tx_Collisions", MIB_ITEM(MIB_TBL_STD, 12, 1)),
+
+       MIB_LIST_ITEM("rx_UndersizeDropPkts", MIB_ITEM(MIB_TBL_PRV, 27, 1)),
+       MIB_LIST_ITEM("tx_PktsFlexibleOctetsSet1", MIB_ITEM(MIB_TBL_PRV, 22, 1)),
+       MIB_LIST_ITEM("rx_PktsFlexibleOctetsSet1", MIB_ITEM(MIB_TBL_PRV, 21, 1)),
+       MIB_LIST_ITEM("tx_PktsFlexibleOctetsCRCSet1", MIB_ITEM(MIB_TBL_PRV, 28, 1)),
+       MIB_LIST_ITEM("rx_PktsFlexibleOctetsCRCSet1", MIB_ITEM(MIB_TBL_PRV, 27, 1)),
+       MIB_LIST_ITEM("tx_PktsFlexibleOctetsSet0", MIB_ITEM(MIB_TBL_PRV, 18, 1)),
+       MIB_LIST_ITEM("rx_PktsFlexibleOctetsSet0", MIB_ITEM(MIB_TBL_PRV, 17, 1)),
+       MIB_LIST_ITEM("tx_PktsFlexibleOctetsCRCSet0", MIB_ITEM(MIB_TBL_PRV, 16, 1)),
+       MIB_LIST_ITEM("rx_PktsFlexibleOctetsCRCSet0", MIB_ITEM(MIB_TBL_PRV, 15, 1)),
+       MIB_LIST_ITEM("LengthFieldError", MIB_ITEM(MIB_TBL_PRV, 14, 1)),
+       MIB_LIST_ITEM("FalseCarrierTimes", MIB_ITEM(MIB_TBL_PRV, 13, 1)),
+       MIB_LIST_ITEM("UndersizeOctets", MIB_ITEM(MIB_TBL_PRV, 12, 1)),
+       MIB_LIST_ITEM("FramingErrors", MIB_ITEM(MIB_TBL_PRV, 11, 1)),
+       MIB_LIST_ITEM("rx_MacDiscards", MIB_ITEM(MIB_TBL_PRV, 9, 1)),
+       MIB_LIST_ITEM("rx_MacIPGShortDrop", MIB_ITEM(MIB_TBL_PRV, 8, 1))
+};
+
+const struct rtldsa_mib_desc rtldsa_931x_mib_desc = {
+       .symbol_errors = MIB_ITEM(MIB_TBL_STD, 29, 1),
+
+       .if_in_octets = MIB_ITEM(MIB_TBL_STD, 51, 2),
+       .if_out_octets = MIB_ITEM(MIB_TBL_STD, 49, 2),
+       .if_in_ucast_pkts = MIB_ITEM(MIB_TBL_STD, 47, 2),
+       .if_in_mcast_pkts = MIB_ITEM(MIB_TBL_STD, 45, 2),
+       .if_in_bcast_pkts = MIB_ITEM(MIB_TBL_STD, 43, 2),
+       .if_out_ucast_pkts = MIB_ITEM(MIB_TBL_STD, 41, 2),
+       .if_out_mcast_pkts = MIB_ITEM(MIB_TBL_STD, 39, 2),
+       .if_out_bcast_pkts = MIB_ITEM(MIB_TBL_STD, 37, 2),
+       .if_out_discards = MIB_ITEM(MIB_TBL_STD, 36, 1),
+       .single_collisions = MIB_ITEM(MIB_TBL_STD, 35, 1),
+       .multiple_collisions = MIB_ITEM(MIB_TBL_STD, 33, 1),
+       .deferred_transmissions = MIB_ITEM(MIB_TBL_STD, 32, 1),
+       .late_collisions = MIB_ITEM(MIB_TBL_STD, 31, 1),
+       .excessive_collisions = MIB_ITEM(MIB_TBL_STD, 30, 1),
+       .crc_align_errors = MIB_ITEM(MIB_TBL_STD, 21, 1),
+       .rx_pkts_over_max_octets = MIB_ITEM(MIB_TBL_PRV, 23, 1),
+
+       .unsupported_opcodes = MIB_ITEM(MIB_TBL_STD, 28, 1),
+
+       .rx_undersize_pkts = MIB_ITEM(MIB_TBL_STD, 19, 1),
+       .rx_oversize_pkts = MIB_ITEM(MIB_TBL_STD, 17, 1),
+       .rx_fragments = MIB_ITEM(MIB_TBL_STD, 15, 1),
+       .rx_jabbers = MIB_ITEM(MIB_TBL_STD, 13, 1),
+
+       .tx_pkts = {
+               MIB_ITEM(MIB_TBL_STD, 11, 1),
+               MIB_ITEM(MIB_TBL_STD, 9, 1),
+               MIB_ITEM(MIB_TBL_STD, 7, 1),
+               MIB_ITEM(MIB_TBL_STD, 5, 1),
+               MIB_ITEM(MIB_TBL_STD, 3, 1),
+               MIB_ITEM(MIB_TBL_STD, 1, 1),
+               MIB_ITEM(MIB_TBL_PRV, 26, 1),
+               MIB_ITEM(MIB_TBL_PRV, 24, 1)
+       },
+       .rx_pkts = {
+               MIB_ITEM(MIB_TBL_STD, 10, 1),
+               MIB_ITEM(MIB_TBL_STD, 8, 1),
+               MIB_ITEM(MIB_TBL_STD, 6, 1),
+               MIB_ITEM(MIB_TBL_STD, 4, 1),
+               MIB_ITEM(MIB_TBL_STD, 2, 1),
+               MIB_ITEM(MIB_TBL_STD, 0, 1),
+               MIB_ITEM(MIB_TBL_PRV, 25, 1),
+               MIB_ITEM(MIB_TBL_PRV, 23, 1),
+       },
+       .rmon_ranges = {
+               { 0, 64 },
+               { 65, 127 },
+               { 128, 255 },
+               { 256, 511 },
+               { 512, 1023 },
+               { 1024, 1518 },
+               { 1519, 12288 },
+               { 12289, 65535 }
+       },
+
+       .drop_events = MIB_ITEM(MIB_TBL_STD, 25, 1),
+       .collisions = MIB_ITEM(MIB_TBL_STD, 12, 1),
+
+       .rx_pause_frames = MIB_ITEM(MIB_TBL_STD, 27, 1),
+       .tx_pause_frames = MIB_ITEM(MIB_TBL_STD, 26, 1),
+
+       .list_count = ARRAY_SIZE(rtldsa_931x_mib_list),
+       .list = rtldsa_931x_mib_list
+};
+
 inline void rtl931x_exec_tbl0_cmd(u32 cmd)
 {
        sw_w32(cmd, RTL931X_TBL_ACCESS_CTRL_0);
@@ -1799,6 +1897,7 @@ const struct rtldsa_config rtldsa_931x_cfg = {
        .stat_port_rst = RTL931X_STAT_PORT_RST,
        .stat_rst = RTL931X_STAT_RST,
        .stat_port_std_mib = 0,  /* Not defined */
+       .mib_desc = &rtldsa_931x_mib_desc,
        .stat_port_table_read = rtldsa_931x_stat_port_table_read,
        .stat_counters_lock = rtldsa_counters_lock_table,
        .stat_counters_unlock = rtldsa_counters_unlock_table,