From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20043.outbound.protection.outlook.com [40.107.2.43]) by dpdk.org (Postfix) with ESMTP id 551111B889 for ; Thu, 18 Apr 2019 07:13:56 +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=0OfdA4vNkk6ZXHVMPvIsD11/6Jvjhe6TmVLPhhBELAU=; b=e3n+N4UQi3IvlnIKJafpzwkkOKmML7XlXn0h5zZ/qk6i1OusKV5OVwsuT3qKPVMii67ChBJEcFFTOSDQKjjwhJxKTnN2XXhmY6TVI7rD3VX6wLJb/U1YkxVzu1+tfPiAtzFGr3JJ3qAhBIK0ESbSuVBiXyG4cgRE4yAkSw7kw7U= Received: from AM4PR05MB3425.eurprd05.prod.outlook.com (10.171.190.15) by AM4PR05MB3298.eurprd05.prod.outlook.com (10.171.187.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1813.12; Thu, 18 Apr 2019 05:13:55 +0000 Received: from AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::a4d7:6c70:9829:2cc8]) by AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::a4d7:6c70:9829:2cc8%6]) with mapi id 15.20.1813.013; Thu, 18 Apr 2019 05:13:55 +0000 From: Ori Kam To: Yongseok Koh 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: AQHU8wbpSPBa3cEpaUqQUeflPgM80qZBIpEAgABAlfA= Date: Thu, 18 Apr 2019 05:13:54 +0000 Message-ID: References: <1555276357-4892-1-git-send-email-orika@mellanox.com> <1555276357-4892-9-git-send-email-orika@mellanox.com> <20190418011603.GE31179@mtidpdk.mti.labs.mlnx> In-Reply-To: <20190418011603.GE31179@mtidpdk.mti.labs.mlnx> 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=orika@mellanox.com; x-originating-ip: [185.175.35.255] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: eb16530f-0560-4411-2db5-08d6c3bca772 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:AM4PR05MB3298; x-ms-traffictypediagnostic: AM4PR05MB3298: x-microsoft-antispam-prvs: x-forefront-prvs: 0011612A55 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(136003)(376002)(346002)(396003)(189003)(199004)(13464003)(7736002)(4326008)(86362001)(33656002)(76176011)(68736007)(102836004)(6862004)(8936002)(55016002)(53546011)(6506007)(486006)(446003)(229853002)(7696005)(6246003)(6436002)(305945005)(2906002)(11346002)(66066001)(9686003)(81156014)(81166006)(74316002)(26005)(186003)(3846002)(6116002)(53936002)(8676002)(476003)(478600001)(97736004)(256004)(71200400001)(71190400001)(54906003)(5660300002)(6636002)(316002)(52536014)(25786009)(14454004)(99286004)(7756004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3298; H:AM4PR05MB3425.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: n/MJAUf+pOJfERBfNycOntMIItZ2KV+y00RDmbNG4wpOCSEqaSX/PumOoB2LX19RIxEGKW1CPLW3YXrX4mixY5j/ig+ayj6BMiAA8HM/p6Vju+J/T6U3v709PnsQ3l+QJsV7X96/Y/AUxYMdTE5NfpxcDmwGqCTmgW93YnQocu1Ls40CcIGNitgZbsviQoBwnoEfpSReDGBxlaH2hp/vvMUSjlbz+xNq+CnJQOu0CJV6Pi20/QrMP5V3zPG51ikZItEot7sGBR17EiJmNABLxc3uLrWLsmOIl1IjvvjgH/I2cuTjhPft4UPKkMEoq/pqF3v+v59bo7ZqVEnqeOL6ZWvd975ael1QaQv0eHMYMkTtbM7kTXX4GPBQ5yegA1KNZBBABUKCfuOL3xOOSQgzujK0jLD7oITghK5HLD5JYz8= 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: eb16530f-0560-4411-2db5-08d6c3bca772 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2019 05:13:54.9109 (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: AM4PR05MB3298 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: , X-List-Received-Date: Thu, 18 Apr 2019 05:13:56 -0000 Hi Yongseok, PSB > -----Original Message----- > From: Yongseok Koh > Sent: Thursday, April 18, 2019 4:16 AM > To: Ori Kam > Cc: Shahaf Shuler ; Matan Azrad > ; Slava Ovsiienko ; Moti > Haimovsky ; dev@dpdk.org > Subject: Re: [PATCH 8/9] net/mlx5: add Forward Database table type >=20 > 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. > > > > Signed-off-by: Ori Kam > > --- > > drivers/net/mlx5/mlx5_flow_dv.c | 54 ++++++++++++++++++++++++++++++-- > --------- > > 1 file changed, 40 insertions(+), 14 deletions(-) > > > > 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 > > > > +#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; > > > > 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, > > }; > > > > + if (transfer) > > + res.ft_type =3D MLX5DV_FLOW_TABLE_TYPE_FDB; >=20 > Why overwrite? > You could've done it above: >=20 > struct mlx5_flow_dv_encap_decap_resource res =3D { > .reformat_type =3D >=20 > MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNN > EL, > .ft_type =3D transfer ? MLX5DV_FLOW_TABLE_TYPE_FDB : > MLX5DV_FLOW_TABLE_TYPE_NIC_TX, > }; >=20 > Same for the rest. > Will fix. > > 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, > > }; > > > > + 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_TUNN > EL : > > > 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; > > > > - 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; > > > > + if (attr->transfer) > > + res.ft_type =3D MLX5DV_FLOW_TABLE_TYPE_FDB; >=20 > This res has nothing to do with encap/decap but it is > mlx5_flow_dv_modify_hdr_resource. >=20 Yes like I wrote in the commit, I'm adding the table support for all action= s=20 including the modify. > Thanks, > Yongseok >=20 > > 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; > > -- > > 1.8.3.1 > > 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 D5F4AA00E6 for ; Thu, 18 Apr 2019 07:13:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0A3C31B91E; Thu, 18 Apr 2019 07:13:58 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20043.outbound.protection.outlook.com [40.107.2.43]) by dpdk.org (Postfix) with ESMTP id 551111B889 for ; Thu, 18 Apr 2019 07:13:56 +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=0OfdA4vNkk6ZXHVMPvIsD11/6Jvjhe6TmVLPhhBELAU=; b=e3n+N4UQi3IvlnIKJafpzwkkOKmML7XlXn0h5zZ/qk6i1OusKV5OVwsuT3qKPVMii67ChBJEcFFTOSDQKjjwhJxKTnN2XXhmY6TVI7rD3VX6wLJb/U1YkxVzu1+tfPiAtzFGr3JJ3qAhBIK0ESbSuVBiXyG4cgRE4yAkSw7kw7U= Received: from AM4PR05MB3425.eurprd05.prod.outlook.com (10.171.190.15) by AM4PR05MB3298.eurprd05.prod.outlook.com (10.171.187.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1813.12; Thu, 18 Apr 2019 05:13:55 +0000 Received: from AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::a4d7:6c70:9829:2cc8]) by AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::a4d7:6c70:9829:2cc8%6]) with mapi id 15.20.1813.013; Thu, 18 Apr 2019 05:13:55 +0000 From: Ori Kam To: Yongseok Koh 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: AQHU8wbpSPBa3cEpaUqQUeflPgM80qZBIpEAgABAlfA= Date: Thu, 18 Apr 2019 05:13:54 +0000 Message-ID: References: <1555276357-4892-1-git-send-email-orika@mellanox.com> <1555276357-4892-9-git-send-email-orika@mellanox.com> <20190418011603.GE31179@mtidpdk.mti.labs.mlnx> In-Reply-To: <20190418011603.GE31179@mtidpdk.mti.labs.mlnx> 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=orika@mellanox.com; x-originating-ip: [185.175.35.255] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: eb16530f-0560-4411-2db5-08d6c3bca772 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:AM4PR05MB3298; x-ms-traffictypediagnostic: AM4PR05MB3298: x-microsoft-antispam-prvs: x-forefront-prvs: 0011612A55 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(136003)(376002)(346002)(396003)(189003)(199004)(13464003)(7736002)(4326008)(86362001)(33656002)(76176011)(68736007)(102836004)(6862004)(8936002)(55016002)(53546011)(6506007)(486006)(446003)(229853002)(7696005)(6246003)(6436002)(305945005)(2906002)(11346002)(66066001)(9686003)(81156014)(81166006)(74316002)(26005)(186003)(3846002)(6116002)(53936002)(8676002)(476003)(478600001)(97736004)(256004)(71200400001)(71190400001)(54906003)(5660300002)(6636002)(316002)(52536014)(25786009)(14454004)(99286004)(7756004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3298; H:AM4PR05MB3425.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: n/MJAUf+pOJfERBfNycOntMIItZ2KV+y00RDmbNG4wpOCSEqaSX/PumOoB2LX19RIxEGKW1CPLW3YXrX4mixY5j/ig+ayj6BMiAA8HM/p6Vju+J/T6U3v709PnsQ3l+QJsV7X96/Y/AUxYMdTE5NfpxcDmwGqCTmgW93YnQocu1Ls40CcIGNitgZbsviQoBwnoEfpSReDGBxlaH2hp/vvMUSjlbz+xNq+CnJQOu0CJV6Pi20/QrMP5V3zPG51ikZItEot7sGBR17EiJmNABLxc3uLrWLsmOIl1IjvvjgH/I2cuTjhPft4UPKkMEoq/pqF3v+v59bo7ZqVEnqeOL6ZWvd975ael1QaQv0eHMYMkTtbM7kTXX4GPBQ5yegA1KNZBBABUKCfuOL3xOOSQgzujK0jLD7oITghK5HLD5JYz8= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb16530f-0560-4411-2db5-08d6c3bca772 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2019 05:13:54.9109 (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: AM4PR05MB3298 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: <20190418051354.E5MYZKRfhsvXXookZJbYLAL-gUyoc9c-wxQcIP-iv3Q@z> Hi Yongseok, PSB > -----Original Message----- > From: Yongseok Koh > Sent: Thursday, April 18, 2019 4:16 AM > To: Ori Kam > Cc: Shahaf Shuler ; Matan Azrad > ; Slava Ovsiienko ; Moti > Haimovsky ; dev@dpdk.org > Subject: Re: [PATCH 8/9] net/mlx5: add Forward Database table type >=20 > 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. > > > > Signed-off-by: Ori Kam > > --- > > drivers/net/mlx5/mlx5_flow_dv.c | 54 ++++++++++++++++++++++++++++++-- > --------- > > 1 file changed, 40 insertions(+), 14 deletions(-) > > > > 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 > > > > +#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; > > > > 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, > > }; > > > > + if (transfer) > > + res.ft_type =3D MLX5DV_FLOW_TABLE_TYPE_FDB; >=20 > Why overwrite? > You could've done it above: >=20 > struct mlx5_flow_dv_encap_decap_resource res =3D { > .reformat_type =3D >=20 > MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNN > EL, > .ft_type =3D transfer ? MLX5DV_FLOW_TABLE_TYPE_FDB : > MLX5DV_FLOW_TABLE_TYPE_NIC_TX, > }; >=20 > Same for the rest. > Will fix. > > 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, > > }; > > > > + 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_TUNN > EL : > > > 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; > > > > - 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; > > > > + if (attr->transfer) > > + res.ft_type =3D MLX5DV_FLOW_TABLE_TYPE_FDB; >=20 > This res has nothing to do with encap/decap but it is > mlx5_flow_dv_modify_hdr_resource. >=20 Yes like I wrote in the commit, I'm adding the table support for all action= s=20 including the modify. > Thanks, > Yongseok >=20 > > 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; > > -- > > 1.8.3.1 > >