Bug 1144 - virtio may lost pkts when pmd rxq less than virtio-max_queue_pairs
Summary: virtio may lost pkts when pmd rxq less than virtio-max_queue_pairs
Status: UNCONFIRMED
Alias: None
Product: DPDK
Classification: Unclassified
Component: vhost/virtio (show other bugs)
Version: 22.11
Hardware: All All
: Normal major
Target Milestone: ---
Assignee: Maxime Coquelin
URL:
Depends on:
Blocks:
 
Reported: 2022-12-08 15:25 CET by liuxf
Modified: 2023-01-13 07:57 CET (History)
2 users (show)



Attachments
write queue register is always the same (117.38 KB, image/png)
2022-12-09 08:29 CET, liuxf
Details

Description liuxf 2022-12-08 15:25:41 CET
when virtio pmd starts, a virtio-func named modern_setup_queue will set rxq num to hw. let's suppose 4 rxqs in hw-virtio. but a dpdk-process starts use only 2 rxqs, however hw doesn't aware this, pkts will send to 4 rxqs all the same, but dpdk-process would only poll 2 rxqs which result to a pkts loss. cuz the pkts send to the other 2 unused rxqs will never be consumed.
Comment 1 liuxf 2022-12-09 08:29:21 CET
Created attachment 236 [details]
write queue register is always the same

as you can see,dpdk now always write 'max_queue_pairs' into hw, so hw will send to pkts to all rxq, but users may use only part of them which lead to a pkt loss
Comment 2 liuxf 2022-12-21 05:04:34 CET
is there anybody could help me to confirm it?
Comment 3 liuxf 2023-01-13 07:51:33 CET
this case happend when I set tx-queue and rx-queue respectively(tx-queues not equals to rx-queues). maybe not a bug, that's to say virtio only support queue pairs(tx-queues must equal to rx-queues)
Comment 4 liuxf 2023-01-13 07:57:47 CET
	/*Notify the backend
	 *Otherwise the tap backend might already stop its queue due to fullness.
	 *vhost backend will have no chance to be waked up
	 */
	nb_queues = RTE_MAX(dev->data->nb_rx_queues, dev->data->nb_tx_queues);
	if (hw->max_queue_pairs > 1) {
		if (virtio_set_multiple_queues(dev, nb_queues) != 0)
			return -EINVAL;
	}

dpdk-virtio chose the RTE_MAX between nb_rx_queues and nb_tx_queues. however user may set nb_rx_queues to 1, and set nb_tx_queues to 2.  this case dpdk-virtio notify the backend we use 2 queue-pairs. actually user only use rx-queue1, but packets will send to rx-queue1 and rx-queue2 by backend

Note You need to log in before you can comment on or make changes to this bug.