qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Anton Ivanov (antivano)" <antivano@cisco.com>
To: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v5] net: L2TPv3 transport
Date: Wed, 26 Mar 2014 08:39:14 +0000	[thread overview]
Message-ID: <5332922B.6040408@cisco.com> (raw)
In-Reply-To: <20140326082453.GD25917@stefanha-thinkpad.muc.redhat.com>

[snip]
>> So the fact that qemu_send_packet_async() has returned a non-zero does not mean that we have not paid the price for it :) 
> A non-zero return is simply an error code from the ->receive() function.
> In this case the packet is dropped but queuing is unaffected.
>
>> The relevant code is in qemu_net_queue_append which invoked by
>> qemu_net_queue_send which is what qemu_send_packet_async calls.
> Are we interpreting the code differently?

Let me go through this once again and make sure it has the correct logic
in RX and TX direction.

In RX it should not use any of the queue.c functions as the message
vector doubles up for queue.

In TX it should still use them and still have _flush invoked where
needed as it is not using sendmmsg for now.

A.


>
>>>> +static void l2tpv3_writable(void *opaque)
>>>> +{
>>>> +    NetL2TPV3State *s = opaque;
>>>> +
>>>> +    l2tpv3_write_poll(s, false);
>>>> +
>>>> +    net_l2tpv3_send(s);
>>> This is the wrong function because net-l2tpv3_send() *reads* new packets
>>> from the socket.  We must tell the peer to resume transmitting packets
>>> so we can *write* them to the socket.
>>>
>>> This line should be:
>>> qemu_flush_queued_packets(&s->nc);
>> No.
>>
>> That function doubles for local buffer using the recvmmsg vector, there
>> is never any packets in the queue from queue.c to flush. The exact idea
>> here is to eliminate that queue as it is surplus to requirements if you
>> are doing multirx. If you are doing multirx (or packet mmap) your
>> packets are in a multi-packet buffer already. It is a perfect queue,
>> there is no need for another :)
>>
>> The send function is written so it picks up where it has left off last
>> time so any packets left over in the recvmmsg vector are flushed first
>> before any new reads.
> You're thinking about the wrong data transfer direction.  There are two
> queues:
> 1. recvmmsg() -> NIC incoming queue - you are trying to bypass this.
> 2. sendmsg() -> l2tpv3's incoming queue - if sendmsg() fails with EAGAIN.
>
> l2tpv3_writable() is invoked when the socket becomes writable (case #2)
> and we can resume sendmsg().  This has nothing to do with recvmmsg()
> (case #1).

My exact thought, going through it at the moment.

>
> In other words, the host kernel stopped us from transmitting packets
> because it ran out of buffer space.  So the NIC placed packets into
> l2tpv3's incoming queue and now we need to flush them, as well as
> re-enabling transmission.
>

[snip]

A.

  reply	other threads:[~2014-03-26  8:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-24 11:56 [Qemu-devel] [PATCH v5] net: L2TPv3 transport anton.ivanov
2014-03-25 10:17 ` Stefan Hajnoczi
2014-03-25 10:35   ` Anton Ivanov
2014-03-26  8:24     ` Stefan Hajnoczi
2014-03-26  8:39       ` Anton Ivanov (antivano) [this message]
2014-03-25 10:37   ` Anton Ivanov

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=5332922B.6040408@cisco.com \
    --to=antivano@cisco.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).