Re: [ovs-discuss] check_pkt_larger precision

2020-06-11 Thread Ilya Maximets
> On 03. 06. 20 20:09, Numan Siddique wrote:
>> This email was sent from an external sender. Do not click links or 
>> open attachments unless you recognize the sender and know the content 
>> is safe.
>>
>>
>>
>> On Wed, Jun 3, 2020 at 8:27 PM Miroslav Kubiczek 
>> > > wrote:
>>
>>
>> On 29. 05. 20 12:51, Numan Siddique wrote:
>>> This email was sent from an external sender. Do not click links
>>> or open attachments unless you recognize the sender and know the
>>> content is safe.
>>>
>>>
>>>
>>> On Fri, May 29, 2020 at 3:41 PM Miroslav Kubiczek
>>> >> > wrote:
>>>
>>>
>>> On 29. 05. 20 11:29, Numan Siddique wrote:
 On Fri, May 29, 2020 at 2:25 PM Miroslav Kubiczek
 >>> > wrote:

 Hi, I have finally implemented flows with
 check_pkt_larger action. Partial flow dump is
 here:table=0, priority=100
 actions=check_pkt_larger(60)->NXM_NX_REG0[0],resubmit(,1)
 table=1, priority=1000,reg0=0x1 actions=resubmit(,2)
 table=1, priority=100,reg0=0 actions=resubmit(,3) I run
 a test which sends UDP packets (with VLAN) with size:
 58, 59, 62, 63 and 69 in a loop. Only the packet with 69
 match the action (1st line in table=1). In 2nd test I
 set check_pkt_larger  just by one byte less to 59 and then all 
 the above packets match. So the precision seems to be rounded to 8 bytes 
 or something like that.
 Can this be fixed to be more precise ideally to exact 1 byte?


 Can you try without VLAN and see the accuracy ?
>>>
>>> I tried without VLAN, it's not accurate.
>>>
>>>
>>> This is how the pkt length comparison is done
>>>
>>> in vswitchd -
>>> 
>>> https://github.com/openvswitch/ovs/blob/master/ofproto/ofproto-dpif-xlate.c#L6265
>>> in kernel datapath -
>>> 
>>> https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux/+/refs/heads/master/net/openvswitch/actions.c#1183
>>
>> I can see the problem only when using DPDK. Does it use the same code?
>>
>> For flow translation the same code is hit.
>> I think for ovs-dpdk datapath flows, the code here [1] should get hit.
>>
>> [1] - 
>> https://github.com/openvswitch/ovs/blob/master/lib/odp-execute.c#L766
>>
>> I never tested with ovs-dpdk when I worked on it.
> 
> 
> Thanks Numan, I added logging and I can see in that 
> dp_packet_size(packet) is always greater or equal 60 even if the real 
> packet size is 59 or less.

I think that Dumitru was right and the issue is l2 padding that should
not be taken into account while executing this action.

I sent a patch for this here:
https://patchwork.ozlabs.org/project/openvswitch/patch/20200611100231.2829329-1-i.maxim...@ovn.org/

Could you, please, check it in your setup?

Best regards, Ilya Maximets.
___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


Re: [ovs-discuss] check_pkt_larger precision

2020-06-04 Thread Miroslav Kubiczek


On 03. 06. 20 20:09, Numan Siddique wrote:
This email was sent from an external sender. Do not click links or 
open attachments unless you recognize the sender and know the content 
is safe.




On Wed, Jun 3, 2020 at 8:27 PM Miroslav Kubiczek 
> wrote:



On 29. 05. 20 12:51, Numan Siddique wrote:

This email was sent from an external sender. Do not click links
or open attachments unless you recognize the sender and know the
content is safe.



On Fri, May 29, 2020 at 3:41 PM Miroslav Kubiczek
mailto:miroslav.kubic...@adaptivemobile.com>> wrote:


On 29. 05. 20 11:29, Numan Siddique wrote:

On Fri, May 29, 2020 at 2:25 PM Miroslav Kubiczek
mailto:miroslav.kubic...@adaptivemobile.com>> wrote:

Hi, I have finally implemented flows with
check_pkt_larger action. Partial flow dump is
here:table=0, priority=100
actions=check_pkt_larger(60)->NXM_NX_REG0[0],resubmit(,1)
table=1, priority=1000,reg0=0x1 actions=resubmit(,2)
table=1, priority=100,reg0=0 actions=resubmit(,3) I run
a test which sends UDP packets (with VLAN) with size:
58, 59, 62, 63 and 69 in a loop. Only the packet with 69
match the action (1st line in table=1). In 2nd test I
set check_pkt_larger  just by one byte less to 59 and then all the 
above packets match. So the precision seems to be rounded to 8 bytes or 
something like that.
Can this be fixed to be more precise ideally to exact 1 byte?


Can you try without VLAN and see the accuracy ?


I tried without VLAN, it's not accurate.


This is how the pkt length comparison is done

in vswitchd -

https://github.com/openvswitch/ovs/blob/master/ofproto/ofproto-dpif-xlate.c#L6265
in kernel datapath -

https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux/+/refs/heads/master/net/openvswitch/actions.c#1183


I can see the problem only when using DPDK. Does it use the same code?

For flow translation the same code is hit.
I think for ovs-dpdk datapath flows, the code here [1] should get hit.

[1] - 
https://github.com/openvswitch/ovs/blob/master/lib/odp-execute.c#L766


I never tested with ovs-dpdk when I worked on it.



Thanks Numan, I added logging and I can see in that 
dp_packet_size(packet) is always greater or equal 60 even if the real 
packet size is 59 or less.





Thanks
Numan

When tested with non DPDK then it's working fine. Both versions are:
$ ovs-ofctl --version
ovs-ofctl (Open vSwitch) 2.13.0
OpenFlow versions 0x1:0x6

Thanks,
Miro



Thanks
Numan



man ovs-actions for check_pkt_larger says


Syntax:
       check_pkt_larger(pkt_len)->dst

       Checks if the packet is larger than the specified
length in pkt_len. If so, stores 1 in dst, which should be a
1-bit field; if not, stores 0.

       The packet length to check againt the argument
pkt_len includes the L2 header and L2 payload of the packet,
but not the VLAN tag (if present).

       Examples:
              ·  check_pkt_larger(1500)->reg0[0]
              ·  check_pkt_larger(8000)->reg9[10]

**

Thanks
Numan

Thanks,
Miro




___
discuss mailing list
disc...@openvswitch.org 
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


___
discuss mailing list
disc...@openvswitch.org 
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss

___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


Re: [ovs-discuss] check_pkt_larger precision

2020-06-03 Thread Numan Siddique
On Wed, Jun 3, 2020 at 8:27 PM Miroslav Kubiczek <
miroslav.kubic...@adaptivemobile.com> wrote:

>
> On 29. 05. 20 12:51, Numan Siddique wrote:
>
> This email was sent from an external sender. Do not click links or open
> attachments unless you recognize the sender and know the content is safe.
>
>
>
> On Fri, May 29, 2020 at 3:41 PM Miroslav Kubiczek <
> miroslav.kubic...@adaptivemobile.com> wrote:
>
>>
>> On 29. 05. 20 11:29, Numan Siddique wrote:
>>
>> On Fri, May 29, 2020 at 2:25 PM Miroslav Kubiczek <
>> miroslav.kubic...@adaptivemobile.com> wrote:
>>
>>> Hi,
>>>
>>> I have finally implemented flows with check_pkt_larger action. Partial flow 
>>> dump is here:
>>>
>>> table=0, priority=100 
>>> actions=check_pkt_larger(60)->NXM_NX_REG0[0],resubmit(,1)
>>> table=1, priority=1000,reg0=0x1 actions=resubmit(,2)
>>> table=1, priority=100,reg0=0 actions=resubmit(,3)
>>>
>>> I run a test which sends UDP packets (with VLAN) with size: 58, 59, 62, 63 
>>> and 69 in a loop. Only the packet with 69 match the action (1st line in 
>>> table=1).
>>>
>>> In 2nd test I set check_pkt_larger just by one byte less to 59 and then all 
>>> the above packets match. So the precision seems to be rounded to 8 bytes or 
>>> something like that.
>>> Can this be fixed to be more precise ideally to exact 1 byte?
>>>
>>>
>> Can you try without VLAN and see the accuracy ?
>>
>> I tried without VLAN, it's not accurate.
>>
>
> This is how the pkt length comparison is done
>
> in vswitchd -
> https://github.com/openvswitch/ovs/blob/master/ofproto/ofproto-dpif-xlate.c#L6265
> in kernel datapath -
> https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux/+/refs/heads/master/net/openvswitch/actions.c#1183
>
> I can see the problem only when using DPDK. Does it use the same code?
>
For flow translation the same code is hit.
I think for ovs-dpdk datapath flows, the code here [1] should get hit.

[1] - https://github.com/openvswitch/ovs/blob/master/lib/odp-execute.c#L766

I never tested with ovs-dpdk when I worked on it.

Thanks
Numan

When tested with non DPDK then it's working fine. Both versions are:
> $ ovs-ofctl --version
> ovs-ofctl (Open vSwitch) 2.13.0
> OpenFlow versions 0x1:0x6
>
> Thanks,
> Miro
>
>
> Thanks
> Numan
>
>
>>
>>
>
>> man ovs-actions for check_pkt_larger says
>>
>> 
>> Syntax:
>>check_pkt_larger(pkt_len)->dst
>>
>>Checks if the packet is larger than the specified length in
>> pkt_len. If so, stores 1 in dst, which should be a 1-bit field; if not,
>> stores 0.
>>
>>The packet length to check againt the argument pkt_len includes
>> the L2 header and L2 payload of the packet, but not the VLAN tag (if
>> present).
>>
>>Examples:
>>   ·  check_pkt_larger(1500)->reg0[0]
>>   ·  check_pkt_larger(8000)->reg9[10]
>>
>> **
>>
>> Thanks
>> Numan
>>
>> Thanks,
>>> Miro
>>>
>>>
>>>
>>>
>>> ___
>> discuss mailing list
>> disc...@openvswitch.org
>> https://mail.openvswitch.org/mailman/listinfo/ovs-discuss
>>
> ___
> discuss mailing list
> disc...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-discuss
>
___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


Re: [ovs-discuss] check_pkt_larger precision

2020-06-03 Thread Miroslav Kubiczek


On 29. 05. 20 12:51, Numan Siddique wrote:
This email was sent from an external sender. Do not click links or 
open attachments unless you recognize the sender and know the content 
is safe.




On Fri, May 29, 2020 at 3:41 PM Miroslav Kubiczek 
> wrote:



On 29. 05. 20 11:29, Numan Siddique wrote:

On Fri, May 29, 2020 at 2:25 PM Miroslav Kubiczek
mailto:miroslav.kubic...@adaptivemobile.com>> wrote:

Hi, I have finally implemented flows with check_pkt_larger
action. Partial flow dump is here:table=0, priority=100
actions=check_pkt_larger(60)->NXM_NX_REG0[0],resubmit(,1)
table=1, priority=1000,reg0=0x1 actions=resubmit(,2) table=1,
priority=100,reg0=0 actions=resubmit(,3) I run a test which
sends UDP packets (with VLAN) with size: 58, 59, 62, 63 and
69 in a loop. Only the packet with 69 match the action (1st
line in table=1). In 2nd test I set check_pkt_larger  just by one byte 
less to 59 and then all the above packets match. So the precision seems to be 
rounded to 8 bytes or something like that.
Can this be fixed to be more precise ideally to exact 1 byte?


Can you try without VLAN and see the accuracy ?


I tried without VLAN, it's not accurate.


This is how the pkt length comparison is done

in vswitchd - 
https://github.com/openvswitch/ovs/blob/master/ofproto/ofproto-dpif-xlate.c#L6265
in kernel datapath - 
https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux/+/refs/heads/master/net/openvswitch/actions.c#1183


I can see the problem only when using DPDK. Does it use the same code?
When tested with non DPDK then it's working fine. Both versions are:
$ ovs-ofctl --version
ovs-ofctl (Open vSwitch) 2.13.0
OpenFlow versions 0x1:0x6

Thanks,
Miro



Thanks
Numan



man ovs-actions for check_pkt_larger says


Syntax:
       check_pkt_larger(pkt_len)->dst

       Checks if the packet is larger than the specified length
in pkt_len. If so, stores 1 in dst, which should be a 1-bit
field; if not, stores 0.

       The packet length to check againt the argument pkt_len
includes the L2 header and L2 payload of the packet, but not the
VLAN tag (if present).

       Examples:
              ·  check_pkt_larger(1500)->reg0[0]
              ·  check_pkt_larger(8000)->reg9[10]

**

Thanks
Numan

Thanks,
Miro




___
discuss mailing list
disc...@openvswitch.org 
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss

___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


Re: [ovs-discuss] check_pkt_larger precision

2020-05-29 Thread Dumitru Ceara
On 5/29/20 12:51 PM, Numan Siddique wrote:
> 
> 
> On Fri, May 29, 2020 at 3:41 PM Miroslav Kubiczek
>  > wrote:
> 
> 
> On 29. 05. 20 11:29, Numan Siddique wrote:
>> On Fri, May 29, 2020 at 2:25 PM Miroslav Kubiczek
>> > > wrote:
>>
>> Hi, I have finally implemented flows with check_pkt_larger
>> action. Partial flow dump is here:table=0, priority=100
>> actions=check_pkt_larger(60)->NXM_NX_REG0[0],resubmit(,1)
>> table=1, priority=1000,reg0=0x1 actions=resubmit(,2) table=1,
>> priority=100,reg0=0 actions=resubmit(,3) I run a test which
>> sends UDP packets (with VLAN) with size: 58, 59, 62, 63 and 69
>> in a loop. Only the packet with 69 match the action (1st line
>> in table=1). In 2nd test I set check_pkt_larger just by one byte 
>> less to 59 and then all the above packets match. So the precision seems to 
>> be rounded to 8 bytes or something like that.
>> Can this be fixed to be more precise ideally to exact 1 byte?
>>
>>
>> Can you try without VLAN and see the accuracy ?
> 
> I tried without VLAN, it's not accurate.
> 
> 
> This is how the pkt length comparison is done
> 
> in vswitchd
> - 
> https://github.com/openvswitch/ovs/blob/master/ofproto/ofproto-dpif-xlate.c#L6265
> in kernel datapath
> - 
> https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux/+/refs/heads/master/net/openvswitch/actions.c#1183
> 
> Thanks
> Numan
>  
> 

Is it maybe related to minimum ethernet frame size (which should be
64B). I didn't check any of the code though to see if padding is added
anywhere or if the padding is considered in dp_packet_size().

Regards,
Dumitru

>  
> 
>>
>> man ovs-actions for check_pkt_larger says
>>
>> 
>> Syntax:
>>        check_pkt_larger(pkt_len)->dst
>>
>>        Checks if the packet is larger than the specified length in
>> pkt_len. If so, stores 1 in dst, which should be a 1-bit field; if
>> not, stores 0.
>>
>>        The packet length to check againt the argument pkt_len
>> includes the L2 header and L2 payload of the packet, but not the
>> VLAN tag (if present).
>>
>>        Examples:
>>               ·      check_pkt_larger(1500)->reg0[0]
>>               ·      check_pkt_larger(8000)->reg9[10] 
>>
>> **
>>
>> Thanks
>> Numan
>>
>> Thanks,
>> Miro
>>
>>
>>
> ___
> discuss mailing list
> disc...@openvswitch.org 
> https://mail.openvswitch.org/mailman/listinfo/ovs-discuss
> 
> 
> ___
> discuss mailing list
> disc...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-discuss
> 

___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


Re: [ovs-discuss] check_pkt_larger precision

2020-05-29 Thread Numan Siddique
On Fri, May 29, 2020 at 3:41 PM Miroslav Kubiczek <
miroslav.kubic...@adaptivemobile.com> wrote:

>
> On 29. 05. 20 11:29, Numan Siddique wrote:
>
> On Fri, May 29, 2020 at 2:25 PM Miroslav Kubiczek <
> miroslav.kubic...@adaptivemobile.com> wrote:
>
>> Hi,
>>
>> I have finally implemented flows with check_pkt_larger action. Partial flow 
>> dump is here:
>>
>> table=0, priority=100 
>> actions=check_pkt_larger(60)->NXM_NX_REG0[0],resubmit(,1)
>> table=1, priority=1000,reg0=0x1 actions=resubmit(,2)
>> table=1, priority=100,reg0=0 actions=resubmit(,3)
>>
>> I run a test which sends UDP packets (with VLAN) with size: 58, 59, 62, 63 
>> and 69 in a loop. Only the packet with 69 match the action (1st line in 
>> table=1).
>>
>> In 2nd test I set check_pkt_larger just by one byte less to 59 and then all 
>> the above packets match. So the precision seems to be rounded to 8 bytes or 
>> something like that.
>> Can this be fixed to be more precise ideally to exact 1 byte?
>>
>>
> Can you try without VLAN and see the accuracy ?
>
> I tried without VLAN, it's not accurate.
>

This is how the pkt length comparison is done

in vswitchd -
https://github.com/openvswitch/ovs/blob/master/ofproto/ofproto-dpif-xlate.c#L6265
in kernel datapath -
https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux/+/refs/heads/master/net/openvswitch/actions.c#1183

Thanks
Numan


>
>

> man ovs-actions for check_pkt_larger says
>
> 
> Syntax:
>check_pkt_larger(pkt_len)->dst
>
>Checks if the packet is larger than the specified length in
> pkt_len. If so, stores 1 in dst, which should be a 1-bit field; if not,
> stores 0.
>
>The packet length to check againt the argument pkt_len includes the
> L2 header and L2 payload of the packet, but not the VLAN tag (if present).
>
>Examples:
>   ·  check_pkt_larger(1500)->reg0[0]
>   ·  check_pkt_larger(8000)->reg9[10]
>
> **
>
> Thanks
> Numan
>
> Thanks,
>> Miro
>>
>>
>>
>>
>> ___
> discuss mailing list
> disc...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-discuss
>
___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


Re: [ovs-discuss] check_pkt_larger precision

2020-05-29 Thread Miroslav Kubiczek


On 29. 05. 20 11:29, Numan Siddique wrote:
On Fri, May 29, 2020 at 2:25 PM Miroslav Kubiczek 
> wrote:


Hi, I have finally implemented flows with check_pkt_larger action.
Partial flow dump is here:table=0, priority=100
actions=check_pkt_larger(60)->NXM_NX_REG0[0],resubmit(,1) table=1,
priority=1000,reg0=0x1 actions=resubmit(,2) table=1,
priority=100,reg0=0 actions=resubmit(,3) I run a test which sends
UDP packets (with VLAN) with size: 58, 59, 62, 63 and 69 in a
loop. Only the packet with 69 match the action (1st line in
table=1). In 2nd test I set check_pkt_larger  just by one byte less to 59 
and then all the above packets match. So the precision seems to be rounded to 8 
bytes or something like that.
Can this be fixed to be more precise ideally to exact 1 byte?


Can you try without VLAN and see the accuracy ?


I tried without VLAN, it's not accurate.




man ovs-actions for check_pkt_larger says


Syntax:
       check_pkt_larger(pkt_len)->dst

       Checks if the packet is larger than the specified length in 
pkt_len. If so, stores 1 in dst, which should be a 1-bit field; if 
not, stores 0.


       The packet length to check againt the argument pkt_len includes 
the L2 header and L2 payload of the packet, but not the VLAN tag (if 
present).


       Examples:
              ·      check_pkt_larger(1500)->reg0[0]
              ·      check_pkt_larger(8000)->reg9[10]

**

Thanks
Numan

Thanks,
Miro



___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


Re: [ovs-discuss] check_pkt_larger precision

2020-05-29 Thread Numan Siddique
On Fri, May 29, 2020 at 2:25 PM Miroslav Kubiczek <
miroslav.kubic...@adaptivemobile.com> wrote:

> Hi,
>
> I have finally implemented flows with check_pkt_larger action. Partial flow 
> dump is here:
>
> table=0, priority=100 
> actions=check_pkt_larger(60)->NXM_NX_REG0[0],resubmit(,1)
> table=1, priority=1000,reg0=0x1 actions=resubmit(,2)
> table=1, priority=100,reg0=0 actions=resubmit(,3)
>
> I run a test which sends UDP packets (with VLAN) with size: 58, 59, 62, 63 
> and 69 in a loop. Only the packet with 69 match the action (1st line in 
> table=1).
>
> In 2nd test I set check_pkt_larger just by one byte less to 59 and then all 
> the above packets match. So the precision seems to be rounded to 8 bytes or 
> something like that.
> Can this be fixed to be more precise ideally to exact 1 byte?
>
>
Can you try without VLAN and see the accuracy ?

man ovs-actions for check_pkt_larger says


Syntax:
   check_pkt_larger(pkt_len)->dst

   Checks if the packet is larger than the specified length in pkt_len.
If so, stores 1 in dst, which should be a 1-bit field; if not, stores 0.

   The packet length to check againt the argument pkt_len includes the
L2 header and L2 payload of the packet, but not the VLAN tag (if present).

   Examples:
  ·  check_pkt_larger(1500)->reg0[0]
  ·  check_pkt_larger(8000)->reg9[10]

**

Thanks
Numan


> Thanks,
> Miro
>
>
>
> ___
> discuss mailing list
> disc...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-discuss
>
___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


[ovs-discuss] check_pkt_larger precision

2020-05-29 Thread Miroslav Kubiczek
Hi, I have finally implemented flows with check_pkt_larger action. 
Partial flow dump is here:table=0, priority=100 
actions=check_pkt_larger(60)->NXM_NX_REG0[0],resubmit(,1) table=1, 
priority=1000,reg0=0x1 actions=resubmit(,2) table=1, priority=100,reg0=0 
actions=resubmit(,3) I run a test which sends UDP packets (with VLAN) 
with size: 58, 59, 62, 63 and 69 in a loop. Only the packet with 69 
match the action (1st line in table=1). In 2nd test I set check_pkt_larger  just by one byte less to 59 and then all the above packets match. So the precision seems to be rounded to 8 bytes or something like that.

Can this be fixed to be more precise ideally to exact 1 byte?

Thanks,
Miro

  

___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss