From patchwork Thu Jun 14 08:52:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 10463667 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 99642600D0 for ; Thu, 14 Jun 2018 08:53:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B0CA289B7 for ; Thu, 14 Jun 2018 08:53:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F502289C2; Thu, 14 Jun 2018 08:53:23 +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 A1745289B7 for ; Thu, 14 Jun 2018 08:53:22 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 415y805b6nzF0fX for ; Thu, 14 Jun 2018 18:53:20 +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="qZXcjxbV"; 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:c09::243; helo=mail-wm0-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="qZXcjxbV"; dkim-atps=neutral Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::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 415y7f22QlzF0Rs for ; Thu, 14 Jun 2018 18:53:02 +1000 (AEST) Received: by mail-wm0-x243.google.com with SMTP id r125-v6so10396457wmg.2 for ; Thu, 14 Jun 2018 01:53:02 -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=KEaX0yWqb9HT1UgqbMz5pUwrg+T1Cuy7NBDTOvn/IyA=; b=qZXcjxbVQLqZw3cv460jIrWOBR4jWsw24mJtrwi3wWUccl0T0TmRzpJDlAHmbMqd+I 0lDoB/gbInayCv2iOyf+gvogEEtbm6PVXSPCcYnjFNkYQN6GGPr563DDDmTIxqf4VY3O ktFtLPFElbeBjcqob3QQO4PQLTWupGTv4fICvjHMDCWXgFDrcfpMj8QCL5h9Vro3l7+M cEB7amjZ+d7NA6Bgg22mdzdtEs4GhcgQEyD/MwbFZmWfNs8ClNyxQcIEqPd4nz643/YW U4+y2HzJGgCRH0h3FQXIWqsgmnXDcvh7ZVi4lIWqlwscpGYj1udH5EusjhR8AZZpoeYZ MXVw== 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=KEaX0yWqb9HT1UgqbMz5pUwrg+T1Cuy7NBDTOvn/IyA=; b=AjeWph0o3alF1SvLYt+P2P4wggIUXIGhZXwMnYSQSSs0T+aM8Zy+z4CGsQsJT4KEf4 XP36JaUYQarcnpPzuCEAeJtYkLWjVvpaDJFGXissnpA7Bd5R7HGRJWNZATOeKwK+buPV tjRw8n0cPgLD7AhDhEJRvzRSusRSlLhptuaCD84HfnlGjBrX4F8AzAGEt9xr8ccCo/SD OAgC1oODy4p4IWA98a8wunOR8raEqs2ZUWytkYWdK6oQbe555wWKp0TVxQXO4aCFmq1r jyLirs6ewnNdlvQgITXOLVTsmINaq50tq/qHDkAkLybKeJfY25bJ6NtgWA/UbV4oHvKr Kmvg== X-Gm-Message-State: APt69E1NsC+EV6fv1GJEWL9cMiIM/UcykKRAmdYKS5o2DQoxwgY2Ai4z EYypzpH8nN7FcCj2X6Qf0EWLEw== X-Google-Smtp-Source: ADUXVKKa4f6YKqLTntI5/9nkcqNtinA1vu72rgAPNC2hf3iJgwLCOIbNhqKY38lYr5EAC59MR2fwWw== X-Received: by 2002:a1c:1286:: with SMTP id 128-v6mr1167612wms.9.1528966379294; Thu, 14 Jun 2018 01:52:59 -0700 (PDT) Received: from localhost ([83.167.225.161]) by smtp.gmail.com with ESMTPSA id b204-v6sm4931271wmh.22.2018.06.14.01.52.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Jun 2018 01:52:58 -0700 (PDT) From: Jiri Pirko To: linux-internal@mellanox.com Subject: [patch net-next/mlxsw internal 07/15] mlxsw: acl: Introduce activity get operation for action block/set Date: Thu, 14 Jun 2018 10:52:33 +0200 Message-Id: <20180614085241.1873-8-jiri@resnulli.us> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180614085241.1873-1-jiri@resnulli.us> References: <20180614085241.1873-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 In Spectrum2, activity cannot be find out by TCAM rule (PTCEv2 register), but rather by associated action set. For that purpose, extend action ops to allow query activity from PEFA register. Block activity is decided according to activity of the first set. Signed-off-by: Jiri Pirko --- .../mellanox/mlxsw/core_acl_flex_actions.c | 9 +++++++++ .../mellanox/mlxsw/core_acl_flex_actions.h | 3 +++ .../mellanox/mlxsw/spectrum_acl_flex_actions.c | 23 ++++++++++++++++++++++ 3 files changed, 35 insertions(+) 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 72a6a8a2131e..efd02313c333 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c @@ -441,6 +441,15 @@ u32 mlxsw_afa_block_first_kvdl_index(struct mlxsw_afa_block *block) } EXPORT_SYMBOL(mlxsw_afa_block_first_kvdl_index); +int mlxsw_afa_block_activity_get(struct mlxsw_afa_block *block, bool *activity) +{ + u32 kvdl_index = block->first_set->kvdl_index; + + return block->afa->ops->kvdl_set_activity_get(block->afa->ops_priv, + kvdl_index, activity); +} +EXPORT_SYMBOL(mlxsw_afa_block_activity_get); + int mlxsw_afa_block_continue(struct mlxsw_afa_block *block) { if (block->finished) 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 c18249ac28f7..1c7db26e7942 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.h +++ b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.h @@ -45,6 +45,8 @@ struct mlxsw_afa_ops { int (*kvdl_set_add)(void *priv, u32 *p_kvdl_index, char *enc_actions, bool is_first); void (*kvdl_set_del)(void *priv, u32 kvdl_index, bool is_first); + int (*kvdl_set_activity_get)(void *priv, u32 kvdl_index, + bool *activity); int (*kvdl_fwd_entry_add)(void *priv, u32 *p_kvdl_index, u8 local_port); void (*kvdl_fwd_entry_del)(void *priv, u32 kvdl_index); int (*counter_index_get)(void *priv, unsigned int *p_counter_index); @@ -66,6 +68,7 @@ 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_kvdl_index(struct mlxsw_afa_block *block); +int mlxsw_afa_block_activity_get(struct mlxsw_afa_block *block, bool *activity); 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); 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 9119a023bc1e..bca0def756cd 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_actions.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_actions.c @@ -93,6 +93,27 @@ static void mlxsw_sp_act_kvdl_set_del(void *priv, u32 kvdl_index, 1, kvdl_index); } +static int mlxsw_sp1_act_kvdl_set_activity_get(void *priv, u32 kvdl_index, + bool *activity) +{ + return -EOPNOTSUPP; +} + +static int mlxsw_sp2_act_kvdl_set_activity_get(void *priv, u32 kvdl_index, + bool *activity) +{ + struct mlxsw_sp *mlxsw_sp = priv; + char pefa_pl[MLXSW_REG_PEFA_LEN]; + int err; + + mlxsw_reg_pefa_pack(pefa_pl, kvdl_index, true, NULL); + err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(pefa), pefa_pl); + if (err) + return err; + mlxsw_reg_pefa_unpack(pefa_pl, activity); + return 0; +} + static int mlxsw_sp_act_kvdl_fwd_entry_add(void *priv, u32 *p_kvdl_index, u8 local_port) { @@ -174,6 +195,7 @@ mlxsw_sp_act_mirror_del(void *priv, u8 local_in_port, int span_id, bool ingress) const struct mlxsw_afa_ops mlxsw_sp1_act_afa_ops = { .kvdl_set_add = mlxsw_sp1_act_kvdl_set_add, .kvdl_set_del = mlxsw_sp_act_kvdl_set_del, + .kvdl_set_activity_get = mlxsw_sp1_act_kvdl_set_activity_get, .kvdl_fwd_entry_add = mlxsw_sp_act_kvdl_fwd_entry_add, .kvdl_fwd_entry_del = mlxsw_sp_act_kvdl_fwd_entry_del, .counter_index_get = mlxsw_sp_act_counter_index_get, @@ -185,6 +207,7 @@ const struct mlxsw_afa_ops mlxsw_sp1_act_afa_ops = { const struct mlxsw_afa_ops mlxsw_sp2_act_afa_ops = { .kvdl_set_add = mlxsw_sp2_act_kvdl_set_add, .kvdl_set_del = mlxsw_sp_act_kvdl_set_del, + .kvdl_set_activity_get = mlxsw_sp2_act_kvdl_set_activity_get, .kvdl_fwd_entry_add = mlxsw_sp_act_kvdl_fwd_entry_add, .kvdl_fwd_entry_del = mlxsw_sp_act_kvdl_fwd_entry_del, .counter_index_get = mlxsw_sp_act_counter_index_get,