netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, andrew@lunn.ch,
	vivien.didelot@savoirfairelinux.com,
	Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH net-next v3 11/12] net: dsa: bcm_sf2: Use SF2_NUM_EGRESS_QUEUES for CFP
Date: Tue, 19 Sep 2017 10:46:53 -0700	[thread overview]
Message-ID: <20170919174654.2122-12-f.fainelli@gmail.com> (raw)
In-Reply-To: <20170919174654.2122-1-f.fainelli@gmail.com>

The magic number 8 in 3 locations in bcm_sf2_cfp.c actually designates
the number of switch port egress queues, so use that define instead of
open-coding it.

Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/dsa/bcm_sf2_cfp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/dsa/bcm_sf2_cfp.c b/drivers/net/dsa/bcm_sf2_cfp.c
index 8a1da7e67707..94649e1481ec 100644
--- a/drivers/net/dsa/bcm_sf2_cfp.c
+++ b/drivers/net/dsa/bcm_sf2_cfp.c
@@ -144,7 +144,7 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,
 	 * destination port is enabled and that we are within the
 	 * number of ports supported by the switch
 	 */
-	port_num = fs->ring_cookie / 8;
+	port_num = fs->ring_cookie / SF2_NUM_EGRESS_QUEUES;
 
 	if (fs->ring_cookie == RX_CLS_FLOW_DISC ||
 	    !(BIT(port_num) & ds->enabled_port_mask) ||
@@ -280,7 +280,7 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,
 	 * We have a small oddity where Port 6 just does not have a
 	 * valid bit here (so we subtract by one).
 	 */
-	queue_num = fs->ring_cookie % 8;
+	queue_num = fs->ring_cookie % SF2_NUM_EGRESS_QUEUES;
 	if (port_num >= 7)
 		port_num -= 1;
 
@@ -401,7 +401,7 @@ static int bcm_sf2_cfp_rule_get(struct bcm_sf2_priv *priv, int port,
 	/* There is no Port 6, so we compensate for that here */
 	if (nfc->fs.ring_cookie >= 6)
 		nfc->fs.ring_cookie++;
-	nfc->fs.ring_cookie *= 8;
+	nfc->fs.ring_cookie *= SF2_NUM_EGRESS_QUEUES;
 
 	/* Extract the destination queue */
 	queue_num = (reg >> NEW_TC_SHIFT) & NEW_TC_MASK;
-- 
2.9.3

  parent reply	other threads:[~2017-09-19 17:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19 17:46 [PATCH net-next v3 00/12] net: dsa: b53/bcm_sf2 cleanups Florian Fainelli
2017-09-19 17:46 ` [PATCH net-next v3 01/12] net: dsa: b53: Remove is_cpu_port() Florian Fainelli
2017-09-19 17:46 ` [PATCH net-next v3 02/12] net: dsa: b53: Make b53_enable_cpu_port() take a port argument Florian Fainelli
2017-09-19 17:46 ` [PATCH net-next v3 03/12] net: dsa: b53: Defer port enabling to calling port_enable Florian Fainelli
2017-09-19 17:46 ` [PATCH net-next v3 04/12] net: dsa: bcm_sf2: " Florian Fainelli
2017-09-19 17:46 ` [PATCH net-next v3 05/12] net: dsa: b53: Use a macro to define I/O operations Florian Fainelli
2017-09-19 17:46 ` [PATCH net-next v3 06/12] net: dsa: b53: Move Broadcom header setup to b53 Florian Fainelli
2017-09-19 17:46 ` [PATCH net-next v3 07/12] net: dsa: b53: Define EEE register page Florian Fainelli
2017-09-19 17:46 ` [PATCH net-next v3 08/12] net: dsa: b53: Move EEE functions to b53 Florian Fainelli
2017-09-19 17:46 ` [PATCH net-next v3 09/12] net: dsa: b53: Wire-up EEE Florian Fainelli
2017-09-19 17:46 ` [PATCH net-next v3 10/12] net: dsa: b53: Export b53_imp_vlan_setup() Florian Fainelli
2017-09-19 17:46 ` Florian Fainelli [this message]
2017-09-19 17:46 ` [PATCH net-next v3 12/12] net: dsa: bcm_sf2: Utilize b53_{enable,disable}_port Florian Fainelli
2017-09-19 23:09 ` [PATCH net-next v3 00/12] net: dsa: b53/bcm_sf2 cleanups 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=20170919174654.2122-12-f.fainelli@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.com \
    /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;
as well as URLs for NNTP newsgroup(s).