git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
net/ionic: log queue counters when tearing down
[dpdk.git]
/
drivers
/
net
/
failsafe
/
failsafe_args.c
diff --git
a/drivers/net/failsafe/failsafe_args.c
b/drivers/net/failsafe/failsafe_args.c
index
366dbea
..
707490b
100644
(file)
--- a/
drivers/net/failsafe/failsafe_args.c
+++ b/
drivers/net/failsafe/failsafe_args.c
@@
-1,6
+1,6
@@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright 2017 6WIND S.A.
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright 2017 6WIND S.A.
- * Copyright 2017 Mellanox
.
+ * Copyright 2017 Mellanox
Technologies, Ltd
*/
#include <fcntl.h>
*/
#include <fcntl.h>
@@
-14,6
+14,7
@@
#include <rte_devargs.h>
#include <rte_malloc.h>
#include <rte_kvargs.h>
#include <rte_devargs.h>
#include <rte_malloc.h>
#include <rte_kvargs.h>
+#include <rte_string_fns.h>
#include "failsafe_private.h"
#include "failsafe_private.h"
@@
-21,10
+22,10
@@
typedef int (parse_cb)(struct rte_eth_dev *dev, const char *params,
uint8_t head);
typedef int (parse_cb)(struct rte_eth_dev *dev, const char *params,
uint8_t head);
-uint64_t hotplug_poll = FAILSAFE_HOTPLUG_DEFAULT_TIMEOUT_MS;
-int
mac_from_arg = 0
;
+uint64_t
failsafe_
hotplug_poll = FAILSAFE_HOTPLUG_DEFAULT_TIMEOUT_MS;
+int
failsafe_mac_from_arg
;
-
const char *
pmd_failsafe_init_parameters[] = {
+
static const char * const
pmd_failsafe_init_parameters[] = {
PMD_FAILSAFE_HOTPLUG_POLL_KVARG,
PMD_FAILSAFE_MAC_KVARG,
NULL,
PMD_FAILSAFE_HOTPLUG_POLL_KVARG,
PMD_FAILSAFE_MAC_KVARG,
NULL,
@@
-62,7
+63,7
@@
fs_parse_device(struct sub_device *sdev, char *args)
d = &sdev->devargs;
DEBUG("%s", args);
d = &sdev->devargs;
DEBUG("%s", args);
- ret = rte_
eal_devargs_parse(args, d
);
+ ret = rte_
devargs_parse(d, args
);
if (ret) {
DEBUG("devargs parsing failed with code %d", ret);
return ret;
if (ret) {
DEBUG("devargs parsing failed with code %d", ret);
return ret;
@@
-101,7
+102,7
@@
fs_execute_cmd(struct sub_device *sdev, char *cmdline)
ERROR("Command line allocation failed");
return -ENOMEM;
}
ERROR("Command line allocation failed");
return -ENOMEM;
}
- s
nprintf(sdev->cmdline, len, "%s", cmdline
);
+ s
trlcpy(sdev->cmdline, cmdline, len
);
/* Replace all commas in the command line by spaces */
for (i = 0; i < len; i++)
if (sdev->cmdline[i] == ',')
/* Replace all commas in the command line by spaces */
for (i = 0; i < len; i++)
if (sdev->cmdline[i] == ',')
@@
-340,7
+341,7
@@
fs_remove_sub_devices_definition(char params[DEVARGS_MAXLEN])
a = b + 1;
}
out:
a = b + 1;
}
out:
- s
nprintf(params, DEVARGS_MAXLEN, "%s", buffer
);
+ s
trlcpy(params, buffer, DEVARGS_MAXLEN
);
return 0;
}
return 0;
}
@@
-366,16
+367,12
@@
static int
fs_get_mac_addr_arg(const char *key __rte_unused,
const char *value, void *out)
{
fs_get_mac_addr_arg(const char *key __rte_unused,
const char *value, void *out)
{
- struct ether_addr *ea = out;
- int ret;
+ struct rte_ether_addr *ea = out;
if ((value == NULL) || (out == NULL))
return -EINVAL;
if ((value == NULL) || (out == NULL))
return -EINVAL;
- ret = sscanf(value, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
- &ea->addr_bytes[0], &ea->addr_bytes[1],
- &ea->addr_bytes[2], &ea->addr_bytes[3],
- &ea->addr_bytes[4], &ea->addr_bytes[5]);
- return ret != ETHER_ADDR_LEN;
+
+ return rte_ether_unformat_addr(value, ea);
}
int
}
int
@@
-392,7
+389,7
@@
failsafe_args_parse(struct rte_eth_dev *dev, const char *params)
ret = 0;
priv->subs_tx = FAILSAFE_MAX_ETHPORTS;
/* default parameters */
ret = 0;
priv->subs_tx = FAILSAFE_MAX_ETHPORTS;
/* default parameters */
- n = s
nprintf(mut_params, sizeof(mut_params), "%s", params
);
+ n = s
trlcpy(mut_params, params, sizeof(mut_params)
);
if (n >= sizeof(mut_params)) {
ERROR("Parameter string too long (>=%zu)",
sizeof(mut_params));
if (n >= sizeof(mut_params)) {
ERROR("Parameter string too long (>=%zu)",
sizeof(mut_params));
@@
-419,7
+416,7
@@
failsafe_args_parse(struct rte_eth_dev *dev, const char *params)
if (arg_count == 1) {
ret = rte_kvargs_process(kvlist,
PMD_FAILSAFE_HOTPLUG_POLL_KVARG,
if (arg_count == 1) {
ret = rte_kvargs_process(kvlist,
PMD_FAILSAFE_HOTPLUG_POLL_KVARG,
- &fs_get_u64_arg, &hotplug_poll);
+ &fs_get_u64_arg, &
failsafe_
hotplug_poll);
if (ret < 0)
goto free_kvlist;
}
if (ret < 0)
goto free_kvlist;
}
@@
-434,7
+431,7
@@
failsafe_args_parse(struct rte_eth_dev *dev, const char *params)
if (ret < 0)
goto free_kvlist;
if (ret < 0)
goto free_kvlist;
- mac_from_arg = 1;
+
failsafe_
mac_from_arg = 1;
}
}
PRIV(dev)->state = DEV_PARSED;
}
}
PRIV(dev)->state = DEV_PARSED;