From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 371B5A0599;
	Fri, 10 Apr 2020 04:43:57 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 5935E1D44F;
	Fri, 10 Apr 2020 04:43:56 +0200 (CEST)
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93])
 by dpdk.org (Postfix) with ESMTP id 25F061D44E
 for <dev@dpdk.org>; Fri, 10 Apr 2020 04:43:53 +0200 (CEST)
IronPort-SDR: dKt5f5nFwDGaZcjumskeU6PxBuwaac82R7AoFNtQNnlV15zsyHmQsjnyA7p0jcgI8FhZ8OqpvN
 91PnWJYfxriw==
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga003.jf.intel.com ([10.7.209.27])
 by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 09 Apr 2020 19:43:52 -0700
IronPort-SDR: 5R9OmDubnW3LXGR4sXEGaGImwlukHylhPMwPk99DI/JcRhSU/6jccmnxKS9bp9Fcxaj4KsblcO
 4chlICqyrkjQ==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.72,364,1580803200"; d="scan'208";a="252084566"
Received: from orsmsx108.amr.corp.intel.com ([10.22.240.6])
 by orsmga003.jf.intel.com with ESMTP; 09 Apr 2020 19:43:52 -0700
Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by
 ORSMSX108.amr.corp.intel.com (10.22.240.6) with Microsoft SMTP Server (TLS)
 id 14.3.439.0; Thu, 9 Apr 2020 19:43:52 -0700
Received: from orsmsx606.amr.corp.intel.com (10.22.229.19) by
 ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.1713.5; Thu, 9 Apr 2020 19:43:51 -0700
Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by
 orsmsx606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5
 via Frontend Transport; Thu, 9 Apr 2020 19:43:51 -0700
Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.51) by
 edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server
 (TLS) id 14.3.439.0; Thu, 9 Apr 2020 19:41:35 -0700
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=WdzzBQusyR4YE6VtyfHSo4ftA50JLDE0cVkPFpxLZcVVc0a1VfXVdOoaRNm/WXIiU64yCvQZtGlprNbs7M0RpOs1ZlYQh6hoI4FResnOxNWdAQcHtiAf42hoMGiLji53Irnlg6jnzuz0TJBHXDXWHoxKcMNqng7pQT1//K8Y029dt4jYX4J+eGQhOY04oo9n6pC0Eh6wRHDj6uBthN9Q7A2/b99I5IvQjOeRQ+xhZCguepUcZH5Df1NcGtU+/eIki+ijSDq4+c4ARtgvMPOI0aJJXl6Th1ivR8OYTiWFIun4P/PDc0pC471r6O+Fu1epGFVtJACt5uo7c3CZK2JYwQ==
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=J3gw8aBHqSAKtpnLlEDV/HXVjn+aHXKu2q2KFagogw0=;
 b=ci5iWMMk1eb7kNW2PKSGaqv+Uu754uXZnrpiLTwv+r+dexcqhaIbL6AZhtYOR9lmGh9s5YuaMw2TZvlnPGdIAusSJx2gNVBOOdXgyWMwZmk92uHCyf58JESr0ID/uF//qRK5VVxEh8CC1YGh60dkQFBPZECY86Imuz8Gma1UvHhI2sM+TZoGbyql7G4bpB4OmJDP6MuGpp2jW+C9z+74Kpaqp8+VtIK8hwCx9sxXIeuggPDZ+NICH2Oq0lzQvaXimbiEJBeEoVpcOnc9EMp7ASiZrMXKBjpXo7/hxnyow0nPgubtIgYCEbPNeEGIkaOJGtxjBdvn5fsbyGRzG/K1FA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com;
 dkim=pass header.d=intel.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; 
 s=selector2-intel-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=J3gw8aBHqSAKtpnLlEDV/HXVjn+aHXKu2q2KFagogw0=;
 b=xL/F6Z3qMot4J2K1p6bnYz4zNvz7dsDwyCBhJzv2cgJkwpCVUW6Ab1S3jgFMokm5px90uSm30IyhAmFA9cUgrsIaDnSRpTkMYXcYo+nlJr4kkuUVWb23dJ2BuIFrjKlizWfWZjDnHBh61EVXLCDmT4Gp756DQtWoYFBQgmlpeS4=
Received: from BY5PR11MB3893.namprd11.prod.outlook.com (2603:10b6:a03:183::26)
 by BY5PR11MB4355.namprd11.prod.outlook.com (2603:10b6:a03:1c3::13)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.15; Fri, 10 Apr
 2020 02:40:36 +0000
Received: from BY5PR11MB3893.namprd11.prod.outlook.com
 ([fe80::65ec:b3c9:7f24:d067]) by BY5PR11MB3893.namprd11.prod.outlook.com
 ([fe80::65ec:b3c9:7f24:d067%6]) with mapi id 15.20.2900.015; Fri, 10 Apr 2020
 02:40:36 +0000
From: "Peng, Yuan" <yuan.peng@intel.com>
To: "Zhao1, Wei" <wei.zhao1@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
CC: "Zhang, Qi Z" <qi.z.zhang@intel.com>, "Lu, Nannan" <nannan.lu@intel.com>, 
 "Peng, Yuan" <yuan.peng@intel.com>
Thread-Topic: [PATCH 3/3] net/ice/base: force switch to use different recipe
 for
Thread-Index: AQHWDtPzcw/qkPHl6Uedu4RpHZ+x1KhxpN6Q
Date: Fri, 10 Apr 2020 02:40:36 +0000
Message-ID: <BY5PR11MB38934D436F55F59083CA8918FEDE0@BY5PR11MB3893.namprd11.prod.outlook.com>
References: <20200410004157.3032-1-wei.zhao1@intel.com>
 <20200410004157.3032-4-wei.zhao1@intel.com>
In-Reply-To: <20200410004157.3032-4-wei.zhao1@intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzAyYTBmZmMtZTMzNC00YzQ3LWJmMDktMGNhMjM2N2ZlZTIxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoieFo3aksxU1E4Y0Y1NzNxb1wvWVwveHZkeGNEVHByU0xXekwyRkFcL3JSZjcreTRlb0tcLzVEVDVYbzdHMVc1MHBiZ3AifQ==
dlp-version: 11.2.0.6
dlp-product: dlpe-windows
x-ctpclassification: CTP_NT
dlp-reaction: no-action
authentication-results: spf=none (sender IP is )
 smtp.mailfrom=yuan.peng@intel.com; 
x-originating-ip: [192.55.52.222]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: b404bac9-2db1-45cc-12aa-08d7dcf88cd6
x-ms-traffictypediagnostic: BY5PR11MB4355:
x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr
x-ms-exchange-transport-forked: True
x-microsoft-antispam-prvs: <BY5PR11MB435556B283D1AD2E8067D791FEDE0@BY5PR11MB4355.namprd11.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:813;
x-forefront-prvs: 0369E8196C
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:BY5PR11MB3893.namprd11.prod.outlook.com; PTR:; CAT:NONE;
 SFTY:;
 SFS:(10019020)(39860400002)(366004)(396003)(136003)(376002)(346002)(81156014)(110136005)(8676002)(6506007)(107886003)(2906002)(9686003)(316002)(478600001)(86362001)(4326008)(7696005)(55016002)(64756008)(33656002)(66446008)(76116006)(66946007)(26005)(8936002)(52536014)(71200400001)(186003)(66556008)(54906003)(53546011)(5660300002)(66476007);
 DIR:OUT; SFP:1102; 
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: 3HATTUFPVTiWv3WAAhIGz53w2NTlHVQh3oYlbWW49Fvh5EsOKh+g9Z87gWDSjTWq6X4SNzgSle2dntfenvT9wQq8hGFob54IKhfAePuSyr9EOrwCDWznrb30isuVwJJiPikQvFe+V971ojCK9qCsy6Ou1RfrXbIBteLKNg4BZE1jr/4h8wUYVt0101LFoV8/FTwDtHO91MAB/eTfUemi48gkFaS/NFlkwnHEcLytQfu4FY1C1DiPPHi+zYD64rkdGRAMWhI2w5uSwyAM6YQBNkPB31ipajq/94ImC12yD/GPdq720yEjO8/BvtEI3ScvnNd2U9DRsJdlgKVz0t7LtGIizfJ6PH/pOa9obSLDOB63nfrR6xDgCkmuRuDoSvUU6JEltdeQQWJyC2YIvcjRVSiFrlHcDf9KGf/ukKgN3LL1YOYevBWfzknYiFLDy1mp
x-ms-exchange-antispam-messagedata: QqiMXkg2vo6oF3nVFgyspZC6GgcH43GpB1QDSNrGErFTuF8UPJHXdqiFtIhCAqzUOpVC0TRPvInPlUn9l1moFJPMg4ObU2HmE3/ngp9iryvLUaUZrq4sd96JlyjmOqPWCteQ8pIoYQAr+U52rT1XJg==
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-Network-Message-Id: b404bac9-2db1-45cc-12aa-08d7dcf88cd6
X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Apr 2020 02:40:36.7795 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: WDlmIpu3p/G4fyNrpYXzud7FbdVIxJ+EwgEzpIhq8VXRrqzFCtwyXPcSDOE7hbqcVfb7T16vI5B5NsvdVi9pQQ==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR11MB4355
X-OriginatorOrg: intel.com
Subject: Re: [dpdk-dev] [PATCH 3/3] net/ice/base: force switch to use
 different recipe for
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
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>

Test-by Peng, Yuan <yuan.peng@intel.com>

-----Original Message-----
From: Zhao1, Wei <wei.zhao1@intel.com>=20
Sent: Friday, April 10, 2020 8:42 AM
To: dev@dpdk.org
Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Lu, Nannan <nannan.lu@intel.com>; P=
eng, Yuan <yuan.peng@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
Subject: [PATCH 3/3] net/ice/base: force switch to use different recipe for

When we use profile rule as swicth rule to download, if we download 2 diffe=
rent rules one by one, there will be rejection from function ice_aq_sw_rule=
s(), for example:

"flow create 0 priority 0 ingress pattern eth / ipv6 / ah / end actions que=
ue index 3 / end"
"flow create 0 priority 0 ingress pattern eth / ipv6 / esp / end actions qu=
eue index 2 / end"

That is because the 2 rules has the same s_rule input set except action que=
ue index, so it will be rejected by hardware. So we have to use different r=
ecipes for them.

Also, we need to add recipe_id to keep record of recipe index, which will b=
e used in rule remove, if not, there will be error when search recipe in fu=
nction
ice_rem_adv_rule() if we create 2 or more profile rule.
For example:

"flow create 0 priority 0 ingress pattern eth / ipv4 / udp / pfcp s_field i=
s 1 / end actions queue index 4 / end"
"flow create 0 priority 0 ingress pattern eth / ipv4 / udp / pfcp s_field i=
s 0 / end actions queue index 5 / end"

then,

"flow flush 0"

you will find only the first rule will be delete, because ice_find_recp() w=
ill always return recipe id of the first rule.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ice/base/ice_switch.c | 15 ++++++++++-----  drivers/net/ice/ba=
se/ice_switch.h |  1 +
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_s=
witch.c
index bc0c368d7..d8eec7f51 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -4983,7 +4983,8 @@ static const struct ice_protocol_entry ice_prot_id_tb=
l[ICE_PROTOCOL_LAST] =3D {
  *
  * Returns index of matching recipe, or ICE_MAX_NUM_RECIPES if not found.
  */
-static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup=
_exts)
+static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup=
_exts,
+			 enum ice_sw_tunnel_type tun_type)
 {
 	bool refresh_required =3D true;
 	struct ice_sw_recipe *recp;
@@ -5042,7 +5043,10 @@ static u16 ice_find_recp(struct ice_hw *hw, struct i=
ce_prot_lkup_ext *lkup_exts)
 			/* If for "i"th recipe the found was never set to false
 			 * then it means we found our match
 			 */
-			if (found)
+			if (ice_is_prof_rule(tun_type) &&
+			    tun_type =3D=3D recp[i].tun_type && found)
+				return i; /* Return the recipe ID */
+			else if (!ice_is_prof_rule(tun_type) && found)
 				return i; /* Return the recipe ID */
 		}
 	}
@@ -5798,7 +5802,7 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ic=
e_adv_rule_info *rinfo,
  * if the rule type is a profile rule, that means that there no field valu=
e
  * match required, in this case just a profile hit is required.
  */
-static bool ice_is_prof_rule(enum ice_sw_tunnel_type type)
+bool ice_is_prof_rule(enum ice_sw_tunnel_type type)
 {
 	switch (type) {
 	case ICE_SW_TUN_PROFID_IPV6_ESP:
@@ -5952,11 +5956,12 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_ad=
v_lkup_elem *lkups,
 		goto err_free_lkup_exts;
=20
 	/* Look for a recipe which matches our requested fv / mask list */
-	*rid =3D ice_find_recp(hw, lkup_exts);
+	*rid =3D ice_find_recp(hw, lkup_exts, rinfo->tun_type);
 	if (*rid < ICE_MAX_NUM_RECIPES)
 		/* Success if found a recipe that match the existing criteria */
 		goto err_unroll;
=20
+	rm->tun_type =3D rinfo->tun_type;
 	/* Recipe we need does not exist, add a recipe */
 	status =3D ice_add_sw_recipe(hw, rm, match_tun, profiles);
 	if (status)
@@ -6873,7 +6878,7 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lk=
up_elem *lkups,
 	if (status)
 		return status;
=20
-	rid =3D ice_find_recp(hw, &lkup_exts);
+	rid =3D ice_find_recp(hw, &lkup_exts, rinfo->tun_type);
 	/* If did not find a recipe that match the existing criteria */
 	if (rid =3D=3D ICE_MAX_NUM_RECIPES)
 		return ICE_ERR_PARAM;
diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_s=
witch.h
index f7ae5c741..9666422f7 100644
--- a/drivers/net/ice/base/ice_switch.h
+++ b/drivers/net/ice/base/ice_switch.h
@@ -483,5 +483,6 @@ bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle=
);
=20
 enum ice_status ice_replay_vsi_all_fltr(struct ice_hw *hw, u16 vsi_handle)=
;  void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw);
+bool ice_is_prof_rule(enum ice_sw_tunnel_type type);
=20
 #endif /* _ICE_SWITCH_H_ */
--
2.19.1