Commit c88c5ed7 authored by David S. Miller's avatar David S. Miller

Merge branch 'Fix-tail-dropping-watermarks-for-Ocelot-switches'

Vladimir Oltean says:

====================
Fix tail dropping watermarks for Ocelot switches

This series adds a missing division by 60, and a warning to prevent that
in the future.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 082bb94f 01326493
...@@ -1171,6 +1171,8 @@ static int vsc9959_prevalidate_phy_mode(struct ocelot *ocelot, int port, ...@@ -1171,6 +1171,8 @@ static int vsc9959_prevalidate_phy_mode(struct ocelot *ocelot, int port,
*/ */
static u16 vsc9959_wm_enc(u16 value) static u16 vsc9959_wm_enc(u16 value)
{ {
WARN_ON(value >= 16 * BIT(8));
if (value >= BIT(8)) if (value >= BIT(8))
return BIT(8) | (value / 16); return BIT(8) | (value / 16);
......
...@@ -911,6 +911,8 @@ static int vsc9953_prevalidate_phy_mode(struct ocelot *ocelot, int port, ...@@ -911,6 +911,8 @@ static int vsc9953_prevalidate_phy_mode(struct ocelot *ocelot, int port,
*/ */
static u16 vsc9953_wm_enc(u16 value) static u16 vsc9953_wm_enc(u16 value)
{ {
WARN_ON(value >= 16 * BIT(9));
if (value >= BIT(9)) if (value >= BIT(9))
return BIT(9) | (value / 16); return BIT(9) | (value / 16);
......
...@@ -1253,7 +1253,7 @@ void ocelot_port_set_maxlen(struct ocelot *ocelot, int port, size_t sdu) ...@@ -1253,7 +1253,7 @@ void ocelot_port_set_maxlen(struct ocelot *ocelot, int port, size_t sdu)
struct ocelot_port *ocelot_port = ocelot->ports[port]; struct ocelot_port *ocelot_port = ocelot->ports[port];
int maxlen = sdu + ETH_HLEN + ETH_FCS_LEN; int maxlen = sdu + ETH_HLEN + ETH_FCS_LEN;
int pause_start, pause_stop; int pause_start, pause_stop;
int atop_wm; int atop, atop_tot;
if (port == ocelot->npi) { if (port == ocelot->npi) {
maxlen += OCELOT_TAG_LEN; maxlen += OCELOT_TAG_LEN;
...@@ -1274,12 +1274,12 @@ void ocelot_port_set_maxlen(struct ocelot *ocelot, int port, size_t sdu) ...@@ -1274,12 +1274,12 @@ void ocelot_port_set_maxlen(struct ocelot *ocelot, int port, size_t sdu)
ocelot_fields_write(ocelot, port, SYS_PAUSE_CFG_PAUSE_STOP, ocelot_fields_write(ocelot, port, SYS_PAUSE_CFG_PAUSE_STOP,
pause_stop); pause_stop);
/* Tail dropping watermark */ /* Tail dropping watermarks */
atop_wm = (ocelot->shared_queue_sz - 9 * maxlen) / atop_tot = (ocelot->shared_queue_sz - 9 * maxlen) /
OCELOT_BUFFER_CELL_SZ; OCELOT_BUFFER_CELL_SZ;
ocelot_write_rix(ocelot, ocelot->ops->wm_enc(9 * maxlen), atop = (9 * maxlen) / OCELOT_BUFFER_CELL_SZ;
SYS_ATOP, port); ocelot_write_rix(ocelot, ocelot->ops->wm_enc(atop), SYS_ATOP, port);
ocelot_write(ocelot, ocelot->ops->wm_enc(atop_wm), SYS_ATOP_TOT_CFG); ocelot_write(ocelot, ocelot->ops->wm_enc(atop_tot), SYS_ATOP_TOT_CFG);
} }
EXPORT_SYMBOL(ocelot_port_set_maxlen); EXPORT_SYMBOL(ocelot_port_set_maxlen);
......
...@@ -745,6 +745,8 @@ static int ocelot_reset(struct ocelot *ocelot) ...@@ -745,6 +745,8 @@ static int ocelot_reset(struct ocelot *ocelot)
*/ */
static u16 ocelot_wm_enc(u16 value) static u16 ocelot_wm_enc(u16 value)
{ {
WARN_ON(value >= 16 * BIT(8));
if (value >= BIT(8)) if (value >= BIT(8))
return BIT(8) | (value / 16); return BIT(8) | (value / 16);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment