DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Bug in IPACL library of DPDK-1.6.0
@ 2014-10-14  9:55 Karmarkar Suyash
  2014-10-14 10:45 ` Ananyev, Konstantin
  0 siblings, 1 reply; 6+ messages in thread
From: Karmarkar Suyash @ 2014-10-14  9:55 UTC (permalink / raw)
  To: dev; +Cc: Dey, Souvik, Patil, PraveenKumar

Hello All,

If there are two identical IPv6 rules with source and destination IP addresses as wild card but with different priority, then during lookup  always the rule that is added first in TRIE is returned even though the second rule that has highest priority.

Regards
Suyash Karmarkar

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] Bug in IPACL library of DPDK-1.6.0
  2014-10-14  9:55 [dpdk-dev] Bug in IPACL library of DPDK-1.6.0 Karmarkar Suyash
@ 2014-10-14 10:45 ` Ananyev, Konstantin
  2014-10-14 12:36   ` Karmarkar Suyash
  0 siblings, 1 reply; 6+ messages in thread
From: Ananyev, Konstantin @ 2014-10-14 10:45 UTC (permalink / raw)
  To: Karmarkar Suyash, dev; +Cc: Dey, Souvik, Patil, PraveenKumar

Hi,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Karmarkar Suyash
> Sent: Tuesday, October 14, 2014 10:55 AM
> To: dev@dpdk.org
> Cc: Dey, Souvik; Patil, PraveenKumar
> Subject: [dpdk-dev] Bug in IPACL library of DPDK-1.6.0
> 
> Hello All,
> 
> If there are two identical IPv6 rules with source and destination IP addresses as wild card but with different priority, then during
> lookup  always the rule that is added first in TRIE is returned even though the second rule that has highest priority.
> 

Could you provide a bit more details how to reproduce the problem:
- either a rule and trace file to reproduce the problem in testacl (classsbench) format
-or some simple code snippet.

Thanks
Konstantin

> Regards
> Suyash Karmarkar

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] Bug in IPACL library of DPDK-1.6.0
  2014-10-14 10:45 ` Ananyev, Konstantin
@ 2014-10-14 12:36   ` Karmarkar Suyash
  2014-10-14 14:44     ` Ananyev, Konstantin
  0 siblings, 1 reply; 6+ messages in thread
From: Karmarkar Suyash @ 2014-10-14 12:36 UTC (permalink / raw)
  To: Ananyev, Konstantin, dev; +Cc: Dey, Souvik, Patil, PraveenKumar

There are two user defined ACL rules and they are added with just different priority -

1.      And all other fields are wild card:
>       SOURCE IP and  DEST IP = wild card (*)
>       LIF_GRP_INFO_FIELD_IPV6 = wild card (*)
>       PORTS = wild card (*)
2.      Only next header protocol is specified = ICMPv6 (58)
3.      Priority is different. But the one with lower priority is returned during lookup.

The structure is -

enum
{
   NEXT_HDR_FIELD_IPV4, //8
   IPSRC_FIELD_IPV4,  //src ip (32)
   IPDST_FIELD_IPV4,  //dst ip (32)
   PORTS_FIELD_IPV4,  // src port (16) + dest port (16) => 32
   LIF_GRP_INFO_FIELD_IPV4, //lif group (16) +  lif Id (16)  => 32
   ADDR_CTX_FIELD_IPV4, //addr context (32)
   NUM_FIELDS_IPV4
};



struct rte_acl_field_def ipv6_defs[NUM_FIELDS_IPV6] = {
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint8_t),
      .field_index = NEXT_HDR_FIELD_IPV6,
      .input_index = NEXT_HDR_FIELD_IPV6,
      .offset = offsetof(struct ipv6_hdr, proto),
   },

///source ip
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = IPSRC_FIELD0_IPV6,
      .input_index = IPSRC_FIELD0_IPV6,
      .offset = offsetof(struct ipv6_hdr, src_addr),
   },
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = IPSRC_FIELD1_IPV6,
      .input_index = IPSRC_FIELD1_IPV6,
      .offset = offsetof(struct ipv6_hdr, src_addr) + 1*sizeof (uint32_t),
   },
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = IPSRC_FIELD2_IPV6,
      .input_index = IPSRC_FIELD2_IPV6,
      .offset = offsetof(struct ipv6_hdr, src_addr) + 2*sizeof (uint32_t),
   },
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = IPSRC_FIELD3_IPV6,
      .input_index = IPSRC_FIELD3_IPV6,
      .offset = offsetof(struct ipv6_hdr, src_addr) + 3*sizeof (uint32_t),
   },

///destination ip
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = IPDST_FIELD0_IPV6,
      .input_index = IPDST_FIELD0_IPV6,
      .offset = offsetof(struct ipv6_hdr, dst_addr),
   },
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = IPDST_FIELD1_IPV6,
      .input_index = IPDST_FIELD1_IPV6,
      .offset = offsetof(struct ipv6_hdr, dst_addr) + 1*sizeof (uint32_t),
   },
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = IPDST_FIELD2_IPV6,
      .input_index = IPDST_FIELD2_IPV6,
      .offset = offsetof(struct ipv6_hdr, dst_addr) + 2*sizeof (uint32_t),
   },
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = IPDST_FIELD3_IPV6,
      .input_index = IPDST_FIELD3_IPV6,
      .offset = offsetof(struct ipv6_hdr, dst_addr) + 3*sizeof (uint32_t),
   },

   ///ports
    {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = PORTS_FIELD_IPV6,
      .input_index = PORTS_FIELD_IPV6,
      .offset = sizeof(struct ipv6_hdr) ,
   },
    //LIF grp and addr ctx
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = LIF_GRP_INFO_FIELD_IPV6,
      .input_index = LIF_GRP_INFO_FIELD_IPV6,
      .offset = sizeof(struct ipv6_hdr) +  sizeof (uint32_t),
   },
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = ADDR_CTX_FIELD_IPV6,
      .input_index = ADDR_CTX_FIELD_IPV6,
      .offset = sizeof(struct ipv6_hdr) +  2*sizeof (uint32_t),
   }
} ;




-----Original Message-----
From: Ananyev, Konstantin [mailto:konstantin.ananyev@intel.com]
Sent: Tuesday, October 14, 2014 4:16 PM
To: Karmarkar Suyash; dev@dpdk.org
Cc: Dey, Souvik; Patil, PraveenKumar
Subject: RE: Bug in IPACL library of DPDK-1.6.0

Hi,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Karmarkar Suyash
> Sent: Tuesday, October 14, 2014 10:55 AM
> To: dev@dpdk.org<mailto:dev@dpdk.org>
> Cc: Dey, Souvik; Patil, PraveenKumar
> Subject: [dpdk-dev] Bug in IPACL library of DPDK-1.6.0
>
> Hello All,
>
> If there are two identical IPv6 rules with source and destination IP
> addresses as wild card but with different priority, then during lookup  always the rule that is added first in TRIE is returned even though the second rule that has highest priority.
>

Could you provide a bit more details how to reproduce the problem:
- either a rule and trace file to reproduce the problem in testacl (classsbench) format -or some simple code snippet.

Thanks
Konstantin

> Regards
> Suyash Karmarkar

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] Bug in IPACL library of DPDK-1.6.0
  2014-10-14 12:36   ` Karmarkar Suyash
@ 2014-10-14 14:44     ` Ananyev, Konstantin
  2014-10-14 15:06       ` Karmarkar Suyash
  0 siblings, 1 reply; 6+ messages in thread
From: Ananyev, Konstantin @ 2014-10-14 14:44 UTC (permalink / raw)
  To: Karmarkar Suyash, dev; +Cc: Dey, Souvik, Patil, PraveenKumar

> From: Karmarkar Suyash [mailto:skarmarkar@sonusnet.com]
> Sent: Tuesday, October 14, 2014 1:36 PM
> To: Ananyev, Konstantin; dev@dpdk.org
> Cc: Dey, Souvik; Patil, PraveenKumar
> Subject: RE: Bug in IPACL library of DPDK-1.6.0
> 
> There are two user defined ACL rules and they are added with just different priority -
> 
> 1. And all other fields are wild card:
> * SOURCE IP and  DEST IP = wild card (*)
> * LIF_GRP_INFO_FIELD_IPV6 = wild card (*)
> * PORTS = wild card (*)
> 2. Only next header protocol is specified = ICMPv6 (58)
> 3. Priority is different. But the one with lower priority is returned during lookup.
> 

Hm, I tried what your described - works ok for me.
Are you saying you are still using DPDK 1.6 IPL?
If so, can you upgrade to 1.7 and give it another try?
There was one bug fixed in 1.7 very similar to what you describing:
 http://dpdk.org/ml/archives/dev/2014-June/003198.html

Konstantin


> The structure is -
> 
> enum
> {
>    NEXT_HDR_FIELD_IPV4, //8
>    IPSRC_FIELD_IPV4,  //src ip (32)
>    IPDST_FIELD_IPV4,  //dst ip (32)
>    PORTS_FIELD_IPV4,  // src port (16) + dest port (16) => 32
>    LIF_GRP_INFO_FIELD_IPV4, //lif group (16) +  lif Id (16)  => 32
>    ADDR_CTX_FIELD_IPV4, //addr context (32)
>    NUM_FIELDS_IPV4
> };
> 
> 
> 
> struct rte_acl_field_def ipv6_defs[NUM_FIELDS_IPV6] = {
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint8_t),
>       .field_index = NEXT_HDR_FIELD_IPV6,
>       .input_index = NEXT_HDR_FIELD_IPV6,
>       .offset = offsetof(struct ipv6_hdr, proto),
>    },
> 
> ///source ip
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = IPSRC_FIELD0_IPV6,
>       .input_index = IPSRC_FIELD0_IPV6,
>       .offset = offsetof(struct ipv6_hdr, src_addr),
>    },
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = IPSRC_FIELD1_IPV6,
>       .input_index = IPSRC_FIELD1_IPV6,
>       .offset = offsetof(struct ipv6_hdr, src_addr) + 1*sizeof (uint32_t),
>    },
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = IPSRC_FIELD2_IPV6,
>       .input_index = IPSRC_FIELD2_IPV6,
>       .offset = offsetof(struct ipv6_hdr, src_addr) + 2*sizeof (uint32_t),
>    },
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = IPSRC_FIELD3_IPV6,
>       .input_index = IPSRC_FIELD3_IPV6,
>       .offset = offsetof(struct ipv6_hdr, src_addr) + 3*sizeof (uint32_t),
>    },
> 
> ///destination ip
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = IPDST_FIELD0_IPV6,
>       .input_index = IPDST_FIELD0_IPV6,
>       .offset = offsetof(struct ipv6_hdr, dst_addr),
>    },
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = IPDST_FIELD1_IPV6,
>       .input_index = IPDST_FIELD1_IPV6,
>       .offset = offsetof(struct ipv6_hdr, dst_addr) + 1*sizeof (uint32_t),
>    },
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = IPDST_FIELD2_IPV6,
>       .input_index = IPDST_FIELD2_IPV6,
>       .offset = offsetof(struct ipv6_hdr, dst_addr) + 2*sizeof (uint32_t),
>    },
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = IPDST_FIELD3_IPV6,
>       .input_index = IPDST_FIELD3_IPV6,
>       .offset = offsetof(struct ipv6_hdr, dst_addr) + 3*sizeof (uint32_t),
>    },
> 
>    ///ports
>     {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = PORTS_FIELD_IPV6,
>       .input_index = PORTS_FIELD_IPV6,
>       .offset = sizeof(struct ipv6_hdr) ,
>    },
>     //LIF grp and addr ctx
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = LIF_GRP_INFO_FIELD_IPV6,
>       .input_index = LIF_GRP_INFO_FIELD_IPV6,
>       .offset = sizeof(struct ipv6_hdr) +  sizeof (uint32_t),
>    },
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = ADDR_CTX_FIELD_IPV6,
>       .input_index = ADDR_CTX_FIELD_IPV6,
>       .offset = sizeof(struct ipv6_hdr) +  2*sizeof (uint32_t),
>    }
> } ;
> 
> 
> 
> 
> -----Original Message-----
> From: Ananyev, Konstantin [mailto:konstantin.ananyev@intel.com]
> Sent: Tuesday, October 14, 2014 4:16 PM
> To: Karmarkar Suyash; dev@dpdk.org
> Cc: Dey, Souvik; Patil, PraveenKumar
> Subject: RE: Bug in IPACL library of DPDK-1.6.0
> 
> Hi,
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Karmarkar Suyash
> > Sent: Tuesday, October 14, 2014 10:55 AM
> > To: dev@dpdk.org
> > Cc: Dey, Souvik; Patil, PraveenKumar
> > Subject: [dpdk-dev] Bug in IPACL library of DPDK-1.6.0
> >
> > Hello All,
> >
> > If there are two identical IPv6 rules with source and destination IP
> > addresses as wild card but with different priority, then during lookup  always the rule that is added first in TRIE is returned even
> though the second rule that has highest priority.
> >
> 
> Could you provide a bit more details how to reproduce the problem:
> - either a rule and trace file to reproduce the problem in testacl (classsbench) format -or some simple code snippet.
> 
> Thanks
> Konstantin
> 
> > Regards
> > Suyash Karmarkar
> 
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] Bug in IPACL library of DPDK-1.6.0
  2014-10-14 14:44     ` Ananyev, Konstantin
@ 2014-10-14 15:06       ` Karmarkar Suyash
  2014-10-14 15:17         ` Ananyev, Konstantin
  0 siblings, 1 reply; 6+ messages in thread
From: Karmarkar Suyash @ 2014-10-14 15:06 UTC (permalink / raw)
  To: Ananyev, Konstantin, dev; +Cc: Dey, Souvik, Patil, PraveenKumar

Hi Konstantin,

We did even tried with DPDK-1.7.0 version still we faced the same issue.

Regards
Suyash Karmarkar

-----Original Message-----
From: Ananyev, Konstantin [mailto:konstantin.ananyev@intel.com] 
Sent: Tuesday, October 14, 2014 8:15 PM
To: Karmarkar Suyash; dev@dpdk.org
Cc: Dey, Souvik; Patil, PraveenKumar
Subject: RE: Bug in IPACL library of DPDK-1.6.0

> From: Karmarkar Suyash [mailto:skarmarkar@sonusnet.com]
> Sent: Tuesday, October 14, 2014 1:36 PM
> To: Ananyev, Konstantin; dev@dpdk.org
> Cc: Dey, Souvik; Patil, PraveenKumar
> Subject: RE: Bug in IPACL library of DPDK-1.6.0
> 
> There are two user defined ACL rules and they are added with just 
> different priority -
> 
> 1. And all other fields are wild card:
> * SOURCE IP and  DEST IP = wild card (*)
> * LIF_GRP_INFO_FIELD_IPV6 = wild card (*)
> * PORTS = wild card (*)
> 2. Only next header protocol is specified = ICMPv6 (58) 3. Priority is 
> different. But the one with lower priority is returned during lookup.
> 

Hm, I tried what your described - works ok for me.
Are you saying you are still using DPDK 1.6 IPL?
If so, can you upgrade to 1.7 and give it another try?
There was one bug fixed in 1.7 very similar to what you describing:
 http://dpdk.org/ml/archives/dev/2014-June/003198.html

Konstantin


> The structure is -
> 
> enum
> {
>    NEXT_HDR_FIELD_IPV4, //8
>    IPSRC_FIELD_IPV4,  //src ip (32)
>    IPDST_FIELD_IPV4,  //dst ip (32)
>    PORTS_FIELD_IPV4,  // src port (16) + dest port (16) => 32
>    LIF_GRP_INFO_FIELD_IPV4, //lif group (16) +  lif Id (16)  => 32
>    ADDR_CTX_FIELD_IPV4, //addr context (32)
>    NUM_FIELDS_IPV4
> };
> 
> 
> 
> struct rte_acl_field_def ipv6_defs[NUM_FIELDS_IPV6] = {
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint8_t),
>       .field_index = NEXT_HDR_FIELD_IPV6,
>       .input_index = NEXT_HDR_FIELD_IPV6,
>       .offset = offsetof(struct ipv6_hdr, proto),
>    },
> 
> ///source ip
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = IPSRC_FIELD0_IPV6,
>       .input_index = IPSRC_FIELD0_IPV6,
>       .offset = offsetof(struct ipv6_hdr, src_addr),
>    },
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = IPSRC_FIELD1_IPV6,
>       .input_index = IPSRC_FIELD1_IPV6,
>       .offset = offsetof(struct ipv6_hdr, src_addr) + 1*sizeof (uint32_t),
>    },
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = IPSRC_FIELD2_IPV6,
>       .input_index = IPSRC_FIELD2_IPV6,
>       .offset = offsetof(struct ipv6_hdr, src_addr) + 2*sizeof (uint32_t),
>    },
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = IPSRC_FIELD3_IPV6,
>       .input_index = IPSRC_FIELD3_IPV6,
>       .offset = offsetof(struct ipv6_hdr, src_addr) + 3*sizeof (uint32_t),
>    },
> 
> ///destination ip
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = IPDST_FIELD0_IPV6,
>       .input_index = IPDST_FIELD0_IPV6,
>       .offset = offsetof(struct ipv6_hdr, dst_addr),
>    },
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = IPDST_FIELD1_IPV6,
>       .input_index = IPDST_FIELD1_IPV6,
>       .offset = offsetof(struct ipv6_hdr, dst_addr) + 1*sizeof (uint32_t),
>    },
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = IPDST_FIELD2_IPV6,
>       .input_index = IPDST_FIELD2_IPV6,
>       .offset = offsetof(struct ipv6_hdr, dst_addr) + 2*sizeof (uint32_t),
>    },
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = IPDST_FIELD3_IPV6,
>       .input_index = IPDST_FIELD3_IPV6,
>       .offset = offsetof(struct ipv6_hdr, dst_addr) + 3*sizeof (uint32_t),
>    },
> 
>    ///ports
>     {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = PORTS_FIELD_IPV6,
>       .input_index = PORTS_FIELD_IPV6,
>       .offset = sizeof(struct ipv6_hdr) ,
>    },
>     //LIF grp and addr ctx
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = LIF_GRP_INFO_FIELD_IPV6,
>       .input_index = LIF_GRP_INFO_FIELD_IPV6,
>       .offset = sizeof(struct ipv6_hdr) +  sizeof (uint32_t),
>    },
>    {
>       .type = RTE_ACL_FIELD_TYPE_BITMASK,
>       .size = sizeof (uint32_t),
>       .field_index = ADDR_CTX_FIELD_IPV6,
>       .input_index = ADDR_CTX_FIELD_IPV6,
>       .offset = sizeof(struct ipv6_hdr) +  2*sizeof (uint32_t),
>    }
> } ;
> 
> 
> 
> 
> -----Original Message-----
> From: Ananyev, Konstantin [mailto:konstantin.ananyev@intel.com]
> Sent: Tuesday, October 14, 2014 4:16 PM
> To: Karmarkar Suyash; dev@dpdk.org
> Cc: Dey, Souvik; Patil, PraveenKumar
> Subject: RE: Bug in IPACL library of DPDK-1.6.0
> 
> Hi,
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Karmarkar 
> > Suyash
> > Sent: Tuesday, October 14, 2014 10:55 AM
> > To: dev@dpdk.org
> > Cc: Dey, Souvik; Patil, PraveenKumar
> > Subject: [dpdk-dev] Bug in IPACL library of DPDK-1.6.0
> >
> > Hello All,
> >
> > If there are two identical IPv6 rules with source and destination IP 
> > addresses as wild card but with different priority, then during 
> > lookup  always the rule that is added first in TRIE is returned even
> though the second rule that has highest priority.
> >
> 
> Could you provide a bit more details how to reproduce the problem:
> - either a rule and trace file to reproduce the problem in testacl (classsbench) format -or some simple code snippet.
> 
> Thanks
> Konstantin
> 
> > Regards
> > Suyash Karmarkar
> 
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] Bug in IPACL library of DPDK-1.6.0
  2014-10-14 15:06       ` Karmarkar Suyash
@ 2014-10-14 15:17         ` Ananyev, Konstantin
  0 siblings, 0 replies; 6+ messages in thread
From: Ananyev, Konstantin @ 2014-10-14 15:17 UTC (permalink / raw)
  To: Karmarkar Suyash, dev; +Cc: Dey, Souvik, Patil, PraveenKumar



> -----Original Message-----
> From: Karmarkar Suyash [mailto:skarmarkar@sonusnet.com]
> Sent: Tuesday, October 14, 2014 4:07 PM
> To: Ananyev, Konstantin; dev@dpdk.org
> Cc: Dey, Souvik; Patil, PraveenKumar
> Subject: RE: Bug in IPACL library of DPDK-1.6.0
> 
> Hi Konstantin,
> 
> We did even tried with DPDK-1.7.0 version still we faced the same issue.

Then I suppose, I need more information to reproduce it...
See below the code I used, based on your description. 
Does it replicate your problem?

enum
{
   NEXT_HDR_FIELD_IPV6, //8
        IPSRC_FIELD0_IPV6,
        IPSRC_FIELD1_IPV6,
        IPSRC_FIELD2_IPV6,
        IPSRC_FIELD3_IPV6,
        IPDST_FIELD0_IPV6,
        IPDST_FIELD1_IPV6,
        IPDST_FIELD2_IPV6,
        IPDST_FIELD3_IPV6,
        PORTS_FIELD_IPV6,  // src port (16) + dest port (16) => 32
   LIF_GRP_INFO_FIELD_IPV6, //lif group (16) +  lif Id (16)  => 32
   ADDR_CTX_FIELD_IPV6, //addr context (32)
   NUM_FIELDS_IPV6
};



static const struct rte_acl_field_def ipv6_defs[NUM_FIELDS_IPV6] = {
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint8_t),
      .field_index = NEXT_HDR_FIELD_IPV6,
      .input_index = NEXT_HDR_FIELD_IPV6,
      .offset = offsetof(struct ipv6_hdr, proto),
   },

///source ip
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = IPSRC_FIELD0_IPV6,
      .input_index = IPSRC_FIELD0_IPV6,
      .offset = offsetof(struct ipv6_hdr, src_addr),
   },
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = IPSRC_FIELD1_IPV6,
      .input_index = IPSRC_FIELD1_IPV6,
      .offset = offsetof(struct ipv6_hdr, src_addr) + 1*sizeof (uint32_t),
   },
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = IPSRC_FIELD2_IPV6,
      .input_index = IPSRC_FIELD2_IPV6,
      .offset = offsetof(struct ipv6_hdr, src_addr) + 2*sizeof (uint32_t),
   },
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = IPSRC_FIELD3_IPV6,
      .input_index = IPSRC_FIELD3_IPV6,
      .offset = offsetof(struct ipv6_hdr, src_addr) + 3*sizeof (uint32_t),
   },

///destination ip
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = IPDST_FIELD0_IPV6,
      .input_index = IPDST_FIELD0_IPV6,
      .offset = offsetof(struct ipv6_hdr, dst_addr),
   },
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = IPDST_FIELD1_IPV6,
      .input_index = IPDST_FIELD1_IPV6,
      .offset = offsetof(struct ipv6_hdr, dst_addr) + 1*sizeof (uint32_t),
   },
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = IPDST_FIELD2_IPV6,
      .input_index = IPDST_FIELD2_IPV6,
      .offset = offsetof(struct ipv6_hdr, dst_addr) + 2*sizeof (uint32_t),
   },
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = IPDST_FIELD3_IPV6,
      .input_index = IPDST_FIELD3_IPV6,
      .offset = offsetof(struct ipv6_hdr, dst_addr) + 3*sizeof (uint32_t),
   },

   ///ports
    {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = PORTS_FIELD_IPV6,
      .input_index = PORTS_FIELD_IPV6,
      .offset = sizeof(struct ipv6_hdr) ,
   },
    //LIF grp and addr ctx
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = LIF_GRP_INFO_FIELD_IPV6,
      .input_index = LIF_GRP_INFO_FIELD_IPV6,
      .offset = sizeof(struct ipv6_hdr) +  sizeof (uint32_t),
   },
   {
      .type = RTE_ACL_FIELD_TYPE_BITMASK,
      .size = sizeof (uint32_t),
      .field_index = ADDR_CTX_FIELD_IPV6,
      .input_index = ADDR_CTX_FIELD_IPV6,
      .offset = sizeof(struct ipv6_hdr) +  2*sizeof (uint32_t),
   }
};

RTE_ACL_RULE_DEF(rule, NUM_FIELDS_IPV6);

static const struct rule rules[] = {
        {
                .data.userdata = 1,
                .data.priority = 1,
                .data.category_mask = 1,
                .field[NEXT_HDR_FIELD_IPV6].value.u8 = IPPROTO_ICMPV6,
                .field[NEXT_HDR_FIELD_IPV6].mask_range.u8 = UINT8_MAX,
        },
        {
                .data.userdata = 2,
                .data.priority = 2,
                .data.category_mask = 1,
                .field[NEXT_HDR_FIELD_IPV6].value.u8 = IPPROTO_ICMPV6,
                .field[NEXT_HDR_FIELD_IPV6].mask_range.u8 = UINT8_MAX,
        },
};

static const struct {
        struct ipv6_hdr hdr;
        uint32_t ports;
        uint32_t lif_grp;
        uint32_t addr_ctx;
} data = {
        .hdr = {.proto = IPPROTO_ICMPV6,},
};

static const struct rte_acl_param prm = {
        .name = "xz1",
        .socket_id = SOCKET_ID_ANY,
        .rule_size = RTE_ACL_RULE_SZ(NUM_FIELDS_IPV6),
        .max_rule_num = 256,
};

static void
acl_test1(void)
{
        int32_t rc;
        uint32_t res;
        struct rte_acl_ctx *ctx;
        struct rte_acl_config cfg;
        const uint8_t *dp;

        dp = (const uint8_t *)&data;

        cfg.num_categories = 1;
        cfg.num_fields = RTE_DIM(ipv6_defs);
        memcpy(&cfg.defs, ipv6_defs, sizeof(ipv6_defs));

        ctx = rte_acl_create(&prm);
        assert(ctx != NULL);

        rte_acl_add_rules(ctx, (const struct rte_acl_rule *)&rules[0], 1);
        rte_acl_add_rules(ctx, (const struct rte_acl_rule *)&rules[1], 1);
        rc = rte_acl_build(ctx, &cfg);
        rte_acl_dump(ctx);
        assert(rc == 0);

        rc = rte_acl_classify(ctx, &dp, &res, 1, 1);
        assert(rc == 0);
        assert(res == 2);
        printf("rte_acl_classify() returns %d, res=%u\n", rc, res);

        rte_acl_reset(ctx);
        rte_acl_add_rules(ctx, (const struct rte_acl_rule *)&rules[1], 1);
        rte_acl_add_rules(ctx, (const struct rte_acl_rule *)&rules[0], 1);
        rc = rte_acl_build(ctx, &cfg);
        rte_acl_dump(ctx);
        assert(rc == 0);

        rc = rte_acl_classify(ctx, &dp, &res, 1, 1);
        assert(rc == 0);
        assert(res == 2);
        printf("rte_acl_classify() returns %d, res=%u\n", rc, res);
}

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-10-14 15:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-14  9:55 [dpdk-dev] Bug in IPACL library of DPDK-1.6.0 Karmarkar Suyash
2014-10-14 10:45 ` Ananyev, Konstantin
2014-10-14 12:36   ` Karmarkar Suyash
2014-10-14 14:44     ` Ananyev, Konstantin
2014-10-14 15:06       ` Karmarkar Suyash
2014-10-14 15:17         ` Ananyev, Konstantin

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).