[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190829161029.0676d6f7@cakuba.netronome.com>
Date: Thu, 29 Aug 2019 16:10:29 -0700
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: Shannon Nelson <snelson@...sando.io>
Cc: netdev@...r.kernel.org, davem@...emloft.net
Subject: Re: [PATCH v6 net-next 14/19] ionic: Add initial ethtool support
On Thu, 29 Aug 2019 11:27:15 -0700, Shannon Nelson wrote:
> +static int ionic_get_module_eeprom(struct net_device *netdev,
> + struct ethtool_eeprom *ee,
> + u8 *data)
> +{
> + struct ionic_lif *lif = netdev_priv(netdev);
> + struct ionic_dev *idev = &lif->ionic->idev;
> + struct ionic_xcvr_status *xcvr;
> + char tbuf[sizeof(xcvr->sprom)];
> + int count = 10;
> + u32 len;
> +
> + /* The NIC keeps the module prom up-to-date in the DMA space
> + * so we can simply copy the module bytes into the data buffer.
> + */
> + xcvr = &idev->port_info->status.xcvr;
> + len = min_t(u32, sizeof(xcvr->sprom), ee->len);
> +
> + do {
> + memcpy(data, xcvr->sprom, len);
> + memcpy(tbuf, xcvr->sprom, len);
> +
> + /* Let's make sure we got a consistent copy */
> + if (!memcmp(data, tbuf, len))
> + break;
> +
> + } while (--count);
Should this return an error if the image was never consistent?
> +
> + return 0;
> +}
Powered by blists - more mailing lists