1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019 Cesnet
3 * Copyright(c) 2019 Netcope Technologies, a.s. <info@netcope.com>
11 nfb_eth_rx_queue_start(struct rte_eth_dev
*dev
, uint16_t rxq_id
)
13 struct ndp_rx_queue
*rxq
= dev
->data
->rx_queues
[rxq_id
];
16 if (rxq
->queue
== NULL
) {
17 RTE_LOG(ERR
, PMD
, "RX NDP queue is NULL!\n");
21 ret
= ndp_queue_start(rxq
->queue
);
24 dev
->data
->rx_queue_state
[rxq_id
] = RTE_ETH_QUEUE_STATE_STARTED
;
32 nfb_eth_rx_queue_stop(struct rte_eth_dev
*dev
, uint16_t rxq_id
)
34 struct ndp_rx_queue
*rxq
= dev
->data
->rx_queues
[rxq_id
];
37 if (rxq
->queue
== NULL
) {
38 RTE_LOG(ERR
, PMD
, "RX NDP queue is NULL!\n");
42 ret
= ndp_queue_stop(rxq
->queue
);
46 dev
->data
->rx_queue_state
[rxq_id
] = RTE_ETH_QUEUE_STATE_STOPPED
;
51 nfb_eth_rx_queue_setup(struct rte_eth_dev
*dev
,
53 uint16_t nb_rx_desc __rte_unused
,
54 unsigned int socket_id
,
55 const struct rte_eth_rxconf
*rx_conf __rte_unused
,
56 struct rte_mempool
*mb_pool
)
58 struct pmd_internals
*internals
= dev
->data
->dev_private
;
60 struct ndp_rx_queue
*rxq
;
63 rxq
= rte_zmalloc_socket("ndp rx queue",
64 sizeof(struct ndp_rx_queue
),
65 RTE_CACHE_LINE_SIZE
, socket_id
);
68 RTE_LOG(ERR
, PMD
, "rte_zmalloc_socket() failed for rx queue id "
69 "%" PRIu16
"!\n", rx_queue_id
);
73 ret
= nfb_eth_rx_queue_init(internals
->nfb
,
80 dev
->data
->rx_queues
[rx_queue_id
] = rxq
;
88 nfb_eth_rx_queue_init(struct nfb_device
*nfb
,
91 struct rte_mempool
*mb_pool
,
92 struct ndp_rx_queue
*rxq
)
94 const struct rte_pktmbuf_pool_private
*mbp_priv
=
95 rte_mempool_get_priv(mb_pool
);
100 rxq
->queue
= ndp_open_rx_queue(nfb
, rx_queue_id
);
101 if (rxq
->queue
== NULL
)
105 rxq
->rx_queue_id
= rx_queue_id
;
106 rxq
->in_port
= port_id
;
107 rxq
->mb_pool
= mb_pool
;
108 rxq
->buf_size
= (uint16_t)(mbp_priv
->mbuf_data_room_size
-
109 RTE_PKTMBUF_HEADROOM
);
119 nfb_eth_rx_queue_release(void *q
)
121 struct ndp_rx_queue
*rxq
= (struct ndp_rx_queue
*)q
;
122 if (rxq
->queue
!= NULL
) {
123 ndp_close_rx_queue(rxq
->queue
);