Message ID | 1610292623-15564-19-git-send-email-stefanc@marvell.com (mailing list archive) |
---|---|
State | RFC |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: mvpp2: Add TX Flow Control support | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | fail | Series longer than 15 patches |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 5 of 5 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 13 this patch: 13 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 28 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 13 this patch: 13 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
On Sun, Jan 10, 2021 at 05:30:22PM +0200, stefanc@marvell.com wrote: > From: Stefan Chulski <stefanc@marvell.com> > > This patch add ring size validation before enabling FC. > 1. Flow control cannot be enabled if ring size is below start > threshold. > 2. Flow control disabled if ring size set below start > threshold. You should also tell phylink if pause is not supported, so it can change what is auto-negotiated, letting the link partner know. Andrew
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 06e1000..3607382 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -5372,6 +5372,15 @@ static int mvpp2_ethtool_set_ringparam(struct net_device *dev, if (err) return err; + if (ring->rx_pending < MSS_THRESHOLD_START && port->tx_fc) { + netdev_warn(dev, "TX FC disabled. Ring size is less than %d\n", + MSS_THRESHOLD_START); + port->tx_fc = false; + mvpp2_rxq_disable_fc(port); + if (port->priv->hw_version == MVPP23) + mvpp23_rx_fifo_fc_en(port->priv, port->id, false); + } + if (!netif_running(dev)) { port->rx_ring_size = ring->rx_pending; port->tx_ring_size = ring->tx_pending; @@ -5439,6 +5448,13 @@ static int mvpp2_ethtool_set_pause_param(struct net_device *dev, if (pause->tx_pause && port->priv->global_tx_fc && bm_underrun_protect) { + if (port->rx_ring_size < MSS_THRESHOLD_START) { + netdev_err(dev, "TX FC cannot be supported."); + netdev_err(dev, "Ring size is less than %d\n", + MSS_THRESHOLD_START); + return -EINVAL; + } + port->tx_fc = true; mvpp2_rxq_enable_fc(port); if (port->priv->percpu_pools) {