lkml.org 
[lkml]   [2020]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH net-next 3/7] ethtool: set message mask with DEBUG_SET request
    On Sun, Jan 26, 2020 at 11:11:07PM +0100, Michal Kubecek wrote:
    > Implement DEBUG_SET netlink request to set debugging settings for a device.
    > At the moment, only message mask corresponding to message level as set by
    > ETHTOOL_SMSGLVL ioctl request can be set. (It is called message level in
    > ioctl interface but almost all drivers interpret it as a bit mask.)
    >
    > Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
    > +int ethnl_set_debug(struct sk_buff *skb, struct genl_info *info)
    > +{
    > + struct nlattr *tb[ETHTOOL_A_DEBUG_MAX + 1];
    > + struct ethnl_req_info req_info = {};
    > + struct net_device *dev;
    > + bool mod = false;
    > + u32 msg_mask;
    > + int ret;
    > +
    > + ret = nlmsg_parse(info->nlhdr, GENL_HDRLEN, tb,
    > + ETHTOOL_A_DEBUG_MAX, debug_set_policy,
    > + info->extack);
    > + if (ret < 0)
    > + return ret;
    > + ret = ethnl_parse_header(&req_info, tb[ETHTOOL_A_DEBUG_HEADER],
    > + genl_info_net(info), info->extack, true);
    > + if (ret < 0)
    > + return ret;
    > + dev = req_info.dev;
    > + if (!dev->ethtool_ops->get_msglevel || !dev->ethtool_ops->set_msglevel)
    > + return -EOPNOTSUPP;

    This seems like a new requirement, that both get and set callbacks are
    implemented. However, A quick look thought the code suggests all
    drivers already do have both get and set. So i think this is safe.

    Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

    \
     
     \ /
      Last update: 2020-01-27 01:22    [W:2.726 / U:0.108 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site