src/dpdk/drivers/net/hinic/hinic_pmd_ethdev.c
static int hinic_dev_stop(struct rte_eth_dev *dev)
{
	int rc;
	char *name;
	uint16_t port_id;
	struct hinic_nic_dev *nic_dev;
	struct rte_eth_link link;

	nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
	name = dev->data->name;
	port_id = dev->data->port_id;

	dev->data->dev_started = 0;

	if (!rte_bit_relaxed_test_and_clear32(HINIC_DEV_START,
					      &nic_dev->dev_status)) {
		PMD_DRV_LOG(INFO, "Device %s already stopped", name);
		return 0;
	}

	/* just stop phy port and vport */
	rc = hinic_set_port_enable(nic_dev->hwdev, false);
	if (rc)
		PMD_DRV_LOG(WARNING, "Disable phy port failed, error: %d, dev_name: %s, port_id: %d",
			  rc, name, port_id);

	rc = hinic_set_vport_enable(nic_dev->hwdev, false);
	if (rc)
		PMD_DRV_LOG(WARNING, "Disable vport failed, error: %d, dev_name: %s, port_id: %d",
			  rc, name, port_id);

	/* Clear recorded link status */
	memset(&link, 0, sizeof(link));
	(void)rte_eth_linkstatus_set(dev, &link);

	/* flush pending io request */
	rc = hinic_rx_tx_flush(nic_dev->hwdev);
	if (rc)
		PMD_DRV_LOG(WARNING, "Flush pending io failed, error: %d, dev_name: %s, port_id: %d",
			    rc, name, port_id);

	/* clean rss table and rx_mode */
	hinic_remove_rxtx_configure(dev);

	/* clean root context */
	hinic_free_qp_ctxts(nic_dev->hwdev);

	hinic_destroy_fdir_filter(dev);

	/* free mbuf */
	hinic_free_all_rx_mbuf(dev);
	hinic_free_all_tx_mbuf(dev);

	return 0;
}
/**
 * DPDK callback to stop the device.
 *
 * @param dev
 *   Pointer to Ethernet device structure.
 */
DPDK callback to stop the device.
@param dev
Pointer to Ethernet device structure.
DPDK callback to stop the device . @param dev Pointer to Ethernet device structure .
static int hinic_dev_stop(struct rte_eth_dev *dev)
{
	int rc;
	char *name;
	uint16_t port_id;
	struct hinic_nic_dev *nic_dev;
	struct rte_eth_link link;
	nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
	name = dev->data->name;
	port_id = dev->data->port_id;
	dev->data->dev_started = 0;
	if (!rte_bit_relaxed_test_and_clear32(HINIC_DEV_START,
					      &nic_dev->dev_status)) {
		PMD_DRV_LOG(INFO, "Device %s already stopped", name);
		return 0;
	}
	rc = hinic_set_port_enable(nic_dev->hwdev, false);
	if (rc)
		PMD_DRV_LOG(WARNING, "Disable phy port failed, error: %d, dev_name: %s, port_id: %d",
			  rc, name, port_id);
	rc = hinic_set_vport_enable(nic_dev->hwdev, false);
	if (rc)
		PMD_DRV_LOG(WARNING, "Disable vport failed, error: %d, dev_name: %s, port_id: %d",
			  rc, name, port_id);
	memset(&link, 0, sizeof(link));
	(void)rte_eth_linkstatus_set(dev, &link);
	rc = hinic_rx_tx_flush(nic_dev->hwdev);
	if (rc)
		PMD_DRV_LOG(WARNING, "Flush pending io failed, error: %d, dev_name: %s, port_id: %d",
			    rc, name, port_id);
	hinic_remove_rxtx_configure(dev);
	hinic_free_qp_ctxts(nic_dev->hwdev);
	hinic_destroy_fdir_filter(dev);
	hinic_free_all_rx_mbuf(dev);
	hinic_free_all_tx_mbuf(dev);
	return 0;
}
static int hinic_dev_stop ( struct rte_eth_dev * dev ) { int rc ; char * name ; uint16_t port_id ; struct hinic_nic_dev * nic_dev ; struct rte_eth_link link ; nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV ( dev ) ; name = dev -> data -> name ; port_id = dev -> data -> port_id ; dev -> data -> dev_started = 0 ; if ( ! rte_bit_relaxed_test_and_clear32 ( HINIC_DEV_START , & nic_dev -> dev_status ) ) { PMD_DRV_LOG ( INFO , " " , name ) ; return 0 ; } rc = hinic_set_port_enable ( nic_dev -> hwdev , false ) ; if ( rc ) PMD_DRV_LOG ( WARNING , " " , rc , name , port_id ) ; rc = hinic_set_vport_enable ( nic_dev -> hwdev , false ) ; if ( rc ) PMD_DRV_LOG ( WARNING , " " , rc , name , port_id ) ; memset ( & link , 0 , sizeof ( link ) ) ; ( void ) rte_eth_linkstatus_set ( dev , & link ) ; rc = hinic_rx_tx_flush ( nic_dev -> hwdev ) ; if ( rc ) PMD_DRV_LOG ( WARNING , " " , rc , name , port_id ) ; hinic_remove_rxtx_configure ( dev ) ; hinic_free_qp_ctxts ( nic_dev -> hwdev ) ; hinic_destroy_fdir_filter ( dev ) ; hinic_free_all_rx_mbuf ( dev ) ; hinic_free_all_tx_mbuf ( dev ) ; return 0 ; }
DPDK callback to stop the device.
DPDK callback to stop the device .
/* just stop phy port and vport */ /* Clear recorded link status */ /* flush pending io request */ /* clean rss table and rx_mode */ /* clean root context */ /* free mbuf */