From patchwork Wed May 27 13:23:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 187252 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp1124384ilb; Wed, 27 May 2020 06:31:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfC5vF47V6coR6ZwJWyTRfQv5Ntvyz5Ih+VPkaPpK1AXot7KGz5/h18teTM1nPparyyLlY X-Received: by 2002:adf:ef47:: with SMTP id c7mr27031558wrp.57.1590586275221; Wed, 27 May 2020 06:31:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590586275; cv=none; d=google.com; s=arc-20160816; b=Yii08c0jDGQ9nMaJ7xRbbQ+8sqcoVZ8OJb43JFc8ENc0bWsEJ3NNRfENPKafr1uzpc AoM0+nKKxEZdvUvLbFaTcxjFzpIxAAD3Mcu3BsLAuZbI85/dd3FSeqa/siuiNXp0+G2Y 6CeauoCsaibWpPS+HRBUTGj7A5oVyNi55LYxHoGBnR3aOsH0AoJe2EF14Rhv8xN/UGWY 0mTxbiKNk8aUwx2RSIK8RAnZ41Bc+kGaz0IT3LLhT0S/iezx5Ow1oshomX3ISIUVrzC+ RdD79IODRhRX0jwgdRSNCF+6VjdeQa83mlvON6LWATmKAY5eh7O+r7LoLHUWpV8fNa7A oFfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=G15Tgxk0Hc2M/3F7MskRKHHq889DoMPQdkl/YyCtp8M=; b=ClmerMJ+WKSLRhm8rsrQSCFy41X60b+Q7R6tzQuvzt5SHFT/sf/+fUah7ap/oMoApG s2/A9wvIrf3YJyFRTehfjeiWaPIjIKSpvC3C4HfZN3IGuAr6RYxd7t4RhBTNHv4myjrH IdCBG85pvvUZ+3saUJjxINTXJIr07CRbbKjBFYfaA3e8ZYVSOjxeuHEqByGwRepctKZB BNK2OqlDmdFMF1h5dxiFkdvumCqXvgc9jT5Vu0ZBYz3XGUSEXFL9F+6iI0nnM6MGAKrZ prtpzzIsb7t7cfYONccTNwdo/OcyFlQ+o6pBjcaDaaA6Yn0kmgZFOiWM6hSwRIQCHMgf cczA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id f24si2627631wml.35.2020.05.27.06.31.14; Wed, 27 May 2020 06:31:15 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 04D431DAB6; Wed, 27 May 2020 15:27:11 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id D78871DA4C for ; Wed, 27 May 2020 15:26:42 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id B9DA41A07F2; Wed, 27 May 2020 15:26:42 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id B374B1A07CD; Wed, 27 May 2020 15:26:40 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id E3AAB40326; Wed, 27 May 2020 21:26:34 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org, ferruh.yigit@intel.com Cc: Jun Yang Date: Wed, 27 May 2020 18:53:12 +0530 Message-Id: <20200527132326.1382-24-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200527132326.1382-1-hemant.agrawal@nxp.com> References: <20200527132326.1382-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 23/37] net/dpaa2: dynamic flow control support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Jun Yang Dynamic flow used instead of layout defined. The actual key/mask size depends on protocols and(or) fields of patterns specified. Also, the key and mask should start from the beginning of IOVA. Signed-off-by: Jun Yang --- drivers/net/dpaa2/dpaa2_flow.c | 146 ++++++++------------------------- 1 file changed, 34 insertions(+), 112 deletions(-) -- 2.17.1 diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c index 8aa65db30..05d115c78 100644 --- a/drivers/net/dpaa2/dpaa2_flow.c +++ b/drivers/net/dpaa2/dpaa2_flow.c @@ -33,29 +33,6 @@ struct rte_flow { uint16_t flow_id; }; -/* Layout for rule compositions for supported patterns */ -/* TODO: Current design only supports Ethernet + IPv4 based classification. */ -/* So corresponding offset macros are valid only. Rest are placeholder for */ -/* now. Once support for other netwrok headers will be added then */ -/* corresponding macros will be updated with correct values*/ -#define DPAA2_CLS_RULE_OFFSET_ETH 0 /*Start of buffer*/ -#define DPAA2_CLS_RULE_OFFSET_VLAN 14 /* DPAA2_CLS_RULE_OFFSET_ETH */ - /* + Sizeof Eth fields */ -#define DPAA2_CLS_RULE_OFFSET_IPV4 14 /* DPAA2_CLS_RULE_OFFSET_VLAN */ - /* + Sizeof VLAN fields */ -#define DPAA2_CLS_RULE_OFFSET_IPV6 25 /* DPAA2_CLS_RULE_OFFSET_IPV4 */ - /* + Sizeof IPV4 fields */ -#define DPAA2_CLS_RULE_OFFSET_ICMP 58 /* DPAA2_CLS_RULE_OFFSET_IPV6 */ - /* + Sizeof IPV6 fields */ -#define DPAA2_CLS_RULE_OFFSET_UDP 60 /* DPAA2_CLS_RULE_OFFSET_ICMP */ - /* + Sizeof ICMP fields */ -#define DPAA2_CLS_RULE_OFFSET_TCP 64 /* DPAA2_CLS_RULE_OFFSET_UDP */ - /* + Sizeof UDP fields */ -#define DPAA2_CLS_RULE_OFFSET_SCTP 68 /* DPAA2_CLS_RULE_OFFSET_TCP */ - /* + Sizeof TCP fields */ -#define DPAA2_CLS_RULE_OFFSET_GRE 72 /* DPAA2_CLS_RULE_OFFSET_SCTP */ - /* + Sizeof SCTP fields */ - static const enum rte_flow_item_type dpaa2_supported_pattern_type[] = { RTE_FLOW_ITEM_TYPE_END, @@ -212,7 +189,7 @@ dpaa2_configure_flow_eth(struct rte_flow *flow, (pattern->mask ? pattern->mask : default_mask); /* Key rule */ - key_iova = flow->rule.key_iova + DPAA2_CLS_RULE_OFFSET_ETH; + key_iova = flow->rule.key_iova + flow->key_size; memcpy((void *)key_iova, (const void *)(spec->src.addr_bytes), sizeof(struct rte_ether_addr)); key_iova += sizeof(struct rte_ether_addr); @@ -223,7 +200,7 @@ dpaa2_configure_flow_eth(struct rte_flow *flow, sizeof(rte_be16_t)); /* Key mask */ - mask_iova = flow->rule.mask_iova + DPAA2_CLS_RULE_OFFSET_ETH; + mask_iova = flow->rule.mask_iova + flow->key_size; memcpy((void *)mask_iova, (const void *)(mask->src.addr_bytes), sizeof(struct rte_ether_addr)); mask_iova += sizeof(struct rte_ether_addr); @@ -233,9 +210,9 @@ dpaa2_configure_flow_eth(struct rte_flow *flow, memcpy((void *)mask_iova, (const void *)(&mask->type), sizeof(rte_be16_t)); - flow->rule.key_size = (DPAA2_CLS_RULE_OFFSET_ETH + - ((2 * sizeof(struct rte_ether_addr)) + - sizeof(rte_be16_t))); + flow->key_size += ((2 * sizeof(struct rte_ether_addr)) + + sizeof(rte_be16_t)); + return device_configured; } @@ -335,15 +312,15 @@ dpaa2_configure_flow_vlan(struct rte_flow *flow, mask = (const struct rte_flow_item_vlan *) (pattern->mask ? pattern->mask : default_mask); - key_iova = flow->rule.key_iova + DPAA2_CLS_RULE_OFFSET_VLAN; + key_iova = flow->rule.key_iova + flow->key_size; memcpy((void *)key_iova, (const void *)(&spec->tci), sizeof(rte_be16_t)); - mask_iova = flow->rule.mask_iova + DPAA2_CLS_RULE_OFFSET_VLAN; + mask_iova = flow->rule.mask_iova + flow->key_size; memcpy((void *)mask_iova, (const void *)(&mask->tci), sizeof(rte_be16_t)); - flow->rule.key_size = (DPAA2_CLS_RULE_OFFSET_VLAN + sizeof(rte_be16_t)); + flow->key_size += sizeof(rte_be16_t); return device_configured; } @@ -474,7 +451,7 @@ dpaa2_configure_flow_ipv4(struct rte_flow *flow, mask = (const struct rte_flow_item_ipv4 *) (pattern->mask ? pattern->mask : default_mask); - key_iova = flow->rule.key_iova + DPAA2_CLS_RULE_OFFSET_IPV4; + key_iova = flow->rule.key_iova + flow->key_size; memcpy((void *)key_iova, (const void *)&spec->hdr.src_addr, sizeof(uint32_t)); key_iova += sizeof(uint32_t); @@ -484,7 +461,7 @@ dpaa2_configure_flow_ipv4(struct rte_flow *flow, memcpy((void *)key_iova, (const void *)&spec->hdr.next_proto_id, sizeof(uint8_t)); - mask_iova = flow->rule.mask_iova + DPAA2_CLS_RULE_OFFSET_IPV4; + mask_iova = flow->rule.mask_iova + flow->key_size; memcpy((void *)mask_iova, (const void *)&mask->hdr.src_addr, sizeof(uint32_t)); mask_iova += sizeof(uint32_t); @@ -494,9 +471,7 @@ dpaa2_configure_flow_ipv4(struct rte_flow *flow, memcpy((void *)mask_iova, (const void *)&mask->hdr.next_proto_id, sizeof(uint8_t)); - flow->rule.key_size = (DPAA2_CLS_RULE_OFFSET_IPV4 + - (2 * sizeof(uint32_t)) + sizeof(uint8_t)); - + flow->key_size += (2 * sizeof(uint32_t)) + sizeof(uint8_t); return device_configured; } @@ -613,23 +588,22 @@ dpaa2_configure_flow_ipv6(struct rte_flow *flow, mask = (const struct rte_flow_item_ipv6 *) (pattern->mask ? pattern->mask : default_mask); - key_iova = flow->rule.key_iova + DPAA2_CLS_RULE_OFFSET_IPV6; + key_iova = flow->rule.key_iova + flow->key_size; memcpy((void *)key_iova, (const void *)(spec->hdr.src_addr), sizeof(spec->hdr.src_addr)); key_iova += sizeof(spec->hdr.src_addr); memcpy((void *)key_iova, (const void *)(spec->hdr.dst_addr), sizeof(spec->hdr.dst_addr)); - mask_iova = flow->rule.mask_iova + DPAA2_CLS_RULE_OFFSET_IPV6; + mask_iova = flow->rule.mask_iova + flow->key_size; memcpy((void *)mask_iova, (const void *)(mask->hdr.src_addr), sizeof(mask->hdr.src_addr)); mask_iova += sizeof(mask->hdr.src_addr); memcpy((void *)mask_iova, (const void *)(mask->hdr.dst_addr), sizeof(mask->hdr.dst_addr)); - flow->rule.key_size = (DPAA2_CLS_RULE_OFFSET_IPV6 + - sizeof(spec->hdr.src_addr) + - sizeof(mask->hdr.dst_addr)); + flow->key_size += sizeof(spec->hdr.src_addr) + + sizeof(mask->hdr.dst_addr); return device_configured; } @@ -746,22 +720,21 @@ dpaa2_configure_flow_icmp(struct rte_flow *flow, mask = (const struct rte_flow_item_icmp *) (pattern->mask ? pattern->mask : default_mask); - key_iova = flow->rule.key_iova + DPAA2_CLS_RULE_OFFSET_ICMP; + key_iova = flow->rule.key_iova + flow->key_size; memcpy((void *)key_iova, (const void *)&spec->hdr.icmp_type, sizeof(uint8_t)); key_iova += sizeof(uint8_t); memcpy((void *)key_iova, (const void *)&spec->hdr.icmp_code, sizeof(uint8_t)); - mask_iova = flow->rule.mask_iova + DPAA2_CLS_RULE_OFFSET_ICMP; + mask_iova = flow->rule.mask_iova + flow->key_size; memcpy((void *)mask_iova, (const void *)&mask->hdr.icmp_type, sizeof(uint8_t)); key_iova += sizeof(uint8_t); memcpy((void *)mask_iova, (const void *)&mask->hdr.icmp_code, sizeof(uint8_t)); - flow->rule.key_size = (DPAA2_CLS_RULE_OFFSET_ICMP + - (2 * sizeof(uint8_t))); + flow->key_size += 2 * sizeof(uint8_t); return device_configured; } @@ -837,13 +810,6 @@ dpaa2_configure_flow_udp(struct rte_flow *flow, if (device_configured & DPAA2_QOS_TABLE_RECONFIGURE) { index = priv->extract.qos_key_cfg.num_extracts; - priv->extract.qos_key_cfg.extracts[index].type = - DPKG_EXTRACT_FROM_HDR; - priv->extract.qos_key_cfg.extracts[index].extract.from_hdr.type = DPKG_FULL_FIELD; - priv->extract.qos_key_cfg.extracts[index].extract.from_hdr.prot = NET_PROT_IP; - priv->extract.qos_key_cfg.extracts[index].extract.from_hdr.field = NH_FLD_IP_PROTO; - index++; - priv->extract.qos_key_cfg.extracts[index].type = DPKG_EXTRACT_FROM_HDR; priv->extract.qos_key_cfg.extracts[index].extract.from_hdr.type = DPKG_FULL_FIELD; @@ -862,13 +828,6 @@ dpaa2_configure_flow_udp(struct rte_flow *flow, if (device_configured & DPAA2_FS_TABLE_RECONFIGURE) { index = priv->extract.fs_key_cfg[group].num_extracts; - priv->extract.fs_key_cfg[group].extracts[index].type = - DPKG_EXTRACT_FROM_HDR; - priv->extract.fs_key_cfg[group].extracts[index].extract.from_hdr.type = DPKG_FULL_FIELD; - priv->extract.fs_key_cfg[group].extracts[index].extract.from_hdr.prot = NET_PROT_IP; - priv->extract.fs_key_cfg[group].extracts[index].extract.from_hdr.field = NH_FLD_IP_PROTO; - index++; - priv->extract.fs_key_cfg[group].extracts[index].type = DPKG_EXTRACT_FROM_HDR; priv->extract.fs_key_cfg[group].extracts[index].extract.from_hdr.type = DPKG_FULL_FIELD; @@ -892,25 +851,21 @@ dpaa2_configure_flow_udp(struct rte_flow *flow, mask = (const struct rte_flow_item_udp *) (pattern->mask ? pattern->mask : default_mask); - key_iova = flow->rule.key_iova + DPAA2_CLS_RULE_OFFSET_IPV4 + - (2 * sizeof(uint32_t)); - memset((void *)key_iova, 0x11, sizeof(uint8_t)); - key_iova = flow->rule.key_iova + DPAA2_CLS_RULE_OFFSET_UDP; + key_iova = flow->rule.key_iova + flow->key_size; memcpy((void *)key_iova, (const void *)(&spec->hdr.src_port), sizeof(uint16_t)); key_iova += sizeof(uint16_t); memcpy((void *)key_iova, (const void *)(&spec->hdr.dst_port), sizeof(uint16_t)); - mask_iova = flow->rule.mask_iova + DPAA2_CLS_RULE_OFFSET_UDP; + mask_iova = flow->rule.mask_iova + flow->key_size; memcpy((void *)mask_iova, (const void *)(&mask->hdr.src_port), sizeof(uint16_t)); mask_iova += sizeof(uint16_t); memcpy((void *)mask_iova, (const void *)(&mask->hdr.dst_port), sizeof(uint16_t)); - flow->rule.key_size = (DPAA2_CLS_RULE_OFFSET_UDP + - (2 * sizeof(uint16_t))); + flow->key_size += (2 * sizeof(uint16_t)); return device_configured; } @@ -986,13 +941,6 @@ dpaa2_configure_flow_tcp(struct rte_flow *flow, if (device_configured & DPAA2_QOS_TABLE_RECONFIGURE) { index = priv->extract.qos_key_cfg.num_extracts; - priv->extract.qos_key_cfg.extracts[index].type = - DPKG_EXTRACT_FROM_HDR; - priv->extract.qos_key_cfg.extracts[index].extract.from_hdr.type = DPKG_FULL_FIELD; - priv->extract.qos_key_cfg.extracts[index].extract.from_hdr.prot = NET_PROT_IP; - priv->extract.qos_key_cfg.extracts[index].extract.from_hdr.field = NH_FLD_IP_PROTO; - index++; - priv->extract.qos_key_cfg.extracts[index].type = DPKG_EXTRACT_FROM_HDR; priv->extract.qos_key_cfg.extracts[index].extract.from_hdr.type = DPKG_FULL_FIELD; @@ -1012,13 +960,6 @@ dpaa2_configure_flow_tcp(struct rte_flow *flow, if (device_configured & DPAA2_FS_TABLE_RECONFIGURE) { index = priv->extract.fs_key_cfg[group].num_extracts; - priv->extract.fs_key_cfg[group].extracts[index].type = - DPKG_EXTRACT_FROM_HDR; - priv->extract.fs_key_cfg[group].extracts[index].extract.from_hdr.type = DPKG_FULL_FIELD; - priv->extract.fs_key_cfg[group].extracts[index].extract.from_hdr.prot = NET_PROT_IP; - priv->extract.fs_key_cfg[group].extracts[index].extract.from_hdr.field = NH_FLD_IP_PROTO; - index++; - priv->extract.fs_key_cfg[group].extracts[index].type = DPKG_EXTRACT_FROM_HDR; priv->extract.fs_key_cfg[group].extracts[index].extract.from_hdr.type = DPKG_FULL_FIELD; @@ -1042,25 +983,21 @@ dpaa2_configure_flow_tcp(struct rte_flow *flow, mask = (const struct rte_flow_item_tcp *) (pattern->mask ? pattern->mask : default_mask); - key_iova = flow->rule.key_iova + DPAA2_CLS_RULE_OFFSET_IPV4 + - (2 * sizeof(uint32_t)); - memset((void *)key_iova, 0x06, sizeof(uint8_t)); - key_iova = flow->rule.key_iova + DPAA2_CLS_RULE_OFFSET_TCP; + key_iova = flow->rule.key_iova + flow->key_size; memcpy((void *)key_iova, (const void *)(&spec->hdr.src_port), sizeof(uint16_t)); key_iova += sizeof(uint16_t); memcpy((void *)key_iova, (const void *)(&spec->hdr.dst_port), sizeof(uint16_t)); - mask_iova = flow->rule.mask_iova + DPAA2_CLS_RULE_OFFSET_TCP; + mask_iova = flow->rule.mask_iova + flow->key_size; memcpy((void *)mask_iova, (const void *)(&mask->hdr.src_port), sizeof(uint16_t)); mask_iova += sizeof(uint16_t); memcpy((void *)mask_iova, (const void *)(&mask->hdr.dst_port), sizeof(uint16_t)); - flow->rule.key_size = (DPAA2_CLS_RULE_OFFSET_TCP + - (2 * sizeof(uint16_t))); + flow->key_size += 2 * sizeof(uint16_t); return device_configured; } @@ -1136,13 +1073,6 @@ dpaa2_configure_flow_sctp(struct rte_flow *flow, if (device_configured & DPAA2_QOS_TABLE_RECONFIGURE) { index = priv->extract.qos_key_cfg.num_extracts; - priv->extract.qos_key_cfg.extracts[index].type = - DPKG_EXTRACT_FROM_HDR; - priv->extract.qos_key_cfg.extracts[index].extract.from_hdr.type = DPKG_FULL_FIELD; - priv->extract.qos_key_cfg.extracts[index].extract.from_hdr.prot = NET_PROT_IP; - priv->extract.qos_key_cfg.extracts[index].extract.from_hdr.field = NH_FLD_IP_PROTO; - index++; - priv->extract.qos_key_cfg.extracts[index].type = DPKG_EXTRACT_FROM_HDR; priv->extract.qos_key_cfg.extracts[index].extract.from_hdr.type = DPKG_FULL_FIELD; @@ -1162,13 +1092,6 @@ dpaa2_configure_flow_sctp(struct rte_flow *flow, if (device_configured & DPAA2_FS_TABLE_RECONFIGURE) { index = priv->extract.fs_key_cfg[group].num_extracts; - priv->extract.fs_key_cfg[group].extracts[index].type = - DPKG_EXTRACT_FROM_HDR; - priv->extract.fs_key_cfg[group].extracts[index].extract.from_hdr.type = DPKG_FULL_FIELD; - priv->extract.fs_key_cfg[group].extracts[index].extract.from_hdr.prot = NET_PROT_IP; - priv->extract.fs_key_cfg[group].extracts[index].extract.from_hdr.field = NH_FLD_IP_PROTO; - index++; - priv->extract.fs_key_cfg[group].extracts[index].type = DPKG_EXTRACT_FROM_HDR; priv->extract.fs_key_cfg[group].extracts[index].extract.from_hdr.type = DPKG_FULL_FIELD; @@ -1192,25 +1115,22 @@ dpaa2_configure_flow_sctp(struct rte_flow *flow, mask = (const struct rte_flow_item_sctp *) (pattern->mask ? pattern->mask : default_mask); - key_iova = flow->rule.key_iova + DPAA2_CLS_RULE_OFFSET_IPV4 + - (2 * sizeof(uint32_t)); - memset((void *)key_iova, 0x84, sizeof(uint8_t)); - key_iova = flow->rule.key_iova + DPAA2_CLS_RULE_OFFSET_SCTP; + key_iova = flow->rule.key_iova + flow->key_size; memcpy((void *)key_iova, (const void *)(&spec->hdr.src_port), sizeof(uint16_t)); key_iova += sizeof(uint16_t); memcpy((void *)key_iova, (const void *)(&spec->hdr.dst_port), sizeof(uint16_t)); - mask_iova = flow->rule.mask_iova + DPAA2_CLS_RULE_OFFSET_SCTP; + mask_iova = flow->rule.mask_iova + flow->key_size; memcpy((void *)mask_iova, (const void *)(&mask->hdr.src_port), sizeof(uint16_t)); mask_iova += sizeof(uint16_t); memcpy((void *)mask_iova, (const void *)(&mask->hdr.dst_port), sizeof(uint16_t)); - flow->rule.key_size = (DPAA2_CLS_RULE_OFFSET_SCTP + - (2 * sizeof(uint16_t))); + flow->key_size += 2 * sizeof(uint16_t); + return device_configured; } @@ -1313,15 +1233,15 @@ dpaa2_configure_flow_gre(struct rte_flow *flow, mask = (const struct rte_flow_item_gre *) (pattern->mask ? pattern->mask : default_mask); - key_iova = flow->rule.key_iova + DPAA2_CLS_RULE_OFFSET_GRE; + key_iova = flow->rule.key_iova + flow->key_size; memcpy((void *)key_iova, (const void *)(&spec->protocol), sizeof(rte_be16_t)); - mask_iova = flow->rule.mask_iova + DPAA2_CLS_RULE_OFFSET_GRE; + mask_iova = flow->rule.mask_iova + flow->key_size; memcpy((void *)mask_iova, (const void *)(&mask->protocol), sizeof(rte_be16_t)); - flow->rule.key_size = (DPAA2_CLS_RULE_OFFSET_GRE + sizeof(rte_be16_t)); + flow->key_size += sizeof(rte_be16_t); return device_configured; } @@ -1503,6 +1423,7 @@ dpaa2_generic_flow_set(struct rte_flow *flow, action.flow_id = action.flow_id % nic_attr.num_rx_tcs; index = flow->index + (flow->tc_id * nic_attr.fs_entries); + flow->rule.key_size = flow->key_size; ret = dpni_add_qos_entry(dpni, CMD_PRI_LOW, priv->token, &flow->rule, flow->tc_id, index, @@ -1606,6 +1527,7 @@ dpaa2_generic_flow_set(struct rte_flow *flow, /* Add Rule into QoS table */ index = flow->index + (flow->tc_id * nic_attr.fs_entries); + flow->rule.key_size = flow->key_size; ret = dpni_add_qos_entry(dpni, CMD_PRI_LOW, priv->token, &flow->rule, flow->tc_id, index, 0, 0); @@ -1862,7 +1784,7 @@ struct rte_flow *dpaa2_flow_create(struct rte_eth_dev *dev, flow->rule.key_iova = key_iova; flow->rule.mask_iova = mask_iova; - flow->rule.key_size = 0; + flow->key_size = 0; switch (dpaa2_filter_type) { case RTE_ETH_FILTER_GENERIC: