lkml.org 
[lkml]   [2022]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [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;
    > + }

    \
     
     \ /
      Last update: 2022-11-23 05:15    [W:3.355 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site