From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by dpdk.org (Postfix) with ESMTP id 333AF5F2C for ; Tue, 25 Sep 2018 01:07:44 +0200 (CEST) Received: by mail-lf1-f51.google.com with SMTP id v17-v6so14369056lfe.3 for ; Mon, 24 Sep 2018 16:07:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=vA8unsTJg2Rsd2i33tVQnCuNMEXvSknvsZQ9Rf5y450=; b=QtohIdrftZzi7zwjG34JBE761k6ra/C260v5/6VcSlxYo7gEjANiUnmHGTvgOYuxDM kr7BdZghlN+M2I7BPDybTaksnPYeLZSMnjcieLXA149IdfW1EFNMSk7G4UnaEJTeARiQ 4+TDoL0FKBtHPv18OGyLItRwD0nJwlIYxWb//Psiv2JdD+zqLyemYWBEBbpYLe60dcS3 tfGV4ifXWfmomROvaASsMeJTfSQBg/WNS9ml0xKy1hJ10Ut+VH6OFPq1YFXWV/MNc0FQ VNcJNa/Z2KO6j3p4ZXm36qffQlUuRQ26JeKuqsc/XJKWyXFyKwXAMc0Gq44VKOWhwHnI +nZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=vA8unsTJg2Rsd2i33tVQnCuNMEXvSknvsZQ9Rf5y450=; b=mGq9WAgmhG36l7AgkjYoOdx6h4mbWTm20zFrXgA5KRPLU1kRbaJN+hsSi7SSVLBTQU nU3T6qfy2tcYhIYve7WUCjXMVfWgVQUI6u86gnCIS4OTrqB3tFQlFdWVJ+uQzmFYEKFg o6mj6ZbdG0NiepjswS+jED2Jh9p/HSj26pWsrmpcg5OIQCedL9etbHGGv37Rsny4HzLn IjwR1yIXRBz6sCb5yjPb7xfysiX4b9t6rz0dbQlJ+Cm1EDdFlwifwJ02uBL5Wly7krDB pSjxanymjWR+vMf8eQH+9PESyyxqKAYexwFbruHWKQHglylprUgwHgFTZc/DDi3Hqbly Os8g== X-Gm-Message-State: ABuFfoj2Pq0Ow1Z6G59eZ6Zc4mUELqlsIqPtRZycNUbYxjc5o7snk2zj n1VNitY6kG+fLPEIbR+uqS8DLmqBrR6rkeYRepyYcjAL X-Google-Smtp-Source: ACcGV60U7f5kWTcxT/maGEwSRmugXud+AJ16WE46PRQTkmhS9Ik1zqn26xy8HrhdF9PAS9ijHSpcyLZ/XhLBCUH2JuM= X-Received: by 2002:a19:ce50:: with SMTP id e77-v6mr642473lfg.81.1537830463121; Mon, 24 Sep 2018 16:07:43 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Arvind Narayanan Date: Mon, 24 Sep 2018 18:07:31 -0500 Message-ID: To: users@dpdk.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-users] rte_flow MARK action with Mellanox 100G Card to offload flow tagging to HW 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, 24 Sep 2018 23:07:44 -0000 I was able to solve this issue. It was my mistake. Just in case if anyone hits this issue, make sure you install the rule correctly (e.g. 5-tuple fields are assigned properly in the rte_flow actions/patterns). I was performing both rte_cpu_to_be_32( htonl() ) for src and dst ip addresses instead of using them once. This resulted in successful rule installation, however when packets came in, they didn't match any rule. When packets did not match any rule, they were all going to queue 0 unless you isolate the ingress traffic to only allow pkts that match rules created by rte_flow. Thanks, Arvind On Fri, Sep 21, 2018 at 2:20 PM Arvind Narayanan wrote: > Hi, > > I am trying to use rte_flow's MARK action to set hash.fdir.hi field with > whatever I set via rte_flow action. I adapt the flow_filtering example and > create another function which takes 3 actions. I have also checked out this > blog post and my > implementation is similar to theirs. > > I am able to create the flow without any error, however when I pass the > packets, hash.fdir.hi field in rte_mbuf is not set nor is mb->ol_flags & > PKT_RX_FDIR_ID set. Am I missing anything here? > > RTE_LOG(INFO, MM, "Index %d (%d.%d) found by HW\n", bufs[i]->hash.fdir.hi, > bufs[i]->hash.fdir.hi >> 1, bufs[i]->hash.fdir.hi & 1); > > stdout: > MM: Index -1 (2147483647.1) found by HW > > Dell R620 with Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz (6 cores) > NIC: Mellanox ConnectX-5 EN 100G (MCX516A-CDAT) > Only one socket is there. > HT is disabled. > isolcpus=1-5 > DPDK 18.08 > Ubuntu 16.04 LTS > Driver MLNX_OFED_LINUX-4.4-2.0.7.0-ubuntu16.04-x86_64 was installed > > For more information, this is function I use to set the MARK field (or > install the rte_flow rule). > > struct rte_flow * > generate_ipv4_flow_tag(uint16_t port_id, uint16_t rx_q, > uint32_t src_ip, uint32_t src_mask, > uint32_t dest_ip, uint32_t dest_mask, uint32_t tag, > struct rte_flow_error *error) > { > struct rte_flow_attr attr; > struct rte_flow_item pattern[MAX_PATTERN_NUM]; > struct rte_flow_action action[MAX_PATTERN_NUM]; > struct rte_flow *flow = NULL; > struct rte_flow_action_queue queue = { .index = rx_q }; > struct rte_flow_action_mark mark = { .id = tag }; > struct rte_flow_item_eth eth_spec; > struct rte_flow_item_eth eth_mask; > struct rte_flow_item_ipv4 ip_spec; > struct rte_flow_item_ipv4 ip_mask; > int res; > > memset(pattern, 0, sizeof(pattern)); > memset(action, 0, sizeof(action)); > > /* > * set the rule attribute. > * in this case only ingress packets will be checked. > */ > memset(&attr, 0, sizeof(struct rte_flow_attr)); > attr.ingress = 1; > > /* > * create the action sequence. > * one action only, move packet to queue > */ > > action[0].type = RTE_FLOW_ACTION_TYPE_QUEUE; > action[0].conf = &queue; > action[1].type = RTE_FLOW_ACTION_TYPE_MARK; > action[1].conf = &mark; > action[2].type = RTE_FLOW_ACTION_TYPE_END; > > /* > * set the first level of the pattern (eth). > * since in this example we just want to get the > * ipv4 we set this level to allow all. > */ > memset(ð_spec, 0, sizeof(struct rte_flow_item_eth)); > memset(ð_mask, 0, sizeof(struct rte_flow_item_eth)); > eth_spec.type = 0; > eth_mask.type = 0; > pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH; > pattern[0].spec = ð_spec; > pattern[0].mask = ð_mask; > > /* > * setting the third level of the pattern (ip). > * in this example this is the level we care about > * so we set it according to the parameters. > */ > memset(&ip_spec, 0, sizeof(struct rte_flow_item_ipv4)); > memset(&ip_mask, 0, sizeof(struct rte_flow_item_ipv4)); > ip_spec.hdr.dst_addr = htonl(dest_ip); > ip_mask.hdr.dst_addr = dest_mask; > ip_spec.hdr.src_addr = htonl(src_ip); > ip_mask.hdr.src_addr = src_mask; > pattern[1].type = RTE_FLOW_ITEM_TYPE_IPV4; > pattern[1].spec = &ip_spec; > pattern[1].mask = &ip_mask; > > /* the final level must be always type end */ > pattern[2].type = RTE_FLOW_ITEM_TYPE_END; > > res = rte_flow_validate(port_id, &attr, pattern, action, error); > if (!res) > flow = rte_flow_create(port_id, &attr, pattern, action, error); > > return flow; > } > > > Can anyone please help me with what I may be missing? > > Thanks, > > Arvind > >