From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50063.outbound.protection.outlook.com [40.107.5.63]) by dpdk.org (Postfix) with ESMTP id 7F84F4F90; Thu, 15 Nov 2018 11:29:21 +0100 (CET) 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=NrBWGctRwgjOsq7gfCzZMVN5YXCjwB1zupiKtY3o9zk=; b=DyQN+J/eDJi65hCVuh0yrTsGrBajdkE2RM93i2HrDvMTbnK1WpgD15CScttxbnHb+Cy6B8Zzf2p46VSiiJ9HABDhrtuzRgjqV1FkBj2jvPadcUs5bdcSNi3d8kQRE0XyQc6ZbYhJkV8Pm9Nvurt6uFV2gAFkCIVOYbvjOCmOa14= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3963.eurprd05.prod.outlook.com (52.134.72.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.27; Thu, 15 Nov 2018 10:29:20 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::58e7:97d8:f9c1:4323]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::58e7:97d8:f9c1:4323%3]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 10:29:20 +0000 From: Yongseok Koh To: Shahaf Shuler CC: "dev@dpdk.org" , Yongseok Koh , "stable@dpdk.org" Thread-Topic: [PATCH 4/4] net/mlx5: optimize Rx buffer replenishment threshold Thread-Index: AQHUfM4Rp14hgR7JVEGch8K1Os8ARw== Date: Thu, 15 Nov 2018 10:29:20 +0000 Message-ID: <20181115102859.10928-4-yskoh@mellanox.com> References: <20181115102859.10928-1-yskoh@mellanox.com> In-Reply-To: <20181115102859.10928-1-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR05CA0019.namprd05.prod.outlook.com (2603:10b6:a03:c0::32) 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-microsoft-exchange-diagnostics: 1; DB3PR0502MB3963; 6:MpzE2OG3Cb2vIQLSabskWkdV1WMr/nph7/GQua785hrL5G+f5KE2c+v8DPtoYtuPxUwXSoRrPzWjLFp9utvmnyZbrQu4WH7v5x8dYbTJJl0eYmEWgxfaXc8UHfwdLkoPKSPrQYkLO9l1id9dgbQFTIX5FUIn0wuC8b8pTIBXFqk9FG+7N+Bf3jPr47YLJRtkKlT0vnlKT9sxxC78Mr5HZYH/HWaw0Gr7MTYsbsePme1+GVAmIi6xqUJc/6USX5QfVxIC6iWTe3gQdZIWoRuwZRjQGsQV4U6CbiRsNxjkDuSqI5BH65HyWiRSFxOecEL/h2cUP1SDP8PJ2GjL+6KydQ3bzYx+67swcUfYVt07kfVHitqlnACUHD3gMsJL1wHS0waxFSXZJR1Eovsb7GXxgAAPYaEZ/6wVhs/QkrYcBHwV+YDsG25QAQ0ss7y/gdTcZuQ4ZG3R+uh95TYrmBkofA==; 5:cxI/ceZ6Mi3LujjcsPRk2fuLM1DijJdP5ysG0rvHVLxQBo7OmfrZN+PhOl8xRoYP8JObo2JRBscT5yvWncksk/nqVqf4Bdzn3ISAwU3XhX2JAEQSzjLZOBwZgtm+Yu0ktttGvP/eVeIrDA1sLlQqLv1NzAOrSE+xXqH1nccz6JY=; 7:5SE8rbaYm7bEIF8Ov04Oqs9O3yI7zuBpf4/pHSvBFVGhP7/vVG/ba5eIxm/SIinLKVu85hkX2urX2L93olI0tRtslZdXxGrvNg1N9X5/r60CEbiEkW5hJ8wT2kKMgXPLIvSagCgFKURh5+lABE2lFQ== x-ms-office365-filtering-correlation-id: 26ec638a-3794-476e-edf5-08d64ae53415 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:DB3PR0502MB3963; x-ms-traffictypediagnostic: DB3PR0502MB3963: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231415)(944501410)(52105112)(10201501046)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:DB3PR0502MB3963; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3963; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(39860400002)(396003)(366004)(136003)(189003)(199004)(102836004)(1076002)(186003)(316002)(6636002)(105586002)(6436002)(486006)(106356001)(25786009)(11346002)(5660300001)(386003)(6506007)(8936002)(81166006)(81156014)(68736007)(52116002)(6512007)(66066001)(36756003)(478600001)(2616005)(14454004)(53936002)(7736002)(4326008)(6862004)(71200400001)(71190400001)(8676002)(6486002)(97736004)(86362001)(575784001)(305945005)(99286004)(450100002)(26005)(476003)(54906003)(2900100001)(6116002)(3846002)(446003)(37006003)(2906002)(76176011)(256004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3963; 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-microsoft-antispam-message-info: mzsi47Dtc86JjS4Fj4DV1zY3xampO2NEKXw2LpDvRtazxbpTgndLR22hBT+9Pe7Rr3ZUlTWDNzyo7tmZx5mtmg6PSWrpn+pX+BbuMC0Vad9suFsVRgQFgAZIvXO8bVvRdERBqYwHJsFecmMnAuS9n6a2LEENsOgjT1mlTkdY1WoBKPRPpwCAqMazEi0RRqVCvqXm7d0G+0p6S1+VrR64u0x1c9Z4z7wRQjtSD2CPN4OT2Gqen1EJGH14VTWLbOPfGjmL7hwlxNNYfjqGfrDrmmdHTceteu7RNTi694lm7rIHrqvI/JlnkJD+jYF0b59y+A3tOlxPKnIrXje4LY9UY30Y6WYiu9wOeKkB8Ub9Q/w= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 26ec638a-3794-476e-edf5-08d64ae53415 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 10:29:20.3666 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3963 Subject: [dpdk-dev] [PATCH 4/4] net/mlx5: optimize Rx buffer replenishment threshold 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, 15 Nov 2018 10:29:21 -0000 Due to redundant calculation per every burst, performance drops a little. Fixes: e10245a13b2e ("net/mlx5: fix Rx buffer replenishment threshold") Cc: stable@dpdk.org Signed-off-by: Yongseok Koh --- drivers/net/mlx5/mlx5_rxq.c | 2 ++ drivers/net/mlx5/mlx5_rxtx.h | 1 + drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 2 +- drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index b27fc4798d..183da0e282 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1468,6 +1468,8 @@ mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, u= int16_t desc, tmpl->rxq.mp =3D mp; tmpl->rxq.stats.idx =3D idx; tmpl->rxq.elts_n =3D log2above(desc); + tmpl->rxq.rq_repl_thresh =3D + MLX5_VPMD_RXQ_RPLNSH_THRESH(1 << tmpl->rxq.elts_n); tmpl->rxq.elts =3D (struct rte_mbuf *(*)[1 << tmpl->rxq.elts_n])(tmpl + 1); #ifndef RTE_ARCH_64 diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index e210453fe0..f47d327cfb 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -101,6 +101,7 @@ struct mlx5_rxq_data { uint16_t consumed_strd; /* Number of consumed strides in WQE. */ uint32_t rq_pi; uint32_t cq_ci; + uint16_t rq_repl_thresh; /* Threshold for buffer replenishment. */ struct mlx5_mr_ctrl mr_ctrl; /* MR control descriptor. */ uint16_t mprq_max_memcpy_len; /* Maximum size of packet to memcpy. */ volatile void *wqes; diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_= rxtx_vec_neon.h index 0b729f1859..883fe1bf91 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h @@ -732,7 +732,7 @@ rxq_burst_v(struct mlx5_rxq_data *rxq, struct rte_mbuf = **pkts, uint16_t pkts_n, * N - (rq_ci - rq_pi) :=3D # of buffers consumed (to be replenished). */ repl_n =3D q_n - (rxq->rq_ci - rxq->rq_pi); - if (repl_n >=3D MLX5_VPMD_RXQ_RPLNSH_THRESH(q_n)) + if (repl_n >=3D rxq->rq_repl_thresh) mlx5_rx_replenish_bulk_mbuf(rxq, repl_n); /* See if there're unreturned mbufs from compressed CQE. */ rcvd_pkt =3D rxq->cq_ci - rxq->rq_pi; diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_r= xtx_vec_sse.h index e0f95f923d..14117c4bb4 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h @@ -716,7 +716,7 @@ rxq_burst_v(struct mlx5_rxq_data *rxq, struct rte_mbuf = **pkts, uint16_t pkts_n, * N - (rq_ci - rq_pi) :=3D # of buffers consumed (to be replenished). */ repl_n =3D q_n - (rxq->rq_ci - rxq->rq_pi); - if (repl_n >=3D MLX5_VPMD_RXQ_RPLNSH_THRESH(q_n)) + if (repl_n >=3D rxq->rq_repl_thresh) mlx5_rx_replenish_bulk_mbuf(rxq, repl_n); /* See if there're unreturned mbufs from compressed CQE. */ rcvd_pkt =3D rxq->cq_ci - rxq->rq_pi; --=20 2.11.0