Message ID | 801c89963e95e5ce8f1ab7dbda894dd9da0125cc.1690638748.git.daniel@makrotopia.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [net-next] net: ethernet: mtk_eth_soc: support per-flow accounting on MT7988 | expand |
Hi Daniel, 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/Daniel-Golle/net-ethernet-mtk_eth_soc-support-per-flow-accounting-on-MT7988/20230729-215634 base: net-next/main patch link: https://lore.kernel.org/r/801c89963e95e5ce8f1ab7dbda894dd9da0125cc.1690638748.git.daniel%40makrotopia.org patch subject: [PATCH net-next] net: ethernet: mtk_eth_soc: support per-flow accounting on MT7988 config: hexagon-randconfig-r023-20230729 (https://download.01.org/0day-ci/archive/20230729/202307292316.uxGTiSPC-lkp@intel.com/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a) reproduce: (https://download.01.org/0day-ci/archive/20230729/202307292316.uxGTiSPC-lkp@intel.com/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 <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202307292316.uxGTiSPC-lkp@intel.com/ All errors (new ones prefixed by >>): In file included from drivers/net/ethernet/mediatek/mtk_ppe.c:5: In file included from include/linux/io.h:13: In file included from arch/hexagon/include/asm/io.h:334: include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 547 | val = __raw_readb(PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 560 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); | ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu' 37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) | ^ In file included from drivers/net/ethernet/mediatek/mtk_ppe.c:5: In file included from include/linux/io.h:13: In file included from arch/hexagon/include/asm/io.h:334: include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 573 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); | ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu' 35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) | ^ In file included from drivers/net/ethernet/mediatek/mtk_ppe.c:5: In file included from include/linux/io.h:13: In file included from arch/hexagon/include/asm/io.h:334: include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 584 | __raw_writeb(value, PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 594 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 604 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); | ~~~~~~~~~~ ^ >> drivers/net/ethernet/mediatek/mtk_ppe.c:112:3: error: use of undeclared identifier 'bytes_cnt_low'; did you mean 'byte_cnt_low'? 112 | bytes_cnt_low = cnt_r0; | ^~~~~~~~~~~~~ | byte_cnt_low drivers/net/ethernet/mediatek/mtk_ppe.c:95:6: note: 'byte_cnt_low' declared here 95 | u32 byte_cnt_low, byte_cnt_high, pkt_cnt_low, pkt_cnt_high; | ^ >> drivers/net/ethernet/mediatek/mtk_ppe.c:113:3: error: use of undeclared identifier 'bytes_cnt_high'; did you mean 'byte_cnt_high'? 113 | bytes_cnt_high = cnt_r1; | ^~~~~~~~~~~~~~ | byte_cnt_high drivers/net/ethernet/mediatek/mtk_ppe.c:95:20: note: 'byte_cnt_high' declared here 95 | u32 byte_cnt_low, byte_cnt_high, pkt_cnt_low, pkt_cnt_high; | ^ 6 warnings and 2 errors generated. vim +112 drivers/net/ethernet/mediatek/mtk_ppe.c 92 93 static int mtk_mib_entry_read(struct mtk_ppe *ppe, u16 index, u64 *bytes, u64 *packets) 94 { 95 u32 byte_cnt_low, byte_cnt_high, pkt_cnt_low, pkt_cnt_high; 96 u32 val, cnt_r0, cnt_r1, cnt_r2; 97 int ret; 98 99 val = FIELD_PREP(MTK_PPE_MIB_SER_CR_ADDR, index) | MTK_PPE_MIB_SER_CR_ST; 100 ppe_w32(ppe, MTK_PPE_MIB_SER_CR, val); 101 102 ret = mtk_ppe_mib_wait_busy(ppe); 103 if (ret) 104 return ret; 105 106 cnt_r0 = readl(ppe->base + MTK_PPE_MIB_SER_R0); 107 cnt_r1 = readl(ppe->base + MTK_PPE_MIB_SER_R1); 108 cnt_r2 = readl(ppe->base + MTK_PPE_MIB_SER_R2); 109 110 if (mtk_is_netsys_v3_or_greater(ppe->eth)) { 111 /* 64 bit for each counter */ > 112 bytes_cnt_low = cnt_r0; > 113 bytes_cnt_high = cnt_r1; 114 pkt_cnt_low = cnt_r2; 115 pkt_cnt_high = readl(ppe->base + MTK_PPE_MIB_SER_R3); 116 } else { 117 /* 48 bit for each counter */ 118 byte_cnt_low = FIELD_GET(MTK_PPE_MIB_SER_R0_BYTE_CNT_LOW, cnt_r0); 119 byte_cnt_high = FIELD_GET(MTK_PPE_MIB_SER_R1_BYTE_CNT_HIGH, cnt_r1); 120 pkt_cnt_low = FIELD_GET(MTK_PPE_MIB_SER_R1_PKT_CNT_LOW, cnt_r1); 121 pkt_cnt_high = FIELD_GET(MTK_PPE_MIB_SER_R2_PKT_CNT_HIGH, cnt_r2); 122 } 123 124 *bytes = ((u64)byte_cnt_high << 32) | byte_cnt_low; 125 *packets = (pkt_cnt_high << 16) | pkt_cnt_low; 126 127 return 0; 128 } 129
Hi Daniel, 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/Daniel-Golle/net-ethernet-mtk_eth_soc-support-per-flow-accounting-on-MT7988/20230729-215634 base: net-next/main patch link: https://lore.kernel.org/r/801c89963e95e5ce8f1ab7dbda894dd9da0125cc.1690638748.git.daniel%40makrotopia.org patch subject: [PATCH net-next] net: ethernet: mtk_eth_soc: support per-flow accounting on MT7988 config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230730/202307300133.j8MIsDCa-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce: (https://download.01.org/0day-ci/archive/20230730/202307300133.j8MIsDCa-lkp@intel.com/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 <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202307300133.j8MIsDCa-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/net/ethernet/mediatek/mtk_ppe.c: In function 'mtk_mib_entry_read': >> drivers/net/ethernet/mediatek/mtk_ppe.c:112:17: error: 'bytes_cnt_low' undeclared (first use in this function); did you mean 'byte_cnt_low'? 112 | bytes_cnt_low = cnt_r0; | ^~~~~~~~~~~~~ | byte_cnt_low drivers/net/ethernet/mediatek/mtk_ppe.c:112:17: note: each undeclared identifier is reported only once for each function it appears in >> drivers/net/ethernet/mediatek/mtk_ppe.c:113:17: error: 'bytes_cnt_high' undeclared (first use in this function); did you mean 'byte_cnt_high'? 113 | bytes_cnt_high = cnt_r1; | ^~~~~~~~~~~~~~ | byte_cnt_high vim +112 drivers/net/ethernet/mediatek/mtk_ppe.c 92 93 static int mtk_mib_entry_read(struct mtk_ppe *ppe, u16 index, u64 *bytes, u64 *packets) 94 { 95 u32 byte_cnt_low, byte_cnt_high, pkt_cnt_low, pkt_cnt_high; 96 u32 val, cnt_r0, cnt_r1, cnt_r2; 97 int ret; 98 99 val = FIELD_PREP(MTK_PPE_MIB_SER_CR_ADDR, index) | MTK_PPE_MIB_SER_CR_ST; 100 ppe_w32(ppe, MTK_PPE_MIB_SER_CR, val); 101 102 ret = mtk_ppe_mib_wait_busy(ppe); 103 if (ret) 104 return ret; 105 106 cnt_r0 = readl(ppe->base + MTK_PPE_MIB_SER_R0); 107 cnt_r1 = readl(ppe->base + MTK_PPE_MIB_SER_R1); 108 cnt_r2 = readl(ppe->base + MTK_PPE_MIB_SER_R2); 109 110 if (mtk_is_netsys_v3_or_greater(ppe->eth)) { 111 /* 64 bit for each counter */ > 112 bytes_cnt_low = cnt_r0; > 113 bytes_cnt_high = cnt_r1; 114 pkt_cnt_low = cnt_r2; 115 pkt_cnt_high = readl(ppe->base + MTK_PPE_MIB_SER_R3); 116 } else { 117 /* 48 bit for each counter */ 118 byte_cnt_low = FIELD_GET(MTK_PPE_MIB_SER_R0_BYTE_CNT_LOW, cnt_r0); 119 byte_cnt_high = FIELD_GET(MTK_PPE_MIB_SER_R1_BYTE_CNT_HIGH, cnt_r1); 120 pkt_cnt_low = FIELD_GET(MTK_PPE_MIB_SER_R1_PKT_CNT_LOW, cnt_r1); 121 pkt_cnt_high = FIELD_GET(MTK_PPE_MIB_SER_R2_PKT_CNT_HIGH, cnt_r2); 122 } 123 124 *bytes = ((u64)byte_cnt_high << 32) | byte_cnt_low; 125 *packets = (pkt_cnt_high << 16) | pkt_cnt_low; 126 127 return 0; 128 } 129
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 05be702f19c5e..1b89f800f6dff 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -5064,6 +5064,7 @@ static const struct mtk_soc_data mt7988_data = { .version = 3, .offload_version = 2, .hash_offset = 4, + .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V3_SIZE, .txrx = { .txd_size = sizeof(struct mtk_tx_dma_v2), diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c index bf1ecb0c1c109..1ec508bb206bf 100644 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c @@ -107,10 +107,20 @@ static int mtk_mib_entry_read(struct mtk_ppe *ppe, u16 index, u64 *bytes, u64 *p cnt_r1 = readl(ppe->base + MTK_PPE_MIB_SER_R1); cnt_r2 = readl(ppe->base + MTK_PPE_MIB_SER_R2); - byte_cnt_low = FIELD_GET(MTK_PPE_MIB_SER_R0_BYTE_CNT_LOW, cnt_r0); - byte_cnt_high = FIELD_GET(MTK_PPE_MIB_SER_R1_BYTE_CNT_HIGH, cnt_r1); - pkt_cnt_low = FIELD_GET(MTK_PPE_MIB_SER_R1_PKT_CNT_LOW, cnt_r1); - pkt_cnt_high = FIELD_GET(MTK_PPE_MIB_SER_R2_PKT_CNT_HIGH, cnt_r2); + if (mtk_is_netsys_v3_or_greater(ppe->eth)) { + /* 64 bit for each counter */ + bytes_cnt_low = cnt_r0; + bytes_cnt_high = cnt_r1; + pkt_cnt_low = cnt_r2; + pkt_cnt_high = readl(ppe->base + MTK_PPE_MIB_SER_R3); + } else { + /* 48 bit for each counter */ + byte_cnt_low = FIELD_GET(MTK_PPE_MIB_SER_R0_BYTE_CNT_LOW, cnt_r0); + byte_cnt_high = FIELD_GET(MTK_PPE_MIB_SER_R1_BYTE_CNT_HIGH, cnt_r1); + pkt_cnt_low = FIELD_GET(MTK_PPE_MIB_SER_R1_PKT_CNT_LOW, cnt_r1); + pkt_cnt_high = FIELD_GET(MTK_PPE_MIB_SER_R2_PKT_CNT_HIGH, cnt_r2); + } + *bytes = ((u64)byte_cnt_high << 32) | byte_cnt_low; *packets = (pkt_cnt_high << 16) | pkt_cnt_low; diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_regs.h b/drivers/net/ethernet/mediatek/mtk_ppe_regs.h index a2e61b3eb006d..3ce088eef0efd 100644 --- a/drivers/net/ethernet/mediatek/mtk_ppe_regs.h +++ b/drivers/net/ethernet/mediatek/mtk_ppe_regs.h @@ -163,6 +163,8 @@ enum { #define MTK_PPE_MIB_SER_R2 0x348 #define MTK_PPE_MIB_SER_R2_PKT_CNT_HIGH GENMASK(23, 0) +#define MTK_PPE_MIB_SER_R3 0x34c + #define MTK_PPE_MIB_CACHE_CTL 0x350 #define MTK_PPE_MIB_CACHE_CTL_EN BIT(0) #define MTK_PPE_MIB_CACHE_CTL_FLUSH BIT(2)
NETSYS_V3 uses 64 bits for each counters while older SoCs were using 48 bits for each counter. Support reading per-flow byte and package counters on NETSYS_V3. Signed-off-by: Daniel Golle <daniel@makrotopia.org> --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 1 + drivers/net/ethernet/mediatek/mtk_ppe.c | 18 ++++++++++++++---- drivers/net/ethernet/mediatek/mtk_ppe_regs.h | 2 ++ 3 files changed, 17 insertions(+), 4 deletions(-)