Re: [Qemu-devel] [PATCH] net/socket: remove hardcoded packet size in favor of new mtu parameter

2011-05-15 Thread Nguyen Thai Ngoc Duy
2011/5/16 Michael S. Tsirkin :
> On Fri, Apr 22, 2011 at 07:59:28PM +0700, Nguyễn Thái Ngọc Duy wrote:
>> Also mention the default value 4096.
>>
>> Signed-off-by: Nguyễn Thái Ngọc Duy 
>
> IS the option really necessary? Why not just allocate 128K or so and be
> done with it? That should be big enough even with GSO etc.

If it's big enough for practically everything, then yes, that way
would be simpler.
-- 
Duy



Re: [Qemu-devel] [PATCH] net: add drop_packets parameter to -net nic

2011-04-25 Thread Nguyen Thai Ngoc Duy
2011/4/25 Stefan Hajnoczi :
> 2011/4/25 Nguyễn Thái Ngọc Duy :
>> Dropping packets is sometimes perferred behavior. Add drop_packets
>> parameter to NICConf struct and let nic simulation decide how to use
>> it.
>>
>> Only e1000 supports this for now.
>>
>> Signed-off-by: Nguyễn Thái Ngọc Duy 
>> ---
>>  Documentation is missing, but I'm not even sure if there's any other
>>  user who finds this useful.
>
> Can you explain why you are adding this?  You are trying to bypass the
> send queue and drop packets instead?

Yes.

I have a driver that does connection hand shaking at ethernet level.
If anything goes wrong, it disables rx and after a while a new session
will be started from higher level. The other end has a timer and keeps
sending data until it times out. If this end does not respond properly
until the timer is timed out, the other end starts sending "connection
request" packets periodically for a new session. When this end enables
rx again, in real world it would receive a fresh req packet and send
ack. Because of queuing, it receives packets from old session and
sends out a series of nack because it expects req packet. Depends on
how long rx is disabled until a new session is started, the driver
will have to process all queued (invalid) packets and delay session
establishment some more.

I think dropping packets will improve this situation. But again, this
driver is peculiar. I don't think there are many drivers that do
dialog-style like this.
-- 
Duy



Re: [Qemu-devel] [PATCH] net: add drop_packets parameter to -net nic

2011-04-26 Thread Nguyen Thai Ngoc Duy
On Tue, Apr 26, 2011 at 4:14 PM, Stefan Hajnoczi  wrote:
> The behavior you are describing sounds like a bug in QEMU's network
> layer.  If RX is disabled we should not queue incoming packets.
>
> Have you looked into fixing QEMU so that the queue is disabled when RX
> is disabled?

it's in e1000_can_receive(): it can receive if rx is enabled
(E1000_RCTL_EN) and has enough buffer, which means if the driver
disables rx, packets queue up. Isn't that correct behavior? Sorry I'm
new in this area.
-- 
Duy