netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Vivien Didelot <vivien.didelot@gmail.com>
Cc: David Miller <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	Florian Fainelli <f.fainelli@gmail.com>
Subject: Re: [PATCH v2 net-next 1/2] net: dsa: Add support for devlink device parameters
Date: Sat, 5 Oct 2019 02:52:35 +0200	[thread overview]
Message-ID: <20191005005235.GG3817@lunn.ch> (raw)
In-Reply-To: <20191004202122.GD32368@t480s.localdomain>

On Fri, Oct 04, 2019 at 08:21:22PM -0400, Vivien Didelot wrote:
> On Fri,  4 Oct 2019 23:09:33 +0200, Andrew Lunn <andrew@lunn.ch> wrote:
> > Add plumbing to allow DSA drivers to register parameters with devlink.
> > 
> > To keep with the abstraction, the DSA drivers pass the ds structure to
> > these helpers, and the DSA core then translates that to the devlink
> > structure associated to the device.
> > 
> > Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> > ---
> >  include/net/dsa.h | 23 +++++++++++++++++++++++
> >  net/dsa/dsa.c     | 48 +++++++++++++++++++++++++++++++++++++++++++++++
> >  net/dsa/dsa2.c    |  7 ++++++-
> >  3 files changed, 77 insertions(+), 1 deletion(-)
> > 
> > diff --git a/include/net/dsa.h b/include/net/dsa.h
> > index 8c3ea0530f65..6623f4428930 100644
> > --- a/include/net/dsa.h
> > +++ b/include/net/dsa.h
> > @@ -541,6 +541,29 @@ struct dsa_switch_ops {
> >  	 */
> >  	netdev_tx_t (*port_deferred_xmit)(struct dsa_switch *ds, int port,
> >  					  struct sk_buff *skb);
> > +	/* Devlink parameters */
> > +	int	(*devlink_param_get)(struct dsa_switch *ds, u32 id,
> > +				     struct devlink_param_gset_ctx *ctx);
> > +	int	(*devlink_param_set)(struct dsa_switch *ds, u32 id,
> > +				     struct devlink_param_gset_ctx *ctx);
> 
> Unless that is how devlink is designed, shouldn't ctx be const on _set?

It is the way devlink is designed. The devlink structure is

truct devlink_param {
        u32 id;
        const char *name;
        bool generic;
        enum devlink_param_type type;
        unsigned long supported_cmodes;
        int (*get)(struct devlink *devlink, u32 id,
                   struct devlink_param_gset_ctx *ctx);
        int (*set)(struct devlink *devlink, u32 id,
                   struct devlink_param_gset_ctx *ctx);
        int (*validate)(struct devlink *devlink, u32 id,
                        union devlink_param_value val,
                        struct netlink_ext_ack *extack);
};

No const on set.

   Andrew

  reply	other threads:[~2019-10-05  0:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-04 21:09 [PATCH v2 net-next 0/2] mv88e6xxx: Allow config of ATU hash algorithm Andrew Lunn
2019-10-04 21:09 ` [PATCH v2 net-next 1/2] net: dsa: Add support for devlink device parameters Andrew Lunn
2019-10-05  0:21   ` Vivien Didelot
2019-10-05  0:52     ` Andrew Lunn [this message]
2019-10-04 21:09 ` [PATCH v2 net-next 2/2] net: dsa: mv88e6xxx: Add devlink param for ATU hash algorithm Andrew Lunn
2019-10-04 21:32   ` Jakub Kicinski
2019-10-04 21:40     ` Andrew Lunn
2019-10-05  0:32   ` Vivien Didelot

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=20191005005235.GG3817@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@gmail.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).