On Fri, 10 May 2024 19:29:48 +0200 Morten Brørup <m...@smartsharesystems.com> wrote:
> ad, common functions are good. > > I'm somewhat skeptical about putting the stats structure first in the > rte_eth_dev_data's tx_queues and rx_queues. > These are void* because their types are private to the PMD. Putting the stats > structure first is somewhat a hack, partially removing that privacy. > Perhaps we can make it look less like a hack. After all, it is still a > private structure type, only the first part is public and must be the same > across drivers using the SW stats counters. Overlapping certain parts of a > private structure with a public structure is a common design pattern; I've > seen it used elsewhere in DPDK too. > If we get used to it for SW ethdev drivers, we might not consider it a hack > anymore. ;-) The tradeoff here, is putting them first allows for writing generic version of eth_stats_get and eth_stats_reset. Other option is having generic code take offset for tx/rx to find the stats. C doesn't have RTI like C++ so this was best I could think of.