From: Xueming Li Date: Thu, 2 Dec 2021 13:50:45 +0000 (+0800) Subject: net/virtio: fix Tx queue 0 overriden by queue 128 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=8a886e573af9d25be33e333e9f5cfb48ddd3646c;p=dpdk.git net/virtio: fix Tx queue 0 overriden by queue 128 Both Rx queue and Tx queue are VirtQ in virtio, VQ index is 256 for Tx queue 128. Uint8 type of TxQ VQ index overflows and overrides Tx queue 0 data. This patch fixes VQ index type with uint16 type. Fixes: c1f86306a026 ("virtio: add new driver") Cc: stable@dpdk.org Signed-off-by: Xueming Li Reviewed-by: Maxime Coquelin --- diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index b39dd92d1b..4795893ec7 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -814,7 +814,7 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev, unsigned int socket_id __rte_unused, const struct rte_eth_txconf *tx_conf) { - uint8_t vq_idx = 2 * queue_idx + VTNET_SQ_TQ_QUEUE_IDX; + uint16_t vq_idx = 2 * queue_idx + VTNET_SQ_TQ_QUEUE_IDX; struct virtio_hw *hw = dev->data->dev_private; struct virtqueue *vq = hw->vqs[vq_idx]; struct virtnet_tx *txvq; @@ -858,7 +858,7 @@ int virtio_dev_tx_queue_setup_finish(struct rte_eth_dev *dev, uint16_t queue_idx) { - uint8_t vq_idx = 2 * queue_idx + VTNET_SQ_TQ_QUEUE_IDX; + uint16_t vq_idx = 2 * queue_idx + VTNET_SQ_TQ_QUEUE_IDX; struct virtio_hw *hw = dev->data->dev_private; struct virtqueue *vq = hw->vqs[vq_idx];