From patchwork Thu Jun 14 08:37:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 10463615 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 16081601F9 for ; Thu, 14 Jun 2018 08:38:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06BAB26247 for ; Thu, 14 Jun 2018 08:38:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF723286B9; Thu, 14 Jun 2018 08:38:24 +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 471A826247 for ; Thu, 14 Jun 2018 08:38:24 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 415xpk3v4LzDrqN for ; Thu, 14 Jun 2018 18:38:22 +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="TrwOA+H0"; 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::243; helo=mail-wr0-x243.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="TrwOA+H0"; dkim-atps=neutral Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) (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 415xpX6HpZzF0lh for ; Thu, 14 Jun 2018 18:38:12 +1000 (AEST) Received: by mail-wr0-x243.google.com with SMTP id l10-v6so5473023wrn.2 for ; Thu, 14 Jun 2018 01:38:12 -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=9wi6qRtHD4BQ98ZxtaamTWG7dXKzIzlTmgnh46PuM+s=; b=TrwOA+H0YZVgxYMNq5vsDUNSS0f2lCnRMMffmmtUB8fd5ZIioiuMcCgaDNple2vzi0 WxgA8FQhhnX3mNba9H/Sq1ACY0ka7tLJJoCPrVF5u69TBq9Y08c/WhWtFnd5Iyyubdij fqfZ5fjIeIQmlJMV9B06Nc+5JI96N4OT7StIMzFPXWJAYOlrPNdEJkUiWAaQB6+TRxNp pJwj8laAskAVU1/8ykR3hU0XiNwKNnjuKCcWztJm5hdEmJkcKj1L8V2tkFbx8/uVKo/E /kCF88XFLGYTsKUlcdLieXHrQOdCfWPpD6plUc2J/nIxh33SnN03gq6mzaooNNQuY/ai RTOg== 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=9wi6qRtHD4BQ98ZxtaamTWG7dXKzIzlTmgnh46PuM+s=; b=ujK/+7Ii20s9pIddrfQlO25uMk1+20naIKbnPNWJLdNY433ei09jMgTTVuzN+SzdlI JWrf7fkTnCH0CjcM63F8IJOFkmihPYF2tA8aoPlcQWW4jzBloydruIFyKiE56hkkXZIr gyvvIHeenrMcZe5Vzms6oR/TwFimKJlqc7bPvpKleQ6zi+6Mq6HKHXNdCpby0b7WeVtd 1urKbW6BYE/GdC0LvzpJ9KGOCIYZ0zXOtaGku4n7ptcyunzO8Q7IktB8U3aPhjrYW4Fo Sc8zaPVnmSbnS92n7PeO8VflPjwRn+Wdm0G/JhaTo8ALssSPqOJQAlvP/HMI8BWhzguK G5BQ== X-Gm-Message-State: APt69E0g2YItxqgzH56dQpE0F1BP+HS2aJfoESst1M0hE0a+YVcBtCwt 1F28+CSpHHUhF7670JbIJqkBFg== X-Google-Smtp-Source: ADUXVKLiZESirA9Xj7mVP9//3WqKjlIG527fsj8Nfqn892wwWxWk8IFN4K5coxhz6uYgevVEwccS9w== X-Received: by 2002:adf:b097:: with SMTP id i23-v6mr1272584wra.52.1528965490082; Thu, 14 Jun 2018 01:38:10 -0700 (PDT) Received: from localhost ([83.167.225.161]) by smtp.gmail.com with ESMTPSA id p38-v6sm11590291wrc.11.2018.06.14.01.38.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Jun 2018 01:38:09 -0700 (PDT) From: Jiri Pirko To: linux-internal@mellanox.com Subject: [patch net-next/mlxsw internal 8/8] mlxsw: core_acl_flex_actions: Fix helper to get the first KVD linear index Date: Thu, 14 Jun 2018 10:37:49 +0200 Message-Id: <20180614083749.1592-9-jiri@resnulli.us> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180614083749.1592-1-jiri@resnulli.us> References: <20180614083749.1592-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 The helper should return always KVD linear index of the second set. It is unused now, but going to be used soon. Signed-off-by: Jiri Pirko --- drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c | 11 ++++++++--- drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.h | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c index 9395bf385fa9..72a6a8a2131e 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c @@ -430,11 +430,16 @@ char *mlxsw_afa_block_first_set(struct mlxsw_afa_block *block) } EXPORT_SYMBOL(mlxsw_afa_block_first_set); -u32 mlxsw_afa_block_first_set_kvdl_index(struct mlxsw_afa_block *block) +u32 mlxsw_afa_block_first_kvdl_index(struct mlxsw_afa_block *block) { - return block->first_set->kvdl_index; + /* First set is never in KVD linear. So the first set + * with valid KVD linear index is always the second one. + */ + if (WARN_ON(!block->first_set->next)) + return 0; + return block->first_set->next->kvdl_index; } -EXPORT_SYMBOL(mlxsw_afa_block_first_set_kvdl_index); +EXPORT_SYMBOL(mlxsw_afa_block_first_kvdl_index); int mlxsw_afa_block_continue(struct mlxsw_afa_block *block) { diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.h b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.h index f9c77bf48e24..c18249ac28f7 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.h +++ b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.h @@ -65,7 +65,7 @@ struct mlxsw_afa_block *mlxsw_afa_block_create(struct mlxsw_afa *mlxsw_afa); void mlxsw_afa_block_destroy(struct mlxsw_afa_block *block); int mlxsw_afa_block_commit(struct mlxsw_afa_block *block); char *mlxsw_afa_block_first_set(struct mlxsw_afa_block *block); -u32 mlxsw_afa_block_first_set_kvdl_index(struct mlxsw_afa_block *block); +u32 mlxsw_afa_block_first_kvdl_index(struct mlxsw_afa_block *block); int mlxsw_afa_block_continue(struct mlxsw_afa_block *block); int mlxsw_afa_block_jump(struct mlxsw_afa_block *block, u16 group_id); int mlxsw_afa_block_terminate(struct mlxsw_afa_block *block);