aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2019-04-30 17:25:26 +0200
committerDamjan Marion <dmarion@me.com>2019-05-01 18:12:43 +0000
commit43b512cac2240cd679341a3bc01d548c573b8a85 (patch)
treeeedbc4c059ce494a8f3ea6f4314c2af57f9524b3 /src
parenteecdf93aeaf59e65dfeb57cdeae75ff9675d9c0f (diff)
virtio: remove configurable queue size support
Native virtio device through legacy driver can't support configurable queue size. Change-Id: I76c446a071bef8a469873010325d830586aa84bd Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vat/api_format.c2
-rw-r--r--src/vnet/devices/virtio/cli.c7
-rw-r--r--src/vnet/devices/virtio/pci.c55
-rw-r--r--src/vnet/devices/virtio/pci.h2
-rw-r--r--src/vnet/devices/virtio/virtio.api2
-rw-r--r--src/vnet/devices/virtio/virtio_api.c2
-rw-r--r--src/vpp/api/custom_dump.c4
7 files changed, 27 insertions, 47 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index bff81567c6c..d2c125d5f72 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -7732,8 +7732,6 @@ api_virtio_pci_create (vat_main_t * vam)
mp->pci_addr = htonl (pci_addr);
mp->features = clib_host_to_net_u64 (features);
- mp->rx_ring_sz = htons (rx_ring_sz);
- mp->tx_ring_sz = htons (tx_ring_sz);
if (random_mac == 0)
clib_memcpy (mp->mac_address, mac_address, 6);
diff --git a/src/vnet/devices/virtio/cli.c b/src/vnet/devices/virtio/cli.c
index 92e7e93831a..956284c9716 100644
--- a/src/vnet/devices/virtio/cli.c
+++ b/src/vnet/devices/virtio/cli.c
@@ -29,7 +29,6 @@ virtio_pci_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
{
unformat_input_t _line_input, *line_input = &_line_input;
virtio_pci_create_if_args_t args;
- u32 tmp;
u64 feature_mask = (u64) ~ (0ULL);
/* Get a line of input. */
@@ -43,10 +42,6 @@ virtio_pci_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
;
else if (unformat (line_input, "feature-mask 0x%llx", &feature_mask))
args.features = feature_mask;
- else if (unformat (line_input, "rx-queue-size %u", &tmp))
- args.rxq_size = tmp;
- else if (unformat (line_input, "tx-queue-size %u", &tmp))
- args.txq_size = tmp;
else
return clib_error_return (0, "unknown input `%U'",
format_unformat_error, input);
@@ -62,7 +57,7 @@ virtio_pci_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
VLIB_CLI_COMMAND (virtio_pci_create_command, static) = {
.path = "create interface virtio",
.short_help = "create interface virtio <pci-address> "
- "[feature-mask <hex-mask>] [rx-queue-size <size>] [tx-queue-size <size>]",
+ "[feature-mask <hex-mask>]",
.function = virtio_pci_create_command_fn,
};
/* *INDENT-ON* */
diff --git a/src/vnet/devices/virtio/pci.c b/src/vnet/devices/virtio/pci.c
index 31027f7f687..b02b79d385b 100644
--- a/src/vnet/devices/virtio/pci.c
+++ b/src/vnet/devices/virtio/pci.c
@@ -177,16 +177,21 @@ virtio_pci_legacy_get_queue_num (vlib_main_t * vm, virtio_if_t * vif,
return queue_num;
}
-
-static void
+static int
virtio_pci_legacy_setup_queue (vlib_main_t * vm, virtio_if_t * vif,
u16 queue_id, void *p)
{
u64 addr = vlib_physmem_get_pa (vm, p) >> VIRTIO_PCI_QUEUE_ADDR_SHIFT;
+ u32 addr2 = 0;
vlib_pci_write_io_u16 (vm, vif->pci_dev_handle, VIRTIO_PCI_QUEUE_SEL,
&queue_id);
vlib_pci_write_io_u32 (vm, vif->pci_dev_handle, VIRTIO_PCI_QUEUE_PFN,
(u32 *) & addr);
+ vlib_pci_read_io_u32 (vm, vif->pci_dev_handle, VIRTIO_PCI_QUEUE_PFN,
+ &addr2);
+ if ((u32) addr == addr2)
+ return 0;
+ return 1;
}
static void
@@ -693,20 +698,19 @@ virtio_pci_vring_init (vlib_main_t * vm, virtio_if_t * vif, u16 queue_num)
queue_size - n_alloc);
}
while (n_alloc != queue_size);
- vif->num_txqs++;
virtio_log_debug (vim, vif, "tx-queue: number %u, size %u", queue_num,
queue_size);
}
else
{
- vif->num_rxqs++;
virtio_log_debug (vim, vif, "rx-queue: number %u, size %u", queue_num,
queue_size);
}
vring->size = queue_size;
- virtio_pci_legacy_setup_queue (vm, vif, queue_num, ptr);
- vring->kick_fd = -1;
+ if (virtio_pci_legacy_setup_queue (vm, vif, queue_num, ptr))
+ return clib_error_return (0, "error in queue address setup");
+ vring->kick_fd = -1;
return error;
}
@@ -949,12 +953,24 @@ virtio_pci_device_init (vlib_main_t * vm, virtio_if_t * vif,
for (int i = 0; i < vif->max_queue_pairs; i++)
{
if ((error = virtio_pci_vring_init (vm, vif, RX_QUEUE (i))))
- virtio_log_warning (vim, vif, "%s (%u) %s", "error in rxq-queue",
- RX_QUEUE (i), "initialization");
+ {
+ virtio_log_warning (vim, vif, "%s (%u) %s", "error in rxq-queue",
+ RX_QUEUE (i), "initialization");
+ }
+ else
+ {
+ vif->num_rxqs++;
+ }
if ((error = virtio_pci_vring_init (vm, vif, TX_QUEUE (i))))
- virtio_log_warning (vim, vif, "%s (%u) %s", "error in txq-queue",
- TX_QUEUE (i), "initialization");
+ {
+ virtio_log_warning (vim, vif, "%s (%u) %s", "error in txq-queue",
+ TX_QUEUE (i), "initialization");
+ }
+ else
+ {
+ vif->num_txqs++;
+ }
}
if (vif->features & VIRTIO_FEATURE (VIRTIO_NET_F_CTRL_VQ))
@@ -1006,25 +1022,6 @@ virtio_pci_create_if (vlib_main_t * vm, virtio_pci_create_if_args_t * args)
vlib_pci_dev_handle_t h;
clib_error_t *error = 0;
- if (args->rxq_size == 0)
- args->rxq_size = VIRTIO_NUM_RX_DESC;
- if (args->txq_size == 0)
- args->txq_size = VIRTIO_NUM_TX_DESC;
-
- if (!virtio_pci_queue_size_valid (args->rxq_size) ||
- !virtio_pci_queue_size_valid (args->txq_size))
- {
- args->rv = VNET_API_ERROR_INVALID_VALUE;
- args->error =
- clib_error_return (error,
- "queue size must be <= 4096, >= 64, "
- "and multiples of 64");
- vlib_log (VLIB_LOG_LEVEL_ERR, vim->log_default, "%U: %s",
- format_vlib_pci_addr, &args->addr,
- "queue size must be <= 4096, >= 64, and multiples of 64");
- return;
- }
-
/* *INDENT-OFF* */
pool_foreach (vif, vim->interfaces, ({
if (vif->pci_addr.as_u32 == args->addr)
diff --git a/src/vnet/devices/virtio/pci.h b/src/vnet/devices/virtio/pci.h
index 40648c85c3e..dcf9b146463 100644
--- a/src/vnet/devices/virtio/pci.h
+++ b/src/vnet/devices/virtio/pci.h
@@ -227,8 +227,6 @@ typedef struct
typedef struct
{
u32 addr;
- u16 rxq_size;
- u16 txq_size;
/* return */
i32 rv;
u32 sw_if_index;
diff --git a/src/vnet/devices/virtio/virtio.api b/src/vnet/devices/virtio/virtio.api
index cb672960afd..3a40fa9a952 100644
--- a/src/vnet/devices/virtio/virtio.api
+++ b/src/vnet/devices/virtio/virtio.api
@@ -33,8 +33,6 @@ define virtio_pci_create
u32 pci_addr;
u8 use_random_mac;
u8 mac_address[6];
- u16 tx_ring_sz; /* optional, default is 256 entries, must be power of 2 */
- u16 rx_ring_sz; /* optional, default is 256 entries, must be power of 2 */
u64 features;
};
diff --git a/src/vnet/devices/virtio/virtio_api.c b/src/vnet/devices/virtio/virtio_api.c
index ff123ae081c..82ff791a866 100644
--- a/src/vnet/devices/virtio/virtio_api.c
+++ b/src/vnet/devices/virtio/virtio_api.c
@@ -65,8 +65,6 @@ vl_api_virtio_pci_create_t_handler (vl_api_virtio_pci_create_t * mp)
clib_memcpy (ap->mac_addr, mp->mac_address, 6);
ap->mac_addr_set = 1;
}
- ap->rxq_size = ntohs (mp->rx_ring_sz);
- ap->txq_size = ntohs (mp->tx_ring_sz);
ap->sw_if_index = (u32) ~ 0;
ap->features = clib_net_to_host_u64 (mp->features);
diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c
index 5f6ba063bac..622bd66a02c 100644
--- a/src/vpp/api/custom_dump.c
+++ b/src/vpp/api/custom_dump.c
@@ -612,10 +612,6 @@ static void *vl_api_virtio_pci_create_t_print
if (memcmp (mp->mac_address, null_mac, 6))
s = format (s, "mac-address %U ",
format_ethernet_address, mp->mac_address);
- if (mp->tx_ring_sz)
- s = format (s, "tx-ring-size %u ", ntohs (mp->tx_ring_sz));
- if (mp->rx_ring_sz)
- s = format (s, "rx-ring-size %u ", ntohs (mp->rx_ring_sz));
if (mp->features)
s = format (s, "features 0x%llx ", clib_net_to_host_u64 (mp->features));
FINISH;