git: 4568630d8905 - stable/12 - ena: Align names of constants
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 26 Jul 2022 19:33:30 UTC
The branch stable/12 has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=4568630d8905315f000fa38a906d8d607ed50e45 commit 4568630d8905315f000fa38a906d8d607ed50e45 Author: Dawid Gorecki <dgr@semihalf.com> AuthorDate: 2022-06-10 09:18:13 +0000 Commit: Marcin Wojtas <mw@FreeBSD.org> 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).