[dpdk-dev] [PATCH] ixgbe: fix icc compile error
Stephen Hemminger
stephen at networkplumber.org
Wed Mar 23 20:35:25 CET 2016
On Wed, 23 Mar 2016 17:45:58 +0000
Ferruh Yigit <ferruh.yigit at intel.com> wrote:
> Fixes: 06554d381d97 ("ixgbe: speed up non-vector Tx")
>
> icc (icc (ICC) 16.0.1 20151021) is generating following compile error:
> "
> CC ixgbe_rxtx.o
> .../drivers/net/ixgbe/ixgbe_rxtx.c(153): error #3656: variable
> "free" may be used before its value is set
> (nb_free > 0 && m->pool != free[0]->pool)) {
> ^
> "
>
> Indeed this is a false positive and code is correct.
> "nb_free" check prevents the free[] access before its value set.
>
> But the patch is just for compiler to remove compiler error.
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
> ---
> drivers/net/ixgbe/ixgbe_rxtx.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
> index ff6ddb8..ef1a26f 100644
> --- a/drivers/net/ixgbe/ixgbe_rxtx.c
> +++ b/drivers/net/ixgbe/ixgbe_rxtx.c
> @@ -128,7 +128,8 @@ ixgbe_tx_free_bufs(struct ixgbe_tx_queue *txq)
> struct ixgbe_tx_entry *txep;
> uint32_t status;
> int i, nb_free = 0;
> - struct rte_mbuf *m, *free[RTE_IXGBE_TX_MAX_FREE_BUF_SZ];
> + struct rte_mbuf *m;
> + struct rte_mbuf *free[RTE_IXGBE_TX_MAX_FREE_BUF_SZ] = {0};
>
> /* check DD bit on threshold descriptor */
> status = txq->tx_ring[txq->tx_next_dd].wb.status;
Although this fixes a compiler bug, it also introduces a performance hit.
The initialization will generate a string instruct (rep; stosz) and this
stalls the multi-execution unit on many Intel CPU's.
Better to add a override to the Makefile (for icc only and with big comment).
More information about the dev
mailing list