[Patch v5 16/18] net/mana: add function to start/stop device
Suanming Mou
suanmingm at nvidia.com
Mon Aug 29 05:38:03 CEST 2022
Hi,
> -----Original Message-----
> From: longli at linuxonhyperv.com <longli at linuxonhyperv.com>
> Sent: Saturday, August 27, 2022 8:35 AM
> To: Ferruh Yigit <ferruh.yigit at xilinx.com>
> Cc: dev at dpdk.org; Ajay Sharma <sharmaajay at microsoft.com>; Stephen
> Hemminger <sthemmin at microsoft.com>; NBU-Contact-longli (EXTERNAL)
> <longli at microsoft.com>
> Subject: [Patch v5 16/18] net/mana: add function to start/stop device
>
> From: Long Li <longli at microsoft.com>
>
> Add support for starting/stopping the device.
>
> Signed-off-by: Long Li <longli at microsoft.com>
> ---
> Change log:
> v2:
> Use spinlock for memory registration cache.
> Add prefix mana_ to all function names.
>
> drivers/net/mana/mana.c | 70
> +++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 70 insertions(+)
>
> diff --git a/drivers/net/mana/mana.c b/drivers/net/mana/mana.c index
> 0dcd3f3124..119fdfd8bc 100644
> --- a/drivers/net/mana/mana.c
> +++ b/drivers/net/mana/mana.c
> @@ -97,6 +97,74 @@ static int mana_dev_configure(struct rte_eth_dev *dev)
>
> static int mana_intr_uninstall(struct mana_priv *priv);
>
> +static int
> +mana_dev_start(struct rte_eth_dev *dev) {
> + int ret;
> + struct mana_priv *priv = dev->data->dev_private;
> +
> + rte_spinlock_init(&priv->mr_btree_lock);
> + ret = mana_mr_btree_init(&priv->mr_btree,
Refer to the previous patch, looks mana_mr_btree_free() is needed in the later failure routine, right?
> MANA_MR_BTREE_CACHE_N,
> + dev->device->numa_node);
> + if (ret) {
> + DRV_LOG(ERR, "Failed to init device MR btree %d", ret);
> + return ret;
> + }
> +
> + ret = mana_start_tx_queues(dev);
> + if (ret) {
> + DRV_LOG(ERR, "failed to start tx queues %d", ret);
> + return ret;
> + }
> +
> + ret = mana_start_rx_queues(dev);
> + if (ret) {
> + DRV_LOG(ERR, "failed to start rx queues %d", ret);
> + mana_stop_tx_queues(dev);
> + return ret;
> + }
> +
> + rte_wmb();
> +
> + dev->tx_pkt_burst = mana_tx_burst;
> + dev->rx_pkt_burst = mana_rx_burst;
> +
> + DRV_LOG(INFO, "TX/RX queues have started");
> +
> + /* Enable datapath for secondary processes */
> + mana_mp_req_on_rxtx(dev, MANA_MP_REQ_START_RXTX);
> +
> + return 0;
> +}
> +
> +static int
> +mana_dev_stop(struct rte_eth_dev *dev __rte_unused) {
> + int ret;
> +
> + dev->tx_pkt_burst = mana_tx_burst_removed;
> + dev->rx_pkt_burst = mana_rx_burst_removed;
> +
> + /* Stop datapath on secondary processes */
> + mana_mp_req_on_rxtx(dev, MANA_MP_REQ_STOP_RXTX);
> +
> + rte_wmb();
> +
> + ret = mana_stop_tx_queues(dev);
> + if (ret) {
> + DRV_LOG(ERR, "failed to stop tx queues");
> + return ret;
> + }
> +
> + ret = mana_stop_rx_queues(dev);
> + if (ret) {
> + DRV_LOG(ERR, "failed to stop tx queues");
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> static int
> mana_dev_close(struct rte_eth_dev *dev) { @@ -435,6 +503,8 @@ static int
> mana_dev_link_update(struct rte_eth_dev *dev,
>
> const struct eth_dev_ops mana_dev_ops = {
> .dev_configure = mana_dev_configure,
> + .dev_start = mana_dev_start,
> + .dev_stop = mana_dev_stop,
> .dev_close = mana_dev_close,
> .dev_infos_get = mana_dev_info_get,
> .txq_info_get = mana_dev_tx_queue_info,
> --
> 2.34.1
More information about the dev
mailing list