/* Management event queue polling period in microseconds */
#define SFC_MGMT_EV_QPOLL_PERIOD_US (US_PER_S)
+static const char *
+sfc_evq_type2str(enum sfc_evq_type type)
+{
+ switch (type) {
+ case SFC_EVQ_TYPE_MGMT:
+ return "mgmt-evq";
+ case SFC_EVQ_TYPE_RX:
+ return "rx-evq";
+ case SFC_EVQ_TYPE_TX:
+ return "tx-evq";
+ default:
+ SFC_ASSERT(B_FALSE);
+ return NULL;
+ }
+}
static boolean_t
sfc_ev_initialized(void *arg)
const struct sfc_evq_info *evq_info;
struct sfc_evq *evq;
efsys_mem_t *esmp;
+ uint32_t evq_flags = sa->evq_flags;
unsigned int total_delay_us;
unsigned int delay_us;
int rc;
esmp = &evq->mem;
/* Clear all events */
- (void)memset((void *)esmp->esm_base, 0xff,
- EFX_EVQ_SIZE(evq_info->entries));
+ (void)memset((void *)esmp->esm_base, 0xff, EFX_EVQ_SIZE(evq->entries));
+
+ if (sa->intr.lsc_intr && sw_index == sa->mgmt_evq_index)
+ evq_flags |= EFX_EVQ_FLAGS_NOTIFY_INTERRUPT;
+ else
+ evq_flags |= EFX_EVQ_FLAGS_NOTIFY_DISABLED;
/* Create the common code event queue */
- rc = efx_ev_qcreate(sa->nic, sw_index, esmp, evq_info->entries,
- 0 /* unused on EF10 */, 0, evq_info->flags,
+ rc = efx_ev_qcreate(sa->nic, sw_index, esmp, evq->entries,
+ 0 /* unused on EF10 */, 0, evq_flags,
&evq->common);
if (rc != 0)
goto fail_ev_qcreate;
int
sfc_ev_qinit(struct sfc_adapter *sa, unsigned int sw_index,
+ enum sfc_evq_type type, unsigned int type_index,
unsigned int entries, int socket_id)
{
struct sfc_evq_info *evq_info;
struct sfc_evq *evq;
int rc;
- sfc_log_init(sa, "sw_index=%u", sw_index);
+ sfc_log_init(sa, "sw_index=%u type=%s type_index=%u",
+ sw_index, sfc_evq_type2str(type), type_index);
evq_info = &sa->evq_info[sw_index];
SFC_ASSERT(rte_is_power_of_2(entries));
- SFC_ASSERT(entries <= evq_info->max_entries);
- evq_info->entries = entries;
+ rc = ENOMEM;
evq = rte_zmalloc_socket("sfc-evq", sizeof(*evq), RTE_CACHE_LINE_SIZE,
socket_id);
if (evq == NULL)
- return ENOMEM;
+ goto fail_evq_alloc;
evq->sa = sa;
evq->evq_index = sw_index;
+ evq->type = type;
+ evq->entries = entries;
/* Allocate DMA space */
- rc = sfc_dma_alloc(sa, "evq", sw_index, EFX_EVQ_SIZE(evq_info->entries),
- socket_id, &evq->mem);
+ rc = sfc_dma_alloc(sa, sfc_evq_type2str(type), type_index,
+ EFX_EVQ_SIZE(evq->entries), socket_id, &evq->mem);
if (rc != 0)
- return rc;
+ goto fail_dma_alloc;
evq->init_state = SFC_EVQ_INITIALIZED;
evq_info->evq = evq;
return 0;
+
+fail_dma_alloc:
+ rte_free(evq);
+
+fail_evq_alloc:
+
+ sfc_log_init(sa, "failed %d", rc);
+ return rc;
}
void
static int
sfc_ev_qinit_info(struct sfc_adapter *sa, unsigned int sw_index)
{
- struct sfc_evq_info *evq_info = &sa->evq_info[sw_index];
- unsigned int max_entries;
-
sfc_log_init(sa, "sw_index=%u", sw_index);
- max_entries = sfc_evq_max_entries(sa, sw_index);
- SFC_ASSERT(rte_is_power_of_2(max_entries));
-
- evq_info->max_entries = max_entries;
- evq_info->flags = sa->evq_flags |
- ((sa->intr.lsc_intr && sw_index == sa->mgmt_evq_index) ?
- EFX_EVQ_FLAGS_NOTIFY_INTERRUPT :
- EFX_EVQ_FLAGS_NOTIFY_DISABLED);
-
return 0;
}
goto fail_ev_qinit_info;
}
- rc = sfc_ev_qinit(sa, sa->mgmt_evq_index, SFC_MGMT_EVQ_ENTRIES,
- sa->socket_id);
+ rc = sfc_ev_qinit(sa, sa->mgmt_evq_index, SFC_EVQ_TYPE_MGMT, 0,
+ SFC_MGMT_EVQ_ENTRIES, sa->socket_id);
if (rc != 0)
goto fail_mgmt_evq_init;