Skip to content

Commit 4cf8b6d

Browse files
Zhu Lingshanmstsirkin
authored andcommitted
vDPA/ifcvf: implement new accessors for vq_state
This commit implements a better layout of the live migration bar, therefore the accessors for virtqueue state have been refactored. This commit also add a comment to the probing-ids list, indicating this driver drives F2000X-PL virtio-net Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com> Message-Id: <20230612151420.1019504-4-lingshan.zhu@intel.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
1 parent ae904d9 commit 4cf8b6d

3 files changed

Lines changed: 17 additions & 33 deletions

File tree

drivers/vdpa/ifcvf/ifcvf_base.c

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -328,30 +328,19 @@ void ifcvf_set_driver_features(struct ifcvf_hw *hw, u64 features)
328328

329329
u16 ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid)
330330
{
331-
struct ifcvf_lm_cfg __iomem *ifcvf_lm;
332-
void __iomem *avail_idx_addr;
331+
struct ifcvf_lm_cfg __iomem *lm_cfg = hw->lm_cfg;
333332
u16 last_avail_idx;
334-
u32 q_pair_id;
335333

336-
ifcvf_lm = (struct ifcvf_lm_cfg __iomem *)hw->lm_cfg;
337-
q_pair_id = qid / 2;
338-
avail_idx_addr = &ifcvf_lm->vring_lm_cfg[q_pair_id].idx_addr[qid % 2];
339-
last_avail_idx = vp_ioread16(avail_idx_addr);
334+
last_avail_idx = vp_ioread16(&lm_cfg->vq_state_region + qid * 2);
340335

341336
return last_avail_idx;
342337
}
343338

344339
int ifcvf_set_vq_state(struct ifcvf_hw *hw, u16 qid, u16 num)
345340
{
346-
struct ifcvf_lm_cfg __iomem *ifcvf_lm;
347-
void __iomem *avail_idx_addr;
348-
u32 q_pair_id;
349-
350-
ifcvf_lm = (struct ifcvf_lm_cfg __iomem *)hw->lm_cfg;
351-
q_pair_id = qid / 2;
352-
avail_idx_addr = &ifcvf_lm->vring_lm_cfg[q_pair_id].idx_addr[qid % 2];
353-
hw->vring[qid].last_avail_idx = num;
354-
vp_iowrite16(num, avail_idx_addr);
341+
struct ifcvf_lm_cfg __iomem *lm_cfg = hw->lm_cfg;
342+
343+
vp_iowrite16(num, &lm_cfg->vq_state_region + qid * 2);
355344

356345
return 0;
357346
}

drivers/vdpa/ifcvf/ifcvf_base.h

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,9 @@
2424
#define N3000_DEVICE_ID 0x1041
2525
#define N3000_SUBSYS_DEVICE_ID 0x001A
2626

27-
/* Max 8 data queue pairs(16 queues) and one control vq for now. */
28-
#define IFCVF_MAX_QUEUES 17
29-
3027
#define IFCVF_QUEUE_ALIGNMENT PAGE_SIZE
3128
#define IFCVF_PCI_MAX_RESOURCE 6
3229

33-
#define IFCVF_LM_CFG_SIZE 0x40
34-
#define IFCVF_LM_RING_STATE_OFFSET 0x20
3530
#define IFCVF_LM_BAR 4
3631

3732
#define IFCVF_ERR(pdev, fmt, ...) dev_err(&pdev->dev, fmt, ##__VA_ARGS__)
@@ -54,10 +49,18 @@ struct vring_info {
5449
char msix_name[256];
5550
};
5651

52+
struct ifcvf_lm_cfg {
53+
__le64 control;
54+
__le64 status;
55+
__le64 lm_mem_log_start_addr;
56+
__le64 lm_mem_log_end_addr;
57+
__le16 vq_state_region;
58+
};
59+
5760
struct ifcvf_hw {
5861
u8 __iomem *isr;
5962
/* Live migration */
60-
u8 __iomem *lm_cfg;
63+
struct ifcvf_lm_cfg __iomem *lm_cfg;
6164
/* Notification bar number */
6265
u8 notify_bar;
6366
u8 msix_vector_status;
@@ -92,16 +95,6 @@ struct ifcvf_adapter {
9295
struct ifcvf_hw *vf;
9396
};
9497

95-
struct ifcvf_vring_lm_cfg {
96-
u32 idx_addr[2];
97-
u8 reserved[IFCVF_LM_CFG_SIZE - 8];
98-
};
99-
100-
struct ifcvf_lm_cfg {
101-
u8 reserved[IFCVF_LM_RING_STATE_OFFSET];
102-
struct ifcvf_vring_lm_cfg vring_lm_cfg[IFCVF_MAX_QUEUES];
103-
};
104-
10598
struct ifcvf_vdpa_mgmt_dev {
10699
struct vdpa_mgmt_dev mdev;
107100
struct ifcvf_hw vf;

drivers/vdpa/ifcvf/ifcvf_main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,9 @@ static struct pci_device_id ifcvf_pci_ids[] = {
853853
N3000_DEVICE_ID,
854854
PCI_VENDOR_ID_INTEL,
855855
N3000_SUBSYS_DEVICE_ID) },
856-
/* C5000X-PL network device */
856+
/* C5000X-PL network device
857+
* F2000X-PL network device
858+
*/
857859
{ PCI_DEVICE_SUB(PCI_VENDOR_ID_REDHAT_QUMRANET,
858860
VIRTIO_TRANS_ID_NET,
859861
PCI_VENDOR_ID_INTEL,

0 commit comments

Comments
 (0)