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 B0AA242ADA; Fri, 12 May 2023 04:04:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 810B4406B7; Fri, 12 May 2023 04:04:15 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2116.outbound.protection.outlook.com [40.107.220.116]) by mails.dpdk.org (Postfix) with ESMTP id BFBCD40223; Fri, 12 May 2023 04:04:13 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WenB1C+1//tfmFX+WyBNBtM95ql9M8iaLOp0WjiEl9sQhJFWSVKKZWwLNbBlB4ORYvu1m68GCT0o7Hr+RYHtDQa2vBPZ7DwiuvbXChHFJmfcDQ78uivHwfMlGHQfKEFhmvLh81h5AYulU/fduSZPXXI6NB01athRG4Ksu54EFGzWu1TiGlhJaqrvucIXQ3aUuYlNWlfZuzpjSA9XQF8WSPxbQqD6zNM1h2AhKGuP128EkfqYhq7dp1lDjgrxke6hhZZtl/JNI+6xqnBJYIj9sLXXv5qQwA6+RT7N9F7r9ipx7zWO2CnXyBsi1iH9daa2T4TDGtN0ga7fhuQhJSD3kA== 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=N33GUBs87Ifa37G1tXAb/vcJ09H7L+ztNF7aaV4eyOw=; b=MYhWk1efdYWL+zuwMLX8a0fs+O9VDGgjiKjF0CRKo9S5TJcAmEQ3QS5FKc9xN1p5XA8j061XFL7E2H0jaYqaQReEmPMe3c03QMdCWPmApy3QajvVapCdWR3AemJw2u8KvJKVWdWCLaFnMOGj3LiBbHGEx9gz9lNVDn7KWQNfxdXZKJ8nBLlzfV2NVZi0CpYCEGDV+k9OcwLeUNV//Xk5RGM1o5wpbJhKZQyv9LxUTNgl1D97N7d/hF9p+8P/3vCQzr4NLUdi5afi36BsSLO99f/ELcd9JQBeudO106tu33LzRQqlXY+LOz5JbX6Ecm8YYq2/F31I9b4d9bzd2/QYPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N33GUBs87Ifa37G1tXAb/vcJ09H7L+ztNF7aaV4eyOw=; b=jKFHH7TWvRuMaDO+UyyRCQFB9ySxZJD61UK0EWPLuukTO9XsubQwmYhs2n4j47Yi8JYVgkk1M2FzHS9JmY9rGpm69oJ/gTXuHHp/d1Pw8/516eglEAYIlCn1i0D5oh2XWypdD2oC7tqVVA0Jt22/oXF9vT+5GSTWid+HZKsBBeQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by SA1PR13MB4830.namprd13.prod.outlook.com (2603:10b6:806:1a9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.22; Fri, 12 May 2023 02:04:10 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ac2e:52b6:82ec:4994]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ac2e:52b6:82ec:4994%6]) with mapi id 15.20.6363.032; Fri, 12 May 2023 02:04:10 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He , stable@dpdk.org Subject: [PATCH] net/nfp: fix the VLAN push flow action Date: Fri, 12 May 2023 10:03:46 +0800 Message-Id: <20230512020346.616180-1-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR06CA0014.apcprd06.prod.outlook.com (2603:1096:4:186::11) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SA1PR13MB4830:EE_ X-MS-Office365-Filtering-Correlation-Id: 237635fc-1860-44d9-54f9-08db528d2d09 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AJR89gW44C0f8yq9UMApFXsZYQ250lgGr0nB6/emYITNuBvfeHQQZQ9ALuFg3N1V9ePniRDGfFEeq8N1gVlYUf+PYTOZW8jenUUlCUUTMMj8XbyRhqtQiXsxgTS/g4P9JP+g6foZlRP3Yb7HVmByk9Fj7BHqKFDst9SpwA3kJJ+3EzpS1IZIJuCuvvJpsVo+I1jYeUCNRJ1XzZnRr7nNgmMg4HCgJlSbdfQN56QrMbqhUUPESMktRojn6jycnLWqUhErumunfA2WaUdVrJ9wwZOavlMrlOAI/0yQjRCeVu8uKWqDQ8985gAkh1hWXIDcmXVz7ABFfB7O0lucuSvVSAXfSF0NYsuSQ1nWtnv5tS5PGMtVzpb9R/DpvPLJ0rNy4iFzJRUS5weHWnRaehwL9gXyOevZ9+SuebthtXMeOeCahwJ779PUr9mdABpcJUKACbtvEG9JqgbqS8KhYlrGlShkDIiMulCdBAT5Pm8br+vY3ikIjpMcMDtRj9XbGaRkDjG7Wv+wxZeelUNsi6w34rvTZFbtLsCJ2EeI1OTThZPwOaVKxzBLWcxXHXT9Ja7gyBGQzAz6AwqtFiPUc+La6fySBrUGfzefSnn4aMWty1fo9R8XMFcMg0FM3XJHak3hJDCXVA25m6jPgFPEh5XCZowAzhY7A4ClffLjc/Lx4L0= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(376002)(396003)(346002)(366004)(39840400004)(451199021)(52116002)(4326008)(66946007)(66476007)(66556008)(6916009)(6486002)(478600001)(316002)(450100002)(86362001)(36756003)(83380400001)(2616005)(26005)(186003)(1076003)(6512007)(6506007)(8936002)(44832011)(5660300002)(2906002)(8676002)(41300700001)(6666004)(38100700002)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TGNQYjdUSkZyVy9VaWVFVitUcDk1MEFHRVpEdjdCYjY3aDg5WGRVV1NxQTJz?= =?utf-8?B?bitkMXR0V0FCTHVvd2tqb0kwM3lrV0R5TFFxTlVFS2E3dC9qZDdBVG1UZXdw?= =?utf-8?B?Q1c5Rnk2Z0x3RDE2MFMzSTlBdHJ0R25IUStpd2xpVElHVHp2b0NxQ1VENm9q?= =?utf-8?B?K0pyN0h4S3RVSGRuRUxyQWhGSVEzSmZFbjYvTElEc0d4a29VcDczQUgrTm1w?= =?utf-8?B?akpJYkt3eWlURlpoWWduVVlwZ1JvaDZ2SndpQ2hxT2JlNENHMXEydkdUbWdI?= =?utf-8?B?Tmh0ZTRIY1NXQmpnMzBCSTRCdExOVDFsbTlSODBaVXlkOGdrL2c0dFBwb2Nu?= =?utf-8?B?STdWaG9ldlFWTEZKYW01SHV2YUc1UlNLY3ZWUWtDNTFBU1Myb3h4M0FCcFpG?= =?utf-8?B?NkI3VkpDM1dNa1ZuQ21iaU1CNXhtUjRPOTFYR2Vvb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UNUE2TEVtUGZvdFZJK3cyakRLUVhNWnhXbGRWKzB0TnV6?= =?utf-8?B?clZCUFFMcnlJeUJZdVdhcnV4MTlxVEVvVGlLZmxGUnVONDd4K3h1azV2R29P?= =?utf-8?B?YXFKVUZqMDNhVHJBdDdjcDFtNXBYN0hqNGtZR3ltellWNGNsVjIzV0Yya0p0?= =?utf-8?B?Sk4yWEFwWWFHd09SM05XcHFHL0EyUEsvbitnTUFLZ1lsd2pzMWRpUGNSQkFG?= =?utf-8?B?RktNWlFZQVNCUXJuYWd2ak5HRmhNZWhLVU42WnNvb3JGdDJjRnRPMnVwMXoz?= =?utf-8?B?VmN3cFRaV2VoNGI3WEpSaW9OOEkzNDRLUGZwZjZ1KzVsemJMYlJ0TjZmdDVj?= =?utf-8?B?cythODJqQ1JBZEd2aVd3ODN3cDlpek1SQXkrWCt0Um80NVh4ajVWUi9xblZU?= =?utf-8?B?UHRyRm92QmR1aStYaDNUVjlGUkhRYjE1QTlkL1ZRSG1TNlViL0Vta0pFZDdP?= =?utf-8?B?SDNkMnRxZWNxVW5pZEx6dWdvM1kvSFl4b1YrdC85alUrcGQ4djIwSXEvUWVW?= =?utf-8?B?SXM0N2VQUFJIQ0NTUnB5aDJBbHhtU1lYeWttM20yU2txMjByMmdJUytBa2V4?= =?utf-8?B?aXJtUFNZNURHMzQwOWNNWDdBNUtId3BvaDk4Wk9EempSYzVjL1VsaExSWGg1?= =?utf-8?B?cXdFUmVQdEtvTnRYVGxoNk1qN3g4dW43R3FUdGRRK3VON3VjSi92aENhdWc0?= =?utf-8?B?NUFIY2NTWExYNnJCRktqcDM3d1kxTUZoKzZma1JrYllQSnNoVkFEQXFIbmZO?= =?utf-8?B?ZjdvSDBaSk1nSlFFYjZrM1pldE53dThUQjdyQXJyUGZ0UmxEUjFxQzBBL2NM?= =?utf-8?B?SEE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 237635fc-1860-44d9-54f9-08db528d2d09 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2023 02:04:10.5270 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: TrknxS9TCxdu25uhVYZaTLRxKCdXPjWJHt9Uv3oYWIY/qaiWOAXAM3lkTNeVTzDZk1X9+YnYnuJ0JZM+vhmct4j/uoJMCX7iTvx5pBERqvg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR13MB4830 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 When process VLAN push flow action, the former logic perform the mask and shift operations directly on the big endian data, which cause both the pcp and VLAN id are not correct for offloaded packets. Fix it by convert the data from big endian to CPU endian before perform the mask and shift operations. Fixes: eb9277cb2fd1 ("net/nfp: support VLAN push flow action") Cc: stable@dpdk.org Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- drivers/net/nfp/nfp_flow.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index 41b722f4d8..fdf5c0f40e 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -2205,6 +2205,8 @@ static int nfp_flow_action_push_vlan(char *act_data, const struct rte_flow_action *action) { + uint8_t pcp; + uint16_t vid; size_t act_size; struct nfp_fl_act_push_vlan *push_vlan; const struct rte_flow_action_of_push_vlan *push_vlan_conf; @@ -2227,9 +2229,11 @@ nfp_flow_action_push_vlan(char *act_data, (action + 1)->conf; vlan_vid_conf = (const struct rte_flow_action_of_set_vlan_vid *) (action + 2)->conf; + + vid = rte_be_to_cpu_16(vlan_vid_conf->vlan_vid) & 0x0fff; + pcp = vlan_pcp_conf->vlan_pcp & 0x07; push_vlan->vlan_tpid = push_vlan_conf->ethertype; - push_vlan->vlan_tci = ((vlan_pcp_conf->vlan_pcp & 0x07) << 13) | - (vlan_vid_conf->vlan_vid & 0x0fff); + push_vlan->vlan_tci = rte_cpu_to_be_16(vid | (pcp << 13)); return 0; } -- 2.39.1