[dpdk-dev] [PATCH v2 1/3] virtio: conditional compilation cleanup

Yuanhan Liu yuanhan.liu at linux.intel.com
Mon Jul 4 09:36:48 CEST 2016


On Fri, Jul 01, 2016 at 04:46:36PM +0530, Jerin Jacob wrote:
> @@ -494,9 +486,6 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev,
>  {
>  	uint8_t vtpci_queue_idx = 2 * queue_idx + VTNET_SQ_TQ_QUEUE_IDX;
>  
> -#ifdef RTE_MACHINE_CPUFLAG_SSSE3
> -	struct virtio_hw *hw = dev->data->dev_private;
> -#endif
>  	struct virtnet_tx *txvq;
>  	struct virtqueue *vq;
>  	uint16_t tx_free_thresh;
> @@ -511,13 +500,14 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev,
>  	}
>  
>  #ifdef RTE_MACHINE_CPUFLAG_SSSE3
> +	struct virtio_hw *hw = dev->data->dev_private;

I'd suggest to move above declaration to ...

>  	/* Use simple rx/tx func if single segment and no offloads */
>  	if ((tx_conf->txq_flags & VIRTIO_SIMPLE_FLAGS) == VIRTIO_SIMPLE_FLAGS &&
>  	     !vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {

here: we should try to avoid declaring vars in the middle of a code block.

	--yliu


More information about the dev mailing list