From nobody Thu Jun 30 16:15:43 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 E2A628A40A8; Thu, 30 Jun 2022 16:15:43 +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 4LYk2l4R5hz3QvG; Thu, 30 Jun 2022 16:15:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656605743; 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=DJLEDuYRSYWJgVjG+Zfm/8Cz/Z1Zkn1eG/Zprqke6lY=; b=jeO04/CMv3qJwb9r0p38O3/EqPoE84mavAaaYiZbVLTBa8G8NqXlnQi+IkQzCJgeQ98oHI m/7aeqROw8uoo7VQxLC+6Sq2oT94Z2QPgxW0qgIBjdzoK4D9ozg1N/gk7mCtkGKqXlpHrU EATIXNnxXPCDr3Ai/Dimt+WBjsaP+iOwMWeAoUysYVy8Zj9Im7Xklypp0IRywE84sa4N+9 1h0MZ5lt+tYgSDSN7zEVE7yVeKdsuXQ4z5u5JUVy38pGmsLb1hvQ1b1NX4Vumj6CFb9hAG Oj8/x8B5xEcN/yJeV+mcqlyjP+q04w2HrP+7sfr+7VYYGcJ1BB5zg4D8zwZAog== 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 63F2A196E; Thu, 30 Jun 2022 16:15:43 +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 25UGFhBd014973; Thu, 30 Jun 2022 16:15:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25UGFhri014972; Thu, 30 Jun 2022 16:15:43 GMT (envelope-from git) Date: Thu, 30 Jun 2022 16:15:43 GMT Message-Id: <202206301615.25UGFhri014972@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: 8f15f8a72b54 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 8f15f8a72b5474b81c5951d4039d203b2d80e2e3 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656605743; 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=DJLEDuYRSYWJgVjG+Zfm/8Cz/Z1Zkn1eG/Zprqke6lY=; b=Tj6sVwGbe2rgmRCTqvBxJGM6N8myrhzJ/1G+AiASGsojzEDk6Pqyy6/nebAenGwPzFl+KY VZch+XEIZmpK5MmPsjBbQS5K++HKJmvcfq1OH6wyCxrQ+dpiLgORYMtcnGonKeQZj+nqVw +0vxwvUy3iWyqAhb8wSoTONi+r5q6z+RTCgTYXdcT0BA5O4hVCQJXTRtgMN9/xO+Qj1K9G ENM/iBfJuVhKTOfkx4V0WARr5HcWQKwlGKnSTgN5WJiZctdiNWDlGZuyVWsuStTO9rmTpU PPorthR/XrY55076IEJ2xSLoptWl5WDdEmWkeHsoQB9CowPemwbrV7IeTAm1ig== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656605743; a=rsa-sha256; cv=none; b=MSqT/XvP51F3CVkv4Jcys3keLtHUbPOmAwqMbSHZA6tdWaQt2VqPFd8Q2ECq3rIfI+h4e9 XHOsOAjoG1FigRds2TPaqIqInjpoRVog6DJoNfPeqFqyw2R8yhglME0Gu/zLdY7RClEIiK HaCF18mxCtOydsV3qWKe7cBe+sApKx+3pmlPLwua6Pwsc0rNWqsw66hC+DKC6PbUhklQlp QL4yfQsffjTo2ncW+M9R0BpH/b7S+dzZ0bxy7uzAJLoRDbu7xQG1NGzVgDQ/l3iOIWReki +92/8ziyw8K4UVhLngrozCVmAjpP9VP73s9gHQOpYlklgP+izOL4pGGBD+e3Ww== 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=8f15f8a72b5474b81c5951d4039d203b2d80e2e3 commit 8f15f8a72b5474b81c5951d4039d203b2d80e2e3 Author: Dawid Gorecki AuthorDate: 2022-06-10 09:18:13 +0000 Commit: Marcin Wojtas CommitDate: 2022-06-30 15:32:13 +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. --- 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 3fd2dcf214f5..9b2f1e54b0a7 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); } @@ -2736,9 +2737,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 | @@ -3504,10 +3505,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 21c7f479c7ee..65aeb23c3ca1 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 d5ecb4ece985..c4c9ad3403c6 100644 --- a/sys/dev/ena/ena_datapath.c +++ b/sys/dev/ena/ena_datapath.c @@ -93,20 +93,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); } @@ -248,8 +248,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; @@ -294,8 +294,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], @@ -305,13 +305,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); @@ -575,7 +575,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 */ @@ -698,7 +698,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 @@ -1016,7 +1016,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 d71e14bff962..481a0ab3c2c2 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 d9b9c7652c16..46a759ba8d6c 100644 --- a/sys/dev/ena/ena_sysctl.c +++ b/sys/dev/ena/ena_sysctl.c @@ -68,7 +68,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).