Commit 4cf8b6d0 authored by Zhu Lingshan's avatar Zhu Lingshan Committed by Michael S. Tsirkin

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: default avatarZhu Lingshan <lingshan.zhu@intel.com>
Message-Id: <20230612151420.1019504-4-lingshan.zhu@intel.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent ae904d9c
...@@ -328,30 +328,19 @@ void ifcvf_set_driver_features(struct ifcvf_hw *hw, u64 features) ...@@ -328,30 +328,19 @@ void ifcvf_set_driver_features(struct ifcvf_hw *hw, u64 features)
u16 ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid) u16 ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid)
{ {
struct ifcvf_lm_cfg __iomem *ifcvf_lm; struct ifcvf_lm_cfg __iomem *lm_cfg = hw->lm_cfg;
void __iomem *avail_idx_addr;
u16 last_avail_idx; u16 last_avail_idx;
u32 q_pair_id;
ifcvf_lm = (struct ifcvf_lm_cfg __iomem *)hw->lm_cfg; last_avail_idx = vp_ioread16(&lm_cfg->vq_state_region + qid * 2);
q_pair_id = qid / 2;
avail_idx_addr = &ifcvf_lm->vring_lm_cfg[q_pair_id].idx_addr[qid % 2];
last_avail_idx = vp_ioread16(avail_idx_addr);
return last_avail_idx; return last_avail_idx;
} }
int ifcvf_set_vq_state(struct ifcvf_hw *hw, u16 qid, u16 num) int ifcvf_set_vq_state(struct ifcvf_hw *hw, u16 qid, u16 num)
{ {
struct ifcvf_lm_cfg __iomem *ifcvf_lm; struct ifcvf_lm_cfg __iomem *lm_cfg = hw->lm_cfg;
void __iomem *avail_idx_addr;
u32 q_pair_id; vp_iowrite16(num, &lm_cfg->vq_state_region + qid * 2);
ifcvf_lm = (struct ifcvf_lm_cfg __iomem *)hw->lm_cfg;
q_pair_id = qid / 2;
avail_idx_addr = &ifcvf_lm->vring_lm_cfg[q_pair_id].idx_addr[qid % 2];
hw->vring[qid].last_avail_idx = num;
vp_iowrite16(num, avail_idx_addr);
return 0; return 0;
} }
......
...@@ -24,14 +24,9 @@ ...@@ -24,14 +24,9 @@
#define N3000_DEVICE_ID 0x1041 #define N3000_DEVICE_ID 0x1041
#define N3000_SUBSYS_DEVICE_ID 0x001A #define N3000_SUBSYS_DEVICE_ID 0x001A
/* Max 8 data queue pairs(16 queues) and one control vq for now. */
#define IFCVF_MAX_QUEUES 17
#define IFCVF_QUEUE_ALIGNMENT PAGE_SIZE #define IFCVF_QUEUE_ALIGNMENT PAGE_SIZE
#define IFCVF_PCI_MAX_RESOURCE 6 #define IFCVF_PCI_MAX_RESOURCE 6
#define IFCVF_LM_CFG_SIZE 0x40
#define IFCVF_LM_RING_STATE_OFFSET 0x20
#define IFCVF_LM_BAR 4 #define IFCVF_LM_BAR 4
#define IFCVF_ERR(pdev, fmt, ...) dev_err(&pdev->dev, fmt, ##__VA_ARGS__) #define IFCVF_ERR(pdev, fmt, ...) dev_err(&pdev->dev, fmt, ##__VA_ARGS__)
...@@ -54,10 +49,18 @@ struct vring_info { ...@@ -54,10 +49,18 @@ struct vring_info {
char msix_name[256]; char msix_name[256];
}; };
struct ifcvf_lm_cfg {
__le64 control;
__le64 status;
__le64 lm_mem_log_start_addr;
__le64 lm_mem_log_end_addr;
__le16 vq_state_region;
};
struct ifcvf_hw { struct ifcvf_hw {
u8 __iomem *isr; u8 __iomem *isr;
/* Live migration */ /* Live migration */
u8 __iomem *lm_cfg; struct ifcvf_lm_cfg __iomem *lm_cfg;
/* Notification bar number */ /* Notification bar number */
u8 notify_bar; u8 notify_bar;
u8 msix_vector_status; u8 msix_vector_status;
...@@ -92,16 +95,6 @@ struct ifcvf_adapter { ...@@ -92,16 +95,6 @@ struct ifcvf_adapter {
struct ifcvf_hw *vf; struct ifcvf_hw *vf;
}; };
struct ifcvf_vring_lm_cfg {
u32 idx_addr[2];
u8 reserved[IFCVF_LM_CFG_SIZE - 8];
};
struct ifcvf_lm_cfg {
u8 reserved[IFCVF_LM_RING_STATE_OFFSET];
struct ifcvf_vring_lm_cfg vring_lm_cfg[IFCVF_MAX_QUEUES];
};
struct ifcvf_vdpa_mgmt_dev { struct ifcvf_vdpa_mgmt_dev {
struct vdpa_mgmt_dev mdev; struct vdpa_mgmt_dev mdev;
struct ifcvf_hw vf; struct ifcvf_hw vf;
......
...@@ -853,7 +853,9 @@ static struct pci_device_id ifcvf_pci_ids[] = { ...@@ -853,7 +853,9 @@ static struct pci_device_id ifcvf_pci_ids[] = {
N3000_DEVICE_ID, N3000_DEVICE_ID,
PCI_VENDOR_ID_INTEL, PCI_VENDOR_ID_INTEL,
N3000_SUBSYS_DEVICE_ID) }, N3000_SUBSYS_DEVICE_ID) },
/* C5000X-PL network device */ /* C5000X-PL network device
* F2000X-PL network device
*/
{ PCI_DEVICE_SUB(PCI_VENDOR_ID_REDHAT_QUMRANET, { PCI_DEVICE_SUB(PCI_VENDOR_ID_REDHAT_QUMRANET,
VIRTIO_TRANS_ID_NET, VIRTIO_TRANS_ID_NET,
PCI_VENDOR_ID_INTEL, PCI_VENDOR_ID_INTEL,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment