Skip to content

Commit

Permalink
net/zxdh: support device close operation
Browse files Browse the repository at this point in the history
Provided zxdh dev close ops for resource released.

Signed-off-by: Junlong Wang <wang.junlong1@zte.com.cn>
Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
  • Loading branch information
Junlong Wang authored and ferruhy committed Nov 6, 2024
1 parent 70d49e4 commit 27ed58d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion drivers/net/zxdh/zxdh_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -833,16 +833,31 @@ zxdh_dev_configure(struct rte_eth_dev *dev)
}

static int
zxdh_dev_close(struct rte_eth_dev *dev __rte_unused)
zxdh_dev_close(struct rte_eth_dev *dev)
{
struct zxdh_hw *hw = dev->data->dev_private;
int ret = 0;

zxdh_intr_release(dev);
zxdh_pci_reset(hw);

zxdh_dev_free_mbufs(dev);
zxdh_free_queues(dev);

zxdh_bar_msg_chan_exit();

if (dev->data->mac_addrs != NULL) {
rte_free(dev->data->mac_addrs);
dev->data->mac_addrs = NULL;
}

return ret;
}

/* dev_ops for zxdh, bare necessities for basic operation */
static const struct eth_dev_ops zxdh_eth_dev_ops = {
.dev_configure = zxdh_dev_configure,
.dev_close = zxdh_dev_close,
.dev_infos_get = zxdh_dev_infos_get,
};

Expand Down

0 comments on commit 27ed58d

Please sign in to comment.