pg: Reduce the inclusion of pg.h 57/32557/2
authorNeale Ranns <neale@graphiant.com>
Thu, 3 Jun 2021 14:59:47 +0000 (14:59 +0000)
committerNeale Ranns <neale@graphiant.com>
Mon, 7 Jun 2021 07:19:00 +0000 (07:19 +0000)
Type: style

reduce the number of files recompiled after changing pg.h from 1110 to
102.

Signed-off-by: Neale Ranns <neale@graphiant.com>
Change-Id: I50611eba818eeb3a2dffd437a3c72c77766bed80

21 files changed:
src/vnet/arp/arp.c
src/vnet/devices/virtio/vhost_user_input.c
src/vnet/ethernet/ethernet.h
src/vnet/ethernet/node.c
src/vnet/hdlc/hdlc.h
src/vnet/hdlc/node.c
src/vnet/ip/ip4_forward.c
src/vnet/ip/ip4_input.c
src/vnet/ip/ip6_forward.c
src/vnet/ip/ip6_input.c
src/vnet/ipfix-export/flow_report.h
src/vnet/llc/llc.h
src/vnet/llc/node.c
src/vnet/osi/node.c
src/vnet/osi/osi.h
src/vnet/ppp/node.c
src/vnet/ppp/ppp.h
src/vnet/snap/node.c
src/vnet/snap/snap.h
src/vnet/srp/node.c
src/vnet/srp/srp.h

index 299ed97..ced3c1c 100644 (file)
@@ -22,6 +22,7 @@
 #include <vnet/fib/fib_entry_src.h>
 #include <vnet/adj/adj_nbr.h>
 #include <vnet/adj/adj_mcast.h>
+#include <vnet/pg/pg.h>
 
 #include <vnet/ip-neighbor/ip_neighbor.h>
 #include <vnet/ip-neighbor/ip_neighbor_dp.h>
index 69fba41..6abc1fc 100644 (file)
@@ -42,6 +42,9 @@
 #include <vnet/devices/virtio/vhost_user.h>
 #include <vnet/devices/virtio/vhost_user_inline.h>
 
+#include <vnet/ip/ip4_packet.h>
+#include <vnet/ip/ip6_packet.h>
+
 /*
  * When an RX queue is down but active, received packets
  * must be discarded. This value controls up to how many
index a83b0f3..f3dd1a2 100644 (file)
@@ -43,7 +43,6 @@
 #include <vnet/vnet.h>
 #include <vnet/ethernet/packet.h>
 #include <vnet/ethernet/mac_address.h>
-#include <vnet/pg/pg.h>
 #include <vnet/feature/feature.h>
 
 /* 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)
index 88b4a70..f470c1c 100644 (file)
@@ -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)
 {
index a2bd6e9..490ea94 100644 (file)
@@ -42,7 +42,6 @@
 
 #include <vnet/vnet.h>
 #include <vnet/hdlc/packet.h>
-#include <vnet/pg/pg.h>
 
 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);
index d36b09d..8bb6212 100644 (file)
@@ -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)
 {
index da8522d..36f05a2 100644 (file)
@@ -55,6 +55,7 @@
 #include <vnet/dpo/classify_dpo.h>
 #include <vnet/mfib/mfib_table.h>      /* for mFIB table and entry creation */
 #include <vnet/adj/adj_dp.h>
+#include <vnet/pg/pg.h>
 
 #include <vnet/ip/ip4_forward.h>
 #include <vnet/interface_output.h>
index bf8e05c..3b3edf9 100644 (file)
@@ -39,6 +39,7 @@
 
 #include <vnet/ip/ip4_input.h>
 #include <vnet/ethernet/ethernet.h>
+#include <vnet/pg/pg.h>
 #include <vnet/ppp/ppp.h>
 #include <vnet/hdlc/hdlc.h>
 #include <vnet/util/throttle.h>
index 5d70140..fd742d6 100644 (file)
@@ -50,6 +50,7 @@
 #include <vnet/dpo/load_balance_map.h>
 #include <vnet/dpo/classify_dpo.h>
 #include <vnet/classify/vnet_classify.h>
+#include <vnet/pg/pg.h>
 
 #ifndef CLIB_MARCH_VARIANT
 #include <vppinfra/bihash_template.c>
index 65d39eb..01b8f46 100644 (file)
@@ -41,6 +41,7 @@
 #include <vnet/ethernet/ethernet.h>
 #include <vnet/ppp/ppp.h>
 #include <vnet/hdlc/hdlc.h>
+#include <vnet/pg/pg.h>
 
 typedef struct
 {
index 30c1176..98da146 100644 (file)
@@ -17,7 +17,6 @@
 
 #include <vlib/vlib.h>
 #include <vnet/vnet.h>
-#include <vnet/pg/pg.h>
 #include <vnet/ethernet/ethernet.h>
 #include <vnet/ethernet/packet.h>
 #include <vnet/ip/ip_packet.h>
index 990a581..2496cfd 100644 (file)
@@ -41,7 +41,6 @@
 #define included_llc_h
 
 #include <vnet/vnet.h>
-#include <vnet/pg/pg.h>
 
 /* 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 */
 
 /*
index 79d1541..086925b 100644 (file)
@@ -38,6 +38,7 @@
  */
 
 #include <vlib/vlib.h>
+#include <vnet/pg/pg.h>
 #include <vnet/llc/llc.h>
 
 #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)
 {
index bdeab2d..4eb3e46 100644 (file)
@@ -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)
 {
index 0ff267a..fb248ed 100644 (file)
@@ -41,7 +41,6 @@
 #define included_osi_h
 
 #include <vnet/vnet.h>
-#include <vnet/pg/pg.h>
 
 #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;
index fd0105e..eead2b2 100644 (file)
@@ -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)
 {
index 726eca6..77da8c1 100644 (file)
@@ -42,7 +42,6 @@
 
 #include <vnet/vnet.h>
 #include <vnet/ppp/packet.h>
-#include <vnet/pg/pg.h>
 
 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);
index 9baa750..2a42907 100644 (file)
@@ -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)
 {
index 08c3a8b..f6b3be1 100644 (file)
@@ -41,7 +41,6 @@
 #define included_snap_h
 
 #include <vnet/vnet.h>
-#include <vnet/pg/pg.h>
 
 #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 */
 
 /*
index 926cb7c..12c1401 100644 (file)
@@ -40,6 +40,7 @@
 #include <vlib/vlib.h>
 #include <vnet/ip/ip_packet.h> /* for ip_csum_fold */
 #include <vnet/srp/srp.h>
+#include <vnet/pg/pg.h>
 
 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;
index 8f59e06..2873d5a 100644 (file)
@@ -43,7 +43,6 @@
 #include <vnet/vnet.h>
 #include <vnet/srp/packet.h>
 #include <vnet/ethernet/ethernet.h>
-#include <vnet/pg/pg.h>
 
 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")                       \