[l2l3 stack] implements new nd state machine & nd buffering
[samplevnf.git] / common / VIL / pipeline_arpicmp / pipeline_arpicmp_be.h
1 /*
2 // Copyright (c) 2017 Intel Corporation
3 //
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
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 */
16
17 #ifndef __INCLUDE_PIPELINE_ARPICMP_BE_H__
18 #define __INCLUDE_PIPELINE_ARPICMP_BE_H__
19
20 #include "pipeline_common_be.h"
21 #define PIPELINE_ARPICMP_KEY_PORT_IN_AH(f_ah, f_pkt_work, f_pkt4_work)  \
22 static int                                                              \
23 f_ah(                                                                   \
24         __rte_unused struct rte_pipeline *rte_p,                        \
25         struct rte_mbuf **pkts,                                         \
26         uint32_t n_pkts,                                                \
27         void *arg)                                                      \
28 {                                                                       \
29         uint32_t i, j;                                                  \
30                                                                         \
31         for (j = 0; j < n_pkts; j++)                                    \
32                 rte_prefetch0(pkts[j]);                                 \
33                                                                         \
34         for (i = 0; i < (n_pkts & (~0x3LLU)); i += 4)                   \
35                 f_pkt4_work(&pkts[i], i, arg);                          \
36                                                                         \
37         for ( ; i < n_pkts; i++)                                        \
38                 f_pkt_work(pkts[i], i, arg);                            \
39                                                                         \
40                                                                         \
41         return 0;                                                       \
42 }
43
44 extern struct app_params *myApp;
45 void print_pkt1(struct rte_mbuf *pkt);
46 struct ether_addr *get_link_hw_addr(uint8_t out_port);
47
48 uint8_t lb_outport_id[PIPELINE_MAX_PORT_IN];
49 struct pipeline *loadb_pipeline[PIPELINE_MAX_PORT_IN];
50 struct pipeline *all_pipeline[PIPELINE_MAX_PORT_IN];
51 uint8_t vnf_to_loadb_map[PIPELINE_MAX_PORT_IN];
52 uint8_t port_to_loadb_map[PIPELINE_MAX_PORT_IN];
53 uint8_t loadb_pipeline_nums[PIPELINE_MAX_PORT_IN];
54
55 void set_port_to_loadb_map(uint8_t pipeline_num);
56 uint8_t get_port_to_loadb_map(uint8_t phy_port_id);
57 /* acts on port_to_loadb_map */
58
59 void set_phy_inport_map(uint8_t pipeline_num, uint8_t *map);
60 void set_phy_outport_map(uint8_t pipeline_num, uint8_t *map);
61
62 void set_outport_id(uint8_t pipeline_num, struct pipeline *p, uint8_t *map);
63 /* acts on lb_outport_id */
64 uint8_t get_loadb_outport_id(uint8_t actual_phy_port);
65 /* acts on lb_outport_id */
66 uint8_t get_vnf_set_num(uint8_t pipeline_num);
67
68 void pipelines_port_info(void);
69 void pipelines_map_info(void);
70 void register_loadb_to_arp(uint8_t pipeline_num, struct pipeline *p,
71                                  __rte_unused struct app_params *app);
72 /* vnf_to_loadb_map[]  and loadb_pipelines[] */
73 uint8_t SWQ_to_Port_map[128];
74
75 extern struct pipeline_be_ops pipeline_arpicmp_be_ops;
76 void register_pipeline_Qs(uint8_t pipeline_num, struct pipeline *p);
77 void set_link_map(uint8_t pipeline_num, struct pipeline *p, uint8_t *map);
78 void set_outport_id(uint8_t pipeline_num, struct pipeline *p, uint8_t *map);
79 void set_phy_outport_id(uint8_t pipeline_num, struct pipeline *p, uint8_t *map);
80 void set_phy_inport_id(uint8_t pipeline_num, struct pipeline *p, uint8_t *map);
81
82 /*
83  * Messages
84  */
85 enum pipeline_arpicmp_msg_req_type {
86         PIPELINE_ARPICMP_MSG_REQ_ENTRY_DBG,
87         PIPELINE_ARPICMP_MSG_REQS
88 };
89
90 /*
91  * MSG ENTRY DBG
92  */
93 struct pipeline_arpicmp_entry_dbg_msg_req {
94         enum pipeline_msg_req_type type;
95         enum pipeline_arpicmp_msg_req_type subtype;
96
97         /* data */
98         uint8_t data[2];
99 };
100
101 /*
102  * ARPICMP Entry
103  */
104
105 struct pipeline_arpicmp_in_port_h_arg {
106         struct pipeline_arpicmp *p;
107         uint8_t in_port_id;
108 };
109
110 struct pipeline_arpicmp_entry_dbg_msg_rsp {
111         int status;
112 };
113
114 #endif