Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Stefan Chulski and committed by
David S. Miller
3a616b92 7c294515

+26
+26
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
··· 924 924 spin_unlock_irqrestore(&port->priv->mss_spinlock, flags); 925 925 } 926 926 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 + 927 946 static int mvpp2_enable_global_fc(struct mvpp2 *priv) 928 947 { 929 948 int val, timeout = 0; ··· 4932 4913 */ 4933 4914 static int mvpp2_bm_switch_buffers(struct mvpp2 *priv, bool percpu) 4934 4915 { 4916 + bool change_percpu = (percpu != priv->percpu_pools); 4935 4917 int numbufs = MVPP2_BM_POOLS_NUM, i; 4936 4918 struct mvpp2_port *port = NULL; 4937 4919 bool status[MVPP2_MAX_PORTS]; ··· 4948 4928 if (priv->percpu_pools) 4949 4929 numbufs = port->nrxqs * 2; 4950 4930 4931 + if (change_percpu) 4932 + mvpp2_bm_pool_update_priv_fc(priv, false); 4933 + 4951 4934 for (i = 0; i < numbufs; i++) 4952 4935 mvpp2_bm_pool_destroy(port->dev->dev.parent, priv, &priv->bm_pools[i]); 4953 4936 ··· 4964 4941 if (status[i]) 4965 4942 mvpp2_open(port->dev); 4966 4943 } 4944 + 4945 + if (change_percpu) 4946 + mvpp2_bm_pool_update_priv_fc(priv, true); 4967 4947 4968 4948 return 0; 4969 4949 }