linux-cp: add support for tap num queues config
[vpp.git] / src / plugins / linux-cp / lcp.h
1 /*
2  * Copyright (c) 2020 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef __LCP_H__
16 #define __LCP_H__
17
18 #include <vlib/vlib.h>
19
20 #define LCP_NS_LEN 32
21
22 typedef struct lcp_main_s
23 {
24   u16 msg_id_base;                  /* API message ID base */
25   u8 *default_namespace;            /* default namespace if set */
26   int default_ns_fd;
27   u8 lcp_auto_subint; /* Automatically create/delete LCP sub-interfaces */
28   u8 lcp_sync;        /* Automatically sync VPP changes to LCP */
29   u8 del_static_on_link_down;  /* Delete static routes when link goes down */
30   u8 del_dynamic_on_link_down; /* Delete dynamic routes when link goes down */
31   u16 num_rx_queues;
32   u16 num_tx_queues;
33   u8 test_mode;       /* Set when Unit testing */
34   u8 netlink_processing_active; /* Set while a batch of Netlink messages are
35                                    being processed */
36 } lcp_main_t;
37
38 extern lcp_main_t lcp_main;
39
40 /**
41  * Get/Set the default namespace for LCP host taps.
42  */
43 int lcp_set_default_ns (u8 *ns);
44 u8 *lcp_get_default_ns (void); /* Returns NULL or shared string */
45 int lcp_get_default_ns_fd (void);
46
47 /**
48  * Get/Set whether to delete static routes when the link goes down.
49  */
50 void lcp_set_del_static_on_link_down (u8 is_del);
51 u8 lcp_get_del_static_on_link_down (void);
52
53 /**
54  * Get/Set whether to delete dynamic routes when the link goes down.
55  */
56 void lcp_set_del_dynamic_on_link_down (u8 is_del);
57 u8 lcp_get_del_dynamic_on_link_down (void);
58
59 /**
60  * Get/Set when we're processing a batch of netlink messages.
61  * This is used to avoid looping messages between lcp-sync and netlink.
62  */
63 void lcp_set_netlink_processing_active (u8 is_processing);
64 u8 lcp_get_netlink_processing_active (void);
65
66 /**
67  * Get/Set the default queue number for LCP host taps.
68  */
69 void lcp_set_default_num_queues (u16 num_queues, u8 is_tx);
70 u16 lcp_get_default_num_queues (u8 is_tx);
71
72 #endif
73
74 /*
75  * fd.io coding-style-patch-verification: ON
76  *
77  * Local Variables:
78  * eval: (c-set-style "gnu")
79  * End:
80  */