DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/virtio: fix Tx queue 0 override by queue 128
@ 2021-12-02 13:50 Xueming Li
  2022-01-26 13:21 ` Maxime Coquelin
  2022-01-27  5:12 ` Xia, Chenbo
  0 siblings, 2 replies; 3+ messages in thread
From: Xueming Li @ 2021-12-02 13:50 UTC (permalink / raw)
  To: dev; +Cc: xuemingl, stable, Maxime Coquelin, Chenbo Xia

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 <xuemingl@nvidia.com>
---
 drivers/net/virtio/virtio_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 2e115ded023..f0eafd29dc1 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];
 
-- 
2.34.0


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

* Re: [PATCH] net/virtio: fix Tx queue 0 override by queue 128
  2021-12-02 13:50 [PATCH] net/virtio: fix Tx queue 0 override by queue 128 Xueming Li
@ 2022-01-26 13:21 ` Maxime Coquelin
  2022-01-27  5:12 ` Xia, Chenbo
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2022-01-26 13:21 UTC (permalink / raw)
  To: Xueming Li, dev; +Cc: stable, Chenbo Xia



On 12/2/21 14:50, Xueming Li wrote:
> 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 <xuemingl@nvidia.com>
> ---
>   drivers/net/virtio/virtio_rxtx.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
> index 2e115ded023..f0eafd29dc1 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];
>   

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks for the fix!
Maxime


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

* RE: [PATCH] net/virtio: fix Tx queue 0 override by queue 128
  2021-12-02 13:50 [PATCH] net/virtio: fix Tx queue 0 override by queue 128 Xueming Li
  2022-01-26 13:21 ` Maxime Coquelin
@ 2022-01-27  5:12 ` Xia, Chenbo
  1 sibling, 0 replies; 3+ messages in thread
From: Xia, Chenbo @ 2022-01-27  5:12 UTC (permalink / raw)
  To: Xueming Li, dev; +Cc: stable, Maxime Coquelin

> -----Original Message-----
> From: Xueming Li <xuemingl@nvidia.com>
> Sent: Thursday, December 2, 2021 9:51 PM
> To: dev@dpdk.org
> Cc: xuemingl@nvidia.com; stable@dpdk.org; Maxime Coquelin
> <maxime.coquelin@redhat.com>; Xia, Chenbo <chenbo.xia@intel.com>
> Subject: [PATCH] net/virtio: fix Tx queue 0 override 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 <xuemingl@nvidia.com>
> ---
> --
> 2.34.0

Applied to next-virtio/main, thanks



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

end of thread, other threads:[~2022-01-27  5:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-02 13:50 [PATCH] net/virtio: fix Tx queue 0 override by queue 128 Xueming Li
2022-01-26 13:21 ` Maxime Coquelin
2022-01-27  5:12 ` Xia, Chenbo

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