vdpa/ifc: set max queues based on virtio spec
Set max_queues according to virtio spec. For virtio BLK device, set max_queues to the value of num_queues in struct virtio_blk_config. For virtio NET device, read num_queues from struct ifcvf_pci_common_cfg, get the queue pair number using num_queues and set max_queues to it. Signed-off-by: Andy Pei <andy.pei@intel.com> Signed-off-by: Huang Wei <wei.huang@intel.com> Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
This commit is contained in:
parent
b6b19e23e4
commit
b97f361cbf
@ -21,7 +21,7 @@
|
||||
#define IFCVF_SUBSYS_NET_DEVICE_ID 0x0001
|
||||
#define IFCVF_SUBSYS_BLK_DEVICE_ID 0x0002
|
||||
|
||||
#define IFCVF_MAX_QUEUES 1
|
||||
#define IFCVF_MAX_QUEUES 32
|
||||
|
||||
#ifndef VIRTIO_F_IOMMU_PLATFORM
|
||||
#define VIRTIO_F_IOMMU_PLATFORM 33
|
||||
|
@ -26,6 +26,12 @@
|
||||
|
||||
#include "base/ifcvf.h"
|
||||
|
||||
/*
|
||||
* RTE_MIN() cannot be used since braced-group within expression allowed
|
||||
* only inside a function.
|
||||
*/
|
||||
#define MIN(v1, v2) ((v1) < (v2) ? (v1) : (v2))
|
||||
|
||||
RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.vdpa.ifcvf, NOTICE);
|
||||
#define DRV_LOG(level, fmt, args...) \
|
||||
rte_log(RTE_LOG_ ## level, ifcvf_vdpa_logtype, \
|
||||
@ -1512,6 +1518,7 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
|
||||
uint64_t capacity = 0;
|
||||
uint8_t *byte;
|
||||
uint32_t i;
|
||||
uint16_t queue_pairs;
|
||||
|
||||
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
|
||||
return 0;
|
||||
@ -1559,7 +1566,6 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
|
||||
}
|
||||
|
||||
internal->configured = 0;
|
||||
internal->max_queues = IFCVF_MAX_QUEUES;
|
||||
features = ifcvf_get_features(&internal->hw);
|
||||
|
||||
device_id = ifcvf_pci_get_device_type(pci_dev);
|
||||
@ -1570,6 +1576,14 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
|
||||
|
||||
if (device_id == VIRTIO_ID_NET) {
|
||||
internal->hw.device_type = IFCVF_NET;
|
||||
/*
|
||||
* ifc device always has CTRL_VQ,
|
||||
* and supports VIRTIO_NET_F_CTRL_VQ feature.
|
||||
*/
|
||||
queue_pairs = (internal->hw.common_cfg->num_queues - 1) / 2;
|
||||
DRV_LOG(INFO, "%s support %u queue pairs", pci_dev->name,
|
||||
queue_pairs);
|
||||
internal->max_queues = MIN(IFCVF_MAX_QUEUES, queue_pairs);
|
||||
internal->features = features &
|
||||
~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
|
||||
internal->features |= dev_info[IFCVF_NET].features;
|
||||
@ -1609,6 +1623,9 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
|
||||
internal->hw.blk_cfg->geometry.sectors);
|
||||
DRV_LOG(DEBUG, "num_queues: 0x%08x",
|
||||
internal->hw.blk_cfg->num_queues);
|
||||
|
||||
internal->max_queues = MIN(IFCVF_MAX_QUEUES,
|
||||
internal->hw.blk_cfg->num_queues);
|
||||
}
|
||||
|
||||
list->internal = internal;
|
||||
|
Loading…
Reference in New Issue
Block a user