Skip to content

Commit db5db1a

Browse files
Angus Chenmstsirkin
authored andcommitted
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: 2ddae77 ("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>
1 parent f76349c commit db5db1a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/vdpa/ifcvf/ifcvf_base.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ u16 ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid)
323323
u32 q_pair_id;
324324

325325
ifcvf_lm = (struct ifcvf_lm_cfg __iomem *)hw->lm_cfg;
326-
q_pair_id = qid / hw->nr_vring;
326+
q_pair_id = qid / 2;
327327
avail_idx_addr = &ifcvf_lm->vring_lm_cfg[q_pair_id].idx_addr[qid % 2];
328328
last_avail_idx = vp_ioread16(avail_idx_addr);
329329

@@ -337,7 +337,7 @@ int ifcvf_set_vq_state(struct ifcvf_hw *hw, u16 qid, u16 num)
337337
u32 q_pair_id;
338338

339339
ifcvf_lm = (struct ifcvf_lm_cfg __iomem *)hw->lm_cfg;
340-
q_pair_id = qid / hw->nr_vring;
340+
q_pair_id = qid / 2;
341341
avail_idx_addr = &ifcvf_lm->vring_lm_cfg[q_pair_id].idx_addr[qid % 2];
342342
hw->vring[qid].last_avail_idx = num;
343343
vp_iowrite16(num, avail_idx_addr);

0 commit comments

Comments
 (0)