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 AD24FA0526; Wed, 22 Jul 2020 13:35:40 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 46C4C1C02C; Wed, 22 Jul 2020 13:35:40 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2048.outbound.protection.outlook.com [40.107.21.48]) by dpdk.org (Postfix) with ESMTP id 9420D1C012 for ; Wed, 22 Jul 2020 13:35:39 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=idn1WSt0HxeA9wdlsJhbNcNAzNqUfYZtjcYRpi6SXt9rLx4XxeEp7pNb01uthvw8f7Kgz2V3ChTG3O1sw+BVOXdSSmBnmy+Nqb+y5ejreznKe6t9/MVEAnsBGv3drn4e22q3pO8JPt+NmSzK3D0h2OBVwZK1MlCWRXR4fPiIzgRbulL06nPia8a15d3EfdI0hrrIZhIT73OD0TlA/I3qzhL1kBUmHkw0wSlKXQYorEpGYB6Y1As3n6NgQk0QAIwv4yd6UYhdyu+I4jme7riZukAzxvZ7TqnhjQym0JnPNx6o5tfeXI5Bh27f4ZYJ32bfZScBkEqoQ9wzKOdYioA0Xw== 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=CZfVMHXa5c2peKyG+vLZlK7wwXhMuUO9HpKmGpnnyuI=; b=O0ANDUeTLIZoeFRH4Y1afjpeRuiwwuwpv+W1xeZOju0/fMK4OM2lQ+HT4i918jp0mx8yO7MRedg5q8QT5YG0i3MuD92nGN8CSO9Xpm9kjTdAbWAX41+alEC6aWIeQqY5nMcnu6sk1ZoCF8aqgy2SPceLB7sxLdjt4Rh+Cwge3VCRYgFm91brzIFASmX5ba4FbuWg6rx6eU2RwSruv0KPhoVmsGVJ6xUClJviqXGFKBvLYx60WN0wWm33ELYRi0IMA/EtB1i/Kk6IthPaZAjQstmOoadbxo9cGtR62EP+nycTfIh1WkRK3HwTKhLokKLZJ32rPuitNW0bSz/a0z+Lcg== 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=CZfVMHXa5c2peKyG+vLZlK7wwXhMuUO9HpKmGpnnyuI=; b=oIaTc4aT3bqz/9Yy2nMGVe9/41rb5Y47rkirBVynmxtKCzS85IP2EvuN2IuVYeQOY1vjEBQUlIHQVU8Xx0ggArXlYBi5K27i8XBDgUc88arn5No9cduaJl8OasZBWQUOzjamdibKPYAXtk5F/FZd7iH1prpSwOYVVcnagL2vP2Q= Received: from AM0PR05MB6707.eurprd05.prod.outlook.com (2603:10a6:20b:15b::17) by AM0PR0502MB3924.eurprd05.prod.outlook.com (2603:10a6:208:20::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.22; Wed, 22 Jul 2020 11:35:38 +0000 Received: from AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::ecd3:6008:3784:4012]) by AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::ecd3:6008:3784:4012%5]) with mapi id 15.20.3195.028; Wed, 22 Jul 2020 11:35:38 +0000 From: Raslan Darawsheh To: Suanming Mou , Slava Ovsiienko , Matan Azrad CC: "dev@dpdk.org" Thread-Topic: [PATCH v2 1/3] net/mlx5: separate aging counter pool range Thread-Index: AQHWX/3y/RC/cZDw/kacfvJKqnlAYKkTd9fA Date: Wed, 22 Jul 2020 11:35:38 +0000 Message-ID: References: <1594903224-20442-1-git-send-email-suanmingm@mellanox.com> <1595404727-164521-1-git-send-email-suanmingm@mellanox.com> In-Reply-To: <1595404727-164521-1-git-send-email-suanmingm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: mellanox.com; dkim=none (message not signed) header.d=none;mellanox.com; dmarc=none action=none header.from=mellanox.com; x-originating-ip: [84.242.49.134] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 3d6d2cee-5fef-4f95-41b6-08d82e335b4f x-ms-traffictypediagnostic: AM0PR0502MB3924: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2582; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: J6kpNVpCO3iKuXPZKDCVXRjIRGf7aFCHaMTaiW3q5EgdJWtt55gx/GyZSSbrfaejyM5E3G4dbI7Ztc0bm+vKtlR2rg+088AhmwsdqAmSefad+fgFO98DlXLUXWmzJzKqOZVW5hYNebA06yw1w5z+O3srsMHt4RKM95+TAVh/oG2Q6uqudiafzwvpQdk7LGoFeXx30lC8VCQYILdS87Zg0pw7gyS5TTczPhKoInKhgD+gO+HBcWS8bCLCv8vajqCEnaC9V0qpgNLdXj7wtXRPt6pdVpCjKHGDE8tm/6ILdGCzmMZhkTXcAZEJYjjnGXm0jeClyiQ9yXXZJVzfi6xbiw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB6707.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(366004)(346002)(376002)(396003)(39860400002)(66476007)(66556008)(66946007)(66446008)(64756008)(8936002)(76116006)(7696005)(110136005)(2906002)(71200400001)(8676002)(186003)(86362001)(26005)(316002)(6506007)(53546011)(9686003)(478600001)(5660300002)(55016002)(6636002)(52536014)(4326008)(83380400001)(33656002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: wxKri4TkvuuE1T+YPDk0DjYQzo+vDxhlXr2xWcsAwywkXc6jV8LZvCjw4SRtnfIX8re18KokHCL6Wc/uei7p+bwzVfGlD0jI8vtI/XXpyRrnQ8CKPV7DogyAQZXQg+K4UBI2N3TaMha7N3kWBcJ0P/eIqIrjtcCr3lobdaRlBcvSIvg0gvva0BPqslEV1qdMdcRW/fFhb0/Gl4wuimYHBt+q1DTQkjo/4ZFzecvfCmwU0VgpL1Sn3O5DqrVbyH3nWJVjDRyYE5xSGOjbhbf25rCL5QjryFnhraWCvaXXwNQjZB93o5FJhMafcPYAMA+uLF5ilMw/W2BsYqwYJyeQqVCuUCZdojtCK26SALynIB6SRyuXgTeLuT8UgeT9shCOcmgaLuyTlMJ2SvJ7In+V1l27Z3p0fC6ba5kTeoWUA3HQ4Z3WPglruNlhopgfEYALUqXDJHOn6A12G6L+QbKDmBSqZIG84FoOmiQ/o76ixvE3ImcWXbcRnv9Ghif5OtDQ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM0PR05MB6707.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3d6d2cee-5fef-4f95-41b6-08d82e335b4f X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jul 2020 11:35:38.0447 (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: 4NU865F0SPmGVI9L6SUMz+Wm0KjNI3U4QwxMiuvukqq5O5DLVPihJvoaMHiSxeq2v66xeHvzpAhu6Rkaum6Thw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3924 Subject: Re: [dpdk-dev] [PATCH v2 1/3] net/mlx5: separate aging counter pool range 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: Suanming Mou > Sent: Wednesday, July 22, 2020 10:59 AM > To: Slava Ovsiienko ; Matan Azrad > > Cc: Raslan Darawsheh ; dev@dpdk.org > Subject: [PATCH v2 1/3] net/mlx5: separate aging counter pool range >=20 > Currently, when allocate the counter or counter based age from group 0, > counter and age may share the same counter dcs ID range. Both age and > pure counter need to sync up with each other's container to check if > the ID range exists and update the min_dcs. >=20 > It comes two disadvantages: > 1. If the ID range is shared, this counter range will be queried twice > both from age and pure counter container in 1s. > 2. The same range counter check between the two container makes the > counter allocate sync min_dcs time to time with extra min_dcs updating. >=20 > This patch avoid the same ID range to be shared when allocate the new > pool. If the same ID range exists in other container, just add the > counter to the other container until get new range which saves the > min_dcs sync up time to time. >=20 > Signed-off-by: Suanming Mou > Acked-by: Matan Azrad > --- > drivers/net/mlx5/mlx5_flow_dv.c | 69 +++++++++++++++++------------------ > ------ > 1 file changed, 28 insertions(+), 41 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > b/drivers/net/mlx5/mlx5_flow_dv.c > index f0cc7ad..2fc4457 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -4408,39 +4408,6 @@ struct field_modify_info modify_tcp[] =3D { > } >=20 > /** > - * Update the minimum dcs-id for aged or no-aged counter pool. > - * > - * @param[in] dev > - * Pointer to the Ethernet device structure. > - * @param[in] pool > - * Current counter pool. > - * @param[in] batch > - * Whether the pool is for counter that was allocated by batch command= . > - * @param[in] age > - * Whether the counter is for aging. > - */ > -static void > -flow_dv_counter_update_min_dcs(struct rte_eth_dev *dev, > - struct mlx5_flow_counter_pool *pool, > - uint32_t batch, uint32_t age) > -{ > - struct mlx5_priv *priv =3D dev->data->dev_private; > - struct mlx5_flow_counter_pool *other; > - struct mlx5_pools_container *cont; > - > - cont =3D MLX5_CNT_CONTAINER(priv->sh, batch, (age ^ 0x1)); > - other =3D flow_dv_find_pool_by_id(cont, pool->min_dcs->id); > - if (!other) > - return; > - if (pool->min_dcs->id < other->min_dcs->id) { > - rte_atomic64_set(&other->a64_dcs, > - rte_atomic64_read(&pool->a64_dcs)); > - } else { > - rte_atomic64_set(&pool->a64_dcs, > - rte_atomic64_read(&other->a64_dcs)); > - } > -} > -/** > * Prepare a new counter and/or a new counter pool. > * > * @param[in] dev > @@ -4467,31 +4434,50 @@ struct field_modify_info modify_tcp[] =3D { > struct mlx5_counters tmp_tq; > struct mlx5_devx_obj *dcs =3D NULL; > struct mlx5_flow_counter *cnt; > + uint32_t add2other; > uint32_t i; >=20 > cont =3D MLX5_CNT_CONTAINER(priv->sh, batch, age); > if (!batch) { > +retry: > + add2other =3D 0; > /* bulk_bitmap must be 0 for single counter allocation. */ > dcs =3D mlx5_devx_cmd_flow_counter_alloc(priv->sh->ctx, 0); > if (!dcs) > return NULL; > pool =3D flow_dv_find_pool_by_id(cont, dcs->id); > + /* Check if counter belongs to exist pool ID range. */ > if (!pool) { > - pool =3D flow_dv_pool_create(dev, dcs, batch, age); > - if (!pool) { > - mlx5_devx_cmd_destroy(dcs); > - return NULL; > + pool =3D flow_dv_find_pool_by_id > + (MLX5_CNT_CONTAINER > + (priv->sh, batch, (age ^ 0x1)), dcs->id); > + /* > + * Pool eixsts, counter will be added to the other > + * container, need to reallocate it later. > + */ > + if (pool) { > + add2other =3D 1; > + } else { > + pool =3D flow_dv_pool_create(dev, dcs, batch, > + age); > + if (!pool) { > + mlx5_devx_cmd_destroy(dcs); > + return NULL; > + } > } > - } else if (dcs->id < pool->min_dcs->id) { > + } > + if (dcs->id < pool->min_dcs->id) > rte_atomic64_set(&pool->a64_dcs, > (int64_t)(uintptr_t)dcs); > - } > - flow_dv_counter_update_min_dcs(dev, > - pool, batch, age); > i =3D dcs->id % MLX5_COUNTERS_PER_POOL; > cnt =3D MLX5_POOL_GET_CNT(pool, i); > cnt->pool =3D pool; > MLX5_GET_POOL_CNT_EXT(pool, i)->dcs =3D dcs; > + if (add2other) { > + TAILQ_INSERT_TAIL(&pool->counters[pool- > >query_gen], > + cnt, next); > + goto retry; > + } > *cnt_free =3D cnt; > return pool; > } > @@ -9985,3 +9971,4 @@ struct field_modify_info modify_tcp[] =3D { > }; >=20 > #endif /* HAVE_IBV_FLOW_DV_SUPPORT */ > + > -- > 1.8.3.1 Series applied to next-net-mlx, Kindest regards, Raslan Darawsheh