Add support for IFCOUNTER_IPACKETS, IFCOUNTER_OPACKETS, IFCOUNTER_OBYTES, IFCOUNTER_OMCASTS, IFCOUNTER_OERRORS, and IFCOUNTER_OQDROPS.
This allows tools like systat to report the incoming and outgoing bandwidth.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Tools like systat don't use interface specific ways to access the number of bytes sent / received but use the generic method of interface counters.
See The if_data Structure section in ifnet.9.
I see the code of this driver the first time, but incrementing IFCOUNTER_OERRORS everywhere where tx_dropped is incremented makes sense. The positions of the lines where the other IFCOUNTER_* counters are incremented seems correct to me as well.
In my view these counters are standard counters provided by an interface driver. Could you elaborate why you want them to be available only under certain conditions, for example debugging? What is the drawback to support them?
If we don't want to support them, I would prefer to document that (for example in the BUGS section of the man page) instead of providing them under some condition.
Would you prefer base the numbers reported by the if_counter interface on the counters you already have? I can implement it that way, if you prefer.
I double checked, the counters are part of the information provided by the ioctl SIOCGIFDATA.
Okay, I see. if_inc_counter() is implemented with counter_u64_add which is atomic on arm64, i.e. no synchronization is required. I don't think there's noticeable overhead either, i.e. lgtm.
Has anyone looked if we can now remove some of the manual counters in the dpni sysctl.
I cannot remember what was manually added there.
I have a patch to export the full set of hardware counters though vial sysctl, mostly for debugging or other data gathering.
I double checked, the counters are part of the information provided by the ioctl SIOCGIFDATA.
I did not. Happy to clean things up.
I cannot remember what was manually added there.
I have a patch to export the full set of hardware counters though vial sysctl, mostly for debugging or other data gathering.
Please put it up for review. I am happy to have a look if we can use these for at least some of the IFCOUNTERs by using
a function to be installed via if_setgetcounterfn().