Code Review
/
deb_dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
New upstream version 18.05
[deb_dpdk.git]
/
drivers
/
net
/
ring
/
rte_eth_ring.c
diff --git
a/drivers/net/ring/rte_eth_ring.c
b/drivers/net/ring/rte_eth_ring.c
index
df13c44
..
35b837c
100644
(file)
--- a/
drivers/net/ring/rte_eth_ring.c
+++ b/
drivers/net/ring/rte_eth_ring.c
@@
-60,9
+60,15
@@
static struct rte_eth_link pmd_link = {
.link_speed = ETH_SPEED_NUM_10G,
.link_duplex = ETH_LINK_FULL_DUPLEX,
.link_status = ETH_LINK_DOWN,
.link_speed = ETH_SPEED_NUM_10G,
.link_duplex = ETH_LINK_FULL_DUPLEX,
.link_status = ETH_LINK_DOWN,
- .link_autoneg = ETH_LINK_
AUTONEG
+ .link_autoneg = ETH_LINK_
FIXED,
};
};
+static int eth_ring_logtype;
+
+#define PMD_LOG(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, eth_ring_logtype, \
+ "%s(): " fmt "\n", __func__, ##args)
+
static uint16_t
eth_ring_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
{
static uint16_t
eth_ring_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
{
@@
-256,18
+262,9
@@
do_eth_dev_ring_create(const char *name,
void **tx_queues_local = NULL;
unsigned i;
void **tx_queues_local = NULL;
unsigned i;
-
RTE_LOG(INFO, PMD, "Creating rings-backed ethdev on numa socket %u\n
",
+
PMD_LOG(INFO, "Creating rings-backed ethdev on numa socket %u
",
numa_node);
numa_node);
- /* now do all data allocation - for eth_dev structure, dummy pci driver
- * and internal (private) data
- */
- data = rte_zmalloc_socket(name, sizeof(*data), 0, numa_node);
- if (data == NULL) {
- rte_errno = ENOMEM;
- goto error;
- }
-
rx_queues_local = rte_zmalloc_socket(name,
sizeof(void *) * nb_rx_queues, 0, numa_node);
if (rx_queues_local == NULL) {
rx_queues_local = rte_zmalloc_socket(name,
sizeof(void *) * nb_rx_queues, 0, numa_node);
if (rx_queues_local == NULL) {
@@
-301,10
+298,8
@@
do_eth_dev_ring_create(const char *name,
* - point eth_dev_data to internals
* - and point eth_dev structure to new eth_dev_data structure
*/
* - point eth_dev_data to internals
* - and point eth_dev structure to new eth_dev_data structure
*/
- /* NOTE: we'll replace the data element, of originally allocated eth_dev
- * so the rings are local per-process */
-
rte_memcpy(data, eth_dev->data, sizeof(*data))
;
+
data = eth_dev->data
;
data->rx_queues = rx_queues_local;
data->tx_queues = tx_queues_local;
data->rx_queues = rx_queues_local;
data->tx_queues = tx_queues_local;
@@
-326,7
+321,6
@@
do_eth_dev_ring_create(const char *name,
data->dev_link = pmd_link;
data->mac_addrs = &internals->address;
data->dev_link = pmd_link;
data->mac_addrs = &internals->address;
- eth_dev->data = data;
eth_dev->dev_ops = &ops;
data->kdrv = RTE_KDRV_NONE;
data->numa_node = numa_node;
eth_dev->dev_ops = &ops;
data->kdrv = RTE_KDRV_NONE;
data->numa_node = numa_node;
@@
-335,6
+329,7
@@
do_eth_dev_ring_create(const char *name,
eth_dev->rx_pkt_burst = eth_ring_rx;
eth_dev->tx_pkt_burst = eth_ring_tx;
eth_dev->rx_pkt_burst = eth_ring_rx;
eth_dev->tx_pkt_burst = eth_ring_tx;
+ rte_eth_dev_probing_finish(eth_dev);
*eth_dev_p = eth_dev;
return data->port_id;
*eth_dev_p = eth_dev;
return data->port_id;
@@
-342,7
+337,6
@@
do_eth_dev_ring_create(const char *name,
error:
rte_free(rx_queues_local);
rte_free(tx_queues_local);
error:
rte_free(rx_queues_local);
rte_free(tx_queues_local);
- rte_free(data);
rte_free(internals);
return -1;
rte_free(internals);
return -1;
@@
-459,13
+453,13
@@
static int parse_kvlist (const char *key __rte_unused, const char *value, void *
ret = -EINVAL;
if (!name) {
ret = -EINVAL;
if (!name) {
-
RTE_LOG(WARNING, PMD, "command line parameter is empty for ring pmd!\n
");
+
PMD_LOG(WARNING, "command line parameter is empty for ring pmd!
");
goto out;
}
node = strchr(name, ':');
if (!node) {
goto out;
}
node = strchr(name, ':');
if (!node) {
-
RTE_LOG(WARNING, PMD, "could not parse node value from %s\n
",
+
PMD_LOG(WARNING, "could not parse node value from %s
",
name);
goto out;
}
name);
goto out;
}
@@
-475,7
+469,7
@@
static int parse_kvlist (const char *key __rte_unused, const char *value, void *
action = strchr(node, ':');
if (!action) {
action = strchr(node, ':');
if (!action) {
-
RTE_LOG(WARNING, PMD, "could not parse action value from %s\n
",
+
PMD_LOG(WARNING, "could not parse action value from %s
",
node);
goto out;
}
node);
goto out;
}
@@
-498,7
+492,8
@@
static int parse_kvlist (const char *key __rte_unused, const char *value, void *
info->list[info->count].node = strtol(node, &end, 10);
if ((errno != 0) || (*end != '\0')) {
info->list[info->count].node = strtol(node, &end, 10);
if ((errno != 0) || (*end != '\0')) {
- RTE_LOG(WARNING, PMD, "node value %s is unparseable as a number\n", node);
+ PMD_LOG(WARNING,
+ "node value %s is unparseable as a number", node);
goto out;
}
goto out;
}
@@
-542,14
+537,14
@@
rte_pmd_ring_probe(struct rte_vdev_device *dev)
name = rte_vdev_device_name(dev);
params = rte_vdev_device_args(dev);
name = rte_vdev_device_name(dev);
params = rte_vdev_device_args(dev);
-
RTE_LOG(INFO, PMD, "Initializing pmd_ring for %s\n
", name);
+
PMD_LOG(INFO, "Initializing pmd_ring for %s
", name);
if (params == NULL || params[0] == '\0') {
ret = eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE,
ð_dev);
if (ret == -1) {
if (params == NULL || params[0] == '\0') {
ret = eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE,
ð_dev);
if (ret == -1) {
-
RTE_LOG(INFO, PMD
,
- "Attach to pmd_ring for %s
\n
", name);
+
PMD_LOG(INFO
,
+ "Attach to pmd_ring for %s", name);
ret = eth_dev_ring_create(name, rte_socket_id(),
DEV_ATTACH, ð_dev);
}
ret = eth_dev_ring_create(name, rte_socket_id(),
DEV_ATTACH, ð_dev);
}
@@
-557,13
+552,13
@@
rte_pmd_ring_probe(struct rte_vdev_device *dev)
kvlist = rte_kvargs_parse(params, valid_arguments);
if (!kvlist) {
kvlist = rte_kvargs_parse(params, valid_arguments);
if (!kvlist) {
-
RTE_LOG(INFO, PMD
, "Ignoring unsupported parameters when creating"
- " rings-backed ethernet device
\n
");
+
PMD_LOG(INFO
, "Ignoring unsupported parameters when creating"
+ " rings-backed ethernet device");
ret = eth_dev_ring_create(name, rte_socket_id(),
DEV_CREATE, ð_dev);
if (ret == -1) {
ret = eth_dev_ring_create(name, rte_socket_id(),
DEV_CREATE, ð_dev);
if (ret == -1) {
-
RTE_LOG(INFO, PMD
,
- "Attach to pmd_ring for %s
\n
",
+
PMD_LOG(INFO
,
+ "Attach to pmd_ring for %s",
name);
ret = eth_dev_ring_create(name, rte_socket_id(),
DEV_ATTACH, ð_dev);
name);
ret = eth_dev_ring_create(name, rte_socket_id(),
DEV_ATTACH, ð_dev);
@@
-617,8
+612,8
@@
rte_pmd_ring_probe(struct rte_vdev_device *dev)
ð_dev);
if ((ret == -1) &&
(info->list[info->count].action == DEV_CREATE)) {
ð_dev);
if ((ret == -1) &&
(info->list[info->count].action == DEV_CREATE)) {
-
RTE_LOG(INFO, PMD
,
- "Attach to pmd_ring for %s
\n
",
+
PMD_LOG(INFO
,
+ "Attach to pmd_ring for %s",
name);
ret = eth_dev_ring_create(name,
info->list[info->count].node,
name);
ret = eth_dev_ring_create(name,
info->list[info->count].node,
@@
-647,7
+642,7
@@
rte_pmd_ring_remove(struct rte_vdev_device *dev)
struct ring_queue *r = NULL;
uint16_t i;
struct ring_queue *r = NULL;
uint16_t i;
-
RTE_LOG(INFO, PMD, "Un-Initializing pmd_ring for %s\n
", name);
+
PMD_LOG(INFO, "Un-Initializing pmd_ring for %s
", name);
if (name == NULL)
return -EINVAL;
if (name == NULL)
return -EINVAL;
@@
-675,8
+670,6
@@
rte_pmd_ring_remove(struct rte_vdev_device *dev)
rte_free(eth_dev->data->tx_queues);
rte_free(eth_dev->data->dev_private);
rte_free(eth_dev->data->tx_queues);
rte_free(eth_dev->data->dev_private);
- rte_free(eth_dev->data);
-
rte_eth_dev_release_port(eth_dev);
return 0;
}
rte_eth_dev_release_port(eth_dev);
return 0;
}
@@
-690,3
+683,12
@@
RTE_PMD_REGISTER_VDEV(net_ring, pmd_ring_drv);
RTE_PMD_REGISTER_ALIAS(net_ring, eth_ring);
RTE_PMD_REGISTER_PARAM_STRING(net_ring,
ETH_RING_NUMA_NODE_ACTION_ARG "=name:node:action(ATTACH|CREATE)");
RTE_PMD_REGISTER_ALIAS(net_ring, eth_ring);
RTE_PMD_REGISTER_PARAM_STRING(net_ring,
ETH_RING_NUMA_NODE_ACTION_ARG "=name:node:action(ATTACH|CREATE)");
+
+RTE_INIT(eth_ring_init_log);
+static void
+eth_ring_init_log(void)
+{
+ eth_ring_logtype = rte_log_register("pmd.net.ring");
+ if (eth_ring_logtype >= 0)
+ rte_log_set_level(eth_ring_logtype, RTE_LOG_NOTICE);
+}