Skip to content

Commit 5925f3a

Browse files
committed
fix(libnetcope - ndp): count queues in no-driver mode
This fixes DPDK simulation, which doesn't uses the kernel driver.
1 parent 9a7f156 commit 5925f3a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

libnfb/include/netcope/ndp_core.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
#include <netcope/ndp_core_queue.h>
1111
#include <netcope/ndp.h>
12+
#include <netcope/rxqueue.h>
13+
#include <netcope/txqueue.h>
1214

1315
void *nfb_nalloc(int numa_node, size_t size)
1416
{
@@ -244,12 +246,24 @@ static inline int fdt_get_subnode_count(const void *fdt, const char *path)
244246
#ifndef __KERNEL__
245247
int ndp_get_rx_queue_count(const struct nfb_device *dev)
246248
{
247-
return fdt_get_subnode_count(dev->fdt, "/drivers/ndp/rx_queues");
249+
if (fdt_path_offset(dev->fdt, "/driver/ndp/") >= 0) {
250+
return fdt_get_subnode_count(dev->fdt, "/drivers/ndp/rx_queues");
251+
} else {
252+
return
253+
nfb_comp_count(dev, COMP_NETCOPE_RXQUEUE_NDP) +
254+
nfb_comp_count(dev, COMP_NETCOPE_RXQUEUE_CALYPTE);
255+
}
248256
}
249257

250258
int ndp_get_tx_queue_count(const struct nfb_device *dev)
251259
{
252-
return fdt_get_subnode_count(dev->fdt, "/drivers/ndp/tx_queues");
260+
if (fdt_path_offset(dev->fdt, "/driver/ndp/") >= 0) {
261+
return fdt_get_subnode_count(dev->fdt, "/drivers/ndp/tx_queues");
262+
} else {
263+
return
264+
nfb_comp_count(dev, COMP_NETCOPE_TXQUEUE_NDP) +
265+
nfb_comp_count(dev, COMP_NETCOPE_TXQUEUE_CALYPTE);
266+
}
253267
}
254268

255269
int ndp_queue_is_available(const struct nfb_device *dev, unsigned index, int dir)

0 commit comments

Comments
 (0)