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 B2CC641B9D for ; Wed, 1 Feb 2023 11:41:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A9605427F5; Wed, 1 Feb 2023 11:41:08 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id E0F5640141; Wed, 1 Feb 2023 11:41:07 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rw27RpX9N/yZjZ23Pr7bBytjjSQeF+YofEYNRes8++i4apk/lLE8Y8QOwuMQO1VOrelDJ24Ryn3oxPO8GuyPBnZpu8QDQRNvydCmoJ44FpvnUDuXG4dwVt24TohemOTLRj34Klgzr2Umt9kD8C1HhZhNYLil4ZIZzGLTGBVhWbD+nTuJZ0PmN3sXUJ3POzwpJ49wbqeaA4iA8T3schlX3w2k3ofPdu7zyD3kvhVMUd2VZvSQ/c8r5LSd3OUApYRpsivf+f72zuwsa0bl4wXmHj6C4qdct8msanVteTCqBLcqYOAZNL7UinlLZ2ba5FTsFrdryt1MmlDNGB5tkV4a+A== 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=ndMC9TViIgWGZNUCMn1f8GuNLfnSX7J/px+Qk1GNd7Q=; b=BY205otCV35WIJmRWftpgocen7YX3WPmNdjFstDtnCQ/X0s4y3cNxlj/zgIOaHpKITsa9jVcyaKKZ1oTzLcmf+PWwtE+g2/ZjZwM2k10sW8Ho2eLiGcaG51FpjbIpM8btEnPemJVNxnea6+TQXUhjmDmeK16P7sB/x4UEMIhCN+RdMnPkakORJ35aXnILWONuKBty0ttt9eghhwnlDKA4axfMwRnyJpiyW9HgR6cvQ4Ked+HffotyejFSDizw5CEYn9p4wMexfgnAcTE/r6p2BjNiDhpNhzlFw9b5l6/tQiNF+Sxw0a5QA8dQer1soRC0h6xFmwir787v1GlShSiJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ndMC9TViIgWGZNUCMn1f8GuNLfnSX7J/px+Qk1GNd7Q=; b=5dA1vBKvrymU0QLOmc3OJFE9UBvB3GOyiZOm9dxjqiaBM4hy85Yp77MEY76MPX+RNXTx6psXUJzk5tRnEGlC0+mpxv//x0j2yWCQg8z1jjKCHCTP5p2Obb9bt9T9rOkKqXmoA9PyIMJFmFHYQHG1j4ur/DMmrF60+pv3c5lEDXw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by BL0PR12MB4881.namprd12.prod.outlook.com (2603:10b6:208:1c7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.24; Wed, 1 Feb 2023 10:41:06 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::4807:1f44:5e04:e05a]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::4807:1f44:5e04:e05a%8]) with mapi id 15.20.6064.024; Wed, 1 Feb 2023 10:41:06 +0000 Message-ID: <16ff4010-0b0a-4f4d-e328-bb3710895e03@amd.com> Date: Wed, 1 Feb 2023 10:41:00 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 To: Jiawen Wu , dev@dpdk.org Cc: stable@dpdk.org References: <20230118060039.3074016-1-jiawenwu@trustnetic.com> <20230118060039.3074016-4-jiawenwu@trustnetic.com> <731ecbc6-b338-899e-62be-ecda963951a1@amd.com> <027501d935eb$50bdc120$f2394360$@trustnetic.com> Content-Language: en-US From: Ferruh Yigit Subject: Re: [PATCH 3/8] net/txgbe: fix packet type to parse from offload flags In-Reply-To: <027501d935eb$50bdc120$f2394360$@trustnetic.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO6P123CA0012.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:338::18) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|BL0PR12MB4881:EE_ X-MS-Office365-Filtering-Correlation-Id: 4456b577-2b0a-4d04-5a05-08db0440d2b8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6MPE7FwDF1YzYgaHKE06T9EKB0sSXPaILfkrlTdzAd0XVjIdkhEvjh+f8JU1hq69ybl6MPLTqumA9LLBT23yALlihXV0nahvw2maYjaPCMMFLvHP5a1DsUUjkCgEcrsBAfYmpLMSY5lkWQ1Rm2EJyiTElBsadPFRkdTPlGgdhZJGHAjS/sr80K1AV1XLu80dE2T2P5EQ4MGza3nvJoOHh9IINKZ1wY+lYde2sRb+4AkNyloOK/FOibteTKpwlzb5TXlRRWltBseS/UqfyZ23VvEEcW4kFGrDa8I8U8GI0hMvR3Zlzp/vd16S1+h2uXLuuwWSvQ4snQRvaYjA9L0F3bt7quWFBi9cLK0FBQsaArgAiURHc+26hjcjeq+XnENnJv06aMnBXk7BXRViefCVhSVdtTa2FAFQvQMdLkqKgauD4QDsaMLfsBeyXosCLm8SnGdjSnLGwjzWDw86lXEVi2ZCe/pLvp58w6LKtIJQ+0xUqCortpYY5O+EUfY34ASVz7kd7a1UxONSZqyOS6ZgGjPq3tq4GsVwJpWYv/1GQ9G2JCWMNdcD0kN5dGILpdO7ZJHAtunJrU6HsyOjnWTSajBI4YiN3MA5CBng6SLjalTyeNDuYo7+CAaPqM/SxlIG06IMDekjFaXgoRkD+HuTfJMePnsz0+jJE+8g3Nxee4rhsNo5x9YPd+1Fmc6lxTRUCdm5o/wcngnrpdppDsBpaQX8OHLXYROazNeTBiXpQvQ= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(396003)(346002)(376002)(39860400002)(136003)(366004)(451199018)(31696002)(86362001)(38100700002)(36756003)(66946007)(66556008)(66476007)(316002)(41300700001)(8676002)(8936002)(4326008)(6666004)(44832011)(2906002)(5660300002)(83380400001)(2616005)(478600001)(6486002)(186003)(6506007)(53546011)(6512007)(26005)(31686004)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NXJDZVJ1dTBMUitCMDBEbXJxSEVySytLaGMwMWtubjUwWTM3ejdIRXIyWlN5?= =?utf-8?B?TnE1bnVEaXcyWHpLcktSU2pKYWYzSjNLVFFUY2Y0WDdmU2dER2lmNlBmN0Jq?= =?utf-8?B?YnlObzl3T3BjbGlKK0NTWVlKNVdZUDRTeUg2VlFjK0I3eXZONnU0VkhxeG5B?= =?utf-8?B?V2NPazJFaG90alRwVVBNTGd1a2lwaklIQzU1aTBXYzBpQzNrb1N1ZmpjMFF1?= =?utf-8?B?OXpPWEtpZmZwME50S0tFSGxiaGxR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1vR0Rt?= =?utf-8?B?UGl6VEhIUm1UeERWUWdnVE9JUmNlenRleWhvNzVuekcrdXpPTEFndTVjTVZn?= =?utf-8?Q?v25p8Zon4Wg5t91VK6j/15npQ?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4456b577-2b0a-4d04-5a05-08db0440d2b8 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 10:41:06.4960 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OyvxWl3PqXb55J+xw9ZdNNGyvvN7TiF3QgaduGfJmnH7NfDmFq55hyBR6Eqca64g X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4881 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 On 2/1/2023 3:14 AM, Jiawen Wu wrote: > On Friday, January 27, 2023 11:37 PM, Ferruh Yigit wrote: >> On 1/18/2023 6:00 AM, Jiawen Wu wrote: >>> In some external applications, developers may fill in wrong >>> packet_type in rte_mbuf for transmission. It will result in Tx ring >>> hang when Tx checksum offload is on. So change it to parse from ol_flags. >>> >> >> Can you please give more information on what packet_type value is causing >> problem in Tx path? >> >>> Fixes: ca46fcd753b1 ("net/txgbe: support Tx with hardware offload") >>> Cc: stable@dpdk.org >>> >>> Signed-off-by: Jiawen Wu >>> --- >>> drivers/net/txgbe/txgbe_rxtx.c | 19 ++++++++++++++----- >>> 1 file changed, 14 insertions(+), 5 deletions(-) >>> >>> diff --git a/drivers/net/txgbe/txgbe_rxtx.c >>> b/drivers/net/txgbe/txgbe_rxtx.c index ae70ca3beb..e91aaf60ef 100644 >>> --- a/drivers/net/txgbe/txgbe_rxtx.c >>> +++ b/drivers/net/txgbe/txgbe_rxtx.c >>> @@ -516,20 +516,21 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags) >>> return cmdtype; >>> } >>> >>> -static inline uint8_t >>> -tx_desc_ol_flags_to_ptid(uint64_t oflags, uint32_t ptype) >>> +static inline uint32_t >>> +tx_desc_ol_flags_to_ptype(uint64_t oflags) >>> { >>> + uint32_t ptype; >>> bool tun; >>> >>> - if (ptype) >>> - return txgbe_encode_ptype(ptype); >>> - >>> /* Only support flags in TXGBE_TX_OFFLOAD_MASK */ >>> tun = !!(oflags & RTE_MBUF_F_TX_TUNNEL_MASK); >>> >>> /* L2 level */ >>> ptype = RTE_PTYPE_L2_ETHER; >>> if (oflags & RTE_MBUF_F_TX_VLAN) >>> + ptype |= (tun ? RTE_PTYPE_INNER_L2_ETHER_VLAN : >>> +RTE_PTYPE_L2_ETHER_VLAN); >>> + >>> + if (oflags & RTE_MBUF_F_TX_QINQ) //tun + qinq is not supported >> >> checkpatch is complaining about c99 comment syntax ('//'). >> >>> ptype |= RTE_PTYPE_L2_ETHER_VLAN; >>> >>> /* L3 level */ >>> @@ -587,6 +588,14 @@ tx_desc_ol_flags_to_ptid(uint64_t oflags, >>> uint32_t ptype) >>> break; >>> } >>> >>> + return ptype; >>> +} >>> + >>> +static inline uint8_t >>> +tx_desc_ol_flags_to_ptid(uint64_t oflags, uint32_t ptype) { >>> + ptype = tx_desc_ol_flags_to_ptype(oflags); >>> + >> >> This function get 'ptype' as parameter and immediately overwrites is with >> calculated value, what is the point of getting 'ptype' as argument. >> >>> return txgbe_encode_ptype(ptype); >>> } >>> >> >> Overall why 'ptype' is calculated for Tx path, I see this value is used to see if it is >> tunneled packet or not, is there any other usage of ptype in this path? If not why >> parse all packet types? >> > > If Tx checksum offload or TSO is on, a context descriptor is needed for our hardware, which contains the length of each packet layer and the packet type. > If the packet type and length do not strictly match, it will cause Tx ring hang. It's not just for tunnel packets. But most cases are caused by developers encap/decap at the application layer. > However, we can flexibly set the packet type. For example, if there is no inner checksum for a VXLAN packet, we can only regard it as a UDP packet. > > Thanks for clarification, can you please expand commit log with above information in next version.