@@ -117,9 +117,9 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
if (rte_kvargs_count(kvlist, IFPGA_ARG_PORT) == 1) {
if (rte_kvargs_process(kvlist, IFPGA_ARG_PORT,
- &rte_ifpga_get_integer32_arg, &afu_pr_conf.afu_id.port) < 0) {
- IFPGA_BUS_ERR("error to parse %s",
- IFPGA_ARG_PORT);
+ ifpga_get_integer32_arg,
+ &afu_pr_conf.afu_id.port) < 0) {
+ IFPGA_BUS_ERR("error to parse %s", IFPGA_ARG_PORT);
goto end;
}
} else {
@@ -130,9 +130,8 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
if (rte_kvargs_count(kvlist, IFPGA_AFU_BTS) == 1) {
if (rte_kvargs_process(kvlist, IFPGA_AFU_BTS,
- &rte_ifpga_get_string_arg, &path) < 0) {
- IFPGA_BUS_ERR("Failed to parse %s",
- IFPGA_AFU_BTS);
+ ifpga_get_string_arg, &path) < 0) {
+ IFPGA_BUS_ERR("Failed to parse %s", IFPGA_AFU_BTS);
goto end;
}
afu_pr_conf.pr_enable = 1;
@@ -228,7 +227,7 @@ ifpga_scan(void)
if (rte_kvargs_count(kvlist, IFPGA_ARG_NAME) == 1) {
if (rte_kvargs_process(kvlist, IFPGA_ARG_NAME,
- &rte_ifpga_get_string_arg, &name) < 0) {
+ ifpga_get_string_arg, &name) < 0) {
IFPGA_BUS_ERR("error to parse %s",
IFPGA_ARG_NAME);
goto end;
deleted file mode 100644
@@ -1,87 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2018 Intel Corporation
- */
-
-#include <string.h>
-#include <inttypes.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/queue.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include <rte_errno.h>
-#include <rte_per_lcore.h>
-#include <rte_memory.h>
-#include <rte_memzone.h>
-#include <rte_eal.h>
-#include <rte_common.h>
-
-#include <rte_devargs.h>
-#include <rte_kvargs.h>
-#include <rte_alarm.h>
-
-#include "rte_bus_ifpga.h"
-#include "ifpga_logs.h"
-#include "ifpga_common.h"
-
-int rte_ifpga_get_string_arg(const char *key __rte_unused,
- const char *value, void *extra_args)
-{
- if (!value || !extra_args)
- return -EINVAL;
-
- *(char **)extra_args = strdup(value);
-
- if (!*(char **)extra_args)
- return -ENOMEM;
-
- return 0;
-}
-int rte_ifpga_get_integer32_arg(const char *key __rte_unused,
- const char *value, void *extra_args)
-{
- if (!value || !extra_args)
- return -EINVAL;
-
- *(int *)extra_args = strtoull(value, NULL, 0);
-
- return 0;
-}
-int ifpga_get_integer64_arg(const char *key __rte_unused,
- const char *value, void *extra_args)
-{
- if (!value || !extra_args)
- return -EINVAL;
-
- *(uint64_t *)extra_args = strtoull(value, NULL, 0);
-
- return 0;
-}
-int ifpga_get_unsigned_long(const char *str, int base)
-{
- unsigned long num;
- char *end = NULL;
-
- errno = 0;
-
- num = strtoul(str, &end, base);
- if ((str[0] == '\0') || (end == NULL) || (*end != '\0') || (errno != 0))
- return -1;
-
- return num;
-}
-
-int ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0,
- const struct rte_afu_id *afu_id1)
-{
- if ((afu_id0->uuid.uuid_low == afu_id1->uuid.uuid_low) &&
- (afu_id0->uuid.uuid_high == afu_id1->uuid.uuid_high) &&
- (afu_id0->port == afu_id1->port)) {
- return 0;
- } else
- return 1;
-}
@@ -5,14 +5,50 @@
#ifndef _IFPGA_COMMON_H_
#define _IFPGA_COMMON_H_
-int rte_ifpga_get_string_arg(const char *key __rte_unused,
- const char *value, void *extra_args);
-int rte_ifpga_get_integer32_arg(const char *key __rte_unused,
- const char *value, void *extra_args);
-int ifpga_get_integer64_arg(const char *key __rte_unused,
- const char *value, void *extra_args);
-int ifpga_get_unsigned_long(const char *str, int base);
-int ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0,
- const struct rte_afu_id *afu_id1);
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <rte_bus_ifpga.h>
+#include <rte_common.h>
+
+static inline int
+ifpga_get_string_arg(const char *key __rte_unused, const char *value,
+ void *extra_args)
+{
+ if (!value || !extra_args)
+ return -EINVAL;
+
+ *(char **)extra_args = strdup(value);
+
+ if (!*(char **)extra_args)
+ return -ENOMEM;
+
+ return 0;
+}
+
+static inline int
+ifpga_get_integer32_arg(const char *key __rte_unused, const char *value,
+ void *extra_args)
+{
+ if (!value || !extra_args)
+ return -EINVAL;
+
+ *(int *)extra_args = strtoull(value, NULL, 0);
+
+ return 0;
+}
+
+static inline int
+ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0,
+ const struct rte_afu_id *afu_id1)
+{
+ if ((afu_id0->uuid.uuid_low == afu_id1->uuid.uuid_low) &&
+ (afu_id0->uuid.uuid_high == afu_id1->uuid.uuid_high) &&
+ (afu_id0->port == afu_id1->port)) {
+ return 0;
+ } else
+ return 1;
+}
#endif /* _IFPGA_COMMON_H_ */
@@ -9,4 +9,4 @@ endif
deps += ['pci', 'kvargs', 'rawdev']
headers = files('rte_bus_ifpga.h')
-sources = files('ifpga_common.c', 'ifpga_bus.c')
+sources = files('ifpga_bus.c')
@@ -4,8 +4,6 @@ DPDK_22 {
rte_ifpga_driver_register;
rte_ifpga_driver_unregister;
rte_ifpga_find_afu_by_name;
- rte_ifpga_get_integer32_arg;
- rte_ifpga_get_string_arg;
local: *;
};
@@ -1752,7 +1752,7 @@ ifpga_vdev_parse_devargs(struct rte_devargs *devargs,
if (rte_kvargs_count(kvlist, IFPGA_ARG_PORT) == 1) {
if (rte_kvargs_process(kvlist, IFPGA_ARG_PORT,
- &rte_ifpga_get_integer32_arg, &port) < 0) {
+ ifpga_get_integer32_arg, &port) < 0) {
IFPGA_RAWDEV_PMD_ERR("error to parse %s",
IFPGA_ARG_PORT);
goto end;