X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fnull%2Frte_eth_null.c;h=7c3c76a89725a0360975cc10ae114d7591b65526;hb=92a15fc541fcba1848933c4ba5c6e08f6330bc13;hp=11258ccea646a487d4c371a23749e9878776a06b;hpb=f51ecf2fe0013fd209b848894fa718fecdf8190c;p=dpdk.git diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 11258ccea6..7c3c76a897 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -73,7 +73,7 @@ static struct rte_eth_link pmd_link = { .link_autoneg = ETH_LINK_FIXED, }; -static int eth_null_logtype; +RTE_LOG_REGISTER(eth_null_logtype, pmd.net.null, NOTICE); #define PMD_LOG(level, fmt, args...) \ rte_log(RTE_LOG_ ## level, eth_null_logtype, \ @@ -458,7 +458,23 @@ eth_mac_address_set(__rte_unused struct rte_eth_dev *dev, return 0; } +static int +eth_dev_close(struct rte_eth_dev *dev) +{ + PMD_LOG(INFO, "Closing null ethdev on NUMA socket %u", + rte_socket_id()); + + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + + /* mac_addrs must not be freed alone because part of dev_private */ + dev->data->mac_addrs = NULL; + + return 0; +} + static const struct eth_dev_ops ops = { + .dev_close = eth_dev_close, .dev_start = eth_dev_start, .dev_stop = eth_dev_stop, .dev_configure = eth_dev_configure, @@ -701,18 +717,12 @@ rte_pmd_null_remove(struct rte_vdev_device *dev) if (!dev) return -EINVAL; - PMD_LOG(INFO, "Closing null ethdev on numa socket %u", - rte_socket_id()); - /* find the ethdev entry */ eth_dev = rte_eth_dev_allocated(rte_vdev_device_name(dev)); if (eth_dev == NULL) - return -1; - - if (rte_eal_process_type() == RTE_PROC_PRIMARY) - /* mac_addrs must not be freed alone because part of dev_private */ - eth_dev->data->mac_addrs = NULL; + return 0; /* port already released */ + eth_dev_close(eth_dev); rte_eth_dev_release_port(eth_dev); return 0; @@ -729,10 +739,3 @@ RTE_PMD_REGISTER_PARAM_STRING(net_null, "size= " "copy= " ETH_NULL_PACKET_NO_RX_ARG "=0|1"); - -RTE_INIT(eth_null_init_log) -{ - eth_null_logtype = rte_log_register("pmd.net.null"); - if (eth_null_logtype >= 0) - rte_log_set_level(eth_null_logtype, RTE_LOG_NOTICE); -}