Skip to content

Commit dc384b5

Browse files
rosen-xuFerruh Yigit
authored and
Ferruh Yigit
committed
bus/ifpga: support AFU device search by name
In many scenarios, AFU is needed searched by name, this function add the feature. Signed-off-by: Rosen Xu <[email protected]> Signed-off-by: Andy Pei <[email protected]>
1 parent bad9d52 commit dc384b5

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

drivers/bus/ifpga/ifpga_bus.c

+13
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,19 @@ ifpga_find_afu_dev(const struct rte_rawdev *rdev,
7373
return NULL;
7474
}
7575

76+
struct rte_afu_device *
77+
rte_ifpga_find_afu_by_name(const char *name)
78+
{
79+
struct rte_afu_device *afu_dev = NULL;
80+
81+
TAILQ_FOREACH(afu_dev, &ifpga_afu_dev_list, next) {
82+
if (afu_dev &&
83+
!strcmp(afu_dev->device.name, name))
84+
return afu_dev;
85+
}
86+
return NULL;
87+
}
88+
7689
static const char * const valid_args[] = {
7790
#define IFPGA_ARG_NAME "ifpga"
7891
IFPGA_ARG_NAME,

drivers/bus/ifpga/rte_bus_ifpga.h

+9
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,15 @@ rte_ifpga_device_name(const struct rte_afu_device *afu)
119119
return NULL;
120120
}
121121

122+
/**
123+
* Find AFU by AFU name.
124+
*
125+
* @param name
126+
* A pointer to AFU name string.
127+
*/
128+
struct rte_afu_device *
129+
rte_ifpga_find_afu_by_name(const char *name);
130+
122131
/**
123132
* Register a ifpga afu device driver.
124133
*

drivers/bus/ifpga/rte_bus_ifpga_version.map

+7
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,10 @@ DPDK_18.05 {
88

99
local: *;
1010
};
11+
12+
DPDK_19.05 {
13+
global:
14+
15+
rte_ifpga_find_afu_by_name;
16+
17+
} DPDK_18.05;

0 commit comments

Comments
 (0)