DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ixgbe: fix compilation issue when RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC is disabled
@ 2015-03-19 12:24 Pablo de Lara
  2015-03-19 15:31 ` Stephen Hemminger
  2015-03-20 13:59 ` [dpdk-dev] [PATCHv2] " Konstantin Ananyev
  0 siblings, 2 replies; 5+ messages in thread
From: Pablo de Lara @ 2015-03-19 12:24 UTC (permalink / raw)
  To: dev

If RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC is disabled in the config file,
RTE_PMD_IXGBE_RX_MAX_BURST macro and ixgbe_recv_pkts_bulk_alloc function are not declared,
and some parts of the ixgbe code were still trying to use them.

This patch fixes the problem by including previous conditionals
that were removed in 01fa1d6 ("ixgbe: unify Rx setup").

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 8bede22..011e97c 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -2075,7 +2075,7 @@ check_rx_burst_bulk_alloc_preconditions(__rte_unused struct ixgbe_rx_queue *rxq)
 
 /* Reset dynamic ixgbe_rx_queue fields back to defaults */
 static void
-ixgbe_reset_rx_queue(struct ixgbe_hw *hw, struct ixgbe_rx_queue *rxq)
+ixgbe_reset_rx_queue(struct ixgbe_hw *hw __rte_unused, struct ixgbe_rx_queue *rxq)
 {
 	static const union ixgbe_adv_rx_desc zeroed_desc = { .read = {
 			.pkt_addr = 0}};
@@ -2092,9 +2092,11 @@ ixgbe_reset_rx_queue(struct ixgbe_hw *hw, struct ixgbe_rx_queue *rxq)
 	 * constraints here to see if we need to zero out memory after the end
 	 * of the H/W descriptor ring.
 	 */
+#ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
 	if (hw->rx_bulk_alloc_allowed)
 		/* zero out extra memory */
 		len += RTE_PMD_IXGBE_RX_MAX_BURST;
+#endif
 
 	/*
 	 * Zero out HW ring memory. Zero out extra memory at the end of
@@ -2238,8 +2240,10 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	 * function does not access an invalid memory region.
 	 */
 	len = nb_desc;
+#ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
 	if (hw->rx_bulk_alloc_allowed)
 		len += RTE_PMD_IXGBE_RX_MAX_BURST;
+#endif
 
 	rxq->sw_ring = rte_zmalloc_socket("rxq->sw_ring",
 					  sizeof(struct ixgbe_rx_entry) * len,
@@ -3544,14 +3548,19 @@ void ixgbe_set_rx_function(struct rte_eth_dev *dev)
 				   "burst size no less than 32.");
 
 		dev->rx_pkt_burst = ixgbe_recv_pkts_vec;
-	} else if (hw->rx_bulk_alloc_allowed) {
+
+	}
+#ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
+	else if (hw->rx_bulk_alloc_allowed) {
 		PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions are "
 				    "satisfied. Rx Burst Bulk Alloc function "
 				    "will be used on port=%d.",
 			     dev->data->port_id);
 
 		dev->rx_pkt_burst = ixgbe_recv_pkts_bulk_alloc;
-	} else {
+	}
+#endif
+	else {
 		PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions are not "
 				    "satisfied, or Scattered Rx is requested, "
 				    "or RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC "
-- 
1.7.4.1

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

* Re: [dpdk-dev] [PATCH] ixgbe: fix compilation issue when RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC is disabled
  2015-03-19 12:24 [dpdk-dev] [PATCH] ixgbe: fix compilation issue when RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC is disabled Pablo de Lara
@ 2015-03-19 15:31 ` Stephen Hemminger
  2015-03-20 13:59 ` [dpdk-dev] [PATCHv2] " Konstantin Ananyev
  1 sibling, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2015-03-19 15:31 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: dev

On Thu, 19 Mar 2015 12:24:38 +0000
Pablo de Lara <pablo.de.lara.guarch@intel.com> wrote:

> If RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC is disabled in the config file,
> RTE_PMD_IXGBE_RX_MAX_BURST macro and ixgbe_recv_pkts_bulk_alloc function are not declared,
> and some parts of the ixgbe code were still trying to use them.
> 
> This patch fixes the problem by including previous conditionals
> that were removed in 01fa1d6 ("ixgbe: unify Rx setup").
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
>  lib/librte_pmd_ixgbe/ixgbe_rxtx.c |   15 ++++++++++++---
>  1 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> index 8bede22..011e97c 100644
> --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> @@ -2075,7 +2075,7 @@ check_rx_burst_bulk_alloc_preconditions(__rte_unused struct ixgbe_rx_queue *rxq)
>  
>  /* Reset dynamic ixgbe_rx_queue fields back to defaults */
>  static void
> -ixgbe_reset_rx_queue(struct ixgbe_hw *hw, struct ixgbe_rx_queue *rxq)
> +ixgbe_reset_rx_queue(struct ixgbe_hw *hw __rte_unused, struct ixgbe_rx_queue *rxq)
>  {
>  	static const union ixgbe_adv_rx_desc zeroed_desc = { .read = {
>  			.pkt_addr = 0}};
> @@ -2092,9 +2092,11 @@ ixgbe_reset_rx_queue(struct ixgbe_hw *hw, struct ixgbe_rx_queue *rxq)
>  	 * constraints here to see if we need to zero out memory after the end
>  	 * of the H/W descriptor ring.
>  	 */
> +#ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
>  	if (hw->rx_bulk_alloc_allowed)
>  		/* zero out extra memory */
>  		len += RTE_PMD_IXGBE_RX_MAX_BURST;
> +#endif
>  
>  	/*
>  	 * Zero out HW ring memory. Zero out extra memory at the end of
> @@ -2238,8 +2240,10 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
>  	 * function does not access an invalid memory region.
>  	 */
>  	len = nb_desc;
> +#ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
>  	if (hw->rx_bulk_alloc_allowed)
>  		len += RTE_PMD_IXGBE_RX_MAX_BURST;
> +#endif
>  
>  	rxq->sw_ring = rte_zmalloc_socket("rxq->sw_ring",
>  					  sizeof(struct ixgbe_rx_entry) * len,
> @@ -3544,14 +3548,19 @@ void ixgbe_set_rx_function(struct rte_eth_dev *dev)
>  				   "burst size no less than 32.");
>  
>  		dev->rx_pkt_burst = ixgbe_recv_pkts_vec;
> -	} else if (hw->rx_bulk_alloc_allowed) {
> +
> +	}
> +#ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
> +	else if (hw->rx_bulk_alloc_allowed) {
>  		PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions are "
>  				    "satisfied. Rx Burst Bulk Alloc function "
>  				    "will be used on port=%d.",
>  			     dev->data->port_id);
>  
>  		dev->rx_pkt_burst = ixgbe_recv_pkts_bulk_alloc;
> -	} else {
> +	}
> +#endif
> +	else {
>  		PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions are not "
>  				    "satisfied, or Scattered Rx is requested, "
>  				    "or RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC "

This code needs some 'de-ifdef' work. It is hard to maintain as is.
I prefer having one inline function, and getting rid of all the #ifdef's
and just let the compiler eliminate dead code.

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

* [dpdk-dev] [PATCHv2] ixgbe: fix compilation issue when RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC is disabled
  2015-03-19 12:24 [dpdk-dev] [PATCH] ixgbe: fix compilation issue when RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC is disabled Pablo de Lara
  2015-03-19 15:31 ` Stephen Hemminger
@ 2015-03-20 13:59 ` Konstantin Ananyev
  2015-03-20 14:17   ` De Lara Guarch, Pablo
  1 sibling, 1 reply; 5+ messages in thread
From: Konstantin Ananyev @ 2015-03-20 13:59 UTC (permalink / raw)
  To: dev

v2:
As per comments, reorder patch a bit, to avoid reintroducing extra ifdefs.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 11 +++++++++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 42f0aa5..7b603d0 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -1170,6 +1170,17 @@ ixgbe_recv_pkts_bulk_alloc(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 	return nb_rx;
 }
+
+#else
+
+/* Stub to avoid extra ifdefs */
+static uint16_t
+ixgbe_recv_pkts_bulk_alloc(__rte_unused void *rx_queue,
+	__rte_unused struct rte_mbuf **rx_pkts, __rte_unused uint16_t nb_pkts)
+{
+	return 0;
+}
+
 #endif /* RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC */
 
 uint16_t
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
index 3937cf6..0d549a0 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
@@ -36,9 +36,9 @@
 
 
 #define RTE_PMD_IXGBE_TX_MAX_BURST 32
+#define RTE_PMD_IXGBE_RX_MAX_BURST 32
 
 #ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
-#define RTE_PMD_IXGBE_RX_MAX_BURST 32
 #define RTE_IXGBE_DESCS_PER_LOOP           4
 #elif defined(RTE_IXGBE_INC_VECTOR)
 #define RTE_IXGBE_DESCS_PER_LOOP           4
-- 
1.8.5.3

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

* Re: [dpdk-dev] [PATCHv2] ixgbe: fix compilation issue when RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC is disabled
  2015-03-20 13:59 ` [dpdk-dev] [PATCHv2] " Konstantin Ananyev
@ 2015-03-20 14:17   ` De Lara Guarch, Pablo
  2015-03-20 21:34     ` Thomas Monjalon
  0 siblings, 1 reply; 5+ messages in thread
From: De Lara Guarch, Pablo @ 2015-03-20 14:17 UTC (permalink / raw)
  To: Ananyev, Konstantin, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Konstantin
> Ananyev
> Sent: Friday, March 20, 2015 2:00 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCHv2] ixgbe: fix compilation issue when
> RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC is disabled
> 
> v2:
> As per comments, reorder patch a bit, to avoid reintroducing extra ifdefs.
> 
> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

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

* Re: [dpdk-dev] [PATCHv2] ixgbe: fix compilation issue when RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC is disabled
  2015-03-20 14:17   ` De Lara Guarch, Pablo
@ 2015-03-20 21:34     ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2015-03-20 21:34 UTC (permalink / raw)
  To: Ananyev, Konstantin; +Cc: dev

> > v2:
> > As per comments, reorder patch a bit, to avoid reintroducing extra ifdefs.
> > 
> > Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Fixes: 01fa1d6215fa ("ixgbe: unify Rx setup")

Applied, thanks

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

end of thread, other threads:[~2015-03-20 21:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-19 12:24 [dpdk-dev] [PATCH] ixgbe: fix compilation issue when RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC is disabled Pablo de Lara
2015-03-19 15:31 ` Stephen Hemminger
2015-03-20 13:59 ` [dpdk-dev] [PATCHv2] " Konstantin Ananyev
2015-03-20 14:17   ` De Lara Guarch, Pablo
2015-03-20 21:34     ` Thomas Monjalon

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