net/bnxt: add PCI IDs for 57500 series NPAR devices
[dpdk.git] / drivers / net / ring / rte_eth_ring.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2015 Intel Corporation
3  */
4
5 #include "rte_eth_ring.h"
6 #include <rte_mbuf.h>
7 #include <rte_ethdev_driver.h>
8 #include <rte_malloc.h>
9 #include <rte_memcpy.h>
10 #include <rte_string_fns.h>
11 #include <rte_bus_vdev.h>
12 #include <rte_kvargs.h>
13 #include <rte_errno.h>
14
15 #define ETH_RING_NUMA_NODE_ACTION_ARG   "nodeaction"
16 #define ETH_RING_ACTION_CREATE          "CREATE"
17 #define ETH_RING_ACTION_ATTACH          "ATTACH"
18 #define ETH_RING_INTERNAL_ARG           "internal"
19
20 static const char *valid_arguments[] = {
21         ETH_RING_NUMA_NODE_ACTION_ARG,
22         ETH_RING_INTERNAL_ARG,
23         NULL
24 };
25
26 struct ring_internal_args {
27         struct rte_ring * const *rx_queues;
28         const unsigned int nb_rx_queues;
29         struct rte_ring * const *tx_queues;
30         const unsigned int nb_tx_queues;
31         const unsigned int numa_node;
32         void *addr; /* self addr for sanity check */
33 };
34
35 enum dev_action {
36         DEV_CREATE,
37         DEV_ATTACH
38 };
39
40 struct ring_queue {
41         struct rte_ring *rng;
42         rte_atomic64_t rx_pkts;
43         rte_atomic64_t tx_pkts;
44 };
45
46 struct pmd_internals {
47         unsigned int max_rx_queues;
48         unsigned int max_tx_queues;
49
50         struct ring_queue rx_ring_queues[RTE_PMD_RING_MAX_RX_RINGS];
51         struct ring_queue tx_ring_queues[RTE_PMD_RING_MAX_TX_RINGS];
52
53         struct rte_ether_addr address;
54         enum dev_action action;
55 };
56
57 static struct rte_eth_link pmd_link = {
58         .link_speed = ETH_SPEED_NUM_10G,
59         .link_duplex = ETH_LINK_FULL_DUPLEX,
60         .link_status = ETH_LINK_DOWN,
61         .link_autoneg = ETH_LINK_FIXED,
62 };
63
64 static int eth_ring_logtype;
65
66 #define PMD_LOG(level, fmt, args...) \
67         rte_log(RTE_LOG_ ## level, eth_ring_logtype, \
68                 "%s(): " fmt "\n", __func__, ##args)
69
70 static uint16_t
71 eth_ring_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
72 {
73         void **ptrs = (void *)&bufs[0];
74         struct ring_queue *r = q;
75         const uint16_t nb_rx = (uint16_t)rte_ring_dequeue_burst(r->rng,
76                         ptrs, nb_bufs, NULL);
77         if (r->rng->flags & RING_F_SC_DEQ)
78                 r->rx_pkts.cnt += nb_rx;
79         else
80                 rte_atomic64_add(&(r->rx_pkts), nb_rx);
81         return nb_rx;
82 }
83
84 static uint16_t
85 eth_ring_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
86 {
87         void **ptrs = (void *)&bufs[0];
88         struct ring_queue *r = q;
89         const uint16_t nb_tx = (uint16_t)rte_ring_enqueue_burst(r->rng,
90                         ptrs, nb_bufs, NULL);
91         if (r->rng->flags & RING_F_SP_ENQ)
92                 r->tx_pkts.cnt += nb_tx;
93         else
94                 rte_atomic64_add(&(r->tx_pkts), nb_tx);
95         return nb_tx;
96 }
97
98 static int
99 eth_dev_configure(struct rte_eth_dev *dev __rte_unused) { return 0; }
100
101 static int
102 eth_dev_start(struct rte_eth_dev *dev)
103 {
104         dev->data->dev_link.link_status = ETH_LINK_UP;
105         return 0;
106 }
107
108 static void
109 eth_dev_stop(struct rte_eth_dev *dev)
110 {
111         dev->data->dev_link.link_status = ETH_LINK_DOWN;
112 }
113
114 static int
115 eth_dev_set_link_down(struct rte_eth_dev *dev)
116 {
117         dev->data->dev_link.link_status = ETH_LINK_DOWN;
118         return 0;
119 }
120
121 static int
122 eth_dev_set_link_up(struct rte_eth_dev *dev)
123 {
124         dev->data->dev_link.link_status = ETH_LINK_UP;
125         return 0;
126 }
127
128 static int
129 eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
130                                     uint16_t nb_rx_desc __rte_unused,
131                                     unsigned int socket_id __rte_unused,
132                                     const struct rte_eth_rxconf *rx_conf __rte_unused,
133                                     struct rte_mempool *mb_pool __rte_unused)
134 {
135         struct pmd_internals *internals = dev->data->dev_private;
136
137         dev->data->rx_queues[rx_queue_id] = &internals->rx_ring_queues[rx_queue_id];
138         return 0;
139 }
140
141 static int
142 eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
143                                     uint16_t nb_tx_desc __rte_unused,
144                                     unsigned int socket_id __rte_unused,
145                                     const struct rte_eth_txconf *tx_conf __rte_unused)
146 {
147         struct pmd_internals *internals = dev->data->dev_private;
148
149         dev->data->tx_queues[tx_queue_id] = &internals->tx_ring_queues[tx_queue_id];
150         return 0;
151 }
152
153
154 static int
155 eth_dev_info(struct rte_eth_dev *dev,
156              struct rte_eth_dev_info *dev_info)
157 {
158         struct pmd_internals *internals = dev->data->dev_private;
159
160         dev_info->max_mac_addrs = 1;
161         dev_info->max_rx_pktlen = (uint32_t)-1;
162         dev_info->max_rx_queues = (uint16_t)internals->max_rx_queues;
163         dev_info->max_tx_queues = (uint16_t)internals->max_tx_queues;
164         dev_info->min_rx_bufsize = 0;
165
166         return 0;
167 }
168
169 static int
170 eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
171 {
172         unsigned int i;
173         unsigned long rx_total = 0, tx_total = 0;
174         const struct pmd_internals *internal = dev->data->dev_private;
175
176         for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS &&
177                         i < dev->data->nb_rx_queues; i++) {
178                 stats->q_ipackets[i] = internal->rx_ring_queues[i].rx_pkts.cnt;
179                 rx_total += stats->q_ipackets[i];
180         }
181
182         for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS &&
183                         i < dev->data->nb_tx_queues; i++) {
184                 stats->q_opackets[i] = internal->tx_ring_queues[i].tx_pkts.cnt;
185                 tx_total += stats->q_opackets[i];
186         }
187
188         stats->ipackets = rx_total;
189         stats->opackets = tx_total;
190
191         return 0;
192 }
193
194 static int
195 eth_stats_reset(struct rte_eth_dev *dev)
196 {
197         unsigned int i;
198         struct pmd_internals *internal = dev->data->dev_private;
199
200         for (i = 0; i < dev->data->nb_rx_queues; i++)
201                 internal->rx_ring_queues[i].rx_pkts.cnt = 0;
202         for (i = 0; i < dev->data->nb_tx_queues; i++)
203                 internal->tx_ring_queues[i].tx_pkts.cnt = 0;
204
205         return 0;
206 }
207
208 static void
209 eth_mac_addr_remove(struct rte_eth_dev *dev __rte_unused,
210         uint32_t index __rte_unused)
211 {
212 }
213
214 static int
215 eth_mac_addr_add(struct rte_eth_dev *dev __rte_unused,
216         struct rte_ether_addr *mac_addr __rte_unused,
217         uint32_t index __rte_unused,
218         uint32_t vmdq __rte_unused)
219 {
220         return 0;
221 }
222
223 static void
224 eth_queue_release(void *q __rte_unused) { ; }
225 static int
226 eth_link_update(struct rte_eth_dev *dev __rte_unused,
227                 int wait_to_complete __rte_unused) { return 0; }
228
229 static const struct eth_dev_ops ops = {
230         .dev_start = eth_dev_start,
231         .dev_stop = eth_dev_stop,
232         .dev_set_link_up = eth_dev_set_link_up,
233         .dev_set_link_down = eth_dev_set_link_down,
234         .dev_configure = eth_dev_configure,
235         .dev_infos_get = eth_dev_info,
236         .rx_queue_setup = eth_rx_queue_setup,
237         .tx_queue_setup = eth_tx_queue_setup,
238         .rx_queue_release = eth_queue_release,
239         .tx_queue_release = eth_queue_release,
240         .link_update = eth_link_update,
241         .stats_get = eth_stats_get,
242         .stats_reset = eth_stats_reset,
243         .mac_addr_remove = eth_mac_addr_remove,
244         .mac_addr_add = eth_mac_addr_add,
245 };
246
247 static int
248 do_eth_dev_ring_create(const char *name,
249                 struct rte_ring * const rx_queues[],
250                 const unsigned int nb_rx_queues,
251                 struct rte_ring *const tx_queues[],
252                 const unsigned int nb_tx_queues,
253                 const unsigned int numa_node, enum dev_action action,
254                 struct rte_eth_dev **eth_dev_p)
255 {
256         struct rte_eth_dev_data *data = NULL;
257         struct pmd_internals *internals = NULL;
258         struct rte_eth_dev *eth_dev = NULL;
259         void **rx_queues_local = NULL;
260         void **tx_queues_local = NULL;
261         unsigned int i;
262
263         PMD_LOG(INFO, "Creating rings-backed ethdev on numa socket %u",
264                         numa_node);
265
266         rx_queues_local = rte_calloc_socket(name, nb_rx_queues,
267                                             sizeof(void *), 0, numa_node);
268         if (rx_queues_local == NULL) {
269                 rte_errno = ENOMEM;
270                 goto error;
271         }
272
273         tx_queues_local = rte_calloc_socket(name, nb_tx_queues,
274                                             sizeof(void *), 0, numa_node);
275         if (tx_queues_local == NULL) {
276                 rte_errno = ENOMEM;
277                 goto error;
278         }
279
280         internals = rte_zmalloc_socket(name, sizeof(*internals), 0, numa_node);
281         if (internals == NULL) {
282                 rte_errno = ENOMEM;
283                 goto error;
284         }
285
286         /* reserve an ethdev entry */
287         eth_dev = rte_eth_dev_allocate(name);
288         if (eth_dev == NULL) {
289                 rte_errno = ENOSPC;
290                 goto error;
291         }
292
293         /* now put it all together
294          * - store queue data in internals,
295          * - store numa_node info in eth_dev_data
296          * - point eth_dev_data to internals
297          * - and point eth_dev structure to new eth_dev_data structure
298          */
299
300         data = eth_dev->data;
301         data->rx_queues = rx_queues_local;
302         data->tx_queues = tx_queues_local;
303
304         internals->action = action;
305         internals->max_rx_queues = nb_rx_queues;
306         internals->max_tx_queues = nb_tx_queues;
307         for (i = 0; i < nb_rx_queues; i++) {
308                 internals->rx_ring_queues[i].rng = rx_queues[i];
309                 data->rx_queues[i] = &internals->rx_ring_queues[i];
310         }
311         for (i = 0; i < nb_tx_queues; i++) {
312                 internals->tx_ring_queues[i].rng = tx_queues[i];
313                 data->tx_queues[i] = &internals->tx_ring_queues[i];
314         }
315
316         data->dev_private = internals;
317         data->nb_rx_queues = (uint16_t)nb_rx_queues;
318         data->nb_tx_queues = (uint16_t)nb_tx_queues;
319         data->dev_link = pmd_link;
320         data->mac_addrs = &internals->address;
321         data->promiscuous = 1;
322         data->all_multicast = 1;
323
324         eth_dev->dev_ops = &ops;
325         data->kdrv = RTE_KDRV_NONE;
326         data->numa_node = numa_node;
327
328         /* finally assign rx and tx ops */
329         eth_dev->rx_pkt_burst = eth_ring_rx;
330         eth_dev->tx_pkt_burst = eth_ring_tx;
331
332         rte_eth_dev_probing_finish(eth_dev);
333         *eth_dev_p = eth_dev;
334
335         return data->port_id;
336
337 error:
338         rte_free(rx_queues_local);
339         rte_free(tx_queues_local);
340         rte_free(internals);
341
342         return -1;
343 }
344
345 int
346 rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
347                 const unsigned int nb_rx_queues,
348                 struct rte_ring *const tx_queues[],
349                 const unsigned int nb_tx_queues,
350                 const unsigned int numa_node)
351 {
352         struct ring_internal_args args = {
353                 .rx_queues = rx_queues,
354                 .nb_rx_queues = nb_rx_queues,
355                 .tx_queues = tx_queues,
356                 .nb_tx_queues = nb_tx_queues,
357                 .numa_node = numa_node,
358                 .addr = &args,
359         };
360         char args_str[32];
361         char ring_name[RTE_RING_NAMESIZE];
362         uint16_t port_id = RTE_MAX_ETHPORTS;
363         int ret;
364
365         /* do some parameter checking */
366         if (rx_queues == NULL && nb_rx_queues > 0) {
367                 rte_errno = EINVAL;
368                 return -1;
369         }
370         if (tx_queues == NULL && nb_tx_queues > 0) {
371                 rte_errno = EINVAL;
372                 return -1;
373         }
374         if (nb_rx_queues > RTE_PMD_RING_MAX_RX_RINGS) {
375                 rte_errno = EINVAL;
376                 return -1;
377         }
378
379         snprintf(args_str, sizeof(args_str), "%s=%p",
380                  ETH_RING_INTERNAL_ARG, &args);
381
382         ret = snprintf(ring_name, sizeof(ring_name), "net_ring_%s", name);
383         if (ret >= (int)sizeof(ring_name)) {
384                 rte_errno = ENAMETOOLONG;
385                 return -1;
386         }
387
388         ret = rte_vdev_init(ring_name, args_str);
389         if (ret) {
390                 rte_errno = EINVAL;
391                 return -1;
392         }
393
394         ret = rte_eth_dev_get_port_by_name(ring_name, &port_id);
395         if (ret) {
396                 rte_errno = ENODEV;
397                 return -1;
398         }
399
400         return port_id;
401 }
402
403 int
404 rte_eth_from_ring(struct rte_ring *r)
405 {
406         return rte_eth_from_rings(r->name, &r, 1, &r, 1,
407                         r->memzone ? r->memzone->socket_id : SOCKET_ID_ANY);
408 }
409
410 static int
411 eth_dev_ring_create(const char *name, const unsigned int numa_node,
412                 enum dev_action action, struct rte_eth_dev **eth_dev)
413 {
414         /* rx and tx are so-called from point of view of first port.
415          * They are inverted from the point of view of second port
416          */
417         struct rte_ring *rxtx[RTE_PMD_RING_MAX_RX_RINGS];
418         unsigned int i;
419         char rng_name[RTE_RING_NAMESIZE];
420         unsigned int num_rings = RTE_MIN(RTE_PMD_RING_MAX_RX_RINGS,
421                         RTE_PMD_RING_MAX_TX_RINGS);
422
423         for (i = 0; i < num_rings; i++) {
424                 int cc;
425
426                 cc = snprintf(rng_name, sizeof(rng_name),
427                               "ETH_RXTX%u_%s", i, name);
428                 if (cc >= (int)sizeof(rng_name)) {
429                         rte_errno = ENAMETOOLONG;
430                         return -1;
431                 }
432
433                 rxtx[i] = (action == DEV_CREATE) ?
434                                 rte_ring_create(rng_name, 1024, numa_node,
435                                                 RING_F_SP_ENQ|RING_F_SC_DEQ) :
436                                 rte_ring_lookup(rng_name);
437                 if (rxtx[i] == NULL)
438                         return -1;
439         }
440
441         if (do_eth_dev_ring_create(name, rxtx, num_rings, rxtx, num_rings,
442                 numa_node, action, eth_dev) < 0)
443                 return -1;
444
445         return 0;
446 }
447
448 struct node_action_pair {
449         char name[PATH_MAX];
450         unsigned int node;
451         enum dev_action action;
452 };
453
454 struct node_action_list {
455         unsigned int total;
456         unsigned int count;
457         struct node_action_pair *list;
458 };
459
460 static int parse_kvlist(const char *key __rte_unused,
461                         const char *value, void *data)
462 {
463         struct node_action_list *info = data;
464         int ret;
465         char *name;
466         char *action;
467         char *node;
468         char *end;
469
470         name = strdup(value);
471
472         ret = -EINVAL;
473
474         if (!name) {
475                 PMD_LOG(WARNING, "command line parameter is empty for ring pmd!");
476                 goto out;
477         }
478
479         node = strchr(name, ':');
480         if (!node) {
481                 PMD_LOG(WARNING, "could not parse node value from %s",
482                         name);
483                 goto out;
484         }
485
486         *node = '\0';
487         node++;
488
489         action = strchr(node, ':');
490         if (!action) {
491                 PMD_LOG(WARNING, "could not parse action value from %s",
492                         node);
493                 goto out;
494         }
495
496         *action = '\0';
497         action++;
498
499         /*
500          * Need to do some sanity checking here
501          */
502
503         if (strcmp(action, ETH_RING_ACTION_ATTACH) == 0)
504                 info->list[info->count].action = DEV_ATTACH;
505         else if (strcmp(action, ETH_RING_ACTION_CREATE) == 0)
506                 info->list[info->count].action = DEV_CREATE;
507         else
508                 goto out;
509
510         errno = 0;
511         info->list[info->count].node = strtol(node, &end, 10);
512
513         if ((errno != 0) || (*end != '\0')) {
514                 PMD_LOG(WARNING,
515                         "node value %s is unparseable as a number", node);
516                 goto out;
517         }
518
519         strlcpy(info->list[info->count].name, name,
520                 sizeof(info->list[info->count].name));
521
522         info->count++;
523
524         ret = 0;
525 out:
526         free(name);
527         return ret;
528 }
529
530 static int
531 parse_internal_args(const char *key __rte_unused, const char *value,
532                 void *data)
533 {
534         struct ring_internal_args **internal_args = data;
535         void *args;
536
537         sscanf(value, "%p", &args);
538
539         *internal_args = args;
540
541         if ((*internal_args)->addr != args)
542                 return -1;
543
544         return 0;
545 }
546
547 static int
548 rte_pmd_ring_probe(struct rte_vdev_device *dev)
549 {
550         const char *name, *params;
551         struct rte_kvargs *kvlist = NULL;
552         int ret = 0;
553         struct node_action_list *info = NULL;
554         struct rte_eth_dev *eth_dev = NULL;
555         struct ring_internal_args *internal_args;
556
557         name = rte_vdev_device_name(dev);
558         params = rte_vdev_device_args(dev);
559
560         PMD_LOG(INFO, "Initializing pmd_ring for %s", name);
561
562         if (params == NULL || params[0] == '\0') {
563                 ret = eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE,
564                                 &eth_dev);
565                 if (ret == -1) {
566                         PMD_LOG(INFO,
567                                 "Attach to pmd_ring for %s", name);
568                         ret = eth_dev_ring_create(name, rte_socket_id(),
569                                                   DEV_ATTACH, &eth_dev);
570                 }
571         } else {
572                 kvlist = rte_kvargs_parse(params, valid_arguments);
573
574                 if (!kvlist) {
575                         PMD_LOG(INFO,
576                                 "Ignoring unsupported parameters when creatingrings-backed ethernet device");
577                         ret = eth_dev_ring_create(name, rte_socket_id(),
578                                                   DEV_CREATE, &eth_dev);
579                         if (ret == -1) {
580                                 PMD_LOG(INFO,
581                                         "Attach to pmd_ring for %s",
582                                         name);
583                                 ret = eth_dev_ring_create(name, rte_socket_id(),
584                                                           DEV_ATTACH, &eth_dev);
585                         }
586
587                         if (eth_dev)
588                                 eth_dev->device = &dev->device;
589
590                         return ret;
591                 }
592
593                 if (rte_kvargs_count(kvlist, ETH_RING_INTERNAL_ARG) == 1) {
594                         ret = rte_kvargs_process(kvlist, ETH_RING_INTERNAL_ARG,
595                                                  parse_internal_args,
596                                                  &internal_args);
597                         if (ret < 0)
598                                 goto out_free;
599
600                         ret = do_eth_dev_ring_create(name,
601                                 internal_args->rx_queues,
602                                 internal_args->nb_rx_queues,
603                                 internal_args->tx_queues,
604                                 internal_args->nb_tx_queues,
605                                 internal_args->numa_node,
606                                 DEV_ATTACH,
607                                 &eth_dev);
608                         if (ret >= 0)
609                                 ret = 0;
610                 } else {
611                         ret = rte_kvargs_count(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG);
612                         info = rte_zmalloc("struct node_action_list",
613                                            sizeof(struct node_action_list) +
614                                            (sizeof(struct node_action_pair) * ret),
615                                            0);
616                         if (!info)
617                                 goto out_free;
618
619                         info->total = ret;
620                         info->list = (struct node_action_pair *)(info + 1);
621
622                         ret = rte_kvargs_process(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG,
623                                                  parse_kvlist, info);
624
625                         if (ret < 0)
626                                 goto out_free;
627
628                         for (info->count = 0; info->count < info->total; info->count++) {
629                                 ret = eth_dev_ring_create(info->list[info->count].name,
630                                                           info->list[info->count].node,
631                                                           info->list[info->count].action,
632                                                           &eth_dev);
633                                 if ((ret == -1) &&
634                                     (info->list[info->count].action == DEV_CREATE)) {
635                                         PMD_LOG(INFO,
636                                                 "Attach to pmd_ring for %s",
637                                                 name);
638                                         ret = eth_dev_ring_create(name,
639                                                         info->list[info->count].node,
640                                                         DEV_ATTACH,
641                                                         &eth_dev);
642                                 }
643                         }
644                 }
645         }
646
647         if (eth_dev)
648                 eth_dev->device = &dev->device;
649
650 out_free:
651         rte_kvargs_free(kvlist);
652         rte_free(info);
653         return ret;
654 }
655
656 static int
657 rte_pmd_ring_remove(struct rte_vdev_device *dev)
658 {
659         const char *name = rte_vdev_device_name(dev);
660         struct rte_eth_dev *eth_dev = NULL;
661         struct pmd_internals *internals = NULL;
662         struct ring_queue *r = NULL;
663         uint16_t i;
664
665         PMD_LOG(INFO, "Un-Initializing pmd_ring for %s", name);
666
667         if (name == NULL)
668                 return -EINVAL;
669
670         /* find an ethdev entry */
671         eth_dev = rte_eth_dev_allocated(name);
672         if (eth_dev == NULL)
673                 return -ENODEV;
674
675         eth_dev_stop(eth_dev);
676
677         internals = eth_dev->data->dev_private;
678         if (internals->action == DEV_CREATE) {
679                 /*
680                  * it is only necessary to delete the rings in rx_queues because
681                  * they are the same used in tx_queues
682                  */
683                 for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
684                         r = eth_dev->data->rx_queues[i];
685                         rte_ring_free(r->rng);
686                 }
687         }
688
689         /* mac_addrs must not be freed alone because part of dev_private */
690         eth_dev->data->mac_addrs = NULL;
691         rte_eth_dev_release_port(eth_dev);
692         return 0;
693 }
694
695 static struct rte_vdev_driver pmd_ring_drv = {
696         .probe = rte_pmd_ring_probe,
697         .remove = rte_pmd_ring_remove,
698 };
699
700 RTE_PMD_REGISTER_VDEV(net_ring, pmd_ring_drv);
701 RTE_PMD_REGISTER_ALIAS(net_ring, eth_ring);
702 RTE_PMD_REGISTER_PARAM_STRING(net_ring,
703         ETH_RING_NUMA_NODE_ACTION_ARG "=name:node:action(ATTACH|CREATE)");
704
705 RTE_INIT(eth_ring_init_log)
706 {
707         eth_ring_logtype = rte_log_register("pmd.net.ring");
708         if (eth_ring_logtype >= 0)
709                 rte_log_set_level(eth_ring_logtype, RTE_LOG_NOTICE);
710 }