src/dpdk/drivers/net/failsafe/failsafe_intr.c
static int
fs_rx_intr_vec_install(struct fs_priv *priv)
{
	unsigned int i;
	unsigned int rxqs_n;
	unsigned int n;
	unsigned int count;
	struct rte_intr_handle *intr_handle;

	rxqs_n = priv->data->nb_rx_queues;
	n = RTE_MIN(rxqs_n, (uint32_t)RTE_MAX_RXTX_INTR_VEC_ID);
	count = 0;
	intr_handle = &priv->intr_handle;
	RTE_ASSERT(intr_handle->intr_vec == NULL);
	/* Allocate the interrupt vector of the failsafe Rx proxy interrupts */
	intr_handle->intr_vec = malloc(n * sizeof(intr_handle->intr_vec[0]));
	if (intr_handle->intr_vec == NULL) {
		fs_rx_intr_vec_uninstall(priv);
		rte_errno = ENOMEM;
		ERROR("Failed to allocate memory for interrupt vector,"
		      " Rx interrupts will not be supported");
		return -rte_errno;
	}
	for (i = 0; i < n; i++) {
		struct rxq *rxq = priv->data->rx_queues[i];

		/* Skip queues that cannot request interrupts. */
		if (rxq == NULL || rxq->event_fd < 0) {
			/* Use invalid intr_vec[] index to disable entry. */
			intr_handle->intr_vec[i] =
				RTE_INTR_VEC_RXTX_OFFSET +
				RTE_MAX_RXTX_INTR_VEC_ID;
			continue;
		}
		if (count >= RTE_MAX_RXTX_INTR_VEC_ID) {
			rte_errno = E2BIG;
			ERROR("Too many Rx queues for interrupt vector size"
			      " (%d), Rx interrupts cannot be enabled",
			      RTE_MAX_RXTX_INTR_VEC_ID);
			fs_rx_intr_vec_uninstall(priv);
			return -rte_errno;
		}
		intr_handle->intr_vec[i] = RTE_INTR_VEC_RXTX_OFFSET + count;
		intr_handle->efds[count] = rxq->event_fd;
		count++;
	}
	if (count == 0) {
		fs_rx_intr_vec_uninstall(priv);
	} else {
		intr_handle->nb_efd = count;
		intr_handle->efd_counter_size = sizeof(uint64_t);
	}
	return 0;
}
/**
 * Installs failsafe interrupt vector to be registered with EAL later on.
 *
 * @param priv
 *   Pointer to failsafe private structure.
 *
 * @return
 *   0 on success, negative errno value otherwise and rte_errno is set.
 */
Installs failsafe interrupt vector to be registered with EAL later on.
@param priv
Pointer to failsafe private structure.

@return
0 on success, negative errno value otherwise and rte_errno is set.
Installs failsafe interrupt vector to be registered with EAL later on . @param priv Pointer to failsafe private structure . @return 0 on success negative errno value otherwise and rte_errno is set .
static int
fs_rx_intr_vec_install(struct fs_priv *priv)
{
	unsigned int i;
	unsigned int rxqs_n;
	unsigned int n;
	unsigned int count;
	struct rte_intr_handle *intr_handle;
	rxqs_n = priv->data->nb_rx_queues;
	n = RTE_MIN(rxqs_n, (uint32_t)RTE_MAX_RXTX_INTR_VEC_ID);
	count = 0;
	intr_handle = &priv->intr_handle;
	RTE_ASSERT(intr_handle->intr_vec == NULL);
	intr_handle->intr_vec = malloc(n * sizeof(intr_handle->intr_vec[0]));
	if (intr_handle->intr_vec == NULL) {
		fs_rx_intr_vec_uninstall(priv);
		rte_errno = ENOMEM;
		ERROR("Failed to allocate memory for interrupt vector,"
		      " Rx interrupts will not be supported");
		return -rte_errno;
	}
	for (i = 0; i < n; i++) {
		struct rxq *rxq = priv->data->rx_queues[i];
		if (rxq == NULL || rxq->event_fd < 0) {
			intr_handle->intr_vec[i] =
				RTE_INTR_VEC_RXTX_OFFSET +
				RTE_MAX_RXTX_INTR_VEC_ID;
			continue;
		}
		if (count >= RTE_MAX_RXTX_INTR_VEC_ID) {
			rte_errno = E2BIG;
			ERROR("Too many Rx queues for interrupt vector size"
			      " (%d), Rx interrupts cannot be enabled",
			      RTE_MAX_RXTX_INTR_VEC_ID);
			fs_rx_intr_vec_uninstall(priv);
			return -rte_errno;
		}
		intr_handle->intr_vec[i] = RTE_INTR_VEC_RXTX_OFFSET + count;
		intr_handle->efds[count] = rxq->event_fd;
		count++;
	}
	if (count == 0) {
		fs_rx_intr_vec_uninstall(priv);
	} else {
		intr_handle->nb_efd = count;
		intr_handle->efd_counter_size = sizeof(uint64_t);
	}
	return 0;
}
static int fs_rx_intr_vec_install ( struct fs_priv * priv ) { unsigned int i ; unsigned int rxqs_n ; unsigned int n ; unsigned int count ; struct rte_intr_handle * intr_handle ; rxqs_n = priv -> data -> nb_rx_queues ; n = RTE_MIN ( rxqs_n , ( uint32_t ) RTE_MAX_RXTX_INTR_VEC_ID ) ; count = 0 ; intr_handle = & priv -> intr_handle ; RTE_ASSERT ( intr_handle -> intr_vec == NULL ) ; intr_handle -> intr_vec = malloc ( n * sizeof ( intr_handle -> intr_vec [ 0 ] ) ) ; if ( intr_handle -> intr_vec == NULL ) { fs_rx_intr_vec_uninstall ( priv ) ; rte_errno = ENOMEM ; ERROR ( " " " " ) ; return - rte_errno ; } for ( i = 0 ; i < n ; i ++ ) { struct rxq * rxq = priv -> data -> rx_queues [ i ] ; if ( rxq == NULL || rxq -> event_fd < 0 ) { intr_handle -> intr_vec [ i ] = RTE_INTR_VEC_RXTX_OFFSET + RTE_MAX_RXTX_INTR_VEC_ID ; continue ; } if ( count >= RTE_MAX_RXTX_INTR_VEC_ID ) { rte_errno = E2BIG ; ERROR ( " " " " , RTE_MAX_RXTX_INTR_VEC_ID ) ; fs_rx_intr_vec_uninstall ( priv ) ; return - rte_errno ; } intr_handle -> intr_vec [ i ] = RTE_INTR_VEC_RXTX_OFFSET + count ; intr_handle -> efds [ count ] = rxq -> event_fd ; count ++ ; } if ( count == 0 ) { fs_rx_intr_vec_uninstall ( priv ) ; } else { intr_handle -> nb_efd = count ; intr_handle -> efd_counter_size = sizeof ( uint64_t ) ; } return 0 ; }
Installs failsafe interrupt vector to be registered with EAL later on.
Installs failsafe interrupt vector to be registered with EAL later on .
/* Allocate the interrupt vector of the failsafe Rx proxy interrupts */ /* Skip queues that cannot request interrupts. */ /* Use invalid intr_vec[] index to disable entry. */