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 29FDC45C93 for ; Wed, 6 Nov 2024 10:22:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8DB42427A9; Wed, 6 Nov 2024 10:22:19 +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 D705240265 for ; Wed, 6 Nov 2024 10:22:17 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; t=1730884933; cv=none; d=zohomail.com; s=zohoarc; b=h257AYGdLF+3LLooLVxj8VW4GbjoRSM+j/b9usscWxNXzD6/7dI3c2fToqA5ur3C+Fi5cYmW9baNrEvVYtXH8vgQwiGfznVyAWouEKREnuQjtDiVcYBLxemgOlGMXK9pc9lhXnoQR9DdzWGkame+YYmYiEOlgTs4lIX5K/+X3nw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730884933; 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=uwFIyBqtLBJYKT2iF+hNjJM2wbJCPurHIH4HyF8+SJs=; b=ULWzKHvUIlquiPIgiX1J/+BGF69IlNcU+JjvSdlDLiCmu/6XSIaxLqYOm+VQfZ0yMF7RmvuAqYsppfSEqssj0yHlEF5P4j4NWeWN3ar9Xd4dxbHzHyYTyd1zVj6d9md1DW0jbyfFabTC928jYKOB22e5nBXE3JUim0KwNI6AlJ0= 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=1730884933; 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=uwFIyBqtLBJYKT2iF+hNjJM2wbJCPurHIH4HyF8+SJs=; b=XYK+6UonCqHiyX6hIsaVZTqxEHqVHAzSBYF19JXBEyve6w+U+PiDwkKkrV/I49Es 4e4yl3VBbno1eKcwcVsa2Newjdubb87q0Njwig7Rk3ngTzd84nBszXU5vw4lcavuwls FPRPqAJ38JGBWwQTfXMfX6qwZy1fYxZoO2FXmTYE= Received: from mail.zoho.com by mx.zohomail.com with SMTP id 1730884931060725.8159456519624; Wed, 6 Nov 2024 01:22:11 -0800 (PST) Date: Wed, 06 Nov 2024 14:52:10 +0530 From: Gopinath K To: "Bing Zhao" Cc: "users" Message-Id: <19300c80d32.d5022afa139575.930128267539647532@zohomail.com> In-Reply-To: References: <192fb6be188.1149bb382642049.7819154315379406165@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_443293_1915082988.1730884930869" 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_443293_1915082988.1730884930869 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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_443293_1915082988.1730884930869 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =
FW versio= n: 16.35.1012 (MT_0000000425)
OFED version: 24.07-0.6.1=E2=80=8B

Sent using Zoho Mail




---- 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 you try on the non-r= oot (>0) group? I remember of the send_to_kernel is only supported on no= n-root tables.

 <= br>

From: Gopinath K <gopinath.gk@zohomail= .com>
Sent: Tuesday, November 5, 2024 4:23 PM
To:= users <users@dp= dk.org>
Subject: Error with SEND_TO_KERNEL Action during = Flow creation on Mellanox CX-5

 

 

Hi,

  &nb= sp;  I'm new to DPDK, and have been working on creating flow rules by = using DPDK, to steer traffic to the kernel.

     To= understand the functionality of the Mellanox Bifuracted drive, i attempted= to steer ICMP packets to Linux Kernel and other traffics to DPDK applicati= on. first i tried to create simple flow rule which drops the packet whose d= estination equals 192.168.3.2 (refrenced from from API examples) the flow created successfully without an = error.

 =

     However the is= sue arises when I attempt to use the RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL, w= hich results in an error.

 

Below the s= ample code.

     1. functions to validate and creat= e flow rule.

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

<= div>

  &= nbsp; rte_flow_error error;

    auto flow =3D rte_flow_cr= eate(port_id, &attr, &pattern, &actions, &error);<= span class=3D"size" style=3D"font-size:10pt">

<= /div>

 =    if (!flow) {

        prin= tf("[create flow rule] failed to create flow rule, error: %s.\n", error.mes= sage);=

    }

    return flow;

}
=

 

bool validate_flow(u= int16_t port_id, rte_flow_attr& attr, rte_flow_item& pattern, rte_f= low_action& action) {

    rte_flow_error error;=

&nb= sp;   auto res =3D rte_flow_validate(port_id, &attr, &pat= tern, &action, &error);

    if (res < 0) {
=

&n= bsp;       printf("[validate flow rule] valid= ate flow failed, error: %s\n", error.message);

    &= nbsp;   return false;

    }=

=

   = ; return true;

}

 

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

bool enable_isol= ated_mode(uint16_t port_id) {

    rte_flow_error error;

 

    /= / enable isolated mode.

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

        print= f("[isolated mode] failed to enable isolated mode on port %u, error: %s\n",= port_id, error.message);

        retu= rn false;

    }

 

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

    return true;<= span class=3D"size" style=3D"font-size:10pt">

<= /div>

}
=

 <= br>

     3. port in= itialization function.

static inline int

port_initilization(uint16_t port, rte_mempoo= l *mbuf_pool) {

    rte_eth_conf port_conf;<= /span>

=

 

    if (!rte_eth_= dev_is_valid_port(port)) {

       &n= bsp;  printf("[port init] port %u is not a valid port\n", port);<= /span>=

=     }=

    if (!enable_isolated_mode(port)= ) {

        return -1;

<= div>

  &= nbsp; }

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

    rte_eth_dev_info device_info;<= span class=3D"font" style=3D"font-family:Verdana, sans-serif">

=

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

 &nb= sp;  if (retval !=3D 0) {

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

  &nbs= p; return retval;

    }

&nb= sp;

    if (device_info.tx_offload_cap= a & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)

     = ;     port_conf.txmode.offloads |=3D RTE_ETH_TX_OF= FLOAD_MBUF_FAST_FREE;

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

    uint16_t rx_rings =3D 1;

    uint16= _t tx_rings =3D 1;

    retval =3D rte_eth_dev_configure(p= ort, rx_rings, tx_rings, &port_conf);

    if (retval= !=3D 0) {

          p= rintf("[port init] failed to configure port(%u), error: %d [%s]\n", port, r= te_errno, ::rte_strerror(rte_errno));

      = ;    return retval;

    }

 

    uint16_t n= b_rxd =3D RX_RING_SIZE;

    uint16_t nb_txd =3D TX_RING_SI= ZE;

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

    if (retval !=3D 0) {
=

&n= bsp;         printf("[port ini= t] rte_eth_dev_adjust failed, error: %d [%s]\n", rte_errno, ::rte_strerror(= rte_errno));<= /span>

          = return retval;

    }

 

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

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

    if (retval < 0)=

=

   = ;      return retval;

    }
=

 

    a= uto tx_conf =3D device_info.default_txconf;

    tx_conf.of= floads =3D port_conf.txmode.offloads;

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

        r= etval =3D rte_eth_tx_queue_setup(port, q, nb_txd, rte_eth_dev_socket_id(por= t), &tx_conf);

        if (retval= < 0)

          &nbs= p; return retval;

    }

&nb= sp;

    ::rte_ether_addr addr;<= /span>

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

 =    if (retval !=3D 0)

       = ; return retval;

<= span class=3D"size" style=3D"font-size:10pt"> 

&= nbsp;   retval =3D rte_eth_dev_start(port);<= span class=3D"font" style=3D"font-family:Verdana, sans-serif">

=

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

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

        retur= n retval;

    }

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

    printf("po= rt %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "= %02" PRIx8 "\n", port, RTE_ETHER_ADDR_BYTES(&addr));

  &nb= sp; init_ingress_flow_rules(port);

    init_egress_flow_ru= le(port);

 

=

 =   return 0;

}=

 

  &nb= sp;  4. Flow rule

static void init_ingress_flow_rule(uint32_t port_id) = {

    rte_flow_attr attr =3D {0};

    r= te_flow_item pattern[4];

    rte_flow_action action[2];

 

    a= ttr.ingress =3D 1;

    memset(pattern, 0, sizeof pattern)= ;

    rte_flow_item_eth eth_spec;

    r= te_flow_item_eth eth_mask;

    memset(&eth_spec, 0, = sizeof eth_spec);

    memset(&eth_mask, 0, sizeof et= h_mask);

    pattern[0].type =3D RTE_FLOW_ITEM_TYPE_ETH;<= br>

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

=

 

    rte_flow_item_ipv4= ipv4_spec;

    rte_flow_item_ipv4 ipv4_mask;

 &nbs= p;  memset(&ipv4_spec, 0, sizeof ipv4_spec);<= span class=3D"font" style=3D"font-family:Verdana, sans-serif">

=

   = ; memset(&ipv4_mask, 0, sizeof ipv4_mask);

    patter= n[1].type =3D RTE_FLOW_ITEM_TYPE_IPV4;

    pattern[1].sp= ec =3D &ipv4_spec;

=     pattern[1].mask =3D &ipv4_m= ask;

<= span class=3D"font" style=3D"font-family:Verdana, sans-serif"> 

  = ;  rte_flow_item_icmp icmp_spec;

    rte_flow_item_ic= mp icmp_mask;=

    memset(&icmp_spec, 0, sizeof icmp_sp= ec);

<= span class=3D"colour" style=3D"color: black;">    memset(&icmp_mask, 0, sizeof icmp_mask);
=

&n= bsp;   icmp_spec.hdr.icmp_type =3D 0;

    patter= n[2].type =3D RTE_FLOW_ITEM_TYPE_ICMP;

    pattern[2].sp= ec =3D &icmp_spec;

=     pattern[2].mask =3D &icmp_m= ask;

<= span class=3D"colour" style=3D"color: black;">    pattern[3].type =3D RTE_FLOW_ITEM_TYPE_END;
<= /p>

 

    acti= on[0].type =3D RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL;

    a= ction[1].type =3D RTE_FLOW_ACTION_TYPE_END;

&nb= sp;

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

        p= rintf("[init flow rule] validated successfully.\n");

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

        if (flow !=3D NUL= L) {

<= span class=3D"colour" style=3D"color: black;">            p= rintf("[rte flow rule] successfully created a egress flow rule in port %u\n= ", port_id);<= /span>

        }

<= div>

  &= nbsp; }

}

 

When I try to run the abo= ve program, the flow rule validated successfully with `rte_flow_validate()`= , but failed on creating the flow with an error of `hardware refuses to create flow`.


[create flow rule] failed to = create flow rule, error: hardware refuses to create flow.

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

= testpmd> flow isolate 0 true

testpmd> port= start 0


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?

<= 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 = Regards,
Gopinath.

 

Sent using = Zoho Mail

&n= bsp;

 

=


------=_Part_443293_1915082988.1730884930869--

= External email: Use caution opening links or attachments=