src/dpdk/drivers/net/failsafe/failsafe_intr.c
static int
failsafe_eth_rx_intr_ctl_subdevice(struct sub_device *sdev, int op)
{
	struct rte_eth_dev *dev;
	struct rte_eth_dev *fsdev;
	int epfd;
	uint16_t pid;
	uint16_t qid;
	struct rxq *fsrxq;
	int rc;
	int ret = 0;

	fsdev = fs_dev(sdev);
	if (sdev == NULL || (ETH(sdev) == NULL) ||
		fsdev == NULL || (PRIV(fsdev) == NULL)) {
		ERROR("Called with invalid arguments");
		return -EINVAL;
	}
	dev = ETH(sdev);
	epfd = PRIV(fsdev)->rxp.efd;
	pid = PORT_ID(sdev);

	if (epfd <= 0) {
		if (op == RTE_INTR_EVENT_ADD) {
			ERROR("Proxy events are not initialized");
			return -EBADF;
		} else {
			return 0;
		}
	}
	if (dev->data->nb_rx_queues > fsdev->data->nb_rx_queues) {
		ERROR("subdevice has too many queues,"
		      " Interrupts will not be enabled");
			return -E2BIG;
	}
	for (qid = 0; qid < dev->data->nb_rx_queues; qid++) {
		fsrxq = fsdev->data->rx_queues[qid];
		rc = rte_eth_dev_rx_intr_ctl_q(pid, qid, epfd,
					       op, (void *)fsrxq);
		if (rc) {
			ERROR("rte_eth_dev_rx_intr_ctl_q failed for "
			      "port %d  queue %d, epfd %d, error %d",
			      pid, qid, epfd, rc);
			ret = rc;
		}
	}
	return ret;
}
/**
 * RX Interrupt control per subdevice.
 *
 * @param sdev
 *   Pointer to sub-device structure.
 * @param op
 *   The operation be performed for the vector.
 *   Operation type of {RTE_INTR_EVENT_ADD, RTE_INTR_EVENT_DEL}.
 * @return
 *   - On success, zero.
 *   - On failure, a negative value.
 */
RX Interrupt control per subdevice.
@param sdev
Pointer to sub-device structure.
@param op
The operation be performed for the vector.
RX Interrupt control per subdevice . @param sdev Pointer to sub - device structure . @param op The operation be performed for the vector .
static int
failsafe_eth_rx_intr_ctl_subdevice(struct sub_device *sdev, int op)
{
	struct rte_eth_dev *dev;
	struct rte_eth_dev *fsdev;
	int epfd;
	uint16_t pid;
	uint16_t qid;
	struct rxq *fsrxq;
	int rc;
	int ret = 0;
	fsdev = fs_dev(sdev);
	if (sdev == NULL || (ETH(sdev) == NULL) ||
		fsdev == NULL || (PRIV(fsdev) == NULL)) {
		ERROR("Called with invalid arguments");
		return -EINVAL;
	}
	dev = ETH(sdev);
	epfd = PRIV(fsdev)->rxp.efd;
	pid = PORT_ID(sdev);
	if (epfd <= 0) {
		if (op == RTE_INTR_EVENT_ADD) {
			ERROR("Proxy events are not initialized");
			return -EBADF;
		} else {
			return 0;
		}
	}
	if (dev->data->nb_rx_queues > fsdev->data->nb_rx_queues) {
		ERROR("subdevice has too many queues,"
		      " Interrupts will not be enabled");
			return -E2BIG;
	}
	for (qid = 0; qid < dev->data->nb_rx_queues; qid++) {
		fsrxq = fsdev->data->rx_queues[qid];
		rc = rte_eth_dev_rx_intr_ctl_q(pid, qid, epfd,
					       op, (void *)fsrxq);
		if (rc) {
			ERROR("rte_eth_dev_rx_intr_ctl_q failed for "
			      "port %d  queue %d, epfd %d, error %d",
			      pid, qid, epfd, rc);
			ret = rc;
		}
	}
	return ret;
}
static int failsafe_eth_rx_intr_ctl_subdevice ( struct sub_device * sdev , int op ) { struct rte_eth_dev * dev ; struct rte_eth_dev * fsdev ; int epfd ; uint16_t pid ; uint16_t qid ; struct rxq * fsrxq ; int rc ; int ret = 0 ; fsdev = fs_dev ( sdev ) ; if ( sdev == NULL || ( ETH ( sdev ) == NULL ) || fsdev == NULL || ( PRIV ( fsdev ) == NULL ) ) { ERROR ( " " ) ; return - EINVAL ; } dev = ETH ( sdev ) ; epfd = PRIV ( fsdev ) -> rxp . efd ; pid = PORT_ID ( sdev ) ; if ( epfd <= 0 ) { if ( op == RTE_INTR_EVENT_ADD ) { ERROR ( " " ) ; return - EBADF ; } else { return 0 ; } } if ( dev -> data -> nb_rx_queues > fsdev -> data -> nb_rx_queues ) { ERROR ( " " " " ) ; return - E2BIG ; } for ( qid = 0 ; qid < dev -> data -> nb_rx_queues ; qid ++ ) { fsrxq = fsdev -> data -> rx_queues [ qid ] ; rc = rte_eth_dev_rx_intr_ctl_q ( pid , qid , epfd , op , ( void * ) fsrxq ) ; if ( rc ) { ERROR ( " " " " , pid , qid , epfd , rc ) ; ret = rc ; } } return ret ; }
RX Interrupt control per subdevice.
RX Interrupt control per subdevice .