From patchwork Thu Jun 14 08:40:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 10463619 X-Patchwork-Delegate: idosch@idosch.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4FCA3601F9 for ; Thu, 14 Jun 2018 08:41:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F85528994 for ; Thu, 14 Jun 2018 08:41:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33AC6289B5; Thu, 14 Jun 2018 08:41:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0261C28994 for ; Thu, 14 Jun 2018 08:41:10 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 415xsw1DJGzF0Tn for ; Thu, 14 Jun 2018 18:41:08 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=resnulli.us Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="FJ+QpqUW"; dkim-atps=neutral X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=resnulli.us (client-ip=2a00:1450:400c:c0c::244; helo=mail-wr0-x244.google.com; envelope-from=jiri@resnulli.us; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=resnulli.us Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="FJ+QpqUW"; dkim-atps=neutral Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 415xsk3yPNzF0TM for ; Thu, 14 Jun 2018 18:40:58 +1000 (AEST) Received: by mail-wr0-x244.google.com with SMTP id d2-v6so5441514wrm.10 for ; Thu, 14 Jun 2018 01:40:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EFE4Jjc+6xs/uwcJf+f9/F3LvwlMTg2nYYwcudnF/aU=; b=FJ+QpqUWn7MtBji2STp83/WN0Z5NZk4Nn/eCRz8xSfetySaHdbIotu01z0+Cqk9cH3 /BYk8ucD6EykRtkmQKBX8wz5fbIfDxArWkzufuBFFCgpjrxSYbs5dLppkzsDgMS5e85l /bD6EYr5BFe336NT1ebI98ydnEvDeIweGxEvcG3GDnggbhpTagQ3f3DElRZl3rDkp9fU d8V8CXuptvQUkVxxBXbBnr92DXp2fEQJvJxG60aQcKPXEM/Etbq0CQf8QOclxxyF5XzX fImPkQu+v0mon3ThHTe578zzyEsYmNIhr3PNx/bIJwSEJEBxoMseQpLt3WZXQPbYgYoG TxBg== 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=EFE4Jjc+6xs/uwcJf+f9/F3LvwlMTg2nYYwcudnF/aU=; b=gkzMoqDwf0MbP6ZfLDu/JODd+1SYU463y/eM0euey3hbucGMalhuhCikF2+jx2HgQW ZO9PPzs3q1uddF8A79iR3wGPL6APxbySJhB1ocxdqhJd86AFHSy2NNq1N7/KiMD4CPMd 5xCkyENCYxzDXTvz/sejsMnTVZvd3VdCrfBwZ9Ih/l6JgKQ/e9JJPZFiArCu522joAft Snzt5MVoHVin5tL0Ktoz7/oVfkvU7q3fB/IcQASLkpCqgV0VZJZ1CfHi4GKzkbStNhm/ i3A4jMhoV5hdhHG6K5GsFnAAQCd2jESKOjwSNezvPRcy1exlD3DDsotWJXgkqd46izvA mFjA== X-Gm-Message-State: APt69E3sPbGHLey2iXY67DhX3b3w5UlIVhIRntu1q63EVDlNWsmmxKuO 9/SLgR52JFYnTskBJod2VGsm7g== X-Google-Smtp-Source: ADUXVKKTfvjvZOxjUaNRDPn6rPdsYcn2PEo1ZCZknEy18PdEpgVTgqEyys4vX6fxwkduEd4sWWYrpw== X-Received: by 2002:adf:ad2f:: with SMTP id p44-v6mr1373217wrc.164.1528965655211; Thu, 14 Jun 2018 01:40:55 -0700 (PDT) Received: from localhost ([83.167.225.161]) by smtp.gmail.com with ESMTPSA id u15-v6sm7037730wma.37.2018.06.14.01.40.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Jun 2018 01:40:54 -0700 (PDT) From: Jiri Pirko To: linux-internal@mellanox.com Subject: [patch net-next/mlxsw internal 03/12] mlxsw: spectrum_kvdl: Pass entry_count to free function Date: Thu, 14 Jun 2018 10:40:43 +0200 Message-Id: <20180614084049.1689-4-jiri@resnulli.us> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180614084049.1689-1-jiri@resnulli.us> References: <20180614084049.1689-1-jiri@resnulli.us> X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: mlxsw driver development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jiri Pirko For the Spectrum2 KVD linear manager implementation, entry_count will be needed even for the free function. So pass it down. Signed-off-by: Jiri Pirko --- drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 4 ++-- drivers/net/ethernet/mellanox/mlxsw/spectrum1_kvdl.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_actions.c | 8 ++++---- drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c | 5 +++-- drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 6 +++--- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h index bee61128550e..bdb0fd933f5b 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h @@ -467,7 +467,7 @@ struct mlxsw_sp_kvdl_ops { unsigned int entry_count, u32 *p_entry_index); void (*free)(struct mlxsw_sp *mlxsw_sp, void *priv, enum mlxsw_sp_kvdl_entry_type type, - int entry_index); + unsigned int entry_count, int entry_index); int (*alloc_size_query)(struct mlxsw_sp *mlxsw_sp, void *priv, enum mlxsw_sp_kvdl_entry_type type, unsigned int entry_count, @@ -482,7 +482,7 @@ int mlxsw_sp_kvdl_alloc(struct mlxsw_sp *mlxsw_sp, unsigned int entry_count, u32 *p_entry_index); void mlxsw_sp_kvdl_free(struct mlxsw_sp *mlxsw_sp, enum mlxsw_sp_kvdl_entry_type type, - int entry_index); + unsigned int entry_count, int entry_index); int mlxsw_sp_kvdl_alloc_count_query(struct mlxsw_sp *mlxsw_sp, enum mlxsw_sp_kvdl_entry_type type, unsigned int entry_count, diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum1_kvdl.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum1_kvdl.c index 86e0b993f8b3..0d4583894a97 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum1_kvdl.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum1_kvdl.c @@ -194,7 +194,7 @@ static int mlxsw_sp1_kvdl_alloc(struct mlxsw_sp *mlxsw_sp, void *priv, static void mlxsw_sp1_kvdl_free(struct mlxsw_sp *mlxsw_sp, void *priv, enum mlxsw_sp_kvdl_entry_type type, - int entry_index) + unsigned int entry_count, int entry_index) { struct mlxsw_sp1_kvdl *kvdl = priv; struct mlxsw_sp1_kvdl_part *part; diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_actions.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_actions.c index f98fb2c76cd8..6a7c3406b724 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_actions.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_actions.c @@ -64,7 +64,7 @@ static int mlxsw_sp_act_kvdl_set_add(void *priv, u32 *p_kvdl_index, err_pefa_write: mlxsw_sp_kvdl_free(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_ACTSET, - kvdl_index); + 1, kvdl_index); return err; } @@ -76,7 +76,7 @@ static void mlxsw_sp_act_kvdl_set_del(void *priv, u32 kvdl_index, if (is_first) return; mlxsw_sp_kvdl_free(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_ACTSET, - kvdl_index); + 1, kvdl_index); } static int mlxsw_sp_act_kvdl_fwd_entry_add(void *priv, u32 *p_kvdl_index, @@ -100,7 +100,7 @@ static int mlxsw_sp_act_kvdl_fwd_entry_add(void *priv, u32 *p_kvdl_index, err_ppbs_write: mlxsw_sp_kvdl_free(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_PBS, - kvdl_index); + 1, kvdl_index); return err; } @@ -109,7 +109,7 @@ static void mlxsw_sp_act_kvdl_fwd_entry_del(void *priv, u32 kvdl_index) struct mlxsw_sp *mlxsw_sp = priv; mlxsw_sp_kvdl_free(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_PBS, - kvdl_index); + 1, kvdl_index); } static int diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c index 3f9130afe5ea..fd557585514d 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c @@ -86,11 +86,12 @@ int mlxsw_sp_kvdl_alloc(struct mlxsw_sp *mlxsw_sp, void mlxsw_sp_kvdl_free(struct mlxsw_sp *mlxsw_sp, enum mlxsw_sp_kvdl_entry_type type, - int entry_index) + unsigned int entry_count, int entry_index) { struct mlxsw_sp_kvdl *kvdl = mlxsw_sp->kvdl; - kvdl->kvdl_ops->free(mlxsw_sp, kvdl->priv, type, entry_index); + kvdl->kvdl_ops->free(mlxsw_sp, kvdl->priv, type, + entry_count, entry_index); } int mlxsw_sp_kvdl_alloc_count_query(struct mlxsw_sp *mlxsw_sp, diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c index d1fd85ade425..87d9423dacdc 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c @@ -111,7 +111,7 @@ mlxsw_sp_mr_erif_sublist_destroy(struct mlxsw_sp *mlxsw_sp, { list_del(&erif_sublist->list); mlxsw_sp_kvdl_free(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_MCRIGR, - erif_sublist->rigr2_kvdl_index); + 1, erif_sublist->rigr2_kvdl_index); kfree(erif_sublist); } diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 11640286f314..4ea9009cc332 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -1127,7 +1127,7 @@ static void mlxsw_sp_fib_entry_decap_fini(struct mlxsw_sp *mlxsw_sp, fib_entry->decap.ipip_entry->decap_fib_entry = NULL; fib_entry->decap.ipip_entry = NULL; mlxsw_sp_kvdl_free(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_ADJ, - fib_entry->decap.tunnel_index); + 1, fib_entry->decap.tunnel_index); } static struct mlxsw_sp_fib_node * @@ -3318,7 +3318,7 @@ mlxsw_sp_nexthop_group_refresh(struct mlxsw_sp *mlxsw_sp, err = mlxsw_sp_adj_index_mass_update(mlxsw_sp, nh_grp, old_adj_index, old_ecmp_size); mlxsw_sp_kvdl_free(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_ADJ, - old_adj_index); + old_ecmp_size, old_adj_index); if (err) { dev_warn(mlxsw_sp->bus_info->dev, "Failed to mass-update adjacency index for nexthop group.\n"); goto set_trap; @@ -3341,7 +3341,7 @@ mlxsw_sp_nexthop_group_refresh(struct mlxsw_sp *mlxsw_sp, dev_warn(mlxsw_sp->bus_info->dev, "Failed to set traps for fib entries.\n"); if (old_adj_index_valid) mlxsw_sp_kvdl_free(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_ADJ, - nh_grp->adj_index); + nh_grp->ecmp_size, nh_grp->adj_index); } static void __mlxsw_sp_nexthop_neigh_update(struct mlxsw_sp_nexthop *nh,