netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Ben Hutchings <ben@decadent.org.uk>
Cc: David Miller <davem@davemloft.net>,
	_govind@gmx.com, netdev@vger.kernel.org, ssujith@cisco.com,
	benve@cisco.com
Subject: Re: [PATCH net-next v2 2/3] ethtool: Add support for DMA buffer settings
Date: Sat, 2 Aug 2014 07:26:07 -0700	[thread overview]
Message-ID: <20140802072607.6eec3334@haswell.linuxnetplumber.net> (raw)
In-Reply-To: <1406987782.30258.43.camel@deadeye.wl.decadent.org.uk>

On Sat, 02 Aug 2014 14:56:22 +0100
Ben Hutchings <ben@decadent.org.uk> wrote:

> On Wed, 2014-07-30 at 17:53 -0700, David Miller wrote:
> > From: Govindarajulu Varadarajan <_govind@gmx.com>
> > Date: Tue, 29 Jul 2014 17:10:38 +0530
> > 
> > > @@ -440,6 +440,20 @@ struct ethtool_ringparam {
> > >  };
> > >  
> > >  /**
> > > + * struct ethtool_buffparam - DMA buffer parameters
> > > + * @rx_copybreak_cur: current receive DMA buff rx_copybreak.
> > > + * @rx_copybreak_min: min rx_copybreak set by driver.
> > > + * @rx_copybreak_max: Max rx_copybreak set by driver.
> > > + * @reserved: reserve room for future use.
> > > + */
> > > +struct ethtool_buffparam {
> > > +	__u32	cmd;
> > > +	__u32	rx_copybreak_cur;
> > > +	__u32	rx_copybreak_max;
> > > +	__u8	reserved[84];
> > > +};
> > 
> > I don't understand the reasoning behind this reserved field.
> > 
> > You can't use it to add more fields later, because right now
> > we'll let the user put any garbage there and thus if you add
> > more fields that garbage from older apps would be interpreted
> > as one of the new values.
> 
> That's OK, we can test that they're all zero.  Or add flags.
> 
> > Largely we have not been adding reserved fields to new ethtool
> > structures, and this is the primary reason I guess.
> 
> Yes we have, but not consistently.
> 
> > It's a shame that when we want to add a new 32-bit knob we have
> > to add an entire new struct.
> > 
> > We have ethtool_value, but that's only good for one knob at a time and
> > we have to allocate an entire new ethtool command value for each such
> > knob.
> 
> Two commands and two function pointers!
> 
> > I really don't know what the recommend here.
> > 
> > However I wonder what value that "max" thing has, I think setting the
> > value to infinity is just fine, it just means every packet will be
> > copied.
> > 
> > So if we remove the 'max', we just have the copybreak itself, and you
> > can therefore use ethtool_value and allocate the ethtool command
> > numbers.
> > 
> > What do you think?
> 
> 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).
> 
> Ben.
> 

Looks like you just reinvented netlink :-)

I wish ethtool would die.
It has fixed size static structures and has no notification mechanism.

If we could just get all the ethtool features into netlink, under IF_LINK
then most of this could go away.

  reply	other threads:[~2014-08-02 14:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-29 11:40 [PATCH net-next v2 0/3] enic: Add support for rx_copybreak Govindarajulu Varadarajan
2014-07-29 11:40 ` [PATCH net-next v2 1/3] enic: implement rx_copybreak Govindarajulu Varadarajan
2014-07-29 11:40 ` [PATCH net-next v2 2/3] ethtool: Add support for DMA buffer settings Govindarajulu Varadarajan
2014-07-31  0:53   ` David Miller
2014-07-31 22:03     ` Govindarajulu Varadarajan
2014-08-02 13:56     ` Ben Hutchings
2014-08-02 14:26       ` Stephen Hemminger [this message]
2014-08-02 15:06         ` Ben Hutchings
2014-08-07 21:56           ` Govindarajulu Varadarajan
2014-08-04 22:15       ` David Miller
2014-07-29 11:40 ` [PATCH net-next v2 3/3] enic: add ethtool support set/show rx_copybreak Govindarajulu Varadarajan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140802072607.6eec3334@haswell.linuxnetplumber.net \
    --to=stephen@networkplumber.org \
    --cc=_govind@gmx.com \
    --cc=ben@decadent.org.uk \
    --cc=benve@cisco.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=ssujith@cisco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).