Skip to contentSkip to conversation

Fragmented packets incorrect RSS distribution with TAP PMD on Hyper-V platform

dpdk-dev [email protected] 1 participant 2 messages Oct 29, 2021 – Nov 28, 2023

lore
Share & tools
lore
#0 lore raw

https://bugs.dpdk.org/show_bug.cgi?id=870

Bug ID: 870
Summary: Fragmented packets incorrect RSS distribution with TAP
PMD on Hyper-V platform
Product: DPDK
Version: 20.11
Hardware: x86
OS: Linux
Status: UNCONFIRMED
Severity: normal
Priority: Normal
Component: ethdev
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---

On Hyper-V based platforms(Azure with Accelerated-mode disabled), the network ports come up on Failsafe-PMD(and underneath TAP PMD) configured with 4-queues RSS enabled.
The normal Rx/Tx packets were received and transmitted well. But, when the IP fragmented packets received on these ports, all the fragments of single-packet were distributed across different queues, instead of arriving to single-queue.

As per the TAP PMD RSS(based on BPF) algorithm mentioned in the "tap_bpf_program.c" file, the RSS algorithm written based on 4-tuple(L3 Src/Dst and L4 Src-port/Dst-port) as mentioned in below code snippet, the RSS algorithm does not check for the IP fragmented packets.
It assumes all the incoming IP based packets will have L4-header and trying to access the L4 Src-port/Dst-port fields using the pointer of L3-header end-address without cross checking the L4 header presence. since, in-case of fragmented packets the L4 header will not be present expect for first fragment and thus should not consider L4 Src-port/Dst-port under the 4-tuple hash calculation.

So, this RSS hash calculation has a bug in-case of fragmented packets.

File-name: ./drivers/net/tap/tap_bpf_program.c
================ =========================
rss_l3_l4(struct __sk_buff *skb)
{
.....
.....

  __u8 *src_dst_addr = data + off + offsetof(struct iphdr, saddr);
        __u8 *src_dst_port = data + off + sizeof(struct iphdr);
        struct ipv4_l3_l4_tuple v4_tuple = {
            .src_addr = IPv4(*(src_dst_addr + 0),
                    *(src_dst_addr + 1),
                    *(src_dst_addr + 2),
                    *(src_dst_addr + 3)),
            .dst_addr = IPv4(*(src_dst_addr + 4),
                    *(src_dst_addr + 5),
                    *(src_dst_addr + 6),
                    *(src_dst_addr + 7)),
            .sport = PORT(*(src_dst_port + 0),
                    *(src_dst_port + 1)),
            .dport = PORT(*(src_dst_port + 2),
                    *(src_dst_port + 3)),
        };

....
....

}
=========================================

So, here we can see the L4 src/dst ports were fetched without cross-checking the packet has L4 header and in-case of fragmented packets the L4 src/dst ports will be some junk values.

Due to this all the fragments of same packet were landing on to different queues and thus re-assembling the fragments got failed.

Tested with DPDK-version "20.11.2" and the Linux Kernel-version is "5.4.17".

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.
#1 lore raw

https://bugs.dpdk.org/show_bug.cgi?id=870

Thomas Monjalon ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from Thomas Monjalon ([email protected]) --- Resolved in http://git.dpdk.org/dpdk/commit/?id=db6a3ddb16

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.