2 // Copyright (c) 2017 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 #ifndef __INCLUDE_PIPELINE_ARPICMP_H__
18 #define __INCLUDE_PIPELINE_ARPICMP_H__
21 #include "pipeline_arpicmp_be.h"
26 extern struct pipeline_type pipeline_arpicmp;
27 //uint16_t verbose_level = 1; /**< should be Silent by default. */
28 #define MAX_PKT_BURST 512
29 #define DEF_PKT_BURST 32
30 /**< Number of packets per burst. */
31 //uint16_t nb_pkt_per_burst = DEF_PKT_BURST;
32 typedef uint8_t portid_t;
33 typedef uint16_t queueid_t;
34 typedef uint16_t streamid_t;
36 * The data structure associated with a forwarding stream between a receive
37 * port/queue and a transmit port/queue.
40 /* "read-only" data */
41 /**< port to poll for received packets */
43 /**< RX queue to poll on "rx_port" */
45 /**< forwarding port of received packets */
47 /**< TX queue to send forwarded packets */
49 /**< index of peer ethernet address of packets */
52 /* "read-write" results */
53 /**< received packets */
54 unsigned int rx_packets;
55 /**< received packets transmitted */
56 unsigned int tx_packets;
57 /**< received packets not forwarded */
58 unsigned int fwd_dropped;
59 /**< received packets has bad ip checksum */
60 unsigned int rx_bad_ip_csum;
61 /**< received packets has bad l4 checksum */
62 unsigned int rx_bad_l4_csum;
63 #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
64 uint64_t core_cycles; /**< used for RX and TX processing */
66 #ifdef RTE_TEST_PMD_RECORD_BURST_STATS
67 struct pkt_burst_stats rx_burst_stats;
68 struct pkt_burst_stats tx_burst_stats;
72 * Forwarding mode operations:
73 * - IO forwarding mode (default mode)
74 * Forwards packets unchanged.
76 * - MAC forwarding mode
77 * Set the source and the destination Ethernet addresses of packets
78 * before forwarding them.
80 * - IEEE1588 forwarding mode
81 * Check that received IEEE1588 Precise Time Protocol (PTP) packets are
82 * filtered and timestamped by the hardware.
83 * Forwards packets unchanged on the same port.
84 * Check that sent IEEE1588 PTP packets are timestamped by the hardware.
86 typedef void (*port_fwd_begin_t)(portid_t pi);
87 typedef void (*port_fwd_end_t)(portid_t pi);
88 typedef void (*packet_fwd_t)(struct fwd_stream *fs);
90 /**< Forwarding mode name. */
91 const char *fwd_mode_name;
92 /**< NULL if nothing special to do. */
93 port_fwd_begin_t port_fwd_begin;
94 /**< NULL if nothing special to do. */
95 port_fwd_end_t port_fwd_end;
97 packet_fwd_t packet_fwd;
99 #define IPV4_ADDR_TO_UINT(ip_addr, ip) \
101 if ((ip_addr).family == AF_INET) \
102 (ip) = (ip_addr).addr.ipv4.s_addr; \
104 printf("invalid parameter.\n"); \
109 #define IPV6_ADDR_TO_ARRAY(ip_addr, ip) \
111 if ((ip_addr).family == AF_INET6) \
112 (void)rte_memcpy(&(ip), \
113 &((ip_addr).addr.ipv6), \
114 sizeof(struct in6_addr)); \
116 printf("invalid parameter.\n"); \
121 void set_pkt_forwarding_mode(const char *fwd_mode_name);