All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Russkikh <irusskikh@marvell.com>
To: <netdev@vger.kernel.org>
Cc: "David S . Miller" <davem@davemloft.net>,
	Ariel Elior <aelior@marvell.com>,
	Michal Kalderon <mkalderon@marvell.com>,
	Denis Bolotin <dbolotin@marvell.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Igor Russkikh <irusskikh@marvell.com>,
	Ariel Elior <ariel.elior@marvell.com>,
	"Michal Kalderon" <michal.kalderon@marvell.com>
Subject: [PATCH v2 net-next 07/11] net: qede: optional hw recovery procedure
Date: Thu, 14 May 2020 12:57:23 +0300	[thread overview]
Message-ID: <20200514095727.1361-8-irusskikh@marvell.com> (raw)
In-Reply-To: <20200514095727.1361-1-irusskikh@marvell.com>

Driver has an ability to initiate a recovery process as a reaction to
detected errors. But the codepath (recovery_process) was disabled and
never active.

Here we add ethtool private flag to allow user have the recovery
procedure activated.

We still do not enable this by default though, since in some configurations
this is not desirable. E.g. this may impact other PFs/VFs.

Signed-off-by: Ariel Elior <ariel.elior@marvell.com>
Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
---
 .../net/ethernet/qlogic/qede/qede_ethtool.c   | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
index 812c7766e096..24cc68391ac4 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
@@ -190,12 +190,14 @@ static const struct {
 enum {
 	QEDE_PRI_FLAG_CMT,
 	QEDE_PRI_FLAG_SMART_AN_SUPPORT, /* MFW supports SmartAN */
+	QEDE_PRI_FLAG_RECOVER_ON_ERROR,
 	QEDE_PRI_FLAG_LEN,
 };
 
 static const char qede_private_arr[QEDE_PRI_FLAG_LEN][ETH_GSTRING_LEN] = {
 	"Coupled-Function",
 	"SmartAN capable",
+	"Recover on error",
 };
 
 enum qede_ethtool_tests {
@@ -417,9 +419,30 @@ static u32 qede_get_priv_flags(struct net_device *dev)
 	if (edev->dev_info.common.smart_an)
 		flags |= BIT(QEDE_PRI_FLAG_SMART_AN_SUPPORT);
 
+	if (edev->err_flags & BIT(QEDE_ERR_IS_RECOVERABLE))
+		flags |= BIT(QEDE_PRI_FLAG_RECOVER_ON_ERROR);
+
 	return flags;
 }
 
+static int qede_set_priv_flags(struct net_device *dev, u32 flags)
+{
+	struct qede_dev *edev = netdev_priv(dev);
+	u32 cflags = qede_get_priv_flags(dev);
+	u32 dflags = flags ^ cflags;
+
+	/* can only change RECOVER_ON_ERROR flag */
+	if (dflags & ~BIT(QEDE_PRI_FLAG_RECOVER_ON_ERROR))
+		return -EINVAL;
+
+	if (flags & BIT(QEDE_PRI_FLAG_RECOVER_ON_ERROR))
+		set_bit(QEDE_ERR_IS_RECOVERABLE, &edev->err_flags);
+	else
+		clear_bit(QEDE_ERR_IS_RECOVERABLE, &edev->err_flags);
+
+	return 0;
+}
+
 struct qede_link_mode_mapping {
 	u32 qed_link_mode;
 	u32 ethtool_link_mode;
@@ -2098,6 +2121,7 @@ static const struct ethtool_ops qede_ethtool_ops = {
 	.set_phys_id = qede_set_phys_id,
 	.get_ethtool_stats = qede_get_ethtool_stats,
 	.get_priv_flags = qede_get_priv_flags,
+	.set_priv_flags = qede_set_priv_flags,
 	.get_sset_count = qede_get_sset_count,
 	.get_rxnfc = qede_get_rxnfc,
 	.set_rxnfc = qede_set_rxnfc,
-- 
2.17.1


  parent reply	other threads:[~2020-05-14  9:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14  9:57 [PATCH v2 net-next 00/11] net: qed/qede: critical hw error handling Igor Russkikh
2020-05-14  9:57 ` [PATCH v2 net-next 01/11] net: qed: adding hw_err states and handling Igor Russkikh
2020-05-14  9:57 ` [PATCH v2 net-next 02/11] net: qede: add hw err scheduled handler Igor Russkikh
2020-05-14  9:57 ` [PATCH v2 net-next 03/11] net: qed: invoke err notify on critical areas Igor Russkikh
2020-05-14  9:57 ` [PATCH v2 net-next 04/11] net: qed: critical err reporting to management firmware Igor Russkikh
2020-05-14  9:57 ` [PATCH v2 net-next 05/11] net: qed: cleanup debug related declarations Igor Russkikh
2020-05-14  9:57 ` [PATCH v2 net-next 06/11] net: qed: attention clearing properties Igor Russkikh
2020-05-14  9:57 ` Igor Russkikh [this message]
2020-05-14  9:57 ` [PATCH v2 net-next 08/11] net: qede: Implement ndo_tx_timeout Igor Russkikh
2020-05-14  9:57 ` [PATCH v2 net-next 09/11] net: qed: introduce critical fan failure handler Igor Russkikh
2020-05-14  9:57 ` [PATCH v2 net-next 10/11] net: qed: introduce critical hardware error handler Igor Russkikh
2020-05-14  9:57 ` [PATCH v2 net-next 11/11] net: qed: fix bad formatting Igor Russkikh
2020-05-14 19:06 ` [PATCH v2 net-next 00/11] net: qed/qede: critical hw error handling Jakub Kicinski
2020-05-14 19:40   ` [EXT] " Igor Russkikh
2020-05-14 20:02     ` Jakub Kicinski
2020-05-14 20:09       ` Igor Russkikh
2020-05-14 20:01 ` David Miller
2020-05-14 20:09   ` David Miller
2020-05-14 20:22     ` David Miller

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=20200514095727.1361-8-irusskikh@marvell.com \
    --to=irusskikh@marvell.com \
    --cc=aelior@marvell.com \
    --cc=ariel.elior@marvell.com \
    --cc=davem@davemloft.net \
    --cc=dbolotin@marvell.com \
    --cc=kuba@kernel.org \
    --cc=michal.kalderon@marvell.com \
    --cc=mkalderon@marvell.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.