DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus
@ 2018-05-12  1:58 Andy Green
  2018-05-12  1:58 ` [dpdk-dev] [PATCH v3 01/24] lib/librte_eal: import libbsd strlcpy Andy Green
                   ` (24 more replies)
  0 siblings, 25 replies; 174+ messages in thread
From: Andy Green @ 2018-05-12  1:58 UTC (permalink / raw)
  To: dev

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.

Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>

---

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

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v3 01/24] lib/librte_eal: import libbsd strlcpy
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
@ 2018-05-12  1:58 ` Andy Green
  2018-05-13 14:56   ` Thomas Monjalon
  2018-05-12  1:58 ` [dpdk-dev] [PATCH v3 02/24] lib/librte_ethdev: change eth-dev-ops API to return int Andy Green
                   ` (23 subsequent siblings)
  24 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 02/24] lib/librte_ethdev: change eth-dev-ops API to return int
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
  2018-05-12  1:58 ` [dpdk-dev] [PATCH v3 01/24] lib/librte_eal: import libbsd strlcpy Andy Green
@ 2018-05-12  1:58 ` Andy Green
  2018-05-13 14:58   ` Thomas Monjalon
  2018-05-12  1:58 ` [dpdk-dev] [PATCH v3 03/24] rte_common.h: cast gcc builtin result to avoid complaints Andy Green
                   ` (22 subsequent siblings)
  24 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-12  1:58 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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 03/24] rte_common.h: cast gcc builtin result to avoid complaints
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
  2018-05-12  1:58 ` [dpdk-dev] [PATCH v3 01/24] lib/librte_eal: import libbsd strlcpy Andy Green
  2018-05-12  1:58 ` [dpdk-dev] [PATCH v3 02/24] lib/librte_ethdev: change eth-dev-ops API to return int Andy Green
@ 2018-05-12  1:58 ` Andy Green
  2018-05-13 20:40   ` Thomas Monjalon
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 04/24] lib/librte_eal: explicit tmp cast Andy Green
                   ` (21 subsequent siblings)
  24 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-12  1:58 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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 04/24] lib/librte_eal: explicit tmp cast
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (2 preceding siblings ...)
  2018-05-12  1:58 ` [dpdk-dev] [PATCH v3 03/24] rte_common.h: cast gcc builtin result to avoid complaints Andy Green
@ 2018-05-12  1:59 ` Andy Green
  2018-05-13 16:19   ` Thomas Monjalon
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 05/24] lib/librte_eal: explicit cast for signed change Andy Green
                   ` (20 subsequent siblings)
  24 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 05/24] lib/librte_eal: explicit cast for signed change
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (3 preceding siblings ...)
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 04/24] lib/librte_eal: explicit tmp cast Andy Green
@ 2018-05-12  1:59 ` Andy Green
  2018-05-13 20:40   ` Thomas Monjalon
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 06/24] /lib/librte_eal: stage cast from uint64 to long Andy Green
                   ` (19 subsequent siblings)
  24 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 06/24] /lib/librte_eal: stage cast from uint64 to long
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (4 preceding siblings ...)
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 05/24] lib/librte_eal: explicit cast for signed change Andy Green
@ 2018-05-12  1:59 ` Andy Green
  2018-05-13 16:24   ` Thomas Monjalon
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 07/24] rte_spinlock.h: stack declarations before code Andy Green
                   ` (18 subsequent siblings)
  24 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 07/24] rte_spinlock.h: stack declarations before code
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (5 preceding siblings ...)
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 06/24] /lib/librte_eal: stage cast from uint64 to long Andy Green
@ 2018-05-12  1:59 ` Andy Green
  2018-05-13 20:42   ` Thomas Monjalon
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 08/24] rte_ring_generic.h: " Andy Green
                   ` (17 subsequent siblings)
  24 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 08/24] rte_ring_generic.h: stack declarations before code
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (6 preceding siblings ...)
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 07/24] rte_spinlock.h: stack declarations before code Andy Green
@ 2018-05-12  1:59 ` Andy Green
  2018-05-13 16:47   ` Thomas Monjalon
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 09/24] rte_ring.h: remove signed type flipflopping Andy Green
                   ` (16 subsequent siblings)
  24 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 09/24] rte_ring.h: remove signed type flipflopping
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (7 preceding siblings ...)
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 08/24] rte_ring_generic.h: " Andy Green
@ 2018-05-12  1:59 ` Andy Green
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 10/24] rte_dev.h: stack declaration at top of own basic block Andy Green
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 10/24] rte_dev.h: stack declaration at top of own basic block
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (8 preceding siblings ...)
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 09/24] rte_ring.h: remove signed type flipflopping Andy Green
@ 2018-05-12  1:59 ` Andy Green
  2018-05-13 20:41   ` Thomas Monjalon
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 11/24] rte_mbuf.h: avoid warnings from inadvertant promotion Andy Green
                   ` (14 subsequent siblings)
  24 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 11/24] rte_mbuf.h: avoid warnings from inadvertant promotion
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (9 preceding siblings ...)
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 10/24] rte_dev.h: stack declaration at top of own basic block Andy Green
@ 2018-05-12  1:59 ` Andy Green
  2018-05-13 16:54   ` Thomas Monjalon
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 12/24] rte_mbuf.h: explicit casts for int16 to uint16 Andy Green
                   ` (13 subsequent siblings)
  24 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 12/24] rte_mbuf.h: explicit casts for int16 to uint16
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (10 preceding siblings ...)
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 11/24] rte_mbuf.h: avoid warnings from inadvertant promotion Andy Green
@ 2018-05-12  1:59 ` Andy Green
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 13/24] rte_mbuf.h: make sure RTE-MIN compares same types Andy Green
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 13/24] rte_mbuf.h: make sure RTE-MIN compares same types
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (11 preceding siblings ...)
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 12/24] rte_mbuf.h: explicit casts for int16 to uint16 Andy Green
@ 2018-05-12  1:59 ` Andy Green
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 14/24] rte_mbuf.h: explicit cast restricting ptrdiff to uint16 Andy Green
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 14/24] rte_mbuf.h: explicit cast restricting ptrdiff to uint16
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (12 preceding siblings ...)
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 13/24] rte_mbuf.h: make sure RTE-MIN compares same types Andy Green
@ 2018-05-12  1:59 ` Andy Green
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 15/24] rte_mbuf.h: explicit cast for size type to uint32 Andy Green
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-12  1:59 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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 15/24] rte_mbuf.h: explicit cast for size type to uint32
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (13 preceding siblings ...)
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 14/24] rte_mbuf.h: explicit cast restricting ptrdiff to uint16 Andy Green
@ 2018-05-12  1:59 ` Andy Green
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 16/24] rte_mbuf.h: explicit casts to uint16 to avoid warnings Andy Green
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-12  1:59 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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 16/24] rte_mbuf.h: explicit casts to uint16 to avoid warnings
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (14 preceding siblings ...)
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 15/24] rte_mbuf.h: explicit cast for size type to uint32 Andy Green
@ 2018-05-12  2:00 ` Andy Green
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 17/24] rte_byteorder.h: explicit cast for return promotion Andy Green
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 17/24] rte_byteorder.h: explicit cast for return promotion
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (15 preceding siblings ...)
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 16/24] rte_mbuf.h: explicit casts to uint16 to avoid warnings Andy Green
@ 2018-05-12  2:00 ` Andy Green
  2018-05-13 16:59   ` Thomas Monjalon
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 18/24] rte_ether.h: explicit cast avoiding truncation warning Andy Green
                   ` (7 subsequent siblings)
  24 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 18/24] rte_ether.h: explicit cast avoiding truncation warning
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (16 preceding siblings ...)
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 17/24] rte_byteorder.h: explicit cast for return promotion Andy Green
@ 2018-05-12  2:00 ` Andy Green
  2018-05-13 17:02   ` Thomas Monjalon
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 19/24] rte_ether.h: stack vars declared at top of function Andy Green
                   ` (6 subsequent siblings)
  24 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 19/24] rte_ether.h: stack vars declared at top of function
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (17 preceding siblings ...)
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 18/24] rte_ether.h: explicit cast avoiding truncation warning Andy Green
@ 2018-05-12  2:00 ` Andy Green
  2018-05-13 20:42   ` Thomas Monjalon
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 20/24] rte_ethdev.h: align sign and scope of temp var Andy Green
                   ` (5 subsequent siblings)
  24 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 20/24] rte_ethdev.h: align sign and scope of temp var
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (18 preceding siblings ...)
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 19/24] rte_ether.h: stack vars declared at top of function Andy Green
@ 2018-05-12  2:00 ` Andy Green
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 21/24] rte_ethdev.h: explicit cast for truncation Andy Green
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 21/24] rte_ethdev.h: explicit cast for truncation
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (19 preceding siblings ...)
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 20/24] rte_ethdev.h: align sign and scope of temp var Andy Green
@ 2018-05-12  2:00 ` Andy Green
  2018-05-13 20:43   ` Thomas Monjalon
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 22/24] rte_hash_crc.h: stack vars declared at top of function Andy Green
                   ` (3 subsequent siblings)
  24 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 22/24] rte_hash_crc.h: stack vars declared at top of function
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (20 preceding siblings ...)
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 21/24] rte_ethdev.h: explicit cast for truncation Andy Green
@ 2018-05-12  2:00 ` Andy Green
  2018-05-13 20:44   ` Thomas Monjalon
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 23/24] rte_hash_crc.h: explicit casts for truncation Andy Green
                   ` (2 subsequent siblings)
  24 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 23/24] rte_hash_crc.h: explicit casts for truncation
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (21 preceding siblings ...)
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 22/24] rte_hash_crc.h: stack vars declared at top of function Andy Green
@ 2018-05-12  2:00 ` Andy Green
  2018-05-13 20:44   ` Thomas Monjalon
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 24/24] test_table_pipeline: repair munged indirection level Andy Green
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
  24 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* [dpdk-dev] [PATCH v3 24/24] test_table_pipeline: repair munged indirection level
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (22 preceding siblings ...)
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 23/24] rte_hash_crc.h: explicit casts for truncation Andy Green
@ 2018-05-12  2:00 ` Andy Green
  2018-05-13 20:33   ` Thomas Monjalon
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
  24 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-12  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] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 01/24] lib/librte_eal: import libbsd strlcpy
  2018-05-12  1:58 ` [dpdk-dev] [PATCH v3 01/24] lib/librte_eal: import libbsd strlcpy Andy Green
@ 2018-05-13 14:56   ` Thomas Monjalon
  2018-05-13 23:07     ` Andy Green
  0 siblings, 1 reply; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-13 14:56 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

Hi,

12/05/2018 03:58, Andy Green:
> Signed-off-by: Andy Green <andy@warmcat.com>

Why do we need to replace rte_strlcpy fallback?
GCC 8 complains about the fallback using snprintf?


> +/*
> + * 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)
> +{
[...]
> +}

I would like to be sure there is no legal issue with this imported code.


[...]
> -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);

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 02/24] lib/librte_ethdev: change eth-dev-ops API to return int
  2018-05-12  1:58 ` [dpdk-dev] [PATCH v3 02/24] lib/librte_ethdev: change eth-dev-ops API to return int Andy Green
@ 2018-05-13 14:58   ` Thomas Monjalon
  2018-05-13 23:10     ` Andy Green
  0 siblings, 1 reply; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-13 14:58 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

12/05/2018 03:58, Andy Green:
> Signed-off-by: Andy Green <andy@warmcat.com>
[...]
> --- a/lib/librte_ethdev/rte_ethdev_core.h
> +++ b/lib/librte_ethdev/rte_ethdev_core.h
> -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. */

What is the reason of this change?

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 04/24] lib/librte_eal: explicit tmp cast
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 04/24] lib/librte_eal: explicit tmp cast Andy Green
@ 2018-05-13 16:19   ` Thomas Monjalon
  0 siblings, 0 replies; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-13 16:19 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

12/05/2018 03:59, Andy Green:
> Signed-off-by: Andy Green <andy@warmcat.com>

I know it's boring because there are a lot of things to fix for GCC 8,
but each patch should justify why the change is required, in order to keep
track in the history.
In this case, I think the compiler message would help.
Thanks

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 06/24] /lib/librte_eal: stage cast from uint64 to long
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 06/24] /lib/librte_eal: stage cast from uint64 to long Andy Green
@ 2018-05-13 16:24   ` Thomas Monjalon
  2018-05-13 23:17     ` Andy Green
  0 siblings, 1 reply; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-13 16:24 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

12/05/2018 03:59, Andy Green:
> warning: conversion to 'uint64_t' {aka 'long unsigned int'}
> from 'long int' may change the sign of the result
> [-Wsign-conversion]
>   val = lrand48();
>         ^~~~~~~
[...]
>  rte_rand(void)
>  {
>  	uint64_t val;
> -	val = lrand48();
> +	val = (unsigned long)lrand48();

I think the right cast is uint64_t.
It makes a difference in 32-bit environment.

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 08/24] rte_ring_generic.h: stack declarations before code
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 08/24] rte_ring_generic.h: " Andy Green
@ 2018-05-13 16:47   ` Thomas Monjalon
  2018-05-13 23:21     ` Andy Green
  0 siblings, 1 reply; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-13 16:47 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, bruce.richardson, olivier.matz

12/05/2018 03:59, Andy Green:
> /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;

The fix line is:
Fixes: 0dfc98c507b1 ("ring: separate out head index manipulation")

But I wonder why it was done like this. Maybe there is a hidden reason.
Bruce? Olivier?

> Signed-off-by: Andy Green <andy@warmcat.com>
[...]
> --- 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);

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 11/24] rte_mbuf.h: avoid warnings from inadvertant promotion
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 11/24] rte_mbuf.h: avoid warnings from inadvertant promotion Andy Green
@ 2018-05-13 16:54   ` Thomas Monjalon
  2018-05-13 23:27     ` Andy Green
  0 siblings, 1 reply; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-13 16:54 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

12/05/2018 03:59, Andy Green:
> @@ -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;
>  	}

I don't understand what it is fixing.
Please could you explain or show the GCC warning?

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 17/24] rte_byteorder.h: explicit cast for return promotion
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 17/24] rte_byteorder.h: explicit cast for return promotion Andy Green
@ 2018-05-13 16:59   ` Thomas Monjalon
  2018-05-14  0:02     ` Andy Green
  0 siblings, 1 reply; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-13 16:59 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

12/05/2018 04:00, Andy Green:
> --- 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);
>  }

x is already uint16_t, and RTE_STATIC_BSWAP16 is already casting to uint16_t.
So why these casts are needed?
And why not in rte_constant_bswap32/64?

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 18/24] rte_ether.h: explicit cast avoiding truncation warning
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 18/24] rte_ether.h: explicit cast avoiding truncation warning Andy Green
@ 2018-05-13 17:02   ` Thomas Monjalon
  2018-05-14  0:05     ` Andy Green
  0 siblings, 1 reply; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-13 17:02 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

12/05/2018 04:00, Andy Green:
> /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 */
[..]
>  	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 */

ETHER_GROUP_ADDR and ETHER_LOCAL_ADMIN_ADDR are defined macros,
they have no type, so I don't understand the need for casting.
And I don't understand why it is not needed for ETHER_LOCAL_ADMIN_ADDR.

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 24/24] test_table_pipeline: repair munged indirection level
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 24/24] test_table_pipeline: repair munged indirection level Andy Green
@ 2018-05-13 20:33   ` Thomas Monjalon
  2018-05-14  0:22     ` Andy Green
  0 siblings, 1 reply; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-13 20:33 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

12/05/2018 04:00, Andy Green:
> Signed-off-by: Andy Green <andy@warmcat.com>

May be a fix of
Fixes: 4c387fcdf777 ("pipeline: add new functions for action handlers")

>  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);

Why changing only
	table_action_stub_miss
and not
	table_action_stub_hit
	table_action_0x00
?

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 03/24] rte_common.h: cast gcc builtin result to avoid complaints
  2018-05-12  1:58 ` [dpdk-dev] [PATCH v3 03/24] rte_common.h: cast gcc builtin result to avoid complaints Andy Green
@ 2018-05-13 20:40   ` Thomas Monjalon
  0 siblings, 0 replies; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-13 20:40 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, stable

12/05/2018 03:58, Andy Green:
> /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.

    Fixes: 03f6bced5bba ("eal: use intrinsic function")
    Cc: stable@dpdk.org

> Signed-off-by: Andy Green <andy@warmcat.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 05/24] lib/librte_eal: explicit cast for signed change
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 05/24] lib/librte_eal: explicit cast for signed change Andy Green
@ 2018-05-13 20:40   ` Thomas Monjalon
  0 siblings, 0 replies; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-13 20:40 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, stable

12/05/2018 03:59, Andy Green:
> /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();

    Fixes: 5583037a7950 ("eal: get relative core index")
    Cc: stable@dpdk.org

> Signed-off-by: Andy Green <andy@warmcat.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 10/24] rte_dev.h: stack declaration at top of own basic block
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 10/24] rte_dev.h: stack declaration at top of own basic block Andy Green
@ 2018-05-13 20:41   ` Thomas Monjalon
  0 siblings, 0 replies; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-13 20:41 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, stable

12/05/2018 03:59, Andy Green:
> /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];

    Fixes: b974e4a40cb5 ("ethdev: make error checking macros public")
    Cc: stable@dpdk.org

> Signed-off-by: Andy Green <andy@warmcat.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 07/24] rte_spinlock.h: stack declarations before code
  2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 07/24] rte_spinlock.h: stack declarations before code Andy Green
@ 2018-05-13 20:42   ` Thomas Monjalon
  0 siblings, 0 replies; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-13 20:42 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, stable

12/05/2018 03:59, Andy Green:
> /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;

    Fixes: ba7468997ea6 ("spinlock: add HTM lock elision for x86")
    Cc: stable@dpdk.org

> Signed-off-by: Andy Green <andy@warmcat.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 19/24] rte_ether.h: stack vars declared at top of function
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 19/24] rte_ether.h: stack vars declared at top of function Andy Green
@ 2018-05-13 20:42   ` Thomas Monjalon
  0 siblings, 0 replies; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-13 20:42 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, stable

12/05/2018 04:00, Andy Green:
> /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);

    Fixes: c974021a5949 ("ether: add soft vlan encap/decap")
    Cc: stable@dpdk.org

> Signed-off-by: Andy Green <andy@warmcat.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 21/24] rte_ethdev.h: explicit cast for truncation
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 21/24] rte_ethdev.h: explicit cast for truncation Andy Green
@ 2018-05-13 20:43   ` Thomas Monjalon
  0 siblings, 0 replies; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-13 20:43 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, stable

12/05/2018 04:00, Andy Green:
> /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,

    Fixes: d6c99e62c852 ("ethdev: add buffered Tx")
    Cc: stable@dpdk.org

> Signed-off-by: Andy Green <andy@warmcat.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 22/24] rte_hash_crc.h: stack vars declared at top of function
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 22/24] rte_hash_crc.h: stack vars declared at top of function Andy Green
@ 2018-05-13 20:44   ` Thomas Monjalon
  0 siblings, 0 replies; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-13 20:44 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, stable

12/05/2018 04:00, Andy Green:
> /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;

    Fixes: d983cf41698f ("hash: add software CRC32 implementation")
    Cc: stable@dpdk.org

> Signed-off-by: Andy Green <andy@warmcat.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 23/24] rte_hash_crc.h: explicit casts for truncation
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 23/24] rte_hash_crc.h: explicit casts for truncation Andy Green
@ 2018-05-13 20:44   ` Thomas Monjalon
  0 siblings, 0 replies; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-13 20:44 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, stable

12/05/2018 04:00, Andy Green:
> /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);

    Fixes: 00bf774bab0b ("hash: add assembly implementation of CRC32 intrinsics")
    Cc: stable@dpdk.org

> Signed-off-by: Andy Green <andy@warmcat.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 01/24] lib/librte_eal: import libbsd strlcpy
  2018-05-13 14:56   ` Thomas Monjalon
@ 2018-05-13 23:07     ` Andy Green
  0 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-13 23:07 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Stephen Hemminger



On 05/13/2018 10:56 PM, Thomas Monjalon wrote:
> Hi,
> 
> 12/05/2018 03:58, Andy Green:
>> Signed-off-by: Andy Green <andy@warmcat.com>
> 
> Why do we need to replace rte_strlcpy fallback?
> GCC 8 complains about the fallback using snprintf?

No; the first version of this patch just fixed the compiler warnings. 
But Stephen Hemminger <stephen@networkplumber.org> requested the ersatz 
rte_strlcpy be replaced --->

> 
>> +/*
>> + * 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)
>> +{
> [...]
>> +}
> 
> I would like to be sure there is no legal issue with this imported code.

"with the one from BSD".  If it's OK to use BSD anything then the way 
this is imported should be respecting the original license.

-Andy

> 
> [...]
>> -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);
> 
> 
> 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 02/24] lib/librte_ethdev: change eth-dev-ops API to return int
  2018-05-13 14:58   ` Thomas Monjalon
@ 2018-05-13 23:10     ` Andy Green
  2018-05-13 23:49       ` Thomas Monjalon
  0 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-13 23:10 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Stephen Hemminger



On 05/13/2018 10:58 PM, Thomas Monjalon wrote:
> 12/05/2018 03:58, Andy Green:
>> Signed-off-by: Andy Green <andy@warmcat.com>
> [...]
>> --- a/lib/librte_ethdev/rte_ethdev_core.h
>> +++ b/lib/librte_ethdev/rte_ethdev_core.h
>> -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. */
> 
> What is the reason of this change?

I thought I wasn't making enough patches, so I randomly started changing 
stuff.

Just kidding.  Again, the original version of this patch just fixed the 
compiler warning, but Stephen Hemminger <stephen@networkplumber.org> 
suggested going one level deeper and having this api return an int, so 
it has a way to signal errors.  It sounded reasonable to me so I did it.

-Andy

> 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 06/24] /lib/librte_eal: stage cast from uint64 to long
  2018-05-13 16:24   ` Thomas Monjalon
@ 2018-05-13 23:17     ` Andy Green
  0 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-13 23:17 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev



On 05/14/2018 12:24 AM, Thomas Monjalon wrote:
> 12/05/2018 03:59, Andy Green:
>> warning: conversion to 'uint64_t' {aka 'long unsigned int'}
>> from 'long int' may change the sign of the result
>> [-Wsign-conversion]
>>    val = lrand48();
>>          ^~~~~~~
> [...]
>>   rte_rand(void)
>>   {
>>   	uint64_t val;
>> -	val = lrand48();
>> +	val = (unsigned long)lrand48();
> 
> I think the right cast is uint64_t.
> It makes a difference in 32-bit environment.

Yes, you are right thanks.  I changed it accordingly.

-Andy

> 
> 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 08/24] rte_ring_generic.h: stack declarations before code
  2018-05-13 16:47   ` Thomas Monjalon
@ 2018-05-13 23:21     ` Andy Green
  2018-05-13 23:44       ` Thomas Monjalon
  0 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-13 23:21 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, bruce.richardson, olivier.matz



On 05/14/2018 12:47 AM, Thomas Monjalon wrote:
> 12/05/2018 03:59, Andy Green:
>> /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;
> 
> The fix line is:
> Fixes: 0dfc98c507b1 ("ring: separate out head index manipulation")

OK... people can just use git blame at the time they want to know this 
though.

> But I wonder why it was done like this. Maybe there is a hidden reason.
> Bruce? Olivier?

It's not crazy to do it for clarity, or when you thought there'd be more 
uses of the calculation.  At any rate, I don't see any openings for it 
to affect the code changing it.

-Andy

>> Signed-off-by: Andy Green <andy@warmcat.com>
> [...]
>> --- 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);
> 
> 
> 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 11/24] rte_mbuf.h: avoid warnings from inadvertant promotion
  2018-05-13 16:54   ` Thomas Monjalon
@ 2018-05-13 23:27     ` Andy Green
  0 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-13 23:27 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev



On 05/14/2018 12:54 AM, Thomas Monjalon wrote:
> 12/05/2018 03:59, Andy Green:
>> @@ -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;
>>   	}
> 
> I don't understand what it is fixing.
> Please could you explain or show the GCC warning?

"1 + value", where value is an uint16_t causes promotion to a signed 
int.  The compiler complained that we are shoving an int into a uint16_t 
return type with different size and sign.

Bumping and returning value directly instead removes the promotion and 
the problem.

I added this explanation to the patch (although the title gave a big 
clue already).

-Andy

> 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 08/24] rte_ring_generic.h: stack declarations before code
  2018-05-13 23:21     ` Andy Green
@ 2018-05-13 23:44       ` Thomas Monjalon
  2018-05-14  0:09         ` Andy Green
  0 siblings, 1 reply; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-13 23:44 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, bruce.richardson, olivier.matz

14/05/2018 01:21, Andy Green:
> 
> On 05/14/2018 12:47 AM, Thomas Monjalon wrote:
> > 12/05/2018 03:59, Andy Green:
> >> /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;
> > 
> > The fix line is:
> > Fixes: 0dfc98c507b1 ("ring: separate out head index manipulation")
> 
> OK... people can just use git blame at the time they want to know this 
> though.

No, we need it to automatically detect which commits should be backported,
and in which branch.

We also add Cc: stable@dpdk.org to confirm explicitly that is must be backported.

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 02/24] lib/librte_ethdev: change eth-dev-ops API to return int
  2018-05-13 23:10     ` Andy Green
@ 2018-05-13 23:49       ` Thomas Monjalon
  0 siblings, 0 replies; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-13 23:49 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, Stephen Hemminger

14/05/2018 01:10, Andy Green:
> 
> On 05/13/2018 10:58 PM, Thomas Monjalon wrote:
> > 12/05/2018 03:58, Andy Green:
> >> Signed-off-by: Andy Green <andy@warmcat.com>
> > [...]
> >> --- a/lib/librte_ethdev/rte_ethdev_core.h
> >> +++ b/lib/librte_ethdev/rte_ethdev_core.h
> >> -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. */
> > 
> > What is the reason of this change?
> 
> I thought I wasn't making enough patches, so I randomly started changing 
> stuff.
> 
> Just kidding.  Again, the original version of this patch just fixed the 
> compiler warning, but Stephen Hemminger <stephen@networkplumber.org> 
> suggested going one level deeper and having this api return an int, so 
> it has a way to signal errors.  It sounded reasonable to me so I did it.

OK. You know it's difficult to read the history of this series because
you don't use --in-reply-to to keep all revisions in the same thread.

At least, please provide some explanations in the message area.
Thanks

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 17/24] rte_byteorder.h: explicit cast for return promotion
  2018-05-13 16:59   ` Thomas Monjalon
@ 2018-05-14  0:02     ` Andy Green
  0 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-14  0:02 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev



On 05/14/2018 12:59 AM, Thomas Monjalon wrote:
> 12/05/2018 04:00, Andy Green:
>> --- 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);
>>   }
> 
> x is already uint16_t, and RTE_STATIC_BSWAP16 is already casting to uint16_t.
> So why these casts are needed?


After winding dpdk back inside lagopus without this patch and recooking 
everything...

In file included from 
/projects/lagopus/src/dpdk/build/include/rte_byteorder.h:15,
                  from /projects/lagopus/src/dataplane/dpdk/pktbuf.h:27,
                  from ./ofproto/mbtree.c:50:
/projects/lagopus/src/dpdk/build/include/generic/rte_byteorder.h: In 
function 'rte_constant_bswap16':
/projects/lagopus/src/dpdk/build/include/generic/rte_byteorder.h:54:45: 
warning: conversion from 'int' to 'uint16_t' {aka 'short unsigned int'} 
may change value [-Wconversion]
   ((((uint16_t)(v) & UINT16_C(0x00ff)) << 8) | \
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
    (((uint16_t)(v) & UINT16_C(0xff00)) >> 8))
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/generic/rte_byteorder.h:126:9: 
note: in expansion of macro 'RTE_STATIC_BSWAP16'
   return RTE_STATIC_BSWAP16(x);
          ^~~~~~~~~~~~~~~~~~

> And why not in rte_constant_bswap32/64?

It's likely also needed there.  I removed the second cast and then 
repeated the fix on 32/64 as well.

GCC8 building lagopus blowing chunks is my only insight into these api 
header problems in dpdk.  It only blew on bswap16.

I simply want to build lagopus with latest pieces to assess how much 
risk signing up to use lagopus (and its dependencies) ongoing gets me 
into.  So my goal is fix all the build issues around that and then why 
not provide the patches to the projects since they are done by then. 
(My lagopus fixes will have no meaning unless the dpdk fixes get in 
first, so I defer interacting with them).

I can get that to build (I think... I have to pin the dpdk subproject, 
make clean, make dpdk and then finally make to see the warnings 
repeatably) with master dpdk now with my dpdk series of ~45 patches, but 
it requires 25 patches on lagopus and there are still a ton of warnings 
to clean out and an api change about color / metering I just hacked out 
for now.  I didn't look too closely yet but maybe some more dpdk header 
usage issues to come.

-Andy

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 18/24] rte_ether.h: explicit cast avoiding truncation warning
  2018-05-13 17:02   ` Thomas Monjalon
@ 2018-05-14  0:05     ` Andy Green
  0 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-14  0:05 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev



On 05/14/2018 01:02 AM, Thomas Monjalon wrote:
> 12/05/2018 04:00, Andy Green:
>> /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 */
> [..]
>>   	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 */
> 
> ETHER_GROUP_ADDR and ETHER_LOCAL_ADMIN_ADDR are defined macros,
> they have no type, so I don't understand the need for casting.
> And I don't understand why it is not needed for ETHER_LOCAL_ADMIN_ADDR.

Both of those manifest constants are 0x1.

But ~ETHER_GROUP_ADDR is a "big number" in an int.

The compiler notices a definite truncation if you try to put 0xfffffffe 
in a uint8_t and complains.

If you try to put 0x01 in a uint8_t, the compiler feels it was OK.

-Andy

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 08/24] rte_ring_generic.h: stack declarations before code
  2018-05-13 23:44       ` Thomas Monjalon
@ 2018-05-14  0:09         ` Andy Green
  2018-05-14  1:49           ` Thomas Monjalon
  0 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-14  0:09 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, bruce.richardson, olivier.matz



On 05/14/2018 07:44 AM, Thomas Monjalon wrote:
> 14/05/2018 01:21, Andy Green:
>>
>> On 05/14/2018 12:47 AM, Thomas Monjalon wrote:
>>> 12/05/2018 03:59, Andy Green:
>>>> /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;
>>>
>>> The fix line is:
>>> Fixes: 0dfc98c507b1 ("ring: separate out head index manipulation")
>>
>> OK... people can just use git blame at the time they want to know this
>> though.
> 
> No, we need it to automatically detect which commits should be backported,

There is nothing automatic about that flow :-)

It's "automatic after every committer did the work manually" you mean.

> and in which branch.
> 
> We also add Cc: stable@dpdk.org to confirm explicitly that is must be backported.

In other projects this work falls on the maintainer(s).

-Andy

> 
> 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 24/24] test_table_pipeline: repair munged indirection level
  2018-05-13 20:33   ` Thomas Monjalon
@ 2018-05-14  0:22     ` Andy Green
  0 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-14  0:22 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev



On 05/14/2018 04:33 AM, Thomas Monjalon wrote:
> 12/05/2018 04:00, Andy Green:
>> Signed-off-by: Andy Green <andy@warmcat.com>
> 
> May be a fix of
> Fixes: 4c387fcdf777 ("pipeline: add new functions for action handlers")
> 
>>   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);
> 
> Why changing only
> 	table_action_stub_miss
> and not
> 	table_action_stub_hit
> 	table_action_0x00
> ?

OK, I extended the change to those too.

-Andy

> 
> 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v3 08/24] rte_ring_generic.h: stack declarations before code
  2018-05-14  0:09         ` Andy Green
@ 2018-05-14  1:49           ` Thomas Monjalon
  0 siblings, 0 replies; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-14  1:49 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, bruce.richardson, olivier.matz

14/05/2018 02:09, Andy Green:
> 
> On 05/14/2018 07:44 AM, Thomas Monjalon wrote:
> > 14/05/2018 01:21, Andy Green:
> >>
> >> On 05/14/2018 12:47 AM, Thomas Monjalon wrote:
> >>> 12/05/2018 03:59, Andy Green:
> >>>> /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;
> >>>
> >>> The fix line is:
> >>> Fixes: 0dfc98c507b1 ("ring: separate out head index manipulation")
> >>
> >> OK... people can just use git blame at the time they want to know this
> >> though.
> > 
> > No, we need it to automatically detect which commits should be backported,
> 
> There is nothing automatic about that flow :-)
> 
> It's "automatic after every committer did the work manually" you mean.

Yes.
In this case, I found it for you.
You just need to keep it if doing a new revision.

> > and in which branch.
> > 
> > We also add Cc: stable@dpdk.org to confirm explicitly that is must be backported.
> 
> In other projects this work falls on the maintainer(s).

In DPDK too, the maintainers often fill this field
(I did it for your 8 patches just pushed today).
But we prefer when this work is done by the patch author :)

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus
  2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
                   ` (23 preceding siblings ...)
  2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 24/24] test_table_pipeline: repair munged indirection level Andy Green
@ 2018-05-14  5:09 ` Andy Green
  2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 01/23] lib/librte_eal: import libbsd strlcpy Andy Green
                     ` (23 more replies)
  24 siblings, 24 replies; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:09 UTC (permalink / raw)
  To: dev

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.

v4 has absorbed more list comment and added 6 x patches
at the end, from getting further into lagopus build with
master DPDK.  There are still many warnings and errors
in lagopus I am working through, but so far it looks like
the solutions for those now belong in lagopus, not DPDK
after this series.

(Applies to v3, without the last 6 patches)
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>

---

Andy Green (23):
      lib/librte_eal: import libbsd strlcpy
      rte_eal_version_map: export rte-strlcpy
      lib/librte_ethdev: change eth-dev-ops API to return int
      lib/librte_eal: explicit tmp cast
      /lib/librte_eal: stage cast from uint64 to long
      rte_ring_generic.h: stack declarations before code
      rte_ring.h: remove signed type flipflopping
      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_ether.h: explicit cast avoiding truncation warning
      rte_ethdev.h: align sign and scope of temp var
      rte_byteorder.h: explicit cast for return promotion
      test_table_pipeline: repair munged indirection level
      rte_rwlock.h: gcc8 sign conversion warnings
      rte_ip.h: cast input to bswap16 to be uint16
      rte_ip.h: cast around promotion to int
      rte_ip.h: cast type decided by sizeof to uint32
      rte_ip.h: cast return checksum size to uint16
      rte_ip.h: cast away gcc8 warning on rte_ipv6_phdr_cksum


 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/generic/rte_byteorder.h         |    6 ++-
 lib/librte_eal/common/include/generic/rte_rwlock.h |    4 +-
 lib/librte_eal/common/include/rte_random.h         |    6 ++-
 lib/librte_eal/common/include/rte_string_fns.h     |    7 +---
 lib/librte_eal/rte_eal_version.map                 |    1 +
 lib/librte_ethdev/rte_ethdev.h                     |   25 ++++++++------
 lib/librte_ethdev/rte_ethdev_core.h                |    4 +-
 lib/librte_mbuf/rte_mbuf.h                         |   36 +++++++++++---------
 lib/librte_net/rte_ether.h                         |    2 +
 lib/librte_net/rte_ip.h                            |   14 ++++----
 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                    |   12 +++----
 38 files changed, 149 insertions(+), 118 deletions(-)

--
Signature

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v4 01/23] lib/librte_eal: import libbsd strlcpy
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
@ 2018-05-14  5:09   ` Andy Green
  2018-05-17 10:36     ` Bruce Richardson
  2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 02/23] rte_eal_version_map: export rte-strlcpy Andy Green
                     ` (22 subsequent siblings)
  23 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:09 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] 174+ messages in thread

* [dpdk-dev] [PATCH v4 02/23] rte_eal_version_map: export rte-strlcpy
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
  2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 01/23] lib/librte_eal: import libbsd strlcpy Andy Green
@ 2018-05-14  5:09   ` Andy Green
  2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 03/23] lib/librte_ethdev: change eth-dev-ops API to return int Andy Green
                     ` (21 subsequent siblings)
  23 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:09 UTC (permalink / raw)
  To: dev

Building dpdk as a shared library on systems without their own
native strlcpy (eg, glibc) fails, because we do not allow the
explicit export of the helper rte_strlcpy().

It used to be an inline, but it's now a function.  Building
static, there's no problem but configured to build shared, the
users of rte_strlcpy() cannot bind to the definition in
librte_eal even though they give the library on their linker
line, because it's not listed to be exported.

This must also be applied if
 lib/librte_eal: import libbsd strlcpy
is applied to allow shared build.

BTW this is a clear instance where nothing else will do but
use the api name on the commit title...

Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_eal/rte_eal_version.map |    1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index 859723974..9d5b67903 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -241,6 +241,7 @@ DPDK_18.05 {
 	rte_service_set_runstate_mapped_check;
 	rte_service_set_stats_enable;
 	rte_service_start_with_defaults;
+	rte_strlcpy;
 
 } DPDK_18.02;
 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v4 03/23] lib/librte_ethdev: change eth-dev-ops API to return int
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
  2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 01/23] lib/librte_eal: import libbsd strlcpy Andy Green
  2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 02/23] rte_eal_version_map: export rte-strlcpy Andy Green
@ 2018-05-14  5:09   ` Andy Green
  2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 04/23] lib/librte_eal: explicit tmp cast Andy Green
                     ` (20 subsequent siblings)
  23 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:09 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 f7e234d58..37f5331b0 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 8999cb2e8..889c80c3b 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] 174+ messages in thread

* [dpdk-dev] [PATCH v4 04/23] lib/librte_eal: explicit tmp cast
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (2 preceding siblings ...)
  2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 03/23] lib/librte_ethdev: change eth-dev-ops API to return int Andy Green
@ 2018-05-14  5:09   ` Andy Green
  2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 05/23] /lib/librte_eal: stage cast from uint64 to long Andy Green
                     ` (19 subsequent siblings)
  23 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:09 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] 174+ messages in thread

* [dpdk-dev] [PATCH v4 05/23] /lib/librte_eal: stage cast from uint64 to long
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (3 preceding siblings ...)
  2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 04/23] lib/librte_eal: explicit tmp cast Andy Green
@ 2018-05-14  5:09   ` Andy Green
  2018-05-17 10:47     ` Bruce Richardson
  2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 06/23] rte_ring_generic.h: stack declarations before code Andy Green
                     ` (18 subsequent siblings)
  23 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:09 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..e30777b83 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 = (uint64_t)lrand48();
 	val <<= 32;
-	val += lrand48();
+	val += (uint64_t)lrand48();
 	return val;
 }
 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v4 06/23] rte_ring_generic.h: stack declarations before code
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (4 preceding siblings ...)
  2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 05/23] /lib/librte_eal: stage cast from uint64 to long Andy Green
@ 2018-05-14  5:09   ` Andy Green
  2018-05-17  8:29     ` Olivier Matz
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 07/23] rte_ring.h: remove signed type flipflopping Andy Green
                     ` (17 subsequent siblings)
  23 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:09 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>
Fixes: 0dfc98c507b1 ("ring: separate out head index manipulation")
---
 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] 174+ messages in thread

* [dpdk-dev] [PATCH v4 07/23] rte_ring.h: remove signed type flipflopping
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (5 preceding siblings ...)
  2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 06/23] rte_ring_generic.h: stack declarations before code Andy Green
@ 2018-05-14  5:10   ` Andy Green
  2018-05-17  8:29     ` Olivier Matz
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 08/23] rte_mbuf.h: avoid warnings from inadvertant promotion Andy Green
                     ` (16 subsequent siblings)
  23 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:10 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] 174+ messages in thread

* [dpdk-dev] [PATCH v4 08/23] rte_mbuf.h: avoid warnings from inadvertant promotion
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (6 preceding siblings ...)
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 07/23] rte_ring.h: remove signed type flipflopping Andy Green
@ 2018-05-14  5:10   ` Andy Green
  2018-05-17  8:30     ` Olivier Matz
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 09/23] rte_mbuf.h: explicit casts for int16 to uint16 Andy Green
                     ` (15 subsequent siblings)
  23 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:10 UTC (permalink / raw)
  To: dev

"1 + value", where value is an uint16_t causes promotion
to a signed int.  The compiler complained that we are
shoving an int into a uint16_t return type with different
size and sign.

Bumping and returning value directly instead removes the
promotion and the problem.

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] 174+ messages in thread

* [dpdk-dev] [PATCH v4 09/23] rte_mbuf.h: explicit casts for int16 to uint16
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (7 preceding siblings ...)
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 08/23] rte_mbuf.h: avoid warnings from inadvertant promotion Andy Green
@ 2018-05-14  5:10   ` Andy Green
  2018-05-17  8:30     ` Olivier Matz
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 10/23] rte_mbuf.h: make sure RTE-MIN compares same types Andy Green
                     ` (14 subsequent siblings)
  23 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:10 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] 174+ messages in thread

* [dpdk-dev] [PATCH v4 10/23] rte_mbuf.h: make sure RTE-MIN compares same types
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (8 preceding siblings ...)
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 09/23] rte_mbuf.h: explicit casts for int16 to uint16 Andy Green
@ 2018-05-14  5:10   ` Andy Green
  2018-05-17 10:49     ` Bruce Richardson
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 11/23] rte_mbuf.h: explicit cast restricting ptrdiff to uint16 Andy Green
                     ` (13 subsequent siblings)
  23 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:10 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] 174+ messages in thread

* [dpdk-dev] [PATCH v4 11/23] rte_mbuf.h: explicit cast restricting ptrdiff to uint16
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (9 preceding siblings ...)
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 10/23] rte_mbuf.h: make sure RTE-MIN compares same types Andy Green
@ 2018-05-14  5:10   ` Andy Green
  2018-05-17 10:50     ` Bruce Richardson
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 12/23] rte_mbuf.h: explicit cast for size type to uint32 Andy Green
                     ` (12 subsequent siblings)
  23 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:10 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] 174+ messages in thread

* [dpdk-dev] [PATCH v4 12/23] rte_mbuf.h: explicit cast for size type to uint32
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (10 preceding siblings ...)
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 11/23] rte_mbuf.h: explicit cast restricting ptrdiff to uint16 Andy Green
@ 2018-05-14  5:10   ` Andy Green
  2018-05-17 10:53     ` Bruce Richardson
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 13/23] rte_mbuf.h: explicit casts to uint16 to avoid warnings Andy Green
                     ` (11 subsequent siblings)
  23 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:10 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] 174+ messages in thread

* [dpdk-dev] [PATCH v4 13/23] rte_mbuf.h: explicit casts to uint16 to avoid warnings
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (11 preceding siblings ...)
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 12/23] rte_mbuf.h: explicit cast for size type to uint32 Andy Green
@ 2018-05-14  5:10   ` Andy Green
  2018-05-17 10:58     ` Bruce Richardson
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 14/23] rte_ether.h: explicit cast avoiding truncation warning Andy Green
                     ` (10 subsequent siblings)
  23 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:10 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] 174+ messages in thread

* [dpdk-dev] [PATCH v4 14/23] rte_ether.h: explicit cast avoiding truncation warning
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (12 preceding siblings ...)
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 13/23] rte_mbuf.h: explicit casts to uint16 to avoid warnings Andy Green
@ 2018-05-14  5:10   ` Andy Green
  2018-05-17 11:01     ` Bruce Richardson
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 15/23] rte_ethdev.h: align sign and scope of temp var Andy Green
                     ` (9 subsequent siblings)
  23 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:10 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 27c919594..bee2b34f0 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] 174+ messages in thread

* [dpdk-dev] [PATCH v4 15/23] rte_ethdev.h: align sign and scope of temp var
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (13 preceding siblings ...)
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 14/23] rte_ether.h: explicit cast avoiding truncation warning Andy Green
@ 2018-05-14  5:10   ` Andy Green
  2018-05-17 13:54     ` Bruce Richardson
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 16/23] rte_byteorder.h: explicit cast for return promotion Andy Green
                     ` (8 subsequent siblings)
  23 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:10 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 49c2ebbd5..2cb5fe3be 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] 174+ messages in thread

* [dpdk-dev] [PATCH v4 16/23] rte_byteorder.h: explicit cast for return promotion
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (14 preceding siblings ...)
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 15/23] rte_ethdev.h: align sign and scope of temp var Andy Green
@ 2018-05-14  5:10   ` Andy Green
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 17/23] test_table_pipeline: repair munged indirection level Andy Green
                     ` (7 subsequent siblings)
  23 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:10 UTC (permalink / raw)
  To: dev

Signed-off-by: Andy Green <andy@warmcat.com>
---
 .../common/include/generic/rte_byteorder.h         |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/common/include/generic/rte_byteorder.h b/lib/librte_eal/common/include/generic/rte_byteorder.h
index 9bed85cca..7d9a1463c 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(x);
 }
 
 /*
@@ -135,7 +135,7 @@ rte_constant_bswap16(uint16_t x)
 static inline uint32_t
 rte_constant_bswap32(uint32_t x)
 {
-	return RTE_STATIC_BSWAP32(x);
+	return (uint32_t)RTE_STATIC_BSWAP32(x);
 }
 
 /*
@@ -147,7 +147,7 @@ rte_constant_bswap32(uint32_t x)
 static inline uint64_t
 rte_constant_bswap64(uint64_t x)
 {
-	return RTE_STATIC_BSWAP64(x);
+	return (uint64_t)RTE_STATIC_BSWAP64(x);
 }
 
 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v4 17/23] test_table_pipeline: repair munged indirection level
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (15 preceding siblings ...)
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 16/23] rte_byteorder.h: explicit cast for return promotion Andy Green
@ 2018-05-14  5:10   ` Andy Green
  2018-05-14 10:35     ` Singh, Jasvinder
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 18/23] rte_rwlock.h: gcc8 sign conversion warnings Andy Green
                     ` (6 subsequent siblings)
  23 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:10 UTC (permalink / raw)
  To: dev

Signed-off-by: Andy Green <andy@warmcat.com>
---
 test/test/test_table_pipeline.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/test/test/test_table_pipeline.c b/test/test/test_table_pipeline.c
index 5ec4c5244..70dbd25f4 100644
--- a/test/test/test_table_pipeline.c
+++ b/test/test/test_table_pipeline.c
@@ -63,21 +63,21 @@ rte_pipeline_port_out_action_handler port_action_stub(struct rte_mbuf **pkts,
 
 rte_pipeline_table_action_handler_hit
 table_action_0x00(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_stub_hit(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);
 
 static int
 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,
 	__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("Table Action, setting pkts_mask to 0x00\n");
@@ -90,7 +90,7 @@ rte_pipeline_table_action_handler_hit
 table_action_stub_hit(__attribute__((unused)) 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 Hit - doing nothing\n");
@@ -105,7 +105,7 @@ static int
 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] 174+ messages in thread

* [dpdk-dev] [PATCH v4 18/23] rte_rwlock.h: gcc8 sign conversion warnings
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (16 preceding siblings ...)
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 17/23] test_table_pipeline: repair munged indirection level Andy Green
@ 2018-05-14  5:10   ` Andy Green
  2018-05-14  5:11   ` [dpdk-dev] [PATCH v4 19/23] rte_ip.h: cast input to bswap16 to be uint16 Andy Green
                     ` (5 subsequent siblings)
  23 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:10 UTC (permalink / raw)
  To: dev

In file included from /projects/lagopus/src/dpdk/
build/include/rte_rwlock.h:12,
                 from ./mgr/lock.h:24,
                 from ./mgr/sock_io.c:54:
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h: In function 'rte_rwlock_read_lock':
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h:74:12: warning: conversion to 'uint32_t'
{aka 'unsigned int'} from 'int32_t' {aka 'int'} may
change the sign of the result [-Wsign-conversion]
            x, x + 1);
            ^
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h:74:17: warning: conversion to 'uint32_t'
{aka 'unsigned int'} from 'int' may change the sign
of the result [-Wsign-conversion]
            x, x + 1);
               ~~^~~
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h: In function 'rte_rwlock_write_lock':
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h:110:15: warning: unsigned conversion
from 'int' to 'uint32_t' {aka 'unsigned int'}
changes value from '-1' to '4294967295'
[-Wsign-conversion]
            0, -1);
               ^~
Fixes: af75078fec ("first public release")
Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_eal/common/include/generic/rte_rwlock.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/include/generic/rte_rwlock.h b/lib/librte_eal/common/include/generic/rte_rwlock.h
index 899e9bc43..497934977 100644
--- a/lib/librte_eal/common/include/generic/rte_rwlock.h
+++ b/lib/librte_eal/common/include/generic/rte_rwlock.h
@@ -71,7 +71,7 @@ rte_rwlock_read_lock(rte_rwlock_t *rwl)
 			continue;
 		}
 		success = rte_atomic32_cmpset((volatile uint32_t *)&rwl->cnt,
-					      x, x + 1);
+					      x, (uint32_t)(x + 1));
 	}
 }
 
@@ -107,7 +107,7 @@ rte_rwlock_write_lock(rte_rwlock_t *rwl)
 			continue;
 		}
 		success = rte_atomic32_cmpset((volatile uint32_t *)&rwl->cnt,
-					      0, -1);
+					      0, (uint32_t)-1);
 	}
 }
 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v4 19/23] rte_ip.h: cast input to bswap16 to be uint16
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (17 preceding siblings ...)
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 18/23] rte_rwlock.h: gcc8 sign conversion warnings Andy Green
@ 2018-05-14  5:11   ` Andy Green
  2018-05-14  5:11   ` [dpdk-dev] [PATCH v4 20/23] rte_ip.h: cast around promotion to int Andy Green
                     ` (4 subsequent siblings)
  23 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:11 UTC (permalink / raw)
  To: dev

In file included from /projects/lagopus/src/dpdk/
build/include/rte_ether.h:24,
                 from /projects/lagopus/src/dpdk/
build/include/rte_ethdev.h:158,
                 from ./dpdk/worker.c:90:
/projects/lagopus/src/dpdk/build/include/rte_ip.h:
In function 'rte_raw_cksum_mbuf':
/projects/lagopus/src/dpdk/build/include/rte_ip.h:
225:22: warning: conversion from 'uint32_t'
{aka 'unsigned int'} to 'uint16_t' {aka 'short
unsigned int'} may change value [-Wconversion]
    tmp = rte_bswap16(tmp);
                      ^~~
/projects/lagopus/src/dpdk/build/include/
rte_byteorder.h:53:25: note: in definition of
macro 'rte_bswap16'
        rte_arch_bswap16(x)))
                         ^

Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_net/rte_ip.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index f32684c66..b46a0c717 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -222,7 +222,7 @@ rte_raw_cksum_mbuf(const struct rte_mbuf *m, uint32_t off, uint32_t len,
 	for (;;) {
 		tmp = __rte_raw_cksum(buf, seglen, 0);
 		if (done & 1)
-			tmp = rte_bswap16(tmp);
+			tmp = rte_bswap16((uint16_t)tmp);
 		sum += tmp;
 		done += seglen;
 		if (done == len)

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v4 20/23] rte_ip.h: cast around promotion to int
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (18 preceding siblings ...)
  2018-05-14  5:11   ` [dpdk-dev] [PATCH v4 19/23] rte_ip.h: cast input to bswap16 to be uint16 Andy Green
@ 2018-05-14  5:11   ` Andy Green
  2018-05-14  5:11   ` [dpdk-dev] [PATCH v4 21/23] rte_ip.h: cast type decided by sizeof to uint32 Andy Green
                     ` (3 subsequent siblings)
  23 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:11 UTC (permalink / raw)
  To: dev

/projects/lagopus/src/dpdk/build/include/
rte_ip.h: In function 'rte_ipv4_cksum':
/projects/lagopus/src/dpdk/build/include/
rte_ip.h:256:35: warning: conversion from
'int' to 'uint16_t' {aka 'short unsigned int'}
may change value [-Wconversion]
  return (cksum == 0xffff) ? cksum : ~cksum;
         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~

Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_net/rte_ip.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index b46a0c717..8689e9113 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -253,7 +253,7 @@ rte_ipv4_cksum(const struct ipv4_hdr *ipv4_hdr)
 {
 	uint16_t cksum;
 	cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct ipv4_hdr));
-	return (cksum == 0xffff) ? cksum : ~cksum;
+	return (cksum == 0xffff) ? cksum : (uint16_t)~cksum;
 }
 
 /**

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v4 21/23] rte_ip.h: cast type decided by sizeof to uint32
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (19 preceding siblings ...)
  2018-05-14  5:11   ` [dpdk-dev] [PATCH v4 20/23] rte_ip.h: cast around promotion to int Andy Green
@ 2018-05-14  5:11   ` Andy Green
  2018-05-14  5:11   ` [dpdk-dev] [PATCH v4 22/23] rte_ip.h: cast return checksum size to uint16 Andy Green
                     ` (2 subsequent siblings)
  23 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:11 UTC (permalink / raw)
  To: dev

/projects/lagopus/src/dpdk/build/include/rte_ip.h:
In function 'rte_ipv4_udptcp_cksum':
/projects/lagopus/src/dpdk/build/include/rte_byteorder.h:
51:24: warning: conversion from 'long unsigned int' to
'uint32_t' {aka 'unsigned int'} may change value
[-Wconversion]
 #define rte_bswap16(x) ((uint16_t)
(__builtin_constant_p(x) ?  \
                        ^
/projects/lagopus/src/dpdk/build/include/rte_byteorder.h:
85:29: note: in expansion of macro 'rte_bswap16'
 #define rte_be_to_cpu_16(x) rte_bswap16(x)
                             ^~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_ip.h:321:11:
note: in expansion of macro 'rte_be_to_cpu_16'
  l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) -
           ^~~~~~~~~~~~~~~~

Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_net/rte_ip.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index 8689e9113..88dfbaa9a 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -318,8 +318,8 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr)
 	uint32_t cksum;
 	uint32_t l4_len;
 
-	l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) -
-		sizeof(struct ipv4_hdr);
+	l4_len = (uint32_t)(rte_be_to_cpu_16(ipv4_hdr->total_length) -
+		sizeof(struct ipv4_hdr));
 
 	cksum = rte_raw_cksum(l4_hdr, l4_len);
 	cksum += rte_ipv4_phdr_cksum(ipv4_hdr, 0);

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v4 22/23] rte_ip.h: cast return checksum size to uint16
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (20 preceding siblings ...)
  2018-05-14  5:11   ` [dpdk-dev] [PATCH v4 21/23] rte_ip.h: cast type decided by sizeof to uint32 Andy Green
@ 2018-05-14  5:11   ` Andy Green
  2018-05-14  5:11   ` [dpdk-dev] [PATCH v4 23/23] rte_ip.h: cast away gcc8 warning on rte_ipv6_phdr_cksum Andy Green
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
  23 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:11 UTC (permalink / raw)
  To: dev

In file included from ./dpdk/worker.c:94:
/projects/lagopus/src/dpdk/build/include/rte_ip.h:
332:9: warning: conversion from 'uint32_t'
{aka 'unsigned int'} to 'uint16_t' {aka 'short
unsigned int'} may change value [-Wconversion]
  return cksum;
         ^~~~~

/projects/lagopus/src/dpdk/build/include/rte_ip.h:
In function 'rte_ipv6_udptcp_cksum':
/projects/lagopus/src/dpdk/build/include/rte_ip.h:421:9:
warning: conversion from 'uint32_t' {aka 'unsigned int'}
to 'uint16_t' {aka 'short unsigned int'} may change
value [-Wconversion]
  return cksum;
         ^~~~~


Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_net/rte_ip.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index 88dfbaa9a..c46398548 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -329,7 +329,7 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr)
 	if (cksum == 0)
 		cksum = 0xffff;
 
-	return cksum;
+	return (uint16_t)cksum;
 }
 
 /**
@@ -418,7 +418,7 @@ rte_ipv6_udptcp_cksum(const struct ipv6_hdr *ipv6_hdr, const void *l4_hdr)
 	if (cksum == 0)
 		cksum = 0xffff;
 
-	return cksum;
+	return (uint16_t)cksum;
 }
 
 #ifdef __cplusplus

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v4 23/23] rte_ip.h: cast away gcc8 warning on rte_ipv6_phdr_cksum
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (21 preceding siblings ...)
  2018-05-14  5:11   ` [dpdk-dev] [PATCH v4 22/23] rte_ip.h: cast return checksum size to uint16 Andy Green
@ 2018-05-14  5:11   ` Andy Green
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
  23 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-14  5:11 UTC (permalink / raw)
  To: dev

/projects/lagopus/src/dpdk/build/include/rte_ip.h:
In function 'rte_ipv6_phdr_cksum':
/projects/lagopus/src/dpdk/build/include/rte_ip.h:
378:18: warning: conversion to 'uint32_t' {aka
'unsigned int'} from 'int' may change the sign of
the result [-Wsign-conversion]
  psd_hdr.proto = (ipv6_hdr->proto << 24);

Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_net/rte_ip.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index c46398548..72dc2456a 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -375,7 +375,7 @@ rte_ipv6_phdr_cksum(const struct ipv6_hdr *ipv6_hdr, uint64_t ol_flags)
 		uint32_t proto; /* L4 protocol - top 3 bytes must be zero */
 	} psd_hdr;
 
-	psd_hdr.proto = (ipv6_hdr->proto << 24);
+	psd_hdr.proto = (uint32_t)(ipv6_hdr->proto << 24);
 	if (ol_flags & PKT_TX_TCP_SEG) {
 		psd_hdr.len = 0;
 	} else {

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 17/23] test_table_pipeline: repair munged indirection level
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 17/23] test_table_pipeline: repair munged indirection level Andy Green
@ 2018-05-14 10:35     ` Singh, Jasvinder
  2018-05-14 10:46       ` Andy Green
  0 siblings, 1 reply; 174+ messages in thread
From: Singh, Jasvinder @ 2018-05-14 10:35 UTC (permalink / raw)
  To: Andy Green, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Andy Green
> Sent: Monday, May 14, 2018 6:11 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v4 17/23] test_table_pipeline: repair munged
> indirection level
> 
> Signed-off-by: Andy Green <andy@warmcat.com>
> ---
>  test/test/test_table_pipeline.c |   12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/test/test/test_table_pipeline.c b/test/test/test_table_pipeline.c
> index 5ec4c5244..70dbd25f4 100644
> --- a/test/test/test_table_pipeline.c
> +++ b/test/test/test_table_pipeline.c
> @@ -63,21 +63,21 @@ rte_pipeline_port_out_action_handler
> port_action_stub(struct rte_mbuf **pkts,
> 
>  rte_pipeline_table_action_handler_hit
>  table_action_0x00(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);

In my opinion , this is wrong fix. Here, table action is meant to be applied on any number of packets (maximum 64), therefore,
entry parameter should be array of up to 64 pointers to rte_pipeline_table_entry structure. BTW, Dave has already sent
fix for gcc 8.1 build error.  http://www.dpdk.org/ml/archives/dev/2018-May/101113.html



^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 17/23] test_table_pipeline: repair munged indirection level
  2018-05-14 10:35     ` Singh, Jasvinder
@ 2018-05-14 10:46       ` Andy Green
  0 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-14 10:46 UTC (permalink / raw)
  To: Singh, Jasvinder, dev



On 05/14/2018 06:35 PM, Singh, Jasvinder wrote:
> 
> 
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Andy Green
>> Sent: Monday, May 14, 2018 6:11 AM
>> To: dev@dpdk.org
>> Subject: [dpdk-dev] [PATCH v4 17/23] test_table_pipeline: repair munged
>> indirection level
>>
>> Signed-off-by: Andy Green <andy@warmcat.com>
>> ---
>>   test/test/test_table_pipeline.c |   12 ++++++------
>>   1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/test/test/test_table_pipeline.c b/test/test/test_table_pipeline.c
>> index 5ec4c5244..70dbd25f4 100644
>> --- a/test/test/test_table_pipeline.c
>> +++ b/test/test/test_table_pipeline.c
>> @@ -63,21 +63,21 @@ rte_pipeline_port_out_action_handler
>> port_action_stub(struct rte_mbuf **pkts,
>>
>>   rte_pipeline_table_action_handler_hit
>>   table_action_0x00(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);
> 
> In my opinion , this is wrong fix. Here, table action is meant to be applied on any number of packets (maximum 64), therefore,
> entry parameter should be array of up to 64 pointers to rte_pipeline_table_entry structure. BTW, Dave has already sent
> fix for gcc 8.1 build error.  http://www.dpdk.org/ml/archives/dev/2018-May/101113.html


Well, no worries... I saw something was broken (the * vs the **) and 
simply guessed the resolution.

If it's wrong, just drop my patch about this.

-Andy

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 06/23] rte_ring_generic.h: stack declarations before code
  2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 06/23] rte_ring_generic.h: stack declarations before code Andy Green
@ 2018-05-17  8:29     ` Olivier Matz
  0 siblings, 0 replies; 174+ messages in thread
From: Olivier Matz @ 2018-05-17  8:29 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

On Mon, May 14, 2018 at 01:09:57PM +0800, Andy Green wrote:
> /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>
> Fixes: 0dfc98c507b1 ("ring: separate out head index manipulation")

Acked-by: Olivier Matz <olivier.matz@6wind.com>

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 07/23] rte_ring.h: remove signed type flipflopping
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 07/23] rte_ring.h: remove signed type flipflopping Andy Green
@ 2018-05-17  8:29     ` Olivier Matz
  0 siblings, 0 replies; 174+ messages in thread
From: Olivier Matz @ 2018-05-17  8:29 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

On Mon, May 14, 2018 at 01:10:02PM +0800, Andy Green wrote:
> /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>

Acked-by: Olivier Matz <olivier.matz@6wind.com>

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 08/23] rte_mbuf.h: avoid warnings from inadvertant promotion
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 08/23] rte_mbuf.h: avoid warnings from inadvertant promotion Andy Green
@ 2018-05-17  8:30     ` Olivier Matz
  0 siblings, 0 replies; 174+ messages in thread
From: Olivier Matz @ 2018-05-17  8:30 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

On Mon, May 14, 2018 at 01:10:07PM +0800, Andy Green wrote:
> "1 + value", where value is an uint16_t causes promotion
> to a signed int.  The compiler complained that we are
> shoving an int into a uint16_t return type with different
> size and sign.
> 
> Bumping and returning value directly instead removes the
> promotion and the problem.
> 
> Signed-off-by: Andy Green <andy@warmcat.com>

Acked-by: Olivier Matz <olivier.matz@6wind.com>

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 09/23] rte_mbuf.h: explicit casts for int16 to uint16
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 09/23] rte_mbuf.h: explicit casts for int16 to uint16 Andy Green
@ 2018-05-17  8:30     ` Olivier Matz
  0 siblings, 0 replies; 174+ messages in thread
From: Olivier Matz @ 2018-05-17  8:30 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

On Mon, May 14, 2018 at 01:10:12PM +0800, Andy Green wrote:
> 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);
> 

Looking at the API of functions, I think there are some inconsistencies:

  static inline void
  rte_mbuf_refcnt_set(struct rte_mbuf *m, uint16_t new_value)

  /* internal */
  static inline uint16_t
  __rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value)

  static inline uint16_t
  rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value)

For next version, I think we should change it to be int16_t everywhere,
to avoid some of the explicit casts you are introducing.

If we want it for 18.05:
Acked-by: Olivier Matz <olivier.matz@6wind.com>

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 01/23] lib/librte_eal: import libbsd strlcpy
  2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 01/23] lib/librte_eal: import libbsd strlcpy Andy Green
@ 2018-05-17 10:36     ` Bruce Richardson
  2018-05-17 12:35       ` Andy Green
  0 siblings, 1 reply; 174+ messages in thread
From: Bruce Richardson @ 2018-05-17 10:36 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

On Mon, May 14, 2018 at 01:09:32PM +0800, Andy Green wrote:
> 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(-)
> 

While I'm aware this was suggested by other reviewers, I really don't feel
that it is necessary to actually import the code. If libbsd is present on
the system, we will use it directly. If libbsd is not present, the snprintf
provides an acceptable fallback for strlcpy IMHO. Having the full function
without good justification seems excessive.

/Bruce

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 05/23] /lib/librte_eal: stage cast from uint64 to long
  2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 05/23] /lib/librte_eal: stage cast from uint64 to long Andy Green
@ 2018-05-17 10:47     ` Bruce Richardson
  2018-05-17 12:56       ` Andy Green
  0 siblings, 1 reply; 174+ messages in thread
From: Bruce Richardson @ 2018-05-17 10:47 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

On Mon, May 14, 2018 at 01:09:52PM +0800, Andy Green wrote:
> /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..e30777b83 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);

Is double-cast necessary here? Can we not just cast straight to long?

>  }
>  
>  /**
> @@ -48,9 +48,9 @@ static inline uint64_t
>  rte_rand(void)
>  {
>  	uint64_t val;
> -	val = lrand48();
> +	val = (uint64_t)lrand48();
>  	val <<= 32;
> -	val += lrand48();
> +	val += (uint64_t)lrand48();
>  	return val;
>  }
>  
> 

Apart from the one minor comment above LGTM

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 10/23] rte_mbuf.h: make sure RTE-MIN compares same types
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 10/23] rte_mbuf.h: make sure RTE-MIN compares same types Andy Green
@ 2018-05-17 10:49     ` Bruce Richardson
  0 siblings, 0 replies; 174+ messages in thread
From: Bruce Richardson @ 2018-05-17 10:49 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

On Mon, May 14, 2018 at 01:10:17PM +0800, Andy Green wrote:
> /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);
>  }
>  
Not sure the cast before RTE_MIN is necessary, but it's harmless.

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 11/23] rte_mbuf.h: explicit cast restricting ptrdiff to uint16
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 11/23] rte_mbuf.h: explicit cast restricting ptrdiff to uint16 Andy Green
@ 2018-05-17 10:50     ` Bruce Richardson
  2018-05-17 11:03       ` Ananyev, Konstantin
  0 siblings, 1 reply; 174+ messages in thread
From: Bruce Richardson @ 2018-05-17 10:50 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

On Mon, May 14, 2018 at 01:10:22PM +0800, Andy Green wrote:
> /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;
>  }
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 12/23] rte_mbuf.h: explicit cast for size type to uint32
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 12/23] rte_mbuf.h: explicit cast for size type to uint32 Andy Green
@ 2018-05-17 10:53     ` Bruce Richardson
  2018-05-17 13:09       ` Andy Green
  0 siblings, 1 reply; 174+ messages in thread
From: Bruce Richardson @ 2018-05-17 10:53 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

On Mon, May 14, 2018 at 01:10:27PM +0800, Andy Green wrote:
> 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;
> 
It would be good to include the error message in the commit log.
Also, for safety, is it better to have extra braces to cast the whole
expression, not just the sizeof, i.e.

	mbuf_size = (uint32_t)(sizeof(...) + priv_size);

/Bruce

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 13/23] rte_mbuf.h: explicit casts to uint16 to avoid warnings
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 13/23] rte_mbuf.h: explicit casts to uint16 to avoid warnings Andy Green
@ 2018-05-17 10:58     ` Bruce Richardson
  2018-05-17 13:28       ` Andy Green
  0 siblings, 1 reply; 174+ messages in thread
From: Bruce Richardson @ 2018-05-17 10:58 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

On Mon, May 14, 2018 at 01:10:32PM +0800, Andy Green wrote:
> 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;

I think a better fix for this is to change priv_size to be uint16_t. There
is no reason for it to be a 32-bit value.


> @@ -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);
>  

What is the error message here? The cast isn't wrong, it just seems like we
shouldn't need it. I suppose it's implicit promotion being done in the
subtraction operation.

> @@ -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] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 14/23] rte_ether.h: explicit cast avoiding truncation warning
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 14/23] rte_ether.h: explicit cast avoiding truncation warning Andy Green
@ 2018-05-17 11:01     ` Bruce Richardson
  0 siblings, 0 replies; 174+ messages in thread
From: Bruce Richardson @ 2018-05-17 11:01 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

On Mon, May 14, 2018 at 01:10:37PM +0800, Andy Green wrote:
> /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>

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 11/23] rte_mbuf.h: explicit cast restricting ptrdiff to uint16
  2018-05-17 10:50     ` Bruce Richardson
@ 2018-05-17 11:03       ` Ananyev, Konstantin
  0 siblings, 0 replies; 174+ messages in thread
From: Ananyev, Konstantin @ 2018-05-17 11:03 UTC (permalink / raw)
  To: Richardson, Bruce, Andy Green; +Cc: dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bruce Richardson
> Sent: Thursday, May 17, 2018 11:51 AM
> To: Andy Green <andy@warmcat.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v4 11/23] rte_mbuf.h: explicit cast restricting ptrdiff to uint16
> 
> On Mon, May 14, 2018 at 01:10:22PM +0800, Andy Green wrote:
> > /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;
> >  }
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>


Just as a nit: if all such conversions are unavoidable - might be introduce:
RTE_PTR_DIFF_TYPE(.., type)	((type)(RTE_PTR_DIFF(...))
Might look a bit nicer.
Konstantin

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 01/23] lib/librte_eal: import libbsd strlcpy
  2018-05-17 10:36     ` Bruce Richardson
@ 2018-05-17 12:35       ` Andy Green
  2018-05-17 12:56         ` Bruce Richardson
  0 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-17 12:35 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev



On 05/17/2018 06:36 PM, Bruce Richardson wrote:
> On Mon, May 14, 2018 at 01:09:32PM +0800, Andy Green wrote:
>> 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(-)
>>
> 
> While I'm aware this was suggested by other reviewers, I really don't feel
> that it is necessary to actually import the code. If libbsd is present on
> the system, we will use it directly. If libbsd is not present, the snprintf
> provides an acceptable fallback for strlcpy IMHO. Having the full function
> without good justification seems excessive.

Well, as you can probably guess, I don't really mind either way.

This also implies another patch to export rte_strlcpy since it's no 
longer an inline in the headers this way.

I removed these patches and rebuilt dpdk and then lagopus without it 
with the idea of pasting the compile error.  But I can't reproduce the 
original problem... since then I rebased on current master dpdk, got 
updated to gcc 8.1 and added more patches on lagopus.

So just drop this patch if you don't want the bsd lstrcpy.

-Andy

> /Bruce
> 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 01/23] lib/librte_eal: import libbsd strlcpy
  2018-05-17 12:35       ` Andy Green
@ 2018-05-17 12:56         ` Bruce Richardson
  2018-05-17 13:00           ` Andy Green
  0 siblings, 1 reply; 174+ messages in thread
From: Bruce Richardson @ 2018-05-17 12:56 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

On Thu, May 17, 2018 at 08:35:21PM +0800, Andy Green wrote:
> 
> 
> On 05/17/2018 06:36 PM, Bruce Richardson wrote:
> > On Mon, May 14, 2018 at 01:09:32PM +0800, Andy Green wrote:
> > > 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(-)
> > > 
> > 
> > While I'm aware this was suggested by other reviewers, I really don't feel
> > that it is necessary to actually import the code. If libbsd is present on
> > the system, we will use it directly. If libbsd is not present, the snprintf
> > provides an acceptable fallback for strlcpy IMHO. Having the full function
> > without good justification seems excessive.
> 
> Well, as you can probably guess, I don't really mind either way.
> 
> This also implies another patch to export rte_strlcpy since it's no longer
> an inline in the headers this way.
> 
> I removed these patches and rebuilt dpdk and then lagopus without it with
> the idea of pasting the compile error.  But I can't reproduce the original
> problem... since then I rebased on current master dpdk, got updated to gcc
> 8.1 and added more patches on lagopus.
> 
> So just drop this patch if you don't want the bsd lstrcpy.
> 
Yes, let's drop it from the set for now anyway, if it's not solving any
specific error. We can relook at it in 18.08 anyway.

/Bruce

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 05/23] /lib/librte_eal: stage cast from uint64 to long
  2018-05-17 10:47     ` Bruce Richardson
@ 2018-05-17 12:56       ` Andy Green
  0 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 12:56 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev



On 05/17/2018 06:47 PM, Bruce Richardson wrote:
> On Mon, May 14, 2018 at 01:09:52PM +0800, Andy Green wrote:
>> /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..e30777b83 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);
> 
> Is double-cast necessary here? Can we not just cast straight to long?

You're right, it can just go straight to long.

I'm going through adding the compiler errors into the patches that have 
them missing and doing this kind of small change, and I'll reissue in an 
hour or two (.

-Andy

>>   }
>>   
>>   /**
>> @@ -48,9 +48,9 @@ static inline uint64_t
>>   rte_rand(void)
>>   {
>>   	uint64_t val;
>> -	val = lrand48();
>> +	val = (uint64_t)lrand48();
>>   	val <<= 32;
>> -	val += lrand48();
>> +	val += (uint64_t)lrand48();
>>   	return val;
>>   }
>>   
>>
> 
> Apart from the one minor comment above LGTM
> 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 01/23] lib/librte_eal: import libbsd strlcpy
  2018-05-17 12:56         ` Bruce Richardson
@ 2018-05-17 13:00           ` Andy Green
  2018-05-17 13:49             ` Bruce Richardson
  0 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:00 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev



On 05/17/2018 08:56 PM, Bruce Richardson wrote:
> On Thu, May 17, 2018 at 08:35:21PM +0800, Andy Green wrote:
>>
>>
>> On 05/17/2018 06:36 PM, Bruce Richardson wrote:
>>> On Mon, May 14, 2018 at 01:09:32PM +0800, Andy Green wrote:
>>>> 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(-)
>>>>
>>>
>>> While I'm aware this was suggested by other reviewers, I really don't feel
>>> that it is necessary to actually import the code. If libbsd is present on
>>> the system, we will use it directly. If libbsd is not present, the snprintf
>>> provides an acceptable fallback for strlcpy IMHO. Having the full function
>>> without good justification seems excessive.
>>
>> Well, as you can probably guess, I don't really mind either way.
>>
>> This also implies another patch to export rte_strlcpy since it's no longer
>> an inline in the headers this way.
>>
>> I removed these patches and rebuilt dpdk and then lagopus without it with
>> the idea of pasting the compile error.  But I can't reproduce the original
>> problem... since then I rebased on current master dpdk, got updated to gcc
>> 8.1 and added more patches on lagopus.
>>
>> So just drop this patch if you don't want the bsd lstrcpy.
>>
> Yes, let's drop it from the set for now anyway, if it's not solving any
> specific error. We can relook at it in 18.08 anyway.

Sorry to immediately contradict myself but I forgot a step in the rather 
complicated flow to force the lagopus dpdk submodule HEAD... by default 
making lagopus forces the submodule commit to something else.  It does 
need a much smaller one-liner to avoid

     In file included from ./dpdk/dpdk.c:88:
     /projects/lagopus/src/dpdk/build/include/rte_string_fns.h: In
     function 'rte_strlcpy':
     /projects/lagopus/src/dpdk/build/include/rte_string_fns.h:58:9:
     warning: conversion to 'size_t' {aka 'long unsigned int'} from
     'int' may change the sign of the result [-Wsign-conversion]
       return snprintf(dst, size, "%s", src);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It just needs a cast to make the return type of the snprintf compatible 
with the expected return type of strlcpy().

I'll include this in the next send in an hour or two.

-Andy

> /Bruce
> 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 12/23] rte_mbuf.h: explicit cast for size type to uint32
  2018-05-17 10:53     ` Bruce Richardson
@ 2018-05-17 13:09       ` Andy Green
  0 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:09 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev



On 05/17/2018 06:53 PM, Bruce Richardson wrote:
> On Mon, May 14, 2018 at 01:10:27PM +0800, Andy Green wrote:
>> 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;
>>
> It would be good to include the error message in the commit log.
> Also, for safety, is it better to have extra braces to cast the whole
> expression, not just the sizeof, i.e.
> 
> 	mbuf_size = (uint32_t)(sizeof(...) + priv_size);

OK I went back and captured the original error and added it back in, and 
adapted the scope of the cast as you suggested.

-Andy

> /Bruce
> 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 13/23] rte_mbuf.h: explicit casts to uint16 to avoid warnings
  2018-05-17 10:58     ` Bruce Richardson
@ 2018-05-17 13:28       ` Andy Green
  0 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:28 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev



On 05/17/2018 06:58 PM, Bruce Richardson wrote:
> On Mon, May 14, 2018 at 01:10:32PM +0800, Andy Green wrote:
>> 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;
> 
> I think a better fix for this is to change priv_size to be uint16_t. There
> is no reason for it to be a 32-bit value.

OK.

>> @@ -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);
>>   
> 
> What is the error message here? The cast isn't wrong, it just seems like we
> shouldn't need it. I suppose it's implicit promotion being done in the
> subtraction operation.

     /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
     In function 'rte_pktmbuf_prepend':
     /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
     1908:17: warning: conversion from 'int' to 'uint16_t'
     {aka 'short unsigned int'} may change value [-Wconversion]
       m->data_off -= len;
                      ^~~

I have added all the original warnings to the patch.

-Andy

>> @@ -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] 174+ messages in thread

* [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus
  2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
                     ` (22 preceding siblings ...)
  2018-05-14  5:11   ` [dpdk-dev] [PATCH v4 23/23] rte_ip.h: cast away gcc8 warning on rte_ipv6_phdr_cksum Andy Green
@ 2018-05-17 13:48   ` Andy Green
  2018-05-17 13:48     ` [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-dev-ops API to return int Andy Green
                       ` (21 more replies)
  23 siblings, 22 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:48 UTC (permalink / raw)
  To: dev

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.

v5 applies list comment from today.  gcc8.1 errors
corresponding to the problem provoking the patch
have been added in where relevant (almost all of them).

v4 has absorbed more list comment and added 6 x patches
at the end, from getting further into lagopus build with
master DPDK.  There are still many warnings and errors
in lagopus I am working through, but so far it looks like
the solutions for those now belong in lagopus, not DPDK
after this series.

(Applies to v3)
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>

---

Andy Green (21):
      lib/librte_ethdev: change eth-dev-ops API to return int
      rte_string_fns.h: fix gcc8.1 sign conv warning in lstrcpy
      lib/librte_eal: explicit tmp cast
      /lib/librte_eal: stage cast from uint64 to long
      rte_ring_generic.h: stack declarations before code
      rte_ring.h: remove signed type flipflopping
      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_ether.h: explicit cast avoiding truncation warning
      rte_rwlock.h: gcc8 sign conversion warnings
      rte_ip.h: cast input to bswap16 to be uint16
      rte_ip.h: cast around promotion to int
      rte_ip.h: cast type decided by sizeof to uint32
      rte_ip.h: cast return checksum size to uint16
      rte_ip.h: cast away gcc8 warning on rte_ipv6_phdr_cksum
      rte_mbuf.h: explicit cast for size type to uint32
      rte_mbuf.h: explicit casts to uint16 to avoid warnings
      rte_ethdev.h: align sign and scope of temp var
      rte_byteorder.h: explicit cast for return promotion


 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 +
 .../common/include/arch/x86/rte_memcpy.h           |    8 ++--
 .../common/include/generic/rte_byteorder.h         |    6 ++-
 lib/librte_eal/common/include/generic/rte_rwlock.h |    4 +-
 lib/librte_eal/common/include/rte_random.h         |    6 ++-
 lib/librte_eal/common/include/rte_string_fns.h     |    2 +
 lib/librte_ethdev/rte_ethdev.h                     |   25 ++++++++------
 lib/librte_ethdev/rte_ethdev_core.h                |    4 +-
 lib/librte_mbuf/rte_mbuf.h                         |   37 +++++++++++---------
 lib/librte_net/rte_ether.h                         |    2 +
 lib/librte_net/rte_ip.h                            |   14 ++++----
 lib/librte_ring/rte_ring.h                         |    4 +-
 lib/librte_ring/rte_ring_c11_mem.h                 |    2 +
 lib/librte_ring/rte_ring_generic.h                 |   10 ++---
 35 files changed, 108 insertions(+), 108 deletions(-)

--
Signature

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-dev-ops API to return int
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
@ 2018-05-17 13:48     ` Andy Green
  2018-05-17 13:55       ` Bruce Richardson
  2018-05-18 10:59       ` Shreyansh Jain
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 02/21] rte_string_fns.h: fix gcc8.1 sign conv warning in lstrcpy Andy Green
                       ` (20 subsequent siblings)
  21 siblings, 2 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:48 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 e03a136fc..abfca0e85 100644
--- a/drivers/net/avf/avf_rxtx.c
+++ b/drivers/net/avf/avf_rxtx.c
@@ -1839,13 +1839,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 9edcc7b7d..edee42bb2 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1610,15 +1610,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 d014a11aa..70a5b4851 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -725,7 +725,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;
@@ -738,7 +738,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 9297725d9..eb6245b83 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -604,7 +604,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;
@@ -612,7 +612,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();
 
@@ -628,7 +628,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 a6b3e92a6..827bf1f7d 100644
--- a/drivers/net/e1000/em_rxtx.c
+++ b/drivers/net/e1000/em_rxtx.c
@@ -1476,7 +1476,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
@@ -1496,7 +1496,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 5f729f271..753f1f291 100644
--- a/drivers/net/e1000/igb_rxtx.c
+++ b/drivers/net/e1000/igb_rxtx.c
@@ -1757,7 +1757,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
@@ -1777,7 +1777,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 6032d5541..895ecede8 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -1938,7 +1938,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
@@ -1964,7 +1964,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 e42ec30d3..236efd9e9 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -567,8 +567,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 3e13d26ae..429d4329d 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -3063,7 +3063,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
@@ -3084,7 +3084,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 80dc2731c..287796bd0 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);
@@ -1232,13 +1231,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];
 
@@ -1263,7 +1262,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 1b6499f85..7bbfbb823 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -1098,14 +1098,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 99fcd516b..21ad1df35 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1044,7 +1044,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 0d000c71c..bdf504bac 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] 174+ messages in thread

* [dpdk-dev] [PATCH v5 02/21] rte_string_fns.h: fix gcc8.1 sign conv warning in lstrcpy
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
  2018-05-17 13:48     ` [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-dev-ops API to return int Andy Green
@ 2018-05-17 13:49     ` Andy Green
  2018-05-17 13:56       ` Bruce Richardson
                         ` (2 more replies)
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 03/21] lib/librte_eal: explicit tmp cast Andy Green
                       ` (19 subsequent siblings)
  21 siblings, 3 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:49 UTC (permalink / raw)
  To: dev

In file included from ./dpdk/dpdk.c:88:
/projects/lagopus/src/dpdk/build/include/rte_string_fns.h: In
function 'rte_strlcpy':
/projects/lagopus/src/dpdk/build/include/rte_string_fns.h:58:9:
warning: conversion to 'size_t' {aka 'long unsigned int'} from
'int' may change the sign of the result [-Wsign-conversion]
  return snprintf(dst, size, "%s", src);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 lib/librte_eal/common/include/rte_string_fns.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index fcbb42e00..97597a148 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -55,7 +55,7 @@ rte_strsplit(char *string, int stringlen,
 static inline size_t
 rte_strlcpy(char *dst, const char *src, size_t size)
 {
-	return snprintf(dst, size, "%s", src);
+	return (size_t)snprintf(dst, size, "%s", src);
 }
 
 /* pull in a strlcpy function */

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v5 03/21] lib/librte_eal: explicit tmp cast
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
  2018-05-17 13:48     ` [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-dev-ops API to return int Andy Green
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 02/21] rte_string_fns.h: fix gcc8.1 sign conv warning in lstrcpy Andy Green
@ 2018-05-17 13:49     ` Andy Green
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 04/21] /lib/librte_eal: stage cast from uint64 to long Andy Green
                       ` (18 subsequent siblings)
  21 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:49 UTC (permalink / raw)
  To: dev

/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
  MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
  ^~~~~~~~~~~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
649:51: warning: conversion from 'size_t' {aka 'long
unsigned int'} to 'int' may change value [-Wconversion]
     case 0x0B: MOVEUNALIGNED_LEFT47_IMM(dst, src,
n, 0x0B); break;    \
                                                   ^
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
616:15: note: in definition of macro 'MOVEUNALIGNED_LEFT47_IMM'
         tmp = len;                                                                                          \
               ^~~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
  MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
  ^~~~~~~~~~~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
618:13: warning: conversion to 'size_t' {aka 'long
unsigned int'} from 'int' may change the sign of the
result [-Wsign-conversion]
         tmp -= len;                                                                                         \
             ^~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
649:16: note: in expansion of macro 'MOVEUNALIGNED_LEFT47_IMM'
     case 0x0B: MOVEUNALIGNED_LEFT47_IMM(dst, src,
n, 0x0B); break;    \
                ^~~~~~~~~~~~~~~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
  MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
  ^~~~~~~~~~~~~~~~~~~~

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] 174+ messages in thread

* [dpdk-dev] [PATCH v5 04/21] /lib/librte_eal: stage cast from uint64 to long
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
                       ` (2 preceding siblings ...)
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 03/21] lib/librte_eal: explicit tmp cast Andy Green
@ 2018-05-17 13:49     ` Andy Green
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 05/21] rte_ring_generic.h: stack declarations before code Andy Green
                       ` (17 subsequent siblings)
  21 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:49 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..b2ca1c209 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)seedval);
 }
 
 /**
@@ -48,9 +48,9 @@ static inline uint64_t
 rte_rand(void)
 {
 	uint64_t val;
-	val = lrand48();
+	val = (uint64_t)lrand48();
 	val <<= 32;
-	val += lrand48();
+	val += (uint64_t)lrand48();
 	return val;
 }
 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 01/23] lib/librte_eal: import libbsd strlcpy
  2018-05-17 13:00           ` Andy Green
@ 2018-05-17 13:49             ` Bruce Richardson
  0 siblings, 0 replies; 174+ messages in thread
From: Bruce Richardson @ 2018-05-17 13:49 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

On Thu, May 17, 2018 at 09:00:25PM +0800, Andy Green wrote:
> 
> 
> On 05/17/2018 08:56 PM, Bruce Richardson wrote:
> > On Thu, May 17, 2018 at 08:35:21PM +0800, Andy Green wrote:
> > > 
> > > 
> > > On 05/17/2018 06:36 PM, Bruce Richardson wrote:
> > > > On Mon, May 14, 2018 at 01:09:32PM +0800, Andy Green wrote:
> > > > > 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(-)
> > > > > 
> > > > 
> > > > While I'm aware this was suggested by other reviewers, I really don't feel
> > > > that it is necessary to actually import the code. If libbsd is present on
> > > > the system, we will use it directly. If libbsd is not present, the snprintf
> > > > provides an acceptable fallback for strlcpy IMHO. Having the full function
> > > > without good justification seems excessive.
> > > 
> > > Well, as you can probably guess, I don't really mind either way.
> > > 
> > > This also implies another patch to export rte_strlcpy since it's no longer
> > > an inline in the headers this way.
> > > 
> > > I removed these patches and rebuilt dpdk and then lagopus without it with
> > > the idea of pasting the compile error.  But I can't reproduce the original
> > > problem... since then I rebased on current master dpdk, got updated to gcc
> > > 8.1 and added more patches on lagopus.
> > > 
> > > So just drop this patch if you don't want the bsd lstrcpy.
> > > 
> > Yes, let's drop it from the set for now anyway, if it's not solving any
> > specific error. We can relook at it in 18.08 anyway.
> 
> Sorry to immediately contradict myself but I forgot a step in the rather
> complicated flow to force the lagopus dpdk submodule HEAD... by default
> making lagopus forces the submodule commit to something else.  It does need
> a much smaller one-liner to avoid
> 
>     In file included from ./dpdk/dpdk.c:88:
>     /projects/lagopus/src/dpdk/build/include/rte_string_fns.h: In
>     function 'rte_strlcpy':
>     /projects/lagopus/src/dpdk/build/include/rte_string_fns.h:58:9:
>     warning: conversion to 'size_t' {aka 'long unsigned int'} from
>     'int' may change the sign of the result [-Wsign-conversion]
>       return snprintf(dst, size, "%s", src);
>              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> It just needs a cast to make the return type of the snprintf compatible with
> the expected return type of strlcpy().
> 
> I'll include this in the next send in an hour or two.
> 
Great, thanks for the all the patches!

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v5 05/21] rte_ring_generic.h: stack declarations before code
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
                       ` (3 preceding siblings ...)
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 04/21] /lib/librte_eal: stage cast from uint64 to long Andy Green
@ 2018-05-17 13:49     ` Andy Green
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 06/21] rte_ring.h: remove signed type flipflopping Andy Green
                       ` (16 subsequent siblings)
  21 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:49 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>
Fixes: 0dfc98c507b1 ("ring: separate out head index manipulation")
---
 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] 174+ messages in thread

* [dpdk-dev] [PATCH v5 06/21] rte_ring.h: remove signed type flipflopping
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
                       ` (4 preceding siblings ...)
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 05/21] rte_ring_generic.h: stack declarations before code Andy Green
@ 2018-05-17 13:49     ` Andy Green
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 07/21] rte_mbuf.h: avoid warnings from inadvertant promotion Andy Green
                       ` (15 subsequent siblings)
  21 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:49 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] 174+ messages in thread

* [dpdk-dev] [PATCH v5 07/21] rte_mbuf.h: avoid warnings from inadvertant promotion
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
                       ` (5 preceding siblings ...)
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 06/21] rte_ring.h: remove signed type flipflopping Andy Green
@ 2018-05-17 13:49     ` Andy Green
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 08/21] rte_mbuf.h: explicit casts for int16 to uint16 Andy Green
                       ` (14 subsequent siblings)
  21 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:49 UTC (permalink / raw)
  To: dev

"1 + value", where value is an uint16_t causes promotion
to a signed int.  The compiler complained that we are
shoving an int into a uint16_t return type with different
size and sign.

Bumping and returning value directly instead removes the
promotion and the problem.

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] 174+ messages in thread

* [dpdk-dev] [PATCH v5 08/21] rte_mbuf.h: explicit casts for int16 to uint16
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
                       ` (6 preceding siblings ...)
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 07/21] rte_mbuf.h: avoid warnings from inadvertant promotion Andy Green
@ 2018-05-17 13:49     ` Andy Green
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 09/21] rte_mbuf.h: make sure RTE-MIN compares same types Andy Green
                       ` (13 subsequent siblings)
  21 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:49 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>
If we want it for 18.05:
Acked-by: Olivier Matz <olivier.matz@6wind.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] 174+ messages in thread

* [dpdk-dev] [PATCH v5 09/21] rte_mbuf.h: make sure RTE-MIN compares same types
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
                       ` (7 preceding siblings ...)
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 08/21] rte_mbuf.h: explicit casts for int16 to uint16 Andy Green
@ 2018-05-17 13:49     ` Andy Green
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 10/21] rte_mbuf.h: explicit cast restricting ptrdiff to uint16 Andy Green
                       ` (12 subsequent siblings)
  21 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:49 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>
Acked-by: Bruce Richardson <bruce.richardson@intel.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] 174+ messages in thread

* [dpdk-dev] [PATCH v5 10/21] rte_mbuf.h: explicit cast restricting ptrdiff to uint16
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
                       ` (8 preceding siblings ...)
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 09/21] rte_mbuf.h: make sure RTE-MIN compares same types Andy Green
@ 2018-05-17 13:49     ` Andy Green
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 11/21] rte_ether.h: explicit cast avoiding truncation warning Andy Green
                       ` (11 subsequent siblings)
  21 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:49 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>
Acked-by: Bruce Richardson <bruce.richardson@intel.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] 174+ messages in thread

* [dpdk-dev] [PATCH v5 11/21] rte_ether.h: explicit cast avoiding truncation warning
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
                       ` (9 preceding siblings ...)
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 10/21] rte_mbuf.h: explicit cast restricting ptrdiff to uint16 Andy Green
@ 2018-05-17 13:49     ` Andy Green
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 12/21] rte_rwlock.h: gcc8 sign conversion warnings Andy Green
                       ` (10 subsequent siblings)
  21 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:49 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>
Acked-by: Bruce Richardson <bruce.richardson@intel.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 27c919594..bee2b34f0 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] 174+ messages in thread

* [dpdk-dev] [PATCH v5 12/21] rte_rwlock.h: gcc8 sign conversion warnings
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
                       ` (10 preceding siblings ...)
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 11/21] rte_ether.h: explicit cast avoiding truncation warning Andy Green
@ 2018-05-17 13:49     ` Andy Green
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 13/21] rte_ip.h: cast input to bswap16 to be uint16 Andy Green
                       ` (9 subsequent siblings)
  21 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:49 UTC (permalink / raw)
  To: dev

In file included from /projects/lagopus/src/dpdk/
build/include/rte_rwlock.h:12,
                 from ./mgr/lock.h:24,
                 from ./mgr/sock_io.c:54:
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h: In function 'rte_rwlock_read_lock':
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h:74:12: warning: conversion to 'uint32_t'
{aka 'unsigned int'} from 'int32_t' {aka 'int'} may
change the sign of the result [-Wsign-conversion]
            x, x + 1);
            ^
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h:74:17: warning: conversion to 'uint32_t'
{aka 'unsigned int'} from 'int' may change the sign
of the result [-Wsign-conversion]
            x, x + 1);
               ~~^~~
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h: In function 'rte_rwlock_write_lock':
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h:110:15: warning: unsigned conversion
from 'int' to 'uint32_t' {aka 'unsigned int'}
changes value from '-1' to '4294967295'
[-Wsign-conversion]
            0, -1);
               ^~
Fixes: af75078fec ("first public release")
Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_eal/common/include/generic/rte_rwlock.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/include/generic/rte_rwlock.h b/lib/librte_eal/common/include/generic/rte_rwlock.h
index 899e9bc43..5751a0e6d 100644
--- a/lib/librte_eal/common/include/generic/rte_rwlock.h
+++ b/lib/librte_eal/common/include/generic/rte_rwlock.h
@@ -71,7 +71,7 @@ rte_rwlock_read_lock(rte_rwlock_t *rwl)
 			continue;
 		}
 		success = rte_atomic32_cmpset((volatile uint32_t *)&rwl->cnt,
-					      x, x + 1);
+					      (uint32_t)x, (uint32_t)(x + 1));
 	}
 }
 
@@ -107,7 +107,7 @@ rte_rwlock_write_lock(rte_rwlock_t *rwl)
 			continue;
 		}
 		success = rte_atomic32_cmpset((volatile uint32_t *)&rwl->cnt,
-					      0, -1);
+					      0, (uint32_t)-1);
 	}
 }
 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v5 13/21] rte_ip.h: cast input to bswap16 to be uint16
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
                       ` (11 preceding siblings ...)
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 12/21] rte_rwlock.h: gcc8 sign conversion warnings Andy Green
@ 2018-05-17 13:49     ` Andy Green
  2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 14/21] rte_ip.h: cast around promotion to int Andy Green
                       ` (8 subsequent siblings)
  21 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:49 UTC (permalink / raw)
  To: dev

In file included from /projects/lagopus/src/dpdk/
build/include/rte_ether.h:24,
                 from /projects/lagopus/src/dpdk/
build/include/rte_ethdev.h:158,
                 from ./dpdk/worker.c:90:
/projects/lagopus/src/dpdk/build/include/rte_ip.h:
In function 'rte_raw_cksum_mbuf':
/projects/lagopus/src/dpdk/build/include/rte_ip.h:
225:22: warning: conversion from 'uint32_t'
{aka 'unsigned int'} to 'uint16_t' {aka 'short
unsigned int'} may change value [-Wconversion]
    tmp = rte_bswap16(tmp);
                      ^~~
/projects/lagopus/src/dpdk/build/include/
rte_byteorder.h:53:25: note: in definition of
macro 'rte_bswap16'
        rte_arch_bswap16(x)))
                         ^

Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_net/rte_ip.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index f32684c66..b46a0c717 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -222,7 +222,7 @@ rte_raw_cksum_mbuf(const struct rte_mbuf *m, uint32_t off, uint32_t len,
 	for (;;) {
 		tmp = __rte_raw_cksum(buf, seglen, 0);
 		if (done & 1)
-			tmp = rte_bswap16(tmp);
+			tmp = rte_bswap16((uint16_t)tmp);
 		sum += tmp;
 		done += seglen;
 		if (done == len)

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v5 14/21] rte_ip.h: cast around promotion to int
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
                       ` (12 preceding siblings ...)
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 13/21] rte_ip.h: cast input to bswap16 to be uint16 Andy Green
@ 2018-05-17 13:50     ` Andy Green
  2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 15/21] rte_ip.h: cast type decided by sizeof to uint32 Andy Green
                       ` (7 subsequent siblings)
  21 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:50 UTC (permalink / raw)
  To: dev

/projects/lagopus/src/dpdk/build/include/
rte_ip.h: In function 'rte_ipv4_cksum':
/projects/lagopus/src/dpdk/build/include/
rte_ip.h:256:35: warning: conversion from
'int' to 'uint16_t' {aka 'short unsigned int'}
may change value [-Wconversion]
  return (cksum == 0xffff) ? cksum : ~cksum;
         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~

Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_net/rte_ip.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index b46a0c717..8689e9113 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -253,7 +253,7 @@ rte_ipv4_cksum(const struct ipv4_hdr *ipv4_hdr)
 {
 	uint16_t cksum;
 	cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct ipv4_hdr));
-	return (cksum == 0xffff) ? cksum : ~cksum;
+	return (cksum == 0xffff) ? cksum : (uint16_t)~cksum;
 }
 
 /**

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v5 15/21] rte_ip.h: cast type decided by sizeof to uint32
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
                       ` (13 preceding siblings ...)
  2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 14/21] rte_ip.h: cast around promotion to int Andy Green
@ 2018-05-17 13:50     ` Andy Green
  2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 16/21] rte_ip.h: cast return checksum size to uint16 Andy Green
                       ` (6 subsequent siblings)
  21 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:50 UTC (permalink / raw)
  To: dev

/projects/lagopus/src/dpdk/build/include/rte_ip.h:
In function 'rte_ipv4_udptcp_cksum':
/projects/lagopus/src/dpdk/build/include/rte_byteorder.h:
51:24: warning: conversion from 'long unsigned int' to
'uint32_t' {aka 'unsigned int'} may change value
[-Wconversion]
 #define rte_bswap16(x) ((uint16_t)
(__builtin_constant_p(x) ?  \
                        ^
/projects/lagopus/src/dpdk/build/include/rte_byteorder.h:
85:29: note: in expansion of macro 'rte_bswap16'
 #define rte_be_to_cpu_16(x) rte_bswap16(x)
                             ^~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_ip.h:321:11:
note: in expansion of macro 'rte_be_to_cpu_16'
  l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) -
           ^~~~~~~~~~~~~~~~

Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_net/rte_ip.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index 8689e9113..88dfbaa9a 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -318,8 +318,8 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr)
 	uint32_t cksum;
 	uint32_t l4_len;
 
-	l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) -
-		sizeof(struct ipv4_hdr);
+	l4_len = (uint32_t)(rte_be_to_cpu_16(ipv4_hdr->total_length) -
+		sizeof(struct ipv4_hdr));
 
 	cksum = rte_raw_cksum(l4_hdr, l4_len);
 	cksum += rte_ipv4_phdr_cksum(ipv4_hdr, 0);

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v5 16/21] rte_ip.h: cast return checksum size to uint16
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
                       ` (14 preceding siblings ...)
  2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 15/21] rte_ip.h: cast type decided by sizeof to uint32 Andy Green
@ 2018-05-17 13:50     ` Andy Green
  2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 17/21] rte_ip.h: cast away gcc8 warning on rte_ipv6_phdr_cksum Andy Green
                       ` (5 subsequent siblings)
  21 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:50 UTC (permalink / raw)
  To: dev

In file included from ./dpdk/worker.c:94:
/projects/lagopus/src/dpdk/build/include/rte_ip.h:
332:9: warning: conversion from 'uint32_t'
{aka 'unsigned int'} to 'uint16_t' {aka 'short
unsigned int'} may change value [-Wconversion]
  return cksum;
         ^~~~~

/projects/lagopus/src/dpdk/build/include/rte_ip.h:
In function 'rte_ipv6_udptcp_cksum':
/projects/lagopus/src/dpdk/build/include/rte_ip.h:421:9:
warning: conversion from 'uint32_t' {aka 'unsigned int'}
to 'uint16_t' {aka 'short unsigned int'} may change
value [-Wconversion]
  return cksum;
         ^~~~~


Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_net/rte_ip.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index 88dfbaa9a..c46398548 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -329,7 +329,7 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr)
 	if (cksum == 0)
 		cksum = 0xffff;
 
-	return cksum;
+	return (uint16_t)cksum;
 }
 
 /**
@@ -418,7 +418,7 @@ rte_ipv6_udptcp_cksum(const struct ipv6_hdr *ipv6_hdr, const void *l4_hdr)
 	if (cksum == 0)
 		cksum = 0xffff;
 
-	return cksum;
+	return (uint16_t)cksum;
 }
 
 #ifdef __cplusplus

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v5 17/21] rte_ip.h: cast away gcc8 warning on rte_ipv6_phdr_cksum
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
                       ` (15 preceding siblings ...)
  2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 16/21] rte_ip.h: cast return checksum size to uint16 Andy Green
@ 2018-05-17 13:50     ` Andy Green
  2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 18/21] rte_mbuf.h: explicit cast for size type to uint32 Andy Green
                       ` (4 subsequent siblings)
  21 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:50 UTC (permalink / raw)
  To: dev

/projects/lagopus/src/dpdk/build/include/rte_ip.h:
In function 'rte_ipv6_phdr_cksum':
/projects/lagopus/src/dpdk/build/include/rte_ip.h:
378:18: warning: conversion to 'uint32_t' {aka
'unsigned int'} from 'int' may change the sign of
the result [-Wsign-conversion]
  psd_hdr.proto = (ipv6_hdr->proto << 24);

Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_net/rte_ip.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index c46398548..72dc2456a 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -375,7 +375,7 @@ rte_ipv6_phdr_cksum(const struct ipv6_hdr *ipv6_hdr, uint64_t ol_flags)
 		uint32_t proto; /* L4 protocol - top 3 bytes must be zero */
 	} psd_hdr;
 
-	psd_hdr.proto = (ipv6_hdr->proto << 24);
+	psd_hdr.proto = (uint32_t)(ipv6_hdr->proto << 24);
 	if (ol_flags & PKT_TX_TCP_SEG) {
 		psd_hdr.len = 0;
 	} else {

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v5 18/21] rte_mbuf.h: explicit cast for size type to uint32
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
                       ` (16 preceding siblings ...)
  2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 17/21] rte_ip.h: cast away gcc8 warning on rte_ipv6_phdr_cksum Andy Green
@ 2018-05-17 13:50     ` Andy Green
  2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 19/21] rte_mbuf.h: explicit casts to uint16 to avoid warnings Andy Green
                       ` (3 subsequent siblings)
  21 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:50 UTC (permalink / raw)
  To: dev

/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
In function 'rte_pktmbuf_detach':
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
1580:14: warning: conversion from 'long unsigned int'
to 'uint32_t' {aka 'unsigned int'} may change
value [-Wconversion]
  mbuf_size = sizeof(struct rte_mbuf) + priv_size;
              ^~~~~~

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..7849192c6 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] 174+ messages in thread

* [dpdk-dev] [PATCH v5 19/21] rte_mbuf.h: explicit casts to uint16 to avoid warnings
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
                       ` (17 preceding siblings ...)
  2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 18/21] rte_mbuf.h: explicit cast for size type to uint32 Andy Green
@ 2018-05-17 13:50     ` Andy Green
  2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 20/21] rte_ethdev.h: align sign and scope of temp var Andy Green
                       ` (2 subsequent siblings)
  21 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:50 UTC (permalink / raw)
  To: dev

/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
In function 'rte_pktmbuf_detach':
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
1583:17: warning: conversion from 'uint32_t' {aka
'unsigned int'} to 'uint16_t' {aka
'short unsigned int'} may change value [-Wconversion]
  m->priv_size = priv_size;
                 ^~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
In function 'rte_pktmbuf_prepend':
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
1908:17: warning: conversion from 'int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
  m->data_off -= len;
                 ^~~
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
In function 'rte_pktmbuf_adj':
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
1969:17: warning: conversion from 'int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
  m->data_off += len;
                 ^~~
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
In function 'rte_pktmbuf_chain':
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
2082:19: warning: conversion from 'int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
  head->nb_segs += tail->nb_segs;
                   ^~~~
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
In function 'rte_validate_tx_offload':
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
2112:19: warning: conversion to 'uint64_t'
{aka 'long unsigned int'} from 'int' may change the
sign of the result [-Wsign-conversion]
   inner_l3_offset += m->outer_l2_len + m->outer_l3_len;
                   ^~
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
In function 'rte_pktmbuf_linearize':
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
1873:32: warning: conversion to 'int' from 'uint32_t'
{aka 'unsigned int'} may change the sign of the
result [-Wsign-conversion]
 #define rte_pktmbuf_pkt_len(m) ((m)->pkt_len)
                                ^
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
2166:13: note: in expansion of macro 'rte_pktmbuf_pkt_len'
  copy_len = rte_pktmbuf_pkt_len(mbuf) -
rte_pktmbuf_data_len(mbuf);
             ^~~~~~~~~~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
2180:51: warning: conversion to 'size_t' {aka
'long unsigned int'} from 'int' may change the
sign of the result [-Wsign-conversion]
   rte_memcpy(buffer, rte_pktmbuf_mtod(m, char *), seg_len);
                                                   ^~~~~~~
Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_mbuf/rte_mbuf.h |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 7849192c6..4eddf238e 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1569,7 +1569,8 @@ __rte_pktmbuf_free_direct(struct rte_mbuf *m)
 static inline void rte_pktmbuf_detach(struct rte_mbuf *m)
 {
 	struct rte_mempool *mp = m->pool;
-	uint32_t mbuf_size, buf_len, priv_size;
+	uint32_t mbuf_size, buf_len;
+	uint16_t priv_size;
 
 	if (RTE_MBUF_HAS_EXTBUF(m))
 		__rte_pktmbuf_free_extbuf(m);
@@ -1905,7 +1906,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 +1967,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 +2080,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 +2110,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 +2156,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 +2171,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] 174+ messages in thread

* [dpdk-dev] [PATCH v5 20/21] rte_ethdev.h: align sign and scope of temp var
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
                       ` (18 preceding siblings ...)
  2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 19/21] rte_mbuf.h: explicit casts to uint16 to avoid warnings Andy Green
@ 2018-05-17 13:50     ` Andy Green
  2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 21/21] rte_byteorder.h: explicit cast for return promotion Andy Green
  2018-05-20 22:18     ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Thomas Monjalon
  21 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:50 UTC (permalink / raw)
  To: dev

/projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
In function 'rte_eth_rx_burst':
/projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
3836:18: warning: conversion to 'int16_t' {aka 'short
int'} from 'uint16_t' {aka 'short unsigned int'} may
change the sign of the result [-Wsign-conversion]
  int16_t nb_rx = (*dev->rx_pkt_burst)(dev->data->
rx_queues[queue_id],
                  ^
/projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
3844:50: warning: conversion to 'uint16_t' {aka 'short
unsigned int'} from 'int16_t' {aka 'short int'} may
change the sign of the result [-Wsign-conversion]
    nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
                                                  ^~~~~
/projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
3844:12: warning: conversion to 'int16_t' {aka 'short
int'} from 'uint16_t' {aka 'short unsigned int'} may
change the sign of the result [-Wsign-conversion]
    nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
            ^~
/projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
3851:9: warning: conversion to 'uint16_t' {aka 'short
unsigned int'} from 'int16_t' {aka 'short int'} may
change the sign of the result [-Wsign-conversion]
  return nb_rx;
         ^~~~~


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 f8815e994..7e7cfeee9 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -3823,6 +3823,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);
@@ -3833,18 +3834,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] 174+ messages in thread

* [dpdk-dev] [PATCH v5 21/21] rte_byteorder.h: explicit cast for return promotion
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
                       ` (19 preceding siblings ...)
  2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 20/21] rte_ethdev.h: align sign and scope of temp var Andy Green
@ 2018-05-17 13:50     ` Andy Green
  2018-05-20 22:18     ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Thomas Monjalon
  21 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:50 UTC (permalink / raw)
  To: dev

/projects/lagopus/src/dpdk/build/include/generic/
rte_byteorder.h: In function 'rte_constant_bswap16':
/projects/lagopus/src/dpdk/build/include/generic/
rte_byteorder.h:54:45: warning: conversion from
'int' to 'uint16_t' {aka 'short unsigned int'}
may change value [-Wconversion]
  ((((uint16_t)(v) & UINT16_C(0x00ff)) << 8) | \
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   (((uint16_t)(v) & UINT16_C(0xff00)) >> 8))
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/generic/
rte_byteorder.h:126:9: note: in expansion of macro
'RTE_STATIC_BSWAP16'
  return RTE_STATIC_BSWAP16(x);
         ^~~~~~~~~~~~~~~~~~

The other two sizes are going to be afflicted the
same, so get the same fix.

Signed-off-by: Andy Green <andy@warmcat.com>
---
 .../common/include/generic/rte_byteorder.h         |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/common/include/generic/rte_byteorder.h b/lib/librte_eal/common/include/generic/rte_byteorder.h
index 9bed85cca..7d9a1463c 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(x);
 }
 
 /*
@@ -135,7 +135,7 @@ rte_constant_bswap16(uint16_t x)
 static inline uint32_t
 rte_constant_bswap32(uint32_t x)
 {
-	return RTE_STATIC_BSWAP32(x);
+	return (uint32_t)RTE_STATIC_BSWAP32(x);
 }
 
 /*
@@ -147,7 +147,7 @@ rte_constant_bswap32(uint32_t x)
 static inline uint64_t
 rte_constant_bswap64(uint64_t x)
 {
-	return RTE_STATIC_BSWAP64(x);
+	return (uint64_t)RTE_STATIC_BSWAP64(x);
 }
 
 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 15/23] rte_ethdev.h: align sign and scope of temp var
  2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 15/23] rte_ethdev.h: align sign and scope of temp var Andy Green
@ 2018-05-17 13:54     ` Bruce Richardson
  2018-05-17 14:17       ` Andy Green
  0 siblings, 1 reply; 174+ messages in thread
From: Bruce Richardson @ 2018-05-17 13:54 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

On Mon, May 14, 2018 at 01:10:43PM +0800, Andy Green wrote:
> Signed-off-by: Andy Green <andy@warmcat.com>
> ---
>  lib/librte_ethdev/rte_ethdev.h |   25 +++++++++++++++----------
>  1 file changed, 15 insertions(+), 10 deletions(-)
> 

While I dislike the changes below, since I believe it's always more
readable to declare variables at first use, if the changes are needed to
remove compiler errors in apps, then they need to be fixed.

Patch needs a suitable commit log explaining the changes or giving the
error message.


> diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
> index 49c2ebbd5..2cb5fe3be 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

Rather than increasing the level of indentation needed with the extra
braces, it's probably best to separate variable definition and assignment
as you did in the first change above.

/Bruce

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-dev-ops API to return int
  2018-05-17 13:48     ` [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-dev-ops API to return int Andy Green
@ 2018-05-17 13:55       ` Bruce Richardson
  2018-05-17 13:59         ` Andy Green
  2018-05-18 10:59       ` Shreyansh Jain
  1 sibling, 1 reply; 174+ messages in thread
From: Bruce Richardson @ 2018-05-17 13:55 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

On Thu, May 17, 2018 at 09:48:57PM +0800, Andy Green wrote:
> Signed-off-by: Andy Green <andy@warmcat.com>
> ---

What's the reason for this change of type?

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v5 02/21] rte_string_fns.h: fix gcc8.1 sign conv warning in lstrcpy
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 02/21] rte_string_fns.h: fix gcc8.1 sign conv warning in lstrcpy Andy Green
@ 2018-05-17 13:56       ` Bruce Richardson
  2018-05-17 14:03       ` [dpdk-dev] [PATCH] " Andy Green
  2018-05-17 14:40       ` [dpdk-dev] [PATCH v5 02/21] " Stephen Hemminger
  2 siblings, 0 replies; 174+ messages in thread
From: Bruce Richardson @ 2018-05-17 13:56 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

On Thu, May 17, 2018 at 09:49:02PM +0800, Andy Green wrote:
> In file included from ./dpdk/dpdk.c:88:
> /projects/lagopus/src/dpdk/build/include/rte_string_fns.h: In
> function 'rte_strlcpy':
> /projects/lagopus/src/dpdk/build/include/rte_string_fns.h:58:9:
> warning: conversion to 'size_t' {aka 'long unsigned int'} from
> 'int' may change the sign of the result [-Wsign-conversion]
>   return snprintf(dst, size, "%s", src);
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ---
>  lib/librte_eal/common/include/rte_string_fns.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-dev-ops API to return int
  2018-05-17 13:55       ` Bruce Richardson
@ 2018-05-17 13:59         ` Andy Green
  0 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 13:59 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev



On 05/17/2018 09:55 PM, Bruce Richardson wrote:
> On Thu, May 17, 2018 at 09:48:57PM +0800, Andy Green wrote:
>> Signed-off-by: Andy Green <andy@warmcat.com>
>> ---
> 
> What's the reason for this change of type?

I was asked to do it on the list... the original patch I sent was 
triggered by gcc8 warnings and just casted it away.  But the comment was 
that as an int, it could return negative error codes, so better to 
change them all.

It thereby became something in the way of a refactor rather than a gcc 8 
fix any more.

-Andy

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH] rte_string_fns.h: fix gcc8.1 sign conv warning in lstrcpy
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 02/21] rte_string_fns.h: fix gcc8.1 sign conv warning in lstrcpy Andy Green
  2018-05-17 13:56       ` Bruce Richardson
@ 2018-05-17 14:03       ` Andy Green
  2018-05-17 14:40       ` [dpdk-dev] [PATCH v5 02/21] " Stephen Hemminger
  2 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-17 14:03 UTC (permalink / raw)
  To: dev

In file included from ./dpdk/dpdk.c:88:
/projects/lagopus/src/dpdk/build/include/rte_string_fns.h: In
function 'rte_strlcpy':
/projects/lagopus/src/dpdk/build/include/rte_string_fns.h:58:9:
warning: conversion to 'size_t' {aka 'long unsigned int'} from
'int' may change the sign of the result [-Wsign-conversion]
  return snprintf(dst, size, "%s", src);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_eal/common/include/rte_string_fns.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index fcbb42e00..97597a148 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -55,7 +55,7 @@ rte_strsplit(char *string, int stringlen,
 static inline size_t
 rte_strlcpy(char *dst, const char *src, size_t size)
 {
-	return snprintf(dst, size, "%s", src);
+	return (size_t)snprintf(dst, size, "%s", src);
 }
 
 /* pull in a strlcpy function */

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 15/23] rte_ethdev.h: align sign and scope of temp var
  2018-05-17 13:54     ` Bruce Richardson
@ 2018-05-17 14:17       ` Andy Green
  2018-05-17 14:26         ` Bruce Richardson
  0 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-17 14:17 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev



On 05/17/2018 09:54 PM, Bruce Richardson wrote:
> On Mon, May 14, 2018 at 01:10:43PM +0800, Andy Green wrote:
>> Signed-off-by: Andy Green <andy@warmcat.com>
>> ---
>>   lib/librte_ethdev/rte_ethdev.h |   25 +++++++++++++++----------
>>   1 file changed, 15 insertions(+), 10 deletions(-)
>>
> 
> While I dislike the changes below, since I believe it's always more
> readable to declare variables at first use, if the changes are needed to
> remove compiler errors in apps, then they need to be fixed.
> 
> Patch needs a suitable commit log explaining the changes or giving the
> error message.

It has this in the last push (which overlapped with your comment)... I 
seem to have missed the error about declarations after code not being 
allowed in C90, but I guess that part being an issue is not controversial.

> 
>> diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
>> index 49c2ebbd5..2cb5fe3be 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
> 
> Rather than increasing the level of indentation needed with the extra
> braces, it's probably best to separate variable definition and assignment
> as you did in the first change above.

IIRC my thinking was I had a choice to repeat the conditional 
compilation stuff around the declaration (because it's in an #ifdef), 
(void)cb; to dodge the unused var warning, or add a basic block for it 
to scope to.  The last one didn't seem so bad.

-Andy

> /Bruce
> 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v4 15/23] rte_ethdev.h: align sign and scope of temp var
  2018-05-17 14:17       ` Andy Green
@ 2018-05-17 14:26         ` Bruce Richardson
  0 siblings, 0 replies; 174+ messages in thread
From: Bruce Richardson @ 2018-05-17 14:26 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

On Thu, May 17, 2018 at 10:17:04PM +0800, Andy Green wrote:
> 
> 
> On 05/17/2018 09:54 PM, Bruce Richardson wrote:
> > On Mon, May 14, 2018 at 01:10:43PM +0800, Andy Green wrote:
> > > Signed-off-by: Andy Green <andy@warmcat.com>
> > > ---
> > >   lib/librte_ethdev/rte_ethdev.h |   25 +++++++++++++++----------
> > >   1 file changed, 15 insertions(+), 10 deletions(-)
> > > 
> > 
> > While I dislike the changes below, since I believe it's always more
> > readable to declare variables at first use, if the changes are needed to
> > remove compiler errors in apps, then they need to be fixed.
> > 
> > Patch needs a suitable commit log explaining the changes or giving the
> > error message.
> 
> It has this in the last push (which overlapped with your comment)... I seem
> to have missed the error about declarations after code not being allowed in
> C90, but I guess that part being an issue is not controversial.
> 
> > 
> > > diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
> > > index 49c2ebbd5..2cb5fe3be 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
> > 
> > Rather than increasing the level of indentation needed with the extra
> > braces, it's probably best to separate variable definition and assignment
> > as you did in the first change above.
> 
> IIRC my thinking was I had a choice to repeat the conditional compilation
> stuff around the declaration (because it's in an #ifdef), (void)cb; to dodge
> the unused var warning, or add a basic block for it to scope to.  The last
> one didn't seem so bad.
> 
Ok, that makes sense. For completeness, I'd add a "do" and "while(0)" to the
braces, but that's not important here, it's ok as-is.

BTW: for your v5, I don't think you kept the previous ack's that myself and
Olivier had given for a number of your patches. It's strongly recommended
that you put any previously-given acks in any new revisions after the
signoff line, so as to make it easier to track for maintainers, and to save
us having to re-ack the same patches multiple times.

Thanks,
/Bruce

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v5 02/21] rte_string_fns.h: fix gcc8.1 sign conv warning in lstrcpy
  2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 02/21] rte_string_fns.h: fix gcc8.1 sign conv warning in lstrcpy Andy Green
  2018-05-17 13:56       ` Bruce Richardson
  2018-05-17 14:03       ` [dpdk-dev] [PATCH] " Andy Green
@ 2018-05-17 14:40       ` Stephen Hemminger
  2018-05-17 15:28         ` Bruce Richardson
  2 siblings, 1 reply; 174+ messages in thread
From: Stephen Hemminger @ 2018-05-17 14:40 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

On Thu, 17 May 2018 21:49:02 +0800
Andy Green <andy@warmcat.com> wrote:

> In file included from ./dpdk/dpdk.c:88:
> /projects/lagopus/src/dpdk/build/include/rte_string_fns.h: In
> function 'rte_strlcpy':
> /projects/lagopus/src/dpdk/build/include/rte_string_fns.h:58:9:
> warning: conversion to 'size_t' {aka 'long unsigned int'} from
> 'int' may change the sign of the result [-Wsign-conversion]
>   return snprintf(dst, size, "%s", src);
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ---
>  lib/librte_eal/common/include/rte_string_fns.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
> index fcbb42e00..97597a148 100644
> --- a/lib/librte_eal/common/include/rte_string_fns.h
> +++ b/lib/librte_eal/common/include/rte_string_fns.h
> @@ -55,7 +55,7 @@ rte_strsplit(char *string, int stringlen,
>  static inline size_t
>  rte_strlcpy(char *dst, const char *src, size_t size)
>  {
> -	return snprintf(dst, size, "%s", src);
> +	return (size_t)snprintf(dst, size, "%s", src);
>  }
>  
>  /* pull in a strlcpy function */
> 

I still like the BSD function better because it guarantees all data
in the buffer is zero'd snprintf does not.

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v5 02/21] rte_string_fns.h: fix gcc8.1 sign conv warning in lstrcpy
  2018-05-17 14:40       ` [dpdk-dev] [PATCH v5 02/21] " Stephen Hemminger
@ 2018-05-17 15:28         ` Bruce Richardson
  0 siblings, 0 replies; 174+ messages in thread
From: Bruce Richardson @ 2018-05-17 15:28 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Andy Green, dev

On Thu, May 17, 2018 at 07:40:16AM -0700, Stephen Hemminger wrote:
> On Thu, 17 May 2018 21:49:02 +0800
> Andy Green <andy@warmcat.com> wrote:
> 
> > In file included from ./dpdk/dpdk.c:88:
> > /projects/lagopus/src/dpdk/build/include/rte_string_fns.h: In
> > function 'rte_strlcpy':
> > /projects/lagopus/src/dpdk/build/include/rte_string_fns.h:58:9:
> > warning: conversion to 'size_t' {aka 'long unsigned int'} from
> > 'int' may change the sign of the result [-Wsign-conversion]
> >   return snprintf(dst, size, "%s", src);
> >          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > ---
> >  lib/librte_eal/common/include/rte_string_fns.h |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
> > index fcbb42e00..97597a148 100644
> > --- a/lib/librte_eal/common/include/rte_string_fns.h
> > +++ b/lib/librte_eal/common/include/rte_string_fns.h
> > @@ -55,7 +55,7 @@ rte_strsplit(char *string, int stringlen,
> >  static inline size_t
> >  rte_strlcpy(char *dst, const char *src, size_t size)
> >  {
> > -	return snprintf(dst, size, "%s", src);
> > +	return (size_t)snprintf(dst, size, "%s", src);
> >  }
> >  
> >  /* pull in a strlcpy function */
> > 
> 
> I still like the BSD function better because it guarantees all data
> in the buffer is zero'd snprintf does not.

Right. But that is really a separate change from just fixing compiler
errors, which is why I think it's best kept out of this set.

As for zero-ing the rest of the buffer, reading the man page for strlcpy on
my fedora system, I find no mention of that behaviour. This implies to me
that the only guarantee from strlcpy is that there is one zero byte at the
end, and that the zeroing the rest of the array is not to be relied up.
Therefore, I see little value in having it in the fallback implementation
unless we are going to guarantee that we always use that implementation -
something we can't really do on freebsd systems, for example.

/Bruce

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-dev-ops API to return int
  2018-05-17 13:48     ` [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-dev-ops API to return int Andy Green
  2018-05-17 13:55       ` Bruce Richardson
@ 2018-05-18 10:59       ` Shreyansh Jain
  2018-05-18 11:12         ` Andy Green
  2018-05-18 13:02         ` [dpdk-dev] [PATCH] rte_ethdev.h: fix gcc8.1 sign conversion warining Andy Green
  1 sibling, 2 replies; 174+ messages in thread
From: Shreyansh Jain @ 2018-05-18 10:59 UTC (permalink / raw)
  To: Andy Green, dev

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Andy Green
> Sent: Thursday, May 17, 2018 7:19 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-dev-
> ops API to return int
> 
> 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(-)
> 

[...]

>  	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 d014a11aa..70a5b4851 100644
> --- a/drivers/net/dpaa/dpaa_ethdev.c
> +++ b/drivers/net/dpaa/dpaa_ethdev.c
> @@ -725,7 +725,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;
> @@ -738,7 +738,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 9297725d9..eb6245b83 100644
> --- a/drivers/net/dpaa2/dpaa2_ethdev.c
> +++ b/drivers/net/dpaa2/dpaa2_ethdev.c
> @@ -604,7 +604,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;
> @@ -612,7 +612,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();
> 
> @@ -628,7 +628,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);
>  	}

This doesn't feel correct. A counter, especially the number of descriptors in a queue, doesn't have a negative value. So, 1) this is an unnatural return and 2) we litter the code with unnecessary typecast.

In fact, even in the above change, the debug messages continue to print unsigned values. So, another typecast would be required there.

I don't agree with this change - at least not until some strong gcc 8 warning reason is triggering this. Can you please point me to some conversation on mailing list which enforces this?

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-dev-ops API to return int
  2018-05-18 10:59       ` Shreyansh Jain
@ 2018-05-18 11:12         ` Andy Green
  2018-05-20  2:43           ` Shreyansh Jain
  2018-05-18 13:02         ` [dpdk-dev] [PATCH] rte_ethdev.h: fix gcc8.1 sign conversion warining Andy Green
  1 sibling, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-18 11:12 UTC (permalink / raw)
  To: Shreyansh Jain, dev



On 05/18/2018 06:59 PM, Shreyansh Jain wrote:
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Andy Green
>> Sent: Thursday, May 17, 2018 7:19 PM
>> To: dev@dpdk.org
>> Subject: [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-dev-
>> ops API to return int
>>
>> 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(-)
>>
> 
> [...]
> 
>>   	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 d014a11aa..70a5b4851 100644
>> --- a/drivers/net/dpaa/dpaa_ethdev.c
>> +++ b/drivers/net/dpaa/dpaa_ethdev.c
>> @@ -725,7 +725,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;
>> @@ -738,7 +738,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 9297725d9..eb6245b83 100644
>> --- a/drivers/net/dpaa2/dpaa2_ethdev.c
>> +++ b/drivers/net/dpaa2/dpaa2_ethdev.c
>> @@ -604,7 +604,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;
>> @@ -612,7 +612,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();
>>
>> @@ -628,7 +628,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);
>>   	}
> 
> This doesn't feel correct. A counter, especially the number of descriptors in a queue, doesn't have a negative value. So, 1) this is an unnatural return and 2) we litter the code with unnecessary typecast.
> 
> In fact, even in the above change, the debug messages continue to print unsigned values. So, another typecast would be required there.
> 
> I don't agree with this change - at least not until some strong gcc 8 warning reason is triggering this. Can you please point me to some conversation on mailing list which enforces this?
> 

hmmmmm.... no, it's not my idea.

If you don't like it, don't do it, I don't mind either way.  I sent a 
patch that just solved the compiler error only already, and was told on 
the list it would be cooler if these things returned an int instead.

There's no point challenging me about the wisdom of it, although it 
seems reasonable to me.  I sent a patch, list guy $1 says do X instead, 
I do X and then list guy $2 says EXPLAIN YOURSELF.

I really don't care, $1 should argue with $2 and leave me out of it.

If I don't hear anything more I'll reissue with just the minimal change 
later.

-Andy

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH] rte_ethdev.h: fix gcc8.1 sign conversion warining
  2018-05-18 10:59       ` Shreyansh Jain
  2018-05-18 11:12         ` Andy Green
@ 2018-05-18 13:02         ` Andy Green
  1 sibling, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-18 13:02 UTC (permalink / raw)
  To: dev; +Cc: shreyansh.jain, bruce.richardson

/projects/lagopus/src/dpdk/build/include/rte_ethdev.h: In function 'rte_eth_rx_queue_count':
/projects/lagopus/src/dpdk/build/include/rte_ethdev.h:3882:10: warning: conversion to 'int' from 'uint32_t' {aka 'unsigned int'} may change the sign of the result [-Wsign-conversion]
  return (*dev->dev_ops->rx_queue_count)(dev, queue_id);
         ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Andy Green <andy@warmcat.com>
Fixes: 439a90b5f2 ("ethdev: reorder inline functions")
---
 lib/librte_ethdev/rte_ethdev.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index f8815e994..d52c1bed9 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -3874,7 +3874,7 @@ rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id)
 	if (queue_id >= dev->data->nb_rx_queues)
 		return -EINVAL;
 
-	return (*dev->dev_ops->rx_queue_count)(dev, queue_id);
+	return (int)(*dev->dev_ops->rx_queue_count)(dev, queue_id);
 }
 
 /**

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-dev-ops API to return int
  2018-05-18 11:12         ` Andy Green
@ 2018-05-20  2:43           ` Shreyansh Jain
  2018-05-20  4:11             ` Andy Green
  2018-05-21  6:52             ` Stephen Hemminger
  0 siblings, 2 replies; 174+ messages in thread
From: Shreyansh Jain @ 2018-05-20  2:43 UTC (permalink / raw)
  To: Andy Green, dev

> -----Original Message-----
> From: Andy Green [mailto:andy@warmcat.com]
> Sent: Friday, May 18, 2018 4:42 PM
> To: Shreyansh Jain <shreyansh.jain@nxp.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-
> dev-ops API to return int
> 
> 
> 
> On 05/18/2018 06:59 PM, Shreyansh Jain wrote:
> >> -----Original Message-----
> >> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Andy Green
> >> Sent: Thursday, May 17, 2018 7:19 PM
> >> To: dev@dpdk.org
> >> Subject: [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-
> dev-
> >> ops API to return int
> >>
> >> 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(-)
> >>
> >
> > [...]
> >
> >>   	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 d014a11aa..70a5b4851 100644
> >> --- a/drivers/net/dpaa/dpaa_ethdev.c
> >> +++ b/drivers/net/dpaa/dpaa_ethdev.c
> >> @@ -725,7 +725,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;
> >> @@ -738,7 +738,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 9297725d9..eb6245b83 100644
> >> --- a/drivers/net/dpaa2/dpaa2_ethdev.c
> >> +++ b/drivers/net/dpaa2/dpaa2_ethdev.c
> >> @@ -604,7 +604,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;
> >> @@ -612,7 +612,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();
> >>
> >> @@ -628,7 +628,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);
> >>   	}
> >
> > This doesn't feel correct. A counter, especially the number of
> descriptors in a queue, doesn't have a negative value. So, 1) this is
> an unnatural return and 2) we litter the code with unnecessary
> typecast.
> >
> > In fact, even in the above change, the debug messages continue to
> print unsigned values. So, another typecast would be required there.
> >
> > I don't agree with this change - at least not until some strong gcc 8
> warning reason is triggering this. Can you please point me to some
> conversation on mailing list which enforces this?
> >
> 
> hmmmmm.... no, it's not my idea.
> 
> If you don't like it, don't do it, I don't mind either way.  I sent a
> patch that just solved the compiler error only already, and was told on
> the list it would be cooler if these things returned an int instead.
> 
> There's no point challenging me about the wisdom of it, although it
> seems reasonable to me.  I sent a patch, list guy $1 says do X instead,
> I do X and then list guy $2 says EXPLAIN YOURSELF.

That is what a community is. Consensus has to be built, not expected automagically. If you touch a line, you are responsible for it (also, because in future git blame would point *you* out for a change).

> 
> I really don't care, $1 should argue with $2 and leave me out of it.

I was expecting that you point me out to where the $1 conversation was - so that I could have understood reason for your change. You didn’t do that and rather went into a tangential conversation.

I will not be searching through your previous patches and conversations to understand why $1 said something and you *agreed* to go ahead and make changes.

> 
> If I don't hear anything more I'll reissue with just the minimal change
> later.
> 
> -Andy

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-dev-ops API to return int
  2018-05-20  2:43           ` Shreyansh Jain
@ 2018-05-20  4:11             ` Andy Green
  2018-05-21  6:52             ` Stephen Hemminger
  1 sibling, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-20  4:11 UTC (permalink / raw)
  To: Shreyansh Jain, dev



On 05/20/2018 10:43 AM, Shreyansh Jain wrote:
>> -----Original Message-----
>> From: Andy Green [mailto:andy@warmcat.com]
>> Sent: Friday, May 18, 2018 4:42 PM
>> To: Shreyansh Jain <shreyansh.jain@nxp.com>; dev@dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-
>> dev-ops API to return int
>>
>>
>>
>> On 05/18/2018 06:59 PM, Shreyansh Jain wrote:
>>>> -----Original Message-----
>>>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Andy Green
>>>> Sent: Thursday, May 17, 2018 7:19 PM
>>>> To: dev@dpdk.org
>>>> Subject: [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-
>> dev-
>>>> ops API to return int
>>>>
>>>> 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(-)
>>>>
>>>
>>> [...]
>>>
>>>>    	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 d014a11aa..70a5b4851 100644
>>>> --- a/drivers/net/dpaa/dpaa_ethdev.c
>>>> +++ b/drivers/net/dpaa/dpaa_ethdev.c
>>>> @@ -725,7 +725,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;
>>>> @@ -738,7 +738,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 9297725d9..eb6245b83 100644
>>>> --- a/drivers/net/dpaa2/dpaa2_ethdev.c
>>>> +++ b/drivers/net/dpaa2/dpaa2_ethdev.c
>>>> @@ -604,7 +604,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;
>>>> @@ -612,7 +612,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();
>>>>
>>>> @@ -628,7 +628,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);
>>>>    	}
>>>
>>> This doesn't feel correct. A counter, especially the number of
>> descriptors in a queue, doesn't have a negative value. So, 1) this is
>> an unnatural return and 2) we litter the code with unnecessary
>> typecast.
>>>
>>> In fact, even in the above change, the debug messages continue to
>> print unsigned values. So, another typecast would be required there.
>>>
>>> I don't agree with this change - at least not until some strong gcc 8
>> warning reason is triggering this. Can you please point me to some
>> conversation on mailing list which enforces this?
>>>
>>
>> hmmmmm.... no, it's not my idea.
>>
>> If you don't like it, don't do it, I don't mind either way.  I sent a
>> patch that just solved the compiler error only already, and was told on
>> the list it would be cooler if these things returned an int instead.
>>
>> There's no point challenging me about the wisdom of it, although it
>> seems reasonable to me.  I sent a patch, list guy $1 says do X instead,
>> I do X and then list guy $2 says EXPLAIN YOURSELF.
> 
> That is what a community is. Consensus has to be built, not expected automagically. If you touch a line, you are responsible for it (also, because in future git blame would point *you* out for a change).

That makes a lot of sense if you work for Intel.

>> I really don't care, $1 should argue with $2 and leave me out of it.
> 
> I was expecting that you point me out to where the $1 conversation was - so that I could have understood reason for your change. You didn’t do that and rather went into a tangential conversation.
> 
> I will not be searching through your previous patches and conversations to understand why $1 said something and you *agreed* to go ahead and make changes.

As I said I don't care to waste more time digging it up and arguing 
about it either.  It wasn't my idea.  The dude just suggested the 
change, as someone passing by I can't tell if the project is asking me 
to do some "community service" to get my patches in (as is common on the 
kernel) or some random guy is just explaining his prejudices.

Friday I sent a patch here without the return type change at all, 
instead it's just a one-liner fixing the original compile problem, which 
is what I originally sent to the list.  So already you can just pick 
which version you like and move on.

-Andy

>>
>> If I don't hear anything more I'll reissue with just the minimal change
>> later.
>>
>> -Andy

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus
  2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
                       ` (20 preceding siblings ...)
  2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 21/21] rte_byteorder.h: explicit cast for return promotion Andy Green
@ 2018-05-20 22:18     ` Thomas Monjalon
  2018-05-21  2:00       ` [dpdk-dev] [PATCH v6 0/8] " Andy Green
  2018-05-21  2:06       ` [dpdk-dev] [PATCH v5 00/21] " Andy Green
  21 siblings, 2 replies; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-20 22:18 UTC (permalink / raw)
  To: Andy Green; +Cc: dev

> Andy Green (21):
>       lib/librte_ethdev: change eth-dev-ops API to return int
>       rte_string_fns.h: fix gcc8.1 sign conv warning in lstrcpy
>       lib/librte_eal: explicit tmp cast
>       /lib/librte_eal: stage cast from uint64 to long
>       rte_ring_generic.h: stack declarations before code
>       rte_ring.h: remove signed type flipflopping
>       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_ether.h: explicit cast avoiding truncation warning
>       rte_rwlock.h: gcc8 sign conversion warnings
>       rte_ip.h: cast input to bswap16 to be uint16
>       rte_ip.h: cast around promotion to int
>       rte_ip.h: cast type decided by sizeof to uint32
>       rte_ip.h: cast return checksum size to uint16
>       rte_ip.h: cast away gcc8 warning on rte_ipv6_phdr_cksum
>       rte_mbuf.h: explicit cast for size type to uint32
>       rte_mbuf.h: explicit casts to uint16 to avoid warnings
>       rte_ethdev.h: align sign and scope of temp var
>       rte_byteorder.h: explicit cast for return promotion

16 patches have been applied.
The tags Fixes and Cc:stable have been added, so they can be backported.

5 patches are missing:
	lib/librte_eal: explicit tmp cast
	rte_rwlock.h: gcc8 sign conversion warnings
	rte_ip.h: cast type decided by sizeof to uint32
	rte_mbuf.h: explicit casts to uint16 to avoid warnings
	rte_ethdev.h: align sign and scope of temp var
Those patches are either not reviewed, or not safe enough at this release stage.
Please, feel free to send them again in a v6 to make clear they need more review.
I think the mbuf one (for uint16_t) may deserve to be split.

Thanks

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v6 0/8] Fixes for GCC8 against lagopus
  2018-05-20 22:18     ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Thomas Monjalon
@ 2018-05-21  2:00       ` Andy Green
  2018-05-21  2:00         ` [dpdk-dev] [PATCH v6 1/8] lib/librte_eal: explicit tmp cast Andy Green
                           ` (8 more replies)
  2018-05-21  2:06       ` [dpdk-dev] [PATCH v5 00/21] " Andy Green
  1 sibling, 9 replies; 174+ messages in thread
From: Andy Green @ 2018-05-21  2:00 UTC (permalink / raw)
  To: dev; +Cc: thomas

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.

These are the remaining 5 patches not yet applied,
with one split into three for clarity.  There is no
new patch content.

Extra explanation is added (along with Fixes: already).

I confirmed with master plus these patches, the only
remaing compile errors in lagopus are from lagopus
itself.

---

Andy Green (8):
      lib/librte_eal: explicit tmp cast
      rte_rwlock.h: gcc8 sign conversion warnings
      rte_ip.h: cast type decided by sizeof to uint32
      rte_mbuf.h: reduce temp to match uint16 types
      rte_mbuf.h: avoid implicit demotion in 64-bit arith
      rte_mbuf.h: choose correct type for temp
      rte_mbuf.h: add and subtract explicitly to avoid promotion
      rte_ethdev.h: align sign and scope of temp var


 .../common/include/arch/x86/rte_memcpy.h           |    8 +++---
 lib/librte_eal/common/include/generic/rte_rwlock.h |    4 ++-
 lib/librte_ethdev/rte_ethdev.h                     |   25 ++++++++++++--------
 lib/librte_mbuf/rte_mbuf.h                         |   14 ++++++-----
 lib/librte_net/rte_ip.h                            |    4 ++-
 5 files changed, 31 insertions(+), 24 deletions(-)

--
Signature

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v6 1/8] lib/librte_eal: explicit tmp cast
  2018-05-21  2:00       ` [dpdk-dev] [PATCH v6 0/8] " Andy Green
@ 2018-05-21  2:00         ` Andy Green
  2018-05-21 11:06           ` [dpdk-dev] [PATCH] lib/librte_eal: change type of tmp Andy Green
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 2/8] rte_rwlock.h: gcc8 sign conversion warnings Andy Green
                           ` (7 subsequent siblings)
  8 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-21  2:00 UTC (permalink / raw)
  To: dev; +Cc: thomas

/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
  MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
  ^~~~~~~~~~~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
649:51: warning: conversion from 'size_t' {aka 'long
unsigned int'} to 'int' may change value [-Wconversion]
     case 0x0B: MOVEUNALIGNED_LEFT47_IMM(dst, src,
n, 0x0B); break;    \
                                                   ^
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
616:15: note: in definition of macro 'MOVEUNALIGNED_LEFT47_IMM'
         tmp = len;                                                                                          \
               ^~~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
  MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
  ^~~~~~~~~~~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
618:13: warning: conversion to 'size_t' {aka 'long
unsigned int'} from 'int' may change the sign of the
result [-Wsign-conversion]
         tmp -= len;                                                                                         \
             ^~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
649:16: note: in expansion of macro 'MOVEUNALIGNED_LEFT47_IMM'
     case 0x0B: MOVEUNALIGNED_LEFT47_IMM(dst, src,
n, 0x0B); break;    \
                ^~~~~~~~~~~~~~~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
  MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
  ^~~~~~~~~~~~~~~~~~~~

This provides an explicit cast for a cast that has always been
happening, and still happens exactly the same after the cast.
It doesn't change the generated code.

    /projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
    618:13: warning: conversion to 'size_t' {aka 'long
    unsigned int'} from 'int' may change the sign of the
    result [-Wsign-conversion]
             tmp -= len;
                 ^~
    int tmp;
...

-    tmp -= len;
+    tmp -= (int)len;

Signed-off-by: Andy Green <andy@warmcat.com>
Fixes: d35cc1fe6a ("eal/x86: revert select optimized memcpy at run-time")
---
 .../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] 174+ messages in thread

* [dpdk-dev] [PATCH v6 2/8] rte_rwlock.h: gcc8 sign conversion warnings
  2018-05-21  2:00       ` [dpdk-dev] [PATCH v6 0/8] " Andy Green
  2018-05-21  2:00         ` [dpdk-dev] [PATCH v6 1/8] lib/librte_eal: explicit tmp cast Andy Green
@ 2018-05-21  2:01         ` Andy Green
  2018-05-21 12:10           ` Bruce Richardson
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 3/8] rte_ip.h: cast type decided by sizeof to uint32 Andy Green
                           ` (6 subsequent siblings)
  8 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-21  2:01 UTC (permalink / raw)
  To: dev; +Cc: thomas

In file included from /projects/lagopus/src/dpdk/
build/include/rte_rwlock.h:12,
                 from ./mgr/lock.h:24,
                 from ./mgr/sock_io.c:54:
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h: In function 'rte_rwlock_read_lock':
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h:74:12: warning: conversion to 'uint32_t'
{aka 'unsigned int'} from 'int32_t' {aka 'int'} may
change the sign of the result [-Wsign-conversion]
            x, x + 1);
            ^
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h:74:17: warning: conversion to 'uint32_t'
{aka 'unsigned int'} from 'int' may change the sign
of the result [-Wsign-conversion]
            x, x + 1);
               ~~^~~
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h: In function 'rte_rwlock_write_lock':
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h:110:15: warning: unsigned conversion
from 'int' to 'uint32_t' {aka 'unsigned int'}
changes value from '-1' to '4294967295'
[-Wsign-conversion]
            0, -1);
               ^~

Again in this case we are making explicit the exact cast
that was always happening implicitly.  The patch does not
change the generated code.

The int32_t temp "x" is required to be signed to detect
a < 0 error condition from the lock status.  Afterwards,
it has always been implicitly cast to uint32_t when it
is used in the arguments to rte_atomic32_cmpset()...
gcc8.1 objects to the implicit cast now and requires us
to cast it explicitly.

Fixes: af75078fec ("first public release")
Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_eal/common/include/generic/rte_rwlock.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/include/generic/rte_rwlock.h b/lib/librte_eal/common/include/generic/rte_rwlock.h
index 899e9bc43..5751a0e6d 100644
--- a/lib/librte_eal/common/include/generic/rte_rwlock.h
+++ b/lib/librte_eal/common/include/generic/rte_rwlock.h
@@ -71,7 +71,7 @@ rte_rwlock_read_lock(rte_rwlock_t *rwl)
 			continue;
 		}
 		success = rte_atomic32_cmpset((volatile uint32_t *)&rwl->cnt,
-					      x, x + 1);
+					      (uint32_t)x, (uint32_t)(x + 1));
 	}
 }
 
@@ -107,7 +107,7 @@ rte_rwlock_write_lock(rte_rwlock_t *rwl)
 			continue;
 		}
 		success = rte_atomic32_cmpset((volatile uint32_t *)&rwl->cnt,
-					      0, -1);
+					      0, (uint32_t)-1);
 	}
 }
 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v6 3/8] rte_ip.h: cast type decided by sizeof to uint32
  2018-05-21  2:00       ` [dpdk-dev] [PATCH v6 0/8] " Andy Green
  2018-05-21  2:00         ` [dpdk-dev] [PATCH v6 1/8] lib/librte_eal: explicit tmp cast Andy Green
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 2/8] rte_rwlock.h: gcc8 sign conversion warnings Andy Green
@ 2018-05-21  2:01         ` Andy Green
  2018-05-21 12:13           ` Bruce Richardson
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 4/8] rte_mbuf.h: reduce temp to match uint16 types Andy Green
                           ` (5 subsequent siblings)
  8 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-21  2:01 UTC (permalink / raw)
  To: dev; +Cc: thomas

/projects/lagopus/src/dpdk/build/include/rte_ip.h:
In function 'rte_ipv4_udptcp_cksum':
/projects/lagopus/src/dpdk/build/include/rte_byteorder.h:
51:24: warning: conversion from 'long unsigned int' to
'uint32_t' {aka 'unsigned int'} may change value
[-Wconversion]
 #define rte_bswap16(x) ((uint16_t)
(__builtin_constant_p(x) ?  \
                        ^
/projects/lagopus/src/dpdk/build/include/rte_byteorder.h:
85:29: note: in expansion of macro 'rte_bswap16'
 #define rte_be_to_cpu_16(x) rte_bswap16(x)
                             ^~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_ip.h:321:11:
note: in expansion of macro 'rte_be_to_cpu_16'
  l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) -
           ^~~~~~~~~~~~~~~~

Also with this one, it is a cast that always occurred
and is just being done explicitly, with no changes to
the generated code.

The warning stack is misleading, it points to the last
element in the macro that produced the lhs of the subtraction
above.  But the only "unsigned long int" in the expression is
the result of the sizeof() on the rhs, it promotes the
subtraction result to unsigned long.  So the error actually
relates to the result of the outer subtraction.

The actual error is "you are trying to put an unsigned long
into a uint32_t".  We always did so, the fix is just to inform
the compiler it is intentional with an explicit cast.

Fixes: 6006818cfb ("net: new checksum functions")
Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_net/rte_ip.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index c924aca7f..72dc2456a 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -318,8 +318,8 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr)
 	uint32_t cksum;
 	uint32_t l4_len;
 
-	l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) -
-		sizeof(struct ipv4_hdr);
+	l4_len = (uint32_t)(rte_be_to_cpu_16(ipv4_hdr->total_length) -
+		sizeof(struct ipv4_hdr));
 
 	cksum = rte_raw_cksum(l4_hdr, l4_len);
 	cksum += rte_ipv4_phdr_cksum(ipv4_hdr, 0);

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v6 4/8] rte_mbuf.h: reduce temp to match uint16 types
  2018-05-21  2:00       ` [dpdk-dev] [PATCH v6 0/8] " Andy Green
                           ` (2 preceding siblings ...)
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 3/8] rte_ip.h: cast type decided by sizeof to uint32 Andy Green
@ 2018-05-21  2:01         ` Andy Green
  2018-05-21 12:14           ` Bruce Richardson
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 5/8] rte_mbuf.h: avoid implicit demotion in 64-bit arith Andy Green
                           ` (4 subsequent siblings)
  8 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-21  2:01 UTC (permalink / raw)
  To: dev; +Cc: thomas

    /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
    In function 'rte_pktmbuf_detach':
    /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
    1583:17: warning: conversion from 'uint32_t' {aka
    'unsigned int'} to 'uint16_t' {aka
    'short unsigned int'} may change value [-Wconversion]
      m->priv_size = priv_size;
                     ^~~~~~~~~

    The temp priv_size is declared as a uint32_t.  But it
    only deals in uint16_t.  m->priv_size is a uint16_t.
    Change it to a uint16_t.

Fixes: 355e6735b3 ("mbuf: fix cloning with private mbuf data")
Fixes: 1a60a0daa6 ("mbuf: fix segments number type increase")
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 28fd4ad52..76e37a2f8 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1571,7 +1571,8 @@ __rte_pktmbuf_free_direct(struct rte_mbuf *m)
 static inline void rte_pktmbuf_detach(struct rte_mbuf *m)
 {
 	struct rte_mempool *mp = m->pool;
-	uint32_t mbuf_size, buf_len, priv_size;
+	uint32_t mbuf_size, buf_len;
+	uint16_t priv_size;
 
 	if (RTE_MBUF_HAS_EXTBUF(m))
 		__rte_pktmbuf_free_extbuf(m);

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v6 5/8] rte_mbuf.h: avoid implicit demotion in 64-bit arith
  2018-05-21  2:00       ` [dpdk-dev] [PATCH v6 0/8] " Andy Green
                           ` (3 preceding siblings ...)
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 4/8] rte_mbuf.h: reduce temp to match uint16 types Andy Green
@ 2018-05-21  2:01         ` Andy Green
  2018-05-21 12:27           ` Bruce Richardson
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 6/8] rte_mbuf.h: choose correct type for temp Andy Green
                           ` (3 subsequent siblings)
  8 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-21  2:01 UTC (permalink / raw)
  To: dev; +Cc: thomas

/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
In function 'rte_validate_tx_offload':
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
2112:19: warning: conversion to 'uint64_t'
{aka 'long unsigned int'} from 'int' may change the
sign of the result [-Wsign-conversion]
  inner_l3_offset += m->outer_l2_len + m->outer_l3_len;
                   ^~

  uint64_t inner_l3_offset...

  /* fields for TX offloading of tunnels */
  uint64_t outer_l3_len:9; /**< Outer L3 (IP) Hdr Length. */
  uint64_t outer_l2_len:7; /**< Outer L2 (MAC) Hdr Length. */

We want to do the arithmetic entirely in uint64_t
space, but there is an implicit demotion to int created by
the +=.  Remove the +=.

Fixes: 4fb7e803eb ("ethdev: add Tx preparation")
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 76e37a2f8..55fba3b14 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -2112,7 +2112,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 = inner_l3_offset + 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)

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v6 6/8] rte_mbuf.h: choose correct type for temp
  2018-05-21  2:00       ` [dpdk-dev] [PATCH v6 0/8] " Andy Green
                           ` (4 preceding siblings ...)
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 5/8] rte_mbuf.h: avoid implicit demotion in 64-bit arith Andy Green
@ 2018-05-21  2:01         ` Andy Green
  2018-05-21 13:09           ` Bruce Richardson
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 7/8] rte_mbuf.h: add and subtract explicitly to avoid promotion Andy Green
                           ` (2 subsequent siblings)
  8 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-21  2:01 UTC (permalink / raw)
  To: dev; +Cc: thomas

/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
In function 'rte_pktmbuf_linearize':
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
1873:32: warning: conversion to 'int' from 'uint32_t'
{aka 'unsigned int'} may change the sign of the
result [-Wsign-conversion]
#define rte_pktmbuf_pkt_len(m) ((m)->pkt_len)
                                    ^
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
2166:13: note: in expansion of macro 'rte_pktmbuf_pkt_len'
   copy_len = rte_pktmbuf_pkt_len(mbuf) -
rte_pktmbuf_data_len(mbuf);
                 ^~~~~~~~~~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
2180:51: warning: conversion to 'size_t' {aka
'long unsigned int'} from 'int' may change the
sign of the result [-Wsign-conversion]
rte_memcpy(buffer, rte_pktmbuf_mtod(m, char *), seg_len);
                                                ^~~~~~~

The temp is consumed as a size_t.  So let's make it
a size_t in the first place.

Fixes: 1feda4d8fc ("mbuf: add a function to linearize a packet")
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 55fba3b14..a0423a548 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -2158,7 +2158,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;

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v6 7/8] rte_mbuf.h: add and subtract explicitly to avoid promotion
  2018-05-21  2:00       ` [dpdk-dev] [PATCH v6 0/8] " Andy Green
                           ` (5 preceding siblings ...)
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 6/8] rte_mbuf.h: choose correct type for temp Andy Green
@ 2018-05-21  2:01         ` Andy Green
  2018-05-21 13:10           ` Bruce Richardson
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 8/8] rte_ethdev.h: align sign and scope of temp var Andy Green
  2018-05-22  1:24         ` [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus Andy Green
  8 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-21  2:01 UTC (permalink / raw)
  To: dev; +Cc: thomas

   /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
    In function 'rte_pktmbuf_prepend':
    /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
    1908:17: warning: conversion from 'int' to 'uint16_t'
    {aka 'short unsigned int'} may change value [-Wconversion]
      m->data_off -= len;
                     ^~~
    m->data_off is a uint16_t

            uint16_t data_off;

    len (a uint16_t) is promoted to an int using -=.  Do the
    subtraction explicitly and cast the result to uint16_t.

    -       m->data_off -= len;
    +       m->data_off = (uint16_t)(m->data_off - len);

    The below += or -= changes are solving the same thing.

    /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
    In function 'rte_pktmbuf_adj':
    /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
    1969:17: warning: conversion from 'int' to 'uint16_t'
    {aka 'short unsigned int'} may change value [-Wconversion]
      m->data_off += len;
                     ^~~
    /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
    In function 'rte_pktmbuf_chain':
    /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
    2082:19: warning: conversion from 'int' to 'uint16_t'
    {aka 'short unsigned int'} may change value [-Wconversion]
      head->nb_segs += tail->nb_segs;
                       ^~~~
    Also uint16_t

            uint16_t nb_segs;         /**< Number of segments. */

Fixes: 08b563ffb1 ("mbuf: replace data pointer by an offset")
Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_mbuf/rte_mbuf.h |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index a0423a548..beb104c69 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1908,7 +1908,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);
 
@@ -1969,7 +1969,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;
 }
@@ -2082,7 +2082,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 */

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v6 8/8] rte_ethdev.h: align sign and scope of temp var
  2018-05-21  2:00       ` [dpdk-dev] [PATCH v6 0/8] " Andy Green
                           ` (6 preceding siblings ...)
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 7/8] rte_mbuf.h: add and subtract explicitly to avoid promotion Andy Green
@ 2018-05-21  2:01         ` Andy Green
  2018-05-21 13:30           ` Bruce Richardson
  2018-05-22  1:24         ` [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus Andy Green
  8 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-21  2:01 UTC (permalink / raw)
  To: dev; +Cc: thomas

/projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
In function 'rte_eth_rx_burst':
/projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
3836:18: warning: conversion to 'int16_t' {aka 'short
int'} from 'uint16_t' {aka 'short unsigned int'} may
change the sign of the result [-Wsign-conversion]
  int16_t nb_rx = (*dev->rx_pkt_burst)(dev->data->
rx_queues[queue_id],
                  ^
/projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
3844:50: warning: conversion to 'uint16_t' {aka 'short
unsigned int'} from 'int16_t' {aka 'short int'} may
change the sign of the result [-Wsign-conversion]
    nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
                                                  ^~~~~
/projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
3844:12: warning: conversion to 'int16_t' {aka 'short
int'} from 'uint16_t' {aka 'short unsigned int'} may
change the sign of the result [-Wsign-conversion]
    nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
            ^~
/projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
3851:9: warning: conversion to 'uint16_t' {aka 'short
unsigned int'} from 'int16_t' {aka 'short int'} may
change the sign of the result [-Wsign-conversion]
  return nb_rx;
         ^~~~~

The second part of the patch is solved by its own basic
block because it is inside a preprocessor conditional.

Bringing the declaration of the var to the top of the
function would require that also being given its own
preprocessor conditional, or a (void)var to avoid an
unused var warning.  The basic block is no worse than
those imho.

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 d52c1bed9..4d059a2a7 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -3823,6 +3823,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);
@@ -3833,18 +3834,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] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus
  2018-05-20 22:18     ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Thomas Monjalon
  2018-05-21  2:00       ` [dpdk-dev] [PATCH v6 0/8] " Andy Green
@ 2018-05-21  2:06       ` Andy Green
  1 sibling, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-21  2:06 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev



On 05/21/2018 06:18 AM, Thomas Monjalon wrote:
>> Andy Green (21):
>>        lib/librte_ethdev: change eth-dev-ops API to return int
>>        rte_string_fns.h: fix gcc8.1 sign conv warning in lstrcpy
>>        lib/librte_eal: explicit tmp cast
>>        /lib/librte_eal: stage cast from uint64 to long
>>        rte_ring_generic.h: stack declarations before code
>>        rte_ring.h: remove signed type flipflopping
>>        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_ether.h: explicit cast avoiding truncation warning
>>        rte_rwlock.h: gcc8 sign conversion warnings
>>        rte_ip.h: cast input to bswap16 to be uint16
>>        rte_ip.h: cast around promotion to int
>>        rte_ip.h: cast type decided by sizeof to uint32
>>        rte_ip.h: cast return checksum size to uint16
>>        rte_ip.h: cast away gcc8 warning on rte_ipv6_phdr_cksum
>>        rte_mbuf.h: explicit cast for size type to uint32
>>        rte_mbuf.h: explicit casts to uint16 to avoid warnings
>>        rte_ethdev.h: align sign and scope of temp var
>>        rte_byteorder.h: explicit cast for return promotion
> 
> 16 patches have been applied.
> The tags Fixes and Cc:stable have been added, so they can be backported.

Thanks a lot for the help.

> 5 patches are missing:
> 	lib/librte_eal: explicit tmp cast
> 	rte_rwlock.h: gcc8 sign conversion warnings
> 	rte_ip.h: cast type decided by sizeof to uint32
> 	rte_mbuf.h: explicit casts to uint16 to avoid warnings
> 	rte_ethdev.h: align sign and scope of temp var
> Those patches are either not reviewed, or not safe enough at this release stage.

Well, at least several of them are actually a NOP wrt "safety", since 
they just do the cast that pre-gcc v8 was doing silently until now.  I 
can see it's not exactly easy to know that at a glance though.

I added a rationale for what each patch is doing making it clear where 
it is effectively a NOP just making explicit what was implicit before.

> Please, feel free to send them again in a v6 to make clear they need more review.

... well, you may find them easier to parse in the v6 I just pushed.

> I think the mbuf one (for uint16_t) may deserve to be split.

Yes looking at it, it is three patches in one.  I split it out.

-Andy

> Thanks
> 
> 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-dev-ops API to return int
  2018-05-20  2:43           ` Shreyansh Jain
  2018-05-20  4:11             ` Andy Green
@ 2018-05-21  6:52             ` Stephen Hemminger
  2018-05-21  7:25               ` Andy Green
  1 sibling, 1 reply; 174+ messages in thread
From: Stephen Hemminger @ 2018-05-21  6:52 UTC (permalink / raw)
  To: Shreyansh Jain; +Cc: Andy Green, dev

On Sun, 20 May 2018 02:43:58 +0000
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:

> > > This doesn't feel correct. A counter, especially the number of  
> > descriptors in a queue, doesn't have a negative value. So, 1) this is
> > an unnatural return and 2) we litter the code with unnecessary
> > typecast.  
> > >
> > > In fact, even in the above change, the debug messages continue to  
> > print unsigned values. So, another typecast would be required there.  
> > >
> > > I don't agree with this change - at least not until some strong gcc 8  
> > warning reason is triggering this. Can you please point me to some
> > conversation on mailing list which enforces this?  
> > >  
> > 
> > hmmmmm.... no, it's not my idea.
> > 
> > If you don't like it, don't do it, I don't mind either way.  I sent a
> > patch that just solved the compiler error only already, and was told on
> > the list it would be cooler if these things returned an int instead.
> > 
> > There's no point challenging me about the wisdom of it, although it
> > seems reasonable to me.  I sent a patch, list guy $1 says do X instead,
> > I do X and then list guy $2 says EXPLAIN YOURSELF.  
> 
> That is what a community is. Consensus has to be built, not expected automagically. If you touch a line, you are responsible for it (also, because in future git blame would point *you* out for a change).


My comment was a suggestion, not a "you must do it this way".
The reason was it was cleaner change for Gcc fix
and it allowed for possibility that some driver might not detect an error
(for example if device was removed by hot plug).

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-dev-ops API to return int
  2018-05-21  6:52             ` Stephen Hemminger
@ 2018-05-21  7:25               ` Andy Green
  0 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-21  7:25 UTC (permalink / raw)
  To: Stephen Hemminger, Shreyansh Jain; +Cc: dev



On 05/21/2018 02:52 PM, Stephen Hemminger wrote:
> On Sun, 20 May 2018 02:43:58 +0000
> Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> 
>>>> This doesn't feel correct. A counter, especially the number of
>>> descriptors in a queue, doesn't have a negative value. So, 1) this is
>>> an unnatural return and 2) we litter the code with unnecessary
>>> typecast.
>>>>
>>>> In fact, even in the above change, the debug messages continue to
>>> print unsigned values. So, another typecast would be required there.
>>>>
>>>> I don't agree with this change - at least not until some strong gcc 8
>>> warning reason is triggering this. Can you please point me to some
>>> conversation on mailing list which enforces this?
>>>>   
>>>
>>> hmmmmm.... no, it's not my idea.
>>>
>>> If you don't like it, don't do it, I don't mind either way.  I sent a
>>> patch that just solved the compiler error only already, and was told on
>>> the list it would be cooler if these things returned an int instead.
>>>
>>> There's no point challenging me about the wisdom of it, although it
>>> seems reasonable to me.  I sent a patch, list guy $1 says do X instead,
>>> I do X and then list guy $2 says EXPLAIN YOURSELF.
>>
>> That is what a community is. Consensus has to be built, not expected automagically. If you touch a line, you are responsible for it (also, because in future git blame would point *you* out for a change).
> 
> 
> My comment was a suggestion, not a "you must do it this way".

OK.

> The reason was it was cleaner change for Gcc fix
> and it allowed for possibility that some driver might not detect an error
> (for example if device was removed by hot plug).

Yes, I also thought it was reasonable.  Even if it was somehow 
unreasonable, it's selfcontained enough in terms of what it does that it 
shouldn't blow anything up.

But it only took me five minutes.  Binning that and just directly fixing 
the compiler warning is also 100% fine from my side and no worries.

The main thing is 18.05 should be usable to build with things that want 
to bind to dpdk using contemporary tools like gcc8.1.  If we can manage 
that, we can build on it for helping lagopus get ahead too.

-Andy

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH] lib/librte_eal: change type of tmp
  2018-05-21  2:00         ` [dpdk-dev] [PATCH v6 1/8] lib/librte_eal: explicit tmp cast Andy Green
@ 2018-05-21 11:06           ` Andy Green
  2018-05-21 12:07             ` Bruce Richardson
  0 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-21 11:06 UTC (permalink / raw)
  To: dev; +Cc: thomas

/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
  MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
  ^~~~~~~~~~~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
649:51: warning: conversion from 'size_t' {aka 'long
unsigned int'} to 'int' may change value [-Wconversion]
     case 0x0B: MOVEUNALIGNED_LEFT47_IMM(dst, src,
n, 0x0B); break;    \
                                                   ^
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
616:15: note: in definition of macro 'MOVEUNALIGNED_LEFT47_IMM'
         tmp = len;                                                                                          \
               ^~~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
  MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
  ^~~~~~~~~~~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
618:13: warning: conversion to 'size_t' {aka 'long
unsigned int'} from 'int' may change the sign of the
result [-Wsign-conversion]
         tmp -= len;                                                                                         \
             ^~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
649:16: note: in expansion of macro 'MOVEUNALIGNED_LEFT47_IMM'
     case 0x0B: MOVEUNALIGNED_LEFT47_IMM(dst, src,
n, 0x0B); break;    \
                ^~~~~~~~~~~~~~~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
  MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
  ^~~~~~~~~~~~~~~~~~~~

    /projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
    618:13: warning: conversion to 'size_t' {aka 'long
    unsigned int'} from 'int' may change the sign of the
    result [-Wsign-conversion]
             tmp -= len;
                 ^~

We can eliminate the problems by setting the type of tmp to
size_t in the first place.

After a suggestion by Bruce Richardson

Signed-off-by: Andy Green <andy@warmcat.com>
Fixes: d35cc1fe6a ("eal/x86: revert select optimized memcpy at run-time")
---
 .../common/include/arch/x86/rte_memcpy.h           |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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..7b758094d 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
@@ -574,7 +574,7 @@ rte_mov256(uint8_t *dst, const uint8_t *src)
  */
 #define MOVEUNALIGNED_LEFT47_IMM(dst, src, len, offset)                                                     \
 __extension__ ({                                                                                            \
-    int tmp;                                                                                                \
+    size_t tmp;                                                                                                \
     while (len >= 128 + 16 - offset) {                                                                      \
         xmm0 = _mm_loadu_si128((const __m128i *)((const uint8_t *)src - offset + 0 * 16));                  \
         len -= 128;                                                                                         \

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH] lib/librte_eal: change type of tmp
  2018-05-21 11:06           ` [dpdk-dev] [PATCH] lib/librte_eal: change type of tmp Andy Green
@ 2018-05-21 12:07             ` Bruce Richardson
  0 siblings, 0 replies; 174+ messages in thread
From: Bruce Richardson @ 2018-05-21 12:07 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, thomas

On Mon, May 21, 2018 at 07:06:49PM +0800, Andy Green wrote:
> /projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
> 793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
>   MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
>   ^~~~~~~~~~~~~~~~~~~~
> /projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
> 649:51: warning: conversion from 'size_t' {aka 'long
> unsigned int'} to 'int' may change value [-Wconversion]
>      case 0x0B: MOVEUNALIGNED_LEFT47_IMM(dst, src,
> n, 0x0B); break;    \
>                                                    ^
> /projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
> 616:15: note: in definition of macro 'MOVEUNALIGNED_LEFT47_IMM'
>          tmp = len;                                                                                          \
>                ^~~
> /projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
> 793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
>   MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
>   ^~~~~~~~~~~~~~~~~~~~
> /projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
> 618:13: warning: conversion to 'size_t' {aka 'long
> unsigned int'} from 'int' may change the sign of the
> result [-Wsign-conversion]
>          tmp -= len;                                                                                         \
>              ^~
> /projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
> 649:16: note: in expansion of macro 'MOVEUNALIGNED_LEFT47_IMM'
>      case 0x0B: MOVEUNALIGNED_LEFT47_IMM(dst, src,
> n, 0x0B); break;    \
>                 ^~~~~~~~~~~~~~~~~~~~~~~~
> /projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
> 793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
>   MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
>   ^~~~~~~~~~~~~~~~~~~~
> 
>     /projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
>     618:13: warning: conversion to 'size_t' {aka 'long
>     unsigned int'} from 'int' may change the sign of the
>     result [-Wsign-conversion]
>              tmp -= len;
>                  ^~
> 
> We can eliminate the problems by setting the type of tmp to
> size_t in the first place.
> 
> After a suggestion by Bruce Richardson
> 
> Signed-off-by: Andy Green <andy@warmcat.com>
> Fixes: d35cc1fe6a ("eal/x86: revert select optimized memcpy at run-time")
> ---

Thanks, this looks a better fix than loads of type-casting.

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v6 2/8] rte_rwlock.h: gcc8 sign conversion warnings
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 2/8] rte_rwlock.h: gcc8 sign conversion warnings Andy Green
@ 2018-05-21 12:10           ` Bruce Richardson
  0 siblings, 0 replies; 174+ messages in thread
From: Bruce Richardson @ 2018-05-21 12:10 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, thomas

On Mon, May 21, 2018 at 10:01:03AM +0800, Andy Green wrote:
> In file included from /projects/lagopus/src/dpdk/
> build/include/rte_rwlock.h:12,
>                  from ./mgr/lock.h:24,
>                  from ./mgr/sock_io.c:54:
> /projects/lagopus/src/dpdk/build/include/generic/
> rte_rwlock.h: In function 'rte_rwlock_read_lock':
> /projects/lagopus/src/dpdk/build/include/generic/
> rte_rwlock.h:74:12: warning: conversion to 'uint32_t'
> {aka 'unsigned int'} from 'int32_t' {aka 'int'} may
> change the sign of the result [-Wsign-conversion]
>             x, x + 1);
>             ^
> /projects/lagopus/src/dpdk/build/include/generic/
> rte_rwlock.h:74:17: warning: conversion to 'uint32_t'
> {aka 'unsigned int'} from 'int' may change the sign
> of the result [-Wsign-conversion]
>             x, x + 1);
>                ~~^~~
> /projects/lagopus/src/dpdk/build/include/generic/
> rte_rwlock.h: In function 'rte_rwlock_write_lock':
> /projects/lagopus/src/dpdk/build/include/generic/
> rte_rwlock.h:110:15: warning: unsigned conversion
> from 'int' to 'uint32_t' {aka 'unsigned int'}
> changes value from '-1' to '4294967295'
> [-Wsign-conversion]
>             0, -1);
>                ^~
> 
> Again in this case we are making explicit the exact cast
> that was always happening implicitly.  The patch does not
> change the generated code.
> 
> The int32_t temp "x" is required to be signed to detect
> a < 0 error condition from the lock status.  Afterwards,
> it has always been implicitly cast to uint32_t when it
> is used in the arguments to rte_atomic32_cmpset()...
> gcc8.1 objects to the implicit cast now and requires us
> to cast it explicitly.
> 
> Fixes: af75078fec ("first public release")
> Signed-off-by: Andy Green <andy@warmcat.com>
> ---

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v6 3/8] rte_ip.h: cast type decided by sizeof to uint32
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 3/8] rte_ip.h: cast type decided by sizeof to uint32 Andy Green
@ 2018-05-21 12:13           ` Bruce Richardson
  0 siblings, 0 replies; 174+ messages in thread
From: Bruce Richardson @ 2018-05-21 12:13 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, thomas

On Mon, May 21, 2018 at 10:01:08AM +0800, Andy Green wrote:
> /projects/lagopus/src/dpdk/build/include/rte_ip.h:
> In function 'rte_ipv4_udptcp_cksum':
> /projects/lagopus/src/dpdk/build/include/rte_byteorder.h:
> 51:24: warning: conversion from 'long unsigned int' to
> 'uint32_t' {aka 'unsigned int'} may change value
> [-Wconversion]
>  #define rte_bswap16(x) ((uint16_t)
> (__builtin_constant_p(x) ?  \
>                         ^
> /projects/lagopus/src/dpdk/build/include/rte_byteorder.h:
> 85:29: note: in expansion of macro 'rte_bswap16'
>  #define rte_be_to_cpu_16(x) rte_bswap16(x)
>                              ^~~~~~~~~~~
> /projects/lagopus/src/dpdk/build/include/rte_ip.h:321:11:
> note: in expansion of macro 'rte_be_to_cpu_16'
>   l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) -
>            ^~~~~~~~~~~~~~~~
> 
> Also with this one, it is a cast that always occurred
> and is just being done explicitly, with no changes to
> the generated code.
> 
> The warning stack is misleading, it points to the last
> element in the macro that produced the lhs of the subtraction
> above.  But the only "unsigned long int" in the expression is
> the result of the sizeof() on the rhs, it promotes the
> subtraction result to unsigned long.  So the error actually
> relates to the result of the outer subtraction.
> 
> The actual error is "you are trying to put an unsigned long
> into a uint32_t".  We always did so, the fix is just to inform
> the compiler it is intentional with an explicit cast.
> 
> Fixes: 6006818cfb ("net: new checksum functions")
> Signed-off-by: Andy Green <andy@warmcat.com>
> ---
>  lib/librte_net/rte_ip.h |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v6 4/8] rte_mbuf.h: reduce temp to match uint16 types
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 4/8] rte_mbuf.h: reduce temp to match uint16 types Andy Green
@ 2018-05-21 12:14           ` Bruce Richardson
  0 siblings, 0 replies; 174+ messages in thread
From: Bruce Richardson @ 2018-05-21 12:14 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, thomas

On Mon, May 21, 2018 at 10:01:13AM +0800, Andy Green wrote:
>     /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
>     In function 'rte_pktmbuf_detach':
>     /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
>     1583:17: warning: conversion from 'uint32_t' {aka
>     'unsigned int'} to 'uint16_t' {aka
>     'short unsigned int'} may change value [-Wconversion]
>       m->priv_size = priv_size;
>                      ^~~~~~~~~
> 
>     The temp priv_size is declared as a uint32_t.  But it
>     only deals in uint16_t.  m->priv_size is a uint16_t.
>     Change it to a uint16_t.
> 
> Fixes: 355e6735b3 ("mbuf: fix cloning with private mbuf data")
> Fixes: 1a60a0daa6 ("mbuf: fix segments number type increase")
> Signed-off-by: Andy Green <andy@warmcat.com>
> ---
>  lib/librte_mbuf/rte_mbuf.h |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v6 5/8] rte_mbuf.h: avoid implicit demotion in 64-bit arith
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 5/8] rte_mbuf.h: avoid implicit demotion in 64-bit arith Andy Green
@ 2018-05-21 12:27           ` Bruce Richardson
  2018-05-22  1:29             ` Andy Green
  0 siblings, 1 reply; 174+ messages in thread
From: Bruce Richardson @ 2018-05-21 12:27 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, thomas

On Mon, May 21, 2018 at 10:01:18AM +0800, Andy Green wrote:
> /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
> In function 'rte_validate_tx_offload':
> /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
> 2112:19: warning: conversion to 'uint64_t'
> {aka 'long unsigned int'} from 'int' may change the
> sign of the result [-Wsign-conversion]
>   inner_l3_offset += m->outer_l2_len + m->outer_l3_len;
>                    ^~
> 
>   uint64_t inner_l3_offset...
> 
>   /* fields for TX offloading of tunnels */
>   uint64_t outer_l3_len:9; /**< Outer L3 (IP) Hdr Length. */
>   uint64_t outer_l2_len:7; /**< Outer L2 (MAC) Hdr Length. */
> 
> We want to do the arithmetic entirely in uint64_t
> space, but there is an implicit demotion to int created by
> the +=.  Remove the +=.
> 
> Fixes: 4fb7e803eb ("ethdev: add Tx preparation")
> Signed-off-by: Andy Green <andy@warmcat.com>
> ---
>  lib/librte_mbuf/rte_mbuf.h |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>

Fix looks ok, but given that it's non-obvious why += doesn't work, I think
it would be good to put a comment in explaining it. Otherwise I could see
someone changing this back in a later patch, because the problem doesn't
arise with regular DPDK compiles 

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v6 6/8] rte_mbuf.h: choose correct type for temp
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 6/8] rte_mbuf.h: choose correct type for temp Andy Green
@ 2018-05-21 13:09           ` Bruce Richardson
  0 siblings, 0 replies; 174+ messages in thread
From: Bruce Richardson @ 2018-05-21 13:09 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, thomas

On Mon, May 21, 2018 at 10:01:23AM +0800, Andy Green wrote:
> /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
> In function 'rte_pktmbuf_linearize':
> /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
> 1873:32: warning: conversion to 'int' from 'uint32_t'
> {aka 'unsigned int'} may change the sign of the
> result [-Wsign-conversion]
> #define rte_pktmbuf_pkt_len(m) ((m)->pkt_len)
>                                     ^
> /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
> 2166:13: note: in expansion of macro 'rte_pktmbuf_pkt_len'
>    copy_len = rte_pktmbuf_pkt_len(mbuf) -
> rte_pktmbuf_data_len(mbuf);
>                  ^~~~~~~~~~~~~~~~~~~
> /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
> 2180:51: warning: conversion to 'size_t' {aka
> 'long unsigned int'} from 'int' may change the
> sign of the result [-Wsign-conversion]
> rte_memcpy(buffer, rte_pktmbuf_mtod(m, char *), seg_len);
>                                                 ^~~~~~~
> 
> The temp is consumed as a size_t.  So let's make it
> a size_t in the first place.
> 
> Fixes: 1feda4d8fc ("mbuf: add a function to linearize a packet")
> 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 55fba3b14..a0423a548 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -2158,7 +2158,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;
> 
Looks reasonable.

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v6 7/8] rte_mbuf.h: add and subtract explicitly to avoid promotion
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 7/8] rte_mbuf.h: add and subtract explicitly to avoid promotion Andy Green
@ 2018-05-21 13:10           ` Bruce Richardson
  0 siblings, 0 replies; 174+ messages in thread
From: Bruce Richardson @ 2018-05-21 13:10 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, thomas

On Mon, May 21, 2018 at 10:01:28AM +0800, Andy Green wrote:
>    /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
>     In function 'rte_pktmbuf_prepend':
>     /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
>     1908:17: warning: conversion from 'int' to 'uint16_t'
>     {aka 'short unsigned int'} may change value [-Wconversion]
>       m->data_off -= len;
>                      ^~~
>     m->data_off is a uint16_t
> 
>             uint16_t data_off;
> 
>     len (a uint16_t) is promoted to an int using -=.  Do the
>     subtraction explicitly and cast the result to uint16_t.
> 
>     -       m->data_off -= len;
>     +       m->data_off = (uint16_t)(m->data_off - len);
> 
>     The below += or -= changes are solving the same thing.
> 
>     /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
>     In function 'rte_pktmbuf_adj':
>     /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
>     1969:17: warning: conversion from 'int' to 'uint16_t'
>     {aka 'short unsigned int'} may change value [-Wconversion]
>       m->data_off += len;
>                      ^~~
>     /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
>     In function 'rte_pktmbuf_chain':
>     /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
>     2082:19: warning: conversion from 'int' to 'uint16_t'
>     {aka 'short unsigned int'} may change value [-Wconversion]
>       head->nb_segs += tail->nb_segs;
>                        ^~~~
>     Also uint16_t
> 
>             uint16_t nb_segs;         /**< Number of segments. */
> 
> Fixes: 08b563ffb1 ("mbuf: replace data pointer by an offset")
> Signed-off-by: Andy Green <andy@warmcat.com>
> ---
>  lib/librte_mbuf/rte_mbuf.h |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> index a0423a548..beb104c69 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -1908,7 +1908,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);
>  
Code change looks ok to me, again it wouldn't hurt to have a comment
explaining the absense of -=, but otherwise:

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v6 8/8] rte_ethdev.h: align sign and scope of temp var
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 8/8] rte_ethdev.h: align sign and scope of temp var Andy Green
@ 2018-05-21 13:30           ` Bruce Richardson
  2018-05-22  1:25             ` Andy Green
  0 siblings, 1 reply; 174+ messages in thread
From: Bruce Richardson @ 2018-05-21 13:30 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, thomas

On Mon, May 21, 2018 at 10:01:33AM +0800, Andy Green wrote:
> /projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
> In function 'rte_eth_rx_burst':
> /projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
> 3836:18: warning: conversion to 'int16_t' {aka 'short
> int'} from 'uint16_t' {aka 'short unsigned int'} may
> change the sign of the result [-Wsign-conversion]
>   int16_t nb_rx = (*dev->rx_pkt_burst)(dev->data->
> rx_queues[queue_id],
>                   ^
> /projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
> 3844:50: warning: conversion to 'uint16_t' {aka 'short
> unsigned int'} from 'int16_t' {aka 'short int'} may
> change the sign of the result [-Wsign-conversion]
>     nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
>                                                   ^~~~~
> /projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
> 3844:12: warning: conversion to 'int16_t' {aka 'short
> int'} from 'uint16_t' {aka 'short unsigned int'} may
> change the sign of the result [-Wsign-conversion]
>     nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
>             ^~
> /projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
> 3851:9: warning: conversion to 'uint16_t' {aka 'short
> unsigned int'} from 'int16_t' {aka 'short int'} may
> change the sign of the result [-Wsign-conversion]
>   return nb_rx;
>          ^~~~~
> 
> The second part of the patch is solved by its own basic
> block because it is inside a preprocessor conditional.
> 
> Bringing the declaration of the var to the top of the
> function would require that also being given its own
> preprocessor conditional, or a (void)var to avoid an
> unused var warning.  The basic block is no worse than
> those imho.
> 
> 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 d52c1bed9..4d059a2a7 100644
> --- a/lib/librte_ethdev/rte_ethdev.h
> +++ b/lib/librte_ethdev/rte_ethdev.h
> @@ -3823,6 +3823,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);
> @@ -3833,18 +3834,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);
> +		}
>  	}

I think you can eliminate these extra brackets by moving the cb declaration
inside the if body:

if (unlikely(dev->post_rx_burst_cbs[queue_id] != NULL)) {$
	struct rte_eth_rxtx_callback *cb =
			dev->post_rx_burst_cbs[queue_id];
	do {$
		nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,$
				nb_pkts, cb->param);$
		cb = cb->next;$
	} while (cb != NULL);$
}

/Bruce

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus
  2018-05-21  2:00       ` [dpdk-dev] [PATCH v6 0/8] " Andy Green
                           ` (7 preceding siblings ...)
  2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 8/8] rte_ethdev.h: align sign and scope of temp var Andy Green
@ 2018-05-22  1:24         ` Andy Green
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 1/8] lib/librte_eal: change type of tmp Andy Green
                             ` (8 more replies)
  8 siblings, 9 replies; 174+ messages in thread
From: Andy Green @ 2018-05-22  1:24 UTC (permalink / raw)
  To: dev; +Cc: thomas

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.

6/8 are acked by Bruce Richardson... the other two have
had the pending comment applied in this version.

---

Andy Green (8):
      lib/librte_eal: change type of tmp
      rte_rwlock.h: gcc8 sign conversion warnings
      rte_ip.h: cast type decided by sizeof to uint32
      rte_mbuf.h: reduce temp to match uint16 types
      rte_mbuf.h: avoid implicit demotion in 64-bit arith
      rte_mbuf.h: choose correct type for temp
      rte_mbuf.h: add and subtract explicitly to avoid promotion
      rte_ethdev.h: align sign and scope of temp var


 .../common/include/arch/x86/rte_memcpy.h           |    2 +
 lib/librte_eal/common/include/generic/rte_rwlock.h |    4 +--
 lib/librte_ethdev/rte_ethdev.h                     |   15 ++++++-----
 lib/librte_mbuf/rte_mbuf.h                         |   28 +++++++++++++++-----
 lib/librte_net/rte_ip.h                            |    4 +--
 5 files changed, 35 insertions(+), 18 deletions(-)

--
Signature

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v7 1/8] lib/librte_eal: change type of tmp
  2018-05-22  1:24         ` [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus Andy Green
@ 2018-05-22  1:24           ` Andy Green
  2018-05-22  9:13             ` Bruce Richardson
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 2/8] rte_rwlock.h: gcc8 sign conversion warnings Andy Green
                             ` (7 subsequent siblings)
  8 siblings, 1 reply; 174+ messages in thread
From: Andy Green @ 2018-05-22  1:24 UTC (permalink / raw)
  To: dev; +Cc: thomas

/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
  MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
  ^~~~~~~~~~~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
649:51: warning: conversion from 'size_t' {aka 'long
unsigned int'} to 'int' may change value [-Wconversion]
     case 0x0B: MOVEUNALIGNED_LEFT47_IMM(dst, src,
n, 0x0B); break;    \
                                                   ^
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
616:15: note: in definition of macro 'MOVEUNALIGNED_LEFT47_IMM'
         tmp = len;                                                                                          \
               ^~~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
  MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
  ^~~~~~~~~~~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
618:13: warning: conversion to 'size_t' {aka 'long
unsigned int'} from 'int' may change the sign of the
result [-Wsign-conversion]
         tmp -= len;                                                                                         \
             ^~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
649:16: note: in expansion of macro 'MOVEUNALIGNED_LEFT47_IMM'
     case 0x0B: MOVEUNALIGNED_LEFT47_IMM(dst, src,
n, 0x0B); break;    \
                ^~~~~~~~~~~~~~~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
  MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
  ^~~~~~~~~~~~~~~~~~~~

    /projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
    618:13: warning: conversion to 'size_t' {aka 'long
    unsigned int'} from 'int' may change the sign of the
    result [-Wsign-conversion]
             tmp -= len;
                 ^~

We can eliminate the problems by setting the type of tmp to
size_t in the first place.

After a suggestion by Bruce Richardson

Signed-off-by: Andy Green <andy@warmcat.com>
Fixes: d35cc1fe6a ("eal/x86: revert select optimized memcpy at run-time")
---
 .../common/include/arch/x86/rte_memcpy.h           |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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..7b758094d 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
@@ -574,7 +574,7 @@ rte_mov256(uint8_t *dst, const uint8_t *src)
  */
 #define MOVEUNALIGNED_LEFT47_IMM(dst, src, len, offset)                                                     \
 __extension__ ({                                                                                            \
-    int tmp;                                                                                                \
+    size_t tmp;                                                                                                \
     while (len >= 128 + 16 - offset) {                                                                      \
         xmm0 = _mm_loadu_si128((const __m128i *)((const uint8_t *)src - offset + 0 * 16));                  \
         len -= 128;                                                                                         \

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v7 2/8] rte_rwlock.h: gcc8 sign conversion warnings
  2018-05-22  1:24         ` [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus Andy Green
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 1/8] lib/librte_eal: change type of tmp Andy Green
@ 2018-05-22  1:24           ` Andy Green
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 3/8] rte_ip.h: cast type decided by sizeof to uint32 Andy Green
                             ` (6 subsequent siblings)
  8 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-22  1:24 UTC (permalink / raw)
  To: dev; +Cc: thomas

In file included from /projects/lagopus/src/dpdk/
build/include/rte_rwlock.h:12,
                 from ./mgr/lock.h:24,
                 from ./mgr/sock_io.c:54:
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h: In function 'rte_rwlock_read_lock':
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h:74:12: warning: conversion to 'uint32_t'
{aka 'unsigned int'} from 'int32_t' {aka 'int'} may
change the sign of the result [-Wsign-conversion]
            x, x + 1);
            ^
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h:74:17: warning: conversion to 'uint32_t'
{aka 'unsigned int'} from 'int' may change the sign
of the result [-Wsign-conversion]
            x, x + 1);
               ~~^~~
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h: In function 'rte_rwlock_write_lock':
/projects/lagopus/src/dpdk/build/include/generic/
rte_rwlock.h:110:15: warning: unsigned conversion
from 'int' to 'uint32_t' {aka 'unsigned int'}
changes value from '-1' to '4294967295'
[-Wsign-conversion]
            0, -1);
               ^~

Again in this case we are making explicit the exact cast
that was always happening implicitly.  The patch does not
change the generated code.

The int32_t temp "x" is required to be signed to detect
a < 0 error condition from the lock status.  Afterwards,
it has always been implicitly cast to uint32_t when it
is used in the arguments to rte_atomic32_cmpset()...
gcc8.1 objects to the implicit cast now and requires us
to cast it explicitly.

Fixes: af75078fec ("first public release")
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/librte_eal/common/include/generic/rte_rwlock.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/include/generic/rte_rwlock.h b/lib/librte_eal/common/include/generic/rte_rwlock.h
index 899e9bc43..5751a0e6d 100644
--- a/lib/librte_eal/common/include/generic/rte_rwlock.h
+++ b/lib/librte_eal/common/include/generic/rte_rwlock.h
@@ -71,7 +71,7 @@ rte_rwlock_read_lock(rte_rwlock_t *rwl)
 			continue;
 		}
 		success = rte_atomic32_cmpset((volatile uint32_t *)&rwl->cnt,
-					      x, x + 1);
+					      (uint32_t)x, (uint32_t)(x + 1));
 	}
 }
 
@@ -107,7 +107,7 @@ rte_rwlock_write_lock(rte_rwlock_t *rwl)
 			continue;
 		}
 		success = rte_atomic32_cmpset((volatile uint32_t *)&rwl->cnt,
-					      0, -1);
+					      0, (uint32_t)-1);
 	}
 }
 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v7 3/8] rte_ip.h: cast type decided by sizeof to uint32
  2018-05-22  1:24         ` [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus Andy Green
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 1/8] lib/librte_eal: change type of tmp Andy Green
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 2/8] rte_rwlock.h: gcc8 sign conversion warnings Andy Green
@ 2018-05-22  1:24           ` Andy Green
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 4/8] rte_mbuf.h: reduce temp to match uint16 types Andy Green
                             ` (5 subsequent siblings)
  8 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-22  1:24 UTC (permalink / raw)
  To: dev; +Cc: thomas

/projects/lagopus/src/dpdk/build/include/rte_ip.h:
In function 'rte_ipv4_udptcp_cksum':
/projects/lagopus/src/dpdk/build/include/rte_byteorder.h:
51:24: warning: conversion from 'long unsigned int' to
'uint32_t' {aka 'unsigned int'} may change value
[-Wconversion]
 #define rte_bswap16(x) ((uint16_t)
(__builtin_constant_p(x) ?  \
                        ^
/projects/lagopus/src/dpdk/build/include/rte_byteorder.h:
85:29: note: in expansion of macro 'rte_bswap16'
 #define rte_be_to_cpu_16(x) rte_bswap16(x)
                             ^~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_ip.h:321:11:
note: in expansion of macro 'rte_be_to_cpu_16'
  l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) -
           ^~~~~~~~~~~~~~~~

Also with this one, it is a cast that always occurred
and is just being done explicitly, with no changes to
the generated code.

The warning stack is misleading, it points to the last
element in the macro that produced the lhs of the subtraction
above.  But the only "unsigned long int" in the expression is
the result of the sizeof() on the rhs, it promotes the
subtraction result to unsigned long.  So the error actually
relates to the result of the outer subtraction.

The actual error is "you are trying to put an unsigned long
into a uint32_t".  We always did so, the fix is just to inform
the compiler it is intentional with an explicit cast.

Fixes: 6006818cfb ("net: new checksum functions")
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/librte_net/rte_ip.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index c924aca7f..72dc2456a 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -318,8 +318,8 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr)
 	uint32_t cksum;
 	uint32_t l4_len;
 
-	l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) -
-		sizeof(struct ipv4_hdr);
+	l4_len = (uint32_t)(rte_be_to_cpu_16(ipv4_hdr->total_length) -
+		sizeof(struct ipv4_hdr));
 
 	cksum = rte_raw_cksum(l4_hdr, l4_len);
 	cksum += rte_ipv4_phdr_cksum(ipv4_hdr, 0);

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v7 4/8] rte_mbuf.h: reduce temp to match uint16 types
  2018-05-22  1:24         ` [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus Andy Green
                             ` (2 preceding siblings ...)
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 3/8] rte_ip.h: cast type decided by sizeof to uint32 Andy Green
@ 2018-05-22  1:24           ` Andy Green
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 5/8] rte_mbuf.h: avoid implicit demotion in 64-bit arith Andy Green
                             ` (4 subsequent siblings)
  8 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-22  1:24 UTC (permalink / raw)
  To: dev; +Cc: thomas

    /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
    In function 'rte_pktmbuf_detach':
    /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
    1583:17: warning: conversion from 'uint32_t' {aka
    'unsigned int'} to 'uint16_t' {aka
    'short unsigned int'} may change value [-Wconversion]
      m->priv_size = priv_size;
                     ^~~~~~~~~

    The temp priv_size is declared as a uint32_t.  But it
    only deals in uint16_t.  m->priv_size is a uint16_t.
    Change it to a uint16_t.

Fixes: 355e6735b3 ("mbuf: fix cloning with private mbuf data")
Fixes: 1a60a0daa6 ("mbuf: fix segments number type increase")
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.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 28fd4ad52..76e37a2f8 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1571,7 +1571,8 @@ __rte_pktmbuf_free_direct(struct rte_mbuf *m)
 static inline void rte_pktmbuf_detach(struct rte_mbuf *m)
 {
 	struct rte_mempool *mp = m->pool;
-	uint32_t mbuf_size, buf_len, priv_size;
+	uint32_t mbuf_size, buf_len;
+	uint16_t priv_size;
 
 	if (RTE_MBUF_HAS_EXTBUF(m))
 		__rte_pktmbuf_free_extbuf(m);

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v7 5/8] rte_mbuf.h: avoid implicit demotion in 64-bit arith
  2018-05-22  1:24         ` [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus Andy Green
                             ` (3 preceding siblings ...)
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 4/8] rte_mbuf.h: reduce temp to match uint16 types Andy Green
@ 2018-05-22  1:24           ` Andy Green
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 6/8] rte_mbuf.h: choose correct type for temp Andy Green
                             ` (3 subsequent siblings)
  8 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-22  1:24 UTC (permalink / raw)
  To: dev; +Cc: thomas

/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
In function 'rte_validate_tx_offload':
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
2112:19: warning: conversion to 'uint64_t'
{aka 'long unsigned int'} from 'int' may change the
sign of the result [-Wsign-conversion]
  inner_l3_offset += m->outer_l2_len + m->outer_l3_len;
                   ^~

  uint64_t inner_l3_offset...

  /* fields for TX offloading of tunnels */
  uint64_t outer_l3_len:9; /**< Outer L3 (IP) Hdr Length. */
  uint64_t outer_l2_len:7; /**< Outer L2 (MAC) Hdr Length. */

We want to do the arithmetic entirely in uint64_t
space, but with the +=, the rhs type becomes int since the
bitfields will fit in int.

Elaborate the artithmetic to be u64 = u64 + int + int, so
the type of the result is correct to be stored in the u64.

Fixes: 4fb7e803eb ("ethdev: add Tx preparation")
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/librte_mbuf/rte_mbuf.h |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 76e37a2f8..491503e47 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -2112,7 +2112,11 @@ 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;
+		/* NB: elaborating the addition like this instead of using
+		 *     += gives the result uint64_t type instead of int,
+		 *     avoiding compiler warnings on gcc 8.1 at least */
+		inner_l3_offset = inner_l3_offset + 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)

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v7 6/8] rte_mbuf.h: choose correct type for temp
  2018-05-22  1:24         ` [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus Andy Green
                             ` (4 preceding siblings ...)
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 5/8] rte_mbuf.h: avoid implicit demotion in 64-bit arith Andy Green
@ 2018-05-22  1:24           ` Andy Green
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 7/8] rte_mbuf.h: add and subtract explicitly to avoid promotion Andy Green
                             ` (2 subsequent siblings)
  8 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-22  1:24 UTC (permalink / raw)
  To: dev; +Cc: thomas

/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
In function 'rte_pktmbuf_linearize':
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
1873:32: warning: conversion to 'int' from 'uint32_t'
{aka 'unsigned int'} may change the sign of the
result [-Wsign-conversion]
#define rte_pktmbuf_pkt_len(m) ((m)->pkt_len)
                                    ^
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
2166:13: note: in expansion of macro 'rte_pktmbuf_pkt_len'
   copy_len = rte_pktmbuf_pkt_len(mbuf) -
rte_pktmbuf_data_len(mbuf);
                 ^~~~~~~~~~~~~~~~~~~
/projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
2180:51: warning: conversion to 'size_t' {aka
'long unsigned int'} from 'int' may change the
sign of the result [-Wsign-conversion]
rte_memcpy(buffer, rte_pktmbuf_mtod(m, char *), seg_len);
                                                ^~~~~~~

The temp is consumed as a size_t.  So let's make it
a size_t in the first place.

Fixes: 1feda4d8fc ("mbuf: add a function to linearize a packet")
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.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 491503e47..0e89a6927 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -2161,7 +2161,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;

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v7 7/8] rte_mbuf.h: add and subtract explicitly to avoid promotion
  2018-05-22  1:24         ` [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus Andy Green
                             ` (5 preceding siblings ...)
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 6/8] rte_mbuf.h: choose correct type for temp Andy Green
@ 2018-05-22  1:24           ` Andy Green
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 8/8] rte_ethdev.h: align sign and scope of temp var Andy Green
  2018-05-22  9:13           ` [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus Bruce Richardson
  8 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-22  1:24 UTC (permalink / raw)
  To: dev; +Cc: thomas

   /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
    In function 'rte_pktmbuf_prepend':
    /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
    1908:17: warning: conversion from 'int' to 'uint16_t'
    {aka 'short unsigned int'} may change value [-Wconversion]
      m->data_off -= len;
                     ^~~
    m->data_off is a uint16_t

            uint16_t data_off;

    len (a uint16_t) is promoted to an int using -=.  Do the
    subtraction explicitly and cast the result to uint16_t.

    -       m->data_off -= len;
    +       m->data_off = (uint16_t)(m->data_off - len);

    The below += or -= changes are solving the same thing.

    /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
    In function 'rte_pktmbuf_adj':
    /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
    1969:17: warning: conversion from 'int' to 'uint16_t'
    {aka 'short unsigned int'} may change value [-Wconversion]
      m->data_off += len;
                     ^~~
    /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
    In function 'rte_pktmbuf_chain':
    /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
    2082:19: warning: conversion from 'int' to 'uint16_t'
    {aka 'short unsigned int'} may change value [-Wconversion]
      head->nb_segs += tail->nb_segs;
                       ^~~~
    Also uint16_t

            uint16_t nb_segs;         /**< Number of segments. */

Fixes: 08b563ffb1 ("mbuf: replace data pointer by an offset")
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/librte_mbuf/rte_mbuf.h |   17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 0e89a6927..e136d12b7 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1908,7 +1908,10 @@ static inline char *rte_pktmbuf_prepend(struct rte_mbuf *m,
 	if (unlikely(len > rte_pktmbuf_headroom(m)))
 		return NULL;
 
-	m->data_off -= len;
+	/* NB: elaborating the subtraction like this instead of using
+	 *     -= allows us to ensure the result type is uint16_t
+	 *     avoiding compiler warnings on gcc 8.1 at least */
+	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);
 
@@ -1968,8 +1971,11 @@ static inline char *rte_pktmbuf_adj(struct rte_mbuf *m, uint16_t len)
 	if (unlikely(len > m->data_len))
 		return NULL;
 
+	/* NB: elaborating the addition like this instead of using
+	 *     += allows us to ensure the result type is uint16_t
+	 *     avoiding compiler warnings on gcc 8.1 at least */
 	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;
 }
@@ -2081,8 +2087,11 @@ static inline int rte_pktmbuf_chain(struct rte_mbuf *head, struct rte_mbuf *tail
 	cur_tail = rte_pktmbuf_lastseg(head);
 	cur_tail->next = tail;
 
-	/* accumulate number of segments and total length. */
-	head->nb_segs += tail->nb_segs;
+	/* accumulate number of segments and total length.
+	 * NB: elaborating the addition like this instead of using
+	 *     -= allows us to ensure the result type is uint16_t
+	 *     avoiding compiler warnings on gcc 8.1 at least */
+	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 */

^ permalink raw reply	[flat|nested] 174+ messages in thread

* [dpdk-dev] [PATCH v7 8/8] rte_ethdev.h: align sign and scope of temp var
  2018-05-22  1:24         ` [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus Andy Green
                             ` (6 preceding siblings ...)
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 7/8] rte_mbuf.h: add and subtract explicitly to avoid promotion Andy Green
@ 2018-05-22  1:24           ` Andy Green
  2018-05-22  9:12             ` Bruce Richardson
  2018-05-22 14:18             ` Thomas Monjalon
  2018-05-22  9:13           ` [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus Bruce Richardson
  8 siblings, 2 replies; 174+ messages in thread
From: Andy Green @ 2018-05-22  1:24 UTC (permalink / raw)
  To: dev; +Cc: thomas

/projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
In function 'rte_eth_rx_burst':
/projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
3836:18: warning: conversion to 'int16_t' {aka 'short
int'} from 'uint16_t' {aka 'short unsigned int'} may
change the sign of the result [-Wsign-conversion]
  int16_t nb_rx = (*dev->rx_pkt_burst)(dev->data->
rx_queues[queue_id],
                  ^
/projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
3844:50: warning: conversion to 'uint16_t' {aka 'short
unsigned int'} from 'int16_t' {aka 'short int'} may
change the sign of the result [-Wsign-conversion]
    nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
                                                  ^~~~~
/projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
3844:12: warning: conversion to 'int16_t' {aka 'short
int'} from 'uint16_t' {aka 'short unsigned int'} may
change the sign of the result [-Wsign-conversion]
    nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
            ^~
/projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
3851:9: warning: conversion to 'uint16_t' {aka 'short
unsigned int'} from 'int16_t' {aka 'short int'} may
change the sign of the result [-Wsign-conversion]
  return nb_rx;
         ^~~~~

The second part of the patch is solved by its own basic
block because it is inside a preprocessor conditional.

Bringing the declaration of the var to the top of the
function would require that also being given its own
preprocessor conditional, or a (void)var to avoid an
unused var warning.  The basic block is no worse than
those imho.

Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_ethdev/rte_ethdev.h |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index d52c1bed9..504253816 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -3823,6 +3823,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);
@@ -3833,16 +3834,18 @@ 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(dev->post_rx_burst_cbs[queue_id] != 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);
+			nb_rx = cb->fn.rx(port_id, queue_id,
+					  rx_pkts, nb_rx,
+					  nb_pkts, cb->param);
 			cb = cb->next;
 		} while (cb != NULL);
 	}

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v6 8/8] rte_ethdev.h: align sign and scope of temp var
  2018-05-21 13:30           ` Bruce Richardson
@ 2018-05-22  1:25             ` Andy Green
  0 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-22  1:25 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, thomas



On 05/21/2018 09:30 PM, Bruce Richardson wrote:
> On Mon, May 21, 2018 at 10:01:33AM +0800, Andy Green wrote:
>> /projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
>> In function 'rte_eth_rx_burst':
>> /projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
>> 3836:18: warning: conversion to 'int16_t' {aka 'short
>> int'} from 'uint16_t' {aka 'short unsigned int'} may
>> change the sign of the result [-Wsign-conversion]
>>    int16_t nb_rx = (*dev->rx_pkt_burst)(dev->data->
>> rx_queues[queue_id],
>>                    ^
>> /projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
>> 3844:50: warning: conversion to 'uint16_t' {aka 'short
>> unsigned int'} from 'int16_t' {aka 'short int'} may
>> change the sign of the result [-Wsign-conversion]
>>      nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
>>                                                    ^~~~~
>> /projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
>> 3844:12: warning: conversion to 'int16_t' {aka 'short
>> int'} from 'uint16_t' {aka 'short unsigned int'} may
>> change the sign of the result [-Wsign-conversion]
>>      nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
>>              ^~
>> /projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
>> 3851:9: warning: conversion to 'uint16_t' {aka 'short
>> unsigned int'} from 'int16_t' {aka 'short int'} may
>> change the sign of the result [-Wsign-conversion]
>>    return nb_rx;
>>           ^~~~~
>>
>> The second part of the patch is solved by its own basic
>> block because it is inside a preprocessor conditional.
>>
>> Bringing the declaration of the var to the top of the
>> function would require that also being given its own
>> preprocessor conditional, or a (void)var to avoid an
>> unused var warning.  The basic block is no worse than
>> those imho.
>>
>> 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 d52c1bed9..4d059a2a7 100644
>> --- a/lib/librte_ethdev/rte_ethdev.h
>> +++ b/lib/librte_ethdev/rte_ethdev.h
>> @@ -3823,6 +3823,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);
>> @@ -3833,18 +3834,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);
>> +		}
>>   	}
> 
> I think you can eliminate these extra brackets by moving the cb declaration
> inside the if body:
> 
> if (unlikely(dev->post_rx_burst_cbs[queue_id] != NULL)) {$
> 	struct rte_eth_rxtx_callback *cb =
> 			dev->post_rx_burst_cbs[queue_id];
> 	do {$
> 		nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,$
> 				nb_pkts, cb->param);$
> 		cb = cb->next;$
> 	} while (cb != NULL);$
> }

Okay... it repeats the expression but what the hey.  It's changed to 
that in the v7 just pushed.

-Andy

> /Bruce
> 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v6 5/8] rte_mbuf.h: avoid implicit demotion in 64-bit arith
  2018-05-21 12:27           ` Bruce Richardson
@ 2018-05-22  1:29             ` Andy Green
  0 siblings, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-22  1:29 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, thomas



On 05/21/2018 08:27 PM, Bruce Richardson wrote:
> On Mon, May 21, 2018 at 10:01:18AM +0800, Andy Green wrote:
>> /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
>> In function 'rte_validate_tx_offload':
>> /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:
>> 2112:19: warning: conversion to 'uint64_t'
>> {aka 'long unsigned int'} from 'int' may change the
>> sign of the result [-Wsign-conversion]
>>    inner_l3_offset += m->outer_l2_len + m->outer_l3_len;
>>                     ^~
>>
>>    uint64_t inner_l3_offset...
>>
>>    /* fields for TX offloading of tunnels */
>>    uint64_t outer_l3_len:9; /**< Outer L3 (IP) Hdr Length. */
>>    uint64_t outer_l2_len:7; /**< Outer L2 (MAC) Hdr Length. */
>>
>> We want to do the arithmetic entirely in uint64_t
>> space, but there is an implicit demotion to int created by
>> the +=.  Remove the +=.
>>
>> Fixes: 4fb7e803eb ("ethdev: add Tx preparation")
>> Signed-off-by: Andy Green <andy@warmcat.com>
>> ---
>>   lib/librte_mbuf/rte_mbuf.h |    3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
> 
> Fix looks ok, but given that it's non-obvious why += doesn't work, I think
> it would be good to put a comment in explaining it. Otherwise I could see

I commnented these and the related stanzas in the second patch you 
suggested the comment in v7.

> someone changing this back in a later patch, because the problem doesn't
> arise with regular DPDK compiles

Yes the header apis are not actually used just building dpdk, so you 
don't see any problem.  But the problem will come as soon as you try to 
actually build something else against dpdk + gcc8.1.

-Andy

> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v7 8/8] rte_ethdev.h: align sign and scope of temp var
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 8/8] rte_ethdev.h: align sign and scope of temp var Andy Green
@ 2018-05-22  9:12             ` Bruce Richardson
  2018-05-22 14:18             ` Thomas Monjalon
  1 sibling, 0 replies; 174+ messages in thread
From: Bruce Richardson @ 2018-05-22  9:12 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, thomas

On Tue, May 22, 2018 at 09:24:47AM +0800, Andy Green wrote:
> /projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
> In function 'rte_eth_rx_burst':
> /projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
> 3836:18: warning: conversion to 'int16_t' {aka 'short
> int'} from 'uint16_t' {aka 'short unsigned int'} may
> change the sign of the result [-Wsign-conversion]
>   int16_t nb_rx = (*dev->rx_pkt_burst)(dev->data->
> rx_queues[queue_id],
>                   ^
> /projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
> 3844:50: warning: conversion to 'uint16_t' {aka 'short
> unsigned int'} from 'int16_t' {aka 'short int'} may
> change the sign of the result [-Wsign-conversion]
>     nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
>                                                   ^~~~~
> /projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
> 3844:12: warning: conversion to 'int16_t' {aka 'short
> int'} from 'uint16_t' {aka 'short unsigned int'} may
> change the sign of the result [-Wsign-conversion]
>     nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
>             ^~
> /projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
> 3851:9: warning: conversion to 'uint16_t' {aka 'short
> unsigned int'} from 'int16_t' {aka 'short int'} may
> change the sign of the result [-Wsign-conversion]
>   return nb_rx;
>          ^~~~~
> 
> The second part of the patch is solved by its own basic
> block because it is inside a preprocessor conditional.
> 
> Bringing the declaration of the var to the top of the
> function would require that also being given its own
> preprocessor conditional, or a (void)var to avoid an
> unused var warning.  The basic block is no worse than
> those imho.
> 
> Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v7 1/8] lib/librte_eal: change type of tmp
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 1/8] lib/librte_eal: change type of tmp Andy Green
@ 2018-05-22  9:13             ` Bruce Richardson
  0 siblings, 0 replies; 174+ messages in thread
From: Bruce Richardson @ 2018-05-22  9:13 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, thomas

On Tue, May 22, 2018 at 09:24:12AM +0800, Andy Green wrote:
> /projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
> 793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
>   MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
>   ^~~~~~~~~~~~~~~~~~~~
> /projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
> 649:51: warning: conversion from 'size_t' {aka 'long
> unsigned int'} to 'int' may change value [-Wconversion]
>      case 0x0B: MOVEUNALIGNED_LEFT47_IMM(dst, src,
> n, 0x0B); break;    \
>                                                    ^
> /projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
> 616:15: note: in definition of macro 'MOVEUNALIGNED_LEFT47_IMM'
>          tmp = len;                                                                                          \
>                ^~~
> /projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
> 793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
>   MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
>   ^~~~~~~~~~~~~~~~~~~~
> /projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
> 618:13: warning: conversion to 'size_t' {aka 'long
> unsigned int'} from 'int' may change the sign of the
> result [-Wsign-conversion]
>          tmp -= len;                                                                                         \
>              ^~
> /projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
> 649:16: note: in expansion of macro 'MOVEUNALIGNED_LEFT47_IMM'
>      case 0x0B: MOVEUNALIGNED_LEFT47_IMM(dst, src,
> n, 0x0B); break;    \
>                 ^~~~~~~~~~~~~~~~~~~~~~~~
> /projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
> 793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
>   MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
>   ^~~~~~~~~~~~~~~~~~~~
> 
>     /projects/lagopus/src/dpdk/build/include/rte_memcpy.h:
>     618:13: warning: conversion to 'size_t' {aka 'long
>     unsigned int'} from 'int' may change the sign of the
>     result [-Wsign-conversion]
>              tmp -= len;
>                  ^~
> 
> We can eliminate the problems by setting the type of tmp to
> size_t in the first place.
> 
> After a suggestion by Bruce Richardson
> 
> Signed-off-by: Andy Green <andy@warmcat.com>
> Fixes: d35cc1fe6a ("eal/x86: revert select optimized memcpy at run-time")
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus
  2018-05-22  1:24         ` [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus Andy Green
                             ` (7 preceding siblings ...)
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 8/8] rte_ethdev.h: align sign and scope of temp var Andy Green
@ 2018-05-22  9:13           ` Bruce Richardson
  2018-05-22  9:14             ` Andy Green
  2018-05-22 14:29             ` Thomas Monjalon
  8 siblings, 2 replies; 174+ messages in thread
From: Bruce Richardson @ 2018-05-22  9:13 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, thomas

On Tue, May 22, 2018 at 09:24:07AM +0800, Andy Green 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.
> 
> 6/8 are acked by Bruce Richardson... the other two have
> had the pending comment applied in this version.
> 
I've acked the final two versions now. All look ok to me.

/Bruce

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus
  2018-05-22  9:13           ` [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus Bruce Richardson
@ 2018-05-22  9:14             ` Andy Green
  2018-05-22 14:29             ` Thomas Monjalon
  1 sibling, 0 replies; 174+ messages in thread
From: Andy Green @ 2018-05-22  9:14 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, thomas



On 05/22/2018 05:13 PM, Bruce Richardson wrote:
> On Tue, May 22, 2018 at 09:24:07AM +0800, Andy Green 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.
>>
>> 6/8 are acked by Bruce Richardson... the other two have
>> had the pending comment applied in this version.
>>
> I've acked the final two versions now. All look ok to me.

Thanks again for your help.

-Andy

> /Bruce
> 

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v7 8/8] rte_ethdev.h: align sign and scope of temp var
  2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 8/8] rte_ethdev.h: align sign and scope of temp var Andy Green
  2018-05-22  9:12             ` Bruce Richardson
@ 2018-05-22 14:18             ` Thomas Monjalon
  1 sibling, 0 replies; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-22 14:18 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, bruce.richardson

22/05/2018 03:24, Andy Green:
> -			nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
> -						nb_pkts, cb->param);
> +			nb_rx = cb->fn.rx(port_id, queue_id,
> +					  rx_pkts, nb_rx,
> +					  nb_pkts, cb->param);

This change seems to be a leftover of previous revision.
I will remove it from the patch.

^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus
  2018-05-22  9:13           ` [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus Bruce Richardson
  2018-05-22  9:14             ` Andy Green
@ 2018-05-22 14:29             ` Thomas Monjalon
  1 sibling, 0 replies; 174+ messages in thread
From: Thomas Monjalon @ 2018-05-22 14:29 UTC (permalink / raw)
  To: Andy Green; +Cc: dev, Bruce Richardson

22/05/2018 11:13, Bruce Richardson:
> On Tue, May 22, 2018 at 09:24:07AM +0800, Andy Green 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.
> > 
> > 6/8 are acked by Bruce Richardson... the other two have
> > had the pending comment applied in this version.
> > 
> I've acked the final two versions now. All look ok to me.

Applied, thanks

^ permalink raw reply	[flat|nested] 174+ messages in thread

end of thread, other threads:[~2018-05-22 14:29 UTC | newest]

Thread overview: 174+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-12  1:58 [dpdk-dev] [PATCH v3 00/24] Fixes for GCC8 against lagopus Andy Green
2018-05-12  1:58 ` [dpdk-dev] [PATCH v3 01/24] lib/librte_eal: import libbsd strlcpy Andy Green
2018-05-13 14:56   ` Thomas Monjalon
2018-05-13 23:07     ` Andy Green
2018-05-12  1:58 ` [dpdk-dev] [PATCH v3 02/24] lib/librte_ethdev: change eth-dev-ops API to return int Andy Green
2018-05-13 14:58   ` Thomas Monjalon
2018-05-13 23:10     ` Andy Green
2018-05-13 23:49       ` Thomas Monjalon
2018-05-12  1:58 ` [dpdk-dev] [PATCH v3 03/24] rte_common.h: cast gcc builtin result to avoid complaints Andy Green
2018-05-13 20:40   ` Thomas Monjalon
2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 04/24] lib/librte_eal: explicit tmp cast Andy Green
2018-05-13 16:19   ` Thomas Monjalon
2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 05/24] lib/librte_eal: explicit cast for signed change Andy Green
2018-05-13 20:40   ` Thomas Monjalon
2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 06/24] /lib/librte_eal: stage cast from uint64 to long Andy Green
2018-05-13 16:24   ` Thomas Monjalon
2018-05-13 23:17     ` Andy Green
2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 07/24] rte_spinlock.h: stack declarations before code Andy Green
2018-05-13 20:42   ` Thomas Monjalon
2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 08/24] rte_ring_generic.h: " Andy Green
2018-05-13 16:47   ` Thomas Monjalon
2018-05-13 23:21     ` Andy Green
2018-05-13 23:44       ` Thomas Monjalon
2018-05-14  0:09         ` Andy Green
2018-05-14  1:49           ` Thomas Monjalon
2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 09/24] rte_ring.h: remove signed type flipflopping Andy Green
2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 10/24] rte_dev.h: stack declaration at top of own basic block Andy Green
2018-05-13 20:41   ` Thomas Monjalon
2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 11/24] rte_mbuf.h: avoid warnings from inadvertant promotion Andy Green
2018-05-13 16:54   ` Thomas Monjalon
2018-05-13 23:27     ` Andy Green
2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 12/24] rte_mbuf.h: explicit casts for int16 to uint16 Andy Green
2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 13/24] rte_mbuf.h: make sure RTE-MIN compares same types Andy Green
2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 14/24] rte_mbuf.h: explicit cast restricting ptrdiff to uint16 Andy Green
2018-05-12  1:59 ` [dpdk-dev] [PATCH v3 15/24] rte_mbuf.h: explicit cast for size type to uint32 Andy Green
2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 16/24] rte_mbuf.h: explicit casts to uint16 to avoid warnings Andy Green
2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 17/24] rte_byteorder.h: explicit cast for return promotion Andy Green
2018-05-13 16:59   ` Thomas Monjalon
2018-05-14  0:02     ` Andy Green
2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 18/24] rte_ether.h: explicit cast avoiding truncation warning Andy Green
2018-05-13 17:02   ` Thomas Monjalon
2018-05-14  0:05     ` Andy Green
2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 19/24] rte_ether.h: stack vars declared at top of function Andy Green
2018-05-13 20:42   ` Thomas Monjalon
2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 20/24] rte_ethdev.h: align sign and scope of temp var Andy Green
2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 21/24] rte_ethdev.h: explicit cast for truncation Andy Green
2018-05-13 20:43   ` Thomas Monjalon
2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 22/24] rte_hash_crc.h: stack vars declared at top of function Andy Green
2018-05-13 20:44   ` Thomas Monjalon
2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 23/24] rte_hash_crc.h: explicit casts for truncation Andy Green
2018-05-13 20:44   ` Thomas Monjalon
2018-05-12  2:00 ` [dpdk-dev] [PATCH v3 24/24] test_table_pipeline: repair munged indirection level Andy Green
2018-05-13 20:33   ` Thomas Monjalon
2018-05-14  0:22     ` Andy Green
2018-05-14  5:09 ` [dpdk-dev] [PATCH v4 00/23] Fixes for GCC8 against lagopus Andy Green
2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 01/23] lib/librte_eal: import libbsd strlcpy Andy Green
2018-05-17 10:36     ` Bruce Richardson
2018-05-17 12:35       ` Andy Green
2018-05-17 12:56         ` Bruce Richardson
2018-05-17 13:00           ` Andy Green
2018-05-17 13:49             ` Bruce Richardson
2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 02/23] rte_eal_version_map: export rte-strlcpy Andy Green
2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 03/23] lib/librte_ethdev: change eth-dev-ops API to return int Andy Green
2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 04/23] lib/librte_eal: explicit tmp cast Andy Green
2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 05/23] /lib/librte_eal: stage cast from uint64 to long Andy Green
2018-05-17 10:47     ` Bruce Richardson
2018-05-17 12:56       ` Andy Green
2018-05-14  5:09   ` [dpdk-dev] [PATCH v4 06/23] rte_ring_generic.h: stack declarations before code Andy Green
2018-05-17  8:29     ` Olivier Matz
2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 07/23] rte_ring.h: remove signed type flipflopping Andy Green
2018-05-17  8:29     ` Olivier Matz
2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 08/23] rte_mbuf.h: avoid warnings from inadvertant promotion Andy Green
2018-05-17  8:30     ` Olivier Matz
2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 09/23] rte_mbuf.h: explicit casts for int16 to uint16 Andy Green
2018-05-17  8:30     ` Olivier Matz
2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 10/23] rte_mbuf.h: make sure RTE-MIN compares same types Andy Green
2018-05-17 10:49     ` Bruce Richardson
2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 11/23] rte_mbuf.h: explicit cast restricting ptrdiff to uint16 Andy Green
2018-05-17 10:50     ` Bruce Richardson
2018-05-17 11:03       ` Ananyev, Konstantin
2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 12/23] rte_mbuf.h: explicit cast for size type to uint32 Andy Green
2018-05-17 10:53     ` Bruce Richardson
2018-05-17 13:09       ` Andy Green
2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 13/23] rte_mbuf.h: explicit casts to uint16 to avoid warnings Andy Green
2018-05-17 10:58     ` Bruce Richardson
2018-05-17 13:28       ` Andy Green
2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 14/23] rte_ether.h: explicit cast avoiding truncation warning Andy Green
2018-05-17 11:01     ` Bruce Richardson
2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 15/23] rte_ethdev.h: align sign and scope of temp var Andy Green
2018-05-17 13:54     ` Bruce Richardson
2018-05-17 14:17       ` Andy Green
2018-05-17 14:26         ` Bruce Richardson
2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 16/23] rte_byteorder.h: explicit cast for return promotion Andy Green
2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 17/23] test_table_pipeline: repair munged indirection level Andy Green
2018-05-14 10:35     ` Singh, Jasvinder
2018-05-14 10:46       ` Andy Green
2018-05-14  5:10   ` [dpdk-dev] [PATCH v4 18/23] rte_rwlock.h: gcc8 sign conversion warnings Andy Green
2018-05-14  5:11   ` [dpdk-dev] [PATCH v4 19/23] rte_ip.h: cast input to bswap16 to be uint16 Andy Green
2018-05-14  5:11   ` [dpdk-dev] [PATCH v4 20/23] rte_ip.h: cast around promotion to int Andy Green
2018-05-14  5:11   ` [dpdk-dev] [PATCH v4 21/23] rte_ip.h: cast type decided by sizeof to uint32 Andy Green
2018-05-14  5:11   ` [dpdk-dev] [PATCH v4 22/23] rte_ip.h: cast return checksum size to uint16 Andy Green
2018-05-14  5:11   ` [dpdk-dev] [PATCH v4 23/23] rte_ip.h: cast away gcc8 warning on rte_ipv6_phdr_cksum Andy Green
2018-05-17 13:48   ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Andy Green
2018-05-17 13:48     ` [dpdk-dev] [PATCH v5 01/21] lib/librte_ethdev: change eth-dev-ops API to return int Andy Green
2018-05-17 13:55       ` Bruce Richardson
2018-05-17 13:59         ` Andy Green
2018-05-18 10:59       ` Shreyansh Jain
2018-05-18 11:12         ` Andy Green
2018-05-20  2:43           ` Shreyansh Jain
2018-05-20  4:11             ` Andy Green
2018-05-21  6:52             ` Stephen Hemminger
2018-05-21  7:25               ` Andy Green
2018-05-18 13:02         ` [dpdk-dev] [PATCH] rte_ethdev.h: fix gcc8.1 sign conversion warining Andy Green
2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 02/21] rte_string_fns.h: fix gcc8.1 sign conv warning in lstrcpy Andy Green
2018-05-17 13:56       ` Bruce Richardson
2018-05-17 14:03       ` [dpdk-dev] [PATCH] " Andy Green
2018-05-17 14:40       ` [dpdk-dev] [PATCH v5 02/21] " Stephen Hemminger
2018-05-17 15:28         ` Bruce Richardson
2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 03/21] lib/librte_eal: explicit tmp cast Andy Green
2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 04/21] /lib/librte_eal: stage cast from uint64 to long Andy Green
2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 05/21] rte_ring_generic.h: stack declarations before code Andy Green
2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 06/21] rte_ring.h: remove signed type flipflopping Andy Green
2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 07/21] rte_mbuf.h: avoid warnings from inadvertant promotion Andy Green
2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 08/21] rte_mbuf.h: explicit casts for int16 to uint16 Andy Green
2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 09/21] rte_mbuf.h: make sure RTE-MIN compares same types Andy Green
2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 10/21] rte_mbuf.h: explicit cast restricting ptrdiff to uint16 Andy Green
2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 11/21] rte_ether.h: explicit cast avoiding truncation warning Andy Green
2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 12/21] rte_rwlock.h: gcc8 sign conversion warnings Andy Green
2018-05-17 13:49     ` [dpdk-dev] [PATCH v5 13/21] rte_ip.h: cast input to bswap16 to be uint16 Andy Green
2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 14/21] rte_ip.h: cast around promotion to int Andy Green
2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 15/21] rte_ip.h: cast type decided by sizeof to uint32 Andy Green
2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 16/21] rte_ip.h: cast return checksum size to uint16 Andy Green
2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 17/21] rte_ip.h: cast away gcc8 warning on rte_ipv6_phdr_cksum Andy Green
2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 18/21] rte_mbuf.h: explicit cast for size type to uint32 Andy Green
2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 19/21] rte_mbuf.h: explicit casts to uint16 to avoid warnings Andy Green
2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 20/21] rte_ethdev.h: align sign and scope of temp var Andy Green
2018-05-17 13:50     ` [dpdk-dev] [PATCH v5 21/21] rte_byteorder.h: explicit cast for return promotion Andy Green
2018-05-20 22:18     ` [dpdk-dev] [PATCH v5 00/21] Fixes for GCC8 against lagopus Thomas Monjalon
2018-05-21  2:00       ` [dpdk-dev] [PATCH v6 0/8] " Andy Green
2018-05-21  2:00         ` [dpdk-dev] [PATCH v6 1/8] lib/librte_eal: explicit tmp cast Andy Green
2018-05-21 11:06           ` [dpdk-dev] [PATCH] lib/librte_eal: change type of tmp Andy Green
2018-05-21 12:07             ` Bruce Richardson
2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 2/8] rte_rwlock.h: gcc8 sign conversion warnings Andy Green
2018-05-21 12:10           ` Bruce Richardson
2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 3/8] rte_ip.h: cast type decided by sizeof to uint32 Andy Green
2018-05-21 12:13           ` Bruce Richardson
2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 4/8] rte_mbuf.h: reduce temp to match uint16 types Andy Green
2018-05-21 12:14           ` Bruce Richardson
2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 5/8] rte_mbuf.h: avoid implicit demotion in 64-bit arith Andy Green
2018-05-21 12:27           ` Bruce Richardson
2018-05-22  1:29             ` Andy Green
2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 6/8] rte_mbuf.h: choose correct type for temp Andy Green
2018-05-21 13:09           ` Bruce Richardson
2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 7/8] rte_mbuf.h: add and subtract explicitly to avoid promotion Andy Green
2018-05-21 13:10           ` Bruce Richardson
2018-05-21  2:01         ` [dpdk-dev] [PATCH v6 8/8] rte_ethdev.h: align sign and scope of temp var Andy Green
2018-05-21 13:30           ` Bruce Richardson
2018-05-22  1:25             ` Andy Green
2018-05-22  1:24         ` [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus Andy Green
2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 1/8] lib/librte_eal: change type of tmp Andy Green
2018-05-22  9:13             ` Bruce Richardson
2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 2/8] rte_rwlock.h: gcc8 sign conversion warnings Andy Green
2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 3/8] rte_ip.h: cast type decided by sizeof to uint32 Andy Green
2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 4/8] rte_mbuf.h: reduce temp to match uint16 types Andy Green
2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 5/8] rte_mbuf.h: avoid implicit demotion in 64-bit arith Andy Green
2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 6/8] rte_mbuf.h: choose correct type for temp Andy Green
2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 7/8] rte_mbuf.h: add and subtract explicitly to avoid promotion Andy Green
2018-05-22  1:24           ` [dpdk-dev] [PATCH v7 8/8] rte_ethdev.h: align sign and scope of temp var Andy Green
2018-05-22  9:12             ` Bruce Richardson
2018-05-22 14:18             ` Thomas Monjalon
2018-05-22  9:13           ` [dpdk-dev] [PATCH v7 0/8] Fixes for GCC8 against lagopus Bruce Richardson
2018-05-22  9:14             ` Andy Green
2018-05-22 14:29             ` Thomas Monjalon
2018-05-21  2:06       ` [dpdk-dev] [PATCH v5 00/21] " Andy Green

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).