1 /* SPDX-License-Identifier: BSD-3-Clause
3 * Copyright (c) 2016-2018 Solarflare Communications Inc.
6 * This software was jointly developed between OKTET Labs (under contract
7 * for Solarflare) and Solarflare Communications, Inc.
10 #include <rte_debug.h>
11 #include <rte_cycles.h>
12 #include <rte_alarm.h>
13 #include <rte_branch_prediction.h>
18 #include "sfc_debug.h"
23 #include "sfc_kvargs.h"
26 /* Initial delay when waiting for event queue init complete event */
27 #define SFC_EVQ_INIT_BACKOFF_START_US (1)
28 /* Maximum delay between event queue polling attempts */
29 #define SFC_EVQ_INIT_BACKOFF_MAX_US (10 * 1000)
30 /* Event queue init approx timeout */
31 #define SFC_EVQ_INIT_TIMEOUT_US (2 * US_PER_S)
33 /* Management event queue polling period in microseconds */
34 #define SFC_MGMT_EV_QPOLL_PERIOD_US (US_PER_S)
37 sfc_evq_type2str(enum sfc_evq_type type)
40 case SFC_EVQ_TYPE_MGMT:
53 sfc_ev_initialized(void *arg)
55 struct sfc_evq *evq = arg;
57 /* Init done events may be duplicated on SFN7xxx (SFC bug 31631) */
58 SFC_ASSERT(evq->init_state == SFC_EVQ_STARTING ||
59 evq->init_state == SFC_EVQ_STARTED);
61 evq->init_state = SFC_EVQ_STARTED;
67 sfc_ev_nop_rx(void *arg, uint32_t label, uint32_t id,
68 uint32_t size, uint16_t flags)
70 struct sfc_evq *evq = arg;
73 "EVQ %u unexpected Rx event label=%u id=%#x size=%u flags=%#x",
74 evq->evq_index, label, id, size, flags);
79 sfc_ev_efx_rx(void *arg, __rte_unused uint32_t label, uint32_t id,
80 uint32_t size, uint16_t flags)
82 struct sfc_evq *evq = arg;
83 struct sfc_efx_rxq *rxq;
85 unsigned int pending_id;
88 struct sfc_efx_rx_sw_desc *rxd;
90 if (unlikely(evq->exception))
93 rxq = sfc_efx_rxq_by_dp_rxq(evq->dp_rxq);
95 SFC_ASSERT(rxq != NULL);
96 SFC_ASSERT(rxq->evq == evq);
97 SFC_ASSERT(rxq->flags & SFC_EFX_RXQ_FLAG_STARTED);
99 stop = (id + 1) & rxq->ptr_mask;
100 pending_id = rxq->pending & rxq->ptr_mask;
101 delta = (stop >= pending_id) ? (stop - pending_id) :
102 (rxq->ptr_mask + 1 - pending_id + stop);
106 * Rx event with no new descriptors done and zero length
107 * is used to abort scattered packet when there is no room
110 if (unlikely(size != 0)) {
111 evq->exception = B_TRUE;
113 "EVQ %u RxQ %u invalid RX abort "
114 "(id=%#x size=%u flags=%#x); needs restart",
115 evq->evq_index, rxq->dp.dpq.queue_id,
120 /* Add discard flag to the first fragment */
121 rxq->sw_desc[pending_id].flags |= EFX_DISCARD;
122 /* Remove continue flag from the last fragment */
123 rxq->sw_desc[id].flags &= ~EFX_PKT_CONT;
124 } else if (unlikely(delta > rxq->batch_max)) {
125 evq->exception = B_TRUE;
128 "EVQ %u RxQ %u completion out of order "
129 "(id=%#x delta=%u flags=%#x); needs restart",
130 evq->evq_index, rxq->dp.dpq.queue_id,
136 for (i = pending_id; i != stop; i = (i + 1) & rxq->ptr_mask) {
137 rxd = &rxq->sw_desc[i];
141 SFC_ASSERT(size < (1 << 16));
142 rxd->size = (uint16_t)size;
145 rxq->pending += delta;
152 sfc_ev_dp_rx(void *arg, __rte_unused uint32_t label, uint32_t id,
153 __rte_unused uint32_t size, __rte_unused uint16_t flags)
155 struct sfc_evq *evq = arg;
156 struct sfc_dp_rxq *dp_rxq;
158 dp_rxq = evq->dp_rxq;
159 SFC_ASSERT(dp_rxq != NULL);
161 SFC_ASSERT(evq->sa->dp_rx->qrx_ev != NULL);
162 return evq->sa->dp_rx->qrx_ev(dp_rxq, id);
166 sfc_ev_nop_tx(void *arg, uint32_t label, uint32_t id)
168 struct sfc_evq *evq = arg;
170 sfc_err(evq->sa, "EVQ %u unexpected Tx event label=%u id=%#x",
171 evq->evq_index, label, id);
176 sfc_ev_tx(void *arg, __rte_unused uint32_t label, uint32_t id)
178 struct sfc_evq *evq = arg;
179 struct sfc_dp_txq *dp_txq;
180 struct sfc_efx_txq *txq;
184 dp_txq = evq->dp_txq;
185 SFC_ASSERT(dp_txq != NULL);
187 txq = sfc_efx_txq_by_dp_txq(dp_txq);
188 SFC_ASSERT(txq->evq == evq);
190 if (unlikely((txq->flags & SFC_EFX_TXQ_FLAG_STARTED) == 0))
193 stop = (id + 1) & txq->ptr_mask;
194 id = txq->pending & txq->ptr_mask;
196 delta = (stop >= id) ? (stop - id) : (txq->ptr_mask + 1 - id + stop);
198 txq->pending += delta;
205 sfc_ev_dp_tx(void *arg, __rte_unused uint32_t label, uint32_t id)
207 struct sfc_evq *evq = arg;
208 struct sfc_dp_txq *dp_txq;
210 dp_txq = evq->dp_txq;
211 SFC_ASSERT(dp_txq != NULL);
213 SFC_ASSERT(evq->sa->dp_tx->qtx_ev != NULL);
214 return evq->sa->dp_tx->qtx_ev(dp_txq, id);
218 sfc_ev_exception(void *arg, uint32_t code, __rte_unused uint32_t data)
220 struct sfc_evq *evq = arg;
222 if (code == EFX_EXCEPTION_UNKNOWN_SENSOREVT)
225 evq->exception = B_TRUE;
227 "hardware exception %s (code=%u, data=%#x) on EVQ %u;"
229 (code == EFX_EXCEPTION_RX_RECOVERY) ? "RX_RECOVERY" :
230 (code == EFX_EXCEPTION_RX_DSC_ERROR) ? "RX_DSC_ERROR" :
231 (code == EFX_EXCEPTION_TX_DSC_ERROR) ? "TX_DSC_ERROR" :
232 (code == EFX_EXCEPTION_FWALERT_SRAM) ? "FWALERT_SRAM" :
233 (code == EFX_EXCEPTION_UNKNOWN_FWALERT) ? "UNKNOWN_FWALERT" :
234 (code == EFX_EXCEPTION_RX_ERROR) ? "RX_ERROR" :
235 (code == EFX_EXCEPTION_TX_ERROR) ? "TX_ERROR" :
236 (code == EFX_EXCEPTION_EV_ERROR) ? "EV_ERROR" :
238 code, data, evq->evq_index);
244 sfc_ev_nop_rxq_flush_done(void *arg, uint32_t rxq_hw_index)
246 struct sfc_evq *evq = arg;
248 sfc_err(evq->sa, "EVQ %u unexpected RxQ %u flush done",
249 evq->evq_index, rxq_hw_index);
254 sfc_ev_rxq_flush_done(void *arg, __rte_unused uint32_t rxq_hw_index)
256 struct sfc_evq *evq = arg;
257 struct sfc_dp_rxq *dp_rxq;
260 dp_rxq = evq->dp_rxq;
261 SFC_ASSERT(dp_rxq != NULL);
263 rxq = sfc_rxq_by_dp_rxq(dp_rxq);
264 SFC_ASSERT(rxq != NULL);
265 SFC_ASSERT(rxq->hw_index == rxq_hw_index);
266 SFC_ASSERT(rxq->evq == evq);
267 sfc_rx_qflush_done(rxq);
273 sfc_ev_nop_rxq_flush_failed(void *arg, uint32_t rxq_hw_index)
275 struct sfc_evq *evq = arg;
277 sfc_err(evq->sa, "EVQ %u unexpected RxQ %u flush failed",
278 evq->evq_index, rxq_hw_index);
283 sfc_ev_rxq_flush_failed(void *arg, __rte_unused uint32_t rxq_hw_index)
285 struct sfc_evq *evq = arg;
286 struct sfc_dp_rxq *dp_rxq;
289 dp_rxq = evq->dp_rxq;
290 SFC_ASSERT(dp_rxq != NULL);
292 rxq = sfc_rxq_by_dp_rxq(dp_rxq);
293 SFC_ASSERT(rxq != NULL);
294 SFC_ASSERT(rxq->hw_index == rxq_hw_index);
295 SFC_ASSERT(rxq->evq == evq);
296 sfc_rx_qflush_failed(rxq);
302 sfc_ev_nop_txq_flush_done(void *arg, uint32_t txq_hw_index)
304 struct sfc_evq *evq = arg;
306 sfc_err(evq->sa, "EVQ %u unexpected TxQ %u flush done",
307 evq->evq_index, txq_hw_index);
312 sfc_ev_txq_flush_done(void *arg, __rte_unused uint32_t txq_hw_index)
314 struct sfc_evq *evq = arg;
315 struct sfc_dp_txq *dp_txq;
318 dp_txq = evq->dp_txq;
319 SFC_ASSERT(dp_txq != NULL);
321 txq = sfc_txq_by_dp_txq(dp_txq);
322 SFC_ASSERT(txq != NULL);
323 SFC_ASSERT(txq->hw_index == txq_hw_index);
324 SFC_ASSERT(txq->evq == evq);
325 sfc_tx_qflush_done(txq);
331 sfc_ev_software(void *arg, uint16_t magic)
333 struct sfc_evq *evq = arg;
335 sfc_err(evq->sa, "EVQ %u unexpected software event magic=%#.4x",
336 evq->evq_index, magic);
341 sfc_ev_sram(void *arg, uint32_t code)
343 struct sfc_evq *evq = arg;
345 sfc_err(evq->sa, "EVQ %u unexpected SRAM event code=%u",
346 evq->evq_index, code);
351 sfc_ev_wake_up(void *arg, uint32_t index)
353 struct sfc_evq *evq = arg;
355 sfc_err(evq->sa, "EVQ %u unexpected wake up event index=%u",
356 evq->evq_index, index);
361 sfc_ev_timer(void *arg, uint32_t index)
363 struct sfc_evq *evq = arg;
365 sfc_err(evq->sa, "EVQ %u unexpected timer event index=%u",
366 evq->evq_index, index);
371 sfc_ev_nop_link_change(void *arg, __rte_unused efx_link_mode_t link_mode)
373 struct sfc_evq *evq = arg;
375 sfc_err(evq->sa, "EVQ %u unexpected link change event",
381 sfc_ev_link_change(void *arg, efx_link_mode_t link_mode)
383 struct sfc_evq *evq = arg;
384 struct sfc_adapter *sa = evq->sa;
385 struct rte_eth_link new_link;
387 sfc_port_link_mode_to_info(link_mode, &new_link);
388 if (rte_eth_linkstatus_set(sa->eth_dev, &new_link))
389 evq->sa->port.lsc_seq++;
394 static const efx_ev_callbacks_t sfc_ev_callbacks = {
395 .eec_initialized = sfc_ev_initialized,
396 .eec_rx = sfc_ev_nop_rx,
397 .eec_tx = sfc_ev_nop_tx,
398 .eec_exception = sfc_ev_exception,
399 .eec_rxq_flush_done = sfc_ev_nop_rxq_flush_done,
400 .eec_rxq_flush_failed = sfc_ev_nop_rxq_flush_failed,
401 .eec_txq_flush_done = sfc_ev_nop_txq_flush_done,
402 .eec_software = sfc_ev_software,
403 .eec_sram = sfc_ev_sram,
404 .eec_wake_up = sfc_ev_wake_up,
405 .eec_timer = sfc_ev_timer,
406 .eec_link_change = sfc_ev_link_change,
409 static const efx_ev_callbacks_t sfc_ev_callbacks_efx_rx = {
410 .eec_initialized = sfc_ev_initialized,
411 .eec_rx = sfc_ev_efx_rx,
412 .eec_tx = sfc_ev_nop_tx,
413 .eec_exception = sfc_ev_exception,
414 .eec_rxq_flush_done = sfc_ev_rxq_flush_done,
415 .eec_rxq_flush_failed = sfc_ev_rxq_flush_failed,
416 .eec_txq_flush_done = sfc_ev_nop_txq_flush_done,
417 .eec_software = sfc_ev_software,
418 .eec_sram = sfc_ev_sram,
419 .eec_wake_up = sfc_ev_wake_up,
420 .eec_timer = sfc_ev_timer,
421 .eec_link_change = sfc_ev_nop_link_change,
424 static const efx_ev_callbacks_t sfc_ev_callbacks_dp_rx = {
425 .eec_initialized = sfc_ev_initialized,
426 .eec_rx = sfc_ev_dp_rx,
427 .eec_tx = sfc_ev_nop_tx,
428 .eec_exception = sfc_ev_exception,
429 .eec_rxq_flush_done = sfc_ev_rxq_flush_done,
430 .eec_rxq_flush_failed = sfc_ev_rxq_flush_failed,
431 .eec_txq_flush_done = sfc_ev_nop_txq_flush_done,
432 .eec_software = sfc_ev_software,
433 .eec_sram = sfc_ev_sram,
434 .eec_wake_up = sfc_ev_wake_up,
435 .eec_timer = sfc_ev_timer,
436 .eec_link_change = sfc_ev_nop_link_change,
439 static const efx_ev_callbacks_t sfc_ev_callbacks_efx_tx = {
440 .eec_initialized = sfc_ev_initialized,
441 .eec_rx = sfc_ev_nop_rx,
443 .eec_exception = sfc_ev_exception,
444 .eec_rxq_flush_done = sfc_ev_nop_rxq_flush_done,
445 .eec_rxq_flush_failed = sfc_ev_nop_rxq_flush_failed,
446 .eec_txq_flush_done = sfc_ev_txq_flush_done,
447 .eec_software = sfc_ev_software,
448 .eec_sram = sfc_ev_sram,
449 .eec_wake_up = sfc_ev_wake_up,
450 .eec_timer = sfc_ev_timer,
451 .eec_link_change = sfc_ev_nop_link_change,
454 static const efx_ev_callbacks_t sfc_ev_callbacks_dp_tx = {
455 .eec_initialized = sfc_ev_initialized,
456 .eec_rx = sfc_ev_nop_rx,
457 .eec_tx = sfc_ev_dp_tx,
458 .eec_exception = sfc_ev_exception,
459 .eec_rxq_flush_done = sfc_ev_nop_rxq_flush_done,
460 .eec_rxq_flush_failed = sfc_ev_nop_rxq_flush_failed,
461 .eec_txq_flush_done = sfc_ev_txq_flush_done,
462 .eec_software = sfc_ev_software,
463 .eec_sram = sfc_ev_sram,
464 .eec_wake_up = sfc_ev_wake_up,
465 .eec_timer = sfc_ev_timer,
466 .eec_link_change = sfc_ev_nop_link_change,
471 sfc_ev_qpoll(struct sfc_evq *evq)
473 SFC_ASSERT(evq->init_state == SFC_EVQ_STARTED ||
474 evq->init_state == SFC_EVQ_STARTING);
476 /* Synchronize the DMA memory for reading not required */
478 efx_ev_qpoll(evq->common, &evq->read_ptr, evq->callbacks, evq);
480 if (unlikely(evq->exception) && sfc_adapter_trylock(evq->sa)) {
481 struct sfc_adapter *sa = evq->sa;
484 if (evq->dp_rxq != NULL) {
485 unsigned int rxq_sw_index;
487 rxq_sw_index = evq->dp_rxq->dpq.queue_id;
490 "restart RxQ %u because of exception on its EvQ %u",
491 rxq_sw_index, evq->evq_index);
493 sfc_rx_qstop(sa, rxq_sw_index);
494 rc = sfc_rx_qstart(sa, rxq_sw_index);
496 sfc_err(sa, "cannot restart RxQ %u",
500 if (evq->dp_txq != NULL) {
501 unsigned int txq_sw_index;
503 txq_sw_index = evq->dp_txq->dpq.queue_id;
506 "restart TxQ %u because of exception on its EvQ %u",
507 txq_sw_index, evq->evq_index);
509 sfc_tx_qstop(sa, txq_sw_index);
510 rc = sfc_tx_qstart(sa, txq_sw_index);
512 sfc_err(sa, "cannot restart TxQ %u",
517 sfc_panic(sa, "unrecoverable exception on EvQ %u",
520 sfc_adapter_unlock(sa);
523 /* Poll-mode driver does not re-prime the event queue for interrupts */
527 sfc_ev_mgmt_qpoll(struct sfc_adapter *sa)
529 if (rte_spinlock_trylock(&sa->mgmt_evq_lock)) {
530 if (sa->mgmt_evq_running)
531 sfc_ev_qpoll(sa->mgmt_evq);
533 rte_spinlock_unlock(&sa->mgmt_evq_lock);
538 sfc_ev_qprime(struct sfc_evq *evq)
540 SFC_ASSERT(evq->init_state == SFC_EVQ_STARTED);
541 return efx_ev_qprime(evq->common, evq->read_ptr);
544 /* Event queue HW index allocation scheme is described in sfc_ev.h. */
546 sfc_ev_qstart(struct sfc_evq *evq, unsigned int hw_index)
548 struct sfc_adapter *sa = evq->sa;
550 uint32_t evq_flags = sa->evq_flags;
551 unsigned int total_delay_us;
552 unsigned int delay_us;
555 sfc_log_init(sa, "hw_index=%u", hw_index);
559 evq->evq_index = hw_index;
561 /* Clear all events */
562 (void)memset((void *)esmp->esm_base, 0xff, EFX_EVQ_SIZE(evq->entries));
564 if (sa->intr.lsc_intr && hw_index == sa->mgmt_evq_index)
565 evq_flags |= EFX_EVQ_FLAGS_NOTIFY_INTERRUPT;
567 evq_flags |= EFX_EVQ_FLAGS_NOTIFY_DISABLED;
569 /* Create the common code event queue */
570 rc = efx_ev_qcreate(sa->nic, hw_index, esmp, evq->entries,
571 0 /* unused on EF10 */, 0, evq_flags,
574 goto fail_ev_qcreate;
576 SFC_ASSERT(evq->dp_rxq == NULL || evq->dp_txq == NULL);
577 if (evq->dp_rxq != 0) {
578 if (strcmp(sa->dp_rx->dp.name, SFC_KVARG_DATAPATH_EFX) == 0)
579 evq->callbacks = &sfc_ev_callbacks_efx_rx;
581 evq->callbacks = &sfc_ev_callbacks_dp_rx;
582 } else if (evq->dp_txq != 0) {
583 if (strcmp(sa->dp_tx->dp.name, SFC_KVARG_DATAPATH_EFX) == 0)
584 evq->callbacks = &sfc_ev_callbacks_efx_tx;
586 evq->callbacks = &sfc_ev_callbacks_dp_tx;
588 evq->callbacks = &sfc_ev_callbacks;
591 evq->init_state = SFC_EVQ_STARTING;
593 /* Wait for the initialization event */
595 delay_us = SFC_EVQ_INIT_BACKOFF_START_US;
597 (void)sfc_ev_qpoll(evq);
599 /* Check to see if the initialization complete indication
600 * posted by the hardware.
602 if (evq->init_state == SFC_EVQ_STARTED)
605 /* Give event queue some time to init */
606 rte_delay_us(delay_us);
608 total_delay_us += delay_us;
610 /* Exponential backoff */
612 if (delay_us > SFC_EVQ_INIT_BACKOFF_MAX_US)
613 delay_us = SFC_EVQ_INIT_BACKOFF_MAX_US;
615 } while (total_delay_us < SFC_EVQ_INIT_TIMEOUT_US);
624 evq->init_state = SFC_EVQ_INITIALIZED;
625 efx_ev_qdestroy(evq->common);
628 sfc_log_init(sa, "failed %d", rc);
633 sfc_ev_qstop(struct sfc_evq *evq)
638 sfc_log_init(evq->sa, "hw_index=%u", evq->evq_index);
640 if (evq->init_state != SFC_EVQ_STARTED)
643 evq->init_state = SFC_EVQ_INITIALIZED;
644 evq->callbacks = NULL;
646 evq->exception = B_FALSE;
648 efx_ev_qdestroy(evq->common);
654 sfc_ev_mgmt_periodic_qpoll(void *arg)
656 struct sfc_adapter *sa = arg;
659 sfc_ev_mgmt_qpoll(sa);
661 rc = rte_eal_alarm_set(SFC_MGMT_EV_QPOLL_PERIOD_US,
662 sfc_ev_mgmt_periodic_qpoll, sa);
663 if (rc == -ENOTSUP) {
664 sfc_warn(sa, "alarms are not supported");
665 sfc_warn(sa, "management EVQ must be polled indirectly using no-wait link status update");
666 } else if (rc != 0) {
668 "cannot rearm management EVQ polling alarm (rc=%d)",
674 sfc_ev_mgmt_periodic_qpoll_start(struct sfc_adapter *sa)
676 sfc_ev_mgmt_periodic_qpoll(sa);
680 sfc_ev_mgmt_periodic_qpoll_stop(struct sfc_adapter *sa)
682 rte_eal_alarm_cancel(sfc_ev_mgmt_periodic_qpoll, sa);
686 sfc_ev_start(struct sfc_adapter *sa)
690 sfc_log_init(sa, "entry");
692 rc = efx_ev_init(sa->nic);
696 /* Start management EVQ used for global events */
699 * Management event queue start polls the queue, but it cannot
700 * interfere with other polling contexts since mgmt_evq_running
703 rc = sfc_ev_qstart(sa->mgmt_evq, sa->mgmt_evq_index);
705 goto fail_mgmt_evq_start;
707 rte_spinlock_lock(&sa->mgmt_evq_lock);
708 sa->mgmt_evq_running = true;
709 rte_spinlock_unlock(&sa->mgmt_evq_lock);
711 if (sa->intr.lsc_intr) {
712 rc = sfc_ev_qprime(sa->mgmt_evq);
714 goto fail_mgmt_evq_prime;
718 * Start management EVQ polling. If interrupts are disabled
719 * (not used), it is required to process link status change
720 * and other device level events to avoid unrecoverable
721 * error because the event queue overflow.
723 sfc_ev_mgmt_periodic_qpoll_start(sa);
726 * Rx/Tx event queues are started/stopped when corresponding
727 * Rx/Tx queue is started/stopped.
733 sfc_ev_qstop(sa->mgmt_evq);
736 efx_ev_fini(sa->nic);
739 sfc_log_init(sa, "failed %d", rc);
744 sfc_ev_stop(struct sfc_adapter *sa)
746 sfc_log_init(sa, "entry");
748 sfc_ev_mgmt_periodic_qpoll_stop(sa);
750 rte_spinlock_lock(&sa->mgmt_evq_lock);
751 sa->mgmt_evq_running = false;
752 rte_spinlock_unlock(&sa->mgmt_evq_lock);
754 sfc_ev_qstop(sa->mgmt_evq);
756 efx_ev_fini(sa->nic);
760 sfc_ev_qinit(struct sfc_adapter *sa,
761 enum sfc_evq_type type, unsigned int type_index,
762 unsigned int entries, int socket_id, struct sfc_evq **evqp)
767 sfc_log_init(sa, "type=%s type_index=%u",
768 sfc_evq_type2str(type), type_index);
770 SFC_ASSERT(rte_is_power_of_2(entries));
773 evq = rte_zmalloc_socket("sfc-evq", sizeof(*evq), RTE_CACHE_LINE_SIZE,
780 evq->entries = entries;
782 /* Allocate DMA space */
783 rc = sfc_dma_alloc(sa, sfc_evq_type2str(type), type_index,
784 EFX_EVQ_SIZE(evq->entries), socket_id, &evq->mem);
788 evq->init_state = SFC_EVQ_INITIALIZED;
801 sfc_log_init(sa, "failed %d", rc);
806 sfc_ev_qfini(struct sfc_evq *evq)
808 struct sfc_adapter *sa = evq->sa;
810 SFC_ASSERT(evq->init_state == SFC_EVQ_INITIALIZED);
812 sfc_dma_free(sa, &evq->mem);
816 SFC_ASSERT(sa->evq_count > 0);
821 sfc_kvarg_perf_profile_handler(__rte_unused const char *key,
822 const char *value_str, void *opaque)
824 uint32_t *value = opaque;
826 if (strcasecmp(value_str, SFC_KVARG_PERF_PROFILE_THROUGHPUT) == 0)
827 *value = EFX_EVQ_FLAGS_TYPE_THROUGHPUT;
828 else if (strcasecmp(value_str, SFC_KVARG_PERF_PROFILE_LOW_LATENCY) == 0)
829 *value = EFX_EVQ_FLAGS_TYPE_LOW_LATENCY;
830 else if (strcasecmp(value_str, SFC_KVARG_PERF_PROFILE_AUTO) == 0)
831 *value = EFX_EVQ_FLAGS_TYPE_AUTO;
839 sfc_ev_attach(struct sfc_adapter *sa)
843 sfc_log_init(sa, "entry");
845 sa->evq_flags = EFX_EVQ_FLAGS_TYPE_THROUGHPUT;
846 rc = sfc_kvargs_process(sa, SFC_KVARG_PERF_PROFILE,
847 sfc_kvarg_perf_profile_handler,
850 sfc_err(sa, "invalid %s parameter value",
851 SFC_KVARG_PERF_PROFILE);
852 goto fail_kvarg_perf_profile;
855 sa->mgmt_evq_index = 0;
856 rte_spinlock_init(&sa->mgmt_evq_lock);
858 rc = sfc_ev_qinit(sa, SFC_EVQ_TYPE_MGMT, 0, SFC_MGMT_EVQ_ENTRIES,
859 sa->socket_id, &sa->mgmt_evq);
861 goto fail_mgmt_evq_init;
864 * Rx/Tx event queues are created/destroyed when corresponding
865 * Rx/Tx queue is created/destroyed.
872 fail_kvarg_perf_profile:
873 sfc_log_init(sa, "failed %d", rc);
878 sfc_ev_detach(struct sfc_adapter *sa)
880 sfc_log_init(sa, "entry");
882 sfc_ev_qfini(sa->mgmt_evq);
884 if (sa->evq_count != 0)
885 sfc_err(sa, "%u EvQs are not destroyed before detach",