Merge branch 'master' into fix_deprecated_func
authorkevin-laatz-intel <kevin.laatz@intel.com>
Mon, 2 Jul 2018 14:51:04 +0000 (15:51 +0100)
committerGitHub <noreply@github.com>
Mon, 2 Jul 2018 14:51:04 +0000 (15:51 +0100)
1  2 
src/dpdkevents.c
src/utils_dpdk.c

diff --combined src/dpdkevents.c
@@@ -66,19 -66,19 +66,19 @@@ typedef struct dpdk_ka_monitor_s 
  
  typedef struct dpdk_link_status_config_s {
    int enabled;
-   _Bool send_updated;
+   bool send_updated;
    uint32_t enabled_port_mask;
    char port_name[RTE_MAX_ETHPORTS][DATA_MAX_NAME_LEN];
-   _Bool notify;
+   bool notify;
  } dpdk_link_status_config_t;
  
  typedef struct dpdk_keep_alive_config_s {
    int enabled;
-   _Bool send_updated;
+   bool send_updated;
    uint128_t lcore_mask;
    dpdk_keepalive_shm_t *shm;
    char shm_name[DATA_MAX_NAME_LEN];
-   _Bool notify;
+   bool notify;
    int fd;
  } dpdk_keep_alive_config_t;
  
@@@ -185,8 -185,8 +185,8 @@@ static void dpdk_events_default_config(
    /* Link Status */
    ec->config.link_status.enabled = 1;
    ec->config.link_status.enabled_port_mask = ~0;
-   ec->config.link_status.send_updated = 1;
-   ec->config.link_status.notify = 0;
+   ec->config.link_status.send_updated = true;
+   ec->config.link_status.notify = false;
  
    for (int i = 0; i < RTE_MAX_ETHPORTS; i++) {
      ec->config.link_status.port_name[i][0] = 0;
  
    /* Keep Alive */
    ec->config.keep_alive.enabled = 1;
-   ec->config.keep_alive.send_updated = 1;
-   ec->config.keep_alive.notify = 0;
+   ec->config.keep_alive.send_updated = true;
+   ec->config.keep_alive.notify = false;
    /* by default enable 128 cores */
    memset(&ec->config.keep_alive.lcore_mask, 1,
           sizeof(ec->config.keep_alive.lcore_mask));
@@@ -419,12 -419,8 +419,12 @@@ static int dpdk_events_config(oconfig_i
  static int dpdk_helper_link_status_get(dpdk_helper_ctx_t *phc) {
    dpdk_events_ctx_t *ec = DPDK_EVENTS_CTX_GET(phc);
  
 -  /* get Link Status values from DPDK */
 +/* get Link Status values from DPDK */
 +#if RTE_VERSION < RTE_VERSION_NUM(18, 05, 0, 0)
    uint8_t nb_ports = rte_eth_dev_count();
 +#else
 +  uint8_t nb_ports = rte_eth_dev_count_avail();
 +#endif
    if (nb_ports == 0) {
      DPDK_CHILD_LOG("dpdkevent-helper: No DPDK ports available. "
                     "Check bound devices to DPDK driver.\n");
    }
    ec->nb_ports = nb_ports > RTE_MAX_ETHPORTS ? RTE_MAX_ETHPORTS : nb_ports;
  
-   for (int i = 0; i < ec->nb_ports; i++) {
+   for (unsigned int i = 0; i < ec->nb_ports; i++) {
      if (ec->config.link_status.enabled_port_mask & (1 << i)) {
        struct rte_eth_link link;
        ec->link_info[i].read_time = cdtime();
@@@ -501,7 -497,7 +501,7 @@@ static int dpdk_events_link_status_disp
          ec->nb_ports);
  
    /* dispatch Link Status values to collectd */
-   for (int i = 0; i < ec->nb_ports; i++) {
+   for (unsigned int i = 0; i < ec->nb_ports; i++) {
      if (ec->config.link_status.enabled_port_mask & (1 << i)) {
        if (!ec->config.link_status.send_updated ||
            ec->link_info[i].status_updated) {
diff --combined src/utils_dpdk.c
@@@ -831,7 -831,7 +831,7 @@@ uint128_t str_to_uint128(const char *st
        return lcore_mask;
    } else {
      char low_str[DATA_MAX_NAME_LEN];
-     char high_str[DATA_MAX_NAME_LEN];
+     char high_str[DATA_MAX_NAME_LEN * 2];
  
      memset(high_str, 0, sizeof(high_str));
      memset(low_str, 0, sizeof(low_str));
    return lcore_mask;
  }
  
- uint8_t dpdk_helper_eth_dev_count() {
+ uint8_t dpdk_helper_eth_dev_count(void) {
 +#if RTE_VERSION < RTE_VERSION_NUM(18, 05, 0, 0)
    uint8_t ports = rte_eth_dev_count();
 +#else
 +  uint8_t ports = rte_eth_dev_count_avail();
 +#endif
    if (ports == 0) {
      ERROR(
          "%s:%d: No DPDK ports available. Check bound devices to DPDK driver.\n",