From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0064.outbound.protection.outlook.com [104.47.1.64]) by dpdk.org (Postfix) with ESMTP id C17731B34D; Tue, 13 Feb 2018 19:35:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=IZgI5E3f2A3yG8epNjUcGgqFyLBrD6eKoN1Tt3/Wkn4=; b=JjdQAZeiPYMpA3YcoSzYX2d8wONW5MxgFGPBsSa/H6WlQHGFr0GAoKNa7fo/uda334rUqVGP+2vneIOgOFgDshGZvaOdC7bR6BwdMqkXlR0Pz5i+AGsbUKXGezHc4bqkNxselGbzaGcdu9E22iu+HRCEsvnvgfKHTfRvRCNZP9Q= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM6PR0502MB3877.eurprd05.prod.outlook.com (2603:10a6:209:b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.10; Tue, 13 Feb 2018 18:35:55 +0000 From: Ophir Munk To: dev@dpdk.org, Pascal Mazon Cc: Thomas Monjalon , Olga Shern , Ophir Munk , stable@dpdk.org Date: Tue, 13 Feb 2018 18:35:47 +0000 Message-Id: <1518546947-20932-1-git-send-email-ophirmu@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1518542172-9334-1-git-send-email-ophirmu@mellanox.com> References: <1518542172-9334-1-git-send-email-ophirmu@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0802CA0031.eurprd08.prod.outlook.com (2603:10a6:800:a9::17) To AM6PR0502MB3877.eurprd05.prod.outlook.com (2603:10a6:209:b::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 90c10adb-d02a-406e-a494-08d573109f02 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603307)(7153060)(7193020); SRVR:AM6PR0502MB3877; X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3877; 3:+QUOYVnd0zoaGBIvFPXnahib6Iv+Tkg2CAmnviGgEVS5YdJy9WUOuPtvlIq7cyB6yz+6KppNfyTBV0w/zq2UCFx9Y6tGb35IOFhBiLcd5sU/tPOyBqwm3GzJ8L8XofkDoyyeox59a3r5By3Wz9lcxrgU4rP3/aksaBbHN21b5/R8Uvsao8VnTah7VM38rcJSYgOoTXzEc4HD8HCjD5FBje78W1Uk8x+dFsJFgXHQnEQjI1aAAIQQ4/H1e31yG6sX; 25:AMWaN1UXX/7wSGvV/hLhTRGD4gUvbNy6GqOiAxJ7tc8/YJz0GyDKzvvvJRhwZ0zeq1i/IkBNkHS8UpEmYVIZlW1wb4Ynr0EGA2mqKk5RnWgLd/Uw42RDbTqhhUR+hNBAsYpO0XpVtzkxwQEDqdkiNoGXmNZ3OFMwHRfmRDA6mFwEO0Rqt7d1L8G5z/1ird9wjBO8S4lHQpAfHtp7CEgXrLf7w+MNIT2k8Gz+oGR7mOV2rmoJ9Wu/rs5ev/nzIlTB7Leptdjlr3eQlxVhW0464l7KiBNJtqNlPbuCkOlZM3UiPlUZJmRjsL1krFUjMmDoS7QbnhOcLy40E16gHyBqfA==; 31:I3QK/F/t2aHebohZskHXDjFxPL0gqE/4VD9xR2WMkkxIEq59hPfaJzW0ifo2ea2uRU6C4If0/x5nGYx9Oq4BRNYivFfwWp0O45O7pnZczOKxBxcBadsqtptpZUVnkqWADyfYb5dqrhmYa3jccN2Pm7rO6JqcKtIAnEMVNVK4Sg0d74sWZUa0tZdgE/IXeyItRmtqK3OarxdeBj67xNOaCPpH4gAFuZCK78NdqaFHino= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3877: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3877; 20:PBsJPxZF93QjYkI8RgvYNMXnpiv7+1CgURN2NTVae2TbeaFIi/W8B6L4i8Rh5ryhodIIlUB+dJxVbEE9XItrgR87pZV27PzK6IuyEjXhg086EZLlzpe4RsS3EM9aHJMxELwgmlEGjAqptJEd+PeFehCaz2LBbu/qyBmm9bmQ9rLUeY+BZnWJzICHn1ww/fqru+W739hk0YIy34KSZT2NPW47jcQeX8r4P9meJhiMWH7eadgkUC0+uBA9hbLkt28R31oj75O2Cl7mj6FGRlaa/tid2r2hLyH6g0j+7GnvEEDiATmv51bmFmTLPsB+W9fxqmgJ8SVbhRH9n60ZmUb5nxTN3xuiYsY/X3zksqvEWbJnrEos4vDB5Hd19JNkRZbKABP2Mpx08UjZZ14CCD5VIlAudl5MP46m4togsy3R7ITl80BClgorRHRQjp2fW1moIX3fakS+wdwvSOVvaIzJMrTDm965qXU2/x8qaKDat9L/uNeL0JRH3xYJ44CnYumK; 4:6b2rlyKgjNu6mGFhwcHMaD4lNNLIPFBdsmthJUWK5O9jyVC6bv3ax3Twe38FuyEwth13hpSFp98BFRCqPCccnxMoH7Du7Ob8kafhKwCJOhcq7dy4jMBZ/wGxinsPgYj9NDJpFrhkklbW0GkO9TdFONlGen0n4e/ohG0MajBl9FdTJTYmmVEZTamNi3cUJwZREfwuZ3IS1y9/rYzypgFnEBo/tIMN5Wuql7wV6Cjj6AP5jOG1YMuUZIm68yHwtdWIPe8YSfBlEYKFBTunIl0vaA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(3231101)(944501161)(10201501046)(6055026)(6041288)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:AM6PR0502MB3877; BCL:0; PCL:0; RULEID:; SRVR:AM6PR0502MB3877; X-Forefront-PRVS: 0582641F53 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(376002)(39380400002)(39860400002)(346002)(396003)(199004)(189003)(50226002)(33026002)(55016002)(66066001)(48376002)(69596002)(47776003)(3846002)(52116002)(53936002)(7696005)(6116002)(51416003)(25786009)(4720700003)(81166006)(16526019)(26005)(97736004)(186003)(386003)(76176011)(6666003)(305945005)(86362001)(8936002)(8676002)(2950100002)(106356001)(7736002)(2906002)(316002)(478600001)(16586007)(4326008)(50466002)(81156014)(54906003)(5660300001)(36756003)(6916009)(105586002)(21086003)(68736007)(59450400001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3877; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM6PR0502MB3877; 23:xYXA4/kTKm60Yv3NFSes6iJB9wXMAyh19q3BWTk?= =?us-ascii?Q?nA6bxpu+uV4rQ5/WPgKCUY+ryAGSkQGN0Z0a9sab1u04O83BztbA0jx+0ztJ?= =?us-ascii?Q?GQrtYRkaQMTPCqew+kSxfyv7/M6yNafVAYfJB7SYBzt/qFAmQX5ryQchvXjF?= =?us-ascii?Q?VEAEKWz2a3w7SnLEd5n6/pzlbNSGKjkinLcMkyFbSvXK1GSIb8yTTlu2pglO?= =?us-ascii?Q?S2tt+2qEyclG2gIkEiRmh4QLryc3+1irIMj/P2Xil9ej/0Rag30ImBOKcyRM?= =?us-ascii?Q?lZsG65Zk4TyBIq7Km34cbdg7LdDDnLQh8mt2tCgzO4XVXoT6hRsNlQ3XX2Ld?= =?us-ascii?Q?RU2JEW3T5U3xZ5WecGRI3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?=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3877; 6:68X8fqI+xZmn6uikWavbOZ/LMw1pv9m20DQR9ZdbaY/72tHSqU2UqVXAl7BvzEE1bTjeeI53fSg1+LEr2dByHFbGffqDInMlTU0eYy5XwiB0jCtJ53aQiaEWsisECukIGYlNFsHC1hiWiGLhb/azMQ9BiwftIsEU6Q0xb/mzvrDecffOSzH5YrCSmO6EgXo8BWP/WvuK0yj1Z7SrTOQtkJJJwXUS5+qMMqaAgh0pSR35tquLiZqYjyZGqhH8GJIv0LgT9fjMJ9u0Riq3CUFo+eENSlwKIBAFmx6yKgHZ5nr7uO0jXvjXtNeRoBD3XJrMaaM4vl77lgFSABdTOWjsgAU9IgMg8xfWLmuTe2kfo3U=; 5:UyLQ2qXOgeyzf5Nf/OAsZsQIOChFmbk7cLnFAO/iXxclHDHAnqoCkA2LdfHX75BNdcDTha442JLHcI9FhUlxKGdx38bxlmWgnMeWl09z7CKx3K7PVPSARt7Gq4cwmuSSRFLNzTKi3DxVKRfVDM17bwEywGTlvK11eld1fnV6gqQ=; 24:Galo0wvZY9hNXmnwJ1SeDBnQ8EsiMgOlClmTA+2t4+i/WdfV6k463uO2REj6mMkUi8G07Bl0TpdxchFi4jRfEiRoA9XMHsjnwmuZA2gbzcU=; 7:wQV1r3b+ZIRFb6YZgffR45g3Jp6LmcDGi6uIIwmZjKuM8PftzO+mkQNQ6Ove9xR/UQT3EAjhB6jEqRkL9mF4NjAfgHWG6CKNWju4c5A7OuHzqPcqdxGHcZzwep89ZgArCnQbH00YmsWxsf/BKvMWTBourlt9YYCOokr7Kn/YwPxjME91Mun0T6mgRyCiTGrYADNS3hEnaT9E5Cjd2UCiLABndW6XYcwPi8vivlwH2w1K5Paxw+qnhzndHOPkSfBW SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2018 18:35:55.6589 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 90c10adb-d02a-406e-a494-08d573109f02 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3877 Subject: [dpdk-stable] [PATCH v2] net/tap: fix promiscuous rules double insersions X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 18:35:59 -0000 Running testpmd command "port stop all" followed by command "port start all" may result in a TAP error: PMD: Kernel refused TC filter rule creation (17): File exists Root cause analysis: during the execution of "port start all" command testpmd calls rte_eth_promiscuous_enable() while during the execution of "port stop all" command testpmd does not call rte_eth_promiscuous_enable(). As a result the TAP PMD is trying to add tc (traffic control command) promiscuous rules to the remote netvsc device consecutively. From the kernel point of view it is seen as an attempt to add the same rule more than once. In recent kernels (e.g. version 4.13) this attempt is rejected with a "File exists" error. In less recent kernels (e.g. version 4.4) the same rule may have been accepted twice successfully, which is undesirable. In the corrupted code every tc promiscuous rule included a different handle number parameter. If instead an identical handle number parameter is used for all tc promiscuous rules - all kernels will reject the second rule with a "File exists" error, which is easy to identify and to silently ignore. Fixes: 2bc06869cd94 ("net/tap: add remote netdevice traffic capture") Cc: stable@dpdk.org Signed-off-by: Ophir Munk --- v2: add detailed commit message drivers/net/tap/tap_flow.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c index 65657f0..d1f4a52 100644 --- a/drivers/net/tap/tap_flow.c +++ b/drivers/net/tap/tap_flow.c @@ -123,6 +123,7 @@ enum key_status_e { }; #define ISOLATE_HANDLE 1 +#define REMOTE_PROMISCUOUS_HANDLE 2 struct rte_flow { LIST_ENTRY(rte_flow) next; /* Pointer to the next rte_flow structure */ @@ -1692,9 +1693,15 @@ int tap_flow_implicit_create(struct pmd_internals *pmd, * The ISOLATE rule is always present and must have a static handle, as * the action is changed whether the feature is enabled (DROP) or * disabled (PASSTHRU). + * There is just one REMOTE_PROMISCUOUS rule in all cases. It should + * have a static handle such that adding it twice will fail with EEXIST + * with any kernel version. Remark: old kernels may falsely accept the + * same REMOTE_PREMISCUOUS rules if they had different handles. */ if (idx == TAP_ISOLATE) remote_flow->msg.t.tcm_handle = ISOLATE_HANDLE; + else if (idx == TAP_REMOTE_PROMISC) + remote_flow->msg.t.tcm_handle = REMOTE_PROMISCUOUS_HANDLE; else tap_flow_set_handle(remote_flow); if (priv_flow_process(pmd, attr, items, actions, NULL, @@ -1709,12 +1716,16 @@ int tap_flow_implicit_create(struct pmd_internals *pmd, } err = tap_nl_recv_ack(pmd->nlsk_fd); if (err < 0) { + /* Silently ignore re-entering remote promiscuous rule */ + if (errno == EEXIST && idx == TAP_REMOTE_PROMISC) + goto success; RTE_LOG(ERR, PMD, "Kernel refused TC filter rule creation (%d): %s\n", errno, strerror(errno)); goto fail; } LIST_INSERT_HEAD(&pmd->implicit_flows, remote_flow, next); +success: return 0; fail: if (remote_flow) -- 2.7.4