lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87618083B2453E4A8714035B62D67992337B5051@FMSMSX102.amr.corp.intel.com>
Date:	Sun, 17 Feb 2013 06:16:25 +0000
From:	"Tantilov, Emil S" <emil.s.tantilov@...el.com>
To:	Michal Miroslaw <mirqus@...il.com>,
	"Kirsher, Jeffrey T" <jeffrey.t.kirsher@...el.com>
CC:	"davem@...emloft.net" <davem@...emloft.net>,
	Aurélien Guillaume <footplus@...il.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"gospo@...hat.com" <gospo@...hat.com>,
	"sassmann@...hat.com" <sassmann@...hat.com>
Subject: RE: [net-next 13/15] ixgbe: implement SFF diagnostic monitoring via
 ethtool

>-----Original Message-----
>From: Michał Mirosław [mailto:mirqus@...il.com]
>Sent: Saturday, February 16, 2013 2:54 AM
>To: Kirsher, Jeffrey T
>Cc: davem@...emloft.net; Aurélien Guillaume; netdev@...r.kernel.org;
>gospo@...hat.com; sassmann@...hat.com; Tantilov, Emil S
>Subject: Re: [net-next 13/15] ixgbe: implement SFF diagnostic monitoring
>via ethtool
>
>2013/2/16 Jeff Kirsher <jeffrey.t.kirsher@...el.com>:
>> From: Aurélien Guillaume <footplus@...il.com>
>>
>> This patch adds support for reading data from SFP+ modules over i2c.
>>
>> Signed-off-by: Aurélien Guillaume <footplus@...il.com>
>> Signed-off-by: Emil Tantilov <emil.s.tantilov@...el.com>
>> Tested-by: Phil Schmitt <phillip.j.schmitt@...el.com>
>> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@...el.com>
>> ---
>>  drivers/net/ethernet/intel/ixgbe/ixgbe.h         |   1 +
>>  drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 114
>+++++++++++++++++++++++
>>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c    |   4 +
>>  3 files changed, 119 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
>b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
>> index b91f9b6..196002b 100644
>> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
>> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
>> @@ -620,6 +620,7 @@ enum ixgbe_state_t {
>>         __IXGBE_DOWN,
>>         __IXGBE_SERVICE_SCHED,
>>         __IXGBE_IN_SFP_INIT,
>> +       __IXGBE_READ_I2C,
>>  };
>>
>>  struct ixgbe_cb {
>> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
>b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
>> index 7349a8b..e6cebdc 100644
>> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
>> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
>> @@ -39,6 +39,7 @@
>>  #include <linux/uaccess.h>
>>
>>  #include "ixgbe.h"
>> +#include "ixgbe_phy.h"
>>
>>
>>  #define IXGBE_ALL_RAR_ENTRIES 16
>> @@ -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.

Thanks,
Emil


>Best Regards,
>Michał Mirosław

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ