aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api
AgeCommit message (Collapse)AuthorFilesLines
2018-02-19VOM: acl: Some necessary fixesMohsin Kazmi3-7/+13
It: 1. changes ethertype_rule_t to hold actual objects instead of reference to them. 2. fixes acl_ethertype 'update' function 3. fixes pretty-print of acl-list-update. 4. adds l3-acl update unit test. Change-Id: Iec72212806e96bd0574b46b563de79f0744cb248 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2018-02-17vpp_papi: remove legacy way of calling VPP APIsKlement Sekera1-7/+0
This allows VPP to define APIs which conflict with internal function names used in vpp_papi without issues. Change-Id: I56c21814e1c11fa2aa6bcd95adb3fdeacd304e8e Signed-off-by: Klement Sekera <ksekera@cisco.com>
2018-02-17vpp_papi: reduce memory leaksKlement Sekera1-12/+16
This changes makes unused VPP objects collectable by garbage collector, allowing running all `make test` tests again instead of python crashing due to running out of memory. Change-Id: I0e271c2b3f195d9d3b64840f9f11144da0fe967d Signed-off-by: Klement Sekera <ksekera@cisco.com>
2018-02-15VOM: Fix broken MakefileMohsin Kazmi1-1/+1
Typo mistake broken the makefile which results in missing vom headers in system. Change-Id: Ic2e5f742f0e38140559138b4aa7564f8c25b73e4 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2018-02-14VOM: build with plugins disabledNeale Ranns3-30/+79
Change-Id: I1384d16deb3fa38b988dd2fc98f436124e381536 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2018-02-13VOM: ACL: Add Object Model for acl ethertypeMohsin Kazmi7-0/+747
Change-Id: I2b572ebd4b7bb26381f127912a4cc0825c04fc34 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2018-02-09GBP pluginNeale Ranns11-3/+1339
Group Base Policy (GBP) defines: - endpoints: typically a VM or container that is connected to the virtual switch/router (i.e. to VPP) - endpoint-group: (EPG) a collection of endpoints - policy: rules determining which traffic can pass between EPGs a.k.a a 'contract' Here, policy is implemented via an ACL. EPG classification for transit packets is determined by: - source EPG: from the packet's input interface - destination EPG: from the packet's destination IP address. Change-Id: I7b983844826b5fc3d49e21353ebda9df9b224e25 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2018-02-02VOM: route-domain find() fixNeale Ranns3-24/+5
Change-Id: I5b7117f3568e3ba979baa15521b2cfc180abb682 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2018-01-27jvpp: map VPP API enums to primitive typesMarek Gradzki2-3/+76
Adding enum support (VPP-1153) requires JVPP generator refactoring (see: VPP-1154, VPP-1155, VPP-480) As a workaround we just update all the mappings used for VPP API definitions to JAVA and C/JNI translation. Change-Id: I9dff83e5199039a1a46a3d4685ce57cdeeeb2014 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
2018-01-27jvpp: use Python's logging APIMarek Gradzki10-34/+61
Change-Id: Iec437e4672af1f0d1a24458afb977ba6fbeba4ed Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
2018-01-25VPP-1144: PAPI Import leads to duplicate type definition.Ole Troan1-0/+15
Change-Id: I54c147004fd93681a6a9cf30fa5277c1dabce67c Signed-off-by: Ole Troan <ot@cisco.com>
2018-01-23For DHCP client configuration control the setting of the broadcast flag in theNeale Ranns4-6/+28
DISCOVER message sent. According to RFC2131: In the case of a client using DHCP for initial configuration (before the client's TCP/IP software has been completely configured), DHCP requires creative use of the client's TCP/IP software and liberal interpretation of RFC 1122. The TCP/IP software SHOULD accept and forward to the IP layer any IP packets delivered to the client's hardware address before the IP address is configured; DHCP servers and BOOTP relay agents may not be able to deliver DHCP messages to clients that cannot accept hardware unicast datagrams before the TCP/IP software is configured. To work around some clients that cannot accept IP unicast datagrams before the TCP/IP software is configured as discussed in the previous paragraph, DHCP uses the 'flags' field [21]. The leftmost bit is defined as the BROADCAST (B) flag. The semantics of this flag are discussed in section 4.1 of this document. The remaining bits of the flags field are reserved for future use. They MUST be set to zero by clients and ignored by servers and relay agents. Figure 2 gives the format of the 'flags' field. this changes means VPP conforms to the: "SHOULD accept and forward to the IP layer any IP packets delivered to the client's hardware address before the IP address is configured" with the caveat that VPP allows DHCP packets destined to the stanard client DHCP port to be delivered. With this enhancement the control-plane is now able to choose the setting of the broadcast flag. Change-Id: Ia4eb2c9bb1e30c29f9192facc645e9533641955a Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-01-23VPPAPIGEN: vppapigen replacement in Python PLY.Ole Troan1-1/+1
This is a version of the VPP API generator in Python PLY. It supports the existing language, and has a plugin architecture for generators. Currently C and JSON are supported. Changes: - vl_api_version to option version = "major.minor.patch" - enum support - Added error checking and reporting - import support (removed the C pre-processor) - services (tying request/reply together) Version: option version = "1.0.0"; Enum: enum colours { RED, BLUE = 50, }; define foo { vl_api_colours_t colours; }; Services: service { rpc foo returns foo_reply; rpc foo_dump returns stream foo_details; rpc want_stats returns want_stats_reply events ip4_counters, ip6_counters; }; Future planned features: - unions - bool, text - array support (including length) - proto3 output plugin - Refactor C/C++ generator as a plugin - Refactor Java generator as a plugin Change-Id: Ifa289966c790e1b1a8e2938a91e69331e3a58bdf Signed-off-by: Ole Troan <ot@cisco.com>
2018-01-22vom: acl: Fix l3 acl handle populateMohsin Kazmi3-0/+21
Change-Id: I5f105a1abb8a28645d6c961ad92f91c23787047f Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2018-01-22vom: ip_route: fix handle populateMohsin Kazmi1-5/+15
Change-Id: I91892084133daadb74caa7aa13ee1071599ba892 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2018-01-22vom: Fix connection to VAPI and add disconnect functionMohsin Kazmi6-28/+48
Change-Id: I2dd5dbafe36e5ae536b3e600beb6920a71238b7a Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2018-01-22svm: queue sub: Add conditional timed waitMohsin Kazmi4-8/+17
On reviece side svm queue only permits blocking and non-blocking calls. This patch adds timed wait blocking functionality which returns either on signal/event or on given time out. It also preserves the original behavior, so it will not hurt client applications which are using svm queue. Change-Id: Ic10632170330a80afb8bc781d4ccddfe4da2c69a Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2018-01-10makefile set CXXFLAGS so they are propageted to sub-buildsNeale Ranns1-2/+1
Change-Id: I55d9953851062f7106c66701d46bcd9073cf1ee4 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2018-01-09Revert "VOM: fix cflags"Dave Wallace1-2/+1
This reverts commit 4363ad6c96b5641fca1b16c5a6ec22e2364adcfd. Change-Id: Ie71ee265659e06ada37f40cfceed4c20b1cbf6e5 Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2018-01-09api: refactor vlibmemoryFlorin Coras18-36/+34
- separate client/server code for both memory and socket apis - separate memory api code from generic vlib api code - move unix_shared_memory_fifo to svm and rename to svm_fifo_t - overall declutter Change-Id: I90cdd98ff74d0787d58825b914b0f1eafcfa4dc2 Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-01-09VOM: fix cflagsNeale Ranns1-1/+2
override the default CXXFLAGS (which provides a -O2) with the system set CFLAGS (providing -O0/-O2 for debug/release builds) Change-Id: Ic84e51baafdc22d37139303566d705d759e36721 Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-01-09DVR: run L3 output featuresNeale Ranns5-25/+95
- rename l2_bridged to is_dvr. Including on the ip.api this was new in the 18.01 release so no compatability issues. - steal the free space in vnet_buffer_opaque_t for use with flags. - run the ipX-output feature arc from the DVR DPO Change-Id: I040e5976d1dbe076fcdda3a40a7804f56337ce3f Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-01-04VOM: NAT coverity found bugsNeale Ranns2-3/+3
Change-Id: Ic55ad2e0a1435f552ce84ed1a9b1981191bc178b Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-01-02VOM: NAT updatesNeale Ranns12-174/+518
Change-Id: I112afaa1f2ccd2ee62a436c73802afaea9b44779 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2017-12-20L2 EmulationNeale Ranns6-1/+560
L2 Emulation is a feautre that is applied to L2 ports to 'extract' IP packets from the L2 path and inject them into the L3 path (i.e. into the appropriate ip[4|6]_input node). L3 routes in the table_id for that interface should then be configured as DVR routes, therefore the forwarded packet has the L2 header preserved and togehter the L3 routed system behaves like an L2 bridge. Change-Id: I8effd7e2f4c67ee277b73c7bc79aa3e5a3e34d03 Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-12-14vom: acl: Extend constructor for l3 ruleMohsin Kazmi2-9/+23
New constructor can construct the l3 rule using all or partial paratmeters. Change-Id: I828ec1c4713decb5824e4a73c3692cebc2324cc2 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2017-12-14vom: acl-list: Add comparison operator - for UTMohsin Kazmi1-0/+12
Change-Id: I341f522b46dd85fb3b1dd43fd125513f16f89171 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2017-12-13VOM: a couple of print fixesNeale Ranns2-2/+3
Change-Id: I4c22ad08bf8fa3e8f05b8938ff447cafa4eea5b2 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2017-12-10improve vapi json parser error handlingKlement Sekera1-1/+19
Change-Id: I39b975e6dc3b3ed1f81c1736ed498aee05f6a88b Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-12-09jvpp: include all api files from @top_builddir@/vppMarek Gradzki2-6/+5
Currently: - vpe.api (supported previously) - stats.api - oam.api Change-Id: Iab48d5d142e9a1ea0a4f366352b1d9429cc47309 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
2017-12-09jvpp: do not hardcode event sufixes (VPP-940)Marek Gradzki7-141/+175
JVpp maps request messages with replies for Java API user convenience, e.g.: - do not polute send APIs with messages other than requests/dumps, - allow callback registration only for replies/details and events. Since there are no conventions for event message naming (https://wiki.fd.io/view/VPP/API_Concepts#API_Conventions), jvpp should not limit events to messages that end with 'event' or 'counters' suffix. Instead jvpp should treat all messages except for requests/dumps as potential events. Such behaviour was introduced on Java API level by https://gerrit.fd.io/r/#/c/8377/ in order support reusing details messages as events (e.g. BFD events). This patch goes one step forward by relaxing rules at jvpp generation level. Change-Id: I2a35e9eb2a288b2cf02d36ca95e6cb13e76e19e3 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
2017-12-08vom: acl-l3: Fix pretty print for TCP mask and flagsMohsin Kazmi1-2/+2
Change-Id: If14d1b2d9b73de77321d94f10d48fa1bb04846f6 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2017-12-08VOM: prefix bit fiddlingNeale Ranns3-19/+130
Change-Id: I4fbf4a574f455628d56e78cefc1a76adc06bc801 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2017-12-07jvpp: unify notification handlingMarek Gradzki3-23/+7
Since introduction of dedicated SW Interface Event, there is no need for special handling of messages that can be both requests and events. Change-Id: I76575e32c6d5b19e9a1ca953e5841d8ac3de4de7 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
2017-12-07jvpp: remove special request<>reply mappingsMarek Gradzki10-102/+28
Since L2FibTable removal and introduction of dedicated SW Interface Event, special message handling code can be removed. The patch also fixes issues found by Intelij's code inspection tool. Change-Id: Ic4b2fd12ac30c7627f4cd6769716e4bb52ec0b10 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
2017-12-02VOM: l2fib: Add bvi flag supportMohsin Kazmi3-13/+29
Change-Id: I03d7508649e80a538fcf9541815e2c29224bc87a Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2017-12-01VOM: fixes for interface recreate on agent restart and L2 re-bindingNeale Ranns4-10/+24
Change-Id: I14c838ee99f9bc2db66bb2e775039d2cb2e7924f Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2017-11-29NAT: Remove old SNAT API (VPP-1070)Matus Fabian1-10/+10
Change-Id: I3d936d456ee27b2e0857843295efb60a9f2d0be7 Signed-off-by: Matus Fabian <matfabia@cisco.com>
2017-11-29VOM: logging, populate and stats fixesNeale Ranns22-251/+372
logging: allow a client to register a callback handler to recieve log messages that way the client can maintain a correctly sequenced log populate: fix the creation of interface and the setting of the handle stats: the reset promise idea is not defined behaviour. Use an eanble/disable command pair Change-Id: I347720bb65df2874c7619e722d593bc863ee2bf1 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2017-11-27VOM: favour make_sharedNeale Ranns13-45/+49
Change-Id: I0c5e198049d510f3b3f9a6aefe49c315449768e3 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2017-11-25VOM: handle null for iterator in dump cmdNeale Ranns1-2/+21
Change-Id: I2e8743d70a8d8604d370218a73d5f37c2f7c4617 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2017-11-24VOM: Additions to allow uses to UT applications that use VOMNeale Ranns51-295/+676
- find object by key - compare objects Change-Id: I36ec8612be9482bcef7ceced2a59f7403f77b3e8 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2017-11-22VOM: stats: Associate stat obj to interfaceMohsin Kazmi5-25/+71
Change-Id: Id8b159dd72b92798538a32fe570fb0038d742ef2 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2017-11-20Have PAPI find its API definition filesChris Luke1-5/+140
- Add a basic heuristic to have vpp_papi search in several places for the JSON API files. - It's clever enough to work out the path to these files from within several places in the source tree, falling back to the system location as a last resort. Change-Id: I1f823588e5aa0064d545ce4206ab29dbdedc4c7f Signed-off-by: Chris Luke <chrisy@flirble.org>
2017-11-20nowhere to set read_timeoutdongjuan1-2/+2
Change-Id: I8a16f2ba884451ca8028adb91383d57fdf1d9d50 Signed-off-by: dongjuan <dong.juan1@zte.com.cn>
2017-11-17VOM fixes and logger improvementsNeale Ranns7-30/+47
Change-Id: I5e3fa5e098a8ea26dbc3d3a1dc064e3507e33d8e Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2017-11-15VOM: interface's handle() retreives from singular instanceNeale Ranns2-0/+11
Change-Id: I262f2113f5805c0f89b615a0383efa8520184dd1 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2017-11-15VOM: interface RD update reconfigures L3 bindingsNeale Ranns4-21/+82
Change-Id: I273e1ea28c3c146e4a88d031c790c1cc56dccf00 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2017-11-14VOM: bridge-domain learning mode and route help commandsNeale Ranns8-7/+125
Change-Id: I2fa219d6530f1e7a3b8ae32d35a0c60ba57c5129 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2017-11-11Handle CPU flags from autotools projectDamjan Marion2-2/+2
Change-Id: Id085c1e3cbc7bf03df02755f9e35896cdb57e9e3 Signed-off-by: Damjan Marion <damarion@cisco.com>
er of link types. Not part of the enum so it does not have to be included in * switch statements */ #define VNET_LINK_NUM (VNET_LINK_NSH+1) /** * @brief Convert a link to to an Ethertype */ extern vnet_l3_packet_type_t vnet_link_to_l3_proto (vnet_link_t link); /** * @brief Attributes assignable to a HW interface Class. */ typedef enum vnet_hw_interface_class_flags_t_ { /** * @brief a point 2 point interface */ VNET_HW_INTERFACE_CLASS_FLAG_P2P = (1 << 0), } vnet_hw_interface_class_flags_t; /* Layer-2 (e.g. Ethernet) interface class. */ typedef struct _vnet_hw_interface_class { /* Index into main vector. */ u32 index; /* Class name (e.g. "Ethernet"). */ char *name; /* Flags */ vnet_hw_interface_class_flags_t flags; /* Function to call when hardware interface is added/deleted. */ vnet_interface_function_t *interface_add_del_function; /* Function to bring interface administratively up/down. */ vnet_interface_function_t *admin_up_down_function; /* Function to call when link state changes. */ vnet_interface_function_t *link_up_down_function; /* Function to call when link MAC changes. */ vnet_interface_set_mac_address_function_t *mac_addr_change_function; /* Format function to display interface name. */ format_function_t *format_interface_name; /* Format function to display interface address. */ format_function_t *format_address; /* Format packet header for this interface class. */ format_function_t *format_header; /* Format device verbosely for this class. */ format_function_t *format_device; /* Parser for hardware (e.g. ethernet) address. */ unformat_function_t *unformat_hw_address; /* Parser for packet header for e.g. rewrite string. */ unformat_function_t *unformat_header; /* Builds a rewrite string for the interface to the destination * for the payload/link type. */ u8 *(*build_rewrite) (struct vnet_main_t * vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_hw_address); /* Update an adjacecny added by FIB (as opposed to via the * neighbour resolution protocol). */ void (*update_adjacency) (struct vnet_main_t * vnm, u32 sw_if_index, u32 adj_index); uword (*is_valid_class_for_interface) (struct vnet_main_t * vnm, u32 hw_if_index, u32 hw_class_index); /* Called when hw interface class is changed and old hardware instance may want to be deleted. */ void (*hw_class_change) (struct vnet_main_t * vnm, u32 hw_if_index, u32 old_class_index, u32 new_class_index); /* List of hw interface classes, built by constructors */ struct _vnet_hw_interface_class *next_class_registration; } vnet_hw_interface_class_t; /** * @brief Return a complete, zero-length (aka dummy) rewrite */ extern u8 *default_build_rewrite (struct vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_hw_address); /** * @brief Default adjacency update function */ extern void default_update_adjacency (struct vnet_main_t *vnm, u32 sw_if_index, u32 adj_index); #define VNET_HW_INTERFACE_CLASS(x,...) \ __VA_ARGS__ vnet_hw_interface_class_t x; \ static void __vnet_add_hw_interface_class_registration_##x (void) \ __attribute__((__constructor__)) ; \ static void __vnet_add_hw_interface_class_registration_##x (void) \ { \ vnet_main_t * vnm = vnet_get_main(); \ x.next_class_registration = vnm->hw_interface_class_registrations; \ vnm->hw_interface_class_registrations = &x; \ } \ __VA_ARGS__ vnet_hw_interface_class_t x /* Hardware-interface. This corresponds to a physical wire that packets flow over. */ typedef struct vnet_hw_interface_t { /* Interface name. */ u8 *name; u32 flags; /* Hardware link state is up. */ #define VNET_HW_INTERFACE_FLAG_LINK_UP (1 << 0) /* Hardware duplex state */ #define VNET_HW_INTERFACE_FLAG_DUPLEX_SHIFT 1 #define VNET_HW_INTERFACE_FLAG_HALF_DUPLEX (1 << 1) #define VNET_HW_INTERFACE_FLAG_FULL_DUPLEX (1 << 2) #define VNET_HW_INTERFACE_FLAG_DUPLEX_MASK \ (VNET_HW_INTERFACE_FLAG_HALF_DUPLEX | \ VNET_HW_INTERFACE_FLAG_FULL_DUPLEX) /* Hardware link speed */ #define VNET_HW_INTERFACE_FLAG_SPEED_SHIFT 3 #define VNET_HW_INTERFACE_FLAG_SPEED_10M (1 << 3) #define VNET_HW_INTERFACE_FLAG_SPEED_100M (1 << 4) #define VNET_HW_INTERFACE_FLAG_SPEED_1G (1 << 5) #define VNET_HW_INTERFACE_FLAG_SPEED_2_5G (1 << 6) #define VNET_HW_INTERFACE_FLAG_SPEED_5G (1 << 7) #define VNET_HW_INTERFACE_FLAG_SPEED_10G (1 << 8) #define VNET_HW_INTERFACE_FLAG_SPEED_20G (1 << 9) #define VNET_HW_INTERFACE_FLAG_SPEED_25G (1 << 10) #define VNET_HW_INTERFACE_FLAG_SPEED_40G (1 << 11) #define VNET_HW_INTERFACE_FLAG_SPEED_50G (1 << 12) #define VNET_HW_INTERFACE_FLAG_SPEED_56G (1 << 13) #define VNET_HW_INTERFACE_FLAG_SPEED_100G (1 << 14) #define VNET_HW_INTERFACE_FLAG_SPEED_MASK \ (VNET_HW_INTERFACE_FLAG_SPEED_10M | \ VNET_HW_INTERFACE_FLAG_SPEED_100M | \ VNET_HW_INTERFACE_FLAG_SPEED_1G | \ VNET_HW_INTERFACE_FLAG_SPEED_2_5G | \ VNET_HW_INTERFACE_FLAG_SPEED_5G | \ VNET_HW_INTERFACE_FLAG_SPEED_10G | \ VNET_HW_INTERFACE_FLAG_SPEED_20G | \ VNET_HW_INTERFACE_FLAG_SPEED_25G | \ VNET_HW_INTERFACE_FLAG_SPEED_40G | \ VNET_HW_INTERFACE_FLAG_SPEED_50G | \ VNET_HW_INTERFACE_FLAG_SPEED_56G | \ VNET_HW_INTERFACE_FLAG_SPEED_100G) /* rx mode flags */ #define VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE (1 << 16) /* tx checksum offload */ #define VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD (1 << 17) /* Hardware address as vector. Zero (e.g. zero-length vector) if no address for this class (e.g. PPP). */ u8 *hw_address; /* Interface is up as far as software is concerned. */ /* NAME.{output,tx} nodes for this interface. */ u32 output_node_index, tx_node_index; /* (dev_class, dev_instance) uniquely identifies hw interface. */ u32 dev_class_index; u32 dev_instance; /* (hw_class, hw_instance) uniquely identifies hw interface. */ u32 hw_class_index; u32 hw_instance; /* Hardware index for this hardware interface. */ u32 hw_if_index; /* Software index for this hardware interface. */ u32 sw_if_index; /* Next index in interface-output node for this interface used by node function vnet_per_buffer_interface_output() */ u32 output_node_next_index; /* Maximum transmit rate for this interface in bits/sec. */ f64 max_rate_bits_per_sec; /* Smallest packet size supported by this interface. */ u32 min_supported_packet_bytes; /* Largest packet size supported by this interface. */ u32 max_supported_packet_bytes; /* Smallest packet size for this interface. */ u32 min_packet_bytes; /* Largest packet size for this interface. */ u32 max_packet_bytes; /* Number of extra bytes that go on the wire. Packet length on wire = max (length + per_packet_overhead_bytes, min_packet_bytes). */ u32 per_packet_overhead_bytes; /* Receive and transmit layer 3 packet size limits (MRU/MTU). */ u32 max_l3_packet_bytes[VLIB_N_RX_TX]; /* Hash table mapping sub interface id to sw_if_index. */ uword *sub_interface_sw_if_index_by_id; /* Count of number of L2 subinterfaces */ u32 l2_if_count; /* Bonded interface info - 0 - not a bonded interface nor a slave ~0 - slave to a bonded interface others - A bonded interface with a pointer to bitmap for all slaves */ uword *bond_info; #define VNET_HW_INTERFACE_BOND_INFO_NONE ((uword *) 0) #define VNET_HW_INTERFACE_BOND_INFO_SLAVE ((uword *) ~0) /* Input node */ u32 input_node_index; /* input node cpu index by queue */ u32 *input_node_thread_index_by_queue; /* vnet_hw_interface_rx_mode by queue */ u8 *rx_mode_by_queue; vnet_hw_interface_rx_mode default_rx_mode; /* device input device_and_queue runtime index */ uword *dq_runtime_index_by_queue; } vnet_hw_interface_t; extern vnet_device_class_t vnet_local_interface_device_class; typedef enum { /* A hw interface. */ VNET_SW_INTERFACE_TYPE_HARDWARE, /* A sub-interface. */ VNET_SW_INTERFACE_TYPE_SUB, VNET_SW_INTERFACE_TYPE_P2P, } vnet_sw_interface_type_t; typedef struct { /* * Subinterface ID. A number 0-N to uniquely identify * this subinterface under the main (parent?) interface */ u32 id; /* Classification data. Used to associate packet header with subinterface. */ struct { u16 outer_vlan_id; u16 inner_vlan_id; union { u16 raw_flags; struct { u16 no_tags:1; u16 one_tag:1; u16 two_tags:1; u16 dot1ad:1; /* 0 = dot1q, 1=dot1ad */ u16 exact_match:1; u16 default_sub:1; u16 outer_vlan_id_any:1; u16 inner_vlan_id_any:1; } flags; }; } eth; } vnet_sub_interface_t; typedef struct { /* * Subinterface ID. A number 0-N to uniquely identify * this subinterface under the main interface */ u32 id; u32 pool_index; u8 client_mac[6]; } vnet_p2p_sub_interface_t; typedef enum { /* Always flood */ VNET_FLOOD_CLASS_NORMAL, VNET_FLOOD_CLASS_TUNNEL_MASTER, /* Does not flood when tunnel master is in the same L2 BD */ VNET_FLOOD_CLASS_TUNNEL_NORMAL } vnet_flood_class_t; /* Software-interface. This corresponds to a Ethernet VLAN, ATM vc, a tunnel, etc. Configuration (e.g. IP address) gets attached to software interface. */ typedef struct { vnet_sw_interface_type_t type:16; u16 flags; /* Interface is "up" meaning adminstratively up. Up in the sense of link state being up is maintained by hardware interface. */ #define VNET_SW_INTERFACE_FLAG_ADMIN_UP (1 << 0) /* Interface is disabled for forwarding: punt all traffic to slow-path. */ #define VNET_SW_INTERFACE_FLAG_PUNT (1 << 1) #define VNET_SW_INTERFACE_FLAG_PROXY_ARP (1 << 2) #define VNET_SW_INTERFACE_FLAG_UNNUMBERED (1 << 3) #define VNET_SW_INTERFACE_FLAG_BOND_SLAVE (1 << 4) /* Interface does not appear in CLI/API */ #define VNET_SW_INTERFACE_FLAG_HIDDEN (1 << 5) /* Interface in ERROR state */ #define VNET_SW_INTERFACE_FLAG_ERROR (1 << 6) /* Index for this interface. */ u32 sw_if_index; /* Software interface index of super-interface; equal to sw_if_index if this interface is not a sub-interface. */ u32 sup_sw_if_index; /* this swif is unnumbered, use addresses on unnumbered_sw_if_index... */ u32 unnumbered_sw_if_index; u32 link_speed; union { /* VNET_SW_INTERFACE_TYPE_HARDWARE. */ u32 hw_if_index; /* VNET_SW_INTERFACE_TYPE_SUB. */ vnet_sub_interface_t sub; /* VNET_SW_INTERFACE_TYPE_P2P. */ vnet_p2p_sub_interface_t p2p; }; vnet_flood_class_t flood_class; } vnet_sw_interface_t; typedef enum { /* Simple counters. */ VNET_INTERFACE_COUNTER_DROP = 0, VNET_INTERFACE_COUNTER_PUNT = 1, VNET_INTERFACE_COUNTER_IP4 = 2, VNET_INTERFACE_COUNTER_IP6 = 3, VNET_INTERFACE_COUNTER_RX_NO_BUF = 4, VNET_INTERFACE_COUNTER_RX_MISS = 5, VNET_INTERFACE_COUNTER_RX_ERROR = 6, VNET_INTERFACE_COUNTER_TX_ERROR = 7, VNET_INTERFACE_COUNTER_MPLS = 8, VNET_N_SIMPLE_INTERFACE_COUNTER = 9, /* Combined counters. */ VNET_INTERFACE_COUNTER_RX = 0, VNET_INTERFACE_COUNTER_TX = 1, VNET_N_COMBINED_INTERFACE_COUNTER = 2, } vnet_interface_counter_type_t; typedef struct { u32 output_node_index; u32 tx_node_index; } vnet_hw_interface_nodes_t; typedef struct { /* Hardware interfaces. */ vnet_hw_interface_t *hw_interfaces; /* Hash table mapping HW interface name to index. */ uword *hw_interface_by_name; /* Vectors if hardware interface classes and device classes. */ vnet_hw_interface_class_t *hw_interface_classes; vnet_device_class_t *device_classes; /* Hash table mapping name to hw interface/device class. */ uword *hw_interface_class_by_name; uword *device_class_by_name; /* Software interfaces. */ vnet_sw_interface_t *sw_interfaces; /* Hash table mapping sub intfc sw_if_index by sup sw_if_index and sub id */ uword *sw_if_index_by_sup_and_sub; /* Software interface counters both simple and combined packet and byte counters. */ volatile u32 *sw_if_counter_lock; vlib_simple_counter_main_t *sw_if_counters; vlib_combined_counter_main_t *combined_sw_if_counters; vnet_hw_interface_nodes_t *deleted_hw_interface_nodes; /* pcap drop tracing */ int drop_pcap_enable; pcap_main_t pcap_main; u8 *pcap_filename; u32 pcap_sw_if_index; u32 pcap_pkts_to_capture; uword *pcap_drop_filter_hash; /* feature_arc_index */ u8 output_feature_arc_index; } vnet_interface_main_t; static inline void vnet_interface_counter_lock (vnet_interface_main_t * im) { if (im->sw_if_counter_lock) while (__sync_lock_test_and_set (im->sw_if_counter_lock, 1)) /* zzzz */ ; } static inline void vnet_interface_counter_unlock (vnet_interface_main_t * im) { if (im->sw_if_counter_lock) *im->sw_if_counter_lock = 0; } void vnet_pcap_drop_trace_filter_add_del (u32 error_index, int is_add); int vnet_interface_name_renumber (u32 sw_if_index, u32 new_show_dev_instance); #endif /* included_vnet_interface_h */ /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */