Re: [PATCH net-next v2 2/3] ethtool: Add support for DMA buffer settings
From: David Miller <davem@davemloft.net>
Date: 2014-08-04 22:15:40
From: Ben Hutchings <redacted> Date: Sat, 02 Aug 2014 14:56:22 +0100
How about adding a generic operation for independent tunables:
struct ethtool_get_tunable {
u32 cmd;
u32 id;
u64 value, min, max;
};
struct ethtool_set_tunable {
u32 cmd;
u32 id;
u64 value;
};
int (*get_tunable)(struct net_device *, struct ethtool_get_tunable *);
int (*set_tunable)(struct net_device *, const struct ethtool_set_tunable *);
The id to name mapping could be provided either through a stringset or
macros in <uapi/linux/ethtool.h>. And perhaps we could split the id
space to allow for driver-specific tunables (while strongly discouraging
those for in-tree drivers).
That would certainly work, and another approach would be that we could
also create a tunable namespace of sorts.
struct ethtool_tunable {
u32 cmd;
u32 len;
u32 data[];
};
#define ETHTOOL_GTUNABLE x
#define ETHTOOL_STUNABLE y
...
#define ETHTOOL_TUNABLE_COPYBREAK 0x00000001 /* u32 */
etc.
I understand the reason to gravitate towards stringset, in that it would
minimize the amount of code needed in the ethtool utility itself.