Netdev List
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@mellanox.com>
To: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
	Jiri Pirko <jiri@mellanox.com>, mlxsw <mlxsw@mellanox.com>,
	Ido Schimmel <idosch@mellanox.com>
Subject: [PATCH net-next 08/15] mlxsw: spectrum_acl: Enable vregion rehash per-profile
Date: Sun, 24 Feb 2019 06:46:28 +0000	[thread overview]
Message-ID: <20190224064525.14913-9-idosch@mellanox.com> (raw)
In-Reply-To: <20190224064525.14913-1-idosch@mellanox.com>

From: Jiri Pirko <jiri@mellanox.com>

For MR ACL profile is does not make sense to do periodical rehashes, as
there is only one mask in use during the whole vregion lifetime.
Therefore periodical work is scheduled but the rehash never happens.
So allow to enable/disable rehash for the whole group, which is added
per-profile. Disable rehashing for MR profile.

Addition to the vregion list is done only in case the rehash is enable
on the particular vregion. Also, the addition is moved after delayed
work init to avoid schedule of uninitialized work
from vregion_rehash_intrvl_set(). Symmetrically, deletion from
the list is done before canceling the delayed work so it is
not scheduled by vregion_rehash_intrvl_set() again.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
---
 .../mellanox/mlxsw/spectrum_acl_tcam.c        | 23 ++++++++++++-------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
index 54c0519195b7..cdbcf612b6fd 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
@@ -175,6 +175,7 @@ struct mlxsw_sp_acl_tcam_vgroup {
 	unsigned int patterns_count;
 	bool tmplt_elusage_set;
 	struct mlxsw_afk_element_usage tmplt_elusage;
+	bool vregion_rehash_enabled;
 };
 
 struct mlxsw_sp_acl_tcam_vregion {
@@ -188,6 +189,7 @@ struct mlxsw_sp_acl_tcam_vregion {
 	struct list_head vchunk_list; /* List of vchunks under this vregion */
 	struct mlxsw_afk_key_info *key_info;
 	struct mlxsw_sp_acl_tcam *tcam;
+	struct mlxsw_sp_acl_tcam_vgroup *vgroup;
 	struct delayed_work rehash_dw;
 	struct mlxsw_sp *mlxsw_sp;
 	bool failed_rollback; /* Indicates failed rollback during migration */
@@ -290,12 +292,15 @@ mlxsw_sp_acl_tcam_vgroup_add(struct mlxsw_sp *mlxsw_sp,
 			     struct mlxsw_sp_acl_tcam_vgroup *vgroup,
 			     const struct mlxsw_sp_acl_tcam_pattern *patterns,
 			     unsigned int patterns_count,
-			     struct mlxsw_afk_element_usage *tmplt_elusage)
+			     struct mlxsw_afk_element_usage *tmplt_elusage,
+			     bool vregion_rehash_enabled)
 {
 	int err;
 
 	vgroup->patterns = patterns;
 	vgroup->patterns_count = patterns_count;
+	vgroup->vregion_rehash_enabled = vregion_rehash_enabled;
+
 	if (tmplt_elusage) {
 		vgroup->tmplt_elusage_set = true;
 		memcpy(&vgroup->tmplt_elusage, tmplt_elusage,
@@ -753,6 +758,7 @@ mlxsw_sp_acl_tcam_vregion_create(struct mlxsw_sp *mlxsw_sp,
 	mutex_init(&vregion->lock);
 	vregion->tcam = tcam;
 	vregion->mlxsw_sp = mlxsw_sp;
+	vregion->vgroup = vgroup;
 	vregion->ref_count = 1;
 
 	vregion->key_info = mlxsw_afk_key_info_get(afk, elusage);
@@ -773,13 +779,12 @@ mlxsw_sp_acl_tcam_vregion_create(struct mlxsw_sp *mlxsw_sp,
 	if (err)
 		goto err_vgroup_vregion_attach;
 
-	list_add_tail(&vregion->tlist, &tcam->vregion_list);
-
-	if (ops->region_rehash_hints_get) {
+	if (vgroup->vregion_rehash_enabled && ops->region_rehash_hints_get) {
 		/* Create the delayed work for vregion periodic rehash */
 		INIT_DELAYED_WORK(&vregion->rehash_dw,
 				  mlxsw_sp_acl_tcam_vregion_rehash_work);
 		mlxsw_sp_acl_tcam_vregion_rehash_work_schedule(vregion);
+		list_add_tail(&vregion->tlist, &tcam->vregion_list);
 	}
 
 	return vregion;
@@ -798,10 +803,12 @@ mlxsw_sp_acl_tcam_vregion_destroy(struct mlxsw_sp *mlxsw_sp,
 				  struct mlxsw_sp_acl_tcam_vregion *vregion)
 {
 	const struct mlxsw_sp_acl_tcam_ops *ops = mlxsw_sp->acl_tcam_ops;
+	struct mlxsw_sp_acl_tcam_vgroup *vgroup = vregion->vgroup;
 
-	if (ops->region_rehash_hints_get)
+	if (vgroup->vregion_rehash_enabled && ops->region_rehash_hints_get) {
+		list_del(&vregion->tlist);
 		cancel_delayed_work_sync(&vregion->rehash_dw);
-	list_del(&vregion->tlist);
+	}
 	mlxsw_sp_acl_tcam_vgroup_vregion_detach(mlxsw_sp, vregion);
 	if (vregion->region2)
 		mlxsw_sp_acl_tcam_region_destroy(mlxsw_sp, vregion->region2);
@@ -1410,7 +1417,7 @@ mlxsw_sp_acl_tcam_flower_ruleset_add(struct mlxsw_sp *mlxsw_sp,
 	return mlxsw_sp_acl_tcam_vgroup_add(mlxsw_sp, tcam, &ruleset->vgroup,
 					    mlxsw_sp_acl_tcam_patterns,
 					    MLXSW_SP_ACL_TCAM_PATTERNS_COUNT,
-					    tmplt_elusage);
+					    tmplt_elusage, true);
 }
 
 static void
@@ -1527,7 +1534,7 @@ mlxsw_sp_acl_tcam_mr_ruleset_add(struct mlxsw_sp *mlxsw_sp,
 	err = mlxsw_sp_acl_tcam_vgroup_add(mlxsw_sp, tcam, &ruleset->vgroup,
 					   mlxsw_sp_acl_tcam_patterns,
 					   MLXSW_SP_ACL_TCAM_PATTERNS_COUNT,
-					   tmplt_elusage);
+					   tmplt_elusage, false);
 	if (err)
 		return err;
 
-- 
2.20.1


  parent reply	other threads:[~2019-02-24  6:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-24  6:46 [PATCH net-next 00/15] mlxsw: spectrum_acl: Don't take rtnl mutex for region rehash Ido Schimmel
2019-02-24  6:46 ` [PATCH net-next 01/15] mlxsw: spectrum_acl: Remove unused ops field from group structure Ido Schimmel
2019-02-24  6:46 ` [PATCH net-next 02/15] mlxsw: spectrum_acl: Split TCAM group structure into two Ido Schimmel
2019-02-24  6:46 ` [PATCH net-next 03/15] mlxsw: spectrum_acl: Introduce a mutex to guard region list updates Ido Schimmel
2019-02-24  6:46 ` [PATCH net-next 04/15] mlxsw: spectrum_acl: Refactor vregion association code Ido Schimmel
2019-02-24  6:46 ` [PATCH net-next 05/15] mlxsw: spectrum_acl: Introduce vregion mutex Ido Schimmel
2019-02-24  6:46 ` [PATCH net-next 06/15] mlxsw: spectrum_acl: Introduce mutex to guard Bloom Filter updates Ido Schimmel
2019-02-24  6:46 ` [PATCH net-next 07/15] mlxsw: spectrum_acl: Introduce a mutex to guard objagg instance manipulation Ido Schimmel
2019-02-24  6:46 ` Ido Schimmel [this message]
2019-02-24  6:46 ` [PATCH net-next 09/15] mlxsw: spectrum_acl: Don't take rtnl lock during vregion_rehash_intrvl_set() Ido Schimmel
2019-02-24  6:46 ` [PATCH net-next 10/15] mlxsw: spectrum_acl: Remove RTNL lock assertions from ERP code Ido Schimmel
2019-02-24  6:46 ` [PATCH net-next 11/15] mlxsw: spectrum_acl: Don't take mutex in mlxsw_sp_acl_tcam_vregion_rehash_work() Ido Schimmel
2019-02-24  6:46 ` [PATCH net-next 12/15] selftests: mlxsw: spectrum-2: Add IPv6 variant of simple delta rehash test Ido Schimmel
2019-02-24  6:46 ` [PATCH net-next 14/15] selftests: mlxsw: spectrum-2: Check migrate end trace Ido Schimmel
2019-02-24  6:46 ` [PATCH net-next 13/15] mlxsw: spectrum_acl: Add vregion migration end tracepoint Ido Schimmel
2019-02-24  6:46 ` [PATCH net-next 15/15] selftests: mlxsw: spectrum-2: Add massive delta rehash test Ido Schimmel
2019-02-25  4:26 ` [PATCH net-next 00/15] mlxsw: spectrum_acl: Don't take rtnl mutex for region rehash David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190224064525.14913-9-idosch@mellanox.com \
    --to=idosch@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=jiri@mellanox.com \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox