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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ba1d251a9bd93cdf4c894313637dd9618cd8091c.camel@microchip.com>
Date:   Thu, 24 Mar 2022 15:48:57 +0000
From:   <Arun.Ramadoss@...rochip.com>
To:     <andrew@...n.ch>
CC:     <linux-kernel@...r.kernel.org>, <UNGLinuxDriver@...rochip.com>,
        <linux@...linux.org.uk>, <kuba@...nel.org>, <pabeni@...hat.com>,
        <netdev@...r.kernel.org>, <davem@...emloft.net>,
        <hkallweit1@...il.com>
Subject: Re: [RFC Patch net-next 3/3] net: phy: lan87xx: added ethtool SQI
 support

Hi Andrew,

Thanks for the review.

On Mon, 2022-03-21 at 19:36 +0100, Andrew Lunn wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> > +#define T1_DCQ_SQI_MSK                       GENMASK(3, 1)
> > +static int lan87xx_get_sqi(struct phy_device *phydev)
> > +{
> > +     u16 sqi_value[LAN87XX_SQI_ENTRY];
> > +     for (i = 0; i < LAN87XX_SQI_ENTRY; i++) {
> > +
> > +             sqi_value[i] = FIELD_GET(T1_DCQ_SQI_MSK, rc);
> > +
> > +     /* Sorting SQI values */
> > +     sort(sqi_value, LAN87XX_SQI_ENTRY, sizeof(u16),
> > lan87xx_sqi_cmp, NULL);
> 
> Sort is quite heavyweight. Your SQI values are in the range 0-7
> right?
> So rather than have an array of LAN87XX_SQI_ENTRY entries, why not
> create a histogram? You then just need to keep 8 uints. There is no
> need to perform a sort to discard the outliers, simply remove from
> the
> outer histogram buckets. And then you can calculate the average.
> 
> That should be faster and use less memory.
> 
>      Andrew

I could get the algorithm for replacing array of LAN87XX_SQI_ENTRY(200)
to array of 8 (sqi values 0 to 7) and increment the array[sqi_value]
for every reading. And calculate the Average = ( 1 * array[1] + 2 *
array[2] ... + 7 * array[7])/LAN87XX_SQI_ENTRY. By this way we get the
average for 200 entries.
But I couldn't get the algorithm on how to discard the outliers from
the buckets. our main aim is to average from array[40] to arrary[160]
value. Can you bit elaborate on how to remove the outer histogram
buckets.

Arun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ