From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40042.outbound.protection.outlook.com [40.107.4.42]) by dpdk.org (Postfix) with ESMTP id 568B81B31B for ; Tue, 13 Feb 2018 18:16:23 +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=3LGdQd/qds9/Vb59MsnTgHOozU9eO9vuv6UZZTzBtms=; b=cabljTxT5dDCguMGZaVaqRJJZtJ+y5B2F+4jTtui6gJN1o7Pg8pk7FHzFhlhSPp2yLboh7T00MFqw3sYTS+8QRrkpZkujEK9eJosv2iHSlsqX6ORJSAtIojsT9/Tpp5umKzGroUzna+Th9hjs63i3yVXlaGN9SYGOteh0/rsB1Y= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; Received: from mellanox.com (37.142.13.130) by VI1PR0502MB3885.eurprd05.prod.outlook.com (2603:10a6:803:c::10) 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 17:16:20 +0000 From: Ophir Munk To: dev@dpdk.org, Pascal Mazon Cc: Thomas Monjalon , Olga Shern , Ophir Munk Date: Tue, 13 Feb 2018 17:16:12 +0000 Message-Id: <1518542172-9334-1-git-send-email-ophirmu@mellanox.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0501CA0043.eurprd05.prod.outlook.com (2603:10a6:800:60::29) To VI1PR0502MB3885.eurprd05.prod.outlook.com (2603:10a6:803:c::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: abb07345-577e-45b2-2f72-08d5730580a1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:VI1PR0502MB3885; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB3885; 3:4yz65uVGUEFWiGYyHNnP47RGrHN5mrSHYwtqAv9GXFTV/go46gDSsA72LqQHFCfSvCjv5jzGdIBnNJIdPyus944XtOStMBzRPInelwYE5GZoNAyAFrx3UrXzBJ0Nl7yroMUFy3DYS5DUc+k7N+5mr4vCyOUYaT37VQncYyIhyy0WejkHA11KezFqcKyd62VpNHSvXI8mzfkoV9yqpAqyyOiqAapXhfm+UWudp21LUy0sccSIyxHWVgFczqZwemJy; 25:5t4ILzfNtZQo42sy3HNLs5tlKBuV0QKko8wUKNQwx97y76sOWvf3Fq0aCNg261IMmMzGKENxS0PuNWlzzv7KQCgPAr9BT4qBKJ42/yds/fdTtpmcnzJUx0Wk4CojogBa76W9jXKHVU+fZwaindb7tdfVJKhRDx/kCi7svQlqyanYsiDCnXpcUJAzGtPmqy+sKt+TbifrnLLPEiDdzcfO3X7tpzxGYpSERqWm78RnxKH4Ww4VsoI7svFUEhZJ5/AJi9TRuHp0XltMWXTdf4gHiJW6i7PkjJnMHgvF51bgfOQp2ngrwbPul02D2je+qVNWSZolcFrffNbWxh3NEkgExA==; 31:X24mAUZ43WEbQbHW4EbICCOIVdwLuNvyEvR/PYCBO4MVKMN+3bpUOHSJYjfFei3vA6xWVImQ6Go2bxwpWlnwroLNCScI8l9gvWXGnRycydcv8z4XioqdJcSvIroyRHK25j1dVLvlVmR0lMo3o1/gYu/u2JQxfAgmHQS2kJwO1msoxdx5GhBo1leh8wL6okkPkFLu4T7V85O8mLREwAtJofz0r1DHnoxYb2H5HxpQbKs= X-MS-TrafficTypeDiagnostic: VI1PR0502MB3885: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB3885; 20:wh7kF0PFGE+NcFljIk7DGkaIit9rBf2BZzrk+4M5PHOxSxMkOUkzEa8StQMr8PjfpOq9/dgKBD7cw3dxG4Hv9t0c2+eVVFh2eR8YxObAMKUq6eqdoyXkN92GDT8sZw+VxnZqn+USM85UL8OxlFVjHnyfNupUktj/+SZ32SwKONiiJI5GKBnYQJa7kJi2QVVNqD7BgVch+sgzvZpQjQDbq9zWft2NLELeyyLT0wXtUxQ1ONfecB5IULjsxCsvBbDSJlvHqUv68kmaMwcSnsxt5bZqKfTwoRLQWIgWl//kUig8SraZ+espM+eae5s4Fbi29HzyFJ2oJ3fLiCiPn9UJf6aZFKU14xk0kNwaLTTO0j8tP1lU1xOE1/7PaMdqIn3PlR20WdGX+wrXAKmhCMR6ur9lCmZRqeq3nRFevqovSVI5PHsXEZimLIydDHEKZU4wM6y8b28dtUvZlAaPkIHNo/8VDu6U8J3DhWRf4RZ19O7uPLclna7eLNowKAQrV1mb; 4:3Q78TwW3jTeWzi/gxKp9bVXtPm6bUg80yaWCycRTL3HJlAYzSgFMLHdiep2ePSvDDrja+bdlAkI15mC5eMZRWi+MczWradaInGVlv3mX2yHGJ/ui65bHWPy2nVmH9VmZQnTA8OA2eF4ag4xPidROvaP3KJgGI2n+uxDzIDNjFyWsrgBIB+EmlapGYiRwZpp35+SbvwdWGANH2GMLkVLPP8jGnS/5DU1FsJyDfWY7xrndwpCZWGRbfhKMR0qZo2fHdRwKKhjg1LmNI6pAlxYdPw== 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)(10201501046)(3231101)(2400082)(944501161)(6055026)(6041288)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:VI1PR0502MB3885; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0502MB3885; X-Forefront-PRVS: 0582641F53 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(346002)(366004)(376002)(39380400002)(199004)(189003)(16586007)(316002)(59450400001)(16526019)(186003)(107886003)(21086003)(386003)(36756003)(106356001)(4326008)(54906003)(7736002)(86362001)(25786009)(69596002)(33026002)(26005)(50466002)(48376002)(305945005)(68736007)(55016002)(97736004)(478600001)(4720700003)(50226002)(6916009)(6666003)(6116002)(8936002)(105586002)(3846002)(51416003)(52116002)(81156014)(81166006)(53936002)(66066001)(5660300001)(7696005)(2906002)(47776003)(8676002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0502MB3885; 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; VI1PR0502MB3885; 23:nst0Mv3ArabVtLYGm+HC6WZZO2+TfT7HfvvwYvT?= =?us-ascii?Q?5tmhXmLzxcWu/BLXhyENDzkTgSPYsxxESw2+z/HnMdTbCQLEsXgUmTS/M1uH?= =?us-ascii?Q?UaDt0wDjy99IdHDvjt2qohamso/e1Xv4nu9H7uO9asFcpPS+fP12sqR+s5l/?= =?us-ascii?Q?Ap9+QcHhwCxkEpE9jyrCw469tV8SEY2f3igouEf5eCD8gOfFxJNHIBTCTkzu?= =?us-ascii?Q?VJbrY1vAUeZ8onumqY7LCrC4/xjazBiPEXK+MTjNAfindT6aImQk/icLP3l1?= =?us-ascii?Q?6sByjTOSR0smUcpT3J9QfW1VrMAyRend4KyaMZC7xTIV8EMwXpeY8+6HI9bU?= =?us-ascii?Q?Mv4ZqQdWsVpJkY3UUzVKVEmuHtz0Np4MTtA2ZsCGDDiiHMa16Q08FK5HBy3T?= =?us-ascii?Q?YMPCkg9YPrcc+2i6iwKnWf2bVKaML4LnR7Z3IlpF6fTd1Nt4PonAOK+DfLU8?= =?us-ascii?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GmuSTJ+YXLfYGLlBG7eZ10BVjRT4t+AzXCb0MP++yRjY4eeY/+DOkwZXDmAxgLz6FFqQ5Lf2DAm+oWvB/tIQJuggQtIemF0tvYfxP3RevdVQcaqINZymRYzSUkuwob525CXNy2euqS11LmOBXYE21IHDEbZ0fVfv1asPa3LuSBLpqnVRCyiFOv2X99jqBJqhNVsnLGXQOi2FnY/Rj3HZ0y09V7zZkSBUljieFIqrZrJXwaQnwRsybg==; 5:z9CrYxHB5nb5sbZCTPIi3CMOID+Dc0utYLbU4GicJ7bU6ruU0YXZX5EJTvFc0wjvcr65BTTGT7pRbCDBn/UsdF8hRMVj4h4KWGzUZP7TGRCbyRRt50vQE3VGFHbI2UaJeIo2XHQolOHUNyGLQtPo2VauddZE3Z3iajtC9Vhk4ZA=; 24:kpzbpQmAi1BjcBpfs+5VkS13UNI1cNjcYOydxSP/DRlWnAYnFLhbch2YWcvI7mFj/FhDmR4KlVafdJPZcopBUmp3R7c8OBYjy7wHBZJ+HCo=; 7:vBgz3R3eArarFRuxK+cF93zPWk4c6NcDHx6D9DBdKlUXJEgbGzuaNsXH0KFXrEYHVdDxa5irumtkME0WctDu4KLmCboossBYOtp7tvy0nrPjoIQ9KZdX507fky6XZfkA24KJNv6pDlH+8xLqgf4kRnY44SrAHVetRTrYRj2Nr/G6IsADJMftZGz1D1l6LGgjmqbnNgzfWEYiP4cwRA29XS6MilRgIU1JPt8R3g98Tk42TE8EOWiJNp+H76jCjVP4 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2018 17:16:20.5370 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: abb07345-577e-45b2-2f72-08d5730580a1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0502MB3885 Subject: [dpdk-dev] [PATCH v1] net/tap: fix promiscuous rules double insersions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 17:16:23 -0000 Signed-off-by: Ophir Munk --- Full Commit message will follow immediately in v2 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