From nobody Tue Jul 26 19:33:30 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 4LsnBz3Dd8z4WxHp; Tue, 26 Jul 2022 19:33: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 4LsnBz0x6Cz47jM; Tue, 26 Jul 2022 19:33:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658864011; 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=xrSPhjDOeMmJfxhU+lEj/d/kRmMlpeabOXLabUQm2tM=; b=Octzuvi6NYRDIUpbBg370W5Pr0auv8a1xMvOWG+1hx/lmcnOTwhSVjTnYIpXwZs9nleqS3 C0Jky4YTn1//Aj+dDNVRdWrxLTpmJsJOWn7+6LwzEiZnsp8r+8CnNIHW/VTNXO1a7GfGKn /xCO3C+UeBqz//RugpLW8nzvtrE5n0NOdvxC9Amk9WAjg+SqbS/vmgmLh12OROOvLKgZ0x OQNewZybs3tmrprmX4tAQcTI6knbodjWu89d0piq4x7MIOuYrEQh7bZpNh3BSOLgcmxl8F j8ssK/O4wyem3//uWHjcVCFsYo3wp3BCezpbZG5anr5NSEACE+xJVFbAk6tK7w== 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 4LsnBy69WVzph4; Tue, 26 Jul 2022 19:33: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 26QJXUtK033954; Tue, 26 Jul 2022 19:33:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26QJXUQN033952; Tue, 26 Jul 2022 19:33:30 GMT (envelope-from git) Date: Tue, 26 Jul 2022 19:33:30 GMT Message-Id: <202207261933.26QJXUQN033952@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: 4568630d8905 - stable/12 - ena: Align names of constants 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: 4568630d8905315f000fa38a906d8d607ed50e45 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658864011; 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=xrSPhjDOeMmJfxhU+lEj/d/kRmMlpeabOXLabUQm2tM=; b=wQImWqe09Ay6WN3oRT06BrF2mCaMj/8M3Wyj79/fQnCXKzRNnF3UfXw/eilxjXqV95Fma+ 6IY1OEKvGzKgr9g24j1K1kDS7+xliFLwPguL64c53qwGDPgT0BHhCP3dJ8u/YUZACl7Uay 1Uca7VBMaKwTd9j87nv9LZITVG2bBGJEcXQo/GRxoAFSSIortMTt31/fF/R2a+i3uqpaXe fjt9fa0tg0htgWapTP581WAtNRKUf0Fxri26oG8CGpRere4HU7aoiYzNFkUjf8/hkkII43 3xWlw0hoSDtAtyUM1wS9Bdj/ScLeL1EDA3gtZ8mauHp5V1P8J2FqOkejrXYBbA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658864011; a=rsa-sha256; cv=none; b=P/fo0H45XkC0iiGIU06DETYbl5TpEI2wgU5V78p/FR5978Tfmh0HaZLJOM6scAx4o/Umlu 6/sfivTnXPVbJJkAyMXRK9baIfWdSX3FkjDP3+9W/S3HLowOSMnfPWvEjXKdu3R2fB0toy lue9qPmhV0a1eiI8eiUXCmjI72gDTBxfzxtUyXhZKsYKqbm531IUXLWRKMKSufy6JY3PpC zSPR91I+Pz/WwXDvd0bd1ISOT9uzASu2ZUVPyFDcLWN4uHzs+Ad6N74HeyQRI7QTpl/wje 5rcDcsHqpDMg3Gx08iMIJDmiImJueLnXrGLp39Ya1yKxu/NkX84ps0lFEMk8ng== 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=4568630d8905315f000fa38a906d8d607ed50e45 commit 4568630d8905315f000fa38a906d8d607ed50e45 Author: Dawid Gorecki AuthorDate: 2022-06-10 09:18:13 +0000 Commit: Marcin Wojtas CommitDate: 2022-07-26 19:33:04 +0000 ena: Align names of constants Most of the constants in ena.h file were prefixed with ENA_*, while others did not have this prefix. Align the constants by prefixing the remaining constants with ENA. Obtained from: Semihalf MFC after: 2 weeks Sponsored by: Amazon, Inc. (cherry picked from commit 8f15f8a72b5474b81c5951d4039d203b2d80e2e3) --- sys/dev/ena/ena.c | 19 ++++++++++--------- sys/dev/ena/ena.h | 44 ++++++++++++++++++++++---------------------- sys/dev/ena/ena_datapath.c | 26 +++++++++++++------------- sys/dev/ena/ena_netmap.c | 2 +- sys/dev/ena/ena_sysctl.c | 2 +- 5 files changed, 47 insertions(+), 46 deletions(-) diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c index 339df5f234c2..a7d177454075 100644 --- a/sys/dev/ena/ena.c +++ b/sys/dev/ena/ena.c @@ -170,7 +170,8 @@ static void unimplemented_aenq_handler(void *, struct ena_admin_aenq_entry *); static int ena_copy_eni_metrics(struct ena_adapter *); static void ena_timer_service(void *); -static char ena_version[] = DEVICE_NAME DRV_MODULE_NAME " v" DRV_MODULE_VERSION; +static char ena_version[] = ENA_DEVICE_NAME ENA_DRV_MODULE_NAME + " v" ENA_DRV_MODULE_VERSION; static ena_vendor_info_t ena_vendor_info_array[] = { { PCI_VENDOR_ID_AMAZON, PCI_DEV_ID_ENA_PF, 0 }, @@ -307,7 +308,7 @@ ena_probe(device_t dev) ena_log_raw(DBG, "vendor=%x device=%x\n", pci_vendor_id, pci_device_id); - device_set_desc(dev, DEVICE_DESC); + device_set_desc(dev, ENA_DEVICE_DESC); return (BUS_PROBE_DEFAULT); } @@ -2740,9 +2741,9 @@ ena_config_host_info(struct ena_com_dev *ena_dev, device_t dev) strncpy(host_info->os_dist_str, osrelease, sizeof(host_info->os_dist_str) - 1); - host_info->driver_version = (DRV_MODULE_VER_MAJOR) | - (DRV_MODULE_VER_MINOR << ENA_ADMIN_HOST_INFO_MINOR_SHIFT) | - (DRV_MODULE_VER_SUBMINOR << ENA_ADMIN_HOST_INFO_SUB_MINOR_SHIFT); + host_info->driver_version = (ENA_DRV_MODULE_VER_MAJOR) | + (ENA_DRV_MODULE_VER_MINOR << ENA_ADMIN_HOST_INFO_MINOR_SHIFT) | + (ENA_DRV_MODULE_VER_SUBMINOR << ENA_ADMIN_HOST_INFO_SUB_MINOR_SHIFT); host_info->num_cpus = mp_ncpus; host_info->driver_supported_features = ENA_ADMIN_HOST_INFO_RX_OFFSET_MASK | @@ -3508,10 +3509,10 @@ ena_attach(device_t pdev) * concurrency, as the callout won't be using any locking inside. */ ENA_TIMER_INIT(adapter); - adapter->keep_alive_timeout = DEFAULT_KEEP_ALIVE_TO; - adapter->missing_tx_timeout = DEFAULT_TX_CMP_TO; - adapter->missing_tx_max_queues = DEFAULT_TX_MONITORED_QUEUES; - adapter->missing_tx_threshold = DEFAULT_TX_CMP_THRESHOLD; + adapter->keep_alive_timeout = ENA_DEFAULT_KEEP_ALIVE_TO; + adapter->missing_tx_timeout = ENA_DEFAULT_TX_CMP_TO; + adapter->missing_tx_max_queues = ENA_DEFAULT_TX_MONITORED_QUEUES; + adapter->missing_tx_threshold = ENA_DEFAULT_TX_CMP_THRESHOLD; if (version_printed++ == 0) ena_log(pdev, INFO, "%s\n", ena_version); diff --git a/sys/dev/ena/ena.h b/sys/dev/ena/ena.h index 73561a3ab46f..f7684d7cc777 100644 --- a/sys/dev/ena/ena.h +++ b/sys/dev/ena/ena.h @@ -39,20 +39,20 @@ #include "ena-com/ena_com.h" #include "ena-com/ena_eth_com.h" -#define DRV_MODULE_VER_MAJOR 2 -#define DRV_MODULE_VER_MINOR 5 -#define DRV_MODULE_VER_SUBMINOR 0 +#define ENA_DRV_MODULE_VER_MAJOR 2 +#define ENA_DRV_MODULE_VER_MINOR 5 +#define ENA_DRV_MODULE_VER_SUBMINOR 0 -#define DRV_MODULE_NAME "ena" +#define ENA_DRV_MODULE_NAME "ena" -#ifndef DRV_MODULE_VERSION -#define DRV_MODULE_VERSION \ - __XSTRING(DRV_MODULE_VER_MAJOR) "." \ - __XSTRING(DRV_MODULE_VER_MINOR) "." \ - __XSTRING(DRV_MODULE_VER_SUBMINOR) +#ifndef ENA_DRV_MODULE_VERSION +#define ENA_DRV_MODULE_VERSION \ + __XSTRING(ENA_DRV_MODULE_VER_MAJOR) "." \ + __XSTRING(ENA_DRV_MODULE_VER_MINOR) "." \ + __XSTRING(ENA_DRV_MODULE_VER_SUBMINOR) #endif -#define DEVICE_NAME "Elastic Network Adapter (ENA)" -#define DEVICE_DESC "ENA adapter" +#define ENA_DEVICE_NAME "Elastic Network Adapter (ENA)" +#define ENA_DEVICE_DESC "ENA adapter" /* Calculate DMA mask - width for ena cannot exceed 48, so it is safe */ #define ENA_DMA_BIT_MASK(x) ((1ULL << (x)) - 1ULL) @@ -92,24 +92,24 @@ #define ENA_TX_RESUME_THRESH (ENA_PKT_MAX_BUFS + 2) -#define DB_THRESHOLD 64 +#define ENA_DB_THRESHOLD 64 -#define TX_COMMIT 32 +#define ENA_TX_COMMIT 32 /* * TX budget for cleaning. It should be half of the RX budget to reduce amount * of TCP retransmissions. */ -#define TX_BUDGET 128 +#define ENA_TX_BUDGET 128 /* RX cleanup budget. -1 stands for infinity. */ -#define RX_BUDGET 256 +#define ENA_RX_BUDGET 256 /* * How many times we can repeat cleanup in the io irq handling routine if the * RX or TX budget was depleted. */ -#define CLEAN_BUDGET 8 +#define ENA_CLEAN_BUDGET 8 -#define RX_IRQ_INTERVAL 20 -#define TX_IRQ_INTERVAL 50 +#define ENA_RX_IRQ_INTERVAL 20 +#define ENA_TX_IRQ_INTERVAL 50 #define ENA_MIN_MTU 128 @@ -136,16 +136,16 @@ * ENA device should send keep alive msg every 1 sec. * We wait for 6 sec just to be on the safe side. */ -#define DEFAULT_KEEP_ALIVE_TO (SBT_1S * 6) +#define ENA_DEFAULT_KEEP_ALIVE_TO (SBT_1S * 6) /* Time in jiffies before concluding the transmitter is hung. */ -#define DEFAULT_TX_CMP_TO (SBT_1S * 5) +#define ENA_DEFAULT_TX_CMP_TO (SBT_1S * 5) /* Number of queues to check for missing queues per timer tick */ -#define DEFAULT_TX_MONITORED_QUEUES (4) +#define ENA_DEFAULT_TX_MONITORED_QUEUES (4) /* Max number of timeouted packets before device reset */ -#define DEFAULT_TX_CMP_THRESHOLD (128) +#define ENA_DEFAULT_TX_CMP_THRESHOLD (128) /* * Supported PCI vendor and devices IDs diff --git a/sys/dev/ena/ena_datapath.c b/sys/dev/ena/ena_datapath.c index f23403b5089a..a5c4eec43f67 100644 --- a/sys/dev/ena/ena_datapath.c +++ b/sys/dev/ena/ena_datapath.c @@ -94,20 +94,20 @@ ena_cleanup(void *arg, int pending) atomic_store_8(&tx_ring->first_interrupt, true); atomic_store_8(&rx_ring->first_interrupt, true); - for (i = 0; i < CLEAN_BUDGET; ++i) { + for (i = 0; i < ENA_CLEAN_BUDGET; ++i) { rxc = ena_rx_cleanup(rx_ring); txc = ena_tx_cleanup(tx_ring); if (unlikely((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0)) return; - if ((txc != TX_BUDGET) && (rxc != RX_BUDGET)) + if ((txc != ENA_TX_BUDGET) && (rxc != ENA_RX_BUDGET)) break; } /* Signal that work is done and unmask interrupt */ - ena_com_update_intr_reg(&intr_reg, RX_IRQ_INTERVAL, TX_IRQ_INTERVAL, - true); + ena_com_update_intr_reg(&intr_reg, ENA_RX_IRQ_INTERVAL, + ENA_TX_IRQ_INTERVAL, true); counter_u64_add(tx_ring->tx_stats.unmask_interrupt_num, 1); ena_com_unmask_intr(io_cq, &intr_reg); } @@ -249,8 +249,8 @@ ena_tx_cleanup(struct ena_ring *tx_ring) uint16_t ena_qid; unsigned int total_done = 0; int rc; - int commit = TX_COMMIT; - int budget = TX_BUDGET; + int commit = ENA_TX_COMMIT; + int budget = ENA_TX_BUDGET; int work_done; bool above_thresh; @@ -295,8 +295,8 @@ ena_tx_cleanup(struct ena_ring *tx_ring) tx_ring->ring_size); if (unlikely(--commit == 0)) { - commit = TX_COMMIT; - /* update ring state every TX_COMMIT descriptor */ + commit = ENA_TX_COMMIT; + /* update ring state every ENA_TX_COMMIT descriptor */ tx_ring->next_to_clean = next_to_clean; ena_com_comp_ack( &adapter->ena_dev->io_sq_queues[ena_qid], @@ -306,13 +306,13 @@ ena_tx_cleanup(struct ena_ring *tx_ring) } } while (likely(--budget)); - work_done = TX_BUDGET - budget; + work_done = ENA_TX_BUDGET - budget; ena_log_io(adapter->pdev, DBG, "tx: q %d done. total pkts: %d\n", tx_ring->qid, work_done); /* If there is still something to commit update ring state */ - if (likely(commit != TX_COMMIT)) { + if (likely(commit != ENA_TX_COMMIT)) { tx_ring->next_to_clean = next_to_clean; ena_com_comp_ack(&adapter->ena_dev->io_sq_queues[ena_qid], total_done); @@ -576,7 +576,7 @@ ena_rx_cleanup(struct ena_ring *rx_ring) uint32_t do_if_input = 0; unsigned int qid; int rc, i; - int budget = RX_BUDGET; + int budget = ENA_RX_BUDGET; #ifdef DEV_NETMAP int done; #endif /* DEV_NETMAP */ @@ -699,7 +699,7 @@ ena_rx_cleanup(struct ena_ring *rx_ring) tcp_lro_flush_all(&rx_ring->lro); - return (RX_BUDGET - budget); + return (ENA_RX_BUDGET - budget); } static void @@ -1017,7 +1017,7 @@ ena_xmit_mbuf(struct ena_ring *tx_ring, struct mbuf **mbuf) /* Set flags and meta data */ ena_tx_csum(&ena_tx_ctx, *mbuf, adapter->disable_meta_caching); - if (tx_ring->acum_pkts == DB_THRESHOLD || + if (tx_ring->acum_pkts == ENA_DB_THRESHOLD || ena_com_is_doorbell_needed(tx_ring->ena_com_io_sq, &ena_tx_ctx)) { ena_log_io(pdev, DBG, "llq tx max burst size of queue %d achieved, writing doorbell to send burst\n", diff --git a/sys/dev/ena/ena_netmap.c b/sys/dev/ena/ena_netmap.c index 71035c9bb2e4..6a780440efc9 100644 --- a/sys/dev/ena/ena_netmap.c +++ b/sys/dev/ena/ena_netmap.c @@ -428,7 +428,7 @@ 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 || + if (tx_ring->acum_pkts == ENA_DB_THRESHOLD || ena_com_is_doorbell_needed(ctx->io_sq, &ena_tx_ctx)) ena_ring_tx_doorbell(tx_ring); diff --git a/sys/dev/ena/ena_sysctl.c b/sys/dev/ena/ena_sysctl.c index 0dad2dbdeeae..db426ae89aeb 100644 --- a/sys/dev/ena/ena_sysctl.c +++ b/sys/dev/ena/ena_sysctl.c @@ -67,7 +67,7 @@ SYSCTL_INT(_hw_ena, OID_AUTO, log_level, CTLFLAG_RWTUN, &ena_log_level, 0, "Logging level indicating verbosity of the logs"); SYSCTL_CONST_STRING(_hw_ena, OID_AUTO, driver_version, CTLFLAG_RD, - DRV_MODULE_VERSION, "ENA driver version"); + ENA_DRV_MODULE_VERSION, "ENA driver version"); /* * Use 9k mbufs for the Rx buffers. Default to 0 (use page size mbufs instead).