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 D1512A054F; Tue, 18 Feb 2020 10:05:21 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 453771D665; Tue, 18 Feb 2020 10:05:21 +0100 (CET) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2040.outbound.protection.outlook.com [40.107.22.40]) by dpdk.org (Postfix) with ESMTP id 2C5A21D664; Tue, 18 Feb 2020 10:05:20 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Khwbnk+/BjcsfOveNeUu/iI/FaFq5tv34cUz7hdxuLyukikySqQbEFxqaBDtpOWLMdhplu+QraCGo46q9Ry3ZlZLsQ8IUI6VEL+1nca2rqBmu4jdWTPcqdHqh/kR/O7qIfhCSEH0FyUg2JFsHtIcAdH1TULVAWWNmJWAg04HY9Ok2KQB+XcHE+ei+LEj6wv7Peadka8AFaFVfMCJIhyZfyu/b8BPEgkW90KJrjp+o4KojjMnjMGFiIlFdgvwYvQdWL0daQa1Qkg7M17pVB9IO02bcnciBgnyHdbuawU/8wbHH4IubhCOFKyVpp9dGN4b7bXcaAM9rf1F7Rt9q82svQ== 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=Hst5f4OS17jKo4xC3RMurArNBFLpaX5yApiOUk2wGuw=; b=NkKDwYFGSv9/vHYVjvtSZ/iOH/z+6lyztTf7u0jHzUiz2AIrwqWxPnbiJuGT95tT9MSIYGhhZ2uhOfNfFgzkIgWynfPnGFvWx62wX7IV3ouS/GiYNpAIBxg7+gKVYf2dXsPrr2QTlh5Myfv8n0I1etyafiCxeqRfel/w5lTOF3h6tlPW5h02VGIEZtlaDltwc+oyOYtd7skZVdeL7VyTCkKxklw+Lv9AI3zlo9uXyk5MX84ctv+vyaxqKuDy3/p0dNhBHuGH8HT3FQ7IZn0wkQ5KVmSb0b+6wR3QC+PIUnucCSl+tESalvitvugTCOcKQSYlM/0RAgnNpY1Ql37m6w== 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=Hst5f4OS17jKo4xC3RMurArNBFLpaX5yApiOUk2wGuw=; b=dZGa8huEkLNHTJ6pLeHENljTiZ3m87G3ZXKusdv0XlddhrlPpL/a2ZCzDYI9v5eLYp7+VXkRCZiYl4wQ+xoV4R6j8A7avsE7BYrihEj+YsXHdpJbT2m3iraOixV2vdM/w+oSESh6eS5YrPpw4qmlFSBnHk5npUuUC8JsNq2sjlQ= Received: from AM6PR05MB5176.eurprd05.prod.outlook.com (20.177.196.158) by AM6PR05MB4485.eurprd05.prod.outlook.com (52.135.163.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2729.24; Tue, 18 Feb 2020 09:05:19 +0000 Received: from AM6PR05MB5176.eurprd05.prod.outlook.com ([fe80::1888:dbf5:a84e:c53b]) by AM6PR05MB5176.eurprd05.prod.outlook.com ([fe80::1888:dbf5:a84e:c53b%6]) with mapi id 15.20.2729.032; Tue, 18 Feb 2020 09:05:19 +0000 From: Ori Kam To: Bing Zhao , Matan Azrad CC: Slava Ovsiienko , Raslan Darawsheh , "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH] net/mlx5: fix the hairpin queue capacity Thread-Index: AQHV5ZakE/CtYX5lEUewnmm18YlBCqggqbCw Date: Tue, 18 Feb 2020 09:05:18 +0000 Message-ID: References: <1581946301-457865-1-git-send-email-bingz@mellanox.com> In-Reply-To: <1581946301-457865-1-git-send-email-bingz@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=orika@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 31804725-5f45-4bda-b138-08d7b451ad72 x-ms-traffictypediagnostic: AM6PR05MB4485:|AM6PR05MB4485: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 031763BCAF x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(136003)(346002)(396003)(39860400002)(366004)(189003)(199004)(66476007)(2906002)(66946007)(76116006)(66556008)(66446008)(478600001)(86362001)(81166006)(81156014)(64756008)(8936002)(8676002)(5660300002)(71200400001)(450100002)(26005)(6636002)(316002)(110136005)(54906003)(186003)(52536014)(33656002)(9686003)(55016002)(7696005)(4326008)(6506007); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB4485; H:AM6PR05MB5176.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: BCL:0; x-microsoft-antispam-message-info: 2in67zWAms7cLwkxJDkbXejlMccqFY8bWfrti8PqXY27/JjIO2GvKkTGPADZgFnzSQ+A+73IGW6c3QjBwcthEV/eHOVOHRqNvBEiizPkyq+UOtGA7DqxqwQ6dgthdfjWIbH0BkImU19h7Wny0Ht5tZ/qv6mU22ldIRNPpM+aTy2ikgrgW+kOV+yUX57GXw1FStKPzmyGUmdQrj11r3KhBKYup7Y7966CCxbZCh+yrj/TnaBABeUwRgDOwoKYlnRO+a/VQG0lYQ97tTahOxPUe1W1WOJfyjAWTSNxkr24KOqMzAcxXIamyYH9mG4XrSdEDAakaF46gzzViMK6bBLKpYzBr5d2zmHJ+jjCcFgRCh4o8SE/LidfQ0WStA0b30MTfOwMJ+seMH7060MMidn98tzVHgnxm4Ef68KK9y6NmG3/fA0oxDeVrGYbqmcH4tKi x-ms-exchange-antispam-messagedata: QGR3RwXM2iWXNyKIdz6MeJMMcmLZ6AgqHIXDuYwmYNxORUpAmALvWkXlN/9OKZTApwfhN5gSLaV2Onk7FlhgCmI/7xQXoLkM+mNTFISrGkIF67qMZHXxobRLmlHoE5tk5TtVqTNaifLGs8UYWxXBww== 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: 31804725-5f45-4bda-b138-08d7b451ad72 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Feb 2020 09:05:18.9181 (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: KWvLunw8YPXa8LanI3NWKEj6SojbzFHaGINXmcifY/OoqDx2MpRb5nGC/1IkU4rDsbt8wYViscp68Mxuhv8/LA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB4485 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix the hairpin queue capacity 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: Bing Zhao > Subject: [PATCH] net/mlx5: fix the hairpin queue capacity >=20 > The hairpin TX/RX queue depth and packet size is fixed in the past. > When the firmware has some fix or improvement, the PMD will not > make full use of it. And also, 32 packets for a single queue will not > guarantee a good performance for hairpin flows. > The parameter of hairpin queue setup needs to be adjusted. Number of > packets of a single queue should be the maximum supported value, and > the maximum single packet size should support the standard jumbo > frame with 9KB. In the meanwhile, there is no need to support the > max capacity of a single packet because the memory consumption should > also be taken into consideration. >=20 > Fixes: e79c9be91515 ("net/mlx5: support Rx hairpin queues") > Cc: orika@mellanox.com > Cc: stable@dpdk.org >=20 > Signed-off-by: Bing Zhao > --- Acked-by: Ori Kam Thanks, Ori > drivers/net/mlx5/mlx5_defs.h | 4 ++++ > drivers/net/mlx5/mlx5_rxq.c | 12 ++++++++---- > drivers/net/mlx5/mlx5_txq.c | 12 ++++++++---- > 3 files changed, 20 insertions(+), 8 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h > index 9b392ed..19e8253 100644 > --- a/drivers/net/mlx5/mlx5_defs.h > +++ b/drivers/net/mlx5/mlx5_defs.h > @@ -173,6 +173,10 @@ > #define MLX5_FLOW_MREG_HNAME "MARK_COPY_TABLE" > #define MLX5_DEFAULT_COPY_ID UINT32_MAX >=20 > +/* Hairpin TX/RX queue configuration parameters. */ > +#define MLX5_HAIRPIN_QUEUE_STRIDE 6 > +#define MLX5_HAIRPIN_JUMBO_LOG_SIZE (14 + 2) > + > /* Definition of static_assert found in /usr/include/assert.h */ > #ifndef HAVE_STATIC_ASSERT > #define static_assert _Static_assert > diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c > index dc0fd82..ac9016e 100644 > --- a/drivers/net/mlx5/mlx5_rxq.c > +++ b/drivers/net/mlx5/mlx5_rxq.c > @@ -1268,6 +1268,7 @@ > struct mlx5_devx_create_rq_attr attr =3D { 0 }; > struct mlx5_rxq_obj *tmpl =3D NULL; > int ret =3D 0; > + uint32_t max_wq_data; >=20 > MLX5_ASSERT(rxq_data); > MLX5_ASSERT(!rxq_ctrl->obj); > @@ -1283,11 +1284,14 @@ > tmpl->type =3D MLX5_RXQ_OBJ_TYPE_DEVX_HAIRPIN; > tmpl->rxq_ctrl =3D rxq_ctrl; > attr.hairpin =3D 1; > - /* Workaround for hairpin startup */ > - attr.wq_attr.log_hairpin_num_packets =3D log2above(32); > - /* Workaround for packets larger than 1KB */ > + max_wq_data =3D priv->config.hca_attr.log_max_hairpin_wq_data_sz; > + /* Set the packets number to the maximum value for performance. */ > + attr.wq_attr.log_hairpin_num_packets =3D max_wq_data - > + MLX5_HAIRPIN_QUEUE_STRIDE; > + /* Jumbo frames > 9KB should be supported. */ > attr.wq_attr.log_hairpin_data_sz =3D > - priv->config.hca_attr.log_max_hairpin_wq_data_sz; > + (max_wq_data < MLX5_HAIRPIN_JUMBO_LOG_SIZE) ? > + max_wq_data : MLX5_HAIRPIN_JUMBO_LOG_SIZE; > tmpl->rq =3D mlx5_devx_cmd_create_rq(priv->sh->ctx, &attr, > rxq_ctrl->socket); > if (!tmpl->rq) { > diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c > index bc13abf..6c08bb9 100644 > --- a/drivers/net/mlx5/mlx5_txq.c > +++ b/drivers/net/mlx5/mlx5_txq.c > @@ -493,6 +493,7 @@ > struct mlx5_devx_create_sq_attr attr =3D { 0 }; > struct mlx5_txq_obj *tmpl =3D NULL; > int ret =3D 0; > + uint32_t max_wq_data; >=20 > MLX5_ASSERT(txq_data); > MLX5_ASSERT(!txq_ctrl->obj); > @@ -509,11 +510,14 @@ > tmpl->txq_ctrl =3D txq_ctrl; > attr.hairpin =3D 1; > attr.tis_lst_sz =3D 1; > - /* Workaround for hairpin startup */ > - attr.wq_attr.log_hairpin_num_packets =3D log2above(32); > - /* Workaround for packets larger than 1KB */ > + max_wq_data =3D priv->config.hca_attr.log_max_hairpin_wq_data_sz; > + /* Set the packets number to the maximum value for performance. */ > + attr.wq_attr.log_hairpin_num_packets =3D max_wq_data - > + MLX5_HAIRPIN_QUEUE_STRIDE; > + /* Jumbo frames > 9KB should be supported. */ > attr.wq_attr.log_hairpin_data_sz =3D > - priv->config.hca_attr.log_max_hairpin_wq_data_sz; > + (max_wq_data < MLX5_HAIRPIN_JUMBO_LOG_SIZE) ? > + max_wq_data : MLX5_HAIRPIN_JUMBO_LOG_SIZE; > attr.tis_num =3D priv->sh->tis->id; > tmpl->sq =3D mlx5_devx_cmd_create_sq(priv->sh->ctx, &attr); > if (!tmpl->sq) { > -- > 1.8.3.1