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 418CEA057B; Thu, 2 Apr 2020 12:00:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0ED272BCE; Thu, 2 Apr 2020 12:00:17 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130049.outbound.protection.outlook.com [40.107.13.49]) by dpdk.org (Postfix) with ESMTP id 8A39B2BAF for ; Thu, 2 Apr 2020 12:00:15 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H/81OoIjmZR7CNLKCyQCwwUJJpTY0HuqGzaGowGS/ISpfk9OAp7C0ZoLI/ADmm7wdEM46BAkOXl5W61Zq+GfPR+dHckw9B6WUkMOQcZGyaDGsylFpvJSdk9OqA6/ygWHdSAjDvRDgliyrN1fB0K6jSCHGJB2PtpmI7K8xL4cPWacjNGhS90cFluWRauqge8CuJhU624IV2xp+UD8+bvnpOfyHEhSfbvYYtV/Jtv4y5AS4k2dRcOOUY6zjvGSblsW+SlMzuvnJVV+zjbIrn741bExZWKQTleEyjWkPDf+1Z4fP7hU9zzW/2FBAGAhjKHp6Wm3QJlAvjI6lBDXx0sJYA== 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=HjxwkQCtuyQnXOwJqkeO6nudgdGGDdodKJNAq1Y6riA=; b=Z4CLAHdzFKZ3KMsoOGX2k8RVe5UtzT4R4XHnqthIZuVq+zpWR21tvjKFafEmWW7HBWKmdhHL4T2jkKY505wiCuwXPQWn+bP3QiPyHZeVtXN4BXgAuNhqtL0W2KnXzwZy5iDPNLf+y0RMszHnBmedaygSCWZM2OoPwkiFfRG5NkuWruRemaun1dyojSEgLceuJyfG/lFcObRVq0BO8OdknYEh1NtqgANz2huMMP/tTT/XFym6VcuKrCMd0lbhogPMRWY8QwhWOK/3ZrTQcGUcs3PZnBnoej/I6hW6EJhFA8RhYBmbVBVrPvPPQSGLY+Zz8YpuCny24cT+GbOb74GSSg== 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=HjxwkQCtuyQnXOwJqkeO6nudgdGGDdodKJNAq1Y6riA=; b=XuzCGrarWLerF26GdKoqNVd8Dx0IpyDlwAigPiuMovQmABQPR16PudQozddZ5zb7rdFj2eu+Ksu79DLWbIx+1bWkUQ0B072hn4lJo/bYnya9zMMxbur5BMQM3teTmTKDAsskt8igiZhFijyaOxB4pFG3bhbdn35Ru70SJoA86qo= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.188.154) by AM4PR05MB3489.eurprd05.prod.outlook.com (10.170.126.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.15; Thu, 2 Apr 2020 10:00:14 +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.2856.019; Thu, 2 Apr 2020 10:00:14 +0000 From: Slava Ovsiienko To: Alexander Kozyrev , "dev@dpdk.org" CC: Raslan Darawsheh , Matan Azrad , "ferruh.yigit@intel.com" , Thomas Monjalon Thread-Topic: [PATCH 1/4] net/mlx5: add a devarg to specify MPRQ stride size Thread-Index: AQHWB6bVsmRcDc+d6UKYDEwkFVKY86hlm2tA Date: Thu, 2 Apr 2020 10:00:12 +0000 Message-ID: References: <1585691559-17409-1-git-send-email-akozyrev@mellanox.com> <1585691559-17409-2-git-send-email-akozyrev@mellanox.com> In-Reply-To: <1585691559-17409-2-git-send-email-akozyrev@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: 1d599886-7b7c-4af6-2709-08d7d6eca394 x-ms-traffictypediagnostic: AM4PR05MB3489:|AM4PR05MB3489: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr,ExtFwd x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 0361212EA8 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM4PR05MB3265.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(376002)(346002)(366004)(39860400002)(396003)(136003)(8676002)(2906002)(7696005)(316002)(26005)(6506007)(186003)(54906003)(76116006)(33656002)(5660300002)(52536014)(4326008)(64756008)(71200400001)(81166006)(53546011)(110136005)(81156014)(478600001)(55016002)(86362001)(66946007)(66574012)(9686003)(66476007)(66556008)(8936002)(66446008)(309714004); DIR:OUT; SFP:1101; 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: HQbmpWcVaifcFB8SVkIVXDJKQPMMfuXDu9DZmSEfXwboreXcNHFXqGlAsKvvXXeOHZBUZVfhZLzUlW0oxKscDqEwaH95DvQYuO/qbsCY4dcF5fFbXvUVoq1sVOb9Oqf8Kejv7Uwq+ar+GcGefIMqTMABdM1R9msZpLsCLjHTmkytYArfM6ZkPI2yZ3W1/2OzV6Z4RZSlP8HJzrRX4rmWHziMyCer5/U336ZUW1bkgXgEEUJOSIcp1qir16Ztrou/x9ixnrdajkUYmaiWfbZ9BWFyJIsCIAq0n0WsG/Znib/10rXSPt+bhUyWbWYXYtj5+tZIZ/dEMJjZIwV8ZZ+PKkQiWa35yI6PEKXJr01X2s+4ccH68MxIebSYeMmDltPUT/ovDcJwAm0dx4SJHtjZcE6Nxld3faFj1d1lrNoBfwY/KUS/PlEMRg8ADEMAURfg8eO6SkPDsI5coeeaFqiqDZT3v9qREwM7bA5xdoBETLoZSuy9v11S2Os2J9/+3Bey x-ms-exchange-antispam-messagedata: F2bqMcf/7tuyibLuchaBRtsdV+1x866jj6By+G51HHCpXIbhLKbWeQgjwLF+plyjTKlHLdDiE/Y+6sO4R0XASSrwqVeyszbB34aKOmRLD3jBWS5lTGqJPXrJiyg6DtGqZ+oGuQgjZ9diH80CZR/W5w== 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: 1d599886-7b7c-4af6-2709-08d7d6eca394 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Apr 2020 10:00:12.7534 (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: uorTd/n+q7Ys2Hhp3ehfaDVepZ4n3g0yWW9r7WMlPMTfaXHy3348xAsdYOuv5tSIWdC1pnHPQDLYGuR2VwmUq9Jngrbb6U6U4vjD4pZJLhw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3489 Subject: Re: [dpdk-dev] [PATCH 1/4] net/mlx5: add a devarg to specify MPRQ stride size 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: Alexander Kozyrev > Sent: Wednesday, April 1, 2020 0:53 > To: dev@dpdk.org > Cc: Raslan Darawsheh ; Matan Azrad > ; Slava Ovsiienko ; > ferruh.yigit@intel.com; Thomas Monjalon > Subject: [PATCH 1/4] net/mlx5: add a devarg to specify MPRQ stride size >=20 > Define a device parameter to configure log 2 of a stride size for MPRQ > - mprq_log_stride_size. User is able to specify a stride size in a range = allowed > by an underlying hardware. The default stride size is defined as > 2048 bytes to encompass most commonly used packet sizes in the Internet > (MTU 1518 and less) and will be used in case a maximum configured packet > size cannot fit into the largest possible stride size. Otherwise a stride= size is > set to a large enough value to encompass a whole packet. >=20 > Signed-off-by: Alexander Kozyrev Acked-by: Viacheslav Ovsiienko > --- > drivers/net/mlx5/mlx5.c | 34 +++++++++++++++++++++++++++------- > drivers/net/mlx5/mlx5.h | 1 + > drivers/net/mlx5/mlx5_defs.h | 3 +++ > drivers/net/mlx5/mlx5_rxq.c | 22 +++++++++++++--------- > 4 files changed, 44 insertions(+), 16 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index > 6a11b14..a2ba6d3 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -63,6 +63,9 @@ > /* Device parameter to configure log 2 of the number of strides for MPRQ= . */ > #define MLX5_RX_MPRQ_LOG_STRIDE_NUM "mprq_log_stride_num" >=20 > +/* Device parameter to configure log 2 of the stride size for MPRQ. */ > +#define MLX5_RX_MPRQ_LOG_STRIDE_SIZE "mprq_log_stride_size" > + > /* Device parameter to limit the size of memcpy'd packet for MPRQ. */ > #define MLX5_RX_MPRQ_MAX_MEMCPY_LEN "mprq_max_memcpy_len" >=20 > @@ -1531,6 +1534,8 @@ struct mlx5_flow_id_pool * > config->mprq.enabled =3D !!tmp; > } else if (strcmp(MLX5_RX_MPRQ_LOG_STRIDE_NUM, key) =3D=3D 0) { > config->mprq.stride_num_n =3D tmp; > + } else if (strcmp(MLX5_RX_MPRQ_LOG_STRIDE_SIZE, key) =3D=3D 0) { > + config->mprq.stride_size_n =3D tmp; > } else if (strcmp(MLX5_RX_MPRQ_MAX_MEMCPY_LEN, key) =3D=3D 0) { > config->mprq.max_memcpy_len =3D tmp; > } else if (strcmp(MLX5_RXQS_MIN_MPRQ, key) =3D=3D 0) { @@ -1627,6 > +1632,7 @@ struct mlx5_flow_id_pool * > MLX5_RXQ_PKT_PAD_EN, > MLX5_RX_MPRQ_EN, > MLX5_RX_MPRQ_LOG_STRIDE_NUM, > + MLX5_RX_MPRQ_LOG_STRIDE_SIZE, > MLX5_RX_MPRQ_MAX_MEMCPY_LEN, > MLX5_RXQS_MIN_MPRQ, > MLX5_TXQ_INLINE, > @@ -2302,8 +2308,6 @@ struct mlx5_flow_id_pool * > mprq_caps.min_single_wqe_log_num_of_strides; > mprq_max_stride_num_n =3D > mprq_caps.max_single_wqe_log_num_of_strides; > - config.mprq.stride_num_n =3D > RTE_MAX(MLX5_MPRQ_STRIDE_NUM_N, > - mprq_min_stride_num_n); > } > #endif > if (RTE_CACHE_LINE_SIZE =3D=3D 128 && > @@ -2617,17 +2621,32 @@ struct mlx5_flow_id_pool * #endif > } > if (config.mprq.enabled && mprq) { > - if (config.mprq.stride_num_n > mprq_max_stride_num_n || > - config.mprq.stride_num_n < mprq_min_stride_num_n) { > + if (config.mprq.stride_num_n && > + (config.mprq.stride_num_n > mprq_max_stride_num_n || > + config.mprq.stride_num_n < mprq_min_stride_num_n)) { > config.mprq.stride_num_n =3D > - RTE_MAX(MLX5_MPRQ_STRIDE_NUM_N, > - mprq_min_stride_num_n); > + > RTE_MIN(RTE_MAX(MLX5_MPRQ_STRIDE_NUM_N, > + mprq_min_stride_num_n), > + mprq_max_stride_num_n); > DRV_LOG(WARNING, > "the number of strides" > " for Multi-Packet RQ is out of range," > " setting default value (%u)", > 1 << config.mprq.stride_num_n); > } > + if (config.mprq.stride_size_n && > + (config.mprq.stride_size_n > mprq_max_stride_size_n || > + config.mprq.stride_size_n < mprq_min_stride_size_n)) { > + config.mprq.stride_size_n =3D > + > RTE_MIN(RTE_MAX(MLX5_MPRQ_STRIDE_SIZE_N, > + mprq_min_stride_size_n), > + mprq_max_stride_size_n); > + DRV_LOG(WARNING, > + "the size of a stride" > + " for Multi-Packet RQ is out of range," > + " setting default value (%u)", > + 1 << config.mprq.stride_size_n); > + } > config.mprq.min_stride_size_n =3D mprq_min_stride_size_n; > config.mprq.max_stride_size_n =3D mprq_max_stride_size_n; > } else if (config.mprq.enabled && !mprq) { @@ -3361,7 +3380,8 @@ > struct mlx5_flow_id_pool * > .mr_ext_memseg_en =3D 1, > .mprq =3D { > .enabled =3D 0, /* Disabled by default. */ > - .stride_num_n =3D MLX5_MPRQ_STRIDE_NUM_N, > + .stride_num_n =3D 0, > + .stride_size_n =3D 0, > .max_memcpy_len =3D > MLX5_MPRQ_MEMCPY_DEFAULT_LEN, > .min_rxqs_num =3D MLX5_MPRQ_MIN_RXQS, > }, > diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index > 62b0810..c8e2454 100644 > --- a/drivers/net/mlx5/mlx5.h > +++ b/drivers/net/mlx5/mlx5.h > @@ -176,6 +176,7 @@ struct mlx5_dev_config { > struct { > unsigned int enabled:1; /* Whether MPRQ is enabled. */ > unsigned int stride_num_n; /* Number of strides. */ > + unsigned int stride_size_n; /* Size of a stride. */ > unsigned int min_stride_size_n; /* Min size of a stride. */ > unsigned int max_stride_size_n; /* Max size of a stride. */ > unsigned int max_memcpy_len; > diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h > index 19e8253..260f584 100644 > --- a/drivers/net/mlx5/mlx5_defs.h > +++ b/drivers/net/mlx5/mlx5_defs.h > @@ -143,6 +143,9 @@ > /* Log 2 of the default number of strides per WQE for Multi-Packet RQ. *= / > #define MLX5_MPRQ_STRIDE_NUM_N 6U >=20 > +/* Log 2 of the default size of a stride per WQE for Multi-Packet RQ. > +*/ #define MLX5_MPRQ_STRIDE_SIZE_N 11U > + > /* Two-byte shift is disabled for Multi-Packet RQ. */ #define > MLX5_MPRQ_TWO_BYTE_SHIFT 0 >=20 > diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c in= dex > 0a95e3c..85fcfe6 100644 > --- a/drivers/net/mlx5/mlx5_rxq.c > +++ b/drivers/net/mlx5/mlx5_rxq.c > @@ -1856,25 +1856,26 @@ struct mlx5_rxq_ctrl * > strd_headroom_en =3D 1; > mprq_stride_size =3D non_scatter_min_mbuf_size; > } > + if (!config->mprq.stride_num_n) > + config->mprq.stride_num_n =3D MLX5_MPRQ_STRIDE_NUM_N; > + if (!config->mprq.stride_size_n) > + config->mprq.stride_size_n =3D (mprq_stride_size <=3D > + (1U << config->mprq.max_stride_size_n)) ? > + log2above(mprq_stride_size) : > MLX5_MPRQ_STRIDE_SIZE_N; > /* > * This Rx queue can be configured as a Multi-Packet RQ if all of the > * following conditions are met: > * - MPRQ is enabled. > * - The number of descs is more than the number of strides. > - * - max_rx_pkt_len plus overhead is less than the max size of a > - * stride. > * Otherwise, enable Rx scatter if necessary. > */ > - if (mprq_en && > - desc > (1U << config->mprq.stride_num_n) && > - mprq_stride_size <=3D (1U << config->mprq.max_stride_size_n)) { > + if (mprq_en && desc > (1U << config->mprq.stride_num_n)) { > /* TODO: Rx scatter isn't supported yet. */ > tmpl->rxq.sges_n =3D 0; > /* Trim the number of descs needed. */ > desc >>=3D config->mprq.stride_num_n; > tmpl->rxq.strd_num_n =3D config->mprq.stride_num_n; > - tmpl->rxq.strd_sz_n =3D RTE_MAX(log2above(mprq_stride_size), > - config->mprq.min_stride_size_n); > + tmpl->rxq.strd_sz_n =3D config->mprq.stride_size_n; > tmpl->rxq.strd_shift_en =3D MLX5_MPRQ_TWO_BYTE_SHIFT; > tmpl->rxq.strd_headroom_en =3D strd_headroom_en; > tmpl->rxq.mprq_max_memcpy_len =3D > RTE_MIN(first_mb_free_size, @@ -1924,9 +1925,12 @@ struct mlx5_rxq_ctrl * > DRV_LOG(WARNING, > "port %u MPRQ is requested but cannot be enabled" > " (requested: desc =3D %u, stride_sz =3D %u," > - " supported: min_stride_num =3D %u, max_stride_sz =3D > %u).", > - dev->data->port_id, desc, mprq_stride_size, > + " supported: min_stride_num =3D %u, min_stride_sz =3D > %u," > + "max_stride_sz =3D %u).", > + dev->data->port_id, desc, > + (1 << config->mprq.stride_size_n), > (1 << config->mprq.stride_num_n), > + (1 << config->mprq.min_stride_size_n), > (1 << config->mprq.max_stride_size_n)); > DRV_LOG(DEBUG, "port %u maximum number of segments per > packet: %u", > dev->data->port_id, 1 << tmpl->rxq.sges_n); > -- > 1.8.3.1