aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/avf
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/avf')
-rw-r--r--src/plugins/avf/device.c9
-rw-r--r--src/plugins/avf/input.c40
-rw-r--r--src/plugins/avf/output.c36
3 files changed, 40 insertions, 45 deletions
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c
index 71105e88677..c23746be1b2 100644
--- a/src/plugins/avf/device.c
+++ b/src/plugins/avf/device.c
@@ -240,14 +240,11 @@ avf_rxq_init (vlib_main_t * vm, avf_device_t * ad, u16 qid, u16 rxq_size)
avf_rx_desc_t *d = rxq->descs;
for (i = 0; i < n_alloc; i++)
{
+ vlib_buffer_t *b = vlib_get_buffer (vm, rxq->bufs[i]);
if (ad->flags & AVF_DEVICE_F_IOVA)
- {
- vlib_buffer_t *b = vlib_get_buffer (vm, rxq->bufs[i]);
- d->qword[0] = pointer_to_uword (b->data);
- }
+ d->qword[0] = vlib_buffer_get_va (b);
else
- d->qword[0] =
- vlib_get_buffer_data_physical_address (vm, rxq->bufs[i]);
+ d->qword[0] = vlib_buffer_get_pa (vm, b);
d++;
}
diff --git a/src/plugins/avf/input.c b/src/plugins/avf/input.c
index 0b1ac744a1f..efe3b0e0251 100644
--- a/src/plugins/avf/input.c
+++ b/src/plugins/avf/input.c
@@ -52,6 +52,7 @@ avf_rxq_refill (vlib_main_t * vm, vlib_node_runtime_t * node, avf_rxq_t * rxq,
{
u16 n_refill, mask, n_alloc, slot;
u32 s0, s1, s2, s3;
+ vlib_buffer_t *b[4];
avf_rx_desc_t *d[4];
n_refill = rxq->size - 1 - rxq->n_enqueued;
@@ -97,28 +98,24 @@ avf_rxq_refill (vlib_main_t * vm, vlib_node_runtime_t * node, avf_rxq_t * rxq,
d[1] = ((avf_rx_desc_t *) rxq->descs) + s1;
d[2] = ((avf_rx_desc_t *) rxq->descs) + s2;
d[3] = ((avf_rx_desc_t *) rxq->descs) + s3;
+ b[0] = vlib_get_buffer (vm, rxq->bufs[s0]);
+ b[1] = vlib_get_buffer (vm, rxq->bufs[s1]);
+ b[2] = vlib_get_buffer (vm, rxq->bufs[s2]);
+ b[3] = vlib_get_buffer (vm, rxq->bufs[s3]);
+
if (use_iova)
{
- vlib_buffer_t *b;
- b = vlib_get_buffer (vm, rxq->bufs[s0]);
- d[0]->qword[0] = pointer_to_uword (b->data);
- b = vlib_get_buffer (vm, rxq->bufs[s1]);
- d[1]->qword[0] = pointer_to_uword (b->data);
- b = vlib_get_buffer (vm, rxq->bufs[s2]);
- d[2]->qword[0] = pointer_to_uword (b->data);
- b = vlib_get_buffer (vm, rxq->bufs[s3]);
- d[3]->qword[0] = pointer_to_uword (b->data);
+ d[0]->qword[0] = vlib_buffer_get_va (b[0]);
+ d[1]->qword[0] = vlib_buffer_get_va (b[1]);
+ d[2]->qword[0] = vlib_buffer_get_va (b[2]);
+ d[3]->qword[0] = vlib_buffer_get_va (b[3]);
}
else
{
- d[0]->qword[0] =
- vlib_get_buffer_data_physical_address (vm, rxq->bufs[s0]);
- d[1]->qword[0] =
- vlib_get_buffer_data_physical_address (vm, rxq->bufs[s1]);
- d[2]->qword[0] =
- vlib_get_buffer_data_physical_address (vm, rxq->bufs[s2]);
- d[3]->qword[0] =
- vlib_get_buffer_data_physical_address (vm, rxq->bufs[s3]);
+ d[0]->qword[0] = vlib_buffer_get_pa (vm, b[0]);
+ d[1]->qword[0] = vlib_buffer_get_pa (vm, b[1]);
+ d[2]->qword[0] = vlib_buffer_get_pa (vm, b[2]);
+ d[3]->qword[0] = vlib_buffer_get_pa (vm, b[3]);
}
d[0]->qword[1] = 0;
@@ -134,14 +131,11 @@ avf_rxq_refill (vlib_main_t * vm, vlib_node_runtime_t * node, avf_rxq_t * rxq,
{
s0 = slot;
d[0] = ((avf_rx_desc_t *) rxq->descs) + s0;
+ b[0] = vlib_get_buffer (vm, rxq->bufs[s0]);
if (use_iova)
- {
- vlib_buffer_t *b = vlib_get_buffer (vm, rxq->bufs[s0]);
- d[0]->qword[0] = pointer_to_uword (b->data);
- }
+ d[0]->qword[0] = vlib_buffer_get_va (b[0]);
else
- d[0]->qword[0] =
- vlib_get_buffer_data_physical_address (vm, rxq->bufs[s0]);
+ d[0]->qword[0] = vlib_buffer_get_pa (vm, b[0]);
d[0]->qword[1] = 0;
/* next */
diff --git a/src/plugins/avf/output.c b/src/plugins/avf/output.c
index 8f8e82d146c..c2c4b01d022 100644
--- a/src/plugins/avf/output.c
+++ b/src/plugins/avf/output.c
@@ -118,16 +118,21 @@ retry:
b2 = vlib_get_buffer (vm, bi2);
b3 = vlib_get_buffer (vm, bi3);
-#if 0
- d->qword[0] = vlib_get_buffer_data_physical_address (vm, bi0) +
- b0->current_data;
-#else
- d0->qword[0] = pointer_to_uword (b0->data) + b0->current_data;
- d1->qword[0] = pointer_to_uword (b1->data) + b1->current_data;
- d2->qword[0] = pointer_to_uword (b2->data) + b2->current_data;
- d3->qword[0] = pointer_to_uword (b3->data) + b3->current_data;
-
-#endif
+ if (ad->flags & AVF_DEVICE_F_IOVA)
+ {
+ d0->qword[0] = vlib_buffer_get_current_va (b0);
+ d1->qword[0] = vlib_buffer_get_current_va (b1);
+ d2->qword[0] = vlib_buffer_get_current_va (b2);
+ d3->qword[0] = vlib_buffer_get_current_va (b3);
+ }
+ else
+ {
+ d0->qword[0] = vlib_buffer_get_current_pa (vm, b0);
+ d1->qword[0] = vlib_buffer_get_current_pa (vm, b1);
+ d2->qword[0] = vlib_buffer_get_current_pa (vm, b2);
+ d3->qword[0] = vlib_buffer_get_current_pa (vm, b3);
+ }
+
d0->qword[1] = ((u64) b0->current_length) << 34 | bits;
d1->qword[1] = ((u64) b1->current_length) << 34 | bits;
d2->qword[1] = ((u64) b2->current_length) << 34 | bits;
@@ -146,12 +151,11 @@ retry:
txq->bufs[next] = bi0;
b0 = vlib_get_buffer (vm, bi0);
-#if 0
- d->qword[0] = vlib_get_buffer_data_physical_address (vm, bi0) +
- b0->current_data;
-#else
- d0->qword[0] = pointer_to_uword (b0->data) + b0->current_data;
-#endif
+ if (ad->flags & AVF_DEVICE_F_IOVA)
+ d0->qword[0] = vlib_buffer_get_current_va (b0);
+ else
+ d0->qword[0] = vlib_buffer_get_current_pa (vm, b0);
+
d0->qword[1] = (((u64) b0->current_length) << 34) | bits;
next = (next + 1) & mask;