On Thu, 2015-12-17 at 06:51 +0000, kan.li...@intel.com wrote:
[...]
> --- a/net/core/ethtool.c
> +++ b/net/core/ethtool.c
> @@ -1778,6 +1778,37 @@ static int ethtool_get_per_queue_coalesce(struct 
> net_device *dev,
>       return 0;
>  }
>  
> +static int ethtool_set_per_queue_coalesce(struct net_device *dev,
> +                                       void __user *useraddr,
> +                                       struct ethtool_per_queue_op 
> *per_queue_opt)
> +{
> +     u64 queue_mask;
> +     int bit, i, ret;
> +
> +     if (!dev->ethtool_ops->set_per_queue_coalesce)
> +             return -EOPNOTSUPP;
> +
> +     useraddr += sizeof(*per_queue_opt);
> +     for (i = 0; i < MAX_QUEUE_MASK; i++) {
> +             queue_mask = per_queue_opt->queue_mask[i];
> +             if (queue_mask > 0) {
> +                     for_each_set_bit(bit, (unsigned long *)&queue_mask, 64) 
> {
> +                             struct ethtool_coalesce coalesce;
> +
> +                             if (copy_from_user(&coalesce, useraddr, 
> sizeof(coalesce)))
> +                                     return -EFAULT;
> +
> +                             ret = 
> dev->ethtool_ops->set_per_queue_coalesce(dev, bit + i * 64, &coalesce);
> +                             if (ret != 0)
> +                                     return ret;
[...]

So there's no attempt to roll back on failure?

Then, what is the benefit of doing this iteration in the kernel rather
than userland?

Ben.

-- 
Ben Hutchings
Always try to do things in chronological order;
it's less confusing that way.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to