> +static int ionic_get_module_eeprom(struct net_device *netdev, > + struct ethtool_eeprom *ee, > + u8 *data) > +{ > + struct lif *lif = netdev_priv(netdev); > + struct ionic_dev *idev = &lif->ionic->idev; > + struct xcvr_status *xcvr; > + 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); > + memcpy(data, xcvr->sprom, len); > + > + return 0; > +}
Is the firmware doing this DMA update atomically? The diagnostic values are u16s. Is there any chance we do this memcpy at the same time the DMA is active and we get a mix of old and new data? Often in cases like this you do the copy twice and ensure you get the same values each time. If not, keep repeating the copy until you do get the same values twice. Andrew