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 5CFC0A00C4; Tue, 26 Jul 2022 08:18:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D4B3A41144; Tue, 26 Jul 2022 08:18:03 +0200 (CEST) Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2084.outbound.protection.outlook.com [40.107.215.84]) by mails.dpdk.org (Postfix) with ESMTP id 67BED40695; Tue, 26 Jul 2022 08:18:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GMvkPzfB00pkZRqTBanJEpX5bIgSZnlaqelCUTVQV9lFtODGCp8By3enye446buyFE57GTSWOf2rQeI+QNQG9sQ6oKIqYeKxSyvCl0Fn9XG53lxg1eBjdBOKOpiK1PvY8rgh9S81qMkMx2EO6JmyQfC27yuSRwwETXVWF2fKCELejom0UEq4dcSkQTYUJWCdEuYx8t7njSHMQQ7igeM7IQeXxXJORPUqxLN0+juDwuryAPL+fE3SnuQWy1jP6K7BL1NYPLkRK8UECCZDCtfxF482dGy8NqXgtyQW0Tjxxo8ApmM1hRmvB4ep2aroaD+0AtKAA6FuMB5ByJ/TBbnxKg== 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=QwHfqkZKCkOVdReE+wUqvTsTGn5DqjZzC0k7QxRn5ow=; b=Y+9TOQ/EWPFJCRuIe05ovx6gRpPPwJdp8n/io0NTdLcbfUxYyBc0qnpvgua/I24Odc5KFJ/R2vFlAj2mNB0PJtHskg39fG8rd0mvyHkzJswuEtRwoRJOrVlyJIYIMx5WKgCYe9l4jS/IxM3x4qDWCGJ0yPYBRDoncwGE36JNIxbusdx6ZlXD6eht+4Zg3szRddd7tAQ6hB32odNQQTCZCLMRA7C5jjY8Jw32LCVB9IWf07WLUKm40tLLpVeJftYl54Mx8gAqIUjr/y1TYU4vjt4CLL93vNKpBtwt9ObvRGQLh6yjX9Lz5s6FCof8Sjqs4gh4hHjPS3WMxxh01bccOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=jaguarmicro.com; dmarc=pass action=none header.from=jaguarmicro.com; dkim=pass header.d=jaguarmicro.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jaguarmicro.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QwHfqkZKCkOVdReE+wUqvTsTGn5DqjZzC0k7QxRn5ow=; b=OGLiCKsxnAoGYJD2zCtt0uUv8w2GPyu7gIfDn3iBEghkzbJD8QCF8JTAhVufg4vjEgjXL3VVltk69a1yCbKWB6jpshBMRmxqoVbwh6YAx6rvHkn2NRntK5y/wSSk8UCp3GLE83HAHGg1vT/2yekCaiBC3Cz9jNHMTS/tkXJwbBWt32cC6pMDQScO/gU9SCFZ3loJb9KoE1j4j/JCnR5u1XOfpzCdF0nOv5M/+rrBDt0hZTw8RACDFadiYX51P1M1ARHfvHz6hHT8JAOPH57li2XF6PrJWyxhZc7Y7ECUsPR+VrlWfLLxGsq+DdkFH++q1d6TKI9e8m2v2Zz6VAL4EA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=jaguarmicro.com; Received: from KL1PR0601MB4530.apcprd06.prod.outlook.com (2603:1096:820:64::10) by SEYPR06MB5375.apcprd06.prod.outlook.com (2603:1096:101:68::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.20; Tue, 26 Jul 2022 06:17:59 +0000 Received: from KL1PR0601MB4530.apcprd06.prod.outlook.com ([fe80::59b6:ff9c:d103:9e97]) by KL1PR0601MB4530.apcprd06.prod.outlook.com ([fe80::59b6:ff9c:d103:9e97%9]) with mapi id 15.20.5458.025; Tue, 26 Jul 2022 06:17:59 +0000 From: Jun Qiu To: dev@dpdk.org Cc: jiayu.hu@intel.com, stable@dpdk.org Subject: [PATCH] gro: fix gro with tcp push flag Date: Tue, 26 Jul 2022 06:17:41 +0000 Message-Id: <20220726061741.21021-1-jun.qiu@jaguarmicro.com> X-Mailer: git-send-email 2.25.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR04CA0212.apcprd04.prod.outlook.com (2603:1096:4:187::8) To KL1PR0601MB4530.apcprd06.prod.outlook.com (2603:1096:820:64::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b3828d2f-1043-44fc-f40a-08da6ece9657 X-MS-TrafficTypeDiagnostic: SEYPR06MB5375:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0UecG1XHmk3WZ/qWDSvdAHc2AlskzkbNI68x1+yUGe0Mxlx4w+2FK/MFv1xIZF8buFEfnsfoIn5ymG+4u7ZFRORjg7whxKF89VF8GEZkXY6KXGcMgD+xuV7pDLTbBNdCxvNjGqyU5oGeDxzsYYaCYDXeypDYno1OtNFQKFEsDHY5PLLEoxTIlgFeo4+999FvhUVeswWOri6df3DoSUKWeF1l07ocT4JjXyiNVmHORfb4YtPEHc5V/IDaBPU7mUtPoZDgYQ6i86JcSArRsWp+4D405tFn0Ql56QDdkRtFpIN63Tn5fx/x8lBHDCRd4cmXD14gr3cCzftfJO0jFxK+oLZ3ksF7MwqatudyicuHb8h9vEdNYrsYcoAokE5UnRoCDfgyTKrN3MhR1DTNsYLRaU1php4LUVZ0XX+miTdTQJwWA7RlcfULqfY2l6kSt0+DQw0ErjepnR/K4EjtPg8gvWrFql1tzXjkaK/Ox8RMAkCM6kB1FOfe9WQc1McO6x3X9F5H3Dc5Ekm4SibEa5QhOeRwGn6DfYaNPlu9PZg0xXZUBKIj7DquzktCKB7Q+X6OPVKyEsdRV6ZXvF1LjyL3rYTPFKiHbH/y5aw4Pu9aAYA4oawmvIbvlBiT7UJ7XcK00jWjHFjBmrFV79zeSQEk7N00AUQt1FDlycYsabq3hi160AkF5gVPzV0eVr6IerNrRB3ilTa++pwBACossqXb05Lv4Js64Z4pAKlaZ2CkyzXSzga5vo91qL1a8TgxVjvgg/tzlb2kYYSmko7MPCvNdAkJER0X1PiL0MoHnCMuTLk0bP54bNKrsxWDGU2fSQwA X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:KL1PR0601MB4530.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(39840400004)(376002)(366004)(346002)(396003)(136003)(44832011)(38100700002)(2906002)(478600001)(41300700001)(8936002)(6486002)(6666004)(86362001)(38350700002)(186003)(1076003)(52116002)(6506007)(6512007)(26005)(5660300002)(36756003)(4326008)(8676002)(83380400001)(2616005)(316002)(6916009)(66556008)(66946007)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?kZNW0GaNmLAnJy5xVL/iT0sLwAZ87XJdb41Jo1BKvis2xlHMg0uV9icLSION?= =?us-ascii?Q?HeUdFjFcyFE/ljzavXHkZfOaAuNxOOyyjwKVFDG55d4OWqMP1UYSd4POv0Ps?= =?us-ascii?Q?wk/pAcdN3Y0dqqmlDd6/euSLxZzZeDzIC2gAuro9hvbtiqLeczC/i82UiaYZ?= =?us-ascii?Q?x+f86mFSS3UeNn5RX4N2OckKzDQ7rj4rXp6vet3LGG7FjUoFAr+KkEH/Mjur?= =?us-ascii?Q?iP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Ka?= =?us-ascii?Q?H1F5Igt3dFF7hsNbVLadF8/2EqJI++ltkc+6iVc1SOmzXyyFA66vHRmp+6Yz?= =?us-ascii?Q?ZOx2JQ5ltutmCOtuBoPjxZjZ3NrRs4fX+AcUyv7NomXWW+b4WEL1+fimrbfP?= =?us-ascii?Q?+tjPJhnpPqq1RzK3Zcab7gqHYAG2ivmyG3RhjG6zITtoER+rmqFRKwd38ZDw?= =?us-ascii?Q?sHnn6zWdNvKZdEjzaLLW4Y37xeOs5RXjV5soi4pXG85zlTpOIRabZRtakuzC?= =?us-ascii?Q?XXh4oqMtL5SIPMz11gNdMOdcuZzPn9YB0qNJB2HWRJ6Ro/MQ7PoRZIAYnqoM?= =?us-ascii?Q?i/1DITmkzYoIoDgKae5AzCQiF1jrhz4N4+lP24thdJrC53+OBObuWyqcK9XQ?= =?us-ascii?Q?pro242ZJmK6czKvCr0z6piGNouuyRBcAdMxfzcmI4u97+Pbr9ipBxf1+est+?= =?us-ascii?Q?pgbyuvwORV3KK7nYukHzfyVvMiqpSxJUxMQTFo/dIcZuKo2LMDEGL78cF0vC?= =?us-ascii?Q?WQ=3D=3D?= X-OriginatorOrg: jaguarmicro.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3828d2f-1043-44fc-f40a-08da6ece9657 X-MS-Exchange-CrossTenant-AuthSource: KL1PR0601MB4530.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2022 06:17:59.2886 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 1e45a5c2-d3e1-46b3-a0e6-c5ebf6d8ba7b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +7YqoJ2TqTlNxuoHFvK6NsAJt0pwuZVjq71FfrEUfpgC9yWCZHDvobGg/IlVtLAI59MoIdOiF9zh8hVl4vwgaQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB5375 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org TCP data packets sometimes carry a PUSH flag. Currently, only the packets that do not have PUSH flag can be GROed. The packets that have a PUSH flag cannot be GROed, the packets that cannot be processed by GRO are placed last. In this case, the received packets may be out of order. For example, there are two packets mbuf1 and mbuf2. mbuf1 contains PUSH flag, mbuf2 does not contain PUSH flag. After GRO processing, mbuf2 is sent for processing before mbuf1. This out-of-order will affect TCP processing performance and lead to unnecessary dup-ACK. Referring to the Linux kernel implementation, packets with PUSH flag can also perform GRO. And if one of the packets containing PUSH flag, the packets after GRO will carry PUSH flag. Fixes: 0d2cbe59b719 ("lib/gro: support TCP/IPv4") Cc: stable@dpdk.org Signed-off-by: Jun Qiu --- lib/gro/gro_tcp4.c | 4 ++-- lib/gro/gro_tcp4.h | 16 +++++++++++++--- lib/gro/gro_vxlan_tcp4.c | 4 ++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c index 7498c66141..7849a2bd1d 100644 --- a/lib/gro/gro_tcp4.c +++ b/lib/gro/gro_tcp4.c @@ -220,10 +220,10 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len; /* - * Don't process the packet which has FIN, SYN, RST, PSH, URG, ECE + * Don't process the packet which has FIN, SYN, RST, URG, ECE * or CWR set. */ - if (tcp_hdr->tcp_flags != RTE_TCP_ACK_FLAG) + if (tcp_hdr->tcp_flags & (~(RTE_TCP_ACK_FLAG | RTE_TCP_PSH_FLAG))) return -1; /* * Don't process the packet whose payload length is less than or diff --git a/lib/gro/gro_tcp4.h b/lib/gro/gro_tcp4.h index 212f97a042..2974faf228 100644 --- a/lib/gro/gro_tcp4.h +++ b/lib/gro/gro_tcp4.h @@ -210,7 +210,8 @@ merge_two_tcp4_packets(struct gro_tcp4_item *item, uint16_t l2_offset) { struct rte_mbuf *pkt_head, *pkt_tail, *lastseg; - uint16_t hdr_len, l2_len; + struct rte_tcp_hdr *head_tcp_hdr, *tail_tcp_hdr; + uint16_t hdr_len, l2_len, l3_offset; if (cmp > 0) { pkt_head = item->firstseg; @@ -221,13 +222,22 @@ merge_two_tcp4_packets(struct gro_tcp4_item *item, } /* check if the IPv4 packet length is greater than the max value */ - hdr_len = l2_offset + pkt_head->l2_len + pkt_head->l3_len + - pkt_head->l4_len; + l3_offset = l2_offset + pkt_head->l2_len + pkt_head->l3_len; + hdr_len = l3_offset + pkt_head->l4_len; l2_len = l2_offset > 0 ? pkt_head->outer_l2_len : pkt_head->l2_len; if (unlikely(pkt_head->pkt_len - l2_len + pkt_tail->pkt_len - hdr_len > MAX_IPV4_PKT_LENGTH)) return 0; + /* merge push flag to pkt_head */ + tail_tcp_hdr = rte_pktmbuf_mtod_offset(pkt_tail, + struct rte_tcp_hdr *, l3_offset); + if (tail_tcp_hdr->tcp_flags & RTE_TCP_PSH_FLAG) { + head_tcp_hdr = rte_pktmbuf_mtod_offset(pkt_head, + struct rte_tcp_hdr *, l3_offset); + head_tcp_hdr->tcp_flags |= RTE_TCP_PSH_FLAG; + } + /* remove the packet header for the tail packet */ rte_pktmbuf_adj(pkt_tail, hdr_len); diff --git a/lib/gro/gro_vxlan_tcp4.c b/lib/gro/gro_vxlan_tcp4.c index 3be4deb7c7..884802af0b 100644 --- a/lib/gro/gro_vxlan_tcp4.c +++ b/lib/gro/gro_vxlan_tcp4.c @@ -326,10 +326,10 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); /* - * Don't process the packet which has FIN, SYN, RST, PSH, URG, + * Don't process the packet which has FIN, SYN, RST, URG, * ECE or CWR set. */ - if (tcp_hdr->tcp_flags != RTE_TCP_ACK_FLAG) + if (tcp_hdr->tcp_flags & (~(RTE_TCP_ACK_FLAG | RTE_TCP_PSH_FLAG))) return -1; hdr_len = pkt->outer_l2_len + pkt->outer_l3_len + pkt->l2_len + -- 2.25.1