From 68d48d94a84f6499a16cd362d0a225b1720baf67 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Thu, 3 Jun 2021 14:59:47 +0000 Subject: pg: Reduce the inclusion of pg.h Type: style reduce the number of files recompiled after changing pg.h from 1110 to 102. Signed-off-by: Neale Ranns Change-Id: I50611eba818eeb3a2dffd437a3c72c77766bed80 --- src/vnet/arp/arp.c | 1 + src/vnet/devices/virtio/vhost_user_input.c | 3 +++ src/vnet/ethernet/ethernet.h | 12 +----------- src/vnet/ethernet/node.c | 11 +++++++++++ src/vnet/hdlc/hdlc.h | 12 ------------ src/vnet/hdlc/node.c | 11 +++++++++++ src/vnet/ip/ip4_forward.c | 1 + src/vnet/ip/ip4_input.c | 1 + src/vnet/ip/ip6_forward.c | 1 + src/vnet/ip/ip6_input.c | 1 + src/vnet/ipfix-export/flow_report.h | 1 - src/vnet/llc/llc.h | 12 ------------ src/vnet/llc/node.c | 12 ++++++++++++ src/vnet/osi/node.c | 11 +++++++++++ src/vnet/osi/osi.h | 12 ------------ src/vnet/ppp/node.c | 11 +++++++++++ src/vnet/ppp/ppp.h | 12 ------------ src/vnet/snap/node.c | 11 +++++++++++ src/vnet/snap/snap.h | 12 ------------ src/vnet/srp/node.c | 11 +++++++++++ src/vnet/srp/srp.h | 11 ----------- 21 files changed, 87 insertions(+), 83 deletions(-) (limited to 'src/vnet') diff --git a/src/vnet/arp/arp.c b/src/vnet/arp/arp.c index 299ed97f6e4..ced3c1cb7a7 100644 --- a/src/vnet/arp/arp.c +++ b/src/vnet/arp/arp.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include diff --git a/src/vnet/devices/virtio/vhost_user_input.c b/src/vnet/devices/virtio/vhost_user_input.c index 69fba411f1c..6abc1fc6e94 100644 --- a/src/vnet/devices/virtio/vhost_user_input.c +++ b/src/vnet/devices/virtio/vhost_user_input.c @@ -42,6 +42,9 @@ #include #include +#include +#include + /* * When an RX queue is down but active, received packets * must be discarded. This value controls up to how many diff --git a/src/vnet/ethernet/ethernet.h b/src/vnet/ethernet/ethernet.h index a83b0f39295..f3dd1a24a4f 100644 --- a/src/vnet/ethernet/ethernet.h +++ b/src/vnet/ethernet/ethernet.h @@ -43,7 +43,6 @@ #include #include #include -#include #include /* ethernet-input frame flags and scalar data */ @@ -404,16 +403,7 @@ uword unformat_ethernet_interface (unformat_input_t * input, va_list * args); uword unformat_pg_ethernet_header (unformat_input_t * input, va_list * args); -always_inline void -ethernet_setup_node (vlib_main_t * vm, u32 node_index) -{ - vlib_node_t *n = vlib_get_node (vm, node_index); - pg_node_t *pn = pg_get_node (node_index); - - n->format_buffer = format_ethernet_header_with_length; - n->unformat_buffer = unformat_ethernet_header; - pn->unformat_edit = unformat_pg_ethernet_header; -} +void ethernet_setup_node (vlib_main_t *vm, u32 node_index); always_inline ethernet_header_t * ethernet_buffer_get_header (vlib_buffer_t * b) diff --git a/src/vnet/ethernet/node.c b/src/vnet/ethernet/node.c index 88b4a70a28a..f470c1c7b46 100644 --- a/src/vnet/ethernet/node.c +++ b/src/vnet/ethernet/node.c @@ -2236,6 +2236,17 @@ next_by_ethertype_register (next_by_ethertype_t * l3_next, return 0; } +void +ethernet_setup_node (vlib_main_t *vm, u32 node_index) +{ + vlib_node_t *n = vlib_get_node (vm, node_index); + pg_node_t *pn = pg_get_node (node_index); + + n->format_buffer = format_ethernet_header_with_length; + n->unformat_buffer = unformat_ethernet_header; + pn->unformat_edit = unformat_pg_ethernet_header; +} + void ethernet_input_init (vlib_main_t * vm, ethernet_main_t * em) { diff --git a/src/vnet/hdlc/hdlc.h b/src/vnet/hdlc/hdlc.h index a2bd6e928b2..490ea949dae 100644 --- a/src/vnet/hdlc/hdlc.h +++ b/src/vnet/hdlc/hdlc.h @@ -42,7 +42,6 @@ #include #include -#include extern vnet_hw_interface_class_t hdlc_hw_interface_class; @@ -106,17 +105,6 @@ unformat_function_t unformat_hdlc_protocol_net_byte_order; unformat_function_t unformat_hdlc_header; unformat_function_t unformat_pg_hdlc_header; -always_inline void -hdlc_setup_node (vlib_main_t * vm, u32 node_index) -{ - vlib_node_t *n = vlib_get_node (vm, node_index); - pg_node_t *pn = pg_get_node (node_index); - - n->format_buffer = format_hdlc_header_with_length; - n->unformat_buffer = unformat_hdlc_header; - pn->unformat_edit = unformat_pg_hdlc_header; -} - void hdlc_register_input_protocol (vlib_main_t * vm, hdlc_protocol_t protocol, u32 node_index); diff --git a/src/vnet/hdlc/node.c b/src/vnet/hdlc/node.c index d36b09d4dcd..8bb621231c7 100644 --- a/src/vnet/hdlc/node.c +++ b/src/vnet/hdlc/node.c @@ -324,6 +324,17 @@ hdlc_input_runtime_init (vlib_main_t * vm) return 0; } +static void +hdlc_setup_node (vlib_main_t *vm, u32 node_index) +{ + vlib_node_t *n = vlib_get_node (vm, node_index); + pg_node_t *pn = pg_get_node (node_index); + + n->format_buffer = format_hdlc_header_with_length; + n->unformat_buffer = unformat_hdlc_header; + pn->unformat_edit = unformat_pg_hdlc_header; +} + static clib_error_t * hdlc_input_init (vlib_main_t * vm) { diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c index da8522de775..36f05a27820 100644 --- a/src/vnet/ip/ip4_forward.c +++ b/src/vnet/ip/ip4_forward.c @@ -55,6 +55,7 @@ #include #include /* for mFIB table and entry creation */ #include +#include #include #include diff --git a/src/vnet/ip/ip4_input.c b/src/vnet/ip/ip4_input.c index bf8e05c1bab..3b3edf9fca7 100644 --- a/src/vnet/ip/ip4_input.c +++ b/src/vnet/ip/ip4_input.c @@ -39,6 +39,7 @@ #include #include +#include #include #include #include diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c index 5d7014070bd..fd742d6b3e2 100644 --- a/src/vnet/ip/ip6_forward.c +++ b/src/vnet/ip/ip6_forward.c @@ -50,6 +50,7 @@ #include #include #include +#include #ifndef CLIB_MARCH_VARIANT #include diff --git a/src/vnet/ip/ip6_input.c b/src/vnet/ip/ip6_input.c index 65d39ebc54d..01b8f46b4d8 100644 --- a/src/vnet/ip/ip6_input.c +++ b/src/vnet/ip/ip6_input.c @@ -41,6 +41,7 @@ #include #include #include +#include typedef struct { diff --git a/src/vnet/ipfix-export/flow_report.h b/src/vnet/ipfix-export/flow_report.h index 30c11760c92..98da146427a 100644 --- a/src/vnet/ipfix-export/flow_report.h +++ b/src/vnet/ipfix-export/flow_report.h @@ -17,7 +17,6 @@ #include #include -#include #include #include #include diff --git a/src/vnet/llc/llc.h b/src/vnet/llc/llc.h index 990a581db7b..2496cfd510d 100644 --- a/src/vnet/llc/llc.h +++ b/src/vnet/llc/llc.h @@ -41,7 +41,6 @@ #define included_llc_h #include -#include /* Protocol (SSAP/DSAP) types. */ #define foreach_llc_protocol \ @@ -169,17 +168,6 @@ unformat_function_t unformat_llc_protocol; unformat_function_t unformat_llc_header; unformat_function_t unformat_pg_llc_header; -always_inline void -llc_setup_node (vlib_main_t * vm, u32 node_index) -{ - vlib_node_t *n = vlib_get_node (vm, node_index); - pg_node_t *pn = pg_get_node (node_index); - - n->format_buffer = format_llc_header_with_length; - n->unformat_buffer = unformat_llc_header; - pn->unformat_edit = unformat_pg_llc_header; -} - #endif /* included_llc_h */ /* diff --git a/src/vnet/llc/node.c b/src/vnet/llc/node.c index 79d15418af2..086925bd305 100644 --- a/src/vnet/llc/node.c +++ b/src/vnet/llc/node.c @@ -38,6 +38,7 @@ */ #include +#include #include #define foreach_llc_input_next \ @@ -268,6 +269,17 @@ VLIB_REGISTER_NODE (llc_input_node) = { }; /* *INDENT-ON* */ +static void +llc_setup_node (vlib_main_t *vm, u32 node_index) +{ + vlib_node_t *n = vlib_get_node (vm, node_index); + pg_node_t *pn = pg_get_node (node_index); + + n->format_buffer = format_llc_header_with_length; + n->unformat_buffer = unformat_llc_header; + pn->unformat_edit = unformat_pg_llc_header; +} + static clib_error_t * llc_input_init (vlib_main_t * vm) { diff --git a/src/vnet/osi/node.c b/src/vnet/osi/node.c index bdeab2df074..4eb3e461139 100644 --- a/src/vnet/osi/node.c +++ b/src/vnet/osi/node.c @@ -262,6 +262,17 @@ VLIB_REGISTER_NODE (osi_input_node) = { }; /* *INDENT-ON* */ +static void +osi_setup_node (vlib_main_t *vm, u32 node_index) +{ + vlib_node_t *n = vlib_get_node (vm, node_index); + pg_node_t *pn = pg_get_node (node_index); + + n->format_buffer = format_osi_header_with_length; + n->unformat_buffer = unformat_osi_header; + pn->unformat_edit = unformat_pg_osi_header; +} + static clib_error_t * osi_input_init (vlib_main_t * vm) { diff --git a/src/vnet/osi/osi.h b/src/vnet/osi/osi.h index 0ff267a330b..fb248ed9cc5 100644 --- a/src/vnet/osi/osi.h +++ b/src/vnet/osi/osi.h @@ -41,7 +41,6 @@ #define included_osi_h #include -#include #define foreach_osi_protocol \ _ (null, 0x0) \ @@ -142,17 +141,6 @@ unformat_function_t unformat_osi_protocol; unformat_function_t unformat_osi_header; unformat_function_t unformat_pg_osi_header; -always_inline void -osi_setup_node (vlib_main_t * vm, u32 node_index) -{ - vlib_node_t *n = vlib_get_node (vm, node_index); - pg_node_t *pn = pg_get_node (node_index); - - n->format_buffer = format_osi_header_with_length; - n->unformat_buffer = unformat_osi_header; - pn->unformat_edit = unformat_pg_osi_header; -} - void osi_register_input_protocol (osi_protocol_t protocol, u32 node_index); format_function_t format_osi_header; diff --git a/src/vnet/ppp/node.c b/src/vnet/ppp/node.c index fd0105e4305..eead2b2f0c1 100644 --- a/src/vnet/ppp/node.c +++ b/src/vnet/ppp/node.c @@ -311,6 +311,17 @@ ppp_input_runtime_init (vlib_main_t * vm) return 0; } +static void +ppp_setup_node (vlib_main_t *vm, u32 node_index) +{ + vlib_node_t *n = vlib_get_node (vm, node_index); + pg_node_t *pn = pg_get_node (node_index); + + n->format_buffer = format_ppp_header_with_length; + n->unformat_buffer = unformat_ppp_header; + pn->unformat_edit = unformat_pg_ppp_header; +} + static clib_error_t * ppp_input_init (vlib_main_t * vm) { diff --git a/src/vnet/ppp/ppp.h b/src/vnet/ppp/ppp.h index 726eca66835..77da8c19bba 100644 --- a/src/vnet/ppp/ppp.h +++ b/src/vnet/ppp/ppp.h @@ -42,7 +42,6 @@ #include #include -#include extern vnet_hw_interface_class_t ppp_hw_interface_class; @@ -106,17 +105,6 @@ unformat_function_t unformat_ppp_protocol_net_byte_order; unformat_function_t unformat_ppp_header; unformat_function_t unformat_pg_ppp_header; -always_inline void -ppp_setup_node (vlib_main_t * vm, u32 node_index) -{ - vlib_node_t *n = vlib_get_node (vm, node_index); - pg_node_t *pn = pg_get_node (node_index); - - n->format_buffer = format_ppp_header_with_length; - n->unformat_buffer = unformat_ppp_header; - pn->unformat_edit = unformat_pg_ppp_header; -} - void ppp_register_input_protocol (vlib_main_t * vm, ppp_protocol_t protocol, u32 node_index); diff --git a/src/vnet/snap/node.c b/src/vnet/snap/node.c index 9baa75002cb..2a42907321c 100644 --- a/src/vnet/snap/node.c +++ b/src/vnet/snap/node.c @@ -284,6 +284,17 @@ VLIB_REGISTER_NODE (snap_input_node) = { }; /* *INDENT-ON* */ +static void +snap_setup_node (vlib_main_t *vm, u32 node_index) +{ + vlib_node_t *n = vlib_get_node (vm, node_index); + pg_node_t *pn = pg_get_node (node_index); + + n->format_buffer = format_snap_header_with_length; + n->unformat_buffer = unformat_snap_header; + pn->unformat_edit = unformat_pg_snap_header; +} + static clib_error_t * snap_input_init (vlib_main_t * vm) { diff --git a/src/vnet/snap/snap.h b/src/vnet/snap/snap.h index 08c3a8b9c18..f6b3be1847f 100644 --- a/src/vnet/snap/snap.h +++ b/src/vnet/snap/snap.h @@ -41,7 +41,6 @@ #define included_snap_h #include -#include #define foreach_ieee_oui \ _ (0x000000, ethernet) \ @@ -184,17 +183,6 @@ unformat_function_t unformat_snap_protocol; unformat_function_t unformat_snap_header; unformat_function_t unformat_pg_snap_header; -always_inline void -snap_setup_node (vlib_main_t * vm, u32 node_index) -{ - vlib_node_t *n = vlib_get_node (vm, node_index); - pg_node_t *pn = pg_get_node (node_index); - - n->format_buffer = format_snap_header_with_length; - n->unformat_buffer = unformat_snap_header; - pn->unformat_edit = unformat_pg_snap_header; -} - #endif /* included_snap_h */ /* diff --git a/src/vnet/srp/node.c b/src/vnet/srp/node.c index 926cb7cb45c..12c14012b61 100644 --- a/src/vnet/srp/node.c +++ b/src/vnet/srp/node.c @@ -40,6 +40,7 @@ #include #include /* for ip_csum_fold */ #include +#include srp_main_t srp_main; @@ -861,6 +862,16 @@ vlib_node_registration_t srp_ips_process_node = { .state = VLIB_NODE_STATE_DISABLED, }; +static void +srp_setup_node (vlib_main_t *vm, u32 node_index) +{ + vlib_node_t *n = vlib_get_node (vm, node_index); + pg_node_t *pn = pg_get_node (node_index); + n->format_buffer = format_srp_header_with_length; + n->unformat_buffer = unformat_srp_header; + pn->unformat_edit = unformat_pg_srp_header; +} + static clib_error_t * srp_init (vlib_main_t * vm) { srp_main_t * sm = &srp_main; diff --git a/src/vnet/srp/srp.h b/src/vnet/srp/srp.h index 8f59e064c8b..2873d5a2184 100644 --- a/src/vnet/srp/srp.h +++ b/src/vnet/srp/srp.h @@ -43,7 +43,6 @@ #include #include #include -#include extern vnet_hw_interface_class_t srp_hw_interface_class; @@ -189,16 +188,6 @@ unformat_srp_header (unformat_input_t * input, va_list * args); uword unformat_pg_srp_header (unformat_input_t * input, va_list * args); -always_inline void -srp_setup_node (vlib_main_t * vm, u32 node_index) -{ - vlib_node_t * n = vlib_get_node (vm, node_index); - pg_node_t * pn = pg_get_node (node_index); - n->format_buffer = format_srp_header_with_length; - n->unformat_buffer = unformat_srp_header; - pn->unformat_edit = unformat_pg_srp_header; -} - #define foreach_srp_error \ _ (NONE, "no error") \ _ (UNKNOWN_MODE, "unknown mode in SRP header") \ -- cgit 1.2.3-korg