When IP layer fragments packets, L4 header is only present in the first packet. The next fragmented packets donot contain L4 headers. So hash calculation based on 5tuple should ignore the L4 headers for all fragmented packets. If we consider L4 header for any fragments , say first or subsequent ones, the hash will vary which may result in selecting different dpdk port for egressing out packet.
Signed-off-by: Somnath Chatterjee <somnath.b.chatter...@ericsson.com> --- lib/flow.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/lib/flow.c b/lib/flow.c index c2e1e4ad6..d01fa103f 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -1075,10 +1075,12 @@ miniflow_extract(struct dp_packet *packet, struct miniflow *dst) miniflow_push_be16(mf, tp_dst, tcp->tcp_dst); miniflow_push_be16(mf, ct_tp_src, ct_tp_src); miniflow_push_be16(mf, ct_tp_dst, ct_tp_dst); - if (dl_type == htons(ETH_TYPE_IP)) { - dp_packet_update_rss_hash_ipv4_tcp_udp(packet); - } else if (dl_type == htons(ETH_TYPE_IPV6)) { - dp_packet_update_rss_hash_ipv6_tcp_udp(packet); + if (OVS_LIKELY(!nw_frag)) { + if (dl_type == htons(ETH_TYPE_IP)) { + dp_packet_update_rss_hash_ipv4_tcp_udp(packet); + } else if (dl_type == htons(ETH_TYPE_IPV6)) { + dp_packet_update_rss_hash_ipv6_tcp_udp(packet); + } } dp_packet_ol_l4_csum_check_partial(packet); if (dp_packet_l4_checksum_good(packet) @@ -1095,10 +1097,12 @@ miniflow_extract(struct dp_packet *packet, struct miniflow *dst) miniflow_push_be16(mf, tp_dst, udp->udp_dst); miniflow_push_be16(mf, ct_tp_src, ct_tp_src); miniflow_push_be16(mf, ct_tp_dst, ct_tp_dst); - if (dl_type == htons(ETH_TYPE_IP)) { - dp_packet_update_rss_hash_ipv4_tcp_udp(packet); - } else if (dl_type == htons(ETH_TYPE_IPV6)) { - dp_packet_update_rss_hash_ipv6_tcp_udp(packet); + if (OVS_LIKELY(!nw_frag)) { + if (dl_type == htons(ETH_TYPE_IP)) { + dp_packet_update_rss_hash_ipv4_tcp_udp(packet); + } else if (dl_type == htons(ETH_TYPE_IPV6)) { + dp_packet_update_rss_hash_ipv6_tcp_udp(packet); + } } dp_packet_ol_l4_csum_check_partial(packet); if (dp_packet_l4_checksum_good(packet) @@ -2426,10 +2430,13 @@ flow_hash_5tuple(const struct flow *flow, uint32_t basis) goto out; } - /* Add both ports at once. */ - hash = hash_add(hash, - ((const uint32_t *)flow)[offsetof(struct flow, tp_src) - / sizeof(uint32_t)]); + /* Add both L4 ports, only if the packet is not fragmented. */ + if (OVS_LIKELY(!(flow->nw_frag & FLOW_NW_FRAG_MASK))) { + hash = hash_add(hash, + ((const uint32_t *) flow) + [offsetof(struct flow, tp_src) / + sizeof(uint32_t)]); + } } out: return hash_finish(hash, 42); /* Arbitrary number. */ -- 2.45.1.windows.1 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev