ethdev: allow drivers to return error on close
[dpdk.git] / drivers / net / softnic / rte_eth_softnic.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2017 Intel Corporation
3  */
4
5 #include <stdint.h>
6 #include <stdlib.h>
7 #include <string.h>
8
9 #include <rte_ethdev_driver.h>
10 #include <rte_ethdev_vdev.h>
11 #include <rte_malloc.h>
12 #include <rte_bus_vdev.h>
13 #include <rte_kvargs.h>
14 #include <rte_errno.h>
15 #include <rte_ring.h>
16 #include <rte_tm_driver.h>
17 #include <rte_mtr_driver.h>
18
19 #include "rte_eth_softnic.h"
20 #include "rte_eth_softnic_internals.h"
21
22 #define PMD_PARAM_FIRMWARE                                 "firmware"
23 #define PMD_PARAM_CONN_PORT                                "conn_port"
24 #define PMD_PARAM_CPU_ID                                   "cpu_id"
25 #define PMD_PARAM_SC                                       "sc"
26 #define PMD_PARAM_TM_N_QUEUES                              "tm_n_queues"
27 #define PMD_PARAM_TM_QSIZE0                                "tm_qsize0"
28 #define PMD_PARAM_TM_QSIZE1                                "tm_qsize1"
29 #define PMD_PARAM_TM_QSIZE2                                "tm_qsize2"
30 #define PMD_PARAM_TM_QSIZE3                                "tm_qsize3"
31 #define PMD_PARAM_TM_QSIZE4                                "tm_qsize4"
32 #define PMD_PARAM_TM_QSIZE5                                "tm_qsize5"
33 #define PMD_PARAM_TM_QSIZE6                                "tm_qsize6"
34 #define PMD_PARAM_TM_QSIZE7                                "tm_qsize7"
35 #define PMD_PARAM_TM_QSIZE8                                "tm_qsize8"
36 #define PMD_PARAM_TM_QSIZE9                                "tm_qsize9"
37 #define PMD_PARAM_TM_QSIZE10                               "tm_qsize10"
38 #define PMD_PARAM_TM_QSIZE11                               "tm_qsize11"
39 #define PMD_PARAM_TM_QSIZE12                               "tm_qsize12"
40
41
42 static const char * const pmd_valid_args[] = {
43         PMD_PARAM_FIRMWARE,
44         PMD_PARAM_CONN_PORT,
45         PMD_PARAM_CPU_ID,
46         PMD_PARAM_SC,
47         PMD_PARAM_TM_N_QUEUES,
48         PMD_PARAM_TM_QSIZE0,
49         PMD_PARAM_TM_QSIZE1,
50         PMD_PARAM_TM_QSIZE2,
51         PMD_PARAM_TM_QSIZE3,
52         PMD_PARAM_TM_QSIZE4,
53         PMD_PARAM_TM_QSIZE5,
54         PMD_PARAM_TM_QSIZE6,
55         PMD_PARAM_TM_QSIZE7,
56         PMD_PARAM_TM_QSIZE8,
57         PMD_PARAM_TM_QSIZE9,
58         PMD_PARAM_TM_QSIZE10,
59         PMD_PARAM_TM_QSIZE11,
60         PMD_PARAM_TM_QSIZE12,
61         NULL
62 };
63
64 static const char welcome[] =
65         "\n"
66         "Welcome to Soft NIC!\n"
67         "\n";
68
69 static const char prompt[] = "softnic> ";
70
71 static const struct softnic_conn_params conn_params_default = {
72         .welcome = welcome,
73         .prompt = prompt,
74         .addr = "0.0.0.0",
75         .port = 0,
76         .buf_size = 1024 * 1024,
77         .msg_in_len_max = 1024,
78         .msg_out_len_max = 1024 * 1024,
79         .msg_handle = softnic_cli_process,
80         .msg_handle_arg = NULL,
81 };
82
83 RTE_LOG_REGISTER(pmd_softnic_logtype, pmd.net.softnic, NOTICE);
84
85 #define PMD_LOG(level, fmt, args...) \
86         rte_log(RTE_LOG_ ## level, pmd_softnic_logtype, \
87                 "%s(): " fmt "\n", __func__, ##args)
88
89 static int
90 pmd_dev_infos_get(struct rte_eth_dev *dev __rte_unused,
91         struct rte_eth_dev_info *dev_info)
92 {
93         dev_info->max_rx_pktlen = UINT32_MAX;
94         dev_info->max_rx_queues = UINT16_MAX;
95         dev_info->max_tx_queues = UINT16_MAX;
96
97         return 0;
98 }
99
100 static int
101 pmd_dev_configure(struct rte_eth_dev *dev __rte_unused)
102 {
103         return 0;
104 }
105
106 static int
107 pmd_rx_queue_setup(struct rte_eth_dev *dev,
108         uint16_t rx_queue_id,
109         uint16_t nb_rx_desc,
110         unsigned int socket_id __rte_unused,
111         const struct rte_eth_rxconf *rx_conf __rte_unused,
112         struct rte_mempool *mb_pool __rte_unused)
113 {
114         char name[NAME_SIZE];
115         struct pmd_internals *p = dev->data->dev_private;
116         struct softnic_swq *swq;
117
118         struct softnic_swq_params params = {
119                 .size = nb_rx_desc,
120         };
121
122         snprintf(name, sizeof(name), "RXQ%u", rx_queue_id);
123
124         swq = softnic_swq_create(p,
125                 name,
126                 &params);
127         if (swq == NULL)
128                 return -1;
129
130         dev->data->rx_queues[rx_queue_id] = swq->r;
131         return 0;
132 }
133
134 static int
135 pmd_tx_queue_setup(struct rte_eth_dev *dev,
136         uint16_t tx_queue_id,
137         uint16_t nb_tx_desc,
138         unsigned int socket_id __rte_unused,
139         const struct rte_eth_txconf *tx_conf __rte_unused)
140 {
141         char name[NAME_SIZE];
142         struct pmd_internals *p = dev->data->dev_private;
143         struct softnic_swq *swq;
144
145         struct softnic_swq_params params = {
146                 .size = nb_tx_desc,
147         };
148
149         snprintf(name, sizeof(name), "TXQ%u", tx_queue_id);
150
151         swq = softnic_swq_create(p,
152                 name,
153                 &params);
154         if (swq == NULL)
155                 return -1;
156
157         dev->data->tx_queues[tx_queue_id] = swq->r;
158         return 0;
159 }
160
161 static int
162 pmd_dev_start(struct rte_eth_dev *dev)
163 {
164         struct pmd_internals *p = dev->data->dev_private;
165         int status;
166
167         /* Firmware */
168         status = softnic_cli_script_process(p,
169                 p->params.firmware,
170                 conn_params_default.msg_in_len_max,
171                 conn_params_default.msg_out_len_max);
172         if (status)
173                 return status;
174
175         /* Link UP */
176         dev->data->dev_link.link_status = ETH_LINK_UP;
177
178         return 0;
179 }
180
181 static void
182 pmd_dev_stop(struct rte_eth_dev *dev)
183 {
184         struct pmd_internals *p = dev->data->dev_private;
185
186         /* Link DOWN */
187         dev->data->dev_link.link_status = ETH_LINK_DOWN;
188
189         /* Firmware */
190         softnic_pipeline_disable_all(p);
191         softnic_pipeline_free(p);
192         softnic_table_action_profile_free(p);
193         softnic_port_in_action_profile_free(p);
194         softnic_tap_free(p);
195         softnic_tmgr_free(p);
196         softnic_link_free(p);
197         softnic_softnic_swq_free_keep_rxq_txq(p);
198         softnic_mempool_free(p);
199
200         tm_hierarchy_free(p);
201         softnic_mtr_free(p);
202 }
203
204 static int
205 pmd_dev_close(struct rte_eth_dev *dev __rte_unused)
206 {
207         return 0;
208 }
209
210 static int
211 pmd_link_update(struct rte_eth_dev *dev __rte_unused,
212         int wait_to_complete __rte_unused)
213 {
214         return 0;
215 }
216
217 static int
218 pmd_filter_ctrl(struct rte_eth_dev *dev __rte_unused,
219                 enum rte_filter_type filter_type,
220                 enum rte_filter_op filter_op,
221                 void *arg)
222 {
223         if (filter_type == RTE_ETH_FILTER_GENERIC &&
224                         filter_op == RTE_ETH_FILTER_GET) {
225                 *(const void **)arg = &pmd_flow_ops;
226                 return 0;
227         }
228
229         return -ENOTSUP;
230 }
231
232 static int
233 pmd_tm_ops_get(struct rte_eth_dev *dev __rte_unused, void *arg)
234 {
235         *(const struct rte_tm_ops **)arg = &pmd_tm_ops;
236
237         return 0;
238 }
239
240 static int
241 pmd_mtr_ops_get(struct rte_eth_dev *dev __rte_unused, void *arg)
242 {
243         *(const struct rte_mtr_ops **)arg = &pmd_mtr_ops;
244
245         return 0;
246 }
247
248 static const struct eth_dev_ops pmd_ops = {
249         .dev_configure = pmd_dev_configure,
250         .dev_start = pmd_dev_start,
251         .dev_stop = pmd_dev_stop,
252         .dev_close = pmd_dev_close,
253         .link_update = pmd_link_update,
254         .dev_infos_get = pmd_dev_infos_get,
255         .rx_queue_setup = pmd_rx_queue_setup,
256         .tx_queue_setup = pmd_tx_queue_setup,
257         .filter_ctrl = pmd_filter_ctrl,
258         .tm_ops_get = pmd_tm_ops_get,
259         .mtr_ops_get = pmd_mtr_ops_get,
260 };
261
262 static uint16_t
263 pmd_rx_pkt_burst(void *rxq,
264         struct rte_mbuf **rx_pkts,
265         uint16_t nb_pkts)
266 {
267         return (uint16_t)rte_ring_sc_dequeue_burst(rxq,
268                 (void **)rx_pkts,
269                 nb_pkts,
270                 NULL);
271 }
272
273 static uint16_t
274 pmd_tx_pkt_burst(void *txq,
275         struct rte_mbuf **tx_pkts,
276         uint16_t nb_pkts)
277 {
278         return (uint16_t)rte_ring_sp_enqueue_burst(txq,
279                 (void **)tx_pkts,
280                 nb_pkts,
281                 NULL);
282 }
283
284 static void *
285 pmd_init(struct pmd_params *params)
286 {
287         struct pmd_internals *p;
288         int status;
289
290         p = rte_zmalloc_socket(params->name,
291                 sizeof(struct pmd_internals),
292                 0,
293                 params->cpu_id);
294         if (p == NULL)
295                 return NULL;
296
297         /* Params */
298         memcpy(&p->params, params, sizeof(p->params));
299
300         /* Resources */
301         tm_hierarchy_init(p);
302         softnic_mtr_init(p);
303
304         softnic_mempool_init(p);
305         softnic_swq_init(p);
306         softnic_link_init(p);
307         softnic_tmgr_init(p);
308         softnic_tap_init(p);
309         softnic_cryptodev_init(p);
310         softnic_port_in_action_profile_init(p);
311         softnic_table_action_profile_init(p);
312         softnic_pipeline_init(p);
313
314         status = softnic_thread_init(p);
315         if (status) {
316                 rte_free(p);
317                 return NULL;
318         }
319
320         if (params->conn_port) {
321                 struct softnic_conn_params conn_params;
322
323                 memcpy(&conn_params, &conn_params_default, sizeof(conn_params));
324                 conn_params.port = p->params.conn_port;
325                 conn_params.msg_handle_arg = p;
326
327                 p->conn = softnic_conn_init(&conn_params);
328                 if (p->conn == NULL) {
329                         softnic_thread_free(p);
330                         rte_free(p);
331                         return NULL;
332                 }
333         }
334
335         return p;
336 }
337
338 static void
339 pmd_free(struct pmd_internals *p)
340 {
341         if (p == NULL)
342                 return;
343
344         if (p->params.conn_port)
345                 softnic_conn_free(p->conn);
346
347         softnic_thread_free(p);
348         softnic_pipeline_free(p);
349         softnic_table_action_profile_free(p);
350         softnic_port_in_action_profile_free(p);
351         softnic_tap_free(p);
352         softnic_tmgr_free(p);
353         softnic_link_free(p);
354         softnic_swq_free(p);
355         softnic_mempool_free(p);
356
357         tm_hierarchy_free(p);
358         softnic_mtr_free(p);
359
360         rte_free(p);
361 }
362
363 static struct rte_ether_addr eth_addr = {
364         .addr_bytes = {0},
365 };
366
367 static int
368 pmd_ethdev_register(struct rte_vdev_device *vdev,
369         struct pmd_params *params,
370         void *dev_private)
371 {
372         struct rte_eth_dev *dev;
373
374         /* Ethdev entry allocation */
375         dev = rte_eth_dev_allocate(params->name);
376         if (!dev)
377                 return -ENOMEM;
378
379         /* dev */
380         dev->rx_pkt_burst = pmd_rx_pkt_burst;
381         dev->tx_pkt_burst = pmd_tx_pkt_burst;
382         dev->tx_pkt_prepare = NULL;
383         dev->dev_ops = &pmd_ops;
384         dev->device = &vdev->device;
385
386         /* dev->data */
387         dev->data->dev_private = dev_private;
388         dev->data->dev_link.link_speed = ETH_SPEED_NUM_100G;
389         dev->data->dev_link.link_duplex = ETH_LINK_FULL_DUPLEX;
390         dev->data->dev_link.link_autoneg = ETH_LINK_FIXED;
391         dev->data->dev_link.link_status = ETH_LINK_DOWN;
392         dev->data->mac_addrs = &eth_addr;
393         dev->data->promiscuous = 1;
394         dev->data->numa_node = params->cpu_id;
395
396         rte_eth_dev_probing_finish(dev);
397
398         return 0;
399 }
400
401 static int
402 get_string(const char *key __rte_unused, const char *value, void *extra_args)
403 {
404         if (!value || !extra_args)
405                 return -EINVAL;
406
407         *(char **)extra_args = strdup(value);
408
409         if (!*(char **)extra_args)
410                 return -ENOMEM;
411
412         return 0;
413 }
414
415 static int
416 get_uint32(const char *key __rte_unused, const char *value, void *extra_args)
417 {
418         if (!value || !extra_args)
419                 return -EINVAL;
420
421         *(uint32_t *)extra_args = strtoull(value, NULL, 0);
422
423         return 0;
424 }
425
426 static int
427 get_uint16(const char *key __rte_unused, const char *value, void *extra_args)
428 {
429         if (!value || !extra_args)
430                 return -EINVAL;
431
432         *(uint16_t *)extra_args = strtoull(value, NULL, 0);
433
434         return 0;
435 }
436
437 static int
438 pmd_parse_args(struct pmd_params *p, const char *params)
439 {
440         struct rte_kvargs *kvlist;
441         int ret = 0;
442
443         kvlist = rte_kvargs_parse(params, pmd_valid_args);
444         if (kvlist == NULL)
445                 return -EINVAL;
446
447         /* Set default values */
448         memset(p, 0, sizeof(*p));
449         p->firmware = SOFTNIC_FIRMWARE;
450         p->cpu_id = SOFTNIC_CPU_ID;
451         p->sc = SOFTNIC_SC;
452         p->tm.n_queues = SOFTNIC_TM_N_QUEUES;
453         p->tm.qsize[0] = SOFTNIC_TM_QUEUE_SIZE;
454         p->tm.qsize[1] = SOFTNIC_TM_QUEUE_SIZE;
455         p->tm.qsize[2] = SOFTNIC_TM_QUEUE_SIZE;
456         p->tm.qsize[3] = SOFTNIC_TM_QUEUE_SIZE;
457         p->tm.qsize[4] = SOFTNIC_TM_QUEUE_SIZE;
458         p->tm.qsize[5] = SOFTNIC_TM_QUEUE_SIZE;
459         p->tm.qsize[6] = SOFTNIC_TM_QUEUE_SIZE;
460         p->tm.qsize[7] = SOFTNIC_TM_QUEUE_SIZE;
461         p->tm.qsize[8] = SOFTNIC_TM_QUEUE_SIZE;
462         p->tm.qsize[9] = SOFTNIC_TM_QUEUE_SIZE;
463         p->tm.qsize[10] = SOFTNIC_TM_QUEUE_SIZE;
464         p->tm.qsize[11] = SOFTNIC_TM_QUEUE_SIZE;
465         p->tm.qsize[12] = SOFTNIC_TM_QUEUE_SIZE;
466
467         /* Firmware script (optional) */
468         if (rte_kvargs_count(kvlist, PMD_PARAM_FIRMWARE) == 1) {
469                 ret = rte_kvargs_process(kvlist, PMD_PARAM_FIRMWARE,
470                         &get_string, &p->firmware);
471                 if (ret < 0)
472                         goto out_free;
473         }
474
475         /* Connection listening port (optional) */
476         if (rte_kvargs_count(kvlist, PMD_PARAM_CONN_PORT) == 1) {
477                 ret = rte_kvargs_process(kvlist, PMD_PARAM_CONN_PORT,
478                         &get_uint16, &p->conn_port);
479                 if (ret < 0)
480                         goto out_free;
481         }
482
483         /* CPU ID (optional) */
484         if (rte_kvargs_count(kvlist, PMD_PARAM_CPU_ID) == 1) {
485                 ret = rte_kvargs_process(kvlist, PMD_PARAM_CPU_ID,
486                         &get_uint32, &p->cpu_id);
487                 if (ret < 0)
488                         goto out_free;
489         }
490
491         /* Service cores (optional) */
492         if (rte_kvargs_count(kvlist, PMD_PARAM_SC) == 1) {
493                 ret = rte_kvargs_process(kvlist, PMD_PARAM_SC,
494                         &get_uint32, &p->sc);
495                 if (ret < 0)
496                         goto out_free;
497         }
498
499         /* TM number of queues (optional) */
500         if (rte_kvargs_count(kvlist, PMD_PARAM_TM_N_QUEUES) == 1) {
501                 ret = rte_kvargs_process(kvlist, PMD_PARAM_TM_N_QUEUES,
502                         &get_uint32, &p->tm.n_queues);
503                 if (ret < 0)
504                         goto out_free;
505         }
506
507         /* TM queue size 0 .. 3 (optional) */
508         if (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE0) == 1) {
509                 ret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE0,
510                         &get_uint32, &p->tm.qsize[0]);
511                 if (ret < 0)
512                         goto out_free;
513         }
514
515         if (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE1) == 1) {
516                 ret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE1,
517                         &get_uint32, &p->tm.qsize[1]);
518                 if (ret < 0)
519                         goto out_free;
520         }
521
522         if (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE2) == 1) {
523                 ret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE2,
524                         &get_uint32, &p->tm.qsize[2]);
525                 if (ret < 0)
526                         goto out_free;
527         }
528
529         if (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE3) == 1) {
530                 ret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE3,
531                         &get_uint32, &p->tm.qsize[3]);
532                 if (ret < 0)
533                         goto out_free;
534         }
535
536         if (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE4) == 1) {
537                 ret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE4,
538                         &get_uint32, &p->tm.qsize[4]);
539                 if (ret < 0)
540                         goto out_free;
541         }
542
543         if (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE5) == 1) {
544                 ret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE5,
545                         &get_uint32, &p->tm.qsize[5]);
546                 if (ret < 0)
547                         goto out_free;
548         }
549
550         if (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE6) == 1) {
551                 ret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE6,
552                         &get_uint32, &p->tm.qsize[6]);
553                 if (ret < 0)
554                         goto out_free;
555         }
556
557         if (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE7) == 1) {
558                 ret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE7,
559                         &get_uint32, &p->tm.qsize[7]);
560                 if (ret < 0)
561                         goto out_free;
562         }
563         if (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE8) == 1) {
564                 ret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE8,
565                         &get_uint32, &p->tm.qsize[8]);
566                 if (ret < 0)
567                         goto out_free;
568         }
569         if (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE9) == 1) {
570                 ret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE9,
571                         &get_uint32, &p->tm.qsize[9]);
572                 if (ret < 0)
573                         goto out_free;
574         }
575
576         if (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE10) == 1) {
577                 ret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE10,
578                         &get_uint32, &p->tm.qsize[10]);
579                 if (ret < 0)
580                         goto out_free;
581         }
582
583         if (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE11) == 1) {
584                 ret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE11,
585                         &get_uint32, &p->tm.qsize[11]);
586                 if (ret < 0)
587                         goto out_free;
588         }
589
590         if (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE12) == 1) {
591                 ret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE12,
592                         &get_uint32, &p->tm.qsize[12]);
593                 if (ret < 0)
594                         goto out_free;
595         }
596
597 out_free:
598         rte_kvargs_free(kvlist);
599         return ret;
600 }
601
602 static int
603 pmd_probe(struct rte_vdev_device *vdev)
604 {
605         struct pmd_params p;
606         const char *params;
607         int status = 0;
608
609         void *dev_private;
610         const char *name = rte_vdev_device_name(vdev);
611
612         PMD_LOG(INFO, "Probing device \"%s\"", name);
613
614         /* Parse input arguments */
615         params = rte_vdev_device_args(vdev);
616         if (!params)
617                 return -EINVAL;
618
619         status = pmd_parse_args(&p, params);
620         if (status)
621                 return status;
622
623         p.name = name;
624
625         /* Allocate and initialize soft ethdev private data */
626         dev_private = pmd_init(&p);
627         if (dev_private == NULL)
628                 return -ENOMEM;
629
630         /* Register soft ethdev */
631         PMD_LOG(INFO, "Creating soft ethdev \"%s\"", p.name);
632
633         status = pmd_ethdev_register(vdev, &p, dev_private);
634         if (status) {
635                 pmd_free(dev_private);
636                 return status;
637         }
638
639         return 0;
640 }
641
642 static int
643 pmd_remove(struct rte_vdev_device *vdev)
644 {
645         struct rte_eth_dev *dev = NULL;
646
647         if (!vdev)
648                 return -EINVAL;
649
650         PMD_LOG(INFO, "Removing device \"%s\"", rte_vdev_device_name(vdev));
651
652         /* Find the ethdev entry */
653         dev = rte_eth_dev_allocated(rte_vdev_device_name(vdev));
654         if (dev == NULL)
655                 return -ENODEV;
656
657         /* Free device data structures*/
658         pmd_free(dev->data->dev_private);
659         dev->data->dev_private = NULL; /* already freed */
660         dev->data->mac_addrs = NULL; /* statically allocated */
661         rte_eth_dev_release_port(dev);
662
663         return 0;
664 }
665
666 static struct rte_vdev_driver pmd_softnic_drv = {
667         .probe = pmd_probe,
668         .remove = pmd_remove,
669 };
670
671 RTE_PMD_REGISTER_VDEV(net_softnic, pmd_softnic_drv);
672 RTE_PMD_REGISTER_PARAM_STRING(net_softnic,
673         PMD_PARAM_FIRMWARE "=<string> "
674         PMD_PARAM_CONN_PORT "=<uint16> "
675         PMD_PARAM_CPU_ID "=<uint32> "
676         PMD_PARAM_TM_N_QUEUES "=<uint32> "
677         PMD_PARAM_TM_QSIZE0 "=<uint32> "
678         PMD_PARAM_TM_QSIZE1 "=<uint32> "
679         PMD_PARAM_TM_QSIZE2 "=<uint32> "
680         PMD_PARAM_TM_QSIZE3 "=<uint32>"
681         PMD_PARAM_TM_QSIZE4 "=<uint32> "
682         PMD_PARAM_TM_QSIZE5 "=<uint32> "
683         PMD_PARAM_TM_QSIZE6 "=<uint32> "
684         PMD_PARAM_TM_QSIZE7 "=<uint32> "
685         PMD_PARAM_TM_QSIZE8 "=<uint32> "
686         PMD_PARAM_TM_QSIZE9 "=<uint32> "
687         PMD_PARAM_TM_QSIZE10 "=<uint32> "
688         PMD_PARAM_TM_QSIZE11 "=<uint32>"
689         PMD_PARAM_TM_QSIZE12 "=<uint32>"
690 );
691
692 int
693 rte_pmd_softnic_manage(uint16_t port_id)
694 {
695         struct rte_eth_dev *dev = &rte_eth_devices[port_id];
696         struct pmd_internals *softnic;
697
698 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
699         RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
700 #endif
701
702         softnic = dev->data->dev_private;
703
704         softnic_conn_poll_for_conn(softnic->conn);
705
706         softnic_conn_poll_for_msg(softnic->conn);
707
708         return 0;
709 }