netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: davem@davemloft.net, Vitaly Lifshits <vitaly.lifshits@intel.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	kbuild test robot <lkp@intel.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Andre Guedes <andre.guedes@intel.com>,
	Aaron Brown <aaron.f.brown@intel.com>,
	Andrew Lunn <andrew@lunn.ch>
Subject: Re: [net-next 03/13] igc: add support to interrupt, eeprom, registers and link self-tests
Date: Tue, 21 Apr 2020 10:48:18 -0700	[thread overview]
Message-ID: <20200421104818.1e9cfa14@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <20200420234313.2184282-4-jeffrey.t.kirsher@intel.com>

On Mon, 20 Apr 2020 16:43:03 -0700 Jeff Kirsher wrote:
> +bool igc_intr_test(struct igc_adapter *adapter, u64 *data)
> +{
> +	struct igc_hw *hw = &adapter->hw;
> +	struct net_device *netdev = adapter->netdev;
> +	u32 mask, ics_mask = IGC_ICS_MASK_OTHER, i = 0, shared_int = true;
> +	u32 irq = adapter->pdev->irq;
> +
> +	*data = 0;
> +
> +	/* Hook up test interrupt handler just for this test */
> +	if (adapter->msix_entries) {
> +		if (request_irq(adapter->msix_entries[0].vector,
> +				&igc_test_intr_msix, 0,
> +				netdev->name, adapter)) {
> +			*data = 1;
> +			return false;
> +		}
> +		ics_mask = IGC_ICS_MASK_MSIX;
> +	} else if (adapter->flags & IGC_FLAG_HAS_MSI) {
> +		shared_int = false;
> +		if (request_irq(irq,
> +				igc_test_intr, 0, netdev->name, adapter)) {
> +			*data = 1;
> +			return false;
> +		}
> +	} else if (!request_irq(irq, igc_test_intr, IRQF_PROBE_SHARED,
> +				netdev->name, adapter)) {
> +		shared_int = false;
> +	} else if (request_irq(irq, &igc_test_intr, IRQF_SHARED,
> +		 netdev->name, adapter)) {
> +		*data = 1;
> +		return false;
> +	}

What's the meaning of shared_int here? Looks like MSI-Ss are shared but
not MSIs? Could you perhaps add a comment or rename so it's clear it's
not IRQF_SHARED we're talking about?

> +static void igc_diag_test(struct net_device *netdev,
> +			  struct ethtool_test *eth_test, u64 *data)
> +{
> +	struct igc_adapter *adapter = netdev_priv(netdev);
> +	bool if_running = netif_running(netdev);
> +
> +	if (eth_test->flags == ETH_TEST_FL_OFFLINE) {
> +		netdev_info(adapter->netdev, "offline testing starting");
> +		set_bit(__IGC_TESTING, &adapter->state);

> +	} else {
> +		netdev_info(adapter->netdev, "online testing starting");

I'm no expert on self-tests but this looks like a strange condition for
a bitfield. If only on bit is set we do offline, if no bit is set, or
offline and something else we do online?

Perhaps:

if (flags & OFFLINE) {
 ...
} else {
 ...
}

Or

if (flags == OFFLINE) {
 ...
} else if (flags == 0) {
 ...
}

Rather than the mix of the two?

> +		/* register, eeprom, intr and loopback tests not run online */
> +		data[TEST_REG] = 0;
> +		data[TEST_EEP] = 0;
> +		data[TEST_IRQ] = 0;
> +		data[TEST_LOOP] = 0;
> +
> +		if (!igc_link_test(adapter, &data[TEST_LINK]))
> +			eth_test->flags |= ETH_TEST_FL_FAILED;
> +	}
> +
> +	msleep_interruptible(4 * 1000);

Why?

> +}
> +

  reply	other threads:[~2020-04-21 17:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-20 23:43 [net-next 00/13][pull request] 1GbE Intel Wired LAN Driver Updates 2020-04-20 Jeff Kirsher
2020-04-20 23:43 ` [net-next 01/13] igc: Add ECN support for TSO Jeff Kirsher
2020-04-20 23:43 ` [net-next 02/13] igc: Use netdev log helpers in igc_main.c Jeff Kirsher
2020-04-21 17:39   ` Jakub Kicinski
2020-04-21 19:26   ` David Miller
2020-04-21 21:09     ` Andre Guedes
2020-04-21 22:32       ` David Miller
2020-04-21 22:48         ` Andre Guedes
2020-04-20 23:43 ` [net-next 03/13] igc: add support to interrupt, eeprom, registers and link self-tests Jeff Kirsher
2020-04-21 17:48   ` Jakub Kicinski [this message]
2020-04-20 23:43 ` [net-next 04/13] igc: Use netdev log helpers in igc_ethtool.c Jeff Kirsher
2020-04-20 23:43 ` [net-next 05/13] igc: Use netdev log helpers in igc_ptp.c Jeff Kirsher
2020-04-20 23:43 ` [net-next 06/13] igc: Use netdev log helpers in igc_dump.c Jeff Kirsher
2020-04-20 23:43 ` [net-next 07/13] igc: Use netdev log helpers in igc_base.c Jeff Kirsher
2020-04-20 23:43 ` [net-next 08/13] igc: Remove '\n' from log strings in igc_i225.c Jeff Kirsher
2020-04-20 23:43 ` [net-next 09/13] igc: Remove '\n' from log strings in igc_mac.c Jeff Kirsher
2020-04-20 23:43 ` [net-next 10/13] igc: Remove '\n' from log messages in igc_nvm.c Jeff Kirsher
2020-04-20 23:43 ` [net-next 11/13] igc: Remove '\n' from log strings in igc_phy.c Jeff Kirsher
2020-04-20 23:43 ` [net-next 12/13] igc: Remove unneeded definition Jeff Kirsher
2020-04-20 23:43 ` [net-next 13/13] igc: Remove unneeded register Jeff Kirsher

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=20200421104818.1e9cfa14@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
    --to=kuba@kernel.org \
    --cc=aaron.f.brown@intel.com \
    --cc=andre.guedes@intel.com \
    --cc=andrew@lunn.ch \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=lkp@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=sassmann@redhat.com \
    --cc=vitaly.lifshits@intel.com \
    /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).