From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C2FD043B86 for ; Tue, 5 Mar 2024 10:50:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BBFF54026B; Tue, 5 Mar 2024 10:50:25 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2050.outbound.protection.outlook.com [40.107.223.50]) by mails.dpdk.org (Postfix) with ESMTP id BE05C4014F for ; Tue, 5 Mar 2024 10:50:23 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b61iKemROrbLeXEHrytL/vAasrmdsPIib6Vu2+gp3Fojp094gzWEl7VkMNOWasaTlUBybwpys1yriFNP6Nwe+ySdm9iW7P1nYUQtUz0fj4zgsc5sDM83BQ9HzPONGDSxftGVHuFvPYguKjW2OAvRAS/AHxpdLL7nm0PUTuZTbNiJCNtQ/R0MUk1soQR/LZAZOG2/STBrFoh4jQins84T9prQF0ekoU/XO4nXpNA6BiSbuxpoIRB7BQQkZXVnuUMUpBsxYheMkFIHtlgDguSfOANCIvUp8yflLHFZ+nRN+N6pWJw8axeUQkcFosQ1hi+xY7nMcrXfJRUxp/WK8sO2wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YoXxSvO2R24anawjuRgUXDcszmlu4qt5h4a0tPPOBXE=; b=byhEbiUpPFtm8XaySGZQjW3v3Ui5fGJrYTJSfR8daHpwu8N57Eq0sf1wL8WFp6c9MkjJP5yHG8+Ty/hogwscVhA3wVnnj0JGgx4F6aFOy2HVNldukcJoIE9Z8jynNqIQLon4IGxBVKDsMekgyNY05wEsQX3dkymhLzx+T8KKH0hbGYMap87VgS0ac3HVtKQZWdAIywR7pzoW+24W9Op0gcZrN8FBiH/pY6kkn171agR532RXYLilaoP49l9kQqRy0dzZ78q5MCZ3hxkmDhafbAZpjyByrNJTy9BYlRvlZZ0fdRWbUQ27mjPyrHVfgflsumTICTWy5B2CXq1zfoFRXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YoXxSvO2R24anawjuRgUXDcszmlu4qt5h4a0tPPOBXE=; b=mr5iBCTb3YzVaGzIyD2xmy1upYypedKEzKj7CwKZPqwTiE5e2dzSMay0KHmbs2dNUESLCy7GHUWTtyPrnTlPAgRTdaD+/+voFIPnesojJva2IWI1KMw9ql1dkS13hb91BGwuZE3Y4NzseMVGSzyK8QADzceHkQffoSk/1o+CZInZsyp3pZsDk0jDMm1waEn1NNjQlWLsw7I7leivPAfUkLBS95qfvZJrGCM5XwZRyvDhzVJCvvksoRQZZvuVPjXJwm3Pe1SIwvzy/4vGzTShdUf/Cu2b4JTSal41wNAN0HFtMYZdgV/yB8NFUMRTZ0Bgv1lQJGl5MG1qK2vvWc/RxA== Received: from CH2PR07CA0032.namprd07.prod.outlook.com (2603:10b6:610:20::45) by SA3PR12MB8809.namprd12.prod.outlook.com (2603:10b6:806:31f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39; Tue, 5 Mar 2024 09:50:20 +0000 Received: from CY4PEPF0000FCC3.namprd03.prod.outlook.com (2603:10b6:610:20:cafe::4) by CH2PR07CA0032.outlook.office365.com (2603:10b6:610:20::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.38 via Frontend Transport; Tue, 5 Mar 2024 09:50:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CY4PEPF0000FCC3.mail.protection.outlook.com (10.167.242.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.11 via Frontend Transport; Tue, 5 Mar 2024 09:50:20 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 5 Mar 2024 01:50:06 -0800 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 5 Mar 2024 01:50:04 -0800 From: Xueming Li To: Kumara Parameshwaran CC: Jiayu Hu , dpdk stable Subject: patch 'gro: fix reordering of packets' has been queued to stable release 23.11.1 Date: Tue, 5 Mar 2024 17:46:03 +0800 Message-ID: <20240305094757.439387-23-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240305094757.439387-1-xuemingl@nvidia.com> References: <20240305094757.439387-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC3:EE_|SA3PR12MB8809:EE_ X-MS-Office365-Filtering-Correlation-Id: f6bbac05-2b2f-418b-38a4-08dc3cf9ab85 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9EGlW92cp2SrtVoM8qI8dTpTgj1sXJM0DmoQSGqbS/qCFBYBRe8mHwrNkSKko5g4OexM9pMHrS+uD87otESYkHCNOlFdqBxfWlqcnX5r8FMQOlv9i6uDq+TTJcIc7WS4Iig2+xhy+9D81azT4DQTTeFW2EirKo7PTYepLXygafyGRJ2Hjw2rqe02cRW15M6xLwouj7KHzOm3Yljo19ZQwCj30Eeqef3M0bdXpgsC13lMCxv98EQp4f9txzg5HxfstTA3V13Kf0wXW+fj/QaRaedhIM0YVW+ZTCvHSd57i52MMhiXNGHNqT8Jj3o39q8F0Sjbtytj7LhUEnulseSP14MMOU+0uGC9mNjDuOV1nx44631vA2UaWhlSYHJch+0MA5rGfrMMlcKIv+JHor9dHTrg8oKPYipHdcpjACzDgyPRIqw8QUnSe2rGi1id/EJu0d+Hne/XHkJi76lil5iO7TW9DSfTW9B8HUiErGRw+oniQWcFBVH+GYMwWJnqectXyyjgq13OLwwORDdq6nKfcCJugAZTHAykcGtO6Z8NPiHaiv9BmsDu8vGqSEiDr1jjTN3HoGy/th7LVWCOyDc9zs1DefezJix4aUIFPN8iTmCU1N9qUeSs3PdSrsVOQvPvqoUnzeguDVt8thc6iUmJn4uXDJTQrJKbGUO81xUMgoeDpGYgKg+czRP/UCoP6ic84CUbuWXzYs1N5XxGW3SHxAv+DrgkPtX+YQwfOghP0QVbcyA36/lRz5fRxPsYwozz X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(376005)(36860700004)(82310400014); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2024 09:50:20.0519 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f6bbac05-2b2f-418b-38a4-08dc3cf9ab85 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000FCC3.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB8809 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 23.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/31/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=d7a30d20c42e7409e1e9e3f3ad525898982befb3 Thanks. Xueming Li --- >From d7a30d20c42e7409e1e9e3f3ad525898982befb3 Mon Sep 17 00:00:00 2001 From: Kumara Parameshwaran Date: Mon, 8 Jan 2024 21:34:53 +0530 Subject: [PATCH] gro: fix reordering of packets Cc: Xueming Li [ upstream commit 547f294357690ab8501f120457a82919b1217517 ] In the current implementation when a packet is received with special TCP flag(s) set, only that packet is delivered out of order. There could be already coalesced packets in the GRO table belonging to the same flow but not delivered. This fix makes sure that the entire segment is delivered with the special flag(s) set which is how the Linux GRO is also implemented. Fixes: 0d2cbe59b719 ("lib/gro: support TCP/IPv4") Signed-off-by: Kumara Parameshwaran Reviewed-by: Jiayu Hu --- lib/gro/gro_tcp.h | 9 +++++++++ lib/gro/gro_tcp4.c | 36 +++++++++++++++++++++++++++--------- lib/gro/gro_tcp_internal.h | 2 +- lib/gro/gro_vxlan_tcp4.c | 5 +++-- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/lib/gro/gro_tcp.h b/lib/gro/gro_tcp.h index d926c4b8cc..2c68b5f23e 100644 --- a/lib/gro/gro_tcp.h +++ b/lib/gro/gro_tcp.h @@ -19,6 +19,8 @@ #define INVALID_TCP_HDRLEN(len) \ (((len) < sizeof(struct rte_tcp_hdr)) || ((len) > MAX_TCP_HLEN)) +#define VALID_GRO_TCP_FLAGS (RTE_TCP_ACK_FLAG | RTE_TCP_PSH_FLAG | RTE_TCP_FIN_FLAG) + struct cmn_tcp_key { struct rte_ether_addr eth_saddr; struct rte_ether_addr eth_daddr; @@ -81,11 +83,13 @@ merge_two_tcp_packets(struct gro_tcp_item *item, struct rte_mbuf *pkt, int cmp, uint32_t sent_seq, + uint8_t tcp_flags, uint16_t ip_id, uint16_t l2_offset) { struct rte_mbuf *pkt_head, *pkt_tail, *lastseg; uint16_t hdr_len, l2_len; + struct rte_tcp_hdr *tcp_hdr; if (cmp > 0) { pkt_head = item->firstseg; @@ -128,6 +132,11 @@ merge_two_tcp_packets(struct gro_tcp_item *item, /* update MBUF metadata for the merged packet */ pkt_head->nb_segs += pkt_tail->nb_segs; pkt_head->pkt_len += pkt_tail->pkt_len; + if (tcp_flags != RTE_TCP_ACK_FLAG) { + tcp_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_tcp_hdr *, + l2_offset + pkt_head->l2_len + pkt_head->l3_len); + tcp_hdr->tcp_flags |= tcp_flags; + } return 1; } diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c index 6645de592b..c8b8d7990c 100644 --- a/lib/gro/gro_tcp4.c +++ b/lib/gro/gro_tcp4.c @@ -126,6 +126,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, uint32_t item_idx; uint32_t i, max_flow_num, remaining_flow_num; uint8_t find; + uint32_t item_start_idx; /* * Don't process the packet whose TCP header length is greater @@ -139,11 +140,8 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len; - /* - * Don't process the packet which has FIN, SYN, RST, PSH, URG, ECE - * or CWR set. - */ - if (tcp_hdr->tcp_flags != RTE_TCP_ACK_FLAG) + /* Return early if the TCP flags are not handled in GRO layer */ + if (tcp_hdr->tcp_flags & ~VALID_GRO_TCP_FLAGS) return -1; /* trim the tail padding bytes */ @@ -183,13 +181,35 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, if (tbl->flows[i].start_index != INVALID_ARRAY_INDEX) { if (is_same_tcp4_flow(tbl->flows[i].key, key)) { find = 1; + item_start_idx = tbl->flows[i].start_index; break; } remaining_flow_num--; } } - if (find == 0) { + if (find == 1) { + /* + * Any packet with additional flags like PSH,FIN should be processed + * and flushed immediately. + * Hence marking the start time to 0, so that the packets will be flushed + * immediately in timer mode. + */ + if (tcp_hdr->tcp_flags & (RTE_TCP_ACK_FLAG | RTE_TCP_PSH_FLAG | RTE_TCP_FIN_FLAG)) { + if (tcp_hdr->tcp_flags != RTE_TCP_ACK_FLAG) + tbl->items[item_start_idx].start_time = 0; + return process_tcp_item(pkt, tcp_hdr, tcp_dl, tbl->items, + tbl->flows[i].start_index, &tbl->item_num, + tbl->max_item_num, ip_id, is_atomic, start_time); + } else { + return -1; + } + } + /* + * Add new flow to the table only if contains ACK flag with data. + * Do not add any packets with additional tcp flags to the GRO table + */ + if (tcp_hdr->tcp_flags == RTE_TCP_ACK_FLAG) { sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); item_idx = insert_new_tcp_item(pkt, tbl->items, &tbl->item_num, tbl->max_item_num, start_time, @@ -209,9 +229,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, return 0; } - return process_tcp_item(pkt, tcp_hdr, tcp_dl, tbl->items, tbl->flows[i].start_index, - &tbl->item_num, tbl->max_item_num, - ip_id, is_atomic, start_time); + return -1; } /* diff --git a/lib/gro/gro_tcp_internal.h b/lib/gro/gro_tcp_internal.h index cc84abeaeb..e4855da1ad 100644 --- a/lib/gro/gro_tcp_internal.h +++ b/lib/gro/gro_tcp_internal.h @@ -101,7 +101,7 @@ process_tcp_item(struct rte_mbuf *pkt, is_atomic); if (cmp) { if (merge_two_tcp_packets(&items[cur_idx], - pkt, cmp, sent_seq, ip_id, 0)) + pkt, cmp, sent_seq, tcp_hdr->tcp_flags, ip_id, 0)) return 1; /* * Fail to merge the two packets, as the packet diff --git a/lib/gro/gro_vxlan_tcp4.c b/lib/gro/gro_vxlan_tcp4.c index 6ab7001922..8dd62a949c 100644 --- a/lib/gro/gro_vxlan_tcp4.c +++ b/lib/gro/gro_vxlan_tcp4.c @@ -239,10 +239,11 @@ merge_two_vxlan_tcp4_packets(struct gro_vxlan_tcp4_item *item, struct rte_mbuf *pkt, int cmp, uint32_t sent_seq, + uint8_t tcp_flags, uint16_t outer_ip_id, uint16_t ip_id) { - if (merge_two_tcp_packets(&item->inner_item, pkt, cmp, sent_seq, + if (merge_two_tcp_packets(&item->inner_item, pkt, cmp, sent_seq, tcp_flags, ip_id, pkt->outer_l2_len + pkt->outer_l3_len)) { /* Update the outer IPv4 ID to the large value. */ @@ -413,7 +414,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, tcp_dl, outer_is_atomic, is_atomic); if (cmp) { if (merge_two_vxlan_tcp4_packets(&(tbl->items[cur_idx]), - pkt, cmp, sent_seq, + pkt, cmp, sent_seq, tcp_hdr->tcp_flags, outer_ip_id, ip_id)) return 1; /* -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-05 17:39:31.746546825 +0800 +++ 0022-gro-fix-reordering-of-packets.patch 2024-03-05 17:39:30.703566491 +0800 @@ -1 +1 @@ -From 547f294357690ab8501f120457a82919b1217517 Mon Sep 17 00:00:00 2001 +From d7a30d20c42e7409e1e9e3f3ad525898982befb3 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 547f294357690ab8501f120457a82919b1217517 ] @@ -14 +16,0 @@ -Cc: stable@dpdk.org @@ -26 +28 @@ -index bbd2f9c16a..e9be7b95d1 100644 +index d926c4b8cc..2c68b5f23e 100644 @@ -65 +67 @@ -index d6c0f9182d..855cc7a71d 100644 +index 6645de592b..c8b8d7990c 100644 @@ -152 +154 @@ -index 2752650389..29d4a2e13d 100644 +index 6ab7001922..8dd62a949c 100644