1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2018 Intel Corporation
8 #include <rte_string_fns.h>
10 #include "rte_eth_softnic_internals.h"
13 softnic_swq_init(struct pmd_internals *p)
15 TAILQ_INIT(&p->swq_list);
21 softnic_swq_free(struct pmd_internals *p)
24 struct softnic_swq *swq;
26 swq = TAILQ_FIRST(&p->swq_list);
30 TAILQ_REMOVE(&p->swq_list, swq, node);
31 rte_ring_free(swq->r);
37 softnic_softnic_swq_free_keep_rxq_txq(struct pmd_internals *p)
39 struct softnic_swq *swq;
41 TAILQ_FOREACH(swq, &p->swq_list, node) {
42 if ((strncmp(swq->name, "RXQ", strlen("RXQ")) == 0) ||
43 (strncmp(swq->name, "TXQ", strlen("TXQ")) == 0))
46 TAILQ_REMOVE(&p->swq_list, swq, node);
47 rte_ring_free(swq->r);
53 softnic_swq_find(struct pmd_internals *p,
56 struct softnic_swq *swq;
61 TAILQ_FOREACH(swq, &p->swq_list, node)
62 if (strcmp(swq->name, name) == 0)
69 softnic_swq_create(struct pmd_internals *p,
71 struct softnic_swq_params *params)
73 char ring_name[NAME_SIZE];
74 struct softnic_swq *swq;
76 unsigned int flags = RING_F_SP_ENQ | RING_F_SC_DEQ;
78 /* Check input params */
80 softnic_swq_find(p, name) ||
86 snprintf(ring_name, sizeof(ring_name), "%s_%s",
90 r = rte_ring_create(ring_name,
99 swq = calloc(1, sizeof(struct softnic_swq));
106 strlcpy(swq->name, name, sizeof(swq->name));
109 /* Node add to list */
110 TAILQ_INSERT_TAIL(&p->swq_list, swq, node);