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 3C23145CAD for ; Thu, 7 Nov 2024 06:04:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BC27A402EA; Thu, 7 Nov 2024 06:04:20 +0100 (CET) Received: from sender4-of-o54.zoho.com (sender4-of-o54.zoho.com [136.143.188.54]) by mails.dpdk.org (Postfix) with ESMTP id 9D26C402D8 for ; Thu, 7 Nov 2024 06:04:17 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; t=1730955852; cv=none; d=zohomail.com; s=zohoarc; b=cJ2KYOz3deraW6sBFs4EboR1W/iFTpnhPzeeKPSZ2qODMjli9lLEmiPSia/djLMSqpF5SfyyqIL+JxiYUfPRB3gUEtNfD3A5eiKlykZrvyf8IGjXQDIAtJh1RU2Vlb9XL2FDJ7hOQmS2WXFLg/+KsKKWZ33pmgiqkAjug9W/+7U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730955852; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=xLSPwz/MJrqcPi7yN2ht0rS3LNnwsWIxdNA0IrZ7Aew=; b=KViAYX0U54Od8layF/g37CqHKllE0AkHKHBMJllXeWczttsAPW//lpmXUkPqU72HgjltYizX/wIfvxahGyiGoETR6Rqxq66/11eJk+rBZl2p69CubKBjk6B+vhHaP59xrWQjjIUO1iyFWXNuDGk+qPeI1VLdc3skYc5ohQ30i7Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=zohomail.com; spf=pass smtp.mailfrom=gopinath.gk@zohomail.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1730955852; s=zm2022; d=zohomail.com; i=gopinath.gk@zohomail.com; h=Date:Date:From:From:To:To:Cc:Cc:Message-Id:Message-Id:In-Reply-To:References:Subject:Subject:MIME-Version:Content-Type:Reply-To; bh=xLSPwz/MJrqcPi7yN2ht0rS3LNnwsWIxdNA0IrZ7Aew=; b=SYjCfa6RccSWe5CyEgh+Y5NyfkVPVKrxFmI3R0mv8wwLP5PG2mOBn0wlKqw58Js1 g0+0aUBI/wJyN9MVBJns5pPM8CUgAGdk44N3HeyoUYPJms1dvAUHuB96Y8QoaXYl1k2 bXgz8xqYt9ilwIOdCibpXW1FvHU3xcZLc3Ur6YTE= Received: from mail.zoho.com by mx.zohomail.com with SMTP id 1730955850976972.9230973707598; Wed, 6 Nov 2024 21:04:10 -0800 (PST) Date: Thu, 07 Nov 2024 10:34:10 +0530 From: Gopinath K To: "Bing Zhao" Cc: "users" Message-Id: <19305023434.ef44793c267716.8870262245955392369@zohomail.com> In-Reply-To: <19300c80d32.d5022afa139575.930128267539647532@zohomail.com> References: <192fb6be188.1149bb382642049.7819154315379406165@zohomail.com> <19300c80d32.d5022afa139575.930128267539647532@zohomail.com> Subject: RE: Error with SEND_TO_KERNEL Action during Flow creation on Mellanox CX-5 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_846208_242152898.1730955850807" Importance: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail 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 ------=_Part_846208_242152898.1730955850807 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, after assigning the flow to non-root table (by setting the flow group value= greater than 0), the flow was created successfully without any errors. Thanks, Gopinath K Sent using=20 ---- On Wed, 06 Nov 2024 14:52:10 +0530 Gopinath K wrote --- FW version:=C2=A016.35.1012 (MT_0000000425) OFED version: 24.07-0.6.1=E2=80=8B Sent using=20 ---- On Wed, 06 Nov 2024 14:46:15 +0530 Bing Zhao = wrote --- Which FW and OFED version are you using? BTW, have you tried on 6-Dx and can you try on the non-root (>0) group? I r= emember of the send_to_kernel is only supported on non-root tables. =C2=A0 From: Gopinath K =20 Sent: Tuesday, November 5, 2024 4:23 PM To: users Subject: Error with SEND_TO_KERNEL Action during Flow creation on Mellanox= CX-5 =C2=A0 External email: Use caution opening links or attachments =C2=A0 Hi, =20 =C2=A0 =C2=A0 =C2=A0I'm new to DPDK, and have been working on creating flo= w rules by using DPDK, to steer traffic to the kernel. =20 =C2=A0 =C2=A0 =C2=A0To understand the functionality of the Mellanox Bifura= cted drive, i attempted to steer ICMP packets to Linux Kernel and other tra= ffics to DPDK application. first i tried to create simple flow rule which d= rops the packet whose destination equals 192.168.3.2=C2=A0https://doc.dpdk.= org/guides/howto/rte_flow.html=C2=A0the flow created successfully without a= n error. =C2=A0 =C2=A0 =C2=A0 =C2=A0However the issue arises when I attempt to use the RTE_= FLOW_ACTION_TYPE_SEND_TO_KERNEL, which results in an error. =C2=A0 Below the sample code. =20 =C2=A0 =C2=A0 =C2=A01. functions to validate and create flow rule. static ::rte_flow* create_flow(uint16_t port_id, rte_flow_attr& attr, rte_f= low_item& pattern, rte_flow_action& actions) { =C2=A0=C2=A0=C2=A0 rte_flow_error error; =C2=A0=C2=A0=C2=A0 auto flow =3D rte_flow_create(port_id, &attr, &pattern, = &actions, &error); =C2=A0=C2=A0=C2=A0 if (!flow) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 printf("[create flow rule] faile= d to create flow rule, error: %s.\n", error.message); =C2=A0=C2=A0=C2=A0 } =C2=A0=C2=A0=C2=A0 return flow; } =C2=A0 bool validate_flow(uint16_t port_id, rte_flow_attr& attr, rte_flow_item& pa= ttern, rte_flow_action& action) { =C2=A0=C2=A0=C2=A0 rte_flow_error error; =C2=A0=C2=A0=C2=A0 auto res =3D rte_flow_validate(port_id, &attr, &pattern,= &action, &error); =C2=A0=C2=A0=C2=A0 if (res < 0) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 printf("[validate flow rule] val= idate flow failed, error: %s\n", error.message); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return false; =C2=A0=C2=A0=C2=A0 } =C2=A0=C2=A0=C2=A0 return true; } =C2=A0 =C2=A0 =C2=A0 =C2=A02. function to enable isolated mode on network port. bool enable_isolated_mode(uint16_t port_id) { =C2=A0=C2=A0=C2=A0 rte_flow_error error; =C2=A0 =C2=A0=C2=A0=C2=A0 // enable isolated mode. =C2=A0=C2=A0=C2=A0 if (rte_flow_isolate(port_id, 1, &error) < 0) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 printf("[isolated mode] failed t= o enable isolated mode on port %u, error: %s\n", port_id, error.message); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return false; =C2=A0=C2=A0=C2=A0 } =C2=A0 =C2=A0=C2=A0=C2=A0 printf("[isolated mode] isolated mode enabled on port %u= \n", port_id); =C2=A0=C2=A0=C2=A0 return true; } =C2=A0 =C2=A0 =C2=A0 =C2=A03. port initialization function. static inline int port_initilization(uint16_t port, rte_mempool *mbuf_pool) { =C2=A0=C2=A0=C2=A0 rte_eth_conf port_conf; =C2=A0 =C2=A0=C2=A0=C2=A0 if (!rte_eth_dev_is_valid_port(port)) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0printf("[port i= nit] port %u is not a valid port\n", port); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return -1; =C2=A0=C2=A0=C2=A0 } =C2=A0=C2=A0=C2=A0 if (!enable_isolated_mode(port)) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return -1; =C2=A0=C2=A0=C2=A0 } =C2=A0=C2=A0=C2=A0 memset(&port_conf, 0, sizeof(rte_eth_conf)); =C2=A0=C2=A0=C2=A0 rte_eth_dev_info device_info; =C2=A0=C2=A0=C2=A0 auto retval =3D rte_eth_dev_info_get(port, &device_info)= ; =C2=A0=C2=A0=C2=A0 if (retval !=3D 0) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0printf("[pirt i= nit] getting device(port %u) info, error: %d [%s]\n", port, rte_errno, ::rt= e_strerror(rte_errno)); =C2=A0=C2=A0=C2=A0 return retval; =C2=A0=C2=A0=C2=A0 } =C2=A0 =C2=A0=C2=A0=C2=A0 if (device_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_MBU= F_FAST_FREE) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0port_conf.txmod= e.offloads |=3D RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE; =C2=A0 =C2=A0=C2=A0=C2=A0 uint16_t rx_rings =3D 1; =C2=A0=C2=A0=C2=A0 uint16_t tx_rings =3D 1; =C2=A0=C2=A0=C2=A0 retval =3D rte_eth_dev_configure(port, rx_rings, tx_ring= s, &port_conf); =C2=A0=C2=A0=C2=A0 if (retval !=3D 0) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0printf("[port i= nit] failed to configure port(%u), error: %d [%s]\n", port, rte_errno, ::rt= e_strerror(rte_errno)); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return retval; =C2=A0=C2=A0=C2=A0 } =C2=A0 =C2=A0=C2=A0=C2=A0 uint16_t nb_rxd =3D RX_RING_SIZE; =C2=A0=C2=A0=C2=A0 uint16_t nb_txd =3D TX_RING_SIZE; =C2=A0=C2=A0=C2=A0 retval =3D rte_eth_dev_adjust_nb_rx_tx_desc(port, &nb_rx= d, &nb_txd); =C2=A0=C2=A0=C2=A0 if (retval !=3D 0) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0printf("[port i= nit] rte_eth_dev_adjust failed, error: %d [%s]\n", rte_errno, ::rte_strerro= r(rte_errno)); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return retval; =C2=A0=C2=A0=C2=A0 } =C2=A0 =C2=A0=C2=A0=C2=A0 for (auto q =3D 0; q < rx_rings; q++) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0retval =3D rte_= eth_rx_queue_setup(port, q, nb_rxd, rte_eth_dev_socket_id(port), NULL, mbuf= _pool); =C2=A0 =C2=A0 if (retval < 0) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return retval; =C2=A0=C2=A0=C2=A0 } =C2=A0 =C2=A0=C2=A0=C2=A0 auto tx_conf =3D device_info.default_txconf; =C2=A0=C2=A0=C2=A0 tx_conf.offloads =3D port_conf.txmode.offloads; =C2=A0=C2=A0=C2=A0 for (auto q =3D 0; q < tx_rings; q++) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 retval =3D rte_eth_tx_queue_setu= p(port, q, nb_txd, rte_eth_dev_socket_id(port), &tx_conf); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (retval < 0) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return r= etval; =C2=A0=C2=A0=C2=A0 } =C2=A0 =C2=A0=C2=A0=C2=A0 ::rte_ether_addr addr; =C2=A0=C2=A0=C2=A0 retval =3D rte_eth_macaddr_get(port, &addr); =C2=A0=C2=A0=C2=A0 if (retval !=3D 0) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return retval; =C2=A0 =C2=A0=C2=A0=C2=A0 retval =3D rte_eth_dev_start(port); =C2=A0=C2=A0=C2=A0 if (retval !=3D 0) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 printf("[port init] starting por= t %u failed, error: %d [%s]\n", port, rte_errno, rte_strerror(rte_errno)); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return retval; =C2=A0=C2=A0=C2=A0 } =C2=A0=C2=A0=C2=A0 printf("[port init] successfully started port: %u\n", po= rt); =C2=A0=C2=A0=C2=A0 printf("port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx= 8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", port, RTE_ETHER_ADDR_BYTES(&= addr)); =C2=A0=C2=A0=C2=A0 init_ingress_flow_rules(port); =C2=A0=C2=A0=C2=A0 init_egress_flow_rule(port); =C2=A0 =C2=A0=C2=A0 return 0; } =C2=A0 =C2=A0 =C2=A0 =C2=A04. Flow rule static void init_ingress_flow_rule(uint32_t port_id) { =C2=A0=C2=A0=C2=A0 rte_flow_attr attr =3D {0}; =C2=A0=C2=A0=C2=A0 rte_flow_item pattern[4]; =C2=A0=C2=A0=C2=A0 rte_flow_action action[2]; =C2=A0 =C2=A0=C2=A0=C2=A0 attr.ingress =3D 1; =C2=A0=C2=A0=C2=A0 memset(pattern, 0, sizeof pattern); =C2=A0=C2=A0=C2=A0 rte_flow_item_eth eth_spec; =C2=A0=C2=A0=C2=A0 rte_flow_item_eth eth_mask; =C2=A0=C2=A0=C2=A0 memset(ð_spec, 0, sizeof eth_spec); =C2=A0=C2=A0=C2=A0 memset(ð_mask, 0, sizeof eth_mask); =C2=A0=C2=A0=C2=A0 pattern[0].type =3D RTE_FLOW_ITEM_TYPE_ETH; =C2=A0=C2=A0=C2=A0 pattern[0].spec =3D ð_spec; =C2=A0 =C2=A0=C2=A0=C2=A0 rte_flow_item_ipv4 ipv4_spec; =C2=A0=C2=A0=C2=A0 rte_flow_item_ipv4 ipv4_mask; =C2=A0=C2=A0=C2=A0 memset(&ipv4_spec, 0, sizeof ipv4_spec); =C2=A0=C2=A0=C2=A0 memset(&ipv4_mask, 0, sizeof ipv4_mask); =C2=A0=C2=A0=C2=A0 pattern[1].type =3D RTE_FLOW_ITEM_TYPE_IPV4; =C2=A0=C2=A0=C2=A0 pattern[1].spec =3D &ipv4_spec; =C2=A0=C2=A0=C2=A0 pattern[1].mask =3D &ipv4_mask; =C2=A0 =C2=A0=C2=A0=C2=A0 rte_flow_item_icmp icmp_spec; =C2=A0=C2=A0=C2=A0 rte_flow_item_icmp icmp_mask; =C2=A0=C2=A0=C2=A0 memset(&icmp_spec, 0, sizeof icmp_spec); =C2=A0=C2=A0=C2=A0 memset(&icmp_mask, 0, sizeof icmp_mask); =C2=A0=C2=A0=C2=A0 icmp_spec.hdr.icmp_type =3D 0; =C2=A0=C2=A0=C2=A0 pattern[2].type =3D RTE_FLOW_ITEM_TYPE_ICMP; =C2=A0=C2=A0=C2=A0 pattern[2].spec =3D &icmp_spec; =C2=A0=C2=A0=C2=A0 pattern[2].mask =3D &icmp_mask; =C2=A0=C2=A0=C2=A0 pattern[3].type =3D RTE_FLOW_ITEM_TYPE_END; =C2=A0 =C2=A0=C2=A0=C2=A0 action[0].type =3D RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL; =C2=A0=C2=A0=C2=A0 action[1].type =3D RTE_FLOW_ACTION_TYPE_END; =C2=A0 =C2=A0=C2=A0=C2=A0 if (validate_flow(port_id, attr, pattern[0], action[0]))= { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 printf("[init flow rule] validat= ed successfully.\n"); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 auto flow =3D create_flow(port_i= d, attr, pattern[0], action[0]); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (flow !=3D NULL) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 printf("= [rte flow rule] successfully created a egress flow rule in port %u\n", port= _id); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } =C2=A0=C2=A0=C2=A0 } } =C2=A0 When I try to run the above program, the flow rule validated successfully w= ith `rte_flow_validate()`, but failed on creating the flow with an error of= `hardware refuses to create flow`. [init flow rule] validated successfully. [create flow rule] failed to create flow rule, error: hardware refuses to c= reate flow. The same error arise when try to create the flow in `dpdk-testpmd` program. testpmd> flow isolate 0 true testpmd> port start 0 testpmd> flow create 0 ingress pattern eth / ipv4 / icmp / end actions send= _to_kernel / end port_flow_complain(): Caught PMD error type 1 (cause unspecified): hardware= refuses to create flow: Operation not supported Can anyone tell me whether my code is correct or not? =C2=A0 Can anyone tell me whether my code is correct or not? and any idea how to u= se SEND_TO_KERNEL Action on Mellanox CX-5 NIC's. =20 System specification. =20 =C2=A0 =C2=A0 =C2=A0Operating System: Debian =C2=A0 =C2=A0 =C2=A0OS Version: 12.7 =C2=A0 =C2=A0 =C2=A0DPDK version: 24.07 =20 =20 Thanks and Regards, Gopinath. =C2=A0 Sent using Zoho Mail =C2=A0 =C2=A0 ------=_Part_846208_242152898.1730955850807 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =
Hi,

after assign= ing the flow to non-root table (by setting the flow group value greater tha= n 0), the flow was created successfully without any errors.
<= br>
Thanks,
Gopinath K

Sent using Zoho Mail



<= /div>

<= /div>
---- On Wed, 06 Nov 2024 14:52:10 +0530 Go= pinath K <gopinath.gk@zohomail.com> wrote ---

<= /div>
FW version: 16.35.1012 (MT_0000000= 425)
OFED version:= 24.07-0.6.1=E2=80=8B

Sent using Zoho Mail


<= br>

---- On Wed, 06 Nov 2024 14:46:15 +0530 Bing Zhao= <bingz@nvidia.com= > wrote ---


=


Which FW and OFED version are you using?

BTW, have you tried on 6-Dx and can y= ou try on the non-root (>0) group? I remember of the send_to_kernel is o= nly supported on non-root tables.

 

From: Gopin= ath K <gop= inath.gk@zohomail.com>
Sent: Tuesday, November 5, 2024 4= :23 PM
To: users <users@dpdk.org>
Subject: Error with SEND_TO_KERN= EL Action during Flow creation on Mellanox CX-5

 
<= /tr>

External email: Use caution opening links or att= achments

 

Hi,
<= br>      I'm new to DPDK, and have been working on creating = flow rules by using DPDK, to steer traffic to the kernel.

  &= nbsp;  To understand the functionality of the Mellanox Bifuracted driv= e, i attempted to steer ICMP packets to Linux Kernel and other traffics to = DPDK application. first i tried to create simple flow rule which drops the = packet whose destination equals 192.168.3.2 (refrenced from from API examples) the flow created successfully without an = error.

 <= br>

     However the issu= e arises when I attempt to use the RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL, whi= ch results in an error.

=  

Below the sampl= e code.

     1. functions to validate and create fl= ow rule.

static ::rte_flow* create= _flow(uint16_t port_id, rte_flow_attr& attr, rte_flow_item& pattern= , rte_flow_action& actions) {

    rte_flow_error error;=

=

=     auto flow =3D rte_f= low_create(port_id, &attr, &pattern, &actions, &error);

    if (= !flow) {

  = ;      printf("[create flow rule] failed to create= flow rule, error: %s.\n", error.message);

<= span class=3D"highlight" style=3D"background: white; margin-top: 0px; margi= n-bottom: 0px;">    }

    return flow;

<= div>

}

<= span class=3D"highlight" style=3D"background: white; margin-top: 0px; margi= n-bottom: 0px;"> 

bool validate_flow= (uint16_t port_id, rte_flow_attr& attr, rte_flow_item& pattern, rte= _flow_action& action) {

    rte_flow_error error;

    auto res =3D rte_flow_val= idate(port_id, &attr, &pattern, &action, &error);<= span class=3D"size" style=3D"font-size:10pt">

<= /div>

    if (res &l= t; 0) {

  =       printf("[validate flow rule] validate flow f= ailed, error: %s\n", error.message);

        return false;<= br>

    }=

    = return true;<= /span>

}
=

 

     2. function= to enable isolated mode on network port.

<= blockquote style=3D"border: solid rgb(204, 204, 204) 1pt; padding: 5pt 5pt = 5pt 5pt; margin-top: 5pt; margin-bottom: 5pt">

bool enable_isolated_mode(uint16_t port_id) {

<= div>

    rte_flow_error e= rror;<= /span>

 

    // enable isolated mode.

    if (rte_flow_= isolate(port_id, 1, &error) < 0) {

<= span class=3D"highlight" style=3D"background: white; margin-top: 0px; margi= n-bottom: 0px;">        printf(= "[isolated mode] failed to enable isolated mode on port %u, error: %s\n", p= ort_id, error.message);

        return false;<= /span>

=

    }=

 <= /span>

=     printf("[isolated mode] isolated mode enabled on port %u= \n", port_id);

&nb= sp;   return true;

}

 =

    &n= bsp;3. port initialization function.

<= /span>

= port_initilization(uint16_t port, rte_mempool *mbuf_pool) {

<= div>

    rte_eth_conf por= t_conf;

 

    if (!rte_eth_dev_is_valid_port(por= t)) {<= /span>

  &n= bsp;       printf("[port init] port %u i= s not a valid port\n", port);

          retur= n -1;<= /span>

  &n= bsp; }=

  &= nbsp; if (!enable_isolated_mode(port)) {

        return -1;=

    = }

   = memset(&port_conf, 0, sizeof(rte_eth_conf));

    rte_eth_dev_info device_in= fo;

  &nbs= p; auto retval =3D rte_eth_dev_info_get(port, &device_info);

    if (retval = !=3D 0) {

 &nbs= p;        printf("[pirt init] getti= ng device(port %u) info, error: %d [%s]\n", port, rte_errno, ::rte_strerror= (rte_errno));=

 =    return retval;

    }

 

    if (device_i= nfo.tx_offload_capa & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)<= /span>

=

     &nbs= p;    port_conf.txmode.offloads |=3D RTE_ETH_TX_OFFLOAD= _MBUF_FAST_FREE;

 

    uint16_t rx_rings =3D 1;<= br>

    u= int16_t tx_rings =3D 1;

    retval =3D rte_eth_dev_configure(port, rx_rings, tx_= rings, &port_conf);

    if (retval !=3D 0) {

<= span class=3D"highlight" style=3D"background: white; margin-top: 0px; margi= n-bottom: 0px;">        &n= bsp; printf("[port init] failed to configure port(%u), error: %d [%s]\= n", port, rte_errno, ::rte_strerror(rte_errno));

       &nbs= p;  return retval;

    }

 

    uint16_t nb_= rxd =3D RX_RING_SIZE;


=

=     retval =3D rte_eth_= dev_adjust_nb_rx_tx_desc(port, &nb_rxd, &nb_txd);

    if (retval !=3D 0)= {

   = ;       printf("[port init] rte_eth_dev_= adjust failed, error: %d [%s]\n", rte_errno, ::rte_strerror(rte_errno));

   &n= bsp;      return retval;=

=

=     }

 

&nb= sp;   for (auto q =3D 0; q < rx_rings; q++) {

      =     retval =3D rte_eth_rx_queue_setup(port, q, nb_rxd, = rte_eth_dev_socket_id(port), NULL, mbuf_pool);

    if (retval < 0)<= /span>

=

      &nb= sp;  return retval;

    }

 

    auto tx_conf= =3D device_info.default_txconf;

    tx_conf.offloads =3D port_conf.txmode.offl= oads;<= /span>

  &n= bsp; for (auto q =3D 0; q < tx_rings; q++) {

        retv= al =3D rte_eth_tx_queue_setup(port, q, nb_txd, rte_eth_dev_socket_id(port),= &tx_conf);

&nb= sp;       if (retval < 0)

      =       return retval;

    }

 =

  &= nbsp; ::rte_ether_addr addr;

    retval =3D rte_eth_macaddr_get(port, &addr= );

   = ; if (retval !=3D 0)=

        return retval;

 

&nb= sp;   retval =3D rte_eth_dev_start(port);

    if (retval !=3D 0) {

    = ;    printf("[port init] starting port %u failed, error: %d = [%s]\n", port, rte_errno, rte_strerror(rte_errno));

        = return retval;

&nb= sp;   }

&n= bsp;   printf("[port init] successfully started port: %u\n", port= );

   = ; printf("port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " = %02" PRIx8 " %02" PRIx8 "\n", port, RTE_ETHER_ADDR_BYTES(&addr));
<= /p>

    init_i= ngress_flow_rules(port);

    init_egress_flow_rule(port);

 

 &nb= sp; return 0;=

}
=

 

     4. Flow rule

<= span class=3D"size" style=3D"font-size: 10pt;">static void init_ingress_flo= w_rule(uint32_t port_id) {

    rte_flow_attr attr =3D {0};

    rte_flow_item patte= rn[4];=

  &= nbsp; rte_flow_action action[2];

 

=

<= span class=3D"size" style=3D"font-size: 10pt;">    attr.ingr= ess =3D 1;

 &nb= sp;  memset(pattern, 0, sizeof pattern);

    rte_flow_item_eth eth_spec;<= /span>=

    r= te_flow_item_eth eth_mask;

    memset(&eth_spec, 0, sizeof eth_spec);

    mems= et(&eth_mask, 0, sizeof eth_mask);

    pattern[0].type =3D RTE_FLOW_ITEM_= TYPE_ETH;

 &nbs= p;  pattern[0].spec =3D &eth_spec;

<= span class=3D"highlight" style=3D"background: white; margin-top: 0px; margi= n-bottom: 0px;"> 

   = rte_flow_item_ipv4 ipv4_spec;

    rte_flow_item_ipv4 ipv4_mask;

<= div>

    memset(&ipv4= _spec, 0, sizeof ipv4_spec);

    memset(&ipv4_mask, 0, sizeof ipv4_mask);<= br>

    p= attern[1].type =3D RTE_FLOW_ITEM_TYPE_IPV4;

<= span class=3D"highlight" style=3D"background: white; margin-top: 0px; margi= n-bottom: 0px;">    pattern[1].spec =3D &ipv4_s= pec;

  &nb= sp; pattern[1].mask =3D &ipv4_mask;

 <= br>

    r= te_flow_item_icmp icmp_spec;

    rte_flow_item_icmp icmp_mask;

    memset(&icmp_= spec, 0, sizeof icmp_spec);

    memset(&icmp_mask, 0, sizeof icmp_mask);<= br>

    i= cmp_spec.hdr.icmp_type =3D 0;

    pattern[2].type =3D RTE_FLOW_ITEM_TYPE_ICMP;<= br>

    p= attern[2].spec =3D &icmp_spec;

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

    patt= ern[3].type =3D RTE_FLOW_ITEM_TYPE_END;

 <= br>

    a= ction[0].type =3D RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL;=

=

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

 

    if (validate_flow= (port_id, attr, pattern[0], action[0])) {

<= span class=3D"highlight" style=3D"background: white; margin-top: 0px; margi= n-bottom: 0px;">        printf(= "[init flow rule] validated successfully.\n");

        auto= flow =3D create_flow(port_id, attr, pattern[0], action[0]);<= /span>

=

     &nbs= p;  if (flow !=3D NULL) {

          &nbs= p; printf("[rte flow rule] successfully created a egress flow rule in port = %u\n", port_id);

&nb= sp;       }

<= span class=3D"highlight" style=3D"background: white; margin-top: 0px; margi= n-bottom: 0px;">    }

}

 

When I = try to run the above program, the flow rule validated successfully with `rt= e_flow_validate()`, but failed on creating the flow with an error of `hardw= are refuses to create flow`.

[init flow rule] val= idated successfully.=

[create flow rule] failed to create flow rule, error: hardware refuses to = create flow.<= /span>

The same = error arise when try to create the flow in `dpdk-testpmd` program.

testpmd> flow isolate 0 true

testpmd> port start 0=

<= span class=3D"highlight" style=3D"background-color: white;">testpmd> flow create 0 ingress pattern eth / ipv4 / i= cmp / end actions send_to_kernel / end

port_flow_complain(): Caught PMD error type 1 (cause unspecified): hardw= are refuses to create flow: Operation not supported
Can= anyone tell me whether my code is correct or not?

<= div>

 

Can anyone tell me whether my code is correct or not? and any ide= a how to use SEND_TO_KERNEL Action on Mellanox CX-5 NIC's.

System = specification.

     Operating System: Debian
=

     OS Version: = 12.7
     DPDK version: 24.07


Thanks and R= egards,
Gopinath.

 

Sent using Zoh= o Mail=

 =

 



------=_Part_846208_242152898.1730955850807--