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 65E5AA0C46; Mon, 20 Sep 2021 19:49:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D760A40DF7; Mon, 20 Sep 2021 19:49:12 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 0BE2040DF5 for ; Mon, 20 Sep 2021 19:49:10 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10113"; a="308741989" X-IronPort-AV: E=Sophos;i="5.85,309,1624345200"; d="scan'208";a="308741989" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2021 10:48:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,309,1624345200"; d="scan'208";a="517933712" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga001.jf.intel.com with ESMTP; 20 Sep 2021 10:48:46 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Mon, 20 Sep 2021 10:48:46 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Mon, 20 Sep 2021 10:48:45 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Mon, 20 Sep 2021 10:48:45 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.171) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Mon, 20 Sep 2021 10:48:45 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V7YntOIv+Lt6/c9H7GggO++DbTaLa3m/sn7KstBOxG3Zegg3AwKGkVrCUx0XOKDWaKDsU3vlbeUJyyULFRu4k1xyVGna3gzyX5O73usabdocRZzFZ2P7cj/keXsLcLd2mbWUdJuQohwvBbrBi3lYceP7jwHmqNqyuuXZUzU6K+h2fia/k9QwzQOuOUOaGtEBLozI7TbjwKI5tXVlHvnqWVjfedOJrl0UHsew57o2GETiVMjPLy+taisjwCX7lJfU2d0HIOTi9Q+lhQKytiNev4mgere6FzOSPrUHzF7kNwAAzzlBrTHOQKZjJ/pDLI3jJI+8Pp3Dj6eNVbmZJJrkxQ== 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; bh=WEy7WtZ3p6M1fRCyDU9YZaeYNYiWML2jN5ujIc/DLRk=; b=dmGN6hlycuGdPeuCdC1XxyItlrR/qThMGJDmbxTJSq3I2J9bKWUaoG4evOqRfBVnJkWn428zOHtyOgMAGDJEXTHSfm26YVjTdDqbCoAs/O5AjUH9YGYJIWhGr6dDviJ6yTDUEag3DCkw5H+5S/eeDQwzcSaITFNglKFgg5B8mDWFOuURzk5lEpGEonlRCeBclQTufN8xApLoajk1jKjnl1ZdKzBpOiyo/Wr0xacCT3CfcSkPrxTdxU/1dsYFAHUPYGtNszsFhHtTweYkjQBg/4Dbib0tuM3h9OS72btFGXnJWKo6GHW62wVigqdkRGmhT5ixG98IEqHV0B7GMrGLMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WEy7WtZ3p6M1fRCyDU9YZaeYNYiWML2jN5ujIc/DLRk=; b=sTJRzCkg5+TzkcWs5rtModatunxzqlxpJMcjNc2wQVwB68B4+n39MD4xsMFk+9e/eNjOQwpBS9MnvslnIADqrrDfB+afeM0da6drikhj73P3JbWtPMhxnFHfpA0iHK/5MB+MmSFwvSd/5HIOAklSR9s1SnkgeTWIJHCFPHNVrqM= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by PH0PR11MB5109.namprd11.prod.outlook.com (2603:10b6:510:3e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16; Mon, 20 Sep 2021 17:48:44 +0000 Received: from PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::747b:3a08:d1ec:31fc]) by PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::747b:3a08:d1ec:31fc%5]) with mapi id 15.20.4523.018; Mon, 20 Sep 2021 17:48:44 +0000 To: Tudor Cornea , CC: , , , References: <1631542151-62895-1-git-send-email-tudor.cornea@gmail.com> <1631553801-75072-1-git-send-email-tudor.cornea@gmail.com> From: Ferruh Yigit X-User: ferruhy Message-ID: <00f7ddfd-33e5-51c2-e881-0546adbf588f@intel.com> Date: Mon, 20 Sep 2021 18:48:37 +0100 In-Reply-To: <1631553801-75072-1-git-send-email-tudor.cornea@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-ClientProxiedBy: DU2PR04CA0299.eurprd04.prod.outlook.com (2603:10a6:10:28c::34) To PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) MIME-Version: 1.0 Received: from [192.168.0.206] (37.228.236.146) by DU2PR04CA0299.eurprd04.prod.outlook.com (2603:10a6:10:28c::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16 via Frontend Transport; Mon, 20 Sep 2021 17:48:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 71487263-d2a7-4861-fa88-08d97c5ee3dd X-MS-TrafficTypeDiagnostic: PH0PR11MB5109: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uDAFCoogkG2WsLp0Cz4aXzMpRlAxfekRJkuhxtHQw/bp5XS/EqJ4DxlctkFSV9wRgsGCcNRTU5rAtL1U1roJtZOGCkE9H3b/Giaa6RX6V6H2TD2ZlHRcfLGGCUQ8P0gJa+COJrHL5/nHbnO8ORAl0lyhbi67ndRHv/TwaZBCMqT6pmjoCl3p6DXCMjCLXfbLLEi3mXitdUmGotP3nfIpiHMAZEiNUqNy35DJZ7jocpx/Cmp0Fwm5IZTa+hcl1aqjIYlc5Be22val3NwPecajlRgitlU2IZ8u5bD+3GdVHIseaf3+v1br66FCXAzi1mDrpNx5N4LZnljh9gJErFGxLhJ0BjyVNb8HvurrQhVFtTVo4zf2UTV8Cd1HKCecRGlkLhR96mFL0ky54qMJGwSxgbJgUzdtu4MyRve3Uuo2KUvYHP1wLeP9CX0rLRwgc2/cv7qMJ19g/1eBJ76O5BefMcm2D6YmNJNYdIub9P8e4u6MLGGhqjpxqu62bEUOAx7Z7VvYtl8KnruhqPHYo/kOthukfixLB7NDWs8uDO0jlrsOzYfWp9tkhEvFV3Qlxi9dYCXj5EcFNejKNbBJZ0WI1HeTWlmoQhGXhDZbC3ne4oggD4JVwQSfo5fM622q7/uaqD/r0HqetFWQf0yDhSXG8IbknERsi1lnA5s3V+sODdmOGM5a3nyhYOF0VXQk757ZvDaYo2Zw7Pr4UMdPPOLfWcDYOzZGShhfICPdSQnIlbsZorhCeayQWGR3cvMmd4zVwCekUdJ3dLVckBbCSKIsqwSEa6cKiAYAM/igfy1u2bA= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5000.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(396003)(136003)(376002)(39860400002)(86362001)(38100700002)(8936002)(5660300002)(186003)(316002)(6666004)(2906002)(6486002)(26005)(31686004)(966005)(16576012)(31696002)(2616005)(956004)(478600001)(66556008)(53546011)(44832011)(36756003)(66476007)(83380400001)(8676002)(66946007)(4326008)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QUwyVUx3SVR4eXU1T3JQMktHU09XZ05PYWhTVHdmbTJqbk9FNHZxSGxaTmxw?= =?utf-8?B?NEVDMUhtaW9yTyt6Y2hDZ1JWZStvOEVxUmFVVkM4cGJnTFFpemV3SDV6eXFo?= =?utf-8?B?Tnh0NEhRTGJncVZjOHU2b2dvSEc1d0UyWkJQQytWamdINWFBS1A2VkYwWkdV?= =?utf-8?B?djg0ajFKcE5TUHcyWjc3QUwyT1N1b1c3OHBMSFNaUzRFeHFEaVJxR0V2ZFpZ?= =?utf-8?B?YXZjT0U1dFdJRWs3UG9ibzdaQmpJZThJcVc0WVAzOUxCQWlWNTY2MGlibUMr?= =?utf-8?B?WVJ0VWVSb05UTHRtNmZtVm5zQUtad0pYUUhlRktrZWFXUXQ5RmQx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t3QVQ2OXhOQ2s1MnhuMnJJRFgyL2VM?= =?utf-8?B?OHo4SVJBbFRFNGRUZkNmeDhaLzhnWGdoMDVRS2dNekpSUVppb2xMdmxYV1Jk?= =?utf-8?B?QVExSzUxL0ZPTzNpbHNBbVk1dlVrdnhNMXBSVDkzT01BTTNsRng4M2xBd0JK?= =?utf-8?B?TTBDUGpvYzhWSnROd25CQVBNTHlCeGV5c2pnd0hCancvME1iblVONnNRR1VD?= =?utf-8?B?S0RoYkU5OXFmcWFFWDZGR2FKSCtDeFNnTURMbFZUNHpMMWdsR0FJY0UwdGJJ?= =?utf-8?B?VDRETlMzdFd2eWlTV3ExbHV4di9yWEU5RFFCRm1iUjd6RXlyYWtjcDRxWm9O?= =?utf-8?B?d1lkNExramNVdVJSRHIyL29SS2JPNjN0bWdhYm1kZTNjcHFacWd2empjbzlk?= =?utf-8?B?Z2haUWI2T2hWNnl6Z3ZyR21GMEF6eFdGY2laTlNVU3UreGF6em5jWGdaaDlJ?= =?utf-8?B?Q1pjbjVCRGhKOUxqRDhqSGQrOEFlMEd4Zmt4cUNDdXpIVTFlTkdZckh2R0lp?= =?utf-8?Q?aJMec/3SASadb+XwbEbtuEJbQqroLS6lX+YrBSB?= X-MS-Exchange-CrossTenant-Network-Message-Id: 71487263-d2a7-4861-fa88-08d97c5ee3dd X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2021 17:48:44.2645 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dk8AthqTvjEFeoz8KJqtd4mD1dbCOmx7Uml5tcBv2REhXPPEB7QaaPFEwhCfo7Lozx22DeE9eXKJ/zGO0QNoyQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5109 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2] net/af_packet: remove timestamp from packet status 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 Sender: "dev" On 9/13/2021 6:23 PM, Tudor Cornea wrote: > We should eliminate the timestamp status from the packet > status. This should only matter if timestamping is enabled > on the socket, but we might hit a kernel bug, which is fixed > in newer releases. > > For interfaces of type 'veth', the sent skb is forwarded > to the peer and back into the network stack which timestamps > it on the RX path if timestamping is enabled globally > (which happens if any socket enables timestamping). > > When the skb is destructed, tpacket_destruct_skb() is called > and it calls __packet_set_timestamp() which doesn't check > the flags on the socket and returns the timestamp if it is > set in the skb (and for veth it is, as mentioned above). > > See the following kernel commit for reference [1]: > > net: packetmmap: fix only tx timestamp on request > > The packetmmap tx ring should only return timestamps if requested > via setsockopt PACKET_TIMESTAMP, as documented. This allows > compatibility with non-timestamp aware user-space code which checks > tp_status == TP_STATUS_AVAILABLE; not expecting additional timestamp > flags to be set in tp_status. > > [1] https://www.spinics.net/lists/kernel/msg3959391.html > > Signed-off-by: Mihai Pogonaru > Signed-off-by: Tudor Cornea > > --- > v2: > * Remove compile-time check for kernel version OK, Stephen's comment makes sense. > --- > drivers/net/af_packet/rte_eth_af_packet.c | 20 ++++++++++++++++++-- > 1 file changed, 18 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c > index b73b211..7ecea4e 100644 > --- a/drivers/net/af_packet/rte_eth_af_packet.c > +++ b/drivers/net/af_packet/rte_eth_af_packet.c > @@ -167,6 +167,22 @@ eth_af_packet_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) > return num_rx; > } > > +static inline bool tx_ring_status_unavailable(uint32_t tp_status) > +{ Minor syntax comment, can you have the 'static inline bool' part in separate line. And a basic function comment can be good. Thanks, ferruh > + /* > + * We eliminate the timestamp status from the packet status. > + * This should only matter if timestamping is enabled on the socket, > + * but there is a bug in the kernel which is fixed in newer releases. > + * > + * See the following kernel commit for reference: > + * commit 171c3b151118a2fe0fc1e2a9d1b5a1570cfe82d2 > + * net: packetmmap: fix only tx timestamp on request > + */ > + tp_status &= ~(TP_STATUS_TS_SOFTWARE | TP_STATUS_TS_RAW_HARDWARE); > + > + return tp_status != TP_STATUS_AVAILABLE; > +} > + > /* > * Callback to handle sending packets through a real NIC. > */ > @@ -212,8 +228,8 @@ eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) > } > > /* point at the next incoming frame */ > - if ((ppd->tp_status != TP_STATUS_AVAILABLE) && > - (poll(&pfd, 1, -1) < 0)) > + if (tx_ring_status_unavailable(ppd->tp_status) && > + poll(&pfd, 1, -1) < 0) > break; > > /* copy the tx frame data */ >