From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4D4C9A0C48; Tue, 13 Jul 2021 10:07:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CA595411BD; Tue, 13 Jul 2021 10:07:40 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 4A76D4069E for ; Tue, 13 Jul 2021 10:07:39 +0200 (CEST) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id D0A607F510; Tue, 13 Jul 2021 11:07:38 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru D0A607F510 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1626163658; bh=SIuw3EfXp4Pi4m2G0Y5U2b/Vr4ia57TCgdkFoTf/nDM=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=KiVk484BlA8zuwajJz5nTI/0w2jmnHMN/S6Gnfmnn7oI6aXwOzYmx3pPcJRNpGFfh AIbvfsme7gKtBiYW8s/x2jr52cq7Nz/PDgwEMgnz7wE1sCUj5Vj1rDlX+/oXmLGTve VwhKGeAuiDP5XxSBjVJ0ktl34/Lh4pWq+b6tkGXo= To: Ori Kam Cc: viacheslavo@nvidia.com, Xiaoyun Li , Gregory Etelson , dev@dpdk.org References: <20210705115217.4768-1-getelson@nvidia.com> <20210713072925.18540-1-getelson@nvidia.com> From: Andrew Rybchenko Organization: OKTET Labs Message-ID: <319c7581-498b-1f15-3d8b-c56a9e1393e8@oktetlabs.ru> Date: Tue, 13 Jul 2021 11:07:38 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210713072925.18540-1-getelson@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2] app/testpmd: add flow item to match on IPv4 version_ihl field X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" @Ori, could you review it, please. Thanks, Andrew. On 7/13/21 10:29 AM, Gregory Etelson wrote: > The new flow item allows PMD to offload IPv4 IHL field for matching, > if hardware supports that operation. > > Signed-off-by: Gregory Etelson > --- > v2: replace UNSIGNED with COMMON_UNSIGNED following 21.08 API change. > --- > app/test-pmd/cmdline_flow.c | 13 ++++++++++++- > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 1 + > 2 files changed, 13 insertions(+), 1 deletion(-) > > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index 8fc0e1469d..34e043621c 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -171,6 +171,7 @@ enum index { > ITEM_VLAN_INNER_TYPE, > ITEM_VLAN_HAS_MORE_VLAN, > ITEM_IPV4, > + ITEM_IPV4_VER_IHL, > ITEM_IPV4_TOS, > ITEM_IPV4_ID, > ITEM_IPV4_FRAGMENT_OFFSET, > @@ -1069,6 +1070,7 @@ static const enum index item_vlan[] = { > }; > > static const enum index item_ipv4[] = { > + ITEM_IPV4_VER_IHL, > ITEM_IPV4_TOS, > ITEM_IPV4_ID, > ITEM_IPV4_FRAGMENT_OFFSET, > @@ -2576,6 +2578,14 @@ static const struct token token_list[] = { > .next = NEXT(item_ipv4), > .call = parse_vc, > }, > + [ITEM_IPV4_VER_IHL] = { > + .name = "version_ihl", > + .help = "match header length", > + .next = NEXT(item_ipv4, NEXT_ENTRY(COMMON_UNSIGNED), > + item_param), > + .args = ARGS(ARGS_ENTRY(struct rte_flow_item_ipv4, > + hdr.version_ihl)), > + }, > [ITEM_IPV4_TOS] = { > .name = "tos", > .help = "type of service", > @@ -8193,7 +8203,8 @@ update_fields(uint8_t *buf, struct rte_flow_item *item, uint16_t next_proto) > break; > case RTE_FLOW_ITEM_TYPE_IPV4: > ipv4 = (struct rte_ipv4_hdr *)buf; > - ipv4->version_ihl = 0x45; > + if (!ipv4->version_ihl) > + ipv4->version_ihl = RTE_IPV4_VHL_DEF; > if (next_proto && ipv4->next_proto_id == 0) > ipv4->next_proto_id = (uint8_t)next_proto; > break; > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > index 33857acf54..ab7e91ad6c 100644 > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > @@ -3654,6 +3654,7 @@ This section lists supported pattern items and their attributes, if any. > > - ``ipv4``: match IPv4 header. > > + - ``version_ihl {unsigned}``: IPv4 version and IP header length. > - ``tos {unsigned}``: type of service. > - ``ttl {unsigned}``: time to live. > - ``proto {unsigned}``: next protocol ID. >