Re: [PATCH V4 net-next 4/4] net: hns3: support dump pfc frame statistics in tx timeout log

From: Jiri Pirko
Date: Tue Jan 09 2024 - 04:01:01 EST


Tue, Jan 09, 2024 at 09:19:48AM CET, shaojijie@xxxxxxxxxx wrote:
>
>on 2024/1/5 17:55, Jiri Pirko wrote:
>> > +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
>> > @@ -2871,8 +2871,10 @@ static bool hns3_get_tx_timeo_queue_info(struct net_device *ndev)
>> > struct hns3_mac_stats mac_stats;
>> >
>> > h->ae_algo->ops->get_mac_stats(h, &mac_stats);
>> > - netdev_info(ndev, "tx_pause_cnt: %llu, rx_pause_cnt: %llu\n",
>> > - mac_stats.tx_pause_cnt, mac_stats.rx_pause_cnt);
>> > + netdev_info(ndev,
>> > + "tx_pause_cnt: %llu, rx_pause_cnt: %llu, tx_pfc_cnt: %llu, rx_pfc_cnt: %llu\n",
>> > + mac_stats.tx_pause_cnt, mac_stats.rx_pause_cnt,
>> > + mac_stats.tx_pfc_cnt, mac_stats.rx_pfc_cnt);
>> Don't we have a better way to expose this? I mean, whenever there is a
>> patch that extends the amount of text written in dmesg, it smells.
>> We should rather reduce it.
>>
>In fact, we include this part of the statistics in the ethtool -S statistics.
>However, if tx timeout occurs,the driver performs a reset attempt to recover
>it. And the statistics are cleared after the reset. Therefore, pfc statistics
>are added to tx timeout log to determine the timeout cause.

Does not sound correct at all. You are basically forcing user to check
the dmesg to understand the behaviour of stats he gets from ethtool. You
can expose "reset"/"recover" counter through ethtool to expose this fact
rather than dmesg print. Please don't add dmesg print.

>
>