netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michał Mirosław" <mirqus@gmail.com>
To: "Tantilov, Emil S" <emil.s.tantilov@intel.com>
Cc: "Kirsher, Jeffrey T" <jeffrey.t.kirsher@intel.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"Aurélien Guillaume" <footplus@gmail.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"gospo@redhat.com" <gospo@redhat.com>,
	"sassmann@redhat.com" <sassmann@redhat.com>
Subject: Re: [net-next 13/15] ixgbe: implement SFF diagnostic monitoring via ethtool
Date: Sun, 17 Feb 2013 14:41:23 +0100	[thread overview]
Message-ID: <CAHXqBFJEh5apNBgo59g7D8M1PAOOqo04y_uQEMJHTKwAGL3arw@mail.gmail.com> (raw)
In-Reply-To: <87618083B2453E4A8714035B62D67992337B5051@FMSMSX102.amr.corp.intel.com>

2013/2/17 Tantilov, Emil S <emil.s.tantilov@intel.com>:
>>> @@ -2839,6 +2840,117 @@ static int ixgbe_set_channels(struct net_device
>>*dev,
>>>         return ixgbe_setup_tc(dev, netdev_get_num_tc(dev));
>>>  }
>>>
>>> +static int ixgbe_get_module_info(struct net_device *dev,
>>> +                                      struct ethtool_modinfo *modinfo)
>>> +{
>>> +       struct ixgbe_adapter *adapter = netdev_priv(dev);
>>> +       struct ixgbe_hw *hw = &adapter->hw;
>>> +       u32 status;
>>> +       u8 sff8472_rev, addr_mode;
>>> +       int ret_val = 0;
>>> +       bool page_swap = false;
>>> +
>>> +       /* avoid concurent i2c reads */
>>> +       while (test_bit(__IXGBE_IN_SFP_INIT, &adapter->state))
>>> +               msleep(100);
>>> +
>>> +       /* used by the service task */
>>> +       set_bit(__IXGBE_READ_I2C, &adapter->state);
>>
>>This is racy. Why do you need another bit?
>
> The I2C bit helps to reduce the delay in the service task relative to the initialization of the SFP modules.
>
>>
>> while (test_and_set_bit(__IXGBE_IN_SFP_INIT, &adapter->state))
>>       msleep(100);
>>...
>>  clear_bit(__IXGBE_IN_SFP_INIT, &adapter->state)
>
> This is what I had initially, but the i2c reads can take a long time on some parts and __IXGBE_IN_SFP_INIT protects portions of the code that have nothing to do with I2C reads. Setting __IXGBE_IN_SFP_INIT in ethtool while dumping the SFF data can introduce needlessly long delays in the SFP initialization path.

Maybe it would be enough to protect the body of read_i2c_eeprom()
usign a mutex? It seems you want __IXGBE_READ_I2C to work like a
mutex, but you test it in non-atomic way.

Best Regards,
Michał Mirosław

  reply	other threads:[~2013-02-17 13:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-16  8:33 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2013.02.16 Jeff Kirsher
2013-02-16  8:33 ` [net-next 01/15] e1000: fix whitespace issues and multi-line comments Jeff Kirsher
2013-02-16  8:33 ` [net-next 02/15] e1000e: display a warning message when SmartSpeed works Jeff Kirsher
2013-02-16  8:33 ` [net-next 03/15] igbvf: Make next_to_watch a pointer and adjust memory barriers to avoid races Jeff Kirsher
2013-02-16  8:33 ` [net-next 04/15] igb: increase timeout for ethtool offline self-test Jeff Kirsher
2013-02-16  8:33 ` [net-next 05/15] ixgbe: Define FCoE and Flow director limits much sooner to allow for changes Jeff Kirsher
2013-02-16  8:33 ` [net-next 06/15] ixgbe: Add function for setting XPS queue mapping Jeff Kirsher
2013-02-16  8:33 ` [net-next 07/15] ixgbe: Update ixgbe driver to use __netdev_pick_tx in ixgbe_select_queue Jeff Kirsher
2013-02-16  8:33 ` [net-next 08/15] ixgbe: Make ixgbe_setup_tc usable even when DCB is not enabled Jeff Kirsher
2013-02-16  8:33 ` [net-next 09/15] ixgbe: Add support for displaying the number of Tx/Rx channels Jeff Kirsher
2013-02-16  8:33 ` [net-next 10/15] ixgbe: Add support for set_channels ethtool operation Jeff Kirsher
2013-02-16  8:33 ` [net-next 11/15] ixgbe: fix possible data corruption in read_i2c_byte Jeff Kirsher
2013-02-16  8:33 ` [net-next 12/15] ixgbe: cleanup error checking in ixgbe_identify_sfp_module_generic() Jeff Kirsher
2013-02-16  8:33 ` [net-next 13/15] ixgbe: implement SFF diagnostic monitoring via ethtool Jeff Kirsher
2013-02-16 10:53   ` Michał Mirosław
2013-02-17  6:16     ` Tantilov, Emil S
2013-02-17 13:41       ` Michał Mirosław [this message]
2013-02-19 22:14   ` Ben Hutchings
2013-02-20  0:26     ` Tantilov, Emil S
2013-02-16  8:33 ` [net-next 14/15] ixgbe: fix Tx timeouts with BQL Jeff Kirsher
2013-02-16  8:33 ` [net-next 15/15] ixgbe: Update DESC_NEEDED define to adjust for changes to MAX_SKB_FRAGS Jeff Kirsher
2013-02-18 17:37 ` [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2013.02.16 David Miller
2013-02-19 18:06   ` Tantilov, Emil S

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=CAHXqBFJEh5apNBgo59g7D8M1PAOOqo04y_uQEMJHTKwAGL3arw@mail.gmail.com \
    --to=mirqus@gmail.com \
    --cc=davem@davemloft.net \
    --cc=emil.s.tantilov@intel.com \
    --cc=footplus@gmail.com \
    --cc=gospo@redhat.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=sassmann@redhat.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).