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 4E401A0556; Thu, 20 Feb 2020 16:02:09 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D47D01BF9F; Thu, 20 Feb 2020 16:02:07 +0100 (CET) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70073.outbound.protection.outlook.com [40.107.7.73]) by dpdk.org (Postfix) with ESMTP id 231A01BF99; Thu, 20 Feb 2020 16:02:06 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rj7c0HUpmjV89Klbt1DfGYius4mEqtFQCyyAgHAeQuOCZcybU38s4h+Uyro+/gUYgH1mfD7XISvmz1xjHqhv/ACRIGSh0GAEKnAoMpOY+fXzdmsPOEBit3IP7NnxxVPXqGXvzD0CYEimsAKKC+qGoEweFKaessiD1ybjC5Sq6z/6uz5JupUnW+GhXrvjv/c/0SgHAsCshcr4kr0hww2E7NlC7XgdSKqIUH8XjUEMplYdvDnTv44m72vSKLrL4d/4VKb36MDoD59aUfTEa0HI0MZzB9Q2zHRTb/TgrhrV+sLzYZXoVPGGJc4LlyMI8sBUsIyXYIEeYysmhHWC1+ajWA== 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=nJ17DBLmmOWXxVvB6iws6kTQ4sYH1rArMa43EiC8x3U=; b=QOBBGmP1EyNK/CyvPgjS72DMelEPrcwk+hFW1QGfTgXQK+WN6XTj31/C95XF1FibbuFpqssY1cf3k1Ltg6uZA7g7oSC2aJjePq3GAiSMxBAjZYJS8jaoNsxKPrH9WmnnnDUb4HS/PRy1OZdsjLk7J2lp1RXcwsjisChSiAm62TY3qAOifU/b+LLaiF0jPyv/Orlq78oNCSQarAo7l/BJ2EXOwZoDDgc4MM2NS76/M9qtSJyGcjo1XNUIEnXNHMFWRt6WSYH3V12RwbmGiSiaYyPaGgysV8/xsgORqfPnQOAPbLqcK3VjG8gC5JPS8NMma/fWIjx25iwgP03LS3k8kQ== 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=nJ17DBLmmOWXxVvB6iws6kTQ4sYH1rArMa43EiC8x3U=; b=XTelJ3g25M9Tuo302VvPVOlPVJJT3TDAkzh/GYiu2kVOkoIlgeh8tqFyvXxqHzhAAS4QIpxTOVIiULZenLCI+jvQQ1z8vWsZbhYkvrecNBeSeM5SjZHwR2xFF2sv6dQKgwo+6oIoAGbCZkWbFllGJtxFK45NdVAUQtawu5aTrFY= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.188.154) by AM4PR05MB3252.eurprd05.prod.outlook.com (10.171.186.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2729.23; Thu, 20 Feb 2020 15:02:05 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::da5:7919:35c1:894]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::da5:7919:35c1:894%6]) with mapi id 15.20.2729.032; Thu, 20 Feb 2020 15:02:04 +0000 From: Slava Ovsiienko To: Matan Azrad , "dev@dpdk.org" CC: "stable@dpdk.org" Thread-Topic: [PATCH] net/mlx5: fix metadata split with encap action Thread-Index: AQHV5/wsheQh3lbRE0StrxvHnomrCKgkK/nA Date: Thu, 20 Feb 2020 15:02:04 +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=viacheslavo@mellanox.com; x-originating-ip: [95.164.10.10] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: c4309d51-dc62-42ee-2f89-08d7b615d91d x-ms-traffictypediagnostic: AM4PR05MB3252:|AM4PR05MB3252: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-forefront-prvs: 031996B7EF x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(39860400002)(136003)(366004)(376002)(396003)(199004)(189003)(2906002)(9686003)(55016002)(5660300002)(66446008)(64756008)(76116006)(66556008)(52536014)(66946007)(66476007)(478600001)(33656002)(8936002)(71200400001)(8676002)(81166006)(7696005)(81156014)(86362001)(110136005)(6506007)(53546011)(26005)(316002)(450100002)(186003)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3252; H:AM4PR05MB3265.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: QbZ3T8co5+GZ5nqDkKwnf0bVDfKlSuc9PKYKCMHJHbcOGjkuEK9rRp/vdZ3URdDbJLrlM3NAlE1OzKQk2vDa96cgKKJh8QGkSCGkvVVI0k0dhPaEXnO2pq5qBk6515q+rbbuniomFYobByZFazNJyZtFmcSq3zXGyjGDQYURfR/HnBDYQKRHKMi52ODpknMHCjkx+BXRW97/W2ktJL1VltWXlOcOkCYryxqajnB3RsMjewCM70KpzJr5VrNlKanLxza4vjfy1afenuzlkyoP84LCqtdmCZJr7gcPR/4E0YSNoZdzFtav6tWYUbM0bSzT1EerxvYNlI3v+K13wE9H/xUG4+PyHm4tondanfOLYQY1UFv25a0jUTgCb6l7ps24tW7C8fpGR5rLPTu2fHtoEccY0OcRHe1vRVk7bj1EDYjM6jmW6ovf65kunTVqIeNW x-ms-exchange-antispam-messagedata: 3EAa8ozdrWYEjpnqkbXh4TdD1HQC4iM56mQsS1Y+ja5JxzzevYwkur7UE10oi8q6iJGyqa4tz2JevdRYMPNwNarFSEKqa/pRtbr/LOYuljyfskR069D1PgDiPRnK8yh9rfW+Hn2XD2D9uorLRZNK8Q== 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: c4309d51-dc62-42ee-2f89-08d7b615d91d X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Feb 2020 15:02:04.7802 (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: xWmD+annfPjIigabAiNPzfq+cHMzeORLAXI+jiJW/bjcn+Fc+eJBkBvohMI58dUHdN8DVMVU3xmR2P9s/e8LY45H/tFnLuXMZBWXXMJr6m8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3252 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" > -----Original Message----- > From: Matan Azrad > Sent: Thursday, February 20, 2020 16:44 > To: dev@dpdk.org > Cc: Slava Ovsiienko ; stable@dpdk.org > Subject: [PATCH] net/mlx5: fix metadata split with encap action >=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 metadat= a > register REG_A to REG_C_0. >=20 > This copy action is considered as modify header action from HW perspectiv= e. >=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 t= he > 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 Acked-by: Viacheslav Ovsiienko PS. Raslan - please, fix typos in commit message, thanks > --- > 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