[dpdk-dev] [PATCH v8] ethdev: add sanity checks in control APIs

Thomas Monjalon thomas at monjalon.net
Tue Apr 20 12:04:50 CEST 2021


Thanks for the work.
Few last comments below.

17/04/2021 09:39, Min Hu (Connor):
> @@ -293,6 +303,11 @@ rte_eth_iterator_init(struct rte_dev_iterator *iter, const char *devargs_str)
>  uint16_t
>  rte_eth_iterator_next(struct rte_dev_iterator *iter)
>  {
> +	if (iter == NULL) {
> +		RTE_ETHDEV_LOG(ERR, "Cannot iterate next NULL iter\n");

I would remove "next".
Cannot iterate NULL iter

> @@ -2629,6 +2707,13 @@ rte_eth_link_get_nowait(uint16_t port_id, struct rte_eth_link *eth_link)
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
>  
> +	if (eth_link == NULL) {
> +		RTE_ETHDEV_LOG(ERR,
> +			"Cannot get nowait ethdev port %u for NULL link\n",
> +			port_id);

"nowait ethdev" is not correct.
I think you can just remove "nowait".

> +	if (fw_version == NULL) {
> +		RTE_ETHDEV_LOG(ERR,
> +			"Cannot get ethdev port %u fw version for NULL param\n",
[...]
> +	if (fw_size == 0) {
> +		RTE_ETHDEV_LOG(ERR,
> +			"Cannot get ethdev port %u fw version with zero size\n",
> +			port_id);

s/fw/FW/

> +		RTE_ETHDEV_LOG(ERR,
> +			"Cannot update ethdev port %u rss reta to NULL\n",
> +		RTE_ETHDEV_LOG(ERR,
> +			"Cannot update ethdev port %u rss reta with zero size\n",

s/rss reta/RSS RETA/

> +		RTE_ETHDEV_LOG(ERR,
> +			"Cannot update ethdev port %u rss hash to NULL\n",

s/rss/RSS/





More information about the dev mailing list