From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id D01E0A00E6 for ; Thu, 18 Apr 2019 03:16:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0A9861B7D5; Thu, 18 Apr 2019 03:16:15 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130041.outbound.protection.outlook.com [40.107.13.41]) by dpdk.org (Postfix) with ESMTP id 2E6F61B75A for ; Thu, 18 Apr 2019 03:16:14 +0200 (CEST) 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=M1URR1aWLhWapWBtdM89coC2XUdhzdjQL7NSe23boZ0=; b=URlMICAYvFAUsOZcEH6RsNko9C2oiQF1Y+wUHAH1RxPtUheootg+oydhMRusm4Hmc6vDmvTrtHVFkxKdumqW8hOocfCVNwTlkH0igmE5lyTRglu8lLrk8spiZyDT3XYcmBJ/NCweHP9Vc33JXilRUSO6RQQE/Vact32w+iw8ER0= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3993.eurprd05.prod.outlook.com (52.134.70.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.19; Thu, 18 Apr 2019 01:16:13 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::6072:43be:7c2d:103a]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::6072:43be:7c2d:103a%3]) with mapi id 15.20.1813.011; Thu, 18 Apr 2019 01:16:13 +0000 From: Yongseok Koh To: Ori Kam CC: Shahaf Shuler , Matan Azrad , Slava Ovsiienko , Moti Haimovsky , "dev@dpdk.org" Thread-Topic: [PATCH 8/9] net/mlx5: add Forward Database table type Thread-Index: AQHU8wb0h7gGe/ytU0m0PWt++JLbHqZBIocA Date: Thu, 18 Apr 2019 01:16:12 +0000 Message-ID: <20190418011603.GE31179@mtidpdk.mti.labs.mlnx> References: <1555276357-4892-1-git-send-email-orika@mellanox.com> <1555276357-4892-9-git-send-email-orika@mellanox.com> In-Reply-To: <1555276357-4892-9-git-send-email-orika@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BY5PR13CA0009.namprd13.prod.outlook.com (2603:10b6:a03:180::22) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4f25c360-7c64-4944-0427-08d6c39b725d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600141)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:DB3PR0502MB3993; x-ms-traffictypediagnostic: DB3PR0502MB3993: x-microsoft-antispam-prvs: x-forefront-prvs: 0011612A55 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(39860400002)(136003)(376002)(396003)(366004)(189003)(199004)(81156014)(446003)(53936002)(81166006)(8936002)(33656002)(54906003)(6246003)(229853002)(478600001)(6862004)(6436002)(6486002)(68736007)(9686003)(6636002)(305945005)(25786009)(6512007)(7736002)(8676002)(3846002)(99286004)(71200400001)(2906002)(86362001)(5660300002)(316002)(66066001)(186003)(476003)(1076003)(52116002)(11346002)(6506007)(4326008)(6116002)(256004)(14454004)(97736004)(102836004)(386003)(76176011)(71190400001)(486006)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3993; H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: kD7dqA+5596W6PSUAjrY7eAqkSkjKH0HWI/L//OIoItUQXyI3V1iCRZmnGOTRmO12O1FP8B++5AuWwUO3hj/kK3R8KabjvKUZet1Ac+z+adC22vVpGXY3DwPbVzofbakkfQTiWcVsw1mGY/hay2FHqbnKOp8ZgS9hW5B1zTYgjXSNEfUSaraiF0dgMMvWdUClkshzETWOrKEyAfAgzzk5t8adZX2lyQZxBF3Vg9/hLDlzxPsSjUJl9tNjukmIvSDL+Pb52+17HIB7drJzQXo8GejAPdeiygWM5ZmACKLEqdgZ1WxZol9BOLBPrY9w2hpySrBNkVwyil9qDeas+p9nPHZMV2pDXD9C+t/NeyOgT+obpqg9vXa2WLYmDen6e8PPzLghm5h3+HSV8aA782CRDzrOx3EZEfqqcI0vkj5/GE= Content-Type: text/plain; charset="UTF-8" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4f25c360-7c64-4944-0427-08d6c39b725d X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2019 01:16:12.9322 (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-Transport-CrossTenantHeadersStamped: DB3PR0502MB3993 Subject: Re: [dpdk-dev] [PATCH 8/9] net/mlx5: add Forward Database table type 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" Message-ID: <20190418011612.N6xhhMgB0b7wqyaZlBCGyH-uzbGtAg-svaCHpS-sLrM@z> On Sun, Apr 14, 2019 at 09:12:36PM +0000, Ori Kam wrote: > Actions like encap/decap, modify header require setting the flow table > type. Until now we supported only Nic RX and Nic TX, this commits adds > the support for FDB table type for those actions. >=20 > Signed-off-by: Ori Kam > --- > drivers/net/mlx5/mlx5_flow_dv.c | 54 ++++++++++++++++++++++++++++++-----= ------ > 1 file changed, 40 insertions(+), 14 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow= _dv.c > index f4b7f06..d4dc439 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -40,6 +40,10 @@ > #define MLX5DV_FLOW_ACTION_COUNTERS_DEVX 0 > #endif > =20 > +#ifndef HAVE_MLX5DV_DR_ESWITCH > +#define MLX5DV_FLOW_TABLE_TYPE_FDB 0 > +#endif > + > union flow_dv_attr { > struct { > uint32_t valid:1; > @@ -943,7 +947,9 @@ struct field_modify_info modify_tcp[] =3D { > struct mlx5dv_dr_ns *ns; > =20 > resource->flags =3D flow->group ? 0 : 1; > - if (flow->ingress) > + if (resource->ft_type =3D=3D MLX5DV_FLOW_TABLE_TYPE_FDB) > + ns =3D sh->fdb_ns; > + else if (resource->ft_type =3D=3D MLX5DV_FLOW_TABLE_TYPE_NIC_RX) > ns =3D sh->rx_ns; > else > ns =3D sh->tx_ns; > @@ -1364,6 +1370,8 @@ struct field_modify_info modify_tcp[] =3D { > * Pointer to action structure. > * @param[in, out] dev_flow > * Pointer to the mlx5_flow. > + * @param[in] transfer > + * Mark if the flow is E-Switch flow. > * @param[out] error > * Pointer to the error structure. > * > @@ -1374,6 +1382,7 @@ struct field_modify_info modify_tcp[] =3D { > flow_dv_create_action_l2_encap(struct rte_eth_dev *dev, > const struct rte_flow_action *action, > struct mlx5_flow *dev_flow, > + uint8_t transfer, > struct rte_flow_error *error) > { > const struct rte_flow_item *encap_data; > @@ -1384,6 +1393,8 @@ struct field_modify_info modify_tcp[] =3D { > .ft_type =3D MLX5DV_FLOW_TABLE_TYPE_NIC_TX, > }; > =20 > + if (transfer) > + res.ft_type =3D MLX5DV_FLOW_TABLE_TYPE_FDB; Why overwrite? You could've done it above: struct mlx5_flow_dv_encap_decap_resource res =3D { .reformat_type =3D MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL, .ft_type =3D transfer ? MLX5DV_FLOW_TABLE_TYPE_FDB : MLX5DV_FLOW_TABLE_TYPE_NIC_TX, }; Same for the rest. > if (action->type =3D=3D RTE_FLOW_ACTION_TYPE_RAW_ENCAP) { > raw_encap_data =3D > (const struct rte_flow_action_raw_encap *)action->conf; > @@ -1416,6 +1427,8 @@ struct field_modify_info modify_tcp[] =3D { > * Pointer to rte_eth_dev structure. > * @param[in, out] dev_flow > * Pointer to the mlx5_flow. > + * @param[in] transfer > + * Mark if the flow is E-Switch flow. > * @param[out] error > * Pointer to the error structure. > * > @@ -1425,6 +1438,7 @@ struct field_modify_info modify_tcp[] =3D { > static int > flow_dv_create_action_l2_decap(struct rte_eth_dev *dev, > struct mlx5_flow *dev_flow, > + uint8_t transfer, > struct rte_flow_error *error) > { > struct mlx5_flow_dv_encap_decap_resource res =3D { > @@ -1434,6 +1448,8 @@ struct field_modify_info modify_tcp[] =3D { > .ft_type =3D MLX5DV_FLOW_TABLE_TYPE_NIC_RX, > }; > =20 > + if (transfer) > + res.ft_type =3D MLX5DV_FLOW_TABLE_TYPE_FDB; > if (flow_dv_encap_decap_resource_register(dev, &res, dev_flow, error)) > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > @@ -1474,8 +1490,11 @@ struct field_modify_info modify_tcp[] =3D { > res.reformat_type =3D attr->egress ? > MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL : > MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2; > - res.ft_type =3D attr->egress ? MLX5DV_FLOW_TABLE_TYPE_NIC_TX : > - MLX5DV_FLOW_TABLE_TYPE_NIC_RX; > + if (attr->transfer) > + res.ft_type =3D MLX5DV_FLOW_TABLE_TYPE_FDB; > + else > + res.ft_type =3D attr->egress ? MLX5DV_FLOW_TABLE_TYPE_NIC_TX : > + MLX5DV_FLOW_TABLE_TYPE_NIC_RX; > if (flow_dv_encap_decap_resource_register(dev, &res, dev_flow, error)) > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > @@ -1810,11 +1829,14 @@ struct field_modify_info modify_tcp[] =3D { > struct mlx5_priv *priv =3D dev->data->dev_private; > struct mlx5_ibv_shared *sh =3D priv->sh; > struct mlx5_flow_dv_modify_hdr_resource *cache_resource; > + struct mlx5dv_dr_ns *ns; > =20 > - struct mlx5dv_dr_ns *ns =3D > - resource->ft_type =3D=3D MLX5DV_FLOW_TABLE_TYPE_NIC_TX ? > - sh->tx_ns : sh->rx_ns; > - > + if (resource->ft_type =3D=3D MLX5DV_FLOW_TABLE_TYPE_FDB) > + ns =3D sh->fdb_ns; > + else if (resource->ft_type =3D=3D MLX5DV_FLOW_TABLE_TYPE_NIC_TX) > + ns =3D sh->tx_ns; > + else > + ns =3D sh->rx_ns; > /* Lookup a matching resource from cache. */ > LIST_FOREACH(cache_resource, &sh->modify_cmds, next) { > if (resource->ft_type =3D=3D cache_resource->ft_type && > @@ -3615,6 +3637,8 @@ struct field_modify_info modify_tcp[] =3D { > union flow_dv_attr flow_attr =3D { .attr =3D 0 }; > struct mlx5_flow_dv_tag_resource tag_resource; > =20 > + if (attr->transfer) > + res.ft_type =3D MLX5DV_FLOW_TABLE_TYPE_FDB; This res has nothing to do with encap/decap but it is mlx5_flow_dv_modify_hdr_resource. Thanks, Yongseok > if (priority =3D=3D MLX5_FLOW_PRIO_RSVD) > priority =3D priv->config.flow_prio - 1; > for (; !actions_end ; actions++) { > @@ -3720,7 +3744,9 @@ struct field_modify_info modify_tcp[] =3D { > case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP: > case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: > if (flow_dv_create_action_l2_encap(dev, actions, > - dev_flow, error)) > + dev_flow, > + attr->transfer, > + error)) > return -rte_errno; > dev_flow->dv.actions[actions_n++] =3D > dev_flow->dv.encap_decap->verbs_action; > @@ -3732,6 +3758,7 @@ struct field_modify_info modify_tcp[] =3D { > case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP: > case RTE_FLOW_ACTION_TYPE_NVGRE_DECAP: > if (flow_dv_create_action_l2_decap(dev, dev_flow, > + attr->transfer, > error)) > return -rte_errno; > dev_flow->dv.actions[actions_n++] =3D > @@ -3751,9 +3778,9 @@ struct field_modify_info modify_tcp[] =3D { > dev_flow->dv.encap_decap->verbs_action; > } else { > /* Handle encap without preceding decap. */ > - if (flow_dv_create_action_l2_encap(dev, actions, > - dev_flow, > - error)) > + if (flow_dv_create_action_l2_encap > + (dev, actions, dev_flow, attr->transfer, > + error)) > return -rte_errno; > dev_flow->dv.actions[actions_n++] =3D > dev_flow->dv.encap_decap->verbs_action; > @@ -3768,9 +3795,8 @@ struct field_modify_info modify_tcp[] =3D { > } > /* Handle decap only if it isn't followed by encap. */ > if (action->type !=3D RTE_FLOW_ACTION_TYPE_RAW_ENCAP) { > - if (flow_dv_create_action_l2_decap(dev, > - dev_flow, > - error)) > + if (flow_dv_create_action_l2_decap > + (dev, dev_flow, attr->transfer, error)) > return -rte_errno; > dev_flow->dv.actions[actions_n++] =3D > dev_flow->dv.encap_decap->verbs_action; > --=20 > 1.8.3.1 >=20