Thread (44 messages) 44 messages, 8 authors, 2024-06-07

Re: [PATCH net v5 4/4] net: dsa: microchip: monitor potential faults in half-duplex mode

From: <Arun.Ramadoss@microchip.com>
Date: 2024-06-05 03:32:18

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;
+}
+
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help