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 ABCC4A04A2 for ; Thu, 24 Feb 2022 08:02:42 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 93A1F41172; Thu, 24 Feb 2022 08:02:42 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2071.outbound.protection.outlook.com [40.107.94.71]) by mails.dpdk.org (Postfix) with ESMTP id DC2C64114D; Thu, 24 Feb 2022 08:02:40 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e5tgHgSnHayEQLWTgBtbfA5AV66HI/xNiAYsfigQJPPwA9Q4BP+eCSaO2I9DNJZhIdW/lNEq7Hp8YdwW9Rg0V/fI5S9fukNhpLNiXsBl5DfRAjAVVzmdZGKYiVV06n+FNijb6Owf9IAv2QFqcXsnuSAAX+mpTmyByzj9xqAMUTdQcmvtvKv/l9b/jOHDhS9G0mpBsoKbjkZ4p4YlRwqJ4ujJO5KAiddQqymgqcBkpwB/HXtkhONPyORNbf+RO5tHP8WUxan8QKh+SVx6cQnAUdAzwYmBSkZwnVHs6AsMIer0y/WpqITZi3E5+NPGP9xEtsgYrLpzJhyF2l+qZp34DQ== 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=Z2KB0BJgIRFb+kySzNN3bC2Bo/PgUGgSzVWuFMzVhAQ=; b=S2+Yz4ElkUmNUCS6y9vh8RmSa70iyqa7BKWuIbWYOSNKMp7vAf1Xki+dh9KkLWBTK0bla17Ps+Hvfx9QpbGOaAOayBv/A/huv5HaSEd9JnNGeYcoSOZNSYxEPa4DjpvLyYNN9z5pHcyZ5lcD7fEzv2XCIoh07UpJvTpRRiMNDEPRbhiRh0/2qSxRdBcMn7hG2lBA8qD8vXNqbEsAmDTjVkfU4vdePYaQuPZV1+pDdYmTGG4AXVJglCJaiwWb4wRsLha7K2S9X8gHBh3pgOkj758mB+5L9HvbRv02mOO6Jvan7IoUSEl0i41QtjYDvgsWvGCwergkd7zCJZs4SCesdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z2KB0BJgIRFb+kySzNN3bC2Bo/PgUGgSzVWuFMzVhAQ=; b=XKR51UCBWEBIcVcpsBbbOfcnd1uIjj8D6xIKtsvQL0D89jGN47swjoZBpqjlH5uTD8Xn9t1i7H361XKl7HRQawDFF7S05/4H4O570A3wEcHr+K6MoaeMGFYQFs4/vfO+cO4Lmg+3QKNmpuKjlyumH/UJW6Oqcgs3vv+PA1Xih0km1vELdIHakjZdX28V6i7ZHn6TBsYeextpBY/npZBt02fVVyPDwgJNRwuTOvP/f4dXjShySFP17sB0yUGqcVsjt6mO5J7BLVS/5Uus8JwIAhKOoGr8SzEsgOqPHmJ0y93VG9amgbnR1URU7fDagkDxWSXx7CsRIcdrXf5RlfwH4g== Received: from BN9P221CA0025.NAMP221.PROD.OUTLOOK.COM (2603:10b6:408:10a::22) by BYAPR12MB3143.namprd12.prod.outlook.com (2603:10b6:a03:a8::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.24; Thu, 24 Feb 2022 07:02:37 +0000 Received: from BN8NAM11FT046.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10a:cafe::ed) by BN9P221CA0025.outlook.office365.com (2603:10b6:408:10a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22 via Frontend Transport; Thu, 24 Feb 2022 07:02:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by BN8NAM11FT046.mail.protection.outlook.com (10.13.177.127) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5017.22 via Frontend Transport; Thu, 24 Feb 2022 07:02:37 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 24 Feb 2022 07:02:36 +0000 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Wed, 23 Feb 2022 23:02:33 -0800 From: Bing Zhao To: , , , , CC: , Subject: [PATCH] app/testpmd: fix raw encap of GENEVE option Date: Thu, 24 Feb 2022 09:02:14 +0200 Message-ID: <20220224070214.326158-1-bingz@nvidia.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1a17a0f8-1a32-4065-d68e-08d9f763a3d0 X-MS-TrafficTypeDiagnostic: BYAPR12MB3143:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Sbx/sJXOTTThxzMMbzbT1VA8oibJH0UZerLclGpouQCnBO84BA4ICiEmqJ+qN0dN6AowsZocHwtVbT8YLcjv/zQLx3MxsGk+akL9CMB3z1yC2aKD9/dq8aPMgwAjIkMYUSpJ63SJNmh3QZB3l+UAwtVSV3ZxZyaHSKgyOdcc/N2zqH2hkcxxRTsngVe9zE0itoAx4eT00h+LdscbkcDuwYdv13OCn1yPV9lIkBpqqRfnhHH8p1qkuPD5p5KtKQtx57XhvTgW/gRufQ1z+xb/VX5HoXB/Egv/xgGhTjTDAKqaZgr1yA4SwCeahd1FbOBZVF+yebnaeOYSNOxY6F+sn7cY+Z4tEnPHYYiUqLz2NYMAwyxQMHmDaSIQf2mYwb7Z6TuiaIGuUzZ7Mjj26DqLIEkE4ghczD8CNeuc1VpFQXUdGlFIGI46etIP5JdWw0pusirtpqF9ukYJtLOpvQ7fLLhk79cWcUvypxAUltxE+hivr4ama8URWmnuG9qcBGWdbLT4sDDzP7drKdDIuywIXW4FFRrrygHs7UnI0yiP6CYs6VsRhHU9vUVrE3W6Q7aMPAzjaiMOtQHFgMHrkWQfgWh46cgmtZfZ68kQ6p6hHoWROpO6xXttBupMKtscwNrXnNERY7HwtPElmrrjMC2tt6OvsUvhPDXYjUCbS5rFwOByYkBzCSDnCTHiYHfrDdjg0LoPMLWcCDke+gZW1V6GDw== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(4326008)(508600001)(316002)(6286002)(70586007)(8676002)(86362001)(81166007)(1076003)(2616005)(186003)(26005)(16526019)(70206006)(356005)(82310400004)(83380400001)(110136005)(40460700003)(7696005)(55016003)(6666004)(5660300002)(8936002)(47076005)(36860700001)(36756003)(2906002)(426003)(336012)(54906003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2022 07:02:37.0112 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1a17a0f8-1a32-4065-d68e-08d9f763a3d0 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT046.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3143 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 The structure "rte_flow_item_geneve_opt" is not a protocol header of geneve tunnel option from rfc8926. The field "data" is a pointer which points to the actual variable-length option data. So the structure is not packed. There is 4 bytes hole before the pointer in a 64-bit system. The option header is just 4 bytes. When using offsetof() to get the fixed part's size of option header, the wrong value 8 was got. When constructing the encap header, a wrong size and offset was used due to this hole. With this commit, the fixed part's size is calculated explicitly based on all fields. Fixes: 55c074f3ba1d ("app/testpmd: support GENEVE option item") Cc: viacheslavo@nvidia.com Cc: stable@dpdk.org Signed-off-by: Bing Zhao Reviewed-by: Viacheslav Ovsiienko --- app/test-pmd/cmdline_flow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index c0644d678c..60424e26aa 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -9426,7 +9426,8 @@ cmd_set_raw_parsed(const struct buffer *in) case RTE_FLOW_ITEM_TYPE_GENEVE_OPT: opt = (const struct rte_flow_item_geneve_opt *) item->spec; - size = offsetof(struct rte_flow_item_geneve_opt, data); + size = offsetof(struct rte_flow_item_geneve_opt, + option_len) + sizeof(uint8_t); if (opt->option_len && opt->data) { *total_size += opt->option_len * sizeof(uint32_t); -- 2.27.0