Skip to content

Commit bffdf04

Browse files
Angus Chengregkh
authored andcommitted
vdpa/ifcvf: fix the calculation of queuepair
[ Upstream commit db5db1a ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 9f9687b commit bffdf04

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
@@ -315,7 +315,7 @@ u16 ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid)
315315
u32 q_pair_id;
316316

317317
ifcvf_lm = (struct ifcvf_lm_cfg __iomem *)hw->lm_cfg;
318-
q_pair_id = qid / hw->nr_vring;
318+
q_pair_id = qid / 2;
319319
avail_idx_addr = &ifcvf_lm->vring_lm_cfg[q_pair_id].idx_addr[qid % 2];
320320
last_avail_idx = vp_ioread16(avail_idx_addr);
321321

@@ -329,7 +329,7 @@ int ifcvf_set_vq_state(struct ifcvf_hw *hw, u16 qid, u16 num)
329329
u32 q_pair_id;
330330

331331
ifcvf_lm = (struct ifcvf_lm_cfg __iomem *)hw->lm_cfg;
332-
q_pair_id = qid / hw->nr_vring;
332+
q_pair_id = qid / 2;
333333
avail_idx_addr = &ifcvf_lm->vring_lm_cfg[q_pair_id].idx_addr[qid % 2];
334334
hw->vring[qid].last_avail_idx = num;
335335
vp_iowrite16(num, avail_idx_addr);

0 commit comments

Comments
 (0)