--- v13
+++ v11
@@ -11,11 +11,10 @@
Supported only in PPv23.
Signed-off-by: Stefan Chulski <stefanc@marvell.com>
-Acked-by: Marcin Wojtas <mw@semihalf.com>
---
- drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 8 ++++++
- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 26 ++++++++++++++++++++
- 2 files changed, 34 insertions(+)
+ drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 8 +++++
+ drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 35 +++++++++++++++++++-
+ 2 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
index 0731dc7..9b525b60 100644
@@ -44,10 +43,22 @@
#define MVPP2_CTRS_IDX 0x7040
#define MVPP22_CTRS_TX_CTR(port, txq) ((txq) | ((port) << 3) | BIT(7))
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
-index 90c9265..9226d2f 100644
+index 90c9265..3faad04 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
-@@ -423,6 +423,19 @@ static int mvpp2_bm_pool_create(struct device *dev, struct mvpp2 *priv,
+@@ -69,6 +69,11 @@ enum mvpp2_bm_pool_log_num {
+ module_param(queue_mode, int, 0444);
+ MODULE_PARM_DESC(queue_mode, "Set queue_mode (single=0, multi=1)");
+
++static int bm_underrun_protect = 1;
++
++module_param(bm_underrun_protect, int, 0444);
++MODULE_PARM_DESC(bm_underrun_protect, "Set BM underrun protect feature (0-1), def=1");
++
+ /* Utility/helper methods */
+
+ void mvpp2_write(struct mvpp2 *priv, u32 offset, u32 data)
+@@ -423,6 +428,21 @@ static int mvpp2_bm_pool_create(struct device *dev, struct mvpp2 *priv,
val = mvpp2_read(priv, MVPP2_BM_POOL_CTRL_REG(bm_pool->id));
val |= MVPP2_BM_START_MASK;
@@ -55,8 +66,10 @@
+ val &= ~MVPP2_BM_LOW_THRESH_MASK;
+ val &= ~MVPP2_BM_HIGH_THRESH_MASK;
+
-+ /* Set 8 Pools BPPI threshold for MVPP23 */
-+ if (priv->hw_version == MVPP23) {
++ /* Set 8 Pools BPPI threshold if BM underrun protection feature
++ * was enabled
++ */
++ if (priv->hw_version == MVPP23 && bm_underrun_protect) {
+ val |= MVPP2_BM_LOW_THRESH_VALUE(MVPP23_BM_BPPI_LOW_THRESH);
+ val |= MVPP2_BM_HIGH_THRESH_VALUE(MVPP23_BM_BPPI_HIGH_THRESH);
+ } else {
@@ -67,7 +80,7 @@
mvpp2_write(priv, MVPP2_BM_POOL_CTRL_REG(bm_pool->id), val);
bm_pool->size = size;
-@@ -591,6 +604,16 @@ static int mvpp2_bm_pools_init(struct device *dev, struct mvpp2 *priv)
+@@ -591,6 +611,16 @@ static int mvpp2_bm_pools_init(struct device *dev, struct mvpp2 *priv)
return err;
}
@@ -84,16 +97,25 @@
static int mvpp2_bm_init(struct device *dev, struct mvpp2 *priv)
{
enum dma_data_direction dma_dir = DMA_FROM_DEVICE;
-@@ -644,6 +667,9 @@ static int mvpp2_bm_init(struct device *dev, struct mvpp2 *priv)
+@@ -644,6 +674,9 @@ static int mvpp2_bm_init(struct device *dev, struct mvpp2 *priv)
if (!priv->bm_pools)
return -ENOMEM;
-+ if (priv->hw_version == MVPP23)
++ if (priv->hw_version == MVPP23 && bm_underrun_protect)
+ mvpp23_bm_set_8pool_mode(priv);
+
err = mvpp2_bm_pools_init(dev, priv);
if (err < 0)
return err;
+@@ -6490,7 +6523,7 @@ static void mvpp2_mac_link_up(struct phylink_config *config,
+ val);
+ }
+
+- if (port->priv->global_tx_fc) {
++ if (port->priv->global_tx_fc && bm_underrun_protect) {
+ port->tx_fc = tx_pause;
+ if (tx_pause)
+ mvpp2_rxq_enable_fc(port);
--
1.9.1