[dpdk-dev] [PATCH v8 08/11] ethdev: add rx intr enable, disable and ctl functions

Stephen Hemminger stephen at networkplumber.org
Thu May 21 20:22:33 CEST 2015


On Thu, 21 May 2015 16:56:00 +0800
Cunming Liang <cunming.liang at intel.com> wrote:

> +int
> +rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id,
> +			  int epfd, int op, void *data)
> +{
> +	uint32_t vec;
> +	struct rte_eth_dev *dev;
> +	struct rte_intr_handle *intr_handle;
> +	int rc;
> +
> +	if (!rte_eth_dev_is_valid_port(port_id)) {
> +		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);

Use %u when printing unsigned value

> +		return -ENODEV;
> +	}
> +
> +	dev = &rte_eth_devices[port_id];
> +	if (dev == NULL) {
> +		PMD_DEBUG_TRACE("Invalid port device\n");
> +		return -ENODEV;
> +	}
Another unnecessary conditional check, already done in rte_eth_dev_is_valid_port

> +
> +	if (queue_id >= dev->data->nb_rx_queues) {
> +		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
This is wrong, won't build with debug enabled, You meant to use queue_id
here and use %u

> +		return -EINVAL;
> +	}
> +
> +	intr_handle = &dev->pci_dev->intr_handle;
> +	if (!intr_handle->intr_vec) {
> +		PMD_DEBUG_TRACE("RX Intr vector unset\n");
> +		return -EPERM;
> +	}
> +


More information about the dev mailing list