[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4a3070182e56ca21d9e07e083f30f82c1e886c3f.camel@microchip.com>
Date: Wed, 5 Jun 2024 03:31:36 +0000
From: <Arun.Ramadoss@...rochip.com>
To: <enguerrand.de-ribaucourt@...oirfairelinux.com>, <netdev@...r.kernel.org>
CC: <linux@...linux.org.uk>, <horms@...nel.org>, <Tristram.Ha@...rochip.com>,
<Woojung.Huh@...rochip.com>, <hkallweit1@...il.com>,
<UNGLinuxDriver@...rochip.com>, <andrew@...n.ch>
Subject: Re: [PATCH net v5 4/4] net: dsa: microchip: monitor potential faults
in half-duplex mode
Hi Enguerrand,
>
> +int ksz9477_errata_monitor(struct ksz_device *dev, int port,
> + u64 tx_late_col)
> +{
> + u32 pmavbc;
> + u8 status;
> + u16 pqm;
> + int ret;
> +
> + ret = ksz_pread8(dev, port, REG_PORT_STATUS_0, &status);
> + if (ret)
> + return ret;
Blank line after return ret will increase readability.
> + if (!((status & PORT_INTF_SPEED_MASK) ==
> PORT_INTF_SPEED_MASK) &&
Why this check is needed. Is it to check reserved value 11b.
> + !(status & PORT_INTF_FULL_DUPLEX)) {
> + dev_warn_once(dev->dev,
> + "Half-duplex detected on port %d,
> transmission halt may occur\n",
> + port);
> + /* Errata DS80000754 recommends monitoring potential
> faults in
> + * half-duplex mode. The switch might not be able to
> communicate anymore
> + * in these states.
> + */
> + if (tx_late_col != 0) {
> + /* Transmission halt with late collisions */
> + dev_crit_ratelimited(dev->dev,
> + "TX late collisions
> detected, transmission may be halted on port %d\n",
> + port);
> + }
> + ret = ksz_pread16(dev, port, REG_PORT_QM_TX_CNT_0__4,
> &pqm);
> + if (ret)
> + return ret;
> + ret = ksz_read32(dev, REG_PMAVBC, &pmavbc);
> + if (ret)
> + return ret;
> + if ((FIELD_GET(PMAVBC_MASK, pmavbc) <= PMAVBC_MIN) ||
> + (FIELD_GET(PORT_QM_TX_CNT_M, pqm) >=
> PORT_QM_TX_CNT_MAX)) {
> + /* Transmission halt with Half-Duplex and
> VLAN */
> + dev_crit_ratelimited(dev->dev,
> + "resources out of
> limits, transmission may be halted\n");
> + }
> + }
> + return ret;
> +}
> +
>
>
Powered by blists - more mailing lists