/* * Copyright (c) 2015 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * vnet/buffer.h: vnet buffer flags * * Copyright (c) 2008 Eliot Dresselhaus * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef included_vnet_buffer_h #define included_vnet_buffer_h #include /** * Flags that are set in the high order bits of ((vlib_buffer*)b)->flags * */ #define foreach_vnet_buffer_flag \ _ (1, L4_CHECKSUM_COMPUTED, "l4-cksum-computed", 1) \ _ (2, L4_CHECKSUM_CORRECT, "l4-cksum-correct", 1) \ _ (3, VLAN_2_DEEP, "vlan-2-deep", 1) \ _ (4, VLAN_1_DEEP, "vlan-1-deep", 1) \ _ (5, SPAN_CLONE, "span-clone", 1) \ _ (6, LOOP_COUNTER_VALID, "loop-counter-valid", 0) \ _ (7, LOCALLY_ORIGINATED, "local", 1) \ _ (8, IS_IP4, "ip4", 1) \ _ (9, IS_IP6, "ip6", 1) \ _ (10, OFFLOAD, "offload", 0) \ _ (11, IS_NATED, "natted", 1) \ _ (12, L2_HDR_OFFSET_VALID, "l2_hdr_offset_valid", 0) \ _ (13, L3_HDR_OFFSET_VALID, "l3_hdr_offset_valid", 0) \ _ (14, L4_HDR_OFFSET_VALID, "l4_hdr_offset_valid", 0) \ _ (15, FLOW_REPORT, "flow-report", 1) \ _ (16, IS_DVR, "dvr", 1) \ _ (17, QOS_DATA_VALID, "qos-data-valid", 0) \ _ (18, GSO, "gso", 0) \ _ (19, AVAIL1, "avail1", 1) \ _ (20, AVAIL2, "avail2", 1) \ _ (21, AVAIL3, "avail3", 1) \ _ (22, AVAIL4, "avail4", 1) \ _ (23, AVAIL5, "avail5", 1) \ _ (24, AVAIL6, "avail6", 1) \ _ (25, AVAIL7, "avail7", 1) \ _ (26, AVAIL8, "avail8", 1) \ _ (27, AVAIL9, "avail9", 1) /* * Please allocate the FIRST available bit, redefine * AVAIL 1 ... AVAILn-1, and remove AVAILn. Please maintain the * VNET_BUFFER_FLAGS_ALL_AVAIL definition. */ #define VNET_BUFFER_FLAGS_ALL_AVAIL \ (VNET_BUFFER_F_AVAIL1 | VNET_BUFFER_F_AVAIL2 | VNET_BUFFER_F_AVAIL3 | \ VNET_BUFFER_F_AVAIL4 | VNET_BUFFER_F_AVAIL5 | VNET_BUFFER_F_AVAIL6 | \ VNET_BUFFER_F_AVAIL7 | VNET_BUFFER_F_AVAIL8 | VNET_BUFFER_F_AVAIL9) #define VNET_BUFFER_FLAGS_VLAN_BITS \ (VNET_BUFFER_F_VLAN_1_DEEP | VNET_BUFFER_F_VLAN_2_DEEP) enum { #define _(bit, name, s, v) VNET_BUFFER_F_##name = (1 << LOG2_VLIB_BUFFER_FLAG_USER(bit)), foreach_vnet_buffer_flag #undef _ }; enum { #define _(bit, name, s, v) VNET_BUFFER_F_LOG2_##name = LOG2_VLIB_BUFFER_FLAG_USER(bit), foreach_vnet_buffer_flag #undef _ }; /* Make sure that the vnet and vlib bits are disjoint */ STATIC_ASSERT (((VNET_BUFFER_FLAGS_ALL_AVAIL & VLIB_BUFFER_FLAGS_ALL) == 0), "VLIB / VNET buffer flags overlap"); #define foreach_vnet_buffer_offload_flag \ _ (0, IP_CKSUM, "offload-ip-cksum", 1) \ _ (1, TCP_CKSUM, "offload-tcp-cksum", 1) \ _ (2, UDP_CKSUM, "offload-udp-cksum", 1) \ _ (3, OUTER_IP_CKSUM, "offload-outer-ip-cksum", 1) \ _ (4, OUTER_TCP_CKSUM, "offload-outer-tcp-cksum", 1) \ _ (5, OUTER_UDP_CKSUM, "offload-outer-udp-cksum", 1) typedef enum { #define _(bit, name, s, v) VNET_BUFFER_OFFLOAD_F_##name = (1 << bit), foreach_vnet_buffer_offload_flag #undef _ } vnet_buffer_oflags_t; #define foreach_buffer_opaque_union_subtype \ _(ip) \ _(l2) \ _(l2t) \ _(l2_classify) \ _(policer) \ _(ipsec) \ _(map) \ _(map_t) \ _(ip_frag) \ _(mpls) \ _(tcp) /* * vnet stack buffer opaque array overlay structure. * The vnet_buffer_opaque_t *must* be the same size as the * vlib_buffer_t "opaque" structure member, 32 bytes. * * When adding a union type, please add a stanza to * foreach_buffer_opaque_union_subtype (directly above). * Code in vnet_interface_init(...) verifies the size * of the union, and will announce any deviations in an * impossible-to-miss manner. */ typedef struct { u32 sw_if_index[VLIB_N_RX_TX]; i16 l2_hdr_offset; i16 l3_hdr_offset; i16 l4_hdr_offset; u8 feature_arc_index; /* offload flags */ vnet_buffer_oflags_t oflags : 8; union { /* IP4/6 buffer opaque. */ struct { /* Adjacency from destination IP address lookup [VLIB_TX]. Adjacency from source IP
# Copyright (c) 2015 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License