qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Anton Ivanov <anton.ivanov@cambridgegreys.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/3] Unified Datagram Socket Transport
Date: Wed, 19 Jul 2017 14:07:00 +0800	[thread overview]
Message-ID: <050e2865-0453-64d8-f29a-7b6d2bb418d9@redhat.com> (raw)
In-Reply-To: <89e2f26c-4e1d-05ef-9a99-85dc5c9c111a@cambridgegreys.com>



On 2017年07月19日 13:48, Anton Ivanov wrote:
>
>
> On 19/07/17 06:39, Jason Wang wrote:
>>
>>
>> On 2017年07月19日 01:08, anton.ivanov@cambridgegreys.com wrote:
>>> From: Anton Ivanov <anton.ivanov@cambridgegreys.com>
>>>
>>> 1. Creates a common backend for socket transports using
>>> recvmmsg().
>>> 2. Migrates L2TPv3 to the new backend
>>
>> It would be better if you could further split out 2 from this patch.
>>
>>>
>>> Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
>>> ---
>>>   configure         |  10 +-
>>>   net/Makefile.objs |   2 +-
>>>   net/l2tpv3.c      | 531 
>>> +++++++++---------------------------------------------
>>>   net/net.c         |   4 +-
>>>   net/unified.c     | 406 +++++++++++++++++++++++++++++++++++++++++
>>>   net/unified.h     | 118 ++++++++++++
>>>   6 files changed, 613 insertions(+), 458 deletions(-)
>>>   create mode 100644 net/unified.c
>>>   create mode 100644 net/unified.h
>>>
>>> diff --git a/configure b/configure
>>> index a3f0522e8f..99a60b723c 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -1862,7 +1862,7 @@ if ! compile_object -Werror ; then
>>>   fi
>>>     ##########################################
>>> -# L2TPV3 probe
>>> +# UNIFIED probe
>>>     cat > $TMPC <<EOF
>>>   #include <sys/socket.h>
>>> @@ -1870,9 +1870,9 @@ cat > $TMPC <<EOF
>>>   int main(void) { return sizeof(struct mmsghdr); }
>>>   EOF
>>>   if compile_prog "" "" ; then
>>> -  l2tpv3=yes
>>> +  unified=yes
>>>   else
>>> -  l2tpv3=no
>>> +  unified=no
>>>   fi
>>>     ##########################################
>>> @@ -5458,8 +5458,8 @@ fi
>>>   if test "$netmap" = "yes" ; then
>>>     echo "CONFIG_NETMAP=y" >> $config_host_mak
>>>   fi
>>> -if test "$l2tpv3" = "yes" ; then
>>> -  echo "CONFIG_L2TPV3=y" >> $config_host_mak
>>> +if test "$unified" = "yes" ; then
>>> +  echo "CONFIG_UNIFIED=y" >> $config_host_mak
>>>   fi
>>
>> Could we keep l2tpv3 option?
>
> The l2tpv3 test is actually a test for recvmmsg. If you can do one 
> recvmmsg transport you can do all of them.

Yes, but I wonder whether or not the check for recvmmsg is too simple. 
We probably want something like what AV_VSOCK did, test the support of 
each transport through socket().

>
>>
>>>   if test "$cap_ng" = "yes" ; then
>>>     echo "CONFIG_LIBCAP=y" >> $config_host_mak
>>> diff --git a/net/Makefile.objs b/net/Makefile.objs
>>> index 67ba5e26fb..8026ad778a 100644
>>> --- a/net/Makefile.objs
>>> +++ b/net/Makefile.objs
>>> @@ -2,7 +2,7 @@ common-obj-y = net.o queue.o checksum.o util.o hub.o
>>>   common-obj-y += socket.o
>>>   common-obj-y += dump.o
>>>   common-obj-y += eth.o
>>> -common-obj-$(CONFIG_L2TPV3) += l2tpv3.o
>>> +common-obj-$(CONFIG_UNIFIED) += l2tpv3.o unified.o
>>>   common-obj-$(CONFIG_POSIX) += vhost-user.o
>>>   common-obj-$(CONFIG_SLIRP) += slirp.o
>>>   common-obj-$(CONFIG_VDE) += vde.o

[...]

>>>>   -    s = DO_UPCAST(NetL2TPV3State, nc, nc);
>>>> +    s->params = p;
>>>>   +    s->form_header = &l2tpv3_form_header;
>>>> +    s->verify_header = &l2tpv3_verify_header;
>>>>       s->queue_head = 0;
>>>>       s->queue_tail = 0;
>>>>       s->header_mismatch = false;
>>>
>>> Why not move all above into qemu_new_unified_net()?
>
> Only queue head/tail assignment can move.
>
> raw which uses same backend does not use header_mismatch. Form/verify 
> header are different for each sub-transport. F.e. for gre you need the 
> gre one, for raw you need the raw one, etc.

Right, I mean pass function pointer to qemu_new_unified_net().

>
>>
>>> @@ -549,9 +188,9 @@ int net_init_l2tpv3(const Netdev *netdev,
>>>       l2tpv3 = &netdev->u.l2tpv3;
>>>         if (l2tpv3->has_ipv6 && l2tpv3->ipv6) {
>>> -        s->ipv6 = l2tpv3->ipv6;
>>> +        p->ipv6 = l2tpv3->ipv6;
>>>       } else {
>>> -        s->ipv6 = false;
>>> +        p->ipv6 = false;

[...]

>>>   diff --git a/net/unified.c b/net/unified.c
>>
>> Not a native speaker, but I think we need a better name here e.g udst 
>> which is short for Unified Datagram Socket Transport?
>
> I am not a native speaker either :)
>
> I am OK - let's call it udst as this is more descriptive and this 
> clearly delineates that you cannot
> migrate tcp/socket to it.

Ok.

>
>>
>>>

[...]

>>> +
>>> +static ssize_t net_unified_receive_dgram_iov(NetClientState *nc,
>>> +                    const struct iovec *iov,
>>> +                    int iovcnt)
>>> +{
>>> +    NetUnifiedState *s = DO_UPCAST(NetUnifiedState, nc, nc);
>>> +
>>> +    struct msghdr message;
>>> +    int ret;
>>> +
>>> +    if (iovcnt > MAX_UNIFIED_IOVCNT - 1) {
>>> +        error_report(
>>> +            "iovec too long %d > %d, change unified.h",
>>> +            iovcnt, MAX_UNIFIED_IOVCNT
>>> +        );
>>> +        return -1;
>>> +    }
>>> +    if (s->offset > 0) {
>>
>> net_l2tpv3_receive_dgram_iov() does not have this check. I guess it 
>> s->offset=0 will be used by other transport. Maybe it's better to 
>> delay this change until is has a real user or add a comment here.
>
> The real user is in patch No 2. Raw.

Ok.

Thanks.

  reply	other threads:[~2017-07-19  6:07 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-18 17:08 [Qemu-devel] Unified Socket Driver anton.ivanov
2017-07-18 17:08 ` [Qemu-devel] [PATCH 1/3] Unified Datagram Socket Transport anton.ivanov
2017-07-19  5:39   ` Jason Wang
2017-07-19  5:48     ` Anton Ivanov
2017-07-19  6:07       ` Jason Wang [this message]
2017-07-19  6:48         ` Anton Ivanov
2017-07-21 17:50     ` Anton Ivanov
2017-07-24  3:51       ` Jason Wang
2017-07-18 17:08 ` [Qemu-devel] [PATCH 2/3] Unified Datagram Socket Transport - GRE support anton.ivanov
2017-07-19  5:48   ` Jason Wang
2017-07-19  5:50     ` Anton Ivanov
2017-07-19 14:40   ` Eric Blake
2017-07-19 14:46     ` Anton Ivanov
2017-07-19 17:32     ` Anton Ivanov
2017-07-21 19:14       ` Eric Blake
2017-07-22  7:52         ` Anton Ivanov
2017-07-18 17:08 ` [Qemu-devel] [PATCH 3/3] Unified Datagram Socket Transport - raw support anton.ivanov
2017-07-19  5:58   ` Jason Wang
2017-07-19  6:02     ` Anton Ivanov
2017-07-21 18:50     ` Anton Ivanov
2017-07-24  4:03       ` Jason Wang
2017-09-08 17:22         ` Anton Ivanov
2017-07-19 14:42   ` Eric Blake

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=050e2865-0453-64d8-f29a-7b6d2bb418d9@redhat.com \
    --to=jasowang@redhat.com \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=qemu-devel@nongnu.org \
    /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).