[dpdk-dev] [PATCH] ixgbe: change logging for ixgbe tx code path selection

Bruce Richardson bruce.richardson at intel.com
Tue Oct 27 12:50:03 CET 2015


On Tue, Oct 27, 2015 at 11:41:08AM +0000, Kevin Traynor wrote:
> Simple and vector are different tx code paths. If vector
> is selected, change logging from:
> PMD: ixgbe_set_tx_function(): Using simple tx code path
> PMD: ixgbe_set_tx_function(): Vector tx enabled.
> 
> to:
> PMD: ixgbe_set_tx_function(): Using vector tx code path
> 
> or, if simple selected:
> PMD: ixgbe_set_tx_function(): Using simple tx code path
> 
> The dangling else in the #ifdef makes readability difficult,
> so resolving in way that seems most readable.
> 
> Signed-off-by: Kevin Traynor <kevin.traynor at intel.com>
> ---
>  drivers/net/ixgbe/ixgbe_rxtx.c |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
> index a598a72..11d7feb 100644
> --- a/drivers/net/ixgbe/ixgbe_rxtx.c
> +++ b/drivers/net/ixgbe/ixgbe_rxtx.c
> @@ -1963,16 +1963,18 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq)
>  	/* Use a simple Tx queue (no offloads, no multi segs) if possible */
>  	if (((txq->txq_flags & IXGBE_SIMPLE_FLAGS) == IXGBE_SIMPLE_FLAGS)
>  			&& (txq->tx_rs_thresh >= RTE_PMD_IXGBE_TX_MAX_BURST)) {
> -		PMD_INIT_LOG(DEBUG, "Using simple tx code path");
>  #ifdef RTE_IXGBE_INC_VECTOR
>  		if (txq->tx_rs_thresh <= RTE_IXGBE_TX_MAX_FREE_BUF_SZ &&
>  				(rte_eal_process_type() != RTE_PROC_PRIMARY ||
>  					ixgbe_txq_vec_setup(txq) == 0)) {
> -			PMD_INIT_LOG(DEBUG, "Vector tx enabled.");
> +			PMD_INIT_LOG(DEBUG, "Using vector tx code path");
>  			dev->tx_pkt_burst = ixgbe_xmit_pkts_vec;
>  		} else
>  #endif
> -		dev->tx_pkt_burst = ixgbe_xmit_pkts_simple;
> +		{
> +			PMD_INIT_LOG(DEBUG, "Using simple tx code path");
> +			dev->tx_pkt_burst = ixgbe_xmit_pkts_simple;
> +		}
>  	} else {
>  		PMD_INIT_LOG(DEBUG, "Using full-featured tx code path");
>  		PMD_INIT_LOG(DEBUG,
> -- 
> 1.7.4.1
> 
Hi Kevin,

can I suggest a slight alternative here that might help make things easier.
Instead of printing the message as we pick the code path, why not have a "logmsg"
pointer variable that is assigned in the code, and then print out the log path
at the end.

This would have a number of advantages:
1. there are no issues with changing our mind, so we can assign one path type, 
and then later change it to something different without cluttering up the debug
output with the history of our code's flow.
2. it means that you don't have a problem with smaller else legs as you can
easily do multiple assignments in the one line using a comma as:
	dev->tx_pkt_burst = ixgbe_xmit_pkts_simple, logmsg = "Using simple ...";

Regards,
/Bruce


More information about the dev mailing list