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 EEB92A0C46; Tue, 31 Aug 2021 17:31:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 896FA40142; Tue, 31 Aug 2021 17:31:32 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id CEE6940141 for ; Tue, 31 Aug 2021 17:31:30 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10093"; a="279509695" X-IronPort-AV: E=Sophos;i="5.84,366,1620716400"; d="scan'208";a="279509695" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2021 08:31:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,366,1620716400"; d="scan'208";a="541052924" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga002.fm.intel.com with ESMTP; 31 Aug 2021 08:31:29 -0700 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) 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; Tue, 31 Aug 2021 08:31:28 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) 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.10; Tue, 31 Aug 2021 08:31:27 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) 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; Tue, 31 Aug 2021 08:31:27 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.40) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Tue, 31 Aug 2021 08:31:27 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ItnXxZziXvyOsgjff4vM15QObfASOKMyCWocjOPZ1FYxKYLFmRJYXDudtkbEMLGRopKuYt6xi+cXjucuUf6deX2U2ATVi1wKE3/fqXXTnHuOJA/MjGy0ds1GmGsqcW8xBGjk2xKtKitch8P/II1tKh7OLng9rbZAZq94uFIsnsG6q4ymzEu9nI4kVHAM7dY1rZU2WQRZH6+RPqWJooks0QerLTO5e7ZvBiASqus9eMWWLULiKiEmbra6xM5nFC+k/z8mhW6GdGfm0tm+DEVVJSvczXNWy3I3S6ZcrTmXjFGdmsOZbA/apdvt325j/XeNjBVeQEROQXv/+HDYhBRpFA== 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-SenderADCheck; bh=CrRRwJLWc3emzhFyE7uaZGtORhkpoxZjbKPtukY/cdU=; b=fWAIUfcZbyZRekFLLJVUBTs3JbXchf6jqBFg6SWzn36hRMMaa5NCgUXLN9oEd846P42t+d4Vi2YtjoE5V58gn9EgnglmmZglgfzYqlc5LZsVCHN87B1bnJl8H1FZ1fwxCfreyJZf++AcuEq5epHjoamHMvgcJLmB/GPbEQdxAQDqfL9Bl6Whd/FSVLEbPG0stPR92rE43QBnVZ+BxFG9hR7PDlxYE4kpiUmA+5DrXHL90RYq2xZeejwIS//VhECr/KpZObsVhSoGZxFGOAmhzP3sWTeGIuVZLgbsGCtC3DaEdp726o6Tu56vL8amxKTsfTEsJMTdxFMNrxhMt37PMQ== 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=CrRRwJLWc3emzhFyE7uaZGtORhkpoxZjbKPtukY/cdU=; b=rsnO7T8Gos0kfiAU8ozbnghW4WoyThcT7q1J5J+pIpidyiFhkcDbYYmM0+ZYFy7hd7RqwHzB8j5PjjKvi+P7oyoeFlweoSWIXdIIubu/IIBJD0V2uIfvPUpZhGsee6VR8sqZ+1KFttTuWjMyYVBIK1Iyu1MW6qLo9uPSoJJutr0= 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 PH0PR11MB5144.namprd11.prod.outlook.com (2603:10b6:510:3e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.24; Tue, 31 Aug 2021 15:31:26 +0000 Received: from PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::747b:3a08:d1ec:31fc]) by PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::747b:3a08:d1ec:31fc%4]) with mapi id 15.20.4457.024; Tue, 31 Aug 2021 15:31:26 +0000 To: Tudor Cornea , CC: , References: <1629463607-76292-1-git-send-email-tudor.cornea@gmail.com> From: Ferruh Yigit X-User: ferruhy Message-ID: <1483bf7f-09ec-edd5-1fc1-4b4c81206ae2@intel.com> Date: Tue, 31 Aug 2021 16:31:20 +0100 In-Reply-To: <1629463607-76292-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: DB7PR03CA0081.eurprd03.prod.outlook.com (2603:10a6:10:72::22) To PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.0.206] (37.228.236.146) by DB7PR03CA0081.eurprd03.prod.outlook.com (2603:10a6:10:72::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.20 via Frontend Transport; Tue, 31 Aug 2021 15:31:24 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3d3c3ccc-76e8-4b2d-8eb4-08d96c94657a X-MS-TrafficTypeDiagnostic: PH0PR11MB5144: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DHN8caBHTiJr9DcBL5zAFJ5YCIOmbgMs7Kr511v9QAy1rZ9VGxH75Szj286rLXIKjc5DZC+jtKPSOgiTKbzX/H1VKKPCzxwNaSgyz23BaN/xkeK/bYAiPsfwHals4OED3fpE2P9izBqKPQMt09a4oHOQ2kiSZLodpIgmepW5plGSSViGWIvoOIhBugYRR6fW2v6GnoyWOE93Q3oet0orAcEgZpvq5qyASeP1AS4p5VmwjtiijVwosjrJ+rc/hQGWrEiw5WEcJop+0lrm9RKqXq05JiD9aZs9k/Onu3r1XEmk6GZWPn2TfobLSivEfDSmRotKC/ngAq56RIPv9lDAcrXFCOr6My6PuwXOym+4z3W+xu282s86gFc78wZfhp8AVsmWMqT6P/VXmV0VfLTchm0vgt8mHLzrppDTLu4lq1ZRiHEqoz3zf9ms/5MutF+sN6ng9Fz/pE11/m4o9SZAAOUw83ltklV9MC1d6O+16phRcnV8hu3ThWw5fgpkA8FZVBICpCJmVV2Q0/tv+xV6xfv7fUk1rIE56bhsScXcbxuSL5HiABikZiU9ZtKb+enhnY8ycBTyHgrQQJCz96y/6R3VcsS6C3CxciLhufL/1qMwqOoUsBbDQAtjg2JF5zQ8QFI78hLBSSDhfthWDGJTepfs0Z3C3cJPUgAq4YpExoDORrjmO9G0xOzTtdSZUEtjYZnkz7VIyqa1LwEvn8TjUzcXauQE3YJRzW3HlX/pzZxraArJdt5DxVjj4wTDrCDCyQqJ2d2mHbIiK2dzZCmnxGNJvoviOBs8JE0rdA1hoPI= 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)(366004)(136003)(396003)(39860400002)(31686004)(66946007)(44832011)(31696002)(966005)(508600001)(66556008)(8936002)(53546011)(6486002)(2906002)(5660300002)(8676002)(16576012)(316002)(38100700002)(26005)(36756003)(4326008)(6666004)(2616005)(956004)(186003)(86362001)(66476007)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dGpkOVcveU9JcmR4cy9NcnRzcktQd0N6K3R5T2RvbHdqcXRsaldIUE9BbTVq?= =?utf-8?B?WTk1VkpnalBlSnB4eGJ0Z3ZSTXhaaXQwemJuZnltakJLUEQvOFVhR2Fiamho?= =?utf-8?B?RTJmUVNUamNISnV6djFrNVd1ZXR3bDRYcERoaEp6T2xvdU9MSGdXcjR2cnUv?= =?utf-8?B?ZlRnZE9ObmtPZm1zeXRWRlYzM3p4bXBLWkVIYnRQT0ZERVVnSU0vbWU3UGNN?= =?utf-8?B?UFFTVlpCdXU4d25ob1ZGWkNUOUozRVdkNGxaSzdBNW85MHV5MDVCcTg5dU1B?= =?utf-8?B?cXNxUkcrZWZWZmZSNjN4TUdVTG5BclB2SFN5dEUrWkc3TkhZS2FHekJwV2s5?= =?utf-8?B?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6?= =?utf-8?B?M3UxVWEwemIrbkliWHl2WVU5eXJVNmdPWitqZzB2dmVaeXlYNkpiSEJRSUI3?= =?utf-8?B?V2V2MjF1SVlEa0ZIYVZyRWdCS2lqOW5QdXVuRDNBaTVVTnFQSkZPdlJ1bnRp?= =?utf-8?B?RXZOYWU1dVZKNWxMV1NjYWs0d2ovYnZhZ0xvYzk0VWpnL0M4aHU0NTErWVRG?= =?utf-8?B?NWZiai8yTVdlbEhCMHMwRFlwa1VyTGY1djVpeHE0MFoyblV5S2NHNU9xSmp5?= =?utf-8?B?MGZaUjN2MkE3V0Vyb2wxWTZPeGdNOTd6NnNqOTU5UzRiWkg4S0J1YXVVZFE2?= =?utf-8?B?c0ZhdlNqbUtYc1I5S0RXMlBIbVZ2Y3VvbGNBWkZXYkFkcFRBd2c1Y1cvOVox?= =?utf-8?B?ZFAyeU1ZUEdocGxpZFpOeG0xZUxrVktXUW9USWRvc0hVRk5NQUpWQlJJeGdz?= =?utf-8?B?WHhpU21jcnZTQjBiN1h0dUF6blhGaVBsUXVXS2wzNm9sVEZ1b0FyQTVYQXRV?= =?utf-8?Q?dj5o5U8LyrSi6pWWX+YTgor7ZGlALh7+l3Yvt1p?= X-MS-Exchange-CrossTenant-Network-Message-Id: 3d3c3ccc-76e8-4b2d-8eb4-08d96c94657a X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2021 15:31:26.5207 (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: LPlI19yHwBdNzmvVi5o7ssh50UsUN0dP8lPbWA52vyhKJGx5XR+zod+OpNrUokx+MmZV14f+a3HwkeyvkVn/0g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5144 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH] net/af_packet: try to 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 8/20/2021 1:46 PM, 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 bcc6d47903 [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. > > We would like to have the the vlan tag inside the mbuf. > Let's take a shot at it by trying to reinsert the stripped vlan tag. > PMD already sets 'mbuf->vlan_tci' and 'PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED' flags, so application can be aware of the vlan tag and can consume it. Inserting the vlan tag back to packet is costly, what is the motivation to do so? > As a side note, something similar was done for the netvsc pmd. > > [1] https://github.com/torvalds/linux/commit/bcc6d47903612c3861201cc3a866fb604f26b8b2 > > Signed-off-by: Tudor Cornea > --- > drivers/net/af_packet/rte_eth_af_packet.c | 4 ++++ > 1 file changed, 4 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..d116583 100644 > --- a/drivers/net/af_packet/rte_eth_af_packet.c > +++ b/drivers/net/af_packet/rte_eth_af_packet.c > @@ -148,6 +148,10 @@ 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); > + > + /* the kernel always strips the vlan tag, try to reinsert it */ > + if (rte_vlan_insert(&mbuf)) > + PMD_LOG(ERR, "Failed to reinsert vlan tag"); > } > > /* release incoming frame and advance ring buffer */ >