From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0048.outbound.protection.outlook.com [104.47.2.48]) by dpdk.org (Postfix) with ESMTP id 5636749E0; Tue, 15 May 2018 00:19:51 +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=sYdOYksvwF6BVmTan5vVglLK2bORN5dnPTJygtliUoY=; b=LY3vubw0+8lGI9KsOUXHJAJd4BdK+DDV4wzVp4qQ75cy5yNmzrv0QLL0f4A1xCFV4RXypU25TWZrgi+mynFf00OwA344WPIoOOn/lUvLn/GYUzIytzuiGowcA1CqwVS1ezspjBugl9NVVuB1GztbyA+gzxnjSrXPFa8cE01QzuI= Received: from HE1PR0501MB2314.eurprd05.prod.outlook.com (10.168.34.19) by HE1PR0501MB1948.eurprd05.prod.outlook.com (10.166.87.24) 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:19:48 +0000 Received: from HE1PR0501MB2314.eurprd05.prod.outlook.com ([fe80::1071:70d0:eac1:5d97]) by HE1PR0501MB2314.eurprd05.prod.outlook.com ([fe80::1071:70d0:eac1:5d97%18]) with mapi id 15.20.0755.018; Mon, 14 May 2018 22:19:48 +0000 From: Ophir Munk To: "Wiles, Keith" CC: DPDK , Pascal Mazon , "Thomas Monjalon" , Olga Shern , "Shahaf Shuler" , "stable@dpdk.org" Thread-Topic: [PATCH v2] net/tap: fix isolation mode toggling Thread-Index: AQHT69CajQ42KkBKGUWfrcJdyBsTHaQvyzqAgAAAJ/A= Date: Mon, 14 May 2018 22:19:48 +0000 Message-ID: References: <1525682200-21821-1-git-send-email-ophirmu@mellanox.com> <1526335915-27693-1-git-send-email-ophirmu@mellanox.com> <46ECD048-C95D-4F8B-B73F-7FD299B48394@intel.com> In-Reply-To: <46ECD048-C95D-4F8B-B73F-7FD299B48394@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; x-originating-ip: [85.250.111.138] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR0501MB1948; 7:LuMx4I2LUWQzO4FvyqpwoIUW7MUJtl/nYX4GYlv+sg2T7CaMq4WF2dYf/Wh3gIhfh9uzQip3c1Q1aiD2LAQ4NWO9C/vsdxDIt6bQSXWN9Mww3f3WipOfEvQka9dRYOf3tFVQSYpU+irXuNTJGDyfFBMBgyxEOJ4Pg7lCWXQkyykFNatl38s6SSvT3Q5cG6HhcFGdqQvXFgskI+8df8oDn5Smr7+7ENHGKkx/6MGas6tGLjs1UIe79Pc/aP7rtEkO x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:HE1PR0501MB1948; x-ms-traffictypediagnostic: HE1PR0501MB1948: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231254)(944501410)(52105095)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:HE1PR0501MB1948; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0501MB1948; x-forefront-prvs: 067270ECAF x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(366004)(346002)(39860400002)(39380400002)(376002)(199004)(189003)(13464003)(8936002)(14454004)(81166006)(8676002)(81156014)(25786009)(5660300001)(99286004)(86362001)(66066001)(2900100001)(105586002)(106356001)(305945005)(6916009)(74316002)(53936002)(5250100002)(97736004)(229853002)(7736002)(26005)(54906003)(3846002)(55016002)(33656002)(316002)(4326008)(6506007)(11346002)(446003)(53546011)(2906002)(6246003)(6116002)(486006)(68736007)(476003)(7696005)(3660700001)(186003)(6436002)(102836004)(478600001)(9686003)(76176011)(3280700002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0501MB1948; H:HE1PR0501MB2314.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: n8AFBH5WoceTKSEK0nNOSESenoY92eccSacocLwipRXfW8EqB/3Z0v/6d3ZXLTfRUoZlUBKj2QqiX31bcUf5Wa9vujGZwkMtAv9jt1uN3vmHL3gNTgMNPNjuzve9c0wR6OABwaU5H6Kk7v8DZRzjMZMh4kWQPl63m8D2NrnABIzlmcNRINrbueIwViSHElyQ spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: eaf703d8-ae22-48a1-20c7-08d5b9e8ce0b X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: eaf703d8-ae22-48a1-20c7-08d5b9e8ce0b X-MS-Exchange-CrossTenant-originalarrivaltime: 14 May 2018 22:19:48.1930 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0501MB1948 Subject: Re: [dpdk-dev] [PATCH v2] 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:19:51 -0000 v2 has a typo (/raw/row/) Re-sending as v3. > -----Original Message----- > From: Wiles, Keith [mailto:keith.wiles@intel.com] > Sent: Tuesday, May 15, 2018 1:18 AM > To: Ophir Munk > Cc: DPDK ; Pascal Mazon ; > Thomas Monjalon ; Olga Shern > ; Shahaf Shuler ; > stable@dpdk.org > Subject: Re: [PATCH v2] net/tap: fix isolation mode toggling >=20 >=20 >=20 > > On May 14, 2018, at 5:11 PM, Ophir Munk > wrote: > > > > 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 > > raw 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: > > 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 =3D dev->data->dev_private; > > > > + /* normalize 'set' variable to contain 0 or 1 values */ > > if (set) > > - pmd->flow_isolate =3D 1; > > - else > > - pmd->flow_isolate =3D 0; > > + set =3D 1; > > + /* if already in the right isolation mode - nothing to do */ > > + if ((set ^ pmd->flow_isolate) =3D=3D 0) > > + return 0; > > + /* mark the isolation mode for tap_flow_implicit_create() */ > > + pmd->flow_isolate =3D 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 =3D LIST_FIRST(&pmd->implicit_flows); > > - if (!flow) > > + remote_flow =3D 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 =3D=3D pmd->if_index) > > + if (remote_flow->msg.t.tcm_ifindex =3D=3D 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 =3D tap_nl_recv_ack(pmd->nlsk_fd); > > if (err < 0) { > > - /* Silently ignore re-entering remote promiscuous rule */ > > - if (errno =3D=3D EEXIST && idx =3D=3D TAP_REMOTE_PROMISC) > > + /* Silently ignore re-entering existing rule */ > > + if (errno =3D=3D EEXIST) > > goto success; > > TAP_LOG(ERR, > > "Kernel refused TC filter rule creation (%d): %s", > > -- > > 2.7.4 > > >=20 > Looks good. >=20 > Acked By: Keith Wiles >=20 > Regards, > Keith