diff options
author | Dave Barach <dave@barachs.net> | 2020-04-12 08:31:39 -0400 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2020-04-15 11:00:26 +0000 |
commit | 1bd2c019eba5c893d634cc496bd6d54c00020d7e (patch) | |
tree | 99595a7f0818e07034a0a9a7b158d4157a98b3ed /src/vnet/ip | |
parent | 69eeadc03f30c9fb3fe1bb7e2eeb6b04d1bcc596 (diff) |
misc: refactor calc_checksums
Merge two mildly incompatible static inlines, and rename the results
vnet_calc_checksums_inline (...).
The resulting inline has three additional parameters: int is_ip4, int
is_ip6, and int with_gso. All calls manage to pass one or more as
compile-time constants, which causes a certain amount of code to
disappear in each instantiation.
Type: refactor
Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I1a2a0e353b9a7bca20bc81318e8c915617261e1a
Diffstat (limited to 'src/vnet/ip')
-rw-r--r-- | src/vnet/ip/ip4_forward.c | 16 | ||||
-rw-r--r-- | src/vnet/ip/ip6_forward.c | 12 |
2 files changed, 21 insertions, 7 deletions
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c index 4ba0a731006..952915f5317 100644 --- a/src/vnet/ip/ip4_forward.c +++ b/src/vnet/ip/ip4_forward.c @@ -2161,7 +2161,9 @@ ip4_rewrite_inline_with_gso (vlib_main_t * vm, tx_sw_if_index0, &next_index, b[0]); next[0] = next_index; if (is_midchain) - calc_checksums (vm, b[0]); + vnet_calc_checksums_inline (vm, b[0], 1 /* is_ip4 */ , + 0 /* is_ip6 */ , + 0 /* with gso */ ); } else { @@ -2183,7 +2185,9 @@ ip4_rewrite_inline_with_gso (vlib_main_t * vm, tx_sw_if_index1, &next_index, b[1]); next[1] = next_index; if (is_midchain) - calc_checksums (vm, b[1]); + vnet_calc_checksums_inline (vm, b[0], 1 /* is_ip4 */ , + 0 /* is_ip6 */ , + 0 /* with gso */ ); } else { @@ -2327,7 +2331,9 @@ ip4_rewrite_inline_with_gso (vlib_main_t * vm, next[0] = next_index; if (is_midchain) - calc_checksums (vm, b[0]); + vnet_calc_checksums_inline (vm, b[0], 1 /* is_ip4 */ , + 0 /* is_ip6 */ , + 0 /* with gso */ ); /* Guess we are only writing on simple Ethernet header. */ vnet_rewrite_one_header (adj0[0], ip0, sizeof (ethernet_header_t)); @@ -2426,7 +2432,9 @@ ip4_rewrite_inline_with_gso (vlib_main_t * vm, if (is_midchain) /* this acts on the packet that is about to be encapped */ - calc_checksums (vm, b[0]); + vnet_calc_checksums_inline (vm, b[0], 1 /* is_ip4 */ , + 0 /* is_ip6 */ , + 0 /* with gso */ ); /* Guess we are only writing on simple Ethernet header. */ vnet_rewrite_one_header (adj0[0], ip0, sizeof (ethernet_header_t)); diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c index b7cdb1af8bb..9c195e68802 100644 --- a/src/vnet/ip/ip6_forward.c +++ b/src/vnet/ip/ip6_forward.c @@ -1859,8 +1859,12 @@ ip6_rewrite_inline_with_gso (vlib_main_t * vm, { /* before we paint on the next header, update the L4 * checksums if required, since there's no offload on a tunnel */ - calc_checksums (vm, p0); - calc_checksums (vm, p1); + vnet_calc_checksums_inline (vm, p0, 0 /* is_ip4 */ , + 1 /* is_ip6 */ , + 0 /* with gso */ ); + vnet_calc_checksums_inline (vm, p1, 0 /* is_ip4 */ , + 1 /* is_ip6 */ , + 0 /* with gso */ ); } /* Guess we are only writing on simple Ethernet header. */ @@ -1955,7 +1959,9 @@ ip6_rewrite_inline_with_gso (vlib_main_t * vm, if (is_midchain) { - calc_checksums (vm, p0); + vnet_calc_checksums_inline (vm, p0, 0 /* is_ip4 */ , + 1 /* is_ip6 */ , + 0 /* with gso */ ); } /* Guess we are only writing on simple Ethernet header. */ |