Skip to content

Commit 152b6fd

Browse files
ffainellidavem330
authored andcommitted
net: dsa: bcm_sf2: Use SF2_NUM_EGRESS_QUEUES for CFP
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> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent aac0286 commit 152b6fd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/net/dsa/bcm_sf2_cfp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,
144144
* destination port is enabled and that we are within the
145145
* number of ports supported by the switch
146146
*/
147-
port_num = fs->ring_cookie / 8;
147+
port_num = fs->ring_cookie / SF2_NUM_EGRESS_QUEUES;
148148

149149
if (fs->ring_cookie == RX_CLS_FLOW_DISC ||
150150
!(BIT(port_num) & ds->enabled_port_mask) ||
@@ -280,7 +280,7 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,
280280
* We have a small oddity where Port 6 just does not have a
281281
* valid bit here (so we subtract by one).
282282
*/
283-
queue_num = fs->ring_cookie % 8;
283+
queue_num = fs->ring_cookie % SF2_NUM_EGRESS_QUEUES;
284284
if (port_num >= 7)
285285
port_num -= 1;
286286

@@ -401,7 +401,7 @@ static int bcm_sf2_cfp_rule_get(struct bcm_sf2_priv *priv, int port,
401401
/* There is no Port 6, so we compensate for that here */
402402
if (nfc->fs.ring_cookie >= 6)
403403
nfc->fs.ring_cookie++;
404-
nfc->fs.ring_cookie *= 8;
404+
nfc->fs.ring_cookie *= SF2_NUM_EGRESS_QUEUES;
405405

406406
/* Extract the destination queue */
407407
queue_num = (reg >> NEW_TC_SHIFT) & NEW_TC_MASK;

0 commit comments

Comments
 (0)