[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221122201246.0276680f@kernel.org>
Date: Tue, 22 Nov 2022 20:12:46 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Vincent Mailhol <mailhol.vincent@...adoo.fr>
Cc: Jiri Pirko <jiri@...dia.com>, netdev@...r.kernel.org,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH] net: devlink: devlink_nl_info_fill: populate
default information
On Wed, 23 Nov 2022 00:49:34 +0900 Vincent Mailhol wrote:
> static int
> devlink_nl_info_fill(struct sk_buff *msg, struct devlink *devlink,
> enum devlink_command cmd, u32 portid,
> u32 seq, int flags, struct netlink_ext_ack *extack)
> {
> struct devlink_info_req req = {};
> + struct device *dev = devlink_to_dev(devlink);
nit: longest to shortest lines
> void *hdr;
> int err;
>
> @@ -6707,6 +6733,16 @@ devlink_nl_info_fill(struct sk_buff *msg, struct devlink *devlink,
> if (err)
> goto err_cancel_msg;
>
> + err = devlink_nl_driver_info_get(dev->driver, &req);
> + if (err)
> + goto err_cancel_msg;
won't this result in repeated attributes, potentially?
Unlike ethtool which copies data into a struct devlink
adds an attribute each time you request. It does not override.
So we need to extend req with some tracking of whether driver
already put in the info in question
> + if (!strcmp(dev->parent->type->name, "usb_device")) {
> + err = devlink_nl_usb_info_get(to_usb_device(dev->parent), &req);
> + if (err)
> + goto err_cancel_msg;
> + }
Powered by blists - more mailing lists