From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by dpdk.org (Postfix) with ESMTP id A88C21B19C for ; Thu, 5 Oct 2017 14:50:30 +0200 (CEST) Received: by mail-wm0-f49.google.com with SMTP id k4so1998134wmc.1 for ; Thu, 05 Oct 2017 05:50:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=VEjo7NssYIsVh5T5OARNRhoKCBJ2mSmljUXzFR4ZSic=; b=Ra9SnJJVBVLbUSc4FSJOsLBywlYXBYDN89eb3IRGetb/WRfu/CToQQ8Blj/kF3Hupn TCn4KLfnPl5+oTUwwrxV3mSHeE8h0qhUbpsL6/vl5evxyACSIdYYDMIAVneu6/5T/mdP zw7Q7WsKlX1jlW57Cld1iPNkE1VbCux2MvlLZ2LPM2qXKjl1TMFGDeBCtqRW8Ym+EECc C2HpInTZiOgeO+wlSDXbOhqioiurXvy1J37gXRtcqsXZM6f/02b6u85vp35DqbcSwmXs eQn4Ndd1WroRv+dL2Vdzmr8ugzly7r/GcUANYX5DjzMjvyTIHpl86GE5yhxTVbx8q6ya QvyA== 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:in-reply-to:references; bh=VEjo7NssYIsVh5T5OARNRhoKCBJ2mSmljUXzFR4ZSic=; b=NfeFTbE/17MIzf51JKp+fTSbzfZJ9HhsHgixHk00rjN37mYwDeCDxZi8GHoQ1j9OH6 DT7Chq+UgDvBX/G18ohEP1+agMdfMqkNs+cGVQkQvCurWki/Svzlm4ttaxZHi2jyLlSI /Mt/W5z4y/B0JfuVae9TR4MFvbKClKvLIee6ER98/U+85JLNhV3TcAVg7300JoPtcYFV /a2wqmonfoq0IX9u0OLOYar0AWA2DieBJATq5pvP4XnXiuxLHK/ctDeyRqS77fAtjhXg DW1YDUJA2ImALRoTrJmyRqo1wBrVdFjdcey2DxJalw8HvpI9CbajtUTDhJ6Om9QmuIYb /cuQ== X-Gm-Message-State: AMCzsaU9K5Fm5+1mG0vvw+rR7hLbtXVKJU6KMsaj5PlvWiiHE79hooPt nE2mL8TXOgGScYZEmdqMjYBqiL+otw== X-Google-Smtp-Source: AOwi7QCvRBB/3mtWdHUp5r8b0YqTqyKehBQvIz8yHqDqWoDYQiuFxCsK3w7EvhlvWYVY6hZXi8rY2Q== X-Received: by 10.28.4.135 with SMTP id 129mr19140304wme.34.1507207830177; Thu, 05 Oct 2017 05:50:30 -0700 (PDT) Received: from ping.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id k9sm26405823wrk.27.2017.10.05.05.50.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Oct 2017 05:50:29 -0700 (PDT) From: Nelio Laranjeiro To: dev@dpdk.org Cc: adrien.mazarguil@6wind.com, yskoh@mellanox.com, ferruh.yigit@intel.com Date: Thu, 5 Oct 2017 14:49:38 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 06/30] net/mlx5: verify all flows are been removed on close 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: Thu, 05 Oct 2017 12:50:31 -0000 Debug tools to verify all flows are be un-register from the NIC. Signed-off-by: Nelio Laranjeiro --- drivers/net/mlx5/mlx5.c | 4 ++++ drivers/net/mlx5/mlx5.h | 1 + drivers/net/mlx5/mlx5_flow.c | 22 ++++++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 4da0524..6d17d30 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -190,6 +190,7 @@ mlx5_dev_close(struct rte_eth_dev *dev) { struct priv *priv = mlx5_get_priv(dev); unsigned int i; + int ret; priv_lock(priv); DEBUG("%p: closing device \"%s\"", @@ -252,6 +253,9 @@ mlx5_dev_close(struct rte_eth_dev *dev) if (priv->reta_idx != NULL) rte_free(priv->reta_idx); priv_socket_uninit(priv); + ret = priv_flow_verify(priv); + if (ret) + WARN("%p: some flows still remain", (void *)priv); priv_unlock(priv); memset(priv, 0, sizeof(*priv)); } diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 3c58f7a..c6563bd 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -290,6 +290,7 @@ int mlx5_flow_isolate(struct rte_eth_dev *, int, struct rte_flow_error *); int priv_flow_start(struct priv *); void priv_flow_stop(struct priv *); int priv_flow_rxq_in_use(struct priv *, struct mlx5_rxq_data *); +int priv_flow_verify(struct priv *); /* mlx5_socket.c */ diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 3504c43..193a90b 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -1630,3 +1630,25 @@ mlx5_flow_isolate(struct rte_eth_dev *dev, priv_unlock(priv); return 0; } + +/** + * Verify the flow list is empty + * + * @param priv + * Pointer to private structure. + * + * @return the number of flows not released. + */ +int +priv_flow_verify(struct priv *priv) +{ + struct rte_flow *flow; + int ret = 0; + + TAILQ_FOREACH(flow, &priv->flows, next) { + DEBUG("%p: flow %p still referenced", (void *)priv, + (void *)flow); + ++ret; + } + return ret; +} -- 2.1.4