It seems csum is more common and shorter. Signed-off-by: Flavio Leitner <f...@sysclose.org> --- lib/conntrack.c | 12 ++++++------ lib/dp-packet.h | 10 +++++----- lib/ipf.c | 4 ++-- lib/netdev-native-tnl.c | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/lib/conntrack.c b/lib/conntrack.c index 33a1a9295..e84ec4aee 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -2089,12 +2089,12 @@ conn_key_extract(struct conntrack *ct, struct dp_packet *pkt, ovs_be16 dl_type, ctx->key.dl_type = dl_type; if (ctx->key.dl_type == htons(ETH_TYPE_IP)) { - bool hwol_bad_l3_csum = dp_packet_ip_checksum_bad(pkt); + bool hwol_bad_l3_csum = dp_packet_ip_csum_bad(pkt); if (hwol_bad_l3_csum) { ok = false; COVERAGE_INC(conntrack_l3csum_err); } else { - bool hwol_good_l3_csum = dp_packet_ip_checksum_valid(pkt) + bool hwol_good_l3_csum = dp_packet_ip_csum_valid(pkt) || dp_packet_hwol_is_ipv4(pkt); /* Validate the checksum only when hwol is not supported. */ ok = extract_l3_ipv4(&ctx->key, l3, dp_packet_l3_size(pkt), NULL, @@ -2107,10 +2107,10 @@ conn_key_extract(struct conntrack *ct, struct dp_packet *pkt, ovs_be16 dl_type, } if (ok) { - bool hwol_bad_l4_csum = dp_packet_l4_checksum_bad(pkt); + bool hwol_bad_l4_csum = dp_packet_l4_csum_bad(pkt); if (!hwol_bad_l4_csum) { - bool hwol_good_l4_csum = dp_packet_l4_checksum_valid(pkt) - || dp_packet_hwol_tx_l4_checksum(pkt); + bool hwol_good_l4_csum = dp_packet_l4_csum_valid(pkt) + || dp_packet_hwol_tx_l4_csum(pkt); /* Validate the checksum only when hwol is not supported. */ if (extract_l4(&ctx->key, l4, dp_packet_l4_size(pkt), &ctx->icmp_related, l3, !hwol_good_l4_csum, @@ -3424,7 +3424,7 @@ handle_ftp_ctl(struct conntrack *ct, const struct conn_lookup_ctx *ctx, } th->tcp_csum = 0; - if (!dp_packet_hwol_tx_l4_checksum(pkt)) { + if (!dp_packet_hwol_tx_l4_csum(pkt)) { if (ctx->key.dl_type == htons(ETH_TYPE_IPV6)) { th->tcp_csum = packet_csum_upperlayer6(nh6, th, ctx->key.nw_proto, dp_packet_l4_size(pkt)); diff --git a/lib/dp-packet.h b/lib/dp-packet.h index 3dc582fbf..ee8451496 100644 --- a/lib/dp-packet.h +++ b/lib/dp-packet.h @@ -965,7 +965,7 @@ dp_packet_hwol_l4_mask(const struct dp_packet *b) /* Return true if the packet 'b' requested L4 checksum offload. */ static inline bool -dp_packet_hwol_tx_l4_checksum(const struct dp_packet *b) +dp_packet_hwol_tx_l4_csum(const struct dp_packet *b) { return !!dp_packet_hwol_l4_mask(b); } @@ -1056,28 +1056,28 @@ dp_packet_hwol_set_tcp_seg(struct dp_packet *b) } static inline bool -dp_packet_ip_checksum_valid(const struct dp_packet *p) +dp_packet_ip_csum_valid(const struct dp_packet *p) { return (*dp_packet_ol_flags_ptr(p) & DP_PACKET_OL_RX_IP_CKSUM_MASK) == DP_PACKET_OL_RX_IP_CKSUM_GOOD; } static inline bool -dp_packet_ip_checksum_bad(const struct dp_packet *p) +dp_packet_ip_csum_bad(const struct dp_packet *p) { return (*dp_packet_ol_flags_ptr(p) & DP_PACKET_OL_RX_IP_CKSUM_MASK) == DP_PACKET_OL_RX_IP_CKSUM_BAD; } static inline bool -dp_packet_l4_checksum_valid(const struct dp_packet *p) +dp_packet_l4_csum_valid(const struct dp_packet *p) { return (*dp_packet_ol_flags_ptr(p) & DP_PACKET_OL_RX_L4_CKSUM_MASK) == DP_PACKET_OL_RX_L4_CKSUM_GOOD; } static inline bool -dp_packet_l4_checksum_bad(const struct dp_packet *p) +dp_packet_l4_csum_bad(const struct dp_packet *p) { return (*dp_packet_ol_flags_ptr(p) & DP_PACKET_OL_RX_L4_CKSUM_MASK) == DP_PACKET_OL_RX_L4_CKSUM_BAD; diff --git a/lib/ipf.c b/lib/ipf.c index 507db2aea..013c4cfba 100644 --- a/lib/ipf.c +++ b/lib/ipf.c @@ -574,7 +574,7 @@ ipf_list_state_transition(struct ipf *ipf, struct ipf_list *ipf_list, static bool ipf_is_valid_v4_frag(struct ipf *ipf, struct dp_packet *pkt) { - if (OVS_UNLIKELY(dp_packet_ip_checksum_bad(pkt))) { + if (OVS_UNLIKELY(dp_packet_ip_csum_bad(pkt))) { COVERAGE_INC(ipf_l3csum_err); goto invalid_pkt; } @@ -608,7 +608,7 @@ ipf_is_valid_v4_frag(struct ipf *ipf, struct dp_packet *pkt) goto invalid_pkt; } - if (OVS_UNLIKELY(!dp_packet_ip_checksum_valid(pkt) + if (OVS_UNLIKELY(!dp_packet_ip_csum_valid(pkt) && !dp_packet_hwol_is_ipv4(pkt) && csum(l3, ip_hdr_len) != 0)) { COVERAGE_INC(ipf_l3csum_err); diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c index b89dfdd52..2de424105 100644 --- a/lib/netdev-native-tnl.c +++ b/lib/netdev-native-tnl.c @@ -88,7 +88,7 @@ netdev_tnl_ip_extract_tnl_md(struct dp_packet *packet, struct flow_tnl *tnl, ovs_be32 ip_src, ip_dst; - if (OVS_UNLIKELY(!dp_packet_ip_checksum_valid(packet))) { + if (OVS_UNLIKELY(!dp_packet_ip_csum_valid(packet))) { if (csum(ip, IP_IHL(ip->ip_ihl_ver) * 4)) { VLOG_WARN_RL(&err_rl, "ip packet has invalid checksum"); return NULL; @@ -190,7 +190,7 @@ udp_extract_tnl_md(struct dp_packet *packet, struct flow_tnl *tnl, } if (udp->udp_csum) { - if (OVS_UNLIKELY(!dp_packet_l4_checksum_valid(packet))) { + if (OVS_UNLIKELY(!dp_packet_l4_csum_valid(packet))) { uint32_t csum; if (netdev_tnl_is_header_ipv6(dp_packet_data(packet))) { csum = packet_csum_pseudoheader6(dp_packet_l3(packet)); -- 2.31.1 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev