netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shannon Nelson <snelson@pensando.io>
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: Shannon Nelson <snelson@pensando.io>
Subject: [PATCH net-next 2/4] ionic: recover from ringsize change failure
Date: Fri, 24 Jul 2020 17:23:24 -0700	[thread overview]
Message-ID: <20200725002326.41407-3-snelson@pensando.io> (raw)
In-Reply-To: <20200725002326.41407-1-snelson@pensando.io>

If the ringsize change fails, try restoring the previous setting.

Signed-off-by: Shannon Nelson <snelson@pensando.io>
---
 .../ethernet/pensando/ionic/ionic_ethtool.c   | 23 ++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
index e03ea9b18f95..b48f0e46584b 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
@@ -480,6 +480,8 @@ static int ionic_set_ringparam(struct net_device *netdev,
 			       struct ethtool_ringparam *ring)
 {
 	struct ionic_lif *lif = netdev_priv(netdev);
+	int tx_start, rx_start;
+	int err;
 
 	if (ring->rx_mini_pending || ring->rx_jumbo_pending) {
 		netdev_info(netdev, "Changing jumbo or mini descriptors not supported\n");
@@ -497,7 +499,26 @@ static int ionic_set_ringparam(struct net_device *netdev,
 	    ring->rx_pending == lif->nrxq_descs)
 		return 0;
 
-	return ionic_reset_queues(lif, ionic_set_ringsize, ring);
+	tx_start = lif->ntxq_descs;
+	rx_start = lif->nrxq_descs;
+
+	err = ionic_reset_queues(lif, ionic_set_ringsize, ring);
+
+	if (err) {
+		int my_err;
+
+		netdev_warn(netdev, "Ringsize change failed, restoring ring sizes\n");
+		ring->tx_pending = tx_start;
+		ring->rx_pending = rx_start;
+		my_err = ionic_reset_queues(lif, ionic_set_ringsize, ring);
+
+		if (my_err) {
+			netdev_err(netdev, "Ringsize restore failed\n");
+			err = my_err;
+		}
+	}
+
+	return err;
 }
 
 static void ionic_get_channels(struct net_device *netdev,
-- 
2.17.1


  parent reply	other threads:[~2020-07-25  0:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-25  0:23 [PATCH net-next 0/4] ionic txrx updates Shannon Nelson
2020-07-25  0:23 ` [PATCH net-next 1/4] ionic: use fewer firmware doorbells on rx fill Shannon Nelson
2020-07-25  0:23 ` Shannon Nelson [this message]
2020-07-25  2:44   ` [PATCH net-next 2/4] ionic: recover from ringsize change failure David Miller
2020-07-27 16:42     ` Shannon Nelson
2020-07-25  0:23 ` [PATCH net-next 3/4] ionic: tx separate servicing Shannon Nelson
2020-07-25  0:23 ` [PATCH net-next 4/4] ionic: separate interrupt for Tx and Rx Shannon Nelson
2020-07-25  0:56   ` Jakub Kicinski
2020-07-27 16:37     ` Shannon Nelson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200725002326.41407-3-snelson@pensando.io \
    --to=snelson@pensando.io \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).