From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk0-f48.google.com (mail-vk0-f48.google.com [209.85.213.48]) by dpdk.org (Postfix) with ESMTP id E3A984BE1 for ; Mon, 18 Sep 2017 15:38:37 +0200 (CEST) Received: by mail-vk0-f48.google.com with SMTP id h4so268824vkg.0 for ; Mon, 18 Sep 2017 06:38:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=LA5L9H1sSgqP8BcRz8YaGtVr1rADQYFRU4HUpb+sHqk=; b=HeZqo+b7bmugq+jmTIpMn8Xu1JAnrE8iLrYDJUEVfiUwbV/LzKNBQSlfKWDOUTERbC QAS/isJY37Xw9/Ft4bLFn8ljmoMkqPUxujT+LjgIzcCdhTbymdy1Sl/+xk+y5IrSfnEa hb76+e2RYs3WYiWpvz8CpQopkAh0zZHz21xZgy5pRgECGD7BcJhGlmQQPZ22mp7A7ZgX 7MgUUbx3BYFSdoaoCWzTSTPIwd98sjAd8733UhboGCrlNs16D6caiPfzb+9vmCSOgAMw PqzUvYwEZ+vjZCJuK/iMydcSC2gUpL5AY7glfMTFDJZhj2U32lcQnnC+TN3QY4/j6axV 2rgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=LA5L9H1sSgqP8BcRz8YaGtVr1rADQYFRU4HUpb+sHqk=; b=NPwscJTa3WCviaTIte5WinizzWiY3WE+UehjrRPHp/Jf7u80D7CQyXpitHMXcEYvw2 FCCtoiC8H3Lm7iROgzhVfqnufcsW5mvd8KkEcLGSURKGLfQ3ni7mrks6gBct0nAWpd5g MSilhZ0fpWgUTbxpJMNNuy2esPq6pH6pPbUH9vPuu9vd12dr/cpxpKiyebPRv+LhztAR GJwYvg/i8569AeuVp4fZkU+J+inapSsd9NtzZT1MKY6fnZoXqo+4YuehEV1deJkstQr6 f9WeDB/YInPoiE5UmHjAHeyz5F0fMALB7B0ip6BHa6bY0uTTjtjXcerCrSQJEkrIJgbS oNCQ== X-Gm-Message-State: AHPjjUgUe++nlBE/klbgpPLPBHUqmBdZ9eXkOBxGettSwTHgjLOTCiAv Tf3fZx0KqnwhtpNUZ8bxwWM+6XLYmvz1VWIwdFVx8g== X-Google-Smtp-Source: AOwi7QDjHPcOPYOZOcuLhPhNgOmgf6Btx34oURPDMlQCw28MAHLJF/jHdg5NmkvDg9Z57YQwOcjLDCWYLM+CE6BXx0I= X-Received: by 10.31.218.195 with SMTP id r186mr5629443vkg.108.1505741917077; Mon, 18 Sep 2017 06:38:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.64.70 with HTTP; Mon, 18 Sep 2017 06:38:36 -0700 (PDT) In-Reply-To: <20170918132054.twz6ba3xnhubhpc4@shalom> References: <20170918132054.twz6ba3xnhubhpc4@shalom> From: george.dit@gmail.com Date: Mon, 18 Sep 2017 06:38:36 -0700 Message-ID: To: =?UTF-8?Q?N=C3=A9lio_Laranjeiro?= Cc: Shahaf Shuler , "users@dpdk.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-users] DPDK application that sends rules to the NIC X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Sep 2017 13:38:38 -0000 Hi Nelio, Thanks for the prompt reply. I tried not to overwhelm the e-mail but you are right, there is some missing information. DPDK version: 17.08 MLNX_OFED: MLNX_OFED_LINUX-3.4-2.0.0.0-ubuntu16.04-x86_64.tgz here is my code snippet: ////////////////////////////////////////////////////////////////////// // Flow Attributes: Only ingress rules are currently supported ////////////////////////////////////////////////////////////////////// struct rte_flow_attr attr =3D { .group =3D 0, .priority =3D 0, .ingress =3D 1, .egress =3D 0, .reserved =3D 0, }; ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// // Flow Patterns ////////////////////////////////////////////////////////////////////// // L2 - Ethernet type is always IPv4 struct rte_flow_item_eth flow_item_eth_type_ipv4 =3D { .dst =3D { .addr_bytes =3D { 0 } }, .src =3D { .addr_bytes =3D { 0 } }, .type =3D RTE_BE16(ETHER_TYPE_IPv4) }; struct rte_flow_item_eth flow_item_eth_mask_type_ipv4 =3D { .dst =3D { .addr_bytes =3D { 0 } }, .src =3D { .addr_bytes =3D { 0 } }, .type =3D 0xFFFF }; ////////////////////////////////////////////////////////////////////// // Compose the pattern struct rte_flow_item patterns[] =3D { { .type =3D RTE_FLOW_ITEM_TYPE_ETH, .spec =3D (void *) &flow_item_eth_type_ipv4, .last =3D NULL, .mask =3D (void *) &flow_item_eth_mask_type_ipv4, }, { .type =3D RTE_FLOW_ITEM_TYPE_END, .spec =3D NULL, .last =3D NULL, .mask =3D NULL, } }; ////////////////////////////////////////////////////////////////////// // Flow Actions ////////////////////////////////////////////////////////////////////// // Only core dispatching is currently supported struct rte_flow_action_queue queue_conf; queue_conf.index =3D RTE_BE16(queue_index); ////////////////////////////////////////////////////////////////////// struct rte_flow_action actions[] =3D { { .type =3D RTE_FLOW_ACTION_TYPE_QUEUE, .conf =3D &queue_conf }, { .type =3D RTE_FLOW_ACTION_TYPE_END, .conf =3D NULL } }; ////////////////////////////////////////////////////////////////////// // Validate Flow ////////////////////////////////////////////////////////////////////// struct rte_flow_error error; /* Poisoning to make sure PMDs update it in case of error. */ memset(&error, 0x11, sizeof(error)); uint8_t port_id =3D 0; int ret =3D rte_flow_validate(port_id, &attr, patterns, actions, &error= ); if (ret < 0) { flow_rule_complain(&error); return false; } errh->message("Flow rule validated"); // Up until here everything works ////////////////////////////////////////////////////////////////////// // Create Flow ////////////////////////////////////////////////////////////////////// struct rte_flow *flow =3D NULL; // Create a DPDK flow flow =3D rte_flow_create(port_id, &attr, patterns, actions, &error); // At this line I get segmentation fault if (flow =3D=3D NULL) { flow_rule_complain(&error); return false; } SEG FAULT: Thread 1 "click" received signal SIGSEGV, Segmentation fault. 0x00000000006a8f74 in priv_flow_create_action_queue (flow=3D0x7fffffffcc90, flow=3D0x7fffffffcc90, error=3D, action=3D0x7fffffffcd90, priv=3D0x7ffbfffeb180) at /opt/dpdk/drivers/net/mlx5/mlx5_flow.c:1085 1085 rxq =3D container_of((*priv->rxqs)[action->queues[i]], I hope this helps you to understand the issue. Best regards, Georgios On Mon, Sep 18, 2017 at 6:20 AM, N=C3=A9lio Laranjeiro < nelio.laranjeiro@6wind.com> wrote: > Hi Georgios, > > On Mon, Sep 18, 2017 at 05:26:08AM -0700, george.dit@gmail.com wrote: > > Dear all, > > > > I am implementing my own DPDK application to program a Mellanox NIC (ml= x5 > > driver) but I have some issues. > > Specifically I compose a simple rule that matches only the Ethernet > > header's type field using value 800 (Ethernet frames that encapsulate > IPv4 > > packets). > > Then I compose an action RTE_FLOW_ACTION_TYPE_QUEUE which redirects the > > matched packets to queue index 0. > > > > Using test-pmd, this rule is: "flow create 0 ingress pattern eth type i= s > > 800 / end actions queue index 0 / end" and I get a "Flow rule #0 create= d" > > message. > > In my application I compose the same rule using: > > > > PATTERNS > > > > struct rte_flow_item_eth flow_item_eth_type_ipv4 =3D { > > .dst =3D { > > .addr_bytes =3D { 0 } > > }, > > .src =3D { > > .addr_bytes =3D { 0 } > > }, > > .type =3D RTE_BE16(ETHER_TYPE_IPv4) // from > rte_ether.h > > }; > > > > struct rte_flow_item_eth flow_item_eth_mask_type_ipv4 =3D { > > .dst =3D { > > .addr_bytes =3D { 0 } > > }, > > .src =3D { > > .addr_bytes =3D { 0 } > > }, > > .type =3D 0xFFFF > > // match only the 'type' filed > > }; > > > > struct rte_flow_item patterns[] =3D { > > { > > .type =3D RTE_FLOW_ITEM_TYPE_ETH, > > .spec =3D &flow_item_eth_type_ipv4, > > .last =3D NULL, > > .mask =3D &flow_item_eth_mask_type_ipv4, > > }, > > { > > .type =3D RTE_FLOW_ITEM_TYPE_END, > > .spec =3D NULL, > > .last =3D NULL, > > .mask =3D NULL, > > } > > }; > > > > ACTIONS > > > > struct rte_flow_action_queue queue_conf; > > queue_conf.index =3D 0; > > > > struct rte_flow_action actions[] =3D > > { > > { > > .type =3D RTE_FLOW_ACTION_TYPE_QUEUE, > > .conf =3D &queue_conf > > }, > > { > > .type =3D RTE_FLOW_ACTION_TYPE_END, > > .conf =3D NULL > > } > > }; > > > > PROBLEM > > > > When I pass this rule to rte_flow_validate(...) it is successfully > > validated, but rte_flow_create() crashes although it get the very same > > arguments. > > Can you explain a little more what do you mean by "crash" ? > > > If I replace my Mellanox NIC with an Intel 82599 (using DPDK's ixgbe > > driver), then the validate function returns error: "Caught error type 9 > > (specific pattern item): Not supported by L2 tunnel filter". > > The error reported by the Intel driver is weird because there is no > > tunneling. > > > > I guess some value assignments require strict format and are sensitive > > (e.g., big/little endian) so I would really appreciate your help. > > > > Thanks in advance and best regards, > > Georgios > > With so few informations it is not easy to help, from the code above I > don't see anything wrong. To help can you answer the following points: > > - which version of DPDK are you using, > - which version of MLNX_OFED, > - Is it possible to share your snippet of code (just the pattern/action > allocation) ? > > Regards, > > -- > N=C3=A9lio Laranjeiro > 6WIND > --=20 Georgios Katsikas Industrial Ph.D. Student Network Intelligence Group Decision, Networks, and Analytics (DNA) Lab RISE SICS E-Mail: georgios.katsikas@ri.se