diff options
author | Zhiyong Yang <zhiyong.yang@intel.com> | 2019-05-28 00:38:11 -0400 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-05-28 08:10:23 +0000 |
commit | 8cd5bd8e34eb72ee5dccc2fb0733db9da03af5c8 (patch) | |
tree | 924b0a244f8d9e0a1422d3a2a2bcb68e62a39161 /src/vnet | |
parent | d7d24990a0cafc70909106f4fc9b6fb4480c3aa0 (diff) |
snap_input: simplify code using existing functions
Change-Id: Ia0cadebab8b800e34e9574601cdebee5ca90cc6a
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/snap/node.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/vnet/snap/node.c b/src/vnet/snap/node.c index 884ff32444b..9baa75002cb 100644 --- a/src/vnet/snap/node.c +++ b/src/vnet/snap/node.c @@ -128,8 +128,8 @@ snap_input (vlib_main_t * vm, b0 = vlib_get_buffer (vm, bi0); b1 = vlib_get_buffer (vm, bi1); - h0 = (void *) (b0->data + b0->current_data); - h1 = (void *) (b1->data + b1->current_data); + h0 = vlib_buffer_get_current (b0); + h1 = vlib_buffer_get_current (b1); oui0 = snap_header_get_oui (h0); oui1 = snap_header_get_oui (h1); @@ -140,11 +140,8 @@ snap_input (vlib_main_t * vm, len0 = sizeof (h0[0]) - (is_ethernet0 ? sizeof (h0->protocol) : 0); len1 = sizeof (h1[0]) - (is_ethernet1 ? sizeof (h1->protocol) : 0); - b0->current_data += len0; - b1->current_data += len1; - - b0->current_length -= len0; - b1->current_length -= len1; + vlib_buffer_advance (b0, len0); + vlib_buffer_advance (b1, len1); pi0 = snap_get_protocol_info (sm, h0); pi1 = snap_get_protocol_info (sm, h1); @@ -216,7 +213,7 @@ snap_input (vlib_main_t * vm, b0 = vlib_get_buffer (vm, bi0); - h0 = (void *) (b0->data + b0->current_data); + h0 = vlib_buffer_get_current (b0); oui0 = snap_header_get_oui (h0); @@ -224,9 +221,7 @@ snap_input (vlib_main_t * vm, len0 = sizeof (h0[0]) - (is_ethernet0 ? sizeof (h0->protocol) : 0); - b0->current_data += len0; - - b0->current_length -= len0; + vlib_buffer_advance (b0, len0); pi0 = snap_get_protocol_info (sm, h0); |