halmartin / meraki-builder

Scripts and tools to assemble firmware images for various Meraki MS switches and MX routers
GNU General Public License v3.0
70 stars 16 forks source link

pd690xx output contains errors on MS220-48LP #27

Closed halmartin closed 1 year ago

halmartin commented 1 year ago

The port status output from pd690xx is nonsensical on the MS220-48 switch:

~ # pd690xx -l
Port    Status          Type    Priority        Power
1       Enabled         at      Critical        0.0
2       Enabled         at      Critical        0.0
3       Enabled         at      Critical        0.0
4       Enabled         at      Critical        0.0
5       Enabled         at      Critical        0.0
6       Enabled         at      Critical        0.0
7       Enabled         at      Critical        0.0
8       Enabled         at      Critical        0.0
9       Enabled         at      Critical        0.0
10      Enabled         at      Critical        0.0
11      Enabled         at      Critical        0.0
12      Enabled         at      Critical        0.0
13      Disabled        af      Critical        0.0
14      Disabled        af      Unknown 0.0
15      Disabled        af      Unknown 0.0
16      Disabled        af      Unknown 0.0
17      Disabled        af      Unknown 0.0
18      Disabled        af      Unknown 0.0
19      Disabled        af      Unknown 0.0
20      Disabled        af      Unknown 0.0
21      Disabled        af      Unknown 0.0
22      Disabled        af      Unknown 0.0
23      Disabled        af      Unknown 0.0
24      Disabled        af      Unknown 0.0
25      Disabled        af      Unknown 0.0
26      Disabled        af      Critical        0.0
27      Disabled        af      Critical        0.0
28      Disabled        af      Critical        0.0
29      Disabled        af      Critical        0.0
30      Disabled        af      Critical        0.0
31      Disabled        af      Critical        0.0
32      Disabled        af      Critical        0.0
33      Disabled        af      Critical        0.0
34      Disabled        af      Critical        0.0
35      Disabled        af      Critical        0.0
36      Disabled        af      Critical        0.0
37      Disabled        af      Critical        0.0
38      Disabled        af      Critical        95.6
39      Disabled        af      Critical        78.7
40      Disabled        af      Critical        68.8
41      Disabled        af      Unknown 1.6
42      Disabled        Unknown Critical        16.9
43      Forced          Unknown Unknown 50.6
44      Forced          Unknown Critical        57.0
45      Disabled        Unknown Unknown 38.8
46      Unknown Unknown Unknown 38.8
47      Disabled        Unknown Critical        3.8

The switch has no PoE devices attached, so absent a serious hardware fault, there should be no power consumption on any ports (especially on ports which are supposedly disabled).

halmartin commented 1 year ago

pd690xx also doesn't list the port status of port 24 on the MS220-24P, or port 48 on the MS220-48LP

MS220-24P:

~ # pd690xx -l
Port    Status          Type    Priority        Power
1       Enabled         at      Critical        0.0
(...)
23      Enabled         at      Critical        0.0

The port status output on the MS220-24P is also incorrect for ports > 12:

~ # pd690xx -l
Port    Status          Type    Priority        Power
1       Enabled         at      Critical        0.0
2       Enabled         at      Critical        0.0
3       Enabled         at      Critical        0.0
4       Enabled         at      Critical        0.0
5       Enabled         at      Critical        0.0
6       Enabled         at      Critical        0.0
7       Enabled         at      Critical        0.0
8       Enabled         at      Critical        0.0
9       Enabled         at      Critical        0.0
10      Enabled         at      Critical        0.0
11      Enabled         at      Critical        0.0
12      Enabled         at      Critical        0.0
13      Disabled        af      Critical        0.0
14      Disabled        af      Unknown 0.0
15      Disabled        af      Unknown 0.0
16      Disabled        af      Unknown 0.0
17      Disabled        af      Unknown 0.0
18      Disabled        af      Unknown 0.0
19      Disabled        af      Unknown 0.0
20      Disabled        af      Unknown 0.0
21      Disabled        af      Unknown 0.0
22      Disabled        af      Unknown 0.0
23      Disabled        af      Unknown 0.0
halmartin commented 1 year ago

There were several bugs in pd690xx

The simple one: missing the last port on the switch. This was a logic error, ending the port status loop one port early with < instead of <=:

for (int i=1; i<total_ports; i++)

The invalid output for ports > 12 was a more serious error, but was only applicable to the MS220-24P and MS220-48LP/FP as the MS220-8P only has 1 pd690xx and 8 PoE ports.

The function get_pd690xx_addr did not properly return the per port control register address for ports > 12. With the incorrect control register address from get_pd690xx_addr, pd690xx was reading from the per port power limit (Port*_PPL) register instead of the per port control register (Port*_CR).

The Port*_PPL register by default returns 0x140 which leads to the port status being reported as Disabled, af, and Unknown:

Detected 2 pd690xx
Port    Status          Type    Priority        Power
I2C data: 0014
Port 1: disabled
I2C data: 0014
Port 1: 802.3at
I2C data: 0014
Port 1: Critical
I2C data: 0000
1       Disabled        at      Critical        0.0
(...)
I2C data: 0140
Port 23: disabled
I2C data: 0140
Port 23: 802.3af
I2C data: 0140
Port 23: unknown
I2C data: 0000
23      Disabled        af      Unknown 0.0

Not only was reporting the status of ports > 12 broken, but all other operations for ports > 12 would have been directed to the incorrect register and would not have the intended effect.

pd690xx v0.4 fixes the above issues.


Users should update their switch firmware to 20221115.


Thanks to @acjohnson for providing access to MS220-24/48 hardware to diagnose and resolve this issue.