git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
net/virtio: add packed virtqueue defines
[dpdk.git]
/
drivers
/
net
/
kni
/
rte_eth_kni.c
diff --git
a/drivers/net/kni/rte_eth_kni.c
b/drivers/net/kni/rte_eth_kni.c
index
77ac4f2
..
a1e9970
100644
(file)
--- a/
drivers/net/kni/rte_eth_kni.c
+++ b/
drivers/net/kni/rte_eth_kni.c
@@
-65,6
+65,11
@@
static const struct rte_eth_link pmd_link = {
};
static int is_kni_initialized;
};
static int is_kni_initialized;
+static int eth_kni_logtype;
+
+#define PMD_LOG(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, eth_kni_logtype, \
+ "%s(): " fmt "\n", __func__, ##args)
static uint16_t
eth_kni_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
{
static uint16_t
eth_kni_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
{
@@
-126,8
+131,8
@@
eth_kni_start(struct rte_eth_dev *dev)
internals->kni = rte_kni_alloc(mb_pool, &conf, NULL);
if (internals->kni == NULL) {
internals->kni = rte_kni_alloc(mb_pool, &conf, NULL);
if (internals->kni == NULL) {
-
RTE_LOG(ERR, PMD
,
- "Fail to create kni interface for port: %d
\n
",
+
PMD_LOG(ERR
,
+ "Fail to create kni interface for port: %d",
port_id);
return -1;
}
port_id);
return -1;
}
@@
-153,8
+158,8
@@
eth_kni_dev_start(struct rte_eth_dev *dev)
"kni_handle_req", NULL,
kni_handle_request, internals);
if (ret) {
"kni_handle_req", NULL,
kni_handle_request, internals);
if (ret) {
-
RTE_LOG(ERR, PMD
,
- "Fail to create kni request thread
\n
");
+
PMD_LOG(ERR
,
+ "Fail to create kni request thread");
return -1;
}
}
return -1;
}
}
@@
-175,11
+180,11
@@
eth_kni_dev_stop(struct rte_eth_dev *dev)
ret = pthread_cancel(internals->thread);
if (ret)
ret = pthread_cancel(internals->thread);
if (ret)
-
RTE_LOG(ERR, PMD, "Can't cancel the thread\n
");
+
PMD_LOG(ERR, "Can't cancel the thread
");
ret = pthread_join(internals->thread, NULL);
if (ret)
ret = pthread_join(internals->thread, NULL);
if (ret)
-
RTE_LOG(ERR, PMD, "Can't join the thread\n
");
+
PMD_LOG(ERR, "Can't join the thread
");
internals->stop_thread = 0;
}
internals->stop_thread = 0;
}
@@
-338,7
+343,7
@@
eth_kni_create(struct rte_vdev_device *vdev,
struct rte_eth_dev_data *data;
struct rte_eth_dev *eth_dev;
struct rte_eth_dev_data *data;
struct rte_eth_dev *eth_dev;
-
RTE_LOG(INFO, PMD, "Creating kni ethdev on numa socket %u\n
",
+
PMD_LOG(INFO, "Creating kni ethdev on numa socket %u
",
numa_node);
/* reserve an ethdev entry */
numa_node);
/* reserve an ethdev entry */
@@
-403,17
+408,18
@@
eth_kni_probe(struct rte_vdev_device *vdev)
name = rte_vdev_device_name(vdev);
params = rte_vdev_device_args(vdev);
name = rte_vdev_device_name(vdev);
params = rte_vdev_device_args(vdev);
-
RTE_LOG(INFO, PMD, "Initializing eth_kni for %s\n
", name);
+
PMD_LOG(INFO, "Initializing eth_kni for %s
", name);
- if (rte_eal_process_type() == RTE_PROC_SECONDARY &&
- strlen(params) == 0) {
+ if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
eth_dev = rte_eth_dev_attach_secondary(name);
if (!eth_dev) {
eth_dev = rte_eth_dev_attach_secondary(name);
if (!eth_dev) {
-
RTE_LOG(ERR, PMD, "Failed to probe %s\n
", name);
+
PMD_LOG(ERR, "Failed to probe %s
", name);
return -1;
}
/* TODO: request info from primary to set up Rx and Tx */
eth_dev->dev_ops = ð_kni_ops;
return -1;
}
/* TODO: request info from primary to set up Rx and Tx */
eth_dev->dev_ops = ð_kni_ops;
+ eth_dev->device = &vdev->device;
+ rte_eth_dev_probing_finish(eth_dev);
return 0;
}
return 0;
}
@@
-432,6
+438,7
@@
eth_kni_probe(struct rte_vdev_device *vdev)
eth_dev->rx_pkt_burst = eth_kni_rx;
eth_dev->tx_pkt_burst = eth_kni_tx;
eth_dev->rx_pkt_burst = eth_kni_rx;
eth_dev->tx_pkt_burst = eth_kni_tx;
+ rte_eth_dev_probing_finish(eth_dev);
return 0;
kni_uninit:
return 0;
kni_uninit:
@@
-449,20
+456,24
@@
eth_kni_remove(struct rte_vdev_device *vdev)
const char *name;
name = rte_vdev_device_name(vdev);
const char *name;
name = rte_vdev_device_name(vdev);
-
RTE_LOG(INFO, PMD, "Un-Initializing eth_kni for %s\n
", name);
+
PMD_LOG(INFO, "Un-Initializing eth_kni for %s
", name);
/* find the ethdev entry */
eth_dev = rte_eth_dev_allocated(name);
if (eth_dev == NULL)
return -1;
/* find the ethdev entry */
eth_dev = rte_eth_dev_allocated(name);
if (eth_dev == NULL)
return -1;
+ /* mac_addrs must not be freed alone because part of dev_private */
+ eth_dev->data->mac_addrs = NULL;
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return rte_eth_dev_release_port(eth_dev);
+
eth_kni_dev_stop(eth_dev);
internals = eth_dev->data->dev_private;
rte_kni_release(internals->kni);
eth_kni_dev_stop(eth_dev);
internals = eth_dev->data->dev_private;
rte_kni_release(internals->kni);
- rte_free(internals);
-
rte_eth_dev_release_port(eth_dev);
is_kni_initialized--;
rte_eth_dev_release_port(eth_dev);
is_kni_initialized--;
@@
-479,3
+490,10
@@
static struct rte_vdev_driver eth_kni_drv = {
RTE_PMD_REGISTER_VDEV(net_kni, eth_kni_drv);
RTE_PMD_REGISTER_PARAM_STRING(net_kni, ETH_KNI_NO_REQUEST_THREAD_ARG "=<int>");
RTE_PMD_REGISTER_VDEV(net_kni, eth_kni_drv);
RTE_PMD_REGISTER_PARAM_STRING(net_kni, ETH_KNI_NO_REQUEST_THREAD_ARG "=<int>");
+
+RTE_INIT(eth_kni_init_log)
+{
+ eth_kni_logtype = rte_log_register("pmd.net.kni");
+ if (eth_kni_logtype >= 0)
+ rte_log_set_level(eth_kni_logtype, RTE_LOG_NOTICE);
+}