Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vdpa/ifcvf: fix the calculation of queuepair

The q_pair_id to address a queue pair in the lm bar should be
calculated by queue_id / 2 rather than queue_id / nr_vring.

Fixes: 2ddae773c93b ("vDPA/ifcvf: detect and use the onboard number of queues directly")
Signed-off-by: Angus Chen <angus.chen@jaguarmicro.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Zhu Lingshan <lingshan.zhu@intel.com>
Message-Id: <20220923091013.191-1-angus.chen@jaguarmicro.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

authored by

Angus Chen and committed by
Michael S. Tsirkin
db5db1a0 f76349cf

+2 -2
+2 -2
drivers/vdpa/ifcvf/ifcvf_base.c
··· 323 323 u32 q_pair_id; 324 324 325 325 ifcvf_lm = (struct ifcvf_lm_cfg __iomem *)hw->lm_cfg; 326 - q_pair_id = qid / hw->nr_vring; 326 + q_pair_id = qid / 2; 327 327 avail_idx_addr = &ifcvf_lm->vring_lm_cfg[q_pair_id].idx_addr[qid % 2]; 328 328 last_avail_idx = vp_ioread16(avail_idx_addr); 329 329 ··· 337 337 u32 q_pair_id; 338 338 339 339 ifcvf_lm = (struct ifcvf_lm_cfg __iomem *)hw->lm_cfg; 340 - q_pair_id = qid / hw->nr_vring; 340 + q_pair_id = qid / 2; 341 341 avail_idx_addr = &ifcvf_lm->vring_lm_cfg[q_pair_id].idx_addr[qid % 2]; 342 342 hw->vring[qid].last_avail_idx = num; 343 343 vp_iowrite16(num, avail_idx_addr);