Re: [RFC PATCH] net: devlink: devlink_nl_info_fill: populate default information

From
Jakub Kicinski <kuba@kernel.org>
Date
2022-11-23 04:13:23
Also in
lkml
Reply to
Vincent Mailhol, 2022-11-22
On Wed, 23 Nov 2022 00:49:34 +0900 Vincent Mailhol wrote:
quoted hunk ↗ jump to hunk
 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
quoted hunk ↗ jump to hunk
 	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
quoted hunk ↗ jump to hunk
+	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;
+	}
Thread (37 messages) 37 messages, 5 authors, last reply 2022-11-28
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help