netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: kvm@vger.kernel.org, netdev@vger.kernel.org,
	virtualization@lists.linux-foundation.org, wexu@redhat.com,
	stefanha@redhat.com
Subject: Re: [PATCH V4 net-next 3/3] tun: rx batching
Date: Mon, 9 Jan 2017 10:39:55 +0800	[thread overview]
Message-ID: <bff99f2f-8293-0dda-1db1-881e555f3623@redhat.com> (raw)
In-Reply-To: <20170106214323-mutt-send-email-mst@kernel.org>



On 2017年01月07日 03:47, Michael S. Tsirkin wrote:
>> +static int tun_get_coalesce(struct net_device *dev,
>> +			    struct ethtool_coalesce *ec)
>> +{
>> +	struct tun_struct *tun = netdev_priv(dev);
>> +
>> +	ec->rx_max_coalesced_frames = tun->rx_batched;
>> +
>> +	return 0;
>> +}
>> +
>> +static int tun_set_coalesce(struct net_device *dev,
>> +			    struct ethtool_coalesce *ec)
>> +{
>> +	struct tun_struct *tun = netdev_priv(dev);
>> +
>> +	if (ec->rx_max_coalesced_frames > NAPI_POLL_WEIGHT)
>> +		return -EINVAL;
> So what should userspace do? Keep trying until it succeeds?
> I think it's better to just use NAPI_POLL_WEIGHT instead and DTRT here.
>

Well, looking at how set_coalesce is implemented in other drivers, 
-EINVAL is usually used when user give a value that exceeds the 
limitation. For tuntap, what missed here is probably just a 
documentation for coalescing in tuntap.txt. (Or extend ethtool to return 
the max value). This seems much better than silently reduce the value to 
the limitation.

Thanks
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2017-01-09  2:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-06  2:13 [PATCH V4 net-next 0/3] vhost_net tx batching Jason Wang
2017-01-06  2:13 ` [PATCH V4 net-next 1/3] vhost: better detection of available buffers Jason Wang
2017-01-06 19:55   ` Michael S. Tsirkin
2017-01-09  2:59     ` Jason Wang
2017-01-09 23:10       ` Michael S. Tsirkin
2017-01-10  2:22         ` Jason Wang
2017-01-10  2:57           ` Michael S. Tsirkin
2017-01-06  2:13 ` [PATCH V4 net-next 2/3] vhost_net: tx batching Jason Wang
2017-01-06  2:13 ` [PATCH V4 net-next 3/3] tun: rx batching Jason Wang
2017-01-06 19:47   ` Michael S. Tsirkin
2017-01-09  2:39     ` Jason Wang [this message]
2017-01-09 23:12       ` Michael S. Tsirkin
2017-01-10  2:24         ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bff99f2f-8293-0dda-1db1-881e555f3623@redhat.com \
    --to=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=stefanha@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=wexu@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).