From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0045.outbound.protection.outlook.com [104.47.0.45]) by dpdk.org (Postfix) with ESMTP id 0AE201CABF; Tue, 15 May 2018 00:26:46 +0200 (CEST) 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=H4WmtWKWiDdf4Jk8Pelz5sgo1SyRhuDPkuaMGa31mvo=; b=XSR7fyOFNsJujGf5qU2ifIi84IMIy146JaR9JHVnDsRCqPhjlzeE2roqTRL9b5oltKk+2RUDWMIUq/OMzfn2ChGfx1mYyuC/ZDu1myLn27ctNsUHej4I7uyWCXj/NChwVqy5st4aWRkLpTpuwMHeV2HzOARPZARrpA/2HwHeHos= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR0501MB2314.eurprd05.prod.outlook.com (2603:10a6:3:27::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Mon, 14 May 2018 22:26:41 +0000 From: Ophir Munk To: dev@dpdk.org, Pascal Mazon , Keith Wiles Cc: Thomas Monjalon , Olga Shern , Ophir Munk , Shahaf Shuler , stable@dpdk.org Date: Mon, 14 May 2018 22:26:27 +0000 Message-Id: <1526336787-28457-1-git-send-email-ophirmu@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1526335915-27693-1-git-send-email-ophirmu@mellanox.com> References: <1526335915-27693-1-git-send-email-ophirmu@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR07CA0191.eurprd07.prod.outlook.com (2603:10a6:802:3f::15) To HE1PR0501MB2314.eurprd05.prod.outlook.com (2603:10a6:3:27::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603328)(7153060)(7193020); SRVR:HE1PR0501MB2314; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2314; 3:uF1u+ccgOdElaFvpUl8XEJ+hjnj5bd+UJi7rGzqPHf90/JwP7Z/mSGGfg5Dn3QxpytZkoFNuYkUcYHYFkgu3wFJ3RsNkefr2QweuvJnCokLIaevdDERe/S+6RXAypFOfynlFq8qZlAmcINbmKI7bFRXAjx+6F65gcm0+T2e42VunHmW4NXdV4/+pLW+TU7xKL9PD/2VyJA4NKT1rcXdxzmTIyhzFPVNC7IG7dXV6fVOfE9Vz234U+mC6RRxs79kK; 25:nHUfUJe1aqtTIWHChSF/9kGRjppf3gBEU5aMr0z9qjlLiRJZqrgWp+bZKU1a7/MHbUQU2/Qoqy4OgFDVtt89pn07tVj1Fb8ZpGe5zKRmvdZkqOazL9H9Nxz+p0rmqWcSA4XK8voDoXRamxWwAg13lC53B81b1mbVZny6Js88tM13DoZxo28PEbsZI1xmN4qNGIux9cGGd+nosEJ1GXJQWIbydMq5sSCqB3S+C6RDYtGu4TJAFb84tOzUQAOUhUST6O+LufEf0RZfuy0UYesPfO9+2fSlm+XthXPU2bxc2KUjjxyNv4pVom1IpoZOuhq8Wjapr6kfu6Vdl8mO4xoWYg==; 31:P1RtElxIXCmFiJjeVIH4SiXxpGdk1fH+cjVXRs7TWhFihQ/1iZGQCd6CnF39Vp19XSyhyytzlWeE2n7Zl+Pp5YVPIMdCGp86ljYWqirgQJqD6t6ssuzqZ9RbpysTNKtmDdb5XLBmy0i+W0+7+lnJAdXFaITOih8EcaPwFThwfQ4x6IuM3Hs7aFB4H53Ipr7Px5ECwvzs+mnHzsd0a180bF18dXZIglpPo9VLSOjenrQ= X-MS-TrafficTypeDiagnostic: HE1PR0501MB2314: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2314; 20:oIjIuxdnNOJOCHHKko993tbf99jkIBn8JiWcrvqaLXbiR1OiXLILVmZZpF9FjSHzzxMc7mOCSjQ9fzBLp0+7SykwM5o7GLDacj9VXTwsr1EOLUCYIugHIY1M5lud5fs9xvy/umVjy465Jl7Cj3qA8WJ9fW4x/TY2u1oS1uiw7VZjicNy80IgngqzexzCjfcqG/ZFf9lkiA3rs1Ka0SdDHjMICslGJ6Etu1pCte5y+t+Fc4t3e7hppStXEq2XlnNCBF21Fm+3FVPI2OJUTRMWOWEHEi0iIma3zrT4RGk6e9JnhpFWZjGHX4+J/C5LzarXLQxBR6SIl/Yfh+GqD7xd8+sN9T9FvN0/F3eM2ipA5RjRWGSQ2gtEXKSZYGLronOMk29po0GP+NTLy5jvHb4ey2GP6HTDLuwT/6UEkjufe1g7zLJe2Ldy0RoLU35lClQOA1RtOaMmdVBzfPpx+MZn+tlGLW9Bycox7HOA9vjTntNcWGdeHST1ZcLJT8jYF1F8; 4:ewJME2YBR4zeeNDQnVt4XpOcuBBkVqU1C18G584WONoLO4FT49CovQcO9vMW0U/aUyqbTtQsXs8rxGKvoLCypHS6rSwL4IW/dDOtM5R+NsI0gDr/9GxdMtOQaJJxBMm6N9iyvXPugFY5sqrUZ4QcPfszwWYUzv5/Df5zBue5Dqf4XzoJk0gwm+DTjiVbRaJPdyLUXQ8pR7F2eU00z6FozJYidOcmJIRPdjRoxZoQMUXZqXYJHnizT4+pruRLOvceMnfOc8L1ZsK4qptD+3StCA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:HE1PR0501MB2314; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0501MB2314; X-Forefront-PRVS: 067270ECAF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(396003)(376002)(39860400002)(366004)(39380400002)(189003)(199004)(86362001)(68736007)(105586002)(16586007)(106356001)(2906002)(6666003)(81156014)(69596002)(16526019)(50226002)(21086003)(81166006)(8936002)(55016002)(186003)(53936002)(4326008)(4720700003)(110136005)(54906003)(6116002)(3846002)(316002)(8676002)(7736002)(48376002)(305945005)(47776003)(50466002)(478600001)(386003)(36756003)(76176011)(446003)(26005)(486006)(33026002)(66066001)(5660300001)(7696005)(52116002)(97736004)(25786009)(2616005)(956004)(11346002)(476003)(51416003); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0501MB2314; H:mellanox.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:3; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0501MB2314; 23:N+ORWBMkz+11top0zE7qoBSuiNuKhUMGPk0qmm1?= =?us-ascii?Q?cIPrk+FVkj4+FZU+YfATiFhf0bfWuHQXsBOGvfdq27KCx0HZyicmS5rb5Hx0?= =?us-ascii?Q?lCk+RypOAEkYb3GDANZXTHgwXeinPzBD7cI9kMfgpp+qsE9c/DwguXiIR8GW?= =?us-ascii?Q?5ZNm88W29MoDLXUON2Z0jm0iT4+EroTAk/a8AdYbOHPIuUIC8gLKrV75zyvW?= =?us-ascii?Q?ooRHhfJTRN8zSei8m424p6sG/Lhv8wPxSaXUHlEpVCN3f1GCNBgjlGxvPOVq?= =?us-ascii?Q?UlJ9XgTgWBjTxY9uSOV/YPX/T3+R+eKE7uWYhReWqRiDb8vUx6mAUuTdVR9K?= =?us-ascii?Q?ELFALEhT/MOWD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Q= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2314; 7:fdv57FhnfsoytdOyOTjRE8OGcRfj6ws6QsWp8xMmF0IUNKOZqrmIuASWsoXf4N0M9fhtf0dGNg+SVYg/c4Zeq83ir2Pm9PEi5cfyqs4lIN/WT4k1H8jT95lia9zQjh/Aa5J8B+yZN+Bh+/ob1oGxAORmoXIa1CqhlrNbiJ4APeX6XMRy+Bs9yD3FF68uNt3VqDZbmYzdEKrAxx0jjkakxgZ6wqmt0oNWb2lnQpKPLNxf5NWFoOidFVlqiFP38nKF X-MS-Office365-Filtering-Correlation-Id: 5e89fca8-c0c7-43e1-6a1b-08d5b9e9c51c X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2018 22:26:41.2191 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5e89fca8-c0c7-43e1-6a1b-08d5b9e9c51c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0501MB2314 Subject: [dpdk-dev] [PATCH v3] net/tap: fix isolation mode toggling 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: Mon, 14 May 2018 22:26:46 -0000 Running testpmd command "flow isolae 0" (i.e. disabling flow isolation) followed by command "flow isolate 1" (i.e. enabling flow isolation) may result in a TAP error: PMD: Kernel refused TC filter rule creation (17): File exists Root cause analysis: when disabling flow isolation we keep the local rule to redirect packets on TX (TAP_REMOTE_TX index) while we add it again when enabling flow isolation. As a result this rule is added two times in a row which results in "File exists" error. The fix is to identify the "File exists" error and silently ignore it. Another issue occurs when enabling isolation mode several times in a row in which case the same tc rules are added consecutively and rte_flow structs are added to a linked list before removing the previous rte_flow structs. The fix is to act upon isolation mode command only when there is a change from "0" to "1" (or vice versa). Fixes: f503d2694825 ("net/tap: support flow API isolated mode") Cc: stable@dpdk.org Reviewed-by: Raslan Darawsheh Signed-off-by: Ophir Munk --- v1: initial release v2: Please ignore (due to typo errors) v3: 1. Updates based on Keith Wiles review 2. Do not empty list of implicit TC rules (role back to legacy implementation) to ensure TC implicit rules cleanup during implicit rules flushing drivers/net/tap/tap_flow.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c index aab9eef..6b60e6d 100644 --- a/drivers/net/tap/tap_flow.c +++ b/drivers/net/tap/tap_flow.c @@ -1568,10 +1568,14 @@ tap_flow_isolate(struct rte_eth_dev *dev, { struct pmd_internals *pmd = dev->data->dev_private; + /* normalize 'set' variable to contain 0 or 1 values */ if (set) - pmd->flow_isolate = 1; - else - pmd->flow_isolate = 0; + set = 1; + /* if already in the right isolation mode - nothing to do */ + if ((set ^ pmd->flow_isolate) == 0) + return 0; + /* mark the isolation mode for tap_flow_implicit_create() */ + pmd->flow_isolate = set; /* * If netdevice is there, setup appropriate flow rules immediately. * Otherwise it will be set when bringing up the netdevice (tun_alloc). @@ -1579,20 +1583,20 @@ tap_flow_isolate(struct rte_eth_dev *dev, if (!pmd->rxq[0].fd) return 0; if (set) { - struct rte_flow *flow; + struct rte_flow *remote_flow; while (1) { - flow = LIST_FIRST(&pmd->implicit_flows); - if (!flow) + remote_flow = LIST_FIRST(&pmd->implicit_flows); + if (!remote_flow) break; /* * Remove all implicit rules on the remote. * Keep the local rule to redirect packets on TX. * Keep also the last implicit local rule: ISOLATE. */ - if (flow->msg.t.tcm_ifindex == pmd->if_index) + if (remote_flow->msg.t.tcm_ifindex == pmd->if_index) break; - if (tap_flow_destroy_pmd(pmd, flow, NULL) < 0) + if (tap_flow_destroy_pmd(pmd, remote_flow, NULL) < 0) goto error; } /* Switch the TC rule according to pmd->flow_isolate */ @@ -1739,8 +1743,8 @@ 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) + /* Silently ignore re-entering existing rule */ + if (errno == EEXIST) goto success; TAP_LOG(ERR, "Kernel refused TC filter rule creation (%d): %s", -- 2.7.4