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 3F54F43193 for ; Wed, 18 Oct 2023 04:19:24 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AFA8F40261; Wed, 18 Oct 2023 04:19:23 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 6B0494003C for ; Wed, 18 Oct 2023 04:19:22 +0200 (CEST) Received: from kwepemm000002.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S9Dtz0Q3wzvQ81; Wed, 18 Oct 2023 10:14:35 +0800 (CST) Received: from dggpeml500020.china.huawei.com (7.185.36.88) by kwepemm000002.china.huawei.com (7.193.23.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 18 Oct 2023 10:19:19 +0800 Received: from dggpeml500020.china.huawei.com ([7.185.36.88]) by dggpeml500020.china.huawei.com ([7.185.36.88]) with mapi id 15.01.2507.031; Wed, 18 Oct 2023 10:19:18 +0800 From: "jiangheng (G)" To: "Xing, Beilei" , "users@dpdk.org" , Stephen Hemminger CC: "Fanbin(Kira,2012 Blue Lab.)" Subject: =?gb2312?B?tPC4tDogV2hldGhlciB0aGUgY3JlYXRhdGlvbiBvZiBmbG93IHJ1bGVzIG9m?= =?gb2312?Q?_i40e_NIC_support_tcp_port_mask?= Thread-Topic: Whether the creatation of flow rules of i40e NIC support tcp port mask Thread-Index: AdoA1zKopRhb/mz0T4qZQSq4v/eEUgAjryTQAABKRJA= Date: Wed, 18 Oct 2023 02:19:18 +0000 Message-ID: References: In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.136.117.195] Content-Type: multipart/alternative; boundary="_000_baf345cb9cd3493eafbb686d93ce1d55huaweicom_" MIME-Version: 1.0 X-CFilter-Loop: Reflected X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: users-bounces@dpdk.org --_000_baf345cb9cd3493eafbb686d93ce1d55huaweicom_ Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: base64 SGkgQmVpbGVpOg0KV2hhdCBpcyB0aGUgbWF4aW11bSBudW1iZXIgb2YgZmxvdyBydWxlcyBzdXBw b3J0ZWQgYnkgdGhlIGk0MGU/DQpXaGF0IGFib3V0IHRoYXQgc2l0dWF0aW9uOiAgbnVtYmVycyBv ZiB0Y3AgY29ubmVjdGlvbiBpcyBncmVhdGVyIHRoYW4gdGhlIG1heGltdW0gbnVtYmVyIG9mIGZs b3cgcnVsZXMuDQoNCg0Kt6K8/sjLOiBYaW5nLCBCZWlsZWkgPGJlaWxlaS54aW5nQGludGVsLmNv bT4NCreiy83KsbzkOiAyMDIzxOoxMNTCMTjI1SA5OjU1DQrK1bz+yMs6IGppYW5naGVuZyAoRykg PGppYW5naGVuZzE0QGh1YXdlaS5jb20+OyB1c2Vyc0BkcGRrLm9yZw0Ks63LzTogRmFuYmluKEtp cmEsMjAxMiBCbHVlIExhYi4pIDxmYW5iaW4xMkBodWF3ZWkuY29tPg0K1vfM4jogUkU6IFdoZXRo ZXIgdGhlIGNyZWF0YXRpb24gb2YgZmxvdyBydWxlcyBvZiBpNDBlIE5JQyBzdXBwb3J0IHRjcCBw b3J0IG1hc2sNCg0KSGkgSmlhbmdoZW5nLA0KDQpUaGF0oa9zIGJlY2F1c2UgaTQwZSBvbmx5IHN1 cHBvcnRzIHBlcmZlY3QgbWF0Y2guDQoNCkJSLA0KQmVpbGVpDQoNCkZyb206IGppYW5naGVuZyAo RykgPGppYW5naGVuZzE0QGh1YX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wgcmVzKTsNCg0KICAgIH0NCg0KDQoNCkxvb2tpbmcgZm9yd2FyZCB0byB5b3VyIGZh dm91cmFibGUgcmVwbHkuDQoNCg== --_000_baf345cb9cd3493eafbb686d93ce1d55huaweicom_ Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable

Hi Beilei:

What is the maximum number of flow rules supported by the i40e?<= /o:p>

What about that situation:  numbers of tcp connection is greater= than the maximum number of flow rules.

 

 

=B7=A2=BC=FE=C8=CB: Xing, Beilei <beilei.xing@intel.com>
=B7=A2=CB=CD=CA=B1=BC=E4: 2023=C4=EA10=D4=C218=C8=D5 9:55
=CA=D5=BC=FE=C8=CB: jiangheng (G) <jiangheng14@huawei.com>; users@dpdk.org
=B3=AD=CB=CD: Fanbin(Kira,2012 Blue Lab.) <fanbin12@huawei.com>
=D6=F7=CC=E2: RE: Whether the creatation of flow rules of i40e NIC support tcp port mas= k

 

Hi J= iangheng,

 

That= =A1=AFs because i40e only supports perfect match.

 

BR,<= o:p>

Beil= ei

 

From: jiangheng (G) <jiangheng14@huawei.com>
Sent: Tuesday, October 17, 2023 4:52 PM
To: Xing, Beilei <beilei= .xing@intel.com>; users@dpdk.org
Cc: Fanbin(Kira,2012 Blue Lab.) <fanbin12@huawei.com>
Subject: Whether the creatation of flow rules of i40e NIC support tc= p port mask

 

Hi beilei=A3=AC

I would like to create flows= using tcp port mask, but it seems only mask 0xffff or 0x0 work, Does flow rlue can be created using ot= her mask?

I40e dirver was using now. <= o:p>

   

Here is my code:<= /span>

    struct rt= e_flow_attr attr;

    struct rt= e_flow_item pattern[MAX_PATTERN_NUM];

    struct rt= e_flow_action action[MAX_ACTION_NUM];

    struct rt= e_flow *flow =3D NULL;

    struct rt= e_flow_action_queue queue =3D { .index =3D queue_id };

    struct rt= e_flow_item_ipv4 ip_spec;

    struct rt= e_flow_item_ipv4 ip_mask;

 

    stru= ct rte_flow_item_tcp tcp_spec;

    struct rt= e_flow_item_tcp tcp_mask;

    int res;<= o:p>

 

    mems= et_s(pattern, sizeof(pattern), 0, sizeof(pattern));

    memset_s(= action, sizeof(action), 0, sizeof(action));

 

    /*

     * s= et the rule attribute.

     * i= n this case only ingress packets will be checked.

     */<= o:p>

    memset_s(= &attr, sizeof(struct rte_flow_attr), 0, sizeof(struct rte_flow_attr));<= o:p>

    attr.ingr= ess =3D 1;

 

    /*

     * c= reate the action sequence.

     * o= ne action only,  move packet to queue

     */<= o:p>

    action[0]= .type =3D RTE_FLOW_ACTION_TYPE_QUEUE;

    action[0]= .conf =3D &queue;

    action[1]= .type =3D RTE_FLOW_ACTION_TYPE_END;

 

    // n= ot limit eth header

    pattern[0= ].type =3D RTE_FLOW_ITEM_TYPE_ETH;

 

    // i= p header

    memset_s(= &ip_spec, sizeof(struct rte_flow_item_ipv4), 0, sizeof(struct rte_flow_= item_ipv4));

    memset_s(= &ip_mask, sizeof(struct rte_flow_item_ipv4), 0, sizeof(struct rte_flow_= item_ipv4));

    ip_spec.h= dr.dst_addr =3D dst_ip;

    ip_mask.h= dr.dst_addr =3D EMPTY_MASK;

    ip_spec.h= dr.src_addr =3D src_ip;

    ip_mask.h= dr.src_addr =3D EMPTY_MASK;

    pattern[1= ].type =3D RTE_FLOW_ITEM_TYPE_IPV4;

    pattern[1= ].spec =3D &ip_spec;

    pattern[1= ].mask =3D &ip_mask;

 

    // t= cp header, full mask 0xffff

    memset_s(= &tcp_spec, sizeof(struct rte_flow_item_tcp), 0, sizeof(struct rte_flow_= item_tcp));

    memset_s(= &tcp_mask, sizeof(struct rte_flow_item_tcp), 0, sizeof(struct rte_flow_= item_tcp));

    pattern[2= ].type =3D RTE_FLOW_ITEM_TYPE_TCP; // 2: pattern 2 is tcp header=

    tcp_spec.= hdr.src_port =3D src_port;

    tcp_spec.= hdr.dst_port =3D dst_port;

 = ;   tcp_mask.hdr.src_port =3D 0xffff;  // only 0xffff and 0x= 0 work

 = ;   tcp_mask.hdr.dst_port =3D 0xffff; // only 0xffff and 0x0 work=

    pattern[2= ].spec =3D &tcp_spec;

    pattern[2= ].mask =3D &tcp_mask;

 

    /* t= he final level must be always type end */

    pattern[3= ].type =3D RTE_FLOW_ITEM_TYPE_END;

    res =3D r= te_flow_validate(port_id, &attr, pattern, action, error);

    if (!res)= {

    &nbs= p;   flow =3D rte_flow_create(port_id, &attr, pattern, action= , error);

    } else {<= o:p>

    &nbs= p;   LSTACK_LOG(ERR, PORT, "rte_flow_create.rte_flow_validat= e error, res %d \n", res);

    }

 

Looking forward to your favo= urable reply.

 

--_000_baf345cb9cd3493eafbb686d93ce1d55huaweicom_--