On Thu, Apr 13, 2017 at 06:50:42PM -0700, Jakub Kicinski wrote: >On Thu, 13 Apr 2017 17:48:18 +1000, Gavin Shan wrote: >> This creates /sys/kernel/debug/ncsi/<eth0>/stats to dump the NCSI >> packets sent and received over all packages and channels. It's useful >> to diagnose NCSI problems, especially when NCSI packages and channels >> aren't probed properly. The statistics can be gained from debugfs file >> as below: >> >> # cat /sys/kernel/debug/ncsi/eth0/stats >> >> CMD OK TIMEOUT ERROR >> ======================================= >> CIS 32 29 0 >> SP 10 7 0 >> DP 17 14 0 >> EC 1 0 0 >> ECNT 1 0 0 >> AE 1 0 0 >> GLS 11 0 0 >> SMA 1 0 0 >> EBF 1 0 0 >> GVI 2 0 0 >> GC 2 0 0 >> >> RSP OK TIMEOUT ERROR >> ======================================= >> CIS 3 0 0 >> SP 3 0 0 >> DP 2 0 1 >> EC 1 0 0 >> ECNT 1 0 0 >> AE 1 0 0 >> GLS 11 0 0 >> SMA 1 0 0 >> EBF 1 0 0 >> GVI 0 0 2 >> GC 2 0 0 >> >> AEN OK TIMEOUT ERROR >> ======================================= >> >> Signed-off-by: Gavin Shan <gws...@linux.vnet.ibm.com> > >I'm not familiar with NC-SI but these look like some standard stats. >Would it make sense to provide a proper netlink API for them? > >[...] >> +#ifdef CONFIG_NET_NCSI_DEBUG >> + ndp->stats.aen[h->type][NCSI_PKT_STAT_ERROR]++; >> +#endif > >In any case, did you consider creating a macro or inline helper to >limit the number of #ifdefs? >
Jakub, thanks for the comments. NCSI does have standard statistics about the packets passed to peer (NIC) or NCSI packets handled by hardware. I have some patches (not posted yet and won't post in this merge window) to create debugfs file ncsi/eth0/p0/c0/stats and dump them there. This debugfs tracks NCSI packets sent and received by software in order to see if the software has obvious bugs. Yeah, it's definitely worthy to eliminate the #ifdef's. I'll do in next respin. Thanks, Gavin