netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next 10/12] bnxt_en: Add interrupt test to ethtool -t selftest.
Date: Tue,  4 Apr 2017 18:14:15 -0400	[thread overview]
Message-ID: <1491344057-12663-11-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1491344057-12663-1-git-send-email-michael.chan@broadcom.com>

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 32 ++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index dde3e21..848ecf2 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -2178,6 +2178,29 @@ static int bnxt_set_phys_id(struct net_device *dev,
 	return rc;
 }
 
+static int bnxt_hwrm_selftest_irq(struct bnxt *bp, u16 cmpl_ring)
+{
+	struct hwrm_selftest_irq_input req = {0};
+
+	bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_SELFTEST_IRQ, cmpl_ring, -1);
+	return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
+}
+
+static int bnxt_test_irq(struct bnxt *bp)
+{
+	int i;
+
+	for (i = 0; i < bp->cp_nr_rings; i++) {
+		u16 cmpl_ring = bp->grp_info[i].cp_fw_ring_id;
+		int rc;
+
+		rc = bnxt_hwrm_selftest_irq(bp, cmpl_ring);
+		if (rc)
+			return rc;
+	}
+	return 0;
+}
+
 static int bnxt_hwrm_mac_loopback(struct bnxt *bp, bool enable)
 {
 	struct hwrm_port_mac_cfg_input req = {0};
@@ -2366,9 +2389,10 @@ static int bnxt_run_fw_tests(struct bnxt *bp, u8 test_mask, u8 *test_results)
 	return rc;
 }
 
-#define BNXT_DRV_TESTS			2
+#define BNXT_DRV_TESTS			3
 #define BNXT_MACLPBK_TEST_IDX		(bp->num_tests - BNXT_DRV_TESTS)
 #define BNXT_PHYLPBK_TEST_IDX		(BNXT_MACLPBK_TEST_IDX + 1)
+#define BNXT_IRQ_TEST_IDX		(BNXT_MACLPBK_TEST_IDX + 2)
 
 static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest,
 			   u64 *buf)
@@ -2437,6 +2461,10 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest,
 		bnxt_half_close_nic(bp);
 		bnxt_open_nic(bp, false, true);
 	}
+	if (bnxt_test_irq(bp)) {
+		buf[BNXT_IRQ_TEST_IDX] = 1;
+		etest->flags |= ETH_TEST_FL_FAILED;
+	}
 	for (i = 0; i < bp->num_tests - BNXT_DRV_TESTS; i++) {
 		u8 bit_val = 1 << i;
 
@@ -2484,6 +2512,8 @@ void bnxt_ethtool_init(struct bnxt *bp)
 			strcpy(str, "Mac loopback test (offline)");
 		} else if (i == BNXT_PHYLPBK_TEST_IDX) {
 			strcpy(str, "Phy loopback test (offline)");
+		} else if (i == BNXT_IRQ_TEST_IDX) {
+			strcpy(str, "Interrupt_test (offline)");
 		} else {
 			strlcpy(str, fw_str, ETH_GSTRING_LEN);
 			strncat(str, " test", ETH_GSTRING_LEN - strlen(str));
-- 
1.8.3.1

  parent reply	other threads:[~2017-04-04 22:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 22:14 [PATCH net-next 00/12] bnxt_en: Updates for net-next Michael Chan
2017-04-04 22:14 ` [PATCH net-next 01/12] bnxt_en: Update firmware interface spec to 1.7.6.2 Michael Chan
2017-04-04 22:14 ` [PATCH net-next 02/12] bnxt_en: Add basic WoL infrastructure Michael Chan
2017-04-04 22:14 ` [PATCH net-next 03/12] bnxt_en: Add pci shutdown method Michael Chan
2017-04-04 22:14 ` [PATCH net-next 04/12] bnxt_en: Add ethtool get_wol method Michael Chan
2017-04-04 22:14 ` [PATCH net-next 05/12] bnxt_en: Add ethtool set_wol method Michael Chan
2017-04-04 22:14 ` [PATCH net-next 06/12] bnxt_en: Add suspend/resume callbacks Michael Chan
2017-04-04 22:14 ` [PATCH net-next 07/12] bnxt_en: Add basic ethtool -t selftest support Michael Chan
2017-04-04 22:14 ` [PATCH net-next 08/12] bnxt_en: Add ethtool mac loopback self test Michael Chan
2017-04-04 22:14 ` [PATCH net-next 09/12] bnxt_en: Add PHY loopback to ethtool self-test Michael Chan
2017-04-04 22:14 ` Michael Chan [this message]
2017-04-04 22:14 ` [PATCH net-next 11/12] bnxt_en: Use short TX BDs for the XDP TX ring Michael Chan
2017-04-04 22:14 ` [PATCH net-next 12/12] bnxt_en: Cap the msix vector with the max completion rings Michael Chan
2017-04-05 13:24 ` [PATCH net-next 00/12] bnxt_en: Updates for net-next 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=1491344057-12663-11-git-send-email-michael.chan@broadcom.com \
    --to=michael.chan@broadcom.com \
    --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).