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 A4724A0548; Mon, 20 Sep 2021 17:40:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 28B6B40DF7; Mon, 20 Sep 2021 17:40:45 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id B0F0240DF5 for ; Mon, 20 Sep 2021 17:40:42 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10113"; a="245567641" X-IronPort-AV: E=Sophos;i="5.85,308,1624345200"; d="scan'208";a="245567641" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2021 08:40:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,308,1624345200"; d="scan'208";a="532211321" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by fmsmga004.fm.intel.com with ESMTP; 20 Sep 2021 08:40:40 -0700 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) 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 08:40:40 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX609.amr.corp.intel.com (10.22.229.22) 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 08:40:39 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx608.amr.corp.intel.com (10.22.229.21) 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 08:40:39 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.174) by edgegateway.intel.com (134.134.137.103) 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 08:40:39 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CcSMNeqKLIC+EPZN7/k+UFjEf5K85F9lybSfK8MIvR4Rux5yo930s6M3wEX7L7ia20JG7KztPTLJtHA91BITMiyWP1qPSjw++YTOksNDYgIVwh+tHx5bUDRxgb7T5Sy9h1pK9w/1UVFBLejN6BoVgES1Y5LwmIoRe4XicwAwdSF8x1tUgmDy5u8t0ISu3f1zCnRv3qODK8FR88NGbhWTLY66/SrRW1MD1LVLWahMju7YP/V5loREV0kaS9V2EQpja/vF8gfW0Zi7giEQ6Pmy0pmbjM52qrNW//0TAbzbCUwGCaxHRH+93g9qKSfjpsI/klbNUaVm5HVDbcMmxl93Sw== 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=KXDyDFvbk4VNLadCd5P5+XVbXhWOZKxRiuLCjZfRacI=; b=DazNK3/DDtW7kMSCAINiNg0gCnlnhS53t1pdcb67UrGMV1SEbk3ULYq+ACmP+aJ05gg6+dFyDN4wFhEcZ73KAYZHhDktTi5aKouO2De2KDyWXaTilmNKzGOYFDvE7aJPKtFaLDXlybou7EcGKmnpyEG1yvIq6jTDn4Pymjz72SQy+lKpEAD2jlpnLutcZKZweUr/oyuFCmhNYwKXX+vmo4tngeRAC1Bu3r45ucz+zgZVvTd7msyiS4oA+QDicAPs1UPdP8mkZEzmCA+Pvyr8qvWpGlBhdho5u2wUNRePHUMX5CvRh8aOxzHOgLzbl9V2hOIzwqCMnEUOYhXvX5lL7w== 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=KXDyDFvbk4VNLadCd5P5+XVbXhWOZKxRiuLCjZfRacI=; b=dujAft6aeaVJlyqe9yIYlsPS3++3ZkBIHpoEoPKWHD4HHoR3s0yCpgmzR1vOSQG1Vf9ZdT+iIDeEHvlbtkll32BYIUvi8ay4gjqxiyhyVnm/xmG4Db3NZYL2QCAFbRlF7D2PbXTydmgFX342BJ1NkuzCly7YF97LvgtBqL7gRiI= Authentication-Results: marvell.com; dkim=none (message not signed) header.d=none;marvell.com; dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by PH0PR11MB5176.namprd11.prod.outlook.com (2603:10b6:510:3f::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Mon, 20 Sep 2021 15:40:38 +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 15:40:38 +0000 To: Tudor Cornea CC: , , , , , References: <1629463607-76292-1-git-send-email-tudor.cornea@gmail.com> <1631091558-63337-1-git-send-email-tudor.cornea@gmail.com> From: Ferruh Yigit X-User: ferruhy Message-ID: Date: Mon, 20 Sep 2021 16:40:31 +0100 In-Reply-To: <1631091558-63337-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: DB7PR03CA0105.eurprd03.prod.outlook.com (2603:10a6:10:72::46) 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 DB7PR03CA0105.eurprd03.prod.outlook.com (2603:10a6:10:72::46) 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 15:40:36 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 04220612-007c-4c2e-1ded-08d97c4cfea3 X-MS-TrafficTypeDiagnostic: PH0PR11MB5176: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hapqBQ7dQkk/5nGgrLM+JlRhLaneD8owV+g4u7bT8XN3Mtq820pQyriyskV0FG99LDTQJg80dgxmk5Whc9QWVaGaR/AlkNQA2zbJmPhctVmSlFSld7NxNwkwJADrVSeZWLAZgHzDjxKqOTEb8UDShCFzfn793BLN6vd4Ehv4mdsCUHrOsEDdyW96RWta3PSr5935HVrOa2qgM0iN5j1+IFs4M/qjZDpslJ4DKA6X46UClt81+AGo1i3mkjFp/aQmUKvc1NBeVnZSXo9lDQkPFvglasDLgMG65St91zyVufSJ+Ai9WXRfHUnn87Tvrit4QTRenuUEbmwm54dhL65M8zHf0ha6dAAfuxwFEPH7s6U1QJRcGLfrGO0LLkQzxpOfIg4roktZ4DC2XEMNQa7Tk8onP+mPf/JrhJLDC9J9IkBKs7kx7L0dadspWfwKCJBsDC5gmfl5/1b+r4Q/BX4gD5gpQ+g4KjTtki/bimNwMgIONTEj9Sc5GVz1ejBXA2cOhnLt+k5+EtiJ4IXHPmh/FNletjB2TO8Aq0bzvfA04vNGzAVqheYZDpJn1UBFjHXkELDsc6+DwJnkuntN09+Ep6r5+31kBrimnzWszXloN7aidM1BrvGnvYnkHOIDycrC9cyLFHEsiG++ZyHf4F8UB57XtPMp3LYpwwsV6fYD8oHkQ4j7iXBUMGz1Jam6Lichyg6uGRFCdrxu44tXV/eqP1j3KRdetFZZC0ynb6zjMHq8ZRwujhZ5U9tuhFAUrHnjX1I54FhkJhIyRZFcu5E6xcqiDNwMg44L1DvX2n+0LFY= 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)(376002)(39860400002)(396003)(366004)(136003)(26005)(38100700002)(44832011)(186003)(6666004)(66946007)(16576012)(83380400001)(316002)(4326008)(31696002)(66556008)(66476007)(86362001)(31686004)(6486002)(966005)(2906002)(956004)(2616005)(5660300002)(53546011)(36756003)(478600001)(8936002)(8676002)(6916009)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?U2F4T3pKQ3RQM1FjQ0tCYTZoR1pYRUVSRHEwR2didHRSUFBWdFdLYmkwbm0r?= =?utf-8?B?L3RRVjYweFUrSHJQWkV1cUQ3NnBvS3d5d2JSYmg0NkNEamdjVzVqWmVIb0pR?= =?utf-8?B?OU5QUmhaNC9QY1J4cEJsSVNwbUNETXdnc25ocHIvNnhkZUUveitMRmJMeVlR?= =?utf-8?B?ajM4YnBkOE82QXJRbDU0RTVqYjhvYUp3cVc4MDllaWc0QWR0dm1ha0pvblgw?= =?utf-8?B?aHdhUjRieUtQeitwQ0N1M0FwLzNEcTAwZGtNNEJCMG1hcEh4VXRJQTdwSWpP?= =?utf-8?B?NU94TEE4OU9DNEg1cHVZUldpMGZDam5TUEtzVmRTaXlWcE9CUEpLVi9lSEVY?= =?utf-8?B?S1d2RjcvdW9ZTDhOQUtmeX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-8?B?dVdvUUNBRE11ME03WFc3WHZLVThWbTJEdjVPeEwrNzRhcER2aHR4angzK0g1?= =?utf-8?B?R2RTZG5uYVpSUDQwRURVeXBtVHZpVzU1N0t4YXU5Mml2c2RUcy9hUGZiQnZj?= =?utf-8?B?NlVNMEx3RGoyaWRLZzJ0eFdLdDFUSmlodzFYRkFoaFlNMVFWUEFLcWJWVnY3?= =?utf-8?B?UlFjZDluN3NlUFdCN3I0N3dqUHI5SEVnNXU1QWNTKzAxcElqNGVVWG1wbXdk?= =?utf-8?B?TGxMTVBRNDAweVh3b2hBRnFaSTRSL0ptUHMwWnBXSElYQk1rVy8rNFVJMjRF?= =?utf-8?B?a29rcjNHZVNmQXpqaXMxUXhQQTdFUStKb1Fsd3ZTN1IrRzdXenJTSklsbkJl?= =?utf-8?B?N0hZY1FVRzhqeWc4WHdhNStLaERHRVBTOUdoT0dxa2hac3Arekh4SzlRZHdO?= =?utf-8?B?RjhFVS8ybXlKK3BFdnBKbTZMNlU0emJiQitnN0o4dk9TRGZMYW9jODRLb09x?= =?utf-8?Q?VDArbnrSF9noIRxP3GRTdO0u7kxza4nHzrZMJIX?= X-MS-Exchange-CrossTenant-Network-Message-Id: 04220612-007c-4c2e-1ded-08d97c4cfea3 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2021 15:40:38.2551 (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: PgTYRrgS78DuJdjmBzPMJ6kOy9jWs1FoeNYUmBUcWSqaJUQ7E00lBOt2vzIIzXSbE4qCTftHyZd4vTvPakFV4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5176 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2] net/af_packet: reinsert the stripped vlan tag 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/8/2021 9:59 AM, Tudor Cornea wrote: > The af_packet pmd driver binds to a raw socket and allows > sending and receiving of packets through the kernel. > > Since commit [1], the kernel strips the vlan tags early in > __netif_receive_skb_core(), so we receive untagged packets while > running with the af_packet pmd. > > Luckily for us, the skb vlan-related fields are still populated from the > stripped vlan tags, so we end up having all the information > that we need in the mbuf. > > Having the PMD driver support DEV_RX_OFFLOAD_VLAN_STRIP allows the > application to control the desired vlan stripping behavior. > > [1] https://github.com/torvalds/linux/commit/bcc6d47903612c3861201cc3a866fb604f26b8b2 > > Signed-off-by: Tudor Cornea > Hi Tudor, The concern was unexpected performance degradation (user not setting any offload will have performance drop). But since your measurements show no significant drop, I think it is fair to make driver behave same as other drivers. (Until we have a way to describe offloads that can't be disabled by PMDs.) Can you do a few minor updates: - Put your performance measurements into to the commit log to record them - Update the af_packet documentation (doc/guides/nics/af_packet.rst) to document PMD behavior with packets with VLAN tag - Update release note (doc/guides/rel_notes/release_21_11.rst) with a one/two sentences to document the change, to notify possible users of the af_packet with the change. Thanks, ferruh > --- > v2: > * Add DEV_RX_OFFLOAD_VLAN_STRIP to rxmode->offloads > --- > drivers/net/af_packet/rte_eth_af_packet.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c > index b73b211..5ed9dd6 100644 > --- a/drivers/net/af_packet/rte_eth_af_packet.c > +++ b/drivers/net/af_packet/rte_eth_af_packet.c > @@ -48,6 +48,7 @@ struct pkt_rx_queue { > > struct rte_mempool *mb_pool; > uint16_t in_port; > + uint8_t vlan_strip; > > volatile unsigned long rx_pkts; > volatile unsigned long rx_bytes; > @@ -78,6 +79,7 @@ struct pmd_internals { > > struct pkt_rx_queue *rx_queue; > struct pkt_tx_queue *tx_queue; > + uint8_t vlan_strip; > }; > > static const char *valid_arguments[] = { > @@ -148,6 +150,9 @@ eth_af_packet_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) > if (ppd->tp_status & TP_STATUS_VLAN_VALID) { > mbuf->vlan_tci = ppd->tp_vlan_tci; > mbuf->ol_flags |= (PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED); > + > + if (!pkt_q->vlan_strip && rte_vlan_insert(&mbuf)) > + PMD_LOG(ERR, "Failed to reinsert VLAN tag"); > } > > /* release incoming frame and advance ring buffer */ > @@ -302,6 +307,11 @@ eth_dev_stop(struct rte_eth_dev *dev) > static int > eth_dev_configure(struct rte_eth_dev *dev __rte_unused) > { > + struct rte_eth_conf *dev_conf = &dev->data->dev_conf; > + const struct rte_eth_rxmode *rxmode = &dev_conf->rxmode; > + struct pmd_internals *internals = dev->data->dev_private; > + > + internals->vlan_strip = !!(rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP); > return 0; > } > > @@ -318,6 +328,7 @@ eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) > dev_info->min_rx_bufsize = 0; > dev_info->tx_offload_capa = DEV_TX_OFFLOAD_MULTI_SEGS | > DEV_TX_OFFLOAD_VLAN_INSERT; > + dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP; > > return 0; > } > @@ -448,6 +459,7 @@ eth_rx_queue_setup(struct rte_eth_dev *dev, > > dev->data->rx_queues[rx_queue_id] = pkt_q; > pkt_q->in_port = dev->data->port_id; > + pkt_q->vlan_strip = internals->vlan_strip; > > return 0; > } >