[PATCH v9 03/25] net/ethtool: add ULP_DDP_{GET,SET} operations for caps and stats

Jakub Kicinski kuba at kernel.org
Tue Jan 24 11:55:38 PST 2023


On Tue, 24 Jan 2023 14:07:12 +0200 Aurelien Aptel wrote:
> Jakub Kicinski <kuba at kernel.org> writes:
> > But this is not how they should be carried.
> >
> > The string set is retrieved by a separate command, then you request
> > a string based on the attribute ID (global_stringset() + get_string()
> > in ethtool CLI code).
> >
> > That way long running code or code dumping muliple interfaces can load
> > strings once and dumps are kept smaller.  
> 
> As far as I understand, this is what our code is doing, it is aligned
> with the feature bits implementation and its usage of bitsets.
> 
> Features use netlink bitsets which have a verbose (include literal
> strings) and compact form (use stringset ID).
> 
> Similarly our stats have a verbose (literal strings) and compact
> form (use implicit stringset ID).
> 
> In the compact form, since we always return the complete stats list the
> string id is implicit: the first stat is string id 0, next one string id
> 1, and so on. We just return the complete stat array as a blob under
> "COMPACT_VALUES".
> 
> In ethtool CLI we are using the compact form and calling
> global_stringset() + get_string() as you suggested:
> 
> 	stat_names = global_stringset(ETH_SS_ULP_DDP_STATS,
> 				      nlctx->ethnl2_socket);
> 
> Then later:
> 
> 	for (i = 0; i < results.stat_count; i++) {
> 		const char *name = get_string(stat_names, i);
> 		printf("%s: %lu\n", name, results.stats[i]);
> 	}
> 
> See
> https://github.com/aaptel/ethtool/blob/ulp-ddp-v9/netlink/ulp_ddp.c#L186-L189
> https://github.com/aaptel/ethtool/blob/ulp-ddp-v9/netlink/ulp_ddp.c#L154-L157
> 
> Should we remove the verbose form?

Yes, it just complicates the kernel code to no significant gain, IMO.



More information about the Linux-nvme mailing list