netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: netdev@vger.kernel.org, Vladislav Yasevich <vyasevich@gmail.com>,
	virtualization@lists.linux-foundation.org, edumazet@google.com,
	Ben Hutchings <ben@decadent.org.uk>
Subject: Re: [PATCH 1/3] ipv6: Select fragment id during UFO/GSO segmentation if not set.
Date: Tue, 27 Jan 2015 18:08:08 +0200	[thread overview]
Message-ID: <20150127160808.GA10765@redhat.com> (raw)
In-Reply-To: <1422374551.13969.35.camel@stressinduktion.org>

On Tue, Jan 27, 2015 at 05:02:31PM +0100, Hannes Frederic Sowa wrote:
> On Di, 2015-01-27 at 09:26 -0500, Vlad Yasevich wrote:
> > On 01/27/2015 08:47 AM, Hannes Frederic Sowa wrote:
> > > On Di, 2015-01-27 at 10:42 +0200, Michael S. Tsirkin wrote:
> > >> On Tue, Jan 27, 2015 at 02:47:54AM +0000, Ben Hutchings wrote:
> > >>> On Mon, 2015-01-26 at 09:37 -0500, Vladislav Yasevich wrote:
> > >>>> If the IPv6 fragment id has not been set and we perform
> > >>>> fragmentation due to UFO, select a new fragment id.
> > >>>> When we store the fragment id into skb_shinfo, set the bit
> > >>>> in the skb so we can re-use the selected id.
> > >>>> This preserves the behavior of UFO packets generated on the
> > >>>> host and solves the issue of id generation for packet sockets
> > >>>> and tap/macvtap devices.
> > >>>>
> > >>>> This patch moves ipv6_select_ident() back in to the header file.  
> > >>>> It also provides the helper function that sets skb_shinfo() frag
> > >>>> id and sets the bit.
> > >>>>
> > >>>> It also makes sure that we select the fragment id when doing
> > >>>> just gso validation, since it's possible for the packet to
> > >>>> come from an untrusted source (VM) and be forwarded through
> > >>>> a UFO enabled device which will expect the fragment id.
> > >>>>
> > >>>> CC: Eric Dumazet <edumazet@google.com>
> > >>>> Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
> > >>>> ---
> > >>>>  include/linux/skbuff.h |  3 ++-
> > >>>>  include/net/ipv6.h     |  2 ++
> > >>>>  net/ipv6/ip6_output.c  |  4 ++--
> > >>>>  net/ipv6/output_core.c |  9 ++++++++-
> > >>>>  net/ipv6/udp_offload.c | 10 +++++++++-
> > >>>>  5 files changed, 23 insertions(+), 5 deletions(-)
> > >>>>
> > >>>> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> > >>>> index 85ab7d7..3ad5203 100644
> > >>>> --- a/include/linux/skbuff.h
> > >>>> +++ b/include/linux/skbuff.h
> > >>>> @@ -605,7 +605,8 @@ struct sk_buff {
> > >>>>  	__u8			ipvs_property:1;
> > >>>>  	__u8			inner_protocol_type:1;
> > >>>>  	__u8			remcsum_offload:1;
> > >>>> -	/* 3 or 5 bit hole */
> > >>>> +	__u8			ufo_fragid_set:1;
> > >>> [...]
> > >>>
> > >>> Doesn't the flag belong in struct skb_shared_info, rather than struct
> > >>> sk_buff?  Otherwise this looks fine.
> > >>>
> > >>> Ben.
> > >>
> > >> Hmm we seem to be out of tx flags.
> > >> Maybe ip6_frag_id == 0 should mean "not set".
> > > 
> > > Maybe that is the best idea. Definitely the ufo_fragid_set bit should
> > > move into the skb_shared_info area.
> > 
> > That's what I originally wanted to do, but had to move and grow txflags thus
> > skb_shinfo ended up growing.  I wanted to avoid that, so stole an skb flag.
> > 
> > I considered treating fragid == 0 as unset, but a 0 fragid is perfectly valid
> > from the protocol perspective and could actually be generated by the id generator
> > functions.  This may cause us to call the id generation multiple times.
> 
> Are there plans in the long run to let virtio_net transmit auxiliary
> data to the other end so we can clean all of this this up one day?
> 
> I don't like the whole situation: looking into the virtio_net headers
> just adding a field for ipv6 fragmentation ids to those small structs
> seems bloated, not doing it feels incorrect. :/
> 
> Thoughts?
> 
> Bye,
> Hannes

I'm not sure - what will be achieved by generating the IDs guest side as
opposed to host side?  It's certainly harder to get hold of entropy
guest-side.

-- 
MST

  reply	other threads:[~2015-01-27 16:08 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 14:37 [PATCH 0/3] Restore UFO support to virtio_net devices Vladislav Yasevich
2015-01-26 14:37 ` [PATCH 1/3] ipv6: Select fragment id during UFO/GSO segmentation if not set Vladislav Yasevich
2015-01-27  2:47   ` Ben Hutchings
2015-01-27  8:27     ` David Miller
2015-01-27  8:42     ` Michael S. Tsirkin
2015-01-27 13:47       ` Hannes Frederic Sowa
2015-01-27 14:26         ` Vlad Yasevich
2015-01-27 14:38           ` Eric Dumazet
2015-01-27 16:02           ` Hannes Frederic Sowa
2015-01-27 16:08             ` Michael S. Tsirkin [this message]
2015-01-28  8:25               ` Hannes Frederic Sowa
2015-01-28  9:46                 ` Michael S. Tsirkin
2015-01-28 10:34                   ` Hannes Frederic Sowa
2015-01-28 10:39                     ` Hannes Frederic Sowa
2015-01-28 13:43                     ` Michael S. Tsirkin
2015-01-28 14:17                       ` Hannes Frederic Sowa
2015-01-28 14:16                     ` Vlad Yasevich
2015-01-28 14:45                       ` Hannes Frederic Sowa
2015-01-28 15:27                         ` Vlad Yasevich
2015-01-28 15:49                           ` Michael S. Tsirkin
2015-01-28 16:00                     ` Michael S. Tsirkin
2015-01-28 16:15                       ` Hannes Frederic Sowa
2015-01-28 16:48                         ` Michael S. Tsirkin
2015-01-28 17:34                           ` Hannes Frederic Sowa
2015-01-28 17:24                   ` Ben Hutchings
2015-01-27 16:25             ` Vlad Yasevich
2015-01-26 14:37 ` [PATCH 2/3] Revert "drivers/net, ipv6: Select IPv6 fragment idents for virtio UFO packets" Vladislav Yasevich
2015-01-26 14:37 ` [PATCH 3/3] Revert "drivers/net: Disable UFO through virtio" Vladislav Yasevich
2015-01-27  2:51   ` Ben Hutchings
2015-01-26 15:28 ` [PATCH 0/3] Restore UFO support to virtio_net devices Michael S. Tsirkin
2015-01-26 15:32   ` 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=20150127160808.GA10765@redhat.com \
    --to=mst@redhat.com \
    --cc=ben@decadent.org.uk \
    --cc=edumazet@google.com \
    --cc=hannes@stressinduktion.org \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=vyasevich@gmail.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).