From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3976CA0556; Thu, 20 Feb 2020 16:48:40 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 134111BFA0; Thu, 20 Feb 2020 16:48:40 +0100 (CET) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150088.outbound.protection.outlook.com [40.107.15.88]) by dpdk.org (Postfix) with ESMTP id 8F6541BF98; Thu, 20 Feb 2020 16:48:38 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VbgHHX3T91lZiNm1qyWzM4uwVyFvu78yfYzaWnv/aucOQhwXMSXQA0v0M2Q2hsqHYlSXRlI36dhUVSfhunwuxCvPzRT1M46xW8x3MiVhInLsVJr2wzxLClTOSoZPUq7AAx7Yz0QtPR5uM1lw3SLi35Wh8NMI+KwkpE24BIhpOiwE56OE/KW369vyw1syDENqOV/3wh51c/e3q8cxxEyX336QUAKBp4AiobcDBkW9sz+yLBZrYXr+N/VwaceiFlm4zZiraqIRwQFuhOGaOBdhvVUJAslZ9MWLXW2nTyNzX28RY7bhL4ik7qwBCEeS4+kkzcP2R20htArnLwM0i49Jpw== 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=CE7cWAltCNyH3cmQeGvlJ4ruoGuG09Su3WZk8wbbiCs=; b=USwWEZffpp7OynscN15b1dnoUEDj0+gzpBz4nA5X+VEUD0+KzJsAFATNqNguSuH5YEqJrt7wOrlGlAGBtnoO86Hu56CimCsaQb6tqBuhsp9wRwuc4ihhIy2j8kOAz4CsI2N9pxSHFkqYBej1sTMcIFBoOtAf2LrDpKK/L//P5bEs2DOmoj4gLzlI5xx2qcfvuOewzLNjK26c+2o6RMsokmqQq+EDTuHwsK9oui7ZX92n/INP3MwlZcPeym/kDAnHzMxDdT9x7JmxZW6pWKyL5OtUmnmSVglAHp0mX8szOs38GTmGghC+41dljIJO/3J7V1WPyAlHROVht3YBDPKaZw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CE7cWAltCNyH3cmQeGvlJ4ruoGuG09Su3WZk8wbbiCs=; b=V4x0wcLbCTutTbMtbPscRox4UQd11wUugoRPwQk73RfjrlLLYZk9neKhBA5QTTVp7r8j/5Y3+5uQR2Q5jjiN57o5t492XonzYLHpt35549bBJuASE1gheqrA3icJOEWS6PzBD91UOFak+1rc9RVh+ww7J5D4drdF40pzpktJfwY= Received: from AM0PR05MB6707.eurprd05.prod.outlook.com (10.186.174.145) by AM0PR05MB6692.eurprd05.prod.outlook.com (10.186.173.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2729.22; Thu, 20 Feb 2020 15:48:37 +0000 Received: from AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::adbd:45ca:54:bba9]) by AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::adbd:45ca:54:bba9%7]) with mapi id 15.20.2750.016; Thu, 20 Feb 2020 15:48:37 +0000 From: Raslan Darawsheh To: Matan Azrad , "dev@dpdk.org" CC: Slava Ovsiienko , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] net/mlx5: fix metadata split with encap action Thread-Index: AQHV5/wmkmAW0dTkdUK07pnAiHJAgKgkOetA Date: Thu, 20 Feb 2020 15:48:37 +0000 Message-ID: References: <1582209810-20546-1-git-send-email-matan@mellanox.com> In-Reply-To: <1582209810-20546-1-git-send-email-matan@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=rasland@mellanox.com; x-originating-ip: [212.29.221.74] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 4bbdff53-5378-4fe0-375e-08d7b61c59b0 x-ms-traffictypediagnostic: AM0PR05MB6692:|AM0PR05MB6692: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:431; x-forefront-prvs: 031996B7EF x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39850400004)(376002)(396003)(346002)(136003)(366004)(199004)(189003)(81156014)(8676002)(2906002)(81166006)(8936002)(5660300002)(6506007)(53546011)(186003)(26005)(52536014)(9686003)(55016002)(4326008)(7696005)(66946007)(64756008)(33656002)(76116006)(110136005)(478600001)(86362001)(316002)(54906003)(66556008)(66476007)(450100002)(71200400001)(66446008); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB6692; H:AM0PR05MB6707.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: VPq7bzJlQ4adnDLLezyuiKJTxHIzZxHiHmcPCnVCeAcUvV4KPW6Pm4cwtiM7Ktooikygu3c7x+EMMGKzX0IbcghcyLnshHbIgzZCsREYgj0nAx5onhFnNDVclG0OQrxSF0MLrJgqFJMfXEcTsZI66uO8mpjv9GwZxsBIsnC2LR24vYupg9l+eaxbbPXrOA+htRKFnu6uqBYSfOrVdRys1kK04GXkTWPifxYGHJH3zurluN43u+lKxYZbMsiez+UqaSLPY8ksn7wcc9r7Brghgx3DjJXN7QFiVuP0fS0/p689ezsVr9yQI9RpmNuwKcfa9K1O50ImEJmdKP0JYHQTdx3B+eG+V/O+YtpdaEhsXNwqO++3AY6C/2lgcqsKOIXJ/7g6wqK2/pIyK4XKBB1kEqMUzS4OkV3OtfKaZwetYPf9K0hvmCMvN2OCmHss1lFg x-ms-exchange-antispam-messagedata: lMkDfyCOn6u0iUGZF5YPL3nANlWlEaB74silcee7X0Ujz/40C11+fe1CHD58ghVbLSJ+H7NNiPUEHMXgyA9WLuYubvqxXJcAVkWp57rPOG0ESJ66GiHwTR4aMVn+DyN+GREc/LTyDeJ24IMzBi7/tQ== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4bbdff53-5378-4fe0-375e-08d7b61c59b0 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Feb 2020 15:48:37.5428 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: pvQqdVOxdZ4T9tJu+kvbur99YlVG2VR0QSEuAL3gkVu46otPhEF7mywvT82O5HeNDWDD4Qzo4AvhCoI15uy7/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB6692 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix metadata split with encap action 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" Hi, > -----Original Message----- > From: dev On Behalf Of Matan Azrad > Sent: Thursday, February 20, 2020 4:44 PM > To: dev@dpdk.org > Cc: Slava Ovsiienko ; stable@dpdk.org > Subject: [dpdk-dev] [PATCH] net/mlx5: fix metadata split with encap actio= n >=20 > In order to move the mbuf metadata from the WQE to the FDB steering > domain, the PMD add for each NIC TX flow a new action to copy the > metadata register REG_A to REG_C_0. >=20 > This copy action is considered as modify header action from HW > perspective. >=20 > The HW doesn't support to do modify header action after ant > encapsulation action. >=20 > The split metadata function wrongly added the copy action in the end of > the original actions list, hence, NIC egress flow with encapapsulation > action failed when the PMD worked with dv_xmeta_en mode. >=20 > Move the copy action to be before and back to back with the > encapsulation action for the aforementioned case. >=20 > Fixes: 71e254bc0294 ("net/mlx5: split Rx flows to provide metadata copy") > Cc: stable@dpdk.org >=20 > Signed-off-by: Matan Azrad > --- > drivers/net/mlx5/mlx5_flow.c | 66 > ++++++++++++++++++++++++++++++++++---------- > 1 file changed, 51 insertions(+), 15 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c > index fa58546..60aab16 100644 > --- a/drivers/net/mlx5/mlx5_flow.c > +++ b/drivers/net/mlx5/mlx5_flow.c > @@ -2744,7 +2744,7 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > } >=20 > /** > - * Get QUEUE/RSS action from the action list. > + * Get metadata split action information. > * > * @param[in] actions > * Pointer to the list of actions. > @@ -2753,18 +2753,38 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > * @param[out] qrss_type > * Pointer to the action type to return. RTE_FLOW_ACTION_TYPE_END is > returned > * if no QUEUE/RSS is found. > + * @param[out] encap_idx > + * Pointer to the index of the encap action if exists, otherwise the l= ast > + * action index. > * > * @return > * Total number of actions. > */ > static int > -flow_parse_qrss_action(const struct rte_flow_action actions[], > - const struct rte_flow_action **qrss) > +flow_parse_metadata_split_actions_info(const struct rte_flow_action > actions[], > + const struct rte_flow_action **qrss, > + int *encap_idx) > { > + const struct rte_flow_action_raw_encap *raw_encap; > int actions_n =3D 0; > + int raw_decap_idx =3D -1; >=20 > + *encap_idx =3D -1; > for (; actions->type !=3D RTE_FLOW_ACTION_TYPE_END; actions++) { > switch (actions->type) { > + case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP: > + case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: > + *encap_idx =3D actions_n; > + break; > + case RTE_FLOW_ACTION_TYPE_RAW_DECAP: > + raw_decap_idx =3D actions_n; > + break; > + case RTE_FLOW_ACTION_TYPE_RAW_ENCAP: > + raw_encap =3D actions->conf; > + if (raw_encap->size > > MLX5_ENCAPSULATION_DECISION_SIZE) > + *encap_idx =3D raw_decap_idx !=3D -1 ? > + raw_decap_idx : > actions_n; > + break; > case RTE_FLOW_ACTION_TYPE_QUEUE: > case RTE_FLOW_ACTION_TYPE_RSS: > *qrss =3D actions; > @@ -2774,6 +2794,8 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > } > actions_n++; > } > + if (*encap_idx =3D=3D -1) > + *encap_idx =3D actions_n; > /* Count RTE_FLOW_ACTION_TYPE_END. */ > return actions_n + 1; > } > @@ -3739,6 +3761,8 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > * Number of actions in the list. > * @param[out] error > * Perform verbose error reporting if not NULL. > + * @param[in] encap_idx > + * The encap action inndex. > * > * @return > * 0 on success, negative value otherwise > @@ -3747,7 +3771,8 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > flow_mreg_tx_copy_prep(struct rte_eth_dev *dev, > struct rte_flow_action *ext_actions, > const struct rte_flow_action *actions, > - int actions_n, struct rte_flow_error *error) > + int actions_n, struct rte_flow_error *error, > + int encap_idx) > { > struct mlx5_flow_action_copy_mreg *cp_mreg =3D > (struct mlx5_flow_action_copy_mreg *) > @@ -3762,15 +3787,24 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > if (ret < 0) > return ret; > cp_mreg->src =3D ret; > - memcpy(ext_actions, actions, > - sizeof(*ext_actions) * actions_n); > - ext_actions[actions_n - 1] =3D (struct rte_flow_action){ > - .type =3D MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG, > - .conf =3D cp_mreg, > - }; > - ext_actions[actions_n] =3D (struct rte_flow_action){ > - .type =3D RTE_FLOW_ACTION_TYPE_END, > - }; > + if (encap_idx !=3D 0) > + memcpy(ext_actions, actions, sizeof(*ext_actions) * > encap_idx); > + if (encap_idx =3D=3D actions_n - 1) { > + ext_actions[actions_n - 1] =3D (struct rte_flow_action){ > + .type =3D > MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG, > + .conf =3D cp_mreg, > + }; > + ext_actions[actions_n] =3D (struct rte_flow_action){ > + .type =3D RTE_FLOW_ACTION_TYPE_END, > + }; > + } else { > + ext_actions[encap_idx] =3D (struct rte_flow_action){ > + .type =3D > MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG, > + .conf =3D cp_mreg, > + }; > + memcpy(ext_actions + encap_idx + 1, actions + encap_idx, > + sizeof(*ext_actions) * (actions_n - > encap_idx)); > + } > return 0; > } >=20 > @@ -3821,6 +3855,7 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > int mtr_sfx =3D 0; > size_t act_size; > int actions_n; > + int encap_idx; > int ret; >=20 > /* Check whether extensive metadata feature is engaged. */ > @@ -3830,7 +3865,8 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > return flow_create_split_inner(dev, flow, NULL, > prefix_layers, > attr, items, actions, external, > error); > - actions_n =3D flow_parse_qrss_action(actions, &qrss); > + actions_n =3D flow_parse_metadata_split_actions_info(actions, &qrss, > + &encap_idx); > if (qrss) { > /* Exclude hairpin flows from splitting. */ > if (qrss->type =3D=3D RTE_FLOW_ACTION_TYPE_QUEUE) { > @@ -3905,7 +3941,7 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > "metadata flow"); > /* Create the action list appended with copy register. */ > ret =3D flow_mreg_tx_copy_prep(dev, ext_actions, actions, > - actions_n, error); > + actions_n, error, encap_idx); > if (ret < 0) > goto exit; > } > -- > 1.8.3.1 Fixed typo in commit log, And patch applied to next-net-mlx, Kindest regards Raslan Darawsheh