]>
git.proxmox.com Git - ceph.git/blob - ceph/src/seastar/dpdk/drivers/bus/ifpga/ifpga_common.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2018 Intel Corporation
10 #include <sys/queue.h>
12 #include <sys/types.h>
16 #include <rte_errno.h>
18 #include <rte_per_lcore.h>
19 #include <rte_memory.h>
20 #include <rte_memzone.h>
22 #include <rte_common.h>
24 #include <rte_devargs.h>
25 #include <rte_kvargs.h>
26 #include <rte_alarm.h>
28 #include "rte_bus_ifpga.h"
29 #include "ifpga_logs.h"
30 #include "ifpga_common.h"
32 int rte_ifpga_get_string_arg(const char *key __rte_unused
,
33 const char *value
, void *extra_args
)
35 if (!value
|| !extra_args
)
38 *(char **)extra_args
= strdup(value
);
40 if (!*(char **)extra_args
)
45 int rte_ifpga_get_integer32_arg(const char *key __rte_unused
,
46 const char *value
, void *extra_args
)
48 if (!value
|| !extra_args
)
51 *(int *)extra_args
= strtoull(value
, NULL
, 0);
55 int ifpga_get_integer64_arg(const char *key __rte_unused
,
56 const char *value
, void *extra_args
)
58 if (!value
|| !extra_args
)
61 *(uint64_t *)extra_args
= strtoull(value
, NULL
, 0);
65 int ifpga_get_unsigned_long(const char *str
, int base
)
72 num
= strtoul(str
, &end
, base
);
73 if ((str
[0] == '\0') || (end
== NULL
) || (*end
!= '\0') || (errno
!= 0))
79 int ifpga_afu_id_cmp(const struct rte_afu_id
*afu_id0
,
80 const struct rte_afu_id
*afu_id1
)
82 if ((afu_id0
->uuid
.uuid_low
== afu_id1
->uuid
.uuid_low
) &&
83 (afu_id0
->uuid
.uuid_high
== afu_id1
->uuid
.uuid_high
) &&
84 (afu_id0
->port
== afu_id1
->port
)) {