From nobody Thu Jun 30 16:15:30 2022 X-Original-To: dev-commits-src-main@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 071C28A385F; Thu, 30 Jun 2022 16:15:31 +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 4LYk2V6mVPz3QqK; Thu, 30 Jun 2022 16:15:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656605731; 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=xfTiJHNwVfqAfdh1BlrnmtPelFuil7G+JG4sbdJLceY=; b=calai7mYk3ZlAi3NOW/+idiJKCqYaJ3IKRe8eJkt993hlYHhqb56Ar32CkqTpidQ836/Kk BTsJkiHyILvpqBDqzhWcrDaawzQP6ifnNNoKIYHRtocKy+bMjua2iabQM5n7DoHrrRVf30 xwZfMRh/VKioYoKSOQ7K53+r49DKM/IpaPzi4UwyFLVOWdD6VDytVIHWDY+lR1QP95UeH8 G2ESvPE6PDdYqAtSDU2hZyw31iUHOUClrvrRKiukrVSLNUtgJf/0sf6FKAIGERbnqxyYxZ Ic+HYCSsCe93zH0hkFZrMbDZD4DIu8Mle66CU/+a0hJusdFq9cZam2e44UBAxg== 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 C8C28155D; Thu, 30 Jun 2022 16:15:30 +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 25UGFUk8014694; Thu, 30 Jun 2022 16:15:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25UGFUNm014693; Thu, 30 Jun 2022 16:15:30 GMT (envelope-from git) Date: Thu, 30 Jun 2022 16:15:30 GMT Message-Id: <202206301615.25UGFUNm014693@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 3501d4f17e8c - main - ena: Add ena_ring_tx_doorbell() function List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 3501d4f17e8cc0350b8deff671f9991cc7ac280c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656605731; 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=xfTiJHNwVfqAfdh1BlrnmtPelFuil7G+JG4sbdJLceY=; b=eYKNgvgY//vezHTbYEnPGcBJUUdX3BzDMlX66QYjKd6AujMaQd2YwzuOGWDr1iRny4x5kK wwUyRZk2Puqsj7j0b4iZZjZTNxoLUrKvGHCPLaLKF2O4C8QbXdJ0g0P44ym8y/NjMzv00E lEtfPZMhGUFtQ0rGzhMM5yqNDxKeZPLZx3xGmC2d39fVPliKnw+yutin/zIutTtMSw2JO6 AB5E++cvmdH4D1LfBEq3V2gZmArYGoEVbKQQ+yB9N94IAtp0qf1Y0UNjuh3gUv4Ri1HTB7 RNGgfJcJXM43Ns0H0iu719YT+0zc6ztnStKrU7RoHo81jEmLrjUneaH5xtDYkw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656605731; a=rsa-sha256; cv=none; b=KT4RlOLWbHRcEhv7FPNTBSq4wQCJl/1Jpcs+86RyX3bRd/ETdzSFNKBvaClNojQnj58VSx lu4bbZ2wB6lzCF948QoPGghv/wh+VkrzgBwBTGjknm4G7S8bI1dy4btWRyKh8FphI57Q8h rGcEoK+5vjHsOB2BO7PVi03curOWldXm40dhQBgFe5ANR3KB5dWU7Ob26R4RH7JSa1ixJh Mgpy48aZMHuVRT/mca4bkHDLlzAWKG1BuX50x5szAcRo8EJNlfOgBEa5ZziYvf5xX74gv9 g/IVHsOlp7rpqEaLTGnLNks56PxMJJJ8V3renQhByy1Z2gUI7IKdv6hXQSQscQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=3501d4f17e8cc0350b8deff671f9991cc7ac280c commit 3501d4f17e8cc0350b8deff671f9991cc7ac280c Author: Dawid Gorecki AuthorDate: 2022-06-10 09:17:52 +0000 Commit: Marcin Wojtas CommitDate: 2022-06-30 15:31:12 +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. --- 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 a6aa39829f12..85f353e7ab54 100644 --- a/sys/dev/ena/ena.h +++ b/sys/dev/ena/ena.h @@ -543,4 +543,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 c6798b3f7eb3..8d4621947e03 100644 --- a/sys/dev/ena/ena_datapath.c +++ b/sys/dev/ena/ena_datapath.c @@ -1017,9 +1017,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 */ @@ -1098,7 +1096,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; @@ -1111,7 +1108,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, @@ -1149,9 +1145,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 976e54e4525f..8ca6aad75abf 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)) {