Skip to content

Commit 3a616b9

Browse files
stefanchulskidavem330
authored andcommitted
net: mvpp2: Add TX flow control support for jumbo frames
With MTU less than 1500B on all ports, the driver uses per CPU pool mode. If one of the ports set to jumbo frame MTU size, all ports move to shared pools mode. Here, buffer manager TX Flow Control reconfigured on all ports. Signed-off-by: Stefan Chulski <stefanc@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 7c29451 commit 3a616b9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,25 @@ static void mvpp2_bm_pool_update_fc(struct mvpp2_port *port,
924924
spin_unlock_irqrestore(&port->priv->mss_spinlock, flags);
925925
}
926926

927+
/* disable/enable flow control for BM pool on all ports */
928+
static void mvpp2_bm_pool_update_priv_fc(struct mvpp2 *priv, bool en)
929+
{
930+
struct mvpp2_port *port;
931+
int i;
932+
933+
for (i = 0; i < priv->port_count; i++) {
934+
port = priv->port_list[i];
935+
if (port->priv->percpu_pools) {
936+
for (i = 0; i < port->nrxqs; i++)
937+
mvpp2_bm_pool_update_fc(port, &port->priv->bm_pools[i],
938+
port->tx_fc & en);
939+
} else {
940+
mvpp2_bm_pool_update_fc(port, port->pool_long, port->tx_fc & en);
941+
mvpp2_bm_pool_update_fc(port, port->pool_short, port->tx_fc & en);
942+
}
943+
}
944+
}
945+
927946
static int mvpp2_enable_global_fc(struct mvpp2 *priv)
928947
{
929948
int val, timeout = 0;
@@ -4913,6 +4932,7 @@ static int mvpp2_set_mac_address(struct net_device *dev, void *p)
49134932
*/
49144933
static int mvpp2_bm_switch_buffers(struct mvpp2 *priv, bool percpu)
49154934
{
4935+
bool change_percpu = (percpu != priv->percpu_pools);
49164936
int numbufs = MVPP2_BM_POOLS_NUM, i;
49174937
struct mvpp2_port *port = NULL;
49184938
bool status[MVPP2_MAX_PORTS];
@@ -4928,6 +4948,9 @@ static int mvpp2_bm_switch_buffers(struct mvpp2 *priv, bool percpu)
49284948
if (priv->percpu_pools)
49294949
numbufs = port->nrxqs * 2;
49304950

4951+
if (change_percpu)
4952+
mvpp2_bm_pool_update_priv_fc(priv, false);
4953+
49314954
for (i = 0; i < numbufs; i++)
49324955
mvpp2_bm_pool_destroy(port->dev->dev.parent, priv, &priv->bm_pools[i]);
49334956

@@ -4942,6 +4965,9 @@ static int mvpp2_bm_switch_buffers(struct mvpp2 *priv, bool percpu)
49424965
mvpp2_open(port->dev);
49434966
}
49444967

4968+
if (change_percpu)
4969+
mvpp2_bm_pool_update_priv_fc(priv, true);
4970+
49454971
return 0;
49464972
}
49474973

0 commit comments

Comments
 (0)