From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <adrien.mazarguil@6wind.com>
Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52])
 by dpdk.org (Postfix) with ESMTP id 1D08A2E83
 for <dev@dpdk.org>; Fri, 12 May 2017 11:12:38 +0200 (CEST)
Received: by mail-wm0-f52.google.com with SMTP id d127so7772383wmf.0
 for <dev@dpdk.org>; Fri, 12 May 2017 02:12:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=6wind-com.20150623.gappssmtp.com; s=20150623;
 h=date:from:to:cc:subject:message-id:references:mime-version
 :content-disposition:in-reply-to;
 bh=1wTootyMk1nlCVA6MNmQ5IzbPLC4fZ7qp1VIqSN5sTM=;
 b=Xt0aSuULpJs9CDJUJtlzEGrtfGqeNxaF6OepXQCK9o1Ecdak/dQ0Yk/N8Qn97iZ6qE
 VoY5HecTiJw9DmIrjGVvbcYogIbmdWYEb1ljBfH4lcmxcupYl3LFgP2OVJyVfdOuVg72
 bbLu3vft/Iw9g1P6g8D28y7WQ1qt0g+vbvediGE/310Ek3Z6hFN7nozHfBCt1zOW+DQD
 ZftKipq4YG3roHm5E56hLr82ISaqR2ae3YbqsRckBjvDM2PwiVI0QcNVByNC7Z/GKzw3
 xoeW08eBLw9eFSa2VLeLXc02Z8fQbQCVzw7fQkGrJIPeEFmBkXnZzFFh8FAgS4iRlLGH
 ml2Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:references
 :mime-version:content-disposition:in-reply-to;
 bh=1wTootyMk1nlCVA6MNmQ5IzbPLC4fZ7qp1VIqSN5sTM=;
 b=UGLKAmkUtSoq+KmIaSzkB4sBhOh6iY/aF9aCRH9eVPiIem3N5Rz3kOLcX6LM2IpNmM
 eP73jFDMyPN/Cc4wib6tUNtlJKyuHcvrMkcAJP1S6JD1YsLVDerZD3XUt3rd9hBd0I1C
 Svli7SiYaMg5gZTG9UDdrShSOoKiplxrmdQeEO9Y/f9nobTtWKa3ATaDDvOqo+G7fzeK
 aphlBER/Y+7esBCZkz/5q7ak+HgK0hrZK9McrbVV82bA2bwWXPQ3IhfDuhidueeLWX71
 r/2W/NUZCfH3sorttkEuxvXYOqilcZr22dooqlENjldEdnUkP5cw3InyrHVQhA4aW6cH
 CyPg==
X-Gm-Message-State: AODbwcB0y1tXZ2lPOD/Yu1haXqJTo3bMOW4DfEHYZgyfgXiyMdnOR094
 reIv3l4FKNnpBGYm10Y=
X-Received: by 10.28.227.4 with SMTP id a4mr1895622wmh.102.1494580357874;
 Fri, 12 May 2017 02:12:37 -0700 (PDT)
Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78])
 by smtp.gmail.com with ESMTPSA id i3sm2965083wmb.13.2017.05.12.02.12.36
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 12 May 2017 02:12:36 -0700 (PDT)
Date: Fri, 12 May 2017 11:12:31 +0200
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: "Zhao1, Wei" <wei.zhao1@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "Xing, Beilei" <beilei.xing@intel.com>,
 "Lu, Wenzhuo" <wenzhuo.lu@intel.com>
Message-ID: <20170512091231.GY16218@6wind.com>
References: <cover.1482257521.git.adrien.mazarguil@6wind.com>
 <cover.1482331076.git.adrien.mazarguil@6wind.com>
 <180091c2bf814c846abbbfb1c2c50e9ec32d7324.1482331076.git.adrien.mazarguil@6wind.com>
 <A2573D2ACFCADC41BB3BE09C6DE313CA02097C1A@PGSMSX103.gar.corp.intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <A2573D2ACFCADC41BB3BE09C6DE313CA02097C1A@PGSMSX103.gar.corp.intel.com>
Subject: Re: [dpdk-dev] [PATCH v5 19/26] app/testpmd: add item raw to flow
 command
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 12 May 2017 09:12:38 -0000

Hi Wei,

On Thu, May 11, 2017 at 06:53:52AM +0000, Zhao1, Wei wrote:
> Hi, Adrien
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Adrien Mazarguil
> > Sent: Wednesday, December 21, 2016 10:52 PM
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH v5 19/26] app/testpmd: add item raw to flow
> > command
> > 
> > Matches arbitrary byte strings with properties:
> > 
> > - relative: look for pattern after the previous item.
> > - search: search pattern from offset (see also limit).
> > - offset: absolute or relative offset for pattern.
> > - limit: search area limit for start of pattern.
> > - length: pattern length.
> > - pattern: byte string to look for.
> > 
> > Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> > Acked-by: Olga Shern <olgas@mellanox.com>
[...]
> #define  ITEM_RAW_PATTERN_SIZE 36
> 
> The size of NIC i350 flex byte filter can accommodate the max length size of 128 byte, and the reason to 
> Define it as 36 is ?If it is the max length of pattern, maybe 128  is more appropriate? 
> Maybe I have not understand your purpose.
> 
> Thank you.

It's more or less an arbitrary compromise due to various limitations.

Once parsed, the result of an entire command is stored in a fixed buffer of
size CMDLINE_PARSE_RESULT_BUFSIZE (8192). Each parsed token ends up
somewhere in that buffer.

Each flow item always consumes sizeof(struct rte_flow_item) + sizeof(struct
rte_flow_item_xxx) * 3 (spec, last and mask) + alignment constraints.

For the raw item, this makes at least:

 (sizeof(rte_flow_item) +
  (sizeof(rte_flow_item_raw) + ITEM_RAW_PATTERN_SIZE) * 3)
 /* (32 + (12 + 36) * 3) => 176 bytes */

Because space is always consumed regardless of the size of the byte string
to match for implementation reasons, there is a chance to fill the buffer
too quickly with a larger ITEM_RAW_PATTERN_SIZE.

Also, this does not prevent users from specifying larger raw patterns (even
larger than 128) by combining them, e.g.:

 flow create 0
    pattern eth / raw relative is 1 pattern is foobar /
       raw relative is 1 pattern is barbaz / end
    actions queue index 42 / end

Such a pattern ends up matching a single "foobarbarbaz" string.

To summarize, it is only due to testpmd limitations. Even without PMD
support for combination, the current ability to provide 36 bytes of raw data
to match per specified item is plenty to validate basic functionality. We'll
improve testpmd eventually.

-- 
Adrien Mazarguil
6WIND