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]
Date: Fri, 15 Sep 2023 14:05:26 -0300
From: Fabio Estevam <festevam@...il.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: Vladimir Oltean <olteanv@...il.com>, l00g33k@...il.com, netdev <netdev@...r.kernel.org>, 
	Jakub Kicinski <kuba@...nel.org>, sashal@...nel.org
Subject: Re: mv88e6xxx: Timeout waiting for EEPROM done

On Fri, Sep 15, 2023 at 11:34 AM Andrew Lunn <andrew@...n.ch> wrote:

> As i said, we do a hardware reset later. All we are trying to do at
> this stage is probe the device, does it exist on the bus, and what ID
> value does it have. I want to avoid the overhead of doing a reset now,
> and then doing it again later.

Now I see your point, thanks.

Back to mv88e6xxx_g1_read(): should we check whether the EEPROM is
present and bail out if absent?

Did a quick hack just to show the idea. Please let me know what you think.

diff --git a/drivers/net/dsa/mv88e6xxx/global1.c
b/drivers/net/dsa/mv88e6xxx/global1.c
index 5848112036b0..0e8b8667e897 100644
--- a/drivers/net/dsa/mv88e6xxx/global1.c
+++ b/drivers/net/dsa/mv88e6xxx/global1.c
@@ -12,6 +12,7 @@

 #include "chip.h"
 #include "global1.h"
+#include "global2.h"

 int mv88e6xxx_g1_read(struct mv88e6xxx_chip *chip, int reg, u16 *val)
 {
@@ -80,6 +81,13 @@ void mv88e6xxx_g1_wait_eeprom_done(struct
mv88e6xxx_chip *chip)
        const unsigned long timeout = jiffies + 1 * HZ;
        u16 val;
        int err;
+       u16 data;
+       u8 addr = 0;
+
+       err = mv88e6xxx_g2_eeprom_read16(chip, addr, &data);
+       /* Test whether EEPROM is present and bail out if absent */
+       if (data == 0xffff)
+               return;

        /* Wait up to 1 second for the switch to finish reading the
         * EEPROM.
diff --git a/drivers/net/dsa/mv88e6xxx/global2.c
b/drivers/net/dsa/mv88e6xxx/global2.c
index ec49939968fa..e75d7c029280 100644
--- a/drivers/net/dsa/mv88e6xxx/global2.c
+++ b/drivers/net/dsa/mv88e6xxx/global2.c
@@ -411,7 +411,7 @@ static int mv88e6xxx_g2_eeprom_write8(struct
mv88e6xxx_chip *chip,
        return mv88e6xxx_g2_eeprom_cmd(chip, cmd | data);
 }

-static int mv88e6xxx_g2_eeprom_read16(struct mv88e6xxx_chip *chip,
+int mv88e6xxx_g2_eeprom_read16(struct mv88e6xxx_chip *chip,
                                      u8 addr, u16 *data)
 {
        u16 cmd = MV88E6XXX_G2_EEPROM_CMD_OP_READ | addr;
diff --git a/drivers/net/dsa/mv88e6xxx/global2.h
b/drivers/net/dsa/mv88e6xxx/global2.h
index c05fad5c9f19..5bb6d6d7ca86 100644
--- a/drivers/net/dsa/mv88e6xxx/global2.h
+++ b/drivers/net/dsa/mv88e6xxx/global2.h
@@ -331,6 +331,7 @@ int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip,
                              struct ethtool_eeprom *eeprom, u8 *data);
 int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip,
                              struct ethtool_eeprom *eeprom, u8 *data);
+int mv88e6xxx_g2_eeprom_read16(struct mv88e6xxx_chip *chip, u8 addr,
u16 *data);

 int mv88e6xxx_g2_pvt_read(struct mv88e6xxx_chip *chip, int src_dev,
                          int src_port, u16 *data);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ