diff options
author | Vishwesh M Rudramuni <vishweshmr@gmail.com> | 2017-04-18 19:41:40 +0530 |
---|---|---|
committer | Deepak S <deepak.s@linux.intel.com> | 2017-04-18 02:59:07 -0700 |
commit | 51cd08d9a3f2826088d122e2a5683315c77a2786 (patch) | |
tree | 3fac17a8f7bf362f0c77f1003615b2063d900d35 /common/VIL/pipeline_arpicmp/pipeline_arpicmp.h | |
parent | 03aef84e240c5be8813634735d825420129f1460 (diff) |
common: Adding common library for sample vnf
JIRA: SAMPLEVNF-3
This patch adds common libraries required as part of the
sample vnf.
This includes the following libraries
1. ACL library
2. SIP
3. FTP
4. Connection tracker
5. L2l3 stack
- Interface Manager
- ARP & ICMPv4
- ND & ICMPv6
and other common libraries needed for ip pipeline framework
Change-Id: I117690b6b63fbcd76974cd7274518484e60980ab
Signed-off-by: Vishwesh M Rudramuni <vishwesh.m.rudramuni@intel.com>
[Push patch to gerrit]
Signed-off-by: Deepak S <deepak.s@linux.intel.com>
Diffstat (limited to 'common/VIL/pipeline_arpicmp/pipeline_arpicmp.h')
-rw-r--r-- | common/VIL/pipeline_arpicmp/pipeline_arpicmp.h | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/common/VIL/pipeline_arpicmp/pipeline_arpicmp.h b/common/VIL/pipeline_arpicmp/pipeline_arpicmp.h new file mode 100644 index 00000000..1efb14e2 --- /dev/null +++ b/common/VIL/pipeline_arpicmp/pipeline_arpicmp.h @@ -0,0 +1,122 @@ +/* +// Copyright (c) 2017 Intel Corporation +// +// 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. +*/ + +#ifndef __INCLUDE_PIPELINE_ARPICMP_H__ +#define __INCLUDE_PIPELINE_ARPICMP_H__ + +#include "pipeline.h" +#include "pipeline_arpicmp_be.h" + +/* + * Pipeline type + */ +extern struct pipeline_type pipeline_arpicmp; +//uint16_t verbose_level = 1; /**< should be Silent by default. */ +#define MAX_PKT_BURST 512 +#define DEF_PKT_BURST 32 +/**< Number of packets per burst. */ +//uint16_t nb_pkt_per_burst = DEF_PKT_BURST; +typedef uint8_t portid_t; +typedef uint16_t queueid_t; +typedef uint16_t streamid_t; +/** + * The data structure associated with a forwarding stream between a receive + * port/queue and a transmit port/queue. + */ +struct fwd_stream { + /* "read-only" data */ + /**< port to poll for received packets */ + portid_t rx_port; + /**< RX queue to poll on "rx_port" */ + queueid_t rx_queue; + /**< forwarding port of received packets */ + portid_t tx_port; + /**< TX queue to send forwarded packets */ + queueid_t tx_queue; + /**< index of peer ethernet address of packets */ + streamid_t peer_addr; + + /* "read-write" results */ + /**< received packets */ + unsigned int rx_packets; + /**< received packets transmitted */ + unsigned int tx_packets; + /**< received packets not forwarded */ + unsigned int fwd_dropped; + /**< received packets has bad ip checksum */ + unsigned int rx_bad_ip_csum; + /**< received packets has bad l4 checksum */ + unsigned int rx_bad_l4_csum; + #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES + uint64_t core_cycles; /**< used for RX and TX processing */ + #endif + #ifdef RTE_TEST_PMD_RECORD_BURST_STATS + struct pkt_burst_stats rx_burst_stats; + struct pkt_burst_stats tx_burst_stats; + #endif +}; +/* + * Forwarding mode operations: + * - IO forwarding mode (default mode) + * Forwards packets unchanged. + * + * - MAC forwarding mode + * Set the source and the destination Ethernet addresses of packets + * before forwarding them. + * + * - IEEE1588 forwarding mode + * Check that received IEEE1588 Precise Time Protocol (PTP) packets are + * filtered and timestamped by the hardware. + * Forwards packets unchanged on the same port. + * Check that sent IEEE1588 PTP packets are timestamped by the hardware. + */ +typedef void (*port_fwd_begin_t)(portid_t pi); +typedef void (*port_fwd_end_t)(portid_t pi); +typedef void (*packet_fwd_t)(struct fwd_stream *fs); +struct fwd_engine { + /**< Forwarding mode name. */ + const char *fwd_mode_name; + /**< NULL if nothing special to do. */ + port_fwd_begin_t port_fwd_begin; + /**< NULL if nothing special to do. */ + port_fwd_end_t port_fwd_end; + /**< Mandatory. */ + packet_fwd_t packet_fwd; +}; +#define IPV4_ADDR_TO_UINT(ip_addr, ip) \ +do { \ + if ((ip_addr).family == AF_INET) \ + (ip) = (ip_addr).addr.ipv4.s_addr; \ + else { \ + printf("invalid parameter.\n"); \ + return; \ + } \ +} while (0) + +#define IPV6_ADDR_TO_ARRAY(ip_addr, ip) \ +do { \ + if ((ip_addr).family == AF_INET6) \ + (void)rte_memcpy(&(ip), \ + &((ip_addr).addr.ipv6), \ + sizeof(struct in6_addr)); \ + else { \ + printf("invalid parameter.\n"); \ + return; \ + } \ +} while (0) + +void set_pkt_forwarding_mode(const char *fwd_mode_name); +#endif |