From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id 78AA12BF4 for ; Wed, 23 May 2018 14:10:21 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id w194-v6so8285322wmf.2 for ; Wed, 23 May 2018 05:10:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vfew0aOB24VUci/GTTjKyFJ0+G8BXe7w9fo3wHJiSoQ=; b=dUkfvNLI13FT+Pi6/C6JhipGRDnMCC43uGGxSkXS+0eM9vrka7bsnbfYrdvrY5fq6q R0qRXmR9/TChIXTmKdXHbAyZrmpyNmiiuhaqTA3+Eww5GuZ4x0b3qXjqPFZs2OyY15tE MeKo/FYG4lg3R+NJgBnCqmce9DQJjC/HL9RHLHjLAEk9BxEeOmwsLk9TF85RbD0Iy/0R 8yuQ6ZtTMe2WSHe4r3JevCjUBGJ86FMtJ11q7VAOVci65ub+4BcHBuRlUipc/lIZKCPx OkObYHoMfbOiaCdLbHMrfts/5wAhEmu/07h249KG+HclLyRb8R41m7JtFPJLBbLQakzH Sc8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vfew0aOB24VUci/GTTjKyFJ0+G8BXe7w9fo3wHJiSoQ=; b=XuV6qGtbLj737Dnz36pMklZMBMuyxP19D8QiViPKejWGLNVJYgj5mFuMUAsqOjiwQ0 PL9XNsGQcqz4VgGz4GGl0AcKj+q1Of/24/J5qh7ZSG8A0UwRdYSbol0uCcNmgkwiDM+2 9FbMl3r91/LD8dtXSHeyggmvAqn5Anx+xUBu+2xaUZlIXKJSmNBVYHnFfBwXUn+bckOe ZwPNKchYq/gf5s0pXDlhYMt23DBDXhXeRUTi3Ck2br/3UsYqzi9Mp1RE3Wd9AG94EUom igmukeyJ2FL2qNzgYJVvSayhwN//ghyhGHpTuAk5CudW0ZATPQtLUROn7+jICBMvHdu3 QxTQ== X-Gm-Message-State: ALKqPweZ63I03jbD8bknFdbmDXnBzwXAHzN+9kbpjtHaWYYp1MySGQ2b X7hYXdqnzyZ8bgwo4oMikf02kzoz X-Google-Smtp-Source: AB8JxZqE38/Mb2yb6u10bEFyXRdblenk0HoJB18UMuZ71rWK/sRLeg80WCZ+gF4Wh32ar2DFX/iK7w== X-Received: by 2002:a1c:7f0a:: with SMTP id a10-v6mr4639722wmd.97.1527077421110; Wed, 23 May 2018 05:10:21 -0700 (PDT) Received: from localhost ([2a00:23c5:be9a:5200:ce4c:82c0:d567:ecbb]) by smtp.gmail.com with ESMTPSA id q7-v6sm10631663wrf.0.2018.05.23.05.10.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 May 2018 05:10:20 -0700 (PDT) From: luca.boccassi@gmail.com To: Ophir Munk Cc: Raslan Darawsheh , Keith Wiles , dpdk stable Date: Wed, 23 May 2018 13:09:14 +0100 Message-Id: <20180523121010.8385-3-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180523121010.8385-1-luca.boccassi@gmail.com> References: <20180516101323.2234-2-luca.boccassi@gmail.com> <20180523121010.8385-1-luca.boccassi@gmail.com> Subject: [dpdk-stable] patch 'net/tap: fix isolation mode toggling' has been queued to stable release 18.02.2 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: Wed, 23 May 2018 12:10:21 -0000 Hi, FYI, your patch has been queued to stable release 18.02.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/25/18. So please shout if anyone has objections. Thanks. Luca Boccassi --- >>From f7b5d10171989dec8a4322594e1d3d8e8790d518 Mon Sep 17 00:00:00 2001 From: Ophir Munk Date: Mon, 14 May 2018 22:26:27 +0000 Subject: [PATCH] net/tap: fix isolation mode toggling [ upstream commit 2ef1c0da894a9534d41475b8240cff1d04e79fdf ] 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") Reviewed-by: Raslan Darawsheh Signed-off-by: Ophir Munk Acked-by: Keith Wiles --- 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 551b2d83d..84ecf0936 100644 --- a/drivers/net/tap/tap_flow.c +++ b/drivers/net/tap/tap_flow.c @@ -1545,10 +1545,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). @@ -1556,20 +1560,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 */ @@ -1716,8 +1720,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; RTE_LOG(ERR, PMD, "Kernel refused TC filter rule creation (%d): %s\n", -- 2.14.2