* [dpdk-dev] [PATCH v2 01/24] lib/librte_eal: import libbsd strlcpy
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
@ 2018-05-11 1:58 ` Andy Green
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 02/24] lib/librte_ethdev: change eth-dev-ops API to return int Andy Green
` (23 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 1:58 UTC (permalink / raw)
To: dev
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_eal/common/eal_common_string_fns.c | 34 ++++++++++++++++++++++++
lib/librte_eal/common/include/rte_string_fns.h | 7 +----
2 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_string_fns.c b/lib/librte_eal/common/eal_common_string_fns.c
index 6ac5f8289..275f6fd03 100644
--- a/lib/librte_eal/common/eal_common_string_fns.c
+++ b/lib/librte_eal/common/eal_common_string_fns.c
@@ -38,3 +38,37 @@ rte_strsplit(char *string, int stringlen,
errno = EINVAL;
return -1;
}
+
+/*
+ * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ */
+
+size_t
+rte_strlcpy(char *dst, const char *src, size_t siz)
+{
+ char *d = dst;
+ const char *s = src;
+ size_t n = siz;
+
+ /* Copy as many bytes as will fit */
+ if (n != 0) {
+ while (--n != 0) {
+ if ((*d++ = *s++) == '\0')
+ break;
+ }
+ }
+
+ /* Not enough room in dst, add NUL and traverse rest of src */
+ if (n == 0) {
+ if (siz != 0)
+ *d = '\0'; /* NUL-terminate dst */
+ while (*s++)
+ ;
+ }
+
+ return(s - src - 1); /* count does not include NUL */
+}
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index fcbb42e00..d4389bcf4 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -52,11 +52,8 @@ rte_strsplit(char *string, int stringlen,
* DPDK-specific version of strlcpy for systems without
* libc or libbsd copies of the function
*/
-static inline size_t
-rte_strlcpy(char *dst, const char *src, size_t size)
-{
- return snprintf(dst, size, "%s", src);
-}
+size_t
+rte_strlcpy(char *dst, const char *src, size_t size);
/* pull in a strlcpy function */
#ifdef RTE_EXEC_ENV_BSDAPP
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 02/24] lib/librte_ethdev: change eth-dev-ops API to return int
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
2018-05-11 1:58 ` [dpdk-dev] [PATCH v2 01/24] lib/librte_eal: import libbsd strlcpy Andy Green
@ 2018-05-11 1:59 ` Andy Green
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 03/24] rte_common.h: cast gcc builtin result to avoid complaints Andy Green
` (22 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 1:59 UTC (permalink / raw)
To: dev
Signed-off-by: Andy Green <andy@warmcat.com>
---
drivers/net/ark/ark_ethdev_rx.c | 4 ++--
drivers/net/ark/ark_ethdev_rx.h | 3 +--
drivers/net/avf/avf_rxtx.c | 4 ++--
drivers/net/avf/avf_rxtx.h | 2 +-
drivers/net/bnxt/bnxt_ethdev.c | 5 +++--
drivers/net/dpaa/dpaa_ethdev.c | 4 ++--
drivers/net/dpaa2/dpaa2_ethdev.c | 6 +++---
drivers/net/e1000/e1000_ethdev.h | 6 ++----
drivers/net/e1000/em_rxtx.c | 4 ++--
drivers/net/e1000/igb_rxtx.c | 4 ++--
drivers/net/enic/enic_ethdev.c | 9 +++------
drivers/net/i40e/i40e_rxtx.c | 4 ++--
drivers/net/i40e/i40e_rxtx.h | 3 +--
drivers/net/ixgbe/ixgbe_ethdev.h | 3 +--
drivers/net/ixgbe/ixgbe_rxtx.c | 4 ++--
drivers/net/nfp/nfp_net.c | 9 ++++-----
drivers/net/sfc/sfc_ethdev.c | 4 ++--
drivers/net/thunderx/nicvf_ethdev.c | 2 +-
drivers/net/thunderx/nicvf_rxtx.c | 4 ++--
drivers/net/thunderx/nicvf_rxtx.h | 2 +-
drivers/net/vhost/rte_eth_vhost.c | 4 ++--
examples/l3fwd-power/main.c | 2 +-
lib/librte_ethdev/rte_ethdev_core.h | 4 ++--
23 files changed, 44 insertions(+), 52 deletions(-)
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 987d085e2..7f0a6fc52 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -407,13 +407,13 @@ eth_ark_rx_queue_drain(struct ark_rx_queue *queue)
}
}
-uint32_t
+int
eth_ark_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_id)
{
struct ark_rx_queue *queue;
queue = dev->data->rx_queues[queue_id];
- return (queue->prod_index - queue->cons_index); /* mod arith */
+ return (int)(queue->prod_index - queue->cons_index); /* mod arith */
}
/* ************************************************************************* */
diff --git a/drivers/net/ark/ark_ethdev_rx.h b/drivers/net/ark/ark_ethdev_rx.h
index 146787112..c3f56be3b 100644
--- a/drivers/net/ark/ark_ethdev_rx.h
+++ b/drivers/net/ark/ark_ethdev_rx.h
@@ -47,8 +47,7 @@ int eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
unsigned int socket_id,
const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mp);
-uint32_t eth_ark_dev_rx_queue_count(struct rte_eth_dev *dev,
- uint16_t rx_queue_id);
+int eth_ark_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id);
int eth_ark_rx_stop_queue(struct rte_eth_dev *dev, uint16_t queue_id);
int eth_ark_rx_start_queue(struct rte_eth_dev *dev, uint16_t queue_id);
uint16_t eth_ark_recv_pkts_noop(void *rx_queue, struct rte_mbuf **rx_pkts,
diff --git a/drivers/net/avf/avf_rxtx.c b/drivers/net/avf/avf_rxtx.c
index 1824ed70b..b4f7cea0b 100644
--- a/drivers/net/avf/avf_rxtx.c
+++ b/drivers/net/avf/avf_rxtx.c
@@ -1836,13 +1836,13 @@ avf_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
}
/* Get the number of used descriptors of a rx queue */
-uint32_t
+int
avf_dev_rxq_count(struct rte_eth_dev *dev, uint16_t queue_id)
{
#define AVF_RXQ_SCAN_INTERVAL 4
volatile union avf_rx_desc *rxdp;
struct avf_rx_queue *rxq;
- uint16_t desc = 0;
+ int desc = 0;
rxq = dev->data->rx_queues[queue_id];
rxdp = &rxq->rx_ring[rxq->rx_tail];
diff --git a/drivers/net/avf/avf_rxtx.h b/drivers/net/avf/avf_rxtx.h
index 297d0776d..fa287a003 100644
--- a/drivers/net/avf/avf_rxtx.h
+++ b/drivers/net/avf/avf_rxtx.h
@@ -185,7 +185,7 @@ void avf_dev_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_rxq_info *qinfo);
void avf_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_txq_info *qinfo);
-uint32_t avf_dev_rxq_count(struct rte_eth_dev *dev, uint16_t queue_id);
+int avf_dev_rxq_count(struct rte_eth_dev *dev, uint16_t queue_id);
int avf_dev_rx_desc_status(void *rx_queue, uint16_t offset);
int avf_dev_tx_desc_status(void *tx_queue, uint16_t offset);
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 348129dad..3e0201fb8 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1619,15 +1619,16 @@ bnxt_dev_led_off_op(struct rte_eth_dev *dev)
return bnxt_hwrm_port_led_cfg(bp, false);
}
-static uint32_t
+static int
bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id)
{
- uint32_t desc = 0, raw_cons = 0, cons;
struct bnxt_cp_ring_info *cpr;
+ uint32_t raw_cons = 0, cons;
struct bnxt_rx_queue *rxq;
struct rx_pkt_cmpl *rxcmp;
uint16_t cmp_type;
uint8_t cmp = 1;
+ int desc = 0;
bool valid;
rxq = dev->data->rx_queues[rx_queue_id];
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 6bf8c1590..615eb66f2 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -738,7 +738,7 @@ static void dpaa_eth_tx_queue_release(void *txq __rte_unused)
PMD_INIT_FUNC_TRACE();
}
-static uint32_t
+static int
dpaa_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
{
struct dpaa_if *dpaa_intf = dev->data->dev_private;
@@ -751,7 +751,7 @@ dpaa_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
RTE_LOG(DEBUG, PMD, "RX frame count for q(%d) is %u\n",
rx_queue_id, frm_cnt);
}
- return frm_cnt;
+ return (int)frm_cnt;
}
static int dpaa_link_down(struct rte_eth_dev *dev)
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index c304b82bd..32f8daec3 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -620,7 +620,7 @@ dpaa2_dev_tx_queue_release(void *q __rte_unused)
PMD_INIT_FUNC_TRACE();
}
-static uint32_t
+static int
dpaa2_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
{
int32_t ret;
@@ -628,7 +628,7 @@ dpaa2_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
struct dpaa2_queue *dpaa2_q;
struct qbman_swp *swp;
struct qbman_fq_query_np_rslt state;
- uint32_t frame_cnt = 0;
+ int frame_cnt = 0;
PMD_INIT_FUNC_TRACE();
@@ -644,7 +644,7 @@ dpaa2_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[rx_queue_id];
if (qbman_fq_query_state(swp, dpaa2_q->fqid, &state) == 0) {
- frame_cnt = qbman_fq_state_frame_count(&state);
+ frame_cnt = (int)qbman_fq_state_frame_count(&state);
DPAA2_PMD_DEBUG("RX frame count for q(%d) is %u",
rx_queue_id, frame_cnt);
}
diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h
index 902001f36..aeaa90048 100644
--- a/drivers/net/e1000/e1000_ethdev.h
+++ b/drivers/net/e1000/e1000_ethdev.h
@@ -370,8 +370,7 @@ int eth_igb_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mb_pool);
-uint32_t eth_igb_rx_queue_count(struct rte_eth_dev *dev,
- uint16_t rx_queue_id);
+int eth_igb_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id);
int eth_igb_rx_descriptor_done(void *rx_queue, uint16_t offset);
@@ -447,8 +446,7 @@ int eth_em_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mb_pool);
-uint32_t eth_em_rx_queue_count(struct rte_eth_dev *dev,
- uint16_t rx_queue_id);
+int eth_em_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id);
int eth_em_rx_descriptor_done(void *rx_queue, uint16_t offset);
diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c
index 2b3c63e1c..16b0f49ca 100644
--- a/drivers/net/e1000/em_rxtx.c
+++ b/drivers/net/e1000/em_rxtx.c
@@ -1528,7 +1528,7 @@ eth_em_rx_queue_setup(struct rte_eth_dev *dev,
return 0;
}
-uint32_t
+int
eth_em_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
{
#define EM_RXQ_SCAN_INTERVAL 4
@@ -1548,7 +1548,7 @@ eth_em_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
desc - rxq->nb_rx_desc]);
}
- return desc;
+ return (int)desc;
}
int
diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c
index a3776a0d7..246bebd41 100644
--- a/drivers/net/e1000/igb_rxtx.c
+++ b/drivers/net/e1000/igb_rxtx.c
@@ -1808,7 +1808,7 @@ eth_igb_rx_queue_setup(struct rte_eth_dev *dev,
return 0;
}
-uint32_t
+int
eth_igb_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
{
#define IGB_RXQ_SCAN_INTERVAL 4
@@ -1828,7 +1828,7 @@ eth_igb_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
desc - rxq->nb_rx_desc]);
}
- return desc;
+ return (int)desc;
}
int
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 286308924..14dbe9f91 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -269,11 +269,10 @@ static void enicpmd_dev_rx_queue_release(void *rxq)
enic_free_rq(rxq);
}
-static uint32_t enicpmd_dev_rx_queue_count(struct rte_eth_dev *dev,
- uint16_t rx_queue_id)
+static int enicpmd_dev_rx_queue_count(struct rte_eth_dev *dev,
+ uint16_t rx_queue_id)
{
struct enic *enic = pmd_priv(dev);
- uint32_t queue_count = 0;
struct vnic_cq *cq;
uint32_t cq_tail;
uint16_t cq_idx;
@@ -288,9 +287,7 @@ static uint32_t enicpmd_dev_rx_queue_count(struct rte_eth_dev *dev,
if (cq_tail < cq_idx)
cq_tail += cq->ring.desc_count;
- queue_count = cq_tail - cq_idx;
-
- return queue_count;
+ return (int)(cq_tail - cq_idx);
}
static int enicpmd_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 62985c3a9..3187bfb06 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -1961,7 +1961,7 @@ i40e_dev_rx_queue_release(void *rxq)
rte_free(q);
}
-uint32_t
+int
i40e_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
{
#define I40E_RXQ_SCAN_INTERVAL 4
@@ -1987,7 +1987,7 @@ i40e_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
desc - rxq->nb_rx_desc]);
}
- return desc;
+ return (int)desc;
}
int
diff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h
index ea73a8a1b..669377099 100644
--- a/drivers/net/i40e/i40e_rxtx.h
+++ b/drivers/net/i40e/i40e_rxtx.h
@@ -205,8 +205,7 @@ void i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq);
int i40e_alloc_rx_queue_mbufs(struct i40e_rx_queue *rxq);
void i40e_rx_queue_release_mbufs(struct i40e_rx_queue *rxq);
-uint32_t i40e_dev_rx_queue_count(struct rte_eth_dev *dev,
- uint16_t rx_queue_id);
+int i40e_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id);
int i40e_dev_rx_descriptor_done(void *rx_queue, uint16_t offset);
int i40e_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
int i40e_dev_tx_descriptor_status(void *tx_queue, uint16_t offset);
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index cc512d602..e05c21507 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -566,8 +566,7 @@ int ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
uint16_t nb_tx_desc, unsigned int socket_id,
const struct rte_eth_txconf *tx_conf);
-uint32_t ixgbe_dev_rx_queue_count(struct rte_eth_dev *dev,
- uint16_t rx_queue_id);
+int ixgbe_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id);
int ixgbe_dev_rx_descriptor_done(void *rx_queue, uint16_t offset);
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 2892436e9..7985a8971 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -3118,7 +3118,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
return 0;
}
-uint32_t
+int
ixgbe_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
{
#define IXGBE_RXQ_SCAN_INTERVAL 4
@@ -3139,7 +3139,7 @@ ixgbe_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
desc - rxq->nb_rx_desc]);
}
- return desc;
+ return (int)desc;
}
int
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index f114b1839..65f81dd8e 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -79,8 +79,7 @@ static int nfp_net_link_update(struct rte_eth_dev *dev, int wait_to_complete);
static void nfp_net_promisc_enable(struct rte_eth_dev *dev);
static void nfp_net_promisc_disable(struct rte_eth_dev *dev);
static int nfp_net_rx_fill_freelist(struct nfp_net_rxq *rxq);
-static uint32_t nfp_net_rx_queue_count(struct rte_eth_dev *dev,
- uint16_t queue_idx);
+static int nfp_net_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_idx);
static uint16_t nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t nb_pkts);
static void nfp_net_rx_queue_release(void *rxq);
@@ -1371,13 +1370,13 @@ nfp_net_supported_ptypes_get(struct rte_eth_dev *dev)
return NULL;
}
-static uint32_t
+static int
nfp_net_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_idx)
{
struct nfp_net_rxq *rxq;
struct nfp_net_rx_desc *rxds;
uint32_t idx;
- uint32_t count;
+ int count;
rxq = (struct nfp_net_rxq *)dev->data->rx_queues[queue_idx];
@@ -1402,7 +1401,7 @@ nfp_net_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_idx)
idx++;
/* Wrapping? */
- if ((idx) == rxq->rx_count)
+ if (idx == rxq->rx_count)
idx = 0;
}
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index a8c0f8e19..ca5d0a916 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -1113,14 +1113,14 @@ sfc_tx_queue_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id,
sfc_adapter_unlock(sa);
}
-static uint32_t
+static int
sfc_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
{
struct sfc_adapter *sa = dev->data->dev_private;
sfc_log_init(sa, "RxQ=%u", rx_queue_id);
- return sfc_rx_qdesc_npending(sa, rx_queue_id);
+ return (int)sfc_rx_qdesc_npending(sa, rx_queue_id);
}
static int
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index b673b4716..56c1d06c5 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1054,7 +1054,7 @@ nicvf_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
static inline void
nicvf_rx_queue_release_mbufs(struct rte_eth_dev *dev, struct nicvf_rxq *rxq)
{
- uint32_t rxq_cnt;
+ int rxq_cnt;
uint32_t nb_pkts, released_pkts = 0;
uint32_t refill_cnt = 0;
struct rte_mbuf *rx_pkts[NICVF_MAX_RX_FREE_THRESH];
diff --git a/drivers/net/thunderx/nicvf_rxtx.c b/drivers/net/thunderx/nicvf_rxtx.c
index 72305d9d2..133b8ba27 100644
--- a/drivers/net/thunderx/nicvf_rxtx.c
+++ b/drivers/net/thunderx/nicvf_rxtx.c
@@ -535,13 +535,13 @@ nicvf_recv_pkts_multiseg(void *rx_queue, struct rte_mbuf **rx_pkts,
return to_process;
}
-uint32_t
+int
nicvf_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_idx)
{
struct nicvf_rxq *rxq;
rxq = dev->data->rx_queues[queue_idx];
- return nicvf_addr_read(rxq->cq_status) & NICVF_CQ_CQE_COUNT_MASK;
+ return (int)(nicvf_addr_read(rxq->cq_status) & NICVF_CQ_CQE_COUNT_MASK);
}
uint32_t
diff --git a/drivers/net/thunderx/nicvf_rxtx.h b/drivers/net/thunderx/nicvf_rxtx.h
index 8bdd582ed..792beb85a 100644
--- a/drivers/net/thunderx/nicvf_rxtx.h
+++ b/drivers/net/thunderx/nicvf_rxtx.h
@@ -83,7 +83,7 @@ nicvf_mbuff_init_mseg_update(struct rte_mbuf *pkt, const uint64_t mbuf_init,
*(uint64_t *)(&pkt->rearm_data) = init.value;
}
-uint32_t nicvf_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_idx);
+int nicvf_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_idx);
uint32_t nicvf_dev_rbdr_refill(struct rte_eth_dev *dev, uint16_t queue_idx);
uint16_t nicvf_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts, uint16_t pkts);
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index ff5424a92..4c8d844ed 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -1163,7 +1163,7 @@ eth_link_update(struct rte_eth_dev *dev __rte_unused,
return 0;
}
-static uint32_t
+static int
eth_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
{
struct vhost_queue *vq;
@@ -1172,7 +1172,7 @@ eth_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
if (vq == NULL)
return 0;
- return rte_vhost_rx_queue_count(vq->vid, vq->virtqueue_id);
+ return (int)rte_vhost_rx_queue_count(vq->vid, vq->virtqueue_id);
}
static const struct eth_dev_ops ops = {
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 596d64548..22dd7006f 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -722,7 +722,7 @@ power_freq_scaleup_heuristic(unsigned lcore_id,
uint16_t port_id,
uint16_t queue_id)
{
- uint32_t rxq_count = rte_eth_rx_queue_count(port_id, queue_id);
+ int rxq_count = rte_eth_rx_queue_count(port_id, queue_id);
/**
* HW Rx queue size is 128 by default, Rx burst read at maximum 32 entries
* per iteration
diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
index 33d12b3a2..5e77555d3 100644
--- a/lib/librte_ethdev/rte_ethdev_core.h
+++ b/lib/librte_ethdev/rte_ethdev_core.h
@@ -144,8 +144,8 @@ typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev,
typedef void (*eth_queue_release_t)(void *queue);
/**< @internal Release memory resources allocated by given RX/TX queue. */
-typedef uint32_t (*eth_rx_queue_count_t)(struct rte_eth_dev *dev,
- uint16_t rx_queue_id);
+typedef int (*eth_rx_queue_count_t)(struct rte_eth_dev *dev,
+ uint16_t rx_queue_id);
/**< @internal Get number of used descriptors on a receive queue. */
typedef int (*eth_rx_descriptor_done_t)(void *rxq, uint16_t offset);
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 03/24] rte_common.h: cast gcc builtin result to avoid complaints
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
2018-05-11 1:58 ` [dpdk-dev] [PATCH v2 01/24] lib/librte_eal: import libbsd strlcpy Andy Green
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 02/24] lib/librte_ethdev: change eth-dev-ops API to return int Andy Green
@ 2018-05-11 1:59 ` Andy Green
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 04/24] lib/librte_eal: explicit tmp cast Andy Green
` (21 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 1:59 UTC (permalink / raw)
To: dev
/projects/lagopus/src/dpdk/build/include/rte_common.h:416:9:
warning: conversion to 'uint32_t' {aka 'unsigned int'} from
'int' may change the sign of the result [-Wsign-conversion]
return __builtin_ctz(v);
^~~~~~~~~~~~~~~~
The builtin is defined to return int, but we want to
return it as uint32_t. Its only defined valid return
values are positive integers or zero, which is OK for
uint32_t. So just add an explicit cast.
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_eal/common/include/rte_common.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 69e5ed1e3..679f2f184 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -413,7 +413,7 @@ rte_align64prevpow2(uint64_t v)
static inline uint32_t
rte_bsf32(uint32_t v)
{
- return __builtin_ctz(v);
+ return (uint32_t)__builtin_ctz(v);
}
/**
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 04/24] lib/librte_eal: explicit tmp cast
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (2 preceding siblings ...)
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 03/24] rte_common.h: cast gcc builtin result to avoid complaints Andy Green
@ 2018-05-11 1:59 ` Andy Green
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 05/24] lib/librte_eal: explicit cast for signed change Andy Green
` (20 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 1:59 UTC (permalink / raw)
To: dev
Signed-off-by: Andy Green <andy@warmcat.com>
---
.../common/include/arch/x86/rte_memcpy.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
index 5ead68ab2..f9ea0ab69 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
@@ -597,9 +597,9 @@ __extension__ ({
_mm_storeu_si128((__m128i *)((uint8_t *)dst + 7 * 16), _mm_alignr_epi8(xmm8, xmm7, offset)); \
dst = (uint8_t *)dst + 128; \
} \
- tmp = len; \
+ tmp = (int)len; \
len = ((len - 16 + offset) & 127) + 16 - offset; \
- tmp -= len; \
+ tmp -= (int)len; \
src = (const uint8_t *)src + tmp; \
dst = (uint8_t *)dst + tmp; \
if (len >= 32 + 16 - offset) { \
@@ -613,9 +613,9 @@ __extension__ ({
_mm_storeu_si128((__m128i *)((uint8_t *)dst + 1 * 16), _mm_alignr_epi8(xmm2, xmm1, offset)); \
dst = (uint8_t *)dst + 32; \
} \
- tmp = len; \
+ tmp = (int)len; \
len = ((len - 16 + offset) & 31) + 16 - offset; \
- tmp -= len; \
+ tmp -= (int)len; \
src = (const uint8_t *)src + tmp; \
dst = (uint8_t *)dst + tmp; \
} \
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 05/24] lib/librte_eal: explicit cast for signed change
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (3 preceding siblings ...)
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 04/24] lib/librte_eal: explicit tmp cast Andy Green
@ 2018-05-11 1:59 ` Andy Green
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 06/24] /lib/librte_eal: stage cast from uint64 to long Andy Green
` (19 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 1:59 UTC (permalink / raw)
To: dev
/projects/lagopus/src/dpdk/build/include/rte_lcore.h:
In function 'rte_lcore_index':
/projects/lagopus/src/dpdk/build/include/rte_lcore.h:122:14:
warning: conversion to 'int' from 'unsigned int' may change
the sign of the result [-Wsign-conversion]
lcore_id = rte_lcore_id();
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_eal/common/include/rte_lcore.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h
index 1a2f37eaa..6e09d9181 100644
--- a/lib/librte_eal/common/include/rte_lcore.h
+++ b/lib/librte_eal/common/include/rte_lcore.h
@@ -119,7 +119,7 @@ rte_lcore_index(int lcore_id)
if (lcore_id >= RTE_MAX_LCORE)
return -1;
if (lcore_id < 0)
- lcore_id = rte_lcore_id();
+ lcore_id = (int)rte_lcore_id();
return lcore_config[lcore_id].core_index;
}
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 06/24] /lib/librte_eal: stage cast from uint64 to long
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (4 preceding siblings ...)
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 05/24] lib/librte_eal: explicit cast for signed change Andy Green
@ 2018-05-11 1:59 ` Andy Green
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 07/24] rte_spinlock.h: stack declarations before code Andy Green
` (18 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 1:59 UTC (permalink / raw)
To: dev
/projects/lagopus/src/dpdk/build/include/rte_random.h:
In function 'rte_srand':
/projects/lagopus/src/dpdk/build/include/rte_random.h:34:10:
warning: conversion to 'long int' from 'long unsigned int'
may change the sign of the result [-Wsign-conversion]
srand48((long unsigned int)seedval);
/projects/lagopus/src/dpdk/build/include/rte_random.h:51:8:
warning: conversion to 'uint64_t' {aka 'long unsigned int'}
from 'long int' may change the sign of the result
[-Wsign-conversion]
val = lrand48();
^~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_random.h:53:6:
warning: conversion to 'long unsigned int' from 'long int'
may change the sign of the result [-Wsign-conversion]
val += lrand48();
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_eal/common/include/rte_random.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/librte_eal/common/include/rte_random.h b/lib/librte_eal/common/include/rte_random.h
index 63bb28088..96c64fdd2 100644
--- a/lib/librte_eal/common/include/rte_random.h
+++ b/lib/librte_eal/common/include/rte_random.h
@@ -31,7 +31,7 @@ extern "C" {
static inline void
rte_srand(uint64_t seedval)
{
- srand48((long unsigned int)seedval);
+ srand48((long)(unsigned long)seedval);
}
/**
@@ -48,9 +48,9 @@ static inline uint64_t
rte_rand(void)
{
uint64_t val;
- val = lrand48();
+ val = (unsigned long)lrand48();
val <<= 32;
- val += lrand48();
+ val += (unsigned long)lrand48();
return val;
}
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 07/24] rte_spinlock.h: stack declarations before code
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (5 preceding siblings ...)
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 06/24] /lib/librte_eal: stage cast from uint64 to long Andy Green
@ 2018-05-11 1:59 ` Andy Green
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 08/24] rte_ring_generic.h: " Andy Green
` (17 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 1:59 UTC (permalink / raw)
To: dev
/projects/lagopus/src/dpdk/build/include/rte_spinlock.h:
In function 'rte_try_tm':
/projects/lagopus/src/dpdk/build/include/rte_spinlock.h:82:2:
warning: ISO C90 forbids mixed declarations and code
[-Wdeclaration-after-statement]
int retries = RTE_RTM_MAX_RETRIES;
Signed-off-by: Andy Green <andy@warmcat.com>
---
.../common/include/arch/x86/rte_spinlock.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h
index 4b16887ea..60321da02 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h
@@ -76,10 +76,12 @@ static inline int rte_tm_supported(void)
static inline int
rte_try_tm(volatile int *lock)
{
+ int retries;
+
if (!rte_rtm_supported)
return 0;
- int retries = RTE_RTM_MAX_RETRIES;
+ retries = RTE_RTM_MAX_RETRIES;
while (likely(retries--)) {
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 08/24] rte_ring_generic.h: stack declarations before code
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (6 preceding siblings ...)
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 07/24] rte_spinlock.h: stack declarations before code Andy Green
@ 2018-05-11 1:59 ` Andy Green
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 09/24] rte_ring.h: remove signed type flipflopping Andy Green
` (16 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 1:59 UTC (permalink / raw)
To: dev
/projects/lagopus/src/dpdk/build/include/rte_ring_generic.h:
In function '__rte_ring_move_prod_head':
/projects/lagopus/src/dpdk/build/include/rte_ring_generic.h:76:3:
warning: ISO C90 forbids mixed declarations and code
[-Wdeclaration-after-statement]
const uint32_t cons_tail = r->cons.tail;
^~~~~
/projects/lagopus/src/dpdk/build/include/rte_ring_generic.h:
In function '__rte_ring_move_cons_head':
/projects/lagopus/src/dpdk/build/include/rte_ring_generic.h:147:3:
warning: ISO C90 forbids mixed declarations and code
[-Wdeclaration-after-statement]
const uint32_t prod_tail = r->prod.tail;
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_ring/rte_ring_generic.h | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/lib/librte_ring/rte_ring_generic.h b/lib/librte_ring/rte_ring_generic.h
index 5b110425f..c2d482bc9 100644
--- a/lib/librte_ring/rte_ring_generic.h
+++ b/lib/librte_ring/rte_ring_generic.h
@@ -73,14 +73,13 @@ __rte_ring_move_prod_head(struct rte_ring *r, int is_sp,
*/
rte_smp_rmb();
- const uint32_t cons_tail = r->cons.tail;
/*
* The subtraction is done between two unsigned 32bits value
* (the result is always modulo 32 bits even if we have
* *old_head > cons_tail). So 'free_entries' is always between 0
* and capacity (which is < size).
*/
- *free_entries = (capacity + cons_tail - *old_head);
+ *free_entries = (capacity + r->cons.tail - *old_head);
/* check that we have enough room in ring */
if (unlikely(n > *free_entries))
@@ -144,13 +143,12 @@ __rte_ring_move_cons_head(struct rte_ring *r, int is_sc,
*/
rte_smp_rmb();
- const uint32_t prod_tail = r->prod.tail;
/* The subtraction is done between two unsigned 32bits value
* (the result is always modulo 32 bits even if we have
* cons_head > prod_tail). So 'entries' is always between 0
* and size(ring)-1.
*/
- *entries = (prod_tail - *old_head);
+ *entries = (r->prod.tail - *old_head);
/* Set the actual entries for dequeue */
if (n > *entries)
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 09/24] rte_ring.h: remove signed type flipflopping
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (7 preceding siblings ...)
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 08/24] rte_ring_generic.h: " Andy Green
@ 2018-05-11 1:59 ` Andy Green
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 10/24] rte_dev.h: stack declaration at top of own basic block Andy Green
` (15 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 1:59 UTC (permalink / raw)
To: dev
/projects/lagopus/src/dpdk/build/include/rte_ring.h:350:46:
warning: conversion to 'uint32_t' {aka 'unsigned int'}
from 'int' may change the sign of the result
[-Wsign-conversion]
update_tail(&r->prod, prod_head, prod_next, is_sp, 1);
The visible apis take unsigned int, then call a private
api taking an int, which finally calls an api taking an
unsigned int.
Convert the private api to take unsigned int removing
5 x warning similar to that shown above.
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_ring/rte_ring.h | 4 ++--
lib/librte_ring/rte_ring_c11_mem.h | 2 +-
lib/librte_ring/rte_ring_generic.h | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
index d3d3f7f97..124582251 100644
--- a/lib/librte_ring/rte_ring.h
+++ b/lib/librte_ring/rte_ring.h
@@ -335,7 +335,7 @@ void rte_ring_dump(FILE *f, const struct rte_ring *r);
static __rte_always_inline unsigned int
__rte_ring_do_enqueue(struct rte_ring *r, void * const *obj_table,
unsigned int n, enum rte_ring_queue_behavior behavior,
- int is_sp, unsigned int *free_space)
+ unsigned int is_sp, unsigned int *free_space)
{
uint32_t prod_head, prod_next;
uint32_t free_entries;
@@ -377,7 +377,7 @@ __rte_ring_do_enqueue(struct rte_ring *r, void * const *obj_table,
static __rte_always_inline unsigned int
__rte_ring_do_dequeue(struct rte_ring *r, void **obj_table,
unsigned int n, enum rte_ring_queue_behavior behavior,
- int is_sc, unsigned int *available)
+ unsigned int is_sc, unsigned int *available)
{
uint32_t cons_head, cons_next;
uint32_t entries;
diff --git a/lib/librte_ring/rte_ring_c11_mem.h b/lib/librte_ring/rte_ring_c11_mem.h
index 08825ea5b..cb3f82b1a 100644
--- a/lib/librte_ring/rte_ring_c11_mem.h
+++ b/lib/librte_ring/rte_ring_c11_mem.h
@@ -51,7 +51,7 @@ update_tail(struct rte_ring_headtail *ht, uint32_t old_val, uint32_t new_val,
* If behavior == RTE_RING_QUEUE_FIXED, this will be 0 or n only.
*/
static __rte_always_inline unsigned int
-__rte_ring_move_prod_head(struct rte_ring *r, int is_sp,
+__rte_ring_move_prod_head(struct rte_ring *r, unsigned int is_sp,
unsigned int n, enum rte_ring_queue_behavior behavior,
uint32_t *old_head, uint32_t *new_head,
uint32_t *free_entries)
diff --git a/lib/librte_ring/rte_ring_generic.h b/lib/librte_ring/rte_ring_generic.h
index c2d482bc9..ea7dbe5b9 100644
--- a/lib/librte_ring/rte_ring_generic.h
+++ b/lib/librte_ring/rte_ring_generic.h
@@ -53,7 +53,7 @@ update_tail(struct rte_ring_headtail *ht, uint32_t old_val, uint32_t new_val,
* If behavior == RTE_RING_QUEUE_FIXED, this will be 0 or n only.
*/
static __rte_always_inline unsigned int
-__rte_ring_move_prod_head(struct rte_ring *r, int is_sp,
+__rte_ring_move_prod_head(struct rte_ring *r, unsigned int is_sp,
unsigned int n, enum rte_ring_queue_behavior behavior,
uint32_t *old_head, uint32_t *new_head,
uint32_t *free_entries)
@@ -123,7 +123,7 @@ __rte_ring_move_prod_head(struct rte_ring *r, int is_sp,
* If behavior == RTE_RING_QUEUE_FIXED, this will be 0 or n only.
*/
static __rte_always_inline unsigned int
-__rte_ring_move_cons_head(struct rte_ring *r, int is_sc,
+__rte_ring_move_cons_head(struct rte_ring *r, unsigned int is_sc,
unsigned int n, enum rte_ring_queue_behavior behavior,
uint32_t *old_head, uint32_t *new_head,
uint32_t *entries)
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 10/24] rte_dev.h: stack declaration at top of own basic block
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (8 preceding siblings ...)
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 09/24] rte_ring.h: remove signed type flipflopping Andy Green
@ 2018-05-11 1:59 ` Andy Green
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 11/24] rte_mbuf.h: avoid warnings from inadvertant promotion Andy Green
` (14 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 1:59 UTC (permalink / raw)
To: dev
/projects/lagopus/src/dpdk/build/include/rte_dev.h:54:2:
warning: ISO C90 forbids mixed declarations and
code [-Wdeclaration-after-statement]
char buffer[vsnprintf(NULL, 0, fmt, ap) + 1];
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_eal/common/include/rte_dev.h | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 0955e9adb..3879ff3ca 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -51,15 +51,18 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
va_start(ap, fmt);
- char buffer[vsnprintf(NULL, 0, fmt, ap) + 1];
+ {
+ char buffer[vsnprintf(NULL, 0, fmt, ap) + 1];
- va_end(ap);
+ va_end(ap);
- va_start(ap, fmt);
- vsnprintf(buffer, sizeof(buffer), fmt, ap);
- va_end(ap);
+ va_start(ap, fmt);
+ vsnprintf(buffer, sizeof(buffer), fmt, ap);
+ va_end(ap);
- rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", func_name, buffer);
+ rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s",
+ func_name, buffer);
+ }
}
/*
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 11/24] rte_mbuf.h: avoid warnings from inadvertant promotion
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (9 preceding siblings ...)
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 10/24] rte_dev.h: stack declaration at top of own basic block Andy Green
@ 2018-05-11 1:59 ` Andy Green
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 12/24] rte_mbuf.h: explicit casts for int16 to uint16 Andy Green
` (13 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 1:59 UTC (permalink / raw)
To: dev
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_mbuf/rte_mbuf.h | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 4fd9a0d9e..a2a37a311 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -836,8 +836,9 @@ rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value)
* reference counter can occur.
*/
if (likely(rte_mbuf_refcnt_read(m) == 1)) {
- rte_mbuf_refcnt_set(m, 1 + value);
- return 1 + value;
+ ++value;
+ rte_mbuf_refcnt_set(m, value);
+ return value;
}
return __rte_mbuf_refcnt_update(m, value);
@@ -927,8 +928,9 @@ rte_mbuf_ext_refcnt_update(struct rte_mbuf_ext_shared_info *shinfo,
int16_t value)
{
if (likely(rte_mbuf_ext_refcnt_read(shinfo) == 1)) {
- rte_mbuf_ext_refcnt_set(shinfo, 1 + value);
- return 1 + value;
+ ++value;
+ rte_mbuf_ext_refcnt_set(shinfo, value);
+ return value;
}
return (uint16_t)rte_atomic16_add_return(&shinfo->refcnt_atomic, value);
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 12/24] rte_mbuf.h: explicit casts for int16 to uint16
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (10 preceding siblings ...)
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 11/24] rte_mbuf.h: avoid warnings from inadvertant promotion Andy Green
@ 2018-05-11 1:59 ` Andy Green
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 13/24] rte_mbuf.h: make sure RTE-MIN compares same types Andy Green
` (12 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 1:59 UTC (permalink / raw)
To: dev
differences to the atomic16 are signed, but the
atomic16 itself is unsigned. It needs to be
made explicit with casts.
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_mbuf/rte_mbuf.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index a2a37a311..c214f1945 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -806,7 +806,7 @@ rte_mbuf_refcnt_read(const struct rte_mbuf *m)
static inline void
rte_mbuf_refcnt_set(struct rte_mbuf *m, uint16_t new_value)
{
- rte_atomic16_set(&m->refcnt_atomic, new_value);
+ rte_atomic16_set(&m->refcnt_atomic, (int16_t)new_value);
}
/* internal */
@@ -837,8 +837,8 @@ rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value)
*/
if (likely(rte_mbuf_refcnt_read(m) == 1)) {
++value;
- rte_mbuf_refcnt_set(m, value);
- return value;
+ rte_mbuf_refcnt_set(m, (uint16_t)value);
+ return (uint16_t)value;
}
return __rte_mbuf_refcnt_update(m, value);
@@ -909,7 +909,7 @@ static inline void
rte_mbuf_ext_refcnt_set(struct rte_mbuf_ext_shared_info *shinfo,
uint16_t new_value)
{
- rte_atomic16_set(&shinfo->refcnt_atomic, new_value);
+ rte_atomic16_set(&shinfo->refcnt_atomic, (int16_t)new_value);
}
/**
@@ -929,8 +929,8 @@ rte_mbuf_ext_refcnt_update(struct rte_mbuf_ext_shared_info *shinfo,
{
if (likely(rte_mbuf_ext_refcnt_read(shinfo) == 1)) {
++value;
- rte_mbuf_ext_refcnt_set(shinfo, value);
- return value;
+ rte_mbuf_ext_refcnt_set(shinfo, (uint16_t)value);
+ return (uint16_t)value;
}
return (uint16_t)rte_atomic16_add_return(&shinfo->refcnt_atomic, value);
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 13/24] rte_mbuf.h: make sure RTE-MIN compares same types
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (11 preceding siblings ...)
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 12/24] rte_mbuf.h: explicit casts for int16 to uint16 Andy Green
@ 2018-05-11 1:59 ` Andy Green
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 14/24] rte_mbuf.h: explicit cast restricting ptrdiff to uint16 Andy Green
` (11 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 1:59 UTC (permalink / raw)
To: dev
/projects/lagopus/src/dpdk/build/include/rte_common.h:384:2:
warning: conversion from 'int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
__extension__ ({ \
^~~~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:1204:16:
note: in expansion of macro 'RTE_MIN'
m->data_off = RTE_MIN(RTE_PKTMBUF_HEADROOM,
(uint16_t)m->buf_len);
RTE_PKTMBUF_HEADROOM is typ 128, so it doesn't make trouble.
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_mbuf/rte_mbuf.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index c214f1945..a27dbb878 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1201,7 +1201,8 @@ rte_pktmbuf_priv_size(struct rte_mempool *mp)
*/
static inline void rte_pktmbuf_reset_headroom(struct rte_mbuf *m)
{
- m->data_off = RTE_MIN(RTE_PKTMBUF_HEADROOM, (uint16_t)m->buf_len);
+ m->data_off = (uint16_t)RTE_MIN((uint16_t)RTE_PKTMBUF_HEADROOM,
+ (uint16_t)m->buf_len);
}
/**
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 14/24] rte_mbuf.h: explicit cast restricting ptrdiff to uint16
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (12 preceding siblings ...)
2018-05-11 1:59 ` [dpdk-dev] [PATCH v2 13/24] rte_mbuf.h: make sure RTE-MIN compares same types Andy Green
@ 2018-05-11 2:00 ` Andy Green
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 15/24] rte_mbuf.h: explicit cast for size type to uint32 Andy Green
` (10 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 2:00 UTC (permalink / raw)
To: dev
/projects/lagopus/src/dpdk/build/include/rte_common.h:141:34:
warning: conversion from 'long unsigned int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
#define RTE_PTR_DIFF(ptr1, ptr2) ((uintptr_t)(ptr1) -
(uintptr_t)(ptr2))
^
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:1360:13:
note: in expansion of macro 'RTE_PTR_DIFF'
*buf_len = RTE_PTR_DIFF(shinfo, buf_addr);
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_mbuf/rte_mbuf.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index a27dbb878..0580ec8a0 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1358,7 +1358,7 @@ rte_pktmbuf_ext_shinfo_init_helper(void *buf_addr, uint16_t *buf_len,
shinfo->fcb_opaque = fcb_opaque;
rte_mbuf_ext_refcnt_set(shinfo, 1);
- *buf_len = RTE_PTR_DIFF(shinfo, buf_addr);
+ *buf_len = (uint16_t)RTE_PTR_DIFF(shinfo, buf_addr);
return shinfo;
}
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 15/24] rte_mbuf.h: explicit cast for size type to uint32
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (13 preceding siblings ...)
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 14/24] rte_mbuf.h: explicit cast restricting ptrdiff to uint16 Andy Green
@ 2018-05-11 2:00 ` Andy Green
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 16/24] rte_mbuf.h: explicit casts to uint16 to avoid warnings Andy Green
` (9 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 2:00 UTC (permalink / raw)
To: dev
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_mbuf/rte_mbuf.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 0580ec8a0..169f3d3b0 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1577,7 +1577,7 @@ static inline void rte_pktmbuf_detach(struct rte_mbuf *m)
__rte_pktmbuf_free_direct(m);
priv_size = rte_pktmbuf_priv_size(mp);
- mbuf_size = sizeof(struct rte_mbuf) + priv_size;
+ mbuf_size = (uint32_t)sizeof(struct rte_mbuf) + priv_size;
buf_len = rte_pktmbuf_data_room_size(mp);
m->priv_size = priv_size;
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 16/24] rte_mbuf.h: explicit casts to uint16 to avoid warnings
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (14 preceding siblings ...)
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 15/24] rte_mbuf.h: explicit cast for size type to uint32 Andy Green
@ 2018-05-11 2:00 ` Andy Green
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 17/24] rte_byteorder.h: explicit cast for return promotion Andy Green
` (8 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 2:00 UTC (permalink / raw)
To: dev
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_mbuf/rte_mbuf.h | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 169f3d3b0..3cd76abbc 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1580,7 +1580,7 @@ static inline void rte_pktmbuf_detach(struct rte_mbuf *m)
mbuf_size = (uint32_t)sizeof(struct rte_mbuf) + priv_size;
buf_len = rte_pktmbuf_data_room_size(mp);
- m->priv_size = priv_size;
+ m->priv_size = (uint16_t)priv_size;
m->buf_addr = (char *)m + mbuf_size;
m->buf_iova = rte_mempool_virt2iova(m) + mbuf_size;
m->buf_len = (uint16_t)buf_len;
@@ -1905,7 +1905,7 @@ static inline char *rte_pktmbuf_prepend(struct rte_mbuf *m,
if (unlikely(len > rte_pktmbuf_headroom(m)))
return NULL;
- m->data_off -= len;
+ m->data_off = (uint16_t)(m->data_off - len);
m->data_len = (uint16_t)(m->data_len + len);
m->pkt_len = (m->pkt_len + len);
@@ -1966,7 +1966,7 @@ static inline char *rte_pktmbuf_adj(struct rte_mbuf *m, uint16_t len)
return NULL;
m->data_len = (uint16_t)(m->data_len - len);
- m->data_off += len;
+ m->data_off = (uint16_t)(m->data_off + len);
m->pkt_len = (m->pkt_len - len);
return (char *)m->buf_addr + m->data_off;
}
@@ -2079,7 +2079,7 @@ static inline int rte_pktmbuf_chain(struct rte_mbuf *head, struct rte_mbuf *tail
cur_tail->next = tail;
/* accumulate number of segments and total length. */
- head->nb_segs += tail->nb_segs;
+ head->nb_segs = (uint16_t)(head->nb_segs + tail->nb_segs);
head->pkt_len += tail->pkt_len;
/* pkt_len is only set in the head */
@@ -2109,7 +2109,8 @@ rte_validate_tx_offload(const struct rte_mbuf *m)
return 0;
if (ol_flags & PKT_TX_OUTER_IP_CKSUM)
- inner_l3_offset += m->outer_l2_len + m->outer_l3_len;
+ inner_l3_offset += (unsigned int)(m->outer_l2_len +
+ m->outer_l3_len);
/* Headers are fragmented */
if (rte_pktmbuf_data_len(m) < inner_l3_offset + m->l3_len + m->l4_len)
@@ -2154,7 +2155,7 @@ rte_validate_tx_offload(const struct rte_mbuf *m)
static inline int
rte_pktmbuf_linearize(struct rte_mbuf *mbuf)
{
- int seg_len, copy_len;
+ size_t seg_len, copy_len;
struct rte_mbuf *m;
struct rte_mbuf *m_next;
char *buffer;
@@ -2169,7 +2170,7 @@ rte_pktmbuf_linearize(struct rte_mbuf *mbuf)
return -1;
buffer = rte_pktmbuf_mtod_offset(mbuf, char *, mbuf->data_len);
- mbuf->data_len = (uint16_t)(mbuf->pkt_len);
+ mbuf->data_len = (uint16_t)mbuf->pkt_len;
/* Append data from next segments to the first one */
m = mbuf->next;
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 17/24] rte_byteorder.h: explicit cast for return promotion
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (15 preceding siblings ...)
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 16/24] rte_mbuf.h: explicit casts to uint16 to avoid warnings Andy Green
@ 2018-05-11 2:00 ` Andy Green
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 18/24] rte_ether.h: explicit cast avoiding truncation warning Andy Green
` (7 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 2:00 UTC (permalink / raw)
To: dev
Signed-off-by: Andy Green <andy@warmcat.com>
---
.../common/include/generic/rte_byteorder.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_eal/common/include/generic/rte_byteorder.h b/lib/librte_eal/common/include/generic/rte_byteorder.h
index 9bed85cca..8ffbac394 100644
--- a/lib/librte_eal/common/include/generic/rte_byteorder.h
+++ b/lib/librte_eal/common/include/generic/rte_byteorder.h
@@ -123,7 +123,7 @@ typedef uint64_t rte_le64_t; /**< 64-bit little-endian value. */
static inline uint16_t
rte_constant_bswap16(uint16_t x)
{
- return RTE_STATIC_BSWAP16(x);
+ return (uint16_t)RTE_STATIC_BSWAP16((uint16_t)x);
}
/*
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 18/24] rte_ether.h: explicit cast avoiding truncation warning
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (16 preceding siblings ...)
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 17/24] rte_byteorder.h: explicit cast for return promotion Andy Green
@ 2018-05-11 2:00 ` Andy Green
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 19/24] rte_ether.h: stack vars declared at top of function Andy Green
` (6 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 2:00 UTC (permalink / raw)
To: dev
/projects/lagopus/src/dpdk/build/include/rte_ether.h:213:13:
warning: conversion from 'int' to 'uint8_t'
{aka 'unsigned char'} may change value [-Wconversion]
addr[0] &= ~ETHER_GROUP_ADDR;
/* clear multicast bit */
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_net/rte_ether.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index 95d0a533f..01d57f0ae 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -210,7 +210,7 @@ static inline void eth_random_addr(uint8_t *addr)
uint8_t *p = (uint8_t *)&rand;
rte_memcpy(addr, p, ETHER_ADDR_LEN);
- addr[0] &= ~ETHER_GROUP_ADDR; /* clear multicast bit */
+ addr[0] &= (uint8_t)~ETHER_GROUP_ADDR; /* clear multicast bit */
addr[0] |= ETHER_LOCAL_ADMIN_ADDR; /* set local assignment bit */
}
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 19/24] rte_ether.h: stack vars declared at top of function
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (17 preceding siblings ...)
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 18/24] rte_ether.h: explicit cast avoiding truncation warning Andy Green
@ 2018-05-11 2:00 ` Andy Green
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 20/24] rte_ethdev.h: align sign and scope of temp var Andy Green
` (5 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 2:00 UTC (permalink / raw)
To: dev
/projects/lagopus/src/dpdk/build/include/rte_ether.h:
In function 'rte_vlan_strip':
/projects/lagopus/src/dpdk/build/include/rte_ether.h:357:2:
warning: ISO C90 forbids mixed declarations and code
[-Wdeclaration-after-statement]
struct vlan_hdr *vh = (struct vlan_hdr *)(eh + 1);
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_net/rte_ether.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index 01d57f0ae..bee2b34f0 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -350,11 +350,12 @@ static inline int rte_vlan_strip(struct rte_mbuf *m)
{
struct ether_hdr *eh
= rte_pktmbuf_mtod(m, struct ether_hdr *);
+ struct vlan_hdr *vh;
if (eh->ether_type != rte_cpu_to_be_16(ETHER_TYPE_VLAN))
return -1;
- struct vlan_hdr *vh = (struct vlan_hdr *)(eh + 1);
+ vh = (struct vlan_hdr *)(eh + 1);
m->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
m->vlan_tci = rte_be_to_cpu_16(vh->vlan_tci);
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 20/24] rte_ethdev.h: align sign and scope of temp var
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (18 preceding siblings ...)
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 19/24] rte_ether.h: stack vars declared at top of function Andy Green
@ 2018-05-11 2:00 ` Andy Green
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 21/24] rte_ethdev.h: explicit cast for truncation Andy Green
` (4 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 2:00 UTC (permalink / raw)
To: dev
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_ethdev/rte_ethdev.h | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 7ccf4bae6..2487e1d2d 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -3801,6 +3801,7 @@ rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
{
struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ uint16_t nb_rx;
#ifdef RTE_LIBRTE_ETHDEV_DEBUG
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
@@ -3811,18 +3812,22 @@ rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
return 0;
}
#endif
- int16_t nb_rx = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id],
- rx_pkts, nb_pkts);
+ nb_rx = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id],
+ rx_pkts, nb_pkts);
#ifdef RTE_ETHDEV_RXTX_CALLBACKS
- struct rte_eth_rxtx_callback *cb = dev->post_rx_burst_cbs[queue_id];
-
- if (unlikely(cb != NULL)) {
- do {
- nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
- nb_pkts, cb->param);
- cb = cb->next;
- } while (cb != NULL);
+ {
+ struct rte_eth_rxtx_callback *cb =
+ dev->post_rx_burst_cbs[queue_id];
+
+ if (unlikely(cb != NULL)) {
+ do {
+ nb_rx = cb->fn.rx(port_id, queue_id,
+ rx_pkts, nb_rx,
+ nb_pkts, cb->param);
+ cb = cb->next;
+ } while (cb != NULL);
+ }
}
#endif
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 21/24] rte_ethdev.h: explicit cast for truncation
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (19 preceding siblings ...)
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 20/24] rte_ethdev.h: align sign and scope of temp var Andy Green
@ 2018-05-11 2:00 ` Andy Green
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 22/24] rte_hash_crc.h: stack vars declared at top of function Andy Green
` (3 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 2:00 UTC (permalink / raw)
To: dev
/projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
In function 'rte_eth_tx_buffer_flush':
/projects/lagopus/src/dpdk/build/include/rte_ethdev.h:4248:55:
warning: conversion from 'int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
buffer->error_callback(&buffer->pkts[sent], to_send - sent,
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_ethdev/rte_ethdev.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 2487e1d2d..2cb5fe3be 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -4245,8 +4245,9 @@ rte_eth_tx_buffer_flush(uint16_t port_id, uint16_t queue_id,
/* All packets sent, or to be dealt with by callback below */
if (unlikely(sent != to_send))
- buffer->error_callback(&buffer->pkts[sent], to_send - sent,
- buffer->error_userdata);
+ buffer->error_callback(&buffer->pkts[sent],
+ (uint16_t)(to_send - sent),
+ buffer->error_userdata);
return sent;
}
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 22/24] rte_hash_crc.h: stack vars declared at top of function
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (20 preceding siblings ...)
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 21/24] rte_ethdev.h: explicit cast for truncation Andy Green
@ 2018-05-11 2:00 ` Andy Green
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 23/24] rte_hash_crc.h: explicit casts for truncation Andy Green
` (2 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 2:00 UTC (permalink / raw)
To: dev
/projects/lagopus/src/dpdk/build/include/rte_hash_crc.h:
In function 'crc32c_2words':
/projects/lagopus/src/dpdk/build/include/rte_hash_crc.h:347:2:
warning: ISO C90 forbids mixed declarations and code
[-Wdeclaration-after-statement]
uint32_t crc, term1, term2;
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_hash/rte_hash_crc.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h
index 479f84b14..5f5fb3db1 100644
--- a/lib/librte_hash/rte_hash_crc.h
+++ b/lib/librte_hash/rte_hash_crc.h
@@ -338,14 +338,13 @@ crc32c_1word(uint32_t data, uint32_t init_val)
static inline uint32_t
crc32c_2words(uint64_t data, uint32_t init_val)
{
+ uint32_t crc, term1, term2;
union {
uint64_t u64;
uint32_t u32[2];
} d;
d.u64 = data;
- uint32_t crc, term1, term2;
-
crc = init_val;
crc ^= d.u32[0];
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 23/24] rte_hash_crc.h: explicit casts for truncation
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (21 preceding siblings ...)
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 22/24] rte_hash_crc.h: stack vars declared at top of function Andy Green
@ 2018-05-11 2:00 ` Andy Green
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 24/24] test_table_pipeline: repair munged indirection level Andy Green
2018-05-11 3:04 ` [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Stephen Hemminger
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 2:00 UTC (permalink / raw)
To: dev
/projects/lagopus/src/dpdk/build/include/rte_hash_crc.h:
In function 'crc32c_sse42_u64_mimic':
/projects/lagopus/src/dpdk/build/include/rte_hash_crc.h:402:40:
warning: conversion from 'uint64_t' {aka 'long unsigned int'}
to 'uint32_t' {aka 'unsigned int'} may change value [-Wconversion]
init_val = crc32c_sse42_u32(d.u32[0], init_val);
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_hash/rte_hash_crc.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h
index 5f5fb3db1..cf28031b3 100644
--- a/lib/librte_hash/rte_hash_crc.h
+++ b/lib/librte_hash/rte_hash_crc.h
@@ -398,9 +398,9 @@ crc32c_sse42_u64_mimic(uint64_t data, uint64_t init_val)
} d;
d.u64 = data;
- init_val = crc32c_sse42_u32(d.u32[0], init_val);
- init_val = crc32c_sse42_u32(d.u32[1], init_val);
- return init_val;
+ init_val = crc32c_sse42_u32(d.u32[0], (uint32_t)init_val);
+ init_val = crc32c_sse42_u32(d.u32[1], (uint32_t)init_val);
+ return (uint32_t)init_val;
}
#endif
@@ -412,7 +412,7 @@ crc32c_sse42_u64(uint64_t data, uint64_t init_val)
"crc32q %[data], %[init_val];"
: [init_val] "+r" (init_val)
: [data] "rm" (data));
- return init_val;
+ return (uint32_t)init_val;
}
#endif
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 24/24] test_table_pipeline: repair munged indirection level
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (22 preceding siblings ...)
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 23/24] rte_hash_crc.h: explicit casts for truncation Andy Green
@ 2018-05-11 2:00 ` Andy Green
2018-05-11 3:04 ` [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Stephen Hemminger
24 siblings, 0 replies; 26+ messages in thread
From: Andy Green @ 2018-05-11 2:00 UTC (permalink / raw)
To: dev
Signed-off-by: Andy Green <andy@warmcat.com>
---
test/test/test_table_pipeline.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/test/test_table_pipeline.c b/test/test/test_table_pipeline.c
index 055a1a4e7..d007d55ce 100644
--- a/test/test/test_table_pipeline.c
+++ b/test/test/test_table_pipeline.c
@@ -71,7 +71,7 @@ table_action_stub_hit(struct rte_pipeline *p, struct rte_mbuf **pkts,
rte_pipeline_table_action_handler_miss
table_action_stub_miss(struct rte_pipeline *p, struct rte_mbuf **pkts,
- uint64_t pkts_mask, struct rte_pipeline_table_entry **entry, void *arg);
+ uint64_t pkts_mask, struct rte_pipeline_table_entry *entry, void *arg);
rte_pipeline_table_action_handler_hit
table_action_0x00(__attribute__((unused)) struct rte_pipeline *p,
@@ -105,7 +105,7 @@ rte_pipeline_table_action_handler_miss
table_action_stub_miss(struct rte_pipeline *p,
__attribute__((unused)) struct rte_mbuf **pkts,
uint64_t pkts_mask,
- __attribute__((unused)) struct rte_pipeline_table_entry **entry,
+ __attribute__((unused)) struct rte_pipeline_table_entry *entry,
__attribute__((unused)) void *arg)
{
printf("STUB Table Action Miss - setting mask to 0x%"PRIx64"\n",
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus
2018-05-11 1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
` (23 preceding siblings ...)
2018-05-11 2:00 ` [dpdk-dev] [PATCH v2 24/24] test_table_pipeline: repair munged indirection level Andy Green
@ 2018-05-11 3:04 ` Stephen Hemminger
24 siblings, 0 replies; 26+ messages in thread
From: Stephen Hemminger @ 2018-05-11 3:04 UTC (permalink / raw)
To: Andy Green; +Cc: dev
On Fri, 11 May 2018 09:58:54 +0800
Andy Green <andy@warmcat.com> wrote:
> The following series fixes build problems in dpdk master
> headers, found when using it as the dpdk subproject in
> lagopus. These errors are coming when you try to use
> the dpdk headers, not when you build dpdk itself.
>
> Two patches are updated to follow requests for larger
> work.
>
> ---
>
> Andy Green (24):
> lib/librte_eal: import libbsd strlcpy
> lib/librte_ethdev: change eth-dev-ops API to return int
> rte_common.h: cast gcc builtin result to avoid complaints
> lib/librte_eal: explicit tmp cast
> lib/librte_eal: explicit cast for signed change
> /lib/librte_eal: stage cast from uint64 to long
> rte_spinlock.h: stack declarations before code
> rte_ring_generic.h: stack declarations before code
> rte_ring.h: remove signed type flipflopping
> rte_dev.h: stack declaration at top of own basic block
> rte_mbuf.h: avoid warnings from inadvertant promotion
> rte_mbuf.h: explicit casts for int16 to uint16
> rte_mbuf.h: make sure RTE-MIN compares same types
> rte_mbuf.h: explicit cast restricting ptrdiff to uint16
> rte_mbuf.h: explicit cast for size type to uint32
> rte_mbuf.h: explicit casts to uint16 to avoid warnings
> rte_byteorder.h: explicit cast for return promotion
> rte_ether.h: explicit cast avoiding truncation warning
> rte_ether.h: stack vars declared at top of function
> rte_ethdev.h: align sign and scope of temp var
> rte_ethdev.h: explicit cast for truncation
> rte_hash_crc.h: stack vars declared at top of function
> rte_hash_crc.h: explicit casts for truncation
> test_table_pipeline: repair munged indirection level
>
>
> drivers/net/ark/ark_ethdev_rx.c | 4 +-
> drivers/net/ark/ark_ethdev_rx.h | 3 +-
> drivers/net/avf/avf_rxtx.c | 4 +-
> drivers/net/avf/avf_rxtx.h | 2 +
> drivers/net/bnxt/bnxt_ethdev.c | 5 ++-
> drivers/net/dpaa/dpaa_ethdev.c | 4 +-
> drivers/net/dpaa2/dpaa2_ethdev.c | 6 ++-
> drivers/net/e1000/e1000_ethdev.h | 6 +--
> drivers/net/e1000/em_rxtx.c | 4 +-
> drivers/net/e1000/igb_rxtx.c | 4 +-
> drivers/net/enic/enic_ethdev.c | 9 ++---
> drivers/net/i40e/i40e_rxtx.c | 4 +-
> drivers/net/i40e/i40e_rxtx.h | 3 +-
> drivers/net/ixgbe/ixgbe_ethdev.h | 3 +-
> drivers/net/ixgbe/ixgbe_rxtx.c | 4 +-
> drivers/net/nfp/nfp_net.c | 9 ++---
> drivers/net/sfc/sfc_ethdev.c | 4 +-
> drivers/net/thunderx/nicvf_ethdev.c | 2 +
> drivers/net/thunderx/nicvf_rxtx.c | 4 +-
> drivers/net/thunderx/nicvf_rxtx.h | 2 +
> drivers/net/vhost/rte_eth_vhost.c | 4 +-
> examples/l3fwd-power/main.c | 2 +
> lib/librte_eal/common/eal_common_string_fns.c | 34 +++++++++++++++++++
> .../common/include/arch/x86/rte_memcpy.h | 8 ++--
> .../common/include/arch/x86/rte_spinlock.h | 4 ++
> .../common/include/generic/rte_byteorder.h | 2 +
> lib/librte_eal/common/include/rte_common.h | 2 +
> lib/librte_eal/common/include/rte_dev.h | 15 +++++---
> lib/librte_eal/common/include/rte_lcore.h | 2 +
> lib/librte_eal/common/include/rte_random.h | 6 ++-
> lib/librte_eal/common/include/rte_string_fns.h | 7 +---
> lib/librte_ethdev/rte_ethdev.h | 30 ++++++++++-------
> lib/librte_ethdev/rte_ethdev_core.h | 4 +-
> lib/librte_hash/rte_hash_crc.h | 11 +++---
> lib/librte_mbuf/rte_mbuf.h | 36 +++++++++++---------
> lib/librte_net/rte_ether.h | 5 ++-
> lib/librte_ring/rte_ring.h | 4 +-
> lib/librte_ring/rte_ring_c11_mem.h | 2 +
> lib/librte_ring/rte_ring_generic.h | 10 ++----
> test/test/test_table_pipeline.c | 4 +-
> 40 files changed, 157 insertions(+), 121 deletions(-)
>
> --
> Signature
All looks good to me.
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
^ permalink raw reply [flat|nested] 26+ messages in thread