All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] examples/l3fwd: add switch fall-through comments
@ 2017-06-02 11:20 Jerin Jacob
  2017-06-02 11:20 ` [PATCH 2/4] examples/performance-thread: add " Jerin Jacob
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Jerin Jacob @ 2017-06-02 11:20 UTC (permalink / raw)
  To: dev
  Cc: bruce.richardson, thomas, cristian.dumitrescu, yuanhan.liu,
	maxime.coquelin, Jerin Jacob

This fixes compiler warnings with GCC 7.1.1

Fixes: 268888b5b020 ("examples/l3fwd: modularize")
Fixes: 94c54b4158d5 ("examples/l3fwd: rework exact-match")
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 examples/l3fwd/l3fwd_lpm_sse.h | 2 ++
 examples/l3fwd/l3fwd_sse.h     | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/examples/l3fwd/l3fwd_lpm_sse.h b/examples/l3fwd/l3fwd_lpm_sse.h
index aa06b6d34..e92814b10 100644
--- a/examples/l3fwd/l3fwd_lpm_sse.h
+++ b/examples/l3fwd/l3fwd_lpm_sse.h
@@ -199,9 +199,11 @@ l3fwd_lpm_send_packets(int nb_rx, struct rte_mbuf **pkts_burst,
 	case 3:
 		dst_port[j] = lpm_get_dst_port(qconf, pkts_burst[j], portid);
 		j++;
+		/* fall-through */
 	case 2:
 		dst_port[j] = lpm_get_dst_port(qconf, pkts_burst[j], portid);
 		j++;
+		/* fall-through */
 	case 1:
 		dst_port[j] = lpm_get_dst_port(qconf, pkts_burst[j], portid);
 		j++;
diff --git a/examples/l3fwd/l3fwd_sse.h b/examples/l3fwd/l3fwd_sse.h
index 1afa1f006..fa9c4829d 100644
--- a/examples/l3fwd/l3fwd_sse.h
+++ b/examples/l3fwd/l3fwd_sse.h
@@ -349,12 +349,15 @@ send_packetsx4(struct lcore_conf *qconf, uint8_t port, struct rte_mbuf *m[],
 	case 0:
 		qconf->tx_mbufs[port].m_table[len + j] = m[j];
 		j++;
+		/* fall-through */
 	case 3:
 		qconf->tx_mbufs[port].m_table[len + j] = m[j];
 		j++;
+		/* fall-through */
 	case 2:
 		qconf->tx_mbufs[port].m_table[len + j] = m[j];
 		j++;
+		/* fall-through */
 	case 1:
 		qconf->tx_mbufs[port].m_table[len + j] = m[j];
 		j++;
@@ -376,12 +379,15 @@ send_packetsx4(struct lcore_conf *qconf, uint8_t port, struct rte_mbuf *m[],
 		case 0:
 			qconf->tx_mbufs[port].m_table[j] = m[n + j];
 			j++;
+			/* fall-through */
 		case 3:
 			qconf->tx_mbufs[port].m_table[j] = m[n + j];
 			j++;
+			/* fall-through */
 		case 2:
 			qconf->tx_mbufs[port].m_table[j] = m[n + j];
 			j++;
+			/* fall-through */
 		case 1:
 			qconf->tx_mbufs[port].m_table[j] = m[n + j];
 			j++;
@@ -464,10 +470,12 @@ send_packets_multi(struct lcore_conf *qconf, struct rte_mbuf **pkts_burst,
 		process_packet(pkts_burst[j], dst_port + j);
 		GROUP_PORT_STEP(dlp, dst_port, lp, pnum, j);
 		j++;
+		/* fall-through */
 	case 2:
 		process_packet(pkts_burst[j], dst_port + j);
 		GROUP_PORT_STEP(dlp, dst_port, lp, pnum, j);
 		j++;
+		/* fall-through */
 	case 1:
 		process_packet(pkts_burst[j], dst_port + j);
 		GROUP_PORT_STEP(dlp, dst_port, lp, pnum, j);
-- 
2.13.0

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

* [PATCH 2/4] examples/performance-thread: add fall-through comments
  2017-06-02 11:20 [PATCH 1/4] examples/l3fwd: add switch fall-through comments Jerin Jacob
@ 2017-06-02 11:20 ` Jerin Jacob
  2017-06-02 11:20 ` [PATCH 3/4] examples/qos_sched: suppress GCC 7.1.1 warnings Jerin Jacob
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Jerin Jacob @ 2017-06-02 11:20 UTC (permalink / raw)
  To: dev
  Cc: bruce.richardson, thomas, cristian.dumitrescu, yuanhan.liu,
	maxime.coquelin, Jerin Jacob

This fixes compiler warnings with GCC 7.1.1

Fixes: d48415e1fee3 ("examples/performance-thread: add l3fwd-thread app")
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 examples/performance-thread/l3fwd-thread/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index 2d98473eb..ac85a369f 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -761,12 +761,15 @@ send_packetsx4(uint8_t port,
 	case 0:
 		qconf->tx_mbufs[port].m_table[len + j] = m[j];
 		j++;
+		/* fall-through */
 	case 3:
 		qconf->tx_mbufs[port].m_table[len + j] = m[j];
 		j++;
+		/* fall-through */
 	case 2:
 		qconf->tx_mbufs[port].m_table[len + j] = m[j];
 		j++;
+		/* fall-through */
 	case 1:
 		qconf->tx_mbufs[port].m_table[len + j] = m[j];
 		j++;
@@ -788,12 +791,15 @@ send_packetsx4(uint8_t port,
 		case 0:
 			qconf->tx_mbufs[port].m_table[j] = m[n + j];
 			j++;
+			/* fall-through */
 		case 3:
 			qconf->tx_mbufs[port].m_table[j] = m[n + j];
 			j++;
+			/* fall-through */
 		case 2:
 			qconf->tx_mbufs[port].m_table[j] = m[n + j];
 			j++;
+			/* fall-through */
 		case 1:
 			qconf->tx_mbufs[port].m_table[j] = m[n + j];
 			j++;
@@ -1860,10 +1866,12 @@ process_burst(struct rte_mbuf *pkts_burst[MAX_PKT_BURST], int nb_rx,
 		process_packet(pkts_burst[j], dst_port + j, portid);
 		GROUP_PORT_STEP(dlp, dst_port, lp, pnum, j);
 		j++;
+		/* fall-through */
 	case 2:
 		process_packet(pkts_burst[j], dst_port + j, portid);
 		GROUP_PORT_STEP(dlp, dst_port, lp, pnum, j);
 		j++;
+		/* fall-through */
 	case 1:
 		process_packet(pkts_burst[j], dst_port + j, portid);
 		GROUP_PORT_STEP(dlp, dst_port, lp, pnum, j);
-- 
2.13.0

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

* [PATCH 3/4] examples/qos_sched: suppress GCC 7.1.1 warnings
  2017-06-02 11:20 [PATCH 1/4] examples/l3fwd: add switch fall-through comments Jerin Jacob
  2017-06-02 11:20 ` [PATCH 2/4] examples/performance-thread: add " Jerin Jacob
@ 2017-06-02 11:20 ` Jerin Jacob
  2017-06-02 18:18   ` Dumitrescu, Cristian
  2017-06-02 11:20 ` [PATCH 4/4] examples/vhost: fix uninitialized desc indexes Jerin Jacob
  2017-06-05 12:57 ` [PATCH 1/4] examples/l3fwd: add switch fall-through comments Thomas Monjalon
  3 siblings, 1 reply; 7+ messages in thread
From: Jerin Jacob @ 2017-06-02 11:20 UTC (permalink / raw)
  To: dev
  Cc: bruce.richardson, thomas, cristian.dumitrescu, yuanhan.liu,
	maxime.coquelin, Jerin Jacob

This one is more of a compiler issue as application
checks the app_parse_opt_vals() return value.

Since this code is in slow path, adding a memset
to fix following "maybe-uninitialized" warning.

qos_sched/args.c: In function ‘app_parse_args’:
examples/qos_sched/args.c:254:32: error: ‘vals[0]’ may be
used uninitialized in this function [-Werror=maybe-uninitialized]
pconf->rx_port = (uint8_t)vals[0];
                            ~~~~^~~
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 examples/qos_sched/args.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/examples/qos_sched/args.c b/examples/qos_sched/args.c
index 476a0ee1c..2350d64f4 100644
--- a/examples/qos_sched/args.c
+++ b/examples/qos_sched/args.c
@@ -245,6 +245,7 @@ app_parse_flow_conf(const char *conf_str)
 	struct flow_conf *pconf;
 	uint64_t mask;
 
+	memset(vals, 0, sizeof(vals));
 	ret = app_parse_opt_vals(conf_str, ',', 6, vals);
 	if (ret < 4 || ret > 5)
 		return ret;
-- 
2.13.0

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

* [PATCH 4/4] examples/vhost: fix uninitialized desc indexes
  2017-06-02 11:20 [PATCH 1/4] examples/l3fwd: add switch fall-through comments Jerin Jacob
  2017-06-02 11:20 ` [PATCH 2/4] examples/performance-thread: add " Jerin Jacob
  2017-06-02 11:20 ` [PATCH 3/4] examples/qos_sched: suppress GCC 7.1.1 warnings Jerin Jacob
@ 2017-06-02 11:20 ` Jerin Jacob
  2017-06-03  6:59   ` Maxime Coquelin
  2017-06-05 12:57 ` [PATCH 1/4] examples/l3fwd: add switch fall-through comments Thomas Monjalon
  3 siblings, 1 reply; 7+ messages in thread
From: Jerin Jacob @ 2017-06-02 11:20 UTC (permalink / raw)
  To: dev
  Cc: bruce.richardson, thomas, cristian.dumitrescu, yuanhan.liu,
	maxime.coquelin, Jerin Jacob, stable

Fixing the below error by returning from the function early
when count == 0.

Issue flagged by GCC 7.1.1

examples/vhost/virtio_net.c:370:38: error: ‘desc_indexes[0]’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
  rte_prefetch0(&vr->desc[desc_indexes[0]]);

Fixes: ca059fa5e290 ("examples/vhost: demonstrate the new generic APIs")

Cc: stable@dpdk.org
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 examples/vhost/virtio_net.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/examples/vhost/virtio_net.c b/examples/vhost/virtio_net.c
index cc2c3d882..5e1ed44a5 100644
--- a/examples/vhost/virtio_net.c
+++ b/examples/vhost/virtio_net.c
@@ -350,6 +350,9 @@ vs_dequeue_pkts(struct vhost_dev *dev, uint16_t queue_id,
 	count = RTE_MIN(count, MAX_PKT_BURST);
 	count = RTE_MIN(count, free_entries);
 
+	if (unlikely(count == 0))
+		return 0;
+
 	/*
 	 * Retrieve all of the head indexes first and pre-update used entries
 	 * to avoid caching issues.
@@ -385,8 +388,6 @@ vs_dequeue_pkts(struct vhost_dev *dev, uint16_t queue_id,
 		}
 
 	}
-	if (!i)
-		return 0;
 
 	queue->last_avail_idx += i;
 	queue->last_used_idx += i;
-- 
2.13.0

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

* Re: [PATCH 3/4] examples/qos_sched: suppress GCC 7.1.1 warnings
  2017-06-02 11:20 ` [PATCH 3/4] examples/qos_sched: suppress GCC 7.1.1 warnings Jerin Jacob
@ 2017-06-02 18:18   ` Dumitrescu, Cristian
  0 siblings, 0 replies; 7+ messages in thread
From: Dumitrescu, Cristian @ 2017-06-02 18:18 UTC (permalink / raw)
  To: Jerin Jacob, dev; +Cc: Richardson, Bruce, thomas, yuanhan.liu, maxime.coquelin



> -----Original Message-----
> From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> Sent: Friday, June 2, 2017 12:21 PM
> To: dev@dpdk.org
> Cc: Richardson, Bruce <bruce.richardson@intel.com>;
> thomas@monjalon.net; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>; yuanhan.liu@linux.intel.com;
> maxime.coquelin@redhat.com; Jerin Jacob
> <jerin.jacob@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH 3/4] examples/qos_sched: suppress GCC 7.1.1
> warnings
> 
> This one is more of a compiler issue as application
> checks the app_parse_opt_vals() return value.
> 
> Since this code is in slow path, adding a memset
> to fix following "maybe-uninitialized" warning.
> 
> qos_sched/args.c: In function ‘app_parse_args’:
> examples/qos_sched/args.c:254:32: error: ‘vals[0]’ may be
> used uninitialized in this function [-Werror=maybe-uninitialized]
> pconf->rx_port = (uint8_t)vals[0];
>                             ~~~~^~~
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---

Acked-by: Cristian.Dumitrescu@intel.com


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

* Re: [PATCH 4/4] examples/vhost: fix uninitialized desc indexes
  2017-06-02 11:20 ` [PATCH 4/4] examples/vhost: fix uninitialized desc indexes Jerin Jacob
@ 2017-06-03  6:59   ` Maxime Coquelin
  0 siblings, 0 replies; 7+ messages in thread
From: Maxime Coquelin @ 2017-06-03  6:59 UTC (permalink / raw)
  To: Jerin Jacob, dev
  Cc: bruce.richardson, thomas, cristian.dumitrescu, yuanhan.liu, stable



On 06/02/2017 01:20 PM, Jerin Jacob wrote:
> Fixing the below error by returning from the function early
> when count == 0.
> 
> Issue flagged by GCC 7.1.1
> 
> examples/vhost/virtio_net.c:370:38: error: ‘desc_indexes[0]’ may be used
> uninitialized in this function [-Werror=maybe-uninitialized]
>    rte_prefetch0(&vr->desc[desc_indexes[0]]);
> 
> Fixes: ca059fa5e290 ("examples/vhost: demonstrate the new generic APIs")
> 
> Cc: stable@dpdk.org
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

> ---
>   examples/vhost/virtio_net.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/examples/vhost/virtio_net.c b/examples/vhost/virtio_net.c
> index cc2c3d882..5e1ed44a5 100644
> --- a/examples/vhost/virtio_net.c
> +++ b/examples/vhost/virtio_net.c
> @@ -350,6 +350,9 @@ vs_dequeue_pkts(struct vhost_dev *dev, uint16_t queue_id,
>   	count = RTE_MIN(count, MAX_PKT_BURST);
>   	count = RTE_MIN(count, free_entries);
>   
> +	if (unlikely(count == 0))
> +		return 0;
> +
>   	/*
>   	 * Retrieve all of the head indexes first and pre-update used entries
>   	 * to avoid caching issues.
> @@ -385,8 +388,6 @@ vs_dequeue_pkts(struct vhost_dev *dev, uint16_t queue_id,
>   		}
>   
>   	}
> -	if (!i)
> -		return 0;
>   
>   	queue->last_avail_idx += i;
>   	queue->last_used_idx += i;
> 

Thanks,
Maxime

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

* Re: [PATCH 1/4] examples/l3fwd: add switch fall-through comments
  2017-06-02 11:20 [PATCH 1/4] examples/l3fwd: add switch fall-through comments Jerin Jacob
                   ` (2 preceding siblings ...)
  2017-06-02 11:20 ` [PATCH 4/4] examples/vhost: fix uninitialized desc indexes Jerin Jacob
@ 2017-06-05 12:57 ` Thomas Monjalon
  3 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2017-06-05 12:57 UTC (permalink / raw)
  To: Jerin Jacob
  Cc: dev, bruce.richardson, cristian.dumitrescu, yuanhan.liu, maxime.coquelin

02/06/2017 13:20, Jerin Jacob:
> This fixes compiler warnings with GCC 7.1.1

Series applied, thanks

Hope many of us will work with GCC 7.1 now.

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

end of thread, other threads:[~2017-06-05 12:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-02 11:20 [PATCH 1/4] examples/l3fwd: add switch fall-through comments Jerin Jacob
2017-06-02 11:20 ` [PATCH 2/4] examples/performance-thread: add " Jerin Jacob
2017-06-02 11:20 ` [PATCH 3/4] examples/qos_sched: suppress GCC 7.1.1 warnings Jerin Jacob
2017-06-02 18:18   ` Dumitrescu, Cristian
2017-06-02 11:20 ` [PATCH 4/4] examples/vhost: fix uninitialized desc indexes Jerin Jacob
2017-06-03  6:59   ` Maxime Coquelin
2017-06-05 12:57 ` [PATCH 1/4] examples/l3fwd: add switch fall-through comments Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.