Suppress the unaligned packed member address warnings by extending
the telemetry library build flags with -Wno-address-of-packed-member
option, through the WERROR_FLAGS makefile variable.
With this change additional warnings are turned on to be treated as errors,
which causes the following build issues to be seen:
- no previous prototype [-Werror=missing-prototypes]
- initialization discards ‘const’ qualifier from pointer target type
[-Werror=discarded-qualifiers]
- old-style function definition [-Werror=old-style-definition]
- variable may be used before its value is set (when using icc compiler).
Fixes:
0fe3a37924d4 ("telemetry: format json response when sending stats")
Fixes:
ee5ff0d3297e ("telemetry: add client feature and sockets")
Fixes:
8877ac688b52 ("telemetry: introduce infrastructure")
Fixes:
1b756087db93 ("telemetry: add parser for client socket messages")
Fixes:
fff6df7bf58e ("telemetry: fix using ports of different types")
Fixes:
4080e46c8078 ("telemetry: support global metrics")
Cc: stable@dpdk.org
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Signed-off-by: Flavia Musatescu <flavia.musatescu@intel.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
LIB = librte_telemetry.a
CFLAGS += -O3
-CFLAGS += -I$(SRCDIR)
+CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
CFLAGS += -DALLOW_EXPERIMENTAL_API
LDLIBS += -lrte_eal -lrte_ethdev
# Copyright(c) 2018 Intel Corporation
sources = files('rte_telemetry.c', 'rte_telemetry_parser.c', 'rte_telemetry_parser_test.c')
-headers = files('rte_telemetry.h', 'rte_telemetry_internal.h', 'rte_telemetry_parser.h', 'rte_telemetry_parser_test.h')
+headers = files('rte_telemetry.h', 'rte_telemetry_internal.h', 'rte_telemetry_parser.h')
deps += ['metrics', 'ethdev']
cflags += '-DALLOW_EXPERIMENTAL_API'
#include "rte_telemetry.h"
#include "rte_telemetry_internal.h"
#include "rte_telemetry_parser.h"
-#include "rte_telemetry_parser_test.h"
#include "rte_telemetry_socket_tests.h"
#define BUF_SIZE 1024
static telemetry_impl *static_telemetry;
struct telemetry_message_test {
- char *test_name;
+ const char *test_name;
int (*test_func_ptr)(struct telemetry_impl *telemetry, int fd);
};
struct json_data {
char *status_code;
- char *data;
+ const char *data;
int port;
char *stat_name;
int stat_value;
return 0;
}
-int32_t
+static int32_t
rte_telemetry_write_to_socket(struct telemetry_impl *telemetry,
const char *json_string)
{
struct driver_index {
const void *dev_ops;
int reg_index;
- } drv_idx[RTE_MAX_ETHPORTS];
+ } drv_idx[RTE_MAX_ETHPORTS] = { {0} };
int nb_drv_idx = 0;
uint16_t pid;
int ret;
}
int32_t
-rte_telemetry_init()
+rte_telemetry_init(void)
{
int ret;
pthread_attr_t attr;
return -1;
}
-int32_t
+static int32_t
rte_telemetry_dummy_client_socket(const char *valid_client_path)
{
int sockfd = socket(AF_UNIX, SOCK_SEQPACKET, 0);
int ret;
char buf[BUF_SIZE];
int fail_count = 0;
- char *status = "Status Error: Invalid Argument 404";
- char *data = "null";
+ const char *status = "Status Error: Invalid Argument 404";
+ const char *data = "null";
struct json_data *data_struct;
const char *invalid_contents = "{\"action\":0,\"command\":"
"\"ports_stats_values_by_name\",\"data\":{\"ports\""
char buf[BUF_SIZE];
int fail_count = 0;
const char *status = "Status Error: Invalid Argument 404";
- char *data = "null";
+ const char *data = "null";
struct json_data *data_struct;
const char *empty_json = "{}";
int buffer_read = 0;
int32_t
rte_telemetry_send_global_stats_values(struct telemetry_encode_param *ep,
struct telemetry_impl *telemetry);
+
+int32_t
+rte_telemetry_parser_test(struct telemetry_impl *telemetry);
+
#endif
typedef int (*command_func)(struct telemetry_impl *, int, json_t *);
struct rte_telemetry_command {
- char *text;
+ const char *text;
command_func fn;
} command;
return -1;
}
-int32_t
+static int32_t
rte_telemetry_command_ports_all_stat_values(struct telemetry_impl *telemetry,
int action, json_t *data)
{
return -1;
}
-int32_t
+static int32_t
rte_telemetry_command_global_stat_values(struct telemetry_impl *telemetry,
int action, json_t *data)
{
return -1;
}
-int32_t
+static int32_t
rte_telemetry_command_ports_stats_values_by_name(struct telemetry_impl
*telemetry, int action, json_t *data)
{
#include <rte_string_fns.h>
#include "rte_telemetry_parser.h"
+#include "rte_telemetry_internal.h"
enum choices {
INV_ACTION_VAL,
#define TEST_CLIENT "/var/run/dpdk/test_client"
-int32_t
+static int32_t
rte_telemetry_create_test_socket(struct telemetry_impl *telemetry,
const char *test_client_path)
{
return 0;
}
-int32_t
+static int32_t
rte_telemetry_format_port_stat_ids(int *port_ids, int num_port_ids,
const char * const *stat_names, int num_stat_names, json_t **data)
{
return -1;
}
-int32_t
-rte_telemetry_create_json_request(int action, char *command,
+static int32_t
+rte_telemetry_create_json_request(int action, const char *command,
const char *client_path, int *port_ids, int num_port_ids,
const char * const *stat_names, int num_stat_names, char **request,
int inv_choice)
return -1;
}
-int32_t
+static int32_t
rte_telemetry_send_get_ports_and_stats_request(struct telemetry_impl *telemetry,
- int action_choice, char *command_choice, int inv_choice)
+ int action_choice, const char *command_choice, int inv_choice)
{
int ret;
char *request;
- char *client_path_data = NULL;
+ const char *client_path_data = NULL;
if (telemetry == NULL) {
TELEMETRY_LOG_ERR("Telemetry argument has not been initialised");
return 0;
}
-int32_t
+static int32_t
rte_telemetry_send_get_ports_details_request(struct telemetry_impl *telemetry,
int action_choice, int *port_ids, int num_port_ids, int inv_choice)
{
return -EINVAL;
}
- char *command = "ports_details";
+ const char *command = "ports_details";
if (inv_choice == INV_ACTION_VAL)
action_choice = -1;
return 0;
}
-int32_t
+static int32_t
rte_telemetry_send_stats_values_by_name_request(struct telemetry_impl
*telemetry, int action_choice, int *port_ids, int num_port_ids,
const char * const *stat_names, int num_stat_names,
{
int ret;
char *request;
- char *command = "ports_stats_values_by_name";
+ const char *command = "ports_stats_values_by_name";
if (telemetry == NULL) {
TELEMETRY_LOG_ERR("Telemetry argument has not been initialised");
return 0;
}
-int32_t
+static int32_t
rte_telemetry_send_unreg_request(struct telemetry_impl *telemetry,
int action_choice, const char *client_path, int inv_choice)
{
return -EINVAL;
}
- char *command = "clients";
+ const char *command = "clients";
if (inv_choice == INV_ACTION_VAL)
action_choice = -1;
+++ /dev/null
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-
-#ifndef _RTE_TELEMETRY_PARSER_TEST_H_
-#define _RTE_TELEMETRY_PARSER_TEST_H_
-
-int32_t
-rte_telemetry_parser_test(struct telemetry_impl *telemetry);
-
-int32_t
-rte_telemetry_format_port_stat_ids(int *port_ids, int num_port_ids,
- const char * const stat_names, int num_stat_names, json_t **data);
-
-int32_t
-rte_telemetry_create_json_request(int action, char *command,
- const char *client_path, int *port_ids, int num_port_ids,
- const char * const stat_names, int num_stat_names, char **request,
- int inv_choice);
-
-int32_t
-rte_telemetry_send_get_ports_and_stats_request(struct telemetry_impl *telemetry,
- int action_choice, char *command_choice, int inv_choice);
-
-int32_t
-rte_telemetry_send_get_ports_details_request(struct telemetry_impl *telemetry,
- int action_choice, int *port_ids, int num_port_ids, int inv_choice);
-
-int32_t
-rte_telemetry_send_stats_values_by_name_request(struct telemetry_impl
- *telemetry, int action_choice, int *port_ids, int num_port_ids,
- const char * const stat_names, int num_stat_names,
- int inv_choice);
-
-int32_t
-rte_telemetry_send_unreg_request(int action_choice, const char *client_path,
- int inv_choice);
-
-#endif