telemetry: fix passing full params string to command
Telemetry only passed the first param to the command handler if multiple were entered by the user, separated by commas. Telemetry is required to pass the full params string to the command, by splitting by a comma delimiter only once to remove the command part of the string. This will enable future commands to take multiple param values. Fixes:b1ad0e1245
("rawdev: add telemetry callbacks") Fixes:c190daedb9
("ethdev: add telemetry callbacks") Fixes:6dd571fd07
("telemetry: introduce new functionality") Cc: stable@dpdk.org Signed-off-by: Ciara Power <ciara.power@intel.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
This commit is contained in:
parent
40d64b33f7
commit
5514319e7b
@ -5324,11 +5324,15 @@ handle_port_xstats(const char *cmd __rte_unused,
|
||||
struct rte_eth_xstat_name *xstat_names;
|
||||
int port_id, num_xstats;
|
||||
int i, ret;
|
||||
char *end_param;
|
||||
|
||||
if (params == NULL || strlen(params) == 0 || !isdigit(*params))
|
||||
return -1;
|
||||
|
||||
port_id = atoi(params);
|
||||
port_id = strtoul(params, &end_param, 0);
|
||||
if (*end_param != '\0')
|
||||
RTE_ETHDEV_LOG(NOTICE,
|
||||
"Extra parameters passed to ethdev telemetry command, ignoring");
|
||||
if (!rte_eth_dev_is_valid_port(port_id))
|
||||
return -1;
|
||||
|
||||
@ -5370,11 +5374,15 @@ handle_port_link_status(const char *cmd __rte_unused,
|
||||
static const char *status_str = "status";
|
||||
int ret, port_id;
|
||||
struct rte_eth_link link;
|
||||
char *end_param;
|
||||
|
||||
if (params == NULL || strlen(params) == 0 || !isdigit(*params))
|
||||
return -1;
|
||||
|
||||
port_id = atoi(params);
|
||||
port_id = strtoul(params, &end_param, 0);
|
||||
if (*end_param != '\0')
|
||||
RTE_ETHDEV_LOG(NOTICE,
|
||||
"Extra parameters passed to ethdev telemetry command, ignoring");
|
||||
if (!rte_eth_dev_is_valid_port(port_id))
|
||||
return -1;
|
||||
|
||||
|
@ -578,11 +578,15 @@ handle_dev_xstats(const char *cmd __rte_unused,
|
||||
struct rte_rawdev_xstats_name *xstat_names;
|
||||
int dev_id, num_xstats, i, ret;
|
||||
unsigned int *ids;
|
||||
char *end_param;
|
||||
|
||||
if (params == NULL || strlen(params) == 0 || !isdigit(*params))
|
||||
return -1;
|
||||
|
||||
dev_id = atoi(params);
|
||||
dev_id = strtoul(params, &end_param, 0);
|
||||
if (*end_param != '\0')
|
||||
RTE_RDEV_LOG(NOTICE,
|
||||
"Extra parameters passed to rawdev telemetry command, ignoring");
|
||||
if (!rte_rawdev_pmd_is_valid_dev(dev_id))
|
||||
return -1;
|
||||
|
||||
|
@ -258,7 +258,7 @@ client_handler(void *sock_id)
|
||||
while (bytes > 0) {
|
||||
buffer[bytes] = 0;
|
||||
const char *cmd = strtok(buffer, ",");
|
||||
const char *param = strtok(NULL, ",");
|
||||
const char *param = strtok(NULL, "\0");
|
||||
telemetry_cb fn = unknown_command;
|
||||
int i;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user