aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/gve
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/gve')
-rw-r--r--sys/dev/gve/gve.h4
-rw-r--r--sys/dev/gve/gve_adminq.c47
-rw-r--r--sys/dev/gve/gve_qpl.c14
-rw-r--r--sys/dev/gve/gve_tx.c4
4 files changed, 48 insertions, 21 deletions
diff --git a/sys/dev/gve/gve.h b/sys/dev/gve/gve.h
index 64c2a0481817..1a163cfcbce0 100644
--- a/sys/dev/gve/gve.h
+++ b/sys/dev/gve/gve.h
@@ -166,7 +166,7 @@ struct gve_queue_page_list {
uint32_t id;
uint32_t num_dmas;
uint32_t num_pages;
- vm_offset_t kva;
+ char *kva;
vm_page_t *pages;
struct gve_dma_handle *dmas;
};
@@ -350,7 +350,7 @@ struct gve_rx_ring {
* uses it.
*/
struct gve_tx_fifo {
- vm_offset_t base; /* address of base of FIFO */
+ char *base; /* address of base of FIFO */
uint32_t size; /* total size */
volatile int available; /* how much space is still available */
uint32_t head; /* offset to write at */
diff --git a/sys/dev/gve/gve_adminq.c b/sys/dev/gve/gve_adminq.c
index 9b59570a2af4..43952308098b 100644
--- a/sys/dev/gve/gve_adminq.c
+++ b/sys/dev/gve/gve_adminq.c
@@ -214,6 +214,9 @@ gve_process_device_options(struct gve_priv *priv,
return (0);
}
+static int gve_adminq_issue_cmd(struct gve_priv *priv,
+ struct gve_adminq_command *cmd);
+static int gve_adminq_kick_and_wait(struct gve_priv *priv);
static int gve_adminq_execute_cmd(struct gve_priv *priv,
struct gve_adminq_command *cmd);
@@ -225,7 +228,7 @@ gve_adminq_destroy_tx_queue(struct gve_priv *priv, uint32_t id)
cmd.opcode = htobe32(GVE_ADMINQ_DESTROY_TX_QUEUE);
cmd.destroy_tx_queue.queue_id = htobe32(id);
- return (gve_adminq_execute_cmd(priv, &cmd));
+ return (gve_adminq_issue_cmd(priv, &cmd));
}
static int
@@ -236,7 +239,7 @@ gve_adminq_destroy_rx_queue(struct gve_priv *priv, uint32_t id)
cmd.opcode = htobe32(GVE_ADMINQ_DESTROY_RX_QUEUE);
cmd.destroy_rx_queue.queue_id = htobe32(id);
- return (gve_adminq_execute_cmd(priv, &cmd));
+ return (gve_adminq_issue_cmd(priv, &cmd));
}
int
@@ -248,13 +251,18 @@ gve_adminq_destroy_rx_queues(struct gve_priv *priv, uint32_t num_queues)
for (i = 0; i < num_queues; i++) {
err = gve_adminq_destroy_rx_queue(priv, i);
if (err != 0) {
- device_printf(priv->dev, "Failed to destroy rxq %d, err: %d\n",
+ device_printf(priv->dev, "Failed to issue destroy rxq %d, err: %d\n",
i, err);
+ return (err);
}
}
- if (err != 0)
+ err = gve_adminq_kick_and_wait(priv);
+ if (err != 0) {
+ device_printf(priv->dev, "Failed to batch destroy rx queues, err: %d\n",
+ err);
return (err);
+ }
device_printf(priv->dev, "Destroyed %d rx queues\n", num_queues);
return (0);
@@ -269,13 +277,18 @@ gve_adminq_destroy_tx_queues(struct gve_priv *priv, uint32_t num_queues)
for (i = 0; i < num_queues; i++) {
err = gve_adminq_destroy_tx_queue(priv, i);
if (err != 0) {
- device_printf(priv->dev, "Failed to destroy txq %d, err: %d\n",
+ device_printf(priv->dev, "Failed to issue destroy txq %d, err: %d\n",
i, err);
+ return (err);
}
}
- if (err != 0)
+ err = gve_adminq_kick_and_wait(priv);
+ if (err != 0) {
+ device_printf(priv->dev, "Failed to batch destroy tx queues, err: %d\n",
+ err);
return (err);
+ }
device_printf(priv->dev, "Destroyed %d tx queues\n", num_queues);
return (0);
@@ -325,7 +338,7 @@ gve_adminq_create_rx_queue(struct gve_priv *priv, uint32_t queue_index)
htobe16(priv->rx_buf_size_dqo);
}
- return (gve_adminq_execute_cmd(priv, &cmd));
+ return (gve_adminq_issue_cmd(priv, &cmd));
}
int
@@ -337,12 +350,19 @@ gve_adminq_create_rx_queues(struct gve_priv *priv, uint32_t num_queues)
for (i = 0; i < num_queues; i++) {
err = gve_adminq_create_rx_queue(priv, i);
if (err != 0) {
- device_printf(priv->dev, "Failed to create rxq %d, err: %d\n",
+ device_printf(priv->dev, "Failed to issue create rxq %d, err: %d\n",
i, err);
goto abort;
}
}
+ err = gve_adminq_kick_and_wait(priv);
+ if (err != 0) {
+ device_printf(priv->dev, "Failed to batch create rx queues, err: %d\n",
+ err);
+ goto abort;
+ }
+
if (bootverbose)
device_printf(priv->dev, "Created %d rx queues\n", num_queues);
return (0);
@@ -381,7 +401,7 @@ gve_adminq_create_tx_queue(struct gve_priv *priv, uint32_t queue_index)
cmd.create_tx_queue.tx_comp_ring_size =
htobe16(priv->tx_desc_cnt);
}
- return (gve_adminq_execute_cmd(priv, &cmd));
+ return (gve_adminq_issue_cmd(priv, &cmd));
}
int
@@ -393,12 +413,19 @@ gve_adminq_create_tx_queues(struct gve_priv *priv, uint32_t num_queues)
for (i = 0; i < num_queues; i++) {
err = gve_adminq_create_tx_queue(priv, i);
if (err != 0) {
- device_printf(priv->dev, "Failed to create txq %d, err: %d\n",
+ device_printf(priv->dev, "Failed to issue create txq %d, err: %d\n",
i, err);
goto abort;
}
}
+ err = gve_adminq_kick_and_wait(priv);
+ if (err != 0) {
+ device_printf(priv->dev, "Failed to batch create tx queues, err: %d\n",
+ err);
+ goto abort;
+ }
+
if (bootverbose)
device_printf(priv->dev, "Created %d tx queues\n", num_queues);
return (0);
diff --git a/sys/dev/gve/gve_qpl.c b/sys/dev/gve/gve_qpl.c
index 0e7098dcd4a1..1f153d08c126 100644
--- a/sys/dev/gve/gve_qpl.c
+++ b/sys/dev/gve/gve_qpl.c
@@ -59,8 +59,8 @@ gve_free_qpl(struct gve_priv *priv, struct gve_queue_page_list *qpl)
*/
if (vm_page_unwire_noq(qpl->pages[i])) {
if (!qpl->kva) {
- pmap_qremove((vm_offset_t)qpl->dmas[i].cpu_addr, 1);
- kva_free((vm_offset_t)qpl->dmas[i].cpu_addr, PAGE_SIZE);
+ pmap_qremove(qpl->dmas[i].cpu_addr, 1);
+ kva_free(qpl->dmas[i].cpu_addr, PAGE_SIZE);
}
vm_page_free(qpl->pages[i]);
}
@@ -104,7 +104,7 @@ gve_alloc_qpl(struct gve_priv *priv, uint32_t id, int npages, bool single_kva)
qpl->pages = malloc(npages * sizeof(*qpl->pages), M_GVE_QPL,
M_WAITOK | M_ZERO);
- qpl->kva = 0;
+ qpl->kva = NULL;
if (single_kva) {
qpl->kva = kva_alloc(PAGE_SIZE * npages);
if (!qpl->kva) {
@@ -120,15 +120,15 @@ gve_alloc_qpl(struct gve_priv *priv, uint32_t id, int npages, bool single_kva)
VM_ALLOC_ZERO);
if (!single_kva) {
- qpl->dmas[i].cpu_addr = (void *)kva_alloc(PAGE_SIZE);
+ qpl->dmas[i].cpu_addr = kva_alloc(PAGE_SIZE);
if (!qpl->dmas[i].cpu_addr) {
device_printf(priv->dev, "Failed to create kva for page %d in QPL %d", i, id);
err = ENOMEM;
goto abort;
}
- pmap_qenter((vm_offset_t)qpl->dmas[i].cpu_addr, &(qpl->pages[i]), 1);
+ pmap_qenter(qpl->dmas[i].cpu_addr, &(qpl->pages[i]), 1);
} else
- qpl->dmas[i].cpu_addr = (void *)(qpl->kva + (PAGE_SIZE * i));
+ qpl->dmas[i].cpu_addr = qpl->kva + (PAGE_SIZE * i);
qpl->num_pages++;
@@ -244,7 +244,7 @@ void
gve_mextadd_free(struct mbuf *mbuf)
{
vm_page_t page = (vm_page_t)mbuf->m_ext.ext_arg1;
- vm_offset_t va = (vm_offset_t)mbuf->m_ext.ext_arg2;
+ void *va = mbuf->m_ext.ext_arg2;
/*
* Free the page only if this is the last ref.
diff --git a/sys/dev/gve/gve_tx.c b/sys/dev/gve/gve_tx.c
index 84e3a4c4eb9f..5e0611e1d6e4 100644
--- a/sys/dev/gve/gve_tx.c
+++ b/sys/dev/gve/gve_tx.c
@@ -735,7 +735,7 @@ gve_xmit(struct gve_tx_ring *tx, struct mbuf *mbuf)
pkt_len);
m_copydata(mbuf, 0, first_seg_len,
- (char *)tx->fifo.base + info->iov[hdr_nfrags - 1].iov_offset);
+ tx->fifo.base + info->iov[hdr_nfrags - 1].iov_offset);
gve_dma_sync_for_device(tx->com.qpl,
info->iov[hdr_nfrags - 1].iov_offset,
info->iov[hdr_nfrags - 1].iov_len);
@@ -755,7 +755,7 @@ gve_xmit(struct gve_tx_ring *tx, struct mbuf *mbuf)
info->iov[i].iov_offset, is_ipv6, l3_off, tso_mss);
m_copydata(mbuf, copy_offset, info->iov[i].iov_len,
- (char *)tx->fifo.base + info->iov[i].iov_offset);
+ tx->fifo.base + info->iov[i].iov_offset);
gve_dma_sync_for_device(tx->com.qpl,
info->iov[i].iov_offset, info->iov[i].iov_len);
copy_offset += info->iov[i].iov_len;