From nobody Tue Jul 26 19:33:19 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4LsnBl5M6pz4Wx1X; Tue, 26 Jul 2022 19:33:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LsnBl4sXCz47MR; Tue, 26 Jul 2022 19:33:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658863999; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nhyq3G2R2uosOy5q9DXREacCuVcOGeOGvrDdVd4lnCc=; b=lc/qSNxhAjeL6dvM+EJtak0JaYAJCsG3xYfkvgjROVSRVQc4CIPcjS+R9vJyXvSdILjzlE d9Mrmqj0V4QKkRSfctd1/gpSWyAAG8iUPupfB1LRvvMBV9T/xZijjTgjcOGgM6SACDmu3Z WC52VAKB33u61xyW/OlNi6EKR1d8U6anQlO+0lwEATpCwPYr68B13tixKJmTpgB3sS7FiQ RffcBvqiYcTHGZH3ocecxBA2QaKc/s0TyA+j0g/RjhhAw3wFxoLHO+QvjD6NR/QfaSgQby dpb6ka/jx2fWuPvpf+Nu1rZzrVGSIJ9XsOvgC3344eJs0ReDoXAamc96rcLtIg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4LsnBl3w43zpj0; Tue, 26 Jul 2022 19:33:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 26QJXJgL033700; Tue, 26 Jul 2022 19:33:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26QJXJ5n033699; Tue, 26 Jul 2022 19:33:19 GMT (envelope-from git) Date: Tue, 26 Jul 2022 19:33:19 GMT Message-Id: <202207261933.26QJXJ5n033699@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Marcin Wojtas Subject: git: b53231f40cc5 - stable/12 - ena: Add ena_ring_tx_doorbell() function List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b53231f40cc56844235b6d28fce3a6c326e496a1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658863999; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nhyq3G2R2uosOy5q9DXREacCuVcOGeOGvrDdVd4lnCc=; b=HGamsrFqlC14rqVkl+NGGIOoz+oacL3MyVuvDwuDHb66mD4J7cGyJ7scXyoSjQCoKN0lUt 9e1oetbcR3fEiVDeJlSzzG6bwi6vivATPXsmvBiS6Eh2IFFDv6V67OXI21yaVBBUhgRCTC fuA8IPrxnGwTSx/hrkHUfL4Z3Qa+sGaNQ96ZnMMBff0OtYg9K8oWXhcXsopj/tIguJrN1A TxCWzbhghzEUZGQJ7JFdX+I7CPfYWA1Yit/oV70wt9g5+KcKb10gsimdsqShjbdE/errZC NoF4ms7SaRnnL3k+HR4k4sf0uT0lwqMCSQw8M3duHMnbCs59BUlpZ1ZN0A8aVQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658863999; a=rsa-sha256; cv=none; b=llfpYnJxZETj9aZkk0nk+vOkSBHDtNssg3wGwZtNinyYj/4O5ZGmbGqZ0vzb6pfBb1Psgb aK+v7oF1h+iv3BBFZGjIQRMXSTHBiju6YFfOjbfZY/iBYsG98/zTh41Jr/VABcEACa05Au IJ55AKke7+q6aZIQjRgcc9N85KoC3/buMnl2wDhdR428HsALOKYlS96dLhTpAjYexfXeyU Z979GbHKPeHpb3+D2vccRSoiAPFoykg7ztEVp+p7tcGuNMNHLUPIGRwcsBwaOLQdTNd3BW kzCEPmzt6aHqYBpDgVnLrGxyrdSlUPd91i2nEVqJ+4BmEnBDp/yozvi+ySANKw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=b53231f40cc56844235b6d28fce3a6c326e496a1 commit b53231f40cc56844235b6d28fce3a6c326e496a1 Author: Dawid Gorecki AuthorDate: 2022-06-10 09:17:52 +0000 Commit: Marcin Wojtas CommitDate: 2022-07-26 19:33:02 +0000 ena: Add ena_ring_tx_doorbell() function Add ena_ring_tx_doorbell function to remove code duplication. Obtained from: Semihalf MFC after: 2 weeks Sponsored by: Amazon, Inc. (cherry picked from commit 3501d4f17e8cc0350b8deff671f9991cc7ac280c) --- sys/dev/ena/ena.h | 8 ++++++++ sys/dev/ena/ena_datapath.c | 10 ++-------- sys/dev/ena/ena_netmap.c | 11 +++-------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/sys/dev/ena/ena.h b/sys/dev/ena/ena.h index 2825edc41289..43c31269bfd2 100644 --- a/sys/dev/ena/ena.h +++ b/sys/dev/ena/ena.h @@ -542,4 +542,12 @@ ena_trigger_reset(struct ena_adapter *adapter, } } +static inline void +ena_ring_tx_doorbell(struct ena_ring *tx_ring) +{ + ena_com_write_sq_doorbell(tx_ring->ena_com_io_sq); + counter_u64_add(tx_ring->tx_stats.doorbells, 1); + tx_ring->acum_pkts = 0; +} + #endif /* !(ENA_H) */ diff --git a/sys/dev/ena/ena_datapath.c b/sys/dev/ena/ena_datapath.c index bf305944ab22..fac8cdf488f3 100644 --- a/sys/dev/ena/ena_datapath.c +++ b/sys/dev/ena/ena_datapath.c @@ -1018,9 +1018,7 @@ ena_xmit_mbuf(struct ena_ring *tx_ring, struct mbuf **mbuf) ena_log_io(pdev, DBG, "llq tx max burst size of queue %d achieved, writing doorbell to send burst\n", tx_ring->que->id); - ena_com_write_sq_doorbell(tx_ring->ena_com_io_sq); - counter_u64_add(tx_ring->tx_stats.doorbells, 1); - tx_ring->acum_pkts = 0; + ena_ring_tx_doorbell(tx_ring); } /* Prepare the packet's descriptors and send them to device */ @@ -1099,7 +1097,6 @@ ena_start_xmit(struct ena_ring *tx_ring) { struct mbuf *mbuf; struct ena_adapter *adapter = tx_ring->adapter; - struct ena_com_io_sq* io_sq; int ena_qid; int ret = 0; @@ -1112,7 +1109,6 @@ ena_start_xmit(struct ena_ring *tx_ring) return; ena_qid = ENA_IO_TXQ_IDX(tx_ring->que->id); - io_sq = &adapter->ena_dev->io_sq_queues[ena_qid]; while ((mbuf = drbr_peek(adapter->ifp, tx_ring->br)) != NULL) { ena_log_io(adapter->pdev, DBG, @@ -1150,9 +1146,7 @@ ena_start_xmit(struct ena_ring *tx_ring) if (likely(tx_ring->acum_pkts != 0)) { /* Trigger the dma engine */ - ena_com_write_sq_doorbell(io_sq); - counter_u64_add(tx_ring->tx_stats.doorbells, 1); - tx_ring->acum_pkts = 0; + ena_ring_tx_doorbell(tx_ring); } if (unlikely(!tx_ring->running)) diff --git a/sys/dev/ena/ena_netmap.c b/sys/dev/ena/ena_netmap.c index 1525b1efd954..e9511b033fd3 100644 --- a/sys/dev/ena/ena_netmap.c +++ b/sys/dev/ena/ena_netmap.c @@ -375,9 +375,7 @@ ena_netmap_tx_frames(struct ena_netmap_ctx *ctx) /* If any packet was sent... */ if (likely(ctx->nm_i != ctx->kring->nr_hwcur)) { /* ...send the doorbell to the device. */ - ena_com_write_sq_doorbell(ctx->io_sq); - counter_u64_add(ctx->ring->tx_stats.doorbells, 1); - tx_ring->acum_pkts = 0; + ena_ring_tx_doorbell(tx_ring); ctx->ring->next_to_use = ctx->nt; ctx->kring->nr_hwcur = ctx->nm_i; @@ -431,11 +429,8 @@ ena_netmap_tx_frame(struct ena_netmap_ctx *ctx) /* There are no any offloads, as the netmap doesn't support them */ if (tx_ring->acum_pkts == DB_THRESHOLD || - ena_com_is_doorbell_needed(ctx->io_sq, &ena_tx_ctx)) { - ena_com_write_sq_doorbell(ctx->io_sq); - counter_u64_add(tx_ring->tx_stats.doorbells, 1); - tx_ring->acum_pkts = 0; - } + ena_com_is_doorbell_needed(ctx->io_sq, &ena_tx_ctx)) + ena_ring_tx_doorbell(tx_ring); rc = ena_com_prepare_tx(ctx->io_sq, &ena_tx_ctx, &nb_hw_desc); if (unlikely(rc != 0)) {