From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Vlad Yasevich <vyasevic@redhat.com>
Cc: netdev@vger.kernel.org, mst@redhat.com
Subject: Re: [PATCH] macvtap: Correctly set tap features when IFF_VNET_HDR is disabled.
Date: Tue, 13 Aug 2013 22:05:45 +0400 [thread overview]
Message-ID: <520A7579.10601@cogentembedded.com> (raw)
In-Reply-To: <1376416558-25015-1-git-send-email-vyasevic@redhat.com>
Hello.
On 08/13/2013 09:55 PM, Vlad Yasevich wrote:
> When the user turns off IFF_VNET_HDR flag, attempts to change
> offload features via TUNSETOFFLOAD do not work. This could cause
> GSO packets to be delivered to the user when the user is
> not prepared to handle them.
> To solve, allow processing of TUNSETOFFLOAD when IFF_VNET_HDR is
> disabled and make sure to turn off all offloads in this case.
> Also, when IFF_VNET_HDR is disabled, run throught the offload change
> as well to make sure that the functionality is not dependent on
> the order of the ioclt() calls.
> Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
> ---
> drivers/net/macvtap.c | 27 +++++++++++++++++++--------
> 1 file changed, 19 insertions(+), 8 deletions(-)
> diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
> index a98fb0e..076b9e7 100644
> --- a/drivers/net/macvtap.c
> +++ b/drivers/net/macvtap.c
[...]
> @@ -1092,8 +1097,18 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd,
> if ((u & ~(IFF_VNET_HDR | IFF_MULTI_QUEUE)) !=
> (IFF_NO_PI | IFF_TAP))
> ret = -EINVAL;
> - else
> + else {
> + if ((q->flags ^ u) & IFF_VNET_HDR) {
> + /* vnet_hdr support impacts the offloads,
> + * so we need to run throught the offload
> + * change.
> + */
> + rtnl_lock();
> + ret = set_offload(q, 0);
> + rtnl_unlock();
> + }
> q->flags = u;
> + }
According to Documentation/CodingStyle, both arms of the *if* statement
should have {} if one arm has it.
WBR, Sergei
next prev parent reply other threads:[~2013-08-13 18:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-13 17:55 [PATCH] macvtap: Correctly set tap features when IFF_VNET_HDR is disabled Vlad Yasevich
2013-08-13 18:05 ` Sergei Shtylyov [this message]
2013-08-14 12:10 ` Michael S. Tsirkin
2013-08-14 14:07 ` Vlad Yasevich
2013-08-14 16:04 ` Vlad Yasevich
2013-08-14 17:43 ` Michael S. Tsirkin
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=520A7579.10601@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=vyasevic@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).