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: <20220429233049.3726791-2-colin.foster@in-advantage.com>
Date:   Fri, 29 Apr 2022 16:30:48 -0700
From:   Colin Foster <colin.foster@...advantage.com>
To:     linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Cc:     Paolo Abeni <pabeni@...hat.com>, Jakub Kicinski <kuba@...nel.org>,
        Eric Dumazet <edumazet@...gle.com>,
        "David S. Miller" <davem@...emloft.net>,
        Florian Fainelli <f.fainelli@...il.com>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Andrew Lunn <andrew@...n.ch>, UNGLinuxDriver@...rochip.com,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Claudiu Manoil <claudiu.manoil@....com>,
        Vladimir Oltean <vladimir.oltean@....com>
Subject: [PATCH v1 net 1/2] net: ethernet: ocelot: rename vcap_props to clearly be an ocelot member

The vcap_props structure is part of the ocelot driver. It is in the process
of being exported to a wider scope, so renaming it to match other structure
definitions in the include/soc/mscc/ocelot.h makes sense.

I'm splitting the rename operation into this separate commit, since it
should make the actual bug fix (next commit) easier to review.

Signed-off-by: Colin Foster <colin.foster@...advantage.com>
---
 drivers/net/dsa/ocelot/felix.h             |  2 +-
 drivers/net/dsa/ocelot/felix_vsc9959.c     |  2 +-
 drivers/net/dsa/ocelot/seville_vsc9953.c   |  2 +-
 drivers/net/ethernet/mscc/ocelot_flower.c  |  4 +-
 drivers/net/ethernet/mscc/ocelot_vcap.c    | 54 +++++++++++-----------
 drivers/net/ethernet/mscc/ocelot_vsc7514.c |  2 +-
 include/soc/mscc/ocelot.h                  |  2 +-
 include/soc/mscc/ocelot_vcap.h             |  2 +-
 8 files changed, 36 insertions(+), 34 deletions(-)

diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h
index f083b06fdfe9..d6cf5e5a48c5 100644
--- a/drivers/net/dsa/ocelot/felix.h
+++ b/drivers/net/dsa/ocelot/felix.h
@@ -27,7 +27,7 @@ struct felix_info {
 	unsigned int			num_stats;
 	int				num_ports;
 	int				num_tx_queues;
-	struct vcap_props		*vcap;
+	struct ocelot_vcap_props	*vcap;
 	u16				vcap_pol_base;
 	u16				vcap_pol_max;
 	u16				vcap_pol_base2;
diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
index 52a8566071ed..a60dbedc1b1c 100644
--- a/drivers/net/dsa/ocelot/felix_vsc9959.c
+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
@@ -845,7 +845,7 @@ static struct vcap_field vsc9959_vcap_is2_actions[] = {
 	[VCAP_IS2_ACT_HIT_CNT]			= { 44, 32},
 };
 
-static struct vcap_props vsc9959_vcap_props[] = {
+static struct ocelot_vcap_props vsc9959_vcap_props[] = {
 	[VCAP_ES0] = {
 		.action_type_width = 0,
 		.action_table = {
diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c
index 68ef8f111bbe..2fda65fb21a3 100644
--- a/drivers/net/dsa/ocelot/seville_vsc9953.c
+++ b/drivers/net/dsa/ocelot/seville_vsc9953.c
@@ -829,7 +829,7 @@ static struct vcap_field vsc9953_vcap_is2_actions[] = {
 	[VCAP_IS2_ACT_HIT_CNT]			= { 50, 32},
 };
 
-static struct vcap_props vsc9953_vcap_props[] = {
+static struct ocelot_vcap_props vsc9953_vcap_props[] = {
 	[VCAP_ES0] = {
 		.action_type_width = 0,
 		.action_table = {
diff --git a/drivers/net/ethernet/mscc/ocelot_flower.c b/drivers/net/ethernet/mscc/ocelot_flower.c
index 03b5e59d033e..59b040ad1fee 100644
--- a/drivers/net/ethernet/mscc/ocelot_flower.c
+++ b/drivers/net/ethernet/mscc/ocelot_flower.c
@@ -504,8 +504,8 @@ static int ocelot_flower_parse_indev(struct ocelot *ocelot, int port,
 				     struct flow_cls_offload *f,
 				     struct ocelot_vcap_filter *filter)
 {
+	const struct ocelot_vcap_props *vcap = &ocelot->vcap[VCAP_ES0];
 	struct flow_rule *rule = flow_cls_offload_flow_rule(f);
-	const struct vcap_props *vcap = &ocelot->vcap[VCAP_ES0];
 	int key_length = vcap->keys[VCAP_ES0_IGR_PORT].length;
 	struct netlink_ext_ack *extack = f->common.extack;
 	struct net_device *dev, *indev;
@@ -786,7 +786,7 @@ static struct ocelot_vcap_filter
 	if (ingress) {
 		filter->ingress_port_mask = BIT(port);
 	} else {
-		const struct vcap_props *vcap = &ocelot->vcap[VCAP_ES0];
+		const struct ocelot_vcap_props *vcap = &ocelot->vcap[VCAP_ES0];
 		int key_length = vcap->keys[VCAP_ES0_EGR_PORT].length;
 
 		filter->egress_port.value = port;
diff --git a/drivers/net/ethernet/mscc/ocelot_vcap.c b/drivers/net/ethernet/mscc/ocelot_vcap.c
index c8701ac955a8..816c8144e18e 100644
--- a/drivers/net/ethernet/mscc/ocelot_vcap.c
+++ b/drivers/net/ethernet/mscc/ocelot_vcap.c
@@ -47,13 +47,14 @@ struct vcap_data {
 };
 
 static u32 vcap_read_update_ctrl(struct ocelot *ocelot,
-				 const struct vcap_props *vcap)
+				 const struct ocelot_vcap_props *vcap)
 {
 	return ocelot_target_read(ocelot, vcap->target, VCAP_CORE_UPDATE_CTRL);
 }
 
-static void vcap_cmd(struct ocelot *ocelot, const struct vcap_props *vcap,
-		     u16 ix, int cmd, int sel)
+static void vcap_cmd(struct ocelot *ocelot,
+		     const struct ocelot_vcap_props *vcap, u16 ix, int cmd,
+		     int sel)
 {
 	u32 value = (VCAP_CORE_UPDATE_CTRL_UPDATE_CMD(cmd) |
 		     VCAP_CORE_UPDATE_CTRL_UPDATE_ADDR(ix) |
@@ -79,14 +80,15 @@ static void vcap_cmd(struct ocelot *ocelot, const struct vcap_props *vcap,
 }
 
 /* Convert from 0-based row to VCAP entry row and run command */
-static void vcap_row_cmd(struct ocelot *ocelot, const struct vcap_props *vcap,
-			 u32 row, int cmd, int sel)
+static void vcap_row_cmd(struct ocelot *ocelot,
+			 const struct ocelot_vcap_props *vcap, u32 row, int cmd,
+			 int sel)
 {
 	vcap_cmd(ocelot, vcap, vcap->entry_count - row - 1, cmd, sel);
 }
 
 static void vcap_entry2cache(struct ocelot *ocelot,
-			     const struct vcap_props *vcap,
+			     const struct ocelot_vcap_props *vcap,
 			     struct vcap_data *data)
 {
 	u32 entry_words, i;
@@ -103,7 +105,7 @@ static void vcap_entry2cache(struct ocelot *ocelot,
 }
 
 static void vcap_cache2entry(struct ocelot *ocelot,
-			     const struct vcap_props *vcap,
+			     const struct ocelot_vcap_props *vcap,
 			     struct vcap_data *data)
 {
 	u32 entry_words, i;
@@ -121,7 +123,7 @@ static void vcap_cache2entry(struct ocelot *ocelot,
 }
 
 static void vcap_action2cache(struct ocelot *ocelot,
-			      const struct vcap_props *vcap,
+			      const struct ocelot_vcap_props *vcap,
 			      struct vcap_data *data)
 {
 	u32 action_words, mask;
@@ -146,7 +148,7 @@ static void vcap_action2cache(struct ocelot *ocelot,
 }
 
 static void vcap_cache2action(struct ocelot *ocelot,
-			      const struct vcap_props *vcap,
+			      const struct ocelot_vcap_props *vcap,
 			      struct vcap_data *data)
 {
 	u32 action_words;
@@ -170,7 +172,7 @@ static void vcap_cache2action(struct ocelot *ocelot,
 }
 
 /* Calculate offsets for entry */
-static void vcap_data_offset_get(const struct vcap_props *vcap,
+static void vcap_data_offset_get(const struct ocelot_vcap_props *vcap,
 				 struct vcap_data *data, int ix)
 {
 	int num_subwords_per_entry, num_subwords_per_action;
@@ -251,8 +253,8 @@ static void vcap_key_field_set(struct vcap_data *data, u32 offset, u32 width,
 	vcap_data_set(data->mask, offset + data->key_offset, width, mask);
 }
 
-static void vcap_key_set(const struct vcap_props *vcap, struct vcap_data *data,
-			 int field, u32 value, u32 mask)
+static void vcap_key_set(const struct ocelot_vcap_props *vcap,
+			 struct vcap_data *data, int field, u32 value, u32 mask)
 {
 	u32 offset = vcap->keys[field].offset;
 	u32 length = vcap->keys[field].length;
@@ -260,7 +262,7 @@ static void vcap_key_set(const struct vcap_props *vcap, struct vcap_data *data,
 	vcap_key_field_set(data, offset, length, value, mask);
 }
 
-static void vcap_key_bytes_set(const struct vcap_props *vcap,
+static void vcap_key_bytes_set(const struct ocelot_vcap_props *vcap,
 			       struct vcap_data *data, int field,
 			       u8 *val, u8 *msk)
 {
@@ -291,7 +293,7 @@ static void vcap_key_bytes_set(const struct vcap_props *vcap,
 	}
 }
 
-static void vcap_key_l4_port_set(const struct vcap_props *vcap,
+static void vcap_key_l4_port_set(const struct ocelot_vcap_props *vcap,
 				 struct vcap_data *data, int field,
 				 struct ocelot_vcap_udp_tcp *port)
 {
@@ -303,7 +305,7 @@ static void vcap_key_l4_port_set(const struct vcap_props *vcap,
 	vcap_key_field_set(data, offset, length, port->value, port->mask);
 }
 
-static void vcap_key_bit_set(const struct vcap_props *vcap,
+static void vcap_key_bit_set(const struct ocelot_vcap_props *vcap,
 			     struct vcap_data *data, int field,
 			     enum ocelot_vcap_bit val)
 {
@@ -317,7 +319,7 @@ static void vcap_key_bit_set(const struct vcap_props *vcap,
 	vcap_key_field_set(data, offset, length, value, msk);
 }
 
-static void vcap_action_set(const struct vcap_props *vcap,
+static void vcap_action_set(const struct ocelot_vcap_props *vcap,
 			    struct vcap_data *data, int field, u32 value)
 {
 	int offset = vcap->actions[field].offset;
@@ -330,7 +332,7 @@ static void vcap_action_set(const struct vcap_props *vcap,
 static void is2_action_set(struct ocelot *ocelot, struct vcap_data *data,
 			   struct ocelot_vcap_filter *filter)
 {
-	const struct vcap_props *vcap = &ocelot->vcap[VCAP_IS2];
+	const struct ocelot_vcap_props *vcap = &ocelot->vcap[VCAP_IS2];
 	struct ocelot_vcap_action *a = &filter->action;
 
 	vcap_action_set(vcap, data, VCAP_IS2_ACT_MASK_MODE, a->mask_mode);
@@ -345,7 +347,7 @@ static void is2_action_set(struct ocelot *ocelot, struct vcap_data *data,
 static void is2_entry_set(struct ocelot *ocelot, int ix,
 			  struct ocelot_vcap_filter *filter)
 {
-	const struct vcap_props *vcap = &ocelot->vcap[VCAP_IS2];
+	const struct ocelot_vcap_props *vcap = &ocelot->vcap[VCAP_IS2];
 	struct ocelot_vcap_key_vlan *tag = &filter->vlan;
 	u32 val, msk, type, type_mask = 0xf, i, count;
 	struct ocelot_vcap_u64 payload;
@@ -647,7 +649,7 @@ static void is2_entry_set(struct ocelot *ocelot, int ix,
 static void is1_action_set(struct ocelot *ocelot, struct vcap_data *data,
 			   const struct ocelot_vcap_filter *filter)
 {
-	const struct vcap_props *vcap = &ocelot->vcap[VCAP_IS1];
+	const struct ocelot_vcap_props *vcap = &ocelot->vcap[VCAP_IS1];
 	const struct ocelot_vcap_action *a = &filter->action;
 
 	vcap_action_set(vcap, data, VCAP_IS1_ACT_VID_REPLACE_ENA,
@@ -670,7 +672,7 @@ static void is1_action_set(struct ocelot *ocelot, struct vcap_data *data,
 static void is1_entry_set(struct ocelot *ocelot, int ix,
 			  struct ocelot_vcap_filter *filter)
 {
-	const struct vcap_props *vcap = &ocelot->vcap[VCAP_IS1];
+	const struct ocelot_vcap_props *vcap = &ocelot->vcap[VCAP_IS1];
 	struct ocelot_vcap_key_vlan *tag = &filter->vlan;
 	struct ocelot_vcap_u64 payload;
 	struct vcap_data data;
@@ -783,7 +785,7 @@ static void is1_entry_set(struct ocelot *ocelot, int ix,
 static void es0_action_set(struct ocelot *ocelot, struct vcap_data *data,
 			   const struct ocelot_vcap_filter *filter)
 {
-	const struct vcap_props *vcap = &ocelot->vcap[VCAP_ES0];
+	const struct ocelot_vcap_props *vcap = &ocelot->vcap[VCAP_ES0];
 	const struct ocelot_vcap_action *a = &filter->action;
 
 	vcap_action_set(vcap, data, VCAP_ES0_ACT_PUSH_OUTER_TAG,
@@ -811,7 +813,7 @@ static void es0_action_set(struct ocelot *ocelot, struct vcap_data *data,
 static void es0_entry_set(struct ocelot *ocelot, int ix,
 			  struct ocelot_vcap_filter *filter)
 {
-	const struct vcap_props *vcap = &ocelot->vcap[VCAP_ES0];
+	const struct ocelot_vcap_props *vcap = &ocelot->vcap[VCAP_ES0];
 	struct ocelot_vcap_key_vlan *tag = &filter->vlan;
 	struct ocelot_vcap_u64 payload;
 	struct vcap_data data;
@@ -856,7 +858,7 @@ static void es0_entry_set(struct ocelot *ocelot, int ix,
 static void vcap_entry_get(struct ocelot *ocelot, int ix,
 			   struct ocelot_vcap_filter *filter)
 {
-	const struct vcap_props *vcap = &ocelot->vcap[filter->block_id];
+	const struct ocelot_vcap_props *vcap = &ocelot->vcap[filter->block_id];
 	struct vcap_data data;
 	int row, count;
 	u32 cnt;
@@ -1313,7 +1315,7 @@ int ocelot_vcap_filter_stats_update(struct ocelot *ocelot,
 }
 
 static void ocelot_vcap_init_one(struct ocelot *ocelot,
-				 const struct vcap_props *vcap)
+				 const struct ocelot_vcap_props *vcap)
 {
 	struct vcap_data data;
 
@@ -1332,7 +1334,7 @@ static void ocelot_vcap_init_one(struct ocelot *ocelot,
 }
 
 static void ocelot_vcap_detect_constants(struct ocelot *ocelot,
-					 struct vcap_props *vcap)
+					 struct ocelot_vcap_props *vcap)
 {
 	int counter_memory_width;
 	int num_default_actions;
@@ -1421,7 +1423,7 @@ int ocelot_vcap_init(struct ocelot *ocelot)
 
 	for (i = 0; i < OCELOT_NUM_VCAP_BLOCKS; i++) {
 		struct ocelot_vcap_block *block = &ocelot->block[i];
-		struct vcap_props *vcap = &ocelot->vcap[i];
+		struct ocelot_vcap_props *vcap = &ocelot->vcap[i];
 
 		INIT_LIST_HEAD(&block->rules);
 
diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c
index 4f4a495a60ad..12c739cb89f9 100644
--- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c
+++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c
@@ -344,7 +344,7 @@ static const struct ocelot_ops ocelot_ops = {
 	.netdev_to_port		= ocelot_netdev_to_port,
 };
 
-static struct vcap_props vsc7514_vcap_props[] = {
+static struct ocelot_vcap_props vsc7514_vcap_props[] = {
 	[VCAP_ES0] = {
 		.action_type_width = 0,
 		.action_table = {
diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h
index 9b4e6c78d0f4..42634183d062 100644
--- a/include/soc/mscc/ocelot.h
+++ b/include/soc/mscc/ocelot.h
@@ -727,7 +727,7 @@ struct ocelot {
 	struct list_head		dummy_rules;
 	struct ocelot_vcap_block	block[3];
 	struct ocelot_vcap_policer	vcap_pol;
-	struct vcap_props		*vcap;
+	struct ocelot_vcap_props	*vcap;
 	struct ocelot_mirror		*mirror;
 
 	struct ocelot_psfp_list		psfp;
diff --git a/include/soc/mscc/ocelot_vcap.h b/include/soc/mscc/ocelot_vcap.h
index 7b2bf9b1fe69..05bd73c63675 100644
--- a/include/soc/mscc/ocelot_vcap.h
+++ b/include/soc/mscc/ocelot_vcap.h
@@ -36,7 +36,7 @@ enum {
 
 #define OCELOT_NUM_VCAP_BLOCKS		__VCAP_COUNT
 
-struct vcap_props {
+struct ocelot_vcap_props {
 	u16 tg_width; /* Type-group width (in bits) */
 	u16 sw_count; /* Sub word count */
 	u16 entry_count; /* Entry count */
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ