diff options
author | Damjan Marion <damarion@cisco.com> | 2018-02-01 15:30:13 +0100 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-02-07 15:07:51 +0000 |
commit | dac03527f64216e132953a1a1d47b414e6841c68 (patch) | |
tree | bfe382ab6927861aab72acdb6e3d13391b3c7761 /src/vnet | |
parent | f429a93d95c73bafdc7244799703abc051127ca8 (diff) |
Refactor vlib_buffer flags
Change-Id: I853386aebfe488ebb10328435b81b6e3403c5dd0
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/buffer.c | 2 | ||||
-rw-r--r-- | src/vnet/buffer.h | 33 | ||||
-rw-r--r-- | src/vnet/dns/dns.c | 2 | ||||
-rw-r--r-- | src/vnet/dpo/dvr_dpo.c | 12 | ||||
-rw-r--r-- | src/vnet/flow/flow_report.c | 2 | ||||
-rw-r--r-- | src/vnet/pg/pg.h | 2 | ||||
-rw-r--r-- | src/vnet/replication.h | 2 | ||||
-rw-r--r-- | src/vnet/sctp/sctp_output.c | 2 | ||||
-rw-r--r-- | src/vnet/tcp/tcp_output.c | 4 |
9 files changed, 21 insertions, 40 deletions
diff --git a/src/vnet/buffer.c b/src/vnet/buffer.c index 38bda8cb6f4..f12adf7eb64 100644 --- a/src/vnet/buffer.c +++ b/src/vnet/buffer.c @@ -27,7 +27,7 @@ format_vnet_buffer (u8 * s, va_list * args) #define _(bit, name, v) \ if (v && (b->flags & VNET_BUFFER_F_##name)) \ a = format (a, "%s ", v); - foreach_vnet_buffer_field + foreach_vnet_buffer_flag #undef _ if (b->flags & VNET_BUFFER_F_L2_HDR_OFFSET_VALID) a = format (a, "l2-hdr-offset %d ", vnet_buffer (b)->l2_hdr_offset); diff --git a/src/vnet/buffer.h b/src/vnet/buffer.h index 5d7273aa04f..807cd28f9e4 100644 --- a/src/vnet/buffer.h +++ b/src/vnet/buffer.h @@ -45,7 +45,7 @@ /** * Flags that are set in the high order bits of ((vlib_buffer*)b)->flags */ -#define foreach_vnet_buffer_field \ +#define foreach_vnet_buffer_flag \ _( 1, L4_CHECKSUM_COMPUTED, "l4-cksum-computed") \ _( 2, L4_CHECKSUM_CORRECT, "l4-cksum-correct") \ _( 3, VLAN_2_DEEP, "vlan-2-deep") \ @@ -61,7 +61,9 @@ _(13, IS_NATED, "nated") \ _(14, L2_HDR_OFFSET_VALID, 0) \ _(15, L3_HDR_OFFSET_VALID, 0) \ - _(16, L4_HDR_OFFSET_VALID, 0) + _(16, L4_HDR_OFFSET_VALID, 0) \ + _(17, FLOW_REPORT, "flow-report") \ + _(18, IS_DVR, "dvr") #define VNET_BUFFER_FLAGS_VLAN_BITS \ (VNET_BUFFER_F_VLAN_1_DEEP | VNET_BUFFER_F_VLAN_2_DEEP) @@ -69,38 +71,17 @@ enum { #define _(bit, name, v) VNET_BUFFER_F_##name = (1 << LOG2_VLIB_BUFFER_FLAG_USER(bit)), - foreach_vnet_buffer_field + foreach_vnet_buffer_flag #undef _ }; enum { #define _(bit, name, v) VNET_BUFFER_F_LOG2_##name = LOG2_VLIB_BUFFER_FLAG_USER(bit), - foreach_vnet_buffer_field + foreach_vnet_buffer_flag #undef _ }; -/** - * @brief Flags set in ((vnet_buffer(b)->flags - */ -#define foreach_vnet_opaque_flag \ - _( 1, IS_DVR, "DVR-processed") - -enum -{ -#define _(bit, name, v) VNET_OPAQUE_F_##name = (1 << bit), - foreach_vnet_opaque_flag -#undef _ -}; - -enum -{ -#define _(bit, name, v) VNET_OPAQUE_F_LOG2_##name = bit, - foreach_vnet_opaque_flag -#undef _ -}; - - #define foreach_buffer_opaque_union_subtype \ _(ip) \ _(swt) \ @@ -134,7 +115,7 @@ typedef struct i16 l2_hdr_offset; i16 l3_hdr_offset; i16 l4_hdr_offset; - u16 flags; + u16 dont_waste_me; union { diff --git a/src/vnet/dns/dns.c b/src/vnet/dns/dns.c index 24cd5969aa7..eff854933c4 100644 --- a/src/vnet/dns/dns.c +++ b/src/vnet/dns/dns.c @@ -2803,7 +2803,7 @@ vnet_send_dns4_reply (dns_main_t * dm, dns_pending_request_t * pr, * In the resolution-required / deferred case, resetting a freshly-allocated * buffer won't hurt. We hope. */ - b0->flags &= VLIB_BUFFER_FREE_LIST_INDEX_MASK; + b0->flags &= VLIB_BUFFER_NON_DEFAULT_FREELIST; b0->flags |= (VNET_BUFFER_F_LOCALLY_ORIGINATED | VLIB_BUFFER_TOTAL_LENGTH_VALID); b0->current_data = 0; diff --git a/src/vnet/dpo/dvr_dpo.c b/src/vnet/dpo/dvr_dpo.c index 1aa16546c82..02b97ee2e9f 100644 --- a/src/vnet/dpo/dvr_dpo.c +++ b/src/vnet/dpo/dvr_dpo.c @@ -290,8 +290,8 @@ dvr_dpo_inline (vlib_main_t * vm, (u8*)ethernet_buffer_get_header(b1)); vnet_buffer(b0)->l2.l2_len = len0; vnet_buffer(b1)->l2.l2_len = len1; - vnet_buffer(b0)->flags |= VNET_OPAQUE_F_IS_DVR; - vnet_buffer(b1)->flags |= VNET_OPAQUE_F_IS_DVR; + b0->flags |= VNET_BUFFER_F_IS_DVR; + b1->flags |= VNET_BUFFER_F_IS_DVR; vlib_buffer_advance(b0, -len0); vlib_buffer_advance(b1, -len1); @@ -350,7 +350,7 @@ dvr_dpo_inline (vlib_main_t * vm, len0 = ((u8*)vlib_buffer_get_current(b0) - (u8*)ethernet_buffer_get_header(b0)); vnet_buffer(b0)->l2.l2_len = len0; - vnet_buffer(b0)->flags |= VNET_OPAQUE_F_IS_DVR; + b0->flags |= VNET_BUFFER_F_IS_DVR; vlib_buffer_advance(b0, -len0); /* @@ -464,13 +464,13 @@ dvr_reinject_inline (vlib_main_t * vm, b0 = vlib_get_buffer (vm, bi0); b1 = vlib_get_buffer (vm, bi1); - if (vnet_buffer(b0)->flags & VNET_OPAQUE_F_IS_DVR) + if (b0->flags & VNET_BUFFER_F_IS_DVR) next0 = DVR_REINJECT_OUTPUT; else vnet_feature_next(vnet_buffer(b0)->sw_if_index[VLIB_TX], &next0, b0); - if (vnet_buffer(b1)->flags & VNET_OPAQUE_F_IS_DVR) + if (b1->flags & VNET_BUFFER_F_IS_DVR) next1 = DVR_REINJECT_OUTPUT; else vnet_feature_next(vnet_buffer(b1)->sw_if_index[VLIB_TX], @@ -511,7 +511,7 @@ dvr_reinject_inline (vlib_main_t * vm, b0 = vlib_get_buffer (vm, bi0); - if (vnet_buffer(b0)->flags & VNET_OPAQUE_F_IS_DVR) + if (b0->flags & VNET_BUFFER_F_IS_DVR) next0 = DVR_REINJECT_OUTPUT; else vnet_feature_next(vnet_buffer(b0)->sw_if_index[VLIB_TX], diff --git a/src/vnet/flow/flow_report.c b/src/vnet/flow/flow_report.c index f912618ec75..4b890728a8a 100644 --- a/src/vnet/flow/flow_report.c +++ b/src/vnet/flow/flow_report.c @@ -126,7 +126,7 @@ send_template_packet (flow_report_main_t * frm, clib_memcpy (b0->data, fr->rewrite, vec_len (fr->rewrite)); b0->current_data = 0; b0->current_length = vec_len (fr->rewrite); - b0->flags |= (VLIB_BUFFER_TOTAL_LENGTH_VALID | VLIB_BUFFER_FLOW_REPORT); + b0->flags |= (VLIB_BUFFER_TOTAL_LENGTH_VALID | VNET_BUFFER_F_FLOW_REPORT); vnet_buffer (b0)->sw_if_index[VLIB_RX] = 0; vnet_buffer (b0)->sw_if_index[VLIB_TX] = frm->fib_index; diff --git a/src/vnet/pg/pg.h b/src/vnet/pg/pg.h index 111df91ae99..20852ba18d1 100644 --- a/src/vnet/pg/pg.h +++ b/src/vnet/pg/pg.h @@ -90,7 +90,7 @@ typedef struct u32 *buffer_fifo; /* Buffer free list for this buffer index in stream. */ - u32 free_list_index; + vlib_buffer_free_list_index_t free_list_index; } pg_buffer_index_t; typedef struct pg_stream_t diff --git a/src/vnet/replication.h b/src/vnet/replication.h index 531a61c2fd1..6350aedfe7f 100644 --- a/src/vnet/replication.h +++ b/src/vnet/replication.h @@ -39,7 +39,7 @@ typedef struct * data saved from the start of replication and restored * at the end of replication */ - u32 saved_free_list_index; /* from vlib buffer */ + vlib_buffer_free_list_index_t saved_free_list_index; /* from vlib buffer */ /* data saved from the original packet and restored for each replica */ u64 l2_header[3]; /* 24B (must be at least 22B for l2 packets) */ diff --git a/src/vnet/sctp/sctp_output.c b/src/vnet/sctp/sctp_output.c index ef5d3b72968..dc78c0959ce 100644 --- a/src/vnet/sctp/sctp_output.c +++ b/src/vnet/sctp/sctp_output.c @@ -270,7 +270,7 @@ always_inline void * sctp_init_buffer (vlib_main_t * vm, vlib_buffer_t * b) { ASSERT ((b->flags & VLIB_BUFFER_NEXT_PRESENT) == 0); - b->flags &= VLIB_BUFFER_FREE_LIST_INDEX_MASK; + b->flags &= VLIB_BUFFER_NON_DEFAULT_FREELIST; b->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED; b->total_length_not_including_first_buffer = 0; vnet_buffer (b)->sctp.flags = 0; diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c index 78d64133c3a..ec8a251e6eb 100644 --- a/src/vnet/tcp/tcp_output.c +++ b/src/vnet/tcp/tcp_output.c @@ -503,7 +503,7 @@ always_inline void * tcp_init_buffer (vlib_main_t * vm, vlib_buffer_t * b) { ASSERT ((b->flags & VLIB_BUFFER_NEXT_PRESENT) == 0); - b->flags &= VLIB_BUFFER_FREE_LIST_INDEX_MASK; + b->flags &= VLIB_BUFFER_NON_DEFAULT_FREELIST; b->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED; b->total_length_not_including_first_buffer = 0; vnet_buffer (b)->tcp.flags = 0; @@ -1299,7 +1299,7 @@ tcp_prepare_retransmit_segment (tcp_connection_t * tc, u32 offset, ASSERT (n_peeked == len_to_deq); n_bytes += n_peeked; chain_b->current_length = n_peeked; - chain_b->flags &= VLIB_BUFFER_FREE_LIST_INDEX_MASK; + chain_b->flags &= VLIB_BUFFER_NON_DEFAULT_FREELIST; chain_b->next_buffer = 0; /* update previous buffer */ |