uint16_t nb_pkts);
static uint16_t mrvl_tx_sg_pkt_burst(void *txq, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts);
+static int rte_pmd_mrvl_remove(struct rte_vdev_device *vdev);
+static void mrvl_deinit_pp2(void);
+static void mrvl_deinit_hifs(void);
#define MRVL_XSTATS_TBL_ENTRY(name) { \
pp2_cls_plcr_deinit(priv->default_policer);
priv->default_policer = NULL;
}
+
+
+ if (priv->bpool) {
+ pp2_bpool_deinit(priv->bpool);
+ used_bpools[priv->pp_id] &= ~(1 << priv->bpool_bit);
+ priv->bpool = NULL;
+ }
+
+ mrvl_dev_num--;
+
+ if (mrvl_dev_num == 0) {
+ MRVL_LOG(INFO, "Perform MUSDK deinit");
+ mrvl_deinit_hifs();
+ mrvl_deinit_pp2();
+ rte_mvep_deinit(MVEP_MOD_T_PP2);
+ }
}
/**
mrvl_set_tx_function(eth_dev);
eth_dev->dev_ops = &mrvl_ops;
+ /* Flag to call rte_eth_dev_release_port() in rte_eth_dev_close(). */
+ eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
rte_eth_dev_probing_finish(eth_dev);
return 0;
out_free:
return ret;
}
-/**
- * Cleanup previously created device representing Ethernet port.
- *
- * @param name
- * Pointer to the port name.
- */
-static void
-mrvl_eth_dev_destroy(const char *name)
-{
- struct rte_eth_dev *eth_dev;
- struct mrvl_priv *priv;
-
- eth_dev = rte_eth_dev_allocated(name);
- if (!eth_dev)
- return;
-
- priv = eth_dev->data->dev_private;
- pp2_bpool_deinit(priv->bpool);
- used_bpools[priv->pp_id] &= ~(1 << priv->bpool_bit);
- rte_eth_dev_release_port(eth_dev);
-}
-
/**
* Callback used by rte_kvargs_process() during argument parsing.
*
ret = mrvl_eth_dev_create(vdev, ifnames.names[i]);
if (ret)
goto out_cleanup;
+ mrvl_dev_num++;
}
- mrvl_dev_num += ifnum;
rte_kvargs_free(kvlist);
return 0;
out_cleanup:
- for (; i > 0; i--)
- mrvl_eth_dev_destroy(ifnames.names[i]);
+ rte_pmd_mrvl_remove(vdev);
- if (mrvl_dev_num == 0) {
- mrvl_deinit_pp2();
- rte_mvep_deinit(MVEP_MOD_T_PP2);
- }
out_free_kvlist:
rte_kvargs_free(kvlist);
static int
rte_pmd_mrvl_remove(struct rte_vdev_device *vdev)
{
- int i;
- const char *name;
+ uint16_t port_id;
- name = rte_vdev_device_name(vdev);
- if (!name)
- return -EINVAL;
-
- MRVL_LOG(INFO, "Removing %s", name);
-
- RTE_ETH_FOREACH_DEV(i) { /* FIXME: removing all devices! */
- char ifname[RTE_ETH_NAME_MAX_LEN];
-
- rte_eth_dev_get_name_by_port(i, ifname);
- mrvl_eth_dev_destroy(ifname);
- mrvl_dev_num--;
- }
-
- if (mrvl_dev_num == 0) {
- MRVL_LOG(INFO, "Perform MUSDK deinit");
- mrvl_deinit_hifs();
- mrvl_deinit_pp2();
- rte_mvep_deinit(MVEP_MOD_T_PP2);
+ RTE_ETH_FOREACH_DEV(port_id) {
+ if (rte_eth_devices[port_id].device != &vdev->device)
+ continue;
+ rte_eth_dev_close(port_id);
}
return 0;