From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Perches Subject: Re: [PATCH] sfp: allow cotsworks modules Date: Wed, 28 Mar 2018 03:33:57 -0700 Message-ID: <1522233237.12357.96.camel@perches.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org To: Russell King , Andrew Lunn , Florian Fainelli Return-path: Received: from smtprelay0076.hostedemail.com ([216.40.44.76]:50753 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752106AbeC1KeA (ORCPT ); Wed, 28 Mar 2018 06:34:00 -0400 In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Wed, 2018-03-28 at 11:18 +0100, Russell King wrote: > Cotsworks modules fail the checksums - it appears that Cotsworks > reprograms the EEPROM at the end of production with the final product > information (serial, date code, and exact part number for module > options) and fails to update the checksum. trivia: > diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c [] > @@ -574,23 +575,43 @@ static int sfp_sm_mod_probe(struct sfp *sfp) [] > + if (cotsworks) { > + dev_warn(sfp->dev, > + "EEPROM base structure checksum failure (0x%02x != 0x%02x)\n", > + check, id.base.cc_base); > + } else { > + dev_err(sfp->dev, > + "EEPROM base structure checksum failure: 0x%02x != 0x%02x\n", It'd be better to move this above the if and use only a single format string instead of using 2 slightly different formats. > + check, id.base.cc_base); > + print_hex_dump(KERN_ERR, "sfp EE: ", DUMP_PREFIX_OFFSET, > + 16, 1, &id, sizeof(id), true); > + return -EINVAL; > + } > } > > check = sfp_check(&id.ext, sizeof(id.ext) - 1); > if (check != id.ext.cc_ext) { > - dev_err(sfp->dev, > - "EEPROM extended structure checksum failure: 0x%02x\n", > - check); > - memset(&id.ext, 0, sizeof(id.ext)); > + if (cotsworks) { > + dev_warn(sfp->dev, > + "EEPROM extended structure checksum failure (0x%02x != 0x%02x)\n", > + check, id.ext.cc_ext); > + } else { > + dev_err(sfp->dev, > + "EEPROM extended structure checksum failure: 0x%02x != 0x%02x\n", > + check, id.ext.cc_ext); here too