Skip to content

Commit e8e6e73

Browse files
vladimirolteandavem330
authored andcommitted
net: mscc: ocelot: split writes to pause frame enable bit and to thresholds
We don't want ocelot_port_set_maxlen to enable pause frame TX, just to adjust the pause thresholds. Move the unconditional enabling of pause TX to ocelot_init_port. There is no good place to put such setting because it shouldn't be unconditional. But at the moment it is, we're not changing that. Signed-off-by: Vladimir Oltean <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 67c2404 commit e8e6e73

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

drivers/net/ethernet/mscc/ocelot.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,7 @@ void ocelot_port_set_maxlen(struct ocelot *ocelot, int port, size_t sdu)
12591259
{
12601260
struct ocelot_port *ocelot_port = ocelot->ports[port];
12611261
int maxlen = sdu + ETH_HLEN + ETH_FCS_LEN;
1262+
int pause_start, pause_stop;
12621263
int atop_wm;
12631264

12641265
if (port == ocelot->npi) {
@@ -1272,13 +1273,13 @@ void ocelot_port_set_maxlen(struct ocelot *ocelot, int port, size_t sdu)
12721273

12731274
ocelot_port_writel(ocelot_port, maxlen, DEV_MAC_MAXLEN_CFG);
12741275

1275-
/* Set Pause WM hysteresis
1276-
* 152 = 6 * maxlen / OCELOT_BUFFER_CELL_SZ
1277-
* 101 = 4 * maxlen / OCELOT_BUFFER_CELL_SZ
1278-
*/
1279-
ocelot_write_rix(ocelot, SYS_PAUSE_CFG_PAUSE_ENA |
1280-
SYS_PAUSE_CFG_PAUSE_STOP(101) |
1281-
SYS_PAUSE_CFG_PAUSE_START(152), SYS_PAUSE_CFG, port);
1276+
/* Set Pause watermark hysteresis */
1277+
pause_start = 6 * maxlen / OCELOT_BUFFER_CELL_SZ;
1278+
pause_stop = 4 * maxlen / OCELOT_BUFFER_CELL_SZ;
1279+
ocelot_rmw_rix(ocelot, SYS_PAUSE_CFG_PAUSE_START(pause_start),
1280+
SYS_PAUSE_CFG_PAUSE_START_M, SYS_PAUSE_CFG, port);
1281+
ocelot_rmw_rix(ocelot, SYS_PAUSE_CFG_PAUSE_STOP(pause_stop),
1282+
SYS_PAUSE_CFG_PAUSE_STOP_M, SYS_PAUSE_CFG, port);
12821283

12831284
/* Tail dropping watermark */
12841285
atop_wm = (ocelot->shared_queue_sz - 9 * maxlen) /
@@ -1341,6 +1342,10 @@ void ocelot_init_port(struct ocelot *ocelot, int port)
13411342
ocelot_port_writel(ocelot_port, 0, DEV_MAC_FC_MAC_HIGH_CFG);
13421343
ocelot_port_writel(ocelot_port, 0, DEV_MAC_FC_MAC_LOW_CFG);
13431344

1345+
/* Enable transmission of pause frames */
1346+
ocelot_rmw_rix(ocelot, SYS_PAUSE_CFG_PAUSE_ENA, SYS_PAUSE_CFG_PAUSE_ENA,
1347+
SYS_PAUSE_CFG, port);
1348+
13441349
/* Drop frames with multicast source address */
13451350
ocelot_rmw_gix(ocelot, ANA_PORT_DROP_CFG_DROP_MC_SMAC_ENA,
13461351
ANA_PORT_DROP_CFG_DROP_MC_SMAC_ENA,

0 commit comments

Comments
 (0)