aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/avf/output.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-10-22 13:07:02 +0200
committerDamjan Marion <dmarion@me.com>2018-10-22 13:01:19 +0000
commit8f49936b20508d57968f01dcb18f8d31b1a58f3f (patch)
treeedb3ee5da2457b345274f69eab70d05123ada08e /src/plugins/avf/output.c
parent6f3f1cbf7760efb17c5754c3dbccdefd433675cb (diff)
vlib: introduce vlib_buffer_get_{pa,va,current_va,current_pa} inlines
Change-Id: I0b42ac6b05bc9910904a97924ea4bebc84507d4d Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/avf/output.c')
-rw-r--r--src/plugins/avf/output.c36
1 files changed, 20 insertions, 16 deletions
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;