From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 86757A0524;
	Mon, 19 Apr 2021 15:02:37 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 7A435412ED;
	Mon, 19 Apr 2021 15:02:28 +0200 (CEST)
Received: from NAM11-DM6-obe.outbound.protection.outlook.com
 (mail-dm6nam11on2074.outbound.protection.outlook.com [40.107.223.74])
 by mails.dpdk.org (Postfix) with ESMTP id 31BDE4123B;
 Mon, 19 Apr 2021 15:02:26 +0200 (CEST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=OF9Ket8ah9cKqLTcjEvbm0wTq/iUbs9yX0pcVMcY6UZlq6Qln817eKPjbMQPSl+T6sTgu4ji7xbyjN6lmgaG1/33sCUDobdax0esCXSrlyh8m8EsOw1Sp7QhSOlmGbVChqqOFkfzYiyxYqzP603Tb0qA73g9IpFrMI200lEbyqNsQebmuWohuD0waCwxxFp4ReaqKh0faoOlNqBdXN7wUIlqSh6JcDbzXDBbLorhUh2a31qsrwzEIpkA2OuEO6FZyyqV14oUxnIxjRn80ofJ3p/tKBQJyhsrAwkyrF0lFvvRaT3ooij8QxYY5Fr2g4xGIB+JqcoThVatiGzUgG5eVQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=63JEDHQIjJACnyvJDzVjQJzglLOdE3LuoW+1d0rJSqo=;
 b=GN/oemCyO2vtTg+oIYEal/h4gZMeHiSWoEqfIJ4ots/voTsMeVhpNa+5TpS7I+LSHUwuczfZt4pmN6LtfA/t//j/ej5ZrHq3DbyG2wbZv1bQstHe+1JU/CWnOa3OS7IJ30HSQM88rVeL68ZWmR3c3tZXT4zjwfhLhklCTODcWKKipTYUSaswWKj7NGpI5at1ha1ucT1ReV7pizZHeOsd+AImhoyF8NvlmLOQH5sLqWmaZE8r1xrHEWHxu2DNbiAC72FdJY4IY93M8tGBlWlzhN60fa0fyTvPpt2Dtw82GYHaghKT4+9GJBX0S5bPMArK2WgZVVWjPBBhZYy4SWuBHw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is
 216.228.112.34) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com;
 dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com;
 dkim=none (message not signed); arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;
 s=selector2;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=63JEDHQIjJACnyvJDzVjQJzglLOdE3LuoW+1d0rJSqo=;
 b=iOPMJS65bqvdIRrIcMiYsfFI8/lpyWX9kIiYfzVEW3GB4SUcLnKBqG8JdifGb/qNdhQp9hPXZvtc1o+sQ23WSW1cVGCiKp8yTE3hs7bmsgWKXxCbxTDvDp285Xo5V2jxtVuQ8pTNj7ucJXp0BMc3+OsxXT6mFsl2JoM+vp0FTinDHE0P3t9MVI0yVKWiOVhWtjg1Eyu5XGI6JkXJdr0yr0WToNM/58BIJQ9zUWvodvA4eItdYW0LqI2brJH3JxpvCHlcJHwVFKmLTA7Nz0sKEU27zrE28F1rqW/LKPby3f0SY3qzqsdiOvYjQgeDKHOEGZ4eBXFjhXJ1KVcInI76SA==
Received: from MWHPR19CA0009.namprd19.prod.outlook.com (2603:10b6:300:d4::19)
 by CH2PR12MB4905.namprd12.prod.outlook.com (2603:10b6:610:64::20)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.19; Mon, 19 Apr
 2021 13:02:24 +0000
Received: from CO1NAM11FT046.eop-nam11.prod.protection.outlook.com
 (2603:10b6:300:d4:cafe::1) by MWHPR19CA0009.outlook.office365.com
 (2603:10b6:300:d4::19) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16 via Frontend
 Transport; Mon, 19 Apr 2021 13:02:24 +0000
X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34)
 smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed)
 header.d=none;intel.com; dmarc=pass action=none header.from=nvidia.com;
Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates
 216.228.112.34 as permitted sender) receiver=protection.outlook.com;
 client-ip=216.228.112.34; helo=mail.nvidia.com;
Received: from mail.nvidia.com (216.228.112.34) by
 CO1NAM11FT046.mail.protection.outlook.com (10.13.174.203) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id
 15.20.4042.16 via Frontend Transport; Mon, 19 Apr 2021 13:02:24 +0000
Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com
 (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 19 Apr
 2021 13:02:22 +0000
From: Gregory Etelson <getelson@nvidia.com>
To: <dev@dpdk.org>
CC: <getelson@nvidia.com>, <matan@nvidia.com>, <rasland@nvidia.com>,
 <stable@dpdk.org>, Viacheslav Ovsiienko <viacheslavo@mellanox.com>, "Xiaoyun
 Li" <xiaoyun.li@intel.com>
Date: Mon, 19 Apr 2021 16:02:04 +0300
Message-ID: <20210419130204.24348-2-getelson@nvidia.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20210419130204.24348-1-getelson@nvidia.com>
References: <20210419130204.24348-1-getelson@nvidia.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Originating-IP: [172.20.145.6]
X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To
 HQMAIL107.nvidia.com (172.20.187.13)
X-EOPAttributedMessage: 0
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id: 217ed080-66ac-4986-f2f0-08d903336079
X-MS-TrafficTypeDiagnostic: CH2PR12MB4905:
X-Microsoft-Antispam-PRVS: <CH2PR12MB4905B29D54755A32451FEC2AA5499@CH2PR12MB4905.namprd12.prod.outlook.com>
X-MS-Exchange-Transport-Forked: True
X-MS-Oob-TLC-OOBClassifiers: OLM:5516;
X-MS-Exchange-SenderADCheck: 1
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: FeCMLMSWILgZTROGm8SHu9WmZKQm3VIEPbhIRDn8d0sxv+nYCvUxt36GRObnT8nTJZ0VMkXK2Ka2tpB12pAN5WHlrocCgP6MJgZkDpZtn31p3svnZUv78P35KYVApO2QCtPejnNchdpt4lTN+0YqSUzItWAVTtK5RxGIqID9+cPSpcI5bbiDz7k98oq9oYjBg+iJUGEj9Ly7S5o1vwJnH+E+U9te8vN25ZEtrTG4ilzFidqomUUWseULiFaZTAexMqMDLixLwzIvPtOSX9A+r+7JKNuJqzhgHjeXhWBtfh2/vWeEAS/J+mrf377JRnG5OhY0RDfNxskErzZz7GXPZmNtGRj2SUsAJ1NCjUL2uo2w3gU9A8UHpmPf2mWH+hoTEE7VBDP+NDBoED84rj4z360/DZx+A0ISRacCSdghIPAl60ahEQs867Wm148L1zHDCM5byp60WHWk5gf4pkwwYnx4Nh+42Be9GwVPDA0NFwapqS3xZiqzB2iNo49FBm7t0hYjH2LWLt1+c7b8wIiJ+9v5OgPSe9PH0Hvepmqz6Duwg7m2YT2BDfZzw393k1wq4cJrFlHlbrgRTa2fPtDXjKAE1UQXe+y6uXFSwJtvhw68tPKFJ//EFh9UOzlH2c+85bcEQ28KW29Wl/nfLI319iDEFXLicNCrXRhHyznSUNk=
X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE;
 SFS:(4636009)(376002)(346002)(39860400002)(136003)(396003)(36840700001)(46966006)(6286002)(55016002)(5660300002)(4326008)(82310400003)(86362001)(70586007)(7636003)(356005)(7696005)(8936002)(70206006)(83380400001)(36756003)(82740400003)(6916009)(2616005)(336012)(47076005)(1076003)(478600001)(8676002)(316002)(36860700001)(186003)(2906002)(36906005)(6666004)(426003)(54906003)(16526019)(26005);
 DIR:OUT; SFP:1101; 
X-OriginatorOrg: Nvidia.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2021 13:02:24.5436 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 217ed080-66ac-4986-f2f0-08d903336079
X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34];
 Helo=[mail.nvidia.com]
X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT046.eop-nam11.prod.protection.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4905
Subject: [dpdk-dev] [PATCH 2/2] app/testpmd: fix tunnel offload private
 items location
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Flow rules used in tunnel offload model require application to query
PMD for private flow elements and explicitly add these elements to
flow rule.
Tunnel offload model does not restrict private elements location in
a flow rule.
The patch places tunnel offload private PMD flow elements between
general RTE flow elements in a rule.

Fixes: 1b9f274623b8 ("app/testpmd: add commands for tunnel offload")

Cc: stable@dpdk.org

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 app/test-pmd/config.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index ef0b9784d..da5e843fd 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1663,7 +1663,7 @@ port_flow_tunnel_offload_cmd_prep(portid_t port_id,
 		     aptr->type != RTE_FLOW_ACTION_TYPE_END;
 		     aptr++, num_actions++);
 		pft->actions = malloc(
-				(num_actions +  pft->num_pmd_actions) *
+				(num_actions +  pft->num_pmd_actions + 1) *
 				sizeof(actions[0]));
 		if (!pft->actions) {
 			rte_flow_tunnel_action_decap_release(
@@ -1671,9 +1671,10 @@ port_flow_tunnel_offload_cmd_prep(portid_t port_id,
 					pft->num_pmd_actions, &error);
 			return NULL;
 		}
-		rte_memcpy(pft->actions, pft->pmd_actions,
+		pft->actions[0].type = RTE_FLOW_ACTION_TYPE_VOID;
+		rte_memcpy(pft->actions + 1, pft->pmd_actions,
 			   pft->num_pmd_actions * sizeof(actions[0]));
-		rte_memcpy(pft->actions + pft->num_pmd_actions, actions,
+		rte_memcpy(pft->actions + pft->num_pmd_actions + 1, actions,
 			   num_actions * sizeof(actions[0]));
 	}
 	if (tunnel_ops->items) {
@@ -1691,7 +1692,7 @@ port_flow_tunnel_offload_cmd_prep(portid_t port_id,
 		for (iptr = pattern, num_items = 1;
 		     iptr->type != RTE_FLOW_ITEM_TYPE_END;
 		     iptr++, num_items++);
-		pft->items = malloc((num_items + pft->num_pmd_items) *
+		pft->items = malloc((num_items + pft->num_pmd_items + 1) *
 				    sizeof(pattern[0]));
 		if (!pft->items) {
 			rte_flow_tunnel_item_release(
@@ -1699,9 +1700,10 @@ port_flow_tunnel_offload_cmd_prep(portid_t port_id,
 					pft->num_pmd_items, &error);
 			return NULL;
 		}
-		rte_memcpy(pft->items, pft->pmd_items,
+		pft->items[0].type = RTE_FLOW_ITEM_TYPE_VOID;
+		rte_memcpy(pft->items + 1, pft->pmd_items,
 			   pft->num_pmd_items * sizeof(pattern[0]));
-		rte_memcpy(pft->items + pft->num_pmd_items, pattern,
+		rte_memcpy(pft->items + pft->num_pmd_items + 1, pattern,
 			   num_items * sizeof(pattern[0]));
 	}
 
-- 
2.25.1