[dpdk-dev] [PATCH] net/pcap: set queue started and stopped

Ferruh Yigit ferruh.yigit at intel.com
Wed Jul 18 11:13:40 CEST 2018


On 7/9/2018 9:21 PM, Gage Eads wrote:
> Set the rx and tx queue state appropriately when the queues or device are
> started or stopped.

Is there a specific reason to enable these dev_ops, if so can you please
document in commit log?

> 
> Signed-off-by: Gage Eads <gage.eads at intel.com>
> ---
>  drivers/net/pcap/rte_eth_pcap.c | 42 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 42 insertions(+)
> 
> diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
> index 6bd4a7d79..21e466bcd 100644
> --- a/drivers/net/pcap/rte_eth_pcap.c
> +++ b/drivers/net/pcap/rte_eth_pcap.c
> @@ -430,6 +430,10 @@ eth_dev_start(struct rte_eth_dev *dev)
>  				return -1;
>  			rx->pcap = tx->pcap;
>  		}
> +
> +		dev->data->tx_queue_state[0] = RTE_ETH_QUEUE_STATE_STARTED;
> +		dev->data->rx_queue_state[0] = RTE_ETH_QUEUE_STATE_STARTED;

pcap also supports multiple queue, instead of hardcoding the queue 0 it can be
possible to iterate through dev->data->nb_rx_queues, dev->data->nb_tx_queues.

And I think it is not good to set this in "internals->single_iface" condition,
it is better to do these assignments just above "status_up" after all queues
initialized.

> +
>  		goto status_up;
>  	}
>  
> @@ -490,6 +494,8 @@ eth_dev_stop(struct rte_eth_dev *dev)
>  		pcap_close(tx->pcap);
>  		tx->pcap = NULL;
>  		rx->pcap = NULL;
> +		dev->data->tx_queue_state[0] = RTE_ETH_QUEUE_STATE_STOPPED;
> +		dev->data->rx_queue_state[0] = RTE_ETH_QUEUE_STATE_STOPPED;

same here, just above "status_down" is better place and by using
dev->data->nb_[r/t]x_queues

>  		goto status_down;
>  	}
>  



More information about the dev mailing list