Skip to contentSkip to conversation

Patch "net: dsa: bcm_sf2: Fix number of CFP entries for BCM7278" has been added to the 4.12-stable tree

PATCH [email protected] 1 participant 1 message Sep 15, 2017

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

net: dsa: bcm_sf2: Fix number of CFP entries for BCM7278

to the 4.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:

     net-dsa-bcm_sf2-fix-number-of-cfp-entries-for-bcm7278.patch

and it can be found in the queue-4.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Thu Sep 14 23:20:23 PDT 2017

From: Florian Fainelli <[email protected]>
Date: Wed, 30 Aug 2017 12:39:33 -0700
Subject: net: dsa: bcm_sf2: Fix number of CFP entries for BCM7278

From: Florian Fainelli <[email protected]>

[ Upstream commit df191632f814357ee4d646421662d866028b569d ]

BCM7278 has only 128 entries while BCM7445 has the full 256 entries set, fix that.

Fixes 7318166cacad ("net: dsa: bcm_sf2: Add support for ethtool::rxnfc")
---
 drivers/net/dsa/bcm_sf2.c     |    4 ++++
 drivers/net/dsa/bcm_sf2.h     |    1 +
 drivers/net/dsa/bcm_sf2_cfp.c |    8 ++++----
 3 files changed, 9 insertions(+), 4 deletions(-)
drivers/net/dsa/bcm_sf2.c +4 -0
@@ -1055,6 +1055,7 @@ struct bcm_sf2_of_data {
 	u32 type;
 	const u16 *reg_offsets;
 	unsigned int core_reg_align;
+	unsigned int num_cfp_rules;
 };
 
 /* Register offsets for the SWITCH_REG_* block */
@@ -1078,6 +1079,7 @@ static const struct bcm_sf2_of_data bcm_
 	.type		= BCM7445_DEVICE_ID,
 	.core_reg_align	= 0,
 	.reg_offsets	= bcm_sf2_7445_reg_offsets,
+	.num_cfp_rules	= 256,
 };
 
 static const u16 bcm_sf2_7278_reg_offsets[] = {
@@ -1100,6 +1102,7 @@ static const struct bcm_sf2_of_data bcm_
 	.type		= BCM7278_DEVICE_ID,
 	.core_reg_align	= 1,
 	.reg_offsets	= bcm_sf2_7278_reg_offsets,
+	.num_cfp_rules	= 128,
 };
 
 static const struct of_device_id bcm_sf2_of_match[] = {
@@ -1156,6 +1159,7 @@ static int bcm_sf2_sw_probe(struct platf
 	priv->type = data->type;
 	priv->reg_offsets = data->reg_offsets;
 	priv->core_reg_align = data->core_reg_align;
+	priv->num_cfp_rules = data->num_cfp_rules;
 
 	/* Auto-detection using standard registers will not work, so
 	 * provide an indication of what kind of device we are for
drivers/net/dsa/bcm_sf2.h +1 -0
@@ -72,6 +72,7 @@ struct bcm_sf2_priv {
 	u32 				type;
 	const u16			*reg_offsets;
 	unsigned int			core_reg_align;
+	unsigned int			num_cfp_rules;
 
 	/* spinlock protecting access to the indirect registers */
 	spinlock_t			indir_lock;
drivers/net/dsa/bcm_sf2_cfp.c +4 -4
@@ -98,7 +98,7 @@ static inline void bcm_sf2_cfp_rule_addr
 {
 	u32 reg;
 
-	WARN_ON(addr >= CFP_NUM_RULES);
+	WARN_ON(addr >= priv->num_cfp_rules);
 
 	reg = core_readl(priv, CORE_CFP_ACC);
 	reg &= ~(XCESS_ADDR_MASK << XCESS_ADDR_SHIFT);
@@ -109,7 +109,7 @@ static inline void bcm_sf2_cfp_rule_addr
 static inline unsigned int bcm_sf2_cfp_rule_size(struct bcm_sf2_priv *priv)
 {
 	/* Entry #0 is reserved */
-	return CFP_NUM_RULES - 1;
+	return priv->num_cfp_rules - 1;
 }
 
 static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,
@@ -523,7 +523,7 @@ static int bcm_sf2_cfp_rule_get_all(stru
 		if (!(reg & OP_STR_DONE))
 			break;
 
-	} while (index < CFP_NUM_RULES);
+	} while (index < priv->num_cfp_rules);
 
 	/* Put the TCAM size here */
 	nfc->data = bcm_sf2_cfp_rule_size(priv);
@@ -544,7 +544,7 @@ int bcm_sf2_get_rxnfc(struct dsa_switch
 	case ETHTOOL_GRXCLSRLCNT:
 		/* Subtract the default, unusable rule */
 		nfc->rule_cnt = bitmap_weight(priv->cfp.used,
-					      CFP_NUM_RULES) - 1;
+					      priv->num_cfp_rules) - 1;
 		/* We support specifying rule locations */
 		nfc->data |= RX_CLS_LOC_SPECIAL;
 		break;

Patches currently in stable-queue which might be from [email protected] are

queue-4.12/net-systemport-be-drop-monitor-friendly.patch queue-4.12/net-bcmgenet-be-drop-monitor-friendly.patch queue-4.12/net-dsa-bcm_sf2-fix-number-of-cfp-entries-for-bcm7278.patch queue-4.12/net-systemport-free-dma-coherent-descriptors-on-errors.patch queue-4.12/fsl-man-inherit-parent-device-and-of_node.patch queue-4.12/revert-net-phy-correctly-process-phy_halted-in-phy_stop_machine.patch