From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0089.outbound.protection.outlook.com [104.47.0.89]) by dpdk.org (Postfix) with ESMTP id 239877D57 for ; Thu, 24 Aug 2017 17:54:31 +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; bh=H5NAxoxmlPhIkeeA+biWF4fJqIArookSY1Cvh8ZSvV0=; b=pHWoIzBhNTMEclVYHQ9O3IM7xAghnDKU3gNFaH/K4kRPyI56lUQloGXz1Ba9ZN5+MXt+KpX+v2WdWTrBdjPSKwpuMAtA5eY4SDgbJo1rGIULF+guOUbPdACRCysfXdNi0vjlz/uY8RLSMK84P817iWWJgLfHa3eAMb6M/xxWqJU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM4PR05MB1907.eurprd05.prod.outlook.com (2603:10a6:200:15::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1362.18; Thu, 24 Aug 2017 15:54:29 +0000 From: Moti Haimovsky To: adrien.mazarguil@6wind.com Cc: dev@dpdk.org, Moti Haimovsky Date: Thu, 24 Aug 2017 18:54:08 +0300 Message-Id: <1503590050-196143-4-git-send-email-motih@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1503590050-196143-1-git-send-email-motih@mellanox.com> References: <1503590050-196143-1-git-send-email-motih@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0302CA0006.eurprd03.prod.outlook.com (2603:10a6:800:e9::16) To AM4PR05MB1907.eurprd05.prod.outlook.com (2603:10a6:200:15::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 385e5bfd-2480-4126-1ba0-08d4eb08681f X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:AM4PR05MB1907; X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB1907; 3:8AP0TlXSN5nfGPlGcPjgLT7lxbq6HoFSE5UjFYvdZpaXUTii9h/uKlBBmA0cySyGLR/MbjEkRYAO1/DXPRo2d9V6AFn2ajfmQzR8u9F6pu15MgMg4XeIjSqC7I8wwcWan6lALMHeZWp+fVHJ5d2OUJXmL1F+r/HcN/ItXEzxFwKcUVGmemLdIRxPKoiITi+QCeQUgXfduDvhuMVw0S9rSZykW/HVdpGP9Az7OKZTl8BFZigQ3r9R44JV/GLBSAWC; 25:ObXPOPanxEFIkeP9t75dn5gaLsvyoN8KITnXcy2CUNUbv2C+RvKH8cdx+wtXnWh0BCgosSyAWAu/E3oGdel0KferTy7QCooxedNwE/kB5d8c8tYTyndXgMgVuga2oXnPLS/BnODYf4dpHx7M/Mgs2qDV1DK42K656E3MPxClOHy5wdDZsJKrfVPEkYunmMHDsE7cM0Tu64bRzsGtM5UBNrEQRYg9AuUGtxonyE0mbfrhVEF9r4FEq3hDvg4GRnJ/VOx1KPQKwQZjbdcNudpN1nDazH53zRLqXFUJnPwvfS8RkzzywpqTF1pZoVgPNKFRyaYQNeQois3y+imU1ls5ZA==; 31:i35LYq3apG1CCe2w9s7pkV6G1O4anz6z42RXdcKxWheaOkOaDxgJmwol11xZb8TgQo7uS1vlOKWFu5ULKxL3vTU/6dTbA04DS4iTyOQt1ari8zp2A3llCV9jc4Su5+87PTUZ0dEjHGAsILReAm9yTIdsYV1behCrbL9xWD82vsR/evYzrsXNaBg7UCxirraU1Vp3d2Fk/RYhrdtTQYGDYLvAWIECw2xxehb9Y9aCs+8= X-MS-TrafficTypeDiagnostic: AM4PR05MB1907: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB1907; 20:FE2S+P+RP5uXg0oqteQf/ZGTlj4x783ftoUILg1T7KJ94tb6tTkeaZcq312+yliKlEMnR3GdYCsNKIVngbbZgGjuAGX+6huZC3Lx2TqMnCfS9eauGFIv2XPyNnjHpq7rRZQjeQH+/tEHKTok1jW49Ci0KEBKNiZ+G0eufSo0dbsVhD6OK7JfUm7HjCFMWGzDGc7rxt2fhE2spXrAhaUDwaF9OPP9mK+xST5Hc+9ebU6Z9YBufJJN2bPy4Ok0Ajf96H8ys4YRRrhIOb+Fhey6/MnZ0ARiizWQqfsAibmlZ84BpFqJ4T0uobJF3oeuvapQszlPqnBUcS7nnYEM5i2GwEsTnKMs8FHNeLx9P5OULfyV8ThC/AUYPoS9Y269QElrb6UF6orNvkbtrnq8++uJ2AgWB78IRzXXSFe5HzCjTHb/wAEVr7ePohOJx8aNqYusGwGDgtMgHm20NBl7Zr1uCuNxwcyCBKfR0wF49BwISHqc1j3his6Lm94/U7BObDkw; 4:V9AHVhFlWWnxAY/J9EW7hzzBA3riuB+unUMKBfmNOe/DQC0iAKI7Bx1SqG+x0+4bTCu2Fn1E/jAwgEYDrmZ7p9Z0T5cYV6bwizpk3NdFrn1eD3SCP2KjqKFFfsXnYuBVeHU8zeT20tgBv21evkHfbUxj1tlPacCngSayXfeiRH7hM8CULSkzbYrTNLdpEqSYElqu6YwVvhYlPKL+GPmG5HLiFneCZtpcMmC2ftERR9jdlNfa1ij49AzF94w+BJvp X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(3002001)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123560025)(20161123562025)(20161123555025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM4PR05MB1907; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM4PR05MB1907; X-Forefront-PRVS: 04097B7F7F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6009001)(39860400002)(199003)(189002)(66066001)(47776003)(5660300001)(50226002)(2361001)(50986999)(81166006)(8676002)(69596002)(33026002)(478600001)(105586002)(7736002)(42186005)(76176999)(106356001)(305945005)(33646002)(4326008)(81156014)(2906002)(2351001)(101416001)(21086003)(48376002)(25786009)(189998001)(2950100002)(4720700003)(86362001)(6916009)(575784001)(55016002)(6666003)(53936002)(50466002)(107886003)(110136004)(7350300001)(6116002)(36756003)(5003940100001)(97736004)(3846002)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB1907; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM4PR05MB1907; 23:vClCXViYMhFxMdnzLxjrfikZKpxZ/EPCwHJQ1I7CK?= =?us-ascii?Q?9FAnlx4O0S2cHVZdOtoeka/WYMhcFESH5KCnWDMZTH0VwG0gk/jgPVd6Mu3o?= =?us-ascii?Q?DxfdOR9Metd4rEG6qI3jHyWpVuciJGDGe45WBqRHfT4IE0o5tsTaraIxR5A8?= =?us-ascii?Q?YfPXH2k7qQyhLKJDyJVTvpPoQJD8Oci5xRpNv8EgtzPQo7Qc2zF37xYiKpuY?= =?us-ascii?Q?dH6Gt5boIpWPavuJ51KeaHT1oLT7KJ7j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amDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2017 15:54:29.8185 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB1907 Subject: [dpdk-dev] [PATCH 3/5] net/mlx4: refine setting Tx completion flag 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, 24 Aug 2017 15:54:32 -0000 PMD now take into consideration the amount of entries in the TxQ a packet occupies when choosing weather to set the report-completion flag to the chip or not. Signed-off-by: Moti Haimovsky --- drivers/net/mlx4/mlx4_rxtx.c | 30 +++++++++++------------------- drivers/net/mlx4/mlx4_rxtx.h | 2 +- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/net/mlx4/mlx4_rxtx.c b/drivers/net/mlx4/mlx4_rxtx.c index e41ea9e..dae0e47 100644 --- a/drivers/net/mlx4/mlx4_rxtx.c +++ b/drivers/net/mlx4/mlx4_rxtx.c @@ -461,14 +461,16 @@ /* Fill-in date from last to first */ for (i = wr->num_sge - 1; i >= 0; --i) mlx4_set_data_seg(dseg + i, wr->sg_list + i); - /* Handle control info - * - * For raw eth, the SOLICIT flag is used to indicate that - * no icrc should be calculated - */ - srcrb_flags = MLX4_WQE_CTRL_SOLICIT | - ((wr->send_flags & IBV_SEND_SIGNALED) ? - MLX4_WQE_CTRL_CQ_UPDATE : 0); + /* Handle control info */ + /* For raw eth always set the SOLICIT flag */ + /* Request Tx completion. */ + txq->elts_comp_cd -= nr_txbbs; + if (unlikely(txq->elts_comp_cd <= 0)) { + srcrb_flags = MLX4_WQE_CTRL_SOLICIT | MLX4_WQE_CTRL_CQ_UPDATE; + txq->elts_comp_cd = txq->elts_comp_cd_init; + } else { + srcrb_flags = MLX4_WQE_CTRL_SOLICIT; + } fence_size = (wr->send_flags & IBV_SEND_FENCE ? MLX4_WQE_CTRL_FENCE : 0) | ((wqe_real_size / 16) & 0x3f); owner_opcode = MLX4_OPCODE_SEND | @@ -514,13 +516,12 @@ struct ibv_send_wr *wr_bad = NULL; unsigned int elts_head = txq->elts_head; const unsigned int elts_n = txq->elts_n; - unsigned int elts_comp_cd = txq->elts_comp_cd; unsigned int elts_comp = 0; unsigned int i; unsigned int max; int err; - assert(elts_comp_cd != 0); + assert(txq->elts_comp_cd != 0); mlx4_txq_complete(txq); max = (elts_n - (elts_head - txq->elts_tail)); if (max > elts_n) @@ -560,11 +561,6 @@ tmp = next; } while (tmp != NULL); } - /* Request Tx completion. */ - if (unlikely(--elts_comp_cd == 0)) { - elts_comp_cd = txq->elts_comp_cd_init; - send_flags |= IBV_SEND_SIGNALED; - } if (buf->pkt_len <= txq->max_inline) send_flags |= IBV_SEND_INLINE; /* Update element. */ @@ -580,9 +576,6 @@ /* post the pkt for sending */ err = mlx4_post_send(txq, buf, wr, &wr_bad); if (unlikely(err)) { - if (unlikely(wr_bad->send_flags & - IBV_SEND_SIGNALED)) - elts_comp_cd = 1; elt->buf = NULL; goto stop; } @@ -602,7 +595,6 @@ mlx4_send_flush(txq); txq->elts_head = elts_head; txq->elts_comp += elts_comp; - txq->elts_comp_cd = elts_comp_cd; return i; } diff --git a/drivers/net/mlx4/mlx4_rxtx.h b/drivers/net/mlx4/mlx4_rxtx.h index 7cae7e2..35e0de7 100644 --- a/drivers/net/mlx4/mlx4_rxtx.h +++ b/drivers/net/mlx4/mlx4_rxtx.h @@ -140,7 +140,7 @@ struct txq { unsigned int elts_head; /**< Current index in (*elts)[]. */ unsigned int elts_tail; /**< First element awaiting completion. */ unsigned int elts_comp; /**< Number of pkts waiting for completion. */ - unsigned int elts_comp_cd; /**< Countdown for next completion. */ + int elts_comp_cd; /**< Countdown for next completion. */ unsigned int elts_comp_cd_init; /**< Initial value for countdown. */ struct mlx4_txq_stats stats; /**< Tx queue counters. */ unsigned int socket; /**< CPU socket ID for allocations. */ -- 1.8.3.1