qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 09/11] netfilter: add a netbuffer filter


From: Jason Wang
Subject: Re: [Qemu-devel] [PATCH v4 09/11] netfilter: add a netbuffer filter
Date: Thu, 06 Aug 2015 17:35:33 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0


On 08/06/2015 05:23 PM, Yang Hongyang wrote:
>
>
> On 08/06/2015 05:09 PM, Jason Wang wrote:
>>
>>
>> On 08/06/2015 04:19 PM, Yang Hongyang wrote:
>>>
>>>
>>> On 08/06/2015 03:21 PM, Jason Wang wrote:
>>>>
>>>>
>>>> On 08/04/2015 04:30 PM, Yang Hongyang wrote:
>>>>> This filter is to buffer/release packets, this feature can be used
>>>>> when using MicroCheckpointing, or other Remus like VM FT
>>>>> solutions, you
>>>>> can also use it to simulate the network delay.
>>>>> It has an interval option, if supplied, this filter will release
>>>>> packets by interval.
>>>>>
>>>>> Usage:
>>>>>    -netdev tap,id=bn0
>>>>>    -netfilter buffer,id=f0,netdev=bn0,chain=in,interval=1000
>>>>>
>>>>> NOTE:
>>>>>    the scale of interval is microsecond.
>>>>>
>>>>> Signed-off-by: Yang Hongyang <address@hidden>
>>>>> ---
>>>>> v4: remove bh
>>>>>       pass the packet to next filter instead of receiver
>>>>> v3: check packet's sender and sender->peer when flush it
>>>>> ---
>>>>>   

[...]

>>>>>>>
>>>>>>>> +    }
>>>>>>>> +}
>>>>>>>> +
>>>>>>>> +static void filter_buffer_release_timer(void *opaque)
>>>>>>>> +{
>>>>>>>> +    FILTERBUFFERState *s = opaque;
>>>>>>>> +    filter_buffer_flush(&s->nf);
>>>>>>>> +    timer_mod(&s->release_timer,
>>>>>>>> +              qemu_clock_get_us(QEMU_CLOCK_VIRTUAL) +
>>>>>>>> s->interval);
>>>>>>>> +}
>>>>>>>> +
>>>>>>>> +/* filter APIs */
>>>>>>>> +static ssize_t filter_buffer_receive_iov(NetFilterState *nf,
>>>>>>>> +                                         NetClientState *sender,
>>>>>>>> +                                         unsigned flags,
>>>>>>>> +                                         const struct iovec *iov,
>>>>>>>> +                                         int iovcnt)
>>>>>>>> +{
>>>>>>>> +    FILTERBUFFERState *s = DO_UPCAST(FILTERBUFFERState, nf, nf);
>>>>>>>> +    NetQueue *queue = s->incoming_queue;
>>>>>>>> +
>>>>>>>> +    qemu_net_queue_append_iov(queue, sender, flags, iov, iovcnt,
>>>>>>>> +                              packet_send_completed);
>>>>>>>> +    return iov_size(iov, iovcnt);
>>>>>>>
>>>>>>> So if interval is zero, packet will be blocked forever and
>>>>>>> memory will
>>>>>>> be exhausted.
>>>>>>
>>>>>> Yes, but this supposed to be used by FT solutions, so it will
>>>>>> be released periodically. Currently only used with interval makes
>>>>>> sense.
>>>>>>
>>>>>
>>>>> Then you need terminate the initialization when interval is zero.
>
> Ok, but I'd like to also write a comment with it to mention when there're
> users, the interval check can be dropped. 

Ok.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]