[PATCH net 1/7] net: hibmcge: fix incorrect pause frame statistics issue

Jijie Shao posted 7 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH net 1/7] net: hibmcge: fix incorrect pause frame statistics issue
Posted by Jijie Shao 1 month, 1 week ago
The driver supports pause frames,
but does not pass pause frames based on rx pause enable configuration,
resulting in incorrect pause frame statistics.

This patch fixes this problem.

Fixes: 3a03763f3876 ("net: hibmcge: Add pauseparam supported in this module")
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
---
 drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.c  | 3 +++
 drivers/net/ethernet/hisilicon/hibmcge/hbg_reg.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.c b/drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.c
index 74a18033b444..7d3bbd3e2adc 100644
--- a/drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.c
+++ b/drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.c
@@ -242,6 +242,9 @@ void hbg_hw_set_pause_enable(struct hbg_priv *priv, u32 tx_en, u32 rx_en)
 			    HBG_REG_PAUSE_ENABLE_TX_B, tx_en);
 	hbg_reg_write_field(priv, HBG_REG_PAUSE_ENABLE_ADDR,
 			    HBG_REG_PAUSE_ENABLE_RX_B, rx_en);
+
+	hbg_reg_write_field(priv, HBG_REG_REC_FILT_CTRL_ADDR,
+			    HBG_REG_REC_FILT_CTRL_PAUSE_FRM_PASS_B, rx_en);
 }
 
 void hbg_hw_get_pause_enable(struct hbg_priv *priv, u32 *tx_en, u32 *rx_en)
diff --git a/drivers/net/ethernet/hisilicon/hibmcge/hbg_reg.h b/drivers/net/ethernet/hisilicon/hibmcge/hbg_reg.h
index cc2cc612770d..fd623cfd13de 100644
--- a/drivers/net/ethernet/hisilicon/hibmcge/hbg_reg.h
+++ b/drivers/net/ethernet/hisilicon/hibmcge/hbg_reg.h
@@ -68,6 +68,7 @@
 #define HBG_REG_TRANSMIT_CTRL_AN_EN_B		BIT(5)
 #define HBG_REG_REC_FILT_CTRL_ADDR		(HBG_REG_SGMII_BASE + 0x0064)
 #define HBG_REG_REC_FILT_CTRL_UC_MATCH_EN_B	BIT(0)
+#define HBG_REG_REC_FILT_CTRL_PAUSE_FRM_PASS_B	BIT(4)
 #define HBG_REG_RX_OCTETS_TOTAL_OK_ADDR		(HBG_REG_SGMII_BASE + 0x0080)
 #define HBG_REG_RX_OCTETS_BAD_ADDR		(HBG_REG_SGMII_BASE + 0x0084)
 #define HBG_REG_RX_UC_PKTS_ADDR			(HBG_REG_SGMII_BASE + 0x0088)
-- 
2.33.0
Re: [PATCH net 1/7] net: hibmcge: fix incorrect pause frame statistics issue
Posted by Simon Horman 1 month, 1 week ago
On Wed, Apr 02, 2025 at 09:38:59PM +0800, Jijie Shao wrote:
> The driver supports pause frames,
> but does not pass pause frames based on rx pause enable configuration,
> resulting in incorrect pause frame statistics.

I think it would be worth explaining why pause frames need
to be passed through in order for statistics to be correct.
I.e. which entity is passing them through to which other
entity that counts them.

> This patch fixes this problem.
> 
> Fixes: 3a03763f3876 ("net: hibmcge: Add pauseparam supported in this module")
> Signed-off-by: Jijie Shao <shaojijie@huawei.com>

...
Re: [PATCH net 1/7] net: hibmcge: fix incorrect pause frame statistics issue
Posted by Jijie Shao 1 month, 1 week ago
on 2025/4/3 2:56, Simon Horman wrote:
> On Wed, Apr 02, 2025 at 09:38:59PM +0800, Jijie Shao wrote:
>> The driver supports pause frames,
>> but does not pass pause frames based on rx pause enable configuration,
>> resulting in incorrect pause frame statistics.
> I think it would be worth explaining why pause frames need
> to be passed through in order for statistics to be correct.
> I.e. which entity is passing them through to which other
> entity that counts them.

Yeah,This is the behavior of the MAC controller.
I'll describe it in v2

Thank you.
Jijie Shao

>
>> This patch fixes this problem.
>>
>> Fixes: 3a03763f3876 ("net: hibmcge: Add pauseparam supported in this module")
>> Signed-off-by: Jijie Shao <shaojijie@huawei.com>
> ...
>