lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180213102748.7957-3-jiri@resnulli.us>
Date:   Tue, 13 Feb 2018 11:27:47 +0100
From:   Jiri Pirko <jiri@...nulli.us>
To:     netdev@...r.kernel.org
Cc:     davem@...emloft.net, idosch@...lanox.com, petrm@...lanox.com,
        mlxsw@...lanox.com
Subject: [patch net-next 2/3] mlxsw: spectrum: Drop struct span_entry.used

From: Petr Machata <petrm@...lanox.com>

The member ref_count already determines whether a given SPAN entry is
used, and is as easy to use as a dedicated boolean.

Signed-off-by: Petr Machata <petrm@...lanox.com>
Signed-off-by: Jiri Pirko <jiri@...lanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 6 ++----
 drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 1 -
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index da3d981a09f9..0a30438832c9 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -534,7 +534,7 @@ mlxsw_sp_span_entry_create(struct mlxsw_sp_port *port)
 	/* find a free entry to use */
 	index = -1;
 	for (i = 0; i < mlxsw_sp->span.entries_count; i++) {
-		if (!mlxsw_sp->span.entries[i].used) {
+		if (!mlxsw_sp->span.entries[i].ref_count) {
 			index = i;
 			span_entry = &mlxsw_sp->span.entries[i];
 			break;
@@ -549,7 +549,6 @@ mlxsw_sp_span_entry_create(struct mlxsw_sp_port *port)
 	if (err)
 		return NULL;
 
-	span_entry->used = true;
 	span_entry->id = index;
 	span_entry->ref_count = 1;
 	span_entry->local_port = local_port;
@@ -565,7 +564,6 @@ static void mlxsw_sp_span_entry_destroy(struct mlxsw_sp *mlxsw_sp,
 
 	mlxsw_reg_mpat_pack(mpat_pl, pa_id, local_port, false);
 	mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(mpat), mpat_pl);
-	span_entry->used = false;
 }
 
 struct mlxsw_sp_span_entry *
@@ -576,7 +574,7 @@ mlxsw_sp_span_entry_find(struct mlxsw_sp *mlxsw_sp, u8 local_port)
 	for (i = 0; i < mlxsw_sp->span.entries_count; i++) {
 		struct mlxsw_sp_span_entry *curr = &mlxsw_sp->span.entries[i];
 
-		if (curr->used && curr->local_port == local_port)
+		if (curr->ref_count && curr->local_port == local_port)
 			return curr;
 	}
 	return NULL;
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
index bdd8f94a452c..44dc916f4f5c 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
@@ -124,7 +124,6 @@ struct mlxsw_sp_span_inspected_port {
 
 struct mlxsw_sp_span_entry {
 	u8 local_port;
-	bool used;
 	struct list_head bound_ports_list;
 	int ref_count;
 	int id;
-- 
2.14.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ