From 837e9648549532f0caf3e68c2d6a47bb62665174 Mon Sep 17 00:00:00 2001 From: hans-tseng Date: Thu, 1 Mar 2018 18:14:26 +0800 Subject: [PATCH 001/274] [devices]: add the delta ag9064 platform (#1435) * add the ag9064 platform Signed-off-by: hans --- .../Delta-ag9064/port_config.ini | 67 + .../Delta-ag9064/sai.profile | 1 + .../x86_64-delta_ag9064-r0/installer.conf | 2 + .../x86_64-delta_ag9064-r0/led_proc_init.soc | 63 + .../x86_64-delta_ag9064-r0/minigraph.xml | 848 ++++++++ .../x86_64-delta_ag9064-r0/plugins/eeprom.py | 32 + .../x86_64-delta_ag9064-r0/plugins/sfputil.py | 175 ++ .../delta/x86_64-delta_ag9064-r0/sensors.conf | 14 + platform/broadcom/one-image.mk | 1 + platform/broadcom/platform-modules-delta.mk | 6 + .../ag9064/cfg/ag9064-modules.conf | 13 + .../ag9064/modules/Makefile | 4 + .../ag9064/modules/client.h | 255 +++ .../ag9064/modules/delta_ag9064_platform.c | 1829 +++++++++++++++++ .../ag9064/modules/hbm.h | 62 + .../ag9064/modules/hw.h | 426 ++++ .../ag9064/modules/i2c-mei_io.c | 636 ++++++ .../ag9064/modules/i2c-mei_io.h | 46 + .../ag9064/modules/i2c-mei_main.c | 578 ++++++ .../ag9064/modules/i2c-mei_rw.c | 591 ++++++ .../ag9064/modules/i2c-mei_rw.h | 143 ++ .../ag9064/modules/i2c-mei_type.h | 448 ++++ .../ag9064/modules/mei_dev.h | 832 ++++++++ .../debian/control | 5 + .../sonic-platform-modules-delta/debian/files | 1 + .../debian/platform-modules-ag9064.init | 48 + .../debian/platform-modules-ag9064.install | 1 + .../sonic-platform-modules-delta/debian/rules | 2 +- 28 files changed, 7128 insertions(+), 1 deletion(-) create mode 100644 device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/port_config.ini create mode 100644 device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/sai.profile create mode 100644 device/delta/x86_64-delta_ag9064-r0/installer.conf create mode 100644 device/delta/x86_64-delta_ag9064-r0/led_proc_init.soc create mode 100644 device/delta/x86_64-delta_ag9064-r0/minigraph.xml create mode 100644 device/delta/x86_64-delta_ag9064-r0/plugins/eeprom.py create mode 100644 device/delta/x86_64-delta_ag9064-r0/plugins/sfputil.py create mode 100644 device/delta/x86_64-delta_ag9064-r0/sensors.conf create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9064/cfg/ag9064-modules.conf create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9064/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9064/modules/client.h create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9064/modules/hbm.h create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9064/modules/hw.h create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_io.c create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_io.h create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_main.c create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_rw.c create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_rw.h create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_type.h create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9064/modules/mei_dev.h create mode 100755 platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init create mode 100644 platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.install diff --git a/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/port_config.ini b/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/port_config.ini new file mode 100644 index 000000000000..2c4eb341369e --- /dev/null +++ b/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/port_config.ini @@ -0,0 +1,67 @@ +# name lanes alias index +Ethernet0 49,50,51,52 Ethernet1/1 1 +Ethernet4 53,54,55,56 Ethernet2/1 2 +Ethernet8 65,66,67,68 Ethernet3/1 3 +Ethernet12 69,70,71,72 Ethernet4/1 4 +Ethernet16 81,82,83,84 Ethernet5/1 5 +Ethernet20 85,86,87,88 Ethernet6/1 6 +Ethernet24 1,2,3,4 Ethernet7/1 7 +Ethernet28 101,102,103,104 Ethernet8/1 8 +Ethernet32 5,6,7,8 Ethernet9/1 9 +Ethernet36 17,18,19,20 Ethernet10/1 10 +Ethernet40 21,22,23,24 Ethernet11/1 11 +Ethernet44 33,34,35,36 Ethernet12/1 12 +Ethernet48 37,38,39,40 Ethernet13/1 13 +Ethernet52 97,98,99,100 Ethernet14/1 14 +Ethernet56 113,114,115,116 Ethernet15/1 15 +Ethernet60 117,118,119,120 Ethernet16/1 16 +Ethernet64 129,130,131,132 Ethernet17/1 17 +Ethernet68 133,134,135,136 Ethernet18/1 18 +Ethernet72 145,146,147,148 Ethernet19/1 19 +Ethernet76 209,210,211,212 Ethernet20/1 20 +Ethernet80 213,214,215,216 Ethernet21/1 21 +Ethernet84 225,226,227,228 Ethernet22/1 22 +Ethernet88 229,230,231,232 Ethernet23/1 23 +Ethernet92 241,242,243,244 Ethernet24/1 24 +Ethernet96 245,246,247,248 Ethernet25/1 25 +Ethernet100 157,158,159,160 Ethernet26/1 26 +Ethernet104 161,162,163,164 Ethernet27/1 27 +Ethernet108 165,166,167,168 Ethernet28/1 28 +Ethernet112 177,178,179,180 Ethernet29/1 29 +Ethernet116 181,182,183,184 Ethernet30/1 30 +Ethernet120 193,194,195,196 Ethernet31/1 31 +Ethernet124 197,198,199,200 Ethernet32/1 32 +Ethernet128 61,62,63,64 Ethernet33/1 33 +Ethernet132 57,58,59,60 Ethernet34/1 34 +Ethernet136 77,78,79,80 Ethernet35/1 35 +Ethernet140 73,74,75,76 Ethernet36/1 36 +Ethernet144 93,94,95,96 Ethernet37/1 37 +Ethernet148 89,90,91,92 Ethernet38/1 38 +Ethernet152 105,106,107,108 Ethernet39/1 39 +Ethernet156 9,10,11,12 Ethernet40/1 40 +Ethernet160 25,26,27,28 Ethernet41/1 41 +Ethernet164 13,14,15,16 Ethernet42/1 42 +Ethernet168 41,42,43,44 Ethernet43/1 43 +Ethernet172 29,30,31,32 Ethernet44/1 44 +Ethernet176 45,46,47,48 Ethernet45/1 45 +Ethernet180 109,110,111,112 Ethernet46/1 46 +Ethernet184 125,126,127,128 Ethernet47/1 47 +Ethernet188 121,122,123,124 Ethernet48/1 48 +Ethernet192 141,142,143,144 Ethernet49/1 49 +Ethernet196 137,138,139,140 Ethernet50/1 50 +Ethernet200 217,218,219,220 Ethernet51/1 51 +Ethernet204 149,150,151,152 Ethernet52/1 52 +Ethernet208 233,234,235,236 Ethernet53/1 53 +Ethernet212 221,222,223,224 Ethernet54/1 54 +Ethernet216 249,250,251,252 Ethernet55/1 55 +Ethernet220 237,238,239,240 Ethernet56/1 56 +Ethernet224 153,154,155,156 Ethernet57/1 57 +Ethernet228 253,254,255,256 Ethernet58/1 58 +Ethernet232 173,174,175,176 Ethernet59/1 59 +Ethernet236 169,170,171,172 Ethernet60/1 60 +Ethernet240 189,190,191,192 Ethernet61/1 61 +Ethernet244 185,186,187,188 Ethernet62/1 62 +Ethernet248 205,206,207,208 Ethernet63/1 63 +Ethernet252 201,202,203,204 Ethernet64/1 64 +Ethernet256 257 Ethernet65 65 +Ethernet260 259 Ethernet66 66 diff --git a/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/sai.profile b/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/sai.profile new file mode 100644 index 000000000000..b2ecd7a6da47 --- /dev/null +++ b/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th2-ag9064-64x100G.config.bcm diff --git a/device/delta/x86_64-delta_ag9064-r0/installer.conf b/device/delta/x86_64-delta_ag9064-r0/installer.conf new file mode 100644 index 000000000000..fa2af8b7a007 --- /dev/null +++ b/device/delta/x86_64-delta_ag9064-r0/installer.conf @@ -0,0 +1,2 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_SPEED=115200 diff --git a/device/delta/x86_64-delta_ag9064-r0/led_proc_init.soc b/device/delta/x86_64-delta_ag9064-r0/led_proc_init.soc new file mode 100644 index 000000000000..2e6f394b1219 --- /dev/null +++ b/device/delta/x86_64-delta_ag9064-r0/led_proc_init.soc @@ -0,0 +1,63 @@ +led 0 stop +led 0 prog \ + 02 00 60 E0 02 A0 60 E2 86 ED 02 00 60 E1 2E E0 \ + 32 08 97 02 00 0E 05 60 E3 2E E0 32 00 32 01 B7 \ + 97 02 00 0E 00 12 E7 FE E1 50 86 E0 86 E1 06 E1 \ + D2 04 74 19 16 E7 61 EB 06 E3 12 05 67 92 06 E3 \ + 12 04 67 92 06 E3 12 03 67 92 16 E9 61 EB 06 E5 \ + 12 03 67 92 02 02 60 EC 02 00 60 E1 77 66 02 01 \ + 60 EC 02 00 60 E1 12 E7 FE E1 05 60 EB 12 E3 FE \ + E1 05 16 EC 67 92 86 E1 06 E1 D2 04 74 66 06 EC \ + D2 02 70 5E 06 E2 F2 04 60 E2 06 E0 D2 40 74 0A \ + 3A C0 09 75 A9 06 EB D2 00 70 A5 16 ED 99 99 1A \ + 00 71 A5 77 A9 32 0F 87 57 32 0E 87 57 00 00 00 +led 0 auto on +led 0 start + +led 1 stop +led 1 prog \ + 02 00 60 E0 02 A0 60 E2 86 ED 02 00 60 E1 2E E0 \ + 32 08 97 02 00 0E 05 60 E3 2E E0 32 00 32 01 B7 \ + 97 02 00 0E 00 12 E7 FE E1 50 86 E0 86 E1 06 E1 \ + D2 04 74 19 16 E7 61 EB 06 E3 12 05 67 92 06 E3 \ + 12 04 67 92 06 E3 12 03 67 92 16 E9 61 EB 06 E5 \ + 12 03 67 92 02 02 60 EC 02 00 60 E1 77 66 02 01 \ + 60 EC 02 00 60 E1 12 E7 FE E1 05 60 EB 12 E3 FE \ + E1 05 16 EC 67 92 86 E1 06 E1 D2 04 74 66 06 EC \ + D2 02 70 5E 06 E2 F2 04 60 E2 06 E0 D2 40 74 0A \ + 3A C0 09 75 A9 06 EB D2 00 70 A5 16 ED 99 99 1A \ + 00 71 A5 77 A9 32 0F 87 57 32 0E 87 57 00 00 00 +led 1 auto on +led 1 start + +led 2 stop +led 2 prog \ + 02 00 60 E0 02 A0 60 E2 86 ED 02 00 60 E1 2E E0 \ + 32 08 97 02 00 0E 05 60 E3 2E E0 32 00 32 01 B7 \ + 97 02 00 0E 00 12 E7 FE E1 50 86 E0 86 E1 06 E1 \ + D2 04 74 19 16 E7 61 EB 06 E3 12 05 67 92 06 E3 \ + 12 04 67 92 06 E3 12 03 67 92 16 E9 61 EB 06 E5 \ + 12 03 67 92 02 02 60 EC 02 00 60 E1 77 66 02 01 \ + 60 EC 02 00 60 E1 12 E7 FE E1 05 60 EB 12 E3 FE \ + E1 05 16 EC 67 92 86 E1 06 E1 D2 04 74 66 06 EC \ + D2 02 70 5E 06 E2 F2 04 60 E2 06 E0 D2 40 74 0A \ + 3A C0 09 75 A9 06 EB D2 00 70 A5 16 ED 99 99 1A \ + 00 71 A5 77 A9 32 0F 87 57 32 0E 87 57 00 00 00 +led 2 auto on +led 2 start + +led 3 stop +led 3 prog \ + 02 00 60 E0 02 A0 60 E2 86 ED 02 00 60 E1 2E E0 \ + 32 08 97 02 00 0E 05 60 E3 2E E0 32 00 32 01 B7 \ + 97 02 00 0E 00 12 E7 FE E1 50 86 E0 86 E1 06 E1 \ + D2 04 74 19 16 E7 61 EB 06 E3 12 05 67 92 06 E3 \ + 12 04 67 92 06 E3 12 03 67 92 16 E9 61 EB 06 E5 \ + 12 03 67 92 02 02 60 EC 02 00 60 E1 77 66 02 01 \ + 60 EC 02 00 60 E1 12 E7 FE E1 05 60 EB 12 E3 FE \ + E1 05 16 EC 67 92 86 E1 06 E1 D2 04 74 66 06 EC \ + D2 02 70 5E 06 E2 F2 04 60 E2 06 E0 D2 40 74 0A \ + 3A C0 09 75 A9 06 EB D2 00 70 A5 16 ED 99 99 1A \ + 00 71 A5 77 A9 32 0F 87 57 32 0E 87 57 00 00 00 +led 3 auto on +led 3 start diff --git a/device/delta/x86_64-delta_ag9064-r0/minigraph.xml b/device/delta/x86_64-delta_ag9064-r0/minigraph.xml new file mode 100644 index 000000000000..7a2ece422288 --- /dev/null +++ b/device/delta/x86_64-delta_ag9064-r0/minigraph.xml @@ -0,0 +1,848 @@ + + + + + + + + + + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + + + + + + sonic + + + + + + Ethernet1/1 + 10.0.0.0/31 + + + + Ethernet2/1 + 10.0.0.2/31 + + + + Ethernet3/1 + 10.0.0.4/31 + + + + Ethernet4/1 + 10.0.0.6/31 + + + + Ethernet5/1 + 10.0.0.8/31 + + + + Ethernet6/1 + 10.0.0.10/31 + + + + Ethernet7/1 + 10.0.0.12/31 + + + + Ethernet8/1 + 10.0.0.14/31 + + + + Ethernet9/1 + 10.0.0.16/31 + + + + Ethernet10/1 + 10.0.0.18/31 + + + + Ethernet11/1 + 10.0.0.20/31 + + + + Ethernet12/1 + 10.0.0.22/31 + + + + Ethernet13/1 + 10.0.0.24/31 + + + + Ethernet14/1 + 10.0.0.26/31 + + + + Ethernet15/1 + 10.0.0.28/31 + + + + Ethernet16/1 + 10.0.0.30/31 + + + + Ethernet17/1 + 10.0.0.32/31 + + + + Ethernet18/1 + 10.0.0.34/31 + + + + Ethernet19/1 + 10.0.0.36/31 + + + + Ethernet20/1 + 10.0.0.38/31 + + + + Ethernet21/1 + 10.0.0.40/31 + + + + Ethernet22/1 + 10.0.0.42/31 + + + + Ethernet23/1 + 10.0.0.44/31 + + + + Ethernet24/1 + 10.0.0.46/31 + + + + Ethernet25/1 + 10.0.0.48/31 + + + + Ethernet26/1 + 10.0.0.50/31 + + + + Ethernet27/1 + 10.0.0.52/31 + + + + Ethernet28/1 + 10.0.0.54/31 + + + + Ethernet29/1 + 10.0.0.56/31 + + + + Ethernet30/1 + 10.0.0.58/31 + + + + Ethernet31/1 + 10.0.0.60/31 + + + + Ethernet32/1 + 10.0.0.62/31 + + + + Ethernet33/1 + 10.0.0.64/31 + + + + Ethernet34/1 + 10.0.0.66/31 + + + + Ethernet35/1 + 10.0.0.68/31 + + + + Ethernet36/1 + 10.0.0.70/31 + + + + Ethernet37/1 + 10.0.0.72/31 + + + + Ethernet38/1 + 10.0.0.74/31 + + + + Ethernet39/1 + 10.0.0.76/31 + + + + Ethernet40/1 + 10.0.0.78/31 + + + + Ethernet41/1 + 10.0.0.80/31 + + + + Ethernet42/1 + 10.0.0.82/31 + + + + Ethernet43/1 + 10.0.0.84/31 + + + + Ethernet44/1 + 10.0.0.86/31 + + + + Ethernet45/1 + 10.0.0.88/31 + + + + Ethernet46/1 + 10.0.0.90/31 + + + + Ethernet47/1 + 10.0.0.92/31 + + + + Ethernet48/1 + 10.0.0.94/31 + + + + Ethernet49/1 + 10.0.0.96/31 + + + + Ethernet50/1 + 10.0.0.98/31 + + + + Ethernet51/1 + 10.0.0.100/31 + + + + Ethernet52/1 + 10.0.0.102/31 + + + + Ethernet53/1 + 10.0.0.104/31 + + + + Ethernet54/1 + 10.0.0.106/31 + + + + Ethernet55/1 + 10.0.0.108/31 + + + + Ethernet56/1 + 10.0.0.110/31 + + + + Ethernet57/1 + 10.0.0.112/31 + + + + Ethernet58/1 + 10.0.0.114/31 + + + + Ethernet59/1 + 10.0.0.116/31 + + + + Ethernet60/1 + 10.0.0.118/31 + + + + Ethernet61/1 + 10.0.0.120/31 + + + + Ethernet62/1 + 10.0.0.122/31 + + + + Ethernet63/1 + 10.0.0.124/31 + + + + Ethernet64/1 + 10.0.0.126/31 + + + + + + + + + + + + DeviceInterfaceLink + sonic-target + Ethernet1/1 + sonic + Ethernet1/1 + + + DeviceInterfaceLink + sonic-target + Ethernet2/1 + sonic + Ethernet2/1 + + + DeviceInterfaceLink + sonic-target + Ethernet3/1 + sonic + Ethernet3/1 + + + DeviceInterfaceLink + sonic-target + Ethernet4/1 + sonic + Ethernet4/1 + + + DeviceInterfaceLink + sonic-target + Ethernet5/1 + sonic + Ethernet5/1 + + + DeviceInterfaceLink + sonic-target + Ethernet6/1 + sonic + Ethernet6/1 + + + DeviceInterfaceLink + sonic-target + Ethernet7/1 + sonic + Ethernet7/1 + + + DeviceInterfaceLink + sonic-target + Ethernet8/1 + sonic + Ethernet8/1 + + + DeviceInterfaceLink + sonic-target + Ethernet9/1 + sonic + Ethernet9/1 + + + DeviceInterfaceLink + sonic-target + Ethernet10/1 + sonic + Ethernet10/1 + + + DeviceInterfaceLink + sonic-target + Ethernet11/1 + sonic + Ethernet11/1 + + + DeviceInterfaceLink + sonic-target + Ethernet12/1 + sonic + Ethernet12/1 + + + DeviceInterfaceLink + sonic-target + Ethernet13/1 + sonic + Ethernet13/1 + + + DeviceInterfaceLink + sonic-target + Ethernet14/1 + sonic + Ethernet14/1 + + + DeviceInterfaceLink + sonic-target + Ethernet15/1 + sonic + Ethernet15/1 + + + DeviceInterfaceLink + sonic-target + Ethernet16/1 + sonic + Ethernet16/1 + + + DeviceInterfaceLink + sonic-target + Ethernet17/1 + sonic + Ethernet17/1 + + + DeviceInterfaceLink + sonic-target + Ethernet18/1 + sonic + Ethernet18/1 + + + DeviceInterfaceLink + sonic-target + Ethernet19/1 + sonic + Ethernet19/1 + + + DeviceInterfaceLink + sonic-target + Ethernet20/1 + sonic + Ethernet20/1 + + + DeviceInterfaceLink + sonic-target + Ethernet21/1 + sonic + Ethernet21/1 + + + DeviceInterfaceLink + sonic-target + Ethernet22/1 + sonic + Ethernet22/1 + + + DeviceInterfaceLink + sonic-target + Ethernet23/1 + sonic + Ethernet23/1 + + + DeviceInterfaceLink + sonic-target + Ethernet24/1 + sonic + Ethernet24/1 + + + DeviceInterfaceLink + sonic-target + Ethernet25/1 + sonic + Ethernet25/1 + + + DeviceInterfaceLink + sonic-target + Ethernet26/1 + sonic + Ethernet26/1 + + + DeviceInterfaceLink + sonic-target + Ethernet27/1 + sonic + Ethernet27/1 + + + DeviceInterfaceLink + sonic-target + Ethernet28/1 + sonic + Ethernet28/1 + + + DeviceInterfaceLink + sonic-target + Ethernet29/1 + sonic + Ethernet29/1 + + + DeviceInterfaceLink + sonic-target + Ethernet30/1 + sonic + Ethernet30/1 + + + DeviceInterfaceLink + sonic-target + Ethernet31/1 + sonic + Ethernet31/1 + + + DeviceInterfaceLink + sonic-target + Ethernet32/1 + sonic + Ethernet32/1 + + + DeviceInterfaceLink + sonic-target + Ethernet33/1 + sonic + Ethernet33/1 + + + DeviceInterfaceLink + sonic-target + Ethernet34/1 + sonic + Ethernet34/1 + + + DeviceInterfaceLink + sonic-target + Ethernet35/1 + sonic + Ethernet35/1 + + + DeviceInterfaceLink + sonic-target + Ethernet36/1 + sonic + Ethernet36/1 + + + DeviceInterfaceLink + sonic-target + Ethernet37/1 + sonic + Ethernet37/1 + + + DeviceInterfaceLink + sonic-target + Ethernet38/1 + sonic + Ethernet38/1 + + + DeviceInterfaceLink + sonic-target + Ethernet39/1 + sonic + Ethernet39/1 + + + DeviceInterfaceLink + sonic-target + Ethernet40/1 + sonic + Ethernet40/1 + + + DeviceInterfaceLink + sonic-target + Ethernet41/1 + sonic + Ethernet41/1 + + + DeviceInterfaceLink + sonic-target + Ethernet42/1 + sonic + Ethernet42/1 + + + DeviceInterfaceLink + sonic-target + Ethernet43/1 + sonic + Ethernet43/1 + + + DeviceInterfaceLink + sonic-target + Ethernet44/1 + sonic + Ethernet44/1 + + + DeviceInterfaceLink + sonic-target + Ethernet45/1 + sonic + Ethernet45/1 + + + DeviceInterfaceLink + sonic-target + Ethernet46/1 + sonic + Ethernet46/1 + + + DeviceInterfaceLink + sonic-target + Ethernet47/1 + sonic + Ethernet47/1 + + + DeviceInterfaceLink + sonic-target + Ethernet48/1 + sonic + Ethernet48/1 + + + DeviceInterfaceLink + sonic-target + Ethernet49/1 + sonic + Ethernet49/1 + + + DeviceInterfaceLink + sonic-target + Ethernet50/1 + sonic + Ethernet50/1 + + + DeviceInterfaceLink + sonic-target + Ethernet51/1 + sonic + Ethernet51/1 + + + DeviceInterfaceLink + sonic-target + Ethernet52/1 + sonic + Ethernet52/1 + + + DeviceInterfaceLink + sonic-target + Ethernet53/1 + sonic + Ethernet53/1 + + + DeviceInterfaceLink + sonic-target + Ethernet54/1 + sonic + Ethernet54/1 + + + DeviceInterfaceLink + sonic-target + Ethernet55/1 + sonic + Ethernet55/1 + + + DeviceInterfaceLink + sonic-target + Ethernet56/1 + sonic + Ethernet56/1 + + + DeviceInterfaceLink + sonic-target + Ethernet57/1 + sonic + Ethernet57/1 + + + DeviceInterfaceLink + sonic-target + Ethernet58/1 + sonic + Ethernet58/1 + + + DeviceInterfaceLink + sonic-target + Ethernet59/1 + sonic + Ethernet59/1 + + + DeviceInterfaceLink + sonic-target + Ethernet60/1 + sonic + Ethernet60/1 + + + DeviceInterfaceLink + sonic-target + Ethernet61/1 + sonic + Ethernet61/1 + + + DeviceInterfaceLink + sonic-target + Ethernet62/1 + sonic + Ethernet62/1 + + + DeviceInterfaceLink + sonic-target + Ethernet63/1 + sonic + Ethernet63/1 + + + DeviceInterfaceLink + sonic-target + Ethernet64/1 + sonic + Ethernet64/1 + + + + + sonic + Delta-ag9064 + + + + + + + sonic + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + ErspanDestinationIpv4 + + 2.2.2.2 + + + + + + + sonic + Delta-ag9064 + diff --git a/device/delta/x86_64-delta_ag9064-r0/plugins/eeprom.py b/device/delta/x86_64-delta_ag9064-r0/plugins/eeprom.py new file mode 100644 index 000000000000..e4048ed302de --- /dev/null +++ b/device/delta/x86_64-delta_ag9064-r0/plugins/eeprom.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + _TLV_INFO_MAX_LEN = 256 + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/devices/pci0000:00/0000:00:1f.3/i2c-0/0-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/delta/x86_64-delta_ag9064-r0/plugins/sfputil.py b/device/delta/x86_64-delta_ag9064-r0/plugins/sfputil.py new file mode 100644 index 000000000000..d7eadb58036d --- /dev/null +++ b/device/delta/x86_64-delta_ag9064-r0/plugins/sfputil.py @@ -0,0 +1,175 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 0 + PORT_END = 63 + PORTS_IN_BLOCK = 64 + + EEPROM_OFFSET = 20 + + _port_to_eeprom_mapping = {} + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + + for x in range(0, self.port_end + 1): + self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/delta-ag9064-cpld.0/qsfp_present") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # ModPrsL is active low + if reg_value & mask == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/delta-ag9064-cpld.0/qsfp_lpmode") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # LPMode is active high + if reg_value & mask == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/delta-ag9064-cpld.0/qsfp_lpmode", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + content = hex(reg_value) + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True + + def reset(self, port_num): + QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/devices/platform/delta-ag9064-cpld.0/qsfp_reset" + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # File content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # ResetL is active low + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + # Sleep 1 second to allow it to settle + time.sleep(1) + + # Flip the bit back high and write back to the register to take port out of reset + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_value | mask + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + return True diff --git a/device/delta/x86_64-delta_ag9064-r0/sensors.conf b/device/delta/x86_64-delta_ag9064-r0/sensors.conf new file mode 100644 index 000000000000..1d8489248a51 --- /dev/null +++ b/device/delta/x86_64-delta_ag9064-r0/sensors.conf @@ -0,0 +1,14 @@ +# libsensors configuration file for DCS-7060CX-32S +# ------------------------------------------------ +# + +bus "i2c-1" "i2c-1-mux (chan_id 1)" + + +# tmp75-i2c-1-4d CPU below side thermal sensor. + +chip "tmp75-i2c-1-4d" + label temp1 "CPU below side thermal sensor" + set temp1_max 60 + set temp1_max_hyst 55 + diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 0ab2581c28b7..4fe92e9a3366 100755 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -21,6 +21,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(INVENTEC_D7054Q28B_PLATFORM_MODULE) \ $(CEL_DX010_PLATFORM_MODULE) \ $(DELTA_AG9032V1_PLATFORM_MODULE) \ + $(DELTA_AG9064_PLATFORM_MODULE) \ $(QUANTA_IX1B_32X_PLATFORM_MODULE) \ $(MITAC_LY1200_32X_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) diff --git a/platform/broadcom/platform-modules-delta.mk b/platform/broadcom/platform-modules-delta.mk index c73b128106a9..5d9709f5cb5c 100644 --- a/platform/broadcom/platform-modules-delta.mk +++ b/platform/broadcom/platform-modules-delta.mk @@ -1,8 +1,10 @@ # Delta AG9032v1 Platform modules DELTA_AG9032V1_PLATFORM_MODULE_VERSION = 1.1 +DELTA_AG9064_PLATFORM_MODULE_VERSION = 1.1 export DELTA_AG9032V1_PLATFORM_MODULE_VERSION +export DELTA_AG9064_PLATFORM_MODULE_VERSION DELTA_AG9032V1_PLATFORM_MODULE = platform-modules-ag9032v1_$(DELTA_AG9032V1_PLATFORM_MODULE_VERSION)_amd64.deb $(DELTA_AG9032V1_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-delta @@ -10,3 +12,7 @@ $(DELTA_AG9032V1_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_CO $(DELTA_AG9032V1_PLATFORM_MODULE)_PLATFORM = x86_64-delta_ag9032v1-r0 SONIC_DPKG_DEBS += $(DELTA_AG9032V1_PLATFORM_MODULE) + +DELTA_AG9064_PLATFORM_MODULE = platform-modules-ag9064_$(DELTA_AG9064_PLATFORM_MODULE_VERSION)_amd64.deb +$(DELTA_AG9064_PLATFORM_MODULE)_PLATFORM = x86_64-delta_ag9064-r0 +$(eval $(call add_extra_package,$(DELTA_AG9032V1_PLATFORM_MODULE),$(DELTA_AG9064_PLATFORM_MODULE))) diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/cfg/ag9064-modules.conf b/platform/broadcom/sonic-platform-modules-delta/ag9064/cfg/ag9064-modules.conf new file mode 100644 index 000000000000..552b4103ed02 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/cfg/ag9064-modules.conf @@ -0,0 +1,13 @@ +# /etc/modules: kernel modules to load at boot time. +# +# This file contains the names of kernel modules that should be loaded +# at boot time, one per line. Lines beginning with "#" are ignored. + +i2c-i801 +i2c-isch +i2c-ismt +i2c-dev +i2c-mux +i2c-smbus +i2c-mux-gpio +i2c-mux-pca954x diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/Makefile b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/Makefile new file mode 100644 index 000000000000..53589d555416 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/Makefile @@ -0,0 +1,4 @@ +obj-m += delta_ag9064_platform.o +obj-m += i2c-mei.o +i2c-mei-objs := i2c-mei_io.o i2c-mei_main.o i2c-mei_rw.o + diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/client.h b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/client.h new file mode 100644 index 000000000000..04e1aa39243f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/client.h @@ -0,0 +1,255 @@ +/* + * + * Intel Management Engine Interface (Intel MEI) Linux driver + * Copyright (c) 2003-2012, Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +#ifndef _MEI_CLIENT_H_ +#define _MEI_CLIENT_H_ + +#include +#include +#include +#include + +#include "mei_dev.h" + +/* + * reference counting base function + */ +void mei_me_cl_init(struct mei_me_client *me_cl); +void mei_me_cl_put(struct mei_me_client *me_cl); +struct mei_me_client *mei_me_cl_get(struct mei_me_client *me_cl); + +void mei_me_cl_add(struct mei_device *dev, struct mei_me_client *me_cl); +void mei_me_cl_del(struct mei_device *dev, struct mei_me_client *me_cl); + +struct mei_me_client *mei_me_cl_by_uuid(struct mei_device *dev, + const uuid_le *uuid); +struct mei_me_client *mei_me_cl_by_id(struct mei_device *dev, u8 client_id); +struct mei_me_client *mei_me_cl_by_uuid_id(struct mei_device *dev, + const uuid_le *uuid, u8 client_id); +void mei_me_cl_rm_by_uuid(struct mei_device *dev, const uuid_le *uuid); +void mei_me_cl_rm_by_uuid_id(struct mei_device *dev, + const uuid_le *uuid, u8 id); +void mei_me_cl_rm_all(struct mei_device *dev); + +/** + * mei_me_cl_is_active - check whether me client is active in the fw + * + * @me_cl: me client + * + * Return: true if the me client is active in the firmware + */ +static inline bool mei_me_cl_is_active(const struct mei_me_client *me_cl) +{ + return !list_empty_careful(&me_cl->list); +} + +/** + * mei_me_cl_uuid - return me client protocol name (uuid) + * + * @me_cl: me client + * + * Return: me client protocol name + */ +static inline const uuid_le *mei_me_cl_uuid(const struct mei_me_client *me_cl) +{ + return &me_cl->props.protocol_name; +} + +/** + * mei_me_cl_ver - return me client protocol version + * + * @me_cl: me client + * + * Return: me client protocol version + */ +static inline u8 mei_me_cl_ver(const struct mei_me_client *me_cl) +{ + return me_cl->props.protocol_version; +} + +/* + * MEI IO Functions + */ +struct mei_cl_cb *mei_io_cb_init(struct mei_cl *cl, enum mei_cb_file_ops type, + struct file *fp); +void mei_io_cb_free(struct mei_cl_cb *priv_cb); +int mei_io_cb_alloc_buf(struct mei_cl_cb *cb, size_t length); + + +/** + * mei_io_list_init - Sets up a queue list. + * + * @list: An instance cl callback structure + */ +static inline void mei_io_list_init(struct mei_cl_cb *list) +{ + INIT_LIST_HEAD(&list->list); +} +void mei_io_list_flush(struct mei_cl_cb *list, struct mei_cl *cl); + +/* + * MEI Host Client Functions + */ + +struct mei_cl *mei_cl_allocate(struct mei_device *dev); +void mei_cl_init(struct mei_cl *cl, struct mei_device *dev); + + +int mei_cl_link(struct mei_cl *cl, int id); +int mei_cl_unlink(struct mei_cl *cl); + +struct mei_cl *mei_cl_alloc_linked(struct mei_device *dev, int id); + +struct mei_cl_cb *mei_cl_read_cb(const struct mei_cl *cl, + const struct file *fp); +void mei_cl_read_cb_flush(const struct mei_cl *cl, const struct file *fp); +struct mei_cl_cb *mei_cl_alloc_cb(struct mei_cl *cl, size_t length, + enum mei_cb_file_ops type, struct file *fp); +int mei_cl_flush_queues(struct mei_cl *cl, const struct file *fp); + +int mei_cl_flow_ctrl_creds(struct mei_cl *cl); + +int mei_cl_flow_ctrl_reduce(struct mei_cl *cl); +/* + * MEI input output function prototype + */ + +/** + * mei_cl_is_connected - host client is connected + * + * @cl: host client + * + * Return: true if the host client is connected + */ +static inline bool mei_cl_is_connected(struct mei_cl *cl) +{ + return cl->state == MEI_FILE_CONNECTED; +} + +/** + * mei_cl_me_id - me client id + * + * @cl: host client + * + * Return: me client id or 0 if client is not connected + */ +static inline u8 mei_cl_me_id(const struct mei_cl *cl) +{ + return cl->me_cl ? cl->me_cl->client_id : 0; +} + +/** + * mei_cl_mtu - maximal message that client can send and receive + * + * @cl: host client + * + * Return: mtu + */ +static inline size_t mei_cl_mtu(const struct mei_cl *cl) +{ + return cl->me_cl->props.max_msg_length; +} + +/** + * mei_cl_is_fixed_address - check whether the me client uses fixed address + * + * @cl: host client + * + * Return: true if the client is connected and it has fixed me address + */ +static inline bool mei_cl_is_fixed_address(const struct mei_cl *cl) +{ + return cl->me_cl && cl->me_cl->props.fixed_address; +} + +/** + * mei_cl_is_single_recv_buf- check whether the me client + * uses single receiving buffer + * + * @cl: host client + * + * Return: true if single_recv_buf == 1; 0 otherwise + */ +static inline bool mei_cl_is_single_recv_buf(const struct mei_cl *cl) +{ + return cl->me_cl->props.single_recv_buf; +} + +/** + * mei_cl_uuid - client's uuid + * + * @cl: host client + * + * Return: return uuid of connected me client + */ +static inline const uuid_le *mei_cl_uuid(const struct mei_cl *cl) +{ + return mei_me_cl_uuid(cl->me_cl); +} + +/** + * mei_cl_host_addr - client's host address + * + * @cl: host client + * + * Return: 0 for fixed address client, host address for dynamic client + */ +static inline u8 mei_cl_host_addr(const struct mei_cl *cl) +{ + return mei_cl_is_fixed_address(cl) ? 0 : cl->host_client_id; +} + +int mei_cl_disconnect(struct mei_cl *cl); +void mei_cl_set_disconnected(struct mei_cl *cl); +int mei_cl_irq_disconnect(struct mei_cl *cl, struct mei_cl_cb *cb, + struct mei_cl_cb *cmpl_list); +int mei_cl_connect(struct mei_cl *cl, struct mei_me_client *me_cl, + struct file *file); +int mei_cl_irq_connect(struct mei_cl *cl, struct mei_cl_cb *cb, + struct mei_cl_cb *cmpl_list); +int mei_cl_read_start(struct mei_cl *cl, size_t length, struct file *fp); +int mei_cl_irq_read_msg(struct mei_cl *cl, struct mei_msg_hdr *hdr, + struct mei_cl_cb *cmpl_list); +int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking); +int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, + struct mei_cl_cb *cmpl_list); + +void mei_cl_complete(struct mei_cl *cl, struct mei_cl_cb *cb); + +void mei_host_client_init(struct work_struct *work); + +u8 mei_cl_notify_fop2req(enum mei_cb_file_ops fop); +enum mei_cb_file_ops mei_cl_notify_req2fop(u8 request); +int mei_cl_notify_request(struct mei_cl *cl, struct file *file, u8 request); +int mei_cl_irq_notify(struct mei_cl *cl, struct mei_cl_cb *cb, + struct mei_cl_cb *cmpl_list); +int mei_cl_notify_get(struct mei_cl *cl, bool block, bool *notify_ev); +void mei_cl_notify(struct mei_cl *cl); + +void mei_cl_all_disconnect(struct mei_device *dev); +void mei_cl_all_wakeup(struct mei_device *dev); +void mei_cl_all_write_clear(struct mei_device *dev); + +#define MEI_CL_FMT "cl:host=%02d me=%02d " +#define MEI_CL_PRM(cl) (cl)->host_client_id, mei_cl_me_id(cl) + +#define cl_dbg(dev, cl, format, arg...) \ + dev_dbg((dev)->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg) + +#define cl_err(dev, cl, format, arg...) \ + dev_err((dev)->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg) + +#endif /* _MEI_CLIENT_H_ */ diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c new file mode 100644 index 000000000000..df0b47037e12 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c @@ -0,0 +1,1829 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define DEFAULT_NUM 1 +#define BUS9_DEV_NUM 64 +#define BUS9_BASE_NUM 20 + +#define IPMI_MAX_INTF (4) +#define DELTA_NETFN 0x38 +#define BMC_BUS_5 0x04 +#define CMD_SETDATA 0x3 +#define CMD_GETDATA 0x2 + +#define CPLD_REG 0x31 +#define SWPLD1_ADDR 0x35 +#define SWPLD2_ADDR 0x34 +#define SWPLD3_ADDR 0x33 +#define SWPLD4_ADDR 0x32 +#define QSFP_PORT_MUX_REG 0x13 + +#define QSFP_PRESENCE_1 0x3 +#define QSFP_PRESENCE_2 0x3 +#define QSFP_PRESENCE_3 0x24 +#define QSFP_PRESENCE_4 0x24 +#define QSFP_PRESENCE_5 0x4 +#define QSFP_PRESENCE_6 0x4 +#define QSFP_PRESENCE_7 0x25 +#define QSFP_PRESENCE_8 0x25 + +#define QSFP_LP_MODE_1 0x0c +#define QSFP_LP_MODE_2 0x0c +#define QSFP_LP_MODE_3 0x2a +#define QSFP_LP_MODE_4 0x2a +#define QSFP_LP_MODE_5 0x0d +#define QSFP_LP_MODE_6 0x0d +#define QSFP_LP_MODE_7 0x2b +#define QSFP_LP_MODE_8 0x2b + +#define QSFP_RESET_1 0x06 +#define QSFP_RESET_2 0x06 +#define QSFP_RESET_3 0x26 +#define QSFP_RESET_4 0x26 +#define QSFP_RESET_5 0x07 +#define QSFP_RESET_6 0x07 +#define QSFP_RESET_7 0x27 +#define QSFP_RESET_8 0x27 + +#define QSFP_RESPONSE_1 0x09 +#define QSFP_RESPONSE_2 0x09 +#define QSFP_RESPONSE_3 0x28 +#define QSFP_RESPONSE_4 0x28 +#define QSFP_RESPONSE_5 0x0a +#define QSFP_RESPONSE_6 0x0a +#define QSFP_RESPONSE_7 0x29 +#define QSFP_RESPONSE_8 0x29 + +#define QSFP_INTERRUPT_1 0x0f +#define QSFP_INTERRUPT_2 0x0f +#define QSFP_INTERRUPT_3 0x2c +#define QSFP_INTERRUPT_4 0x2c +#define QSFP_INTERRUPT_5 0x10 +#define QSFP_INTERRUPT_6 0x10 +#define QSFP_INTERRUPT_7 0x2d +#define QSFP_INTERRUPT_8 0x2d + +#define SFF8436_INFO(data) \ + .type = "sff8436", .addr = 0x50, .platform_data = (data) + +#define SFF_8346_PORT(eedata) \ + .byte_len = 256, .page_size = 1, .flags = SFF_8436_FLAG_READONLY + +#define ag9064_i2c_device_num(NUM){ \ + .name = "delta-ag9064-i2c-device", \ + .id = NUM, \ + .dev = { \ + .platform_data = &ag9064_i2c_device_platform_data[NUM], \ + .release = device_release, \ + }, \ +} + + +static void msg_handler(struct ipmi_recv_msg *recv_msg,void* handler_data) +{ + struct completion *comp = recv_msg->user_msg_data; + if (comp) + complete(comp); + else + ipmi_free_recv_msg(recv_msg); + return; +} + +static ipmi_user_t ipmi_mh_user = NULL; +static struct ipmi_user_hndl ipmi_hndlrs = { .ipmi_recv_hndl = msg_handler,}; + +static atomic_t dummy_count = ATOMIC_INIT(0); +static void dummy_smi_free(struct ipmi_smi_msg *msg) +{ + atomic_dec(&dummy_count); +} +static void dummy_recv_free(struct ipmi_recv_msg *msg) +{ + atomic_dec(&dummy_count); +} +static struct ipmi_smi_msg halt_smi_msg = { + .done = dummy_smi_free +}; +static struct ipmi_recv_msg halt_recv_msg = { + .done = dummy_recv_free +}; + +struct i2c_client * i2c_client_9548; + +enum{ + BUS0 = 0, + BUS1, + BUS2, + BUS3, + BUS4, + BUS5, + BUS6, + BUS7, + BUS8, + BUS9, + BUS10, + BUS11, + BUS12, + BUS13, + BUS14, +}; + +/* pca9548 - add 8 bus */ +static struct pca954x_platform_mode pca954x_mode[] = +{ + { + .adap_id = 7, + .deselect_on_exit = 1, + }, + { + .adap_id = 8, + .deselect_on_exit = 1, + }, + { + .adap_id = 9, + .deselect_on_exit = 1, + }, + { + .adap_id = 10, + .deselect_on_exit = 1, + }, + { + .adap_id = 11, + .deselect_on_exit = 1, + }, + { + .adap_id = 12, + .deselect_on_exit = 1, + }, + { + .adap_id = 13, + .deselect_on_exit = 1, + }, + { + .adap_id = 14, + .deselect_on_exit = 1, + }, +}; + +static struct pca954x_platform_data pca954x_data = +{ + .modes = pca954x_mode, + .num_modes = ARRAY_SIZE(pca954x_mode), +}; + +static struct i2c_board_info __initdata i2c_info_pca9548[] = +{ + { + I2C_BOARD_INFO("pca9548", 0x70), + .platform_data = &pca954x_data, + }, +}; + +static struct sff_8436_platform_data sff_8436_port[] = { + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, +}; + +/*---------------- IPMI - start ------------- */ + +int dni_create_user(void) +{ + int rv, i; + + for (i=0,rv=1; idev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", + pdata->parent); + return -ENODEV; + } + + pdata->client = i2c_new_device(parent, &pdata->info); + if (!pdata->client) { + dev_err(&pdev->dev, "Failed to create i2c client %s at %d\n", + pdata->info.type, pdata->parent); + return -ENODEV; + } + + return 0; + +} + +static int __exit i2c_deivce_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent; + struct i2c_device_platform_data *pdata; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + if (pdata->client) { + parent = i2c_get_adapter(pdata->parent); + i2c_unregister_device(pdata->client); + i2c_put_adapter(parent); + } + + return 0; +} +static struct platform_driver i2c_device_driver = { + .probe = i2c_device_probe, + .remove = __exit_p(i2c_deivce_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9064-i2c-device", + } +}; + +/*---------------- I2C driver - end ------------- */ + +/*---------------- MUX - start ------------- */ + +struct swpld_mux_platform_data { + int parent; + int base_nr; + struct i2c_client *cpld; +}; + +struct swpld_mux { + struct i2c_adapter *parent; + struct i2c_adapter **child; + struct swpld_mux_platform_data data; +}; + +static struct swpld_mux_platform_data ag9064_swpld_mux_platform_data[] = { + { + .parent = BUS9, + .base_nr = BUS9_BASE_NUM, + .cpld = NULL, + }, +}; + +static struct platform_device ag9064_swpld_mux[] = +{ + { + .name = "delta-ag9064-swpld-mux", + .id = 0, + .dev = { + .platform_data = &ag9064_swpld_mux_platform_data[0], + .release = device_release, + }, + }, +}; + +static int swpld_mux_select(struct i2c_adapter *adap, void *data, u8 chan) +{ + struct swpld_mux *mux = data; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + if ( mux->data.base_nr == BUS9_BASE_NUM ) + { + set_cmd = CMD_SETDATA; + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_PORT_MUX_REG; + cmd_data[3] = chan + 1; + cmd_data_len = sizeof(cmd_data); + return dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + } + else + { + printk(KERN_ERR "Swpld mux QSFP select port error\n"); + return 0; + } +} + +static int __init swpld_mux_probe(struct platform_device *pdev) +{ + struct swpld_mux *mux; + struct swpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int i, ret, dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", pdata->parent); + return -ENODEV; + } + /* Judge bus number to decide how many devices*/ + switch (pdata->parent) { + case BUS9: + dev_num = BUS9_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + mux = kzalloc(sizeof(*mux), GFP_KERNEL); + if (!mux) { + ret = -ENOMEM; + printk(KERN_ERR "Failed to allocate memory for mux\n"); + goto alloc_failed; + } + + mux->parent = parent; + mux->data = *pdata; + mux->child = kzalloc(sizeof(struct i2c_adapter *) * dev_num, GFP_KERNEL); + if (!mux->child) { + ret = -ENOMEM; + printk(KERN_ERR "Failed to allocate memory for device on mux\n"); + goto alloc_failed2; + } + + for (i = 0; i < dev_num; i++) + { + int nr = pdata->base_nr + i; + unsigned int class = 0; + + mux->child[i] = i2c_add_mux_adapter(parent, &pdev->dev, mux, + nr, i, class, + swpld_mux_select, NULL); + if (!mux->child[i]) + { + ret = -ENODEV; + dev_err(&pdev->dev, "Failed to add adapter %d\n", i); + goto add_adapter_failed; + } + } + + platform_set_drvdata(pdev, mux); + return 0; + +add_adapter_failed: + for (; i > 0; i--) + i2c_del_mux_adapter(mux->child[i - 1]); + kfree(mux->child); +alloc_failed2: + kfree(mux); +alloc_failed: + i2c_put_adapter(parent); + + return ret; +} + + +static int __exit swpld_mux_remove(struct platform_device *pdev) +{ + int i; + struct swpld_mux *mux = platform_get_drvdata(pdev); + struct swpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", + pdata->parent); + return -ENODEV; + } + switch (pdata->parent) { + case BUS9: + dev_num = BUS9_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + for (i = 0; i < dev_num; i++) + i2c_del_mux_adapter(mux->child[i]); + + platform_set_drvdata(pdev, NULL); + i2c_put_adapter(mux->parent); + kfree(mux->child); + kfree(mux); + + return 0; +} + +static struct platform_driver swpld_mux_driver = { + .probe = swpld_mux_probe, + .remove = __exit_p(swpld_mux_remove), /* TODO */ + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9064-swpld-mux", + }, +}; + +/*---------------- MUX - end ------------- */ + +/*---------------- CPLD - start ------------- */ + +/* CPLD -- device */ + +static ssize_t get_present(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u64 data = 0; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_PRESENCE_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_PRESENCE_2; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_PRESENCE_3; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_PRESENCE_4; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_PRESENCE_5; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_PRESENCE_6; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_PRESENCE_7; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_PRESENCE_8; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + +static ssize_t get_lpmode(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u64 data = 0; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_LP_MODE_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_LP_MODE_2; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_LP_MODE_3; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_LP_MODE_4; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_LP_MODE_5; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_LP_MODE_6; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_LP_MODE_7; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_LP_MODE_8; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + +static ssize_t get_reset(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u64 data = 0; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESET_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESET_2; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESET_3; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESET_4; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESET_5; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESET_6; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESET_7; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESET_8; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + +static ssize_t get_response(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u64 data = 0; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESPONSE_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESPONSE_2; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESPONSE_3; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESPONSE_4; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESPONSE_5; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESPONSE_6; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESPONSE_7; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESPONSE_8; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + +static ssize_t get_interrupt(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u64 data = 0; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_INTERRUPT_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_INTERRUPT_2; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_INTERRUPT_3; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_INTERRUPT_4; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_INTERRUPT_5; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_INTERRUPT_6; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_INTERRUPT_7; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_INTERRUPT_8; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + + +static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long long set_data; + int err; + + err = kstrtoull(buf, 16, &set_data); + if (err){ + return err; + } + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_SETDATA; + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_LP_MODE_1; + cmd_data[3] = (set_data & 0xff); + cmd_data_len = sizeof(cmd_data); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_LP_MODE_2; + cmd_data[3] = ((set_data >> 8 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_LP_MODE_3; + cmd_data[3] = ((set_data >> 16 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_LP_MODE_4; + cmd_data[3] = ((set_data >> 24 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_LP_MODE_5; + cmd_data[3] = ((set_data >> 32 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_LP_MODE_6; + cmd_data[3] = ((set_data >> 40 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_LP_MODE_7; + cmd_data[3] = ((set_data >> 48 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_LP_MODE_8; + cmd_data[3] = ((set_data >> 56 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + return count; +} + +static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long long set_data; + int err; + + err = kstrtoull(buf, 16, &set_data); + if (err){ + return err; + } + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_SETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESET_1; + cmd_data[3] = (set_data & 0xff); + cmd_data_len = sizeof(cmd_data); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESET_2; + cmd_data[3] = ((set_data >> 8 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESET_3; + cmd_data[3] = ((set_data >> 16 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESET_4; + cmd_data[3] = ((set_data >> 24 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESET_5; + cmd_data[3] = ((set_data >> 32 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESET_6; + cmd_data[3] = ((set_data >> 40 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESET_7; + cmd_data[3] = ((set_data >> 48 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESET_8; + cmd_data[3] = ((set_data >> 56 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + return count; +} + +static ssize_t set_response(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long long set_data; + int err; + + err = kstrtoull(buf, 16, &set_data); + if (err){ + return err; + } + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_SETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESPONSE_1; + cmd_data[3] = (set_data & 0xff); + cmd_data_len = sizeof(cmd_data); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESPONSE_2; + cmd_data[3] = ((set_data >> 8 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESPONSE_3; + cmd_data[3] = ((set_data >> 16 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESPONSE_4; + cmd_data[3] = ((set_data >> 24 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESPONSE_5; + cmd_data[3] = ((set_data >> 32 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESPONSE_6; + cmd_data[3] = ((set_data >> 40 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESPONSE_7; + cmd_data[3] = ((set_data >> 48 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESPONSE_8; + cmd_data[3] = ((set_data >> 56 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + return count; +} + +static DEVICE_ATTR(qsfp_present, S_IRUGO, get_present, NULL); +static DEVICE_ATTR(qsfp_lpmode, S_IWUSR | S_IRUGO, get_lpmode, set_lpmode); +static DEVICE_ATTR(qsfp_reset, S_IWUSR | S_IRUGO, get_reset, set_reset); +static DEVICE_ATTR(qsfp_modsel, S_IWUSR | S_IRUGO, get_response, set_response); +static DEVICE_ATTR(qsfp_interrupt, S_IRUGO, get_interrupt, NULL); + +static struct attribute *ag9064_cpld_attrs[] = { + &dev_attr_qsfp_present.attr, + &dev_attr_qsfp_lpmode.attr, + &dev_attr_qsfp_reset.attr, + &dev_attr_qsfp_modsel.attr, + &dev_attr_qsfp_interrupt.attr, + NULL, +}; + +static struct attribute_group ag9064_cpld_attr_grp = { + .attrs = ag9064_cpld_attrs, +}; + +enum cpld_type { + system_cpld, +}; + +struct cpld_platform_data { + int reg_addr; + struct i2c_client *client; +}; + +static struct cpld_platform_data ag9064_cpld_platform_data[] = { + [system_cpld] = { + .reg_addr = CPLD_REG, + }, +}; + +static struct platform_device ag9064_cpld = { + .name = "delta-ag9064-cpld", + .id = 0, + .dev = { + .platform_data = ag9064_cpld_platform_data, + .release = device_release + }, +}; + +static int __init cpld_probe(struct platform_device *pdev) +{ + struct cpld_platform_data *pdata; + struct i2c_adapter *parent; + int ret; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "CPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(BUS7); + if (!parent) { + printk(KERN_WARNING "Parent adapter (%d) not found\n",BUS7); + return -ENODEV; + } + + pdata[system_cpld].client = i2c_new_dummy(parent, pdata[system_cpld].reg_addr); + if (!pdata[system_cpld].client) { + printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[system_cpld].reg_addr); + goto error; + } + + ret = sysfs_create_group(&pdev->dev.kobj, &ag9064_cpld_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + goto error; + } + + return 0; + +error: + i2c_unregister_device(pdata[system_cpld].client); + i2c_put_adapter(parent); + + return -ENODEV; +} + +static int __exit cpld_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent = NULL; + struct cpld_platform_data *pdata = pdev->dev.platform_data; + sysfs_remove_group(&pdev->dev.kobj, &ag9064_cpld_attr_grp); + + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + } + else { + if (pdata[system_cpld].client) { + if (!parent) { + parent = (pdata[system_cpld].client)->adapter; + } + i2c_unregister_device(pdata[system_cpld].client); + } + } + i2c_put_adapter(parent); + + return 0; +} + +static struct platform_driver cpld_driver = { + .probe = cpld_probe, + .remove = __exit_p(cpld_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9064-cpld", + }, +}; + +/*---------------- CPLD - end ------------- */ + +/*---------------- module initialization ------------- */ + +static void __init delta_ag9064_platform_init(void) +{ + struct i2c_client *client; + struct i2c_adapter *adapter; + struct swpld_mux_platform_data *swpld_pdata; + int ret,i = 0; + + printk("ag9064_platform module initialization\n"); + + adapter = i2c_get_adapter(BUS2); + i2c_client_9548 = i2c_new_device(adapter, &i2c_info_pca9548[0]); + i2c_put_adapter(adapter); + + ret = dni_create_user(); + if (ret != 0){ + printk(KERN_WARNING "Fail to create IPMI user\n"); + } + + ret = platform_driver_register(&cpld_driver); + if (ret) { + printk(KERN_WARNING "Fail to register cpld driver\n"); + goto error_cpld_driver; + } + + // register the mux prob which call the SWPLD + ret = platform_driver_register(&swpld_mux_driver); + if (ret) { + printk(KERN_WARNING "Fail to register swpld mux driver\n"); + goto error_swpld_mux_driver; + } + + // register the i2c devices + ret = platform_driver_register(&i2c_device_driver); + if (ret) { + printk(KERN_WARNING "Fail to register i2c device driver\n"); + goto error_i2c_device_driver; + } + + // register the CPLD + ret = platform_device_register(&ag9064_cpld); + if (ret) { + printk(KERN_WARNING "Fail to create cpld device\n"); + goto error_ag9064_cpld; + } + + swpld_pdata = ag9064_swpld_mux[0].dev.platform_data; + //swpld_pdata->cpld = cpld_pdata[system_cpld].client; + ret = platform_device_register(&ag9064_swpld_mux); + if (ret) { + printk(KERN_WARNING "Fail to create swpld mux\n"); + goto error_ag9064_swpld_mux; + } + + for (i = 0; i < ARRAY_SIZE(ag9064_i2c_device); i++) + { + ret = platform_device_register(&ag9064_i2c_device[i]); + if (ret) + { + printk(KERN_WARNING "Fail to create i2c device %d\n", i); + goto error_ag9064_i2c_device; + } + } + if (ret) + goto error_ag9064_swpld_mux; + + return 0; + +error_ag9064_i2c_device: + i--; + for (; i >= 0; i--) { + platform_device_unregister(&ag9064_i2c_device[i]); + } + i = ARRAY_SIZE(ag9064_swpld_mux); +error_ag9064_swpld_mux: + i--; + for (; i >= 0; i--) { + platform_device_unregister(&ag9064_swpld_mux); + } + platform_driver_unregister(&ag9064_cpld); +error_ag9064_cpld: + platform_driver_unregister(&i2c_device_driver); +error_i2c_device_driver: + platform_driver_unregister(&swpld_mux_driver); +error_swpld_mux_driver: + platform_driver_unregister(&cpld_driver); +error_cpld_driver: + return ret; +} + +static void __exit delta_ag9064_platform_exit(void) +{ + int i = 0; + + for ( i = 0; i < ARRAY_SIZE(ag9064_i2c_device); i++ ) { + platform_device_unregister(&ag9064_i2c_device[i]); + } + + platform_device_unregister(&ag9064_swpld_mux); + platform_device_unregister(&ag9064_cpld); + platform_driver_unregister(&i2c_device_driver); + platform_driver_unregister(&swpld_mux_driver); + platform_driver_unregister(&cpld_driver); + i2c_unregister_device(i2c_client_9548); +} + +module_init(delta_ag9064_platform_init); +module_exit(delta_ag9064_platform_exit); + +MODULE_DESCRIPTION("DELTA ag9064 Platform Support"); +MODULE_AUTHOR("Johnson Lu "); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/hbm.h b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/hbm.h new file mode 100644 index 000000000000..a2025a5083a3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/hbm.h @@ -0,0 +1,62 @@ +/* + * + * Intel Management Engine Interface (Intel MEI) Linux driver + * Copyright (c) 2003-2012, Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +#ifndef _MEI_HBM_H_ +#define _MEI_HBM_H_ + +struct mei_device; +struct mei_msg_hdr; +struct mei_cl; + +/** + * enum mei_hbm_state - host bus message protocol state + * + * @MEI_HBM_IDLE : protocol not started + * @MEI_HBM_STARTING : start request message was sent + * @MEI_HBM_ENUM_CLIENTS : enumeration request was sent + * @MEI_HBM_CLIENT_PROPERTIES : acquiring clients properties + * @MEI_HBM_STARTED : enumeration was completed + * @MEI_HBM_STOPPED : stopping exchange + */ +enum mei_hbm_state { + MEI_HBM_IDLE = 0, + MEI_HBM_STARTING, + MEI_HBM_ENUM_CLIENTS, + MEI_HBM_CLIENT_PROPERTIES, + MEI_HBM_STARTED, + MEI_HBM_STOPPED, +}; + +const char *mei_hbm_state_str(enum mei_hbm_state state); + +int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr); + +void mei_hbm_idle(struct mei_device *dev); +void mei_hbm_reset(struct mei_device *dev); +int mei_hbm_start_req(struct mei_device *dev); +int mei_hbm_start_wait(struct mei_device *dev); +int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl); +int mei_hbm_cl_disconnect_req(struct mei_device *dev, struct mei_cl *cl); +int mei_hbm_cl_disconnect_rsp(struct mei_device *dev, struct mei_cl *cl); +int mei_hbm_cl_connect_req(struct mei_device *dev, struct mei_cl *cl); +bool mei_hbm_version_is_supported(struct mei_device *dev); +int mei_hbm_pg(struct mei_device *dev, u8 pg_cmd); +void mei_hbm_pg_resume(struct mei_device *dev); +int mei_hbm_cl_notify_req(struct mei_device *dev, + struct mei_cl *cl, u8 request); + +#endif /* _MEI_HBM_H_ */ + diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/hw.h b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/hw.h new file mode 100644 index 000000000000..4cebde85924f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/hw.h @@ -0,0 +1,426 @@ +/* + * + * Intel Management Engine Interface (Intel MEI) Linux driver + * Copyright (c) 2003-2012, Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +#ifndef _MEI_HW_TYPES_H_ +#define _MEI_HW_TYPES_H_ + +#include + +/* + * Timeouts in Seconds + */ +#define MEI_HW_READY_TIMEOUT 2 /* Timeout on ready message */ +#define MEI_CONNECT_TIMEOUT 3 /* HPS: at least 2 seconds */ + +#define MEI_CL_CONNECT_TIMEOUT 15 /* HPS: Client Connect Timeout */ +#define MEI_CLIENTS_INIT_TIMEOUT 15 /* HPS: Clients Enumeration Timeout */ + +#define MEI_IAMTHIF_STALL_TIMER 12 /* HPS */ +#define MEI_IAMTHIF_READ_TIMER 10 /* HPS */ + +#define MEI_PGI_TIMEOUT 1 /* PG Isolation time response 1 sec */ +#define MEI_D0I3_TIMEOUT 5 /* D0i3 set/unset max response time */ +#define MEI_HBM_TIMEOUT 1 /* 1 second */ + +/* + * MEI Version + */ +#define HBM_MINOR_VERSION 0 +#define HBM_MAJOR_VERSION 2 + +/* + * MEI version with PGI support + */ +#define HBM_MINOR_VERSION_PGI 1 +#define HBM_MAJOR_VERSION_PGI 1 + +/* + * MEI version with Dynamic clients support + */ +#define HBM_MINOR_VERSION_DC 0 +#define HBM_MAJOR_VERSION_DC 2 + +/* + * MEI version with disconnect on connection timeout support + */ +#define HBM_MINOR_VERSION_DOT 0 +#define HBM_MAJOR_VERSION_DOT 2 + +/* + * MEI version with notifcation support + */ +#define HBM_MINOR_VERSION_EV 0 +#define HBM_MAJOR_VERSION_EV 2 + +/* Host bus message command opcode */ +#define MEI_HBM_CMD_OP_MSK 0x7f +/* Host bus message command RESPONSE */ +#define MEI_HBM_CMD_RES_MSK 0x80 + +/* + * MEI Bus Message Command IDs + */ +#define HOST_START_REQ_CMD 0x01 +#define HOST_START_RES_CMD 0x81 + +#define HOST_STOP_REQ_CMD 0x02 +#define HOST_STOP_RES_CMD 0x82 + +#define ME_STOP_REQ_CMD 0x03 + +#define HOST_ENUM_REQ_CMD 0x04 +#define HOST_ENUM_RES_CMD 0x84 + +#define HOST_CLIENT_PROPERTIES_REQ_CMD 0x05 +#define HOST_CLIENT_PROPERTIES_RES_CMD 0x85 + +#define CLIENT_CONNECT_REQ_CMD 0x06 +#define CLIENT_CONNECT_RES_CMD 0x86 + +#define CLIENT_DISCONNECT_REQ_CMD 0x07 +#define CLIENT_DISCONNECT_RES_CMD 0x87 + +#define MEI_FLOW_CONTROL_CMD 0x08 + +#define MEI_PG_ISOLATION_ENTRY_REQ_CMD 0x0a +#define MEI_PG_ISOLATION_ENTRY_RES_CMD 0x8a +#define MEI_PG_ISOLATION_EXIT_REQ_CMD 0x0b +#define MEI_PG_ISOLATION_EXIT_RES_CMD 0x8b + +#define MEI_HBM_ADD_CLIENT_REQ_CMD 0x0f +#define MEI_HBM_ADD_CLIENT_RES_CMD 0x8f + +#define MEI_HBM_NOTIFY_REQ_CMD 0x10 +#define MEI_HBM_NOTIFY_RES_CMD 0x90 +#define MEI_HBM_NOTIFICATION_CMD 0x11 + +/* + * MEI Stop Reason + * used by hbm_host_stop_request.reason + */ +enum mei_stop_reason_types { + DRIVER_STOP_REQUEST = 0x00, + DEVICE_D1_ENTRY = 0x01, + DEVICE_D2_ENTRY = 0x02, + DEVICE_D3_ENTRY = 0x03, + SYSTEM_S1_ENTRY = 0x04, + SYSTEM_S2_ENTRY = 0x05, + SYSTEM_S3_ENTRY = 0x06, + SYSTEM_S4_ENTRY = 0x07, + SYSTEM_S5_ENTRY = 0x08 +}; + + +/** + * enum mei_hbm_status - mei host bus messages return values + * + * @MEI_HBMS_SUCCESS : status success + * @MEI_HBMS_CLIENT_NOT_FOUND : client not found + * @MEI_HBMS_ALREADY_EXISTS : connection already established + * @MEI_HBMS_REJECTED : connection is rejected + * @MEI_HBMS_INVALID_PARAMETER : invalid parameter + * @MEI_HBMS_NOT_ALLOWED : operation not allowed + * @MEI_HBMS_ALREADY_STARTED : system is already started + * @MEI_HBMS_NOT_STARTED : system not started + * + * @MEI_HBMS_MAX : sentinel + */ +enum mei_hbm_status { + MEI_HBMS_SUCCESS = 0, + MEI_HBMS_CLIENT_NOT_FOUND = 1, + MEI_HBMS_ALREADY_EXISTS = 2, + MEI_HBMS_REJECTED = 3, + MEI_HBMS_INVALID_PARAMETER = 4, + MEI_HBMS_NOT_ALLOWED = 5, + MEI_HBMS_ALREADY_STARTED = 6, + MEI_HBMS_NOT_STARTED = 7, + + MEI_HBMS_MAX +}; + + +/* + * Client Connect Status + * used by hbm_client_connect_response.status + */ +enum mei_cl_connect_status { + MEI_CL_CONN_SUCCESS = MEI_HBMS_SUCCESS, + MEI_CL_CONN_NOT_FOUND = MEI_HBMS_CLIENT_NOT_FOUND, + MEI_CL_CONN_ALREADY_STARTED = MEI_HBMS_ALREADY_EXISTS, + MEI_CL_CONN_OUT_OF_RESOURCES = MEI_HBMS_REJECTED, + MEI_CL_CONN_MESSAGE_SMALL = MEI_HBMS_INVALID_PARAMETER, + MEI_CL_CONN_NOT_ALLOWED = MEI_HBMS_NOT_ALLOWED, +}; + +/* + * Client Disconnect Status + */ +enum mei_cl_disconnect_status { + MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS +}; + +/* + * MEI BUS Interface Section + */ +struct mei_msg_hdr { + u32 me_addr:8; + u32 host_addr:8; + u32 length:9; + u32 reserved:5; + u32 internal:1; + u32 msg_complete:1; +} __packed; + + +struct mei_bus_message { + u8 hbm_cmd; + u8 data[0]; +} __packed; + +/** + * struct hbm_cl_cmd - client specific host bus command + * CONNECT, DISCONNECT, and FlOW CONTROL + * + * @hbm_cmd: bus message command header + * @me_addr: address of the client in ME + * @host_addr: address of the client in the driver + * @data: generic data + */ +struct mei_hbm_cl_cmd { + u8 hbm_cmd; + u8 me_addr; + u8 host_addr; + u8 data; +}; + +struct hbm_version { + u8 minor_version; + u8 major_version; +} __packed; + +struct hbm_host_version_request { + u8 hbm_cmd; + u8 reserved; + struct hbm_version host_version; +} __packed; + +struct hbm_host_version_response { + u8 hbm_cmd; + u8 host_version_supported; + struct hbm_version me_max_version; +} __packed; + +struct hbm_host_stop_request { + u8 hbm_cmd; + u8 reason; + u8 reserved[2]; +} __packed; + +struct hbm_host_stop_response { + u8 hbm_cmd; + u8 reserved[3]; +} __packed; + +struct hbm_me_stop_request { + u8 hbm_cmd; + u8 reason; + u8 reserved[2]; +} __packed; + +/** + * struct hbm_host_enum_request - enumeration request from host to fw + * + * @hbm_cmd: bus message command header + * @allow_add: allow dynamic clients add HBM version >= 2.0 + * @reserved: reserved + */ +struct hbm_host_enum_request { + u8 hbm_cmd; + u8 allow_add; + u8 reserved[2]; +} __packed; + +struct hbm_host_enum_response { + u8 hbm_cmd; + u8 reserved[3]; + u8 valid_addresses[32]; +} __packed; + +struct mei_client_properties { + uuid_le protocol_name; + u8 protocol_version; + u8 max_number_of_connections; + u8 fixed_address; + u8 single_recv_buf; + u32 max_msg_length; +} __packed; + +struct hbm_props_request { + u8 hbm_cmd; + u8 me_addr; + u8 reserved[2]; +} __packed; + +struct hbm_props_response { + u8 hbm_cmd; + u8 me_addr; + u8 status; + u8 reserved[1]; + struct mei_client_properties client_properties; +} __packed; + +/** + * struct hbm_add_client_request - request to add a client + * might be sent by fw after enumeration has already completed + * + * @hbm_cmd: bus message command header + * @me_addr: address of the client in ME + * @reserved: reserved + * @client_properties: client properties + */ +struct hbm_add_client_request { + u8 hbm_cmd; + u8 me_addr; + u8 reserved[2]; + struct mei_client_properties client_properties; +} __packed; + +/** + * struct hbm_add_client_response - response to add a client + * sent by the host to report client addition status to fw + * + * @hbm_cmd: bus message command header + * @me_addr: address of the client in ME + * @status: if HBMS_SUCCESS then the client can now accept connections. + * @reserved: reserved + */ +struct hbm_add_client_response { + u8 hbm_cmd; + u8 me_addr; + u8 status; + u8 reserved[1]; +} __packed; + +/** + * struct hbm_power_gate - power gate request/response + * + * @hbm_cmd: bus message command header + * @reserved: reserved + */ +struct hbm_power_gate { + u8 hbm_cmd; + u8 reserved[3]; +} __packed; + +/** + * struct hbm_client_connect_request - connect/disconnect request + * + * @hbm_cmd: bus message command header + * @me_addr: address of the client in ME + * @host_addr: address of the client in the driver + * @reserved: reserved + */ +struct hbm_client_connect_request { + u8 hbm_cmd; + u8 me_addr; + u8 host_addr; + u8 reserved; +} __packed; + +/** + * struct hbm_client_connect_response - connect/disconnect response + * + * @hbm_cmd: bus message command header + * @me_addr: address of the client in ME + * @host_addr: address of the client in the driver + * @status: status of the request + */ +struct hbm_client_connect_response { + u8 hbm_cmd; + u8 me_addr; + u8 host_addr; + u8 status; +} __packed; + + +#define MEI_FC_MESSAGE_RESERVED_LENGTH 5 + +struct hbm_flow_control { + u8 hbm_cmd; + u8 me_addr; + u8 host_addr; + u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH]; +} __packed; + +#define MEI_HBM_NOTIFICATION_START 1 +#define MEI_HBM_NOTIFICATION_STOP 0 +/** + * struct hbm_notification_request - start/stop notification request + * + * @hbm_cmd: bus message command header + * @me_addr: address of the client in ME + * @host_addr: address of the client in the driver + * @start: start = 1 or stop = 0 asynchronous notifications + */ +struct hbm_notification_request { + u8 hbm_cmd; + u8 me_addr; + u8 host_addr; + u8 start; +} __packed; + +/** + * struct hbm_notification_response - start/stop notification response + * + * @hbm_cmd: bus message command header + * @me_addr: address of the client in ME + * @host_addr: - address of the client in the driver + * @status: (mei_hbm_status) response status for the request + * - MEI_HBMS_SUCCESS: successful stop/start + * - MEI_HBMS_CLIENT_NOT_FOUND: if the connection could not be found. + * - MEI_HBMS_ALREADY_STARTED: for start requests for a previously + * started notification. + * - MEI_HBMS_NOT_STARTED: for stop request for a connected client for whom + * asynchronous notifications are currently disabled. + * + * @start: start = 1 or stop = 0 asynchronous notifications + * @reserved: reserved + */ +struct hbm_notification_response { + u8 hbm_cmd; + u8 me_addr; + u8 host_addr; + u8 status; + u8 start; + u8 reserved[3]; +} __packed; + +/** + * struct hbm_notification - notification event + * + * @hbm_cmd: bus message command header + * @me_addr: address of the client in ME + * @host_addr: address of the client in the driver + * @reserved: reserved for alignment + */ +struct hbm_notification { + u8 hbm_cmd; + u8 me_addr; + u8 host_addr; + u8 reserved[1]; +} __packed; + +#endif diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_io.c b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_io.c new file mode 100644 index 000000000000..97c93c6122bf --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_io.c @@ -0,0 +1,636 @@ + +#include "i2c-mei_rw.h" + + +/* ========== IoLibGcc.c ========= */ + +/** + Reads an 8-bit I/O port. + + Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned. + This function must guarantee that all I/O read and write operations are + serialized. + + If 8-bit I/O port operations are not supported, then ASSERT(). + + @param Port The I/O port to read. + + @return The value read. + +**/ +//__inline__ +UINT8 +IoRead8 ( + IN UINTN Port + ) +{ + UINT8 Data; + + __asm__ __volatile__ ("inb %w1,%b0" : "=a" (Data) : "d" ((UINT16)Port)); + return Data; +} + +/** + Writes an 8-bit I/O port. + + Writes the 8-bit I/O port specified by Port with the value specified by Value + and returns Value. This function must guarantee that all I/O read and write + operations are serialized. + + If 8-bit I/O port operations are not supported, then ASSERT(). + + @param Port The I/O port to write. + @param Value The value to write to the I/O port. + + @return The value written the I/O port. + +**/ +//__inline__ +UINT8 +IoWrite8 ( + IN UINTN Port, + IN UINT8 Value + ) +{ + __asm__ __volatile__ ("outb %b0,%w1" : : "a" (Value), "d" ((UINT16)Port)); + return Value;; +} + +/** + Reads a 16-bit I/O port. + + Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned. + This function must guarantee that all I/O read and write operations are + serialized. + + If 16-bit I/O port operations are not supported, then ASSERT(). + If Port is not aligned on a 16-bit boundary, then ASSERT(). + + @param Port The I/O port to read. + + @return The value read. + +**/ +//__inline__ +UINT16 +IoRead16 ( + IN UINTN Port + ) +{ + UINT16 Data; + + if((Port & 1) != 0) + printk("Failed\n"); + __asm__ __volatile__ ("inw %w1,%w0" : "=a" (Data) : "d" ((UINT16)Port)); + return Data; +} + +/** + Writes a 16-bit I/O port. + + Writes the 16-bit I/O port specified by Port with the value specified by Value + and returns Value. This function must guarantee that all I/O read and write + operations are serialized. + + If 16-bit I/O port operations are not supported, then ASSERT(). + If Port is not aligned on a 16-bit boundary, then ASSERT(). + + @param Port The I/O port to write. + @param Value The value to write to the I/O port. + + @return The value written the I/O port. + +**/ +//__inline__ +UINT16 +IoWrite16 ( + IN UINTN Port, + IN UINT16 Value + ) +{ + if((Port & 1) != 0) + printk("Failed\n"); + __asm__ __volatile__ ("outw %w0,%w1" : : "a" (Value), "d" ((UINT16)Port)); + return Value;; +} + +/** + Reads a 32-bit I/O port. + + Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned. + This function must guarantee that all I/O read and write operations are + serialized. + + If 32-bit I/O port operations are not supported, then ASSERT(). + If Port is not aligned on a 32-bit boundary, then ASSERT(). + + @param Port The I/O port to read. + + @return The value read. + +**/ +//__inline__ +UINT32 +IoRead32 ( + IN UINTN Port + ) +{ + UINT32 Data; + + if((Port & 3) != 0) + printk("Failed\n"); + __asm__ __volatile__ ("inl %w1,%0" : "=a" (Data) : "d" ((UINT16)Port)); + return Data; +} + +/** + Writes a 32-bit I/O port. + + Writes the 32-bit I/O port specified by Port with the value specified by Value + and returns Value. This function must guarantee that all I/O read and write + operations are serialized. + + If 32-bit I/O port operations are not supported, then ASSERT(). + If Port is not aligned on a 32-bit boundary, then ASSERT(). + + @param Port The I/O port to write. + @param Value The value to write to the I/O port. + + @return The value written the I/O port. + +**/ +//__inline__ +UINT32 +IoWrite32 ( + IN UINTN Port, + IN UINT32 Value + ) +{ + if((Port & 3) != 0) + printk("Failed\n"); + __asm__ __volatile__ ("outl %0,%w1" : : "a" (Value), "d" ((UINT16)Port)); + return Value; +} + + + +/* ========== GccInline.c ========= */ + +/** + Enables CPU interrupts. + + Enables CPU interrupts. + +**/ +VOID +EnableInterrupts ( + VOID + ) +{ + __asm__ __volatile__ ("sti"::: "memory"); +} + +/** + Disables CPU interrupts. + + Disables CPU interrupts. + +**/ +VOID +DisableInterrupts ( + VOID + ) +{ + __asm__ __volatile__ ("cli"::: "memory"); +} + +/** + Reads the current value of the EFLAGS register. + + Reads and returns the current value of the EFLAGS register. This function is + only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a + 64-bit value on X64. + + @return EFLAGS on IA-32 or RFLAGS on X64. + +**/ +UINTN +AsmReadEflags ( + VOID + ) +{ + UINTN Eflags; + + __asm__ __volatile__ ( + "pushfq \n\t" + "pop %0 " + : "=r" (Eflags) // %0 + ); + + return Eflags; +} + + + +/* ========== X86GetInterruptState.c ========= */ + +/** + Retrieves the current CPU interrupt state. + + Returns TRUE is interrupts are currently enabled. Otherwise + returns FALSE. + + @retval TRUE CPU interrupts are enabled. + @retval FALSE CPU interrupts are disabled. + +**/ +BOOLEAN +GetInterruptState ( + VOID + ) +{ + IA32_EFLAGS32 EFlags; + + EFlags.UintN = AsmReadEflags (); + return (BOOLEAN)(1 == EFlags.Bits.IF); +} + + + +/* ========== Cpu.c ========= */ + +/** + Disables CPU interrupts and returns the interrupt state prior to the disable + operation. + + @retval TRUE CPU interrupts were enabled on entry to this call. + @retval FALSE CPU interrupts were disabled on entry to this call. + +**/ +BOOLEAN +SaveAndDisableInterrupts ( + VOID + ) +{ + BOOLEAN InterruptState; + + InterruptState = GetInterruptState (); + DisableInterrupts (); + return InterruptState; +} + +/** + Set the current CPU interrupt state. + + Sets the current CPU interrupt state to the state specified by + InterruptState. If InterruptState is TRUE, then interrupts are enabled. If + InterruptState is FALSE, then interrupts are disabled. InterruptState is + returned. + + @param InterruptState TRUE if interrupts should be enabled. FALSE if + interrupts should be disabled. + + @return InterruptState + +**/ +BOOLEAN +SetInterruptState ( + IN BOOLEAN InterruptState + ) +{ + if (InterruptState) { + EnableInterrupts (); + } else { + DisableInterrupts (); + } + return InterruptState; +} + + + +/* ========== pciLib.c ========= */ + +// +// Declare I/O Ports used to perform PCI Confguration Cycles +// +#define PCI_CONFIGURATION_ADDRESS_PORT 0xCF8 +#define PCI_CONFIGURATION_DATA_PORT 0xCFC + +/** + Convert a PCI Library address to PCI CF8 formatted address. + + Declare macro to convert PCI Library address to PCI CF8 formatted address. + Bit fields of PCI Library and CF8 formatted address is as follows: + PCI Library formatted address CF8 Formatted Address + ============================= ====================== + Bits 00..11 Register Bits 00..07 Register + Bits 12..14 Function Bits 08..10 Function + Bits 15..19 Device Bits 11..15 Device + Bits 20..27 Bus Bits 16..23 Bus + Bits 28..31 Reserved(MBZ) Bits 24..30 Reserved(MBZ) + Bits 31..31 Must be 1 + + @param A The address to convert. + + @retval The coverted address. + +**/ +#define PCI_TO_CF8_ADDRESS(A) \ + ((UINT32) ((((A) >> 4) & 0x00ffff00) | ((A) & 0xfc) | 0x80000000)) + +/** + Reads an 8-bit PCI configuration register. + + Reads and returns the 8-bit PCI configuration register specified by Address. + This function must guarantee that all PCI read and write operations are + serialized. + + If Address > 0x0FFFFFFF, then ASSERT(). + If the register specified by Address >= 0x100, then ASSERT(). + + @param Address The address that encodes the PCI Bus, Device, Function and + Register. + + @return The read value from the PCI configuration register. + +**/ +UINT8 +PciCf8Read8 ( + IN UINTN Address + ) +{ + BOOLEAN InterruptState; + UINT32 AddressPort; + UINT8 Result; + + InterruptState = SaveAndDisableInterrupts (); + AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT); + IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address)); + Result = IoRead8 (PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 3)); + IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); + SetInterruptState (InterruptState); + return Result; +} + +/** + Writes an 8-bit PCI configuration register. + + Writes the 8-bit PCI configuration register specified by Address with the + value specified by Value. Value is returned. This function must guarantee + that all PCI read and write operations are serialized. + + If Address > 0x0FFFFFFF, then ASSERT(). + If the register specified by Address >= 0x100, then ASSERT(). + + @param Address The address that encodes the PCI Bus, Device, Function and + Register. + @param Value The value to write. + + @return The value written to the PCI configuration register. + +**/ +UINT8 +PciCf8Write8 ( + IN UINTN Address, + IN UINT8 Value + ) +{ + BOOLEAN InterruptState; + UINT32 AddressPort; + UINT8 Result; + + InterruptState = SaveAndDisableInterrupts (); + AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT); + IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address)); + Result = IoWrite8 ( + PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 3), + Value + ); + IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); + SetInterruptState (InterruptState); + return Result; +} + +/** + Reads a 16-bit PCI configuration register. + + Reads and returns the 16-bit PCI configuration register specified by Address. + This function must guarantee that all PCI read and write operations are + serialized. + + If Address > 0x0FFFFFFF, then ASSERT(). + If Address is not aligned on a 16-bit boundary, then ASSERT(). + If the register specified by Address >= 0x100, then ASSERT(). + + @param Address The address that encodes the PCI Bus, Device, Function and + Register. + + @return The read value from the PCI configuration register. + +**/ +UINT16 +PciCf8Read16 ( + IN UINTN Address + ) +{ + BOOLEAN InterruptState; + UINT32 AddressPort; + UINT16 Result; + + InterruptState = SaveAndDisableInterrupts (); + AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT); + IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address)); + Result = IoRead16 (PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 2)); + IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); + SetInterruptState (InterruptState); + return Result; +} + +/** + Writes a 16-bit PCI configuration register. + + Writes the 16-bit PCI configuration register specified by Address with the + value specified by Value. Value is returned. This function must guarantee + that all PCI read and write operations are serialized. + + If Address > 0x0FFFFFFF, then ASSERT(). + If Address is not aligned on a 16-bit boundary, then ASSERT(). + If the register specified by Address >= 0x100, then ASSERT(). + + @param Address The address that encodes the PCI Bus, Device, Function and + Register. + @param Value The value to write. + + @return The value written to the PCI configuration register. + +**/ +UINT16 +PciCf8Write16 ( + IN UINTN Address, + IN UINT16 Value + ) +{ + BOOLEAN InterruptState; + UINT32 AddressPort; + UINT16 Result; + + InterruptState = SaveAndDisableInterrupts (); + AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT); + IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address)); + Result = IoWrite16 ( + PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 2), + Value + ); + IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); + SetInterruptState (InterruptState); + return Result; +} + +/** + Reads a 32-bit PCI configuration register. + + Reads and returns the 32-bit PCI configuration register specified by Address. + This function must guarantee that all PCI read and write operations are + serialized. + + If Address > 0x0FFFFFFF, then ASSERT(). + If Address is not aligned on a 32-bit boundary, then ASSERT(). + If the register specified by Address >= 0x100, then ASSERT(). + + @param Address The address that encodes the PCI Bus, Device, Function and + Register. + + @return The read value from the PCI configuration register. + +**/ +UINT32 +PciCf8Read32 ( + IN UINTN Address + ) +{ + BOOLEAN InterruptState; + UINT32 AddressPort; + UINT32 Result; + + InterruptState = SaveAndDisableInterrupts (); + AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT); + IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address)); + Result = IoRead32 (PCI_CONFIGURATION_DATA_PORT); + IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); + SetInterruptState (InterruptState); + return Result; +} + +/** + Writes a 32-bit PCI configuration register. + + Writes the 32-bit PCI configuration register specified by Address with the + value specified by Value. Value is returned. This function must guarantee + that all PCI read and write operations are serialized. + + If Address > 0x0FFFFFFF, then ASSERT(). + If Address is not aligned on a 32-bit boundary, then ASSERT(). + If the register specified by Address >= 0x100, then ASSERT(). + + @param Address The address that encodes the PCI Bus, Device, Function and + Register. + @param Value The value to write. + + @return The value written to the PCI configuration register. + +**/ +UINT32 +PciCf8Write32 ( + IN UINTN Address, + IN UINT32 Value + ) +{ + BOOLEAN InterruptState; + UINT32 AddressPort; + UINT32 Result; + + InterruptState = SaveAndDisableInterrupts (); + AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT); + IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address)); + Result = IoWrite32 ( + PCI_CONFIGURATION_DATA_PORT, + Value + ); + IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); + SetInterruptState (InterruptState); + return Result; +} + + + +/* ========== Other ========= */ + +// UINT8 PciRead8(UINT64 addr) +// { +// printf("[%s] addr: %8X.\n", __func__, addr); +// return 0x01; +// } + +// UINT8 PciWrite8(UINT64 addr, UINT8 data) +// { +// printf("[%s] addr: %8X data: %2X.\n", __func__, addr, data); +// return 0x02; +// } + + +// UINT16 PciRead16(UINT64 addr) +// { +// printf("[%s] addr: %8X.\n", __func__, addr); +// return 0x03; +// } + +// UINT16 PciWrite16(UINT64 addr, UINT8 data) +// { +// printf("[%s] addr: %8X data: %2X.\n", __func__, addr, data); +// return 0x04; +// } + + +// UINT32 PciRead32(UINT64 addr) +// { +// printf("[%s] addr: %8X.\n", __func__, addr); +// return 0x05; +// } + +// UINT32 PciWrite32(UINT64 addr, UINT8 data) +// { +// printf("[%s] addr: %8X data: %2X.\n", __func__, addr, data); +// return 0x06; +// } + +UINT8 PciRead8(UINT64 addr) +{ + return PciCf8Read8 (addr); +} + +UINT8 PciWrite8(UINT64 addr, UINT8 data) +{ + return PciCf8Write8 (addr, data); +} + + +UINT16 PciRead16(UINT64 addr) +{ + return PciCf8Read16 (addr); +} + +UINT16 PciWrite16(UINT64 addr, UINT8 data) +{ + return PciCf8Write16 (addr, data); +} + + +UINT32 PciRead32(UINT64 addr) +{ + return PciCf8Read32 (addr); +} + +UINT32 PciWrite32(UINT64 addr, UINT8 data) +{ + return PciCf8Write32 (addr, data); +} diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_io.h b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_io.h new file mode 100644 index 000000000000..5180cc47e736 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_io.h @@ -0,0 +1,46 @@ + +#include "i2c-mei_type.h" + + + +/* ========== PciLib.h ========= */ + +/** + Macro that converts PCI Bus, PCI Device, PCI Function and PCI Register to an + address that can be passed to the PCI Library functions. + + @param Bus PCI Bus number. Range 0..255. + @param Device PCI Device number. Range 0..31. + @param Function PCI Function number. Range 0..7. + @param Register PCI Register number. Range 0..255 for PCI. Range 0..4095 + for PCI Express. + + @return The encoded PCI address. + +**/ +#define PCI_LIB_ADDRESS(Bus,Device,Function,Register) \ + (((Register) & 0xfff) | (((Function) & 0x07) << 12) | (((Device) & 0x1f) << 15) | (((Bus) & 0xff) << 20)) + + + +/* ========== Qubbing ========= */ + +UINT8 PciRead8(UINT64 addr); + +UINT8 PciWrite8(UINT64 addr, UINT8 data); + +UINT16 PciRead16(UINT64 addr); + +UINT16 PciWrite16(UINT64 addr, UINT8 data); + +UINT32 PciRead32(UINT64 addr); + +UINT32 PciWrite32(UINT64 addr, UINT8 data); + + +void I2C_Set(UINT8 smbus, UINT8 daddr, INT32 reg, UINT8 *data, UINT8 dlen); + +void I2C_Read(UINT8 smbus, UINT8 daddr, INT32 reg, UINT8 dlen); + +void VersionRead(void); +void I2C_Probe(void); \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_main.c b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_main.c new file mode 100644 index 000000000000..6a412a783c54 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_main.c @@ -0,0 +1,578 @@ +/* + * MEI-I2C driver + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mei_dev.h" +#include "client.h" +#include "i2c-mei_rw.h" + +#if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \ + defined CONFIG_DMI +#include +#include +#endif + +/* PCI Address Constants */ +#define SMBBAR 0 +#define SMBPCICTL 0x004 +#define SMBPCISTS 0x006 +#define SMBHSTCFG 0x040 +#define TCOBASE 0x050 +#define TCOCTL 0x054 + +/* Other settings */ +#define MAX_RETRIES 400 + +/* I801 command constants */ +#define I801_QUICK 0x00 +#define I801_BYTE 0x04 +#define I801_BYTE_DATA 0x08 +#define I801_WORD_DATA 0x0C +#define I801_PROC_CALL 0x10 /* unimplemented */ +#define I801_BLOCK_DATA 0x14 +#define I801_I2C_BLOCK_DATA 0x18 /* ICH5 and later */ + +#define HECI_PEC_FLAG 0x80 + +#define PCI_DEVICE_ID_INTEL_LPT_H 0x8C3A /* Lynx Point H */ + +struct mei_i2c_mux_config { + char *gpio_chip; + unsigned values[3]; + int n_values; + unsigned classes[3]; + unsigned gpios[2]; /* Relative to gpio_chip->base */ + int n_gpios; +}; + +#define FEATURE_SMBUS_PEC (1 << 0) +#define FEATURE_BLOCK_BUFFER (1 << 1) +#define FEATURE_BLOCK_PROC (1 << 2) +#define FEATURE_I2C_BLOCK_READ (1 << 3) +#define FEATURE_IRQ (1 << 4) +/* Not really a feature, but it's convenient to handle it as such */ +#define FEATURE_IDF (1 << 15) +#define FEATURE_TCO (1 << 16) + +static const char *mei_i2c_feature_names[] = { + "SMBus PEC", + "Block buffer", + "Block process call", + "I2C block read", + "Interrupt", +}; + +static unsigned int disable_features; +module_param(disable_features, uint, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(disable_features, "Disable selected driver features:\n" + "\t\t 0x01 disable SMBus PEC\n" + "\t\t 0x02 disable the block buffer\n" + "\t\t 0x08 disable the I2C block read functionality\n" + "\t\t 0x10 don't use interrupts "); + + +/*MEI SMB Sensor Bus (when MEI_FLAG_SMB_DEV_ADD_FMAT_EXT)*/ +#define MEI_SMB_BUS_SMBUS 0x0 +#define MEI_SMB_BUS_SMLINK0 0x1 +#define MEI_SMB_BUS_SMLINK1 0x2 +#define MEI_SMB_BUS_SMLINK2 0x3 +#define MEI_SMB_BUS_SMLINK3 0x4 +#define MEI_SMB_BUS_SMLINK4 0x5 + +struct mei_smb_priv{ + struct i2c_adapter adapter; + unsigned long smba; + unsigned char original_hstcfg; + struct pci_dev *pci_dev; + unsigned int features; + unsigned char sensorbus; + /* isr processing */ + wait_queue_head_t waitq; + u8 status; + /* Command state used by isr for byte-by-byte block transactions */ + u8 cmd; + bool is_read; + int count; + int len; + u8 *data; +}; + + +struct mei_i2c_data_ext{ + char Cmd; + char Flag; + char Sensor_Bus; + char Psu_Addr; + char Mux_Addr; + char Mux_Channel; + char Mux_Conf; + char Reserved; + char W_Length; + char R_Length; + char PMbus_data[21]; +}; + +struct mei_msg{ + struct mei_msg_hdr hdr; + struct mei_i2c_data_ext data; +}; + +#define DEBUG_MSG 0 +static int mei_TxRx(u8 sensor_bus, u16 addr, u8 command, char read_write, int size, union i2c_smbus_data * data, int pec) +{ + struct mei_msg_hdr mei_hdr; + int rets; + unsigned char * recv_buf; + int retry = 0; + int len = 0; + int i = 0; + + struct mei_msg * msg; + unsigned char blen; + + UINT32 timeout, dwTimeout; + HECI_DEVICE sHeciDev; + + recv_buf = kmalloc(sizeof(unsigned char) * (32), GFP_KERNEL); + msg = kmalloc(sizeof(struct mei_msg), GFP_KERNEL); + + dwTimeout = 2000000 / HECI_TIMEOUT_UNIT; + + sHeciDev.Bus = HECI_BUS; + sHeciDev.Dev = HECI_DEV; + sHeciDev.Fun = HECI_FUN; + sHeciDev.Hidm = HECI_HIDM_MSI; + sHeciDev.Mbar = HECI_MBAR_DEFAULT; + HeciInit(&sHeciDev, &dwTimeout); + + msg->data.Cmd = 0x0A; + if(read_write){ + if(size == I2C_SMBUS_WORD_DATA){ + msg->data.Flag = 0x56; + msg->data.W_Length = 1; + msg->data.R_Length = 2; + } + else if(size == I2C_SMBUS_BYTE_DATA || size == I2C_SMBUS_QUICK){ + msg->data.Flag = 0x52; + msg->data.W_Length = 1; + msg->data.R_Length = 1; + }else if(size == I2C_SMBUS_BYTE){ + msg->data.Flag = 0x50; + msg->data.W_Length = 0; + msg->data.R_Length = 1; + }else if(size == I2C_SMBUS_BLOCK_DATA){ + msg->data.Flag = 0x5A; + msg->data.W_Length = 1; + } + + } + else{ + if(size == I2C_SMBUS_WORD_DATA){ + msg->data.Flag = 0x58; + msg->data.W_Length = 3; + } + else if(size == I2C_SMBUS_BYTE_DATA){ + msg->data.Flag = 0x54; + msg->data.W_Length = 2; + } + else if((size == I2C_SMBUS_BYTE) || (size == I2C_SMBUS_QUICK)){ + msg->data.Flag = 0x50; + msg->data.W_Length = 1; + }else if(size == I2C_SMBUS_BLOCK_DATA){ + msg->data.Flag = 0x5C; + msg->data.W_Length = data->block[0]; + } + + msg->data.R_Length = 0x0; + if(data !=NULL){ + if(size == I2C_SMBUS_WORD_DATA){ + msg->data.PMbus_data[1] = data->word & 0xff; + msg->data.PMbus_data[2] = (data->word & 0xff00) >> 8; + }else if(size == I2C_SMBUS_BYTE_DATA){ + msg->data.PMbus_data[1] = data->byte; + }else if(size == I2C_SMBUS_BLOCK_DATA){ + for (i = 0; i < msg->data.W_Length; i++) + msg->data.PMbus_data[i+1] = data->block[i+1]; + } + + }else{ + msg->data.PMbus_data[1] = 0; + } + } + + if (pec == 1) + msg->data.Flag |= HECI_PEC_FLAG; + + msg->data.Sensor_Bus = sensor_bus; + msg->data.Psu_Addr =(char) addr << 1; + msg->data.Mux_Addr = 0x0; + msg->data.Mux_Channel = 0x0; + msg->data.Mux_Conf = 0x0; + msg->data.Reserved = 0x0; + msg->data.PMbus_data[0] = command; + + + msg->hdr.host_addr = 0;//mei_cl_host_addr(cl); + msg->hdr.me_addr = 0x20; + msg->hdr.reserved = 0; + msg->hdr.msg_complete = 0; + msg->hdr.internal = 0; //cb->internal; + msg->hdr.length = 10 + msg->data.W_Length; + msg->hdr.msg_complete = 1; + +#if (DEBUG_MSG) + printk("Cmd : 0x%02x , Flag : 0x%02x , Sensor_Bus : 0x%02x , Psu_Addr : 0x%02x\n" , msg->data.Cmd, msg->data.Flag, msg->data.Sensor_Bus, msg->data.Psu_Addr); + printk("Mux_Addr : 0x%02x , Mux_Channel : 0x%02x , Mux_Conf : 0x%02x , W_Length : 0x%02x\n" , msg->data.Mux_Addr, msg->data.Mux_Channel, msg->data.Mux_Conf, msg->data.W_Length); + printk("R_Length : 0x%02x , PMbus_data[0] : 0x%02x , size : 0x%x\n" , msg->data.R_Length, msg->data.PMbus_data[0], size); + if(!read_write){ + if(size == I2C_SMBUS_BLOCK_DATA){ + for (i = 0; i < msg->data.W_Length; i++){ + printk("PMbus_data[%d] : 0x%02x , ", i, msg->data.PMbus_data[i]); + } + printk("\n"); + }else{ + printk("PMbus_data[1] : 0x%02x , PMbus_data[2] : 0x%02x\n", msg->data.PMbus_data[1], msg->data.PMbus_data[2]); + } + } +#endif + retry = 3; + while(retry){ + timeout = HECI_SEND_TIMEOUT / HECI_TIMEOUT_UNIT; + rets = HeciMsgSend(&sHeciDev, &timeout, (HECI_MSG_HEADER *)msg); + if (rets != 0){ + printk("HeciMsgSend ret: %d\n",rets); + retry --; + continue; + }else{ + break; + } + } + if(read_write) + { + if(size == I2C_SMBUS_WORD_DATA){ + blen = 8; + HeciMsgRecv(&sHeciDev, &timeout, (HECI_MSG_HEADER *)recv_buf, &blen); + } + else if(size == I2C_SMBUS_BYTE_DATA || size == I2C_SMBUS_QUICK || size == I2C_SMBUS_BYTE){ + blen = 7; + HeciMsgRecv(&sHeciDev, &timeout, (HECI_MSG_HEADER *)recv_buf, &blen); + } +#if (DEBUG_MSG) + if(size == I2C_SMBUS_BLOCK_DATA){ + printk("recv_len %d hdr: 0x%02x%02x%02x%02x\n", blen, recv_buf[3], recv_buf[2], recv_buf[1], recv_buf[0]); + for (i = 0; i < blen ; i++){ + printk("0x%02x , ", recv_buf[4 + i]); + } + printk("\n"); + }else{ + printk("recv_len %d recv: 0x%02x%02x%02x%02x\n0x%02x , 0x%02x , 0x%02x, 0x%02x \n", blen, recv_buf[3], recv_buf[2], recv_buf[1], recv_buf[0], recv_buf[4], recv_buf[5], recv_buf[6], recv_buf[7]); + } +#endif + if(data !=NULL){ + if(size == I2C_SMBUS_WORD_DATA){ + data->word = ((recv_buf[7] << 8) & 0xff00) | (recv_buf[6] & 0xff); + } + else if(size == I2C_SMBUS_BYTE_DATA){ + data->byte = recv_buf[6] & 0xff; + } + else if(size == I2C_SMBUS_BLOCK_DATA){ + for (i = 0; i < blen; i++){ + data->block[i] = recv_buf[6+i] & 0xff; + } + } + } + } + else + { + blen = 6; + HeciMsgRecv(&sHeciDev, &timeout, (HECI_MSG_HEADER *)recv_buf, &blen); +#if (DEBUG_MSG) + printk("recv: 0x%02x%02x%02x%02x , 0x%02x , 0x%02x \n", recv_buf[3], recv_buf[2], recv_buf[1], recv_buf[0], recv_buf[4], recv_buf[5]); +#endif + } + + rets = recv_buf[5]; + + kfree(recv_buf); + kfree(msg); + if(rets) + return -1; + else + return 0; +} + +/* Return negative errno on error. */ +static s32 mei_i2c_access(struct i2c_adapter *adap, u16 addr, + unsigned short flags, char read_write, u8 command, + int size, union i2c_smbus_data *data) +{ + int hwpec; + int block = 0; + int ret = 0, xact = 0; + int pec = 0; + char byte = 0; + struct mei_smb_priv *priv = i2c_get_adapdata(adap); + + if (flags & I2C_CLIENT_PEC) + pec = 1; + + switch (size) { + case I2C_SMBUS_QUICK: + + command = 0; + read_write = 1; + ret = mei_TxRx(priv->sensorbus, addr, command, read_write, size, NULL, pec); + xact = I801_QUICK; + break; + case I2C_SMBUS_BYTE: + if (read_write == I2C_SMBUS_READ) + command = 0; + ret = mei_TxRx(priv->sensorbus, addr, command, read_write, size, data, pec); + xact = I801_BYTE; + break; + case I2C_SMBUS_BYTE_DATA: + ret = mei_TxRx(priv->sensorbus, addr, command, read_write, size, data, pec); + xact = I801_BYTE_DATA; + break; + case I2C_SMBUS_WORD_DATA: + ret = mei_TxRx(priv->sensorbus, addr, command, read_write, size, data, pec); + xact = I801_WORD_DATA; + break; + case I2C_SMBUS_BLOCK_DATA: + ret = mei_TxRx(priv->sensorbus, addr, command, read_write, size, data, pec); + break; + case I2C_SMBUS_I2C_BLOCK_DATA: + printk("I2C_SMBUS_I2C_BLOCK_DATA unsupported!!%d\n",size); + break; + default: + dev_err(&priv->pci_dev->dev, "Unsupported transaction %d\n", + size); + return -EOPNOTSUPP; + } + + if (ret) + return ret; + return 0; +} + +static u32 mei_i2c_func(struct i2c_adapter *adapter) +{ + struct mei_smb_priv *priv = i2c_get_adapdata(adapter); + + return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | + I2C_FUNC_SMBUS_BLOCK_DATA ; +} + +static const struct i2c_algorithm smbus_algorithm = { + .smbus_xfer = mei_i2c_access, + .functionality = mei_i2c_func, +}; + +static const struct pci_device_id mei_i2c_ids[] = { + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_LPT_H) }, + { 0, } +}; + +MODULE_DEVICE_TABLE(pci, mei_i2c_ids); + +/* richard + priv_table */ +struct mei_smb_priv_table { + struct mei_smb_priv *priv_tbl[MEI_SMB_BUS_SMLINK4]; + int count; +}; + +static int mei_i2c_probe(struct pci_dev *pdev, const struct pci_device_id *id) +{ + unsigned char temp; + int err, i; + struct mei_smb_priv *priv_sml_0, *priv_sml_1, *priv_sml_2, *priv_sml_3, *priv_sml_4, *priv_smb; + +//richard + priv_table + struct mei_smb_priv_table *priv_table; + + priv_table = kzalloc(sizeof(*priv_table), GFP_KERNEL); + if(!priv_table) + return -ENOMEM; + + priv_sml_0= kzalloc(sizeof(struct mei_smb_priv), GFP_KERNEL); + if (!priv_sml_0) + return -ENOMEM; + i2c_set_adapdata(&priv_sml_0->adapter, priv_sml_0); + priv_sml_0->adapter.owner = THIS_MODULE; + priv_sml_0->adapter.algo = &smbus_algorithm; + priv_sml_0->adapter.dev.parent = &pdev->dev; + priv_sml_0->adapter.retries = 3; + priv_sml_0->sensorbus = MEI_SMB_BUS_SMLINK0; + priv_sml_0->pci_dev = pdev; + + priv_sml_1 = kzalloc(sizeof(*priv_sml_1), GFP_KERNEL); + if (!priv_sml_1) + return -ENOMEM; + i2c_set_adapdata(&priv_sml_1->adapter, priv_sml_1); + priv_sml_1->adapter.owner = THIS_MODULE; + priv_sml_1->adapter.algo = &smbus_algorithm; + priv_sml_1->adapter.dev.parent = &pdev->dev; + priv_sml_1->adapter.retries = 3; + priv_sml_1->sensorbus = MEI_SMB_BUS_SMLINK1; + priv_sml_1->pci_dev = pdev; + + priv_sml_2 = kzalloc(sizeof(*priv_sml_2), GFP_KERNEL); + if (!priv_sml_2) + return -ENOMEM; + i2c_set_adapdata(&priv_sml_2->adapter, priv_sml_2); + priv_sml_2->adapter.owner = THIS_MODULE; + priv_sml_2->adapter.algo = &smbus_algorithm; + priv_sml_2->adapter.dev.parent = &pdev->dev; + priv_sml_2->adapter.retries = 3; + priv_sml_2->sensorbus = MEI_SMB_BUS_SMLINK2; + priv_sml_2->pci_dev = pdev; + + priv_sml_3 = kzalloc(sizeof(*priv_sml_3), GFP_KERNEL); + if (!priv_sml_3) + return -ENOMEM; + i2c_set_adapdata(&priv_sml_3->adapter, priv_sml_3); + priv_sml_3->adapter.owner = THIS_MODULE; + priv_sml_3->adapter.algo = &smbus_algorithm; + priv_sml_3->adapter.dev.parent = &pdev->dev; + priv_sml_3->adapter.retries = 3; + priv_sml_3->sensorbus = MEI_SMB_BUS_SMLINK3; + priv_sml_3->pci_dev = pdev; + + priv_sml_4 = kzalloc(sizeof(*priv_sml_4), GFP_KERNEL); + if (!priv_sml_4) + return -ENOMEM; + i2c_set_adapdata(&priv_sml_4->adapter, priv_sml_4); + priv_sml_4->adapter.owner = THIS_MODULE; + priv_sml_4->adapter.algo = &smbus_algorithm; + priv_sml_4->adapter.dev.parent = &pdev->dev; + priv_sml_4->adapter.retries = 3; + priv_sml_4->sensorbus = MEI_SMB_BUS_SMLINK4; + priv_sml_4->pci_dev = pdev; + + printk("mei_i2c_probe 0x%x 0x%x\n", pdev->device, pdev->dev.id); + + snprintf(priv_sml_0->adapter.name, sizeof(priv_sml_0->adapter.name), + "ME-SMLINK0"); + err = i2c_add_adapter(&priv_sml_0->adapter); + printk("i2c nr : %d \n", priv_sml_0->adapter.nr); + if (err) { + dev_err(&pdev->dev, "Failed to add SMBus adapter ME-SMLINK0\n"); + return err; + } + + snprintf(priv_sml_1->adapter.name, sizeof(priv_sml_1->adapter.name), + "ME-SMLINK1"); + err = i2c_add_adapter(&priv_sml_1->adapter); + if (err) { + dev_err(&pdev->dev, "Failed to add SMBus adapter ME-SMLINK1\n"); + return err; + } + + snprintf(priv_sml_2->adapter.name, sizeof(priv_sml_2->adapter.name), + "ME-SMLINK2"); + err = i2c_add_adapter(&priv_sml_2->adapter); + if (err) { + dev_err(&pdev->dev, "Failed to add SMBus adapter ME-SMLINK2\n"); + return err; + } + + snprintf(priv_sml_3->adapter.name, sizeof(priv_sml_3->adapter.name), + "ME-SMLINK3"); + err = i2c_add_adapter(&priv_sml_3->adapter); + if (err) { + dev_err(&pdev->dev, "Failed to add SMBus adapter ME-SMLINK3\n"); + return err; + } + + snprintf(priv_sml_4->adapter.name, sizeof(priv_sml_4->adapter.name), + "ME-SMLINK4"); + err = i2c_add_adapter(&priv_sml_4->adapter); + if (err) { + dev_err(&pdev->dev, "Failed to add SMBus adapter ME-SMLINK4\n"); + return err; + } + + priv_table->count = 0; + priv_table->priv_tbl[priv_table->count++] = priv_sml_0; + priv_table->priv_tbl[priv_table->count++] = priv_sml_1; + priv_table->priv_tbl[priv_table->count++] = priv_sml_2; + priv_table->priv_tbl[priv_table->count++] = priv_sml_3; + priv_table->priv_tbl[priv_table->count++] = priv_sml_4; + + pci_set_drvdata(pdev, priv_table); + + return 0; +} + +static void mei_i2c_remove(struct pci_dev *dev) +{ + struct mei_smb_priv *priv = pci_get_drvdata(dev); + // richard + priv_table + struct mei_smb_priv_table *priv_table = pci_get_drvdata(dev); + int i; + + for(i=0; icount; i++) { + i2c_del_adapter(&priv_table->priv_tbl[i]->adapter); + } + pci_write_config_byte(dev, SMBHSTCFG, priv->original_hstcfg); + + /* + * do not call pci_disable_device(dev) since it can cause hard hangs on + * some systems during power-off (eg. Fujitsu-Siemens Lifebook E8010) + */ +} + +#define mei_i2c_suspend NULL +#define mei_i2c_resume NULL + +static struct pci_driver mei_i2c_driver = { + .name = "mei_i2c", + .id_table = mei_i2c_ids, + .probe = mei_i2c_probe, + .remove = mei_i2c_remove, + .suspend = mei_i2c_suspend, + .resume = mei_i2c_resume, +}; + +static int __init mei_i2c_init(void) +{ + int ret = 16; + u32 status = 0; + struct pci_dev *pdev = NULL; + struct mei_device *dev; + struct pci_driver *pci_drv; + + return pci_register_driver(&mei_i2c_driver); +} + +static void __exit mei_i2c_exit(void) +{ + pci_unregister_driver(&mei_i2c_driver); +} + +MODULE_AUTHOR("Delta Networks, Inc."); +MODULE_DESCRIPTION("MEI SMBus driver"); +MODULE_LICENSE("GPL"); + +module_init(mei_i2c_init); +module_exit(mei_i2c_exit); diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_rw.c b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_rw.c new file mode 100644 index 000000000000..215df220f096 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_rw.c @@ -0,0 +1,591 @@ +#include "i2c-mei_rw.h" + +#define MicroSecondDelay(time) udelay(time) + +/****** Parameter *****/ + +/****** Struct *****/ +typedef struct +{ + volatile UINT32 CB_WW; // Circular Buffer Write Window + volatile UINT32 H_CSR; // Host Control and Status Register + volatile UINT32 CB_RW; // Circular Buffer Read Window + volatile UINT32 ME_CSR; // ME Control and Status Register (read only) +} HECI_MBAR_REGS; + + +typedef union +{ + UINT32 DWord; + struct + { + UINT32 H_IE : 1, // 0 - Interrupt Enable ME + H_IS : 1, // 1 - Interrupt Status ME + H_IG : 1, // 2 - Interrupt Generate + H_RDY : 1, // 3 - Ready + H_RST : 1, // 4 - Reset + Reserved: 3, // 5~7 + H_CBRP : 8, // 8~15 - CB Read Pointer + H_CBWP : 8, // 16~23 - CB Write Pointer + H_CBD : 8; // 24~31 - Circular Buffer Depth + } Bits; +} HECI_HOST_CSR; + +// HECI_MBAR_REGS::ME_CSR - ME Control and Status Register +typedef union +{ + UINT32 DWord; + struct + { + UINT32 ME_IE : 1, // 0 - Interrupt Enable (Host Read Access) + ME_IS : 1, // 1 - Interrupt Status (Host Read Access) + ME_IG : 1, // 2 - Interrupt Generate (Host Read Access) + ME_RDY : 1, // 3 - Ready (Host Read Access) + ME_RST : 1, // 4 - Reset (Host Read Access) + Reserved: 3, // 5~7 + ME_CBRP : 8, // 8~15 - CB Read Pointer (Host Read Access) + ME_CBWP : 8, // 16~23 - CB Write Pointer (Host Read Access) + ME_CBD : 8; // 24~31 - Circular Buffer Depth (Host Read Access) + } Bits; +} HECI_ME_CSR; + +/****** Function *****/ +VOID* HeciMbarRead(IN HECI_DEVICE *pThis); +VOID HeciTrace(IN HECI_DEVICE*, IN CHAR8*, IN HECI_MSG_HEADER*, IN INT32); + +EFI_STATUS HeciInit ( HECI_DEVICE *pThis, + UINT32 *pTimeout) +{ + EFI_STATUS Status = EFI_SUCCESS; + UINT32 Timeout = 0; + HECI_HOST_CSR sHCsr; + HECI_ME_CSR sMeCsr; + HECI_MBAR_REGS *pMbarRegs; + VOID *pAddrPoint; + + if (pThis == NULL || (pThis->Mbar & 0xF) != 0 || pThis->Hidm > HECI_HIDM_LAST) + { + printk("Heci Init Failed"); + return EFI_INVALID_PARAMETER; + } + if (pTimeout != NULL) + { + Timeout = *pTimeout; + } + + // HECI vendor and device information away + pThis->PciCfg = PCI_LIB_ADDRESS(pThis->Bus, pThis->Dev, pThis->Fun, 0); + pThis->Vid = PciRead16(pThis->PciCfg + HECI_REG_VENDORID); + pThis->Did = PciRead16(pThis->PciCfg + HECI_REG_DEVICEID); + + if (pThis->Vid != 0x8086) + { + printk("[HECI] Init failed, PCI device %d/%d/%d not valid HECI (%2X-%2X)\n", + pThis->Bus, pThis->Dev, pThis->Fun, pThis->Vid, pThis->Did); + return EFI_DEVICE_ERROR; + } + + // Check MBAR, + pAddrPoint = HeciMbarRead(pThis); + pMbarRegs = (HECI_MBAR_REGS*)ioremap_nocache(pAddrPoint, 0x1000); + if (pMbarRegs == NULL) + { + printk("[HECI-%d] Init failed (device disabled)\n", pThis->Fun); + printk("Check MBAR Failed"); + Status = EFI_DEVICE_ERROR; + goto GO_FAIL; + } + + // Set HECI interrupt delivery mode. + sHCsr.DWord = pMbarRegs->H_CSR; + sHCsr.Bits.H_IE = 0; + pMbarRegs->H_CSR = sHCsr.DWord; + PciWrite8(pThis->PciCfg + HECI_REG_HIDM, pThis->Hidm); + + // Check HECI was free + sMeCsr.DWord = pMbarRegs->ME_CSR; + if (!sMeCsr.Bits.ME_RDY) + { + Status = HecClearQue(pThis, &Timeout); + } + else + { + if (!sHCsr.Bits.H_RDY) + { + sHCsr.Bits.H_IG = 1; + sHCsr.Bits.H_RDY = 1; + sHCsr.Bits.H_RST = 0; + pMbarRegs->H_CSR = sHCsr.DWord; + } + pThis->HMtu = sHCsr.Bits.H_CBD * sizeof(UINT32) - sizeof(HECI_MSG_HEADER); + pThis->MeMtu = sMeCsr.Bits.ME_CBD * sizeof(UINT32) - sizeof(HECI_MSG_HEADER); + } + + GO_FAIL: + if (pTimeout != NULL) + { + *pTimeout = Timeout; + } + pThis->Mefs1.DWord = HeciPciReadMefs1(); + iounmap((VOID *)pMbarRegs); + return Status; +} + +EFI_STATUS HecClearQue ( HECI_DEVICE *pThis, + UINT32 *pTimeout) +{ + EFI_STATUS Status; + UINT32 Timeout = 0; + HECI_HOST_CSR sHCsr; + HECI_ME_CSR sMeCsr; + HECI_MBAR_REGS *pMbarRegs; + VOID *pAddrPoint; + + if (pThis == NULL) + { + printk("Failed"); + return EFI_INVALID_PARAMETER; + } + + // Check for HECI availability on PCI + pAddrPoint = HeciMbarRead(pThis); + pMbarRegs = (HECI_MBAR_REGS*)ioremap_nocache(pAddrPoint, 0x1000); + printk("pMbarRegs: %x\n", pMbarRegs); + + if (pMbarRegs == NULL) + { + printk("[HECI-%d] Reset failed (device disabled)\n", pThis->Fun); + printk("Failed"); + return EFI_DEVICE_ERROR; + } + if (pTimeout != NULL) + { + Timeout = *pTimeout; + } + printk("[HECI-%d] Resetting HECI interface (CSR %X/%X)\n", + pThis->Fun, pMbarRegs->H_CSR, pMbarRegs->ME_CSR); + + sHCsr.DWord = pMbarRegs->H_CSR; + if (!sHCsr.Bits.H_RST) + { + sHCsr.Bits.H_RST = 1; + sHCsr.Bits.H_IG = 1; + pMbarRegs->H_CSR = sHCsr.DWord; + } + + // Wait for H_RDY cleared to make sure that the reset started. + while (1) + { + sHCsr.DWord = pMbarRegs->H_CSR; + if (!sHCsr.Bits.H_RDY) + { + break; + } + if (Timeout == 0) + { + printk("[HECI-%d] Reset failed (timeout)(CSR %X/%X)\n", + pThis->Fun, pMbarRegs->H_CSR, pMbarRegs->ME_CSR); + Status = EFI_TIMEOUT; + goto GO_FAIL; + } + MicroSecondDelay(HECI_TIMEOUT_UNIT); + Timeout--; + } + + // Wait for ME to perform reset and signal it is ready. + while (1) + { + sMeCsr.DWord = pMbarRegs->ME_CSR; + if (sMeCsr.Bits.ME_RDY) + { + break; + } + if (Timeout == 0) + { + printk("[HECI-%d] Reset failed (timeout)(CSR %X/%X)\n", + pThis->Fun, pMbarRegs->H_CSR, pMbarRegs->ME_CSR); + Status = EFI_TIMEOUT; + goto GO_FAIL; + } + MicroSecondDelay(HECI_TIMEOUT_UNIT); + Timeout--; + } + + // ME side is ready, signal host side is ready too. + sHCsr.DWord = pMbarRegs->H_CSR; + sHCsr.Bits.H_RST = 0; + sHCsr.Bits.H_RDY = 1; + sHCsr.Bits.H_IG = 1; + pMbarRegs->H_CSR = sHCsr.DWord; + + // Update MTU, ME could change it during reset. + pThis->HMtu = sHCsr.Bits.H_CBD * sizeof(UINT32) - sizeof(HECI_MSG_HEADER); + pThis->MeMtu = sMeCsr.Bits.ME_CBD * sizeof(UINT32) - sizeof(HECI_MSG_HEADER); + Status = EFI_SUCCESS; + +GO_FAIL: + if (pTimeout != NULL) + { + *pTimeout = Timeout; + } + pThis->Mefs1.DWord = HeciPciReadMefs1(); + iounmap((VOID *)pMbarRegs); + return Status; +} + +EFI_STATUS HeciMsgRecv ( HECI_DEVICE *pThis, + UINT32 *pTimeout, + HECI_MSG_HEADER *pMsgBuf, + UINT32 *pBufLen ) +{ + EFI_STATUS Status = EFI_SUCCESS; + UINT32 Timeout = 0; + UINT32 DWord, dwDataReads, dwBufLen; + UINT8 bFilledSlots, bMsgLen = 0; + HECI_HOST_CSR sHCsr; + HECI_ME_CSR sMeCsr; + HECI_MBAR_REGS *pMbarRegs; + VOID *pAddrPoint; + + if (pThis == NULL || pMsgBuf == NULL || + pBufLen == NULL || *pBufLen < sizeof(HECI_MSG_HEADER)) + { + printk("Heci MsgRecv Failed\n"); + return EFI_INVALID_PARAMETER; + } + + // Check for HECI availability on PCI + pAddrPoint = HeciMbarRead(pThis); + pMbarRegs = (HECI_MBAR_REGS*)ioremap_nocache(pAddrPoint, 0x1000); + if (pMbarRegs == NULL) + { + printk("[HECI-%d] Receive failed (device disabled)\n", pThis->Fun); + printk("pMbarRegs Failed\n"); + return EFI_DEVICE_ERROR; + } + if (pTimeout != NULL) + { + Timeout = *pTimeout; + } + + + // read from queue. + dwBufLen = *pBufLen; + *pBufLen = dwDataReads = 0; + while (1) + { + sHCsr.DWord = pMbarRegs->H_CSR; + sMeCsr.DWord = pMbarRegs->ME_CSR; + + bFilledSlots = (UINT8)((INT8)sMeCsr.Bits.ME_CBWP - (INT8)sMeCsr.Bits.ME_CBRP); + // Is it ready ? + if (!sMeCsr.Bits.ME_RDY || !sHCsr.Bits.H_RDY || bFilledSlots > sHCsr.Bits.H_CBD) + { + Status = HecClearQue(pThis, &Timeout); + if (EFI_ERROR(Status)) + { + goto GO_FAIL; + } + continue; + } + + // Read queue + while (bFilledSlots-- > 0) + { + + DWord = pMbarRegs->CB_RW; + if (*pBufLen < dwBufLen) + { + + if (dwDataReads < dwBufLen / sizeof(UINT32)) + { + ((UINT32*)pMsgBuf)[dwDataReads] = DWord; + *pBufLen += sizeof(UINT32); + } + else + { + switch (dwBufLen % sizeof(UINT32)) + { + case 3: ((UINT8*)pMsgBuf)[*pBufLen + 2] = (UINT8)(DWord >> 16); + case 2: ((UINT8*)pMsgBuf)[*pBufLen + 1] = (UINT8)(DWord >> 8); + case 1: ((UINT8*)pMsgBuf)[*pBufLen + 0] = (UINT8)DWord; + } + *pBufLen += dwBufLen % sizeof(UINT32); + } + } + else + { + printk("[HECI-%d] Message 0x%08X exceeds buffer size (%dB)\n", + pThis->Fun, pMsgBuf[0].DWord, dwBufLen); + } + dwDataReads++; + + // Read message length. + if (bMsgLen == 0) + { + bMsgLen = (UINT8)((pMsgBuf[0].Bits.Length + sizeof(UINT32) - 1) / sizeof(UINT32)); + bMsgLen++; // One more double word for message header + // + // Sanity check. If message length exceeds queue length this is + // not valid header. We are out of synch, let's reset the queue. + // + if (bMsgLen > sMeCsr.Bits.ME_CBD) + { + printk("[HECI-%d] 0x%08X does not seem to be msg header, reseting...\n", + pThis->Fun, pMsgBuf[0].DWord); + Status = HecClearQue(pThis, &Timeout); + if (EFI_ERROR(Status)) + { + goto GO_FAIL; + } + *pBufLen = dwDataReads = bMsgLen = 0; + break; // while (bFilledSlots) + } + } + + // If message is complete set interrupt to ME to let it know that next + // message can be sent and exit. + if (dwDataReads >= bMsgLen) + { + + sMeCsr.DWord = pMbarRegs->ME_CSR; + sHCsr.DWord = pMbarRegs->H_CSR; + if (!sMeCsr.Bits.ME_RDY) + { + HecClearQue(pThis, &Timeout); + Status = EFI_ABORTED; + } + else + { + HeciTrace(pThis, " Got msg: ", pMsgBuf, *pBufLen); + sHCsr.Bits.H_IG = 1; + pMbarRegs->H_CSR = sHCsr.DWord; + } + goto GO_FAIL; + } + } + if (Timeout == 0) + { + printk("[HECI-%d] Receive failed (timeout)\n", pThis->Fun); + Status = EFI_TIMEOUT; + goto GO_FAIL; + } + MicroSecondDelay(HECI_TIMEOUT_UNIT); + Timeout--; + } + GO_FAIL: + if (pTimeout != NULL) + { + *pTimeout = Timeout; + } + pThis->Mefs1.DWord = HeciPciReadMefs1(); + iounmap((VOID *)pMbarRegs); + return Status; +} + +EFI_STATUS HeciMsgSend ( HECI_DEVICE *pThis, + UINT32 *pTimeout, + HECI_MSG_HEADER *pMessage) +{ + EFI_STATUS Status; + UINT32 Timeout = 0; + UINT8 bEmptySlots; + UINT8 i, bMsgLen; + HECI_HOST_CSR sHCsr; + HECI_ME_CSR sMeCsr; + HECI_MBAR_REGS *pMbarRegs; + VOID *pAddrPoint; + + if (pThis == NULL || pMessage == NULL) + { + printk("HeciMsgSend Failed\n"); + return EFI_INVALID_PARAMETER; + } + HeciTrace(pThis, "Send msg: ", pMessage, sizeof(HECI_MSG_HEADER) + pMessage->Bits.Length); + + // Check for HECI availability + pAddrPoint = HeciMbarRead(pThis); + pMbarRegs = (HECI_MBAR_REGS*)ioremap_nocache(pAddrPoint, 0x1000); + if (pMbarRegs == NULL) + { + printk("[HECI-%d] Send failed (device disabled)\n", pThis->Fun); + printk("Failed\n"); + return EFI_DEVICE_ERROR; + } + if (pTimeout != NULL) + { + Timeout = *pTimeout; + } + + bMsgLen = (UINT8)((pMessage->Bits.Length + sizeof(UINT32) - 1) / sizeof(UINT32)); + bMsgLen++; //message header + while (1) + { + sHCsr.DWord = pMbarRegs->H_CSR; + sMeCsr.DWord = pMbarRegs->ME_CSR; + + // If message is more than queue length go fail. + if (bMsgLen > sHCsr.Bits.H_CBD) + { + printk("[HECI-%d] Send failed (msg %d B, queue %d B only)\n", + pThis->Fun, pMessage->Bits.Length, sHCsr.Bits.H_CBD * sizeof(UINT32)); + Status = EFI_BAD_BUFFER_SIZE; + goto GO_FAIL; + } + bEmptySlots = (UINT8)sHCsr.Bits.H_CBD - + (UINT8)((INT8)sHCsr.Bits.H_CBWP - (INT8)sHCsr.Bits.H_CBRP); + + // Is it ready ? + if (!sMeCsr.Bits.ME_RDY || !sHCsr.Bits.H_RDY || bEmptySlots > sHCsr.Bits.H_CBD) + { + Status = HecClearQue(pThis, &Timeout); + if (EFI_ERROR(Status)) + { + goto GO_FAIL; + } + continue; + } + + if (bMsgLen <= bEmptySlots) + { + for (i = 0; i < bMsgLen; i++) + { + pMbarRegs->CB_WW = ((UINT32*)pMessage)[i]; + } + + + sMeCsr.DWord = pMbarRegs->ME_CSR; + if (!sMeCsr.Bits.ME_RDY) + { + printk("[HECI-%d] Queue has been reset while sending\n", pThis->Fun); + continue; + } + + sHCsr.DWord = pMbarRegs->H_CSR; + sHCsr.Bits.H_IS = 0; + sHCsr.Bits.H_IG = 1; + pMbarRegs->H_CSR = sHCsr.DWord; + Status = EFI_SUCCESS; + goto GO_FAIL; + } + + + if (Timeout == 0) + { + printk("[HECI-%d] Send failed (timeout)\n", pThis->Fun); + Status = EFI_TIMEOUT; + goto GO_FAIL; + } + MicroSecondDelay(HECI_TIMEOUT_UNIT); + Timeout--; + } + GO_FAIL: + if (pTimeout != NULL) + { + *pTimeout = Timeout; + } + pThis->Mefs1.DWord = HeciPciReadMefs1(); + iounmap((VOID *)pMbarRegs); + return Status; +} + + +VOID *HeciMbarRead(HECI_DEVICE *pThis) +{ + VOID *start; + + UINT16 Cmd; + union + { + UINT64 QWord; + struct + { + UINT32 DWordL; + UINT32 DWordH; + } Bits; + } Mbar; + + // + // Read MBAR. + Mbar.QWord = 0; + Mbar.Bits.DWordL = PciRead32(pThis->PciCfg + HECI_REG_MBAR); + if (Mbar.Bits.DWordL == 0xFFFFFFFF) + { + printk("[HECI-%d] Device disabled\n", pThis->Fun); + Mbar.Bits.DWordL = 0; + goto GO_FAIL; + } + if (Mbar.Bits.DWordL & 0x4) // if 64-bit address add the upper half + { + Mbar.Bits.DWordH = PciRead32(pThis->PciCfg + HECI_REG_MBAR + 4); + } + Mbar.Bits.DWordL &= 0xFFFFFFF0; + if (Mbar.QWord == 0) + { + if (pThis->Mbar == 0) + { + printk("[HECI-%d] MBAR not programmed\n", pThis->Fun); + goto GO_FAIL; + } + else + { + Mbar.QWord = pThis->Mbar; + printk("[HECI-%d] MBAR not programmed, using default 0x%08X%08X\n", + pThis->Fun, Mbar.Bits.DWordH, Mbar.Bits.DWordL); + + // Programm the MBAR, set the 64-bit support bit regardless of the size + // of the address currently used. + PciWrite32(pThis->PciCfg + HECI_REG_MBAR + 4, Mbar.Bits.DWordH); + PciWrite32(pThis->PciCfg + HECI_REG_MBAR, Mbar.Bits.DWordL | 4); + } + } + else + { + pThis->Mbar = Mbar.QWord; + } + + // Enable the MBAR + Cmd = PciRead16(pThis->PciCfg + HECI_REG_COMMAND); + if (!(Cmd & HECI_CMD_MSE)) + { + PciWrite16(pThis->PciCfg + HECI_REG_COMMAND, Cmd | HECI_CMD_BME | HECI_CMD_MSE); + } + GO_FAIL: + return (VOID*)(INTN)Mbar.QWord; +} + + + +VOID HeciTrace( HECI_DEVICE *pThis, + CHAR8 *pPrefix, + HECI_MSG_HEADER *pMsg, + INT32 MsgLen) +{ +#if 0 /// Trace Enable or Disable + if (MsgLen > 4) + { + UINT32 dwLineBreak = 0; + UINT32 dwIndex = 0; + UINT8 *pMsgBody = (UINT8*)&pMsg[1]; + + MsgLen -= 4; + while (MsgLen-- > 0) + { + if (dwLineBreak == 0) + printk("%02x: ", (dwIndex & 0xF0)); + printk("%02x ", pMsgBody[dwIndex++]); + dwLineBreak++; + if (dwLineBreak == 16) + { + printk("\n"); + dwLineBreak = 0; + } + if (dwLineBreak == 8) + { + printk("-"); + } + } + printk("\n"); + } +#endif +} \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_rw.h b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_rw.h new file mode 100644 index 000000000000..a22728c058fe --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_rw.h @@ -0,0 +1,143 @@ + +#include "i2c-mei_io.h" + +/****** Parameter *****/ + +#define HECI_READ_TIMEOUT 12500000 // 12.5sec +#define HECI_SEND_TIMEOUT 12500000 // 12.5sec +#define HECI_TIMEOUT_UNIT 10 + + +// HECI functions location +#define HECI_BUS 0 +#define HECI_DEV 22 +#define HECI_FUN 0 + +// HECI register +#define HECI_REG_VENDORID 0x00 +#define HECI_REG_DEVICEID 0x02 +#define HECI_REG_COMMAND 0x04 +#define HECI_REG_REVID 0x08 +#define HECI_REG_MBAR 0x10 +#define HECI_REG_IRQ 0x3C +#define HECI_REG_HIDM 0xA0 +#define HECI_REG_HFS 0x40 +#define HECI_REG_MISC_SHDW 0x44 +#define HECI_REG_GS_SHDW 0x48 +#define HECI_REG_H_GS 0x4C +#define HECI_REG_GS_SHDW2 0x60 +#define HECI_REG_GS_SHDW3 0x64 +#define HECI_REG_GS_SHDW4 0x68 +#define HECI_REG_GS_SHDW5 0x6C +#define HECI_REG_H_GS2 0x70 +#define HECI_REG_H_GS3 0x74 +#define HECI_REG_MEFS1 HECI_REG_HFS +#define HECI_REG_MEFS2 HECI_REG_GS_SHDW + +#define HECI_MBAR_DEFAULT 0xFEDB0000 + +// HECI Interrupt Delivery Mode to be set in HECI_REG_HIDM. +#define HECI_HIDM_MSI 0 +#define HECI_HIDM_SCI 1 +#define HECI_HIDM_SMI 2 +#define HECI_HIDM_LAST HECI_HIDM_SMI + +// HECI command register bits +#define HECI_CMD_BME 0x04 // Bus master enable +#define HECI_CMD_MSE 0x02 // Memory space enable + + +/****** Struct *****/ + +typedef union +{ + UINT32 DWord; + struct + { + UINT32 MeAddress : 8, // Addressee on ME side + HostAddress: 8, // Addressee on host siede, zero for BIOS + Length : 9, // Number of bytes following the header + Reserved : 6, + MsgComplete: 1; // Whether this is last fragment of a message + } Bits; +} HECI_MSG_HEADER; + +// ME Firmware Status 1 register basics. offset:40h +typedef union +{ + UINT32 DWord; + struct + { + UINT32 CurrentState : 4, // 0~3 Current ME firmware state + Reserved_5 : 5, // 4~8 + InitComplete : 1, // 9 ME firmware finished initialization + Reserved_10 : 2, // 10~11 + ErrorCode : 4, // 12~15 If set means fatal error + OperatingMode: 4, // 16~19 Current ME operating mode + Reserved_20 : 5, // 20~24 + MsgAckData : 3, // 25~27 MSG ACK Data specific for acknowledged BIOS message + MsgAck : 4; // 28~31 Acknowledge for register based BIOS message + } Bits; +} HECI_MEFS1; + + +typedef struct +{ + + UINT8 Bus; // PCI bus + UINT8 Dev; // PCI device + UINT8 Fun; // PCI function number + + UINTN PciCfg; + UINT16 Vid; // Device ID + UINT16 Did; // Vendor ID + UINT8 Hidm; // interrupt mode + UINT64 Mbar; + UINT32 HMtu; // Max transfer unit configured by ME minus header + UINT32 MeMtu; // Max transfer unit configured by ME minus header + HECI_MEFS1 Mefs1; // ME Firmware Status at recent operation +} HECI_DEVICE; + +/****** Function *****/ + + + +/** + * @param pThis Pointer to HECI device structure + * @param pTimeout On input timeout in ms, on exit time left + */ +EFI_STATUS HeciInit ( HECI_DEVICE *pThis, + UINT32 *pTimeout); + +/** + * @param pThis Pointer to HECI device structure + * @param pTimeout On input timeout in ms, on exit time left + */ +EFI_STATUS HecClearQue ( HECI_DEVICE *pThis, + UINT32 *pTimeout); + +/** + * @param pThis Pointer to HECI device structure + * @param pTimeout On input timeout in ms, on exit time left + * @param pMsgBuf Buffer for the received message + * @param pBufLen On input buffer size, on exit message, in bytes + */ +EFI_STATUS HeciMsgRecv ( HECI_DEVICE *pThis, + UINT32 *pTimeout, + HECI_MSG_HEADER *pMsgBuf, + UINT32 *pBufLen ); + + + +/** + * @param pThis Pointer to HECI device structure + * @param pTimeout On input timeout in ms, on exit time left + * @param pMessage The header of the message to send + */ +EFI_STATUS HeciMsgSend ( HECI_DEVICE *pThis, + UINT32 *pTimeout, + HECI_MSG_HEADER *pMessage); + + + +#define HeciPciReadMefs1() PciRead32(PCI_LIB_ADDRESS(HECI_BUS, HECI_DEV, HECI_FUN, HECI_REG_MEFS1)) \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_type.h b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_type.h new file mode 100644 index 000000000000..e9b60c7573d5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_type.h @@ -0,0 +1,448 @@ + +#include +#include +#include +#include +#include +#include +#include + +#ifdef EFIAPI +#define EFIAPI +#endif + + // + // Assume standard AARCH64 alignment. + // + typedef unsigned long long UINT64; + typedef long long INT64; + typedef unsigned int UINT32; + typedef int INT32; + typedef unsigned short UINT16; + typedef unsigned short CHAR16; + typedef short INT16; + typedef unsigned char BOOLEAN; + typedef unsigned char UINT8; + typedef char CHAR8; + typedef signed char INT8; + +/// +/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions, +/// 8 bytes on supported 64-bit processor instructions) +/// + typedef UINT64 UINTN; + +/// +/// Signed value of native width. (4 bytes on supported 32-bit processor instructions, +/// 8 bytes on supported 64-bit processor instructions) +/// + typedef INT64 INTN; + + + +/* ========== ProcessBind.h ========= */ + +/// +/// A value of native width with the highest bit set. +/// +#define MAX_BIT 0x8000000000000000ULL + + + +/* ========== Base.h ========= */ + +// +// Modifiers to abstract standard types to aid in debug of problems +// + +/// +/// Datum is read-only. +/// +#define CONST const + +/// +/// Datum is scoped to the current file or function. +/// +#define STATIC static + +/// +/// Undeclared type. +/// +#define VOID void + +// +// Modifiers for Data Types used to self document code. +// This concept is borrowed for UEFI specification. +// + +/// +/// Datum is passed to the function. +/// +#define IN + +/// +/// Datum is returned from the function. +/// +#define OUT + +/// +/// Passing the datum to the function is optional, and a NULL +/// is passed if the value is not supplied. +/// +#define OPTIONAL + +// +// UEFI specification claims 1 and 0. We are concerned about the +// complier portability so we did it this way. +// + +/// +/// Boolean true value. UEFI Specification defines this value to be 1, +/// but this form is more portable. +/// +#define TRUE ((BOOLEAN)(1==1)) + +/// +/// Boolean false value. UEFI Specification defines this value to be 0, +/// but this form is more portable. +/// +#define FALSE ((BOOLEAN)(0==1)) + +/// +/// NULL pointer (VOID *) +/// +#define NULL ((VOID *) 0) + +// +// Status codes common to all execution phases +// +typedef UINTN RETURN_STATUS; + +/** + Produces a RETURN_STATUS code with the highest bit set. + + @param StatusCode The status code value to convert into a warning code. + StatusCode must be in the range 0x00000000..0x7FFFFFFF. + + @return The value specified by StatusCode with the highest bit set. + +**/ +#define ENCODE_ERROR(StatusCode) ((RETURN_STATUS)(MAX_BIT | (StatusCode))) + +/** + Produces a RETURN_STATUS code with the highest bit clear. + + @param StatusCode The status code value to convert into a warning code. + StatusCode must be in the range 0x00000000..0x7FFFFFFF. + + @return The value specified by StatusCode with the highest bit clear. + +**/ +#define ENCODE_WARNING(StatusCode) ((RETURN_STATUS)(StatusCode)) + +/** + Returns TRUE if a specified RETURN_STATUS code is an error code. + + This function returns TRUE if StatusCode has the high bit set. Otherwise, FALSE is returned. + + @param StatusCode The status code value to evaluate. + + @retval TRUE The high bit of StatusCode is set. + @retval FALSE The high bit of StatusCode is clear. + +**/ +#define RETURN_ERROR(StatusCode) (((INTN)(RETURN_STATUS)(StatusCode)) < 0) + +/// +/// The operation completed successfully. +/// +#define RETURN_SUCCESS 0 + +/// +/// The image failed to load. +/// +#define RETURN_LOAD_ERROR ENCODE_ERROR (1) + +/// +/// The parameter was incorrect. +/// +#define RETURN_INVALID_PARAMETER ENCODE_ERROR (2) + +/// +/// The operation is not supported. +/// +#define RETURN_UNSUPPORTED ENCODE_ERROR (3) + +/// +/// The buffer was not the proper size for the request. +/// +#define RETURN_BAD_BUFFER_SIZE ENCODE_ERROR (4) + +/// +/// The buffer was not large enough to hold the requested data. +/// The required buffer size is returned in the appropriate +/// parameter when this error occurs. +/// +#define RETURN_BUFFER_TOO_SMALL ENCODE_ERROR (5) + +/// +/// There is no data pending upon return. +/// +#define RETURN_NOT_READY ENCODE_ERROR (6) + +/// +/// The physical device reported an error while attempting the +/// operation. +/// +#define RETURN_DEVICE_ERROR ENCODE_ERROR (7) + +/// +/// The device can not be written to. +/// +#define RETURN_WRITE_PROTECTED ENCODE_ERROR (8) + +/// +/// The resource has run out. +/// +#define RETURN_OUT_OF_RESOURCES ENCODE_ERROR (9) + +/// +/// An inconsistency was detected on the file system causing the +/// operation to fail. +/// +#define RETURN_VOLUME_CORRUPTED ENCODE_ERROR (10) + +/// +/// There is no more space on the file system. +/// +#define RETURN_VOLUME_FULL ENCODE_ERROR (11) + +/// +/// The device does not contain any medium to perform the +/// operation. +/// +#define RETURN_NO_MEDIA ENCODE_ERROR (12) + +/// +/// The medium in the device has changed since the last +/// access. +/// +#define RETURN_MEDIA_CHANGED ENCODE_ERROR (13) + +/// +/// The item was not found. +/// +#define RETURN_NOT_FOUND ENCODE_ERROR (14) + +/// +/// Access was denied. +/// +#define RETURN_ACCESS_DENIED ENCODE_ERROR (15) + +/// +/// The server was not found or did not respond to the request. +/// +#define RETURN_NO_RESPONSE ENCODE_ERROR (16) + +/// +/// A mapping to the device does not exist. +/// +#define RETURN_NO_MAPPING ENCODE_ERROR (17) + +/// +/// A timeout time expired. +/// +#define RETURN_TIMEOUT ENCODE_ERROR (18) + +/// +/// The protocol has not been started. +/// +#define RETURN_NOT_STARTED ENCODE_ERROR (19) + +/// +/// The protocol has already been started. +/// +#define RETURN_ALREADY_STARTED ENCODE_ERROR (20) + +/// +/// The operation was aborted. +/// +#define RETURN_ABORTED ENCODE_ERROR (21) + +/// +/// An ICMP error occurred during the network operation. +/// +#define RETURN_ICMP_ERROR ENCODE_ERROR (22) + +/// +/// A TFTP error occurred during the network operation. +/// +#define RETURN_TFTP_ERROR ENCODE_ERROR (23) + +/// +/// A protocol error occurred during the network operation. +/// +#define RETURN_PROTOCOL_ERROR ENCODE_ERROR (24) + +/// +/// A function encountered an internal version that was +/// incompatible with a version requested by the caller. +/// +#define RETURN_INCOMPATIBLE_VERSION ENCODE_ERROR (25) + +/// +/// The function was not performed due to a security violation. +/// +#define RETURN_SECURITY_VIOLATION ENCODE_ERROR (26) + +/// +/// A CRC error was detected. +/// +#define RETURN_CRC_ERROR ENCODE_ERROR (27) + +/// +/// The beginning or end of media was reached. +/// +#define RETURN_END_OF_MEDIA ENCODE_ERROR (28) + +/// +/// The end of the file was reached. +/// +#define RETURN_END_OF_FILE ENCODE_ERROR (31) + +/// +/// The language specified was invalid. +/// +#define RETURN_INVALID_LANGUAGE ENCODE_ERROR (32) + +/// +/// The security status of the data is unknown or compromised +/// and the data must be updated or replaced to restore a valid +/// security status. +/// +#define RETURN_COMPROMISED_DATA ENCODE_ERROR (33) + +/// +/// The string contained one or more characters that +/// the device could not render and were skipped. +/// +#define RETURN_WARN_UNKNOWN_GLYPH ENCODE_WARNING (1) + +/// +/// The handle was closed, but the file was not deleted. +/// +#define RETURN_WARN_DELETE_FAILURE ENCODE_WARNING (2) + +/// +/// The handle was closed, but the data to the file was not +/// flushed properly. +/// +#define RETURN_WARN_WRITE_FAILURE ENCODE_WARNING (3) + +/// +/// The resulting buffer was too small, and the data was +/// truncated to the buffer size. +/// +#define RETURN_WARN_BUFFER_TOO_SMALL ENCODE_WARNING (4) + +/// +/// The data has not been updated within the timeframe set by +/// local policy for this type of data. +/// +#define RETURN_WARN_STALE_DATA ENCODE_WARNING (5) + + + +/* ========== UefiBaseType.h ========= */ + +/// +/// Function return status for EFI API. +/// +typedef RETURN_STATUS EFI_STATUS; + +/// +/// Enumeration of EFI_STATUS. +///@{ +#define EFI_SUCCESS RETURN_SUCCESS +#define EFI_LOAD_ERROR RETURN_LOAD_ERROR +#define EFI_INVALID_PARAMETER RETURN_INVALID_PARAMETER +#define EFI_UNSUPPORTED RETURN_UNSUPPORTED +#define EFI_BAD_BUFFER_SIZE RETURN_BAD_BUFFER_SIZE +#define EFI_BUFFER_TOO_SMALL RETURN_BUFFER_TOO_SMALL +#define EFI_NOT_READY RETURN_NOT_READY +#define EFI_DEVICE_ERROR RETURN_DEVICE_ERROR +#define EFI_WRITE_PROTECTED RETURN_WRITE_PROTECTED +#define EFI_OUT_OF_RESOURCES RETURN_OUT_OF_RESOURCES +#define EFI_VOLUME_CORRUPTED RETURN_VOLUME_CORRUPTED +#define EFI_VOLUME_FULL RETURN_VOLUME_FULL +#define EFI_NO_MEDIA RETURN_NO_MEDIA +#define EFI_MEDIA_CHANGED RETURN_MEDIA_CHANGED +#define EFI_NOT_FOUND RETURN_NOT_FOUND +#define EFI_ACCESS_DENIED RETURN_ACCESS_DENIED +#define EFI_NO_RESPONSE RETURN_NO_RESPONSE +#define EFI_NO_MAPPING RETURN_NO_MAPPING +#define EFI_TIMEOUT RETURN_TIMEOUT +#define EFI_NOT_STARTED RETURN_NOT_STARTED +#define EFI_ALREADY_STARTED RETURN_ALREADY_STARTED +#define EFI_ABORTED RETURN_ABORTED +#define EFI_ICMP_ERROR RETURN_ICMP_ERROR +#define EFI_TFTP_ERROR RETURN_TFTP_ERROR +#define EFI_PROTOCOL_ERROR RETURN_PROTOCOL_ERROR +#define EFI_INCOMPATIBLE_VERSION RETURN_INCOMPATIBLE_VERSION +#define EFI_SECURITY_VIOLATION RETURN_SECURITY_VIOLATION +#define EFI_CRC_ERROR RETURN_CRC_ERROR +#define EFI_END_OF_MEDIA RETURN_END_OF_MEDIA +#define EFI_END_OF_FILE RETURN_END_OF_FILE +#define EFI_INVALID_LANGUAGE RETURN_INVALID_LANGUAGE +#define EFI_COMPROMISED_DATA RETURN_COMPROMISED_DATA + +#define EFI_WARN_UNKNOWN_GLYPH RETURN_WARN_UNKNOWN_GLYPH +#define EFI_WARN_DELETE_FAILURE RETURN_WARN_DELETE_FAILURE +#define EFI_WARN_WRITE_FAILURE RETURN_WARN_WRITE_FAILURE +#define EFI_WARN_BUFFER_TOO_SMALL RETURN_WARN_BUFFER_TOO_SMALL +#define EFI_WARN_STALE_DATA RETURN_WARN_STALE_DATA +///@} + +/// +/// Define macro to encode the status code. +/// +#define EFIERR(_a) ENCODE_ERROR(_a) + +#define EFI_ERROR(A) RETURN_ERROR(A) + + + +/* ========== BaseLib.h ========= */ + +/// +/// Byte packed structure for EFLAGS/RFLAGS. +/// 32-bits on IA-32. +/// 64-bits on x64. The upper 32-bits on x64 are reserved. +/// +typedef union { + struct { + UINT32 CF:1; ///< Carry Flag. + UINT32 Reserved_0:1; ///< Reserved. + UINT32 PF:1; ///< Parity Flag. + UINT32 Reserved_1:1; ///< Reserved. + UINT32 AF:1; ///< Auxiliary Carry Flag. + UINT32 Reserved_2:1; ///< Reserved. + UINT32 ZF:1; ///< Zero Flag. + UINT32 SF:1; ///< Sign Flag. + UINT32 TF:1; ///< Trap Flag. + UINT32 IF:1; ///< Interrupt Enable Flag. + UINT32 DF:1; ///< Direction Flag. + UINT32 OF:1; ///< Overflow Flag. + UINT32 IOPL:2; ///< I/O Privilege Level. + UINT32 NT:1; ///< Nested Task. + UINT32 Reserved_3:1; ///< Reserved. + UINT32 RF:1; ///< Resume Flag. + UINT32 VM:1; ///< Virtual 8086 Mode. + UINT32 AC:1; ///< Alignment Check. + UINT32 VIF:1; ///< Virtual Interrupt Flag. + UINT32 VIP:1; ///< Virtual Interrupt Pending. + UINT32 ID:1; ///< ID Flag. + UINT32 Reserved_4:10; ///< Reserved. + } Bits; + UINTN UintN; +} IA32_EFLAGS32; \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/mei_dev.h b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/mei_dev.h new file mode 100644 index 000000000000..4250555d5e72 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/mei_dev.h @@ -0,0 +1,832 @@ +/* + * + * Intel Management Engine Interface (Intel MEI) Linux driver + * Copyright (c) 2003-2012, Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +#ifndef _MEI_DEV_H_ +#define _MEI_DEV_H_ + +#include +#include +#include +#include +#include + +#include "hw.h" +#include "hbm.h" + +/* + * watch dog definition + */ +#define MEI_WD_HDR_SIZE 4 +#define MEI_WD_STOP_MSG_SIZE MEI_WD_HDR_SIZE +#define MEI_WD_START_MSG_SIZE (MEI_WD_HDR_SIZE + 16) + +#define MEI_WD_DEFAULT_TIMEOUT 120 /* seconds */ +#define MEI_WD_MIN_TIMEOUT 120 /* seconds */ +#define MEI_WD_MAX_TIMEOUT 65535 /* seconds */ + +#define MEI_WD_STOP_TIMEOUT 10 /* msecs */ + +#define MEI_WD_STATE_INDEPENDENCE_MSG_SENT (1 << 0) + +#define MEI_RD_MSG_BUF_SIZE (128 * sizeof(u32)) + + +/* + * AMTHI Client UUID + */ +extern const uuid_le mei_amthif_guid; + +/* + * Watchdog Client UUID + */ +extern const uuid_le mei_wd_guid; + +/* + * Number of Maximum MEI Clients + */ +#define MEI_CLIENTS_MAX 256 + +/* + * maximum number of consecutive resets + */ +#define MEI_MAX_CONSEC_RESET 3 + +/* + * Number of File descriptors/handles + * that can be opened to the driver. + * + * Limit to 255: 256 Total Clients + * minus internal client for MEI Bus Messages + */ +#define MEI_MAX_OPEN_HANDLE_COUNT (MEI_CLIENTS_MAX - 1) + +/* + * Internal Clients Number + */ +#define MEI_HOST_CLIENT_ID_ANY (-1) +#define MEI_HBM_HOST_CLIENT_ID 0 /* not used, just for documentation */ +#define MEI_WD_HOST_CLIENT_ID 1 +#define MEI_IAMTHIF_HOST_CLIENT_ID 2 + + +/* File state */ +enum file_state { + MEI_FILE_INITIALIZING = 0, + MEI_FILE_CONNECTING, + MEI_FILE_CONNECTED, + MEI_FILE_DISCONNECTING, + MEI_FILE_DISCONNECT_REPLY, + MEI_FILE_DISCONNECT_REQUIRED, + MEI_FILE_DISCONNECTED, +}; + +/* MEI device states */ +enum mei_dev_state { + MEI_DEV_INITIALIZING = 0, + MEI_DEV_INIT_CLIENTS, + MEI_DEV_ENABLED, + MEI_DEV_RESETTING, + MEI_DEV_DISABLED, + MEI_DEV_POWER_DOWN, + MEI_DEV_POWER_UP +}; + +const char *mei_dev_state_str(int state); + +enum iamthif_states { + MEI_IAMTHIF_IDLE, + MEI_IAMTHIF_WRITING, + MEI_IAMTHIF_FLOW_CONTROL, + MEI_IAMTHIF_READING, + MEI_IAMTHIF_READ_COMPLETE +}; + +enum mei_file_transaction_states { + MEI_IDLE, + MEI_WRITING, + MEI_WRITE_COMPLETE, + MEI_FLOW_CONTROL, + MEI_READING, + MEI_READ_COMPLETE +}; + +enum mei_wd_states { + MEI_WD_IDLE, + MEI_WD_RUNNING, + MEI_WD_STOPPING, +}; + +/** + * enum mei_cb_file_ops - file operation associated with the callback + * @MEI_FOP_READ: read + * @MEI_FOP_WRITE: write + * @MEI_FOP_CONNECT: connect + * @MEI_FOP_DISCONNECT: disconnect + * @MEI_FOP_DISCONNECT_RSP: disconnect response + * @MEI_FOP_NOTIFY_START: start notification + * @MEI_FOP_NOTIFY_STOP: stop notification + */ +enum mei_cb_file_ops { + MEI_FOP_READ = 0, + MEI_FOP_WRITE, + MEI_FOP_CONNECT, + MEI_FOP_DISCONNECT, + MEI_FOP_DISCONNECT_RSP, + MEI_FOP_NOTIFY_START, + MEI_FOP_NOTIFY_STOP, +}; + +/* + * Intel MEI message data struct + */ +struct mei_msg_data { + u32 size; + unsigned char *data; +}; + +/* Maximum number of processed FW status registers */ +#define MEI_FW_STATUS_MAX 6 +/* Minimal buffer for FW status string (8 bytes in dw + space or '\0') */ +#define MEI_FW_STATUS_STR_SZ (MEI_FW_STATUS_MAX * (8 + 1)) + + +/* + * struct mei_fw_status - storage of FW status data + * + * @count: number of actually available elements in array + * @status: FW status registers + */ +struct mei_fw_status { + int count; + u32 status[MEI_FW_STATUS_MAX]; +}; + +/** + * struct mei_me_client - representation of me (fw) client + * + * @list: link in me client list + * @refcnt: struct reference count + * @props: client properties + * @client_id: me client id + * @mei_flow_ctrl_creds: flow control credits + * @connect_count: number connections to this client + * @bus_added: added to bus + */ +struct mei_me_client { + struct list_head list; + struct kref refcnt; + struct mei_client_properties props; + u8 client_id; + u8 mei_flow_ctrl_creds; + u8 connect_count; + u8 bus_added; +}; + + +struct mei_cl; + +/** + * struct mei_cl_cb - file operation callback structure + * + * @list: link in callback queue + * @cl: file client who is running this operation + * @fop_type: file operation type + * @buf: buffer for data associated with the callback + * @buf_idx: last read index + * @read_time: last read operation time stamp (iamthif) + * @file_object: pointer to file structure + * @status: io status of the cb + * @internal: communication between driver and FW flag + * @completed: the transfer or reception has completed + */ +struct mei_cl_cb { + struct list_head list; + struct mei_cl *cl; + enum mei_cb_file_ops fop_type; + struct mei_msg_data buf; + unsigned long buf_idx; + unsigned long read_time; + struct file *file_object; + int status; + u32 internal:1; + u32 completed:1; +}; + +/** + * struct mei_cl - me client host representation + * carried in file->private_data + * + * @link: link in the clients list + * @dev: mei parent device + * @state: file operation state + * @tx_wait: wait queue for tx completion + * @rx_wait: wait queue for rx completion + * @wait: wait queue for management operation + * @ev_wait: notification wait queue + * @ev_async: event async notification + * @status: connection status + * @me_cl: fw client connected + * @host_client_id: host id + * @mei_flow_ctrl_creds: transmit flow credentials + * @timer_count: watchdog timer for operation completion + * @reserved: reserved for alignment + * @notify_en: notification - enabled/disabled + * @notify_ev: pending notification event + * @writing_state: state of the tx + * @rd_pending: pending read credits + * @rd_completed: completed read + * + * @cldev: device on the mei client bus + */ +struct mei_cl { + struct list_head link; + struct mei_device *dev; + enum file_state state; + wait_queue_head_t tx_wait; + wait_queue_head_t rx_wait; + wait_queue_head_t wait; + wait_queue_head_t ev_wait; + struct fasync_struct *ev_async; + int status; + struct mei_me_client *me_cl; + u8 host_client_id; + u8 mei_flow_ctrl_creds; + u8 timer_count; + u8 reserved; + u8 notify_en; + u8 notify_ev; + enum mei_file_transaction_states writing_state; + struct list_head rd_pending; + struct list_head rd_completed; + + struct mei_cl_device *cldev; +}; + +/** + * struct mei_hw_ops - hw specific ops + * + * @host_is_ready : query for host readiness + * + * @hw_is_ready : query if hw is ready + * @hw_reset : reset hw + * @hw_start : start hw after reset + * @hw_config : configure hw + * + * @fw_status : get fw status registers + * @pg_state : power gating state of the device + * @pg_in_transition : is device now in pg transition + * @pg_is_enabled : is power gating enabled + * + * @intr_clear : clear pending interrupts + * @intr_enable : enable interrupts + * @intr_disable : disable interrupts + * + * @hbuf_free_slots : query for write buffer empty slots + * @hbuf_is_ready : query if write buffer is empty + * @hbuf_max_len : query for write buffer max len + * + * @write : write a message to FW + * + * @rdbuf_full_slots : query how many slots are filled + * + * @read_hdr : get first 4 bytes (header) + * @read : read a buffer from the FW + */ +struct mei_hw_ops { + + bool (*host_is_ready)(struct mei_device *dev); + + bool (*hw_is_ready)(struct mei_device *dev); + int (*hw_reset)(struct mei_device *dev, bool enable); + int (*hw_start)(struct mei_device *dev); + void (*hw_config)(struct mei_device *dev); + + + int (*fw_status)(struct mei_device *dev, struct mei_fw_status *fw_sts); + enum mei_pg_state (*pg_state)(struct mei_device *dev); + bool (*pg_in_transition)(struct mei_device *dev); + bool (*pg_is_enabled)(struct mei_device *dev); + + void (*intr_clear)(struct mei_device *dev); + void (*intr_enable)(struct mei_device *dev); + void (*intr_disable)(struct mei_device *dev); + + int (*hbuf_free_slots)(struct mei_device *dev); + bool (*hbuf_is_ready)(struct mei_device *dev); + size_t (*hbuf_max_len)(const struct mei_device *dev); + + int (*write)(struct mei_device *dev, + struct mei_msg_hdr *hdr, + unsigned char *buf); + + int (*rdbuf_full_slots)(struct mei_device *dev); + + u32 (*read_hdr)(const struct mei_device *dev); + int (*read)(struct mei_device *dev, + unsigned char *buf, unsigned long len); +}; + +/* MEI bus API*/ +void mei_cl_bus_rescan(struct mei_device *bus); +void mei_cl_bus_dev_fixup(struct mei_cl_device *dev); +ssize_t __mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length, + bool blocking); +ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length); +void mei_cl_bus_rx_event(struct mei_cl *cl); +void mei_cl_bus_notify_event(struct mei_cl *cl); +void mei_cl_bus_remove_devices(struct mei_device *bus); +int mei_cl_bus_init(void); +void mei_cl_bus_exit(void); + +/** + * enum mei_pg_event - power gating transition events + * + * @MEI_PG_EVENT_IDLE: the driver is not in power gating transition + * @MEI_PG_EVENT_WAIT: the driver is waiting for a pg event to complete + * @MEI_PG_EVENT_RECEIVED: the driver received pg event + * @MEI_PG_EVENT_INTR_WAIT: the driver is waiting for a pg event interrupt + * @MEI_PG_EVENT_INTR_RECEIVED: the driver received pg event interrupt + */ +enum mei_pg_event { + MEI_PG_EVENT_IDLE, + MEI_PG_EVENT_WAIT, + MEI_PG_EVENT_RECEIVED, + MEI_PG_EVENT_INTR_WAIT, + MEI_PG_EVENT_INTR_RECEIVED, +}; + +/** + * enum mei_pg_state - device internal power gating state + * + * @MEI_PG_OFF: device is not power gated - it is active + * @MEI_PG_ON: device is power gated - it is in lower power state + */ +enum mei_pg_state { + MEI_PG_OFF = 0, + MEI_PG_ON = 1, +}; + +const char *mei_pg_state_str(enum mei_pg_state state); + +/** + * struct mei_device - MEI private device struct + * + * @dev : device on a bus + * @cdev : character device + * @minor : minor number allocated for device + * + * @write_list : write pending list + * @write_waiting_list : write completion list + * @ctrl_wr_list : pending control write list + * @ctrl_rd_list : pending control read list + * + * @file_list : list of opened handles + * @open_handle_count: number of opened handles + * + * @device_lock : big device lock + * @timer_work : MEI timer delayed work (timeouts) + * + * @recvd_hw_ready : hw ready message received flag + * + * @wait_hw_ready : wait queue for receive HW ready message form FW + * @wait_pg : wait queue for receive PG message from FW + * @wait_hbm_start : wait queue for receive HBM start message from FW + * @wait_stop_wd : wait queue for receive WD stop message from FW + * + * @reset_count : number of consecutive resets + * @dev_state : device state + * @hbm_state : state of host bus message protocol + * @init_clients_timer : HBM init handshake timeout + * + * @pg_event : power gating event + * @pg_domain : runtime PM domain + * + * @rd_msg_buf : control messages buffer + * @rd_msg_hdr : read message header storage + * + * @hbuf_depth : depth of hardware host/write buffer is slots + * @hbuf_is_ready : query if the host host/write buffer is ready + * @wr_msg : the buffer for hbm control messages + * + * @version : HBM protocol version in use + * @hbm_f_pg_supported : hbm feature pgi protocol + * @hbm_f_dc_supported : hbm feature dynamic clients + * @hbm_f_dot_supported : hbm feature disconnect on timeout + * @hbm_f_ev_supported : hbm feature event notification + * + * @me_clients_rwsem: rw lock over me_clients list + * @me_clients : list of FW clients + * @me_clients_map : FW clients bit map + * @host_clients_map : host clients id pool + * @me_client_index : last FW client index in enumeration + * + * @allow_fixed_address: allow user space to connect a fixed client + * + * @wd_cl : watchdog client + * @wd_state : watchdog client state + * @wd_pending : watchdog command is pending + * @wd_timeout : watchdog expiration timeout + * @wd_data : watchdog message buffer + * + * @amthif_cmd_list : amthif list for cmd waiting + * @amthif_rd_complete_list : amthif list for reading completed cmd data + * @iamthif_file_object : file for current amthif operation + * @iamthif_cl : amthif host client + * @iamthif_current_cb : amthif current operation callback + * @iamthif_open_count : number of opened amthif connections + * @iamthif_timer : time stamp of current amthif command completion + * @iamthif_stall_timer : timer to detect amthif hang + * @iamthif_state : amthif processor state + * @iamthif_canceled : current amthif command is canceled + * + * @init_work : work item for the device init + * @reset_work : work item for the device reset + * + * @device_list : mei client bus list + * @cl_bus_lock : client bus list lock + * + * @dbgfs_dir : debugfs mei root directory + * + * @ops: : hw specific operations + * @hw : hw specific data + */ +struct mei_device { + struct device *dev; + struct cdev cdev; + int minor; + + struct mei_cl_cb write_list; + struct mei_cl_cb write_waiting_list; + struct mei_cl_cb ctrl_wr_list; + struct mei_cl_cb ctrl_rd_list; + + struct list_head file_list; + long open_handle_count; + + struct mutex device_lock; + struct delayed_work timer_work; + + bool recvd_hw_ready; + /* + * waiting queue for receive message from FW + */ + wait_queue_head_t wait_hw_ready; + wait_queue_head_t wait_pg; + wait_queue_head_t wait_hbm_start; + wait_queue_head_t wait_stop_wd; + + /* + * mei device states + */ + unsigned long reset_count; + enum mei_dev_state dev_state; + enum mei_hbm_state hbm_state; + u16 init_clients_timer; + + /* + * Power Gating support + */ + enum mei_pg_event pg_event; +#ifdef CONFIG_PM + struct dev_pm_domain pg_domain; +#endif /* CONFIG_PM */ + + unsigned char rd_msg_buf[MEI_RD_MSG_BUF_SIZE]; + u32 rd_msg_hdr; + + /* write buffer */ + u8 hbuf_depth; + bool hbuf_is_ready; + + /* used for control messages */ + struct { + struct mei_msg_hdr hdr; + unsigned char data[128]; + } wr_msg; + + struct hbm_version version; + unsigned int hbm_f_pg_supported:1; + unsigned int hbm_f_dc_supported:1; + unsigned int hbm_f_dot_supported:1; + unsigned int hbm_f_ev_supported:1; + + struct rw_semaphore me_clients_rwsem; + struct list_head me_clients; + DECLARE_BITMAP(me_clients_map, MEI_CLIENTS_MAX); + DECLARE_BITMAP(host_clients_map, MEI_CLIENTS_MAX); + unsigned long me_client_index; + + bool allow_fixed_address; + + struct mei_cl wd_cl; + enum mei_wd_states wd_state; + bool wd_pending; + u16 wd_timeout; + unsigned char wd_data[MEI_WD_START_MSG_SIZE]; + + + /* amthif list for cmd waiting */ + struct mei_cl_cb amthif_cmd_list; + /* driver managed amthif list for reading completed amthif cmd data */ + struct mei_cl_cb amthif_rd_complete_list; + struct file *iamthif_file_object; + struct mei_cl iamthif_cl; + struct mei_cl_cb *iamthif_current_cb; + long iamthif_open_count; + unsigned long iamthif_timer; + u32 iamthif_stall_timer; + enum iamthif_states iamthif_state; + bool iamthif_canceled; + + struct work_struct init_work; + struct work_struct reset_work; + + /* List of bus devices */ + struct list_head device_list; + struct mutex cl_bus_lock; + +#if IS_ENABLED(CONFIG_DEBUG_FS) + struct dentry *dbgfs_dir; +#endif /* CONFIG_DEBUG_FS */ + + + const struct mei_hw_ops *ops; + char hw[0] __aligned(sizeof(void *)); +}; + +static inline unsigned long mei_secs_to_jiffies(unsigned long sec) +{ + return msecs_to_jiffies(sec * MSEC_PER_SEC); +} + +/** + * mei_data2slots - get slots - number of (dwords) from a message length + * + size of the mei header + * + * @length: size of the messages in bytes + * + * Return: number of slots + */ +static inline u32 mei_data2slots(size_t length) +{ + return DIV_ROUND_UP(sizeof(struct mei_msg_hdr) + length, 4); +} + +/** + * mei_slots2data - get data in slots - bytes from slots + * + * @slots: number of available slots + * + * Return: number of bytes in slots + */ +static inline u32 mei_slots2data(int slots) +{ + return slots * 4; +} + +/* + * mei init function prototypes + */ +void mei_device_init(struct mei_device *dev, + struct device *device, + const struct mei_hw_ops *hw_ops); +int mei_reset(struct mei_device *dev); +int mei_start(struct mei_device *dev); +int mei_restart(struct mei_device *dev); +void mei_stop(struct mei_device *dev); +void mei_cancel_work(struct mei_device *dev); + +/* + * MEI interrupt functions prototype + */ + +void mei_timer(struct work_struct *work); +int mei_irq_read_handler(struct mei_device *dev, + struct mei_cl_cb *cmpl_list, s32 *slots); + +int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list); +void mei_irq_compl_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list); + +/* + * AMTHIF - AMT Host Interface Functions + */ +void mei_amthif_reset_params(struct mei_device *dev); + +int mei_amthif_host_init(struct mei_device *dev, struct mei_me_client *me_cl); + +int mei_amthif_read(struct mei_device *dev, struct file *file, + char __user *ubuf, size_t length, loff_t *offset); + +unsigned int mei_amthif_poll(struct mei_device *dev, + struct file *file, poll_table *wait); + +int mei_amthif_release(struct mei_device *dev, struct file *file); + +struct mei_cl_cb *mei_amthif_find_read_list_entry(struct mei_device *dev, + struct file *file); + +int mei_amthif_write(struct mei_cl *cl, struct mei_cl_cb *cb); +int mei_amthif_run_next_cmd(struct mei_device *dev); +int mei_amthif_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, + struct mei_cl_cb *cmpl_list); + +void mei_amthif_complete(struct mei_device *dev, struct mei_cl_cb *cb); +int mei_amthif_irq_read_msg(struct mei_cl *cl, + struct mei_msg_hdr *mei_hdr, + struct mei_cl_cb *complete_list); +int mei_amthif_irq_read(struct mei_device *dev, s32 *slots); + +/* + * NFC functions + */ +int mei_nfc_host_init(struct mei_device *dev, struct mei_me_client *me_cl); +void mei_nfc_host_exit(struct mei_device *dev); + +/* + * NFC Client UUID + */ +extern const uuid_le mei_nfc_guid; + +int mei_wd_send(struct mei_device *dev); +int mei_wd_stop(struct mei_device *dev); +int mei_wd_host_init(struct mei_device *dev, struct mei_me_client *me_cl); +/* + * mei_watchdog_register - Registering watchdog interface + * once we got connection to the WD Client + * @dev: mei device + */ +int mei_watchdog_register(struct mei_device *dev); +/* + * mei_watchdog_unregister - Unregistering watchdog interface + * @dev: mei device + */ +void mei_watchdog_unregister(struct mei_device *dev); + +/* + * Register Access Function + */ + + +static inline void mei_hw_config(struct mei_device *dev) +{ + dev->ops->hw_config(dev); +} + +static inline enum mei_pg_state mei_pg_state(struct mei_device *dev) +{ + return dev->ops->pg_state(dev); +} + +static inline bool mei_pg_in_transition(struct mei_device *dev) +{ + return dev->ops->pg_in_transition(dev); +} + +static inline bool mei_pg_is_enabled(struct mei_device *dev) +{ + return dev->ops->pg_is_enabled(dev); +} + +static inline int mei_hw_reset(struct mei_device *dev, bool enable) +{ + return dev->ops->hw_reset(dev, enable); +} + +static inline int mei_hw_start(struct mei_device *dev) +{ + return dev->ops->hw_start(dev); +} + +static inline void mei_clear_interrupts(struct mei_device *dev) +{ + dev->ops->intr_clear(dev); +} + +static inline void mei_enable_interrupts(struct mei_device *dev) +{ + dev->ops->intr_enable(dev); +} + +static inline void mei_disable_interrupts(struct mei_device *dev) +{ + dev->ops->intr_disable(dev); +} + +static inline bool mei_host_is_ready(struct mei_device *dev) +{ + return dev->ops->host_is_ready(dev); +} +static inline bool mei_hw_is_ready(struct mei_device *dev) +{ + return dev->ops->hw_is_ready(dev); +} + +static inline bool mei_hbuf_is_ready(struct mei_device *dev) +{ + return dev->ops->hbuf_is_ready(dev); +} + +static inline int mei_hbuf_empty_slots(struct mei_device *dev) +{ + return dev->ops->hbuf_free_slots(dev); +} + +static inline size_t mei_hbuf_max_len(const struct mei_device *dev) +{ + return dev->ops->hbuf_max_len(dev); +} + +static inline int mei_write_message(struct mei_device *dev, + struct mei_msg_hdr *hdr, + unsigned char *buf) +{ + return dev->ops->write(dev, hdr, buf); +} + +static inline u32 mei_read_hdr(const struct mei_device *dev) +{ + return dev->ops->read_hdr(dev); +} + +static inline void mei_read_slots(struct mei_device *dev, + unsigned char *buf, unsigned long len) +{ + dev->ops->read(dev, buf, len); +} + +static inline int mei_count_full_read_slots(struct mei_device *dev) +{ + return dev->ops->rdbuf_full_slots(dev); +} + +static inline int mei_fw_status(struct mei_device *dev, + struct mei_fw_status *fw_status) +{ + return dev->ops->fw_status(dev, fw_status); +} + +bool mei_hbuf_acquire(struct mei_device *dev); + +bool mei_write_is_idle(struct mei_device *dev); + +#if IS_ENABLED(CONFIG_DEBUG_FS) +int mei_dbgfs_register(struct mei_device *dev, const char *name); +void mei_dbgfs_deregister(struct mei_device *dev); +#else +static inline int mei_dbgfs_register(struct mei_device *dev, const char *name) +{ + return 0; +} +static inline void mei_dbgfs_deregister(struct mei_device *dev) {} +#endif /* CONFIG_DEBUG_FS */ + +int mei_register(struct mei_device *dev, struct device *parent); +void mei_deregister(struct mei_device *dev); + +#define MEI_HDR_FMT "hdr:host=%02d me=%02d len=%d internal=%1d comp=%1d" +#define MEI_HDR_PRM(hdr) \ + (hdr)->host_addr, (hdr)->me_addr, \ + (hdr)->length, (hdr)->internal, (hdr)->msg_complete + +ssize_t mei_fw_status2str(struct mei_fw_status *fw_sts, char *buf, size_t len); +/** + * mei_fw_status_str - fetch and convert fw status registers to printable string + * + * @dev: the device structure + * @buf: string buffer at minimal size MEI_FW_STATUS_STR_SZ + * @len: buffer len must be >= MEI_FW_STATUS_STR_SZ + * + * Return: number of bytes written or < 0 on failure + */ +static inline ssize_t mei_fw_status_str(struct mei_device *dev, + char *buf, size_t len) +{ + struct mei_fw_status fw_status; + int ret; + + buf[0] = '\0'; + + ret = mei_fw_status(dev, &fw_status); + if (ret) + return ret; + + ret = mei_fw_status2str(&fw_status, buf, MEI_FW_STATUS_STR_SZ); + + return ret; +} + + +#endif diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/control b/platform/broadcom/sonic-platform-modules-delta/debian/control index 1928e9a767eb..14dfdd2e14b9 100644 --- a/platform/broadcom/sonic-platform-modules-delta/debian/control +++ b/platform/broadcom/sonic-platform-modules-delta/debian/control @@ -9,3 +9,8 @@ Package: platform-modules-ag9032v1 Architecture: amd64 Depends: linux-image-3.16.0-5-amd64 Description: kernel modules for platform devices such as fan, led, sfp + +Package: platform-modules-ag9064 +Architecture: amd64 +Depends: linux-image-3.16.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/files b/platform/broadcom/sonic-platform-modules-delta/debian/files index ece02f8e80e2..57f157bc8a3b 100644 --- a/platform/broadcom/sonic-platform-modules-delta/debian/files +++ b/platform/broadcom/sonic-platform-modules-delta/debian/files @@ -1 +1,2 @@ platform-modules-ag9032v1_1.1_amd64.deb main extra +platform-modules-ag9064_1.1_amd64.deb main extra diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init new file mode 100755 index 000000000000..6e413ec644b4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init @@ -0,0 +1,48 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup ag9064 board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + depmod -a + rmmod i2c-i801 + rmmod i2c-ismt + modprobe i2c-dev + modprobe i2c-i801 + modprobe i2c-ismt + modprobe i2c-mei + modprobe i2c-mux-pca954x + modprobe at24 + modprobe delta_ag9064_platform + + /usr/local/bin/ag9064_platform_init.sh + + echo "done." + ;; + +stop) + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-ag9064.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.install b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.install new file mode 100644 index 000000000000..7776ea509487 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.install @@ -0,0 +1 @@ +ag9064/cfg/ag9064-modules.conf etc/modules-load.d diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/rules b/platform/broadcom/sonic-platform-modules-delta/debian/rules index ae590626c817..7efbed9e2c33 100755 --- a/platform/broadcom/sonic-platform-modules-delta/debian/rules +++ b/platform/broadcom/sonic-platform-modules-delta/debian/rules @@ -5,7 +5,7 @@ export INSTALL_MOD_DIR:=extra KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= ag9032v1 +MODULE_DIRS:= ag9032v1 ag9064 %: dh $@ From 9f1f95f98fdac14063eff2047174e31c288f9996 Mon Sep 17 00:00:00 2001 From: cpchang Date: Fri, 2 Mar 2018 07:37:27 +0800 Subject: [PATCH 002/274] Fix LED activity behavior (#1436) --- device/quanta/x86_64-quanta_ix1b_32x-r0/led_proc_init.soc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/device/quanta/x86_64-quanta_ix1b_32x-r0/led_proc_init.soc b/device/quanta/x86_64-quanta_ix1b_32x-r0/led_proc_init.soc index a53360de4ccb..831f74df7557 100755 --- a/device/quanta/x86_64-quanta_ix1b_32x-r0/led_proc_init.soc +++ b/device/quanta/x86_64-quanta_ix1b_32x-r0/led_proc_init.soc @@ -1,8 +1,8 @@ led 0 stop led 1 stop -led 0 prog 02 00 60 F3 67 1A 86 F3 06 F3 D2 40 74 04 12 F0 85 05 D2 0A 71 18 52 00 3A 80 28 60 F3 67 40 67 22 57 06 F3 12 A0 F8 15 1A 05 75 2E 77 38 06 F3 12 A0 F8 15 1A 04 75 4C 16 F0 DA 05 75 4C 77 54 06 F3 12 A0 F8 15 1A 00 75 4C 77 54 32 0F 87 57 32 0E 87 57 32 0E 87 57 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -led 1 prog 02 00 60 F3 67 1A 86 F3 06 F3 D2 40 74 04 12 F0 85 05 D2 0A 71 18 52 00 3A 80 28 60 F3 67 40 67 22 57 06 F3 12 A0 F8 15 1A 05 75 2E 77 38 06 F3 12 A0 F8 15 1A 04 75 4C 16 F0 DA 05 75 4C 77 54 06 F3 12 A0 F8 15 1A 00 75 4C 77 54 32 0F 87 57 32 0E 87 57 32 0E 87 57 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +led 0 prog 02 00 60 E2 D2 40 71 12 12 F0 85 05 D2 0A 71 19 52 00 67 1B 06 E2 80 77 02 3A 80 67 20 67 2E 57 06 E2 12 00 F0 80 F8 15 1A 00 75 4E 77 52 06 E2 F0 12 00 F8 15 1A 00 75 3B 77 46 06 E2 F0 12 00 F8 15 1A 01 75 4E 16 F0 DA 05 75 4E 77 52 32 0F 87 57 32 0E 87 57 00 00 00 00 00 00 00 00 00 00 +led 1 prog 02 00 60 E2 D2 40 71 12 12 F0 85 05 D2 0A 71 19 52 00 67 1B 06 E2 80 77 02 3A 80 67 20 67 2E 57 06 E2 12 00 F0 80 F8 15 1A 00 75 4E 77 52 06 E2 F0 12 00 F8 15 1A 00 75 3B 77 46 06 E2 F0 12 00 F8 15 1A 01 75 4E 16 F0 DA 05 75 4E 77 52 32 0F 87 57 32 0E 87 57 00 00 00 00 00 00 00 00 00 00 led 0 auto on led 1 auto on From a0e68bf39949f697e035f6107ce8701ef8566d29 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 1 Mar 2018 15:39:30 -0800 Subject: [PATCH 003/274] Update sonic-utilities pointer (#1438) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 252e9fab4846..fce7089bc544 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 252e9fab4846afeed1400760f3bb926961bc44f6 +Subproject commit fce7089bc544266dba1daacf29ef0379a800918b From 1e6576c5b8c20c58b1a0c2058126ac809d42a917 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Thu, 1 Mar 2018 20:56:12 -0800 Subject: [PATCH 004/274] [devices]: Update qos and buffer configuration for Dell S6000 (#1441) Signed-off-by: Sihui Han --- .../Force10-S6000/buffers.json.j2 | 29 +++- .../Force10-S6000/pg_profile_lookup.ini | 17 --- .../Force10-S6000/qos.json | 144 ++++++++++++++++++ dockers/docker-orchagent/swssconfig.sh | 6 +- 4 files changed, 172 insertions(+), 24 deletions(-) delete mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/pg_profile_lookup.ini create mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 index 560cae5dd1b4..376bdab77d89 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 @@ -68,8 +68,13 @@ } }, "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "7274496", + "ingress_lossless_pool0": { + "size": "3637248", + "type": "ingress", + "mode": "static" + }, + "ingress_lossless_pool1": { + "size": "3637248", "type": "ingress", "mode": "static" }, @@ -95,6 +100,20 @@ } }, "BUFFER_PROFILE": { + "ingress_lossless_profile0": { + "pool":"[BUFFER_POOL|ingress_lossless_pool0]", + "xon":"18432", + "xoff":"76800", + "size":"113664", + "static_th":"0" + }, + "ingress_lossless_profile1": { + "pool":"[BUFFER_POOL|ingress_lossless_pool1]", + "xon":"18432", + "xoff":"76800", + "size":"113664", + "static_th":"0" + }, "ingress_lossy_profile": { "pool":"[BUFFER_POOL|ingress_lossy_pool]", "size":"1518", @@ -117,6 +136,12 @@ } }, "BUFFER_PG": { + "{{ port_names }}|3": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile0]" + }, + "{{ port_names }}|4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile1]" + }, "{{ port_names }}|0-1": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" } diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/pg_profile_lookup.ini b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/pg_profile_lookup.ini deleted file mode 100644 index f3a0840558a6..000000000000 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold - 10000 5m 113664 18432 76800 0 - 25000 5m 113664 18432 76800 0 - 40000 5m 113664 18432 76800 0 - 50000 5m 113664 18432 76800 0 - 100000 5m 113664 18432 76800 0 - 10000 40m 113664 18432 76800 0 - 25000 40m 113664 18432 76800 0 - 40000 40m 113664 18432 76800 0 - 50000 40m 113664 18432 76800 0 - 100000 40m 113664 18432 76800 0 - 10000 300m 113664 18432 76800 0 - 25000 300m 113664 18432 76800 0 - 40000 300m 113664 18432 76800 0 - 50000 300m 113664 18432 76800 0 - 100000 300m 113664 18432 76800 0 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json new file mode 100644 index 000000000000..f0d92559970f --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json @@ -0,0 +1,144 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"512000", + "red_min_threshold":"512000", + "yellow_max_threshold":"512000", + "yellow_min_threshold":"512000", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1" : { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { + "scheduler" : "[SCHEDULER|scheduler.0]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1" : { + "scheduler" : "[SCHEDULER|scheduler.2]" + } + } +} diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 1de7165281cf..7d82214e1e42 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -43,11 +43,7 @@ HWSKU=`sonic-cfggen -d -v "DEVICE_METADATA['localhost']['hwsku']"` SWSSCONFIG_ARGS="00-copp.config.json ipinip.json ports.json switch.json " -if [ "$HWSKU" == "Force10-S6000" ]; then - SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " -elif [ "$HWSKU" == "Force10-S6000-Q32" ]; then - SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " -elif [ "$HWSKU" == "Force10-S6100" ]; then +if [ "$HWSKU" == "Force10-S6100" ]; then SWSSCONFIG_ARGS+="th.64ports.buffers.json th.64ports.qos.json " elif [ "$HWSKU" == "Arista-7050-QX32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " From 571a18add4bf1d39e168bc688640c4a31cbc4093 Mon Sep 17 00:00:00 2001 From: StanleyCi <34563271+StanleyCi@users.noreply.github.com> Date: Fri, 2 Mar 2018 13:15:27 +0800 Subject: [PATCH 005/274] [Delta ag9032v1]Add attributes for cpupld and swpld. (#1437) Signed-off-by: Stanley Chi --- .../modules/delta_ag9032v1_platform.c | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c index e2ee8ab80bab..abf5b7e3a024 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c @@ -583,7 +583,6 @@ enum cpld_type { struct cpld_platform_data { int reg_addr; struct i2c_client *client; - //struct kobject *kobj; }; enum swpld_attributes { @@ -672,7 +671,7 @@ static struct platform_device ag9032v1_cpld = { .id = 0, .dev = { .platform_data = ag9032v1_cpld_platform_data, - .release = device_release + .release = device_release, }, }; @@ -1547,6 +1546,7 @@ static struct attribute_group ag9032v1_cpld_attr_grp = { .attrs = ag9032v1_cpld_attrs, }; +static struct kobject *kobj_swpld; static struct kobject *kobj_board; static struct kobject *kobj_psu; static struct kobject *kobj_hot_swap; @@ -1557,8 +1557,10 @@ static ssize_t get_swpld_data(struct device *dev, struct device_attribute *dev_a { int ret; struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); - struct device *i2cdev = kobj_to_dev(kobj_board->parent); + struct device *i2cdev = kobj_to_dev(kobj_swpld); struct cpld_platform_data *pdata = i2cdev->platform_data; + + unsigned char reg; int mask; int value; @@ -1572,33 +1574,29 @@ static ssize_t get_swpld_data(struct device *dev, struct device_attribute *dev_a value = ret >> 4; sprintf(note, "\n“0x00”: L9032NB-AL-R\n“0x01”: AK9032-R\n“0x02”: AG9032-R\n“0x03”: AG9032R-R\n“0x04”: AG9032 V1-R\n"); return sprintf(buf, "0x%02x%s", value, note); - break; case SW_BOARD_VER: reg = 0x00; ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); value = ret & 0x0F; sprintf(note, "\n“0x00”: proto-A\n“0x01”: proto-B\n"); return sprintf(buf, "0x%02x%s", value, note); - break; case SWPLD_VER: reg = 0x01; ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); value = ret & 0xFF; sprintf(note, " "); return sprintf(buf, "0x%02x%s", value, note); - break; //other attributes case SYS_RST ... QSFP32_MOD_INT: reg = controller_interrupt_data[attr->index].reg_addr; mask = controller_interrupt_data[attr->index].reg_mask; sprintf(note, "\n%s\n",controller_interrupt_data[attr->index].reg_note); - break; + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); + value = (ret & (1 << mask)) >> mask; + return sprintf(buf, "%d%s", value, note); default: return sprintf(buf, "%d not found", attr->index); } - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); - value = (ret & (1 << mask)) >> mask; - return sprintf(buf, "%d%s", value, note); } static ssize_t set_swpld_data(struct device *dev, struct device_attribute *dev_attr, const char *buf, size_t count) @@ -1633,7 +1631,6 @@ static ssize_t set_swpld_data(struct device *dev, struct device_attribute *dev_a case QSFP_01TO08_MASK_INT... QSFP_25TO32_MASK_ABS: reg = controller_interrupt_data[attr->index].reg_addr; mask = controller_interrupt_data[attr->index].reg_mask; - sprintf(note, "\n%s\n",controller_interrupt_data[attr->index].reg_note); break; default: return sprintf(buf, "%d not found", attr->index); @@ -1856,6 +1853,7 @@ static int __init cpld_probe(struct platform_device *pdev) goto error; } + kobj_swpld = &pdev->dev.kobj; kobj_board = kobject_create_and_add("Board", &pdev->dev.kobj); if (!kobj_board){ printk(KERN_WARNING "Fail to create directory"); @@ -1925,6 +1923,7 @@ static int __init cpld_probe(struct platform_device *pdev) return 0; error: + kobject_put(kobj_swpld); kobject_put(kobj_board); kobject_put(kobj_psu); kobject_put(kobj_hot_swap); @@ -1947,6 +1946,7 @@ static int __exit cpld_remove(struct platform_device *pdev) dev_err(&pdev->dev, "Missing platform data\n"); } else { + kobject_put(kobj_swpld); kobject_put(kobj_board); kobject_put(kobj_psu); kobject_put(kobj_hot_swap); @@ -2266,7 +2266,7 @@ static void __init delta_ag9032v1_platform_init(void) struct i2c_client *client; struct i2c_adapter *adapter; struct cpld_platform_data *cpld_pdata; - struct swpld_mux_platform_data *swpld_pdata; + struct swpld_mux_platform_data *swpld_mux_pdata; int ret,i = 0; printk("ag9032v1_platform module initialization\n"); @@ -2308,8 +2308,8 @@ static void __init delta_ag9032v1_platform_init(void) for (i = 0; i < ARRAY_SIZE(ag9032v1_swpld_mux); i++) { - swpld_pdata = ag9032v1_swpld_mux[i].dev.platform_data; - swpld_pdata->cpld = cpld_pdata[system_cpld].client; + swpld_mux_pdata = ag9032v1_swpld_mux[i].dev.platform_data; + swpld_mux_pdata->cpld = cpld_pdata[system_cpld].client; ret = platform_device_register(&ag9032v1_swpld_mux[i]); if (ret) { printk(KERN_WARNING "Fail to create swpld mux %d\n", i); From cbdcdcd02344d04caa651b55db43a0bd09b25b2a Mon Sep 17 00:00:00 2001 From: AndriiS Date: Fri, 2 Mar 2018 20:52:10 +0200 Subject: [PATCH 006/274] [submodule]: Update sonic-sairedis submodule pointer (#1446) --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index d2601d93ef5c..8990e2522dd6 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit d2601d93ef5c2383e64e8ae33be2e3ebfec6bb3b +Subproject commit 8990e2522dd632b3be2162043bdf580b189ceace From eaea792d47e77f00521a96909644d0000269f9da Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 2 Mar 2018 11:05:27 -0800 Subject: [PATCH 007/274] [libnl3] Fix runtime dependencies for libnl-genl-3 and libnl-route-3 (#1440) --- rules/libnl3.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rules/libnl3.mk b/rules/libnl3.mk index fe43708a9399..70ffa87963d0 100644 --- a/rules/libnl3.mk +++ b/rules/libnl3.mk @@ -12,6 +12,7 @@ LIBNL3_DEV = libnl-3-dev_$(LIBNL3_VERSION)_amd64.deb $(eval $(call add_derived_package,$(LIBNL3),$(LIBNL3_DEV))) LIBNL_GENL3 = libnl-genl-3-200_$(LIBNL3_VERSION)_amd64.deb +$(LIBNL_GENL3)_RDEPENDS += $(LIBNL3) $(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_GENL3))) LIBNL_GENL3_DEV = libnl-genl-3-dev_$(LIBNL3_VERSION)_amd64.deb @@ -19,6 +20,7 @@ $(LIBNL_GENL3_DEV)_DEPENDS += $(LIBNL_GENL3) $(LIBNL3_DEV) $(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_GENL3_DEV))) LIBNL_ROUTE3 = libnl-route-3-200_$(LIBNL3_VERSION)_amd64.deb +$(LIBNL_ROUTE3)_RDEPENDS += $(LIBNL3) $(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_ROUTE3))) LIBNL_ROUTE3_DEV = libnl-route-3-dev_$(LIBNL3_VERSION)_amd64.deb From c689253b3f0b75820188dc930d62c6b834a4fa4f Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 2 Mar 2018 16:46:22 -0800 Subject: [PATCH 008/274] [LLDP] Add lldpmgrd Daemon to Manage LLDP Configuration (#1428) --- dockers/docker-lldp-sv2/Dockerfile.j2 | 54 +++--- dockers/docker-lldp-sv2/lldpmgrd | 199 +++++++++++++++++++++++ dockers/docker-lldp-sv2/reconfigure.sh | 52 ------ dockers/docker-lldp-sv2/start.sh | 2 +- dockers/docker-lldp-sv2/supervisord.conf | 14 +- rules/docker-lldp-sv2.mk | 2 +- 6 files changed, 241 insertions(+), 82 deletions(-) create mode 100755 dockers/docker-lldp-sv2/lldpmgrd delete mode 100755 dockers/docker-lldp-sv2/reconfigure.sh diff --git a/dockers/docker-lldp-sv2/Dockerfile.j2 b/dockers/docker-lldp-sv2/Dockerfile.j2 index bfb1f9ca678a..f75e4ea31422 100644 --- a/dockers/docker-lldp-sv2/Dockerfile.j2 +++ b/dockers/docker-lldp-sv2/Dockerfile.j2 @@ -1,37 +1,49 @@ FROM docker-config-engine -COPY \ -{% for deb in docker_lldp_sv2_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor -%} -debs/ +# Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive -COPY python-wheels /python-wheels +# Update apt's cache of available packages +RUN apt-get update -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive +# Install dependencies +RUN apt-get install -y python-pip libbsd0 libevent-2.0-5 libjansson4 libwrap0 libxml2 libpci3 libperl5.20 libpython2.7 + +{% if docker_lldp_sv2_debs.strip() -%} +# Copy locally-built Debian package dependencies +{%- for deb in docker_lldp_sv2_debs.split(' ') %} +COPY debs/{{ deb }} /debs/ +{%- endfor %} -RUN apt-get update && apt-get install -y python-pip libbsd0 libevent-2.0-5 libjansson4 libwrap0 libxml2 libpci3 libperl5.20 +# Install locally-built Debian packages and implicitly install their dependencies +{%- for deb in docker_lldp_sv2_debs.split(' ') %} +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/{{ deb }} +{%- endfor %} +{%- endif %} -# Pre-install the fundamental packages -# Install Python SwSS SDK -# Install LLDP Sync Daemon +{% if docker_lldp_sv2_whls.strip() -%} +# Copy locally-built Python wheel dependencies +{%- for whl in docker_lldp_sv2_whls.split(' ') %} +COPY python-wheels/{{ whl }} /python-wheels/ +{%- endfor %} -RUN dpkg -i \ -{% for deb in docker_lldp_sv2_debs.split(' ') -%} -debs/{{ deb }}{{' '}} +# Install locally-built Python wheel dependencies +{%- for whl in docker_lldp_sv2_whls.split(' ') %} +RUN pip install /python-wheels/{{ whl }} {%- endfor %} +{% endif %} -RUN pip install /python-wheels/swsssdk-2.0.1-py2-none-any.whl && \ - pip install /python-wheels/sonic_d-2.0.0-py2-none-any.whl && \ - apt-get remove -y python-pip && \ - apt-get purge -y && apt-get autoclean -y && apt-get autoremove -y && \ - rm -rf /debs /python-wheels ~/.cache +# Clean up +RUN apt-get remove -y python-pip +RUN apt-get clean -y +RUN apt-get autoclean -y +RUN apt-get autoremove -y +RUN rm -rf /debs /python-wheels ~/.cache COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] -COPY ["reconfigure.sh", "/usr/bin/"] COPY ["lldpd.conf.j2", "/usr/share/sonic/templates/"] COPY ["lldpd", "/etc/default/"] +COPY ["lldpmgrd", "/usr/bin/"] ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-lldp-sv2/lldpmgrd b/dockers/docker-lldp-sv2/lldpmgrd new file mode 100755 index 000000000000..dce64c10c2a3 --- /dev/null +++ b/dockers/docker-lldp-sv2/lldpmgrd @@ -0,0 +1,199 @@ +#!/usr/bin/env python + +""" + lldpmgrd + + LLDP manager daemon for SONiC + + Daemon which listens for changes in the PORT table of the State DB + and updates LLDP configuration accordingly for that port by calling + lldpcli. + + TODO: Also listen for changes in DEVICE_NEIGHBOR and PORT tables in + Config DB and update LLDP config upon changes. +""" + + +try: + import os + import signal + import subprocess + import sys + import syslog + from swsscommon import swsscommon +except ImportError as err: + raise ImportError("%s - required module not found" % str(err)) + +VERSION = "1.0" + +SYSLOG_IDENTIFIER = "lldpmgrd" + + +# ========================== Syslog wrappers ========================== + +def log_info(msg): + syslog.openlog(SYSLOG_IDENTIFIER) + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + + +def log_warning(msg): + syslog.openlog(SYSLOG_IDENTIFIER) + syslog.syslog(syslog.LOG_WARNING, msg) + syslog.closelog() + + +def log_error(msg): + syslog.openlog(SYSLOG_IDENTIFIER) + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + + +# ========================== Signal Handling ========================== + +def signal_handler(sig, frame): + if sig == signal.SIGHUP: + log_info("Caught SIGHUP - ignoring...") + return + elif sig == signal.SIGINT: + log_info("Caught SIGINT - exiting...") + sys.exit(128 + sig) + elif sig == signal.SIGTERM: + log_info("Caught SIGTERM - exiting...") + sys.exit(128 + sig) + else: + log_warning("Caught unhandled signal '" + sig + "'") + + +# ============================== Classes ============================== + +class LldpManager(object): + """ + Class which subscribes to notifications of changes in the PORT table of + the Redis State database and updates LLDP configuration accordingly for + that port by calling lldpcli. + Attributes: + state_db: Handle to Redis State database via swsscommon lib + config_db: Handle to Redis Config database via swsscommon lib + """ + REDIS_HOSTNAME = "localhost" + REDIS_PORT = 6379 + REDIS_TIMEOUT_USECS = 0 + + def __init__(self): + # Open a handle to the State database + self.state_db = swsscommon.DBConnector(swsscommon.STATE_DB, + self.REDIS_HOSTNAME, + self.REDIS_PORT, + self.REDIS_TIMEOUT_USECS) + + # Open a handle to the Config database + self.config_db = swsscommon.DBConnector(swsscommon.CONFIG_DB, + self.REDIS_HOSTNAME, + self.REDIS_PORT, + self.REDIS_TIMEOUT_USECS) + + def update_lldp_config_for_port(self, port_name): + """ + For port `port_name`, look up the neighboring device's hostname and + corresponding port alias in the Config database, then form the + appropriate lldpcli configuration command and run it. + """ + TABLE_SEPARATOR = "|" + + # Retrieve all entires for this port from the Port table + port_table = swsscommon.Table(self.config_db, swsscommon.CFG_PORT_TABLE_NAME, TABLE_SEPARATOR) + (status, fvp) = port_table.get(port_name) + if status: + # Convert list of tuples to a dictionary + port_table_dict = dict(fvp) + + # Get the port alias. If None or empty string, use port name instead + port_alias = port_table_dict.get("alias") + if not port_alias: + log_info("Unable to retrieve port alias for port '{}'. Using port name instead.".format(port_name)) + port_alias = port_name + else: + log_error("Port '{}' not found in {} table in Config DB. Using port name instead of port alias.".format(port_name, swsscommon.CFG_PORT_TABLE_NAME)) + port_alias = port_name + + lldpcli_cmd = "lldpcli configure ports {0} lldp portidsubtype local {1}".format(port_name, port_alias) + + # Retrieve all entires for this port from the Device Neighbor table + device_neighbor_table = swsscommon.Table(self.config_db, swsscommon.CFG_DEVICE_NEIGHBOR_TABLE_NAME, TABLE_SEPARATOR) + (status, fvp) = device_neighbor_table.get(port_name) + if status: + # Convert list of tuples to a dictionary + device_neighbor_table_dict = dict(fvp) + + # Get neighbor host name and port name + neighbor_hostname = device_neighbor_table_dict.get("name") + neighbor_portname = device_neighbor_table_dict.get("port") + + # If we sucessfully obtained the neighbor's host name and port name, append a port description to the command + if neighbor_hostname and neighbor_portname: + lldpcli_cmd += " description {0}:{1}".format(neighbor_hostname, neighbor_portname) + else: + if not neighbor_hostname: + log_info("Failed to retrieve neighbor host name for port '{}'. Not adding port description.".format(port_name)) + + if not neighbor_portname: + log_info("Failed to retrieve neighbor port name for port '{}'. Not adding port description.".format(port_name)) + else: + log_info("Unable to retrieve neighbor information for port '{}'. Not adding port description.".format(port_name)) + + log_info("Running command: '{}'".format(lldpcli_cmd)) + + proc = subprocess.Popen(lldpcli_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + (stdout, stderr) = proc.communicate() + + if proc.returncode != 0: + log_error("Error running command '{}': {}".format(cmd, stderr)) + + def run(self): + """ + Infinite loop. Subscribes to notifications of changes in the PORT table + of the Redis State database. When we are notified of the creation of an + interface, update LLDP configuration accordingly. + """ + # Subscribe to PORT table notifications in the State DB + sel = swsscommon.Select() + sst = swsscommon.SubscriberStateTable(self.state_db, swsscommon.STATE_PORT_TABLE_NAME) + sel.addSelectable(sst) + + # Listen indefinitely for changes to the PORT table in the State DB + while True: + (state, c, fd) = sel.select() + if state != swsscommon.Select.OBJECT: + log_warning("sel.select() did not return swsscommon.Select.OBJECT") + continue + + (key, op, fvp) = sst.pop() + fvp_dict = dict(fvp) + + if op == "SET" and fvp_dict.get("state") == "ok": + self.update_lldp_config_for_port(key) + + +# ============================= Functions ============================= + +def main(): + log_info("Starting up...") + + if not os.geteuid() == 0: + log_error("Must be root to run this daemon") + print "Error: Must be root to run this daemon" + sys.exit(1) + + # Register our signal handlers + signal.signal(signal.SIGHUP, signal_handler) + signal.signal(signal.SIGINT, signal_handler) + signal.signal(signal.SIGTERM, signal_handler) + + # Instantiate a LldpManager object + lldpmgr = LldpManager() + lldpmgr.run() + +if __name__ == "__main__": + main() diff --git a/dockers/docker-lldp-sv2/reconfigure.sh b/dockers/docker-lldp-sv2/reconfigure.sh deleted file mode 100755 index 515e771aa6f2..000000000000 --- a/dockers/docker-lldp-sv2/reconfigure.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -set -e - -# TODO: Listen to state database when it is ready -interfaces=$(sonic-cfggen -d -v "PORT.keys() | join(' ')") - -function wait_until_if_exists -{ - if=$1 - while [ ! -L /sys/class/net/"$if" ] ; - do - sleep 1 - done - echo interface "$if" is created -} - - -function wait_until_if_not_exists -{ - if=$1 - while [ -L /sys/class/net/"$if" ] ; - do - sleep 1 - done - echo interface "$if" is destroyed -} - - -while /bin/true ; -do - # wait until all interfaces are created - echo Wait until all interfaces are created - for i in $interfaces - do - wait_until_if_exists $i - done - - echo Wait 10 seconds while lldpd finds new interfaces - sleep 10 - - # apply lldpd configuration - echo Apply lldpd configuration - lldpcli -c /etc/lldpd.conf - - # wait until all interfaces are destroyed - echo Wait until all ifaces are destroyed - for i in $interfaces - do - wait_until_if_not_exists $i - done -done diff --git a/dockers/docker-lldp-sv2/start.sh b/dockers/docker-lldp-sv2/start.sh index 3a765c6f5482..26337fb0667d 100755 --- a/dockers/docker-lldp-sv2/start.sh +++ b/dockers/docker-lldp-sv2/start.sh @@ -9,5 +9,5 @@ rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd supervisorctl start lldpd -supervisorctl start lldpd-conf-reload supervisorctl start lldp-syncd +supervisorctl start lldpmgrd diff --git a/dockers/docker-lldp-sv2/supervisord.conf b/dockers/docker-lldp-sv2/supervisord.conf index ab62d9ed2e87..60334e1b8ede 100644 --- a/dockers/docker-lldp-sv2/supervisord.conf +++ b/dockers/docker-lldp-sv2/supervisord.conf @@ -26,23 +26,23 @@ stderr_logfile=syslog # - `-ddd` means to stay in foreground, log warnings and info to console # - `-dddd` means to stay in foreground, log all to console command=/usr/sbin/lldpd -d -I Ethernet*,eth* -priority=100 +priority=3 autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog -[program:lldpd-conf-reload] -command=/usr/bin/reconfigure.sh -priority=150 +[program:lldp-syncd] +command=/usr/bin/env python2 -m lldp_syncd +priority=4 autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog -[program:lldp-syncd] -command=/usr/bin/env python2 -m lldp_syncd -priority=200 +[program:lldpmgrd] +command=/usr/bin/lldpmgrd +priority=5 autostart=false autorestart=false stdout_logfile=syslog diff --git a/rules/docker-lldp-sv2.mk b/rules/docker-lldp-sv2.mk index d9500d1d077a..93f08a541239 100644 --- a/rules/docker-lldp-sv2.mk +++ b/rules/docker-lldp-sv2.mk @@ -2,7 +2,7 @@ DOCKER_LLDP_SV2 = docker-lldp-sv2.gz $(DOCKER_LLDP_SV2)_PATH = $(DOCKERS_PATH)/docker-lldp-sv2 -$(DOCKER_LLDP_SV2)_DEPENDS += $(LLDPD) +$(DOCKER_LLDP_SV2)_DEPENDS += $(LLDPD) $(LIBSWSSCOMMON) $(PYTHON_SWSSCOMMON) $(DOCKER_LLDP_SV2)_PYTHON_WHEELS += $(DBSYNCD_PY2) $(DOCKER_LLDP_SV2)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_LLDP_SV2) From a9d2e1362702894756df84fe1272cfb03352ba08 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 2 Mar 2018 21:21:25 -0800 Subject: [PATCH 009/274] [image]: prevent password related command into syslog (#1450) * [image]: prevent password related command into syslog --- files/image_config/sudoers/sudoers | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/files/image_config/sudoers/sudoers b/files/image_config/sudoers/sudoers index 317ace3bf99f..952a2313bad2 100644 --- a/files/image_config/sudoers/sudoers +++ b/files/image_config/sudoers/sudoers @@ -31,12 +31,17 @@ Cmnd_Alias READ_ONLY_CMDS = /usr/bin/decode-syseeprom, \ /bin/cat /var/log/syslog, \ /usr/bin/tail -f /var/log/syslog +Cmnd_Alias PASSWD_CMDS = /usr/bin/config tacacs passkey *, \ + /usr/sbin/chpasswd * + # User privilege specification root ALL=(ALL:ALL) ALL # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) NOPASSWD: ALL +# Prevent password related command into syslog +Defaults!PASSWD_CMDS !syslog # See sudoers(5) for more information on "#include" directives: From b9f4aa9f005e87b76e3057981806de9feb30d959 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 2 Mar 2018 21:21:47 -0800 Subject: [PATCH 010/274] [bcm sai] upgrade to sai version 3.1.3.4-3 (#1451) - included bcm config files missed between 3.0 and 3.1. --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index de40433e0efa..9616f405dc5c 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.4-2_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-2_amd64.deb?sv=2015-04-05&sr=b&sig=EZRvr20FafC1pB3SLyA4K0cAsbbiNGPkuCuvPEgOtmU%3D&se=2031-11-01T00%3A33%3A10Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.4-3_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-3_amd64.deb?sv=2015-04-05&sr=b&sig=B3xLAq0vI8k0HLt740baKtMxgaAQUkenS63erudlzAU%3D&se=2031-11-09T22%3A35%3A16Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-2_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-3_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-2_amd64.deb?sv=2015-04-05&sr=b&sig=SXh77LQCpwF6e65rU0RX4zMSNMlAHh1iSjsLktrE360%3D&se=2031-11-01T00%3A32%3A36Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-3_amd64.deb?sv=2015-04-05&sr=b&sig=iIVQQNj5gYGlDr8zP9YQXSaHs0o0NziijMDRFyKMfW8%3D&se=2031-11-09T22%3A34%3A14Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From d9aa42e33cea4fcc3991acdc4cb84c3b1544005b Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 2 Mar 2018 21:23:04 -0800 Subject: [PATCH 011/274] [tacacs]: Obfuscate key before printing to syslog (#1453) --- .../nss/0001-Modify-user-map-profile.patch | 4 +-- ...uscate-key-before-printing-to-syslog.patch | 25 +++++++++++++++++++ src/tacacs/pam/Makefile | 1 + 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 src/tacacs/pam/0003-Obfuscate-key-before-printing-to-syslog.patch diff --git a/src/tacacs/nss/0001-Modify-user-map-profile.patch b/src/tacacs/nss/0001-Modify-user-map-profile.patch index 75d037977de4..49e02cf0da58 100644 --- a/src/tacacs/nss/0001-Modify-user-map-profile.patch +++ b/src/tacacs/nss/0001-Modify-user-map-profile.patch @@ -619,9 +619,9 @@ index 79e62b9..ecfa0b0 100644 + useradd_info_t *user; + + for(n = 0; n < tac_srv_no; n++) { -+ syslog(LOG_DEBUG, "%s: server[%d] { addr=%s, key=%s, timeout=%d }", ++ syslog(LOG_DEBUG, "%s: server[%d] { addr=%s, key=%c*****, timeout=%d }", + nssname, n, tac_ntop(tac_srv[n].addr->ai_addr), -+ tac_srv[n].key, tac_srv[n].timeout); ++ tac_srv[n].key[0], tac_srv[n].timeout); + } + syslog(LOG_DEBUG, "%s: many_to_one %s", nssname, 1 == many_to_one + ? "enable" : "disable"); diff --git a/src/tacacs/pam/0003-Obfuscate-key-before-printing-to-syslog.patch b/src/tacacs/pam/0003-Obfuscate-key-before-printing-to-syslog.patch new file mode 100644 index 000000000000..1d1f5d3efe89 --- /dev/null +++ b/src/tacacs/pam/0003-Obfuscate-key-before-printing-to-syslog.patch @@ -0,0 +1,25 @@ +From 254e6cb86b667f6324bcbfd89fe982e865d05189 Mon Sep 17 00:00:00 2001 +From: Taoyu Li +Date: Sat, 3 Mar 2018 02:22:49 +0000 +Subject: [PATCH] obfuscate key before printing to syslog + +--- + support.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/support.c b/support.c +index 44efee3..f9ab8aa 100644 +--- a/support.c ++++ b/support.c +@@ -282,7 +282,7 @@ int _pam_parse (int argc, const char **argv) { + _pam_log(LOG_DEBUG, "%d servers defined", tac_srv_no); + + for(n = 0; n < tac_srv_no; n++) { +- _pam_log(LOG_DEBUG, "server[%d] { addr=%s, key='%s' }", n, tac_ntop(tac_srv[n].addr->ai_addr), tac_srv[n].key); ++ _pam_log(LOG_DEBUG, "server[%d] { addr=%s, key='%c*****' }", n, tac_ntop(tac_srv[n].addr->ai_addr), tac_srv[n].key[0]); + } + + _pam_log(LOG_DEBUG, "tac_service='%s'", tac_service); +-- +2.9.3 + diff --git a/src/tacacs/pam/Makefile b/src/tacacs/pam/Makefile index 707668791402..21d8eeace73e 100644 --- a/src/tacacs/pam/Makefile +++ b/src/tacacs/pam/Makefile @@ -16,6 +16,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Apply patch git apply ../0001-Don-t-init-declarations-in-a-for-loop.patch git apply ../0002-Fix-libtac2-bin-install-directory-error.patch + git apply ../0003-Obfuscate-key-before-printing-to-syslog.patch dpkg-buildpackage -rfakeroot -b -us -uc popd From 09f2385a15be72d3e242d49bdec4f7f0b2077f40 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 2 Mar 2018 21:24:01 -0800 Subject: [PATCH 012/274] [hostcfgd/tacacs] obfuscate tacacs credentials in syslog (#1444) --- files/image_config/hostcfgd/hostcfgd | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/files/image_config/hostcfgd/hostcfgd b/files/image_config/hostcfgd/hostcfgd index 837c5351e0eb..25cfa7c714c4 100755 --- a/files/image_config/hostcfgd/hostcfgd +++ b/files/image_config/hostcfgd/hostcfgd @@ -32,6 +32,13 @@ def sub(l, start, end): return l[start:end] +def obfuscate(data): + if data: + return data[0] + '*****' + else: + return data + + class AaaCfg(object): def __init__(self): self.auth_default = { @@ -144,16 +151,19 @@ class HostConfigDaemon: self.aaacfg.load(aaa, tacacs_global, tacacs_server) def aaa_handler(self, key, data): - syslog.syslog(syslog.LOG_DEBUG, 'value for {} changed to {}'.format(key, data)) self.aaacfg.aaa_update(key, data) def tacacs_server_handler(self, key, data): - syslog.syslog(syslog.LOG_DEBUG, 'value for {} changed to {}'.format(key, data)) self.aaacfg.tacacs_server_update(key, data) + if data.has_key('passkey'): + data['passkey'] = obfuscate(data['passkey']) + syslog.syslog(syslog.LOG_DEBUG, 'value for {} changed to {}'.format(key, data)) def tacacs_global_handler(self, key, data): - syslog.syslog(syslog.LOG_DEBUG, 'value for {} changed to {}'.format(key, data)) self.aaacfg.tacacs_global_update(key, data) + if data.has_key('passkey'): + data['passkey'] = obfuscate(data['passkey']) + syslog.syslog(syslog.LOG_DEBUG, 'value for {} changed to {}'.format(key, data)) def start(self): self.config_db.subscribe('AAA', lambda table, key, data: self.aaa_handler(key, data)) From 2b449420b81c59a3cfee9de46d8066d01cc11d5a Mon Sep 17 00:00:00 2001 From: Harish Venkatraman Date: Fri, 2 Mar 2018 23:31:41 -0800 Subject: [PATCH 013/274] [device/dell] Code supports New Buffer mgmt infra (#1449) This commit adds new code which supports the new buffer mgmt infra. - Added new code to support buffers for T0 and T1 configs of S6100. - Added new qos.json file to support qos on S6100. - Changed the pg_profile_lookup.ini file to support xon_offset. - Changed buffer.json.j2 file according to new buffer mgmt infra. Unit tested by verifying the above changes by loading S6100 with the configuration, checked the hardware for broadcom recommended settings by running bcmcmd. Sent the unit test logs to Ying. Checked the PG_RESET_OFFSET value which reflects the new xon_offset value of 2288 from the pg_profile_lookup.ini. Signed-off-by: Harish Venkatraman --- .../Force10-S6100/buffers.json.j2 | 148 +--------------- .../Force10-S6100/buffers_defaults_t0.j2 | 47 +++++ .../Force10-S6100/buffers_defaults_t1.j2 | 47 +++++ .../Force10-S6100/pg_profile_lookup.ini | 32 ++-- .../Force10-S6100/qos.json | 167 ++++++++++++++++++ 5 files changed, 279 insertions(+), 162 deletions(-) create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t0.j2 create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t1.j2 create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 index 3abfae26744e..1083a6210fc9 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 @@ -1,146 +1,2 @@ -{# Default values which will be used if no actual configura available #} -{% set default_cable = '300m' %} -{% set default_speed = '100G' %} -{% set default_ports_num = 64 -%} - -{# Port configuration to cable length look-up table #} -{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} -{# Roles described in the minigraph #} -{% set ports2cable = { - 'torrouter_server' : '5m', - 'leafrouter_torrouter' : '40m', - 'spinerouter_leafrouter' : '300m' - } -%} - -{%- macro cable_length(port_name) -%} - {%- set cable_len = [] -%} - {%- for local_port in DEVICE_NEIGHBOR -%} - {%- if local_port == port_name -%} - {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor_role = neighbor.type -%} - {%- set roles1 = switch_role + '_' + neighbor_role %} - {%- set roles2 = neighbor_role + '_' + switch_role -%} - {%- set roles1 = roles1 | lower -%} - {%- set roles2 = roles2 | lower -%} - {%- if roles1 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} - {%- elif roles2 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {%- if cable_len -%} - {{ cable_len.0 }} - {%- else -%} - {%- if switch_role == 'ToRRouter' -%} - {%- for local_port in VLAN_MEMBER -%} - {%- set vlan_port = local_port.split("|") -%} - {%- if vlan_port[1] == port_name -%} - {%- set roles3 = switch_role + '_' + 'server' -%} - {%- set roles3 = roles3 | lower -%} - {%- if roles3 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles3]) -%}{%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {%- if cable_len -%} - {{cable_len.0}} - {%- else -%} - {{ default_cable }} - {%- endif -%} - {%- else -%} - {{ default_cable }} - {%- endif -%} - {%- endif -%} -{% endmacro %} - -{%- if DEVICE_METADATA is defined %} -{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} -{%- endif -%} - -{# Generate list of ports if not defined #} -{% if PORT is not defined %} - {% set PORT = [] %} - {% for port_idx in range(0,default_ports_num) %} - {% if PORT.append("Ethernet%d" % port_idx) %}{% endif %} - {% endfor %} -{% endif -%} - -{% set port_names_list = [] %} -{% for port in PORT %} - {%- if port_names_list.append(port) %}{% endif %} -{% endfor %} -{% set port_names = port_names_list | join(',') -%} - -{ - "CABLE_LENGTH": { - "AZURE": { - {% for port in PORT %} - {% set cable = cable_length(port) -%} - "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} - - {% endfor %} - } - }, - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "10443264", - "type": "ingress", - "mode": "dynamic", - "xoff": "4625920" - }, - "egress_lossy_pool": { - "size": "8877440", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "15982592", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool": "[BUFFER_POOL|ingress_lossless_pool]", - "xon": "4096", - "xoff": "58448", - "size": "1248", - "dynamic_th": "-4" - }, - "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"1518", - "static_th":"3995648" - }, - "egress_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"1518", - "dynamic_th":"3" - } - }, - "BUFFER_PG": { - "{{ port_names }}|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" - }, - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - } - }, - "BUFFER_QUEUE": { - "{{ port_names }}|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - } - } -} +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t0.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..7464d31b8e69 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t0.j2 @@ -0,0 +1,47 @@ + +{%- set default_cable = '5m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,63) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "11213696", + "type": "ingress", + "mode": "dynamic", + "xoff": "3855488" + }, + "egress_lossy_pool": { + "size": "9532224", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"1518", + "static_th":"3995680" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t1.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..d367dba3f74f --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t1.j2 @@ -0,0 +1,47 @@ + +{%- set default_cable = '40m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,63) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "10443264", + "type": "ingress", + "mode": "dynamic", + "xoff": "4625920" + }, + "egress_lossy_pool": { + "size": "8877440", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"1518", + "static_th":"3995680" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini index c2375046870e..3b2a417cebcd 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini @@ -1,17 +1,17 @@ # PG lossless profiles. -# speed cable size xon xoff threshold - 10000 5m 1248 2288 35776 -4 - 25000 5m 1248 2288 53248 -4 - 40000 5m 1248 2288 66560 -4 - 50000 5m 1248 2288 90272 -4 - 100000 5m 1248 2288 165568 -4 - 10000 40m 1248 2288 37024 -4 - 25000 40m 1248 2288 53248 -4 - 40000 40m 1248 2288 71552 -4 - 50000 40m 1248 2288 96096 -4 - 100000 40m 1248 2288 177632 -4 - 10000 300m 1248 2288 46176 -4 - 25000 300m 1248 2288 79040 -4 - 40000 300m 1248 2288 108160 -4 - 50000 300m 1248 2288 141856 -4 - 100000 300m 1248 2288 268736 -4 +# speed cable size xon xoff threshold xon_offset + 10000 5m 1248 2288 35776 -4 2288 + 25000 5m 1248 2288 53248 -4 2288 + 40000 5m 1248 2288 66560 -4 2288 + 50000 5m 1248 2288 90272 -4 2288 + 100000 5m 1248 2288 165568 -4 2288 + 10000 40m 1248 2288 37024 -4 2288 + 25000 40m 1248 2288 53248 -4 2288 + 40000 40m 1248 2288 71552 -4 2288 + 50000 40m 1248 2288 96096 -4 2288 + 100000 40m 1248 2288 177632 -4 2288 + 10000 300m 1248 2288 46176 -4 2288 + 25000 300m 1248 2288 79040 -4 2288 + 40000 300m 1248 2288 108160 -4 2288 + 50000 300m 1248 2288 141856 -4 2288 + 100000 300m 1248 2288 268736 -4 2288 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json new file mode 100644 index 000000000000..d63cbfb8c558 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json @@ -0,0 +1,167 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"512000", + "red_min_threshold":"512000", + "yellow_max_threshold":"512000", + "yellow_min_threshold":"512000", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + }, + "AZURE_LOSSLESS" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"512000", + "red_min_threshold":"512000", + "yellow_max_threshold":"512000", + "yellow_min_threshold":"512000", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63|0-1" : { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63!3-4" : { + "scheduler" : "[SCHEDULER|scheduler.0]" + }, + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63!0" : { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63!1" : { + "scheduler" : "[SCHEDULER|scheduler.2]" + } + } +} From 20ab99bf31a5ff2b8e217ec87b631b5b178794b6 Mon Sep 17 00:00:00 2001 From: "Wenda Ni, Ph.D" Date: Sat, 3 Mar 2018 10:09:49 -0800 Subject: [PATCH 014/274] [qos]: Apply ECN configuration on lossless queue for 7050-QX-32S and S6000 (#1439) --- .../Arista-7050-QX-32S/qos.json | 21 +++++++++---------- .../Force10-S6000/qos.json | 21 +++++++++---------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json index f0d92559970f..926911ab59d0 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json @@ -115,24 +115,23 @@ } }, "WRED_PROFILE": { - "AZURE_LOSSY" : { + "AZURE_LOSSLESS" : { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold":"312000", + "green_min_threshold":"104000" } }, "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]" + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json index f0d92559970f..926911ab59d0 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json @@ -115,24 +115,23 @@ } }, "WRED_PROFILE": { - "AZURE_LOSSY" : { + "AZURE_LOSSLESS" : { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold":"312000", + "green_min_threshold":"104000" } }, "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]" + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" From 126d08d000c009ab2e3b9aabb07b497e4134faa8 Mon Sep 17 00:00:00 2001 From: ZivErlich <32637684+ZivErlich@users.noreply.github.com> Date: Mon, 5 Mar 2018 03:58:53 +0200 Subject: [PATCH 015/274] [devices]: Updating SFPUtil plugin for Acton AS7212 and Marvell SLM5401 (#1456) --- .../plugins/sfputil.py | 75 ++++++++++++++++++- .../plugins/sfputil.py | 75 ++++++++++++++++++- 2 files changed, 142 insertions(+), 8 deletions(-) diff --git a/device/accton/x86_64-accton_as7212_54x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7212_54x-r0/plugins/sfputil.py index 6dc35d72bb21..925c6cb0d73a 100755 --- a/device/accton/x86_64-accton_as7212_54x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7212_54x-r0/plugins/sfputil.py @@ -1,12 +1,13 @@ #!/usr/bin/env python try: - from sonic_sfp.sfputilbase import sfputilbase + import time + from sonic_sfp.sfputilbase import SfpUtilBase except ImportError, e: raise ImportError (str(e) + "- required module not found") -class sfputil(sfputilbase): +class sfputil(SfpUtilBase): """Platform specific sfputil class""" port_start = 0 @@ -51,10 +52,76 @@ class sfputil(sfputilbase): _qsfp_ports = range(0, ports_in_block + 1) - def __init__(self, port_num): + def __init__(self): # Override port_to_eeprom_mapping for class initialization eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom' for x in range(self.port_start, self.port_end + 1): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x+1]) self.port_to_eeprom_mapping[x] = port_eeprom_path - sfputilbase.__init__(self, port_num) + SfpUtilBase.__init__(self) + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = "/sys/bus/i2c/devices/{0}-0050/sfp_port_reset" + port_ps = path.format(self.port_to_i2c_mapping[port_num+1]) + + try: + reg_file = open(port_ps, 'w') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + #toggle reset + reg_file.seek(0) + reg_file.write('1') + time.sleep(1) + reg_file.seek(0) + reg_file.write('0') + reg_file.close() + return True + + def set_low_power_mode(self, port_nuM, lpmode): + raise NotImplementedErro + + def get_low_power_mode(self, port_num): + raise NotImplementedErro + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = "/sys/bus/i2c/devices/{0}-0050/sfp_is_present" + port_ps = path.format(self.port_to_i2c_mapping[port_num+1]) + + + try: + reg_file = open(port_ps) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_file.readline().rstrip() + if reg_value == '1': + return True + + return False + + @property + def port_start(self): + return self._port_start + + @property + def port_end(self): + return self._port_end + + @property + def qsfp_ports(self): + return range(0, self.ports_in_block + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping diff --git a/device/marvell/x86_64-marvell_slm5401_54x-r0/plugins/sfputil.py b/device/marvell/x86_64-marvell_slm5401_54x-r0/plugins/sfputil.py index 6dc35d72bb21..925c6cb0d73a 100755 --- a/device/marvell/x86_64-marvell_slm5401_54x-r0/plugins/sfputil.py +++ b/device/marvell/x86_64-marvell_slm5401_54x-r0/plugins/sfputil.py @@ -1,12 +1,13 @@ #!/usr/bin/env python try: - from sonic_sfp.sfputilbase import sfputilbase + import time + from sonic_sfp.sfputilbase import SfpUtilBase except ImportError, e: raise ImportError (str(e) + "- required module not found") -class sfputil(sfputilbase): +class sfputil(SfpUtilBase): """Platform specific sfputil class""" port_start = 0 @@ -51,10 +52,76 @@ class sfputil(sfputilbase): _qsfp_ports = range(0, ports_in_block + 1) - def __init__(self, port_num): + def __init__(self): # Override port_to_eeprom_mapping for class initialization eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom' for x in range(self.port_start, self.port_end + 1): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x+1]) self.port_to_eeprom_mapping[x] = port_eeprom_path - sfputilbase.__init__(self, port_num) + SfpUtilBase.__init__(self) + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = "/sys/bus/i2c/devices/{0}-0050/sfp_port_reset" + port_ps = path.format(self.port_to_i2c_mapping[port_num+1]) + + try: + reg_file = open(port_ps, 'w') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + #toggle reset + reg_file.seek(0) + reg_file.write('1') + time.sleep(1) + reg_file.seek(0) + reg_file.write('0') + reg_file.close() + return True + + def set_low_power_mode(self, port_nuM, lpmode): + raise NotImplementedErro + + def get_low_power_mode(self, port_num): + raise NotImplementedErro + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = "/sys/bus/i2c/devices/{0}-0050/sfp_is_present" + port_ps = path.format(self.port_to_i2c_mapping[port_num+1]) + + + try: + reg_file = open(port_ps) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_file.readline().rstrip() + if reg_value == '1': + return True + + return False + + @property + def port_start(self): + return self._port_start + + @property + def port_end(self): + return self._port_end + + @property + def qsfp_ports(self): + return range(0, self.ports_in_block + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping From 4c1419ceaeb8a9d8a71750f5855d0aad80b7fd59 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Mon, 5 Mar 2018 13:42:45 -0800 Subject: [PATCH 016/274] [sonic-utilities]: update submodule (#1458) Signed-off-by: Sihui Han --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index fce7089bc544..ca6fb49169f5 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit fce7089bc544266dba1daacf29ef0379a800918b +Subproject commit ca6fb49169f56fe42744eb74df9d1c72b556ba6d From b2518c8310de4d0553900225fa65786a10238754 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Mon, 5 Mar 2018 17:43:25 -0800 Subject: [PATCH 017/274] [swss/sairedis]: update submodules (#1459) * [sairedis]: update submodule Signed-off-by: Sihui Han * [swss]: update submodule * exclude crm in swss submodule --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 8990e2522dd6..a381f5653e1f 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 8990e2522dd632b3be2162043bdf580b189ceace +Subproject commit a381f5653e1fdcfe0ef67660b9ae0f24648f721e diff --git a/src/sonic-swss b/src/sonic-swss index 6e274fbcf208..e32212a79c59 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 6e274fbcf208d7d66b3fe1449043bd2e01e43f9c +Subproject commit e32212a79c595c522e9ef9f6033519e6a2db4ead From 7639cc1b5302f66a329305034e89d4b4d0392f13 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Mon, 5 Mar 2018 23:55:37 -0800 Subject: [PATCH 018/274] [pfcwd]: add flag to enable pfc wd on start (#1429) --- Makefile | 3 +++ files/build_templates/sonic_debian_extension.j2 | 4 ++++ rules/config | 4 ++++ slave.mk | 6 ++++++ 4 files changed, 17 insertions(+) diff --git a/Makefile b/Makefile index aa3492561cb2..da5f0a282b1b 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,8 @@ # * ENABLE_DHCP_GRAPH_SERVICE: Enables get-graph service to fetch minigraph files # through http. # * SHUTDOWN_BGP_ON_START: Sets admin-down state for all bgp peerings after restart. +# * ENABLE_PFCWD_ON_START: Enable PFC Watchdog (PFCWD) on server-facing ports +# * by default for TOR switch. # * SONIC_ENABLE_SYNCD_RPC: Enables rpc-based syncd builds. # * USERNAME: Desired username -- default at rules/config # * PASSWORD: Desired password -- default at rules/config @@ -62,6 +64,7 @@ SONIC_BUILD_INSTRUCTION := make \ BUILD_NUMBER=$(BUILD_NUMBER) \ ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \ SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \ + SONIC_ENABLE_PFCWD_ON_START=$(ENABLE_PFCWD_ON_START) \ ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \ PASSWORD=$(PASSWORD) \ USERNAME=$(USERNAME) \ diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 5d7f2b2496ad..434e427abe13 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -168,6 +168,10 @@ sudo bash -c "echo enabled=false > $FILESYSTEM_ROOT/etc/sonic/updategraph.conf" {% if shutdown_bgp_on_start == "y" %} sudo bash -c "echo '{ \"DEVICE_METADATA\": { \"localhost\": { \"default_bgp_status\": \"down\" } } }' >> $FILESYSTEM_ROOT/etc/sonic/init_cfg.json" {% endif %} +{% if enable_pfcwd_on_start == "y" %} +sudo bash -c "echo '{ \"DEVICE_METADATA\": { \"localhost\": { \"default_pfcwd_status\": \"enable\" } } }' >> $FILESYSTEM_ROOT/etc/sonic/init_cfg.json" +{% endif %} + # Copy SNMP configuration files sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/ diff --git a/rules/config b/rules/config index ad13ad047e04..49eb8d57e984 100644 --- a/rules/config +++ b/rules/config @@ -36,6 +36,10 @@ DEFAULT_PASSWORD = YourPaSsWoRd # bgp service starts. # SHUTDOWN_BGP_ON_START = y +# ENABLE_PFCWD_ON_START - if set to y PFC Watchdog (PFCWD) will be enabled all server-facing ports +# by default for TOR switch +# ENABLE_PFCWD_ON_START = y + # SONIC_CONFIG_DEBUG - install debug packages # Uncomment next line to enable: # SONIC_CONFIG_DEBUG = y diff --git a/slave.mk b/slave.mk index 71505942685c..7e842a7a608e 100644 --- a/slave.mk +++ b/slave.mk @@ -59,6 +59,10 @@ list : ## Include other rules ############################################################################### +ifeq ($(SONIC_ENABLE_PFCWD_ON_START),y) +ENABLE_PFCWD_ON_START = y +endif + include $(RULES_PATH)/config include $(RULES_PATH)/functions include $(RULES_PATH)/*.mk @@ -96,6 +100,7 @@ $(info "DEFAULT_USERNAME" : "$(DEFAULT_USERNAME)") $(info "DEFAULT_PASSWORD" : "$(DEFAULT_PASSWORD)") $(info "ENABLE_DHCP_GRAPH_SERVICE" : "$(ENABLE_DHCP_GRAPH_SERVICE)") $(info "SHUTDOWN_BGP_ON_START" : "$(SHUTDOWN_BGP_ON_START)") +$(info "ENABLE_PFCWD_ON_START" : "$(ENABLE_PFCWD_ON_START)") $(info "SONIC_CONFIG_DEBUG" : "$(SONIC_CONFIG_DEBUG)") $(info "ROUTING_STACK" : "$(SONIC_ROUTING_STACK)") $(info "ENABLE_SYNCD_RPC" : "$(ENABLE_SYNCD_RPC)") @@ -439,6 +444,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export enable_organization_extensions="$(ENABLE_ORGANIZATION_EXTENSIONS)" export enable_dhcp_graph_service="$(ENABLE_DHCP_GRAPH_SERVICE)" export shutdown_bgp_on_start="$(SHUTDOWN_BGP_ON_START)" + export enable_pfcwd_on_start="$(ENABLE_PFCWD_ON_START)" export installer_debs="$(addprefix $(DEBS_PATH)/,$($*_INSTALLS))" export lazy_installer_debs="$(foreach deb, $($*_LAZY_INSTALLS),$(foreach device, $($(deb)_PLATFORM),$(addprefix $(device)@, $(DEBS_PATH)/$(deb))))" export installer_images="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))" From f250fe745adc73cfa0a9a4bf73e47e0e16407845 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 6 Mar 2018 12:19:16 -0800 Subject: [PATCH 019/274] [minigraph.py] Convert ipv6 addresses into lower case parsing cpg (#1460) * [minigraph.py] Convert ipv6 addresses into lower case parsing cpg --- src/sonic-config-engine/minigraph.py | 8 ++++---- src/sonic-utilities | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index f6083853c591..34fcf1bcee25 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -239,18 +239,18 @@ def parse_cpg(cpg, hname): keepalive = 60 nhopself = 1 if session.find(str(QName(ns, "NextHopSelf"))) is not None else 0 if end_router == hname: - bgp_sessions[start_peer] = { + bgp_sessions[start_peer.lower()] = { 'name': start_router, - 'local_addr': end_peer, + 'local_addr': end_peer.lower(), 'rrclient': rrclient, 'holdtime': holdtime, 'keepalive': keepalive, 'nhopself': nhopself } else: - bgp_sessions[end_peer] = { + bgp_sessions[end_peer.lower()] = { 'name': end_router, - 'local_addr': start_peer, + 'local_addr': start_peer.lower(), 'rrclient': rrclient, 'holdtime': holdtime, 'keepalive': keepalive, diff --git a/src/sonic-utilities b/src/sonic-utilities index ca6fb49169f5..bf8d2b430e9d 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit ca6fb49169f56fe42744eb74df9d1c72b556ba6d +Subproject commit bf8d2b430e9dfea4fc9f9626acb2663aa527da91 From 763461eeacd67d9a7b59361078bc0bbf0731a005 Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Wed, 7 Mar 2018 16:33:33 +0800 Subject: [PATCH 020/274] [devices]: As7816 64x validate sfputil psuutil (#1466) --- .../plugins/psuutil.py | 61 +++++++++++++++++++ .../plugins/sfputil.py | 14 ++--- .../broadcom/sonic-platform-modules-accton | 2 +- 3 files changed, 67 insertions(+), 10 deletions(-) create mode 100755 device/accton/x86_64-accton_as7816_64x-r0/plugins/psuutil.py diff --git a/device/accton/x86_64-accton_as7816_64x-r0/plugins/psuutil.py b/device/accton/x86_64-accton_as7816_64x-r0/plugins/psuutil.py new file mode 100755 index 000000000000..707c7c897c82 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/plugins/psuutil.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +############################################################################# +# Accton +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/" + self.psu_presence = "/psu_present" + self.psu_oper_status = "/psu_power_good" + self.psu_mapping = { + 1: "10-0053", + 2: "9-0050", + } + + def get_num_psus(self): + return len(self.psu_mapping) + + def get_psu_status(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index]+self.psu_oper_status + try: + with open(node, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index] + self.psu_presence + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/accton/x86_64-accton_as7816_64x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7816_64x-r0/plugins/sfputil.py index 7c82583c26bb..26c2b37c6722 100644 --- a/device/accton/x86_64-accton_as7816_64x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7816_64x-r0/plugins/sfputil.py @@ -94,9 +94,8 @@ def reset(self, port_num): # Check for invalid port_num if port_num < self._port_start or port_num > self._port_end: return False - - path = "/sys/bus/i2c/devices/{0}-0050/sfp_port_reset" - port_ps = path.format(self.port_to_i2c_mapping[port_num+1]) + path = "/sys/bus/i2c/devices/19-0060/module_reset_{0}" + port_ps = path.format(port_num+1) try: reg_file = open(port_ps, 'w') @@ -104,20 +103,17 @@ def reset(self, port_num): print "Error: unable to open file: %s" % str(e) return False - #toggle reset + #HW will clear reset after set. reg_file.seek(0) reg_file.write('1') - time.sleep(1) - reg_file.seek(0) - reg_file.write('0') reg_file.close() return True def set_low_power_mode(self, port_nuM, lpmode): - raise NotImplementedErro + raise NotImplementedError def get_low_power_mode(self, port_num): - raise NotImplementedErro + raise NotImplementedError def get_presence(self, port_num): # Check for invalid port_num diff --git a/platform/broadcom/sonic-platform-modules-accton b/platform/broadcom/sonic-platform-modules-accton index 5c48c84b0f3f..aaaea8d12838 160000 --- a/platform/broadcom/sonic-platform-modules-accton +++ b/platform/broadcom/sonic-platform-modules-accton @@ -1 +1 @@ -Subproject commit 5c48c84b0f3f5ee8b44f02ff3e0c3d1ad2169066 +Subproject commit aaaea8d12838de634fd27e936e4086258933cbac From ef683848af410820adcfd09a3c32c39628648b65 Mon Sep 17 00:00:00 2001 From: "Wenda Ni, Ph.D" Date: Wed, 7 Mar 2018 07:21:41 -0800 Subject: [PATCH 021/274] [devices]: A7050 qx32 mmuconfig (#1463) * Apply MMU config (buffers, qos) to Arista-7050-QX32 Signed-off-by: Wenda --- .../Arista-7050-QX32/buffers.json.j2 | 29 +++- .../Arista-7050-QX32/pg_profile_lookup.ini | 17 --- .../Arista-7050-QX32/qos.json | 143 ++++++++++++++++++ dockers/docker-orchagent/swssconfig.sh | 2 - 4 files changed, 170 insertions(+), 21 deletions(-) delete mode 100644 device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/pg_profile_lookup.ini create mode 100644 device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 index 560cae5dd1b4..376bdab77d89 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 @@ -68,8 +68,13 @@ } }, "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "7274496", + "ingress_lossless_pool0": { + "size": "3637248", + "type": "ingress", + "mode": "static" + }, + "ingress_lossless_pool1": { + "size": "3637248", "type": "ingress", "mode": "static" }, @@ -95,6 +100,20 @@ } }, "BUFFER_PROFILE": { + "ingress_lossless_profile0": { + "pool":"[BUFFER_POOL|ingress_lossless_pool0]", + "xon":"18432", + "xoff":"76800", + "size":"113664", + "static_th":"0" + }, + "ingress_lossless_profile1": { + "pool":"[BUFFER_POOL|ingress_lossless_pool1]", + "xon":"18432", + "xoff":"76800", + "size":"113664", + "static_th":"0" + }, "ingress_lossy_profile": { "pool":"[BUFFER_POOL|ingress_lossy_pool]", "size":"1518", @@ -117,6 +136,12 @@ } }, "BUFFER_PG": { + "{{ port_names }}|3": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile0]" + }, + "{{ port_names }}|4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile1]" + }, "{{ port_names }}|0-1": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" } diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/pg_profile_lookup.ini deleted file mode 100644 index f3a0840558a6..000000000000 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold - 10000 5m 113664 18432 76800 0 - 25000 5m 113664 18432 76800 0 - 40000 5m 113664 18432 76800 0 - 50000 5m 113664 18432 76800 0 - 100000 5m 113664 18432 76800 0 - 10000 40m 113664 18432 76800 0 - 25000 40m 113664 18432 76800 0 - 40000 40m 113664 18432 76800 0 - 50000 40m 113664 18432 76800 0 - 100000 40m 113664 18432 76800 0 - 10000 300m 113664 18432 76800 0 - 25000 300m 113664 18432 76800 0 - 40000 300m 113664 18432 76800 0 - 50000 300m 113664 18432 76800 0 - 100000 300m 113664 18432 76800 0 diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json new file mode 100644 index 000000000000..926911ab59d0 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json @@ -0,0 +1,143 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold":"312000", + "green_min_threshold":"104000" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1" : { + "scheduler" : "[SCHEDULER|scheduler.2]" + } + } +} diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 7d82214e1e42..d3035e04d811 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -45,8 +45,6 @@ SWSSCONFIG_ARGS="00-copp.config.json ipinip.json ports.json switch.json " if [ "$HWSKU" == "Force10-S6100" ]; then SWSSCONFIG_ARGS+="th.64ports.buffers.json th.64ports.qos.json " -elif [ "$HWSKU" == "Arista-7050-QX32" ]; then - SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " fi for file in $SWSSCONFIG_ARGS; do From 667ca3254e068632b2b45e29ad287dbdbded79b1 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 7 Mar 2018 12:07:47 -0800 Subject: [PATCH 022/274] [device]: add platform_reboot for dell s6000 (#1465) --- device/dell/x86_64-dell_s6000_s1220-r0/platform_reboot | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 device/dell/x86_64-dell_s6000_s1220-r0/platform_reboot diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/platform_reboot b/device/dell/x86_64-dell_s6000_s1220-r0/platform_reboot new file mode 100755 index 000000000000..875a52787752 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/platform_reboot @@ -0,0 +1,3 @@ +#!/bin/sh + +echo 1 > /sys/devices/platform/dell-s6000-cpld.0/power_reset From e18e15f31bd05bbf7035743ec2acf29ade4b5806 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Wed, 7 Mar 2018 15:28:14 -0800 Subject: [PATCH 023/274] [Aboot] refactor boot0.j2 for Aboot bootloader (#1445) Now properly differenciate the image installation and the kexec operations. This is useful for fast-reboot operations. Minor updates include - better command line management - using partition UUID in the command line --- files/Aboot/boot0.j2 | 211 +++++++++++++++++++++++++++++++++---------- 1 file changed, 164 insertions(+), 47 deletions(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 3f2d2cdecc3c..435781a77485 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -14,23 +14,55 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Aboot stage 0 boot +# Aboot stage 0 boot script +# +# This boot0 script can be used in different scenario +# - Installation and boot from Aboot (manual or reboot on a new image) +# - EOS to SONiC fast-reboot (installation and kexec in EOS) +# - SONiC to SONiC fast-reboot (installation and kexec in SONiC) +# +# Use it this way: +# - swipath=path/to/swi install=true boot0 +# - swipath=path/to/swi install=true force=true boot0 +# - swipath=path/to/swi kexec=true boot0 +# +# The logic defaults to the first scenario but providing extra environment variable +# will affect the behavior of the script. +# The list of variables is maintained here +# - KERNEL : relative path to the kernel to execute +# - INITRD : relative path to the initrd to load +# - CMDLINE : place to find the default kernel cmdline to use for the platform +# +# By default the boot0 script will behave for an Aboot based behavior. +# Options can be provided to only run some features of this script. +# +# Extra kernel parameters can be provided at runtime by the user by adding them +# into a kernel-params file. set -x -kernel=boot/vmlinuz-3.16.0-5-amd64 -initrd=boot/initrd.img-3.16.0-5-amd64 -kernel_params=kernel-params +image_name="image-%%IMAGE_VERSION%%" + +do_not_clean="do-not-clean" +kernel_params="kernel-params" aboot_machine="arista_unknown" -[ -z "$target_path" ] && target_path=/mnt/flash -image_path="$target_path/image-%%IMAGE_VERSION%%" -# expect the swi to be a non empty file -[ -s "$swipath" ] || exit 1 +# extract mount point from the swi path, e.g., /mnt/flash/sonic.swi --> /mnt/flash +if [ -z "$target_path" ]; then + if [ -z "$swipath" ]; then + echo "target_path= is required when swipath= is not provided" + exit 1 + fi + target_path=$(df "$swipath" | tail -1 | tr -s " " | cut -d ' ' -f6) +fi +image_path="$target_path/$image_name" -bootconfigvars="SWI SWI_COPY POST_LEVEL CONSOLESPEED PASSWORD NETDEV NETAUTO NETIP NETMASK NETGW NETDOMAIN NETDNS NETHW memtest" +cmdline_base="$target_path/kernel-params-base" +cmdline_image="$image_path/kernel-cmdline" + +bootconfigvars="KERNEL INITRD CONSOLESPEED PASSWORD NETDEV NETAUTO NETIP NETMASK NETGW NETDOMAIN NETDNS NETHW memtest" parse_environment_config() { for n in ${bootconfigvars}; do @@ -46,6 +78,8 @@ clean_flash() { for f in $(ls -A $target_path); do if [ $f != "${swipath##*/}" ] && [ $f != "boot-config" ] && + [ $f != "$kernel_params" ] && + [ $f != "$cmdline_base" ] && [ $f != "minigraph.xml" ] then rm -rf "$target_path/$f" @@ -54,7 +88,6 @@ clean_flash() { } extract_image() { - mkdir -p "$image_path" ## Unzip the image except boot0 and dockerfs archive @@ -80,7 +113,7 @@ extract_image() { fi ## use new reduced-size boot swi - echo "SWI=flash:image-%%IMAGE_VERSION%%/{{ ABOOT_BOOT_IMAGE }}" > "$target_path/boot-config" + echo "SWI=flash:$image_name/{{ ABOOT_BOOT_IMAGE }}" > "$target_path/boot-config" ## Remove installer swi as it has lots of redundunt contents rm -f "$swipath" @@ -91,8 +124,12 @@ extract_image() { write_machine_config() { ## Detect SKU and create a hardware description file - aboot_version=$(grep ^Aboot /etc/cmdline | sed 's/^.*norcal.-//') - aboot_build_date=$(stat -c %y /bin/sysinit | sed 's/ /T/') + aboot_version=$(grep ^Aboot "$cmdline_base" | sed 's/^.*norcal.-//' | tail -n 1) + if [ -x /bin/sysinit ]; then + aboot_build_date=$(stat -c %y /bin/sysinit | sed 's/ /T/') + else + aboot_build_date="unknown" + fi cat < ${target_path}/machine.conf aboot_version=$aboot_version aboot_vendor=arista @@ -101,16 +138,17 @@ aboot_machine=$aboot_machine aboot_arch=x86_64 aboot_build_date=$aboot_build_date EOF + chmod a+r "${target_path}/machine.conf" } platform_specific() { - local platform="$(grep -Eo 'platform=[^ ]+' /etc/cmdline | cut -f2 -d=)" - local sid="$(grep -Eo 'sid=[^ ]+' /etc/cmdline | cut -f2 -d=)" + local platform="$(grep -Eo 'platform=[^ ]+' "$cmdline_base" | cut -f2 -d=)" + local sid="$(grep -Eo 'sid=[^ ]+' "$cmdline_base" | cut -f2 -d=)" # set varlog size to 100MB local varlog_size=100 - local flash_size=$(($(df | grep flash | tr -s ' ' | cut -f2 -d' ') / 1000)) + local flash_size=$(($(df | grep -E '/mnt/flash|/host' | tr -s ' ' | cut -f2 -d' ') / 1000)) if [ "$platform" = "raven" ]; then aboot_machine=arista_7050_qx32 @@ -132,7 +170,12 @@ platform_specific() { flash_size=28000 fi if [ "$platform" = "rook" ]; then - readprefdl -f /tmp/.system-prefdl -d > /mnt/flash/.system-prefdl + if [ -x /bin/readprefdl ]; then + readprefdl -f /tmp/.system-prefdl -d > /mnt/flash/.system-prefdl + elif [ -f /etc/prefdl ]; then + cp /etc/prefdl /mnt/flash/.system-prefdl + chmod a+r /mnt/flash/.system-prefdl + fi fi if [ $flash_size -ge 28000 ]; then @@ -144,45 +187,119 @@ platform_specific() { echo "varlog_size=$varlog_size" >>/tmp/append } -# check the hash file in the image, and determine to install or just skip -GIT_REVISION=$(unzip -p "$swipath" .imagehash) -LOCAL_IMAGEHASH=$(cat $image_path/.imagehash 2>/dev/null || true) -if [ "$GIT_REVISION" != "$LOCAL_IMAGEHASH" ]; then - [ -z "$sonic_upgrade" ] && clean_flash - extract_image -fi +get_uuid_for() { + local dev="$1" + + if type lsblk 2>&1 > /dev/null; then + lsblk "$dev" -n --output UUID + elif type blkid 2>&1 > /dev/null; then + blkid | grep "^$dev" | sed -n "s/^.* UUID=\"//p" | grep -Eo '[^"]+' + fi +} + +write_boot_configs() { + if $in_aboot; then + # generate the default kernel parameters for the platform + echo "$append" > $cmdline_base + cat /etc/cmdline | sed "/^\(${bootconfigvars// /\|}\|crashkernel\|loglevel\|ignore_loglevel\)\(\$\|=\)/d;/^\$/d" >> $cmdline_base + parse_environment_config >> $cmdline_base + elif [ ! -f "$cmdline_base" ]; then + # some systems were started with other versions of this script and therefore + # do not have the $cmdline_base file. we assume that we are on Sonic or EOS. + cat /proc/cmdline > $cmdline_base + sed -Ei 's/^(.*) rw .*$/\1/' $cmdline_base + fi -[ -z "$sonic_upgrade" ] || exit 0 + cp $cmdline_base /tmp/append -# build the new cmdline -echo "$append" >/tmp/append -parse_environment_config >>/tmp/append -cat /etc/cmdline | sed "/^\(${bootconfigvars// /\|}\|crashkernel\|loglevel\|ignore_loglevel\)\(\$\|=\)/d;/^\$/d" >>/tmp/append + platform_specific + echo "rw loop=$image_name/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor quiet" >> /tmp/append -echo "rw loop=image-%%IMAGE_VERSION%%/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor quiet" >>/tmp/append -# process platform specific operations -platform_specific + # use extra parameters from kernel-params hook if the file exists + if [ -f "$target_path/$kernel_params" ]; then + cat "$target_path/$kernel_params" >> /tmp/append + fi + + # setting root partition if not overridden by kernel-params + if ! grep -q "root=" /tmp/append; then + rootdev="$(mount | grep -E '/mnt/flash|/host' | cut -f1 -d' ')" + rootfstype="$(mount | grep -E '/mnt/flash|/host' | cut -f5 -d' ')" + rootuuid="$(get_uuid_for $rootdev)" + if [ -z "$rootuuid" ] || [ "$rootfstype" = "vfat" ] ; then + echo "root=$rootdev" >> /tmp/append + else + echo "root=UUID=$rootuuid" >> /tmp/append + fi + fi + + mv /tmp/append $cmdline_image + [ -e ${target_path}/machine.conf ] || write_machine_config +} + +run_kexec() { + local cmdline="$(cat $cmdline_image | tr '\n' ' ')" + local kernel="${KERNEL:-$(find $image_path/boot -name 'vmlinuz-*' -type f | head -n 1)}" + local initrd="${INITRD:-$(find $image_path/boot -name 'initrd.img-*' -type f | head -n 1)}" + + kexec --load --initrd="$initrd" --append="$cmdline" "$kernel" + + [ -z "$testonly" ] || exit 0 + echo "kexecing..." + kexec --exec +} -[ -e ${taget_path}/machine.conf ] || write_machine_config +# In Aboot no option will be provided therefore these are the default values to use +in_aboot=true +do_clean=true +do_install=true +do_kexec=true -# use extra parameters from kernel-params hook if the file exists -if [ -f "$image_path/$kernel_params" ]; then - cat "$image_path/$kernel_params" >>/tmp/append +# prevent the flash from being cleaned if the do-not-clean file exists +if [ -f "$target_path/$do_not_clean" ]; then + do_clean=false fi -# setting root partition if not overridden by kernel-params -if ! grep -q "root=" /tmp/append; then - rootdev=$(mount | grep '/mnt/flash' | cut -f1 -d' ') - rootfstype=$(mount | grep '/mnt/flash' | cut -f5 -d' ') - echo "root=$rootdev" >>/tmp/append +# Parse the cmdline options (used from EOS or from SONiC) +if [ ! -z "$install" ] || [ ! -z "$sonic_upgrade" ]; then + # install from SONiC or EOS + in_aboot=false + do_clean=false + do_kexec=false +elif [ ! -z "$kexec" ]; then + # kexec from SONiC or EOS + in_aboot=false + do_install=false + do_clean=false +elif [ $# -ne 0 ]; then + echo "usage: $0 (see code)" + exit 1 +fi + +# install the image if newer +if $do_install; then + # we expect the swi to install to be a non empty file + if [ ! -s "$swipath" ]; then + echo "The swipath= environment variable does not point to a valid SWI" + exit 1 + fi + + # check the hash file in the image, and determine to install or just skip + GIT_REVISION=$(unzip -p "$swipath" .imagehash) + LOCAL_IMAGEHASH=$(cat $image_path/.imagehash 2>/dev/null || true) + + if [ "$GIT_REVISION" != "$LOCAL_IMAGEHASH" ] || [ ! -z "$force" ]; then + if $do_clean; then + clean_flash + fi + + extract_image + write_boot_configs + fi fi # chainloading using kexec -initrd_path="$image_path/$initrd" -kernel_path="$image_path/$kernel" -cmdline="$(tr '\n' ' ' Date: Wed, 7 Mar 2018 17:08:45 -0800 Subject: [PATCH 024/274] [lldpmgrd] Fix potential race condition when interfaces are created (#1469) --- .gitignore | 3 + .gitmodules | 3 - dockers/docker-lldp-sv2/lldpmgrd | 69 ++++++++++++++----- rules/lldpd.mk | 13 ++-- src/lldpd | 1 - src/lldpd/Makefile | 32 +++++++++ ...eturn-error-when-port-does-not-exist.patch | 39 +++++++++++ src/lldpd/patch/series | 2 + 8 files changed, 137 insertions(+), 25 deletions(-) delete mode 160000 src/lldpd create mode 100644 src/lldpd/Makefile create mode 100644 src/lldpd/patch/0001-return-error-when-port-does-not-exist.patch create mode 100644 src/lldpd/patch/series diff --git a/.gitignore b/.gitignore index 98ef49099546..b75083ce4d57 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,9 @@ src/libnl3/* !src/libnl3/Makefile src/libteam/* !src/libteam/Makefile +src/lldpd/* +!src/lldpd/Makefile +!src/lldpd/patch/ src/mpdecimal/* !src/mpdecimal/Makefile src/python3/* diff --git a/.gitmodules b/.gitmodules index 5517948e5f0e..e0cfc0869d05 100755 --- a/.gitmodules +++ b/.gitmodules @@ -26,9 +26,6 @@ [submodule "src/sonic-py-swsssdk"] path = src/sonic-py-swsssdk url = https://github.com/Azure/sonic-py-swsssdk.git -[submodule "src/lldpd"] - path = src/lldpd - url = https://github.com/vincentbernat/lldpd.git [submodule "src/sonic-snmpagent"] path = src/sonic-snmpagent url = https://github.com/Azure/sonic-snmpagent diff --git a/dockers/docker-lldp-sv2/lldpmgrd b/dockers/docker-lldp-sv2/lldpmgrd index dce64c10c2a3..1d13b1aaafd4 100755 --- a/dockers/docker-lldp-sv2/lldpmgrd +++ b/dockers/docker-lldp-sv2/lldpmgrd @@ -31,6 +31,12 @@ SYSLOG_IDENTIFIER = "lldpmgrd" # ========================== Syslog wrappers ========================== +def log_debug(msg): + syslog.openlog(SYSLOG_IDENTIFIER) + syslog.syslog(syslog.LOG_DEBUG, msg) + syslog.closelog() + + def log_info(msg): syslog.openlog(SYSLOG_IDENTIFIER) syslog.syslog(syslog.LOG_INFO, msg) @@ -75,25 +81,29 @@ class LldpManager(object): Attributes: state_db: Handle to Redis State database via swsscommon lib config_db: Handle to Redis Config database via swsscommon lib + pending_cmds: Dictionary where key is port name, value is pending + LLDP configuration command to run """ REDIS_HOSTNAME = "localhost" REDIS_PORT = 6379 - REDIS_TIMEOUT_USECS = 0 + REDIS_TIMEOUT_MS = 0 def __init__(self): # Open a handle to the State database self.state_db = swsscommon.DBConnector(swsscommon.STATE_DB, self.REDIS_HOSTNAME, self.REDIS_PORT, - self.REDIS_TIMEOUT_USECS) + self.REDIS_TIMEOUT_MS) # Open a handle to the Config database self.config_db = swsscommon.DBConnector(swsscommon.CONFIG_DB, self.REDIS_HOSTNAME, self.REDIS_PORT, - self.REDIS_TIMEOUT_USECS) + self.REDIS_TIMEOUT_MS) + + self.pending_cmds = {} - def update_lldp_config_for_port(self, port_name): + def generate_pending_lldp_config_cmd_for_port(self, port_name): """ For port `port_name`, look up the neighboring device's hostname and corresponding port alias in the Config database, then form the @@ -142,14 +152,34 @@ class LldpManager(object): else: log_info("Unable to retrieve neighbor information for port '{}'. Not adding port description.".format(port_name)) - log_info("Running command: '{}'".format(lldpcli_cmd)) + # Add the command to our dictionary of pending commands, overwriting any + # previous pending command for this port + self.pending_cmds[port_name] = lldpcli_cmd + + def process_pending_cmds(self): + # List of port names (keys of elements) to delete from self.pending_cmds + to_delete = [] - proc = subprocess.Popen(lldpcli_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + for (port_name, cmd) in self.pending_cmds.iteritems(): + log_debug("Running command: '{}'".format(cmd)) - (stdout, stderr) = proc.communicate() + proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - if proc.returncode != 0: - log_error("Error running command '{}': {}".format(cmd, stderr)) + (stdout, stderr) = proc.communicate() + + # If the command succeeds, add the port name to our to_delete list. + # We will delete this command from self.pending_cmds below. + # If the command fails, log a message, but don't delete the command + # from self.pending_cmds, so that the command will be retried the + # next time this method is called. + if proc.returncode == 0: + to_delete.append(port_name) + else: + log_warning("Command failed '{}': {}".format(cmd, stderr)) + + # Delete all successful commands from self.pending_cmds + for port_name in to_delete: + self.pending_cmds.pop(port_name, None) def run(self): """ @@ -157,6 +187,9 @@ class LldpManager(object): of the Redis State database. When we are notified of the creation of an interface, update LLDP configuration accordingly. """ + # Set select timeout to 10 seconds + SELECT_TIMEOUT_MS = 1000 * 10 + # Subscribe to PORT table notifications in the State DB sel = swsscommon.Select() sst = swsscommon.SubscriberStateTable(self.state_db, swsscommon.STATE_PORT_TABLE_NAME) @@ -164,16 +197,18 @@ class LldpManager(object): # Listen indefinitely for changes to the PORT table in the State DB while True: - (state, c, fd) = sel.select() - if state != swsscommon.Select.OBJECT: - log_warning("sel.select() did not return swsscommon.Select.OBJECT") - continue + (state, c, fd) = sel.select(SELECT_TIMEOUT_MS) + + if state == swsscommon.Select.OBJECT: + (key, op, fvp) = sst.pop() + + fvp_dict = dict(fvp) - (key, op, fvp) = sst.pop() - fvp_dict = dict(fvp) + if op == "SET" and fvp_dict.get("state") == "ok": + self.generate_pending_lldp_config_cmd_for_port(key) - if op == "SET" and fvp_dict.get("state") == "ok": - self.update_lldp_config_for_port(key) + # Process all pending commands + self.process_pending_cmds() # ============================= Functions ============================= diff --git a/rules/lldpd.mk b/rules/lldpd.mk index 65cfb61b3eee..10f3a200fc94 100644 --- a/rules/lldpd.mk +++ b/rules/lldpd.mk @@ -1,12 +1,17 @@ # lldpd package -LLDPD_VERSION = 0.9.5-0 +LLDPD_VERSION = 0.9.5 -LLDPD = lldpd_$(LLDPD_VERSION)_amd64.deb +LLDPD = lldpd_$(LLDPD_VERSION)-0_amd64.deb $(LLDPD)_DEPENDS += $(LIBSNMP_DEV) $(LLDPD)_RDEPENDS += $(LIBSNMP) $(LLDPD)_SRC_PATH = $(SRC_PATH)/lldpd -SONIC_DPKG_DEBS += $(LLDPD) +SONIC_MAKE_DEBS += $(LLDPD) -LIBLLDPCTL = liblldpctl-dev_$(LLDPD_VERSION)_amd64.deb +LIBLLDPCTL = liblldpctl-dev_$(LLDPD_VERSION)-0_amd64.deb $(eval $(call add_derived_package,$(LLDPD),$(LIBLLDPCTL))) + +# Export these variables so they can be used in a sub-make +export LLDPD_VERSION +export LLDPD +export LIBLLDPCTL diff --git a/src/lldpd b/src/lldpd deleted file mode 160000 index 396961a038a3..000000000000 --- a/src/lldpd +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 396961a038a38675d46f96eaa7b430b2a1f8701b diff --git a/src/lldpd/Makefile b/src/lldpd/Makefile new file mode 100644 index 000000000000..c34062505d4e --- /dev/null +++ b/src/lldpd/Makefile @@ -0,0 +1,32 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = $(LLDPD) +DERIVED_TARGETS = $(LIBLLDPCTL) + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Remove any stale files + rm -rf ./lldpd + + # Clone lldpd repo + git clone https://github.com/vincentbernat/lldpd.git + pushd ./lldpd + + # Reset HEAD to the commit of the proper tag + # NOTE: Using "git checkout " here detaches our HEAD, + # which stg doesn't like, so we use this method instead + git reset --hard $(LLDPD_VERSION) + + # Apply patches + stg init + stg import -s ../patch/series + + # Build source and Debian packages + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) + popd + + # Move the newly-built .deb packages to the destination directory + mv $* $(DERIVED_TARGETS) $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/src/lldpd/patch/0001-return-error-when-port-does-not-exist.patch b/src/lldpd/patch/0001-return-error-when-port-does-not-exist.patch new file mode 100644 index 000000000000..e17d09a386d4 --- /dev/null +++ b/src/lldpd/patch/0001-return-error-when-port-does-not-exist.patch @@ -0,0 +1,39 @@ +From 15e692fb82a61203624829cdd872315211920077 Mon Sep 17 00:00:00 2001 +From: Guohan Lu +Date: Tue, 6 Mar 2018 09:36:51 +0000 +Subject: [PATCH] return error when port does not exist + +--- + src/client/conf-lldp.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/client/conf-lldp.c b/src/client/conf-lldp.c +index c16219b..b51e4eb 100644 +--- a/src/client/conf-lldp.c ++++ b/src/client/conf-lldp.c +@@ -148,6 +148,8 @@ cmd_portid_type_local(struct lldpctl_conn_t *conn, struct writer *w, + const char *name; + const char *id = cmdenv_get(env, "port-id"); + const char *descr = cmdenv_get(env, "port-descr"); ++ const char *portname = cmdenv_get(env, "ports"); ++ int find_port = 0; + + log_debug("lldpctl", "lldp PortID TLV Subtype Local port-id '%s' port-descr '%s'", id, descr); + +@@ -165,6 +167,12 @@ cmd_portid_type_local(struct lldpctl_conn_t *conn, struct writer *w, + log_warnx("lldpctl", "unable to set LLDP Port Description for %s." + " %s", name, lldpctl_last_strerror(conn)); + } ++ find_port = 1; ++ } ++ ++ if (!find_port) { ++ log_warnx("lldpctl", "cannot find port %s", portname); ++ return 0; + } + + return 1; +-- +2.7.4 + + diff --git a/src/lldpd/patch/series b/src/lldpd/patch/series new file mode 100644 index 000000000000..8aa5ab8d8f3f --- /dev/null +++ b/src/lldpd/patch/series @@ -0,0 +1,2 @@ +# This series applies on GIT commit 396961a038a38675d46f96eaa7b430b2a1f8701b +0001-return-error-when-port-does-not-exist.patch From e4a02cbf65f4990cfc7e4674b0fe0e67589af797 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 8 Mar 2018 10:36:39 -0800 Subject: [PATCH 025/274] [SAI] upgrade to Broadcom SAI 3.1.3.4-4 (#1475) --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 9616f405dc5c..e8b627f6f112 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.4-3_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-3_amd64.deb?sv=2015-04-05&sr=b&sig=B3xLAq0vI8k0HLt740baKtMxgaAQUkenS63erudlzAU%3D&se=2031-11-09T22%3A35%3A16Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.4-4_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-4_amd64.deb?sv=2015-04-05&sr=b&sig=hSWtsH1f5FIV7rk4%2FJA99S%2B7HoJ%2BSvHN8fPXZNnO6mI%3D&se=2031-11-15T03%3A11%3A01Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-3_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-4_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-3_amd64.deb?sv=2015-04-05&sr=b&sig=iIVQQNj5gYGlDr8zP9YQXSaHs0o0NziijMDRFyKMfW8%3D&se=2031-11-09T22%3A34%3A14Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-4_amd64.deb?sv=2015-04-05&sr=b&sig=nEo71IhiVDrk2ydJf3ejyZvQ5QES%2BxjWdQ5SEOOyaic%3D&se=2031-11-15T03%3A10%3A12Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From 2d4c8a2ae6e8acb005685a0e8a6fa468aef8cb3d Mon Sep 17 00:00:00 2001 From: wadelnn Date: Fri, 9 Mar 2018 03:49:17 +0800 Subject: [PATCH 026/274] [Platform] Update switch config files for Ingrasys platforms. (#1474) * Add psuutil for S8900-54XC and S8900-64XC. * Update syseeprom to CPU EEPROM for S9130-32X, S9200-64X and S9230-64X. * Update sensors.conf for S9200-64X and S9230-64X. * Update submodule for platform/broadcom/sonic-platform-modules-ingrasys Signed-off-by: Wade He --- .../plugins/psuutil.py | 92 +++++++++++++++++++ .../plugins/psuutil.py | 92 +++++++++++++++++++ .../plugins/eeprom.py | 2 +- .../plugins/eeprom.py | 2 +- .../x86_64-ingrasys_s9200_64x-r0/sensors.conf | 2 + .../plugins/eeprom.py | 2 +- .../x86_64-ingrasys_s9230_64x-r0/sensors.conf | 11 +-- .../broadcom/sonic-platform-modules-ingrasys | 2 +- 8 files changed, 192 insertions(+), 13 deletions(-) create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/psuutil.py create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/psuutil.py diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/psuutil.py b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/psuutil.py new file mode 100644 index 000000000000..4f226c69fff3 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/psuutil.py @@ -0,0 +1,92 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + PSU_CPLD_DIR = "/sys/bus/i2c/devices/0-0033" + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + mask = [ 0x08, 0x10 ] + attr_file = 'cpld_pw_good' + attr_path = self.PSU_CPLD_DIR +'/'+ attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU status + if (attr_value & mask[index-1]): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + mask = [ 0x01, 0x02 ] + attr_file ='cpld_pw_abs' + attr_path = self.PSU_CPLD_DIR +'/'+ attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU presence + if (~attr_value & mask[index-1]): + status = 1 + + return status + diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/psuutil.py b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/psuutil.py new file mode 100644 index 000000000000..3af5423daebd --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/psuutil.py @@ -0,0 +1,92 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + PSU_CPLD_DIR = "/sys/bus/i2c/devices/0-0033" + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + mask = [ 0x04, 0x08 ] + attr_file = 'cpld_pw_good' + attr_path = self.PSU_CPLD_DIR +'/'+ attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU status + if (attr_value & mask[index-1]): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + mask = [ 0x01, 0x02 ] + attr_file ='cpld_pw_abs' + attr_path = self.PSU_CPLD_DIR +'/'+ attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU presence + if (~attr_value & mask[index-1]): + status = 1 + + return status + diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/eeprom.py b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/eeprom.py index 0f47704ed2cb..71ce941f1abb 100644 --- a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/eeprom.py +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/eeprom.py @@ -18,5 +18,5 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): def __init__(self, name, path, cpld_root, ro): - self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0055/eeprom" + self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0051/eeprom" super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/eeprom.py b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/eeprom.py index 3d01608ef7b2..64ddb99554b0 100644 --- a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/eeprom.py +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/eeprom.py @@ -19,6 +19,6 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): def __init__(self, name, path, cpld_root, ro): i2c_bus = "0" - i2c_addr = "0055" + i2c_addr = "0051" self.eeprom_path = "/sys/class/i2c-adapter/i2c-" + i2c_bus + "/" + i2c_bus + "-" + i2c_addr + "/eeprom" super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/sensors.conf index 065c1ebddf36..361a8b732643 100644 --- a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/sensors.conf +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/sensors.conf @@ -48,6 +48,8 @@ chip "w83795adg-*" ignore temp2 ignore temp3 ignore temp4 + ignore temp5 + ignore temp6 ignore intrusion0 chip "tmp75-i2c-*-4A" diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/eeprom.py b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/eeprom.py index ab398102c9b5..770b0cf43baf 100644 --- a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/eeprom.py +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/eeprom.py @@ -18,5 +18,5 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): def __init__(self, name, path, cpld_root, ro): - self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0055/eeprom" + self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0051/eeprom" super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/sensors.conf index b5daa9af42b7..84abfe88062b 100644 --- a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/sensors.conf +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/sensors.conf @@ -36,16 +36,12 @@ chip "w83795adg-*" ignore in18 ignore in19 label fan1 "FANTRAY 1" - #label fan2 "FANTRAY 1-B" ignore fan2 label fan3 "FANTRAY 2" - #label fan4 "FANTRAY 2-B" ignore fan4 label fan5 "FANTRAY 3" - #label fan6 "FANTRAY 3-B" ignore fan6 label fan7 "FANTRAY 4" - #label fan8 "FANTRAY 4-B" ignore fan8 ignore temp1 ignore temp2 @@ -55,15 +51,14 @@ chip "w83795adg-*" ignore temp6 ignore intrusion0 -# TODO: need to confirm the critial temp value with HW after board ready chip "tmp75-i2c-*-4A" - label temp1 "BMC board Temp" + label temp1 "BMC Board Temp" set temp1_max 50 set temp1_max_hyst 45 bus "i2c-0" "SMBus I801 adapter at f000" chip "tmp75-i2c-*-4F" - label temp1 "x86 CPU board Temp" + label temp1 "x86 CPU Board Temp" set temp1_max 50 set temp1_max_hyst 45 @@ -86,5 +81,3 @@ chip "lm75-i2c-7-4E" label temp1 "Front MAC Temp" set temp1_max 50 set temp1_max_hyst 45 - - diff --git a/platform/broadcom/sonic-platform-modules-ingrasys b/platform/broadcom/sonic-platform-modules-ingrasys index f2dc0aa6b96a..f6e0fa9860c6 160000 --- a/platform/broadcom/sonic-platform-modules-ingrasys +++ b/platform/broadcom/sonic-platform-modules-ingrasys @@ -1 +1 @@ -Subproject commit f2dc0aa6b96ab293b4ae6ebf3a942851dd9324b7 +Subproject commit f6e0fa9860c6d1bd9274b091147d4fc06a0597c3 From 02b62ac9bbf897c51a2f80fe2ea316bc865ebc05 Mon Sep 17 00:00:00 2001 From: padmanarayana Date: Fri, 9 Mar 2018 06:12:41 +0530 Subject: [PATCH 027/274] [fast-reboot]: Support OS9 -> SONiC fast-reboot migration (#1414) * Support OS9 -> SONiC fast-reboot migration * Address review comments. Update NOS mac in EEPROM and net.rules for eth0 * Address review comments. Update sonic-platform-modules-dell to fac81d... * Fix script for POSIX compliance --- build_debian.sh | 6 +- files/image_config/platform/rc.local | 134 ++++++++++++++++-- files/initramfs-tools/mgmt-intf-dhcp | 36 +++++ platform/broadcom/sonic-platform-modules-dell | 2 +- 4 files changed, 168 insertions(+), 10 deletions(-) create mode 100644 files/initramfs-tools/mgmt-intf-dhcp diff --git a/build_debian.sh b/build_debian.sh index 033ac6ff270f..bc04a71800ce 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -144,6 +144,9 @@ sudo cp files/initramfs-tools/union-mount $FILESYSTEM_ROOT/etc/initramfs-tools/s sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/union-mount sudo cp files/initramfs-tools/varlog $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/varlog sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/varlog +# Management interface (eth0) dhcp can be optionally turned off (during a migration from another NOS to SONiC) +sudo cp files/initramfs-tools/mgmt-intf-dhcp $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp +sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp sudo cp files/initramfs-tools/union-fsck $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/union-fsck sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/union-fsck sudo chroot $FILESYSTEM_ROOT update-initramfs -u @@ -221,7 +224,8 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in unzip \ gdisk \ sysfsutils \ - grub2-common + grub2-common \ + ethtool sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y download \ grub-pc-bin diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index aa44cadf52bc..c5bfae19f9b8 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -11,16 +11,92 @@ # # By default this script does nothing. +# In case the unit is migrating from another NOS, save the logs +log_migration() { + echo $1 >> /host/migration/migration.log +} + +# Import files from another NOS's partition onto SONiC +nos_migration_import() { + [ -f $1 ] && cp $1 $2 || log_migration "ERROR: $1 not found!" +} + +# While migrating form another NOS, we need to preserve the MAC addresses +# of eth0 (and eventually switchports). +# Update the eth0 mac and also the EEPROM using ethtool so that subsequent +# reboots use the NOS's mac. +# Input : mgmt_interface.cfg file imported from the previous NOS. +update_mgmt_interface_macaddr() { + mgmt_config=$1 + if [ ! -f "$mgmt_config" ]; then + log_migration "ERROR : unable update eth0 MAC : $mgmt_config not found!" + return + fi + + # Save the previous NOS's mac + old_mac=`ip link show eth0 | grep ether | awk '{print $2}'` + [ -z "$old_mac" ] && log_migration "Unable to retrieve old mac address !" && return + + # Extract, validate and set the eth0's mac address for the current session + new_mac=$(grep "macaddr" $mgmt_config | awk -F'=' '{print $2}') + log_migration "Setting eth0 mac as $new_mac." + if [ `echo $new_mac | egrep "^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$"` ]; then + ip link set eth0 down + ip link set eth0 address $new_mac + ip link set eth0 up + else + log_migration "ERROR: mac imported from NOS is invalid : $new_mac !" + return + fi + + # Get the ethtool magic and offset for changing the mac address in the EEPROM + ethtool_magic=$(grep "ethtool_magic" $mgmt_config | awk -F'=' '{print $2}') + ethtool_offset=$(grep "ethtool_offset" $mgmt_config | awk -F'=' '{print $2}') + if [ -z "$ethtool_magic" ] || [ -z "$ethtool_offset" ]; then + log_migration "Unable to retrieve ethtool params ($ethtool_magic,$ethtool_offset)" + return + fi + + log_migration "eth0 mac in EEPROM before update:" + ethtool -e eth0 offset $ethtool_offset length 6 >> /host/migration/migration.log + + # Update the mac address in the EEPROM for subsequent reboots + # Write only changed octets + for i in 1 2 3 4 5 6; do + offset=$(($ethtool_offset+$i-1)) + old_mac_octet="$(echo $old_mac | cut -d":" -f$i)" + new_mac_octet="$(echo $new_mac | cut -d":" -f$i)" + + if [ "$old_mac_octet" != "$new_mac_octet" ]; then + ethtool -E eth0 magic $ethtool_magic offset $offset value 0x$new_mac_octet + if [ $? != 0 ]; then + log_migration "ERROR: unable to update eth0 EEPROM!" + log_migration "index $i, magic $ethtool_magic offset $offset, value $new_mac_octet" + return + fi + fi + done + + log_migration "eth0 mac in EEPROM after update:" + ethtool -e eth0 offset $ethtool_offset length 6 >> /host/migration/migration.log + + # Update the 70-persistent-net.rules with the new mac for eth0 + log_migration "/etc/udev/rules.d/70-persistent-net.rules : replacing $old_mac with $new_mac for eth0" + sed -i "/eth0/ s/ATTR{address}==\"$old_mac\"/ATTR{address}==\"$new_mac\"/g" /etc/udev/rules.d/70-persistent-net.rules +} + # If the machine.conf is absent, it indicates that the unit booted # into SONiC from another NOS. Extract the machine.conf from ONIE. if [ ! -e /host/machine.conf ]; then + mkdir -p /host/migration + onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//') mkdir -p /mnt/onie-boot mount $onie_dev /mnt/onie-boot onie_grub_cfg=/mnt/onie-boot/onie/grub/grub-machine.cfg if [ ! -e $onie_grub_cfg ]; then - echo "$onie_grub_cfg not found" >> /etc/migration.log + log_migration "$onie_grub_cfg not found" else . ./$onie_grub_cfg grep = $onie_grub_cfg | sed -e 's/onie_//' -e 's/=.*$//' | while read var ; do @@ -29,6 +105,44 @@ if [ ! -e /host/machine.conf ]; then done fi + # Extract the previous NOS's partition that contains the migration artifacts + set -- $(cat /proc/cmdline) + for x in "$@"; do + case "$x" in + nos-config-part=*) + nos_val="${x#nos-config-part=}" + ;; + esac + done + + if [ -n "$nos_val" ]; then + nos_dev=$(findfs $nos_val) + if [ $? != 0 ]; then + log_migration "ERROR: nos_dev not found. Check grub parameters" + fi + else + log_migration "ERROR: nos_val not found. Check grub parameters" + fi + + if [ -n "$nos_dev" ]; then + # Mount the previous NOS's partition + mkdir -p /mnt/nos_migration + mount $nos_dev /mnt/nos_migration + mkdir -p /host/fast-reboot + + # Copy relevant files + nos_migration_import /mnt/nos_migration/mgmt_interface.cfg /host/migration + nos_migration_import /mnt/nos_migration/minigraph.xml /host/migration + nos_migration_import /mnt/nos_migration/arp.json /host/fast-reboot + nos_migration_import /mnt/nos_migration/fdb.json /host/fast-reboot + nos_migration_import /mnt/nos_migration/default_routes.json /host/fast-reboot + + umount /mnt/nos_migration + rmdir /mnt/nos_migration + fi + + update_mgmt_interface_macaddr /host/migration/mgmt_interface.cfg + migration="TRUE" umount /mnt/onie-boot fi @@ -96,6 +210,10 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then # Combine information in minigraph and init_cfg.json to form initiate config DB dump file. # TODO: After moving all information from minigraph to DB, sample config DB dump should be provide sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json + elif [ -n "$migration" ] && [ -f /host/migration/minigraph.xml ]; then + # Use the minigraph that was imported from the NOS + mv /host/migration/minigraph.xml /etc/sonic/ + sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json else # Use default minigraph.xml cp /usr/share/sonic/device/$platform/minigraph.xml /etc/sonic/ @@ -127,26 +245,26 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then grub_bin=$(ls /host/image-$sonic_version/platform/x86_64-grub/grub-pc-bin*.deb 2> /dev/null) if [ -z "$grub_bin" ]; then - echo "Unable to locate grub package !" >> /etc/migration.log + log_migration "Unable to locate grub package !" firsttime_exit fi dpkg -i $grub_bin > /dev/null 2>&1 if [ $? != 0 ]; then - echo "Unable to install grub package !" >> /etc/migration.log + log_migration "Unable to install grub package !" firsttime_exit fi # Determine the block device to install grub sonic_dev=$(blkid | grep SONiC-OS | head -n 1 | awk '{print $1}' | sed -e 's/[0-9]:.*$//') if [ -z "$sonic_dev" ]; then - echo "Unable to determine sonic partition !" >> /etc/migration.log + log_migration "Unable to determine sonic partition !" firsttime_exit fi grub-install --boot-directory=/host --recheck $sonic_dev 2>/dev/null if [ $? != 0 ]; then - echo "grub install failed !" >> /etc/migration.log + log_migration "grub install failed !" firsttime_exit fi @@ -163,7 +281,7 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then if [ ! -z "$console_port" ] && [ "$console_port" != "$CONSOLE_PORT" ]; then sed -i -e "s/\-\-port=$console_port/\-\-port=$CONSOLE_PORT/g" /host/grub.cfg fi - echo "grub.cfg console port=$console_port & installer.conf CONSOLE_PORT=$CONSOLE_PORT" >> /etc/migration.log + log_migration "grub.cfg console port=$console_port & installer.conf CONSOLE_PORT=$CONSOLE_PORT" fi if [ ! -z "$CONSOLE_DEV" ]; then @@ -175,7 +293,7 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then if [ "$console_dev" != "$CONSOLE_DEV" ]; then sed -i -e "s/console=ttyS$console_dev/console=ttyS$CONSOLE_DEV/g" /host/grub.cfg fi - echo "grub.cfg console dev=$console_dev & installer.conf CONSOLE_DEV=$CONSOLE_DEV" >> /etc/migration.log + log_migration "grub.cfg console dev=$console_dev & installer.conf CONSOLE_DEV=$CONSOLE_DEV" fi if [ ! -z "$VAR_LOG_SIZE" ]; then @@ -186,7 +304,7 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then if [ ! -z "$var_log_size" ] && [ "$var_log_size" != "$VAR_LOG_SIZE" ]; then sed -i -e "s/var_log_size=$var_log_size/var_log_size=$VAR_LOG_SIZE/g" /host/grub.cfg fi - echo "grub.cfg var_log_size=$var_log_size & installer.conf VAR_LOG_SIZE=$VAR_LOG_SIZE" >> /etc/migration.log + log_migration "grub.cfg var_log_size=$var_log_size & installer.conf VAR_LOG_SIZE=$VAR_LOG_SIZE" fi # Set the root based on the label diff --git a/files/initramfs-tools/mgmt-intf-dhcp b/files/initramfs-tools/mgmt-intf-dhcp new file mode 100644 index 000000000000..52f7ff5f495c --- /dev/null +++ b/files/initramfs-tools/mgmt-intf-dhcp @@ -0,0 +1,36 @@ +#!/bin/sh + +PREREQS="union-mount" + +prereqs() { echo "$PREREQS"; } + +case $1 in + prereqs) + prereqs + exit 0 + ;; +esac + +# Extract kernel parameters +set -- $(cat /proc/cmdline) +for x in "$@"; do + case "$x" in + mgmt-intf-dhcp=*) + val="${x#mgmt-intf-dhcp=}" + + if [ -z "$val" ]; then + echo "ERROR: mgmt-intf-dhcp value (on/off) not specified !" + exit 0 + fi + + if [ -e "${rootmnt}/etc/network/interfaces" ]; then + if [ "$val" = "off" ]; then + sed -i 's/iface eth0 inet dhcp/iface eth0 inet static/g' ${rootmnt}/etc/network/interfaces + elif [ "$val" = "on" ]; then + sed -i 's/iface eth0 inet static/iface eth0 inet dhcp/g' ${rootmnt}/etc/network/interfaces + fi + fi + + ;; + esac +done diff --git a/platform/broadcom/sonic-platform-modules-dell b/platform/broadcom/sonic-platform-modules-dell index d2f58195831e..fac81d02276d 160000 --- a/platform/broadcom/sonic-platform-modules-dell +++ b/platform/broadcom/sonic-platform-modules-dell @@ -1 +1 @@ -Subproject commit d2f58195831e6e7016992ef449778f3474e60e95 +Subproject commit fac81d02276d7245233c0401ac699029b0b41cdd From 41418723a3f8a4d72f627a59c2131958d367199a Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 9 Mar 2018 11:32:03 -0800 Subject: [PATCH 028/274] [isc-dhcp] Add patch to fix bug which caused log messages to also print to stderr in release builds (#1477) --- ...nt-log-messages-to-stderr-in-release.patch | 28 +++++++++++++++++++ src/isc-dhcp/patch/series | 1 + 2 files changed, 29 insertions(+) create mode 100644 src/isc-dhcp/patch/0004-Bugfix-Don-t-print-log-messages-to-stderr-in-release.patch diff --git a/src/isc-dhcp/patch/0004-Bugfix-Don-t-print-log-messages-to-stderr-in-release.patch b/src/isc-dhcp/patch/0004-Bugfix-Don-t-print-log-messages-to-stderr-in-release.patch new file mode 100644 index 000000000000..428f4471a1f7 --- /dev/null +++ b/src/isc-dhcp/patch/0004-Bugfix-Don-t-print-log-messages-to-stderr-in-release.patch @@ -0,0 +1,28 @@ +From 2bb21fcf4a9ad7535867809c50d2cf0ba1088e17 Mon Sep 17 00:00:00 2001 +From: Joe LeVeque +Date: Fri, 9 Mar 2018 01:43:35 +0000 +Subject: [PATCH] [Bugfix] Don't print log messages to stderr in release builds + +--- + omapip/errwarn.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/omapip/errwarn.c b/omapip/errwarn.c +index 7c91d9d..aa74fd8 100644 +--- a/omapip/errwarn.c ++++ b/omapip/errwarn.c +@@ -39,9 +39,9 @@ + #include + + #ifdef DEBUG +-int log_perror = -1; +-#else + int log_perror = 1; ++#else ++int log_perror = 0; + #endif + void (*log_cleanup) (void); + +-- +2.1.4 + diff --git a/src/isc-dhcp/patch/series b/src/isc-dhcp/patch/series index a896563077c2..17e5e152483b 100644 --- a/src/isc-dhcp/patch/series +++ b/src/isc-dhcp/patch/series @@ -2,3 +2,4 @@ 0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch 0002-Support-for-obtaining-name-of-physical-interface-tha.patch 0003-Support-for-loading-port-alias-map-file-to-replace-p.patch +0004-Bugfix-Don-t-print-log-messages-to-stderr-in-release.patch From 16f81afe9a952cc497ac84c52a385447a62acde0 Mon Sep 17 00:00:00 2001 From: jostar-yang Date: Sat, 10 Mar 2018 07:47:10 +0800 Subject: [PATCH 029/274] [devices]: Add as7716-32xb device code (#1472) * Add as7716-32xb device code * Add as7716-32xb drv code --- .../Accton-AS7716-32XB/port_config.ini | 33 + .../Accton-AS7716-32XB/sai.profile | 1 + .../installer.conf | 3 + .../led_proc_init.soc | 41 + .../minigraph.xml | 1074 +++++++++++++++++ .../plugins/eeprom.py | 24 + .../plugins/psuutil.py | 61 + .../plugins/sfputil.py | 138 +++ .../broadcom/sonic-platform-modules-accton | 2 +- 9 files changed, 1376 insertions(+), 1 deletion(-) create mode 100755 device/accton/x86_64-accton_as7716_32xb-r0/Accton-AS7716-32XB/port_config.ini create mode 100755 device/accton/x86_64-accton_as7716_32xb-r0/Accton-AS7716-32XB/sai.profile create mode 100755 device/accton/x86_64-accton_as7716_32xb-r0/installer.conf create mode 100755 device/accton/x86_64-accton_as7716_32xb-r0/led_proc_init.soc create mode 100755 device/accton/x86_64-accton_as7716_32xb-r0/minigraph.xml create mode 100755 device/accton/x86_64-accton_as7716_32xb-r0/plugins/eeprom.py create mode 100755 device/accton/x86_64-accton_as7716_32xb-r0/plugins/psuutil.py create mode 100755 device/accton/x86_64-accton_as7716_32xb-r0/plugins/sfputil.py diff --git a/device/accton/x86_64-accton_as7716_32xb-r0/Accton-AS7716-32XB/port_config.ini b/device/accton/x86_64-accton_as7716_32xb-r0/Accton-AS7716-32XB/port_config.ini new file mode 100755 index 000000000000..1fa6d21d9609 --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32xb-r0/Accton-AS7716-32XB/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 49,50,51,52 hundredGigE1 +Ethernet4 53,54,55,56 hundredGigE2 +Ethernet8 57,58,59,60 hundredGigE3 +Ethernet12 61,62,63,64 hundredGigE4 +Ethernet16 65,66,67,68 hundredGigE5 +Ethernet20 69,70,71,72 hundredGigE6 +Ethernet24 73,74,75,76 hundredGigE7 +Ethernet28 77,78,79,80 hundredGigE8 +Ethernet32 33,34,35,36 hundredGigE9 +Ethernet36 37,38,39,40 hundredGigE10 +Ethernet40 41,42,43,44 hundredGigE11 +Ethernet44 45,46,47,48 hundredGigE12 +Ethernet48 81,82,83,84 hundredGigE13 +Ethernet52 85,86,87,88 hundredGigE14 +Ethernet56 89,90,91,92 hundredGigE15 +Ethernet60 93,94,95,96 hundredGigE16 +Ethernet64 97,98,99,100 hundredGigE17 +Ethernet68 101,102,103,104 hundredGigE18 +Ethernet72 105,106,107,108 hundredGigE19 +Ethernet76 109,110,111,112 hundredGigE20 +Ethernet80 17,18,19,20 hundredGigE21 +Ethernet84 21,22,23,24 hundredGigE22 +Ethernet88 25,26,27,28 hundredGigE23 +Ethernet92 29,30,31,32 hundredGigE24 +Ethernet96 113,114,115,116 hundredGigE25 +Ethernet100 117,118,119,120 hundredGigE26 +Ethernet104 121,122,123,124 hundredGigE27 +Ethernet108 125,126,127,128 hundredGigE28 +Ethernet112 1,2,3,4 hundredGigE29 +Ethernet116 5,6,7,8 hundredGigE30 +Ethernet120 9,10,11,12 hundredGigE31 +Ethernet124 13,14,15,16 hundredGigE32 diff --git a/device/accton/x86_64-accton_as7716_32xb-r0/Accton-AS7716-32XB/sai.profile b/device/accton/x86_64-accton_as7716_32xb-r0/Accton-AS7716-32XB/sai.profile new file mode 100755 index 000000000000..de1e16b49544 --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32xb-r0/Accton-AS7716-32XB/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-as7716-32x100G.config.bcm diff --git a/device/accton/x86_64-accton_as7716_32xb-r0/installer.conf b/device/accton/x86_64-accton_as7716_32xb-r0/installer.conf new file mode 100755 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32xb-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/accton/x86_64-accton_as7716_32xb-r0/led_proc_init.soc b/device/accton/x86_64-accton_as7716_32xb-r0/led_proc_init.soc new file mode 100755 index 000000000000..719cb777719f --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32xb-r0/led_proc_init.soc @@ -0,0 +1,41 @@ +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=31 REMAP_PORT_1=30 REMAP_PORT_2=29 REMAP_PORT_3=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=27 REMAP_PORT_5=26 REMAP_PORT_6=25 REMAP_PORT_7=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=23 REMAP_PORT_9=22 REMAP_PORT_10=21 REMAP_PORT_11=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=19 REMAP_PORT_13=18 REMAP_PORT_14=17 REMAP_PORT_15=16 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=63 REMAP_PORT_17=62 REMAP_PORT_18=61 REMAP_PORT_19=60 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=59 REMAP_PORT_21=58 REMAP_PORT_22=57 REMAP_PORT_23=56 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=55 REMAP_PORT_25=54 REMAP_PORT_26=53 REMAP_PORT_27=52 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=51 REMAP_PORT_29=50 REMAP_PORT_30=49 REMAP_PORT_31=48 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=47 REMAP_PORT_33=46 REMAP_PORT_34=45 REMAP_PORT_35=44 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=43 REMAP_PORT_37=42 REMAP_PORT_38=41 REMAP_PORT_39=40 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=39 REMAP_PORT_41=38 REMAP_PORT_42=37 REMAP_PORT_43=36 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=35 REMAP_PORT_45=34 REMAP_PORT_46=33 REMAP_PORT_47=32 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=15 REMAP_PORT_49=14 REMAP_PORT_50=13 REMAP_PORT_51=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 REMAP_PORT_53=10 REMAP_PORT_54=9 REMAP_PORT_55=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 REMAP_PORT_57=6 REMAP_PORT_58=5 REMAP_PORT_59=4 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 REMAP_PORT_61=2 REMAP_PORT_62=1 REMAP_PORT_63=0 + +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=35 REMAP_PORT_1=34 REMAP_PORT_2=33 REMAP_PORT_3=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=39 REMAP_PORT_5=38 REMAP_PORT_6=37 REMAP_PORT_7=36 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=43 REMAP_PORT_9=42 REMAP_PORT_10=41 REMAP_PORT_11=40 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=47 REMAP_PORT_13=46 REMAP_PORT_14=45 REMAP_PORT_15=44 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=3 REMAP_PORT_17=2 REMAP_PORT_18=1 REMAP_PORT_19=0 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=7 REMAP_PORT_21=6 REMAP_PORT_22=5 REMAP_PORT_23=4 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=11 REMAP_PORT_25=10 REMAP_PORT_26=9 REMAP_PORT_27=8 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=15 REMAP_PORT_29=14 REMAP_PORT_30=13 REMAP_PORT_31=12 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=19 REMAP_PORT_33=18 REMAP_PORT_34=17 REMAP_PORT_35=16 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=23 REMAP_PORT_37=22 REMAP_PORT_38=21 REMAP_PORT_39=20 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=27 REMAP_PORT_41=26 REMAP_PORT_42=25 REMAP_PORT_43=24 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=31 REMAP_PORT_45=30 REMAP_PORT_46=29 REMAP_PORT_47=28 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=51 REMAP_PORT_49=50 REMAP_PORT_50=49 REMAP_PORT_51=48 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=55 REMAP_PORT_53=54 REMAP_PORT_54=53 REMAP_PORT_55=52 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=59 REMAP_PORT_57=58 REMAP_PORT_58=57 REMAP_PORT_59=56 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=63 REMAP_PORT_61=62 REMAP_PORT_62=61 REMAP_PORT_63=60 + +led 0 prog 02 FD 42 80 02 FF 42 00 02 FE 42 00 02 FA 42 E0 02 FB 42 40 06 F9 D2 00 74 1E 02 F9 42 03 67 AC 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 86 FE 06 FB D6 FE 74 1E 86 FC 3E FA 06 FE 88 4A 03 71 4C 67 84 57 67 84 57 67 98 57 06 FE 88 80 4A 00 27 97 75 4F 90 4A 00 27 4A 01 27 B7 97 71 69 77 42 06 F9 D6 FC 74 7C 02 F9 4A 07 37 4E 07 02 FC 42 00 4E 07 06 F9 0A 07 71 4F 77 42 16 FF 06 FD 17 4D DA 07 74 95 12 FF 52 00 86 FD 57 86 FF 57 16 FF 06 FD 07 4D DA 07 74 A9 12 FF 52 00 86 FD 57 86 FF 57 06 FE C2 FC 98 98 12 F4 50 C2 FC 98 98 F2 F0 14 06 F4 C2 03 88 77 D1 06 FE C2 FC 98 98 F2 E0 14 06 FE C2 03 88 18 71 E2 80 18 71 DD 67 98 67 98 57 67 84 67 98 57 80 18 71 EB 67 98 67 84 57 67 84 67 84 57 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +led 0 start + +led 1 prog 02 FD 42 80 02 FF 42 00 02 FE 42 00 02 FA 42 E0 02 FB 42 40 06 F9 D2 00 74 1E 02 F9 42 03 67 AC 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 86 FE 06 FB D6 FE 74 1E 86 FC 3E FA 06 FE 88 4A 03 71 4C 67 84 57 67 84 57 67 98 57 06 FE 88 80 4A 00 27 97 75 4F 90 4A 00 27 4A 01 27 B7 97 71 69 77 42 06 F9 D6 FC 74 7C 02 F9 4A 07 37 4E 07 02 FC 42 00 4E 07 06 F9 0A 07 71 4F 77 42 16 FF 06 FD 17 4D DA 07 74 95 12 FF 52 00 86 FD 57 86 FF 57 16 FF 06 FD 07 4D DA 07 74 A9 12 FF 52 00 86 FD 57 86 FF 57 06 FE C2 FC 98 98 12 F4 50 C2 FC 98 98 F2 F0 14 06 F4 C2 03 88 77 D1 06 FE C2 FC 98 98 F2 E0 14 06 FE C2 03 88 18 71 E2 80 18 71 DD 67 98 67 98 57 67 84 67 98 57 80 18 71 EB 67 98 67 84 57 67 84 67 84 57 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +led 1 start + +led auto on \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7716_32xb-r0/minigraph.xml b/device/accton/x86_64-accton_as7716_32xb-r0/minigraph.xml new file mode 100755 index 000000000000..5cefa847181c --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32xb-r0/minigraph.xml @@ -0,0 +1,1074 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + sonic + 10.0.0.32 + 1 + 180 + 60 + + + sonic + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + sonic + 10.0.0.34 + 1 + 180 + 60 + + + sonic + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + sonic + 10.0.0.36 + 1 + 180 + 60 + + + sonic + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + sonic + 10.0.0.38 + 1 + 180 + 60 + + + sonic + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + sonic + 10.0.0.40 + 1 + 180 + 60 + + + sonic + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + sonic + 10.0.0.42 + 1 + 180 + 60 + + + sonic + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + sonic + 10.0.0.44 + 1 + 180 + 60 + + + sonic + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + sonic + 10.0.0.46 + 1 + 180 + 60 + + + sonic + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + sonic + 10.0.0.48 + 1 + 180 + 60 + + + sonic + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + sonic + 10.0.0.50 + 1 + 180 + 60 + + + sonic + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + sonic + 10.0.0.52 + 1 + 180 + 60 + + + sonic + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + sonic + 10.0.0.54 + 1 + 180 + 60 + + + sonic + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + sonic + 10.0.0.56 + 1 + 180 + 60 + + + sonic + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + sonic + 10.0.0.58 + 1 + 180 + 60 + + + sonic + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + sonic + 10.0.0.60 + 1 + 180 + 60 + + + sonic + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + sonic + 10.0.0.62 + 1 + 180 + 60 + + + sonic + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + sonic + + +
10.0.0.33
+ + +
+ +
10.0.0.1
+ + +
+ +
10.0.0.35
+ + +
+ +
10.0.0.3
+ + +
+ +
10.0.0.37
+ + +
+ +
10.0.0.5
+ + +
+ +
10.0.0.39
+ + +
+ +
10.0.0.7
+ + +
+ +
10.0.0.41
+ + +
+ +
10.0.0.9
+ + +
+ +
10.0.0.43
+ + +
+ +
10.0.0.11
+ + +
+ +
10.0.0.45
+ + +
+ +
10.0.0.13
+ + +
+ +
10.0.0.47
+ + +
+ +
10.0.0.15
+ + +
+ +
10.0.0.49
+ + +
+ +
10.0.0.17
+ + +
+ +
10.0.0.51
+ + +
+ +
10.0.0.19
+ + +
+ +
10.0.0.53
+ + +
+ +
10.0.0.21
+ + +
+ +
10.0.0.55
+ + +
+ +
10.0.0.23
+ + +
+ +
10.0.0.57
+ + +
+ +
10.0.0.25
+ + +
+ +
10.0.0.59
+ + +
+ +
10.0.0.27
+ + +
+ +
10.0.0.61
+ + +
+ +
10.0.0.29
+ + +
+ +
10.0.0.63
+ + +
+ +
10.0.0.31
+ + +
+
+ +
+ + 64001 + ARISTA01T0 + + + + 65200 + ARISTA01T2 + + + + 64002 + ARISTA02T0 + + + + 65200 + ARISTA02T2 + + + + 64003 + ARISTA03T0 + + + + 65200 + ARISTA03T2 + + + + 64004 + ARISTA04T0 + + + + 65200 + ARISTA04T2 + + + + 64005 + ARISTA05T0 + + + + 65200 + ARISTA05T2 + + + + 64006 + ARISTA06T0 + + + + 65200 + ARISTA06T2 + + + + 64007 + ARISTA07T0 + + + + 65200 + ARISTA07T2 + + + + 64008 + ARISTA08T0 + + + + 65200 + ARISTA08T2 + + + + 64009 + ARISTA09T0 + + + + 65200 + ARISTA09T2 + + + + 64010 + ARISTA10T0 + + + + 65200 + ARISTA10T2 + + + + 64011 + ARISTA11T0 + + + + 65200 + ARISTA11T2 + + + + 64012 + ARISTA12T0 + + + + 65200 + ARISTA12T2 + + + + 64013 + ARISTA13T0 + + + + 65200 + ARISTA13T2 + + + + 64014 + ARISTA14T0 + + + + 65200 + ARISTA14T2 + + + + 64015 + ARISTA15T0 + + + + 65200 + ARISTA15T2 + + + + 64016 + ARISTA16T0 + + + + 65200 + ARISTA16T2 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + + + + + + sonic + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet60 + 10.0.0.30/31 + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet84 + 10.0.0.42/31 + + + + Ethernet88 + 10.0.0.44/31 + + + + Ethernet92 + 10.0.0.46/31 + + + + Ethernet96 + 10.0.0.48/31 + + + + Ethernet100 + 10.0.0.50/31 + + + + Ethernet104 + 10.0.0.52/31 + + + + Ethernet108 + 10.0.0.54/31 + + + + Ethernet112 + 10.0.0.56/31 + + + + Ethernet116 + 10.0.0.58/31 + + + + Ethernet120 + 10.0.0.60/31 + + + + Ethernet124 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + sonic + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet64 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet68 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet72 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet76 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet80 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet84 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet88 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet92 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet96 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet100 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet104 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet108 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet112 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet116 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet120 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet124 + ARISTA16T0 + Ethernet1 + + + + + sonic + Accton-AS7716-32XB + + + + + + + sonic + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + sonic + Accton-AS7716-32XB +
diff --git a/device/accton/x86_64-accton_as7716_32xb-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as7716_32xb-r0/plugins/eeprom.py new file mode 100755 index 000000000000..6fa5719afbad --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32xb-r0/plugins/eeprom.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + #Two i2c buses might get flipped order, check them both. + if not os.path.exists(self.eeprom_path): + self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/accton/x86_64-accton_as7716_32xb-r0/plugins/psuutil.py b/device/accton/x86_64-accton_as7716_32xb-r0/plugins/psuutil.py new file mode 100755 index 000000000000..5a4b0fe83d87 --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32xb-r0/plugins/psuutil.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +############################################################################# +# Accton +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/" + self.psu_presence = "/psu_present" + self.psu_oper_status = "/psu_power_good" + self.psu_mapping = { + 1: "0-0053", + 2: "0-0050", + } + + def get_num_psus(self): + return len(self.psu_mapping) + + def get_psu_status(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index]+self.psu_oper_status + try: + with open(node, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index] + self.psu_presence + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/accton/x86_64-accton_as7716_32xb-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7716_32xb-r0/plugins/sfputil.py new file mode 100755 index 000000000000..d57f10e016db --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32xb-r0/plugins/sfputil.py @@ -0,0 +1,138 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + import os + import sys, getopt + import commands + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 + + BASE_OOM_PATH = "/sys/bus/i2c/devices/{0}-0050/" + BASE_CPLD_PATH = "/sys/bus/i2c/devices/0-0060/" + BASE_I2C_PATH = "/sys/bus/i2c/devices/" + + _port_to_is_present = {} + _port_to_lp_mode = {} + + _port_to_eeprom_mapping = {} + _port_to_i2c_mapping = { + 0: [1, 29], + 1: [2, 30], + 2: [3, 31], + 3: [4, 32], + 4: [5, 34], + 5: [6, 33], + 6: [7, 36], + 7: [8, 35], + 8: [9, 25], + 9: [10, 26], + 10: [11, 27], + 11: [12, 28], + 12: [14, 37], + 13: [15, 38], + 14: [16, 39], + 15: [17, 40], + 16: [18, 41], + 17: [19, 42], + 18: [20, 43], + 19: [21, 44], + 20: [22, 53], + 21: [23, 54], + 22: [24, 55], + 23: [25, 56], + 24: [26, 45], + 25: [27, 46], + 26: [28, 47], + 27: [29, 48], + 28: [30, 49], + 29: [31, 50], + 30: [32, 51], + 31: [33, 52], + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(self.PORT_START, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + present_path = self.BASE_CPLD_PATH + "module_present_" + str(port_num+1) + self.__port_to_is_present = present_path + + try: + val_file = open(self.__port_to_is_present) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def __init__(self): + eeprom_path = self.BASE_I2C_PATH + + for x in range(0, self.port_end+1): + self.port_to_eeprom_mapping[x] = eeprom_path.format( + self._port_to_i2c_mapping[x][1] + ) + if(x < 9): + if(self.get_presence(x)==1): + self.port_to_eeprom_mapping[x] = self.BASE_I2C_PATH + "0-000" +str(x+1) + "/eeprom" + + else: + if(self.get_presence(x)==1): + self.port_to_eeprom_mapping[x] = self.BASE_I2C_PATH + "0-00" +str(x+1)+ "/eeprom" + + SfpUtilBase.__init__(self) + + + + def get_low_power_mode(self, port_num): + raise NotImplementedError + + def set_low_power_mode(self, port_num, lpmode): + raise NotImplementedError + + def reset(self, port_num): + if port_num < self.port_start or port_num > self.port_end: + return False + + mod_rst_cmd = "ipmitool raw 0x34 0x11 " + str(port_num+1) + " 0x11 0x1" + (status, output) = commands.getstatusoutput (mod_rst_cmd) + return True + + \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton b/platform/broadcom/sonic-platform-modules-accton index aaaea8d12838..1168e266b0af 160000 --- a/platform/broadcom/sonic-platform-modules-accton +++ b/platform/broadcom/sonic-platform-modules-accton @@ -1 +1 @@ -Subproject commit aaaea8d12838de634fd27e936e4086258933cbac +Subproject commit 1168e266b0af7dc8f66ec583a1861eef74056283 From e84e093dea909980ac4616051b6b17eb28282286 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 9 Mar 2018 17:17:08 -0800 Subject: [PATCH 030/274] Move all minigraph-related action from rc.local to updategraph (#1452) - Move all minigraph-related action from rc.local to updategraph - updategraph service is now after database. All feature services are now after and depending on updategraph --- files/build_templates/bgp.service.j2 | 4 +- files/build_templates/dhcp_relay.service.j2 | 4 +- files/build_templates/lldp.service.j2 | 4 +- files/build_templates/pmon.service.j2 | 4 +- .../router_advertiser.service.j2 | 4 +- files/build_templates/snmp.service.j2 | 4 +- files/build_templates/swss.service.j2 | 4 +- files/build_templates/teamd.service.j2 | 4 +- files/image_config/caclmgrd/caclmgrd.service | 4 +- files/image_config/hostcfgd/hostcfgd.service | 4 +- .../hostname/hostname-config.service | 4 +- .../interfaces/interfaces-config.service | 4 +- files/image_config/ntp/ntp-config.service | 4 +- files/image_config/platform/rc.local | 56 +++-------- .../rsyslog/rsyslog-config.service | 4 +- .../ssh/sshd-config-updater.service | 3 +- files/image_config/updategraph/updategraph | 97 ++++++++++++++++--- .../updategraph/updategraph.service | 5 +- 18 files changed, 129 insertions(+), 88 deletions(-) diff --git a/files/build_templates/bgp.service.j2 b/files/build_templates/bgp.service.j2 index c7ba8b8a5f52..6c3e343fcf44 100644 --- a/files/build_templates/bgp.service.j2 +++ b/files/build_templates/bgp.service.j2 @@ -1,7 +1,7 @@ [Unit] Description=BGP container -Requires=database.service -After=database.service +Requires=updategraph.service +After=updategraph.service [Service] User={{ sonicadmin_user }} diff --git a/files/build_templates/dhcp_relay.service.j2 b/files/build_templates/dhcp_relay.service.j2 index 966e2782abe0..ea53fa2deda4 100644 --- a/files/build_templates/dhcp_relay.service.j2 +++ b/files/build_templates/dhcp_relay.service.j2 @@ -1,7 +1,7 @@ [Unit] Description=DHCP relay container -Requires=docker.service teamd.service -After=swss.service teamd.service +Requires=updategraph.service swss.service teamd.service +After=updategraph.service swss.service teamd.service [Service] User={{ sonicadmin_user }} diff --git a/files/build_templates/lldp.service.j2 b/files/build_templates/lldp.service.j2 index 1ddda15a49c4..d35cdacca0f3 100644 --- a/files/build_templates/lldp.service.j2 +++ b/files/build_templates/lldp.service.j2 @@ -1,7 +1,7 @@ [Unit] Description=LLDP container -Requires=database.service -After=database.service +Requires=updategraph.service +After=updategraph.service [Service] User={{ sonicadmin_user }} diff --git a/files/build_templates/pmon.service.j2 b/files/build_templates/pmon.service.j2 index 9f1a0298240c..83dd8e4b648d 100644 --- a/files/build_templates/pmon.service.j2 +++ b/files/build_templates/pmon.service.j2 @@ -1,7 +1,7 @@ [Unit] Description=Platform monitor container -Requires=database.service -After=database.service +Requires=updategraph.service +After=updategraph.service [Service] User={{ sonicadmin_user }} diff --git a/files/build_templates/router_advertiser.service.j2 b/files/build_templates/router_advertiser.service.j2 index 12bdb371369d..cd8b817eb64f 100644 --- a/files/build_templates/router_advertiser.service.j2 +++ b/files/build_templates/router_advertiser.service.j2 @@ -1,7 +1,7 @@ [Unit] Description=Router advertiser container -Requires=docker.service -After=swss.service +Requires=updategraph.service +After=updategraph.service swss.service [Service] User={{ sonicadmin_user }} diff --git a/files/build_templates/snmp.service.j2 b/files/build_templates/snmp.service.j2 index 0c1558ad64aa..f0612a9cfcb6 100644 --- a/files/build_templates/snmp.service.j2 +++ b/files/build_templates/snmp.service.j2 @@ -1,7 +1,7 @@ [Unit] Description=SNMP container -Requires=database.service swss.service -After=database.service swss.service +Requires=updategraph.service swss.service +After=updategraph.service swss.service [Service] ExecStartPre=/usr/bin/{{docker_container_name}}.sh start diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 030761015923..e16ca6636121 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -1,12 +1,12 @@ [Unit] Description=switch state service -Requires=database.service +Requires=database.service updategraph.service {% if sonic_asic_platform == 'broadcom' %} Requires=opennsl-modules-3.16.0-5-amd64.service {% elif sonic_asic_platform == 'nephos' %} Requires=nps-modules-3.16.0-5-amd64.service {% endif %} -After=database.service +After=database.service updategraph.service After=interfaces-config.service {% if sonic_asic_platform == 'broadcom' %} After=opennsl-modules-3.16.0-5-amd64.service diff --git a/files/build_templates/teamd.service.j2 b/files/build_templates/teamd.service.j2 index e291a39b387d..bbd04a81b05b 100644 --- a/files/build_templates/teamd.service.j2 +++ b/files/build_templates/teamd.service.j2 @@ -1,7 +1,7 @@ [Unit] Description=TEAMD container -Requires=database.service -After=database.service +Requires=updategraph.service +After=updategraph.service [Service] User={{ sonicadmin_user }} diff --git a/files/image_config/caclmgrd/caclmgrd.service b/files/image_config/caclmgrd/caclmgrd.service index 1acc23458c90..c63f1f7c5c7f 100644 --- a/files/image_config/caclmgrd/caclmgrd.service +++ b/files/image_config/caclmgrd/caclmgrd.service @@ -1,7 +1,7 @@ [Unit] Description=Control Plane ACL configuration daemon -Requires=database.service -After=database.service +Requires=updategraph.service +After=updategraph.service [Service] Type=simple diff --git a/files/image_config/hostcfgd/hostcfgd.service b/files/image_config/hostcfgd/hostcfgd.service index 4f6151a471fe..762786ad830e 100644 --- a/files/image_config/hostcfgd/hostcfgd.service +++ b/files/image_config/hostcfgd/hostcfgd.service @@ -1,7 +1,7 @@ [Unit] Description=Host config enforcer daemon -Requires=database.service -After=database.service +Requires=updategraph.service +After=updategraph.service [Service] Type=simple diff --git a/files/image_config/hostname/hostname-config.service b/files/image_config/hostname/hostname-config.service index e6e8f489883f..c23ae10227a4 100644 --- a/files/image_config/hostname/hostname-config.service +++ b/files/image_config/hostname/hostname-config.service @@ -1,7 +1,7 @@ [Unit] Description=Update hostname based on configdb -Requires=database.service -After=database.service +Requires=updategraph.service +After=updategraph.service [Service] Type=oneshot diff --git a/files/image_config/interfaces/interfaces-config.service b/files/image_config/interfaces/interfaces-config.service index 86706da22518..71178affdee8 100644 --- a/files/image_config/interfaces/interfaces-config.service +++ b/files/image_config/interfaces/interfaces-config.service @@ -1,7 +1,7 @@ [Unit] Description=Update interfaces configuration -Requires=database.service -After=database.service +Requires=updategraph.service +After=updategraph.service [Service] Type=oneshot diff --git a/files/image_config/ntp/ntp-config.service b/files/image_config/ntp/ntp-config.service index d41f1ba2ddca..c86710e3d209 100644 --- a/files/image_config/ntp/ntp-config.service +++ b/files/image_config/ntp/ntp-config.service @@ -1,7 +1,7 @@ [Unit] Description=Update NTP configuration -Requires=database.service -After=database.service +Requires=updategraph.service +After=updategraph.service [Service] Type=oneshot diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index c5bfae19f9b8..2ec4a72e5340 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -157,15 +157,6 @@ firsttime_exit() exit 0 } -test_config() -{ - if [ -d /host/old_config ] && ( [ -f /host/old_config/minigraph.xml ] || [ -f /host/old_config/config_db.json ] ); then - return 0 - fi - - return 1 -} - # Given a string of tuples of the form field=value, extract the value for a field # In : $string, $field # Out: $value @@ -193,46 +184,21 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then firsttime_exit fi - if [ ! -f /etc/sonic/init_cfg.json ]; then - # Generate an empty init_cfg.json - echo '{}' > /etc/sonic/init_cfg.json - fi - # Try to take old configuration saved during installation - if test_config; then - rm -f /host/old_config/sonic_version.yml - mv -f /host/old_config/* /etc/sonic/ - if [ ! -f /etc/sonic/config_db.json ]; then - sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json - fi + # and create a flag in /tmp/ to let updategraph service know + if [ -d /host/old_config ]; then + mv -f /host/old_config /etc/sonic/ + touch /tmp/pending_config_migration elif [ -f /host/minigraph.xml ]; then - mv /host/minigraph.xml /etc/sonic/ - # Combine information in minigraph and init_cfg.json to form initiate config DB dump file. - # TODO: After moving all information from minigraph to DB, sample config DB dump should be provide - sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json + mkdir -p /etc/sonic/old_config + mv /host/minigraph.xml /etc/sonic/old_config/ + touch /tmp/pending_config_migration elif [ -n "$migration" ] && [ -f /host/migration/minigraph.xml ]; then - # Use the minigraph that was imported from the NOS - mv /host/migration/minigraph.xml /etc/sonic/ - sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json + mkdir -p /etc/sonic/old_config + mv /host/migration/minigraph.xml /etc/sonic/old_config/ + touch /tmp/pending_config_migration else - # Use default minigraph.xml - cp /usr/share/sonic/device/$platform/minigraph.xml /etc/sonic/ - sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json - fi - - HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v DEVICE_METADATA.localhost.hwsku` - if [ -f /usr/share/sonic/device/$platform/$HWSKU/buffers.json.j2 ]; then - # generate and merge buffers configuration into config file - sonic-cfggen -m -t /usr/share/sonic/device/$platform/$HWSKU/buffers.json.j2 > /tmp/buffers.json - sonic-cfggen -j /etc/sonic/config_db.json -j /tmp/buffers.json --print-data > /tmp/config_db.json - mv /tmp/config_db.json /etc/sonic/config_db.json - - # Only apply qos.json when buffer configuration is available. - if [ -f /usr/share/sonic/device/$platform/$HWSKU/qos.json ]; then - # merge qos configuration into init config file - sonic-cfggen -j /etc/sonic/config_db.json -j /usr/share/sonic/device/$platform/$HWSKU/qos.json --print-data > /tmp/config_db.json - mv /tmp/config_db.json /etc/sonic/config_db.json - fi + touch /tmp/pending_config_initialization fi if [ -d /host/image-$sonic_version/platform/$platform ]; then diff --git a/files/image_config/rsyslog/rsyslog-config.service b/files/image_config/rsyslog/rsyslog-config.service index e013b992030d..ee62a36ccf2d 100644 --- a/files/image_config/rsyslog/rsyslog-config.service +++ b/files/image_config/rsyslog/rsyslog-config.service @@ -1,7 +1,7 @@ [Unit] Description=Update rsyslog configuration -Requires=database.service -After=database.service +Requires=updategraph.service +After=updategraph.service [Service] Type=oneshot diff --git a/files/image_config/ssh/sshd-config-updater.service b/files/image_config/ssh/sshd-config-updater.service index 306d35f4e6d1..a8e773d48593 100644 --- a/files/image_config/ssh/sshd-config-updater.service +++ b/files/image_config/ssh/sshd-config-updater.service @@ -1,6 +1,7 @@ [Unit] Description=Takes care of updates to SSH config file with respect to the SSH allow list -After=database.service +After=updategraph.service +Requires=updategraph.service ConditionPathExists=!/etc/ssh/sshd_not_to_be_run [Service] diff --git a/files/image_config/updategraph/updategraph b/files/image_config/updategraph/updategraph index 421bbbe5396c..2ce251dfb36e 100755 --- a/files/image_config/updategraph/updategraph +++ b/files/image_config/updategraph/updategraph @@ -1,5 +1,38 @@ #!/bin/bash +CONFIG_DB_INDEX=4 + +reload_minigraph() +{ + echo "Reloading minigraph..." + if [ ! -f /etc/sonic/init_cfg.json ]; then + echo "{}" > /etc/sonic/init_cfg.json + fi + redis-cli -n $CONFIG_DB_INDEX FLUSHDB + sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --write-to-db + redis-cli -n $CONFIG_DB_INDEX SET "CONFIG_DB_INITIALIZED" "1" + if [ -f /etc/sonic/acl.json ]; then + acl-loader update full /etc/sonic/acl.json + fi + config qos reload +} + +copy_default_minigraph() +{ + . /host/machine.conf + if [ -n "$aboot_platform" ]; then + platform=$aboot_platform + elif [ -n "$onie_platform" ]; then + platform=$onie_platform + else + echo "Unknown sonic platform." + exit 1 + fi + echo "Copying default minigraph..." + cp /usr/share/sonic/device/$platform/minigraph.xml /etc/sonic/ +} + + if [ ! -f /etc/sonic/updategraph.conf ]; then echo "No updategraph.conf found, generating a default one." echo "enabled=false" >/etc/sonic/updategraph.conf @@ -7,6 +40,47 @@ fi . /etc/sonic/updategraph.conf +if [ -f /tmp/pending_config_migration ]; then + if [ "$enabled" = "true" ]; then + echo "Use minigraph.xml from old system..." + cp /etc/sonic/old_config/minigraph.xml /etc/sonic/ + if [ -f /etc/sonic/old_config/init_cfg.json ]; then + cp /etc/sonic/old_config/init_cfg.json /etc/sonic/ + fi + if [ -f /etc/sonic/old_config/snmp.yml ]; then + cp /etc/sonic/old_config/snmp.yml /etc/sonic/ + fi + if [ -f /etc/sonic/old_config/acl.json ]; then + cp /etc/sonic/old_config/acl.json /etc/sonic/ + fi + reload_minigraph + sonic-cfggen -d --print-data > /etc/sonic/config_db.json + else + echo "Use config_db.json from old system..." + cp /etc/sonic/old_config/config_db.json /etc/sonic/ + sonic-cfggen -j /etc/sonic/config_db.json --write-to-db + fi + rm -f /tmp/pending_config_migration + sed -i "/enabled=/d" /etc/sonic/updategraph.conf + echo "enabled=false" >> /etc/sonic/updategraph.conf + exit 0 +fi + +if [ -f /tmp/pending_config_initialization ] && [ "$enabled" != "true" ]; then + copy_default_minigraph + reload_minigraph + sonic-cfggen -d --print-data > /etc/sonic/config_db.json + rm -f /tmp/pending_config_initialization + exit 0 +fi + +if [ "$enabled" = "reload_only" ]; then + reload_minigraph + sed -i "/enabled=/d" /etc/sonic/updategraph.conf + echo "enabled=false" >> /etc/sonic/updategraph.conf + exit 0 +fi + if [ "$enabled" != "true" ]; then echo "Disabled in updategraph.conf. Skipping graph update." exit 0 @@ -38,7 +112,9 @@ if [ "$src" = "dhcp" ]; then else cp -f /tmp/device_meta.json /etc/sonic/config_db.json fi - + redis-cli -n $CONFIG_DB_INDEX FLUSHDB + sonic-cfggen -j /etc/sonic/config_db.json --write-to-db + redis-cli -n $CONFIG_DB_INDEX SET "CONFIG_DB_INITIALIZED" "1" if [ "$dhcp_as_static" = "true" ]; then sed -i "/enabled=/d" /etc/sonic/updategraph.conf echo "enabled=false" >> /etc/sonic/updategraph.conf @@ -86,17 +162,6 @@ while true; do sleep 5 done -echo "Regenerating config DB from minigraph..." -if [ -f /etc/sonic/init_cfg.json ]; then - sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json -else - sonic-cfggen -H -m --print-data > /etc/sonic/config_db.json -fi - -# Mark as disabled after graph is successfully downloaded -sed -i "/enabled=/d" /etc/sonic/updategraph.conf -echo "enabled=false" >> /etc/sonic/updategraph.conf - if [ -n "$ACL_URL" ]; then if [ -f /etc/sonic/acl.json ]; then echo "Renaming acl.json to acl.json.old" @@ -111,3 +176,11 @@ if [ -n "$ACL_URL" ]; then else echo "Skip ACL config download." fi + +reload_minigraph +sonic-cfggen -d --print-data > /etc/sonic/config_db.json + +# Mark as disabled after graph is successfully downloaded +sed -i "/enabled=/d" /etc/sonic/updategraph.conf +echo "enabled=false" >> /etc/sonic/updategraph.conf + diff --git a/files/image_config/updategraph/updategraph.service b/files/image_config/updategraph/updategraph.service index 0162754ab2db..4599f56bdc64 100644 --- a/files/image_config/updategraph/updategraph.service +++ b/files/image_config/updategraph/updategraph.service @@ -1,7 +1,8 @@ [Unit] -Description=download minigraph from graph service +Description=Update minigraph and set configuration based on minigraph After=rc-local.service -Before=database.service +After=database.service +Requires=database.service [Service] Type=oneshot From e6278c1e0e438b79618200030f839bf10cf07c7a Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 9 Mar 2018 23:01:49 -0800 Subject: [PATCH 031/274] [radv] Rename service unit file Jinja template to radv.service.j2 (#1480) - Service unit file not getting generated because I changed the docker container name from 'router_advertiser' to 'radv', however I didn't rename the service unit file template name to match. However, slave.mk generates a service file for every docker based on its container name, and since there was no matching 'radv.service.j2' template file, this file stopped getting generated and therefore the docker container was never getting started. - Also add swss.service to 'Requires' --- .../{router_advertiser.service.j2 => radv.service.j2} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename files/build_templates/{router_advertiser.service.j2 => radv.service.j2} (88%) diff --git a/files/build_templates/router_advertiser.service.j2 b/files/build_templates/radv.service.j2 similarity index 88% rename from files/build_templates/router_advertiser.service.j2 rename to files/build_templates/radv.service.j2 index cd8b817eb64f..7d6da31e135f 100644 --- a/files/build_templates/router_advertiser.service.j2 +++ b/files/build_templates/radv.service.j2 @@ -1,6 +1,6 @@ [Unit] Description=Router advertiser container -Requires=updategraph.service +Requires=updategraph.service swss.service After=updategraph.service swss.service [Service] From 913a62c33c01b65f6eabda1dea0403efeb4499d8 Mon Sep 17 00:00:00 2001 From: Rodny Molina Date: Fri, 9 Mar 2018 23:51:33 -0800 Subject: [PATCH 032/274] [configdb]: Sorting all json config-elements residing in config_db.json (#1454) Just a simple change to make sonic's user life a little bit easier. Displaying the multiple elements of config_db.json in an orderly fashion allows a more intuitive user-experience. For this change i'm simply intercepting the config-state that is about to be dumped to config_db.json, and i'm placing it in an ordered-dictionary, so that information is pushed to file in natural/alphanumerical ordering. Example: admin@lnos-x1-a-csw01:~$ sudo sonic-cfggen -m /etc/sonic/minigraph.xml --print-data { ... "PORT": { "Ethernet0": { "alias": "Eth1/1", "lanes": "65" }, "Ethernet1": { "alias": "Eth1/2", "lanes": "66" }, "Ethernet2": { "alias": "Eth1/3", "lanes": "67" }, "Ethernet3": { "alias": "Eth1/4", "lanes": "68" }, "Ethernet4": { "alias": "Eth2/1", "lanes": "69" }, ... ... "INTERFACE": { "Ethernet0|10.0.0.0/31": {}, "Ethernet1|10.0.0.2/31": {}, "Ethernet2|10.0.0.4/31": {}, "Ethernet3|10.0.0.6/31": {}, "Ethernet4|10.0.0.8/31": {}, --- dockers/docker-config-engine/Dockerfile.j2 | 4 ++-- src/sonic-config-engine/sonic-cfggen | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dockers/docker-config-engine/Dockerfile.j2 b/dockers/docker-config-engine/Dockerfile.j2 index b4d924bddfc3..bc82e1ca2883 100644 --- a/dockers/docker-config-engine/Dockerfile.j2 +++ b/dockers/docker-config-engine/Dockerfile.j2 @@ -5,8 +5,8 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update -# Dependencies for sonic-cfggen -RUN apt-get install -y python-lxml python-yaml python-bitarray python-pip python-dev +# Dependencies for sonic-cfggen +RUN apt-get install -y python-lxml python-yaml python-bitarray python-pip python-dev python-natsort RUN pip install --upgrade pip diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 4216425a3617..b11385ab8c8b 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -30,6 +30,8 @@ from sonic_platform import get_machine_info from sonic_platform import get_platform_info from sonic_platform import get_system_mac from swsssdk import ConfigDBConnector +from collections import OrderedDict +from natsort import natsorted def is_ipv4(value): if not value: @@ -99,6 +101,7 @@ TODO(taoyl): Current version of config db only supports BGP admin states. def to_serialized(data): for table in data: if type(data[table]) is dict: + data[table] = OrderedDict(natsorted(data[table].items())) for key in data[table].keys(): new_key = ConfigDBConnector.serialize_key(key) if new_key != key: From f88734b39125bad5ede8cb59b189d9aed39417e4 Mon Sep 17 00:00:00 2001 From: Nadiya Date: Mon, 12 Mar 2018 18:27:36 +0200 Subject: [PATCH 033/274] Fix sfp cli commands (#1482) Signed-off-by: Nadiya Stetskovych --- .../plugins/sfputil.py | 63 ++++++++++++++++--- 1 file changed, 55 insertions(+), 8 deletions(-) diff --git a/device/accton/x86_64-accton_as7512_32x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7512_32x-r0/plugins/sfputil.py index 378a18c6b8bd..f2e59d403344 100644 --- a/device/accton/x86_64-accton_as7512_32x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7512_32x-r0/plugins/sfputil.py @@ -1,25 +1,72 @@ #! /usr/bin/python try: - from sonic_sfp.sfputilbase import sfputilbase + from sonic_sfp.sfputilbase import SfpUtilBase except ImportError, e: raise ImportError (str(e) + "- required module not found") -class sfputil(sfputilbase): +class SfpUtil(SfpUtilBase): """Platform specific sfputil class""" - port_start = 0 - port_end = 31 + _port_start = 0 + _port_end = 31 ports_in_block = 32 - port_to_eeprom_mapping = {} + _port_to_eeprom_mapping = {} + _qsfp_ports = range(0, ports_in_block + 1) - def __init__(self, port_num): + def __init__(self): # Override port_to_eeprom_mapping for class initialization eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom' for x in range(self.port_start, self.port_end + 1): - self.port_to_eeprom_mapping[x] = eeprom_path.format(x + 18) - sfputilbase.__init__(self, port_num) + self._port_to_eeprom_mapping[x] = eeprom_path.format(x + 18) + SfpUtilBase.__init__(self) + + def reset(self, port_num): + raise NotImplementedErro + + def set_low_power_mode(self, port_nuM, lpmode): + raise NotImplementedErro + + def get_low_power_mode(self, port_num): + raise NotImplementedErro + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = "/sys/bus/i2c/devices/{0}-0050/sfp_is_present" + port_ps = path.format(port_num+18) + + + try: + reg_file = open(port_ps) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_file.readline().rstrip() + if reg_value == '1': + return True + + return False + + @property + def port_start(self): + return self._port_start + + @property + def port_end(self): + return self._port_end + + @property + def qsfp_ports(self): + return range(0, self.ports_in_block + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping From 1f4ce098b536afab6f59fe0d3295995b9b2764b1 Mon Sep 17 00:00:00 2001 From: "Wenda Ni, Ph.D" Date: Mon, 12 Mar 2018 14:25:57 -0700 Subject: [PATCH 034/274] Buffers config (#1476) * Improve memory utilization through more sharing at the ingress on A7050-QX-32S Signed-off-by: Wenda * Apply buffers config changes on A7050-QX-32S to A7050-QX32 Signed-off-by: Wenda * Apply buffers config changes on A7050-QX-32S to S6000 --- .../Arista-7050-QX32/buffers.json.j2 | 34 ++++++------------- .../Arista-7050-QX-32S/buffers.json.j2 | 34 ++++++------------- .../Force10-S6000/buffers.json.j2 | 34 ++++++------------- 3 files changed, 30 insertions(+), 72 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 index 376bdab77d89..31efd0634ad1 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 @@ -68,15 +68,10 @@ } }, "BUFFER_POOL": { - "ingress_lossless_pool0": { - "size": "3637248", + "ingress_lossless_pool": { + "size": "7274496", "type": "ingress", - "mode": "static" - }, - "ingress_lossless_pool1": { - "size": "3637248", - "type": "ingress", - "mode": "static" + "mode": "dynamic" }, "ingress_lossy_pool": { "size": "5491712", @@ -100,19 +95,13 @@ } }, "BUFFER_PROFILE": { - "ingress_lossless_profile0": { - "pool":"[BUFFER_POOL|ingress_lossless_pool0]", + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xon":"18432", "xoff":"76800", - "size":"113664", - "static_th":"0" - }, - "ingress_lossless_profile1": { - "pool":"[BUFFER_POOL|ingress_lossless_pool1]", - "xon":"18432", - "xoff":"76800", - "size":"113664", - "static_th":"0" + "size":"78048", + "dynamic_th":"-3", + "xon_offset":"2496" }, "ingress_lossy_profile": { "pool":"[BUFFER_POOL|ingress_lossy_pool]", @@ -136,11 +125,8 @@ } }, "BUFFER_PG": { - "{{ port_names }}|3": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile0]" - }, - "{{ port_names }}|4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile1]" + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" }, "{{ port_names }}|0-1": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 index 376bdab77d89..31efd0634ad1 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 @@ -68,15 +68,10 @@ } }, "BUFFER_POOL": { - "ingress_lossless_pool0": { - "size": "3637248", + "ingress_lossless_pool": { + "size": "7274496", "type": "ingress", - "mode": "static" - }, - "ingress_lossless_pool1": { - "size": "3637248", - "type": "ingress", - "mode": "static" + "mode": "dynamic" }, "ingress_lossy_pool": { "size": "5491712", @@ -100,19 +95,13 @@ } }, "BUFFER_PROFILE": { - "ingress_lossless_profile0": { - "pool":"[BUFFER_POOL|ingress_lossless_pool0]", + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xon":"18432", "xoff":"76800", - "size":"113664", - "static_th":"0" - }, - "ingress_lossless_profile1": { - "pool":"[BUFFER_POOL|ingress_lossless_pool1]", - "xon":"18432", - "xoff":"76800", - "size":"113664", - "static_th":"0" + "size":"78048", + "dynamic_th":"-3", + "xon_offset":"2496" }, "ingress_lossy_profile": { "pool":"[BUFFER_POOL|ingress_lossy_pool]", @@ -136,11 +125,8 @@ } }, "BUFFER_PG": { - "{{ port_names }}|3": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile0]" - }, - "{{ port_names }}|4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile1]" + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" }, "{{ port_names }}|0-1": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 index 376bdab77d89..31efd0634ad1 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 @@ -68,15 +68,10 @@ } }, "BUFFER_POOL": { - "ingress_lossless_pool0": { - "size": "3637248", + "ingress_lossless_pool": { + "size": "7274496", "type": "ingress", - "mode": "static" - }, - "ingress_lossless_pool1": { - "size": "3637248", - "type": "ingress", - "mode": "static" + "mode": "dynamic" }, "ingress_lossy_pool": { "size": "5491712", @@ -100,19 +95,13 @@ } }, "BUFFER_PROFILE": { - "ingress_lossless_profile0": { - "pool":"[BUFFER_POOL|ingress_lossless_pool0]", + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xon":"18432", "xoff":"76800", - "size":"113664", - "static_th":"0" - }, - "ingress_lossless_profile1": { - "pool":"[BUFFER_POOL|ingress_lossless_pool1]", - "xon":"18432", - "xoff":"76800", - "size":"113664", - "static_th":"0" + "size":"78048", + "dynamic_th":"-3", + "xon_offset":"2496" }, "ingress_lossy_profile": { "pool":"[BUFFER_POOL|ingress_lossy_pool]", @@ -136,11 +125,8 @@ } }, "BUFFER_PG": { - "{{ port_names }}|3": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile0]" - }, - "{{ port_names }}|4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile1]" + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" }, "{{ port_names }}|0-1": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" From 75c6f19f8eb1f525967634e3e0b13d8dd5cebf59 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 12 Mar 2018 14:45:35 -0700 Subject: [PATCH 035/274] [docker] Refine docker tag for build number (#1484) --- push_docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/push_docker.sh b/push_docker.sh index 1e2bc467794e..3ba9abfae5bf 100755 --- a/push_docker.sh +++ b/push_docker.sh @@ -18,7 +18,7 @@ docker load < $DOCKER_IMAGE_FILE docker_image_name=$(basename $DOCKER_IMAGE_FILE | cut -d. -f1) remote_image_name=$REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name:$DOCKER_IMAGE_TAG timestamp="$(date -u +%Y%m%d)" -build_version="${timestamp}.${BUILD_NUMBER}" +build_version="${timestamp}.bld-${BUILD_NUMBER}" build_remote_image_name=$REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name:$build_version ## Add registry information as tag, so will push as latest From 6839e7043d7b6cc64f447fc8afd49727b2e75402 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 13 Mar 2018 09:39:07 -0700 Subject: [PATCH 036/274] Update sonic-quagga submodule. Fix IPv6 ECMP behavior (#1490) --- src/sonic-quagga | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-quagga b/src/sonic-quagga index 59f7c8ed56fa..e1217a526999 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit 59f7c8ed56fa1c9df2070596b25f5f019bdba8ca +Subproject commit e1217a5269990926dff30624063975673b1da065 From 243a87d6e60fa045369d088855b7ab3e3f5d51f9 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Tue, 13 Mar 2018 13:07:39 -0700 Subject: [PATCH 037/274] [devices]: remove Dell S6100 qos config via swssconfig (#1483) Signed-off-by: Sihui Han --- dockers/docker-orchagent/swssconfig.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index d3035e04d811..850a4afd1ef5 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -43,10 +43,6 @@ HWSKU=`sonic-cfggen -d -v "DEVICE_METADATA['localhost']['hwsku']"` SWSSCONFIG_ARGS="00-copp.config.json ipinip.json ports.json switch.json " -if [ "$HWSKU" == "Force10-S6100" ]; then - SWSSCONFIG_ARGS+="th.64ports.buffers.json th.64ports.qos.json " -fi - for file in $SWSSCONFIG_ARGS; do swssconfig /etc/swss/config.d/$file sleep 1 From 6194a81236a614dbb0f0acab39bd030803b09540 Mon Sep 17 00:00:00 2001 From: Harish Venkatraman Date: Tue, 13 Mar 2018 21:47:03 -0700 Subject: [PATCH 038/274] [device/dell] Workaround for sai.profile (#1491) This commit has the workaround for sai.profile to point to config.bcm T0 profile. This fix will be reverted once the sai.profile.j2 dynamically generates this file. Signed-off-by: Harish Venkatraman --- .../dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile index ee286905f907..78b0dec06d5d 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-s6100-64x40G.config.bcm +SAI_INIT_CONFIG_FILE=/etc/bcm/th-s6100-64x40G-t0.config.bcm From 9065e09beed612f99d53eedd9e73e92df32b5825 Mon Sep 17 00:00:00 2001 From: AndriiS Date: Wed, 14 Mar 2018 18:20:47 +0200 Subject: [PATCH 039/274] [baseimage] Added net.core.wmem_max value required by Copp test (#1489) --- build_debian.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build_debian.sh b/build_debian.sh index bc04a71800ce..8a3e4f90fa64 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -304,6 +304,7 @@ set /files/etc/sysctl.conf/net.ipv6.conf.all.accept_dad 0 set /files/etc/sysctl.conf/net.ipv6.conf.eth0.accept_ra_defrtr 0 set /files/etc/sysctl.conf/net.core.rmem_max 2097152 +set /files/etc/sysctl.conf/net.core.wmem_max 2097152 " -r $FILESYSTEM_ROOT ## docker-py is needed by Ansible docker module From dd4899548268cc0c6b06ff93db118d2799027606 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 14 Mar 2018 09:38:39 -0700 Subject: [PATCH 040/274] [submodule]: update sonic linux kernel (#1495) --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 5341a8f75f84..ed04b3690388 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 5341a8f75f845240ca73d88738a7708af7e62406 +Subproject commit ed04b36903885ec065274174aa775e47695db2cb From 2beb78f069631fc29da8085422422d46c618aad8 Mon Sep 17 00:00:00 2001 From: kaiyu22 Date: Thu, 15 Mar 2018 00:41:23 +0800 Subject: [PATCH 041/274] [Nephos] Upgrade SAI to v1.2.3 (#1494) - What I did Upgrading SAI version from v1.0 to v1.2.3 - How I did it Updating platform/nephos/sai.mk - How to verify it Checking the image can build successfully in the branch master - Description for the changelog Upgrade SAI to v1.2.3 - A picture of a cute animal (not mandatory but encouraged) Signed-off-by: Sam Yang --- platform/nephos/sai.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/nephos/sai.mk b/platform/nephos/sai.mk index 30fb458e638f..ca756f392351 100644 --- a/platform/nephos/sai.mk +++ b/platform/nephos/sai.mk @@ -1,9 +1,9 @@ NEPHOS_SAI = libsainps_2.0.3_amd64.deb $(NEPHOS_SAI)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps_2.0.3_amd64.deb" -NEPHOS_SAI_DEV = libsainps-dev_2.0.3a63-20180110_amd64.deb +NEPHOS_SAI_DEV = libsainps-dev_2.0.3_sai_1.2.3_amd64.deb $(eval $(call add_derived_package,$(NEPHOS_SAI),$(NEPHOS_SAI_DEV))) -$(NEPHOS_SAI_DEV)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps-dev_2.0.3a63-20180110_amd64.deb" +$(NEPHOS_SAI_DEV)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps-dev_2.0.3_sai_1.2.3_amd64.deb" SONIC_ONLINE_DEBS += $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) $(NEPHOS_SAI_DEV)_DEPENDS += $(NEPHOS_SAI) From aa845b7c6caecff017123325bfb9ee7dc4a60d69 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Wed, 14 Mar 2018 19:12:48 +0200 Subject: [PATCH 042/274] [submodules]: Update sonic-swss pointer (#1498) Signed-off-by: Volodymyr Samotiy --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index e32212a79c59..4dab0c398996 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit e32212a79c595c522e9ef9f6033519e6a2db4ead +Subproject commit 4dab0c398996efb016f8b30539c1903143f8a664 From 33252a4320af671a1acc318a1b96f47daffe4318 Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Thu, 15 Mar 2018 01:23:54 +0800 Subject: [PATCH 043/274] [devices]: As7312 54x add sfp rest and fan policy (#1464) * Update sonic-platform-modules-accton to lastest Signed-off-by: roylee123 * Install sonic-platform-common package in platform-monitor docker for ledd (#1330) * Install sonic-platform-common package in platform-monitor docker for ledd * Specify Python wheel dependencies in docker-platform-monitor.mk; Remove explicit specifications from Dockerfile.j2 * [platform] 1. Add QSFP reset control. 2. Validate fan control monitoring. Signed-off-by: roy_lee * Replace tab by blanks. Signed-off-by: roy_lee * Resolve submodule conflicts. Signed-off-by: roy_lee * AS7312-54x, fix a indention error on sfputil.py. Signed-off-by: roy_lee --- .../plugins/sfputil.py | 57 ++++++++++++------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/device/accton/x86_64-accton_as7312_54x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7312_54x-r0/plugins/sfputil.py index 2cac13d46b6b..956b6b352f9c 100644 --- a/device/accton/x86_64-accton_as7312_54x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7312_54x-r0/plugins/sfputil.py @@ -26,10 +26,10 @@ class SfpUtil(SfpUtilBase): _port_to_eeprom_mapping = {} _cpld_mapping = { - 0: "4-0060", - 1: "5-0062", - 2: "6-0064", - } + 0: "4-0060", + 1: "5-0062", + 2: "6-0064", + } _port_to_i2c_mapping = { 0: 18, 1: 19, @@ -137,29 +137,40 @@ def __init__(self): SfpUtilBase.__init__(self) + + # For port 48~51 are QSFP, here presumed they're all split to 4 lanes. + def get_cage_num(self, port_num): + cage_num = port_num + if (port_num >= self.QSFP_PORT_START): + cage_num = (port_num - self.QSFP_PORT_START)/4 + cage_num = cage_num + self.QSFP_PORT_START + + return cage_num + + # For cage 0~23 and 48~51 are at cpld2, others are at cpld3. + def get_cpld_num(self, port_num): + cpld_i = 1 + cage_num = self.get_cage_num(port_num) + if (port_num > 23 and port_num < self.QSFP_PORT_START): + cpld_i = 2 + + if (cage_num >= 52): + cpld_i = 2 + + return cpld_i + def get_presence(self, port_num): # Check for invalid port_num if port_num < self.port_start or port_num > self.port_end: return False - # For cage 0~23 and 48~51 are at cpld2, others are at cpld3. - # For port 48~51 are QSFP, here presumed they are all broken-out to 4 lanes. - cage_num = port_num - cpld_i = 1 - if (port_num > 23): - cpld_i = 2 - - if (port_num >= self.QSFP_PORT_START): - cpld_i = 1 - cage_num = (port_num - self.QSFP_PORT_START)/4 - cage_num = cage_num + self.QSFP_PORT_START - if (cage_num >= 52): - cpld_i = 2 + cage_num = self.get_cage_num(port_num) + cpld_i = self.get_cpld_num(port_num) cpld_ps = self._cpld_mapping[cpld_i] path = "/sys/bus/i2c/devices/{0}/module_present_{1}" port_ps = path.format(cpld_ps, cage_num+1) - + try: val_file = open(port_ps) except IOError as e: @@ -185,16 +196,18 @@ def reset(self, port_num): if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: return False - - path = "/sys/bus/i2c/devices/5-0062/module_reset_{0}" - port_ps = path.format(port_num+1) + cage_num = self.get_cage_num(port_num) + cpld_i = self.get_cpld_num(port_num) + cpld_ps = self._cpld_mapping[cpld_i] + path = "/sys/bus/i2c/devices/{0}/module_reset_{1}" + port_ps = path.format(cpld_ps, cage_num+1) try: reg_file = open(port_ps, 'w') except IOError as e: print "Error: unable to open file: %s" % str(e) return False - reg_value = '1' + reg_value = '0' reg_file.write(reg_value) reg_file.close() From f306dd36cdaabdbe3097d9ad5128ab020cadf50b Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 14 Mar 2018 14:44:40 -0700 Subject: [PATCH 044/274] [BCM SAI] update Broadcom SDK and SAI (#1485) SDK: no functional change, update version number to 3.4.1.11-2. SAI: upgrade to 3.1.3.4-5, enable warm shutdown feature. --- platform/broadcom/sai.mk | 8 ++++---- platform/broadcom/sdk.mk | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index e8b627f6f112..f24166493c30 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.4-4_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-4_amd64.deb?sv=2015-04-05&sr=b&sig=hSWtsH1f5FIV7rk4%2FJA99S%2B7HoJ%2BSvHN8fPXZNnO6mI%3D&se=2031-11-15T03%3A11%3A01Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.4-5_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-5_amd64.deb?sv=2015-04-05&sr=b&sig=s757Jmeq0blUuQa%2BnWXfe80sChLHWAnuSDf2J84s4OE%3D&se=2031-11-16T21%3A58%3A22Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-4_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-5_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-4_amd64.deb?sv=2015-04-05&sr=b&sig=nEo71IhiVDrk2ydJf3ejyZvQ5QES%2BxjWdQ5SEOOyaic%3D&se=2031-11-15T03%3A10%3A12Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-5_amd64.deb?sv=2015-04-05&sr=b&sig=BOLw2xZ53Tp1JfBXZtqsKAltbYGTJuRV89Y9jDSSp50%3D&se=2031-11-16T21%3A56%3A19Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index b996406a7b72..05d51fc28d07 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,4 +1,4 @@ -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-5-amd64_3.4.1.11-1_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-5-amd64_3.4.1.11-1_amd64.deb?sv=2015-04-05&sr=b&sig=jsHYNwfuoTU%2B2mhhyhC2%2FaQ%2BcaZA%2Fd21LzaaUq%2BG65c%3D&se=2031-10-17T01%3A35%3A15Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-5-amd64_3.4.1.11-2_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-5-amd64_3.4.1.11-2_amd64.deb?sv=2015-04-05&sr=b&sig=xtf8nafmS1pcqx5hhBsfmLNSx2BeqmwN4Dwq5uwM1bo%3D&se=2031-11-16T21%3A54%3A27Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL_KERNEL) From 3bb24a975d2b8d2ae2a18c172e325f1378fcab8e Mon Sep 17 00:00:00 2001 From: padmanarayana Date: Fri, 16 Mar 2018 01:46:00 +0530 Subject: [PATCH 045/274] [debian]: Add fstrim service files to systemd (#1500) --- build_debian.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build_debian.sh b/build_debian.sh index 8a3e4f90fa64..f952de35e32b 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -247,6 +247,9 @@ sudo augtool --autosave "set /files/etc/ssh/sshd_config/UseDNS no" -r $FILESYSTE sudo sed -i 's/^ListenAddress ::/#ListenAddress ::/' $FILESYSTEM_ROOT/etc/ssh/sshd_config sudo sed -i 's/^#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' $FILESYSTEM_ROOT/etc/ssh/sshd_config +## Copy fstrim service +sudo cp $FILESYSTEM_ROOT/usr/share/doc/util-linux/examples/fstrim.{service,timer} $FILESYSTEM_ROOT/etc/systemd/system + ## Config monit sudo sed -i ' s/^# set logfile syslog/set logfile syslog/; From 23e79818e3a63fa5e00f69f32d07cc5b609c5797 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 15 Mar 2018 15:30:09 -0700 Subject: [PATCH 046/274] [platform]: Update sonic-platform-modules-dell submodule (#1502) * Enable/disable fstrim on S6100 & Z9100 Signed-off-by: Shu0T1an ChenG --- platform/broadcom/sonic-platform-modules-dell | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-dell b/platform/broadcom/sonic-platform-modules-dell index fac81d02276d..8d4517d0f94d 160000 --- a/platform/broadcom/sonic-platform-modules-dell +++ b/platform/broadcom/sonic-platform-modules-dell @@ -1 +1 @@ -Subproject commit fac81d02276d7245233c0401ac699029b0b41cdd +Subproject commit 8d4517d0f94dd34b232e3fc03f62f11b2c2cb863 From f00bac79572629d111e22550a625563036d98026 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 15 Mar 2018 15:47:33 -0700 Subject: [PATCH 047/274] [submodule]: Update sonic-sairedis submodule (#1501) --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index a381f5653e1f..dd37cca5a4a3 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit a381f5653e1fdcfe0ef67660b9ae0f24648f721e +Subproject commit dd37cca5a4a322a15638cb393dce0562fdcca666 From 871161e868ea7848dc6ebc6b4a432bf97b92ff07 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 16 Mar 2018 01:09:33 -0700 Subject: [PATCH 048/274] [build_debian]: Add quote to specify values as string (#1503) --- build_debian.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index f952de35e32b..c35ca03297e4 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -335,11 +335,11 @@ sudo cp files/dhcp/dhclient.conf $FILESYSTEM_ROOT/etc/dhcp/ ## Version file sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic sudo tee $FILESYSTEM_ROOT/etc/sonic/sonic_version.yml > /dev/null < Date: Fri, 16 Mar 2018 15:52:08 -0700 Subject: [PATCH 049/274] [devices]: Consolidate to one egress lossless buffer configuration (#1493) --- .../Arista-7050-QX32/buffers.json.j2 | 27 +++++-------------- .../Arista-7050-QX-32S/buffers.json.j2 | 27 +++++-------------- .../Force10-S6000/buffers.json.j2 | 27 +++++-------------- 3 files changed, 21 insertions(+), 60 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 index 31efd0634ad1..2e595d028c70 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 @@ -78,13 +78,8 @@ "type": "ingress", "mode": "dynamic" }, - "egress_lossless_pool0": { - "size": "3637248", - "type": "egress", - "mode": "static" - }, - "egress_lossless_pool1": { - "size": "3637248", + "egress_lossless_pool": { + "size": "7274496", "type": "egress", "mode": "static" }, @@ -108,15 +103,10 @@ "size":"1518", "dynamic_th":"3" }, - "egress_lossless_profile0": { - "pool":"[BUFFER_POOL|egress_lossless_pool0]", + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", "size":"1518", - "static_th":"3637248" - }, - "egress_lossless_profile1": { - "pool":"[BUFFER_POOL|egress_lossless_pool1]", - "size":"1518", - "static_th":"3637248" + "static_th":"7274496" }, "egress_lossy_profile": { "pool":"[BUFFER_POOL|egress_lossy_pool]", @@ -133,11 +123,8 @@ } }, "BUFFER_QUEUE": { - "{{ port_names }}|3": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile0]" - }, - "{{ port_names }}|4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile1]" + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" }, "{{ port_names }}|0-1": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 index 31efd0634ad1..2e595d028c70 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 @@ -78,13 +78,8 @@ "type": "ingress", "mode": "dynamic" }, - "egress_lossless_pool0": { - "size": "3637248", - "type": "egress", - "mode": "static" - }, - "egress_lossless_pool1": { - "size": "3637248", + "egress_lossless_pool": { + "size": "7274496", "type": "egress", "mode": "static" }, @@ -108,15 +103,10 @@ "size":"1518", "dynamic_th":"3" }, - "egress_lossless_profile0": { - "pool":"[BUFFER_POOL|egress_lossless_pool0]", + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", "size":"1518", - "static_th":"3637248" - }, - "egress_lossless_profile1": { - "pool":"[BUFFER_POOL|egress_lossless_pool1]", - "size":"1518", - "static_th":"3637248" + "static_th":"7274496" }, "egress_lossy_profile": { "pool":"[BUFFER_POOL|egress_lossy_pool]", @@ -133,11 +123,8 @@ } }, "BUFFER_QUEUE": { - "{{ port_names }}|3": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile0]" - }, - "{{ port_names }}|4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile1]" + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" }, "{{ port_names }}|0-1": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 index 31efd0634ad1..2e595d028c70 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 @@ -78,13 +78,8 @@ "type": "ingress", "mode": "dynamic" }, - "egress_lossless_pool0": { - "size": "3637248", - "type": "egress", - "mode": "static" - }, - "egress_lossless_pool1": { - "size": "3637248", + "egress_lossless_pool": { + "size": "7274496", "type": "egress", "mode": "static" }, @@ -108,15 +103,10 @@ "size":"1518", "dynamic_th":"3" }, - "egress_lossless_profile0": { - "pool":"[BUFFER_POOL|egress_lossless_pool0]", + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", "size":"1518", - "static_th":"3637248" - }, - "egress_lossless_profile1": { - "pool":"[BUFFER_POOL|egress_lossless_pool1]", - "size":"1518", - "static_th":"3637248" + "static_th":"7274496" }, "egress_lossy_profile": { "pool":"[BUFFER_POOL|egress_lossy_pool]", @@ -133,11 +123,8 @@ } }, "BUFFER_QUEUE": { - "{{ port_names }}|3": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile0]" - }, - "{{ port_names }}|4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile1]" + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" }, "{{ port_names }}|0-1": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" From 066137e9d88d87a2421ce22d39b9b7cc9d12e236 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Fri, 16 Mar 2018 17:15:18 -0700 Subject: [PATCH 050/274] [swss]:update swss submodule (#1499) Signed-off-by: Sihui Han --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 4dab0c398996..2ae1714aa3e2 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 4dab0c398996efb016f8b30539c1903143f8a664 +Subproject commit 2ae1714aa3e285bc9a311c10b5c899b5ec6b76cc From e1cb2ace36feb6543f3823accbdf2c6c13c55a5c Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Sat, 17 Mar 2018 00:43:29 -0700 Subject: [PATCH 051/274] [base image files] All 'docker exec' wrapper scripts now dynamically adjust their flags depending on whether or not they are run on a terminal (#1507) --- dockers/docker-database/base_image_files/redis-cli | 9 ++++++++- dockers/docker-fpm-frr/base_image_files/vtysh | 10 +++++++++- dockers/docker-fpm-quagga/base_image_files/vtysh | 10 +++++++++- dockers/docker-lldp-sv2/base_image_files/lldpctl | 10 +++++++++- dockers/docker-orchagent/base_image_files/swssloglevel | 10 +++++++++- .../docker-platform-monitor/base_image_files/sensors | 10 +++++++++- dockers/docker-teamd/base_image_files/teamdctl | 9 ++++++++- 7 files changed, 61 insertions(+), 7 deletions(-) diff --git a/dockers/docker-database/base_image_files/redis-cli b/dockers/docker-database/base_image_files/redis-cli index 103dd9e02536..6ce1951cd4b9 100755 --- a/dockers/docker-database/base_image_files/redis-cli +++ b/dockers/docker-database/base_image_files/redis-cli @@ -1,3 +1,10 @@ #!/bin/bash -docker exec -it database redis-cli "$@" +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS database redis-cli "$@" diff --git a/dockers/docker-fpm-frr/base_image_files/vtysh b/dockers/docker-fpm-frr/base_image_files/vtysh index 18529b7522c7..8f8cb2e67960 100755 --- a/dockers/docker-fpm-frr/base_image_files/vtysh +++ b/dockers/docker-fpm-frr/base_image_files/vtysh @@ -1,2 +1,10 @@ #!/bin/bash -docker exec -it bgp vtysh "$@" + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS bgp vtysh "$@" diff --git a/dockers/docker-fpm-quagga/base_image_files/vtysh b/dockers/docker-fpm-quagga/base_image_files/vtysh index 18529b7522c7..8f8cb2e67960 100755 --- a/dockers/docker-fpm-quagga/base_image_files/vtysh +++ b/dockers/docker-fpm-quagga/base_image_files/vtysh @@ -1,2 +1,10 @@ #!/bin/bash -docker exec -it bgp vtysh "$@" + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS bgp vtysh "$@" diff --git a/dockers/docker-lldp-sv2/base_image_files/lldpctl b/dockers/docker-lldp-sv2/base_image_files/lldpctl index 068a6e3b5048..f5b6d8307ee9 100755 --- a/dockers/docker-lldp-sv2/base_image_files/lldpctl +++ b/dockers/docker-lldp-sv2/base_image_files/lldpctl @@ -1,2 +1,10 @@ #!/bin/bash -docker exec -i lldp lldpctl "$@" + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS lldp lldpctl "$@" diff --git a/dockers/docker-orchagent/base_image_files/swssloglevel b/dockers/docker-orchagent/base_image_files/swssloglevel index 9282470c2645..d03685ed383c 100755 --- a/dockers/docker-orchagent/base_image_files/swssloglevel +++ b/dockers/docker-orchagent/base_image_files/swssloglevel @@ -1,2 +1,10 @@ #!/bin/bash -docker exec -i swss swssloglevel "$@" + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS swss swssloglevel "$@" diff --git a/dockers/docker-platform-monitor/base_image_files/sensors b/dockers/docker-platform-monitor/base_image_files/sensors index af1e57941861..23a12034f071 100755 --- a/dockers/docker-platform-monitor/base_image_files/sensors +++ b/dockers/docker-platform-monitor/base_image_files/sensors @@ -1,2 +1,10 @@ #!/bin/bash -docker exec -i pmon sensors "$@" + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS pmon sensors "$@" diff --git a/dockers/docker-teamd/base_image_files/teamdctl b/dockers/docker-teamd/base_image_files/teamdctl index 9dd188d18cba..615bc3d953fa 100755 --- a/dockers/docker-teamd/base_image_files/teamdctl +++ b/dockers/docker-teamd/base_image_files/teamdctl @@ -1,3 +1,10 @@ #!/bin/bash -docker exec -i teamd teamdctl "$@" +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS teamd teamdctl "$@" From de5e5332beb5356a2b191b71fa40c6205d1a0d01 Mon Sep 17 00:00:00 2001 From: "Wenda Ni, Ph.D" Date: Sat, 17 Mar 2018 14:48:52 -0700 Subject: [PATCH 052/274] [mmu]: reduce headroom size and remove queue min for lossless traffic (#1508) * Reduce xoff size for in-flight packets of lossless traffic Signed-off-by: Wenda * Must explicitly specify min buffer size per queue to be zero Signed-off-by: Wenda --- .../Arista-7050-QX32/buffers.json.j2 | 6 +++--- .../Arista-7050-QX-32S/buffers.json.j2 | 6 +++--- .../Force10-S6000/buffers.json.j2 | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 index 2e595d028c70..10f9da575a1b 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 @@ -93,8 +93,8 @@ "ingress_lossless_profile": { "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xon":"18432", - "xoff":"76800", - "size":"78048", + "xoff":"40560", + "size":"41808", "dynamic_th":"-3", "xon_offset":"2496" }, @@ -105,7 +105,7 @@ }, "egress_lossless_profile": { "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"1518", + "size":"0", "static_th":"7274496" }, "egress_lossy_profile": { diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 index 2e595d028c70..10f9da575a1b 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 @@ -93,8 +93,8 @@ "ingress_lossless_profile": { "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xon":"18432", - "xoff":"76800", - "size":"78048", + "xoff":"40560", + "size":"41808", "dynamic_th":"-3", "xon_offset":"2496" }, @@ -105,7 +105,7 @@ }, "egress_lossless_profile": { "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"1518", + "size":"0", "static_th":"7274496" }, "egress_lossy_profile": { diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 index 2e595d028c70..10f9da575a1b 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 @@ -93,8 +93,8 @@ "ingress_lossless_profile": { "pool":"[BUFFER_POOL|ingress_lossless_pool]", "xon":"18432", - "xoff":"76800", - "size":"78048", + "xoff":"40560", + "size":"41808", "dynamic_th":"-3", "xon_offset":"2496" }, @@ -105,7 +105,7 @@ }, "egress_lossless_profile": { "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"1518", + "size":"0", "static_th":"7274496" }, "egress_lossy_profile": { From 93f38de672466f63e1de30d1a75a2223dbc1c491 Mon Sep 17 00:00:00 2001 From: delta-JohnsonLu <31528297+delta-JohnsonLu@users.noreply.github.com> Date: Sun, 18 Mar 2018 07:43:14 +0800 Subject: [PATCH 053/274] [devices]: modify platform-modules-ag9064.init (#1504) add load IPMI module. Signed-off-by: johnson.lu --- .../debian/platform-modules-ag9064.init | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init index 6e413ec644b4..669379fc9c12 100755 --- a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init @@ -23,6 +23,8 @@ start) modprobe i2c-mei modprobe i2c-mux-pca954x modprobe at24 + modprobe ipmi_devintf + modprobe ipmi_si trydefaults=1 modprobe delta_ag9064_platform /usr/local/bin/ag9064_platform_init.sh From 15cd34f03c0ed137ce07149bad22432c525fe3d6 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 17 Mar 2018 18:31:18 -0700 Subject: [PATCH 054/274] [installer]: support new onie machine.conf format (#1468) * [installer]: support new onie machine.conf format onie_* variable are generated at runtime in /etc/machine.conf. We can no longer copy the static machine.conf into sonic image. Signed-off-by: Guohan Lu --- installer/x86_64/install.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 4d0d03218600..eef0eeee25d2 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -452,7 +452,13 @@ unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar xz $TAR_EXTRA_OPT if [ "$install_env" = "onie" ]; then # Store machine description in target file system - cp /etc/machine.conf $demo_mnt + if [ -f /etc/machine-build.conf ]; then + # onie_ variable are generate at runtime. + # they are no longer hardcoded in /etc/machine.conf + set | grep ^onie_ > $demo_mnt/machine.conf + else + cp /etc/machine.conf $demo_mnt + fi # Store installation log in target file system rm -f $onie_initrd_tmp/tmp/onie-support*.tar.bz2 From 3ba84ec1f755ed3258e6e0a8af2cc2e63ee47d07 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 17 Mar 2018 19:07:28 -0700 Subject: [PATCH 055/274] [SAI]: Update sonic to use SAI v1.2.4 (#1509) * Update SAI to v1.2.4 Signed-off-by: Andriy Moroz * update SAI to v1.2.4 header --- platform/broadcom/sai.mk | 8 ++++---- platform/mellanox/fw.mk | 2 +- platform/mellanox/mlnx-sai.mk | 4 ++-- platform/mellanox/sdk.mk | 4 ++-- src/sonic-sairedis | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index f24166493c30..1f124e1b9232 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.4-5_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-5_amd64.deb?sv=2015-04-05&sr=b&sig=s757Jmeq0blUuQa%2BnWXfe80sChLHWAnuSDf2J84s4OE%3D&se=2031-11-16T21%3A58%3A22Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.4-7_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-7_amd64.deb?sv=2015-04-05&sr=b&sig=elzOgHCA3G8oKKMfWcbFa%2BvQzAh727mtYJnnVOzVJtY%3D&se=2155-02-07T23%3A37%3A54Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-5_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-7_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-5_amd64.deb?sv=2015-04-05&sr=b&sig=BOLw2xZ53Tp1JfBXZtqsKAltbYGTJuRV89Y9jDSSp50%3D&se=2031-11-16T21%3A56%3A19Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-7_amd64.deb?sv=2015-04-05&sr=b&sig=rysxdbCA%2BaqBgDnxztdRA2ixiME3ypqRvzyEds8hLw4%3D&se=2155-02-07T23%3A38%3A39Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 20f4dc8d956b..ce3c55c59c09 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,6 +1,6 @@ # mellanox firmware -MLNX_FW_VERSION = 13.1600.0184 +MLNX_FW_VERSION = 13.1620.0192 MLNX_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_FW_VERSION))-EVB.mfa $(MLNX_FW_FILE)_URL = $(MLNX_SDK_BASE_URL)/$(MLNX_FW_FILE) SONIC_ONLINE_FILES += $(MLNX_FW_FILE) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index b89768596e85..666e90e2b20f 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.10.1-master -MLNX_SAI_REVISION = dac6b12d09a94d39eabee0d3e6419015cf6fb6b8 +MLNX_SAI_VERSION = SAIRel1.11.2-master +MLNX_SAI_REVISION = f0651fc85d88d03001b72a03a4d15e269e198b38 export MLNX_SAI_VERSION MLNX_SAI_REVISION diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index d416a98d65d7..9c440c0a2fb8 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,5 +1,5 @@ -MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/05493363f389a5601322d664bdb004434e1a7a39/sdk -MLNX_SDK_VERSION = 4.2.7004X004 +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/fb4cd4cec4b8718c54d5bf5c64df9b474738f404/sdk +MLNX_SDK_VERSION = 4.2.7101 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ $(SXD_LIBS) $(TESTX) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index dd37cca5a4a3..e9ad72132f09 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit dd37cca5a4a322a15638cb393dce0562fdcca666 +Subproject commit e9ad72132f09f37418b9ecd9d0c6708afac6db6f From 5034d695c30a17de55ce3f6602a3a4169583954f Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 18 Mar 2018 16:15:19 -0700 Subject: [PATCH 056/274] [doc]: add build badge for 201712 release (#1510) Signed-off-by: Guohan Lu --- README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7c4287b6b997..20cc432cbbe6 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,20 @@ Nephos: [![Nephos](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/j P4: [![P4](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/buildimage-p4-all) VS: [![VS](https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-all) +*201712*: +Broadcom: [![Broadcom](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201712/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201712/) +Barefoot: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/barefoot/job/buildimage-bf-201712/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/barefoot/job/buildimage-bf-201712/) +Centec: [![Centec](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-201712/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-201712/) +Nephos: [![Nephos](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-201712/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-201712/) +Marvell: [![Marvell](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-201712/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-201712/) +Mellanox: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201712/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201712/) + *201709*: Broadcom: [![Broadcom](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201709/) -Cavium: [![Cavium](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/) -Centec: [![Centec](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-all/) +Cavium: [![Cavium](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-201709/) +Centec: [![Centec](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-201709/) Nephos: [![Nephos](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-201709/) -Marvell: [![Marvell](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/) +Marvell: [![Marvell](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-201709/) Mellanox: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201709/) # sonic-buildimage From 56efb41f55d5c258f3bdbe5ce147cce4e97753d6 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 19 Mar 2018 00:53:47 -0700 Subject: [PATCH 057/274] [image]: remove quote for build_version in /etc/sonic/sonic_version.yml (#1512) commit 0965b33 added quote to build_version in /etc/sonic/sonic_version.yml, e.g., sonic_version : '20170104.10'. scripts to use the $sonic_version need to remove the quote. Signed-off-by: Guohan Lu --- files/image_config/platform/rc.local | 2 +- installer/x86_64/install.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index 2ec4a72e5340..a89b800d12f1 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -171,7 +171,7 @@ for x in "$@"; do done } -sonic_version=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ") +eval sonic_version=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ") if [ -f /host/image-$sonic_version/platform/firsttime ]; then diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index eef0eeee25d2..0e4321345167 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -406,7 +406,7 @@ if [ "$install_env" = "onie" ]; then elif [ "$install_env" = "sonic" ]; then demo_mnt="/host" - running_sonic_revision=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ") + eval running_sonic_revision=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ") # Prevent installing existing SONiC if it is running if [ "$image_dir" = "image-$running_sonic_revision" ]; then echo "Not installing SONiC version $running_sonic_revision, as current running SONiC has the same version" From 651aa917a2008ad264b84a6b5b666f7c8cf8484a Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 19 Mar 2018 09:12:49 -0700 Subject: [PATCH 058/274] [Arista7060] Add PFC configuration (#1506) --- .../Arista-7060CX-32S-C32/buffers.json.j2 | 2 + .../buffers_defaults_t0.j2 | 47 +++++ .../buffers_defaults_t1.j2 | 47 +++++ .../pg_profile_lookup.ini | 17 ++ .../Arista-7060CX-32S-C32/qos.json | 167 ++++++++++++++++++ .../Arista-7060CX-32S-C32/sai.profile | 2 +- 6 files changed, 281 insertions(+), 1 deletion(-) create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers.json.j2 create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t0.j2 create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t1.j2 create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/pg_profile_lookup.ini create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers.json.j2 new file mode 100644 index 000000000000..0b1cb2c541b6 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't1' %} +{%- include 'buffers_config.j2' %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..3e39d411e8bf --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t0.j2 @@ -0,0 +1,47 @@ + +{%- set default_cable = '5m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,128,4) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "11213696", + "type": "ingress", + "mode": "dynamic", + "xoff": "3855488" + }, + "egress_lossy_pool": { + "size": "9532224", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"1518", + "static_th":"3995680" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..d9f562f95624 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t1.j2 @@ -0,0 +1,47 @@ + +{%- set default_cable = '40m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,128,4) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "10443264", + "type": "ingress", + "mode": "dynamic", + "xoff": "4625920" + }, + "egress_lossy_pool": { + "size": "8877440", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"1518", + "static_th":"3995680" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/pg_profile_lookup.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/pg_profile_lookup.ini new file mode 100644 index 000000000000..3b2a417cebcd --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 1248 2288 35776 -4 2288 + 25000 5m 1248 2288 53248 -4 2288 + 40000 5m 1248 2288 66560 -4 2288 + 50000 5m 1248 2288 90272 -4 2288 + 100000 5m 1248 2288 165568 -4 2288 + 10000 40m 1248 2288 37024 -4 2288 + 25000 40m 1248 2288 53248 -4 2288 + 40000 40m 1248 2288 71552 -4 2288 + 50000 40m 1248 2288 96096 -4 2288 + 100000 40m 1248 2288 177632 -4 2288 + 10000 300m 1248 2288 46176 -4 2288 + 25000 300m 1248 2288 79040 -4 2288 + 40000 300m 1248 2288 108160 -4 2288 + 50000 300m 1248 2288 141856 -4 2288 + 100000 300m 1248 2288 268736 -4 2288 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json new file mode 100644 index 000000000000..7e00e14d1974 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json @@ -0,0 +1,167 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"512000", + "red_min_threshold":"512000", + "yellow_max_threshold":"512000", + "yellow_min_threshold":"512000", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + }, + "AZURE_LOSSLESS" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"512000", + "red_min_threshold":"512000", + "yellow_max_threshold":"512000", + "yellow_min_threshold":"512000", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1" : { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124!3-4" : { + "scheduler" : "[SCHEDULER|scheduler.0]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124!0" : { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124!1" : { + "scheduler" : "[SCHEDULER|scheduler.2]" + } + } +} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/sai.profile b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/sai.profile index c04ad3498582..34d698db36b8 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/sai.profile +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-a7060-cx32s-32x100G.config.bcm +SAI_INIT_CONFIG_FILE=/etc/bcm/th-a7060-cx32s-32x100G-t1.config.bcm From 1464014da7c7fd9b520d880b643285f3aa6392a9 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Mon, 19 Mar 2018 17:28:18 -0700 Subject: [PATCH 059/274] [swss]: update swss submodule (#1514) Signed-off-by: Sihui Han --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 2ae1714aa3e2..ce78bf568500 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 2ae1714aa3e285bc9a311c10b5c899b5ec6b76cc +Subproject commit ce78bf568500397dac5b2f2cd1a9779cfc50ff62 From 6d592d832935255826e45de1284f23df7538c5a9 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Mon, 19 Mar 2018 17:44:16 -0700 Subject: [PATCH 060/274] [build_template]: combine the init config write into one block (#1513) Signed-off-by: Sihui Han --- files/build_templates/sonic_debian_extension.j2 | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 434e427abe13..91ee8519e83e 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -165,12 +165,7 @@ sudo bash -c "echo dhcp_as_static=true >> $FILESYSTEM_ROOT/etc/sonic/updategraph {% else %} sudo bash -c "echo enabled=false > $FILESYSTEM_ROOT/etc/sonic/updategraph.conf" {% endif %} -{% if shutdown_bgp_on_start == "y" %} -sudo bash -c "echo '{ \"DEVICE_METADATA\": { \"localhost\": { \"default_bgp_status\": \"down\" } } }' >> $FILESYSTEM_ROOT/etc/sonic/init_cfg.json" -{% endif %} -{% if enable_pfcwd_on_start == "y" %} -sudo bash -c "echo '{ \"DEVICE_METADATA\": { \"localhost\": { \"default_pfcwd_status\": \"enable\" } } }' >> $FILESYSTEM_ROOT/etc/sonic/init_cfg.json" -{% endif %} +sudo bash -c "echo '{ \"DEVICE_METADATA\": { \"localhost\": { \"default_bgp_status\": {% if shutdown_bgp_on_start == "y" %}\"down\"{% else %}\"up\"{% endif %}, \"default_pfcwd_status\": {% if enable_pfcwd_on_start == "y" %}\"enable\"{% else %}\"disable\"{% endif %} } } }' >> $FILESYSTEM_ROOT/etc/sonic/init_cfg.json" # Copy SNMP configuration files sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/ From 06a823d3fbe8f770eaeefe810249ab4576ee5ff0 Mon Sep 17 00:00:00 2001 From: jostar-yang Date: Tue, 20 Mar 2018 14:40:12 +0800 Subject: [PATCH 061/274] [devices]: Add build as7716-32xb to platform-modules-accton.mk file (#1496) * Add build as7716-32xb to mk file * Add as7716-32xb build to onie-image.mk * Add as7716-32xb to debian build --- platform/broadcom/one-image.mk | 1 + platform/broadcom/platform-modules-accton.mk | 7 +++++++ platform/broadcom/sonic-platform-modules-accton | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 4fe92e9a3366..908c99c05f9a 100755 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -17,6 +17,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(ACCTON_AS7816_64X_PLATFORM_MODULE) \ $(ACCTON_AS7716_32X_PLATFORM_MODULE) \ $(ACCTON_AS7312_54X_PLATFORM_MODULE) \ + $(ACCTON_AS7716_32XB_PLATFORM_MODULE) \ $(INVENTEC_D7032Q28B_PLATFORM_MODULE) \ $(INVENTEC_D7054Q28B_PLATFORM_MODULE) \ $(CEL_DX010_PLATFORM_MODULE) \ diff --git a/platform/broadcom/platform-modules-accton.mk b/platform/broadcom/platform-modules-accton.mk index db207673b995..63d277b47e6f 100755 --- a/platform/broadcom/platform-modules-accton.mk +++ b/platform/broadcom/platform-modules-accton.mk @@ -5,12 +5,14 @@ ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS7816_64X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS7716_32X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS7312_54X_PLATFORM_MODULE_VERSION = 1.1 +ACCTON_AS7716_32XB_PLATFORM_MODULE_VERSION = 1.1 export ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION export ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION export ACCTON_AS7816_64X_PLATFORM_MODULE_VERSION export ACCTON_AS7716_32X_PLATFORM_MODULE_VERSION export ACCTON_AS7312_54X_PLATFORM_MODULE_VERSION +export ACCTON_AS7716_32XB_PLATFORM_MODULE_VERSION ACCTON_AS7712_32X_PLATFORM_MODULE = sonic-platform-accton-as7712-32x_$(ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION)_amd64.deb $(ACCTON_AS7712_32X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-accton @@ -33,3 +35,8 @@ $(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS ACCTON_AS7312_54X_PLATFORM_MODULE = sonic-platform-accton-as7312-54x_$(ACCTON_AS7312_54X_PLATFORM_MODULE_VERSION)_amd64.deb $(ACCTON_AS7312_54X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7312_54x-r0 $(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS7312_54X_PLATFORM_MODULE))) + +ACCTON_AS7716_32XB_PLATFORM_MODULE = sonic-platform-accton-as7716-32xb_$(ACCTON_AS7716_32XB_PLATFORM_MODULE_VERSION)_amd64.deb +$(ACCTON_AS7716_32XB_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7716_32xb-r0 +$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS7716_32XB_PLATFORM_MODULE))) + diff --git a/platform/broadcom/sonic-platform-modules-accton b/platform/broadcom/sonic-platform-modules-accton index 1168e266b0af..296471b9cd53 160000 --- a/platform/broadcom/sonic-platform-modules-accton +++ b/platform/broadcom/sonic-platform-modules-accton @@ -1 +1 @@ -Subproject commit 1168e266b0af7dc8f66ec583a1861eef74056283 +Subproject commit 296471b9cd538dd0d10bd7d9c6a7d05ffc0ba45a From 957e6c0b6db43dc4614f791cf53f4775e0a52b89 Mon Sep 17 00:00:00 2001 From: Rodny Molina Date: Tue, 20 Mar 2018 11:25:31 -0700 Subject: [PATCH 062/274] Fixing lldp issue displaying mac-addr instead of ports (#1515) Current lldp.conf.j2 template demands the presence of MGMT_INTERFACE attribute in configDB, and by extension, also in config_db.json file. However, MGMT_INTERFACE configuration attribute is optional, so lldp shouldn't bail out if this one isn't provided in configuration. For this reason, no lldp.conf file is ever created in lldp's container, and lldpd defaults to advertise the mac-address of the connected interface, instead of the interface name. The fix is to simply relax this jinja2 statement to verify if MGMT_INTERFACE attribute is present. --- dockers/docker-lldp-sv2/lldpd.conf.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dockers/docker-lldp-sv2/lldpd.conf.j2 b/dockers/docker-lldp-sv2/lldpd.conf.j2 index 165ded79f392..ea8be54b097d 100644 --- a/dockers/docker-lldp-sv2/lldpd.conf.j2 +++ b/dockers/docker-lldp-sv2/lldpd.conf.j2 @@ -1,4 +1,6 @@ +{% if MGMT_INTERFACE %} configure ports eth0 lldp portidsubtype local {{ MGMT_INTERFACE.keys()[0][0] }} +{% endif %} {% for local_port in DEVICE_NEIGHBOR %} configure ports {{ local_port }} lldp portidsubtype local {{ PORT[local_port]['alias'] }} description {{ DEVICE_NEIGHBOR[local_port]['name'] }}:{{ DEVICE_NEIGHBOR[local_port]['port'] }} {% endfor %} From d142f3ceb258e4c09ad5f369f156cef391e5e2f7 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Tue, 20 Mar 2018 23:23:13 +0200 Subject: [PATCH 063/274] [config-engine]: Fix 'get_sonic_version_info' API to return valid info (#1517) Signed-off-by: Volodymyr Samotiy --- src/sonic-config-engine/sonic_platform.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-config-engine/sonic_platform.py b/src/sonic-config-engine/sonic_platform.py index feff5be5f50a..f573d6a6575d 100644 --- a/src/sonic-config-engine/sonic_platform.py +++ b/src/sonic-config-engine/sonic_platform.py @@ -33,10 +33,10 @@ def get_platform_info(machine_info): return None def get_sonic_version_info(): - if not os.path.isfile('/etc/sonic/version.yml'): + if not os.path.isfile('/etc/sonic/sonic_version.yml'): return None data = {} - with open('/etc/sonic/version.yml') as stream: + with open('/etc/sonic/sonic_version.yml') as stream: data = yaml.load(stream) return data From 87e942343f9c06ffd02aa0f85833965f6544e53d Mon Sep 17 00:00:00 2001 From: Harish Venkatraman Date: Wed, 21 Mar 2018 09:28:23 -0700 Subject: [PATCH 064/274] [device/dell] Added dynamic sai.profile generation (#1518) * [device/dell] Added dynamic sai.profile generation This commit addds new code for generating dynamic sai.profile file. The sai.profile.j2 will generate the sai.profile dynamically based on the topology. It will generate the sai.profile under /etc/sai.d/ directory in syncd. Before syncd is started this J2 file will be run from the start.sh file from /usr/bin/ directory. Since the sai.profile is dynamically generated the old sai.profile file is not required so deleted the file for S6100. It also address couple of more changes for port_config.ini support is added for speed in the file which can be used later to find the port speed. Also the buffer_default_t*.j2 file the ports should be from 0 to 64 changed. Unit tested the code on S6100 for dynamic generation of sai.profile file for both T0 and T1 and the file was created in /etc/sai.d/sai.profile Similarly tested the sonic binary on S6000 to make sure that the sai.profile is copied from the /usr/share/sonic/hwsku/sai.profile to /etc/sai.d/sai.profile. Signed-off-by: Harish Venkatraman * [sonic-buildimage] Updating module sai-redis Updating the sonic-sairedis point. Signed-off-by: Harish Venkatraman --- .../Force10-S6100/buffers_defaults_t0.j2 | 2 +- .../Force10-S6100/buffers_defaults_t1.j2 | 2 +- .../Force10-S6100/port_config.ini | 130 +++++++++--------- .../Force10-S6100/sai.profile | 1 - .../Force10-S6100/sai.profile.j2 | 13 ++ platform/broadcom/docker-syncd-brcm/start.sh | 12 ++ src/sonic-sairedis | 2 +- 7 files changed, 93 insertions(+), 69 deletions(-) delete mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile.j2 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t0.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t0.j2 index 7464d31b8e69..e337f676b650 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t0.j2 +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t0.j2 @@ -3,7 +3,7 @@ {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} - {%- for port_idx in range(0,63) %} + {%- for port_idx in range(0,64) %} {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} {%- endfor %} {%- endmacro %} diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t1.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t1.j2 index d367dba3f74f..c7c98bfe4299 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t1.j2 +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t1.j2 @@ -3,7 +3,7 @@ {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} - {%- for port_idx in range(0,63) %} + {%- for port_idx in range(0,64) %} {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} {%- endfor %} {%- endmacro %} diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/port_config.ini b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/port_config.ini index 8b09a1e71f74..1922a3e04b5a 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/port_config.ini +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/port_config.ini @@ -1,65 +1,65 @@ -# name lanes alias index -Ethernet0 101,102 fortyGigE1/1/1 0 -Ethernet1 103,104 fortyGigE1/1/2 1 -Ethernet2 97,98 fortyGigE1/1/3 2 -Ethernet3 99,100 fortyGigE1/1/4 3 -Ethernet4 69,70 fortyGigE1/1/5 4 -Ethernet5 71,72 fortyGigE1/1/6 5 -Ethernet6 65,66 fortyGigE1/1/7 6 -Ethernet7 67,68 fortyGigE1/1/8 7 -Ethernet8 53,54 fortyGigE1/1/9 8 -Ethernet9 55,56 fortyGigE1/1/10 9 -Ethernet10 49,50 fortyGigE1/1/11 10 -Ethernet11 51,52 fortyGigE1/1/12 11 -Ethernet12 21,22 fortyGigE1/1/13 12 -Ethernet13 23,24 fortyGigE1/1/14 13 -Ethernet14 17,18 fortyGigE1/1/15 14 -Ethernet15 19,20 fortyGigE1/1/16 15 -Ethernet16 25,26 fortyGigE1/2/1 16 -Ethernet17 27,28 fortyGigE1/2/2 17 -Ethernet18 29,30 fortyGigE1/2/3 18 -Ethernet19 31,32 fortyGigE1/2/4 19 -Ethernet20 57,58 fortyGigE1/2/5 20 -Ethernet21 59,60 fortyGigE1/2/6 21 -Ethernet22 61,62 fortyGigE1/2/7 22 -Ethernet23 63,64 fortyGigE1/2/8 23 -Ethernet24 73,74 fortyGigE1/2/9 24 -Ethernet25 75,76 fortyGigE1/2/10 25 -Ethernet26 77,78 fortyGigE1/2/11 26 -Ethernet27 79,80 fortyGigE1/2/12 27 -Ethernet28 105,106 fortyGigE1/2/13 28 -Ethernet29 107,108 fortyGigE1/2/14 29 -Ethernet30 109,110 fortyGigE1/2/15 30 -Ethernet31 111,112 fortyGigE1/2/16 31 -Ethernet32 13,14 fortyGigE1/3/1 32 -Ethernet33 15,16 fortyGigE1/3/2 33 -Ethernet34 9,10 fortyGigE1/3/3 34 -Ethernet35 11,12 fortyGigE1/3/4 35 -Ethernet36 125,126 fortyGigE1/3/5 36 -Ethernet37 127,128 fortyGigE1/3/6 37 -Ethernet38 121,122 fortyGigE1/3/7 38 -Ethernet39 123,124 fortyGigE1/3/8 39 -Ethernet40 93,94 fortyGigE1/3/9 40 -Ethernet41 95,96 fortyGigE1/3/10 41 -Ethernet42 89,90 fortyGigE1/3/11 42 -Ethernet43 91,92 fortyGigE1/3/12 43 -Ethernet44 45,46 fortyGigE1/3/13 44 -Ethernet45 47,48 fortyGigE1/3/14 45 -Ethernet46 41,42 fortyGigE1/3/15 46 -Ethernet47 43,44 fortyGigE1/3/16 47 -Ethernet48 113,114 fortyGigE1/4/1 48 -Ethernet49 115,116 fortyGigE1/4/2 49 -Ethernet50 117,118 fortyGigE1/4/3 50 -Ethernet51 119,120 fortyGigE1/4/4 51 -Ethernet52 1,2 fortyGigE1/4/5 52 -Ethernet53 3,4 fortyGigE1/4/6 53 -Ethernet54 5,6 fortyGigE1/4/7 54 -Ethernet55 7,8 fortyGigE1/4/8 55 -Ethernet56 33,34 fortyGigE1/4/9 56 -Ethernet57 35,36 fortyGigE1/4/10 57 -Ethernet58 37,38 fortyGigE1/4/11 58 -Ethernet59 39,40 fortyGigE1/4/12 59 -Ethernet60 81,82 fortyGigE1/4/13 60 -Ethernet61 83,84 fortyGigE1/4/14 61 -Ethernet62 85,86 fortyGigE1/4/15 62 -Ethernet63 87,88 fortyGigE1/4/16 63 +# name lanes alias index speed +Ethernet0 101,102 fortyGigE1/1/1 0 40000 +Ethernet1 103,104 fortyGigE1/1/2 1 40000 +Ethernet2 97,98 fortyGigE1/1/3 2 40000 +Ethernet3 99,100 fortyGigE1/1/4 3 40000 +Ethernet4 69,70 fortyGigE1/1/5 4 40000 +Ethernet5 71,72 fortyGigE1/1/6 5 40000 +Ethernet6 65,66 fortyGigE1/1/7 6 40000 +Ethernet7 67,68 fortyGigE1/1/8 7 40000 +Ethernet8 53,54 fortyGigE1/1/9 8 40000 +Ethernet9 55,56 fortyGigE1/1/10 9 40000 +Ethernet10 49,50 fortyGigE1/1/11 10 40000 +Ethernet11 51,52 fortyGigE1/1/12 11 40000 +Ethernet12 21,22 fortyGigE1/1/13 12 40000 +Ethernet13 23,24 fortyGigE1/1/14 13 40000 +Ethernet14 17,18 fortyGigE1/1/15 14 40000 +Ethernet15 19,20 fortyGigE1/1/16 15 40000 +Ethernet16 25,26 fortyGigE1/2/1 16 40000 +Ethernet17 27,28 fortyGigE1/2/2 17 40000 +Ethernet18 29,30 fortyGigE1/2/3 18 40000 +Ethernet19 31,32 fortyGigE1/2/4 19 40000 +Ethernet20 57,58 fortyGigE1/2/5 20 40000 +Ethernet21 59,60 fortyGigE1/2/6 21 40000 +Ethernet22 61,62 fortyGigE1/2/7 22 40000 +Ethernet23 63,64 fortyGigE1/2/8 23 40000 +Ethernet24 73,74 fortyGigE1/2/9 24 40000 +Ethernet25 75,76 fortyGigE1/2/10 25 40000 +Ethernet26 77,78 fortyGigE1/2/11 26 40000 +Ethernet27 79,80 fortyGigE1/2/12 27 40000 +Ethernet28 105,106 fortyGigE1/2/13 28 40000 +Ethernet29 107,108 fortyGigE1/2/14 29 40000 +Ethernet30 109,110 fortyGigE1/2/15 30 40000 +Ethernet31 111,112 fortyGigE1/2/16 31 40000 +Ethernet32 13,14 fortyGigE1/3/1 32 40000 +Ethernet33 15,16 fortyGigE1/3/2 33 40000 +Ethernet34 9,10 fortyGigE1/3/3 34 40000 +Ethernet35 11,12 fortyGigE1/3/4 35 40000 +Ethernet36 125,126 fortyGigE1/3/5 36 40000 +Ethernet37 127,128 fortyGigE1/3/6 37 40000 +Ethernet38 121,122 fortyGigE1/3/7 38 40000 +Ethernet39 123,124 fortyGigE1/3/8 39 40000 +Ethernet40 93,94 fortyGigE1/3/9 40 40000 +Ethernet41 95,96 fortyGigE1/3/10 41 40000 +Ethernet42 89,90 fortyGigE1/3/11 42 40000 +Ethernet43 91,92 fortyGigE1/3/12 43 40000 +Ethernet44 45,46 fortyGigE1/3/13 44 40000 +Ethernet45 47,48 fortyGigE1/3/14 45 40000 +Ethernet46 41,42 fortyGigE1/3/15 46 40000 +Ethernet47 43,44 fortyGigE1/3/16 47 40000 +Ethernet48 113,114 fortyGigE1/4/1 48 40000 +Ethernet49 115,116 fortyGigE1/4/2 49 40000 +Ethernet50 117,118 fortyGigE1/4/3 50 40000 +Ethernet51 119,120 fortyGigE1/4/4 51 40000 +Ethernet52 1,2 fortyGigE1/4/5 52 40000 +Ethernet53 3,4 fortyGigE1/4/6 53 40000 +Ethernet54 5,6 fortyGigE1/4/7 54 40000 +Ethernet55 7,8 fortyGigE1/4/8 55 40000 +Ethernet56 33,34 fortyGigE1/4/9 56 40000 +Ethernet57 35,36 fortyGigE1/4/10 57 40000 +Ethernet58 37,38 fortyGigE1/4/11 58 40000 +Ethernet59 39,40 fortyGigE1/4/12 59 40000 +Ethernet60 81,82 fortyGigE1/4/13 60 40000 +Ethernet61 83,84 fortyGigE1/4/14 61 40000 +Ethernet62 85,86 fortyGigE1/4/15 62 40000 +Ethernet63 87,88 fortyGigE1/4/16 63 40000 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile deleted file mode 100644 index 78b0dec06d5d..000000000000 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile +++ /dev/null @@ -1 +0,0 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-s6100-64x40G-t0.config.bcm diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile.j2 new file mode 100644 index 000000000000..92cda77668f6 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile.j2 @@ -0,0 +1,13 @@ +{# Get sai.profile based on switch_role #} +{%- if DEVICE_METADATA is defined -%} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] -%} +{%- if switch_role.lower() == 'torrouter' %} +{% set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/etc/bcm/th-s6100-64x40G-t0.config.bcm' -%} +{%- else %} +{%- set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/etc/bcm/th-s6100-64x40G-t1.config.bcm' -%} +{%- endif %} +{%- else %} +{%- set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/etc/bcm/th-s6100-64x40G-t1.config.bcm' -%} +{%- endif %} +{# Write the contents of sai_ profile_filename to sai.profile file #} +{{ sai_profile_contents }} diff --git a/platform/broadcom/docker-syncd-brcm/start.sh b/platform/broadcom/docker-syncd-brcm/start.sh index e06a29b2b2a8..d2180bce1ed7 100755 --- a/platform/broadcom/docker-syncd-brcm/start.sh +++ b/platform/broadcom/docker-syncd-brcm/start.sh @@ -1,11 +1,23 @@ #!/usr/bin/env bash PLATFORM_DIR=/usr/share/sonic/platform +HWSKU_DIR=/usr/share/sonic/hwsku rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd +mkdir -p /etc/sai.d/ + +# Create/Copy the sai.profile to /etc/sai.d/sai.profile +if [ -f $HWSKU_DIR/sai.profile.j2 ]; then + sonic-cfggen -d -t $HWSKU_DIR/sai.profile.j2 > /etc/sai.d/sai.profile +else + if [ -f $HWSKU_DIR/sai.profile ]; then + cp $HWSKU_DIR/sai.profile /etc/sai.d/sai.profile + fi +fi + supervisorctl start syncd # Function: wait until syncd has created the socket for bcmcmd to connect to diff --git a/src/sonic-sairedis b/src/sonic-sairedis index e9ad72132f09..d35642238905 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit e9ad72132f09f37418b9ecd9d0c6708afac6db6f +Subproject commit d35642238905ae4e9a0d259797b578eddd5a7156 From dda00292f3ebef8b39aea78119d0e3d097e8e0fd Mon Sep 17 00:00:00 2001 From: padmanarayana Date: Thu, 22 Mar 2018 01:45:05 +0530 Subject: [PATCH 065/274] Sonic fstrim (#1520) * Update Dell submodule for fstrim support * Revert PR 1500 since fstrim files are now part of submodule --- build_debian.sh | 3 --- platform/broadcom/sonic-platform-modules-dell | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index c35ca03297e4..2b2294194d7b 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -247,9 +247,6 @@ sudo augtool --autosave "set /files/etc/ssh/sshd_config/UseDNS no" -r $FILESYSTE sudo sed -i 's/^ListenAddress ::/#ListenAddress ::/' $FILESYSTEM_ROOT/etc/ssh/sshd_config sudo sed -i 's/^#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' $FILESYSTEM_ROOT/etc/ssh/sshd_config -## Copy fstrim service -sudo cp $FILESYSTEM_ROOT/usr/share/doc/util-linux/examples/fstrim.{service,timer} $FILESYSTEM_ROOT/etc/systemd/system - ## Config monit sudo sed -i ' s/^# set logfile syslog/set logfile syslog/; diff --git a/platform/broadcom/sonic-platform-modules-dell b/platform/broadcom/sonic-platform-modules-dell index 8d4517d0f94d..8bc799d26011 160000 --- a/platform/broadcom/sonic-platform-modules-dell +++ b/platform/broadcom/sonic-platform-modules-dell @@ -1 +1 @@ -Subproject commit 8d4517d0f94dd34b232e3fc03f62f11b2c2cb863 +Subproject commit 8bc799d26011622be07e03f888b4dd4c6b014d38 From 94c90cd5e59d53df0374218422bc56f4aeb44c28 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 22 Mar 2018 18:24:32 -0700 Subject: [PATCH 066/274] Make Dell S6100 and Z9100 psuutil.py plugins compliant with Python 3.6 (#1523) --- device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py | 2 +- device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py index b753cd711dae..5f9661a51e3c 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py @@ -24,7 +24,7 @@ def get_pmc_register(self, reg_name): retval = 'ERR' mb_reg_file = mailbox_dir+'/' + reg_name if (not os.path.isfile(mb_reg_file)): - print mb_reg_file, 'not found !' + logging.error(mb_reg_file, "not found !") return retval try: diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py index 2e07ee818818..66253850e6ff 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py @@ -24,7 +24,7 @@ def get_pmc_register(self, reg_name): retval = 'ERR' mb_reg_file = mailbox_dir+'/' + reg_name if (not os.path.isfile(mb_reg_file)): - print mb_reg_file, 'not found !' + logging.error(mb_reg_file, "not found !") return retval try: From baa9d45343aeeb313f4154dd60aff73108f53642 Mon Sep 17 00:00:00 2001 From: StanleyCi <34563271+StanleyCi@users.noreply.github.com> Date: Sat, 24 Mar 2018 01:45:01 +0800 Subject: [PATCH 067/274] [devices]:Add attributes for cpupld and swpld. (#1516) Signed-off-by: Stanley Chi --- .../ag9064/modules/Makefile | 2 + .../ag9064/modules/delta_ag9064_common.h | 567 ++++++++++++ .../ag9064/modules/delta_ag9064_cpld.c | 860 ++++++++++++++++++ .../ag9064/modules/delta_ag9064_platform.c | 844 +---------------- .../ag9064/modules/delta_ag9064_swpld.c | 620 +++++++++++++ .../debian/platform-modules-ag9064.init | 2 + 6 files changed, 2095 insertions(+), 800 deletions(-) create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_common.h create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_swpld.c diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/Makefile b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/Makefile index 53589d555416..124e0ff5b820 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/Makefile @@ -1,4 +1,6 @@ obj-m += delta_ag9064_platform.o +obj-m += delta_ag9064_cpld.o +obj-m += delta_ag9064_swpld.o obj-m += i2c-mei.o i2c-mei-objs := i2c-mei_io.o i2c-mei_main.o i2c-mei_rw.o diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_common.h b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_common.h new file mode 100644 index 000000000000..f30081a8829e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_common.h @@ -0,0 +1,567 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define IPMI_MAX_INTF (4) +#define DELTA_NETFN 0x38 +#define BMC_BUS_5 0x04 +#define CMD_SETDATA 0x03 +#define CMD_GETDATA 0x02 + +#define CPUPLD_ADDR 0x31 +#define SWPLD1_ADDR 0x35 +#define SWPLD2_ADDR 0x34 +#define SWPLD3_ADDR 0x33 +#define SWPLD4_ADDR 0x32 +#define QSFP_PORT_MUX_REG 0x13 + +#define DEFAULT_NUM 1 +#define BUS9_DEV_NUM 64 +#define BUS9_BASE_NUM 20 + +extern int dni_bmc_cmd(char set_cmd, char *cmd_data, int cmd_data_len); +extern int dni_create_user(void); +extern unsigned char dni_log2 (unsigned char num); + +extern void device_release(struct device *dev); +extern void msg_handler(struct ipmi_recv_msg *recv_msg,void* handler_data); +extern void dummy_smi_free(struct ipmi_smi_msg *msg); +extern void dummy_recv_free(struct ipmi_recv_msg *msg); + +static ipmi_user_t ipmi_mh_user = NULL; +static struct ipmi_user_hndl ipmi_hndlrs = { .ipmi_recv_hndl = msg_handler,}; +static atomic_t dummy_count = ATOMIC_INIT(0); + +static struct ipmi_smi_msg halt_smi_msg = { + .done = dummy_smi_free +}; +static struct ipmi_recv_msg halt_recv_msg = { + .done = dummy_recv_free +}; + +enum{ + BUS0 = 0, + BUS1, + BUS2, + BUS3, + BUS4, + BUS5, + BUS6, + BUS7, + BUS8, + BUS9, + BUS10, + BUS11, + BUS12, + BUS13, + BUS14, +}; + +static struct cpld_attribute_data { + uint8_t bus; + uint8_t addr; + uint8_t reg; + uint8_t mask; + char note[200]; +}; + + +enum cpld_type { + system_cpld, + swpld1, + swpld2, + swpld3, + swpld4, +}; + +struct cpld_platform_data { + int reg_addr; + struct i2c_client *client; +}; + +static struct cpld_platform_data ag9064_cpld_platform_data[] = { + [system_cpld] = { + .reg_addr = CPUPLD_ADDR, + }, +}; + +static struct cpld_platform_data ag9064_swpld1_platform_data[] = { + [swpld1] = { + .reg_addr = SWPLD1_ADDR, + }, +}; + +static struct cpld_platform_data ag9064_swpld2_platform_data[] = { + [swpld2] = { + .reg_addr = SWPLD2_ADDR, + }, +}; + +static struct cpld_platform_data ag9064_swpld3_platform_data[] = { + [swpld3] = { + .reg_addr = SWPLD3_ADDR, + }, +}; + +static struct cpld_platform_data ag9064_swpld4_platform_data[] = { + [swpld4] = { + .reg_addr = SWPLD4_ADDR, + }, +}; + +enum cpld_attributes { + CPLD_REG_ADDR, + CPLD_REG_VALUE, + SWPLD1_REG_ADDR, + SWPLD1_REG_VALUE, + SWPLD2_REG_ADDR, + SWPLD2_REG_VALUE, + SWPLD3_REG_ADDR, + SWPLD3_REG_VALUE, + SWPLD4_REG_ADDR, + SWPLD4_REG_VALUE, + //CPLD + CPLD_VER, + CPU_BOARD_VER, + CPU_ID, + MB_ID, + MB_VER, + CPU0_PWR_OK, + PSU_OVER_TEMP, + PWR_RAIL_OVER_TEMP, + CPU_DISOMIC_OVER_TEMP, + DDR_OVER_TEMP, + CPLD_PWR_ON_RST, + CPLD_HARD_RST, + CPLD_RST, + MB_PWR, + MB_RST, + PSU_FAN_INT, + OP_MODULE_INT, +//SWPLD1 + SWPLD1_MAJOR_VER, + SWPLD1_MINOR_VER, + SWPLD1_SCRTCH_REG, + PSU1_PWR_OK, + PSU1_INT, + PSU2_PWR_OK, + PSU2_INT, + SYNCE_INT, + SYNCE_RST, + SYNCE_EEPROM_WP, + PSU1_GREEN_LED, + PSU1_RED_LED, + PSU2_GREEN_LED, + PSU2_RED_LED, + PSU_LED_MODE, +//SWPLD2 + SWPLD2_MAJOR_VER, + SWPLD2_MINOR_VER, + SWPLD2_SCRTCH_REG, + FAN_LED, + SYS_LED, + FAN_MOD1_LED, + FAN_MOD2_LED, + FAN_MOD3_LED, + FAN_MOD4_LED, +//SWPLD3 + SWPLD3_MAJOR_VER, + SWPLD3_MINOR_VER, + SWPLD3_SCRTCH_REG, + SB_VER, + PLATFORM_TYPE, +//SWPLD4 + SWPLD4_MAJOR_VER, + SWPLD4_MINOR_VER, + SWPLD4_SCRTCH_REG, + BMC_RST, + CPLD_LPC_RST, + CPLD_SW_RST, + MB_CPLD_RST, + BCM56970_RST, + CPLD_UPGRADE_RST, + MB_RST_CPLD, + CPU_RST_MB_OOB, + GPIO_PHY_RST, + PSU_FAN_EVENT, + CPU_THERMAL_INT, + FAN_INT, + CPLD_SPI_WP, + RJ45_CONSOLE_SEL, + SYSTEM_INT, + CPLD_MB_RST_DONE, + MB_PWR_OK, + FAN_EEPROM_WP, +}; + +static struct cpld_attribute_data attribute_data[] = { + [CPLD_REG_ADDR] = { + }, + [CPLD_REG_VALUE] = { + }, + [SWPLD1_REG_ADDR] = { + }, + [SWPLD1_REG_VALUE] = { + }, + [SWPLD2_REG_ADDR] = { + }, + [SWPLD2_REG_VALUE] = { + }, + [SWPLD3_REG_ADDR] = { + }, + [SWPLD3_REG_VALUE] = { + }, + [SWPLD4_REG_ADDR] = { + }, + [SWPLD4_REG_VALUE] = { + }, +//CPLD + [CPLD_VER] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x01, .mask = 0xFF, + .note = "CPLD Version, controlled by CPLD editor" + }, + [CPU_BOARD_VER] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x02, .mask = 0xF0, + .note = "“0x0”: proto A1\n“0x1”: proto A2\n“0x2”: PR (Production)" + }, + [CPU_ID] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x02, .mask = 0x0F, + .note = "“0x0”: C2558 ECC\n“0x1”: Rangeley ECC\n“0x2”: BROADWELL-DE ECC" + }, + [MB_ID] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x03, .mask = 0xFF, + .note = "“0x00”: proto A1\n“0x01”: proto A2\n“0x02”: PR (Production)" + }, + [MB_VER] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x04, .mask = 0x0F, + .note = "“0x0”: proto-A\n“0x1”: proto-B" + }, + [CPU0_PWR_OK] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x08, .mask = 1 << 3, + .note = "“1” =Power rail is good\n“0” = Power rail is failed" + }, + [PSU_OVER_TEMP] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x0b, .mask = 1 << 4, + .note = "“1” = Not over temperature\n“0” = Over temperature" + }, + [PWR_RAIL_OVER_TEMP] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x0b, .mask = 1 << 3, + .note = "“1” = Not over temperature\n“0” = Over temperature" + }, + [CPU_DISOMIC_OVER_TEMP] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x0b, .mask = 1 << 1, + .note = "“1” = Not over temperature\n“0” = Over temperature" + }, + [DDR_OVER_TEMP] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x0b, .mask = 1 << 0, + .note = "“1” = Not over temperature\n“0” = Over temperature" + }, + [CPLD_PWR_ON_RST] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x11, .mask = 1 << 4, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [CPLD_HARD_RST] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x11, .mask = 1 << 2, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [CPLD_RST] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x11, .mask = 1 << 0, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [MB_PWR] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x12, .mask = 1 << 2, + .note = "“0” = Power rail is failed\n“1” =Power rail is good" + }, + [MB_RST] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x12, .mask = 1 << 0, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [PSU_FAN_INT] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x15, .mask = 1 << 1, + .note = "“0” = Interrupt occurs\n“1” = Interrupt doesn't occur" + }, + [OP_MODULE_INT] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x15, .mask = 1 << 0, + .note = "“0” = Interrupt occurs\n“1” = Interrupt doesn't occur" + }, +//SWPLD1 + [SWPLD1_MAJOR_VER] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x00, .mask = 0xF0, + .note = "CPLD Major Version, controlled by CPLD editor." + }, + [SWPLD1_MINOR_VER] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x00, .mask = 0x0F, + .note = "CPLD Minor Version, controlled by CPLD editor." + }, + [SWPLD1_SCRTCH_REG] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x01, .mask = 0xFF, + .note = "CPLD read/write test register, to provide a way to test CPLD access." + }, + [PSU1_PWR_OK] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x02, .mask = 1 << 6, + .note = "‘0’ = Power rail is good\n‘1’ = Power rail is failed" + }, + [PSU1_INT] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x02, .mask = 1 << 5, + .note = "‘0’ = Interrupt doesn’t occur\n‘1’ = Interrupt occurs" + }, + [PSU2_PWR_OK] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x02, .mask = 1 << 2, + .note = "‘0’ = Power rail is good\n‘1’ = Power rail is failed" + }, + [PSU2_INT] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x02, .mask = 1 << 1, + .note = "‘0’ = Interrupt doesn’t occur\n‘1’ = Interrupt occurs" + }, + [SYNCE_INT] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x12, .mask = 1 << 7, + .note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" + }, + [SYNCE_RST] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x12, .mask = 1 << 6, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [SYNCE_EEPROM_WP] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x12, .mask = 1 << 5, + .note = "“1” = enables the lock-down mechanism.\n“0” = overrides the lock-down function enabling blocks to be erased or programmed using software commands." + }, + [PSU1_GREEN_LED] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x13, .mask = 1 << 7, + .note = "“0”: Solid Green – Power Supply 1 is supplied to the switch & operating normally\n“1”: OFF" + }, + [PSU1_RED_LED] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x13, .mask = 1 << 6, + .note = "“0”: Solid Red – Power Supply 1 is supplied to the switch & operating normally\n“1”: OFF" + }, + [PSU2_GREEN_LED] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x13, .mask = 1 << 5, + .note = "“0”: Solid Green – Power Supply 2 is supplied to the switch & operating normally\n“1”: OFF" + }, + [PSU2_RED_LED] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x13, .mask = 1 << 4, + .note = "“0”: Solid Red – Power Supply 1=2 is supplied to the switch & operating normally\n“1”: OFF" + }, + [PSU_LED_MODE] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x13, .mask = 1 << 0, + .note = "“0”: PSU LED can be changed manually\n“1”: PSU LED can’t be changed manually" + }, +//SWPLD2 + [SWPLD2_MAJOR_VER] = { + .bus = BUS0, .addr = SWPLD2_ADDR, + .reg = 0x00, .mask =0xF0 , + .note = "CPLD Major Version, controlled by CPLD editor." + }, + [SWPLD2_MINOR_VER] = { + .bus = BUS0, .addr = SWPLD2_ADDR, + .reg = 0x00, .mask = 0x0F, + .note = "CPLD Minor Version, controlled by CPLD editor." + }, + [SWPLD2_SCRTCH_REG] = { + .bus = BUS0, .addr = SWPLD2_ADDR, + .reg = 0x01, .mask = 0xFF, + .note = "CPLD read/write test register, to provide a way to test CPLD access." + }, + [FAN_LED] = { + .bus = BUS0, .addr = SWPLD2_ADDR, + .reg = 0x02, .mask = 0xC0, + .note = "“00’/”11”: OFF\n“01”: Solid Green – FANs are operating normally\n“10”: Solid Amber – FANs are Error" + }, + [SYS_LED] = { + .bus = BUS0, .addr = SWPLD2_ADDR, + .reg = 0x02, .mask = 0x30, + .note = "‘00’: Off\n‘01’: Solid Green – Normal operation\n‘10’: Blinking Green – Booting Progress\n‘11’: Solid Red – System Fail" + }, + [FAN_MOD1_LED] = { + .bus = BUS0, .addr = SWPLD2_ADDR, + .reg = 0x1b, .mask = 1 << 7, + .note = "‘0’ = Amber\n‘1’ = Green" + }, + [FAN_MOD2_LED] = { + .bus = BUS0, .addr = SWPLD2_ADDR, + .reg = 0x1b, .mask = 1 << 6, + .note = "‘0’ = Amber\n‘1’ = Green" + }, + [FAN_MOD3_LED] = { + .bus = BUS0, .addr = SWPLD2_ADDR, + .reg = 0x1b, .mask = 1 << 5, + .note = "‘0’ = Amber\n‘1’ = Green" + }, + [FAN_MOD4_LED] = { + .bus = BUS0, .addr = SWPLD2_ADDR, + .reg = 0x1b, .mask = 1 << 4, + .note = "‘0’ = Amber\n‘1’ = Green" + }, +//SWPLD3 + [SWPLD3_MAJOR_VER] = { + .bus = BUS0, .addr = SWPLD3_ADDR, + .reg = 0x00, .mask = 0xF0, + .note = "CPLD Major Version, controlled by CPLD editor." + }, + [SWPLD3_MINOR_VER] = { + .bus = BUS0, .addr = SWPLD3_ADDR, + .reg = 0x00, .mask = 0x0F, + .note = "CPLD Minor Version, controlled by CPLD editor." + }, + [SWPLD3_SCRTCH_REG] = { + .bus = BUS0, .addr = SWPLD3_ADDR, + .reg = 0x01, .mask = 0xFF, + .note = "CPLD read/write test register, to provide a way to test CPLD access." + }, + [SB_VER] = { + .bus = BUS0, .addr = SWPLD3_ADDR, + .reg = 0x02, .mask = 0xF0, + .note = "“0x0”: proto-A\n“0x1”: proto-B" + }, + [PLATFORM_TYPE] = { + .bus = BUS0, .addr = SWPLD3_ADDR, + .reg = 0x02, .mask = 0x0F, + .note = "“0x0”: 64X100G_2U\n“0x1”~”0xF” Reserved" + }, +//SWPLD4 + [SWPLD4_MAJOR_VER] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x00, .mask = 0xF0, + .note = "CPLD Major Version, controlled by CPLD editor." + }, + [SWPLD4_MINOR_VER] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x00, .mask = 0x0F, + .note = "CPLD Minor Version, controlled by CPLD editor." + }, + [SWPLD4_SCRTCH_REG] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x01, .mask = 0xFF, + .note = "CPLD read/write test register, to provide a way to test CPLD access." + }, + [BMC_RST] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x02, .mask = 1 << 6, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [CPLD_LPC_RST] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x02, .mask = 1 << 5, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [CPLD_SW_RST] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x02, .mask = 1 << 3, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [MB_CPLD_RST] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x02, .mask = 1 << 2, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [BCM56970_RST] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x02, .mask = 1 << 1, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [CPLD_UPGRADE_RST] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x03, .mask = 1 << 7, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [MB_RST_CPLD] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x03, .mask = 1 << 6, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [CPU_RST_MB_OOB] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x03, .mask = 1 << 5, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [GPIO_PHY_RST] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x03, .mask = 1 << 4, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [PSU_FAN_EVENT] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x04, .mask = 1 << 4, + .note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" + }, + [CPU_THERMAL_INT] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x04, .mask = 1 << 1, + .note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" + }, + [FAN_INT] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x04, .mask = 1 << 0, + .note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" + }, + [CPLD_SPI_WP] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x06, .mask = 1 << 3, + .note = "“0” = SPI write operation is disabled\n“1” = SPI write operation is enabled" + }, + [RJ45_CONSOLE_SEL] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x06, .mask = 1 << 2, + .note = "“0” = Use BCM UART\n“1” = Use CPU UART" + }, + [SYSTEM_INT] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x07, .mask = 1 << 2, + .note = "“0” = Interrupt is asserted\n“1” = Interrupt is deasserted" + }, + [CPLD_MB_RST_DONE] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x07, .mask = 1 << 1, + .note = "“0” = Is done\n“1” = Is not done" + }, + [MB_PWR_OK] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x07, .mask = 1 << 0, + .note = "‘0’ = Power is failed\n‘1’ = Power is good" + }, + [FAN_EEPROM_WP] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x15, .mask = 1 << 2, + .note = "“1” = enables the lock-down mechanism.\n“0” = overrides the lock-down function enabling blocks to be erased or programmed using software commands." + }, +}; \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_cpld.c b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_cpld.c new file mode 100644 index 000000000000..0db05d967ccf --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_cpld.c @@ -0,0 +1,860 @@ +#include "delta_ag9064_common.h" + +#define QSFP_PRESENCE_1 0x03 +#define QSFP_PRESENCE_2 0x03 +#define QSFP_PRESENCE_3 0x24 +#define QSFP_PRESENCE_4 0x24 +#define QSFP_PRESENCE_5 0x04 +#define QSFP_PRESENCE_6 0x04 +#define QSFP_PRESENCE_7 0x25 +#define QSFP_PRESENCE_8 0x25 + +#define QSFP_LP_MODE_1 0x0c +#define QSFP_LP_MODE_2 0x0c +#define QSFP_LP_MODE_3 0x2a +#define QSFP_LP_MODE_4 0x2a +#define QSFP_LP_MODE_5 0x0d +#define QSFP_LP_MODE_6 0x0d +#define QSFP_LP_MODE_7 0x2b +#define QSFP_LP_MODE_8 0x2b + +#define QSFP_RESET_1 0x06 +#define QSFP_RESET_2 0x06 +#define QSFP_RESET_3 0x26 +#define QSFP_RESET_4 0x26 +#define QSFP_RESET_5 0x07 +#define QSFP_RESET_6 0x07 +#define QSFP_RESET_7 0x27 +#define QSFP_RESET_8 0x27 + +#define QSFP_RESPONSE_1 0x09 +#define QSFP_RESPONSE_2 0x09 +#define QSFP_RESPONSE_3 0x28 +#define QSFP_RESPONSE_4 0x28 +#define QSFP_RESPONSE_5 0x0a +#define QSFP_RESPONSE_6 0x0a +#define QSFP_RESPONSE_7 0x29 +#define QSFP_RESPONSE_8 0x29 + +#define QSFP_INTERRUPT_1 0x0f +#define QSFP_INTERRUPT_2 0x0f +#define QSFP_INTERRUPT_3 0x2c +#define QSFP_INTERRUPT_4 0x2c +#define QSFP_INTERRUPT_5 0x10 +#define QSFP_INTERRUPT_6 0x10 +#define QSFP_INTERRUPT_7 0x2d +#define QSFP_INTERRUPT_8 0x2d + +unsigned char cpupld_reg_addr; +/*---------------- CPLD - start ------------- */ +/* CPLD -- device */ +static struct platform_device ag9064_cpld = { + .name = "delta-ag9064-cpld", + .id = 0, + .dev = { + .platform_data = ag9064_cpld_platform_data, + .release = device_release + }, +}; + +static ssize_t get_present(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u64 data = 0; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_PRESENCE_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_PRESENCE_2; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_PRESENCE_3; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_PRESENCE_4; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_PRESENCE_5; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_PRESENCE_6; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_PRESENCE_7; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_PRESENCE_8; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + +static ssize_t get_lpmode(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u64 data = 0; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_LP_MODE_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_LP_MODE_2; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_LP_MODE_3; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_LP_MODE_4; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_LP_MODE_5; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_LP_MODE_6; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_LP_MODE_7; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_LP_MODE_8; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + +static ssize_t get_reset(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u64 data = 0; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESET_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESET_2; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESET_3; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESET_4; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESET_5; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESET_6; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESET_7; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESET_8; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + +static ssize_t get_response(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u64 data = 0; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESPONSE_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESPONSE_2; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESPONSE_3; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESPONSE_4; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESPONSE_5; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESPONSE_6; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESPONSE_7; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESPONSE_8; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + +static ssize_t get_interrupt(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u64 data = 0; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_INTERRUPT_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_INTERRUPT_2; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_INTERRUPT_3; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_INTERRUPT_4; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_INTERRUPT_5; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_INTERRUPT_6; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_INTERRUPT_7; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_INTERRUPT_8; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + +static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long long set_data; + int err; + + err = kstrtoull(buf, 16, &set_data); + if (err){ + return err; + } + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_SETDATA; + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_LP_MODE_1; + cmd_data[3] = (set_data & 0xff); + cmd_data_len = sizeof(cmd_data); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_LP_MODE_2; + cmd_data[3] = ((set_data >> 8 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_LP_MODE_3; + cmd_data[3] = ((set_data >> 16 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_LP_MODE_4; + cmd_data[3] = ((set_data >> 24 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_LP_MODE_5; + cmd_data[3] = ((set_data >> 32 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_LP_MODE_6; + cmd_data[3] = ((set_data >> 40 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_LP_MODE_7; + cmd_data[3] = ((set_data >> 48 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_LP_MODE_8; + cmd_data[3] = ((set_data >> 56 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + return count; +} + +static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long long set_data; + int err; + + err = kstrtoull(buf, 16, &set_data); + if (err){ + return err; + } + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_SETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESET_1; + cmd_data[3] = (set_data & 0xff); + cmd_data_len = sizeof(cmd_data); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESET_2; + cmd_data[3] = ((set_data >> 8 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESET_3; + cmd_data[3] = ((set_data >> 16 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESET_4; + cmd_data[3] = ((set_data >> 24 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESET_5; + cmd_data[3] = ((set_data >> 32 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESET_6; + cmd_data[3] = ((set_data >> 40 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESET_7; + cmd_data[3] = ((set_data >> 48 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESET_8; + cmd_data[3] = ((set_data >> 56 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + return count; +} + +static ssize_t set_response(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long long set_data; + int err; + + err = kstrtoull(buf, 16, &set_data); + if (err){ + return err; + } + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_SETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESPONSE_1; + cmd_data[3] = (set_data & 0xff); + cmd_data_len = sizeof(cmd_data); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESPONSE_2; + cmd_data[3] = ((set_data >> 8 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESPONSE_3; + cmd_data[3] = ((set_data >> 16 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESPONSE_4; + cmd_data[3] = ((set_data >> 24 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESPONSE_5; + cmd_data[3] = ((set_data >> 32 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESPONSE_6; + cmd_data[3] = ((set_data >> 40 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESPONSE_7; + cmd_data[3] = ((set_data >> 48 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESPONSE_8; + cmd_data[3] = ((set_data >> 56 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + return count; +} + +static ssize_t get_cpld_reg(struct device *dev, struct device_attribute *dev_attr, char *buf) +{ + int ret; + int mask; + int value; + char note[200]; + unsigned char reg; + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cpld_platform_data *pdata = dev->platform_data; + + switch (attr->index) { + case CPLD_REG_ADDR: + return sprintf(buf, "0x%02x\n", cpupld_reg_addr); + case CPLD_REG_VALUE: + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, cpupld_reg_addr); + return sprintf(buf, "0x%02x\n", ret); + case CPLD_VER ... OP_MODULE_INT: + reg = attribute_data[attr->index].reg; + mask = attribute_data[attr->index].mask; + value = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); + sprintf(note, "\n%s\n",attribute_data[attr->index].note); + value = (value & mask); + break; + default: + return sprintf(buf, "%d not found", attr->index); + } + + switch (mask) { + case 0xFF: + return sprintf(buf, "0x%02x%s", value, note); + case 0x0F: + return sprintf(buf, "0x%01x%s", value, note); + case 0xF0: + value = value >> 4; + return sprintf(buf, "0x%01x%s", value, note); + default : + value = value >> dni_log2(mask); + return sprintf(buf, "%d%s", value, note); + } +} + +static ssize_t set_cpld_reg(struct device *dev, struct device_attribute *dev_attr, + const char *buf, size_t count) +{ + int err; + int value; + int set_data; + unsigned char reg; + unsigned char mask; + unsigned char mask_out; + + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 0, &set_data); + if (err){ + return err; + } + + if (set_data > 0xff){ + printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); + return count; + } + + switch (attr->index) { + case CPLD_REG_ADDR: + cpupld_reg_addr = set_data; + return count; + case CPLD_REG_VALUE: + i2c_smbus_write_byte_data(pdata[system_cpld].client, cpupld_reg_addr, set_data); + return count; + case CPLD_VER ... OP_MODULE_INT: + reg = attribute_data[attr->index].reg; + mask = attribute_data[attr->index].mask; + value = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); + mask_out = value & ~(mask); + break; + default: + return sprintf(buf, "%d not found", attr->index); + } + + switch (mask) { + case 0xFF: + set_data = mask_out | (set_data & mask); + break; + case 0x0F: + set_data = mask_out | (set_data & mask); + break; + case 0xF0: + set_data = set_data << 4; + set_data = mask_out | (set_data & mask); + break; + default : + set_data = mask_out | (set_data << dni_log2(mask) ); + } + + i2c_smbus_write_byte_data(pdata[system_cpld].client, reg, set_data); + return count; +} + +static DEVICE_ATTR(qsfp_present, S_IRUGO, get_present, NULL); +static DEVICE_ATTR(qsfp_lpmode, S_IWUSR | S_IRUGO, get_lpmode, set_lpmode); +static DEVICE_ATTR(qsfp_reset, S_IWUSR | S_IRUGO, get_reset, set_reset); +static DEVICE_ATTR(qsfp_modsel, S_IWUSR | S_IRUGO, get_response, set_response); +static DEVICE_ATTR(qsfp_interrupt, S_IRUGO, get_interrupt, NULL); + +static SENSOR_DEVICE_ATTR(cpld_reg_addr, S_IRUGO | S_IWUSR, get_cpld_reg, set_cpld_reg, CPLD_REG_ADDR); +static SENSOR_DEVICE_ATTR(cpld_reg_value, S_IRUGO | S_IWUSR, get_cpld_reg, set_cpld_reg, CPLD_REG_VALUE); +static SENSOR_DEVICE_ATTR(cpld_ver, S_IRUGO, get_cpld_reg, NULL, CPLD_VER); +static SENSOR_DEVICE_ATTR(cpu_board_ver, S_IRUGO, get_cpld_reg, NULL, CPU_BOARD_VER); +static SENSOR_DEVICE_ATTR(cpu_id, S_IRUGO, get_cpld_reg, NULL, CPU_ID); +static SENSOR_DEVICE_ATTR(mb_id, S_IRUGO, get_cpld_reg, NULL, MB_ID); +static SENSOR_DEVICE_ATTR(mb_ver, S_IRUGO, get_cpld_reg, NULL, MB_VER); +static SENSOR_DEVICE_ATTR(cpu0_pwr_ok, S_IRUGO, get_cpld_reg, NULL, CPU0_PWR_OK); +static SENSOR_DEVICE_ATTR(psu_over_temp, S_IRUGO, get_cpld_reg, NULL, PSU_OVER_TEMP); +static SENSOR_DEVICE_ATTR(pwr_rail_over_temp, S_IRUGO, get_cpld_reg, NULL, PWR_RAIL_OVER_TEMP); +static SENSOR_DEVICE_ATTR(cpu_disomic_over_temp, S_IRUGO, get_cpld_reg, NULL, CPU_DISOMIC_OVER_TEMP); +static SENSOR_DEVICE_ATTR(ddr_over_temp, S_IRUGO, get_cpld_reg, NULL, DDR_OVER_TEMP); +static SENSOR_DEVICE_ATTR(cpld_pwr_on_rst, S_IRUGO, get_cpld_reg, NULL, CPLD_PWR_ON_RST); +static SENSOR_DEVICE_ATTR(cpld_hard_rst, S_IRUGO, get_cpld_reg, NULL, CPLD_HARD_RST); +static SENSOR_DEVICE_ATTR(cpld_rst, S_IRUGO | S_IWUSR, get_cpld_reg, set_cpld_reg, CPLD_RST); +static SENSOR_DEVICE_ATTR(mb_pwr, S_IRUGO, get_cpld_reg, NULL, MB_PWR); +static SENSOR_DEVICE_ATTR(mb_rst, S_IRUGO | S_IWUSR, get_cpld_reg, set_cpld_reg, MB_RST); +static SENSOR_DEVICE_ATTR(psu_fan_int, S_IRUGO, get_cpld_reg, NULL, PSU_FAN_INT); +static SENSOR_DEVICE_ATTR(op_module_int, S_IRUGO, get_cpld_reg, NULL, OP_MODULE_INT); + +static struct attribute *ag9064_cpld_attrs[] = { + &dev_attr_qsfp_present.attr, + &dev_attr_qsfp_lpmode.attr, + &dev_attr_qsfp_reset.attr, + &dev_attr_qsfp_modsel.attr, + &dev_attr_qsfp_interrupt.attr, + &sensor_dev_attr_cpld_reg_value.dev_attr.attr, + &sensor_dev_attr_cpld_reg_addr.dev_attr.attr, + &sensor_dev_attr_cpld_ver.dev_attr.attr, + &sensor_dev_attr_cpu_board_ver.dev_attr.attr, + &sensor_dev_attr_cpu_id.dev_attr.attr, + &sensor_dev_attr_mb_id.dev_attr.attr, + &sensor_dev_attr_mb_ver.dev_attr.attr, + &sensor_dev_attr_cpu0_pwr_ok.dev_attr.attr, + &sensor_dev_attr_psu_over_temp.dev_attr.attr, + &sensor_dev_attr_pwr_rail_over_temp.dev_attr.attr, + &sensor_dev_attr_cpu_disomic_over_temp.dev_attr.attr, + &sensor_dev_attr_ddr_over_temp.dev_attr.attr, + &sensor_dev_attr_cpld_pwr_on_rst.dev_attr.attr, + &sensor_dev_attr_cpld_hard_rst.dev_attr.attr, + &sensor_dev_attr_cpld_rst.dev_attr.attr, + &sensor_dev_attr_mb_pwr.dev_attr.attr, + &sensor_dev_attr_mb_rst.dev_attr.attr, + &sensor_dev_attr_psu_fan_int.dev_attr.attr, + &sensor_dev_attr_op_module_int.dev_attr.attr, + NULL, +}; + +static struct attribute_group ag9064_cpld_attr_grp = { + .attrs = ag9064_cpld_attrs, +}; + +static int __init cpld_probe(struct platform_device *pdev) +{ + struct cpld_platform_data *pdata; + struct i2c_adapter *parent; + int ret; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "CPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(BUS7); + if (!parent) { + printk(KERN_WARNING "Parent adapter (%d) not found\n",BUS7); + return -ENODEV; + } + + pdata[system_cpld].client = i2c_new_dummy(parent, pdata[system_cpld].reg_addr); + if (!pdata[system_cpld].client) { + printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[system_cpld].reg_addr); + goto error; + } + + ret = sysfs_create_group(&pdev->dev.kobj, &ag9064_cpld_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + goto error; + } + + return 0; + +error: + i2c_unregister_device(pdata[system_cpld].client); + i2c_put_adapter(parent); + + return -ENODEV; +} + +static int __exit cpld_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent = NULL; + struct cpld_platform_data *pdata = pdev->dev.platform_data; + sysfs_remove_group(&pdev->dev.kobj, &ag9064_cpld_attr_grp); + + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + } + else { + if (pdata[system_cpld].client) { + if (!parent) { + parent = (pdata[system_cpld].client)->adapter; + } + i2c_unregister_device(pdata[system_cpld].client); + } + } + i2c_put_adapter(parent); + + return 0; +} + +static struct platform_driver cpld_driver = { + .probe = cpld_probe, + .remove = __exit_p(cpld_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9064-cpld", + }, +}; + +/*---------------- CPLD - end ------------- */ + +/*---------------- module initialization ------------- */ +static void __init delta_ag9064_cpupld_init(void) +{ + int ret; + printk(KERN_WARNING "ag9064_platform_cpupld module initialization\n"); + + ret = dni_create_user(); + if (ret != 0){ + printk(KERN_WARNING "Fail to create IPMI user\n"); + } + + // set the CPUPLD prob and remove + ret = platform_driver_register(&cpld_driver); + if (ret) { + printk(KERN_WARNING "Fail to register cpupld driver\n"); + goto error_cpupld_driver; + } + + // register the CPUPLD + ret = platform_device_register(&ag9064_cpld); + if (ret) { + printk(KERN_WARNING "Fail to create cpupld device\n"); + goto error_ag9064_cpupld; + } + return 0; + +error_ag9064_cpupld: + platform_driver_unregister(&cpld_driver); +error_cpupld_driver: + return ret; +} + +static void __exit delta_ag9064_cpupld_exit(void) +{ + platform_device_unregister(&ag9064_cpld); + platform_driver_unregister(&cpld_driver); +} +module_init(delta_ag9064_cpupld_init); +module_exit(delta_ag9064_cpupld_exit); + +MODULE_DESCRIPTION("DNI ag9064 CPLD Platform Support"); +MODULE_AUTHOR("Stanley Chi "); +MODULE_LICENSE("GPL"); \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c index df0b47037e12..38fb82d443c7 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c @@ -1,86 +1,14 @@ -#include -#include -#include -#include #include #include #include #include #include -#include -#include #include #include #include #include -#include - -#include -#include -#include -#include - -#define DEFAULT_NUM 1 -#define BUS9_DEV_NUM 64 -#define BUS9_BASE_NUM 20 - -#define IPMI_MAX_INTF (4) -#define DELTA_NETFN 0x38 -#define BMC_BUS_5 0x04 -#define CMD_SETDATA 0x3 -#define CMD_GETDATA 0x2 - -#define CPLD_REG 0x31 -#define SWPLD1_ADDR 0x35 -#define SWPLD2_ADDR 0x34 -#define SWPLD3_ADDR 0x33 -#define SWPLD4_ADDR 0x32 -#define QSFP_PORT_MUX_REG 0x13 - -#define QSFP_PRESENCE_1 0x3 -#define QSFP_PRESENCE_2 0x3 -#define QSFP_PRESENCE_3 0x24 -#define QSFP_PRESENCE_4 0x24 -#define QSFP_PRESENCE_5 0x4 -#define QSFP_PRESENCE_6 0x4 -#define QSFP_PRESENCE_7 0x25 -#define QSFP_PRESENCE_8 0x25 - -#define QSFP_LP_MODE_1 0x0c -#define QSFP_LP_MODE_2 0x0c -#define QSFP_LP_MODE_3 0x2a -#define QSFP_LP_MODE_4 0x2a -#define QSFP_LP_MODE_5 0x0d -#define QSFP_LP_MODE_6 0x0d -#define QSFP_LP_MODE_7 0x2b -#define QSFP_LP_MODE_8 0x2b - -#define QSFP_RESET_1 0x06 -#define QSFP_RESET_2 0x06 -#define QSFP_RESET_3 0x26 -#define QSFP_RESET_4 0x26 -#define QSFP_RESET_5 0x07 -#define QSFP_RESET_6 0x07 -#define QSFP_RESET_7 0x27 -#define QSFP_RESET_8 0x27 - -#define QSFP_RESPONSE_1 0x09 -#define QSFP_RESPONSE_2 0x09 -#define QSFP_RESPONSE_3 0x28 -#define QSFP_RESPONSE_4 0x28 -#define QSFP_RESPONSE_5 0x0a -#define QSFP_RESPONSE_6 0x0a -#define QSFP_RESPONSE_7 0x29 -#define QSFP_RESPONSE_8 0x29 - -#define QSFP_INTERRUPT_1 0x0f -#define QSFP_INTERRUPT_2 0x0f -#define QSFP_INTERRUPT_3 0x2c -#define QSFP_INTERRUPT_4 0x2c -#define QSFP_INTERRUPT_5 0x10 -#define QSFP_INTERRUPT_6 0x10 -#define QSFP_INTERRUPT_7 0x2d -#define QSFP_INTERRUPT_8 0x2d + +#include "delta_ag9064_common.h" #define SFF8436_INFO(data) \ .type = "sff8436", .addr = 0x50, .platform_data = (data) @@ -97,56 +25,8 @@ }, \ } - -static void msg_handler(struct ipmi_recv_msg *recv_msg,void* handler_data) -{ - struct completion *comp = recv_msg->user_msg_data; - if (comp) - complete(comp); - else - ipmi_free_recv_msg(recv_msg); - return; -} - -static ipmi_user_t ipmi_mh_user = NULL; -static struct ipmi_user_hndl ipmi_hndlrs = { .ipmi_recv_hndl = msg_handler,}; - -static atomic_t dummy_count = ATOMIC_INIT(0); -static void dummy_smi_free(struct ipmi_smi_msg *msg) -{ - atomic_dec(&dummy_count); -} -static void dummy_recv_free(struct ipmi_recv_msg *msg) -{ - atomic_dec(&dummy_count); -} -static struct ipmi_smi_msg halt_smi_msg = { - .done = dummy_smi_free -}; -static struct ipmi_recv_msg halt_recv_msg = { - .done = dummy_recv_free -}; - struct i2c_client * i2c_client_9548; -enum{ - BUS0 = 0, - BUS1, - BUS2, - BUS3, - BUS4, - BUS5, - BUS6, - BUS7, - BUS8, - BUS9, - BUS10, - BUS11, - BUS12, - BUS13, - BUS14, -}; - /* pca9548 - add 8 bus */ static struct pca954x_platform_mode pca954x_mode[] = { @@ -265,8 +145,45 @@ static struct sff_8436_platform_data sff_8436_port[] = { { SFF_8346_PORT() }, }; -/*---------------- IPMI - start ------------- */ +void device_release(struct device *dev) +{ + return; +} +EXPORT_SYMBOL(device_release); + +void msg_handler(struct ipmi_recv_msg *recv_msg, void* handler_data) +{ + struct completion *comp = recv_msg->user_msg_data; + if (comp) + complete(comp); + else + ipmi_free_recv_msg(recv_msg); + return; +} +EXPORT_SYMBOL(msg_handler); + +void dummy_smi_free(struct ipmi_smi_msg *msg) +{ + atomic_dec(&dummy_count); +} +EXPORT_SYMBOL(dummy_smi_free); +void dummy_recv_free(struct ipmi_recv_msg *msg) +{ + atomic_dec(&dummy_count); +} +EXPORT_SYMBOL(dummy_recv_free); + +unsigned char dni_log2 (unsigned char num){ + unsigned char num_log2 = 0; + while(num > 0){ + num = num >> 1; + num_log2 += 1; + } + return num_log2 -1; +} +EXPORT_SYMBOL(dni_log2); +/*---------------- IPMI - start ------------- */ int dni_create_user(void) { int rv, i; @@ -281,6 +198,7 @@ int dni_create_user(void) return rv; } } +EXPORT_SYMBOL(dni_create_user); int dni_bmc_cmd(char set_cmd, char *cmd_data, int cmd_data_len) { @@ -299,7 +217,7 @@ int dni_bmc_cmd(char set_cmd, char *cmd_data, int cmd_data_len) msg.data = cmd_data; init_completion(&comp); - rv = ipmi_request_supply_msgs(ipmi_mh_user, (struct ipmi_addr*)&addr, 0,&msg, &comp, &halt_smi_msg, &halt_recv_msg, 0); + rv = ipmi_request_supply_msgs(ipmi_mh_user, (struct ipmi_addr*)&addr, 0, &msg, &comp, &halt_smi_msg, &halt_recv_msg, 0); if (rv) { return -6; } @@ -334,16 +252,11 @@ int dni_bmc_cmd(char set_cmd, char *cmd_data, int cmd_data_len) return rv; } - +EXPORT_SYMBOL(dni_bmc_cmd); /*---------------- IPMI - stop ------------- */ /*---------------- I2C device - start ------------- */ -static void device_release(struct device *dev) -{ - return; -} - struct i2c_device_platform_data { int parent; struct i2c_board_info info; @@ -1014,7 +927,6 @@ static int __init swpld_mux_probe(struct platform_device *pdev) return ret; } - static int __exit swpld_mux_remove(struct platform_device *pdev) { int i; @@ -1063,657 +975,8 @@ static struct platform_driver swpld_mux_driver = { .name = "delta-ag9064-swpld-mux", }, }; - /*---------------- MUX - end ------------- */ -/*---------------- CPLD - start ------------- */ - -/* CPLD -- device */ - -static ssize_t get_present(struct device *dev, struct device_attribute \ - *dev_attr, char *buf) -{ - int ret; - u64 data = 0; - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_GETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_PRESENCE_1; - cmd_data[3] = 1; - cmd_data_len = sizeof(cmd_data); - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data = (u64)(ret & 0xff); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_PRESENCE_2; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 8; - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_PRESENCE_3; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 16; - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_PRESENCE_4; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 24; - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_PRESENCE_5; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 32; - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_PRESENCE_6; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 40; - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_PRESENCE_7; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 48; - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_PRESENCE_8; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 56; - - return sprintf(buf, "0x%016llx\n", data); -} - -static ssize_t get_lpmode(struct device *dev, struct device_attribute \ - *dev_attr, char *buf) -{ - int ret; - u64 data = 0; - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_GETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_LP_MODE_1; - cmd_data[3] = 1; - cmd_data_len = sizeof(cmd_data); - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data = (u64)(ret & 0xff); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_LP_MODE_2; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 8; - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_LP_MODE_3; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 16; - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_LP_MODE_4; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 24; - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_LP_MODE_5; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 32; - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_LP_MODE_6; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 40; - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_LP_MODE_7; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 48; - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_LP_MODE_8; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 56; - - return sprintf(buf, "0x%016llx\n", data); -} - -static ssize_t get_reset(struct device *dev, struct device_attribute \ - *dev_attr, char *buf) -{ - int ret; - u64 data = 0; - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_GETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESET_1; - cmd_data[3] = 1; - cmd_data_len = sizeof(cmd_data); - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data = (u64)(ret & 0xff); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESET_2; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 8; - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESET_3; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 16; - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESET_4; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 24; - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESET_5; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 32; - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESET_6; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 40; - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESET_7; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 48; - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESET_8; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 56; - - return sprintf(buf, "0x%016llx\n", data); -} - -static ssize_t get_response(struct device *dev, struct device_attribute \ - *dev_attr, char *buf) -{ - int ret; - u64 data = 0; - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_GETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESPONSE_1; - cmd_data[3] = 1; - cmd_data_len = sizeof(cmd_data); - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data = (u64)(ret & 0xff); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESPONSE_2; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 8; - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESPONSE_3; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 16; - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESPONSE_4; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 24; - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESPONSE_5; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 32; - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESPONSE_6; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 40; - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESPONSE_7; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 48; - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESPONSE_8; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 56; - - return sprintf(buf, "0x%016llx\n", data); -} - -static ssize_t get_interrupt(struct device *dev, struct device_attribute \ - *dev_attr, char *buf) -{ - int ret; - u64 data = 0; - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_GETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_INTERRUPT_1; - cmd_data[3] = 1; - cmd_data_len = sizeof(cmd_data); - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data = (u64)(ret & 0xff); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_INTERRUPT_2; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 8; - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_INTERRUPT_3; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 16; - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_INTERRUPT_4; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 24; - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_INTERRUPT_5; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 32; - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_INTERRUPT_6; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 40; - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_INTERRUPT_7; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 48; - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_INTERRUPT_8; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 56; - - return sprintf(buf, "0x%016llx\n", data); -} - - -static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) -{ - unsigned long long set_data; - int err; - - err = kstrtoull(buf, 16, &set_data); - if (err){ - return err; - } - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_SETDATA; - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_LP_MODE_1; - cmd_data[3] = (set_data & 0xff); - cmd_data_len = sizeof(cmd_data); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_LP_MODE_2; - cmd_data[3] = ((set_data >> 8 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_LP_MODE_3; - cmd_data[3] = ((set_data >> 16 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_LP_MODE_4; - cmd_data[3] = ((set_data >> 24 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_LP_MODE_5; - cmd_data[3] = ((set_data >> 32 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_LP_MODE_6; - cmd_data[3] = ((set_data >> 40 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_LP_MODE_7; - cmd_data[3] = ((set_data >> 48 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_LP_MODE_8; - cmd_data[3] = ((set_data >> 56 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - return count; -} - -static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) -{ - unsigned long long set_data; - int err; - - err = kstrtoull(buf, 16, &set_data); - if (err){ - return err; - } - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_SETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESET_1; - cmd_data[3] = (set_data & 0xff); - cmd_data_len = sizeof(cmd_data); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESET_2; - cmd_data[3] = ((set_data >> 8 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESET_3; - cmd_data[3] = ((set_data >> 16 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESET_4; - cmd_data[3] = ((set_data >> 24 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESET_5; - cmd_data[3] = ((set_data >> 32 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESET_6; - cmd_data[3] = ((set_data >> 40 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESET_7; - cmd_data[3] = ((set_data >> 48 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESET_8; - cmd_data[3] = ((set_data >> 56 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - return count; -} - -static ssize_t set_response(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) -{ - unsigned long long set_data; - int err; - - err = kstrtoull(buf, 16, &set_data); - if (err){ - return err; - } - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_SETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESPONSE_1; - cmd_data[3] = (set_data & 0xff); - cmd_data_len = sizeof(cmd_data); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESPONSE_2; - cmd_data[3] = ((set_data >> 8 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESPONSE_3; - cmd_data[3] = ((set_data >> 16 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESPONSE_4; - cmd_data[3] = ((set_data >> 24 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESPONSE_5; - cmd_data[3] = ((set_data >> 32 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESPONSE_6; - cmd_data[3] = ((set_data >> 40 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESPONSE_7; - cmd_data[3] = ((set_data >> 48 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESPONSE_8; - cmd_data[3] = ((set_data >> 56 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - return count; -} - -static DEVICE_ATTR(qsfp_present, S_IRUGO, get_present, NULL); -static DEVICE_ATTR(qsfp_lpmode, S_IWUSR | S_IRUGO, get_lpmode, set_lpmode); -static DEVICE_ATTR(qsfp_reset, S_IWUSR | S_IRUGO, get_reset, set_reset); -static DEVICE_ATTR(qsfp_modsel, S_IWUSR | S_IRUGO, get_response, set_response); -static DEVICE_ATTR(qsfp_interrupt, S_IRUGO, get_interrupt, NULL); - -static struct attribute *ag9064_cpld_attrs[] = { - &dev_attr_qsfp_present.attr, - &dev_attr_qsfp_lpmode.attr, - &dev_attr_qsfp_reset.attr, - &dev_attr_qsfp_modsel.attr, - &dev_attr_qsfp_interrupt.attr, - NULL, -}; - -static struct attribute_group ag9064_cpld_attr_grp = { - .attrs = ag9064_cpld_attrs, -}; - -enum cpld_type { - system_cpld, -}; - -struct cpld_platform_data { - int reg_addr; - struct i2c_client *client; -}; - -static struct cpld_platform_data ag9064_cpld_platform_data[] = { - [system_cpld] = { - .reg_addr = CPLD_REG, - }, -}; - -static struct platform_device ag9064_cpld = { - .name = "delta-ag9064-cpld", - .id = 0, - .dev = { - .platform_data = ag9064_cpld_platform_data, - .release = device_release - }, -}; - -static int __init cpld_probe(struct platform_device *pdev) -{ - struct cpld_platform_data *pdata; - struct i2c_adapter *parent; - int ret; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "CPLD platform data not found\n"); - return -ENODEV; - } - - parent = i2c_get_adapter(BUS7); - if (!parent) { - printk(KERN_WARNING "Parent adapter (%d) not found\n",BUS7); - return -ENODEV; - } - - pdata[system_cpld].client = i2c_new_dummy(parent, pdata[system_cpld].reg_addr); - if (!pdata[system_cpld].client) { - printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[system_cpld].reg_addr); - goto error; - } - - ret = sysfs_create_group(&pdev->dev.kobj, &ag9064_cpld_attr_grp); - if (ret) { - printk(KERN_WARNING "Fail to create cpld attribute group"); - goto error; - } - - return 0; - -error: - i2c_unregister_device(pdata[system_cpld].client); - i2c_put_adapter(parent); - - return -ENODEV; -} - -static int __exit cpld_remove(struct platform_device *pdev) -{ - struct i2c_adapter *parent = NULL; - struct cpld_platform_data *pdata = pdev->dev.platform_data; - sysfs_remove_group(&pdev->dev.kobj, &ag9064_cpld_attr_grp); - - if (!pdata) { - dev_err(&pdev->dev, "Missing platform data\n"); - } - else { - if (pdata[system_cpld].client) { - if (!parent) { - parent = (pdata[system_cpld].client)->adapter; - } - i2c_unregister_device(pdata[system_cpld].client); - } - } - i2c_put_adapter(parent); - - return 0; -} - -static struct platform_driver cpld_driver = { - .probe = cpld_probe, - .remove = __exit_p(cpld_remove), - .driver = { - .owner = THIS_MODULE, - .name = "delta-ag9064-cpld", - }, -}; - -/*---------------- CPLD - end ------------- */ - /*---------------- module initialization ------------- */ static void __init delta_ag9064_platform_init(void) @@ -1734,12 +997,6 @@ static void __init delta_ag9064_platform_init(void) printk(KERN_WARNING "Fail to create IPMI user\n"); } - ret = platform_driver_register(&cpld_driver); - if (ret) { - printk(KERN_WARNING "Fail to register cpld driver\n"); - goto error_cpld_driver; - } - // register the mux prob which call the SWPLD ret = platform_driver_register(&swpld_mux_driver); if (ret) { @@ -1754,13 +1011,6 @@ static void __init delta_ag9064_platform_init(void) goto error_i2c_device_driver; } - // register the CPLD - ret = platform_device_register(&ag9064_cpld); - if (ret) { - printk(KERN_WARNING "Fail to create cpld device\n"); - goto error_ag9064_cpld; - } - swpld_pdata = ag9064_swpld_mux[0].dev.platform_data; //swpld_pdata->cpld = cpld_pdata[system_cpld].client; ret = platform_device_register(&ag9064_swpld_mux); @@ -1794,14 +1044,10 @@ static void __init delta_ag9064_platform_init(void) for (; i >= 0; i--) { platform_device_unregister(&ag9064_swpld_mux); } - platform_driver_unregister(&ag9064_cpld); -error_ag9064_cpld: platform_driver_unregister(&i2c_device_driver); error_i2c_device_driver: platform_driver_unregister(&swpld_mux_driver); error_swpld_mux_driver: - platform_driver_unregister(&cpld_driver); -error_cpld_driver: return ret; } @@ -1814,10 +1060,8 @@ static void __exit delta_ag9064_platform_exit(void) } platform_device_unregister(&ag9064_swpld_mux); - platform_device_unregister(&ag9064_cpld); platform_driver_unregister(&i2c_device_driver); platform_driver_unregister(&swpld_mux_driver); - platform_driver_unregister(&cpld_driver); i2c_unregister_device(i2c_client_9548); } @@ -1826,4 +1070,4 @@ module_exit(delta_ag9064_platform_exit); MODULE_DESCRIPTION("DELTA ag9064 Platform Support"); MODULE_AUTHOR("Johnson Lu "); -MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL"); \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_swpld.c b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_swpld.c new file mode 100644 index 000000000000..80a0ddc0d370 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_swpld.c @@ -0,0 +1,620 @@ +#include "delta_ag9064_common.h" + +unsigned char swpld1_reg_addr; +unsigned char swpld2_reg_addr; +unsigned char swpld3_reg_addr; +unsigned char swpld4_reg_addr; + +/*---------------- CPLD - start ------------- */ +/* SWPLD1 -- device */ +static struct platform_device swpld1_device = { + .name = "delta-ag9064-swpld1", + .id = 0, + .dev = { + .platform_data = ag9064_swpld1_platform_data, + .release = device_release + }, +}; + +static struct platform_device swpld2_device = { + .name = "delta-ag9064-swpld2", + .id = 0, + .dev = { + .platform_data = ag9064_swpld2_platform_data, + .release = device_release + }, +}; +static struct platform_device swpld3_device = { + .name = "delta-ag9064-swpld3", + .id = 0, + .dev = { + .platform_data = ag9064_swpld3_platform_data, + .release = device_release + }, +}; +static struct platform_device swpld4_device = { + .name = "delta-ag9064-swpld4", + .id = 0, + .dev = { + .platform_data = ag9064_swpld4_platform_data, + .release = device_release + }, +}; + +static ssize_t get_swpld_reg(struct device *dev, struct device_attribute *dev_attr, char *buf) +{ + int ret; + int mask; + int value; + int cmd_data_len; + char note[200]; + uint8_t cmd_data[4]={0}; + uint8_t get_cmd; + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + + cmd_data_len = sizeof(cmd_data); + get_cmd = CMD_GETDATA; + cmd_data[0] = BMC_BUS_5; + cmd_data[3] = 1; + mask = attribute_data[attr->index].mask; + sprintf(note, "\n%s\n",attribute_data[attr->index].note); + + if (attr->index <= SWPLD4_REG_VALUE){ + switch (attr->index) { + case SWPLD1_REG_ADDR: + return sprintf(buf, "0x%02x\n", swpld1_reg_addr); + case SWPLD2_REG_ADDR: + return sprintf(buf, "0x%02x\n", swpld2_reg_addr); + case SWPLD3_REG_ADDR: + return sprintf(buf, "0x%02x\n", swpld3_reg_addr); + case SWPLD4_REG_ADDR: + return sprintf(buf, "0x%02x\n", swpld4_reg_addr); + case SWPLD1_REG_VALUE: + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = swpld1_reg_addr; + break; + case SWPLD2_REG_VALUE: + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = swpld2_reg_addr; + break; + case SWPLD3_REG_VALUE: + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = swpld3_reg_addr; + break; + case SWPLD4_REG_VALUE: + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = swpld4_reg_addr; + break; + default: + return sprintf(buf, "%d not found", attr->index); + } + ret = dni_bmc_cmd(get_cmd, cmd_data, cmd_data_len); + ret = ret & 0xff; + return sprintf(buf, "0x%02x\n", ret); + }else{ + + switch (attr->index) { + case SWPLD1_MAJOR_VER ... PSU_LED_MODE : + cmd_data[1] = SWPLD1_ADDR; + break; + case SWPLD2_MAJOR_VER ... FAN_MOD4_LED : + cmd_data[1] = SWPLD2_ADDR; + break; + case SWPLD3_MAJOR_VER ... PLATFORM_TYPE : + cmd_data[1] = SWPLD3_ADDR; + break; + case SWPLD4_MAJOR_VER ... FAN_EEPROM_WP : + cmd_data[1] = SWPLD4_ADDR; + break; + default: + return sprintf(buf, "%d not found", attr->index); + } + cmd_data[2] = attribute_data[attr->index].reg; + value = dni_bmc_cmd(get_cmd, cmd_data, cmd_data_len); + value = value & mask; + switch (mask) { + case 0xFF: + return sprintf(buf, "0x%02x%s", value, note); + case 0x0F: + return sprintf(buf, "0x%01x%s", value, note); + case 0xF0: + value = value >> 4; + return sprintf(buf, "0x%01x%s", value, note); + case 0xC0: + value = value >> 6; + return sprintf(buf, "0x%01x%s", value, note); + case 0x30: + value = value >> 4; + return sprintf(buf, "0x%01x%s", value, note); + default : + value = value >> dni_log2(mask); + return sprintf(buf, "%d%s", value, note); + } + } +} + +static ssize_t set_swpld_reg(struct device *dev, struct device_attribute *dev_attr, + const char *buf, size_t count) +{ + int err; + int value; + int set_data; + int cmd_data_len; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + uint8_t get_cmd; + unsigned char mask; + unsigned char mask_out; + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + + cmd_data_len = sizeof(cmd_data); + set_cmd = CMD_SETDATA; + get_cmd = CMD_GETDATA; + + err = kstrtoul(buf, 0, &set_data); + if (err){ + return err; + } + + if (set_data > 0xff){ + printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); + return count; + } + if (attr->index <= SWPLD4_REG_VALUE){ + cmd_data[0] = BMC_BUS_5; + cmd_data[3] = set_data; + switch (attr->index) { + //reg_addr + case SWPLD1_REG_ADDR: + swpld1_reg_addr = set_data; + return count; + case SWPLD2_REG_ADDR: + swpld2_reg_addr = set_data; + return count; + case SWPLD3_REG_ADDR: + swpld3_reg_addr = set_data; + return count; + case SWPLD4_REG_ADDR: + swpld4_reg_addr = set_data; + return count; + //reg_value + case SWPLD1_REG_VALUE: + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = swpld1_reg_addr; + break; + case SWPLD2_REG_VALUE: + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = swpld2_reg_addr; + break; + case SWPLD3_REG_VALUE: + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = swpld3_reg_addr; + break; + case SWPLD4_REG_VALUE: + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = swpld4_reg_addr; + break; + default : + return sprintf(buf, "%d not found", attr->index); + } + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + return count; + } + else{ + cmd_data[0] = BMC_BUS_5; + cmd_data[2] = attribute_data[attr->index].reg; + cmd_data[3] = 1; + switch (attr->index) { + //attributes + case SWPLD1_MAJOR_VER ... PSU_LED_MODE://SWPLD1 + cmd_data[1] = SWPLD1_ADDR; + break; + case SWPLD2_MAJOR_VER ... FAN_MOD4_LED://SWPLD2 + cmd_data[1] = SWPLD2_ADDR; + break; + case SWPLD3_MAJOR_VER ... PLATFORM_TYPE://SWPLD3 + cmd_data[1] = SWPLD3_ADDR; + break; + case SWPLD4_MAJOR_VER ... FAN_EEPROM_WP://SWPLD4 + cmd_data[1] = SWPLD4_ADDR; + break; + default: + return sprintf(buf, "%d not found", attr->index); + } + + value = dni_bmc_cmd(get_cmd, cmd_data, cmd_data_len); + mask = attribute_data[attr->index].mask; + mask_out = value & ~(mask); + cmd_data[3] = set_data; + switch (mask) { + case 0xFF: + set_data = mask_out | (set_data & mask); + break; + case 0x0F: + set_data = mask_out | (set_data & mask); + break; + case 0xF0: + set_data = set_data << 4; + set_data = mask_out | (set_data & mask); + break; + case 0xC0: + set_data = set_data << 6; + set_data = mask_out | (set_data & mask); + break; + case 0x30: + set_data = set_data << 4; + set_data = mask_out | (set_data & mask); + break; + default : + set_data = mask_out | (set_data << dni_log2(mask) ); + } + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + return count; + } +} + +//SWPLD +static SENSOR_DEVICE_ATTR(swpld1_reg_addr, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD1_REG_ADDR); +static SENSOR_DEVICE_ATTR(swpld1_reg_value, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD1_REG_VALUE); +static SENSOR_DEVICE_ATTR(swpld2_reg_addr, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD2_REG_ADDR); +static SENSOR_DEVICE_ATTR(swpld2_reg_value, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD2_REG_VALUE); +static SENSOR_DEVICE_ATTR(swpld3_reg_addr, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD3_REG_ADDR); +static SENSOR_DEVICE_ATTR(swpld3_reg_value, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD3_REG_VALUE); +static SENSOR_DEVICE_ATTR(swpld4_reg_addr, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD4_REG_ADDR); +static SENSOR_DEVICE_ATTR(swpld4_reg_value, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD4_REG_VALUE); +//SWPLD1 +static SENSOR_DEVICE_ATTR(swpld1_major_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD1_MAJOR_VER); +static SENSOR_DEVICE_ATTR(swpld1_minor_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD1_MINOR_VER); +static SENSOR_DEVICE_ATTR(swpld1_scrtch_reg, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD1_SCRTCH_REG); +static SENSOR_DEVICE_ATTR(psu1_pwr_ok, S_IRUGO, get_swpld_reg, NULL, PSU1_PWR_OK); +static SENSOR_DEVICE_ATTR(psu1_int, S_IRUGO, get_swpld_reg, NULL, PSU1_INT); +static SENSOR_DEVICE_ATTR(psu2_pwr_ok, S_IRUGO, get_swpld_reg, NULL, PSU2_PWR_OK); +static SENSOR_DEVICE_ATTR(psu2_int, S_IRUGO, get_swpld_reg, NULL, PSU2_INT); +static SENSOR_DEVICE_ATTR(synce_int, S_IRUGO, get_swpld_reg, NULL, SYNCE_INT); +static SENSOR_DEVICE_ATTR(synce_rst, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SYNCE_RST); +static SENSOR_DEVICE_ATTR(synce_eeprom_wp, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SYNCE_EEPROM_WP); +static SENSOR_DEVICE_ATTR(psu1_green_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, PSU1_GREEN_LED); +static SENSOR_DEVICE_ATTR(psu1_red_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, PSU1_RED_LED); +static SENSOR_DEVICE_ATTR(psu2_green_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, PSU2_GREEN_LED); +static SENSOR_DEVICE_ATTR(psu2_red_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, PSU2_RED_LED); +static SENSOR_DEVICE_ATTR(psu_led_mode, S_IRUGO, get_swpld_reg, NULL, PSU_LED_MODE); +//SWPLD2 +static SENSOR_DEVICE_ATTR(swpld2_major_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD2_MAJOR_VER); +static SENSOR_DEVICE_ATTR(swpld2_minor_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD2_MINOR_VER); +static SENSOR_DEVICE_ATTR(swpld2_scrtch_reg, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD2_SCRTCH_REG); +static SENSOR_DEVICE_ATTR(fan_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, FAN_LED); +static SENSOR_DEVICE_ATTR(sys_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SYS_LED); +static SENSOR_DEVICE_ATTR(fan_mod1_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, FAN_MOD1_LED); +static SENSOR_DEVICE_ATTR(fan_mod2_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, FAN_MOD2_LED); +static SENSOR_DEVICE_ATTR(fan_mod3_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, FAN_MOD3_LED); +static SENSOR_DEVICE_ATTR(fan_mod4_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, FAN_MOD4_LED); +//SWPLD3 +static SENSOR_DEVICE_ATTR(swpld3_major_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD3_MAJOR_VER); +static SENSOR_DEVICE_ATTR(swpld3_minor_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD3_MINOR_VER); +static SENSOR_DEVICE_ATTR(swpld3_scrtch_reg, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD3_SCRTCH_REG); +static SENSOR_DEVICE_ATTR(sb_ver, S_IRUGO, get_swpld_reg, NULL, SB_VER); +static SENSOR_DEVICE_ATTR(platform_type, S_IRUGO, get_swpld_reg, NULL, PLATFORM_TYPE); + +//SWPLD4 +static SENSOR_DEVICE_ATTR(swpld4_major_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD4_MAJOR_VER); +static SENSOR_DEVICE_ATTR(swpld4_minor_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD4_MINOR_VER); +static SENSOR_DEVICE_ATTR(swpld4_scrtch_reg, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD4_SCRTCH_REG); +static SENSOR_DEVICE_ATTR(bmc_rst, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, BMC_RST); +static SENSOR_DEVICE_ATTR(cpld_lpc_rst, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, CPLD_LPC_RST); +static SENSOR_DEVICE_ATTR(cpld_sw_rst, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, CPLD_SW_RST); +static SENSOR_DEVICE_ATTR(mb_cpld_rst, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, MB_CPLD_RST); +static SENSOR_DEVICE_ATTR(bcm56970_rst, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, BCM56970_RST); + +static SENSOR_DEVICE_ATTR(cpld_upgrade_rst, S_IRUGO, get_swpld_reg, NULL, CPLD_UPGRADE_RST); +static SENSOR_DEVICE_ATTR(mb_rst_cpld, S_IRUGO, get_swpld_reg, NULL, MB_RST_CPLD); +static SENSOR_DEVICE_ATTR(cpu_rst_mb_oob, S_IRUGO, get_swpld_reg, NULL, CPU_RST_MB_OOB); +static SENSOR_DEVICE_ATTR(gpio_phy_rst, S_IRUGO, get_swpld_reg, NULL, GPIO_PHY_RST); +static SENSOR_DEVICE_ATTR(psu_fan_event, S_IRUGO, get_swpld_reg, NULL, PSU_FAN_EVENT); +static SENSOR_DEVICE_ATTR(cpu_thermal_int, S_IRUGO, get_swpld_reg, NULL, CPU_THERMAL_INT); +static SENSOR_DEVICE_ATTR(fan_int, S_IRUGO, get_swpld_reg, NULL, FAN_INT); + +static SENSOR_DEVICE_ATTR(cpld_spi_wp, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, CPLD_SPI_WP); +static SENSOR_DEVICE_ATTR(rj45_console_sel, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, RJ45_CONSOLE_SEL); +static SENSOR_DEVICE_ATTR(system_int, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SYSTEM_INT); +static SENSOR_DEVICE_ATTR(cpld_mb_rst_done, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, CPLD_MB_RST_DONE); +static SENSOR_DEVICE_ATTR(mb_pwr_ok, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, MB_PWR_OK); +static SENSOR_DEVICE_ATTR(fan_eeprom_wp, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, FAN_EEPROM_WP); + +static struct attribute *swpld1_device_attrs[] = { + &sensor_dev_attr_swpld1_reg_value.dev_attr.attr, + &sensor_dev_attr_swpld1_reg_addr.dev_attr.attr, + &sensor_dev_attr_swpld1_major_ver.dev_attr.attr, + &sensor_dev_attr_swpld1_minor_ver.dev_attr.attr, + &sensor_dev_attr_swpld1_scrtch_reg.dev_attr.attr, + &sensor_dev_attr_psu1_pwr_ok.dev_attr.attr, + &sensor_dev_attr_psu1_int.dev_attr.attr, + &sensor_dev_attr_psu2_pwr_ok.dev_attr.attr, + &sensor_dev_attr_psu2_int.dev_attr.attr, + &sensor_dev_attr_synce_int.dev_attr.attr, + &sensor_dev_attr_synce_rst.dev_attr.attr, + &sensor_dev_attr_synce_eeprom_wp.dev_attr.attr, + &sensor_dev_attr_psu1_green_led.dev_attr.attr, + &sensor_dev_attr_psu1_red_led.dev_attr.attr, + &sensor_dev_attr_psu2_green_led.dev_attr.attr, + &sensor_dev_attr_psu2_red_led.dev_attr.attr, + &sensor_dev_attr_psu_led_mode.dev_attr.attr, + NULL, +}; + +static struct attribute *swpld2_device_attrs[] = { + &sensor_dev_attr_swpld2_reg_value.dev_attr.attr, + &sensor_dev_attr_swpld2_reg_addr.dev_attr.attr, + &sensor_dev_attr_swpld2_major_ver.dev_attr.attr, + &sensor_dev_attr_swpld2_minor_ver.dev_attr.attr, + &sensor_dev_attr_swpld2_scrtch_reg.dev_attr.attr, + &sensor_dev_attr_fan_led.dev_attr.attr, + &sensor_dev_attr_sys_led.dev_attr.attr, + &sensor_dev_attr_fan_mod1_led.dev_attr.attr, + &sensor_dev_attr_fan_mod2_led.dev_attr.attr, + &sensor_dev_attr_fan_mod3_led.dev_attr.attr, + &sensor_dev_attr_fan_mod4_led.dev_attr.attr, + NULL, +}; + +static struct attribute *swpld3_device_attrs[] = { + &sensor_dev_attr_swpld3_reg_value.dev_attr.attr, + &sensor_dev_attr_swpld3_reg_addr.dev_attr.attr, + &sensor_dev_attr_swpld3_major_ver.dev_attr.attr, + &sensor_dev_attr_swpld3_minor_ver.dev_attr.attr, + &sensor_dev_attr_swpld3_scrtch_reg.dev_attr.attr, + &sensor_dev_attr_sb_ver.dev_attr.attr, + &sensor_dev_attr_platform_type.dev_attr.attr, + NULL, +}; + +static struct attribute *swpld4_device_attrs[] = { + &sensor_dev_attr_swpld4_reg_value.dev_attr.attr, + &sensor_dev_attr_swpld4_reg_addr.dev_attr.attr, + &sensor_dev_attr_swpld4_major_ver.dev_attr.attr, + &sensor_dev_attr_swpld4_minor_ver.dev_attr.attr, + &sensor_dev_attr_swpld4_scrtch_reg.dev_attr.attr, + &sensor_dev_attr_bmc_rst.dev_attr.attr, + &sensor_dev_attr_cpld_lpc_rst.dev_attr.attr, + &sensor_dev_attr_cpld_sw_rst.dev_attr.attr, + &sensor_dev_attr_mb_cpld_rst.dev_attr.attr, + &sensor_dev_attr_bcm56970_rst.dev_attr.attr, + &sensor_dev_attr_cpld_upgrade_rst.dev_attr.attr, + &sensor_dev_attr_mb_rst_cpld.dev_attr.attr, + &sensor_dev_attr_cpu_rst_mb_oob.dev_attr.attr, + &sensor_dev_attr_gpio_phy_rst.dev_attr.attr, + &sensor_dev_attr_psu_fan_event.dev_attr.attr, + &sensor_dev_attr_cpu_thermal_int.dev_attr.attr, + &sensor_dev_attr_fan_int.dev_attr.attr, + &sensor_dev_attr_cpld_spi_wp.dev_attr.attr, + &sensor_dev_attr_rj45_console_sel.dev_attr.attr, + &sensor_dev_attr_system_int.dev_attr.attr, + &sensor_dev_attr_cpld_mb_rst_done.dev_attr.attr, + &sensor_dev_attr_mb_pwr_ok.dev_attr.attr, + &sensor_dev_attr_fan_eeprom_wp.dev_attr.attr, + NULL, +}; + +static struct attribute_group swpld1_device_attr_grp = { + .attrs = swpld1_device_attrs, +}; + +static struct attribute_group swpld2_device_attr_grp = { + .attrs = swpld2_device_attrs, +}; + +static struct attribute_group swpld3_device_attr_grp = { + .attrs = swpld3_device_attrs, +}; + +static struct attribute_group swpld4_device_attr_grp = { + .attrs = swpld4_device_attrs, +}; + +static int __init swpld1_probe(struct platform_device *pdev) +{ + int ret; + ret = sysfs_create_group(&pdev->dev.kobj, &swpld1_device_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + return -ENODEV; + } + return 0; +} + +static int __init swpld2_probe(struct platform_device *pdev) +{ + int ret; + ret = sysfs_create_group(&pdev->dev.kobj, &swpld2_device_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + return -ENODEV; + } + return 0; +} + +static int __init swpld3_probe(struct platform_device *pdev) +{ + int ret; + ret = sysfs_create_group(&pdev->dev.kobj, &swpld3_device_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + return -ENODEV; + } + return 0; +} + +static int __init swpld4_probe(struct platform_device *pdev) +{ + int ret; + ret = sysfs_create_group(&pdev->dev.kobj, &swpld4_device_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + return -ENODEV; + } + return 0; +} + +static int __exit swpld1_remove(struct platform_device *pdev) +{ + sysfs_remove_group(&pdev->dev.kobj, &swpld1_device_attr_grp); + return 0; +} + +static int __exit swpld2_remove(struct platform_device *pdev) +{ + sysfs_remove_group(&pdev->dev.kobj, &swpld2_device_attr_grp); + return 0; +} + +static int __exit swpld3_remove(struct platform_device *pdev) +{ + sysfs_remove_group(&pdev->dev.kobj, &swpld3_device_attr_grp); + return 0; +} + +static int __exit swpld4_remove(struct platform_device *pdev) +{ + sysfs_remove_group(&pdev->dev.kobj, &swpld4_device_attr_grp); + return 0; +} + +static struct platform_driver swpld1_driver = { + .probe = swpld1_probe, + .remove = __exit_p(swpld1_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9064-swpld1", + }, +}; + +static struct platform_driver swpld2_driver = { + .probe = swpld2_probe, + .remove = __exit_p(swpld2_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9064-swpld2", + }, +}; + +static struct platform_driver swpld3_driver = { + .probe = swpld3_probe, + .remove = __exit_p(swpld3_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9064-swpld3", + }, +}; + +static struct platform_driver swpld4_driver = { + .probe = swpld4_probe, + .remove = __exit_p(swpld4_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9064-swpld4", + }, +}; +/*---------------- CPLD - end ------------- */ + +/*---------------- module initialization ------------- */ +static void __init delta_ag9064_swpld_init(void) +{ + int ret; + printk(KERN_WARNING "ag9064_platform_swpld module initialization\n"); + + ret = dni_create_user(); + if (ret != 0){ + printk(KERN_WARNING "Fail to create IPMI user\n"); + } + + // set the SWPLD prob and remove + ret = platform_driver_register(&swpld1_driver); + if (ret) { + printk(KERN_WARNING "Fail to register swpld driver\n"); + goto error_swpld1_driver; + } + + // register the SWPLD + ret = platform_device_register(&swpld1_device); + if (ret) { + printk(KERN_WARNING "Fail to create swpld device\n"); + goto error_swpld1_device; + } + + // set the SWPLD prob and remove + ret = platform_driver_register(&swpld2_driver); + if (ret) { + printk(KERN_WARNING "Fail to register swpld driver\n"); + goto error_swpld2_driver; + } + + // register the SWPLD + ret = platform_device_register(&swpld2_device); + if (ret) { + printk(KERN_WARNING "Fail to create swpld device\n"); + goto error_swpld2_device; + } + + // set the SWPLD prob and remove + ret = platform_driver_register(&swpld3_driver); + if (ret) { + printk(KERN_WARNING "Fail to register swpld driver\n"); + goto error_swpld3_driver; + } + + // register the SWPLD + ret = platform_device_register(&swpld3_device); + if (ret) { + printk(KERN_WARNING "Fail to create swpld device\n"); + goto error_swpld3_device; + } + + // set the SWPLD prob and remove + ret = platform_driver_register(&swpld4_driver); + if (ret) { + printk(KERN_WARNING "Fail to register swpld driver\n"); + goto error_swpld4_driver; + } + + // register the SWPLD + ret = platform_device_register(&swpld4_device); + if (ret) { + printk(KERN_WARNING "Fail to create swpld device\n"); + goto error_swpld4_device; + } + return 0; + +error_swpld4_device: + platform_driver_unregister(&swpld4_driver); +error_swpld4_driver: + platform_driver_unregister(&swpld3_device); +error_swpld3_device: + platform_driver_unregister(&swpld3_driver); +error_swpld3_driver: + platform_driver_unregister(&swpld2_device); +error_swpld2_device: + platform_driver_unregister(&swpld2_driver); +error_swpld2_driver: + platform_driver_unregister(&swpld1_device); +error_swpld1_device: + platform_driver_unregister(&swpld1_driver); +error_swpld1_driver: + return ret; +} + +static void __exit delta_ag9064_swpld_exit(void) +{ + platform_device_unregister(&swpld1_device); + platform_driver_unregister(&swpld1_driver); + platform_device_unregister(&swpld2_device); + platform_driver_unregister(&swpld2_driver); + platform_device_unregister(&swpld3_device); + platform_driver_unregister(&swpld3_driver); + platform_device_unregister(&swpld4_device); + platform_driver_unregister(&swpld4_driver); +} +module_init(delta_ag9064_swpld_init); +module_exit(delta_ag9064_swpld_exit); + +MODULE_DESCRIPTION("DNI ag9064 CPLD Platform Support"); +MODULE_AUTHOR("Stanley Chi "); +MODULE_LICENSE("GPL"); \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init index 669379fc9c12..dee41fd6f457 100755 --- a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init @@ -26,6 +26,8 @@ start) modprobe ipmi_devintf modprobe ipmi_si trydefaults=1 modprobe delta_ag9064_platform + modprobe delta_ag9064_cpld + modprobe delta_ag9064_swpld /usr/local/bin/ag9064_platform_init.sh From ebea937a7a795469b3f33d2d500e88520045c14d Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Sat, 24 Mar 2018 03:36:25 +0800 Subject: [PATCH 068/274] [devices]: New platform as7326-56x (#1524) * Update sonic-platform-modules-accton to lastest Signed-off-by: roylee123 * Install sonic-platform-common package in platform-monitor docker for ledd (#1330) * Install sonic-platform-common package in platform-monitor docker for ledd * Specify Python wheel dependencies in docker-platform-monitor.mk; Remove explicit specifications from Dockerfile.j2 * Add related files for new platfrom as7326_56x. Signed-off-by: roy_lee * Validate sfputil.py and verified. Signed-off-by: roy_lee * Push submodule sonic-platform-modules-accton for as7326-56x validation. Signed-off-by: roy_lee --- .../Accton-AS7326-56X/port_config.ini | 55 + .../Accton-AS7326-56X/sai.profile | 1 + .../installer.conf | 1 + .../led_proc_init.soc | 79 ++ .../x86_64-accton_as7326_56x-r0/minigraph.xml | 1184 +++++++++++++++++ .../plugins/eeprom.py | 21 + .../plugins/psuutil.py | 61 + .../plugins/sfputil.py | 203 +++ platform/broadcom/one-image.mk | 1 + platform/broadcom/platform-modules-accton.mk | 6 + .../broadcom/sonic-platform-modules-accton | 2 +- 11 files changed, 1613 insertions(+), 1 deletion(-) create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/Accton-AS7326-56X/port_config.ini create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/Accton-AS7326-56X/sai.profile create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/installer.conf create mode 100755 device/accton/x86_64-accton_as7326_56x-r0/led_proc_init.soc create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/minigraph.xml create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/plugins/eeprom.py create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/plugins/psuutil.py create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/plugins/sfputil.py diff --git a/device/accton/x86_64-accton_as7326_56x-r0/Accton-AS7326-56X/port_config.ini b/device/accton/x86_64-accton_as7326_56x-r0/Accton-AS7326-56X/port_config.ini new file mode 100644 index 000000000000..2c4d0c023772 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/Accton-AS7326-56X/port_config.ini @@ -0,0 +1,55 @@ +# name lanes alias index +Ethernet0 41 twentyfiveGigE1 0 +Ethernet1 42 twentyfiveGigE2 1 +Ethernet2 43 twentyfiveGigE3 2 +Ethernet3 44 twentyfiveGigE4 3 +Ethernet4 49 twentyfiveGigE5 4 +Ethernet5 50 twentyfiveGigE6 5 +Ethernet6 51 twentyfiveGigE7 6 +Ethernet7 52 twentyfiveGigE8 7 +Ethernet8 53 twentyfiveGigE9 8 +Ethernet9 54 twentyfiveGigE10 9 +Ethernet10 55 twentyfiveGigE11 10 +Ethernet11 56 twentyfiveGigE12 11 +Ethernet12 65 twentyfiveGigE13 12 +Ethernet13 66 twentyfiveGigE14 13 +Ethernet14 67 twentyfiveGigE15 14 +Ethernet15 68 twentyfiveGigE16 15 +Ethernet16 33 twentyfiveGigE17 16 +Ethernet17 34 twentyfiveGigE18 17 +Ethernet18 35 twentyfiveGigE19 18 +Ethernet19 36 twentyfiveGigE20 19 +Ethernet20 37 twentyfiveGigE21 20 +Ethernet21 38 twentyfiveGigE22 21 +Ethernet22 39 twentyfiveGigE23 22 +Ethernet23 40 twentyfiveGigE24 23 +Ethernet24 69 twentyfiveGigE25 24 +Ethernet25 70 twentyfiveGigE26 25 +Ethernet26 71 twentyfiveGigE27 26 +Ethernet27 72 twentyfiveGigE28 27 +Ethernet28 81 twentyfiveGigE29 28 +Ethernet29 82 twentyfiveGigE30 29 +Ethernet30 83 twentyfiveGigE31 30 +Ethernet31 84 twentyfiveGigE32 31 +Ethernet32 85 twentyfiveGigE33 32 +Ethernet33 86 twentyfiveGigE34 33 +Ethernet34 87 twentyfiveGigE35 34 +Ethernet35 88 twentyfiveGigE36 35 +Ethernet36 97 twentyfiveGigE37 36 +Ethernet37 98 twentyfiveGigE38 37 +Ethernet38 99 twentyfiveGigE39 38 +Ethernet39 100 twentyfiveGigE40 39 +Ethernet40 101 twentyfiveGigE41 40 +Ethernet41 102 twentyfiveGigE42 41 +Ethernet42 103 twentyfiveGigE43 42 +Ethernet43 104 twentyfiveGigE44 43 +Ethernet44 105 twentyfiveGigE45 44 +Ethernet45 106 twentyfiveGigE46 45 +Ethernet46 107 twentyfiveGigE47 46 +Ethernet47 108 twentyfiveGigE48 47 +Ethernet48 5,6,7,8 hundredGigE49 48 +Ethernet52 1,2,3,4 hundredGigE50 52 +Ethernet56 109,110,111,112 hundredGigE51 56 +Ethernet60 21,22,23,24 hundredGigE52 60 +Ethernet64 9,10,11,12 hundredGigE53 64 +Ethernet68 117,118,119,120 hundredGigE54 68 diff --git a/device/accton/x86_64-accton_as7326_56x-r0/Accton-AS7326-56X/sai.profile b/device/accton/x86_64-accton_as7326_56x-r0/Accton-AS7326-56X/sai.profile new file mode 100644 index 000000000000..0e465ce12edd --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/Accton-AS7326-56X/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/td3-as7326-48x25G+8x100G.config.bcm diff --git a/device/accton/x86_64-accton_as7326_56x-r0/installer.conf b/device/accton/x86_64-accton_as7326_56x-r0/installer.conf new file mode 100644 index 000000000000..5e62742c11bf --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/installer.conf @@ -0,0 +1 @@ +CONSOLE_SPEED=115200 diff --git a/device/accton/x86_64-accton_as7326_56x-r0/led_proc_init.soc b/device/accton/x86_64-accton_as7326_56x-r0/led_proc_init.soc new file mode 100755 index 000000000000..d96b2d00c583 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/led_proc_init.soc @@ -0,0 +1,79 @@ +# accton_as7326_56x 48x25G+8x100G SDK port LED macro init SOC +s CMIC_LEDUP0_DATA_RAM 0 +s CMIC_LEDUP1_DATA_RAM 0 + +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=63 REMAP_PORT_1=63 REMAP_PORT_2=63 REMAP_PORT_3=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=63 REMAP_PORT_5=63 REMAP_PORT_6=63 REMAP_PORT_7=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=27 REMAP_PORT_9=26 REMAP_PORT_10=25 REMAP_PORT_11=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 REMAP_PORT_13=63 REMAP_PORT_14=63 REMAP_PORT_15=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=63 REMAP_PORT_17=63 REMAP_PORT_18=63 REMAP_PORT_19=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=31 REMAP_PORT_21=30 REMAP_PORT_22=29 REMAP_PORT_23=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=15 REMAP_PORT_25=14 REMAP_PORT_26=13 REMAP_PORT_27=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=19 REMAP_PORT_29=18 REMAP_PORT_30=17 REMAP_PORT_31=16 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=63 REMAP_PORT_33=63 REMAP_PORT_34=63 REMAP_PORT_35=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=63 REMAP_PORT_37=63 REMAP_PORT_38=63 REMAP_PORT_39=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=35 REMAP_PORT_41=34 REMAP_PORT_42=33 REMAP_PORT_43=32 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=63 REMAP_PORT_45=63 REMAP_PORT_46=63 REMAP_PORT_47=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=23 REMAP_PORT_49=22 REMAP_PORT_50=21 REMAP_PORT_51=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 REMAP_PORT_53=10 REMAP_PORT_54=9 REMAP_PORT_55=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 REMAP_PORT_57=6 REMAP_PORT_58=5 REMAP_PORT_59=4 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 REMAP_PORT_61=2 REMAP_PORT_62=1 REMAP_PORT_63=0 + +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=19 REMAP_PORT_1=18 REMAP_PORT_2=17 REMAP_PORT_3=16 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=23 REMAP_PORT_5=22 REMAP_PORT_6=21 REMAP_PORT_7=20 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=3 REMAP_PORT_9=2 REMAP_PORT_10=1 REMAP_PORT_11=0 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 REMAP_PORT_13=63 REMAP_PORT_14=63 REMAP_PORT_15=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=7 REMAP_PORT_17=6 REMAP_PORT_18=5 REMAP_PORT_19=4 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=11 REMAP_PORT_21=10 REMAP_PORT_22=9 REMAP_PORT_23=8 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=63 REMAP_PORT_25=63 REMAP_PORT_26=63 REMAP_PORT_27=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=63 REMAP_PORT_29=63 REMAP_PORT_30=63 REMAP_PORT_31=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=15 REMAP_PORT_33=14 REMAP_PORT_34=13 REMAP_PORT_35=12 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=27 REMAP_PORT_37=26 REMAP_PORT_38=25 REMAP_PORT_39=24 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=63 REMAP_PORT_41=63 REMAP_PORT_42=63 REMAP_PORT_43=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=63 REMAP_PORT_45=63 REMAP_PORT_46=63 REMAP_PORT_47=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=31 REMAP_PORT_49=30 REMAP_PORT_50=29 REMAP_PORT_51=28 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=35 REMAP_PORT_53=34 REMAP_PORT_54=33 REMAP_PORT_55=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=63 REMAP_PORT_57=63 REMAP_PORT_58=63 REMAP_PORT_59=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=63 REMAP_PORT_61=63 REMAP_PORT_62=63 REMAP_PORT_63=63 + +led 0 stop +led 0 prog \ + 02 FD 42 80 02 FF 42 00 02 FE 42 00 02 FA 42 7E \ + 02 FB 42 24 06 F9 D2 00 74 1E 02 F9 42 03 67 AC \ + 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 \ + 86 FE 67 C3 67 52 86 FE 06 FB D6 FE 74 1E 86 FC \ + 3E FA 06 FE 88 4A 03 71 4C 67 84 57 67 84 57 67 \ + 98 57 06 FE 88 80 4A 00 27 97 75 4F 90 4A 00 27 \ + 4A 01 27 B7 97 71 69 77 42 06 F9 D6 FC 74 7C 02 \ + F9 4A 07 37 4E 07 02 FC 42 00 4E 07 06 F9 0A 07 \ + 71 4F 77 42 16 FF 06 FD 17 4D DA 07 74 95 12 FF \ + 52 00 86 FD 57 86 FF 57 16 FF 06 FD 07 4D DA 07 \ + 74 A9 12 FF 52 00 86 FD 57 86 FF 57 06 FE C2 FC \ + 98 98 12 F4 50 C2 FC 98 98 F2 F0 14 06 F4 C2 03 \ + 88 77 D1 06 FE C2 FC 98 98 F2 E0 14 06 FE C2 03 \ + 88 18 71 E2 80 18 71 DD 67 98 67 98 57 67 98 67 \ + 84 57 80 18 71 EB 67 84 67 98 57 67 84 67 84 57 \ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +led 0 start +led auto on + +led 1 stop +led 1 prog \ + 02 FD 42 80 02 FF 42 00 02 FE 42 00 02 FA 42 7E \ + 02 FB 42 24 06 F9 D2 00 74 1E 02 F9 42 03 67 AC \ + 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 \ + 86 FE 67 C3 67 52 86 FE 06 FB D6 FE 74 1E 86 FC \ + 3E FA 06 FE 88 4A 03 71 4C 67 84 57 67 84 57 67 \ + 98 57 06 FE 88 80 4A 00 27 97 75 4F 90 4A 00 27 \ + 4A 01 27 B7 97 71 69 77 42 06 F9 D6 FC 74 7C 02 \ + F9 4A 07 37 4E 07 02 FC 42 00 4E 07 06 F9 0A 07 \ + 71 4F 77 42 16 FF 06 FD 17 4D DA 07 74 95 12 FF \ + 52 00 86 FD 57 86 FF 57 16 FF 06 FD 07 4D DA 07 \ + 74 A9 12 FF 52 00 86 FD 57 86 FF 57 06 FE C2 FC \ + 98 98 12 F4 50 C2 FC 98 98 F2 F0 14 06 F4 C2 03 \ + 88 77 D1 06 FE C2 FC 98 98 F2 E0 14 06 FE C2 03 \ + 88 18 71 E2 80 18 71 DD 67 98 67 98 57 67 98 67 \ + 84 57 80 18 71 EB 67 84 67 98 57 67 84 67 84 57 \ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +led 1 start +led auto on diff --git a/device/accton/x86_64-accton_as7326_56x-r0/minigraph.xml b/device/accton/x86_64-accton_as7326_56x-r0/minigraph.xml new file mode 100644 index 000000000000..0aa3f02144ef --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/minigraph.xml @@ -0,0 +1,1184 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + sonic + 10.0.0.32 + 1 + 180 + 60 + + + sonic + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + sonic + 10.0.0.34 + 1 + 180 + 60 + + + sonic + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + sonic + 10.0.0.36 + 1 + 180 + 60 + + + sonic + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + sonic + 10.0.0.38 + 1 + 180 + 60 + + + sonic + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + sonic + 10.0.0.40 + 1 + 180 + 60 + + + sonic + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + sonic + 10.0.0.42 + 1 + 180 + 60 + + + sonic + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + sonic + 10.0.0.44 + 1 + 180 + 60 + + + sonic + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + sonic + 10.0.0.46 + 1 + 180 + 60 + + + sonic + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + sonic + 10.0.0.48 + 1 + 180 + 60 + + + sonic + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + sonic + 10.0.0.50 + 1 + 180 + 60 + + + sonic + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + sonic + 10.0.0.52 + 1 + 180 + 60 + + + sonic + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + sonic + 10.0.0.54 + 1 + 180 + 60 + + + sonic + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + sonic + 10.0.0.56 + 1 + 180 + 60 + + + sonic + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + sonic + 10.0.0.58 + 1 + 180 + 60 + + + sonic + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + sonic + 10.0.0.60 + 1 + 180 + 60 + + + sonic + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + sonic + 10.0.0.62 + 1 + 180 + 60 + + + sonic + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + sonic + + +
10.0.0.33
+ + +
+ +
10.0.0.1
+ + +
+ +
10.0.0.35
+ + +
+ +
10.0.0.3
+ + +
+ +
10.0.0.37
+ + +
+ +
10.0.0.5
+ + +
+ +
10.0.0.39
+ + +
+ +
10.0.0.7
+ + +
+ +
10.0.0.41
+ + +
+ +
10.0.0.9
+ + +
+ +
10.0.0.43
+ + +
+ +
10.0.0.11
+ + +
+ +
10.0.0.45
+ + +
+ +
10.0.0.13
+ + +
+ +
10.0.0.47
+ + +
+ +
10.0.0.15
+ + +
+ +
10.0.0.49
+ + +
+ +
10.0.0.17
+ + +
+ +
10.0.0.51
+ + +
+ +
10.0.0.19
+ + +
+ +
10.0.0.53
+ + +
+ +
10.0.0.21
+ + +
+ +
10.0.0.55
+ + +
+ +
10.0.0.23
+ + +
+ +
10.0.0.57
+ + +
+ +
10.0.0.25
+ + +
+ +
10.0.0.59
+ + +
+ +
10.0.0.27
+ + +
+ +
10.0.0.61
+ + +
+ +
10.0.0.29
+ + +
+ +
10.0.0.63
+ + +
+ +
10.0.0.31
+ + +
+
+ +
+ + 64001 + ARISTA01T0 + + + + 65200 + ARISTA01T2 + + + + 64002 + ARISTA02T0 + + + + 65200 + ARISTA02T2 + + + + 64003 + ARISTA03T0 + + + + 65200 + ARISTA03T2 + + + + 64004 + ARISTA04T0 + + + + 65200 + ARISTA04T2 + + + + 64005 + ARISTA05T0 + + + + 65200 + ARISTA05T2 + + + + 64006 + ARISTA06T0 + + + + 65200 + ARISTA06T2 + + + + 64007 + ARISTA07T0 + + + + 65200 + ARISTA07T2 + + + + 64008 + ARISTA08T0 + + + + 65200 + ARISTA08T2 + + + + 64009 + ARISTA09T0 + + + + 65200 + ARISTA09T2 + + + + 64010 + ARISTA10T0 + + + + 65200 + ARISTA10T2 + + + + 64011 + ARISTA11T0 + + + + 65200 + ARISTA11T2 + + + + 64012 + ARISTA12T0 + + + + 65200 + ARISTA12T2 + + + + 64013 + ARISTA13T0 + + + + 65200 + ARISTA13T2 + + + + 64014 + ARISTA14T0 + + + + 65200 + ARISTA14T2 + + + + 64015 + ARISTA15T0 + + + + 65200 + ARISTA15T2 + + + + 64016 + ARISTA16T0 + + + + 65200 + ARISTA16T2 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + + + + + + sonic + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet1 + 10.0.0.2/31 + + + + Ethernet2 + 10.0.0.4/31 + + + + Ethernet3 + 10.0.0.6/31 + + + + Ethernet4 + 10.0.0.8/31 + + + + Ethernet5 + 10.0.0.10/31 + + + + Ethernet6 + 10.0.0.12/31 + + + + Ethernet7 + 10.0.0.14/31 + + + + Ethernet8 + 10.0.0.16/31 + + + + Ethernet9 + 10.0.0.18/31 + + + + Ethernet10 + 10.0.0.20/31 + + + + Ethernet11 + 10.0.0.22/31 + + + + Ethernet12 + 10.0.0.24/31 + + + + Ethernet13 + 10.0.0.26/31 + + + + Ethernet14 + 10.0.0.28/31 + + + + Ethernet15 + 10.0.0.30/31 + + + + Ethernet16 + 10.0.0.32/31 + + + + Ethernet17 + 10.0.0.34/31 + + + + Ethernet18 + 10.0.0.36/31 + + + + Ethernet19 + 10.0.0.38/31 + + + + Ethernet20 + 10.0.0.40/31 + + + + Ethernet21 + 10.0.0.42/31 + + + + Ethernet22 + 10.0.0.44/31 + + + + Ethernet23 + 10.0.0.46/31 + + + + Ethernet24 + 10.0.0.48/31 + + + + Ethernet25 + 10.0.0.50/31 + + + + Ethernet26 + 10.0.0.52/31 + + + + Ethernet27 + 10.0.0.54/31 + + + + Ethernet28 + 10.0.0.56/31 + + + + Ethernet29 + 10.0.0.58/31 + + + + Ethernet30 + 10.0.0.60/31 + + + + Ethernet31 + 10.0.0.62/31 + + + + Ethernet32 + 10.0.0.64/31 + + + + Ethernet33 + 10.0.0.66/31 + + + + Ethernet34 + 10.0.0.68/31 + + + + Ethernet35 + 10.0.0.70/31 + + + + Ethernet36 + 10.0.0.72/31 + + + + Ethernet37 + 10.0.0.74/31 + + + + Ethernet38 + 10.0.0.76/31 + + + + Ethernet39 + 10.0.0.78/31 + + + + Ethernet40 + 10.0.0.80/31 + + + + Ethernet41 + 10.0.0.82/31 + + + + Ethernet42 + 10.0.0.84/31 + + + + Ethernet43 + 10.0.0.86/31 + + + + Ethernet44 + 10.0.0.88/31 + + + + Ethernet45 + 10.0.0.90/31 + + + + Ethernet46 + 10.0.0.92/31 + + + + Ethernet47 + 10.0.0.94/31 + + + + Ethernet48 + 10.0.0.96/31 + + + + Ethernet52 + 10.0.0.98/31 + + + + Ethernet56 + 10.0.0.100/31 + + + + Ethernet60 + 10.0.0.102/31 + + + + Ethernet64 + 10.0.0.104/31 + + + + Ethernet68 + 10.0.0.106/31 + + + + + + + + + + + + DeviceInterfaceLink + sonic + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet1 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet2 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet3 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet4 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet5 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet6 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet7 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet8 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet9 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet10 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet11 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet12 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet13 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet14 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet15 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet16 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet17 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet18 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet19 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet20 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet21 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet22 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet23 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet24 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet25 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet26 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet27 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet28 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet29 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet30 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet31 + ARISTA16T0 + Ethernet1 + + + + + sonic + Accton-AS7326-56X + + + + + + + sonic + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + sonic + Accton-AS7326-56X +
diff --git a/device/accton/x86_64-accton_as7326_56x-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as7326_56x-r0/plugins/eeprom.py new file mode 100644 index 000000000000..1e7d1046d93d --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/plugins/eeprom.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/accton/x86_64-accton_as7326_56x-r0/plugins/psuutil.py b/device/accton/x86_64-accton_as7326_56x-r0/plugins/psuutil.py new file mode 100644 index 000000000000..a3c30bc478e7 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/plugins/psuutil.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +############################################################################# +# Accton +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/" + self.psu_presence = "/psu_present" + self.psu_oper_status = "/psu_power_good" + self.psu_mapping = { + 2: "13-0053", + 1: "17-0051", + } + + def get_num_psus(self): + return len(self.psu_mapping) + + def get_psu_status(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index]+self.psu_oper_status + try: + with open(node, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index] + self.psu_presence + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/accton/x86_64-accton_as7326_56x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7326_56x-r0/plugins/sfputil.py new file mode 100644 index 000000000000..a09dd0d7c7bf --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/plugins/sfputil.py @@ -0,0 +1,203 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 0 + PORT_END = 81 + PORTS_IN_BLOCK = 82 + QSFP_PORT_START = 48 + QSFP_PORT_END = 82 + + BASE_VAL_PATH = "/sys/class/i2c-adapter/i2c-{0}/{1}-0050/" + + _port_to_is_present = {} + _port_to_lp_mode = {} + + _port_to_eeprom_mapping = {} + _cpld_mapping = { + 1: "12-0062", + 2: "18-0060", + 3: "19-0064", + } + + _port_to_i2c_mapping = { + 0: 42, + 1: 41, + 2: 44, + 3: 43, + 4: 47, + 5: 45, + 6: 46, + 7: 50, + 8: 48, + 9: 49, + 10: 51, + 11: 52, + 12: 53, + 13: 56, + 14: 55, + 15: 54, + 16: 58, + 17: 57, + 18: 59, + 19: 60, + 20: 61, + 21: 63, + 22: 62, + 23: 64, + 24: 66, + 25: 68, + 26: 65, + 27: 67, + 28: 69, + 29: 71, + 30: 72, + 31: 70, + 32: 74, + 33: 73, + 34: 76, + 35: 75, + 36: 77, + 37: 79, + 38: 78, + 39: 80, + 40: 81, + 41: 82, + 42: 84, + 43: 85, + 44: 83, + 45: 87, + 46: 88, + 47: 86, + 48: 25, #QSFP49 + 49: 25, + 50: 25, + 51: 25, + 52: 26, #QSFP50 + 53: 26, + 54: 26, + 55: 26, + 56: 27, #QSFP51 + 57: 26, + 58: 26, + 59: 26, + 60: 28, #QSFP52 + 61: 26, + 62: 26, + 63: 26, + 64: 29, #QSFP53 + 65: 26, + 66: 26, + 67: 26, + 68: 30, #QSFP54 + 69: 26, + 70: 26, + 71: 26, + 72: 31, #QSFP55 + 73: 26, + 74: 26, + 75: 26, + 76: 32, #QSFP56 + 77: 26, + 78: 26, + 79: 26, + 80: 22, + 81: 23} + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_port_start(self): + return self.QSFP_PORT_START + + @property + def qsfp_port_end(self): + return self.QSFP_PORT_END + + @property + def qsfp_ports(self): + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom' + for x in range(0, self.port_end+1): + self.port_to_eeprom_mapping[x] = eeprom_path.format( + self._port_to_i2c_mapping[x]) + + SfpUtilBase.__init__(self) + + + # For port 48~51 are QSFP, here presumed they're all split to 4 lanes. + def get_cage_num(self, port_num): + cage_num = port_num + if (port_num >= self.QSFP_PORT_START): + cage_num = (port_num - self.QSFP_PORT_START)/4 + cage_num = cage_num + self.QSFP_PORT_START + + return cage_num + + # For cage 0~23 and 48~51 are at cpld2, others are at cpld3. + def get_cpld_num(self, port_num): + cpld_i = 1 + cage_num = self.get_cage_num(port_num) + if (port_num > 29): + cpld_i = 2 + return cpld_i + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + cage_num = self.get_cage_num(port_num) + cpld_i = self.get_cpld_num(port_num) + #print "[ROY] cpld:%d" % cpld_i + + cpld_ps = self._cpld_mapping[cpld_i] + path = "/sys/bus/i2c/devices/{0}/module_present_{1}" + port_ps = path.format(cpld_ps, cage_num+1) + + try: + val_file = open(port_ps) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def get_low_power_mode(self, port_num): + raise NotImplementedError + + def set_low_power_mode(self, port_num, lpmode): + raise NotImplementedError + + def reset(self, port_num): + raise NotImplementedError diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 908c99c05f9a..631d735d145d 100755 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -17,6 +17,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(ACCTON_AS7816_64X_PLATFORM_MODULE) \ $(ACCTON_AS7716_32X_PLATFORM_MODULE) \ $(ACCTON_AS7312_54X_PLATFORM_MODULE) \ + $(ACCTON_AS7326_56X_PLATFORM_MODULE) \ $(ACCTON_AS7716_32XB_PLATFORM_MODULE) \ $(INVENTEC_D7032Q28B_PLATFORM_MODULE) \ $(INVENTEC_D7054Q28B_PLATFORM_MODULE) \ diff --git a/platform/broadcom/platform-modules-accton.mk b/platform/broadcom/platform-modules-accton.mk index 63d277b47e6f..b09c9559f775 100755 --- a/platform/broadcom/platform-modules-accton.mk +++ b/platform/broadcom/platform-modules-accton.mk @@ -5,6 +5,7 @@ ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS7816_64X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS7716_32X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS7312_54X_PLATFORM_MODULE_VERSION = 1.1 +ACCTON_AS7326_56X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS7716_32XB_PLATFORM_MODULE_VERSION = 1.1 export ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION @@ -12,6 +13,7 @@ export ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION export ACCTON_AS7816_64X_PLATFORM_MODULE_VERSION export ACCTON_AS7716_32X_PLATFORM_MODULE_VERSION export ACCTON_AS7312_54X_PLATFORM_MODULE_VERSION +export ACCTON_AS7326_56X_PLATFORM_MODULE_VERSION export ACCTON_AS7716_32XB_PLATFORM_MODULE_VERSION ACCTON_AS7712_32X_PLATFORM_MODULE = sonic-platform-accton-as7712-32x_$(ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION)_amd64.deb @@ -36,6 +38,10 @@ ACCTON_AS7312_54X_PLATFORM_MODULE = sonic-platform-accton-as7312-54x_$(ACCTON_AS $(ACCTON_AS7312_54X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7312_54x-r0 $(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS7312_54X_PLATFORM_MODULE))) +ACCTON_AS7326_56X_PLATFORM_MODULE = sonic-platform-accton-as7326-56x_$(ACCTON_AS7326_56X_PLATFORM_MODULE_VERSION)_amd64.deb +$(ACCTON_AS7326_56X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7326_56x-r0 +$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS7326_56X_PLATFORM_MODULE))) + ACCTON_AS7716_32XB_PLATFORM_MODULE = sonic-platform-accton-as7716-32xb_$(ACCTON_AS7716_32XB_PLATFORM_MODULE_VERSION)_amd64.deb $(ACCTON_AS7716_32XB_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7716_32xb-r0 $(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS7716_32XB_PLATFORM_MODULE))) diff --git a/platform/broadcom/sonic-platform-modules-accton b/platform/broadcom/sonic-platform-modules-accton index 296471b9cd53..406c4e675ea7 160000 --- a/platform/broadcom/sonic-platform-modules-accton +++ b/platform/broadcom/sonic-platform-modules-accton @@ -1 +1 @@ -Subproject commit 296471b9cd538dd0d10bd7d9c6a7d05ffc0ba45a +Subproject commit 406c4e675ea73d52827b520958c9956551a94e8e From dba35eebb1c710f0e55f563ae5d438a16a088a7a Mon Sep 17 00:00:00 2001 From: padmanarayana Date: Sat, 24 Mar 2018 03:46:54 +0530 Subject: [PATCH 069/274] [baseimage]: Updategraph during NOS->SONiC migration (#1521) --- files/image_config/platform/rc.local | 1 + 1 file changed, 1 insertion(+) diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index a89b800d12f1..a931efb5b469 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -197,6 +197,7 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then mkdir -p /etc/sonic/old_config mv /host/migration/minigraph.xml /etc/sonic/old_config/ touch /tmp/pending_config_migration + [ -f /etc/sonic/updategraph.conf ] && sed -i -e "s/enabled=false/enabled=true/g" /etc/sonic/updategraph.conf else touch /tmp/pending_config_initialization fi From 830e1dd560e19c6e4d21b2004599bc292bd2bb08 Mon Sep 17 00:00:00 2001 From: nealtai <33504193+nealtai@users.noreply.github.com> Date: Sat, 24 Mar 2018 06:17:41 +0800 Subject: [PATCH 070/274] [device]: Add a new supported device, Delta-ag5648 (#1470) * [platform]: Add a new supported platform, Delta-ag5648 CPU : Intel Rangeley C2538 Swich ASIC: Broadcom Tomahawk BCM56967 Ports : 48x25G + 6x100G Switch SKU : Delta-ag5648 Signed-off-by: neal tai * Delete the file Delete the auto-generated file. * [device]: ag5648 remove all *.cmd files. remove the files under ag5648/modules Signed-off-by: neal tai * [device]: ag5648 device drivers 1. Use the common driver dni_emc2305.c ag9032v1 device drivers 1. Move dni_emc2305.c to be the common driver 2. Remove at24.c Signed-off-by: neal tai --- .../Delta-ag5648/port_config.ini | 55 + .../Delta-ag5648/sai.profile | 1 + .../delta/x86_64-delta_ag5648-r0/fancontrol | 10 + .../x86_64-delta_ag5648-r0/fancontrol.service | 262 +++ .../x86_64-delta_ag5648-r0/installer.conf | 2 + .../x86_64-delta_ag5648-r0/led_proc_init.soc | 67 + .../x86_64-delta_ag5648-r0/minigraph.xml | 1184 +++++++++++++ .../x86_64-delta_ag5648-r0/plugins/eeprom.py | 32 + .../x86_64-delta_ag5648-r0/plugins/psuutil.py | 56 + .../x86_64-delta_ag5648-r0/plugins/sfputil.py | 203 +++ .../delta/x86_64-delta_ag5648-r0/sensors.conf | 91 + platform/broadcom/one-image.mk | 1 + platform/broadcom/platform-modules-delta.mk | 7 + .../ag5648/cfg/ag5648-modules.conf | 13 + .../ag5648/modules/Makefile | 2 + .../ag5648/modules/delta_ag5648_platform.c | 1542 +++++++++++++++++ .../ag5648/modules/dni_ag5648_psu.c | 552 ++++++ .../ag5648/modules/dni_emc2305.c | 1 + .../ag5648/scripts/ag5648_platform_init.sh | 13 + .../ag5648/scripts/led_control | 221 +++ .../ag5648/sensors.conf | 94 + .../ag9032v1/modules/Makefile | 2 +- .../ag9032v1/modules/at24.c | 698 -------- .../ag9032v1/modules/dni_emc2305.c | 382 +--- .../common/modules/dni_emc2305.c | 381 ++++ .../debian/control | 5 + .../sonic-platform-modules-delta/debian/files | 2 - .../debian/platform-modules-ag5648.init | 49 + .../debian/platform-modules-ag5648.install | 3 + .../sonic-platform-modules-delta/debian/rules | 2 +- 30 files changed, 4850 insertions(+), 1083 deletions(-) create mode 100644 device/delta/x86_64-delta_ag5648-r0/Delta-ag5648/port_config.ini create mode 100644 device/delta/x86_64-delta_ag5648-r0/Delta-ag5648/sai.profile create mode 100644 device/delta/x86_64-delta_ag5648-r0/fancontrol create mode 100755 device/delta/x86_64-delta_ag5648-r0/fancontrol.service create mode 100644 device/delta/x86_64-delta_ag5648-r0/installer.conf create mode 100755 device/delta/x86_64-delta_ag5648-r0/led_proc_init.soc create mode 100644 device/delta/x86_64-delta_ag5648-r0/minigraph.xml create mode 100644 device/delta/x86_64-delta_ag5648-r0/plugins/eeprom.py create mode 100644 device/delta/x86_64-delta_ag5648-r0/plugins/psuutil.py create mode 100644 device/delta/x86_64-delta_ag5648-r0/plugins/sfputil.py create mode 100644 device/delta/x86_64-delta_ag5648-r0/sensors.conf create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag5648/cfg/ag5648-modules.conf create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag5648/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag5648/modules/delta_ag5648_platform.c create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag5648/modules/dni_ag5648_psu.c create mode 120000 platform/broadcom/sonic-platform-modules-delta/ag5648/modules/dni_emc2305.c create mode 100755 platform/broadcom/sonic-platform-modules-delta/ag5648/scripts/ag5648_platform_init.sh create mode 100755 platform/broadcom/sonic-platform-modules-delta/ag5648/scripts/led_control create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag5648/sensors.conf delete mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/at24.c mode change 100644 => 120000 platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_emc2305.c create mode 100644 platform/broadcom/sonic-platform-modules-delta/common/modules/dni_emc2305.c delete mode 100644 platform/broadcom/sonic-platform-modules-delta/debian/files create mode 100755 platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag5648.init create mode 100644 platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag5648.install diff --git a/device/delta/x86_64-delta_ag5648-r0/Delta-ag5648/port_config.ini b/device/delta/x86_64-delta_ag5648-r0/Delta-ag5648/port_config.ini new file mode 100644 index 000000000000..ace4228d861a --- /dev/null +++ b/device/delta/x86_64-delta_ag5648-r0/Delta-ag5648/port_config.ini @@ -0,0 +1,55 @@ +# name lanes alias +Ethernet0 65 twentyfiveGigE1 +Ethernet4 66 twentyfiveGigE2 +Ethernet8 67 twentyfiveGigE3 +Ethernet12 68 twentyfiveGigE4 +Ethernet16 69 twentyfiveGigE5 +Ethernet20 70 twentyfiveGigE6 +Ethernet24 71 twentyfiveGigE7 +Ethernet28 72 twentyfiveGigE8 +Ethernet32 81 twentyfiveGigE9 +Ethernet36 82 twentyfiveGigE10 +Ethernet40 83 twentyfiveGigE11 +Ethernet44 84 twentyfiveGigE12 +Ethernet48 85 twentyfiveGigE13 +Ethernet52 86 twentyfiveGigE14 +Ethernet56 87 twentyfiveGigE15 +Ethernet60 88 twentyfiveGigE16 +Ethernet64 33 twentyfiveGigE17 +Ethernet68 34 twentyfiveGigE18 +Ethernet72 35 twentyfiveGigE19 +Ethernet76 36 twentyfiveGigE20 +Ethernet80 37 twentyfiveGigE21 +Ethernet84 38 twentyfiveGigE22 +Ethernet88 39 twentyfiveGigE23 +Ethernet92 40 twentyfiveGigE24 +Ethernet96 42 twentyfiveGigE25 +Ethernet100 41 twentyfiveGigE26 +Ethernet104 44 twentyfiveGigE27 +Ethernet108 43 twentyfiveGigE28 +Ethernet112 49 twentyfiveGigE29 +Ethernet116 50 twentyfiveGigE30 +Ethernet120 51 twentyfiveGigE31 +Ethernet124 52 twentyfiveGigE32 +Ethernet128 53 twentyfiveGigE33 +Ethernet132 54 twentyfiveGigE34 +Ethernet136 55 twentyfiveGigE35 +Ethernet140 56 twentyfiveGigE36 +Ethernet144 97 twentyfiveGigE37 +Ethernet148 98 twentyfiveGigE38 +Ethernet152 99 twentyfiveGigE39 +Ethernet156 100 twentyfiveGigE40 +Ethernet160 101 twentyfiveGigE41 +Ethernet164 102 twentyfiveGigE42 +Ethernet168 103 twentyfiveGigE43 +Ethernet172 104 twentyfiveGigE44 +Ethernet176 105 twentyfiveGigE45 +Ethernet180 106 twentyfiveGigE46 +Ethernet184 107 twentyfiveGigE47 +Ethernet188 108 twentyfiveGigE48 +Ethernet192 117,118,119,120 hundredGigE51 +Ethernet196 109,110,111,112 hundredGigE51 +Ethernet200 5,6,7,8 hundredGigE51 +Ethernet204 1,2,3,4 hundredGigE52 +Ethernet208 21,22,23,24 hundredGigE53 +Ethernet212 9,10,11,12 hundredGigE54 diff --git a/device/delta/x86_64-delta_ag5648-r0/Delta-ag5648/sai.profile b/device/delta/x86_64-delta_ag5648-r0/Delta-ag5648/sai.profile new file mode 100644 index 000000000000..142de3e860c9 --- /dev/null +++ b/device/delta/x86_64-delta_ag5648-r0/Delta-ag5648/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-ag5648-48x25G+6x100G.config.bcm diff --git a/device/delta/x86_64-delta_ag5648-r0/fancontrol b/device/delta/x86_64-delta_ag5648-r0/fancontrol new file mode 100644 index 000000000000..2666ad97d9ce --- /dev/null +++ b/device/delta/x86_64-delta_ag5648-r0/fancontrol @@ -0,0 +1,10 @@ +INTERVAL=10 +DEVPATH=hwmon1=/sys/bus/i2c/devices +DEVNAME=hwmon1=emc2305 +FCTEMPS=DEVPATH/2-004d/hwmon/hwmon*/temp1_input DEVPATH/3-0049/hwmon/hwmon*/temp1_input DEVPATH/3-004b/hwmon/hwmon*/temp1_input DEVPATH/3-004c/hwmon/hwmon*/temp1_input DEVPATH/3-004e/hwmon/hwmon*/temp1_input DEVPATH/3-004f/hwmon/hwmon*/temp1_input DEVPATH/6-0059/temp1_input DEVPATH/6-0058/temp1_input + +FCFANS=DEVPATH/3-004d/fan1_input DEVPATH/3-004d/fan2_input DEVPATH/3-004d/fan3_input DEVPATH/3-004d/fan4_input DEVPATH/5-004d/fan1_input DEVPATH/5-004d/fan2_input DEVPATH/5-004d/fan3_input DEVPATH/5-004d/fan4_input +MINTEMP=20 +MAXTEMP=60 +MINSTART=75 +MINSTOP=22 diff --git a/device/delta/x86_64-delta_ag5648-r0/fancontrol.service b/device/delta/x86_64-delta_ag5648-r0/fancontrol.service new file mode 100755 index 000000000000..ace4392f436d --- /dev/null +++ b/device/delta/x86_64-delta_ag5648-r0/fancontrol.service @@ -0,0 +1,262 @@ +#!/bin/bash +# +# Simple script implementing a temperature dependent fan speed control +# Supported Linux kernel versions: 2.6.5 and later +# +# Version 0.70 +# +# Usage: fancontrol.service [CONFIGFILE] +# +# Dependencies: +# bash, egrep, sed, cut, sleep, readlink, lm_sensors :) +# +# Please send any questions, comments or success stories to +# marius.reiner@hdev.de +# Thanks! +# +# For configuration instructions and warnings please see fancontrol.txt, which +# can be found in the doc/ directory or at the website mentioned above. +# +# +# Copyright 2003 Marius Reiner +# Copyright (C) 2007-2009 Jean Delvare +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA. +# +# + +PIDFILE="/var/run/fancontrol.pid" + +#DEBUG=1 +MAX=255 + +function LoadConfig +{ + local fcvcount fcv + + echo "Loading configuration from $1 ..." + if [ ! -r "$1" ] + then + echo "Error: Can't read configuration file" >&2 + exit 1 + fi + + # grep configuration from file + INTERVAL=`egrep '^INTERVAL=.*$' $1 | sed -e 's/INTERVAL=//g'` + DEVPATH=`egrep '^DEVPATH=.*$' $1 | sed -e 's/DEVPATH= *//g'` + DEVNAME=`egrep '^DEVNAME=.*$' $1 | sed -e 's/DEVNAME= *//g'` + FCTEMPS=`egrep '^FCTEMPS=.*$' $1 | sed -e 's/FCTEMPS=//g'` + MINTEMP=`egrep '^MINTEMP=.*$' $1 | sed -e 's/MINTEMP=//g'` + MAXTEMP=`egrep '^MAXTEMP=.*$' $1 | sed -e 's/MAXTEMP=//g'` + MINSTART=`egrep '^MINSTART=.*$' $1 | sed -e 's/MINSTART=//g'` + MINSTOP=`egrep '^MINSTOP=.*$' $1 | sed -e 's/MINSTOP=//g'` + HWMON=$( echo "$DEVPATH" | sed 's/=.*$//g') + FCDEVPATH=$( echo "$DEVPATH" | sed 's/^.*=//g') + FCMINTEMP=$MINTEMP + FCMAXTEMP=$MAXTEMP + FCMINSTART=$MINSTART + FCMINSTOP=$MINSTOP + + FCFANS=`egrep '^FCFANS=.*$' $1 | sed -e 's/FCFANS=//g'` + + # Check whether all mandatory settings are set + if [[ -z ${INTERVAL} || -z ${FCTEMPS} || -z ${MINTEMP} || -z ${MAXTEMP} || -z ${MINSTART} || -z ${MINSTOP} ]] + then + echo "Some mandatory settings missing, please check your config file!" >&2 + exit 1 + fi + if [ "$INTERVAL" -le 0 ] + then + echo "Error in configuration file:" >&2 + echo "INTERVAL must be at least 1" >&2 + exit 1 + fi + + # write settings to arrays for easier use and print them + echo "Common settings:" + + temp_string=$FCTEMPS + + let fcvcount=0 + for fcv in $FCTEMPS + do + fcvcount=$((fcvcount+1)) + AFCTEMP[$fcvcount]=$( echo "$temp_string" | cut -d" " -f $fcvcount ) + AFCTEMP[$fcvcount]=$( echo "${AFCTEMP[$fcvcount]}" | sed 's/DEVPATH/\/sys\/bus\/i2c\/devices/g' ) + AFCTEMP_PATH[$fcvcount]=$( echo "${AFCTEMP[$fcvcount]}" | sed 's/DEVPATH/\/sys\/bus\/i2c\/devices/g' ) + + #if [ $fcvcount -eq 5 ];then + #echo "0x00" > '/sys/bus/i2c/devices/6-0058/psu_select_member' + # AFCTEMP[$fcvcount]=$( cat ${AFCTEMP[$fcvcount]} ) + #elif [ $fcvcount -eq 6 ];then + #echo "0x20" > '/sys/bus/i2c/devices/6-0058/psu_select_member' + # AFCTEMP[$fcvcount]=$( cat ${AFCTEMP[$fcvcount]} ) + #else + # AFCTEMP[$fcvcount]=$( cat ${AFCTEMP[$fcvcount]} ) + #fi + AFCTEMP[$fcvcount]=$( cat ${AFCTEMP[$fcvcount]} ) + AFCTEMP[$fcvcount]=$(( AFCTEMP[$fcvcount]/1000 )) + echo "AFCTEMP[$fcvcount]=${AFCTEMP[$fcvcount]} (Celsius)" + done + + fan_string=$FCFANS + fcvcount=0 + zero=0 + for fcv in $FCFANS + do + fcvcount=$((fcvcount+1)) + AFCFAN[$fcvcount]=$( echo "$fan_string" | cut -d" " -f $fcvcount ) + AFCFAN_PATH[$fcvcount]=$( echo "${AFCFAN[$fcvcount]}" | sed 's/DEVPATH/\/sys\/bus\/i2c\/devices/g' ) + AFCFAN_TARGET[$fcvcount]=$( echo "${AFCFAN_PATH[$fcvcount]}" | sed 's/DEVPATH/\/sys\/bus\/i2c\/devices/g' ) + AFCFAN_TARGET[$fcvcount]=$( echo "${AFCFAN_TARGET[$fcvcount]}" | sed 's/$/_percentage/g') + AFCFAN[$fcvcount]=$( cat ${AFCFAN_PATH[$fcvcount]} ) + if [ "${AFCFAN[$fcvcount]}" == 960 ] + then + AFCFAN[$fcvcount]=$zero + fi + echo "AFCFAN[$fcvcount]=${AFCFAN[$fcvcount]} (rpm)" + done + echo "INTERVAL=$INTERVAL" + echo "DEVPATH=$FCDEVPATH" + echo "MINTEMP=$FCMINTEMP" + echo "MAXTEMP=$FCMAXTEMP" + echo "MINSTART=$FCMINSTART" + echo "MINSTOP=$FCMINSTOP" +} + +# Check that all referenced sysfs files exist +function CheckFiles +{ + local outdated=0 fcvcount tsen fan + if [ $outdated -eq 1 ] + then + echo >&2 + echo "At least one referenced file is missing. Either some required kernel" >&2 + echo "modules haven't been loaded, or your configuration file is outdated." >&2 + echo "In the latter case, you should run pwmconfig again." >&2 + fi + return $outdated +} + +LoadConfig $1 + +# Detect path to sensors +if [ ! -d $DIR ] +then + echo $0: 'No sensors found! (did you load the necessary modules?)' >&2 + exit 1 +fi +cd $DIR + +# Check for configuration change +if [ "$DIR" != "/" ] && [ -z "$DEVPATH" -o -z "$DEVNAME" ] +then + echo "Configuration is too old, please run pwmconfig again" >&2 + exit 1 +fi +if [ "$DIR" = "/" -a -n "$DEVPATH" ] +then + echo "Unneeded DEVPATH with absolute device paths" >&2 + exit 1 +fi +CheckFiles || exit 1 + +if [ -f "$PIDFILE" ] +then + echo "File $PIDFILE exists, is fancontrol already running?" >&2 + exit 1 +fi +echo $$ > "$PIDFILE" + + +# main function +function UpdateThermalSensors +{ + echo "" + TEMP_HIGHEST=0 + FAN_PERCENTAGE=0 + + for i in ${AFCTEMP_PATH[@]}; do + if (( $(cat $i) > $TEMP_HIGHEST )); then + TEMP_HIGHEST=$(cat $i); + fi; + done + TEMP_HIGHEST=$((TEMP_HIGHEST/1000)) + echo "The highest temperature of thermal sensors: $TEMP_HIGHEST C" + +} + +function UpdateFanSpeeds +{ + if [ $TEMP_HIGHEST -lt 51 ]; then #TEMP<=50 + FAN_PERCENTAGE=40 + elif [ $TEMP_HIGHEST -lt 56 -a $TEMP_HIGHEST -gt 50 ]; then #50 ${AFCFAN_TARGET[$fcvcount]} + AFCFAN[$fcvcount]=$( cat ${AFCFAN_PATH[$fcvcount]} ) + + if [ "${AFCFAN[$fcvcount]}" == 960 ] + then + AFCFAN[$fcvcount]=$zero + fi + echo "AFCFAN[$fcvcount]=${AFCFAN[$fcvcount]} (rpm)" + done + + if [ $TEMP_HIGHEST -lt 51 ]; then #TEMP<=50 + FAN_ON_PSU_PERCENTAGE=50 + elif [ $TEMP_HIGHEST -lt 100 -a $TEMP_HIGHEST -gt 50 ]; then #50 '/sys/bus/i2c/devices/4-0058/psu_select_member' + echo "$FAN_ON_PSU_PERCENTAGE" > '/sys/bus/i2c/devices/6-0059/fan1_set_percentage' + echo "PSU fan1 =$( cat '/sys/bus/i2c/devices/6-0059/fan1_input' ) (rpm)" + #Set speed to PSU_FAN2 + #echo "0x20" > '/sys/bus/i2c/devices/6-0058/psu_select_member' + echo "$FAN_ON_PSU_PERCENTAGE" > '/sys/bus/i2c/devices/6-0058/fan1_set_percentage' + echo "PSU fan2 =$( cat '/sys/bus/i2c/devices/6-0058/fan1_input' ) (rpm)" + + rm -f "$PIDFILE" +} +# main loop calling the main function at specified intervals +while true +do + UpdateThermalSensors + UpdateFanSpeeds + echo "Sleep $INTERVAL seconds ..." + # Sleep while still handling signals + sleep $INTERVAL & + wait $! +done diff --git a/device/delta/x86_64-delta_ag5648-r0/installer.conf b/device/delta/x86_64-delta_ag5648-r0/installer.conf new file mode 100644 index 000000000000..fa2af8b7a007 --- /dev/null +++ b/device/delta/x86_64-delta_ag5648-r0/installer.conf @@ -0,0 +1,2 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_SPEED=115200 diff --git a/device/delta/x86_64-delta_ag5648-r0/led_proc_init.soc b/device/delta/x86_64-delta_ag5648-r0/led_proc_init.soc new file mode 100755 index 000000000000..a329017fbde8 --- /dev/null +++ b/device/delta/x86_64-delta_ag5648-r0/led_proc_init.soc @@ -0,0 +1,67 @@ +#AG5648 LED + +led 0 stop +led 0 prog \ + 02 00 60 E0 02 A0 60 E2 86 ED 02 00 60 E1 67 EF \ + 71 1F 2E E0 32 08 97 02 00 0E 02 60 E3 77 2A 2E \ + E0 32 08 97 02 00 0E 03 60 E3 2E E0 32 00 32 01 \ + B7 97 02 00 0E 00 12 E7 FE E1 50 67 EF 71 49 86 \ + E0 86 E1 06 E1 D2 04 74 2A 02 00 60 E1 12 E7 FE \ + E1 05 60 EC 12 E3 FE E1 05 0A 03 71 61 67 EB 77 \ + 63 67 CB 67 EF 71 76 12 E3 FE E1 05 0A 02 71 74 \ + 67 EB 77 76 67 CB 12 E3 FE E1 05 0A 01 71 87 67 \ + EB 67 EF 71 97 77 8D 67 CB 67 EF 71 97 86 E1 06 \ + E1 D2 04 74 4D 77 A5 06 E0 28 32 08 97 71 A3 67 \ + EB 77 A5 67 D7 06 E2 67 EF 71 B1 F2 04 60 E2 77 \ + B7 F2 01 60 E2 86 E0 06 E0 D2 24 74 0A 67 EB 67 \ + EB 67 EB 67 EB 67 EB 67 EB 3A 72 67 EF 71 E7 06 \ + EC D2 00 70 E7 77 DD 06 EC D2 00 70 EB 16 ED 99 \ + 99 1A 00 71 E7 77 EB 32 0F 87 57 32 0E 87 57 16 \ + E0 DA 0C 57 00 00 00 00 00 00 00 00 00 00 00 00 +led 0 auto on +led 0 start + +led 1 stop +led 1 prog \ + 02 00 60 E0 02 A0 60 E2 86 E6 02 00 60 E1 2E E0 \ + 32 08 97 02 00 0E 03 60 E3 2E E0 32 00 32 01 B7 \ + 97 02 00 0E 00 12 E4 FE E1 50 12 E4 05 60 E5 12 \ + E3 05 0A 03 71 3A 67 83 77 3C 67 7F 12 E3 05 0A \ + 01 71 47 67 83 77 49 67 7F 06 E0 28 32 08 97 71 \ + 55 67 83 77 57 67 6F 06 E2 F2 01 60 E2 86 E0 06 \ + E0 D2 24 74 0A 67 83 67 83 67 83 67 83 3A 70 06 \ + E5 D2 00 70 83 16 E6 99 99 1A 00 71 7F 77 83 32 \ + 0F 87 57 32 0E 87 57 00 00 00 00 00 00 00 00 00 +led 1 auto on +led 1 start + +# LED0 port order remap +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=47 REMAP_PORT_1=47 REMAP_PORT_2=47 REMAP_PORT_3=47 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=47 REMAP_PORT_5=47 REMAP_PORT_6=47 REMAP_PORT_7=47 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=31 REMAP_PORT_9=30 REMAP_PORT_10=29 REMAP_PORT_11=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=47 REMAP_PORT_13=47 REMAP_PORT_14=47 REMAP_PORT_15=47 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=47 REMAP_PORT_17=47 REMAP_PORT_18=47 REMAP_PORT_19=47 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=35 REMAP_PORT_21=34 REMAP_PORT_22=33 REMAP_PORT_23=32 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=23 REMAP_PORT_25=22 REMAP_PORT_26=21 REMAP_PORT_27=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=27 REMAP_PORT_29=26 REMAP_PORT_30=25 REMAP_PORT_31=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=47 REMAP_PORT_33=47 REMAP_PORT_34=47 REMAP_PORT_35=47 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=15 REMAP_PORT_41=14 REMAP_PORT_42=13 REMAP_PORT_43=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=19 REMAP_PORT_49=18 REMAP_PORT_50=17 REMAP_PORT_51=16 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 REMAP_PORT_53=10 REMAP_PORT_54=9 REMAP_PORT_55=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 REMAP_PORT_57=6 REMAP_PORT_58=5 REMAP_PORT_59=4 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 REMAP_PORT_61=2 REMAP_PORT_62=1 REMAP_PORT_63=0 + +# LED1 port order remap +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=19 REMAP_PORT_1=18 REMAP_PORT_2=17 REMAP_PORT_3=16 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=23 REMAP_PORT_5=22 REMAP_PORT_6=21 REMAP_PORT_7=20 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=26 REMAP_PORT_9=27 REMAP_PORT_10=24 REMAP_PORT_11=25 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 REMAP_PORT_13=63 REMAP_PORT_14=63 REMAP_PORT_15=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=31 REMAP_PORT_17=30 REMAP_PORT_18=29 REMAP_PORT_19=28 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=35 REMAP_PORT_21=34 REMAP_PORT_22=33 REMAP_PORT_23=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=63 REMAP_PORT_25=63 REMAP_PORT_26=63 REMAP_PORT_27=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=63 REMAP_PORT_29=63 REMAP_PORT_30=63 REMAP_PORT_31=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=3 REMAP_PORT_33=2 REMAP_PORT_34=1 REMAP_PORT_35=0 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=7 REMAP_PORT_37=6 REMAP_PORT_38=5 REMAP_PORT_39=4 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=11 REMAP_PORT_49=10 REMAP_PORT_50=9 REMAP_PORT_51=8 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=15 REMAP_PORT_53=14 REMAP_PORT_54=13 REMAP_PORT_55=12 + diff --git a/device/delta/x86_64-delta_ag5648-r0/minigraph.xml b/device/delta/x86_64-delta_ag5648-r0/minigraph.xml new file mode 100644 index 000000000000..37c952f49c32 --- /dev/null +++ b/device/delta/x86_64-delta_ag5648-r0/minigraph.xml @@ -0,0 +1,1184 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + sonic + 10.0.0.32 + 1 + 180 + 60 + + + sonic + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + sonic + 10.0.0.34 + 1 + 180 + 60 + + + sonic + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + sonic + 10.0.0.36 + 1 + 180 + 60 + + + sonic + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + sonic + 10.0.0.38 + 1 + 180 + 60 + + + sonic + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + sonic + 10.0.0.40 + 1 + 180 + 60 + + + sonic + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + sonic + 10.0.0.42 + 1 + 180 + 60 + + + sonic + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + sonic + 10.0.0.44 + 1 + 180 + 60 + + + sonic + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + sonic + 10.0.0.46 + 1 + 180 + 60 + + + sonic + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + sonic + 10.0.0.48 + 1 + 180 + 60 + + + sonic + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + sonic + 10.0.0.50 + 1 + 180 + 60 + + + sonic + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + sonic + 10.0.0.52 + 1 + 180 + 60 + + + sonic + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + sonic + 10.0.0.54 + 1 + 180 + 60 + + + sonic + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + sonic + 10.0.0.56 + 1 + 180 + 60 + + + sonic + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + sonic + 10.0.0.58 + 1 + 180 + 60 + + + sonic + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + sonic + 10.0.0.60 + 1 + 180 + 60 + + + sonic + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + sonic + 10.0.0.62 + 1 + 180 + 60 + + + sonic + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + sonic + + +
10.0.0.33
+ + +
+ +
10.0.0.1
+ + +
+ +
10.0.0.35
+ + +
+ +
10.0.0.3
+ + +
+ +
10.0.0.37
+ + +
+ +
10.0.0.5
+ + +
+ +
10.0.0.39
+ + +
+ +
10.0.0.7
+ + +
+ +
10.0.0.41
+ + +
+ +
10.0.0.9
+ + +
+ +
10.0.0.43
+ + +
+ +
10.0.0.11
+ + +
+ +
10.0.0.45
+ + +
+ +
10.0.0.13
+ + +
+ +
10.0.0.47
+ + +
+ +
10.0.0.15
+ + +
+ +
10.0.0.49
+ + +
+ +
10.0.0.17
+ + +
+ +
10.0.0.51
+ + +
+ +
10.0.0.19
+ + +
+ +
10.0.0.53
+ + +
+ +
10.0.0.21
+ + +
+ +
10.0.0.55
+ + +
+ +
10.0.0.23
+ + +
+ +
10.0.0.57
+ + +
+ +
10.0.0.25
+ + +
+ +
10.0.0.59
+ + +
+ +
10.0.0.27
+ + +
+ +
10.0.0.61
+ + +
+ +
10.0.0.29
+ + +
+ +
10.0.0.63
+ + +
+ +
10.0.0.31
+ + +
+
+ +
+ + 64001 + ARISTA01T0 + + + + 65200 + ARISTA01T2 + + + + 64002 + ARISTA02T0 + + + + 65200 + ARISTA02T2 + + + + 64003 + ARISTA03T0 + + + + 65200 + ARISTA03T2 + + + + 64004 + ARISTA04T0 + + + + 65200 + ARISTA04T2 + + + + 64005 + ARISTA05T0 + + + + 65200 + ARISTA05T2 + + + + 64006 + ARISTA06T0 + + + + 65200 + ARISTA06T2 + + + + 64007 + ARISTA07T0 + + + + 65200 + ARISTA07T2 + + + + 64008 + ARISTA08T0 + + + + 65200 + ARISTA08T2 + + + + 64009 + ARISTA09T0 + + + + 65200 + ARISTA09T2 + + + + 64010 + ARISTA10T0 + + + + 65200 + ARISTA10T2 + + + + 64011 + ARISTA11T0 + + + + 65200 + ARISTA11T2 + + + + 64012 + ARISTA12T0 + + + + 65200 + ARISTA12T2 + + + + 64013 + ARISTA13T0 + + + + 65200 + ARISTA13T2 + + + + 64014 + ARISTA14T0 + + + + 65200 + ARISTA14T2 + + + + 64015 + ARISTA15T0 + + + + 65200 + ARISTA15T2 + + + + 64016 + ARISTA16T0 + + + + 65200 + ARISTA16T2 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + + + + + + sonic + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet60 + 10.0.0.30/31 + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet84 + 10.0.0.42/31 + + + + Ethernet88 + 10.0.0.44/31 + + + + Ethernet92 + 10.0.0.46/31 + + + + Ethernet96 + 10.0.0.48/31 + + + + Ethernet100 + 10.0.0.50/31 + + + + Ethernet104 + 10.0.0.52/31 + + + + Ethernet108 + 10.0.0.54/31 + + + + Ethernet112 + 10.0.0.56/31 + + + + Ethernet116 + 10.0.0.58/31 + + + + Ethernet120 + 10.0.0.60/31 + + + + Ethernet124 + 10.0.0.62/31 + + + + Ethernet128 + 10.0.0.64/31 + + + + Ethernet132 + 10.0.0.66/31 + + + + Ethernet136 + 10.0.0.68/31 + + + + Ethernet140 + 10.0.0.70/31 + + + + Ethernet144 + 10.0.0.72/31 + + + + Ethernet148 + 10.0.0.74/31 + + + + Ethernet152 + 10.0.0.76/31 + + + + Ethernet156 + 10.0.0.78/31 + + + + Ethernet160 + 10.0.0.80/31 + + + + Ethernet164 + 10.0.0.82/31 + + + + Ethernet168 + 10.0.0.84/31 + + + + Ethernet172 + 10.0.0.86/31 + + + + Ethernet176 + 10.0.0.88/31 + + + + Ethernet180 + 10.0.0.90/31 + + + + Ethernet184 + 10.0.0.92/31 + + + + Ethernet188 + 10.0.0.94/31 + + + + Ethernet192 + 10.0.0.96/31 + + + + Ethernet196 + 10.0.0.98/31 + + + + Ethernet200 + 10.0.0.100/31 + + + + Ethernet204 + 10.0.0.102/31 + + + + Ethernet208 + 10.0.0.104/31 + + + + Ethernet212 + 10.0.0.106/31 + + + + + + + + + + + + DeviceInterfaceLink + sonic + Ethernet0 + ARISTA01T2 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet4 + ARISTA02T2 + Ethernet8 + + + DeviceInterfaceLink + sonic + Ethernet8 + ARISTA03T2 + Ethernet12 + + + DeviceInterfaceLink + sonic + Ethernet12 + ARISTA04T2 + Ethernet16 + + + DeviceInterfaceLink + sonic + Ethernet16 + ARISTA05T2 + Ethernet20 + + + DeviceInterfaceLink + sonic + Ethernet20 + ARISTA06T2 + Ethernet24 + + + DeviceInterfaceLink + sonic + Ethernet24 + ARISTA07T2 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet28 + ARISTA08T2 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet32 + ARISTA09T2 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet36 + ARISTA10T2 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet40 + ARISTA11T2 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet44 + ARISTA12T2 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet48 + ARISTA13T2 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet52 + ARISTA14T2 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet56 + ARISTA15T2 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet60 + ARISTA16T2 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet64 + ARISTA01T0 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet68 + ARISTA02T0 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet72 + ARISTA03T0 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet76 + ARISTA04T0 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet80 + ARISTA05T0 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet84 + ARISTA06T0 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet88 + ARISTA07T0 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet92 + ARISTA08T0 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet96 + ARISTA09T0 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet100 + ARISTA10T0 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet104 + ARISTA11T0 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet108 + ARISTA12T0 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet112 + ARISTA13T0 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet116 + ARISTA14T0 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet120 + ARISTA15T0 + Ethernet4 + + + DeviceInterfaceLink + sonic + Ethernet124 + ARISTA16T0 + Ethernet4 + + + + + sonic + Delta-ag5648 + + + + + + + sonic + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + sonic + Delta-ag5648 +
diff --git a/device/delta/x86_64-delta_ag5648-r0/plugins/eeprom.py b/device/delta/x86_64-delta_ag5648-r0/plugins/eeprom.py new file mode 100644 index 000000000000..786e1fdc85e3 --- /dev/null +++ b/device/delta/x86_64-delta_ag5648-r0/plugins/eeprom.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + _TLV_INFO_MAX_LEN = 256 + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-2/2-0053/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/delta/x86_64-delta_ag5648-r0/plugins/psuutil.py b/device/delta/x86_64-delta_ag5648-r0/plugins/psuutil.py new file mode 100644 index 000000000000..0d17ff05681a --- /dev/null +++ b/device/delta/x86_64-delta_ag5648-r0/plugins/psuutil.py @@ -0,0 +1,56 @@ +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/6-00{}/" + self.psu_oper_status = "in1_input" + self.psu_presence = "i2cget -y 6 0x{} 0x00" + + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + if index is None: + return False + Base_bus_number = 57 + status = 0 + try: + with open(self.psu_path.format(index + Base_bus_number) + self.psu_oper_status, 'r') as power_status: + if int(power_status.read()) == 0 : + return False + else: + status = 1 + except IOError: + return False + return status == 1 + + def get_psu_presence(self, index): + if index is None: + return False + Base_bus_number = 49 + status = 0 + try: + p = os.popen(self.psu_presence.format(index + Base_bus_number)+ "> /dev/null 2>&1") + if p.readline() != None: + status = 1 + p.close() + except IOError: + return False + return status == 1 + + diff --git a/device/delta/x86_64-delta_ag5648-r0/plugins/sfputil.py b/device/delta/x86_64-delta_ag5648-r0/plugins/sfputil.py new file mode 100644 index 000000000000..70d658e40183 --- /dev/null +++ b/device/delta/x86_64-delta_ag5648-r0/plugins/sfputil.py @@ -0,0 +1,203 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 0 + PORT_START_QSFP = 48 + PORT_END = 53 + PORTS_IN_BLOCK = 54 + + EEPROM_OFFSET = 10 + + _port_to_eeprom_mapping = {} + + @property + def port_start(self): + return self.PORT_START + @property + def port_start_qsfp(self): + return self.PORT_START_QSFP + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + + for x in range(0, self.port_end + 1): + if x > self.port_start_qsfp -1 and x < self.port_end + 1: + self.get_response(x) + self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) + SfpUtilBase.__init__(self) + + def get_response(self, port_num): + # Check for invalid port_num + if port_num < self.port_start_qsfp or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/delta-ag5648-cpld.0/sfp_response", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # set the bit corresponding to our port + mask = (port_num + 1) % 8 - 1 + mask = 1 << mask + + # Convert our register value back to a hex string and write back + content = hex(mask) + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/delta-ag5648-cpld.0/sfp_present") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # ModPrsL is active low + if reg_value & mask == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/delta-ag5648-cpld.0/sfp_lpmode") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # LPMode is active high + if reg_value & mask == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start_qsfp or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/delta-ag5648-cpld.0/sfp_lpmode", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + content = hex(reg_value) + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True + + def reset(self, port_num): + QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/devices/platform/delta-ag5648-cpld.0/sfp_reset" + + # Check for invalid port_num + if port_num < self.port_start_qsfp or port_num > self.port_end: + return False + + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # File content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # ResetL is active low + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + # Sleep 1 second to allow it to settle + time.sleep(1) + + # Flip the bit back high and write back to the register to take port out of reset + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_value | mask + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + return True diff --git a/device/delta/x86_64-delta_ag5648-r0/sensors.conf b/device/delta/x86_64-delta_ag5648-r0/sensors.conf new file mode 100644 index 000000000000..ff71a21a747d --- /dev/null +++ b/device/delta/x86_64-delta_ag5648-r0/sensors.conf @@ -0,0 +1,91 @@ +# libsensors configuration file for AG5648 +# ------------------------------------------------ +# + +bus "i2c-2" "i2c-1-mux (chan_id 0)" +bus "i2c-3" "i2c-1-mux (chan_id 1)" +bus "i2c-4" "i2c-1-mux (chan_id 2)" +bus "i2c-5" "i2c-1-mux (chan_id 3)" +bus "i2c-6" "i2c-1-mux (chan_id 4)" +bus "i2c-7" "i2c-1-mux (chan_id 5)" + +# tmp75-i2c-2-4d board sensor near Left of front vents. +# tmp75-i2c-3-49 board sensor near MAC. +# tmp75-i2c-3-4b board sensor near Middle of front vents. +# tmp75-i2c-3-4c board sensor near Right of front vents. +# tmp75-i2c-3-4e board sensor near DC fan. +# tmp75-i2c-3-4f board sensor near CPU. + +chip "tmp75-i2c-2-4d" + label temp1 "board sensor near Left of front vents" + set temp1_max 60 + set temp1_max_hyst 55 + +chip "tmp75-i2c-3-49" + label temp1 "board sensor near MAC" + set temp1_max 85 + set temp1_max_hyst 80 + +chip "tmp75-i2c-3-4b" + label temp1 "board sensor near Middle of front vents" + set temp1_max 70 + set temp1_max_hyst 65 + +chip "tmp75-i2c-3-4c" + label temp1 "board sensor near Right of front vents" + set temp1_max 65 + set temp1_max_hyst 60 + +chip "tmp75-i2c-3-4e" + label temp1 "board sensor near DC fan" + set temp1_max 60 + set temp1_max_hyst 55 + +chip "tmp75-i2c-3-4f" + label temp1 "board sensor near CPU" + set temp1_max 80 + set temp1_max_hyst 75 + +chip "emc2305-i2c-3-4d" + label fan1 "FANTRAY 1 REAR" + label fan2 "FANTRAY 2 REAR" + label fan3 "FANTRAY 3 REAR" + label fan4 "FANTRAY 4 REAR" + +chip "emc2305-i2c-5-4d" + label fan1 "FANTRAY 1 FRONT" + label fan2 "FANTRAY 2 FRONT" + label fan3 "FANTRAY 3 FRONT" + label fan4 "FANTRAY 4 FRONT" + +chip "ltc4215-i2c-3-40" + label in1 "PSU Hot-Swap voltage 1" + label in2 "PSU Hot-Swap voltage 2" + label power1 "PSU Hot-Swap power" + label curr1 "PSU Hot-Swap current" + +chip "ltc4215-i2c-3-42" + label in1 "PSU Hot-Swap voltage 1" + label in2 "PSU Hot-Swap voltage 2" + label power1 "PSU Hot-Swap power" + label curr1 "PSU Hot-Swap current" + +chip "dni_ag5648_psu-i2c-6-59" + label in1 "PSU voltage 1" + label in2 "PSU voltage 2" + label fan1 "PSU fan" + label temp1 "PSU temperature" + label power1 "PSU power1" + label power2 "PSU power2" + label curr1 "PSU current1" + label curr2 "PSU current2" + +chip "dni_ag5648_psu-i2c-6-58" + label in1 "PSU voltage 1" + label in2 "PSU voltage 2" + label fan1 "PSU fan" + label temp1 "PSU temperature" + label power1 "PSU power1" + label power2 "PSU power2" + label curr1 "PSU current1" + label curr2 "PSU current2" \ No newline at end of file diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 631d735d145d..001d7486101e 100755 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -24,6 +24,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(CEL_DX010_PLATFORM_MODULE) \ $(DELTA_AG9032V1_PLATFORM_MODULE) \ $(DELTA_AG9064_PLATFORM_MODULE) \ + $(DELTA_AG5648_PLATFORM_MODULE) \ $(QUANTA_IX1B_32X_PLATFORM_MODULE) \ $(MITAC_LY1200_32X_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) diff --git a/platform/broadcom/platform-modules-delta.mk b/platform/broadcom/platform-modules-delta.mk index 5d9709f5cb5c..f1e8562844d4 100644 --- a/platform/broadcom/platform-modules-delta.mk +++ b/platform/broadcom/platform-modules-delta.mk @@ -2,9 +2,11 @@ DELTA_AG9032V1_PLATFORM_MODULE_VERSION = 1.1 DELTA_AG9064_PLATFORM_MODULE_VERSION = 1.1 +DELTA_AG5648_PLATFORM_MODULE_VERSION = 1.1 export DELTA_AG9032V1_PLATFORM_MODULE_VERSION export DELTA_AG9064_PLATFORM_MODULE_VERSION +export DELTA_AG5648_PLATFORM_MODULE_VERSION DELTA_AG9032V1_PLATFORM_MODULE = platform-modules-ag9032v1_$(DELTA_AG9032V1_PLATFORM_MODULE_VERSION)_amd64.deb $(DELTA_AG9032V1_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-delta @@ -16,3 +18,8 @@ SONIC_DPKG_DEBS += $(DELTA_AG9032V1_PLATFORM_MODULE) DELTA_AG9064_PLATFORM_MODULE = platform-modules-ag9064_$(DELTA_AG9064_PLATFORM_MODULE_VERSION)_amd64.deb $(DELTA_AG9064_PLATFORM_MODULE)_PLATFORM = x86_64-delta_ag9064-r0 $(eval $(call add_extra_package,$(DELTA_AG9032V1_PLATFORM_MODULE),$(DELTA_AG9064_PLATFORM_MODULE))) + +DELTA_AG5648_PLATFORM_MODULE = platform-modules-ag5648_$(DELTA_AG5648_PLATFORM_MODULE_VERSION)_amd64.deb +$(DELTA_AG5648_PLATFORM_MODULE)_PLATFORM = x86_64-delta_ag5648-r0 +$(eval $(call add_extra_package,$(DELTA_AG9032V1_PLATFORM_MODULE),$(DELTA_AG5648_PLATFORM_MODULE))) + diff --git a/platform/broadcom/sonic-platform-modules-delta/ag5648/cfg/ag5648-modules.conf b/platform/broadcom/sonic-platform-modules-delta/ag5648/cfg/ag5648-modules.conf new file mode 100644 index 000000000000..552b4103ed02 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag5648/cfg/ag5648-modules.conf @@ -0,0 +1,13 @@ +# /etc/modules: kernel modules to load at boot time. +# +# This file contains the names of kernel modules that should be loaded +# at boot time, one per line. Lines beginning with "#" are ignored. + +i2c-i801 +i2c-isch +i2c-ismt +i2c-dev +i2c-mux +i2c-smbus +i2c-mux-gpio +i2c-mux-pca954x diff --git a/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/Makefile b/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/Makefile new file mode 100644 index 000000000000..012f708ec46a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/Makefile @@ -0,0 +1,2 @@ +obj-m := dni_ag5648_psu.o dni_emc2305.o delta_ag5648_platform.o + diff --git a/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/delta_ag5648_platform.c b/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/delta_ag5648_platform.c new file mode 100644 index 000000000000..814889464596 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/delta_ag5648_platform.c @@ -0,0 +1,1542 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BUS4_DEV_NUM 54 +#define DEFAULT_NUM 1 +#define BUS4_BASE_NUM 10 +#define BUS4_MUX_REG 0x18 + +#define TEMP_FAN_VAL 0x06 +#define FANIO_CTL_VAL 0x07 +#define FAN_CTRL_VAL 0x05 +#define PSU1_VAL 0x00 +#define PSU2_VAL 0x20 +#define HOT_SWAP1_VAL 0x10 +#define HOT_SWAP2_VAL 0x30 + +#define SYSTEM_CPLD_REG 0x31 +#define MASTER_CPLD_REG 0x35 +#define SLAVE_CPLD_REG 0x39 + +#define FAN_LED_REG 0x05 +#define LED_REG 0x04 + +#define SFP_PRESENCE_1 0x08 +#define SFP_PRESENCE_2 0x09 +#define SFP_PRESENCE_3 0x0a +#define SFP_PRESENCE_4 0x0b +#define SFP_PRESENCE_5 0x0c +#define SFP_PRESENCE_6 0x08 +#define SFP_PRESENCE_7 0x09 +#define QSFP_PRESENCE 0x12 + +#define QSFP_RESPONSE 0x10 +#define QSFP_LP_MODE 0x11 +#define QSFP_RESET 0x13 + + +#define SFF8436_INFO(data) \ + .type = "sff8436", .addr = 0x50, .platform_data = (data) + +#define SFF_8346_PORT(eedata) \ + .byte_len = 256, .page_size = 1, .flags = SFF_8436_FLAG_READONLY + +#define ag5648_i2c_device_num(NUM){ \ + .name = "delta-ag5648-i2c-device", \ + .id = NUM, \ + .dev = { \ + .platform_data = &ag5648_i2c_device_platform_data[NUM], \ + .release = device_release, \ + }, \ +} + +/*Define struct to get client of i2c_new_deivce */ +struct i2c_client * i2c_client_9548; + +enum{ + BUS0 = 0, + BUS1, + BUS2, + BUS3, + BUS4, + BUS5, + BUS6, + BUS7, +}; + +unsigned char reverse_8bits(unsigned char c) +{ + unsigned char s = 0; + int i; + for (i = 0; i < 8; ++i) { + s <<= 1; + s |= c & 1; + c >>= 1; + } + return s; +} +/*---------------- I2C device - start ------------- */ +static void device_release(struct device *dev) +{ + return; +} + +struct i2c_device_platform_data { + int parent; + struct i2c_board_info info; + struct i2c_client *client; +}; +/* pca9547 - add 8 bus */ +static struct pca954x_platform_mode pca954x_mode[] = { + { .adap_id = 2, + .deselect_on_exit = 1, + }, + { .adap_id = 3, + .deselect_on_exit = 1, + }, + { .adap_id = 4, + .deselect_on_exit = 1, + }, + { .adap_id = 5, + .deselect_on_exit = 1, + }, + { .adap_id = 6, + .deselect_on_exit = 1, + }, + { .adap_id = 7, + .deselect_on_exit = 1, + }, + { .adap_id = 8, + .deselect_on_exit = 1, + }, + { .adap_id = 9, + .deselect_on_exit = 1, + }, +}; + +static struct pca954x_platform_data pca954x_data = { + .modes = pca954x_mode, + .num_modes = ARRAY_SIZE(pca954x_mode), +}; + +static struct i2c_board_info __initdata i2c_info_pca9548[] = +{ + { + I2C_BOARD_INFO("pca9548", 0x70), + .platform_data = &pca954x_data, + }, +}; + + +static struct sff_8436_platform_data sff_8436_port[] = { + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, +}; + + +static struct i2c_device_platform_data ag5648_i2c_device_platform_data[] = { + { + /* id eeprom (0x53) */ + .parent = 2, + .info = { I2C_BOARD_INFO("24c02", 0x53) }, + .client = NULL, + }, + { + /* tmp75 (0x4d) */ + .parent = 2, + .info = { I2C_BOARD_INFO("tmp75", 0x4d) }, + .client = NULL, + }, + { + /* tmp75 (0x4d) */ + .parent = 3, + .info = { I2C_BOARD_INFO("tmp75", 0x49) }, + .client = NULL, + }, + { + /* tmp75 (0x4d) */ + .parent = 3, + .info = { I2C_BOARD_INFO("tmp75", 0x4b) }, + }, + { + /* tmp75 (0x4d) */ + .parent = 3, + .info = { I2C_BOARD_INFO("tmp75", 0x4c) }, + .client = NULL, + }, + { + /* tmp75 (0x4d) */ + .parent = 3, + .info = { I2C_BOARD_INFO("tmp75", 0x4e) }, + .client = NULL, + }, + { + /* tmp75 (0x4d) */ + .parent = 3, + .info = { I2C_BOARD_INFO("tmp75", 0x4f) }, + }, + { + /* tmp75 (0x4d) */ + .parent = 3, + .info = { I2C_BOARD_INFO("emc2305", 0x4d) }, + .client = NULL, + }, + { + /* tmp75 (0x4d) */ + .parent = 5, + .info = { I2C_BOARD_INFO("emc2305", 0x4d) }, + .client = NULL, + }, + { + /* tmp75 (0x4d) */ + .parent = 3, + .info = { I2C_BOARD_INFO("ltc4215", 0x40) }, + .client = NULL, + }, + { + /* tmp75 (0x4d) */ + .parent = 3, + .info = { I2C_BOARD_INFO("ltc4215", 0x42) }, + }, + { + /* psu1 (0x59) */ + .parent = 6, + .info = { I2C_BOARD_INFO("dni_ag5648_psu", 0x59) }, + .client = NULL, + }, + { + /* psu2 (0x58) */ + .parent = 6, + .info = { I2C_BOARD_INFO("dni_ag5648_psu", 0x58) }, + }, + { + /* qsfp 1 (0x50) */ + .parent = 10, + .info = { SFF8436_INFO(&sff_8436_port[0]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 11, + .info = { SFF8436_INFO(&sff_8436_port[1]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 12, + .info = { SFF8436_INFO(&sff_8436_port[2]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 13, + .info = { SFF8436_INFO(&sff_8436_port[3]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 14, + .info = { SFF8436_INFO(&sff_8436_port[4]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 15, + .info = { SFF8436_INFO(&sff_8436_port[5]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 16, + .info = { SFF8436_INFO(&sff_8436_port[6]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 17, + .info = { SFF8436_INFO(&sff_8436_port[7]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 18, + .info = { SFF8436_INFO(&sff_8436_port[8]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 19, + .info = { SFF8436_INFO(&sff_8436_port[9]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 20, + .info = { SFF8436_INFO(&sff_8436_port[10]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 21, + .info = { SFF8436_INFO(&sff_8436_port[11]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 22, + .info = { SFF8436_INFO(&sff_8436_port[12]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 23, + .info = { SFF8436_INFO(&sff_8436_port[13]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 24, + .info = { SFF8436_INFO(&sff_8436_port[14]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 25, + .info = { SFF8436_INFO(&sff_8436_port[15]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 26, + .info = { SFF8436_INFO(&sff_8436_port[16]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 27, + .info = { SFF8436_INFO(&sff_8436_port[17]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 28, + .info = { SFF8436_INFO(&sff_8436_port[18]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 29, + .info = { SFF8436_INFO(&sff_8436_port[19]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 30, + .info = { SFF8436_INFO(&sff_8436_port[20]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 31, + .info = { SFF8436_INFO(&sff_8436_port[21]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 32, + .info = { SFF8436_INFO(&sff_8436_port[22]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 33, + .info = { SFF8436_INFO(&sff_8436_port[23]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 34, + .info = { SFF8436_INFO(&sff_8436_port[24]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 35, + .info = { SFF8436_INFO(&sff_8436_port[25]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 36, + .info = { SFF8436_INFO(&sff_8436_port[26]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 37, + .info = { SFF8436_INFO(&sff_8436_port[27]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 38, + .info = { SFF8436_INFO(&sff_8436_port[28]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 39, + .info = { SFF8436_INFO(&sff_8436_port[29]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 40, + .info = { SFF8436_INFO(&sff_8436_port[30]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 41, + .info = { SFF8436_INFO(&sff_8436_port[31]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 42, + .info = { SFF8436_INFO(&sff_8436_port[32]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 43, + .info = { SFF8436_INFO(&sff_8436_port[33]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 44, + .info = { SFF8436_INFO(&sff_8436_port[34]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 45, + .info = { SFF8436_INFO(&sff_8436_port[35]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 46, + .info = { SFF8436_INFO(&sff_8436_port[36]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 47, + .info = { SFF8436_INFO(&sff_8436_port[37]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 48, + .info = { SFF8436_INFO(&sff_8436_port[38]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 49, + .info = { SFF8436_INFO(&sff_8436_port[39]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 50, + .info = { SFF8436_INFO(&sff_8436_port[40]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 51, + .info = { SFF8436_INFO(&sff_8436_port[41]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 52, + .info = { SFF8436_INFO(&sff_8436_port[42]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 53, + .info = { SFF8436_INFO(&sff_8436_port[43]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 54, + .info = { SFF8436_INFO(&sff_8436_port[44]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 55, + .info = { SFF8436_INFO(&sff_8436_port[45]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 56, + .info = { SFF8436_INFO(&sff_8436_port[46]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 57, + .info = { SFF8436_INFO(&sff_8436_port[47]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 58, + .info = { SFF8436_INFO(&sff_8436_port[48]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 59, + .info = { SFF8436_INFO(&sff_8436_port[49]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 60, + .info = { SFF8436_INFO(&sff_8436_port[50]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 61, + .info = { SFF8436_INFO(&sff_8436_port[51]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 62, + .info = { SFF8436_INFO(&sff_8436_port[52]) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 63, + .info = { SFF8436_INFO(&sff_8436_port[53]) }, + .client = NULL, + }, +}; + + +static struct platform_device ag5648_i2c_device[] = { + ag5648_i2c_device_num(0), + ag5648_i2c_device_num(1), + ag5648_i2c_device_num(2), + ag5648_i2c_device_num(3), + ag5648_i2c_device_num(4), + ag5648_i2c_device_num(5), + ag5648_i2c_device_num(6), + ag5648_i2c_device_num(7), + ag5648_i2c_device_num(8), + ag5648_i2c_device_num(9), + ag5648_i2c_device_num(10), + ag5648_i2c_device_num(11), + ag5648_i2c_device_num(12), + ag5648_i2c_device_num(13), + ag5648_i2c_device_num(14), + ag5648_i2c_device_num(15), + ag5648_i2c_device_num(16), + ag5648_i2c_device_num(17), + ag5648_i2c_device_num(18), + ag5648_i2c_device_num(19), + ag5648_i2c_device_num(20), + ag5648_i2c_device_num(21), + ag5648_i2c_device_num(22), + ag5648_i2c_device_num(23), + ag5648_i2c_device_num(24), + ag5648_i2c_device_num(25), + ag5648_i2c_device_num(26), + ag5648_i2c_device_num(27), + ag5648_i2c_device_num(28), + ag5648_i2c_device_num(29), + ag5648_i2c_device_num(30), + ag5648_i2c_device_num(31), + ag5648_i2c_device_num(32), + ag5648_i2c_device_num(33), + ag5648_i2c_device_num(34), + ag5648_i2c_device_num(35), + ag5648_i2c_device_num(36), + ag5648_i2c_device_num(37), + ag5648_i2c_device_num(38), + ag5648_i2c_device_num(39), + ag5648_i2c_device_num(40), + ag5648_i2c_device_num(41), + ag5648_i2c_device_num(42), + ag5648_i2c_device_num(43), + ag5648_i2c_device_num(44), + ag5648_i2c_device_num(45), + ag5648_i2c_device_num(46), + ag5648_i2c_device_num(47), + ag5648_i2c_device_num(48), + ag5648_i2c_device_num(49), + ag5648_i2c_device_num(50), + ag5648_i2c_device_num(51), + ag5648_i2c_device_num(52), + ag5648_i2c_device_num(53), + ag5648_i2c_device_num(54), + ag5648_i2c_device_num(55), + ag5648_i2c_device_num(56), + ag5648_i2c_device_num(57), + ag5648_i2c_device_num(58), + ag5648_i2c_device_num(59), + ag5648_i2c_device_num(60), + ag5648_i2c_device_num(61), + ag5648_i2c_device_num(62), + ag5648_i2c_device_num(63), + ag5648_i2c_device_num(64), + ag5648_i2c_device_num(65), + ag5648_i2c_device_num(66), +}; + +/*---------------- I2C device - end ------------- */ + +/*---------------- I2C driver - start ------------- */ +static int __init i2c_device_probe(struct platform_device *pdev) +{ + struct i2c_device_platform_data *pdata; + struct i2c_adapter *parent; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", + pdata->parent); + return -ENODEV; + } + + pdata->client = i2c_new_device(parent, &pdata->info); + if (!pdata->client) { + dev_err(&pdev->dev, "Failed to create i2c client %s at %d\n", + pdata->info.type, pdata->parent); + return -ENODEV; + } + + return 0; +} + +static int __exit i2c_deivce_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent; + struct i2c_device_platform_data *pdata; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + if (pdata->client) { + parent = i2c_get_adapter(pdata->parent); + i2c_unregister_device(pdata->client); + i2c_put_adapter(parent); + } + + return 0; +} +static struct platform_driver i2c_device_driver = { + .probe = i2c_device_probe, + .remove = __exit_p(i2c_deivce_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag5648-i2c-device", + } +}; + +/*---------------- I2C driver - end ------------- */ + +/*---------------- CPLD - start ------------- */ + +/* CPLD -- device */ + +enum cpld_type { + system_cpld, + master_cpld, + slave_cpld, +}; + +struct cpld_platform_data { + int reg_addr; + struct i2c_client *client; +}; + +static struct cpld_platform_data ag5648_cpld_platform_data[] = { + [system_cpld] = { + .reg_addr = SYSTEM_CPLD_REG, + }, + [master_cpld] = { + .reg_addr = MASTER_CPLD_REG, + }, + [slave_cpld] = { + .reg_addr = SLAVE_CPLD_REG, + }, +}; + +static struct platform_device ag5648_cpld = { + .name = "delta-ag5648-cpld", + .id = 0, + .dev = { + .platform_data = ag5648_cpld_platform_data, + .release = device_release + }, +}; + +static ssize_t get_present(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u64 data = 0; + u64 data2 = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, SFP_PRESENCE_1); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data = (u32)(ret & 0xff); + + ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, SFP_PRESENCE_2); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(ret & 0xff) << 8; + + ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, SFP_PRESENCE_3); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(ret & 0xff) << 16; + + ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, SFP_PRESENCE_4); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(ret & 0xff) << 24; + + ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, SFP_PRESENCE_5); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data2 = ((u32)(ret & 0xf)) ; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, SFP_PRESENCE_6); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data2 |= (u32)(ret & 0xff) << 4; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, SFP_PRESENCE_7); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data2 |= (u32)((ret >> 4) & 0xf) << 12; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, QSFP_PRESENCE); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data2 |= (u32)(ret & 0x3f) << 16; + + return sprintf(buf, "0x%06x%x\n", data2, data); +} + +static ssize_t get_lpmode(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, QSFP_LP_MODE); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data = ((u8)ret & 0x3f) ; + + return sprintf(buf, "0x%02x%012x\n", data); +} + +static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long data; + int err; + + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + + data = data >> 48; + i2c_smbus_write_byte_data(pdata[master_cpld].client, QSFP_LP_MODE, (u8)(data & 0xff)); + + return count; +} + +static ssize_t get_reset(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u64 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, QSFP_RESET); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + + data = ((u8)ret & 0x3f); + + return sprintf(buf, "0x%02x%012x\n", data); +} + +static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long data; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + data = data >> 48; + i2c_smbus_write_byte_data(pdata[master_cpld].client, QSFP_RESET, (u8)(data & 0xff)); + + return count; +} + +static ssize_t get_response(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u8 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, QSFP_RESPONSE); + + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data = (u8)ret & 0x3f; + + return sprintf(buf, "0x%02x%012x\n", data); +} + +static ssize_t set_response(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long data; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + data = data >> 48; + i2c_smbus_write_byte_data(pdata[master_cpld].client, QSFP_RESPONSE, (u8)(data & 0xff)); + + return count; +} + +struct platform_led_status{ + int reg_data; + char *led_status; + int led_id; +}; + +static struct platform_led_status led_info[] = { + { + .reg_data = 0x00,//0000 0000 + .led_status = "fan_off", + .led_id = 0, + }, + { + .reg_data = 1 << 6,//0100 0000 + .led_status = "fan_Amber", + .led_id = 0, + }, + { + .reg_data = 2 << 6,//1000 0000 + .led_status = "fan_green", + .led_id = 0, + }, + { + .reg_data = 3 << 6,//1100 0000 + .led_status = "fan_Blinking_yellow", + .led_id = 0, + }, + { + .reg_data = 0x00, + .led_status = "sys_Blinking_green", + .led_id = 1, + }, + { + .reg_data = 1 << 4, + .led_status = "sys_green", + .led_id = 1, + }, + { + .reg_data = 2 << 4, + .led_status = "sys_Amber", + .led_id = 1, + }, + { + .reg_data = 3 << 4 , + .led_status = "sys_Amber", + .led_id = 1, + }, + { + .reg_data = 0x00, + .led_status = "pwr_off", + .led_id = 2, + }, + { + .reg_data = 1 << 1, + .led_status = "pwr_Amber", + .led_id = 2, + }, + { + .reg_data = 2 << 1, + .led_status = "pwr_green", + .led_id = 2, + }, + { + .reg_data = 3 << 1, + .led_status = "pwr_Blinking_Amber", + .led_id = 2, + }, + { + .reg_data = 0x00, + .led_status = "fan4_off", + .led_id = 3, + }, + { + .reg_data = 1 << 6, + .led_status = "fan4_green", + .led_id = 3, + }, + { + .reg_data = 2 << 6, + .led_status = "fan4_Amber", + .led_id = 3, + }, + { + .reg_data = 0x00, + .led_status = "fan3_off", + .led_id = 4, + }, + { + .reg_data = 1 << 4, + .led_status = "fan3_green", + .led_id = 4, + }, + { + .reg_data = 2 << 4, + .led_status = "fan3_Amber", + .led_id = 4, + }, + { + .reg_data = 0x00, + .led_status = "fan2_off", + .led_id = 5, + }, + { + .reg_data = 1 << 2, + .led_status = "fan2_green", + .led_id = 5, + }, + { + .reg_data = 1 << 3, + .led_status = "fan2_Amber", + .led_id = 5, + }, + { + .reg_data = 0x00, + .led_status = "fan1_off", + .led_id = 6, + }, + { + .reg_data = 1, + .led_status = "fan1_green", + .led_id = 6, + }, + { + .reg_data = 2, + .led_status = "fan1_Amber", + .led_id = 6, + }, +}; + +struct platform_led_data{ + int reg_addr; + int mask; +}; + +static struct platform_led_data led_data[] = { + { + .reg_addr = LED_REG, //0x04 + .mask = 0xc0,//1100 0000 + }, + { + .reg_addr = LED_REG, + .mask = 0x30,//0011 0000 + }, + { + .reg_addr = LED_REG, + .mask = 0x06,//0000 0110 + }, + { + .reg_addr = FAN_LED_REG,//0x05 + .mask = 0xc0,//1100 0000 + }, + { + .reg_addr = FAN_LED_REG, + .mask = 0x30,//0011 0000 + }, + { + .reg_addr = FAN_LED_REG, + .mask = 0x0c,//0000 1100 + }, + { + .reg_addr = FAN_LED_REG, + .mask = 0x03,//0000 0011 + }, +}; + + +static ssize_t get_led_color(struct device *dev, struct device_attribute *devattr, char *buf) +{ + char str[9][20] = {0}; + int board_data; + int led_data_number; + int led_info_number; + struct cpld_platform_data *pdata = dev->platform_data; + + for(led_data_number = 0; led_data_number < ARRAY_SIZE(led_data); led_data_number++){ + board_data = i2c_smbus_read_byte_data(pdata[slave_cpld].client, led_data[led_data_number].reg_addr); + if(board_data >= 0){ + board_data &= led_data[led_data_number].mask; + for(led_info_number = 0; led_info_number < ARRAY_SIZE(led_info); led_info_number++){ + if (led_data_number == led_info[led_info_number].led_id \ + && board_data == led_info[led_info_number].reg_data){ + sprintf(str[led_data_number], "%s", led_info[led_info_number].led_status); + } + } + } + else + printk( KERN_ERR "Missing LED board data\n"); + } + return sprintf(buf,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n",str[0],str[1],str[2],str[3],str[4],str[5],str[6]); +} + +static ssize_t set_led_color(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + int led_info_number; + int led_data_number; + int str_compar; + int led_reg_value; + struct cpld_platform_data *pdata = dev->platform_data; + + for(led_info_number = 0; led_info_number < ARRAY_SIZE(led_info); led_info_number++){ + str_compar = strncmp(buf,led_info[led_info_number].led_status,strlen(led_info[led_info_number].led_status)); + if(str_compar == 0){ + for(led_data_number = 0; led_data_number < ARRAY_SIZE(led_data); led_data_number++){ + if(led_info[led_info_number].led_id == led_data_number){ + led_reg_value = i2c_smbus_read_byte_data(pdata[slave_cpld].client, led_data[led_data_number].reg_addr); + if(led_reg_value >= 0){ + led_reg_value &= (~led_data[led_data_number].mask); + led_reg_value |= led_info[led_info_number].reg_data; + i2c_smbus_write_byte_data(pdata[slave_cpld].client, (u8)(led_data[led_data_number].reg_addr & 0xff), (u8)(led_reg_value & 0xff)); + } + else + printk( KERN_ERR "Missing LED reg. data\n"); + } + } + } + } + return count; +} + +static DEVICE_ATTR(sfp_response, S_IWUSR | S_IRUGO, get_response, set_response ); +static DEVICE_ATTR(sfp_present, S_IRUGO, get_present, NULL ); +static DEVICE_ATTR(sfp_lpmode, S_IWUSR | S_IRUGO, get_lpmode, set_lpmode ); +static DEVICE_ATTR(sfp_reset, S_IWUSR | S_IRUGO, get_reset, set_reset ); + +static DEVICE_ATTR(led_control, S_IRUGO | S_IWUSR, get_led_color, set_led_color); + +static struct attribute *ag5648_cpld_attrs[] = { + &dev_attr_sfp_response.attr, + &dev_attr_sfp_present.attr, + &dev_attr_sfp_lpmode.attr, + &dev_attr_sfp_reset.attr, + &dev_attr_led_control.attr, + NULL, +}; + +static struct attribute_group ag5648_cpld_attr_grp = { + .attrs = ag5648_cpld_attrs, +}; + +/* CPLD -- driver */ +static int __init cpld_probe(struct platform_device *pdev) +{ + struct cpld_platform_data *pdata; + struct i2c_adapter *parent; + int ret,i; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "CPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(BUS2); + if (!parent) { + printk(KERN_WARNING "Parent adapter (%d) not found\n",BUS2); + return -ENODEV; + } + + for (i = 0; i < ARRAY_SIZE(ag5648_cpld_platform_data); i++) { + pdata[i].client = i2c_new_dummy(parent, pdata[i].reg_addr); + if (!pdata[i].client) { + printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[i].reg_addr); + goto error; + } + } + + ret = sysfs_create_group(&pdev->dev.kobj, &ag5648_cpld_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + goto error; + } + + return 0; + +error: + i--; + for (; i >= 0; i--) { + if (pdata[i].client) { + i2c_unregister_device(pdata[i].client); + } + } + i2c_put_adapter(parent); + + return -ENODEV; +} + +static int __exit cpld_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent = NULL; + struct cpld_platform_data *pdata = pdev->dev.platform_data; + int i; + sysfs_remove_group(&pdev->dev.kobj, &ag5648_cpld_attr_grp); + + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + } + else { + for (i = 0; i < ARRAY_SIZE(ag5648_cpld_platform_data); i++) { + if (pdata[i].client) { + if (!parent) { + parent = (pdata[i].client)->adapter; + } + i2c_unregister_device(pdata[i].client); + } + } + } + + i2c_put_adapter(parent); + + return 0; +} + +static struct platform_driver cpld_driver = { + .probe = cpld_probe, + .remove = __exit_p(cpld_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag5648-cpld", + }, +}; + +/*---------------- CPLD - end ------------- */ + +/*---------------- MUX - start ------------- */ + +struct swpld_mux_platform_data { + int parent; + int base_nr; + int reg_addr; + struct i2c_client *cpld; +}; + +struct swpld_mux { + struct i2c_adapter *parent; + struct i2c_adapter **child; + struct swpld_mux_platform_data data; +}; + +static struct swpld_mux_platform_data ag5648_swpld_mux_platform_data[] = { + { + .parent = BUS4, + .base_nr = BUS4_BASE_NUM, + .cpld = NULL, + .reg_addr = BUS4_MUX_REG , + }, +}; + + +static struct platform_device ag5648_swpld_mux[] = { + { + .name = "delta-ag5648-swpld-mux", + .id = 0, + .dev = { + .platform_data = &ag5648_swpld_mux_platform_data[0], + .release = device_release, + }, + }, +}; + + +static int cpld_reg_write_byte(struct i2c_client *client, u8 regaddr, u8 val) +{ + union i2c_smbus_data data; + + data.byte = val; + return client->adapter->algo->smbus_xfer(client->adapter, client->addr, + client->flags, + I2C_SMBUS_WRITE, + regaddr, I2C_SMBUS_BYTE_DATA, &data); +} + +static int swpld_mux_select(struct i2c_adapter *adap, void *data, u8 chan) +{ + struct swpld_mux *mux = data; + u8 swpld_mux_val=0; + if ( mux->data.base_nr == BUS4_BASE_NUM ) + { + swpld_mux_val = (chan + 0x01); + } + else + { + swpld_mux_val = 0x00; + } + swpld_mux_val=swpld_mux_val & (u8)0x3F; + + return cpld_reg_write_byte(mux->data.cpld, mux->data.reg_addr, (u8)(swpld_mux_val & 0xff)); +} + +static int __init swpld_mux_probe(struct platform_device *pdev) +{ + struct swpld_mux *mux; + struct swpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int i, ret, dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", pdata->parent); + return -ENODEV; + } + + /* Judge bus number to decide how many devices*/ + switch (pdata->parent) { + case BUS4: + dev_num = BUS4_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + mux = kzalloc(sizeof(*mux), GFP_KERNEL); + if (!mux) { + ret = -ENOMEM; + printk(KERN_ERR "Failed to allocate memory for mux\n"); + goto alloc_failed; + } + + mux->parent = parent; + mux->data = *pdata; + mux->child = kzalloc(sizeof(struct i2c_adapter *) * dev_num, GFP_KERNEL); + if (!mux->child) { + ret = -ENOMEM; + printk(KERN_ERR "Failed to allocate memory for device on mux\n"); + goto alloc_failed2; + } + + for (i = 0; i < dev_num; i++) { + int nr = pdata->base_nr + i; + unsigned int class = 0; + + mux->child[i] = i2c_add_mux_adapter(parent, &pdev->dev, mux, + nr, i, class, + swpld_mux_select, NULL); + if (!mux->child[i]) { + ret = -ENODEV; + dev_err(&pdev->dev, "Failed to add adapter %d\n", i); + goto add_adapter_failed; + } + } + + platform_set_drvdata(pdev, mux); + return 0; + +add_adapter_failed: + for (; i > 0; i--) + i2c_del_mux_adapter(mux->child[i - 1]); + kfree(mux->child); +alloc_failed2: + kfree(mux); +alloc_failed: + i2c_put_adapter(parent); + + return ret; +} + + +static int __exit swpld_mux_remove(struct platform_device *pdev) +{ + int i; + struct swpld_mux *mux = platform_get_drvdata(pdev); + struct swpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", + pdata->parent); + return -ENODEV; + } + switch (pdata->parent) { + case BUS4: + dev_num = BUS4_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + for (i = 0; i < dev_num; i++) + i2c_del_mux_adapter(mux->child[i]); + + platform_set_drvdata(pdev, NULL); + i2c_put_adapter(mux->parent); + kfree(mux->child); + kfree(mux); + + return 0; +} + +static struct platform_driver swpld_mux_driver = { + .probe = swpld_mux_probe, + .remove = __exit_p(swpld_mux_remove), /* TODO */ + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag5648-swpld-mux", + }, +}; +/*---------------- MUX - end ------------- */ + + +/*---------------- module initialization ------------- */ +static void __init delta_ag5648_platform_init(void) +{ + struct i2c_client *client; + struct i2c_adapter *adapter; + struct cpld_platform_data *cpld_pdata; + struct swpld_mux_platform_data *swpld_pdata; + int ret,i = 0; + + //Use pca9547 in i2c_mux_pca954x.c + adapter = i2c_get_adapter(BUS1); + //client = i2c_new_device(adapter, &i2c_info_pca9548[0]); + i2c_client_9548 = i2c_new_device(adapter, &i2c_info_pca9548[0]); + i2c_put_adapter(adapter); + + // set the CPLD prob and remove + ret = platform_driver_register(&cpld_driver); + if (ret) { + printk(KERN_WARNING "Fail to register cpld driver\n"); + goto error_cpld_driver; + } + + // register the mux prob which call the CPLD + ret = platform_driver_register(&swpld_mux_driver); + if (ret) { + printk(KERN_WARNING "Fail to register swpld mux driver\n"); + goto error_swpld_mux_driver; + } + + // register the i2c devices + ret = platform_driver_register(&i2c_device_driver); + if (ret) { + printk(KERN_WARNING "Fail to register i2c device driver\n"); + goto error_i2c_device_driver; + } + + // register the CPLD + ret = platform_device_register(&ag5648_cpld); + if (ret) { + printk(KERN_WARNING "Fail to create cpld device\n"); + goto error_ag5648_cpld; + } + // link the CPLD and the Mux + cpld_pdata = ag5648_cpld.dev.platform_data; + + + swpld_pdata = ag5648_swpld_mux[0].dev.platform_data; + swpld_pdata->cpld = cpld_pdata[master_cpld].client; + ret = platform_device_register(&ag5648_swpld_mux[0]); + if (ret) { + printk(KERN_WARNING "Fail to create swpld mux %d\n", i); + goto error_ag5648_swpld_mux; + } + + for (i = 0; i < ARRAY_SIZE(ag5648_i2c_device); i++) + { + ret = platform_device_register(&ag5648_i2c_device[i]); + if (ret) { + printk(KERN_WARNING "Fail to create i2c device %d\n", i); + goto error_ag5648_i2c_device; + } + } + + if (ret) + goto error_ag5648_swpld_mux; + + return 0; + +error_ag5648_i2c_device: + i--; + for (; i >= 0; i--) { + platform_device_unregister(&ag5648_i2c_device[i]); + } + i = ARRAY_SIZE(ag5648_swpld_mux); +error_ag5648_swpld_mux: + i--; + for (; i >= 0; i--) { + platform_device_unregister(&ag5648_swpld_mux[0]); + } + platform_driver_unregister(&ag5648_cpld); +error_ag5648_cpld: + platform_driver_unregister(&i2c_device_driver); +error_i2c_device_driver: + platform_driver_unregister(&swpld_mux_driver); +error_swpld_mux_driver: + platform_driver_unregister(&cpld_driver); +error_cpld_driver: + return ret; +} + +static void __exit delta_ag5648_platform_exit(void) +{ + int i = 0; + + for ( i = 0; i < ARRAY_SIZE(ag5648_i2c_device); i++ ) { + platform_device_unregister(&ag5648_i2c_device[i]); + } + + for (i = 0; i < ARRAY_SIZE(ag5648_swpld_mux); i++) { + platform_device_unregister(&ag5648_swpld_mux[i]); + } + + platform_device_unregister(&ag5648_cpld); + platform_driver_unregister(&i2c_device_driver); + platform_driver_unregister(&cpld_driver); + platform_driver_unregister(&swpld_mux_driver); + + i2c_unregister_device(i2c_client_9548); +} + +module_init(delta_ag5648_platform_init); +module_exit(delta_ag5648_platform_exit); + +MODULE_DESCRIPTION("DNI ag5648 Platform Support"); +MODULE_AUTHOR("Neal Tai "); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/dni_ag5648_psu.c b/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/dni_ag5648_psu.c new file mode 100644 index 000000000000..185ba2222b91 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/dni_ag5648_psu.c @@ -0,0 +1,552 @@ +/* + * An hwmon driver for delta AG5648 PSU + * dps_800ab_16_d.c - Support for DPS-800AB-16 D Power Supply Module + * + * Copyright (C) 2016 Delta Network Technology Corporation + * + * DNI + * + * Based on ym2651y.c + * Based on ad7414.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_FAN_DUTY_CYCLE 100 +#define SWPLD_REG 0x31 +#define SWPLD_PSU_MUX_REG 0x21 +#define SELECT_PSU1_EEPROM 0x00 +#define SELECT_PSU2_EEPROM 0x20 + +u8 psu_member_data = 0x00; + +/* Address scanned */ +static const unsigned short normal_i2c[] = { 0x59, 0x58, I2C_CLIENT_END }; + +/* This is additional data */ +struct dps_800ab_16_d_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; + unsigned long last_updated; /* In jiffies */ + + /* Registers value */ + u8 vout_mode; + u16 in1_input; + u16 in2_input; + u16 curr1_input; + u16 curr2_input; + u16 power1_input; + u16 power2_input; + u16 temp_input[2]; + u8 fan_target; + u16 fan_duty_cycle_input[2]; + u16 fan_speed_input[2]; + u8 mfr_model[14]; + u8 mfr_serial[16]; +}; + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask); +static ssize_t set_fan_duty_cycle_input(struct device *dev, struct device_attribute \ + *dev_attr, const char *buf, size_t count); +static ssize_t for_linear_data(struct device *dev, struct device_attribute \ + *dev_attr, char *buf); +static ssize_t for_fan_target(struct device *dev, struct device_attribute \ + *dev_attr, char *buf); +static ssize_t for_vout_data(struct device *dev, struct device_attribute \ + *dev_attr, char *buf); +static int dps_800ab_16_d_read_byte(struct i2c_client *client, u8 reg); +static int dps_800ab_16_d_read_word(struct i2c_client *client, u8 reg); +static int dps_800ab_16_d_write_word(struct i2c_client *client, u8 reg, \ + u16 value); +static int dps_800ab_16_d_read_block(struct i2c_client *client, u8 command, \ + u8 *data, int data_len); +static struct dps_800ab_16_d_data *dps_800ab_16_d_update_device( \ + struct device *dev); +static ssize_t for_ascii(struct device *dev, struct device_attribute \ + *dev_attr, char *buf); +/* +static ssize_t set_w_member_data(struct device *dev, struct device_attribute \ + *dev_att, const char *buf, size_t count); +static ssize_t for_r_member_data(struct device *dev, struct device_attribute \ + *dev_attr, char *buf); +*/ +enum dps_800ab_16_d_sysfs_attributes { + PSU_V_IN, + PSU_V_OUT, + PSU_I_IN, + PSU_I_OUT, + PSU_P_IN, + PSU_P_OUT, + PSU_TEMP1_INPUT, + PSU_FAN1_FAULT, + PSU_FAN1_DUTY_CYCLE, + PSU_FAN1_SPEED, + PSU_MFR_MODEL, + PSU_MFR_SERIAL, + PSU_SELECT_MEMBER, +}; + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static ssize_t set_fan_duty_cycle_input(struct device *dev, struct device_attribute \ + *dev_attr, const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct i2c_client *client = to_i2c_client(dev); + struct dps_800ab_16_d_data *data = i2c_get_clientdata(client); + int nr = (attr->index == PSU_FAN1_DUTY_CYCLE) ? 0 : 1; + long speed; + int error; + + error = kstrtol(buf, 10, &speed); + if (error) + return error; + + if (speed < 0 || speed > MAX_FAN_DUTY_CYCLE) + return -EINVAL; + + /* Select SWPLD PSU offset */ + + mutex_lock(&data->update_lock); + data->fan_duty_cycle_input[nr] = speed; + dps_800ab_16_d_write_word(client, 0x3B + nr, data->fan_duty_cycle_input[nr]); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t for_linear_data(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct dps_800ab_16_d_data *data = dps_800ab_16_d_update_device(dev); + + u16 value = 0; + int exponent, mantissa; + int multiplier = 1000; + + switch (attr->index) { + case PSU_V_IN: + value = data->in1_input; + break; + case PSU_I_IN: + value = data->curr1_input; + break; + case PSU_I_OUT: + value = data->curr2_input; + break; + case PSU_P_IN: + value = data->power1_input; + multiplier = 1000*1000; + break; + case PSU_P_OUT: + value = data->power2_input; + multiplier = 1000*1000; + break; + case PSU_TEMP1_INPUT: + value = data->temp_input[0]; + break; + case PSU_FAN1_DUTY_CYCLE: + multiplier = 1; + value = data->fan_duty_cycle_input[0]; + break; + case PSU_FAN1_SPEED: + multiplier = 1; + value = data->fan_speed_input[0]; + break; + default: + break; + } + + exponent = two_complement_to_int(value >> 11, 5, 0x1f); + mantissa = two_complement_to_int(value & 0x7ff, 11, 0x7ff); + + return (exponent >= 0) ? sprintf(buf, "%d\n", \ + (mantissa << exponent) * multiplier) : \ + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t for_fan_target(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct dps_800ab_16_d_data *data = dps_800ab_16_d_update_device(dev); + + u8 shift = (attr->index == PSU_FAN1_FAULT) ? 7 : 6; + + return sprintf(buf, "%d\n", data->fan_target >> shift); +} + +static ssize_t for_vout_data(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct dps_800ab_16_d_data *data = dps_800ab_16_d_update_device(dev); + int exponent, mantissa; + int multiplier = 1000; + + exponent = two_complement_to_int(data->vout_mode, 5, 0x1f); + mantissa = data->in2_input; + + return (exponent > 0) ? sprintf(buf, "%d\n", \ + (mantissa * multiplier) / (1 << exponent)): \ + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); + +} + +static ssize_t for_ascii(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct dps_800ab_16_d_data *data = dps_800ab_16_d_update_device(dev); + u8 *ptr = NULL; + + if (!data->valid) + return 0; + + switch (attr->index) { + case PSU_MFR_MODEL: + ptr = data->mfr_model + 1; + break; + case PSU_MFR_SERIAL: + ptr = data->mfr_serial + 1; + break; + default: + return 0; + } + return sprintf(buf, "%s\n", ptr); +} +static int dps_800ab_16_d_read_byte(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int dps_800ab_16_d_read_word(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_word_data(client, reg); +} + +static int dps_800ab_16_d_write_word(struct i2c_client *client, u8 reg, \ + u16 value) +{ + union i2c_smbus_data data; + data.word = value; + return i2c_smbus_xfer(client->adapter, client->addr, + client->flags |= I2C_CLIENT_PEC, + I2C_SMBUS_WRITE, reg, + I2C_SMBUS_WORD_DATA, &data); + +} + +static int dps_800ab_16_d_read_block(struct i2c_client *client, u8 command, \ + u8 *data, int data_len) +{ + int result = i2c_smbus_read_i2c_block_data(client, command, data_len, + data); + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + + result = 0; +abort: + return result; + +} + +struct reg_data_byte { + u8 reg; + u8 *value; +}; + +struct reg_data_word { + u8 reg; + u16 *value; +}; + +static struct dps_800ab_16_d_data *dps_800ab_16_d_update_device( \ + struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct dps_800ab_16_d_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + /* Select SWPLD PSU offset */ + + if (time_after(jiffies, data->last_updated)) { + int i, status; + u8 command; + struct reg_data_byte regs_byte[] = { + {0x20, &data->vout_mode}, + {0x81, &data->fan_target} + }; + struct reg_data_word regs_word[] = { + {0x88, &data->in1_input}, + {0x8b, &data->in2_input}, + {0x89, &data->curr1_input}, + {0x8c, &data->curr2_input}, + {0x97, &data->power1_input}, + {0x96, &data->power2_input}, + {0x8d, &(data->temp_input[0])}, + {0x8e, &(data->temp_input[1])}, + {0x3b, &(data->fan_duty_cycle_input[0])}, + {0x90, &(data->fan_speed_input[0])}, + }; + + dev_dbg(&client->dev, "start data update\n"); + /* one milliseconds from now */ + data->last_updated = jiffies + HZ / 1000; + + data->in1_input = 0; + data->in2_input = 0; + data->curr1_input = 0; + data->curr2_input = 0; + data->power1_input = 0; + data->power2_input = 0; + data->temp_input[0] = 0; + data->temp_input[1] = 0; + data->fan_duty_cycle_input[0] = 0; + data->fan_speed_input[0] = 0; + + data->mfr_model[0] = '\0'; + data->mfr_serial[0] = '\0'; + + command = 0x9a; /* PSU mfr_model */ + status = dps_800ab_16_d_read_block(client, command, + data->mfr_model, ARRAY_SIZE(data->mfr_model) - 1); + data->mfr_model[ARRAY_SIZE(data->mfr_model) - 1] = '\0'; + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, + status); + } + + command = 0x9e; /* PSU mfr_serial */ + status = dps_800ab_16_d_read_block(client, command, + data->mfr_serial, ARRAY_SIZE(data->mfr_serial) - 1); + data->mfr_serial[ARRAY_SIZE(data->mfr_serial) - 1] = '\0'; + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, + status); + } + + for (i = 0; i < ARRAY_SIZE(regs_byte); i++) { + status = dps_800ab_16_d_read_byte(client, + regs_byte[i].reg); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_byte[i].reg, status); + } else { + *(regs_byte[i].value) = status; + } + } + + for (i = 0; i < ARRAY_SIZE(regs_word); i++) { + status = dps_800ab_16_d_read_word(client, + regs_word[i].reg); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_word[i].reg, status); + } else { + *(regs_word[i].value) = status; + } + } +/* + command = 0x9a; / PSU mfr_model / + status = dps_800ab_16_d_read_block(client, command, + data->mfr_model, ARRAY_SIZE(data->mfr_model) - 1); + data->mfr_model[ARRAY_SIZE(data->mfr_model) - 1] = '\0'; + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, + status); + } + + command = 0x9e; / PSU mfr_serial / + status = dps_800ab_16_d_read_block(client, command, + data->mfr_serial, ARRAY_SIZE(data->mfr_serial) - 1); + data->mfr_serial[ARRAY_SIZE(data->mfr_serial) - 1] = '\0'; + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, + status); + } + */ + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; + +} + +/* sysfs attributes for hwmon */ +static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, for_linear_data, NULL, PSU_V_IN); +static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, for_vout_data, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, for_linear_data, NULL, PSU_I_IN); +static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, for_linear_data, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, for_linear_data, NULL, PSU_P_IN); +static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, for_linear_data, NULL, PSU_P_OUT); +static SENSOR_DEVICE_ATTR(temp1_input, \ + S_IRUGO, for_linear_data, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(fan1_target, \ + S_IRUGO, for_fan_target, NULL, PSU_FAN1_FAULT); +static SENSOR_DEVICE_ATTR(fan1_set_percentage, S_IWUGO | S_IRUGO, \ + for_linear_data, set_fan_duty_cycle_input, PSU_FAN1_DUTY_CYCLE); +static SENSOR_DEVICE_ATTR(fan1_input, \ + S_IRUGO, for_linear_data, NULL, PSU_FAN1_SPEED); +static SENSOR_DEVICE_ATTR(psu_mfr_model, \ + S_IRUGO, for_ascii, NULL, PSU_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu_mfr_serial, \ + S_IRUGO, for_ascii, NULL, PSU_MFR_SERIAL); +/* +static SENSOR_DEVICE_ATTR(psu_select_member, S_IWUGO | S_IRUGO, \ + for_r_member_data, set_w_member_data, PSU_SELECT_MEMBER); +*/ +static struct attribute *dps_800ab_16_d_attributes[] = { + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_in2_input.dev_attr.attr, + &sensor_dev_attr_curr1_input.dev_attr.attr, + &sensor_dev_attr_curr2_input.dev_attr.attr, + &sensor_dev_attr_power1_input.dev_attr.attr, + &sensor_dev_attr_power2_input.dev_attr.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_fan1_target.dev_attr.attr, + &sensor_dev_attr_fan1_set_percentage.dev_attr.attr, + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_psu_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu_mfr_serial.dev_attr.attr, + //&sensor_dev_attr_psu_select_member.dev_attr.attr, + NULL +}; + +static const struct attribute_group dps_800ab_16_d_group = { + .attrs = dps_800ab_16_d_attributes, +}; + +static int dps_800ab_16_d_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct dps_800ab_16_d_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(*data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "new chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &dps_800ab_16_d_group); + if (status) + goto exit_sysfs_create_group; + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_hwmon_device_register; + } + + return 0; + +exit_hwmon_device_register: + sysfs_remove_group(&client->dev.kobj, &dps_800ab_16_d_group); +exit_sysfs_create_group: + kfree(data); +exit: + return status; +} + +static int dps_800ab_16_d_remove(struct i2c_client *client) +{ + struct dps_800ab_16_d_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &dps_800ab_16_d_group); + kfree(data); + + return 0; +} + +enum id_name { + dni_ag5648_psu, + dps_800ab_16_d +}; + +static const struct i2c_device_id dps_800ab_16_d_id[] = { + { "dni_ag5648_psu", dni_ag5648_psu }, + { "dps_800ab_16_d", dps_800ab_16_d }, + {} +}; +MODULE_DEVICE_TABLE(i2c, dps_800ab_16_d_id); + +/* This is the driver that will be inserted */ +static struct i2c_driver dps_800ab_16_d_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "dps_800ab_16_d", + }, + .probe = dps_800ab_16_d_probe, + .remove = dps_800ab_16_d_remove, + .id_table = dps_800ab_16_d_id, + .address_list = normal_i2c, +}; + +static int __init dps_800ab_16_d_init(void) +{ + return i2c_add_driver(&dps_800ab_16_d_driver); +} + +static void __exit dps_800ab_16_d_exit(void) +{ + i2c_del_driver(&dps_800ab_16_d_driver); +} + + +MODULE_AUTHOR("Aries Lin "); +MODULE_DESCRIPTION("DPS_800AB_16_D Driver"); +MODULE_LICENSE("GPL"); + +module_init(dps_800ab_16_d_init); +module_exit(dps_800ab_16_d_exit); diff --git a/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/dni_emc2305.c b/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/dni_emc2305.c new file mode 120000 index 000000000000..e8f7ae6b3f4d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/dni_emc2305.c @@ -0,0 +1 @@ +../../common/modules/dni_emc2305.c \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-delta/ag5648/scripts/ag5648_platform_init.sh b/platform/broadcom/sonic-platform-modules-delta/ag5648/scripts/ag5648_platform_init.sh new file mode 100755 index 000000000000..753649f01abe --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag5648/scripts/ag5648_platform_init.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +#platform init script for Delta ag5648 + +#fan speed monitor start +/usr/share/sonic/device/x86_64-delta_ag5648-r0/fancontrol.service /usr/share/sonic/device/x86_64-delta_ag5648-r0/fancontrol & + +#led control +/usr/local/bin/led_control & + + +exit 0 + diff --git a/platform/broadcom/sonic-platform-modules-delta/ag5648/scripts/led_control b/platform/broadcom/sonic-platform-modules-delta/ag5648/scripts/led_control new file mode 100755 index 000000000000..bc1417f9ba5e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag5648/scripts/led_control @@ -0,0 +1,221 @@ +#!/bin/bash + +FAN1_EEPROM="-y 3 0x51 0x0a" +FAN2_EEPROM="-y 3 0x52 0x0a" +FAN3_EEPROM="-y 3 0x53 0x0a" +FAN4_EEPROM="-y 3 0x54 0x0a" +LED_CONTROL="/sys/devices/platform/delta-ag5648-cpld.0/led_control" + +FAN1_REAR_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/3-004d/fan1_input" +FAN2_REAR_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/3-004d/fan2_input" +FAN3_REAR_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/3-004d/fan3_input" +FAN4_REAR_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/3-004d/fan4_input" + +FAN1_FRONT_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-004d/fan1_input" +FAN2_FRONT_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-004d/fan2_input" +FAN3_FRONT_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-004d/fan3_input" +FAN4_FRONT_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-004d/fan4_input" + +PSU1_EEPROM="-y 6 0x51 0x00" +PSU2_EEPROM="-y 6 0x50 0x00" +PSU1_FAN_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0059/fan1_input" +PSU2_FAN_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0058/fan1_input" + +catfaneeprom(){ + fan_eeprom_num=0 + fan1_eeprom_num=0 + i2cget $FAN1_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + fan1_eeprom_num=$((fan1_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + fan1_eeprom_num=$((fan1_eeprom_num)) + fi + + fan2_eeprom_num=0 + i2cget $FAN2_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + fan2_eeprom_num=$((fan2_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + fan2_eeprom_num=$((fan2_eeprom_num)) + fi + + fan3_eeprom_num=0 + i2cget $FAN3_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + fan3_eeprom_num=$((fan3_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + fan3_eeprom_num=$((fan3_eeprom_num)) + fi + + fan4_eeprom_num=0 + i2cget $FAN4_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + fan4_eeprom_num=$((fan4_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + fan4_eeprom_num=$((fan4_eeprom_num)) + fi + + fan_eeprom_num=$((fan1_eeprom_num+fan2_eeprom_num+fan3_eeprom_num+fan4_eeprom_num)) +} + +catfanspeed(){ + fan_rpm_normal_num=0 + fan1_rpm_normal_num=0 + fan1_front_rpm=`cat $FAN1_FRONT_RPM` + fan1_rear_rpm=`cat $FAN1_REAR_RPM` + if [ "${fan1_front_rpm}" -ne "960" ] && [ "${fan1_rear_rpm}" -ne "960" ] && [ "${fan1_front_rpm}" -ne "0" ] && [ "${fan1_rear_rpm}" -ne "0" ]; then + fan1_rpm_normal_num=$((fan1_rpm_normal_num+1)) + elif [ "${fan1_front_rpm}" -eq "960" ] || [ "${fan1_rear_rpm}" -eq "960" ] || [ "${fan1_front_rpm}" -eq "0" ] || [ "${fan1_rear_rpm}" -eq "0" ]; then + fan1_rpm_normal_num=$((fan1_rpm_normal_num)) + fi + + fan2_rpm_normal_num=0 + fan2_front_rpm=`cat $FAN2_FRONT_RPM` + fan2_rear_rpm=`cat $FAN2_REAR_RPM` + if [ "${fan2_front_rpm}" -ne "960" ] && [ "${fan2_rear_rpm}" -ne "960" ] && [ "${fan2_front_rpm}" -ne "0" ] && [ "${fan2_rear_rpm}" -ne "0" ]; then + fan2_rpm_normal_num=$((fan2_rpm_normal_num+1)) + elif [ "${fan2_front_rpm}" -eq "960" ] || [ "${fan2_rear_rpm}" -eq "960" ] || [ "${fan2_front_rpm}" -eq "0" ] || [ "${fan2_rear_rpm}" -eq "0" ]; then + fan2_rpm_normal_num=$((fan2_rpm_normal_num)) + fi + + fan3_rpm_normal_num=0 + fan3_front_rpm=`cat $FAN3_FRONT_RPM` + fan3_rear_rpm=`cat $FAN3_REAR_RPM` + if [ "${fan3_front_rpm}" -ne "960" ] && [ "${fan3_rear_rpm}" -ne "960" ] && [ "${fan3_front_rpm}" -ne "0" ] && [ "${fan3_rear_rpm}" -ne "0" ]; then + fan3_rpm_normal_num=$((fan3_rpm_normal_num+1)) + elif [ "${fan3_front_rpm}" -eq "960" ] || [ "${fan3_rear_rpm}" -eq "960" ] || [ "${fan3_front_rpm}" -eq "0" ] || [ "${fan3_rear_rpm}" -eq "0" ]; then + fan3_rpm_normal_num=$((fan3_rpm_normal_num)) + fi + + fan4_rpm_normal_num=0 + fan4_front_rpm=`cat $FAN4_FRONT_RPM` + fan4_rear_rpm=`cat $FAN4_REAR_RPM` + if [ "${fan4_front_rpm}" -ne "960" ] && [ "${fan4_rear_rpm}" -ne "960" ] && [ "${fan4_front_rpm}" -ne "0" ] && [ "${fan4_rear_rpm}" -ne "0" ]; then + fan4_rpm_normal_num=$((fan4_rpm_normal_num+1)) + elif [ "${fan4_front_rpm}" -eq "960" ] || [ "${fan4_rear_rpm}" -eq "960" ] || [ "${fan4_front_rpm}" -eq "0" ] || [ "${fan4_rear_rpm}" -eq "0" ]; then + fan4_rpm_normal_num=$((fan4_rpm_normal_num)) + fi + + fan_rpm_normal_num=$((fan1_rpm_normal_num+fan2_rpm_normal_num+fan3_rpm_normal_num+fan4_rpm_normal_num)) + +} + +catpsueeprom(){ + psu1_eeprom_num=0 + i2cget $PSU1_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + psu1_eeprom_num=$((psu1_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + psu1_eeprom_num=$((psu1_eeprom_num)) + fi + + psu2_eeprom_num=0 + i2cget $PSU2_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + psu2_eeprom_num=$((psu2_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + psu2_eeprom_num=$((psu2_eeprom_num)) + fi +} + +catpsufanspeed(){ + + psu1_rpm_normal_num=0 + psu1_rpm=`cat $PSU1_FAN_RPM` + + if [ "${psu1_rpm}" -ne "960" ] && [ "${psu1_rpm}" -ne "0" ]; then + psu1_rpm_normal_num=$((psu1_rpm_normal_num+1)) + elif [ "${psu1_rpm}" -eq "960" ] || [ "${psu1_rpm}" -eq "0" ]; then + psu1_rpm_normal_num=$((psu1_rpm_normal_num)) + fi + + psu2_rpm_normal_num=0 + psu2_rpm=`cat $PSU2_FAN_RPM` + + if [ "${psu2_rpm}" -ne "960" ] && [ "${psu2_rpm}" -ne "0" ]; then + psu2_rpm_normal_num=$((psu2_rpm_normal_num+1)) + elif [ "${psu2_rpm}" -eq "960" ] || [ "${psu2_rpm}" -eq "0" ]; then + psu2_rpm_normal_num=$((psu2_rpm_normal_num)) + fi + +} + +setfanled(){ + if [ "${fan_eeprom_num}" -eq "4" ] && [ "${fan_rpm_normal_num}" -eq "4" ]; then + echo "fan_green" > $LED_CONTROL + elif [ "${fan_eeprom_num}" -lt "4" ] && [ "${fan_rpm_normal_num}" -eq "4" ]; then + echo "fan_Amber" > $LED_CONTROL + elif [ "${psu1_eeprom_num}" -eq "0" ] && [ "${psu2_eeprom_num}" -eq "0" ]; then + echo "fan_off" > $LED_CONTROL + else + echo "fan_Blinking_yellow" > $LED_CONTROL + fi +} + +setpsuled(){ + if [ "${psu1_rpm_normal_num}" -eq "1" ] && [ "${psu2_rpm_normal_num}" -eq "1" ]; then + echo "pwr_green" > $LED_CONTROL + elif [ "${psu1_eeprom_num}" -eq "1" ] && [ "${psu2_eeprom_num}" -eq "1" ]; then + echo "pwr_Blinking_Amber" > $LED_CONTROL + elif [ "${psu1_eeprom_num}" -eq "0" ] || [ "${psu2_eeprom_num}" -eq "0" ]; then + echo "pwr_Amber" > $LED_CONTROL + else + echo "pwr_off" > $LED_CONTROL + fi + +} + +setfantrayled(){ + if [ "${fan1_rpm_normal_num}" -eq "1" ]; then + echo "fan1_green" > $LED_CONTROL + elif [ "${fan1_eeprom_num}" -eq "1" ]; then + echo "fan1_Amber" > $LED_CONTROL + else + echo "fan1_off" > $LED_CONTROL + fi + + if [ "${fan2_rpm_normal_num}" -eq "1" ]; then + echo "fan2_green" > $LED_CONTROL + elif [ "${fan2_eeprom_num}" -eq "1" ]; then + echo "fan2_Amber" > $LED_CONTROL + else + echo "fan2_off" > $LED_CONTROL + fi + + if [ "${fan3_rpm_normal_num}" -eq "1" ]; then + echo "fan3_green" > $LED_CONTROL + elif [ "${fan3_eeprom_num}" -eq "1" ]; then + echo "fan3_Amber" > $LED_CONTROL + else + echo "fan3_off" > $LED_CONTROL + fi + + if [ "${fan4_rpm_normal_num}" -eq "1" ]; then + echo "fan4_green" > $LED_CONTROL + elif [ "${fan4_eeprom_num}" -eq "1" ]; then + echo "fan4_Amber" > $LED_CONTROL + else + echo "fan4_off" > $LED_CONTROL + fi + +} + +platformstatus(){ + + echo "sys_green" > $LED_CONTROL + catfaneeprom + catfanspeed + setfanled + setfantrayled + + catpsueeprom + catpsufanspeed + setpsuled +} + +while true +do + platformstatus + sleep 5 +done + diff --git a/platform/broadcom/sonic-platform-modules-delta/ag5648/sensors.conf b/platform/broadcom/sonic-platform-modules-delta/ag5648/sensors.conf new file mode 100644 index 000000000000..c69567997a27 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag5648/sensors.conf @@ -0,0 +1,94 @@ +# libsensors configuration file for AG5648 +# ------------------------------------------------ +# + +bus "i2c-2" "i2c-1-mux (chan_id 0)" +bus "i2c-3" "i2c-1-mux (chan_id 1)" +bus "i2c-4" "i2c-1-mux (chan_id 2)" +bus "i2c-5" "i2c-1-mux (chan_id 3)" +bus "i2c-6" "i2c-1-mux (chan_id 4)" +bus "i2c-7" "i2c-1-mux (chan_id 5)" + +# tmp75-i2c-2-4d board sensor near Left of front vents. +# tmp75-i2c-3-49 board sensor near MAC. +# tmp75-i2c-3-4b board sensor near Middle of front vents. +# tmp75-i2c-3-4c board sensor near Right of front vents. +# tmp75-i2c-3-4e board sensor near DC fan. +# tmp75-i2c-3-4f board sensor near CPU. + +chip "tmp75-i2c-*-4d" + label temp1 "board sensor near Left of front vents" + set temp1_max 60 + set temp1_max_hyst 55 + +chip "tmp75-i2c-*-49" + label temp1 "board sensor near MAC" + set temp1_max 85 + set temp1_max_hyst 80 + +chip "tmp75-i2c-*-4b" + label temp1 "board sensor near Middle of front vents" + set temp1_max 70 + set temp1_max_hyst 65 + +chip "tmp75-i2c-*-4c" + label temp1 "board sensor near Right of front vents" + set temp1_max 65 + set temp1_max_hyst 60 + +chip "tmp75-i2c-*-4e" + label temp1 "board sensor near DC fan" + set temp1_max 60 + set temp1_max_hyst 55 + +chip "tmp75-i2c-*-4f" + label temp1 "board sensor near CPU" + set temp1_max 80 + set temp1_max_hyst 75 + +chip "emc2305-i2c-3-4d" + label fan1 "FANTRAY 1 REAR" + label fan2 "FANTRAY 2 REAR" + label fan3 "FANTRAY 3 REAR" + label fan4 "FANTRAY 4 REAR" + label fan5 "FANTRAY 5 REAR" + +chip "emc2305-i2c-5-4d" + label fan1 "FANTRAY 1 FRONT" + label fan2 "FANTRAY 2 FRONT" + label fan3 "FANTRAY 3 FRONT" + label fan4 "FANTRAY 4 FRONT" + label fan5 "FANTRAY 5 FRONT" + +chip "ltc4215-i2c-*-40" + label in1 "PSU Hot-Swap voltage 1" + label in2 "PSU Hot-Swap voltage 2" + label power1 "PSU Hot-Swap power" + label curr1 "PSU Hot-Swap current" + +chip "ltc4215-i2c-*-42" + label in1 "PSU Hot-Swap voltage 1" + label in2 "PSU Hot-Swap voltage 2" + label power1 "PSU Hot-Swap power" + label curr1 "PSU Hot-Swap current" + +chip "dni_ag5648_psu-i2c-*-59" + label in1 "PSU voltage 1" + label in2 "PSU voltage 2" + label fan1 "PSU fan" + label temp1 "PSU temperature" + label power1 "PSU power1" + label power2 "PSU power2" + label curr1 "PSU current1" + label curr2 "PSU current2" + +chip "dni_ag5648_psu-i2c-*-58" + label in1 "PSU voltage 1" + label in2 "PSU voltage 2" + label fan1 "PSU fan" + label temp1 "PSU temperature" + label power1 "PSU power1" + label power2 "PSU power2" + label curr1 "PSU current1" + label curr2 "PSU current2" + diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/Makefile b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/Makefile index 0712ff9cd6fa..fc335c2a977f 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/Makefile @@ -1,2 +1,2 @@ -obj-m := at24.o dni_ag9032v1_psu.o dni_emc2305.o delta_ag9032v1_platform.o delta_ag9032v1_cpupld.o +obj-m := dni_ag9032v1_psu.o dni_emc2305.o delta_ag9032v1_platform.o delta_ag9032v1_cpupld.o diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/at24.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/at24.c deleted file mode 100644 index 8e73691647d8..000000000000 --- a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/at24.c +++ /dev/null @@ -1,698 +0,0 @@ -/* - * at24.c - handle most I2C EEPROMs - * - * Copyright (C) 2005-2007 David Brownell - * Copyright (C) 2008 Wolfram Sang, Pengutronix - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable. - * Differences between different vendor product lines (like Atmel AT24C or - * MicroChip 24LC, etc) won't much matter for typical read/write access. - * There are also I2C RAM chips, likewise interchangeable. One example - * would be the PCF8570, which acts like a 24c02 EEPROM (256 bytes). - * - * However, misconfiguration can lose data. "Set 16-bit memory address" - * to a part with 8-bit addressing will overwrite data. Writing with too - * big a page size also loses data. And it's not safe to assume that the - * conventional addresses 0x50..0x57 only hold eeproms; a PCF8563 RTC - * uses 0x51, for just one example. - * - * Accordingly, explicit board-specific configuration data should be used - * in almost all cases. (One partial exception is an SMBus used to access - * "SPD" data for DRAM sticks. Those only use 24c02 EEPROMs.) - * - * So this driver uses "new style" I2C driver binding, expecting to be - * told what devices exist. That may be in arch/X/mach-Y/board-Z.c or - * similar kernel-resident tables; or, configuration data coming from - * a bootloader. - * - * Other than binding model, current differences from "eeprom" driver are - * that this one handles write access and isn't restricted to 24c02 devices. - * It also handles larger devices (32 kbit and up) with two-byte addresses, - * which won't work on pure SMBus systems. - */ - -struct at24_data { - struct at24_platform_data chip; - struct memory_accessor macc; - int use_smbus; - - /* - * Lock protects against activities from other Linux tasks, - * but not from changes by other I2C masters. - */ - struct mutex lock; - struct bin_attribute bin; - - u8 *writebuf; - unsigned write_max; - unsigned num_addresses; - - /* - * Some chips tie up multiple I2C addresses; dummy devices reserve - * them for us, and we'll use them with SMBus calls. - */ - struct i2c_client *client[]; -}; - -/* - * This parameter is to help this driver avoid blocking other drivers out - * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C - * clock, one 256 byte read takes about 1/43 second which is excessive; - * but the 1/170 second it takes at 400 kHz may be quite reasonable; and - * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. - * - * This value is forced to be a power of two so that writes align on pages. - */ -static unsigned io_limit = 32; -module_param(io_limit, uint, 0); -MODULE_PARM_DESC(io_limit, "Maximum bytes per I/O (default 32)"); - -/* - * Specs often allow 5 msec for a page write, sometimes 20 msec; - * it's important to recover from write timeouts. - */ -static unsigned write_timeout = 25; -module_param(write_timeout, uint, 0); -MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)"); - -#define AT24_SIZE_BYTELEN 5 -#define AT24_SIZE_FLAGS 8 - -#define AT24_BITMASK(x) (BIT(x) - 1) - -/* create non-zero magic value for given eeprom parameters */ -#define AT24_DEVICE_MAGIC(_len, _flags) \ - ((1 << AT24_SIZE_FLAGS | (_flags)) \ - << AT24_SIZE_BYTELEN | ilog2(_len)) - -static const struct i2c_device_id at24_ids[] = { - /* needs 8 addresses as A0-A2 are ignored */ - { "24c00", AT24_DEVICE_MAGIC(128 / 8, AT24_FLAG_TAKE8ADDR) }, - /* old variants can't be handled with this generic entry! */ - { "24c01", AT24_DEVICE_MAGIC(1024 / 8, 0) }, - { "24c02", AT24_DEVICE_MAGIC(2048 / 8, 0) }, - /* spd is a 24c02 in memory DIMMs */ - { "spd", AT24_DEVICE_MAGIC(2048 / 8, - AT24_FLAG_READONLY | AT24_FLAG_IRUGO) }, - { "24c04", AT24_DEVICE_MAGIC(4096 / 8, 0) }, - /* 24rf08 quirk is handled at i2c-core */ - { "24c08", AT24_DEVICE_MAGIC(8192 / 8, 0) }, - { "24c16", AT24_DEVICE_MAGIC(16384 / 8, 0) }, - { "24c32", AT24_DEVICE_MAGIC(32768 / 8, AT24_FLAG_ADDR16) }, - { "24c64", AT24_DEVICE_MAGIC(65536 / 8, AT24_FLAG_ADDR16) }, - { "24c128", AT24_DEVICE_MAGIC(131072 / 8, AT24_FLAG_ADDR16) }, - { "24c256", AT24_DEVICE_MAGIC(262144 / 8, AT24_FLAG_ADDR16) }, - { "24c512", AT24_DEVICE_MAGIC(524288 / 8, AT24_FLAG_ADDR16) }, - { "24c1024", AT24_DEVICE_MAGIC(1048576 / 8, AT24_FLAG_ADDR16) }, - { "at24", 0 }, - { /* END OF LIST */ } -}; -MODULE_DEVICE_TABLE(i2c, at24_ids); - -/*-------------------------------------------------------------------------*/ - -/* - * This routine supports chips which consume multiple I2C addresses. It - * computes the addressing information to be used for a given r/w request. - * Assumes that sanity checks for offset happened at sysfs-layer. - */ -static struct i2c_client *at24_translate_offset(struct at24_data *at24, - unsigned *offset) -{ - unsigned i; - - if (at24->chip.flags & AT24_FLAG_ADDR16) { - i = *offset >> 16; - *offset &= 0xffff; - } else { - i = *offset >> 8; - *offset &= 0xff; - } - - return at24->client[i]; -} - -static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf, - unsigned offset, size_t count) -{ - struct i2c_msg msg[2]; - u8 msgbuf[2]; - struct i2c_client *client; - unsigned long timeout, read_time; - int status, i; - - memset(msg, 0, sizeof(msg)); - - /* - * REVISIT some multi-address chips don't rollover page reads to - * the next slave address, so we may need to truncate the count. - * Those chips might need another quirk flag. - * - * If the real hardware used four adjacent 24c02 chips and that - * were misconfigured as one 24c08, that would be a similar effect: - * one "eeprom" file not four, but larger reads would fail when - * they crossed certain pages. - */ - - /* - * Slave address and byte offset derive from the offset. Always - * set the byte address; on a multi-master board, another master - * may have changed the chip's "current" address pointer. - */ - client = at24_translate_offset(at24, &offset); - - if (count > io_limit) - count = io_limit; - - switch (at24->use_smbus) { - case I2C_SMBUS_I2C_BLOCK_DATA: - /* Smaller eeproms can work given some SMBus extension calls */ - if (count > I2C_SMBUS_BLOCK_MAX) - count = I2C_SMBUS_BLOCK_MAX; - break; - case I2C_SMBUS_WORD_DATA: - /* Check for odd length transaction */ - count = (count == 1) ? 1 : 2; - break; - case I2C_SMBUS_BYTE_DATA: - count = 1; - break; - default: - /* - * When we have a better choice than SMBus calls, use a - * combined I2C message. Write address; then read up to - * io_limit data bytes. Note that read page rollover helps us - * here (unlike writes). msgbuf is u8 and will cast to our - * needs. - */ - i = 0; - if (at24->chip.flags & AT24_FLAG_ADDR16) - msgbuf[i++] = offset >> 8; - msgbuf[i++] = offset; - - msg[0].addr = client->addr; - msg[0].buf = msgbuf; - msg[0].len = i; - - msg[1].addr = client->addr; - msg[1].flags = I2C_M_RD; - msg[1].buf = buf; - msg[1].len = count; - } - - /* - * Reads fail if the previous write didn't complete yet. We may - * loop a few times until this one succeeds, waiting at least - * long enough for one entire page write to work. - */ - timeout = jiffies + msecs_to_jiffies(write_timeout); - do { - read_time = jiffies; - switch (at24->use_smbus) { - case I2C_SMBUS_I2C_BLOCK_DATA: - status = i2c_smbus_read_i2c_block_data(client, offset, - count, buf); - break; - case I2C_SMBUS_WORD_DATA: - status = i2c_smbus_read_word_data(client, offset); - if (status >= 0) { - buf[0] = status & 0xff; - if (count == 2) - buf[1] = status >> 8; - status = count; - } - break; - case I2C_SMBUS_BYTE_DATA: - status = i2c_smbus_read_byte_data(client, offset); - if (status >= 0) { - buf[0] = status; - status = count; - } - break; - default: - status = i2c_transfer(client->adapter, msg, 2); - if (status == 2) - status = count; - } - dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", - count, offset, status, jiffies); - - if (status == count) - return count; - - /* REVISIT: at HZ=100, this is sloooow */ - msleep(1); - } while (time_before(read_time, timeout)); - - return -ETIMEDOUT; -} - -static ssize_t at24_read(struct at24_data *at24, - char *buf, loff_t off, size_t count) -{ - ssize_t retval = 0; - - if (unlikely(!count)) - return count; - - /* - * Read data from chip, protecting against concurrent updates - * from this host, but not from other I2C masters. - */ - mutex_lock(&at24->lock); - - while (count) { - ssize_t status; - - status = at24_eeprom_read(at24, buf, off, count); - if (status <= 0) { - if (retval == 0) - retval = status; - break; - } - buf += status; - off += status; - count -= status; - retval += status; - } - - mutex_unlock(&at24->lock); - - return retval; -} - -static ssize_t at24_bin_read(struct file *filp, struct kobject *kobj, - struct bin_attribute *attr, - char *buf, loff_t off, size_t count) -{ - struct at24_data *at24; - - at24 = dev_get_drvdata(container_of(kobj, struct device, kobj)); - return at24_read(at24, buf, off, count); -} - - -/* - * Note that if the hardware write-protect pin is pulled high, the whole - * chip is normally write protected. But there are plenty of product - * variants here, including OTP fuses and partial chip protect. - * - * We only use page mode writes; the alternative is sloooow. This routine - * writes at most one page. - */ -static ssize_t at24_eeprom_write(struct at24_data *at24, const char *buf, - unsigned offset, size_t count) -{ - struct i2c_client *client; - struct i2c_msg msg; - ssize_t status; - unsigned long timeout, write_time; - unsigned next_page; - - /* Get corresponding I2C address and adjust offset */ - client = at24_translate_offset(at24, &offset); - - /* write_max is at most a page */ - if (count > at24->write_max) - count = at24->write_max; - - /* Never roll over backwards, to the start of this page */ - next_page = roundup(offset + 1, at24->chip.page_size); - if (offset + count > next_page) - count = next_page - offset; - - /* If we'll use I2C calls for I/O, set up the message */ - if (!at24->use_smbus) { - int i = 0; - - msg.addr = client->addr; - msg.flags = 0; - - /* msg.buf is u8 and casts will mask the values */ - msg.buf = at24->writebuf; - if (at24->chip.flags & AT24_FLAG_ADDR16) - msg.buf[i++] = offset >> 8; - - msg.buf[i++] = offset; - memcpy(&msg.buf[i], buf, count); - msg.len = i + count; - } - - /* - * Writes fail if the previous one didn't complete yet. We may - * loop a few times until this one succeeds, waiting at least - * long enough for one entire page write to work. - */ - timeout = jiffies + msecs_to_jiffies(write_timeout); - do { - write_time = jiffies; - if (at24->use_smbus) { - status = i2c_smbus_write_i2c_block_data(client, - offset, count, buf); - if (status == 0) - status = count; - } else { - status = i2c_transfer(client->adapter, &msg, 1); - if (status == 1) - status = count; - } - dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", - count, offset, status, jiffies); - - if (status == count) - return count; - - /* REVISIT: at HZ=100, this is sloooow */ - msleep(1); - } while (time_before(write_time, timeout)); - - return -ETIMEDOUT; -} - -static ssize_t at24_write(struct at24_data *at24, const char *buf, loff_t off, - size_t count) -{ - ssize_t retval = 0; - - if (unlikely(!count)) - return count; - - /* - * Write data to chip, protecting against concurrent updates - * from this host, but not from other I2C masters. - */ - mutex_lock(&at24->lock); - - while (count) { - ssize_t status; - - status = at24_eeprom_write(at24, buf, off, count); - if (status <= 0) { - if (retval == 0) - retval = status; - break; - } - buf += status; - off += status; - count -= status; - retval += status; - } - - mutex_unlock(&at24->lock); - - return retval; -} - -static ssize_t at24_bin_write(struct file *filp, struct kobject *kobj, - struct bin_attribute *attr, - char *buf, loff_t off, size_t count) -{ - struct at24_data *at24; - - if (unlikely(off >= attr->size)) - return -EFBIG; - - at24 = dev_get_drvdata(container_of(kobj, struct device, kobj)); - return at24_write(at24, buf, off, count); -} - -/*-------------------------------------------------------------------------*/ - -/* - * This lets other kernel code access the eeprom data. For example, it - * might hold a board's Ethernet address, or board-specific calibration - * data generated on the manufacturing floor. - */ - -static ssize_t at24_macc_read(struct memory_accessor *macc, char *buf, - off_t offset, size_t count) -{ - struct at24_data *at24 = container_of(macc, struct at24_data, macc); - - return at24_read(at24, buf, offset, count); -} - -static ssize_t at24_macc_write(struct memory_accessor *macc, const char *buf, - off_t offset, size_t count) -{ - struct at24_data *at24 = container_of(macc, struct at24_data, macc); - - return at24_write(at24, buf, offset, count); -} - -/*-------------------------------------------------------------------------*/ - -#ifdef CONFIG_OF -static void at24_get_ofdata(struct i2c_client *client, - struct at24_platform_data *chip) -{ - const __be32 *val; - struct device_node *node = client->dev.of_node; - - if (node) { - if (of_get_property(node, "read-only", NULL)) - chip->flags |= AT24_FLAG_READONLY; - val = of_get_property(node, "pagesize", NULL); - if (val) - chip->page_size = be32_to_cpup(val); - } -} -#else -static void at24_get_ofdata(struct i2c_client *client, - struct at24_platform_data *chip) -{ } -#endif /* CONFIG_OF */ - -static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) -{ - struct at24_platform_data chip; - bool writable; - int use_smbus = 0; - struct at24_data *at24; - int err; - unsigned i, num_addresses; - kernel_ulong_t magic; - - if (client->dev.platform_data) { - chip = *(struct at24_platform_data *)client->dev.platform_data; - } else { - if (!id->driver_data) - return -ENODEV; - - magic = id->driver_data; - chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN)); - magic >>= AT24_SIZE_BYTELEN; - chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS); - /* - * This is slow, but we can't know all eeproms, so we better - * play safe. Specifying custom eeprom-types via platform_data - * is recommended anyhow. - */ - chip.page_size = 1; - - /* update chipdata if OF is present */ - at24_get_ofdata(client, &chip); - - chip.setup = NULL; - chip.context = NULL; - } - - if (!is_power_of_2(chip.byte_len)) - dev_warn(&client->dev, - "byte_len looks suspicious (no power of 2)!\n"); - if (!chip.page_size) { - dev_err(&client->dev, "page_size must not be 0!\n"); - return -EINVAL; - } - if (!is_power_of_2(chip.page_size)) - dev_warn(&client->dev, - "page_size looks suspicious (no power of 2)!\n"); - - /* Use I2C operations unless we're stuck with SMBus extensions. */ - if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { - if (chip.flags & AT24_FLAG_ADDR16) - return -EPFNOSUPPORT; - - if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { - use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; - } else if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_READ_WORD_DATA)) { - use_smbus = I2C_SMBUS_WORD_DATA; - } else if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_READ_BYTE_DATA)) { - use_smbus = I2C_SMBUS_BYTE_DATA; - } else { - return -EPFNOSUPPORT; - } - } - - if (chip.flags & AT24_FLAG_TAKE8ADDR) - num_addresses = 8; - else - num_addresses = DIV_ROUND_UP(chip.byte_len, - (chip.flags & AT24_FLAG_ADDR16) ? 65536 : 256); - - at24 = devm_kzalloc(&client->dev, sizeof(struct at24_data) + - num_addresses * sizeof(struct i2c_client *), GFP_KERNEL); - if (!at24) - return -ENOMEM; - - mutex_init(&at24->lock); - at24->use_smbus = use_smbus; - at24->chip = chip; - at24->num_addresses = num_addresses; - - /* - * Export the EEPROM bytes through sysfs, since that's convenient. - * By default, only root should see the data (maybe passwords etc) - */ - sysfs_bin_attr_init(&at24->bin); - at24->bin.attr.name = "eeprom"; - at24->bin.attr.mode = chip.flags & AT24_FLAG_IRUGO ? S_IRUGO : S_IRUSR; - at24->bin.read = at24_bin_read; - at24->bin.size = chip.byte_len; - - at24->macc.read = at24_macc_read; - - writable = !(chip.flags & AT24_FLAG_READONLY); - if (writable) { - if (!use_smbus || i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) { - - unsigned write_max = chip.page_size; - - at24->macc.write = at24_macc_write; - - at24->bin.write = at24_bin_write; - at24->bin.attr.mode |= S_IWUSR; - - if (write_max > io_limit) - write_max = io_limit; - if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) - write_max = I2C_SMBUS_BLOCK_MAX; - at24->write_max = write_max; - - /* buffer (data + address at the beginning) */ - at24->writebuf = devm_kzalloc(&client->dev, - write_max + 2, GFP_KERNEL); - if (!at24->writebuf) - return -ENOMEM; - } else { - dev_warn(&client->dev, - "cannot write due to controller restrictions."); - } - } - - at24->client[0] = client; - - /* use dummy devices for multiple-address chips */ - for (i = 1; i < num_addresses; i++) { - at24->client[i] = i2c_new_dummy(client->adapter, - client->addr + i); - if (!at24->client[i]) { - dev_err(&client->dev, "address 0x%02x unavailable\n", - client->addr + i); - err = -EADDRINUSE; - goto err_clients; - } - } - - err = sysfs_create_bin_file(&client->dev.kobj, &at24->bin); - if (err) - goto err_clients; - - i2c_set_clientdata(client, at24); - - dev_info(&client->dev, "%zu byte %s EEPROM, %s, %u bytes/write\n", - at24->bin.size, client->name, - writable ? "writable" : "read-only", at24->write_max); - if (use_smbus == I2C_SMBUS_WORD_DATA || - use_smbus == I2C_SMBUS_BYTE_DATA) { - dev_notice(&client->dev, "Falling back to %s reads, " - "performance will suffer\n", use_smbus == - I2C_SMBUS_WORD_DATA ? "word" : "byte"); - } - - /* export data to kernel code */ - if (chip.setup) - chip.setup(&at24->macc, chip.context); - - return 0; - -err_clients: - for (i = 1; i < num_addresses; i++) - if (at24->client[i]) - i2c_unregister_device(at24->client[i]); - - return err; -} - -static int at24_remove(struct i2c_client *client) -{ - struct at24_data *at24; - int i; - - at24 = i2c_get_clientdata(client); - sysfs_remove_bin_file(&client->dev.kobj, &at24->bin); - - for (i = 1; i < at24->num_addresses; i++) - i2c_unregister_device(at24->client[i]); - - return 0; -} - -/*-------------------------------------------------------------------------*/ - -static struct i2c_driver at24_driver = { - .driver = { - .name = "at24", - .owner = THIS_MODULE, - }, - .probe = at24_probe, - .remove = at24_remove, - .id_table = at24_ids, -}; - -static int __init at24_init(void) -{ - if (!io_limit) { - pr_err("at24: io_limit must not be 0!\n"); - return -EINVAL; - } - - io_limit = rounddown_pow_of_two(io_limit); - return i2c_add_driver(&at24_driver); -} -module_init(at24_init); - -static void __exit at24_exit(void) -{ - i2c_del_driver(&at24_driver); -} -module_exit(at24_exit); - -MODULE_DESCRIPTION("Driver for most I2C EEPROMs"); -MODULE_AUTHOR("David Brownell and Wolfram Sang"); -MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_emc2305.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_emc2305.c deleted file mode 100644 index 73d9900af5b4..000000000000 --- a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_emc2305.c +++ /dev/null @@ -1,381 +0,0 @@ -/* - * - * - * Copyright (C) 2017 Delta Networks, Inc. - * - * This program is free software; you can redistribute it - * and/or modify it under the terms ofthe GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * - * - * - * - * A hwmon driver for the SMSC EMC2305 fan controller - * Complete datasheet is available (6/2013) at: - * http://www.smsc.com/media/Downloads_Public/Data_Sheets/2305.pdf - */ - -#include -#include -#include -#include -#include - - -static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, - const char *buf, size_t count); -static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, - char *buf); -static ssize_t set_fan(struct device *dev, struct device_attribute *devattr, - const char *buf, size_t count); -static ssize_t show_fan(struct device *dev, struct device_attribute *devattr, - char *buf); -static ssize_t set_fan_percentage(struct device *dev, struct device_attribute *devattr, - const char *buf, size_t count); -static ssize_t show_fan_percentage(struct device *dev, struct device_attribute * devattr, - char *buf); -static const unsigned short normal_i2c[] = { 0x2C, 0x2D, 0x2E, 0x2F, 0x4C, - 0x4D, I2C_CLIENT_END - }; - - -#define EMC2305_REG_DEVICE 0xFD -#define EMC2305_REG_VENDOR 0xFE - -//#define FAN_MINIMUN 0x33 /*20%*/ -#define FAN_MINIMUN 0x0 /*0%*/ -#define FAN_RPM_BASED 0xAB - -#define EMC2305_REG_FAN_DRIVE(n) (0x30 + 0x10 * n) -#define EMC2305_REG_FAN_MIN_DRIVE(n) (0x38 + 0x10 * n) -#define EMC2305_REG_FAN_TACH(n) (0x3E + 0x10 * n) -#define EMC2305_REG_FAN_CONF(n) (0x32 + 0x10 * n) -#define EMC2305_REG_FAN_REAR_H_RPM(n) (0x3D + 0x10 * n) -#define EMC2305_REG_FAN_REAR_L_RPM(n) (0x3C + 0x10 * n) - -#define EMC2305_DEVICE 0x34 -#define EMC2305_VENDOR 0x5D -#define MAX_FAN_SPEED 23000 - -struct emc2305_data -{ - struct device *hwmon_dev; - struct attribute_group attrs; - struct mutex lock; -}; - -static int emc2305_probe(struct i2c_client *client, - const struct i2c_device_id *id); -static int emc2305_detect(struct i2c_client *client, - struct i2c_board_info *info); -static int emc2305_remove(struct i2c_client *client); - -static const struct i2c_device_id emc2305_id[] = -{ - { "emc2305", 0 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, emc2305_id); - -static struct i2c_driver emc2305_driver = -{ - .class = I2C_CLASS_HWMON, - .driver = { - .name = "emc2305", - }, - .probe = emc2305_probe, - .remove = emc2305_remove, - .id_table = emc2305_id, - .detect = emc2305_detect, - .address_list = normal_i2c, -}; - -static SENSOR_DEVICE_ATTR(fan1_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 0); -static SENSOR_DEVICE_ATTR(fan2_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 1); -static SENSOR_DEVICE_ATTR(fan3_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 2); -static SENSOR_DEVICE_ATTR(fan4_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 3); -static SENSOR_DEVICE_ATTR(fan5_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 4); -static SENSOR_DEVICE_ATTR(fan1_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 0); -static SENSOR_DEVICE_ATTR(fan2_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 1); -static SENSOR_DEVICE_ATTR(fan3_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 2); -static SENSOR_DEVICE_ATTR(fan4_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 3); -static SENSOR_DEVICE_ATTR(fan5_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 4); -static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 0); -static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 1); -static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 2); -static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 3); -static SENSOR_DEVICE_ATTR(pwm5, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 4); - -static struct attribute *emc2305_attr[] = -{ - &sensor_dev_attr_fan1_input.dev_attr.attr, - &sensor_dev_attr_fan2_input.dev_attr.attr, - &sensor_dev_attr_fan3_input.dev_attr.attr, - &sensor_dev_attr_fan4_input.dev_attr.attr, - &sensor_dev_attr_fan5_input.dev_attr.attr, - &sensor_dev_attr_fan1_input_percentage.dev_attr.attr, - &sensor_dev_attr_fan2_input_percentage.dev_attr.attr, - &sensor_dev_attr_fan3_input_percentage.dev_attr.attr, - &sensor_dev_attr_fan4_input_percentage.dev_attr.attr, - &sensor_dev_attr_fan5_input_percentage.dev_attr.attr, - &sensor_dev_attr_pwm1.dev_attr.attr, - &sensor_dev_attr_pwm2.dev_attr.attr, - &sensor_dev_attr_pwm3.dev_attr.attr, - &sensor_dev_attr_pwm4.dev_attr.attr, - &sensor_dev_attr_pwm5.dev_attr.attr, - NULL -}; - -static ssize_t show_fan_percentage(struct device *dev, struct device_attribute * devattr, - char *buf) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - struct i2c_client *client = to_i2c_client(dev); - struct emc2305_data *data = i2c_get_clientdata(client); - int val; - - mutex_lock(&data->lock); - val = i2c_smbus_read_word_swapped(client, - EMC2305_REG_FAN_TACH(attr->index)); - mutex_unlock(&data->lock); - /* Left shift 3 bits for showing correct RPM */ - val = val >> 3; - if ((int)(3932160 * 2 / (val > 0 ? val : 1) == 960))return sprintf(buf, "%d\n", 0); - return sprintf(buf, "%d\n", (int)(3932160 * 2 / (val > 0 ? val : 1) * 100 / MAX_FAN_SPEED)); -} - - -static ssize_t set_fan_percentage(struct device *dev, struct device_attribute *devattr, - const char *buf, size_t count) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - struct i2c_client *client = to_i2c_client(dev); - struct emc2305_data *data = i2c_get_clientdata(client); - unsigned long hsb, lsb; - unsigned long tech; - unsigned long val; - int ret; - - ret = kstrtoul(buf, 10, &val); - if (ret) - { - return ret; - } - if (val > 100) - { - return -EINVAL; - } - - if (val <= 5) - { - hsb = 0xff; /*high bit*/ - lsb = 0xe0; /*low bit*/ - } - else - { - val = val * 230; - tech = (3932160 * 2) / (val > 0 ? val : 1); - hsb = (uint8_t)(((tech << 3) >> 8) & 0x0ff); - lsb = (uint8_t)((tech << 3) & 0x0f8); - } - - mutex_lock(&data->lock); - i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_H_RPM(attr->index), hsb); - i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_L_RPM(attr->index), lsb); - mutex_unlock(&data->lock); - return count; -} - - -static ssize_t show_fan(struct device *dev, struct device_attribute *devattr, - char *buf) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - struct i2c_client *client = to_i2c_client(dev); - struct emc2305_data *data = i2c_get_clientdata(client); - int val; - - - mutex_lock(&data->lock); - val = i2c_smbus_read_word_swapped(client, - EMC2305_REG_FAN_TACH(attr->index)); - mutex_unlock(&data->lock); - /* Left shift 3 bits for showing correct RPM */ - val = val >> 3; - return sprintf(buf, "%d\n", 3932160 * 2 / (val > 0 ? val : 1)); -} - -static ssize_t set_fan(struct device *dev, struct device_attribute *devattr, - const char *buf, size_t count) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - struct i2c_client *client = to_i2c_client(dev); - struct emc2305_data *data = i2c_get_clientdata(client); - unsigned long hsb, lsb; - unsigned long tech; - unsigned long val; - int ret; - - ret = kstrtoul(buf, 10, &val); - if (ret) - { - return ret; - } - if (val > 23000) - { - return -EINVAL; - } - - if (val <= 960) - { - hsb = 0xff; /*high bit*/ - lsb = 0xe0; /*low bit*/ - } - else - { - tech = (3932160 * 2) / (val > 0 ? val : 1); - hsb = (uint8_t)(((tech << 3) >> 8) & 0x0ff); - lsb = (uint8_t)((tech << 3) & 0x0f8); - } - - mutex_lock(&data->lock); - i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_H_RPM(attr->index), hsb); - i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_L_RPM(attr->index), lsb); - mutex_unlock(&data->lock); - return count; -} - -static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, - char *buf) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - struct i2c_client *client = to_i2c_client(dev); - struct emc2305_data *data = i2c_get_clientdata(client); - int val; - - mutex_lock(&data->lock); - val = i2c_smbus_read_byte_data(client, - EMC2305_REG_FAN_DRIVE(attr->index)); - mutex_unlock(&data->lock); - return sprintf(buf, "%d\n", val); -} - -static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, - const char *buf, size_t count) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - struct i2c_client *client = to_i2c_client(dev); - struct emc2305_data *data = i2c_get_clientdata(client); - unsigned long val; - int ret; - - ret = kstrtoul(buf, 10, &val); - if (ret) - { - return ret; - } - if (val > 255) - { - return -EINVAL; - } - - mutex_lock(&data->lock); - i2c_smbus_write_byte_data(client, - EMC2305_REG_FAN_DRIVE(attr->index), - val); - mutex_unlock(&data->lock); - return count; -} - -static int emc2305_detect(struct i2c_client *client, - struct i2c_board_info *info) -{ - struct i2c_adapter *adapter = client->adapter; - int vendor, device; - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | - I2C_FUNC_SMBUS_WORD_DATA)) - { - return -ENODEV; - } - - vendor = i2c_smbus_read_byte_data(client, EMC2305_REG_VENDOR); - if (vendor != EMC2305_VENDOR) - { - return -ENODEV; - } - - device = i2c_smbus_read_byte_data(client, EMC2305_REG_DEVICE); - if (device != EMC2305_DEVICE) - { - return -ENODEV; - } - - strlcpy(info->type, "emc2305", I2C_NAME_SIZE); - - return 0; -} - -static int emc2305_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - struct emc2305_data *data; - int err; - int i; - - data = devm_kzalloc(&client->dev, sizeof(struct emc2305_data), - GFP_KERNEL); - if (!data) - { - return -ENOMEM; - } - - i2c_set_clientdata(client, data); - mutex_init(&data->lock); - - dev_info(&client->dev, "%s chip found\n", client->name); - - data->attrs.attrs = emc2305_attr; - err = sysfs_create_group(&client->dev.kobj, &data->attrs); - if (err) - { - return err; - } - - data->hwmon_dev = hwmon_device_register(&client->dev); - if (IS_ERR(data->hwmon_dev)) - { - err = PTR_ERR(data->hwmon_dev); - goto exit_remove; - } - - for (i = 0; i < 5; i++) - { - /* set minimum drive to 0% */ - i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_MIN_DRIVE(i), FAN_MINIMUN); - i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_CONF(i), FAN_RPM_BASED); - } - - return 0; - -exit_remove: - sysfs_remove_group(&client->dev.kobj, &data->attrs); - return err; -} - -static int emc2305_remove(struct i2c_client *client) -{ - struct emc2305_data *data = i2c_get_clientdata(client); - - hwmon_device_unregister(data->hwmon_dev); - sysfs_remove_group(&client->dev.kobj, &data->attrs); - return 0; -} - -module_i2c_driver(emc2305_driver); - -MODULE_AUTHOR("Neal Tai"); -MODULE_DESCRIPTION("SMSC EMC2305 fan controller driver"); -MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_emc2305.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_emc2305.c new file mode 120000 index 000000000000..e8f7ae6b3f4d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_emc2305.c @@ -0,0 +1 @@ +../../common/modules/dni_emc2305.c \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-delta/common/modules/dni_emc2305.c b/platform/broadcom/sonic-platform-modules-delta/common/modules/dni_emc2305.c new file mode 100644 index 000000000000..73d9900af5b4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/common/modules/dni_emc2305.c @@ -0,0 +1,381 @@ +/* + * + * + * Copyright (C) 2017 Delta Networks, Inc. + * + * This program is free software; you can redistribute it + * and/or modify it under the terms ofthe GNU General Public License as + * published by the Free Software Foundation; either version 2 of the License, + * or (at your option) any later version. + * + * + * + * + * + * A hwmon driver for the SMSC EMC2305 fan controller + * Complete datasheet is available (6/2013) at: + * http://www.smsc.com/media/Downloads_Public/Data_Sheets/2305.pdf + */ + +#include +#include +#include +#include +#include + + +static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count); +static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, + char *buf); +static ssize_t set_fan(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count); +static ssize_t show_fan(struct device *dev, struct device_attribute *devattr, + char *buf); +static ssize_t set_fan_percentage(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count); +static ssize_t show_fan_percentage(struct device *dev, struct device_attribute * devattr, + char *buf); +static const unsigned short normal_i2c[] = { 0x2C, 0x2D, 0x2E, 0x2F, 0x4C, + 0x4D, I2C_CLIENT_END + }; + + +#define EMC2305_REG_DEVICE 0xFD +#define EMC2305_REG_VENDOR 0xFE + +//#define FAN_MINIMUN 0x33 /*20%*/ +#define FAN_MINIMUN 0x0 /*0%*/ +#define FAN_RPM_BASED 0xAB + +#define EMC2305_REG_FAN_DRIVE(n) (0x30 + 0x10 * n) +#define EMC2305_REG_FAN_MIN_DRIVE(n) (0x38 + 0x10 * n) +#define EMC2305_REG_FAN_TACH(n) (0x3E + 0x10 * n) +#define EMC2305_REG_FAN_CONF(n) (0x32 + 0x10 * n) +#define EMC2305_REG_FAN_REAR_H_RPM(n) (0x3D + 0x10 * n) +#define EMC2305_REG_FAN_REAR_L_RPM(n) (0x3C + 0x10 * n) + +#define EMC2305_DEVICE 0x34 +#define EMC2305_VENDOR 0x5D +#define MAX_FAN_SPEED 23000 + +struct emc2305_data +{ + struct device *hwmon_dev; + struct attribute_group attrs; + struct mutex lock; +}; + +static int emc2305_probe(struct i2c_client *client, + const struct i2c_device_id *id); +static int emc2305_detect(struct i2c_client *client, + struct i2c_board_info *info); +static int emc2305_remove(struct i2c_client *client); + +static const struct i2c_device_id emc2305_id[] = +{ + { "emc2305", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, emc2305_id); + +static struct i2c_driver emc2305_driver = +{ + .class = I2C_CLASS_HWMON, + .driver = { + .name = "emc2305", + }, + .probe = emc2305_probe, + .remove = emc2305_remove, + .id_table = emc2305_id, + .detect = emc2305_detect, + .address_list = normal_i2c, +}; + +static SENSOR_DEVICE_ATTR(fan1_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 0); +static SENSOR_DEVICE_ATTR(fan2_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 1); +static SENSOR_DEVICE_ATTR(fan3_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 2); +static SENSOR_DEVICE_ATTR(fan4_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 3); +static SENSOR_DEVICE_ATTR(fan5_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 4); +static SENSOR_DEVICE_ATTR(fan1_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 0); +static SENSOR_DEVICE_ATTR(fan2_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 1); +static SENSOR_DEVICE_ATTR(fan3_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 2); +static SENSOR_DEVICE_ATTR(fan4_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 3); +static SENSOR_DEVICE_ATTR(fan5_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 4); +static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 0); +static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 1); +static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 2); +static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 3); +static SENSOR_DEVICE_ATTR(pwm5, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 4); + +static struct attribute *emc2305_attr[] = +{ + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan2_input.dev_attr.attr, + &sensor_dev_attr_fan3_input.dev_attr.attr, + &sensor_dev_attr_fan4_input.dev_attr.attr, + &sensor_dev_attr_fan5_input.dev_attr.attr, + &sensor_dev_attr_fan1_input_percentage.dev_attr.attr, + &sensor_dev_attr_fan2_input_percentage.dev_attr.attr, + &sensor_dev_attr_fan3_input_percentage.dev_attr.attr, + &sensor_dev_attr_fan4_input_percentage.dev_attr.attr, + &sensor_dev_attr_fan5_input_percentage.dev_attr.attr, + &sensor_dev_attr_pwm1.dev_attr.attr, + &sensor_dev_attr_pwm2.dev_attr.attr, + &sensor_dev_attr_pwm3.dev_attr.attr, + &sensor_dev_attr_pwm4.dev_attr.attr, + &sensor_dev_attr_pwm5.dev_attr.attr, + NULL +}; + +static ssize_t show_fan_percentage(struct device *dev, struct device_attribute * devattr, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + int val; + + mutex_lock(&data->lock); + val = i2c_smbus_read_word_swapped(client, + EMC2305_REG_FAN_TACH(attr->index)); + mutex_unlock(&data->lock); + /* Left shift 3 bits for showing correct RPM */ + val = val >> 3; + if ((int)(3932160 * 2 / (val > 0 ? val : 1) == 960))return sprintf(buf, "%d\n", 0); + return sprintf(buf, "%d\n", (int)(3932160 * 2 / (val > 0 ? val : 1) * 100 / MAX_FAN_SPEED)); +} + + +static ssize_t set_fan_percentage(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + unsigned long hsb, lsb; + unsigned long tech; + unsigned long val; + int ret; + + ret = kstrtoul(buf, 10, &val); + if (ret) + { + return ret; + } + if (val > 100) + { + return -EINVAL; + } + + if (val <= 5) + { + hsb = 0xff; /*high bit*/ + lsb = 0xe0; /*low bit*/ + } + else + { + val = val * 230; + tech = (3932160 * 2) / (val > 0 ? val : 1); + hsb = (uint8_t)(((tech << 3) >> 8) & 0x0ff); + lsb = (uint8_t)((tech << 3) & 0x0f8); + } + + mutex_lock(&data->lock); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_H_RPM(attr->index), hsb); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_L_RPM(attr->index), lsb); + mutex_unlock(&data->lock); + return count; +} + + +static ssize_t show_fan(struct device *dev, struct device_attribute *devattr, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + int val; + + + mutex_lock(&data->lock); + val = i2c_smbus_read_word_swapped(client, + EMC2305_REG_FAN_TACH(attr->index)); + mutex_unlock(&data->lock); + /* Left shift 3 bits for showing correct RPM */ + val = val >> 3; + return sprintf(buf, "%d\n", 3932160 * 2 / (val > 0 ? val : 1)); +} + +static ssize_t set_fan(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + unsigned long hsb, lsb; + unsigned long tech; + unsigned long val; + int ret; + + ret = kstrtoul(buf, 10, &val); + if (ret) + { + return ret; + } + if (val > 23000) + { + return -EINVAL; + } + + if (val <= 960) + { + hsb = 0xff; /*high bit*/ + lsb = 0xe0; /*low bit*/ + } + else + { + tech = (3932160 * 2) / (val > 0 ? val : 1); + hsb = (uint8_t)(((tech << 3) >> 8) & 0x0ff); + lsb = (uint8_t)((tech << 3) & 0x0f8); + } + + mutex_lock(&data->lock); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_H_RPM(attr->index), hsb); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_L_RPM(attr->index), lsb); + mutex_unlock(&data->lock); + return count; +} + +static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + int val; + + mutex_lock(&data->lock); + val = i2c_smbus_read_byte_data(client, + EMC2305_REG_FAN_DRIVE(attr->index)); + mutex_unlock(&data->lock); + return sprintf(buf, "%d\n", val); +} + +static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + unsigned long val; + int ret; + + ret = kstrtoul(buf, 10, &val); + if (ret) + { + return ret; + } + if (val > 255) + { + return -EINVAL; + } + + mutex_lock(&data->lock); + i2c_smbus_write_byte_data(client, + EMC2305_REG_FAN_DRIVE(attr->index), + val); + mutex_unlock(&data->lock); + return count; +} + +static int emc2305_detect(struct i2c_client *client, + struct i2c_board_info *info) +{ + struct i2c_adapter *adapter = client->adapter; + int vendor, device; + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA)) + { + return -ENODEV; + } + + vendor = i2c_smbus_read_byte_data(client, EMC2305_REG_VENDOR); + if (vendor != EMC2305_VENDOR) + { + return -ENODEV; + } + + device = i2c_smbus_read_byte_data(client, EMC2305_REG_DEVICE); + if (device != EMC2305_DEVICE) + { + return -ENODEV; + } + + strlcpy(info->type, "emc2305", I2C_NAME_SIZE); + + return 0; +} + +static int emc2305_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct emc2305_data *data; + int err; + int i; + + data = devm_kzalloc(&client->dev, sizeof(struct emc2305_data), + GFP_KERNEL); + if (!data) + { + return -ENOMEM; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->lock); + + dev_info(&client->dev, "%s chip found\n", client->name); + + data->attrs.attrs = emc2305_attr; + err = sysfs_create_group(&client->dev.kobj, &data->attrs); + if (err) + { + return err; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) + { + err = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + for (i = 0; i < 5; i++) + { + /* set minimum drive to 0% */ + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_MIN_DRIVE(i), FAN_MINIMUN); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_CONF(i), FAN_RPM_BASED); + } + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &data->attrs); + return err; +} + +static int emc2305_remove(struct i2c_client *client) +{ + struct emc2305_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &data->attrs); + return 0; +} + +module_i2c_driver(emc2305_driver); + +MODULE_AUTHOR("Neal Tai"); +MODULE_DESCRIPTION("SMSC EMC2305 fan controller driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/control b/platform/broadcom/sonic-platform-modules-delta/debian/control index 14dfdd2e14b9..455a5f296ac0 100644 --- a/platform/broadcom/sonic-platform-modules-delta/debian/control +++ b/platform/broadcom/sonic-platform-modules-delta/debian/control @@ -14,3 +14,8 @@ Package: platform-modules-ag9064 Architecture: amd64 Depends: linux-image-3.16.0-5-amd64 Description: kernel modules for platform devices such as fan, led, sfp + +Package: platform-modules-ag5648 +Architecture: amd64 +Depends: linux-image-3.16.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/files b/platform/broadcom/sonic-platform-modules-delta/debian/files deleted file mode 100644 index 57f157bc8a3b..000000000000 --- a/platform/broadcom/sonic-platform-modules-delta/debian/files +++ /dev/null @@ -1,2 +0,0 @@ -platform-modules-ag9032v1_1.1_amd64.deb main extra -platform-modules-ag9064_1.1_amd64.deb main extra diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag5648.init b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag5648.init new file mode 100755 index 000000000000..d69534035a54 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag5648.init @@ -0,0 +1,49 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup ag5648 board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + depmod -a + rmmod i2c-i801 + rmmod i2c-ismt + modprobe i2c-dev + modprobe i2c-i801 + modprobe i2c-ismt + modprobe i2c-mux-pca954x + modprobe dni_ag5648_psu + modprobe dni_emc2305 + modprobe at24 + modprobe delta_ag5648_platform + + /usr/local/bin/ag5648_platform_init.sh + + echo "done." + ;; + +stop) + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-ag5648.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag5648.install b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag5648.install new file mode 100644 index 000000000000..15f218eea12d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag5648.install @@ -0,0 +1,3 @@ +ag5648/scripts/ag5648_platform_init.sh usr/local/bin +ag5648/cfg/ag5648-modules.conf etc/modules-load.d +ag5648/scripts/led_control usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/rules b/platform/broadcom/sonic-platform-modules-delta/debian/rules index 7efbed9e2c33..57383e7241f2 100755 --- a/platform/broadcom/sonic-platform-modules-delta/debian/rules +++ b/platform/broadcom/sonic-platform-modules-delta/debian/rules @@ -5,7 +5,7 @@ export INSTALL_MOD_DIR:=extra KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= ag9032v1 ag9064 +MODULE_DIRS:= ag9032v1 ag9064 ag5648 %: dh $@ From c083532a5d5a646e310894ec41b8ea2e0b467dbf Mon Sep 17 00:00:00 2001 From: Pradchaya P Date: Sat, 24 Mar 2018 06:18:15 +0800 Subject: [PATCH 071/274] [device] Update sensors conf on DX010 (#1430) Update sensors configuration file. Add threshold to PSU sensors values. --- .../x86_64-cel_seastone-r0/sensors.conf | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/device/celestica/x86_64-cel_seastone-r0/sensors.conf b/device/celestica/x86_64-cel_seastone-r0/sensors.conf index 93a0fd6db762..e25717ac589f 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sensors.conf +++ b/device/celestica/x86_64-cel_seastone-r0/sensors.conf @@ -8,6 +8,16 @@ chip "dps460-i2c-*-5a" label temp3 "Power Supply 1 temp sensor 3" ignore fan2 ignore fan3 + ignore in2 + + set in1_max 240 + set in1_min 100 + set in1_crit 264 + set in1_lcrit 90 + set in3_max 12.6 + set in3_min 11.4 + set in3_crit 13.0 + set in3_lcrit 11.0 chip "dps460-i2c-*-5b" label temp1 "Power Supply 2 temp sensor 1" @@ -15,6 +25,16 @@ chip "dps460-i2c-*-5b" label temp3 "Power Supply 2 temp sensor 3" ignore fan2 ignore fan3 + ignore in2 + + set in1_max 240 + set in1_min 100 + set in1_crit 264 + set in1_lcrit 90 + set in3_max 12.6 + set in3_min 11.4 + set in3_crit 13.0 + set in3_lcrit 11.0 # These sensors located on Main Switch Board. chip "dx010_lm75b-i2c-*-48" @@ -41,4 +61,4 @@ chip "dx010_lm75b-i2c-*-48" chip "dx010_lm75b-i2c-*-4e" label temp1 "Rear-panel temp sensor 2" set temp1_max 43 - set temp1_max_hyst 28 \ No newline at end of file + set temp1_max_hyst 28 From 25d73ef1a1bdc33643137221a56b502e2986cc12 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 24 Mar 2018 02:04:25 -0700 Subject: [PATCH 072/274] [device]: fix led_control plugin on Arista 7050-QX32S (#1527) Signed-off-by: Guohan Lu --- .../x86_64-arista_7050_qx32s/plugins/led_control.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py b/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py index f2cb73194e14..8fa0c63a473a 100644 --- a/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py +++ b/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py @@ -81,13 +81,13 @@ def __init__(self): f.write("1") # Initialize all fan LEDs to green - with open("/sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060/hwmon/hwmon2/fan1_led", "w") as f: + with open("/sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060/hwmon/hwmon4/fan1_led", "w") as f: f.write("1") - with open("/sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060/hwmon/hwmon2/fan2_led", "w") as f: + with open("/sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060/hwmon/hwmon4/fan2_led", "w") as f: f.write("1") - with open("/sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060/hwmon/hwmon2/fan3_led", "w") as f: + with open("/sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060/hwmon/hwmon4/fan3_led", "w") as f: f.write("1") - with open("/sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060/hwmon/hwmon2/fan4_led", "w") as f: + with open("/sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060/hwmon/hwmon4/fan4_led", "w") as f: f.write("1") From 17b09ef06a7efe230daccc82bb38e51819bcfc5d Mon Sep 17 00:00:00 2001 From: "Wenda Ni, Ph.D" Date: Sat, 24 Mar 2018 02:36:48 -0700 Subject: [PATCH 073/274] [build]: Move the mounting point inside the docker to home directory (#1522) * Move the mounting point inside the docker to home directory Signed-off-by: Wenda * Change mount point to src under the home directory Signed-off-by: Wenda --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index da5f0a282b1b..ed0c853e22df 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ # * USERNAME: Desired username -- default at rules/config # * PASSWORD: Desired password -- default at rules/config # * KEEP_SLAVE_ON: Keeps slave container up after building-process concludes. -# * SOURCE_FOLDER: host path to be mount as /var/src, only effective when KEEP_SLAVE_ON=yes +# * SOURCE_FOLDER: host path to be mount as /var/$(USER)/src, only effective when KEEP_SLAVE_ON=yes # * SONIC_BUILD_JOB: Specifying number of concurrent build job(s) to run # ############################################################################### @@ -85,7 +85,7 @@ SONIC_BUILD_INSTRUCTION := make \ $(DOCKER_BUILD) ; } ifeq "$(KEEP_SLAVE_ON)" "yes" ifdef SOURCE_FOLDER - @$(DOCKER_RUN) -v $(SOURCE_FOLDER):/var/src $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash" + @$(DOCKER_RUN) -v $(SOURCE_FOLDER):/var/$(USER)/src $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash" else @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash" endif From c6a9201b74e0a712e814b4ca30e4a2d9fa4ce100 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Mon, 26 Mar 2018 20:15:13 +0300 Subject: [PATCH 074/274] [mellanox]: Update MLNX SAI and SDK pointers (#1531) Signed-off-by: Volodymyr Samotiy --- platform/mellanox/fw.mk | 2 +- platform/mellanox/mlnx-sai.mk | 4 ++-- platform/mellanox/sdk.mk | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index ce3c55c59c09..0ac9dd9b7aa6 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,6 +1,6 @@ # mellanox firmware -MLNX_FW_VERSION = 13.1620.0192 +MLNX_FW_VERSION = 13.1620.0208 MLNX_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_FW_VERSION))-EVB.mfa $(MLNX_FW_FILE)_URL = $(MLNX_SDK_BASE_URL)/$(MLNX_FW_FILE) SONIC_ONLINE_FILES += $(MLNX_FW_FILE) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 666e90e2b20f..afb080413f64 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.11.2-master -MLNX_SAI_REVISION = f0651fc85d88d03001b72a03a4d15e269e198b38 +MLNX_SAI_VERSION = SAIRel1.11.4-master +MLNX_SAI_REVISION = 6367854b48b73470a6e093f6fbbd45b3341edaba export MLNX_SAI_VERSION MLNX_SAI_REVISION diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 9c440c0a2fb8..2ebb7d23f9c6 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,5 +1,5 @@ -MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/fb4cd4cec4b8718c54d5bf5c64df9b474738f404/sdk -MLNX_SDK_VERSION = 4.2.7101 +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/6367854b48b73470a6e093f6fbbd45b3341edaba/sdk +MLNX_SDK_VERSION = 4.2.7201 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ $(SXD_LIBS) $(TESTX) From 9b14addbf1c32561620de41c544a98e9314ff296 Mon Sep 17 00:00:00 2001 From: simonJi2018 <37395146+simonJi2018@users.noreply.github.com> Date: Mon, 26 Mar 2018 13:32:54 -0700 Subject: [PATCH 075/274] [platform]: Upgrade Nephos SAI to v1.2.4 (#1530) --- platform/nephos/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/nephos/sai.mk b/platform/nephos/sai.mk index ca756f392351..7c898bbada6b 100644 --- a/platform/nephos/sai.mk +++ b/platform/nephos/sai.mk @@ -1,9 +1,9 @@ -NEPHOS_SAI = libsainps_2.0.3_amd64.deb -$(NEPHOS_SAI)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps_2.0.3_amd64.deb" +NEPHOS_SAI = libsainps_2.0.4_amd64.deb +$(NEPHOS_SAI)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps_2.0.4_amd64.deb" -NEPHOS_SAI_DEV = libsainps-dev_2.0.3_sai_1.2.3_amd64.deb +NEPHOS_SAI_DEV = libsainps-dev_2.0.4_sai_1.2.4_amd64.deb $(eval $(call add_derived_package,$(NEPHOS_SAI),$(NEPHOS_SAI_DEV))) -$(NEPHOS_SAI_DEV)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps-dev_2.0.3_sai_1.2.3_amd64.deb" +$(NEPHOS_SAI_DEV)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps-dev_2.0.4_sai_1.2.4_amd64.deb" SONIC_ONLINE_DEBS += $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) $(NEPHOS_SAI_DEV)_DEPENDS += $(NEPHOS_SAI) From 9f3d3f158312bb1c84142db6f6035c8f22c87f49 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Tue, 27 Mar 2018 02:14:16 -0700 Subject: [PATCH 076/274] [device] Update Arista drivers submodule (#1533) Enforce SMBus retry for all kinds of IO error as they are generally one off errors. --- platform/broadcom/sonic-platform-modules-arista | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 3e8345b5d2ec..6fe9de4dd52b 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 3e8345b5d2ec2a2127c201c7749b9283b8daa618 +Subproject commit 6fe9de4dd52bba4c5856567a8f5624e75e9af66d From da42bd75a823b057fb607effa3be4f7661dc529b Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Tue, 27 Mar 2018 23:37:02 +0300 Subject: [PATCH 077/274] [config]: Apply CRM default config to DB on start (#1534) Signed-off-by: Volodymyr Samotiy --- files/build_templates/sonic_debian_extension.j2 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 91ee8519e83e..0849118b83a4 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -165,7 +165,11 @@ sudo bash -c "echo dhcp_as_static=true >> $FILESYSTEM_ROOT/etc/sonic/updategraph {% else %} sudo bash -c "echo enabled=false > $FILESYSTEM_ROOT/etc/sonic/updategraph.conf" {% endif %} -sudo bash -c "echo '{ \"DEVICE_METADATA\": { \"localhost\": { \"default_bgp_status\": {% if shutdown_bgp_on_start == "y" %}\"down\"{% else %}\"up\"{% endif %}, \"default_pfcwd_status\": {% if enable_pfcwd_on_start == "y" %}\"enable\"{% else %}\"disable\"{% endif %} } } }' >> $FILESYSTEM_ROOT/etc/sonic/init_cfg.json" +sudo bash -c "echo '{ \"DEVICE_METADATA\": { \"localhost\": { \"default_bgp_status\": {% if shutdown_bgp_on_start == "y" %}\"down\"{% else %}\"up\"{% endif %}, \"default_pfcwd_status\": {% if enable_pfcwd_on_start == "y" %}\"enable\"{% else %}\"disable\"{% endif %} } }, +{%- print ' \\"CRM\\": { \\"Config\\": { \\"polling_interval\\": \\"300\\", ' %} +{%- for crm_res in ["ipv4_route", "ipv6_route", "ipv4_nexthop", "ipv6_nexthop", "ipv4_neighbor", "ipv6_neighbor", "nexthop_group_member", "nexthop_group", "acl_table", "acl_group", "acl_entry", "acl_counter", "fdb_entry"] -%} +\"{{crm_res}}_threshold_type\": \"percentage\", \"{{crm_res}}_low_threshold\": \"70\", \"{{crm_res}}_high_threshold\": \"85\"{% if not loop.last %}, {% endif %} +{%- endfor %} } } }' >> $FILESYSTEM_ROOT/etc/sonic/init_cfg.json" # Copy SNMP configuration files sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/ From f74de8914b3d065fc69f49f4c45ac51835b59699 Mon Sep 17 00:00:00 2001 From: Jipan Yang Date: Tue, 27 Mar 2018 13:39:04 -0700 Subject: [PATCH 078/274] [telemetry]: SONiC system telemetry Support (#1526) * SONiC system telemetry Support Signed-off-by: Jipan Yang * Update package name from telemetry to sonic-telemetry Signed-off-by: Jipan Yang --- .gitignore | 1 + Makefile | 3 +- dockers/docker-sonic-telemetry/Dockerfile.j2 | 31 +++++++++++ dockers/docker-sonic-telemetry/dialout.sh | 6 +++ dockers/docker-sonic-telemetry/start.sh | 11 ++++ .../docker-sonic-telemetry/supervisord.conf | 36 +++++++++++++ dockers/docker-sonic-telemetry/telemetry.sh | 51 +++++++++++++++++++ files/build_templates/telemetry.service.j2 | 13 +++++ .../logrotate/logrotate.d/rsyslog | 1 + .../rsyslog/rsyslog.d/00-sonic.conf | 6 +++ rules/config | 9 ++-- rules/docker-telemetry.mk | 15 ++++++ rules/telemetry.mk | 5 ++ slave.mk | 11 ++-- src/telemetry/Makefile | 20 ++++++++ src/telemetry/debian/changelog | 5 ++ src/telemetry/debian/compat | 1 + src/telemetry/debian/control | 17 +++++++ src/telemetry/debian/rules | 3 ++ src/telemetry/debian/telemetry.init.d | 14 +++++ 20 files changed, 250 insertions(+), 9 deletions(-) create mode 100644 dockers/docker-sonic-telemetry/Dockerfile.j2 create mode 100755 dockers/docker-sonic-telemetry/dialout.sh create mode 100755 dockers/docker-sonic-telemetry/start.sh create mode 100644 dockers/docker-sonic-telemetry/supervisord.conf create mode 100755 dockers/docker-sonic-telemetry/telemetry.sh create mode 100644 files/build_templates/telemetry.service.j2 create mode 100644 rules/docker-telemetry.mk create mode 100644 rules/telemetry.mk create mode 100644 src/telemetry/Makefile create mode 100644 src/telemetry/debian/changelog create mode 100644 src/telemetry/debian/compat create mode 100644 src/telemetry/debian/control create mode 100644 src/telemetry/debian/rules create mode 100644 src/telemetry/debian/telemetry.init.d diff --git a/.gitignore b/.gitignore index b75083ce4d57..74998573e491 100644 --- a/.gitignore +++ b/.gitignore @@ -57,6 +57,7 @@ dockers/docker-router-advertiser/Dockerfile dockers/docker-snmp-sv2/Dockerfile dockers/docker-teamd/Dockerfile dockers/docker-sonic-mgmt/Dockerfile +dockers/docker-sonic-telemetry/Dockerfile platform/*/docker-syncd-*/Dockerfile platform/*/docker-syncd-*-rpc/Dockerfile platform/vs/docker-sonic-vs/Dockerfile diff --git a/Makefile b/Makefile index ed0c853e22df..6471f7f757b9 100644 --- a/Makefile +++ b/Makefile @@ -70,7 +70,8 @@ SONIC_BUILD_INSTRUCTION := make \ USERNAME=$(USERNAME) \ SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \ HTTP_PROXY=$(http_proxy) \ - HTTPS_PROXY=$(https_proxy) + HTTPS_PROXY=$(https_proxy) \ + ENABLE_SYSTEM_TELEMETRY=$(ENABLE_SYSTEM_TELEMETRY) .PHONY: sonic-slave-build sonic-slave-bash init reset diff --git a/dockers/docker-sonic-telemetry/Dockerfile.j2 b/dockers/docker-sonic-telemetry/Dockerfile.j2 new file mode 100644 index 000000000000..bbb15db69aaa --- /dev/null +++ b/dockers/docker-sonic-telemetry/Dockerfile.j2 @@ -0,0 +1,31 @@ +FROM docker-config-engine + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +RUN apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4 + +## Install redis-tools dependencies +## TODO: implicitly install dependencies +RUN apt-get -y install libjemalloc1 + +COPY \ +{% for deb in docker_sonic_telemetry_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in docker_sonic_telemetry_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + +COPY ["start.sh", "telemetry.sh", "dialout.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-sonic-telemetry/dialout.sh b/dockers/docker-sonic-telemetry/dialout.sh new file mode 100755 index 000000000000..8683e8edae8e --- /dev/null +++ b/dockers/docker-sonic-telemetry/dialout.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Start with default config + +exec /usr/sbin/dialout_client_cli -insecure -logtostderr -v 2 + diff --git a/dockers/docker-sonic-telemetry/start.sh b/dockers/docker-sonic-telemetry/start.sh new file mode 100755 index 000000000000..b307e387d557 --- /dev/null +++ b/dockers/docker-sonic-telemetry/start.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +mkdir -p /var/sonic +echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status + +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd + +supervisorctl start telemetry +supervisorctl start dialout diff --git a/dockers/docker-sonic-telemetry/supervisord.conf b/dockers/docker-sonic-telemetry/supervisord.conf new file mode 100644 index 000000000000..dcd8a9eb1e80 --- /dev/null +++ b/dockers/docker-sonic-telemetry/supervisord.conf @@ -0,0 +1,36 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:telemetry] +command=/usr/bin/telemetry.sh +priority=3 +autostart=false +autorestart=true +stdout_logfile=syslog +stderr_logfile=syslog + +[program:dialout] +command=/usr/bin/dialout.sh +priority=4 +autostart=false +autorestart=true +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/dockers/docker-sonic-telemetry/telemetry.sh b/dockers/docker-sonic-telemetry/telemetry.sh new file mode 100755 index 000000000000..053b1dae6ead --- /dev/null +++ b/dockers/docker-sonic-telemetry/telemetry.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +# Try to read telemetry and x509 config from ConfigDB. +# Use default value if no valid config exists +X509=`sonic-cfggen -d -v "DEVICE_METADATA['x509']"` +TELEMETRY=`sonic-cfggen -d -v 'TELEMETRY.keys() | join(" ") if TELEMETRY'` + +TELEMETRY_ARGS=" -logtostderr" + +if [ ! -z $X509 ]; then + SERVER_CRT=`sonic-cfggen -d -v "DEVICE_METADATA['x509']['server_crt']"` + SERVER_KEY=`sonic-cfggen -d -v "DEVICE_METADATA['x509']['server_key']"` + if [ -z $SERVER_CRT ] || [ -z $SERVER_KEY ]; then + TELEMETRY_ARGS+=" --insecure" + else + TELEMETRY_ARGS+=" --server_crt $SERVER_CRT --server_key $SERVER_KEY " + fi +else + TELEMETRY_ARGS+=" --insecure" +fi + +if [ ! -z $X509 ]; then + CA_CRT=`sonic-cfggen -d -v "DEVICE_METADATA['x509']['ca_crt']"` + if [ ! -z $CA_CRT ]; then + TELEMETRY_ARGS+=" --ca_crt $CA_CRT" + fi +fi + +# If no configuration entry exists for TELEMETRY, create one default port +if [ -z $TELEMETRY ]; then + redis-cli -n 4 hset "TELEMETRY|gnmi" port 8080 +fi + +PORT=`sonic-cfggen -d -v "TELEMETRY['gnmi']['port']"` +TELEMETRY_ARGS+=" --port $PORT" + +CLIENT_AUTH=`sonic-cfggen -d -v "TELEMETRY['gnmi']['client_auth']"` +if [ -z $CLIENT_AUTH ] || [ $CLIENT_AUTH == "false" ]; then + TELEMETRY_ARGS+=" --allow_no_client_auth" +fi + +LOG_LEVEL=`sonic-cfggen -d -v "TELEMETRY['gnmi']['log_level']"` +if [ ! -z $LOG_LEVEL ]; then + TELEMETRY_ARGS+=" -v=$LOG_LEVEL" +else + TELEMETRY_ARGS+=" -v=2" +fi + +exec /usr/sbin/telemetry ${TELEMETRY_ARGS} + + diff --git a/files/build_templates/telemetry.service.j2 b/files/build_templates/telemetry.service.j2 new file mode 100644 index 000000000000..5f2e81ed95ea --- /dev/null +++ b/files/build_templates/telemetry.service.j2 @@ -0,0 +1,13 @@ +[Unit] +Description=Telemetry container +Requires=swss.service +After=swss.service + +[Service] +User={{ sonicadmin_user }} +ExecStartPre=/usr/bin/{{docker_container_name}}.sh start +ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStop=/usr/bin/{{docker_container_name}}.sh stop + +[Install] +WantedBy=multi-user.target diff --git a/files/image_config/logrotate/logrotate.d/rsyslog b/files/image_config/logrotate/logrotate.d/rsyslog index ba550dcd242b..ed54c62082f9 100644 --- a/files/image_config/logrotate/logrotate.d/rsyslog +++ b/files/image_config/logrotate/logrotate.d/rsyslog @@ -31,6 +31,7 @@ /var/log/cron.log /var/log/syslog /var/log/teamd.log +/var/log/telemetry.log /var/log/quagga/bgpd.log /var/log/quagga/zebra.log /var/log/swss/sairedis.rec diff --git a/files/image_config/rsyslog/rsyslog.d/00-sonic.conf b/files/image_config/rsyslog/rsyslog.d/00-sonic.conf index bc0bbbaf1e61..6e4be4bb6022 100644 --- a/files/image_config/rsyslog/rsyslog.d/00-sonic.conf +++ b/files/image_config/rsyslog/rsyslog.d/00-sonic.conf @@ -19,3 +19,9 @@ if $programname contains "teamd_" then { /var/log/teamd.log stop } + +## telemetry rules +if $msg startswith " telemetry" or ($msg startswith " dialout" )then { + /var/log/telemetry.log + stop +} \ No newline at end of file diff --git a/rules/config b/rules/config index 49eb8d57e984..86d106637de2 100644 --- a/rules/config +++ b/rules/config @@ -27,12 +27,12 @@ DEFAULT_USERNAME = admin DEFAULT_PASSWORD = YourPaSsWoRd # ENABLE_DHCP_GRAPH_SERVICE - specify the source of minigraph to generate configuration file. -# If set to y SONiC will get the minigraph from graph service. Graph service URL need to be +# If set to y SONiC will get the minigraph from graph service. Graph service URL need to be # passed through DHCP option 225. # If not set (default behavior) the default minigraph built into the image will be used. # ENABLE_DHCP_GRAPH_SERVICE = y -# SHUTDOWN_BGP_ON_START - if set to y all bgp sessions will be in admin down state when +# SHUTDOWN_BGP_ON_START - if set to y all bgp sessions will be in admin down state when # bgp service starts. # SHUTDOWN_BGP_ON_START = y @@ -52,6 +52,9 @@ SONIC_ROUTING_STACK = quagga # ENABLE_SYNCD_RPC - build docker-syncd with rpc packages for testing purposes. # Uncomment to enable: # ENABLE_SYNCD_RPC = y - + # Enable Origanization Extensions - Specific to the deployment scenarios of the Organization ENABLE_ORGANIZATION_EXTENSIONS = y + +# ENABLE_SYSTEM_TELEMETRY - build docker-sonic-telemetry for system telemetry support +# ENABLE_SYSTEM_TELEMETRY = y diff --git a/rules/docker-telemetry.mk b/rules/docker-telemetry.mk new file mode 100644 index 000000000000..fca3b8a39a70 --- /dev/null +++ b/rules/docker-telemetry.mk @@ -0,0 +1,15 @@ +# docker image for telemetry agent + +DOCKER_TELEMETRY = docker-sonic-telemetry.gz +$(DOCKER_TELEMETRY)_PATH = $(DOCKERS_PATH)/docker-sonic-telemetry +$(DOCKER_TELEMETRY)_DEPENDS += $(REDIS_TOOLS) $(SONIC_TELEMETRY) +$(DOCKER_TELEMETRY)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) +SONIC_DOCKER_IMAGES += $(DOCKER_TELEMETRY) +ifeq ($(ENABLE_SYSTEM_TELEMETRY), y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_TELEMETRY) +endif + +$(DOCKER_TELEMETRY)_CONTAINER_NAME = telemetry +$(DOCKER_TELEMETRY)_RUN_OPT += --net=host --privileged -t +$(DOCKER_TELEMETRY)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + diff --git a/rules/telemetry.mk b/rules/telemetry.mk new file mode 100644 index 000000000000..a160bf50899c --- /dev/null +++ b/rules/telemetry.mk @@ -0,0 +1,5 @@ +# SONiC telemetry package + +SONIC_TELEMETRY = sonic-telemetry_0.1_amd64.deb +$(SONIC_TELEMETRY)_SRC_PATH = $(SRC_PATH)/telemetry +SONIC_DPKG_DEBS += $(SONIC_TELEMETRY) diff --git a/slave.mk b/slave.mk index 7e842a7a608e..7430f3a80d10 100644 --- a/slave.mk +++ b/slave.mk @@ -12,8 +12,8 @@ GUID = $(shell id -g) .SECONDEXPANSION: -SPACE := -SPACE += +SPACE := +SPACE += ############################################################################### ## General definitions @@ -107,6 +107,7 @@ $(info "ENABLE_SYNCD_RPC" : "$(ENABLE_SYNCD_RPC)") $(info "ENABLE_ORGANIZATION_EXTENSIONS" : "$(ENABLE_ORGANIZATION_EXTENSIONS)") $(info "HTTP_PROXY" : "$(HTTP_PROXY)") $(info "HTTPS_PROXY" : "$(HTTPS_PROXY)") +$(info "ENABLE_SYSTEM_TELEMETRY" : "$(ENABLE_SYSTEM_TELEMETRY)") $(info ) ############################################################################### @@ -441,7 +442,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export image_type="$($*_IMAGE_TYPE)" export sonicadmin_user="$(USERNAME)" export sonic_asic_platform="$(CONFIGURED_PLATFORM)" - export enable_organization_extensions="$(ENABLE_ORGANIZATION_EXTENSIONS)" + export enable_organization_extensions="$(ENABLE_ORGANIZATION_EXTENSIONS)" export enable_dhcp_graph_service="$(ENABLE_DHCP_GRAPH_SERVICE)" export shutdown_bgp_on_start="$(SHUTDOWN_BGP_ON_START)" export enable_pfcwd_on_start="$(ENABLE_PFCWD_ON_START)" @@ -451,7 +452,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export config_engine_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE))" export swsssdk_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SWSSSDK_PY2))" export platform_common_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_COMMON_PY2))" - + $(foreach docker, $($*_DOCKERS),\ export docker_image="$(docker)" export docker_image_name="$(basename $(docker))" @@ -472,7 +473,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ j2 -f env files/initramfs-tools/union-mount.j2 onie-image.conf > files/initramfs-tools/union-mount j2 -f env files/initramfs-tools/arista-convertfs.j2 onie-image.conf > files/initramfs-tools/arista-convertfs - $(if $($*_DOCKERS), + $(if $($*_DOCKERS), j2 files/build_templates/sonic_debian_extension.j2 > sonic_debian_extension.sh chmod +x sonic_debian_extension.sh, ) diff --git a/src/telemetry/Makefile b/src/telemetry/Makefile new file mode 100644 index 000000000000..91a822d4f93c --- /dev/null +++ b/src/telemetry/Makefile @@ -0,0 +1,20 @@ +export GOPATH=/tmp/go + +INSTALL := /usr/bin/install + +all: sonic-telemetry + +sonic-telemetry: + /usr/local/go/bin/go get -v github.com/Azure/sonic-telemetry/telemetry + /usr/local/go/bin/go get -v github.com/Azure/sonic-telemetry/dialout/dialout_client_cli + +install: + $(INSTALL) -D ${GOPATH}/bin/telemetry $(DESTDIR)/usr/sbin/telemetry + $(INSTALL) -D ${GOPATH}/bin/dialout_client_cli $(DESTDIR)/usr/sbin/dialout_client_cli + +deinstall: + rm $(DESTDIR)/usr/sbin/telemetry + rm $(DESTDIR)/usr/sbin/dialout_client_cli + +clean: + rm -fr ${GOPATH} diff --git a/src/telemetry/debian/changelog b/src/telemetry/debian/changelog new file mode 100644 index 000000000000..77dab629040e --- /dev/null +++ b/src/telemetry/debian/changelog @@ -0,0 +1,5 @@ +sonic-telemetry (0.1) UNRELEASED; urgency=medium + + * Initial release. + + -- Jipan Yang Sat, 24 Mar 2018 12:48:22 -0700 diff --git a/src/telemetry/debian/compat b/src/telemetry/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/src/telemetry/debian/compat @@ -0,0 +1 @@ +9 diff --git a/src/telemetry/debian/control b/src/telemetry/debian/control new file mode 100644 index 000000000000..f1b6a7c07282 --- /dev/null +++ b/src/telemetry/debian/control @@ -0,0 +1,17 @@ +Source: sonic-telemetry +Section: devel +Priority: optional +Maintainer: Jipan Yang +Build-Depends: debhelper (>= 8.0.0), + dh-systemd +Standards-Version: 3.9.3 +Homepage: https://github.com/Azure/sonic-telemetry +XS-Go-Import-Path: github.com/Azure/sonic-telemetry + +Package: sonic-telemetry +Architecture: any +Built-Using: ${misc:Built-Using} +Depends: ${misc:Depends}, + ${shlibs:Depends} +Description: SONiC telemetry + sonic-telemetry \ No newline at end of file diff --git a/src/telemetry/debian/rules b/src/telemetry/debian/rules new file mode 100644 index 000000000000..3995a26d7fcd --- /dev/null +++ b/src/telemetry/debian/rules @@ -0,0 +1,3 @@ +#!/usr/bin/make -f +%: + dh $@ --with systemd diff --git a/src/telemetry/debian/telemetry.init.d b/src/telemetry/debian/telemetry.init.d new file mode 100644 index 000000000000..2fea32e17c49 --- /dev/null +++ b/src/telemetry/debian/telemetry.init.d @@ -0,0 +1,14 @@ +#!/bin/bash +# +### BEGIN INIT INFO +# Provides: sonic-telemetry +# Required-Start: $local_fs $network $remote_fs $syslog +# Required-Stop: $local_fs $network $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: start and stop the telemetry +# Description: sonic-telemetry is an implementation of sonic telemetry daemon in Go +### END INIT INFO +# + +exit 0 From 2a1ae65a8549748f66eb4efc9c69c166508d941c Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 27 Mar 2018 17:26:24 -0700 Subject: [PATCH 079/274] Update sonic-utilities to the latest master (#1537) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index bf8d2b430e9d..c1d0b969f895 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit bf8d2b430e9dfea4fc9f9626acb2663aa527da91 +Subproject commit c1d0b969f89576731dc5b509ff649a8a1cbf0abb From 4daf002859a2f4b336a3fcd24109c5cb6aed81dc Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 28 Mar 2018 09:06:48 -0700 Subject: [PATCH 080/274] [updategraph] Remove pending_initialization flag after first boot (#1538) --- files/image_config/updategraph/updategraph | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/files/image_config/updategraph/updategraph b/files/image_config/updategraph/updategraph index 2ce251dfb36e..f0cea0894a9c 100755 --- a/files/image_config/updategraph/updategraph +++ b/files/image_config/updategraph/updategraph @@ -66,12 +66,14 @@ if [ -f /tmp/pending_config_migration ]; then exit 0 fi -if [ -f /tmp/pending_config_initialization ] && [ "$enabled" != "true" ]; then - copy_default_minigraph - reload_minigraph - sonic-cfggen -d --print-data > /etc/sonic/config_db.json +if [ -f /tmp/pending_config_initialization ]; then rm -f /tmp/pending_config_initialization - exit 0 + if [ "$enabled" != "true" ]; then + copy_default_minigraph + reload_minigraph + sonic-cfggen -d --print-data > /etc/sonic/config_db.json + exit 0 + fi fi if [ "$enabled" = "reload_only" ]; then From 208ca4376095b9026ce66dc1b88ea2a7683a9392 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 28 Mar 2018 10:55:59 -0700 Subject: [PATCH 081/274] [hostcfgd] Fix a bug that tacacs key is wrongly modified (#1536) --- files/image_config/hostcfgd/hostcfgd | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/files/image_config/hostcfgd/hostcfgd b/files/image_config/hostcfgd/hostcfgd index 25cfa7c714c4..8c03f2234a94 100755 --- a/files/image_config/hostcfgd/hostcfgd +++ b/files/image_config/hostcfgd/hostcfgd @@ -5,6 +5,7 @@ import os import sys import subprocess import syslog +import copy import jinja2 from swsssdk import ConfigDBConnector @@ -155,15 +156,17 @@ class HostConfigDaemon: def tacacs_server_handler(self, key, data): self.aaacfg.tacacs_server_update(key, data) - if data.has_key('passkey'): - data['passkey'] = obfuscate(data['passkey']) - syslog.syslog(syslog.LOG_DEBUG, 'value for {} changed to {}'.format(key, data)) + log_data = copy.deepcopy(data) + if log_data.has_key('passkey'): + log_data['passkey'] = obfuscate(log_data['passkey']) + syslog.syslog(syslog.LOG_DEBUG, 'value of {} changed to {}'.format(key, log_data)) def tacacs_global_handler(self, key, data): self.aaacfg.tacacs_global_update(key, data) - if data.has_key('passkey'): - data['passkey'] = obfuscate(data['passkey']) - syslog.syslog(syslog.LOG_DEBUG, 'value for {} changed to {}'.format(key, data)) + log_data = copy.deepcopy(data) + if log_data.has_key('passkey'): + log_data['passkey'] = obfuscate(log_data['passkey']) + syslog.syslog(syslog.LOG_DEBUG, 'value of {} changed to {}'.format(key, log_data)) def start(self): self.config_db.subscribe('AAA', lambda table, key, data: self.aaa_handler(key, data)) From f43580492fcf58124aaecf9bf282f930ebdc0027 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 28 Mar 2018 12:34:46 -0700 Subject: [PATCH 082/274] quagga container processes could be restarted within a second (#1541) --- dockers/docker-fpm-quagga/supervisord.conf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dockers/docker-fpm-quagga/supervisord.conf b/dockers/docker-fpm-quagga/supervisord.conf index 92d806ff281c..3e05215babaa 100644 --- a/dockers/docker-fpm-quagga/supervisord.conf +++ b/dockers/docker-fpm-quagga/supervisord.conf @@ -8,6 +8,7 @@ command=/usr/bin/start.sh priority=1 autostart=true autorestart=false +startsecs=0 stdout_logfile=syslog stderr_logfile=syslog @@ -16,6 +17,7 @@ command=/usr/bin/bgpcfgd priority=2 autostart=false autorestart=false +startsecs=0 stdout_logfile=syslog stderr_logfile=syslog @@ -24,6 +26,7 @@ command=/usr/sbin/rsyslogd -n priority=3 autostart=false autorestart=false +startsecs=0 stdout_logfile=syslog stderr_logfile=syslog @@ -32,6 +35,7 @@ command=/usr/lib/quagga/zebra -A 127.0.0.1 priority=4 autostart=false autorestart=false +startsecs=0 stdout_logfile=syslog stderr_logfile=syslog @@ -40,6 +44,7 @@ command=/usr/lib/quagga/bgpd -A 127.0.0.1 -F priority=5 autostart=false autorestart=false +startsecs=0 stdout_logfile=syslog stderr_logfile=syslog @@ -48,5 +53,6 @@ command=fpmsyncd priority=6 autostart=false autorestart=false +startsecs=0 stdout_logfile=syslog stderr_logfile=syslog From 5e2773dcaaa718cd02573e633671d605663f61b4 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 28 Mar 2018 17:04:33 -0700 Subject: [PATCH 083/274] [submodules]: update swss and sairedis (#1535) * [submodules]: update swss and sairedis Signed-off-by: Guohan Lu --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index d35642238905..c860472a3d8c 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit d35642238905ae4e9a0d259797b578eddd5a7156 +Subproject commit c860472a3d8c16cad8a44fd7f76e848c39651f2e diff --git a/src/sonic-swss b/src/sonic-swss index ce78bf568500..e217519c20c6 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit ce78bf568500397dac5b2f2cd1a9779cfc50ff62 +Subproject commit e217519c20c60f7cf4e24688dd3eca6d380a1dd6 From ad0ad913319e940ec5aacad87635a4cc063d5bac Mon Sep 17 00:00:00 2001 From: jostar-yang Date: Thu, 29 Mar 2018 14:49:27 +0800 Subject: [PATCH 084/274] [device]: Accton 5712 Modify sfp to support oom and sfp access by cpld. Add psuutil (#1542) --- .../plugins/psuutil.py | 61 +++++++ .../plugins/sfputil.py | 170 +++++++++--------- 2 files changed, 149 insertions(+), 82 deletions(-) create mode 100755 device/accton/x86_64-accton_as5712_54x-r0/plugins/psuutil.py diff --git a/device/accton/x86_64-accton_as5712_54x-r0/plugins/psuutil.py b/device/accton/x86_64-accton_as5712_54x-r0/plugins/psuutil.py new file mode 100755 index 000000000000..841070637b3e --- /dev/null +++ b/device/accton/x86_64-accton_as5712_54x-r0/plugins/psuutil.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +############################################################################# +# Accton +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/" + self.psu_presence = "/psu_present" + self.psu_oper_status = "/psu_power_good" + self.psu_mapping = { + 1: "57-0038", + 2: "58-003b", + } + + def get_num_psus(self): + return len(self.psu_mapping) + + def get_psu_status(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index]+self.psu_oper_status + try: + with open(node, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index] + self.psu_presence + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py index d554910ac5cd..c30ba62c51bd 100755 --- a/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py @@ -20,84 +20,87 @@ class SfpUtil(SfpUtilBase): QSFP_PORT_END = 72 BASE_VAL_PATH = "/sys/class/i2c-adapter/i2c-{0}/{1}-0050/" + BASE_OOM_PATH = "/sys/bus/i2c/devices/{0}-0050/" + BASE_CPLD2_PATH = "/sys/bus/i2c/devices/0-0061/" + BASE_CPLD3_PATH = "/sys/bus/i2c/devices/0-0062/" _port_to_is_present = {} _port_to_lp_mode = {} _port_to_eeprom_mapping = {} _port_to_i2c_mapping = { - 0: [2, 2], - 1: [3, 3], - 2: [4, 4], - 3: [5, 5], - 4: [6, 6], - 5: [7, 7], - 6: [8, 8], - 7: [9, 9], - 8: [10, 10], - 9: [11, 11], - 10: [12, 12], - 11: [13, 13], - 12: [14, 14], - 13: [15, 15], - 14: [16, 16], - 15: [17, 17], - 16: [18, 18], - 17: [19, 19], - 18: [20, 20], - 19: [21, 21], - 20: [22, 22], - 21: [23, 23], - 22: [24, 24], - 23: [25, 25], - 24: [26, 26], - 25: [27, 27], - 26: [28, 28], - 27: [29, 29], - 28: [30, 30], - 29: [31, 31], - 30: [32, 32], - 31: [33, 33], - 32: [34, 34], - 33: [35, 35], - 34: [36, 36], - 35: [37, 37], - 36: [38, 38], - 37: [39, 39], - 38: [40, 40], - 39: [41, 41], - 40: [42, 42], - 41: [43, 43], - 42: [44, 44], - 43: [45, 45], - 44: [46, 46], - 45: [47, 47], - 46: [48, 48], - 47: [49, 49], - 48: [50, 50], #QSFP49 - 49: [50, 50], - 50: [50, 50], - 51: [50, 50], - 52: [52, 52], #QSFP50 - 53: [52, 52], - 54: [52, 52], - 55: [52, 52], - 56: [54, 54], #QSFP51 - 57: [54, 54], - 58: [54, 54], - 59: [54, 54], - 60: [51, 51], #QSFP52 - 61: [51, 51], - 62: [51, 51], - 63: [51, 51], + 0: [1, 2], + 1: [2, 3], + 2: [3, 4], + 3: [4, 5], + 4: [5, 6], + 5: [6, 7], + 6: [7, 8], + 7: [8, 9], + 8: [9, 10], + 9: [10, 11], + 10: [11, 12], + 11: [12, 13], + 12: [13, 14], + 13: [14, 15], + 14: [15, 16], + 15: [16, 17], + 16: [17, 18], + 17: [18, 19], + 18: [19, 20], + 19: [20, 21], + 20: [21, 22], + 21: [22, 23], + 22: [23, 24], + 23: [24, 25], + 24: [25, 26], + 25: [26, 27], + 26: [27, 28], + 27: [28, 29], + 28: [29, 30], + 29: [30, 31], + 30: [31, 32], + 31: [32, 33], + 32: [33, 34], + 33: [34, 35], + 34: [35, 36], + 35: [36, 37], + 36: [37, 38], + 37: [38, 39], + 38: [39, 40], + 39: [40, 41], + 40: [41, 42], + 41: [42, 43], + 42: [43, 44], + 43: [44, 45], + 44: [45, 46], + 45: [46, 47], + 46: [47, 48], + 47: [48, 49], + 48: [49, 50],#QSFP49 + 49: [49, 50], + 50: [49, 50], + 51: [49, 50], + 52: [50, 52],#QSFP50 + 53: [50, 52], + 54: [50, 52], + 55: [50, 52], + 56: [51, 54],#QSFP51 + 57: [51, 54], + 58: [51, 54], + 59: [51, 54], + 60: [52, 51],#QSFP52 + 61: [52, 51], + 62: [52, 51], + 63: [52, 51], 64: [53, 53], #QSFP53 65: [53, 53], 66: [53, 53], 67: [53, 53], - 68: [55, 55], #QSFP54 - 69: [55, 55], - 70: [55, 55], - 71: [55, 55], + 68: [54, 55],#QSFP54 + 69: [54, 55], + 70: [54, 55], + 71: [54, 55], } @property @@ -125,12 +128,12 @@ def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping def __init__(self): - eeprom_path = self.BASE_VAL_PATH + "sfp_eeprom" + eeprom_path = self.BASE_OOM_PATH + "eeprom" for x in range(0, self.port_end+1): self.port_to_eeprom_mapping[x] = eeprom_path.format( - self._port_to_i2c_mapping[x][0], - self._port_to_i2c_mapping[x][1]) + self._port_to_i2c_mapping[x][1] + ) SfpUtilBase.__init__(self) @@ -139,8 +142,13 @@ def get_presence(self, port_num): if port_num < self.port_start or port_num > self.port_end: return False - present_path = self.BASE_VAL_PATH + "sfp_is_present" - self.__port_to_is_present = present_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1]) + if port_num < 24: + present_path = self.BASE_CPLD2_PATH + "module_present_" + str(self._port_to_i2c_mapping[port_num][0]) + else: + present_path = self.BASE_CPLD3_PATH + "module_present_" + str(self._port_to_i2c_mapping[port_num][0]) + + self.__port_to_is_present = present_path + try: val_file = open(self.__port_to_is_present) @@ -161,11 +169,10 @@ def get_low_power_mode(self, port_num): if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: return False - lp_mode_path = self.BASE_VAL_PATH + "sfp_lp_mode" - self.__port_to_lp_mode = lp_mode_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1]) + lp_mode_path = self.BASE_CPLD3_PATH + "module_lp_mode_" + str(self._port_to_i2c_mapping[port_num][0]) try: - val_file = open(self.__port_to_lp_mode) + val_file = open(lp_mode_path) except IOError as e: print "Error: unable to open file: %s" % str(e) return False @@ -183,11 +190,10 @@ def set_low_power_mode(self, port_num, lpmode): if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: return False - lp_mode_path = self.BASE_VAL_PATH + "sfp_lp_mode" - self.__port_to_lp_mode = lp_mode_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1]) + lp_mode_path = self.BASE_CPLD3_PATH + "module_lp_mode_" + str(self._port_to_i2c_mapping[port_num][0]) try: - reg_file = open(self.__port_to_lp_mode, 'r+') + reg_file = open(lp_mode_path, 'r+') except IOError as e: print "Error: unable to open file: %s" % str(e) return False @@ -206,10 +212,10 @@ def reset(self, port_num): if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: return False - mod_rst_path = self.BASE_VAL_PATH + "sfp_mod_rst" - self.__port_to_mod_rst = mod_rst_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1]) + mod_rst_path = lp_mode_path = self.BASE_CPLD3_PATH + "module_reset_" + str(self._port_to_i2c_mapping[port_num][0]) + try: - reg_file = open(self.__port_to_mod_rst, 'r+') + reg_file = open(mod_rst_path, 'r+') except IOError as e: print "Error: unable to open file: %s" % str(e) return False From 37d0ff3ef7f1ef1dbe78fd76c3776ab7e59d787a Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 29 Mar 2018 11:16:45 -0700 Subject: [PATCH 085/274] [utililities] update sonic-utilities submodule (#1546) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index c1d0b969f895..ed432fc5454a 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit c1d0b969f89576731dc5b509ff649a8a1cbf0abb +Subproject commit ed432fc5454a97d2e3ab545147072fbe6eee2181 From a5bfa2c7abf0b9f8a64a4eeb7f43df4624f219f2 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 29 Mar 2018 23:39:49 -0700 Subject: [PATCH 086/274] [device]: do not export gpio{1,2} if already exist on S6000 (#1547) --- device/dell/x86_64-dell_s6000_s1220-r0/installer.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/installer.conf b/device/dell/x86_64-dell_s6000_s1220-r0/installer.conf index a8fef6185912..107095cdad7c 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/installer.conf +++ b/device/dell/x86_64-dell_s6000_s1220-r0/installer.conf @@ -5,8 +5,8 @@ if [ "$install_env" = "onie" ]; then echo "Replace ONIE reboot with Dell reset commands" # set I2C GPIO mux -echo 1 > /sys/class/gpio/export -echo 2 > /sys/class/gpio/export +[ -d /sys/class/gpio/gpio1 ] || echo 1 > /sys/class/gpio/export +[ -d /sys/class/gpio/gpio2 ] || echo 2 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio1/direction echo out > /sys/class/gpio/gpio2/direction echo 0 > /sys/class/gpio/gpio1/value From d66e79d702f9a462055af080493a3437577f485f Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 30 Mar 2018 11:37:59 -0700 Subject: [PATCH 087/274] [installer]: remove single quotes around the value when create machine.conf (#1552) Signed-off-by: Guohan Lu --- installer/x86_64/install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 0e4321345167..825e4636d0af 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -455,7 +455,8 @@ if [ "$install_env" = "onie" ]; then if [ -f /etc/machine-build.conf ]; then # onie_ variable are generate at runtime. # they are no longer hardcoded in /etc/machine.conf - set | grep ^onie_ > $demo_mnt/machine.conf + # also remove single quotes around the value + set | grep ^onie | sed -e "s/='/=/" -e "s/'$//" > $demo_mnt/machine.conf else cp /etc/machine.conf $demo_mnt fi From 8572f84ea0f6054f1c0440511db6501d6f465cfd Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 30 Mar 2018 19:23:46 -0700 Subject: [PATCH 088/274] [sonic-utilities] include reboot scripts improvements (#1554) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index ed432fc5454a..68c3fbf79738 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit ed432fc5454a97d2e3ab545147072fbe6eee2181 +Subproject commit 68c3fbf79738253ca5b1c8f225152a1cab55c5a1 From 11b0cd93e82bccebffc860b2d76f6f23ab4c654a Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 1 Apr 2018 21:36:43 -0700 Subject: [PATCH 089/274] [baseimage]: bring down eth0 before restart networking (#1555) cfggen generates new eth0 configuration. Need to first clean existing configuration on eth0 before bring up new configuration on eth0. Thus, we need to first bring down eth0 before putting new configuration into /etc/network/ interfaces Signed-off-by: Guohan Lu --- files/image_config/interfaces/interfaces-config.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index 06174790f04a..75660e713e7f 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -1,5 +1,7 @@ #!/bin/bash +ifdown eth0 + sonic-cfggen -d -t /usr/share/sonic/templates/interfaces.j2 > /etc/network/interfaces [ -f /var/run/dhclient.eth0.pid ] && kill `cat /var/run/dhclient.eth0.pid` && rm -f /var/run/dhclient.eth0.pid From a04401f68f29e88af314200b61d4d59f2e530a5d Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Mon, 2 Apr 2018 09:17:47 -0700 Subject: [PATCH 090/274] [minigraph.py] Add support to parse tacacs server information (#1549) * [minigraph.py] Add support to parse tacacs server information --- src/sonic-config-engine/minigraph.py | 11 +- .../tests/simple-sample-graph-metadata.xml | 317 ++++++++++++++++++ src/sonic-config-engine/tests/test_cfggen.py | 17 + 3 files changed, 342 insertions(+), 3 deletions(-) create mode 100644 src/sonic-config-engine/tests/simple-sample-graph-metadata.xml diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 34fcf1bcee25..f989129a439e 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -286,6 +286,7 @@ def parse_meta(meta, hname): syslog_servers = [] dhcp_servers = [] ntp_servers = [] + tacacs_servers = [] mgmt_routes = [] erspan_dst = [] deployment_id = None @@ -296,20 +297,22 @@ def parse_meta(meta, hname): for device_property in properties.findall(str(QName(ns1, "DeviceProperty"))): name = device_property.find(str(QName(ns1, "Name"))).text value = device_property.find(str(QName(ns1, "Value"))).text - value_group = value.split(';') if value and value != "" else [] + value_group = value.strip().split(';') if value and value != "" else [] if name == "DhcpResources": dhcp_servers = value_group elif name == "NtpResources": ntp_servers = value_group elif name == "SyslogResources": syslog_servers = value_group + elif name == "TacacsServer": + tacacs_servers = value_group elif name == "ForcedMgmtRoutes": mgmt_routes = value_group elif name == "ErspanDestinationIpv4": erspan_dst = value_group elif name == "DeploymentId": deployment_id = value - return syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst, deployment_id + return syslog_servers, dhcp_servers, ntp_servers, tacacs_servers, mgmt_routes, erspan_dst, deployment_id def parse_deviceinfo(meta, hwsku): port_speeds = {} @@ -352,6 +355,7 @@ def parse_xml(filename, platform=None, port_config_file=None): syslog_servers = [] dhcp_servers = [] ntp_servers = [] + tacacs_servers = [] mgmt_routes = [] erspan_dst = [] bgp_peers_with_range = None @@ -377,7 +381,7 @@ def parse_xml(filename, platform=None, port_config_file=None): elif child.tag == str(QName(ns, "UngDec")): (u_neighbors, u_devices, _, _, _, _) = parse_png(child, hostname) elif child.tag == str(QName(ns, "MetadataDeclaration")): - (syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst, deployment_id) = parse_meta(child, hostname) + (syslog_servers, dhcp_servers, ntp_servers, tacacs_servers, mgmt_routes, erspan_dst, deployment_id) = parse_meta(child, hostname) elif child.tag == str(QName(ns, "DeviceInfos")): (port_speeds, port_descriptions) = parse_deviceinfo(child, hwsku) @@ -433,6 +437,7 @@ def parse_xml(filename, platform=None, port_config_file=None): results['SYSLOG_SERVER'] = dict((item, {}) for item in syslog_servers) results['DHCP_SERVER'] = dict((item, {}) for item in dhcp_servers) results['NTP_SERVER'] = dict((item, {}) for item in ntp_servers) + results['TACPLUS_SERVER'] = dict((item, {'priority': '1', 'tcp_port': '49'}) for item in tacacs_servers) results['ACL_TABLE'] = acls mirror_sessions = {} diff --git a/src/sonic-config-engine/tests/simple-sample-graph-metadata.xml b/src/sonic-config-engine/tests/simple-sample-graph-metadata.xml new file mode 100644 index 000000000000..28044f1c8780 --- /dev/null +++ b/src/sonic-config-engine/tests/simple-sample-graph-metadata.xml @@ -0,0 +1,317 @@ + + + + + + false + switch-t0 + 10.0.0.56 + ARISTA01T1 + 10.0.0.57 + 1 + 180 + 60 + + + switch-t0 + FC00::71 + ARISTA01T1 + FC00::72 + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.58 + ARISTA02T1 + 10.0.0.59 + 1 + 180 + 60 + + + switch-t0 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 180 + 60 + + + + + 65100 + switch-t0 + + +
10.0.0.57
+ + + +
+ +
10.0.0.59
+ + + +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.0.0.100/24 + + 10.0.0.100/24 + + + + + + + switch-t0 + + + PortChannel01 + fortyGigE0/4 + + + + + + ab1 + fortyGigE0/8 + 192.0.0.1;192.0.0.2 + 1000 + 1000 + 192.168.0.0/27 + + + + + + PortChannel01 + 10.0.0.56/31 + + + + PortChannel01 + FC00::71/126 + + + + fortyGigE0/0 + 10.0.0.58/31 + + + + fortyGigE0/0 + FC00::75/126 + + + + ab1 + 192.168.0.1/27 + + + + + + PortChannel01 + DataAcl + DataPlane + + + SNMP + SNMP_ACL + SNMP + + + + + + + + + + + switch-t0 + Force10-S6000 + + + ARISTA01T1 + Arista + + + ARISTA02T1 + Arista + + + ARISTA03T1 + Arista + + + ARISTA04T1 + Arista + + + + + + + switch-t0 + + + DeploymentId + + 1 + + + ErspanDestinationIpv4 + + 10.0.100.1 + + + NtpResources + + 10.0.10.1;10.0.10.2 + + + + SnmpResources + + 10.0.10.3;10.0.10.4 + + + + SyslogResources + + 10.0.10.5;10.0.10.6; + + + + TacacsServer + + 10.0.10.7;10.0.10.8 + + + + + + + + + true + + + DeviceInterface + + true + true + 1 + fortyGigE0/0 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + true + 1 + fortyGigE0/4 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + fortyGigE0/8 + + false + 0 + 0 + 40000 + Interface description + + + DeviceInterface + + true + true + 1 + fortyGigE0/12 + + false + 0 + 0 + 100000 + Interface description + + + true + 0 + Force10-S6000 + + + switch-t0 + Force10-S6000 +
diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 3ee689622577..d187cfd26b8b 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -10,6 +10,7 @@ def setUp(self): self.sample_graph = os.path.join(self.test_dir, 'sample_graph.xml') self.sample_graph_t0 = os.path.join(self.test_dir, 't0-sample-graph.xml') self.sample_graph_simple = os.path.join(self.test_dir, 'simple-sample-graph.xml') + self.sample_graph_metadata = os.path.join(self.test_dir, 'simple-sample-graph-metadata.xml') self.sample_graph_pc_test = os.path.join(self.test_dir, 'pc-test-graph.xml') self.sample_graph_bgp_speaker = os.path.join(self.test_dir, 't0-sample-bgp-speaker.xml') self.sample_device_desc = os.path.join(self.test_dir, 'device.xml') @@ -143,3 +144,19 @@ def test_minigraph_ethernet_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet12\']"' output = self.run_script(argument) self.assertEqual(output.strip(), "{'alias': 'fortyGigE0/12', 'lanes': '33,34,35,36', 'fec': 'rs', 'speed': '100000', 'description': 'Interface description'}") + + def test_metadata_everflow(self): + argument = '-m "' + self.sample_graph_metadata + '" -p "' + self.port_config + '" -v "MIRROR_SESSION"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'everflow0': {'src_ip': '10.1.0.32', 'dst_ip': '10.0.100.1'}}") + + def test_metadata_tacacs(self): + argument = '-m "' + self.sample_graph_metadata + '" -p "' + self.port_config + '" -v "TACPLUS_SERVER"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'10.0.10.7': {'priority': '1', 'tcp_port': '49'}, '10.0.10.8': {'priority': '1', 'tcp_port': '49'}}") + + def test_metadata_ntp(self): + argument = '-m "' + self.sample_graph_metadata + '" -p "' + self.port_config + '" -v "NTP_SERVER"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'10.0.10.1': {}, '10.0.10.2': {}}") + From dc7c52442618208073e94e21290add5ff5553d98 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Tue, 3 Apr 2018 05:02:48 +0300 Subject: [PATCH 091/274] [mellanox]: Update MLNX SAI pointer (#1557) Signed-off-by: Volodymyr Samotiy --- platform/mellanox/mlnx-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index afb080413f64..23ef8c60458b 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = SAIRel1.11.4-master -MLNX_SAI_REVISION = 6367854b48b73470a6e093f6fbbd45b3341edaba +MLNX_SAI_REVISION = 1a44c29b22e1f36f4856f4aee92ad513c963c2b8 export MLNX_SAI_VERSION MLNX_SAI_REVISION From 1c32321805e4f8f0693a7a7d79da350a5002ae4a Mon Sep 17 00:00:00 2001 From: simonJi2018 <37395146+simonJi2018@users.noreply.github.com> Date: Mon, 2 Apr 2018 19:06:00 -0700 Subject: [PATCH 092/274] [device]: Add a new supported device accton-as7116 (#1539) * Upgrade SAI to v1.2.4 * Add a new supported device accton as7116 * Add maintainer info for deb --- .../Accton-AS7116-54X/port_config.ini | 58 + .../Accton-AS7116-54X/port_config_as7116.ini | 55 + .../Accton-AS7116-54X/sai.profile | 2 + .../installer.conf | 3 + .../led_proc_init.nps | 20 + .../x86_64-accton_as7116_54x-r0/minigraph.xml | 1074 +++++++++++++ .../plugins/eeprom.py | 21 + .../plugins/sfputil.py | 155 ++ platform/nephos/one-image.mk | 3 +- platform/nephos/rules.mk | 1 + .../sonic-platform-modules-accton/LICENSE | 16 + .../sonic-platform-modules-accton/README.md | 1 + .../as7116-54x/classes/__init__.py | 0 .../as7116-54x/classes/fanutil.py | 0 .../as7116-54x/classes/thermalutil.py | 0 .../as7116-54x/modules/Makefile | 2 + .../modules/x86-64-accton-as7116-54x-cpld.c | 242 +++ .../modules/x86-64-accton-as7116-54x-fan.c | 494 ++++++ .../modules/x86-64-accton-as7116-54x-led.c | 448 ++++++ .../modules/x86-64-accton-as7116-54x-psu.c | 349 +++++ .../modules/x86-64-accton-as7116-54x-sfp.c | 1384 +++++++++++++++++ .../service/as7116-platform-init.service | 13 + .../as7116-54x/setup.py | 15 + .../as7116-54x/utils/README | 60 + .../as7116-54x/utils/accton_as7116_util.py | 518 ++++++ .../debian/changelog | 6 + .../debian/compat | 1 + .../debian/control | 11 + .../debian/rules | 86 + 29 files changed, 5037 insertions(+), 1 deletion(-) create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.ini create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config_as7116.ini create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/sai.profile create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/installer.conf create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/led_proc_init.nps create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/minigraph.xml create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/plugins/eeprom.py create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/plugins/sfputil.py create mode 100644 platform/nephos/sonic-platform-modules-accton/LICENSE create mode 100644 platform/nephos/sonic-platform-modules-accton/README.md create mode 100644 platform/nephos/sonic-platform-modules-accton/as7116-54x/classes/__init__.py create mode 100644 platform/nephos/sonic-platform-modules-accton/as7116-54x/classes/fanutil.py create mode 100644 platform/nephos/sonic-platform-modules-accton/as7116-54x/classes/thermalutil.py create mode 100644 platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/Makefile create mode 100644 platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-cpld.c create mode 100644 platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-fan.c create mode 100644 platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-led.c create mode 100644 platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-psu.c create mode 100644 platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-sfp.c create mode 100755 platform/nephos/sonic-platform-modules-accton/as7116-54x/service/as7116-platform-init.service create mode 100644 platform/nephos/sonic-platform-modules-accton/as7116-54x/setup.py create mode 100755 platform/nephos/sonic-platform-modules-accton/as7116-54x/utils/README create mode 100755 platform/nephos/sonic-platform-modules-accton/as7116-54x/utils/accton_as7116_util.py create mode 100755 platform/nephos/sonic-platform-modules-accton/debian/changelog create mode 100644 platform/nephos/sonic-platform-modules-accton/debian/compat create mode 100755 platform/nephos/sonic-platform-modules-accton/debian/control create mode 100755 platform/nephos/sonic-platform-modules-accton/debian/rules diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.ini b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.ini new file mode 100644 index 000000000000..6e5276fc726b --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.ini @@ -0,0 +1,58 @@ +# name lanes alias index +Ethernet0 8 Ethernet1/1 0 +Ethernet1 9 Ethernet2/1 1 +Ethernet2 10 Ethernet3/1 2 +Ethernet3 11 Ethernet4/1 3 +Ethernet4 12 Ethernet5/1 4 +Ethernet5 13 Ethernet6/1 5 +Ethernet6 14 Ethernet7/1 6 +Ethernet7 15 Ethernet8/1 7 +Ethernet8 16 Ethernet9/1 8 +Ethernet9 17 Ethernet10/1 9 +Ethernet10 18 Ethernet11/1 10 +Ethernet11 19 Ethernet12/1 11 +Ethernet12 20 Ethernet13/1 12 +Ethernet13 21 Ethernet14/1 13 +Ethernet14 22 Ethernet15/1 14 +Ethernet15 23 Ethernet16/1 15 +Ethernet16 32 Ethernet17/1 16 +Ethernet17 33 Ethernet18/1 17 +Ethernet18 34 Ethernet19/1 18 +Ethernet19 35 Ethernet20/1 19 +Ethernet20 40 Ethernet21/1 20 +Ethernet21 41 Ethernet22/1 21 +Ethernet22 42 Ethernet23/1 22 +Ethernet23 43 Ethernet24/1 23 +Ethernet24 48 Ethernet25/1 24 +Ethernet25 49 Ethernet26/1 25 +Ethernet26 50 Ethernet27/1 26 +Ethernet27 51 Ethernet28/1 27 +Ethernet28 56 Ethernet29/1 28 +Ethernet29 57 Ethernet30/1 29 +Ethernet30 58 Ethernet31/1 30 +Ethernet31 59 Ethernet32/1 31 +Ethernet32 64 Ethernet33/1 32 +Ethernet33 65 Ethernet34/1 33 +Ethernet34 66 Ethernet35/1 34 +Ethernet35 67 Ethernet36/1 35 +Ethernet36 68 Ethernet37/1 36 +Ethernet37 69 Ethernet38/1 37 +Ethernet38 70 Ethernet39/1 38 +Ethernet39 71 Ethernet40/1 39 +Ethernet40 72 Ethernet41/1 40 +Ethernet41 73 Ethernet42/1 41 +Ethernet42 74 Ethernet43/1 42 +Ethernet43 75 Ethernet44/1 43 +Ethernet44 76 Ethernet45/1 44 +Ethernet45 77 Ethernet46/1 45 +Ethernet46 78 Ethernet47/1 46 +Ethernet47 79 Ethernet48/1 47 +Ethernet48 80 Ethernet49/1 48 +Ethernet49 81 Ethernet50/1 49 +Ethernet50 82 Ethernet51/1 50 +Ethernet51 83 Ethernet52/1 51 +Ethernet52 84,85,86,87 Ethernet53/1 52 +Ethernet53 104,105,106,107 Ethernet54/1 53 +Ethernet54 108,109,110,111 Ethernet55/1 54 +Ethernet55 112,113,114,115 Ethernet56/1 55 +Ethernet56 116,117,118,119 Ethernet57/1 56 diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config_as7116.ini b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config_as7116.ini new file mode 100644 index 000000000000..0c124743d9ec --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config_as7116.ini @@ -0,0 +1,55 @@ +# name lanes alias index +Ethernet0 8 Ethernet1/1 0 +Ethernet1 9 Ethernet2/1 1 +Ethernet2 10 Ethernet3/1 2 +Ethernet3 11 Ethernet4/1 3 +Ethernet4 12 Ethernet5/1 4 +Ethernet5 13 Ethernet6/1 5 +Ethernet6 14 Ethernet7/1 6 +Ethernet7 15 Ethernet8/1 7 +Ethernet8 16 Ethernet9/1 8 +Ethernet9 17 Ethernet10/1 9 +Ethernet10 18 Ethernet11/1 10 +Ethernet11 19 Ethernet12/1 11 +Ethernet12 20 Ethernet13/1 12 +Ethernet13 21 Ethernet14/1 13 +Ethernet14 22 Ethernet15/1 14 +Ethernet15 23 Ethernet16/1 15 +Ethernet16 32 Ethernet17/1 16 +Ethernet17 33 Ethernet18/1 17 +Ethernet18 34 Ethernet19/1 18 +Ethernet19 35 Ethernet20/1 19 +Ethernet20 40 Ethernet21/1 20 +Ethernet21 41 Ethernet22/1 21 +Ethernet22 42 Ethernet23/1 22 +Ethernet23 43 Ethernet24/1 23 +Ethernet24 48 Ethernet25/1 24 +Ethernet25 49 Ethernet26/1 25 +Ethernet26 50 Ethernet27/1 26 +Ethernet27 51 Ethernet28/1 27 +Ethernet28 56 Ethernet29/1 28 +Ethernet29 57 Ethernet30/1 29 +Ethernet30 58 Ethernet31/1 30 +Ethernet31 59 Ethernet32/1 31 +Ethernet32 64 Ethernet33/1 32 +Ethernet33 65 Ethernet34/1 33 +Ethernet34 66 Ethernet35/1 34 +Ethernet35 67 Ethernet36/1 35 +Ethernet36 68 Ethernet37/1 36 +Ethernet37 69 Ethernet38/1 37 +Ethernet38 70 Ethernet39/1 38 +Ethernet39 71 Ethernet40/1 39 +Ethernet40 72 Ethernet41/1 40 +Ethernet41 73 Ethernet42/1 41 +Ethernet42 74 Ethernet43/1 42 +Ethernet43 75 Ethernet44/1 43 +Ethernet44 76 Ethernet45/1 44 +Ethernet45 77 Ethernet46/1 45 +Ethernet46 78 Ethernet47/1 46 +Ethernet47 79 Ethernet48/1 47 +Ethernet48 80,81,82,83 Ethernet49/1 48 +Ethernet49 84,85,86,87 Ethernet50/1 49 +Ethernet50 104,105,106,107 Ethernet51/1 50 +Ethernet51 108,109,110,111 Ethernet52/1 51 +Ethernet52 112,113,114,115 Ethernet53/1 52 +Ethernet53 116,117,118,119 Ethernet54/1 56 \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/sai.profile b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/sai.profile new file mode 100644 index 000000000000..d43b2a33f42d --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/etc/nps/tau-as7116-4806.cfg +SAI_DSH_CONFIG_FILE=/etc/nps/tau-as7116-4806.dsh diff --git a/device/accton/x86_64-accton_as7116_54x-r0/installer.conf b/device/accton/x86_64-accton_as7116_54x-r0/installer.conf new file mode 100644 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/accton/x86_64-accton_as7116_54x-r0/led_proc_init.nps b/device/accton/x86_64-accton_as7116_54x-r0/led_proc_init.nps new file mode 100644 index 000000000000..9a97d94c0b0e --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/led_proc_init.nps @@ -0,0 +1,20 @@ +#This configuration file is for customer init value feature. Please refer to mtk_cfg.h/mtk_cfg.c for detail. +#1. The lines beginning with # are comment lines. The lines beginning with number are the setting lines. +#2. There are five parameters which can be set. +# 1) the first is unit. +# 2) the second is NPS_CFG_TYPE_XXX. Refer to NPS_CFG_TYPE_T. +# 3) the 3-5 are {param0, param1, value} pairs. Refer to NPS_CFG_VALUE_T. Support HEX format. +# 4) the (unit, NPS_CFG_TYPE_XXX, param0, param1) group is the key to get the correspingding value. +# There should be no same (unit, NPS_CFG_TYPE_XXX, param0, param1) group. +#3. User must follow correct format to apply the setting. Please refer to below commentted example(#0 NPS_CFG_TYPE_L2_ADDR_MODE 0 0 1); +#4. Usage under the linux shell: +# 1) ./image-path/image-name -c cfg-path/NPS_Ari_EVB_24.cfg : mamually specify directory path if they are not in current work dirctory. +# 2) ./image-name -c NPS_Ari_EVB_24.cfg : the image and the NPS_Ari_EVB_24.cfg are in the current work directory. + +#unit NPS_CFG_TYPE_XXX param0 param1 value +#---- ---------------- ------ ------ ----- +0 NPS_CFG_TYPE_USE_UNIT_PORT 0 0 1 +0 NPS_CFG_TYPE_LED_CFG 0 0 3 +0 NPS_CFG_TYPE_USER_BUF_CTRL 0 0 1 +0 NPS_CFG_TYPE_CPI_PORT_MODE 129 0 1 +0 NPS_CFG_TYPE_CPI_PORT_MODE 130 0 1 diff --git a/device/accton/x86_64-accton_as7116_54x-r0/minigraph.xml b/device/accton/x86_64-accton_as7116_54x-r0/minigraph.xml new file mode 100644 index 000000000000..d538a8cbd709 --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/minigraph.xml @@ -0,0 +1,1074 @@ + + + + + + ARISTA01T0 + 10.1.1.33 + switch1 + 10.0.0.32 + 1 + 180 + 60 + + + switch1 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch1 + 10.0.0.34 + 1 + 180 + 60 + + + switch1 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch1 + 10.0.0.36 + 1 + 180 + 60 + + + switch1 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch1 + 10.0.0.38 + 1 + 180 + 60 + + + switch1 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch1 + 10.0.0.40 + 1 + 180 + 60 + + + switch1 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch1 + 10.0.0.42 + 1 + 180 + 60 + + + switch1 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch1 + 10.0.0.44 + 1 + 180 + 60 + + + switch1 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch1 + 10.0.0.46 + 1 + 180 + 60 + + + switch1 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch1 + 10.0.0.48 + 1 + 180 + 60 + + + switch1 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch1 + 10.0.0.50 + 1 + 180 + 60 + + + switch1 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch1 + 10.0.0.52 + 1 + 180 + 60 + + + switch1 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch1 + 10.0.0.54 + 1 + 180 + 60 + + + switch1 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch1 + 10.0.0.56 + 1 + 180 + 60 + + + switch1 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch1 + 10.0.0.58 + 1 + 180 + 60 + + + switch1 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch1 + 10.0.0.60 + 1 + 180 + 60 + + + switch1 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch1 + 10.0.0.62 + 1 + 180 + 60 + + + switch1 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch1 + + +
10.0.0.33
+ + +
+ +
10.0.0.1
+ + +
+ +
10.0.0.35
+ + +
+ +
10.0.0.3
+ + +
+ +
10.0.0.37
+ + +
+ +
10.0.0.5
+ + +
+ +
10.0.0.39
+ + +
+ +
10.0.0.7
+ + +
+ +
10.0.0.41
+ + +
+ +
10.0.0.9
+ + +
+ +
10.0.0.43
+ + +
+ +
10.0.0.11
+ + +
+ +
10.0.0.45
+ + +
+ +
10.0.0.13
+ + +
+ +
10.0.0.47
+ + +
+ +
10.0.0.15
+ + +
+ +
10.0.0.49
+ + +
+ +
10.0.0.17
+ + +
+ +
10.0.0.51
+ + +
+ +
10.0.0.19
+ + +
+ +
10.0.0.53
+ + +
+ +
10.0.0.21
+ + +
+ +
10.0.0.55
+ + +
+ +
10.0.0.23
+ + +
+ +
10.0.0.57
+ + +
+ +
10.0.0.25
+ + +
+ +
10.0.0.59
+ + +
+ +
10.0.0.27
+ + +
+ +
10.0.0.61
+ + +
+ +
10.0.0.29
+ + +
+ +
10.0.0.63
+ + +
+ +
10.0.0.31
+ + +
+
+ +
+ + 64001 + ARISTA01T0 + + + + 65200 + ARISTA01T2 + + + + 64002 + ARISTA02T0 + + + + 65200 + ARISTA02T2 + + + + 64003 + ARISTA03T0 + + + + 65200 + ARISTA03T2 + + + + 64004 + ARISTA04T0 + + + + 65200 + ARISTA04T2 + + + + 64005 + ARISTA05T0 + + + + 65200 + ARISTA05T2 + + + + 64006 + ARISTA06T0 + + + + 65200 + ARISTA06T2 + + + + 64007 + ARISTA07T0 + + + + 65200 + ARISTA07T2 + + + + 64008 + ARISTA08T0 + + + + 65200 + ARISTA08T2 + + + + 64009 + ARISTA09T0 + + + + 65200 + ARISTA09T2 + + + + 64010 + ARISTA10T0 + + + + 65200 + ARISTA10T2 + + + + 64011 + ARISTA11T0 + + + + 65200 + ARISTA11T2 + + + + 64012 + ARISTA12T0 + + + + 65200 + ARISTA12T2 + + + + 64013 + ARISTA13T0 + + + + 65200 + ARISTA13T2 + + + + 64014 + ARISTA14T0 + + + + 65200 + ARISTA14T2 + + + + 64015 + ARISTA15T0 + + + + 65200 + ARISTA15T2 + + + + 64016 + ARISTA16T0 + + + + 65200 + ARISTA16T2 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + + + + + + switch1 + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet60 + 10.0.0.30/31 + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet84 + 10.0.0.42/31 + + + + Ethernet88 + 10.0.0.44/31 + + + + Ethernet92 + 10.0.0.46/31 + + + + Ethernet96 + 10.0.0.48/31 + + + + Ethernet100 + 10.0.0.50/31 + + + + Ethernet104 + 10.0.0.52/31 + + + + Ethernet108 + 10.0.0.54/31 + + + + Ethernet112 + 10.0.0.56/31 + + + + Ethernet116 + 10.0.0.58/31 + + + + Ethernet120 + 10.0.0.60/31 + + + + Ethernet124 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + switch1 + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet64 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet68 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet72 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet76 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet80 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet84 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet88 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet92 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet96 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet100 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet104 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet108 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet112 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet116 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet120 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet124 + ARISTA16T0 + Ethernet1 + + + + + switch1 + Accton-AS7116-54X + + + + + + + switch1 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + switch1 + Accton-AS7116-54X +
diff --git a/device/accton/x86_64-accton_as7116_54x-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as7116_54x-r0/plugins/eeprom.py new file mode 100644 index 000000000000..1e7d1046d93d --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/plugins/eeprom.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/accton/x86_64-accton_as7116_54x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7116_54x-r0/plugins/sfputil.py new file mode 100644 index 000000000000..974bedc4db19 --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/plugins/sfputil.py @@ -0,0 +1,155 @@ +#!/usr/bin/env python + +try: + import time + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class SfpUtil(SfpUtilBase): + """Platform specific SfpUtill class""" + + _port_start = 0 + _port_end = 53 + _qsfp_port_start = 48 + _ports_in_block = 54 + + _port_to_eeprom_mapping = {} + _port_to_i2c_mapping = { + 0 : 37, + 1 : 38, + 2 : 39, + 3 : 40, + 4 : 41, + 5 : 42, + 6 : 43, + 7 : 44, + 8 : 45, + 9 : 46, + 10 : 47, + 11 : 48, + 12 : 49, + 13 : 50, + 14 : 51, + 15 : 52, + 16 : 53, + 17 : 54, + 18 : 55, + 19 : 56, + 20 : 57, + 21 : 58, + 22 : 59, + 23 : 60, + 24 : 61, + 25 : 62, + 26 : 63, + 27 : 64, + 28 : 65, + 29 : 66, + 30 : 67, + 31 : 68, + 32 : 69, + 33 : 70, + 34 : 71, + 35 : 72, + 36 : 73, + 37 : 74, + 38 : 75, + 39 : 76, + 40 : 77, + 41 : 78, + 42 : 79, + 43 : 80, + 44 : 81, + 45 : 82, + 46 : 83, + 47 : 84, + 48 : 21, + 49 : 22, + 50 : 23, + 51 : 24, + 52 : 25, + 53 : 26, + } + + _qsfp_ports = range(_qsfp_port_start, _ports_in_block + 1) + + def __init__(self): + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom' + for x in range(self._port_start, self._port_end + 1): + port_eeprom_path = eeprom_path.format(self._port_to_i2c_mapping[x]) + if x == 53: + self._port_to_eeprom_mapping[56] = port_eeprom_path # ugly!!!! + else: + self._port_to_eeprom_mapping[x] = port_eeprom_path + + SfpUtilBase.__init__(self) + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = "/sys/bus/i2c/devices/{0}-0050/sfp_port_reset" + port_ps = path.format(self._port_to_i2c_mapping[port_num]) + + try: + reg_file = open(port_ps, 'w') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + #toggle reset + reg_file.seek(0) + reg_file.write('1') + time.sleep(1) + reg_file.seek(0) + reg_file.write('0') + reg_file.close() + return True + + def set_low_power_mode(self, port_nuM, lpmode): + raise NotImplementedError + + def get_low_power_mode(self, port_num): + raise NotImplementedError + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = "/sys/bus/i2c/devices/{0}-0050/sfp_is_present" + port_ps = path.format(self._port_to_i2c_mapping[port_num]) + + + try: + reg_file = open(port_ps) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_file.readline().rstrip() + if reg_value == '1': + return True + + return False + + @property + def port_start(self): + return self._port_start + + @property + def port_end(self): + return self._port_end + + @property + def qsfp_ports(self): + return self._qsfp_ports + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + diff --git a/platform/nephos/one-image.mk b/platform/nephos/one-image.mk index 8e9406dca89c..aa5cc1ff4324 100644 --- a/platform/nephos/one-image.mk +++ b/platform/nephos/one-image.mk @@ -5,6 +5,7 @@ $(SONIC_ONE_IMAGE)_MACHINE = nephos $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie $(SONIC_ONE_IMAGE)_INSTALLS += $(NEPHOS_NPS_KERNEL) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(INGRASYS_S9130_32X_PLATFORM_MODULE) \ - $(INGRASYS_S9230_64X_PLATFORM_MODULE) + $(INGRASYS_S9230_64X_PLATFORM_MODULE) \ + $(ACCTON_AS7116_54X_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/nephos/rules.mk b/platform/nephos/rules.mk index 96f39ef8aad1..bf77ad0e6edf 100644 --- a/platform/nephos/rules.mk +++ b/platform/nephos/rules.mk @@ -1,6 +1,7 @@ include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/platform-modules-ingrasys.mk +include $(PLATFORM_PATH)/platform-modules-accton.mk include $(PLATFORM_PATH)/docker-orchagent-nephos.mk include $(PLATFORM_PATH)/docker-syncd-nephos.mk include $(PLATFORM_PATH)/docker-syncd-nephos-rpc.mk diff --git a/platform/nephos/sonic-platform-modules-accton/LICENSE b/platform/nephos/sonic-platform-modules-accton/LICENSE new file mode 100644 index 000000000000..bc693f7a4c40 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-accton/LICENSE @@ -0,0 +1,16 @@ +Copyright (C) 2016 Microsoft, Inc +Copyright (C) 2017 Accton Technology Corporation + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/nephos/sonic-platform-modules-accton/README.md b/platform/nephos/sonic-platform-modules-accton/README.md new file mode 100644 index 000000000000..0ff20bb2d21b --- /dev/null +++ b/platform/nephos/sonic-platform-modules-accton/README.md @@ -0,0 +1 @@ +platform drivers of Accton products for the SONiC project diff --git a/platform/nephos/sonic-platform-modules-accton/as7116-54x/classes/__init__.py b/platform/nephos/sonic-platform-modules-accton/as7116-54x/classes/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/nephos/sonic-platform-modules-accton/as7116-54x/classes/fanutil.py b/platform/nephos/sonic-platform-modules-accton/as7116-54x/classes/fanutil.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/nephos/sonic-platform-modules-accton/as7116-54x/classes/thermalutil.py b/platform/nephos/sonic-platform-modules-accton/as7116-54x/classes/thermalutil.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/Makefile b/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/Makefile new file mode 100644 index 000000000000..19c7029f14a2 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/Makefile @@ -0,0 +1,2 @@ +obj-m := x86-64-accton-as7116-54x-cpld.o x86-64-accton-as7116-54x-fan.o \ + x86-64-accton-as7116-54x-led.o x86-64-accton-as7116-54x-psu.o x86-64-accton-as7116-54x-sfp.o diff --git a/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-cpld.c b/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-cpld.c new file mode 100644 index 000000000000..eb52512343a8 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-cpld.c @@ -0,0 +1,242 @@ +/* + * A hwmon driver for the as7116_54x_cpld + * + * Copyright (C) 2017 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +/* Addresses scanned for as7116_54x_cpld + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +static ssize_t show_cpld_version(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0; + struct i2c_client *client = to_i2c_client(dev); + + val = i2c_smbus_read_byte_data(client, 0x1); + + if (val < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x1) err %d\n", client->addr, val); + } + + return sprintf(buf, "%d\n", val); +} + +static struct device_attribute ver = __ATTR(version, 0600, show_cpld_version, NULL); + +static void as7116_54x_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void as7116_54x_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static int as7116_54x_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr); + status = -EIO; + goto exit; + } + + status = sysfs_create_file(&client->dev.kobj, &ver.attr); + if (status) { + goto exit; + } + + dev_info(&client->dev, "chip found\n"); + as7116_54x_cpld_add_client(client); + + return 0; + +exit: + return status; +} + +static int as7116_54x_cpld_remove(struct i2c_client *client) +{ + sysfs_remove_file(&client->dev.kobj, &ver.attr); + as7116_54x_cpld_remove_client(client); + + return 0; +} + +enum cpld_chips +{ + as7116_54x_cpld1, + as7116_54x_cpld2, + as7116_54x_cpld3 +}; + +static const struct i2c_device_id as7116_54x_cpld_id[] = { + { "as7116_54x_cpld1", as7116_54x_cpld1 }, + { "as7116_54x_cpld2", as7116_54x_cpld2 }, + { "as7116_54x_cpld3", as7116_54x_cpld3 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7116_54x_cpld_id); + +static struct i2c_driver as7116_54x_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as7116_54x_cpld", + }, + .probe = as7116_54x_cpld_probe, + .remove = as7116_54x_cpld_remove, + .id_table = as7116_54x_cpld_id, + .address_list = normal_i2c, +}; + +int as7116_54x_cpld_read(unsigned short cpld_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_read_byte_data(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as7116_54x_cpld_read); + +int as7116_54x_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_write_byte_data(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as7116_54x_cpld_write); + +static int __init as7116_54x_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&as7116_54x_cpld_driver); +} + +static void __exit as7116_54x_cpld_exit(void) +{ + i2c_del_driver(&as7116_54x_cpld_driver); +} + +static struct dmi_system_id as7116_54x_dmi_table[] = { + { + .ident = "Accton AS7716", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Accton"), + DMI_MATCH(DMI_PRODUCT_NAME, "AS7116"), + }, + } +}; + +int platform_accton_as7116_54x(void) +{ + //return dmi_check_system(as7116_54x_dmi_table); + return 1; +} +EXPORT_SYMBOL(platform_accton_as7116_54x); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_as7116_54x driver"); +MODULE_LICENSE("GPL"); + +module_init(as7116_54x_cpld_init); +module_exit(as7116_54x_cpld_exit); + diff --git a/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-fan.c b/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-fan.c new file mode 100644 index 000000000000..4fd1b91e26dc --- /dev/null +++ b/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-fan.c @@ -0,0 +1,494 @@ +/* + * A hwmon driver for the Accton as7716 32x fan + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "as7116_54x_fan" + +static struct as7116_54x_fan_data *as7116_54x_fan_update_device(struct device *dev); +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); + +/* fan related data, the index should match sysfs_fan_attributes + */ +static const u8 fan_reg[] = { + 0x02, /* fan 1-6 present status */ + 0x03, /* fan 1-6 direction(0:F2B 1:B2F) */ + 0x06, /* fan PWM(for all fan) */ + 0x04, /* front fan fault */ + 0x05, /* rear fan fault */ + 0x07, /* front fan 1 speed(rpm) */ + 0x08, /* front fan 2 speed(rpm) */ + 0x09, /* front fan 3 speed(rpm) */ + 0x0A, /* front fan 4 speed(rpm) */ + 0x0B, /* front fan 5 speed(rpm) */ + 0x0C, /* rear fan 1 speed(rpm) */ + 0x0D, /* rear fan 2 speed(rpm) */ + 0x0E, /* rear fan 3 speed(rpm) */ + 0x0f, /* rear fan 4 speed(rpm) */ + 0x10, /* rear fan 5 speed(rpm) */ +}; + +/* Each client has this additional data */ +struct as7116_54x_fan_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[ARRAY_SIZE(fan_reg)]; /* Register value */ +}; + +enum fan_id { + FAN1_ID, + FAN2_ID, + FAN3_ID, + FAN4_ID, + FAN5_ID +}; + +enum sysfs_fan_attributes { + FAN_PRESENT_REG, + FAN_DIRECTION_REG, + FAN_DUTY_CYCLE_PERCENTAGE, /* Only one CPLD register to control duty cycle for all fans */ + FAN_FRONT_FAULT_REG, + FAN_REAR_FAULT_REG, + FAN1_FRONT_SPEED_RPM, + FAN2_FRONT_SPEED_RPM, + FAN3_FRONT_SPEED_RPM, + FAN4_FRONT_SPEED_RPM, + FAN5_FRONT_SPEED_RPM, + FAN1_REAR_SPEED_RPM, + FAN2_REAR_SPEED_RPM, + FAN3_REAR_SPEED_RPM, + FAN4_REAR_SPEED_RPM, + FAN5_REAR_SPEED_RPM, + FAN1_DIRECTION, + FAN2_DIRECTION, + FAN3_DIRECTION, + FAN4_DIRECTION, + FAN5_DIRECTION, + FAN1_PRESENT, + FAN2_PRESENT, + FAN3_PRESENT, + FAN4_PRESENT, + FAN5_PRESENT, + FAN1_FRONT_FAULT, + FAN2_FRONT_FAULT, + FAN3_FRONT_FAULT, + FAN4_FRONT_FAULT, + FAN5_FRONT_FAULT, + FAN1_REAR_FAULT, + FAN2_REAR_FAULT, + FAN3_REAR_FAULT, + FAN4_REAR_FAULT, + FAN5_REAR_FAULT +}; + +/* Define attributes + */ +#define DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_front_fault, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_FAULT);\ + static SENSOR_DEVICE_ATTR(fan##index##_rear_fault, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_FAULT) +#define DECLARE_FAN_FAULT_ATTR(index) &sensor_dev_attr_fan##index##_front_fault.dev_attr.attr,\ + &sensor_dev_attr_fan##index##_rear_fault.dev_attr.attr + +#define DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_direction, S_IRUGO, fan_show_value, NULL, FAN##index##_DIRECTION) +#define DECLARE_FAN_DIRECTION_ATTR(index) &sensor_dev_attr_fan##index##_direction.dev_attr.attr + +#define DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN##index##_DUTY_CYCLE_PERCENTAGE) +#define DECLARE_FAN_DUTY_CYCLE_ATTR(index) &sensor_dev_attr_fan##index##_duty_cycle_percentage.dev_attr.attr + +#define DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_present, S_IRUGO, fan_show_value, NULL, FAN##index##_PRESENT) +#define DECLARE_FAN_PRESENT_ATTR(index) &sensor_dev_attr_fan##index##_present.dev_attr.attr + +#define DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_front_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_rear_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM) +#define DECLARE_FAN_SPEED_RPM_ATTR(index) &sensor_dev_attr_fan##index##_front_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_rear_speed_rpm.dev_attr.attr + +/* 6 fan fault attributes in this platform */ +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(1); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(2); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(3); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(4); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(5); +/* 6 fan speed(rpm) attributes in this platform */ +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(1); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(2); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(3); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(4); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(5); +/* 6 fan present attributes in this platform */ +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(1); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(2); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(3); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(4); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(5); +/* 6 fan direction attribute in this platform */ +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(1); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(2); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(3); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(4); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(5); +/* 1 fan duty cycle attribute in this platform */ +DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(); + +static struct attribute *as7116_54x_fan_attributes[] = { + /* fan related attributes */ + DECLARE_FAN_FAULT_ATTR(1), + DECLARE_FAN_FAULT_ATTR(2), + DECLARE_FAN_FAULT_ATTR(3), + DECLARE_FAN_FAULT_ATTR(4), + DECLARE_FAN_FAULT_ATTR(5), + DECLARE_FAN_SPEED_RPM_ATTR(1), + DECLARE_FAN_SPEED_RPM_ATTR(2), + DECLARE_FAN_SPEED_RPM_ATTR(3), + DECLARE_FAN_SPEED_RPM_ATTR(4), + DECLARE_FAN_SPEED_RPM_ATTR(5), + DECLARE_FAN_PRESENT_ATTR(1), + DECLARE_FAN_PRESENT_ATTR(2), + DECLARE_FAN_PRESENT_ATTR(3), + DECLARE_FAN_PRESENT_ATTR(4), + DECLARE_FAN_PRESENT_ATTR(5), + DECLARE_FAN_DIRECTION_ATTR(1), + DECLARE_FAN_DIRECTION_ATTR(2), + DECLARE_FAN_DIRECTION_ATTR(3), + DECLARE_FAN_DIRECTION_ATTR(4), + DECLARE_FAN_DIRECTION_ATTR(5), + DECLARE_FAN_DUTY_CYCLE_ATTR(), + NULL +}; + +#define FAN_DUTY_CYCLE_REG_MASK 0x1F +#define FAN_MIN_DUTY_CYCLE 20 +#define FAN_MAX_DUTY_CYCLE 100 +#define FAN_REG_VAL_TO_SPEED_RPM_STEP 150 + +static int as7116_54x_fan_read_value(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int as7116_54x_fan_write_value(struct i2c_client *client, u8 reg, u8 value) +{ + return i2c_smbus_write_byte_data(client, reg, value); +} + +/* fan utility functions + */ +static u32 reg_val_to_duty_cycle(u8 reg_val) +{ + return (reg_val & FAN_DUTY_CYCLE_REG_MASK) * 5; +} + +static u8 duty_cycle_to_reg_val(u8 duty_cycle) +{ + return (duty_cycle / 5); +} + +static u32 reg_val_to_speed_rpm(u8 reg_val) +{ + return (u32)reg_val * FAN_REG_VAL_TO_SPEED_RPM_STEP; +} + +static u8 reg_val_to_direction(u8 reg_val, enum fan_id id) +{ + return !!(reg_val & (1 << id)); +} + +static u8 reg_val_to_is_present(u8 reg_val, enum fan_id id) +{ + return !(reg_val & (1 << id)); +} + +static u8 is_fan_fault(u8 reg_val, enum fan_id id) +{ + return !!(reg_val & (1 << id)); +} +#if 0 +static u8 is_fan_fault(struct as7116_54x_fan_data *data, enum fan_id id) +{ + u8 ret = 1; + int front_fan_index = FAN1_FRONT_SPEED_RPM + id; + int rear_fan_index = FAN1_REAR_SPEED_RPM + id; + + /* Check if the speed of front or rear fan is ZERO, + */ + if (reg_val_to_speed_rpm(data->reg_val[front_fan_index]) && + reg_val_to_speed_rpm(data->reg_val[rear_fan_index])) { + ret = 0; + } + + return ret; +} +#endif + +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int error, value; + struct i2c_client *client = to_i2c_client(dev); + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < FAN_MIN_DUTY_CYCLE) { + value = FAN_MIN_DUTY_CYCLE; + } + + if (value > FAN_MAX_DUTY_CYCLE) { + value = FAN_MAX_DUTY_CYCLE; + } + + as7116_54x_fan_write_value(client, fan_reg[FAN_DUTY_CYCLE_PERCENTAGE], duty_cycle_to_reg_val(value)); + return count; +} + +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as7116_54x_fan_data *data = as7116_54x_fan_update_device(dev); + ssize_t ret = 0; + + if (data->valid) { + switch (attr->index) { + case FAN_DUTY_CYCLE_PERCENTAGE: + { + u32 duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN_DUTY_CYCLE_PERCENTAGE]); + ret = sprintf(buf, "%u\n", duty_cycle); + break; + } + case FAN1_FRONT_SPEED_RPM: + case FAN2_FRONT_SPEED_RPM: + case FAN3_FRONT_SPEED_RPM: + case FAN4_FRONT_SPEED_RPM: + case FAN5_FRONT_SPEED_RPM: + case FAN1_REAR_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + case FAN5_REAR_SPEED_RPM: + ret = sprintf(buf, "%u\n", reg_val_to_speed_rpm(data->reg_val[attr->index])); + break; + case FAN1_PRESENT: + case FAN2_PRESENT: + case FAN3_PRESENT: + case FAN4_PRESENT: + case FAN5_PRESENT: + ret = sprintf(buf, "%d\n", + reg_val_to_is_present(data->reg_val[FAN_PRESENT_REG], + attr->index - FAN1_PRESENT)); + break; + case FAN1_FRONT_FAULT: + case FAN2_FRONT_FAULT: + case FAN3_FRONT_FAULT: + case FAN4_FRONT_FAULT: + case FAN5_FRONT_FAULT: + ret = sprintf(buf, "%d\n", + is_fan_fault(data->reg_val[FAN_FRONT_FAULT_REG], + attr->index - FAN1_FRONT_FAULT)); + break; + case FAN1_REAR_FAULT: + case FAN2_REAR_FAULT: + case FAN3_REAR_FAULT: + case FAN4_REAR_FAULT: + case FAN5_REAR_FAULT: + ret = sprintf(buf, "%d\n", + is_fan_fault(data->reg_val[FAN_REAR_FAULT_REG], + attr->index - FAN1_REAR_FAULT)); + break; + case FAN1_DIRECTION: + case FAN2_DIRECTION: + case FAN3_DIRECTION: + case FAN4_DIRECTION: + case FAN5_DIRECTION: + ret = sprintf(buf, "%d\n", + reg_val_to_direction(data->reg_val[FAN_DIRECTION_REG], + attr->index - FAN1_DIRECTION)); + break; + default: + break; + } + } + + return ret; +} + +static const struct attribute_group as7116_54x_fan_group = { + .attrs = as7116_54x_fan_attributes, +}; + +static struct as7116_54x_fan_data *as7116_54x_fan_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7116_54x_fan_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || + !data->valid) { + int i; + + dev_dbg(&client->dev, "Starting as7116_54x_fan update\n"); + data->valid = 0; + + /* Update fan data + */ + for (i = 0; i < ARRAY_SIZE(data->reg_val); i++) { + int status = as7116_54x_fan_read_value(client, fan_reg[i]); + + if (status < 0) { + data->valid = 0; + mutex_unlock(&data->update_lock); + dev_dbg(&client->dev, "reg %d, err %d\n", fan_reg[i], status); + return data; + } + else { + data->reg_val[i] = status; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +static int as7116_54x_fan_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7116_54x_fan_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as7116_54x_fan_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7116_54x_fan_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: fan '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7116_54x_fan_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7116_54x_fan_remove(struct i2c_client *client) +{ + struct as7116_54x_fan_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7116_54x_fan_group); + + return 0; +} + +/* Addresses to scan */ +static const unsigned short normal_i2c[] = { 0x66, I2C_CLIENT_END }; + +static const struct i2c_device_id as7116_54x_fan_id[] = { + { "as7116_54x_fan", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7116_54x_fan_id); + +static struct i2c_driver as7116_54x_fan_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRVNAME, + }, + .probe = as7116_54x_fan_probe, + .remove = as7116_54x_fan_remove, + .id_table = as7116_54x_fan_id, + .address_list = normal_i2c, +}; + +static int __init as7116_54x_fan_init(void) +{ +#if 0 + extern int platform_accton_as7116_54x(void); + if (!platform_accton_as7116_54x()) { + return -ENODEV; + } +#endif + return i2c_add_driver(&as7116_54x_fan_driver); +} + +static void __exit as7116_54x_fan_exit(void) +{ + i2c_del_driver(&as7116_54x_fan_driver); +} + +module_init(as7116_54x_fan_init); +module_exit(as7116_54x_fan_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7116_54x_fan driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-led.c b/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-led.c new file mode 100644 index 000000000000..cd69f711c826 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-led.c @@ -0,0 +1,448 @@ +/* + * A LED driver for the accton_as7116_54x_led + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "as7116_54x_fan" + +#define DEBUG_MODE 0 +#if (DEBUG_MODE == 1) + #define DEBUG_PRINT(fmt, args...) \ + printk (KERN_INFO "%s:%s[%d]: " fmt "\r\n", __FILE__, __FUNCTION__, __LINE__, ##args) +#else + #define DEBUG_PRINT(fmt, args...) +#endif + +extern int as7116_54x_cpld_read(unsigned short cpld_addr, u8 reg); +extern int as7116_54x_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +struct as7116_54x_led_data { + struct platform_device *pdev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[1]; /* LOC/DIAG LED */ +}; + +static struct as7116_54x_led_data *ledctl = NULL; + +/* LED related data + */ + +#define LED_CNTRLER_I2C_ADDRESS (0x60) + +#define LED_TYPE_DIAG_REG_MASK (0x0C) +#define LED_MODE_DIAG_GREEN_VALUE (0x08) +#define LED_MODE_DIAG_AMBER_VALUE (0x04) +#define LED_MODE_DIAG_YELLOW_VALUE (0x00) +#define LED_MODE_DIAG_OFF_VALUE (0x0C) + +#define LED_TYPE_FAN_REG_MASK (0x03) +#define LED_MODE_FAN_GREEN_VALUE (0x02) +#define LED_MODE_FAN_AMBER_VALUE (0x01) +#define LED_MODE_FAN_OFF_VALUE (0x03) +#define LED_MODE_FAN_AUTO_VALUE (0x00) + +#define LED_TYPE_PSU1_REG_MASK (0x03) +#define LED_MODE_PSU1_GREEN_VALUE (0x02) +#define LED_MODE_PSU1_AMBER_VALUE (0x01) +#define LED_MODE_PSU1_OFF_VALUE (0x03) +#define LED_MODE_PSU1_AUTO_VALUE (0x00) + +#define LED_TYPE_PSU2_REG_MASK (0x0C) +#define LED_MODE_PSU2_GREEN_VALUE (0x08) +#define LED_MODE_PSU2_AMBER_VALUE (0x04) +#define LED_MODE_PSU2_OFF_VALUE (0x0C) +#define LED_MODE_PSU2_AUTO_VALUE (0x00) + +#define LED_TYPE_LOC_REG_MASK (0x30) +#define LED_MODE_LOC_AMBER_VALUE (0x00) +#define LED_MODE_LOC_AMBER_BLINKING_VALUE1 (0x20) +#define LED_MODE_LOC_AMBER_BLINKING_VALUE2 (0x30) +#define LED_MODE_LOC_OFF_VALUE (0x10) + +static const u8 led_reg[] = { + 0x0A, /* LOC/DIAG/FAN LED */ + 0x0B, /* PSU1/PSU2 LED */ +}; + +enum led_type { + LED_TYPE_DIAG, + LED_TYPE_LOC, + LED_TYPE_FAN, + LED_TYPE_PSU1, + LED_TYPE_PSU2 +}; + +enum led_light_mode { + LED_MODE_OFF = 0, + LED_MODE_GREEN, + LED_MODE_GREEN_BLINK, + LED_MODE_AMBER, + LED_MODE_AMBER_BLINK, + LED_MODE_YELLOW, + LED_MODE_YELLOW_BLINK, + LED_MODE_BLUE, + LED_MODE_BLUE_BLINK, + LED_MODE_AUTO, + LED_MODE_UNKNOWN +}; + +struct led_type_mode { + enum led_type type; + enum led_light_mode mode; + int type_mask; + int mode_value; +}; + +static struct led_type_mode led_type_mode_data[] = { +{LED_TYPE_FAN, LED_MODE_OFF, LED_TYPE_FAN_REG_MASK, LED_MODE_FAN_OFF_VALUE}, +{LED_TYPE_FAN, LED_MODE_GREEN, LED_TYPE_FAN_REG_MASK, LED_MODE_FAN_GREEN_VALUE}, +{LED_TYPE_FAN, LED_MODE_AMBER, LED_TYPE_FAN_REG_MASK, LED_MODE_FAN_AMBER_VALUE}, +{LED_TYPE_FAN, LED_MODE_AUTO, LED_TYPE_FAN_REG_MASK, LED_MODE_FAN_AUTO_VALUE}, +{LED_TYPE_PSU1, LED_MODE_OFF, LED_TYPE_PSU1_REG_MASK, LED_MODE_PSU1_OFF_VALUE}, +{LED_TYPE_PSU1, LED_MODE_GREEN, LED_TYPE_PSU1_REG_MASK, LED_MODE_PSU1_GREEN_VALUE}, +{LED_TYPE_PSU1, LED_MODE_AMBER, LED_TYPE_PSU1_REG_MASK, LED_MODE_PSU1_AMBER_VALUE}, +{LED_TYPE_PSU1, LED_MODE_AUTO, LED_TYPE_PSU1_REG_MASK, LED_MODE_PSU1_AUTO_VALUE}, +{LED_TYPE_PSU2, LED_MODE_OFF, LED_TYPE_PSU2_REG_MASK, LED_MODE_PSU2_OFF_VALUE}, +{LED_TYPE_PSU2, LED_MODE_GREEN, LED_TYPE_PSU2_REG_MASK, LED_MODE_PSU2_GREEN_VALUE}, +{LED_TYPE_PSU2, LED_MODE_AMBER, LED_TYPE_PSU2_REG_MASK, LED_MODE_PSU2_AMBER_VALUE}, +{LED_TYPE_PSU2, LED_MODE_AUTO, LED_TYPE_PSU2_REG_MASK, LED_MODE_PSU2_AUTO_VALUE}, +{LED_TYPE_DIAG, LED_MODE_OFF, LED_TYPE_DIAG_REG_MASK, LED_MODE_DIAG_OFF_VALUE}, +{LED_TYPE_DIAG, LED_MODE_GREEN, LED_TYPE_DIAG_REG_MASK, LED_MODE_DIAG_GREEN_VALUE}, +{LED_TYPE_DIAG, LED_MODE_AMBER, LED_TYPE_DIAG_REG_MASK, LED_MODE_DIAG_AMBER_VALUE}, +{LED_TYPE_DIAG, LED_MODE_YELLOW, LED_TYPE_DIAG_REG_MASK, LED_MODE_DIAG_YELLOW_VALUE}, +{LED_TYPE_LOC, LED_MODE_OFF, LED_TYPE_LOC_REG_MASK, LED_MODE_LOC_OFF_VALUE}, +{LED_TYPE_LOC, LED_MODE_AMBER, LED_TYPE_LOC_REG_MASK, LED_MODE_LOC_AMBER_VALUE}, +{LED_TYPE_LOC, LED_MODE_AMBER_BLINK, LED_TYPE_LOC_REG_MASK, LED_MODE_LOC_AMBER_BLINKING_VALUE1}, +{LED_TYPE_LOC, LED_MODE_AMBER_BLINK, LED_TYPE_LOC_REG_MASK, LED_MODE_LOC_AMBER_BLINKING_VALUE2} +}; + +static int led_reg_val_to_light_mode(enum led_type type, u8 reg_val) { + int i; + + for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) { + if (type != led_type_mode_data[i].type) { + continue; + } + + if ((led_type_mode_data[i].type_mask & reg_val) == + led_type_mode_data[i].mode_value) { + return led_type_mode_data[i].mode; + } + } + + return LED_MODE_UNKNOWN; +} + +static u8 led_light_mode_to_reg_val(enum led_type type, + enum led_light_mode mode, u8 reg_val) { + int i; + + for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) { + int type_mask, mode_value; + + if (type != led_type_mode_data[i].type) + continue; + + if (mode != led_type_mode_data[i].mode) + continue; + + type_mask = led_type_mode_data[i].type_mask; + mode_value = led_type_mode_data[i].mode_value; + reg_val = (reg_val & ~type_mask) | mode_value; + } + + return reg_val; +} + +static int as7116_54x_led_read_value(u8 reg) +{ + return as7116_54x_cpld_read(LED_CNTRLER_I2C_ADDRESS, reg); +} + +static int as7116_54x_led_write_value(u8 reg, u8 value) +{ + return as7116_54x_cpld_write(LED_CNTRLER_I2C_ADDRESS, reg, value); +} + +static void as7116_54x_led_update(void) +{ + mutex_lock(&ledctl->update_lock); + + if (time_after(jiffies, ledctl->last_updated + HZ + HZ / 2) + || !ledctl->valid) { + int i; + + dev_dbg(&ledctl->pdev->dev, "Starting accton_as7116_54x_led update\n"); + ledctl->valid = 0; + + /* Update LED data + */ + for (i = 0; i < ARRAY_SIZE(ledctl->reg_val); i++) { + int status = as7116_54x_led_read_value(led_reg[i]); + + if (status < 0) { + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", led_reg[i], status); + goto exit; + } + else { + ledctl->reg_val[i] = status; + } + } + + ledctl->last_updated = jiffies; + ledctl->valid = 1; + } + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void as7116_54x_led_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode, + u8 reg, enum led_type type) +{ + int reg_val; + + mutex_lock(&ledctl->update_lock); + + reg_val = as7116_54x_led_read_value(reg); + + if (reg_val < 0) { + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", reg, reg_val); + goto exit; + } + reg_val = led_light_mode_to_reg_val(type, led_light_mode, reg_val); + as7116_54x_led_write_value(reg, reg_val); + + /* to prevent the slow-update issue */ + ledctl->valid = 0; + +exit: + mutex_unlock(&ledctl->update_lock); +} + + +static void as7116_54x_led_diag_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + as7116_54x_led_set(led_cdev, led_light_mode, led_reg[0], LED_TYPE_DIAG); +} + +static enum led_brightness as7116_54x_led_diag_get(struct led_classdev *cdev) +{ + as7116_54x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_DIAG, ledctl->reg_val[0]); +} + +static void as7116_54x_led_loc_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + as7116_54x_led_set(led_cdev, led_light_mode, led_reg[0], LED_TYPE_LOC); +} + +static enum led_brightness as7116_54x_led_loc_get(struct led_classdev *cdev) +{ + as7116_54x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_LOC, ledctl->reg_val[0]); +} + +static void as7116_54x_led_fan_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + as7116_54x_led_set(led_cdev, led_light_mode, led_reg[0], LED_TYPE_FAN); +} + +static enum led_brightness as7116_54x_led_fan_get(struct led_classdev *cdev) +{ + as7116_54x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_FAN, ledctl->reg_val[0]); +} + +static void as7116_54x_led_psu1_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + as7116_54x_led_set(led_cdev, led_light_mode, led_reg[1], LED_TYPE_PSU1); +} + +static enum led_brightness as7116_54x_led_psu1_get(struct led_classdev *cdev) +{ + as7116_54x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_PSU1, ledctl->reg_val[1]); +} + +static void as7116_54x_led_psu2_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + as7116_54x_led_set(led_cdev, led_light_mode, led_reg[1], LED_TYPE_PSU2); +} + +static enum led_brightness as7116_54x_led_psu2_get(struct led_classdev *cdev) +{ + as7116_54x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_PSU2, ledctl->reg_val[1]); +} + +static struct led_classdev as7116_54x_leds[] = { + [LED_TYPE_DIAG] = { + .name = "as7116_54x_led::diag", + .default_trigger = "unused", + .brightness_set = as7116_54x_led_diag_set, + .brightness_get = as7116_54x_led_diag_get, + .max_brightness = LED_MODE_YELLOW, + }, + [LED_TYPE_LOC] = { + .name = "as7116_54x_led::loc", + .default_trigger = "unused", + .brightness_set = as7116_54x_led_loc_set, + .brightness_get = as7116_54x_led_loc_get, + .max_brightness = LED_MODE_AMBER_BLINK, + }, + [LED_TYPE_FAN] = { + .name = "as7116_54x_led::fan", + .default_trigger = "unused", + .brightness_set = as7116_54x_led_fan_set, + .brightness_get = as7116_54x_led_fan_get, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU1] = { + .name = "as7116_54x_led::psu1", + .default_trigger = "unused", + .brightness_set = as7116_54x_led_psu1_set, + .brightness_get = as7116_54x_led_psu1_get, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU2] = { + .name = "as7116_54x_led::psu2", + .default_trigger = "unused", + .brightness_set = as7116_54x_led_psu2_set, + .brightness_get = as7116_54x_led_psu2_get, + .max_brightness = LED_MODE_AUTO, + }, +}; + + +static int as7116_54x_led_probe(struct platform_device *pdev) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(as7116_54x_leds); i++) { + ret = led_classdev_register(&pdev->dev, &as7116_54x_leds[i]); + + if (ret < 0) { + break; + } + } + + /* Check if all LEDs were successfully registered */ + if (i != ARRAY_SIZE(as7116_54x_leds)){ + int j; + + /* only unregister the LEDs that were successfully registered */ + for (j = 0; j < i; j++) { + led_classdev_unregister(&as7116_54x_leds[i]); + } + } + + return ret; +} + +static int as7116_54x_led_remove(struct platform_device *pdev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(as7116_54x_leds); i++) { + led_classdev_unregister(&as7116_54x_leds[i]); + } + + return 0; +} + +static struct platform_driver as7116_54x_led_driver = { + .probe = as7116_54x_led_probe, + .remove = as7116_54x_led_remove, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int __init as7116_54x_led_init(void) +{ + int ret; + +#if 0 + extern int platform_accton_as7116_54x(void); + if (!platform_accton_as7116_54x()) { + return -ENODEV; + } +#endif + + ret = platform_driver_register(&as7116_54x_led_driver); + if (ret < 0) { + goto exit; + } + + ledctl = kzalloc(sizeof(struct as7116_54x_led_data), GFP_KERNEL); + if (!ledctl) { + ret = -ENOMEM; + goto exit_driver; + } + + mutex_init(&ledctl->update_lock); + + ledctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(ledctl->pdev)) { + ret = PTR_ERR(ledctl->pdev); + goto exit_free; + } + + return 0; + +exit_free: + kfree(ledctl); +exit_driver: + platform_driver_unregister(&as7116_54x_led_driver); +exit: + return ret; +} + +static void __exit as7116_54x_led_exit(void) +{ + platform_device_unregister(ledctl->pdev); + platform_driver_unregister(&as7116_54x_led_driver); + kfree(ledctl); +} + +module_init(as7116_54x_led_init); +module_exit(as7116_54x_led_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_as7116_54x_led driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-psu.c b/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-psu.c new file mode 100644 index 000000000000..b4e14297f414 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-psu.c @@ -0,0 +1,349 @@ +/* + * An hwmon driver for accton as7116_54x Power Module + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PSU_STATUS_I2C_ADDR 0x60 +#define PSU_STATUS_I2C_REG_OFFSET 0x2 + +#define MODEL_NAME_LEN 11 +#define MODEL_NAME_REG_OFFSET 0x20 + +#define SERIAL_NUM_LEN 18 +#define SERIAL_NUM_REG_OFFSET 0x35 + +#define IS_POWER_GOOD(id, value) (!!(value & BIT(id*4 + 1))) +#define IS_PRESENT(id, value) (!(value & BIT(id*4))) + +static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_string(struct device *dev, struct device_attribute *da, char *buf); +static int as7116_54x_psu_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len); +extern int as7116_54x_cpld_read(unsigned short cpld_addr, u8 reg); +static struct as7116_54x_psu_data *as7116_54x_psu_update_device(struct device *dev, u8 update_eeprom); + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as7116_54x_psu_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 index; /* PSU index */ + u8 status; /* Status(present/power_good) register read from CPLD */ + char model_name[MODEL_NAME_LEN+1]; /* Model name, read from eeprom */ + char serial[SERIAL_NUM_LEN+1]; /* Serial number, read from eeprom*/ +}; + +enum as7116_54x_psu_sysfs_attributes { + PSU_PRESENT, + PSU_MODEL_NAME, + PSU_POWER_GOOD, + PSU_SERIAL_NUMBER +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_string, NULL, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); +static SENSOR_DEVICE_ATTR(psu_serial_numer, S_IRUGO, show_string, NULL, PSU_SERIAL_NUMBER); + +static struct attribute *as7116_54x_psu_attributes[] = { + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_model_name.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + &sensor_dev_attr_psu_serial_numer.dev_attr.attr, + NULL +}; + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as7116_54x_psu_data *data = as7116_54x_psu_update_device(dev, 0); + u8 status = 0; + + if (!data->valid) { + return -EIO; + } + + if (attr->index == PSU_PRESENT) { + status = IS_PRESENT(data->index, data->status); + } + else { /* PSU_POWER_GOOD */ + status = IS_POWER_GOOD(data->index, data->status); + } + + return sprintf(buf, "%d\n", status); +} + +static ssize_t show_string(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as7116_54x_psu_data *data = as7116_54x_psu_update_device(dev, 1); + char *ptr = NULL; + + if (!data->valid) { + return -EIO; + } + + if (!IS_PRESENT(data->index, data->status)) { + return -ENXIO; + } + + if (attr->index == PSU_MODEL_NAME) { + ptr = data->model_name; + } + else { /* PSU_SERIAL_NUBMER */ + ptr = data->serial; + } + + return sprintf(buf, "%s\n", ptr); +} + +static const struct attribute_group as7116_54x_psu_group = { + .attrs = as7116_54x_psu_attributes, +}; + +static int as7116_54x_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7116_54x_psu_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as7116_54x_psu_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + data->index = dev_id->driver_data; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7116_54x_psu_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7116_54x_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7116_54x_psu_remove(struct i2c_client *client) +{ + struct as7116_54x_psu_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7116_54x_psu_group); + kfree(data); + + return 0; +} + +enum psu_index +{ + as7116_54x_psu1, + as7116_54x_psu2 +}; + +static const struct i2c_device_id as7116_54x_psu_id[] = { + { "as7116_54x_psu1", as7116_54x_psu1 }, + { "as7116_54x_psu2", as7116_54x_psu2 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7116_54x_psu_id); + +static struct i2c_driver as7116_54x_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as7116_54x_psu", + }, + .probe = as7116_54x_psu_probe, + .remove = as7116_54x_psu_remove, + .id_table = as7116_54x_psu_id, + .address_list = normal_i2c, +}; + +static int as7116_54x_psu_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = 0; + int retry_count = 5; + + while (retry_count) { + retry_count--; + + result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) { + msleep(10); + continue; + } + + if (unlikely(result != data_len)) { + result = -EIO; + msleep(10); + continue; + } + + result = 0; + break; + } + + return result; +} + +static struct as7116_54x_psu_data *as7116_54x_psu_update_device(struct device *dev, u8 update_eeprom) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7116_54x_psu_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int status; + + data->valid = 0; + dev_dbg(&client->dev, "Starting as7116_54x update\n"); + + /* Read psu status */ + status = as7116_54x_cpld_read(PSU_STATUS_I2C_ADDR, PSU_STATUS_I2C_REG_OFFSET); + + if (status < 0) { + dev_dbg(&client->dev, "cpld reg (0x%x) err %d\n", PSU_STATUS_I2C_ADDR, status); + goto exit; + } + else { + data->status = status; + } + + + memset(data->model_name, 0, sizeof(data->model_name)); + memset(data->serial, 0, sizeof(data->serial)); + + if (update_eeprom && IS_PRESENT(data->index, data->status)) { + /* Read model name */ + status = as7116_54x_psu_read_block(client, MODEL_NAME_REG_OFFSET, data->model_name, + ARRAY_SIZE(data->model_name)-1); + + if (status < 0) { + data->model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr); + goto exit; + } + else { + /* Skip the meaningless data byte 8*/ + data->model_name[8] = data->model_name[9]; + data->model_name[9] = data->model_name[10]; + data->model_name[10] = '\0'; + } + + /* Read serial number */ + status = as7116_54x_psu_read_block(client, SERIAL_NUM_REG_OFFSET, data->serial, + ARRAY_SIZE(data->serial)-1); + + if (status < 0) { + data->serial[0] = '\0'; + dev_dbg(&client->dev, "unable to read serial number from (0x%x)\n", client->addr); + goto exit; + } + else { + data->serial[SERIAL_NUM_LEN] = '\0'; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + +exit: + mutex_unlock(&data->update_lock); + + return data; +} + +static int __init as7116_54x_psu_init(void) +{ + //extern int platform_accton_as7116_54x(void); + //if (!platform_accton_as7116_54x()) { + // return -ENODEV; + //} + + return i2c_add_driver(&as7116_54x_psu_driver); +} + +static void __exit as7116_54x_psu_exit(void) +{ + i2c_del_driver(&as7116_54x_psu_driver); +} + +module_init(as7116_54x_psu_init); +module_exit(as7116_54x_psu_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7116_54x_psu driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-sfp.c b/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-sfp.c new file mode 100644 index 000000000000..540ceb21722f --- /dev/null +++ b/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-sfp.c @@ -0,0 +1,1384 @@ +/* + * SFP driver for accton as7116_54x sfp + * + * Copyright (C) Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_NAME "as7116_54x_sfp" /* Platform dependent */ + +#define DEBUG_MODE 0 + +#if (DEBUG_MODE == 1) + #define DEBUG_PRINT(fmt, args...) \ + printk (KERN_INFO "%s:%s[%d]: " fmt "\r\n", __FILE__, __FUNCTION__, __LINE__, ##args) +#else + #define DEBUG_PRINT(fmt, args...) +#endif + +#define EEPROM_NAME "sfp_eeprom" +#define EEPROM_SIZE 256 /* 256 byte eeprom */ +#define BIT_INDEX(i) (1ULL << (i)) +#define USE_I2C_BLOCK_READ 1 /* Platform dependent */ +#define I2C_RW_RETRY_COUNT 3 +#define I2C_RW_RETRY_INTERVAL 100 /* ms */ + +#define SFP_EEPROM_A0_I2C_ADDR (0xA0 >> 1) +#define SFP_EEPROM_A2_I2C_ADDR (0xA2 >> 1) + +#define SFF8024_PHYSICAL_DEVICE_ID_ADDR 0x0 +#define SFF8024_DEVICE_ID_SFP 0x3 +#define SFF8024_DEVICE_ID_QSFP 0xC +#define SFF8024_DEVICE_ID_QSFP_PLUS 0xD +#define SFF8024_DEVICE_ID_QSFP28 0x11 + +#define SFF8472_DIAG_MON_TYPE_ADDR 92 +#define SFF8472_DIAG_MON_TYPE_DDM_MASK 0x40 +#define SFF8472_10G_ETH_COMPLIANCE_ADDR 0x3 +#define SFF8472_10G_BASE_MASK 0xF0 + +#define SFF8436_RX_LOS_ADDR 3 +#define SFF8436_TX_FAULT_ADDR 4 +#define SFF8436_TX_DISABLE_ADDR 86 + +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_port_type(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_present(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sfp_set_tx_disable(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t qsfp_set_tx_disable(struct device *dev, struct device_attribute *da, const char *buf, size_t count);; +static ssize_t sfp_show_ddm_implemented(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sfp_eeprom_read(struct i2c_client *, u8, u8 *,int); +static ssize_t sfp_eeprom_write(struct i2c_client *, u8 , const char *,int); +extern int as7116_54x_cpld_read(unsigned short cpld_addr, u8 reg); +extern int as7116_54x_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +enum sfp_sysfs_attributes { + PRESENT, + PRESENT_ALL, + PORT_NUMBER, + PORT_TYPE, + DDM_IMPLEMENTED, + TX_FAULT, + TX_FAULT1, + TX_FAULT2, + TX_FAULT3, + TX_FAULT4, + TX_DISABLE, + TX_DISABLE1, + TX_DISABLE2, + TX_DISABLE3, + TX_DISABLE4, + RX_LOS, + RX_LOS1, + RX_LOS2, + RX_LOS3, + RX_LOS4, + RX_LOS_ALL +}; + +/* SFP/QSFP common attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_port_number, S_IRUGO, show_port_number, NULL, PORT_NUMBER); +static SENSOR_DEVICE_ATTR(sfp_port_type, S_IRUGO, show_port_type, NULL, PORT_TYPE); +static SENSOR_DEVICE_ATTR(sfp_is_present, S_IRUGO, show_present, NULL, PRESENT); +static SENSOR_DEVICE_ATTR(sfp_is_present_all, S_IRUGO, show_present, NULL, PRESENT_ALL); +static SENSOR_DEVICE_ATTR(sfp_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, RX_LOS); +static SENSOR_DEVICE_ATTR(sfp_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, TX_DISABLE); +static SENSOR_DEVICE_ATTR(sfp_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, TX_FAULT); + +/* QSFP attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_rx_los1, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS1); +static SENSOR_DEVICE_ATTR(sfp_rx_los2, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS2); +static SENSOR_DEVICE_ATTR(sfp_rx_los3, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS3); +static SENSOR_DEVICE_ATTR(sfp_rx_los4, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS4); +static SENSOR_DEVICE_ATTR(sfp_tx_disable1, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE1); +static SENSOR_DEVICE_ATTR(sfp_tx_disable2, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE2); +static SENSOR_DEVICE_ATTR(sfp_tx_disable3, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE3); +static SENSOR_DEVICE_ATTR(sfp_tx_disable4, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE4); +static SENSOR_DEVICE_ATTR(sfp_tx_fault1, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT1); +static SENSOR_DEVICE_ATTR(sfp_tx_fault2, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT2); +static SENSOR_DEVICE_ATTR(sfp_tx_fault3, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT3); +static SENSOR_DEVICE_ATTR(sfp_tx_fault4, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT4); +static struct attribute *qsfp_attributes[] = { + &sensor_dev_attr_sfp_port_number.dev_attr.attr, + &sensor_dev_attr_sfp_port_type.dev_attr.attr, + &sensor_dev_attr_sfp_is_present.dev_attr.attr, + &sensor_dev_attr_sfp_is_present_all.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los1.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los2.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los3.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los4.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable1.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable2.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable3.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable4.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault1.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault2.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault3.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault4.dev_attr.attr, + NULL +}; + +/* SFP msa attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_ddm_implemented, S_IRUGO, sfp_show_ddm_implemented, NULL, DDM_IMPLEMENTED); +static SENSOR_DEVICE_ATTR(sfp_rx_los_all, S_IRUGO, sfp_show_tx_rx_status, NULL, RX_LOS_ALL); +static struct attribute *sfp_msa_attributes[] = { + &sensor_dev_attr_sfp_port_number.dev_attr.attr, + &sensor_dev_attr_sfp_port_type.dev_attr.attr, + &sensor_dev_attr_sfp_is_present.dev_attr.attr, + &sensor_dev_attr_sfp_is_present_all.dev_attr.attr, + &sensor_dev_attr_sfp_ddm_implemented.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los_all.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable.dev_attr.attr, + NULL +}; + +/* SFP ddm attributes for sysfs */ +static struct attribute *sfp_ddm_attributes[] = { + NULL +}; + +/* Platform dependent +++ */ +#define CPLD_PORT_TO_FRONT_PORT(port) (port+1) + +enum port_numbers { +as7116_54x_sfp1, as7116_54x_sfp2, as7116_54x_sfp3, as7116_54x_sfp4, +as7116_54x_sfp5, as7116_54x_sfp6, as7116_54x_sfp7, as7116_54x_sfp8, +as7116_54x_sfp9, as7116_54x_sfp10, as7116_54x_sfp11, as7116_54x_sfp12, +as7116_54x_sfp13, as7116_54x_sfp14, as7116_54x_sfp15, as7116_54x_sfp16, +as7116_54x_sfp17, as7116_54x_sfp18, as7116_54x_sfp19, as7116_54x_sfp20, +as7116_54x_sfp21, as7116_54x_sfp22, as7116_54x_sfp23, as7116_54x_sfp24, +as7116_54x_sfp25, as7116_54x_sfp26, as7116_54x_sfp27, as7116_54x_sfp28, +as7116_54x_sfp29, as7116_54x_sfp30, as7116_54x_sfp31, as7116_54x_sfp32, +as7116_54x_sfp33, as7116_54x_sfp34, as7116_54x_sfp35, as7116_54x_sfp36, +as7116_54x_sfp37, as7116_54x_sfp38, as7116_54x_sfp39, as7116_54x_sfp40, +as7116_54x_sfp41, as7116_54x_sfp42, as7116_54x_sfp43, as7116_54x_sfp44, +as7116_54x_sfp45, as7116_54x_sfp46, as7116_54x_sfp47, as7116_54x_sfp48, +as7116_54x_sfp49, as7116_54x_sfp50, as7116_54x_sfp51, as7116_54x_sfp52, +as7116_54x_sfp53, as7116_54x_sfp54 +}; + +#define I2C_DEV_ID(x) { #x, x} + +static const struct i2c_device_id sfp_device_id[] = { +I2C_DEV_ID(as7116_54x_sfp1), +I2C_DEV_ID(as7116_54x_sfp2), +I2C_DEV_ID(as7116_54x_sfp3), +I2C_DEV_ID(as7116_54x_sfp4), +I2C_DEV_ID(as7116_54x_sfp5), +I2C_DEV_ID(as7116_54x_sfp6), +I2C_DEV_ID(as7116_54x_sfp7), +I2C_DEV_ID(as7116_54x_sfp8), +I2C_DEV_ID(as7116_54x_sfp9), +I2C_DEV_ID(as7116_54x_sfp10), +I2C_DEV_ID(as7116_54x_sfp11), +I2C_DEV_ID(as7116_54x_sfp12), +I2C_DEV_ID(as7116_54x_sfp13), +I2C_DEV_ID(as7116_54x_sfp14), +I2C_DEV_ID(as7116_54x_sfp15), +I2C_DEV_ID(as7116_54x_sfp16), +I2C_DEV_ID(as7116_54x_sfp17), +I2C_DEV_ID(as7116_54x_sfp18), +I2C_DEV_ID(as7116_54x_sfp19), +I2C_DEV_ID(as7116_54x_sfp20), +I2C_DEV_ID(as7116_54x_sfp21), +I2C_DEV_ID(as7116_54x_sfp22), +I2C_DEV_ID(as7116_54x_sfp23), +I2C_DEV_ID(as7116_54x_sfp24), +I2C_DEV_ID(as7116_54x_sfp25), +I2C_DEV_ID(as7116_54x_sfp26), +I2C_DEV_ID(as7116_54x_sfp27), +I2C_DEV_ID(as7116_54x_sfp28), +I2C_DEV_ID(as7116_54x_sfp29), +I2C_DEV_ID(as7116_54x_sfp30), +I2C_DEV_ID(as7116_54x_sfp31), +I2C_DEV_ID(as7116_54x_sfp32), +I2C_DEV_ID(as7116_54x_sfp33), +I2C_DEV_ID(as7116_54x_sfp34), +I2C_DEV_ID(as7116_54x_sfp35), +I2C_DEV_ID(as7116_54x_sfp36), +I2C_DEV_ID(as7116_54x_sfp37), +I2C_DEV_ID(as7116_54x_sfp38), +I2C_DEV_ID(as7116_54x_sfp39), +I2C_DEV_ID(as7116_54x_sfp40), +I2C_DEV_ID(as7116_54x_sfp41), +I2C_DEV_ID(as7116_54x_sfp42), +I2C_DEV_ID(as7116_54x_sfp43), +I2C_DEV_ID(as7116_54x_sfp44), +I2C_DEV_ID(as7116_54x_sfp45), +I2C_DEV_ID(as7116_54x_sfp46), +I2C_DEV_ID(as7116_54x_sfp47), +I2C_DEV_ID(as7116_54x_sfp48), +I2C_DEV_ID(as7116_54x_sfp49), +I2C_DEV_ID(as7116_54x_sfp50), +I2C_DEV_ID(as7116_54x_sfp51), +I2C_DEV_ID(as7116_54x_sfp52), +I2C_DEV_ID(as7116_54x_sfp53), +I2C_DEV_ID(as7116_54x_sfp54), +{ /* LIST END */ } +}; +MODULE_DEVICE_TABLE(i2c, sfp_device_id); + +/* + * list of valid port types + * note OOM_PORT_TYPE_NOT_PRESENT to indicate no + * module is present in this port + */ +typedef enum oom_driver_port_type_e { + OOM_DRIVER_PORT_TYPE_INVALID, + OOM_DRIVER_PORT_TYPE_NOT_PRESENT, + OOM_DRIVER_PORT_TYPE_SFP, + OOM_DRIVER_PORT_TYPE_SFP_PLUS, + OOM_DRIVER_PORT_TYPE_QSFP, + OOM_DRIVER_PORT_TYPE_QSFP_PLUS, + OOM_DRIVER_PORT_TYPE_QSFP28 +} oom_driver_port_type_t; + +enum driver_type_e { + DRIVER_TYPE_SFP_MSA, + DRIVER_TYPE_SFP_DDM, + DRIVER_TYPE_QSFP +}; + +/* Each client has this additional data + */ +struct eeprom_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + struct bin_attribute bin; /* eeprom data */ +}; + +struct sfp_msa_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u64 status[6]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => tx_fail + 1 => tx_disable + 2 => rx_loss + 3 => device id + 4 => 10G Ethernet Compliance Codes + to distinguish SFP or SFP+ + 5 => DIAGNOSTIC MONITORING TYPE */ + struct eeprom_data eeprom; +}; + +struct sfp_ddm_data { + struct eeprom_data eeprom; +}; + +struct qsfp_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 status[3]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => tx_fail + 1 => tx_disable + 2 => rx_loss */ + + u8 device_id; + struct eeprom_data eeprom; +}; + +struct sfp_port_data { + struct mutex update_lock; + enum driver_type_e driver_type; + int port; /* CPLD port index */ + oom_driver_port_type_t port_type; + u64 present; /* present status, bit0:port0, bit1:port1 and so on */ + + struct sfp_msa_data *msa; + struct sfp_ddm_data *ddm; + struct qsfp_data *qsfp; + + struct i2c_client *client; +}; + +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + return sprintf(buf, "%d\n", CPLD_PORT_TO_FRONT_PORT(data->port)); +} + +/* Platform dependent +++ */ +static struct sfp_port_data *sfp_update_present(struct i2c_client *client) +{ + int i = 0, j = 0, status = -1; + u8 reg; + unsigned short cpld_addr; + struct sfp_port_data *data = i2c_get_clientdata(client); + + DEBUG_PRINT("Starting sfp present status update"); + mutex_lock(&data->update_lock); + data->present = 0; + + /* Read present status of port 1~48(SFP port) */ + for (i = 0; i < 2; i++) { + for (j = 0; j < 3; j++) { + cpld_addr = 0x61+i; + reg = 0x6+j; + status = as7116_54x_cpld_read(cpld_addr, reg); + + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", cpld_addr, reg, status); + goto exit; + } + + DEBUG_PRINT("Present status = 0x%lx\r\n", data->present); + data->present |= (u64)status << ((i*24) + (j%3)*8); + } + } + + /* Read present status of port 49-54(QSFP port) */ + cpld_addr = 0x62; + reg = 0x14; + status = as7116_54x_cpld_read(cpld_addr, reg); + + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", cpld_addr, reg, status); + goto exit; + } + else { + data->present |= (u64)status << 48; + } + + DEBUG_PRINT("Present status = 0x%lx", data->present); +exit: + mutex_unlock(&data->update_lock); + return (status < 0) ? ERR_PTR(status) : data; +} + +static struct sfp_port_data *sfp_update_tx_rx_status(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + int i = 0, j = 0; + int status = -1; + + if (time_before(jiffies, data->msa->last_updated + HZ + HZ / 2) && data->msa->valid) { + return data; + } + + DEBUG_PRINT("Starting as7116_54x sfp tx rx status update"); + mutex_lock(&data->update_lock); + data->msa->valid = 0; + memset(data->msa->status, 0, sizeof(data->msa->status)); + + /* Read status of port 1~48(SFP port) */ + for (i = 0; i < 2; i++) { + for (j = 0; j < 9; j++) { + u8 reg; + unsigned short cpld_addr; + reg = 0x9+j; + cpld_addr = 0x61+i; + + status = as7116_54x_cpld_read(cpld_addr, reg); + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", cpld_addr, reg, status); + goto exit; + } + + data->msa->status[j/3] |= (u64)status << ((i*24) + (j%3)*8); + } + } + + data->msa->valid = 1; + data->msa->last_updated = jiffies; + +exit: + mutex_unlock(&data->update_lock); + return (status < 0) ? ERR_PTR(status) : data; +} + +static ssize_t sfp_set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + unsigned short cpld_addr = 0; + u8 cpld_reg = 0, cpld_val = 0, cpld_bit = 0; + long disable; + int error; + + if (data->driver_type == DRIVER_TYPE_QSFP) { + return qsfp_set_tx_disable(dev, da, buf, count); + } + + error = kstrtol(buf, 10, &disable); + if (error) { + return error; + } + + mutex_lock(&data->update_lock); + + if(data->port < 24) { + cpld_addr = 0x61; + cpld_reg = 0xC + data->port / 8; + cpld_bit = 1 << (data->port % 8); + } + else { /* port 24 ~ 48 */ + cpld_addr = 0x62; + cpld_reg = 0xC + (data->port - 24) / 8; + cpld_bit = 1 << (data->port % 8); + } + + /* Read current status */ + cpld_val = as7116_54x_cpld_read(cpld_addr, cpld_reg); + + /* Update tx_disable status */ + if (disable) { + data->msa->status[1] |= BIT_INDEX(data->port); + cpld_val |= cpld_bit; + } + else { + data->msa->status[1] &= ~BIT_INDEX(data->port); + cpld_val &= ~cpld_bit; + } + + as7116_54x_cpld_write(cpld_addr, cpld_reg, cpld_val); + mutex_unlock(&data->update_lock); + return count; +} +/* Platform dependent --- */ + +static int sfp_is_port_present(struct i2c_client *client, int port) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + + data = sfp_update_present(client); + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + return !(data->present & BIT_INDEX(data->port)); /* Platform dependent */ +} + +/* Platform dependent +++ */ +static ssize_t show_present(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + + if (PRESENT_ALL == attr->index) { + int i; + u8 values[7] = {0}; + struct sfp_port_data *data = sfp_update_present(client); + + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + for (i = 0; i < ARRAY_SIZE(values); i++) { + values[i] = ~(u8)(data->present >> (i * 8)); + } + + /* Return values 1 -> 54 in order */ + return sprintf(buf, "%.2x %.2x %.2x %.2x %.2x %.2x %.2x\n", + values[0], values[1], values[2], + values[3], values[4], values[5], + values[6] & 0x3F); + } + else { + struct sfp_port_data *data = i2c_get_clientdata(client); + int present = sfp_is_port_present(client, data->port); + + if (IS_ERR_VALUE(present)) { + return present; + } + + /* PRESENT */ + return sprintf(buf, "%d\n", present); + } +} +/* Platform dependent --- */ + +static struct sfp_port_data *sfp_update_port_type(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + u8 buf = 0; + int status; + + mutex_lock(&data->update_lock); + + switch (data->driver_type) { + case DRIVER_TYPE_SFP_MSA: + { + status = sfp_eeprom_read(client, SFF8024_PHYSICAL_DEVICE_ID_ADDR, &buf, sizeof(buf)); + if (unlikely(status < 0)) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + if (buf != SFF8024_DEVICE_ID_SFP) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + status = sfp_eeprom_read(client, SFF8472_10G_ETH_COMPLIANCE_ADDR, &buf, sizeof(buf)); + if (unlikely(status < 0)) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + DEBUG_PRINT("sfp port type (0x3) data = (0x%x)", buf); + data->port_type = buf & SFF8472_10G_BASE_MASK ? OOM_DRIVER_PORT_TYPE_SFP_PLUS : OOM_DRIVER_PORT_TYPE_SFP; + break; + } + case DRIVER_TYPE_QSFP: + { + status = sfp_eeprom_read(client, SFF8024_PHYSICAL_DEVICE_ID_ADDR, &buf, sizeof(buf)); + if (unlikely(status < 0)) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + DEBUG_PRINT("qsfp port type (0x0) buf = (0x%x)", buf); + switch (buf) { + case SFF8024_DEVICE_ID_QSFP: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP; + break; + case SFF8024_DEVICE_ID_QSFP_PLUS: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP_PLUS; + break; + case SFF8024_DEVICE_ID_QSFP28: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP_PLUS; + break; + default: + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + break; + } + default: + break; + } + + mutex_unlock(&data->update_lock); + return data; +} + +static ssize_t show_port_type(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + int present = sfp_is_port_present(client, data->port); + + if (IS_ERR_VALUE(present)) { + return present; + } + + if (!present) { + /* port is not present */ + return sprintf(buf, "%d\n", OOM_DRIVER_PORT_TYPE_NOT_PRESENT); + } + + sfp_update_port_type(dev); + return sprintf(buf, "%d\n", data->port_type); +} + +static struct sfp_port_data *qsfp_update_tx_rx_status(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + int i, status = -1; + u8 buf = 0; + u8 reg[] = {SFF8436_TX_FAULT_ADDR, SFF8436_TX_DISABLE_ADDR, SFF8436_RX_LOS_ADDR}; + + DEBUG_PRINT(""); + if (time_before(jiffies, data->qsfp->last_updated + HZ + HZ / 2) && data->qsfp->valid) { + return data; + } + + DEBUG_PRINT("Starting sfp tx rx status update"); + mutex_lock(&data->update_lock); + data->qsfp->valid = 0; + memset(data->qsfp->status, 0, sizeof(data->qsfp->status)); + + DEBUG_PRINT(""); + /* Notify device to update tx fault/ tx disable/ rx los status */ + for (i = 0; i < ARRAY_SIZE(reg); i++) { + status = sfp_eeprom_read(client, reg[i], &buf, sizeof(buf)); + if (unlikely(status < 0)) { + DEBUG_PRINT(""); + goto exit; + } + } + msleep(200); + DEBUG_PRINT(""); + + /* Read actual tx fault/ tx disable/ rx los status */ + for (i = 0; i < ARRAY_SIZE(reg); i++) { + status = sfp_eeprom_read(client, reg[i], &buf, sizeof(buf)); + if (unlikely(status < 0)) { + DEBUG_PRINT(""); + goto exit; + } + + DEBUG_PRINT("qsfp reg(0x%x) status = (0x%x)", reg[i], data->qsfp->status[i]); + data->qsfp->status[i] = (buf & 0xF); + } + + DEBUG_PRINT(""); + data->qsfp->valid = 1; + data->qsfp->last_updated = jiffies; + +exit: + DEBUG_PRINT(""); + mutex_unlock(&data->update_lock); + return (status < 0) ? ERR_PTR(status) : data; +} + +static ssize_t qsfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + int present; + u8 val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + DEBUG_PRINT(""); + present = sfp_is_port_present(client, data->port); + if (IS_ERR_VALUE(present)) { + return present; + } + + DEBUG_PRINT(""); + if (present == 0) { + /* port is not present */ + return -ENODEV; + } + + DEBUG_PRINT(""); + data = qsfp_update_tx_rx_status(dev); + DEBUG_PRINT(""); + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + DEBUG_PRINT(""); + switch (attr->index) { + case TX_FAULT: + val = !!(data->qsfp->status[2] & 0xF); + break; + case TX_FAULT1: + case TX_FAULT2: + case TX_FAULT3: + case TX_FAULT4: + val = !!(data->qsfp->status[2] & BIT_INDEX(attr->index - TX_FAULT1)); + break; + case TX_DISABLE: + val = data->qsfp->status[1] & 0xF; + break; + case TX_DISABLE1: + case TX_DISABLE2: + case TX_DISABLE3: + case TX_DISABLE4: + val = !!(data->qsfp->status[1] & BIT_INDEX(attr->index - TX_DISABLE1)); + break; + case RX_LOS: + val = !!(data->qsfp->status[0] & 0xF); + break; + case RX_LOS1: + case RX_LOS2: + case RX_LOS3: + case RX_LOS4: + val = !!(data->qsfp->status[0] & BIT_INDEX(attr->index - RX_LOS1)); + break; + default: + break; + } + + DEBUG_PRINT(""); + return sprintf(buf, "%d\n", val); +} + +static ssize_t qsfp_set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + long disable; + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + status = sfp_is_port_present(client, data->port); + if (IS_ERR_VALUE(status)) { + return status; + } + + if (!status) { + /* port is not present */ + return -ENXIO; + } + + status = kstrtol(buf, 10, &disable); + if (status) { + return status; + } + + data = qsfp_update_tx_rx_status(dev); + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + mutex_lock(&data->update_lock); + + if (attr->index == TX_DISABLE) { + data->qsfp->status[1] = disable & 0xF; + } + else {/* TX_DISABLE1 ~ TX_DISABLE4*/ + if (disable) { + data->qsfp->status[1] |= (1 << (attr->index - TX_DISABLE1)); + } + else { + data->qsfp->status[1] &= ~(1 << (attr->index - TX_DISABLE1)); + } + } + + DEBUG_PRINT("index = (%d), status = (0x%x)", attr->index, data->qsfp->status[1]); + status = sfp_eeprom_write(data->client, SFF8436_TX_DISABLE_ADDR, &data->qsfp->status[1], sizeof(data->qsfp->status[1])); + if (unlikely(status < 0)) { + count = status; + } + + mutex_unlock(&data->update_lock); + return count; +} + +static ssize_t sfp_show_ddm_implemented(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + char ddm; + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + status = sfp_is_port_present(client, data->port); + if (IS_ERR_VALUE(status)) { + return status; + } + + if (status == 0) { + /* port is not present */ + return -ENODEV; + } + + status = sfp_eeprom_read(client, SFF8472_DIAG_MON_TYPE_ADDR, &ddm, sizeof(ddm)); + if (unlikely(status < 0)) { + return status; + } + + return sprintf(buf, "%d\n", !!(ddm & SFF8472_DIAG_MON_TYPE_DDM_MASK)); +} + +/* Platform dependent +++ */ +static ssize_t sfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + u8 val = 0, index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + DEBUG_PRINT("driver type = (%d)", data->driver_type); + if (data->driver_type == DRIVER_TYPE_QSFP) { + DEBUG_PRINT(""); + return qsfp_show_tx_rx_status(dev, da, buf); + } + + DEBUG_PRINT(""); + data = sfp_update_tx_rx_status(dev); + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + if(attr->index == RX_LOS_ALL) { + int i = 0; + u8 values[6] = {0}; + + for (i = 0; i < ARRAY_SIZE(values); i++) { + values[i] = (u8)(data->msa->status[2] >> (i * 8)); + } + + /** Return values 1 -> 48 in order */ + return sprintf(buf, "%.2x %.2x %.2x %.2x %.2x %.2x\n", + values[0], values[1], values[2], + values[3], values[4], values[5]); + } + + switch (attr->index) { + case TX_FAULT: + index = 0; + break; + case TX_DISABLE: + index = 1; + break; + case RX_LOS: + index = 2; + break; + default: + break; + } + + val = !!(data->msa->status[index] & BIT_INDEX(data->port)); + return sprintf(buf, "%d\n", val); +} +/* Platform dependent --- */ +static ssize_t sfp_eeprom_write(struct i2c_client *client, u8 command, const char *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int status, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + status = i2c_smbus_write_i2c_block_data(client, command, data_len, data); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + return status; + } + + return data_len; +#else + int status, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_write_byte_data(client, command, *data); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + return status; + } + + return 1; +#endif + + +} + +static ssize_t sfp_port_write(struct sfp_port_data *data, + const char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + return count; + } + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_write(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; +} + + +static ssize_t sfp_bin_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + int present; + struct sfp_port_data *data; + DEBUG_PRINT("%s(%d) offset = (%d), count = (%d)", off, count); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + + present = sfp_is_port_present(data->client, data->port); + if (IS_ERR_VALUE(present)) { + return present; + } + + if (present == 0) { + /* port is not present */ + return -ENODEV; + } + + return sfp_port_write(data, buf, off, count); +} + +static ssize_t sfp_eeprom_read(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int status, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + status = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + goto abort; + } + if (unlikely(status != data_len)) { + status = -EIO; + goto abort; + } + + //result = data_len; + +abort: + return status; +#else + int status, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_read_byte_data(client, command); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "sfp read byte data failed, command(0x%2x), data(0x%2x)\r\n", command, status); + goto abort; + } + + *data = (u8)status; + status = 1; + +abort: + return status; +#endif +} + +static ssize_t sfp_port_read(struct sfp_port_data *data, + char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + DEBUG_PRINT("Count = 0, return"); + return count; + } + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_read(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; + +} + +static ssize_t sfp_bin_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + int present; + struct sfp_port_data *data; + DEBUG_PRINT("offset = (%d), count = (%d)", off, count); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + + present = sfp_is_port_present(data->client, data->port); + if (IS_ERR_VALUE(present)) { + return present; + } + + if (present == 0) { + /* port is not present */ + return -ENODEV; + } + + return sfp_port_read(data, buf, off, count); +} + +static int sfp_sysfs_eeprom_init(struct kobject *kobj, struct bin_attribute *eeprom) +{ + int err; + + sysfs_bin_attr_init(eeprom); + eeprom->attr.name = EEPROM_NAME; + eeprom->attr.mode = S_IWUSR | S_IRUGO; + eeprom->read = sfp_bin_read; + eeprom->write = sfp_bin_write; + eeprom->size = EEPROM_SIZE; + + /* Create eeprom file */ + err = sysfs_create_bin_file(kobj, eeprom); + if (err) { + return err; + } + + return 0; +} + +static int sfp_sysfs_eeprom_cleanup(struct kobject *kobj, struct bin_attribute *eeprom) +{ + sysfs_remove_bin_file(kobj, eeprom); + return 0; +} + +static const struct attribute_group sfp_msa_group = { + .attrs = sfp_msa_attributes, +}; + +static int sfp_i2c_check_functionality(struct i2c_client *client) +{ +#if USE_I2C_BLOCK_READ + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK); +#else + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA); +#endif +} + +static int sfp_msa_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct sfp_msa_data **data) +{ + int status; + struct sfp_msa_data *msa; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + msa = kzalloc(sizeof(struct sfp_msa_data), GFP_KERNEL); + if (!msa) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &sfp_msa_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &msa->eeprom.bin); + if (status) { + goto exit_remove; + } + + *data = msa; + dev_info(&client->dev, "sfp msa '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &sfp_msa_group); +exit_free: + kfree(msa); +exit: + + return status; +} + +static const struct attribute_group sfp_ddm_group = { + .attrs = sfp_ddm_attributes, +}; + +static int sfp_ddm_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct sfp_ddm_data **data) +{ + int status; + struct sfp_ddm_data *ddm; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + ddm = kzalloc(sizeof(struct sfp_ddm_data), GFP_KERNEL); + if (!ddm) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &sfp_ddm_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &ddm->eeprom.bin); + if (status) { + goto exit_remove; + } + + *data = ddm; + dev_info(&client->dev, "sfp ddm '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &sfp_ddm_group); +exit_free: + kfree(ddm); +exit: + + return status; +} + +static const struct attribute_group qsfp_group = { + .attrs = qsfp_attributes, +}; + +static int qsfp_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct qsfp_data **data) +{ + int status; + struct qsfp_data *qsfp; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + qsfp = kzalloc(sizeof(struct qsfp_data), GFP_KERNEL); + if (!qsfp) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &qsfp_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &qsfp->eeprom.bin); + if (status) { + goto exit_remove; + } + + /* Bring QSFPs out of reset */ + as7116_54x_cpld_write(0x62, 0x15, 0x3F); + + *data = qsfp; + dev_info(&client->dev, "qsfp '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &qsfp_group); +exit_free: + kfree(qsfp); +exit: + + return status; +} + +/* Platform dependent +++ */ +static int sfp_device_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct sfp_port_data *data = NULL; + + data = kzalloc(sizeof(struct sfp_port_data), GFP_KERNEL); + if (!data) { + return -ENOMEM; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->port = dev_id->driver_data; + data->client = client; + + if (dev_id->driver_data >= as7116_54x_sfp1 && dev_id->driver_data <= as7116_54x_sfp48) { + if (client->addr == SFP_EEPROM_A0_I2C_ADDR) { + data->driver_type = DRIVER_TYPE_SFP_MSA; + return sfp_msa_probe(client, dev_id, &data->msa); + } + else if (client->addr == SFP_EEPROM_A2_I2C_ADDR) { + data->driver_type = DRIVER_TYPE_SFP_DDM; + return sfp_ddm_probe(client, dev_id, &data->ddm); + } + } + else { /* as7116_54x_sfp49 ~ as7116_54x_sfp54 */ + if (client->addr == SFP_EEPROM_A0_I2C_ADDR) { + data->driver_type = DRIVER_TYPE_QSFP; + return qsfp_probe(client, dev_id, &data->qsfp); + } + } + + return -ENODEV; +} +/* Platform dependent --- */ + +static int sfp_msa_remove(struct i2c_client *client, struct sfp_msa_data *data) +{ + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + sysfs_remove_group(&client->dev.kobj, &sfp_msa_group); + kfree(data); + return 0; +} + +static int sfp_ddm_remove(struct i2c_client *client, struct sfp_ddm_data *data) +{ + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + sysfs_remove_group(&client->dev.kobj, &sfp_ddm_group); + kfree(data); + return 0; +} + +static int qfp_remove(struct i2c_client *client, struct qsfp_data *data) +{ + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + sysfs_remove_group(&client->dev.kobj, &qsfp_group); + kfree(data); + return 0; +} + +static int sfp_device_remove(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + + switch (data->driver_type) { + case DRIVER_TYPE_SFP_MSA: + return sfp_msa_remove(client, data->msa); + case DRIVER_TYPE_SFP_DDM: + return sfp_ddm_remove(client, data->ddm); + case DRIVER_TYPE_QSFP: + return qfp_remove(client, data->qsfp); + } + + return 0; +} + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +static struct i2c_driver sfp_driver = { + .driver = { + .name = DRIVER_NAME, + }, + .probe = sfp_device_probe, + .remove = sfp_device_remove, + .id_table = sfp_device_id, + .address_list = normal_i2c, +}; + +static int __init sfp_init(void) +{ + //extern int platform_accton_as7116_54x(void); + //if (!platform_accton_as7116_54x()) { + // return -ENODEV; + //} + + return i2c_add_driver(&sfp_driver); +} + +static void __exit sfp_exit(void) +{ + i2c_del_driver(&sfp_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton as7116_54x_sfp driver"); +MODULE_LICENSE("GPL"); + +module_init(sfp_init); +module_exit(sfp_exit); + diff --git a/platform/nephos/sonic-platform-modules-accton/as7116-54x/service/as7116-platform-init.service b/platform/nephos/sonic-platform-modules-accton/as7116-54x/service/as7116-platform-init.service new file mode 100755 index 000000000000..be8688d2c2d2 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-accton/as7116-54x/service/as7116-platform-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Accton AS7116-54X Platform initialization service +Before=pmon.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/accton_as7116_util.py install +ExecStop=/usr/local/bin/accton_as7116_util.py clean +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/nephos/sonic-platform-modules-accton/as7116-54x/setup.py b/platform/nephos/sonic-platform-modules-accton/as7116-54x/setup.py new file mode 100644 index 000000000000..bb740409e310 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-accton/as7116-54x/setup.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import os +import sys +from setuptools import setup +os.listdir + +setup( + name='as7116-54x', + version='1.0.0', + description='Module to initialize Accton AS7116-54X platforms', + + packages=['as7116-54x'], + package_dir={'as7116-54x': 'as7116-54x/classes'}, + ) diff --git a/platform/nephos/sonic-platform-modules-accton/as7116-54x/utils/README b/platform/nephos/sonic-platform-modules-accton/as7116-54x/utils/README new file mode 100755 index 000000000000..0b9fc1633999 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-accton/as7116-54x/utils/README @@ -0,0 +1,60 @@ +Copyright (C) 2016 Accton Networks, Inc. + +This program is free software: you can redistribute it and/or modify +It under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +To initialize the system, run "accton_as7712_util.py install". +To clean up the drivers & devices, run "accton_as7712_util.py clean". +To dump information of sensors, run "accton_as7712_util.py show". +To dump SFP EEPROM, run "accton_as7712_util.py sff". +To set fan speed, run "accton_as7712_util.py set fan". +To enable/disable SFP emission, run "accton_as7712_util.py set sfp". +To set system LEDs' color, run "accton_as7712_util.py set led" +For more information, run "accton_as7712_util.py --help". + +==================================================================== +Besides applying accton_as7712_util.py to access peripherals, you can +access peripherals by sysfs nodes directly after the installation is run. + +LED controls can be found under /sys/class/leds. The sysfs interface +color mappings are as follows: +Brightness: + 0 => off + 1 => green + 2 => amber + 3 => red + 4 => blue + +There are 5 system LEDs, loc, diag, fan, ps1, and ps2. +They are lit automatically by CPLD, but the loc and diag. +The loc led has only 1 color, blue. +The diag one has 3 colors: red, amber, and green. + +Fan controls can be found in /sys/bus/i2c/devices/2-0066. +There are 12 fans inside 6 fan modules. +All fans share 1 duty setting, ranged from 0~100. + +Three temperature sensors are controlled by the lm75 kernel modules. +They should already be visible under /sys/bus/i2c/drivers/lm75/. + +Two power supplies are controlled by the CPLD. +Here provide their status under +/sys/bus/i2c/devices/10-0050 and /sys/bus/i2c/devices/11-0053. + +There are 32 QSFP+ modules are equipped. +Apply "accton_as7712_util.py show" to get their status. +Apply "accton_as7712_util.py set sfp" to turn on/off light transmission. +Apply "accton_as7712_util.py sff" to dump EEPROM information. +Before operating on that QSFP+, please make sure it is well plugged. +Otherwise, operation is going to fail. + diff --git a/platform/nephos/sonic-platform-modules-accton/as7116-54x/utils/accton_as7116_util.py b/platform/nephos/sonic-platform-modules-accton/as7116-54x/utils/accton_as7116_util.py new file mode 100755 index 000000000000..17c56f7beb53 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-accton/as7116-54x/utils/accton_as7116_util.py @@ -0,0 +1,518 @@ +#!/usr/bin/env python +# +# Copyright (C) 2016 Accton Networks, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom + set : change board setting with fan|led|sfp +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + + + + +PROJECT_NAME = 'as7116_54x' +version = '0.1.0' +verbose = False +DEBUG = False +args = [] +ALL_DEVICE = {} +DEVICE_NO = {'led':5, 'fan':1, 'thermal':3, 'psu':2, 'sfp':54} +FORCE = 0 +#logging.basicConfig(filename= PROJECT_NAME+'.log', filemode='w',level=logging.DEBUG) +#logging.basicConfig(level=logging.INFO) + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'show': + device_traversal() + elif arg == 'sff': + if len(args)!=2: + show_eeprom_help() + elif int(args[1]) ==0 or int(args[1]) > DEVICE_NO['sfp']: + show_eeprom_help() + else: + show_eeprom(args[1]) + return + elif arg == 'set': + if len(args)<3: + show_set_help() + else: + set_device(args[1:]) + return + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_set_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print cmd +" [led|sfp|fan]" + print " use \""+ cmd + " led 0-4 \" to set led color" + print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" + print " use \""+ cmd + " sfp 1-54 {0|1}\" to set sfp# tx_disable" + sys.exit(0) + +def show_eeprom_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print " use \""+ cmd + " 1-54 \" to dump sfp# eeprom" + sys.exit(0) + +def my_log(txt): + if DEBUG == True: + print "[ROY]"+txt + return + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + my_log (cmd +"with result:" + str(status)) + my_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +def driver_check(): + ret, lsmod = log_os_system("lsmod| grep accton", 0) + logging.info('mods:'+lsmod) + if len(lsmod) ==0: + return False + return True + + + +kos = [ + 'depmod', + 'modprobe i2c_dev', + 'modprobe i2c_mux_pca954x force_deselect_on_exit=1', + 'modprobe x86-64-accton-as7116-54x-cpld' , + 'modprobe x86-64-accton-as7116-54x-fan' , + 'modprobe x86-64-accton-as7116-54x-psu' , + 'modprobe x86-64-accton-as7116-54x-sfp' , + 'modprobe x86-64-accton-as7116-54x-led' ] + +def driver_install(): + global FORCE + for i in range(0,len(kos)): + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + +def driver_uninstall(): + global FORCE + for i in range(0,len(kos)): + rm = kos[-(i+1)].replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + +led_prefix ='/sys/class/leds/'+PROJECT_NAME+'_led::' +hwmon_types = {'led': ['diag','fan','loc','psu1','psu2']} +hwmon_nodes = {'led': ['brightness'] } +hwmon_prefix ={'led': led_prefix} + +i2c_prefix = '/sys/bus/i2c/devices/' +i2c_bus = {'fan': ['1-0063'] , + 'thermal': ['17-004b','19-0049', '20-004a'] , + 'psu': ['10-0050','11-0058'], + 'sfp': ['-0050']} +i2c_nodes = {'fan': ['present', 'front_speed_rpm', 'rear_speed_rpm'] , + 'thermal': ['hwmon/hwmon*/temp1_input'] , + 'psu': ['psu_present ', 'psu_power_good'] , + 'sfp': ['sfp_is_present ', 'sfp_tx_disable_all']} + +sfp_map = [37,38,39,40, + 41,42,43,44,45,46,47,48,49,50, + 51,52,53,54,55,56,57,58,59,60, + 61,62,63,64,65,66,67,68,69,70, + 71,72,73,74,75,76,77,78,79,80, + 81,82,83,84, + 21,22,23,24,25,26] + +mknod =[ + 'echo pca9548 0x77 > /sys/bus/i2c/devices/i2c-0/new_device', + 'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-1/new_device', + 'echo pca9545 0x71 > /sys/bus/i2c/devices/i2c-1/new_device', + 'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-1/new_device', + 'echo as7116_54x_fan 0x63 > /sys/bus/i2c/devices/i2c-1/new_device', + 'echo lm75 0x4b > /sys/bus/i2c/devices/i2c-17/new_device', + 'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-19/new_device', + 'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-20/new_device', + 'echo as7116_54x_cpld1 0x60 > /sys/bus/i2c/devices/i2c-2/new_device', + 'echo as7116_54x_cpld2 0x61 > /sys/bus/i2c/devices/i2c-2/new_device', + 'echo as7116_54x_cpld3 0x62 > /sys/bus/i2c/devices/i2c-2/new_device', + 'echo as7116_54x_psu1 0x50 > /sys/bus/i2c/devices/i2c-10/new_device', + 'echo ym2401 0x58 > /sys/bus/i2c/devices/i2c-10/new_device', + 'echo as7116_54x_psu2 0x53 > /sys/bus/i2c/devices/i2c-11/new_device', + 'echo ym2401 0x5b > /sys/bus/i2c/devices/i2c-11/new_device', + 'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-2/new_device', + 'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-29/new_device', + 'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-30/new_device', + 'echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-31/new_device', + 'echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-32/new_device', + 'echo pca9548 0x75 > /sys/bus/i2c/devices/i2c-33/new_device', + 'echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-34/new_device', + 'echo 24c02 0x56 > /sys/bus/i2c/devices/i2c-0/new_device'] + +def device_install(): + global FORCE + + for i in range(0,len(mknod)): + #for pca954x need times to built new i2c buses + if mknod[i].find('pca954') != -1: + time.sleep(1) + + status, output = log_os_system(mknod[i], 1) + if status: + print output + if FORCE == 0: + return status + + for i in range(0,len(sfp_map)): + status, output =log_os_system("echo as7116_54x_sfp"+str(i+1)+" 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + return + +def device_uninstall(): + global FORCE + + status, output =log_os_system("ls /sys/bus/i2c/devices/1-0077", 0) + + for i in range(0,len(sfp_map)): + target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" + status, output =log_os_system("echo 0x50 > "+ target, 1) + if status: + print output + if FORCE == 0: + return status + + nodelist = mknod + + for i in range(len(nodelist)): + target = nodelist[-(i+1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print output + if FORCE == 0: + return status + + return + +def system_ready(): + if driver_check() == False: + return False + if not device_exist(): + return False + return True + +def do_install(): + print "Checking system...." + if driver_check() == False: + print "No driver, installing...." + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" drivers detected...." + if not device_exist(): + print "No device, installing...." + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" devices detected...." + return + +def do_uninstall(): + print "Checking system...." + if not device_exist(): + print PROJECT_NAME.upper() +" has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_check()== False : + print PROJECT_NAME.upper() +" has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def devices_info(): + global DEVICE_NO + global ALL_DEVICE + global i2c_bus, hwmon_types + for key in DEVICE_NO: + ALL_DEVICE[key]= {} + for i in range(0,DEVICE_NO[key]): + ALL_DEVICE[key][key+str(i+1)] = [] + + for key in i2c_bus: + buses = i2c_bus[key] + nodes = i2c_nodes[key] + for i in range(0,len(buses)): + for j in range(0,len(nodes)): + if 'fan' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ buses[i]+"/fan"+str(k+1)+"_"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + elif 'sfp' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ str(sfp_map[k])+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + else: + node = key+str(i+1) + path = i2c_prefix+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + + for key in hwmon_types: + itypes = hwmon_types[key] + nodes = hwmon_nodes[key] + for i in range(0,len(itypes)): + for j in range(0,len(nodes)): + node = key+"_"+itypes[i] + path = hwmon_prefix[key]+ itypes[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][ key+str(i+1)].append(path) + + #show dict all in the order + if DEBUG == True: + for i in sorted(ALL_DEVICE.keys()): + print(i+": ") + for j in sorted(ALL_DEVICE[i].keys()): + print(" "+j) + for k in (ALL_DEVICE[i][j]): + print(" "+" "+k) + return + +def show_eeprom(index): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + node = ALL_DEVICE['sfp'] ['sfp'+str(index)][0] + node = node.replace(node.split("/")[-1], 'sfp_eeprom') + # check if got hexdump command in current environment + ret, log = log_os_system("which hexdump", 0) + ret, log2 = log_os_system("which busybox hexdump", 0) + if len(log): + hex_cmd = 'hexdump' + elif len(log2): + hex_cmd = ' busybox hexdump' + else: + log = 'Failed : no hexdump cmd!!' + logging.info(log) + print log + return 1 + + print node + ":" + ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) + if ret==0: + print log + else: + print "**********device no found**********" + return + +def set_device(args): + global DEVICE_NO + global ALL_DEVICE + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + + if args[0]=='led': + if int(args[1])>4: + show_set_help() + return + #print ALL_DEVICE['led'] + for i in range(0,len(ALL_DEVICE['led'])): + for k in (ALL_DEVICE['led']['led'+str(i+1)]): + ret, log = log_os_system("echo "+args[1]+" >"+k, 1) + if ret: + return ret + elif args[0]=='fan': + if int(args[1])>100: + show_set_help() + return + #print ALL_DEVICE['fan'] + #fan1~6 is all fine, all fan share same setting + node = ALL_DEVICE['fan'] ['fan1'][0] + node = node.replace(node.split("/")[-1], 'fan_duty_cycle_percentage') + ret, log = log_os_system("cat "+ node, 1) + if ret==0: + print ("Previous fan duty: " + log.strip() +"%") + ret, log = log_os_system("echo "+args[1]+" >"+node, 1) + if ret==0: + print ("Current fan duty: " + args[1] +"%") + return ret + elif args[0]=='sfp': + if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: + show_set_help() + return + if len(args)<2: + show_set_help() + return + + if int(args[2])>1: + show_set_help() + return + + #print ALL_DEVICE[args[0]] + for i in range(0,len(ALL_DEVICE[args[0]])): + for j in ALL_DEVICE[args[0]][args[0]+str(args[1])]: + if j.find('tx_disable')!= -1: + ret, log = log_os_system("echo "+args[2]+" >"+ j, 1) + if ret: + return ret + + return + +#get digits inside a string. +#Ex: 31 for "sfp31" +def get_value(input): + digit = re.findall('\d+', input) + return int(digit[0]) + +def device_traversal(): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + for i in sorted(ALL_DEVICE.keys()): + print("============================================") + print(i.upper()+": ") + print("============================================") + + for j in sorted(ALL_DEVICE[i].keys(), key=get_value): + print " "+j+":", + for k in (ALL_DEVICE[i][j]): + ret, log = log_os_system("cat "+k, 0) + func = k.split("/")[-1].strip() + func = re.sub(j+'_','',func,1) + func = re.sub(i.lower()+'_','',func,1) + if ret==0: + print func+"="+log+" ", + else: + print func+"="+"X"+" ", + print + print("----------------------------------------------------------------") + + + print + return + +def device_exist(): + ret1, log = log_os_system("ls "+i2c_prefix+"*0077", 0) + ret2, log = log_os_system("ls "+i2c_prefix+"i2c-2", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() diff --git a/platform/nephos/sonic-platform-modules-accton/debian/changelog b/platform/nephos/sonic-platform-modules-accton/debian/changelog new file mode 100755 index 000000000000..49f8f44bca48 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-accton/debian/changelog @@ -0,0 +1,6 @@ +sonic-accton-platform-modules (1.0.0) unstable; urgency=low + + * Add support for AS7116-54X series + + -- developer Wed, 29 Mar 2017 11:00:00 +0800 + diff --git a/platform/nephos/sonic-platform-modules-accton/debian/compat b/platform/nephos/sonic-platform-modules-accton/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-accton/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/nephos/sonic-platform-modules-accton/debian/control b/platform/nephos/sonic-platform-modules-accton/debian/control new file mode 100755 index 000000000000..e1a403b3a719 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-accton/debian/control @@ -0,0 +1,11 @@ +Source: sonic-accton-platform-modules +Section: main +Priority: extra +Maintainer: simon.ji@nephosinc.com +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: sonic-platform-accton-as7116-54x +Architecture: amd64 +Depends: linux-image-3.16.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/nephos/sonic-platform-modules-accton/debian/rules b/platform/nephos/sonic-platform-modules-accton/debian/rules new file mode 100755 index 000000000000..cb232bd42425 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-accton/debian/rules @@ -0,0 +1,86 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +include /usr/share/dpkg/pkg-info.mk + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +export INSTALL_MOD_DIR:=extra + +PYTHON ?= python2 + +PACKAGE_PRE_NAME := sonic-platform-accton +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MOD_SRC_DIR:= $(shell pwd) +MODULE_DIRS:= as7116-54x +MODULE_DIR := modules +UTILS_DIR := utils +SERVICE_DIR := service +CLASSES_DIR := classes +CONF_DIR := conf + +%: + dh $@ --with systemd,python2,python3 --buildsystem=pybuild + +clean: + dh_testdir + dh_testroot + dh_clean + +build: + #make modules -C $(KERNEL_SRC)/build M=$(MODULE_SRC) + (for mod in $(MODULE_DIRS); do \ + make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ + $(PYTHON) $${mod}/setup.py build; \ + done) + +binary: binary-arch binary-indep + # Nothing to do + +binary-arch: + # Nothing to do + +#install: build + #dh_testdir + #dh_testroot + #dh_clean -k + #dh_installdirs + +binary-indep: + dh_testdir + dh_installdirs + + # Custom package commands + (for mod in $(MODULE_DIRS); do \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin; \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system; \ + cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \ + cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ + $(PYTHON) $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \ + done) + # Resuming debhelper scripts + dh_testroot + dh_install + dh_installchangelogs + dh_installdocs + dh_systemd_enable + dh_installinit + dh_systemd_start + dh_link + dh_fixperms + dh_compress + dh_strip + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb +.PHONY: build binary binary-arch binary-indep clean From ed915e342adbce38fd46fddb147e31935d41f656 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Tue, 3 Apr 2018 11:24:59 +0800 Subject: [PATCH 093/274] [build templates] Add environment variables for mellanox syncd container to support mellanox sdk and prm sniffer. (#1551) modified: files/build_templates/docker_image_ctl.j2 Signed-off-by: Kebo Liu kebol@mellanox.com --- files/build_templates/docker_image_ctl.j2 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 6592e9ed173d..b17c70b4a9d2 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -63,6 +63,13 @@ start() { docker run -d {{docker_image_run_opt}} \ {%- if '--log-driver=json-file' in docker_image_run_opt or '--log-driver' not in docker_image_run_opt %} --log-opt max-size=2M --log-opt max-file=5 \ +{%- endif %} +{%- if docker_container_name == "syncd" and sonic_asic_platform == "mellanox" %} + -e SX_SNIFFER_ENABLE \ + -e SX_SNIFFER_TARGET \ + -e PRM_SNIFFER \ + -e PRM_SNIFFER_FILE_PATH \ + -v /var/log/mellanox/sniffer:/var/log/mellanox/sniffer:rw \ {%- endif %} -v /var/run/redis:/var/run/redis:rw \ -v /usr/share/sonic/device/$PLATFORM:/usr/share/sonic/platform:ro \ From 099635652165eedc67ff78c85a041422af316993 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 4 Apr 2018 22:01:31 -0700 Subject: [PATCH 094/274] [installer]: Suppress tar xz warning about time stamp in the future, if date is not correctly set (#1560) Signed-off-by: Qi Luo --- installer/x86_64/install.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 825e4636d0af..cfa008d8b349 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -446,7 +446,11 @@ fi # Decompress the file for the file system directly to the partition unzip -o $ONIE_INSTALLER_PAYLOAD -x "$FILESYSTEM_DOCKERFS" -d $demo_mnt/$image_dir -TAR_EXTRA_OPTION="--numeric-owner" +if [ "$install_env" != "build" ]; then + TAR_EXTRA_OPTION="--numeric-owner" +else + TAR_EXTRA_OPTION="--numeric-owner --warning=no-timestamp" +fi mkdir -p $demo_mnt/$image_dir/$DOCKERFS_DIR unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR From 1051d82ebc151dca44fb4176b592f29c85db2dba Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 4 Apr 2018 23:22:57 -0700 Subject: [PATCH 095/274] Revert "[installer]: Suppress tar xz warning about time stamp in the future, if date is not correctly set (#1560)" (#1561) This reverts commit 099635652165eedc67ff78c85a041422af316993. --- installer/x86_64/install.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index cfa008d8b349..825e4636d0af 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -446,11 +446,7 @@ fi # Decompress the file for the file system directly to the partition unzip -o $ONIE_INSTALLER_PAYLOAD -x "$FILESYSTEM_DOCKERFS" -d $demo_mnt/$image_dir -if [ "$install_env" != "build" ]; then - TAR_EXTRA_OPTION="--numeric-owner" -else - TAR_EXTRA_OPTION="--numeric-owner --warning=no-timestamp" -fi +TAR_EXTRA_OPTION="--numeric-owner" mkdir -p $demo_mnt/$image_dir/$DOCKERFS_DIR unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR From 4754b43d7c3ed16399d60c0baa8c7c820509675c Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 4 Apr 2018 23:42:11 -0700 Subject: [PATCH 096/274] [installer]: Suppress tar xz warning about time stamp in the future, if date is not correctly set (#1562) Signed-off-by: Qi Luo --- installer/x86_64/install.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 825e4636d0af..949c052acb89 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -446,7 +446,11 @@ fi # Decompress the file for the file system directly to the partition unzip -o $ONIE_INSTALLER_PAYLOAD -x "$FILESYSTEM_DOCKERFS" -d $demo_mnt/$image_dir -TAR_EXTRA_OPTION="--numeric-owner" +if [ "$install_env" = "onie" ]; then + TAR_EXTRA_OPTION="--numeric-owner" +else + TAR_EXTRA_OPTION="--numeric-owner --warning=no-timestamp" +fi mkdir -p $demo_mnt/$image_dir/$DOCKERFS_DIR unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR From e6015d89a7701cee677fff9b411fb7a8d43b8953 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 6 Apr 2018 05:55:17 -0700 Subject: [PATCH 097/274] [sonic-platform-common] Update submodule (#1563) - Includes the following commits: - [bcmshell.py] Match extra whitespace before prompt in regex (#3) - add support for qsfp28 eeprom (#2) --- src/sonic-platform-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-platform-common b/src/sonic-platform-common index 0581611b7be5..560b465cb516 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit 0581611b7be5cc52aea2877199785fe72f759a58 +Subproject commit 560b465cb5166d0ad0c56312292bba990a122419 From ac2861e6d732a737e88c05099707606ec6f516c6 Mon Sep 17 00:00:00 2001 From: byu343 Date: Fri, 6 Apr 2018 10:48:13 -0700 Subject: [PATCH 098/274] [Arista] Set MAC address of mangement port in initramfs (#1565) * Set MAC address of mangement port in initramfs * Fix boot0 for running in none-aboot environment --- files/Aboot/boot0.j2 | 7 +++- files/initramfs-tools/arista-net | 66 ++++++++++++++++++++++++++++---- 2 files changed, 64 insertions(+), 9 deletions(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 435781a77485..5ed75852cb93 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -206,8 +206,7 @@ write_boot_configs() { elif [ ! -f "$cmdline_base" ]; then # some systems were started with other versions of this script and therefore # do not have the $cmdline_base file. we assume that we are on Sonic or EOS. - cat /proc/cmdline > $cmdline_base - sed -Ei 's/^(.*) rw .*$/\1/' $cmdline_base + cat /proc/cmdline | sed -E 's/^(.*) rw .*$/\1/' | tr ' ' '\n' > $cmdline_base fi cp $cmdline_base /tmp/append @@ -215,6 +214,10 @@ write_boot_configs() { platform_specific echo "rw loop=$image_name/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor quiet" >> /tmp/append + # Pass the MAC address to the new kernel as a command line parameter. This makes it + # possible to restore the MAC address in the new kernel without requiring driver modifications. + [ "${NETDEV}" ] || NETDEV=ma1 + echo "hwaddr_${NETDEV}=$(cat /sys/class/net/${NETDEV}/address)" >> /tmp/append # use extra parameters from kernel-params hook if the file exists if [ -f "$target_path/$kernel_params" ]; then diff --git a/files/initramfs-tools/arista-net b/files/initramfs-tools/arista-net index 1fbe4838adf5..8759746458d6 100644 --- a/files/initramfs-tools/arista-net +++ b/files/initramfs-tools/arista-net @@ -26,19 +26,71 @@ for x in "$@"; do esac done +random() { + echo $(od -vAn -N1 -tu1 < /dev/urandom) +} + +arista_net_devname() { + local pciaddr="$1" + local devname_prefix="$2" + for path in $(ls -d /sys/class/net/${devname_prefix}* 2>/dev/null); do + local devid="$(realpath "$path/device")" + if echo "$devid" | grep -q "$pciaddr"; then + echo "${path##*/}" + return + fi + done +} + arista_net_rename() { local device_path="$1" local new_name="$2" local from_name="$3" - for path in $(ls -d /sys/class/net/$from_name* 2>/dev/null); do - local devid="$(realpath "$path/device")" - if echo "$devid" | grep -q "$device_path"; then - local cur_name="${path##*/}" - ip link set "$cur_name" name "$new_name" - return + devname=$(arista_net_devname "$device_path" "$from_name") + [ -n "$devname" ] && ip link set "$devname" name "$new_name" +} + +# Sets the MAC address to the value passed by Aboot through /proc/cmdline +tg3fixhwaddr() +{ + local default_tg3_hwaddr="00:10:18:00:00:00" + local pciaddr="$1" + local hwaddr="$2" + + devname=$(arista_net_devname "$pciaddr") + if [ -z "$devname" ]; then + return + fi + + driver=$(basename $(readlink "/sys/class/net/$devname/device/driver")) + if [ "$driver" != "tg3" ]; then + return 0 + fi + + if [ "$hwaddr" = "$default_tg3_hwaddr" ]; then + hwaddr=$(cat /sys/class/net/$devname/address) + fi + + if [ "$hwaddr" = "$default_tg3_hwaddr" ]; then + hwaddr=$(printf "%02x" "$(($(random) & 0xfe | 0x02))") + for i in 1 2 3 4 5; do + hwaddr=$(printf "$hwaddr:%02x" "$(($(random) & 0xfe | 0x02))") + done + fi + + ip link set dev "$devname" addr "$hwaddr" +} + +if [ -n "$aboot_flag" ]; then + for item in $items; do + key="${item%=*}" + value="${item#*=}" + hwaddr=$(eval echo \${hwaddr_${key}}) + if [ -n "$hwaddr" ]; then + tg3fixhwaddr "$value" "$hwaddr" fi done -} +fi # Iterate over all the net_maX items found in the cmdline two times. # First time renaming the interfaces to maX. From 30466b27c1b096998d2e30c72f49adfb48d662e3 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 6 Apr 2018 19:24:18 -0700 Subject: [PATCH 099/274] [router advertiser] Only start radvd process if device role is 'ToRRouter' (#1569) --- .../docker-router-advertiser.supervisord.conf | 1 + dockers/docker-router-advertiser/start.sh | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf b/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf index 08a3e0a94872..f0bb4d5b3bbd 100644 --- a/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf +++ b/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf @@ -8,6 +8,7 @@ command=/usr/bin/start.sh priority=1 autostart=true autorestart=false +startsecs=0 stdout_logfile=syslog stderr_logfile=syslog diff --git a/dockers/docker-router-advertiser/start.sh b/dockers/docker-router-advertiser/start.sh index cbd5ec383bd6..7fcaf65a79c9 100755 --- a/dockers/docker-router-advertiser/start.sh +++ b/dockers/docker-router-advertiser/start.sh @@ -1,11 +1,18 @@ #!/usr/bin/env bash -# Generate /etc/radvd.conf config file -sonic-cfggen -d -t /usr/share/sonic/templates/radvd.conf.j2 > /etc/radvd.conf - rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd +# Router advertiser should only run on ToR (T0) devices +DEVICE_ROLE=$(sonic-cfggen -d -v "DEVICE_METADATA.localhost.type") +if [ "$DEVICE_ROLE" != "ToRRouter" ]; then + echo "Device role is not ToRRouter. Not starting router advertiser process." + exit 0 +fi + +# Generate /etc/radvd.conf config file +sonic-cfggen -d -t /usr/share/sonic/templates/radvd.conf.j2 > /etc/radvd.conf + # Start the router advertiser supervisorctl start radvd From 5a47b81c4b10b9fb4a6e1c1e54853863c8e3858a Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 7 Apr 2018 10:19:55 -0700 Subject: [PATCH 100/274] [submodules]: update sonic-swss (#1570) Signed-off-by: Guohan Lu --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index e217519c20c6..d711d2cf5783 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit e217519c20c60f7cf4e24688dd3eca6d380a1dd6 +Subproject commit d711d2cf57839589aa7d6653b252305c31f8c2b0 From 4d3f44bc3280cdb536adcc8020792f585db3faac Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 7 Apr 2018 15:50:37 -0700 Subject: [PATCH 101/274] [submodules]: update sonic-utilities (#1571) Signed-off-by: Guohan Lu --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 68c3fbf79738..3f2d7bb4beaf 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 68c3fbf79738253ca5b1c8f225152a1cab55c5a1 +Subproject commit 3f2d7bb4beaf3987db0c3e6fb57ae7ba51390a16 From af0013e93904edc7b1b854c2d3599a28013f9787 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 9 Apr 2018 16:41:51 -0700 Subject: [PATCH 102/274] [cfggen]: ignore acl when its type is not defined (#1568) Signed-off-by: Guohan Lu --- src/sonic-config-engine/minigraph.py | 14 +++++++++----- .../tests/t0-sample-graph.xml | 14 ++++++++++++++ src/sonic-config-engine/tests/test_cfggen.py | 18 ++++++++++++------ 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index f989129a439e..fb098cee3268 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -207,11 +207,15 @@ def parse_dpg(dpg, hname): 'type': 'MIRROR' if is_mirror else 'L3'} else: # This ACL has no interfaces to attach to -- consider this a control plane ACL - aclservice = aclintf.find(str(QName(ns, "Type"))).text - acls[aclname] = {'policy_desc': aclname, - 'ports': acl_intfs, - 'type': 'CTRLPLANE', - 'service': aclservice if aclservice is not None else 'UNKNOWN'} + try: + aclservice = aclintf.find(str(QName(ns, "Type"))).text + acls[aclname] = {'policy_desc': aclname, + 'ports': acl_intfs, + 'type': 'CTRLPLANE', + 'service': aclservice if aclservice is not None else 'UNKNOWN'} + except: + print >> sys.stderr, "Warning: Ingore Control Plane ACL %s without type" % aclname + return intfs, lo_intfs, mgmt_intf, vlans, vlan_members, pcs, acls return None, None, None, None, None, None, None diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index f3d05cbc22c1..a12605c8c3e1 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -271,6 +271,20 @@ SNMP_ACL SNMP + + NTP + NTP_ACL + NTP + + + SSH + SSH_ACL + SSH + + + NTP + NTP_ACL + diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index d187cfd26b8b..64162e49417e 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -16,9 +16,13 @@ def setUp(self): self.sample_device_desc = os.path.join(self.test_dir, 'device.xml') self.port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini') - def run_script(self, argument): + def run_script(self, argument, check_stderr=False): print '\n Running sonic-cfggen ' + argument - output = subprocess.check_output(self.script_file + ' ' + argument, shell=True) + if check_stderr: + output = subprocess.check_output(self.script_file + ' ' + argument, stderr=subprocess.STDOUT, shell=True) + else: + output = subprocess.check_output(self.script_file + ' ' + argument, shell=True) + linecount = output.strip().count('\n') if linecount <= 0: print ' Output: ' + output.strip() @@ -73,10 +77,12 @@ def test_render_template(self): def test_minigraph_acl(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v ACL_TABLE' - output = self.run_script(argument) - self.assertEqual(output.strip(), "{'SNMP_ACL': {'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL', 'service': 'SNMP', 'ports': []}," - " 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") - + output = self.run_script(argument, True) + self.assertEqual(output.strip(), "Warning: Ingore Control Plane ACL NTP_ACL without type\n" + "{'SSH_ACL': {'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL', 'service': 'SSH', 'ports': []}," + " 'SNMP_ACL': {'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL', 'service': 'SNMP', 'ports': []}," + " 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}," + " 'NTP_ACL': {'type': 'CTRLPLANE', 'policy_desc': 'NTP_ACL', 'service': 'NTP', 'ports': []}}") def test_minigraph_everflow(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v MIRROR_SESSION' output = self.run_script(argument) From c29def6379a1aad5d228e217bb533784ce6cb5fd Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 9 Apr 2018 23:51:43 -0700 Subject: [PATCH 103/274] [installer]: Umount before delete partition (#1575) Signed-off-by: Qi Luo --- installer/x86_64/install.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 949c052acb89..91dd57a74ba1 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -163,11 +163,21 @@ create_demo_gpt_partition() while read -r part_index; do if [ "$blk_dev$part_index" = "$cur_part" ]; then continue; fi echo "deleting partition $part_index ..." + # if the partition is already mounted, umount first + df $blk_dev$part_index 2>/dev/null && { + umount $blk_dev$part_index || { + echo "Error: Unable to umount $blk_dev$part_index" + exit 1 + } + } sgdisk -d $part_index $blk_dev || { echo "Error: Unable to delete partition $part_index on $blk_dev" exit 1 } - partprobe + partprobe || { + echo "Error: Unable to partprobe" + exit 1 + } done < $tmpfifo fi From 2f53bcf8be524dd4f64001b4a42ba0d2366209fa Mon Sep 17 00:00:00 2001 From: simonJi2018 <37395146+simonJi2018@users.noreply.github.com> Date: Wed, 11 Apr 2018 00:43:26 +0800 Subject: [PATCH 104/274] [platform/nephos]add makefile for 7116 board (#1572) --- platform/nephos/platform-modules-accton.mk | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 platform/nephos/platform-modules-accton.mk diff --git a/platform/nephos/platform-modules-accton.mk b/platform/nephos/platform-modules-accton.mk new file mode 100644 index 000000000000..110d0f3a5a11 --- /dev/null +++ b/platform/nephos/platform-modules-accton.mk @@ -0,0 +1,11 @@ +# Accton AS7116 54X Platform modules + +ACCTON_AS7116_54X_PLATFORM_MODULE_VERSION = 1.0.0 + +export ACCTON_AS7116_54X_PLATFORM_MODULE_VERSION + +ACCTON_AS7116_54X_PLATFORM_MODULE = sonic-platform-accton-as7116-54x_$(ACCTON_AS7116_54X_PLATFORM_MODULE_VERSION)_amd64.deb +$(ACCTON_AS7116_54X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-accton +$(ACCTON_AS7116_54X_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(ACCTON_AS7116_54X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7116_54x-r0 +SONIC_DPKG_DEBS += $(ACCTON_AS7116_54X_PLATFORM_MODULE) From 83f81c9676441d88d7a07dc6bcc6510532a77f97 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 10 Apr 2018 13:37:46 -0700 Subject: [PATCH 105/274] Use eth0 interface only to generate lldpd SystemId (#1577) --- dockers/docker-lldp-sv2/supervisord.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-lldp-sv2/supervisord.conf b/dockers/docker-lldp-sv2/supervisord.conf index 60334e1b8ede..e8022a9a5fa6 100644 --- a/dockers/docker-lldp-sv2/supervisord.conf +++ b/dockers/docker-lldp-sv2/supervisord.conf @@ -25,7 +25,7 @@ stderr_logfile=syslog # - `-dd` means to stay in foreground, log warnings to console # - `-ddd` means to stay in foreground, log warnings and info to console # - `-dddd` means to stay in foreground, log all to console -command=/usr/sbin/lldpd -d -I Ethernet*,eth* +command=/usr/sbin/lldpd -d -I Ethernet*,eth* -C eth0 priority=3 autostart=false autorestart=false From c626dc921f200c97ce7435e34332658f903cfca7 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 10 Apr 2018 18:14:12 -0700 Subject: [PATCH 106/274] Allow one Service ACL to bind to multiple services (#1576) * [caclmgrd] Also ignore IP protocol if found in rule; we will only use our predefined protocols --- dockers/docker-snmp-sv2/snmpd-config-updater | 4 +- files/image_config/caclmgrd/caclmgrd | 138 +++++++++--------- files/image_config/ssh/sshd-config-updater | 2 +- src/sonic-config-engine/minigraph.py | 24 ++- .../tests/t0-sample-graph.xml | 10 ++ src/sonic-config-engine/tests/test_cfggen.py | 10 +- src/sonic-utilities | 2 +- 7 files changed, 106 insertions(+), 84 deletions(-) diff --git a/dockers/docker-snmp-sv2/snmpd-config-updater b/dockers/docker-snmp-sv2/snmpd-config-updater index 10c2a2b57ef3..ea837e5a787f 100755 --- a/dockers/docker-snmp-sv2/snmpd-config-updater +++ b/dockers/docker-snmp-sv2/snmpd-config-updater @@ -48,8 +48,8 @@ class ConfigUpdater(object): if table_data["type"] != self.ACL_TABLE_TYPE_CTRLPLANE: continue - # Ignore non-SSH service ACLs - if table_data["service"] != self.ACL_SERVICE_SNMP: + # Ignore non-SNMP service ACLs + if self.ACL_SERVICE_SNMP not in table_data["services"]: continue acl_rules = {} diff --git a/files/image_config/caclmgrd/caclmgrd b/files/image_config/caclmgrd/caclmgrd index a61c2437a5b7..dee85d2e26ed 100755 --- a/files/image_config/caclmgrd/caclmgrd +++ b/files/image_config/caclmgrd/caclmgrd @@ -123,80 +123,76 @@ class ControlPlaneAclManager(object): if table_data["type"] != self.ACL_TABLE_TYPE_CTRLPLANE: continue - acl_service = table_data["service"] + acl_services = table_data["services"] - if acl_service not in self.ACL_SERVICES: - log_warning("Ignoring control plane ACL '{}' with unrecognized service '{}'" - .format(table_name, acl_service)) - continue - - log_info("Translating ACL rules for control plane ACL '{}' (service: '{}')" - .format(table_name, acl_service)) - - # Obtain default IP protocol(s) and destination port(s) for this service - ip_protocols = self.ACL_SERVICES[acl_service]["ip_protocols"] - dst_ports = self.ACL_SERVICES[acl_service]["dst_ports"] - - acl_rules = {} - - for ((rule_table_name, rule_id), rule_props) in self._rules_db_info.iteritems(): - if rule_table_name == table_name: - acl_rules[rule_props["PRIORITY"]] = rule_props - - # For each ACL rule in this table (in descending order of priority) - for priority in sorted(acl_rules.iterkeys(), reverse=True): - rule_props = acl_rules[priority] - - if "PACKET_ACTION" not in rule_props: - log_error("ACL rule does not contain PACKET_ACTION property") + for acl_service in acl_services: + if acl_service not in self.ACL_SERVICES: + log_warning("Ignoring control plane ACL '{}' with unrecognized service '{}'" + .format(table_name, acl_service)) continue - # If the rule contains an IP protocol, we will use it. - # Otherwise, we will apply the rule to the default - # protocol(s) for this ACL service - if "IP_PROTOCOL" in rule_props: - ip_protocols = [rule_props["IP_PROTOCOL"]] - - for ip_protocol in ip_protocols: - for dst_port in dst_ports: - rule_cmd = "iptables -A INPUT -p {}".format(ip_protocol) - - if "SRC_IP" in rule_props and rule_props["SRC_IP"]: - rule_cmd += " -s {}".format(rule_props["SRC_IP"]) - - rule_cmd += " --dport {}".format(dst_port) - - # If there are TCP flags present, append them - if "TCP_FLAGS" in rule_props and rule_props["TCP_FLAGS"]: - tcp_flags = int(rule_props["TCP_FLAGS"], 16) - - if tcp_flags > 0: - rule_cmd += " --tcp-flags " - - if tcp_flags & 0x01: - rule_cmd += "FIN," - if tcp_flags & 0x02: - rule_cmd += "SYN," - if tcp_flags & 0x04: - rule_cmd += "RST," - if tcp_flags & 0x08: - rule_cmd += "PSH," - if tcp_flags & 0x10: - rule_cmd += "ACK," - if tcp_flags & 0x20: - rule_cmd += "URG," - if tcp_flags & 0x40: - rule_cmd += "ECE," - if tcp_flags & 0x80: - rule_cmd += "CWR," - - # Delete the trailing comma - rule_cmd = rule_cmd[:-1] - - # Append the packet action as the jump target - rule_cmd += " -j {}".format(rule_props["PACKET_ACTION"]) - - iptables_cmds.append(rule_cmd) + log_info("Translating ACL rules for control plane ACL '{}' (service: '{}')" + .format(table_name, acl_service)) + + # Obtain default IP protocol(s) and destination port(s) for this service + ip_protocols = self.ACL_SERVICES[acl_service]["ip_protocols"] + dst_ports = self.ACL_SERVICES[acl_service]["dst_ports"] + + acl_rules = {} + + for ((rule_table_name, rule_id), rule_props) in self._rules_db_info.iteritems(): + if rule_table_name == table_name: + acl_rules[rule_props["PRIORITY"]] = rule_props + + # For each ACL rule in this table (in descending order of priority) + for priority in sorted(acl_rules.iterkeys(), reverse=True): + rule_props = acl_rules[priority] + + if "PACKET_ACTION" not in rule_props: + log_error("ACL rule does not contain PACKET_ACTION property") + continue + + # Apply the rule to the default protocol(s) for this ACL service + for ip_protocol in ip_protocols: + for dst_port in dst_ports: + rule_cmd = "iptables -A INPUT -p {}".format(ip_protocol) + + if "SRC_IP" in rule_props and rule_props["SRC_IP"]: + rule_cmd += " -s {}".format(rule_props["SRC_IP"]) + + rule_cmd += " --dport {}".format(dst_port) + + # If there are TCP flags present, append them + if "TCP_FLAGS" in rule_props and rule_props["TCP_FLAGS"]: + tcp_flags = int(rule_props["TCP_FLAGS"], 16) + + if tcp_flags > 0: + rule_cmd += " --tcp-flags " + + if tcp_flags & 0x01: + rule_cmd += "FIN," + if tcp_flags & 0x02: + rule_cmd += "SYN," + if tcp_flags & 0x04: + rule_cmd += "RST," + if tcp_flags & 0x08: + rule_cmd += "PSH," + if tcp_flags & 0x10: + rule_cmd += "ACK," + if tcp_flags & 0x20: + rule_cmd += "URG," + if tcp_flags & 0x40: + rule_cmd += "ECE," + if tcp_flags & 0x80: + rule_cmd += "CWR," + + # Delete the trailing comma + rule_cmd = rule_cmd[:-1] + + # Append the packet action as the jump target + rule_cmd += " -j {}".format(rule_props["PACKET_ACTION"]) + + iptables_cmds.append(rule_cmd) return iptables_cmds diff --git a/files/image_config/ssh/sshd-config-updater b/files/image_config/ssh/sshd-config-updater index ad1ee000febe..5f7a4ce17f98 100755 --- a/files/image_config/ssh/sshd-config-updater +++ b/files/image_config/ssh/sshd-config-updater @@ -49,7 +49,7 @@ class ConfigUpdater(object): continue # Ignore non-SSH service ACLs - if table_data["service"] != self.ACL_SERVICE_SSH: + if self.ACL_SERVICE_SSH not in table_data["services"]: continue acl_rules = {} diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index fb098cee3268..731f449ab028 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -188,6 +188,10 @@ def parse_dpg(dpg, hname): aclattach = aclintf.find(str(QName(ns, "AttachTo"))).text.split(';') acl_intfs = [] is_mirror = False + + # TODO: Ensure that acl_intfs will only ever contain front-panel interfaces (e.g., + # maybe we should explicity ignore management and loopback interfaces?) because we + # decide an ACL is a Control Plane ACL if acl_intfs is empty below. for member in aclattach: member = member.strip() if pcs.has_key(member): @@ -209,12 +213,22 @@ def parse_dpg(dpg, hname): # This ACL has no interfaces to attach to -- consider this a control plane ACL try: aclservice = aclintf.find(str(QName(ns, "Type"))).text - acls[aclname] = {'policy_desc': aclname, - 'ports': acl_intfs, - 'type': 'CTRLPLANE', - 'service': aclservice if aclservice is not None else 'UNKNOWN'} + + # If we already have an ACL with this name and this ACL is bound to a different service, + # append the service to our list of services + if aclname in acls: + if acls[aclname]['type'] != 'CTRLPLANE': + print >> sys.stderr, "Warning: ACL '%s' type mismatch. Not updating ACL." % aclname + elif acls[aclname]['services'] == aclservice: + print >> sys.stderr, "Warning: ACL '%s' already contains service '%s'. Not updating ACL." % (aclname, aclservice) + else: + acls[aclname]['services'].append(aclservice) + else: + acls[aclname] = {'policy_desc': aclname, + 'type': 'CTRLPLANE', + 'services': [aclservice]} except: - print >> sys.stderr, "Warning: Ingore Control Plane ACL %s without type" % aclname + print >> sys.stderr, "Warning: Ignoring Control Plane ACL %s without type" % aclname return intfs, lo_intfs, mgmt_intf, vlans, vlan_members, pcs, acls return None, None, None, None, None, None, None diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index a12605c8c3e1..bda5517771e5 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -281,6 +281,16 @@ SSH_ACL SSH + + SSH + ROUTER-PROTECT + SSH + + + SNMP + ROUTER-PROTECT + SNMP + NTP NTP_ACL diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 64162e49417e..6059798cbd6e 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -78,11 +78,13 @@ def test_render_template(self): def test_minigraph_acl(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v ACL_TABLE' output = self.run_script(argument, True) - self.assertEqual(output.strip(), "Warning: Ingore Control Plane ACL NTP_ACL without type\n" - "{'SSH_ACL': {'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL', 'service': 'SSH', 'ports': []}," - " 'SNMP_ACL': {'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL', 'service': 'SNMP', 'ports': []}," + self.assertEqual(output.strip(), "Warning: Ignoring Control Plane ACL NTP_ACL without type\n" + "{'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL'}," + " 'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL'}," " 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}," - " 'NTP_ACL': {'type': 'CTRLPLANE', 'policy_desc': 'NTP_ACL', 'service': 'NTP', 'ports': []}}") + " 'NTP_ACL': {'services': ['NTP'], 'type': 'CTRLPLANE', 'policy_desc': 'NTP_ACL'}," + " 'ROUTER_PROTECT': {'services': ['SSH', 'SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'ROUTER_PROTECT'}}") + def test_minigraph_everflow(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v MIRROR_SESSION' output = self.run_script(argument) diff --git a/src/sonic-utilities b/src/sonic-utilities index 3f2d7bb4beaf..5e476d6d549c 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 3f2d7bb4beaf3987db0c3e6fb57ae7ba51390a16 +Subproject commit 5e476d6d549cf40b68e86ae01dcb703b567b85e3 From 27e57c06abfe1a20367a04a4a619d0bb7770b1dd Mon Sep 17 00:00:00 2001 From: byu343 Date: Tue, 10 Apr 2018 20:14:45 -0700 Subject: [PATCH 107/274] [devices]: Fix the issue of ma1 not found in boot0 for Arista (#1579) --- files/Aboot/boot0.j2 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 5ed75852cb93..ee77746676e0 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -216,8 +216,13 @@ write_boot_configs() { # Pass the MAC address to the new kernel as a command line parameter. This makes it # possible to restore the MAC address in the new kernel without requiring driver modifications. - [ "${NETDEV}" ] || NETDEV=ma1 - echo "hwaddr_${NETDEV}=$(cat /sys/class/net/${NETDEV}/address)" >> /tmp/append + if [ -f /sys/class/net/ma1/address ]; then + echo "hwaddr_ma1=$(cat /sys/class/net/ma1/address)" >> /tmp/append + elif [ -f /sys/class/net/eth0/address ]; then + echo "hwaddr_ma1=$(cat /sys/class/net/eth0/address)" >> /tmp/append + else + echo "ERROR: Management port is not found." + fi # use extra parameters from kernel-params hook if the file exists if [ -f "$target_path/$kernel_params" ]; then From ccff73bb33f34fe68b4aefb05b5049bc364a707b Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 10 Apr 2018 20:15:20 -0700 Subject: [PATCH 108/274] [snmp]: Bind snmpd to all ip addresses (#1587) Signed-off-by: Qi Luo --- dockers/docker-snmp-sv2/snmpd.conf.j2 | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/dockers/docker-snmp-sv2/snmpd.conf.j2 b/dockers/docker-snmp-sv2/snmpd.conf.j2 index b46871dfd6f8..18b7af1e925d 100644 --- a/dockers/docker-snmp-sv2/snmpd.conf.j2 +++ b/dockers/docker-snmp-sv2/snmpd.conf.j2 @@ -13,24 +13,9 @@ # AGENT BEHAVIOUR # -{% if MGMT_INTERFACE %} -# Listen for connections on localhost, loopback ip and mgmt (eth0) ip -agentAddress udp:127.0.0.1:161 -{% for (name, prefix) in MGMT_INTERFACE %} -{% if prefix | ipv4 %} -agentAddress udp:{{ prefix | ip }}:161 -{% endif %} -{% endfor %} -# TODO: only support ipv4 lo addresses, add ipv6 support later -{% for (name, prefix) in LOOPBACK_INTERFACE %} -{% if prefix | ipv4 %} -agentAddress udp:{{ prefix | ip }}:161 -{% endif %} -{% endfor %} -{% else %} -# Listen on all addresses as mgmt ip not specified +# Listen for connections on all ip addresses, including eth0, ipv4 lo agentAddress udp:161 -{% endif %} +# TODO: only support ipv4 lo addresses, add ipv6 support later ############################################################################### # From ca111db34d7042fdc282b96831770f490bb29d50 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Tue, 10 Apr 2018 20:16:07 -0700 Subject: [PATCH 109/274] [device] Update Arista driver submodule (#1585) Watchdog timeout increased --- platform/broadcom/sonic-platform-modules-arista | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 6fe9de4dd52b..86221d907f27 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 6fe9de4dd52bba4c5856567a8f5624e75e9af66d +Subproject commit 86221d907f27e7f6df40393a5bfe217bf22b19af From 856fc830b5a06e3bb21e3e0367d735462eb2971a Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 10 Apr 2018 20:20:35 -0700 Subject: [PATCH 110/274] [snmp] support multiple community strings (proposal 2) (#1583) * [snmp] support multiple community strings * Use community old if communities is absent --- dockers/docker-snmp-sv2/snmpd.conf.j2 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dockers/docker-snmp-sv2/snmpd.conf.j2 b/dockers/docker-snmp-sv2/snmpd.conf.j2 index 18b7af1e925d..57cdccd85f6b 100644 --- a/dockers/docker-snmp-sv2/snmpd.conf.j2 +++ b/dockers/docker-snmp-sv2/snmpd.conf.j2 @@ -27,8 +27,13 @@ view systemonly included .1.3.6.1.2.1.1 view systemonly included .1.3.6.1.2.1.25.1 # Default access to basic system info +{% if snmp_rocommunities %} +{% for community in snmp_rocommunities %} +rocommunity {{ community }} +{% endfor %} +{% else %} rocommunity {{ snmp_rocommunity }} - +{$ endif %} ############################################################################### # From 7b31f7df326d24eec1f4765a467d90b10eb23797 Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Tue, 10 Apr 2018 22:45:59 -0700 Subject: [PATCH 111/274] [devices]: Fix type for qos.json in 7060 and S6100 (#1582) --- .../x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json | 6 +++--- .../dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json index 7e00e14d1974..b724b48c2c23 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json @@ -154,13 +154,13 @@ "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1" : { "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124!3-4" : { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { "scheduler" : "[SCHEDULER|scheduler.0]" }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124!0" : { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124!1" : { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1" : { "scheduler" : "[SCHEDULER|scheduler.2]" } } diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json index d63cbfb8c558..99642cf8cf4c 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json @@ -154,13 +154,13 @@ "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63|0-1" : { "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" }, - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63!3-4" : { + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63|3-4" : { "scheduler" : "[SCHEDULER|scheduler.0]" }, - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63!0" : { + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" }, - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63!1" : { + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63|1" : { "scheduler" : "[SCHEDULER|scheduler.2]" } } From 291321d85135339531512b79b864933a7cc4ec69 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 11 Apr 2018 01:50:17 -0700 Subject: [PATCH 112/274] Incorporate swss-common Table Name Separator Changes (#1584) * Table name separator now determined by database ID, no longer passed manually upon table creation * Update submodules to include table name separator changes --- dockers/docker-lldp-sv2/lldpmgrd | 6 ++---- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/dockers/docker-lldp-sv2/lldpmgrd b/dockers/docker-lldp-sv2/lldpmgrd index 1d13b1aaafd4..b34bd49b3d8c 100755 --- a/dockers/docker-lldp-sv2/lldpmgrd +++ b/dockers/docker-lldp-sv2/lldpmgrd @@ -109,10 +109,8 @@ class LldpManager(object): corresponding port alias in the Config database, then form the appropriate lldpcli configuration command and run it. """ - TABLE_SEPARATOR = "|" - # Retrieve all entires for this port from the Port table - port_table = swsscommon.Table(self.config_db, swsscommon.CFG_PORT_TABLE_NAME, TABLE_SEPARATOR) + port_table = swsscommon.Table(self.config_db, swsscommon.CFG_PORT_TABLE_NAME) (status, fvp) = port_table.get(port_name) if status: # Convert list of tuples to a dictionary @@ -130,7 +128,7 @@ class LldpManager(object): lldpcli_cmd = "lldpcli configure ports {0} lldp portidsubtype local {1}".format(port_name, port_alias) # Retrieve all entires for this port from the Device Neighbor table - device_neighbor_table = swsscommon.Table(self.config_db, swsscommon.CFG_DEVICE_NEIGHBOR_TABLE_NAME, TABLE_SEPARATOR) + device_neighbor_table = swsscommon.Table(self.config_db, swsscommon.CFG_DEVICE_NEIGHBOR_TABLE_NAME) (status, fvp) = device_neighbor_table.get(port_name) if status: # Convert list of tuples to a dictionary diff --git a/src/sonic-sairedis b/src/sonic-sairedis index c860472a3d8c..d1c52239635b 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit c860472a3d8c16cad8a44fd7f76e848c39651f2e +Subproject commit d1c52239635b68c672a9c8f59854a474f3e99d3b diff --git a/src/sonic-swss b/src/sonic-swss index d711d2cf5783..114faa4c5919 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit d711d2cf57839589aa7d6653b252305c31f8c2b0 +Subproject commit 114faa4c591917540933348801d9f96cffcd8ca1 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 14ca39fa0670..821377734ab8 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 14ca39fa0670b0e9b34d0ab63b12348bcba652ac +Subproject commit 821377734ab86ca931ffa45609c17a08c7859e99 From 0d5dc775de5dc6cc0f48b76629f0303fd261c5a0 Mon Sep 17 00:00:00 2001 From: Harish Venkatraman Date: Wed, 11 Apr 2018 08:12:37 -0700 Subject: [PATCH 113/274] [device/dell] Update pg_profile_lookup.ini (#1586) This commit updates the pg_profile_lookuip.ini file with correct xoff values for 50G. 25G/40m xoff value is updated to reflect the correct value. Signed-off-by: Harish Venkatraman --- .../Force10-S6100/pg_profile_lookup.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini index 3b2a417cebcd..7222f8014925 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini @@ -3,15 +3,15 @@ 10000 5m 1248 2288 35776 -4 2288 25000 5m 1248 2288 53248 -4 2288 40000 5m 1248 2288 66560 -4 2288 - 50000 5m 1248 2288 90272 -4 2288 + 50000 5m 1248 2288 79872 -4 2288 100000 5m 1248 2288 165568 -4 2288 10000 40m 1248 2288 37024 -4 2288 - 25000 40m 1248 2288 53248 -4 2288 + 25000 40m 1248 2288 56160 -4 2288 40000 40m 1248 2288 71552 -4 2288 - 50000 40m 1248 2288 96096 -4 2288 + 50000 40m 1248 2288 85696 -4 2288 100000 40m 1248 2288 177632 -4 2288 10000 300m 1248 2288 46176 -4 2288 25000 300m 1248 2288 79040 -4 2288 40000 300m 1248 2288 108160 -4 2288 - 50000 300m 1248 2288 141856 -4 2288 + 50000 300m 1248 2288 131456 -4 2288 100000 300m 1248 2288 268736 -4 2288 From 622d3577191e5e27dcbcc38b123af81cac82d62a Mon Sep 17 00:00:00 2001 From: ZivErlich <32637684+ZivErlich@users.noreply.github.com> Date: Thu, 12 Apr 2018 02:52:58 +0300 Subject: [PATCH 114/274] Marvell's updates for SONiC 201803 over SAI v1.2 (#1588) --- platform/marvell/rules.mk | 2 +- platform/marvell/sai.mk | 4 ++-- platform/marvell/sdk.mk | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/marvell/rules.mk b/platform/marvell/rules.mk index 185b7b5fd7a9..c5df6bab194e 100644 --- a/platform/marvell/rules.mk +++ b/platform/marvell/rules.mk @@ -12,7 +12,7 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) \ $(DOCKER_SYNCD_MRVL_RPC) # Inject mrvl sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(MRVL_FPA) $(MRVL_SAI) #$(LIBSAITHRIFT_DEV_MRVL) +$(LIBSAIREDIS)_DEPENDS += $(MRVL_FPA) $(MRVL_SAI) $(LIBSAITHRIFT_DEV_MRVL) # Runtime dependency on mrvl sai is set only for syncd $(SYNCD)_RDEPENDS += $(MRVL_SAI) diff --git a/platform/marvell/sai.mk b/platform/marvell/sai.mk index d2722971f1dd..5016b47f19a9 100644 --- a/platform/marvell/sai.mk +++ b/platform/marvell/sai.mk @@ -1,7 +1,7 @@ # Marvell SAI -export MRVL_SAI_VERSION = 1.0.1 -export MRVL_SAI_TAG = SONiC.201712 +export MRVL_SAI_VERSION = 1.2.1 +export MRVL_SAI_TAG = SONiC.201803 export MRVL_SAI = mrvllibsai_$(MRVL_SAI_VERSION).deb $(MRVL_SAI)_SRC_PATH = $(PLATFORM_PATH)/sai diff --git a/platform/marvell/sdk.mk b/platform/marvell/sdk.mk index 12050df5d34b..3d1ce8e04c88 100644 --- a/platform/marvell/sdk.mk +++ b/platform/marvell/sdk.mk @@ -1,7 +1,7 @@ # Marvell FPA -export MRVL_FPA_VERSION = 1.0.1 -export MRVL_FPA_TAG = SONiC.201712 +export MRVL_FPA_VERSION = 1.2.1 +export MRVL_FPA_TAG = SONiC.201803 export MRVL_FPA = mrvllibfpa_$(MRVL_FPA_VERSION).deb $(MRVL_FPA)_SRC_PATH = $(PLATFORM_PATH)/sdk From 2d54d43a0fd1e926d9c37b156b421c5e9d994ae6 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 12 Apr 2018 04:04:32 -0700 Subject: [PATCH 115/274] [minigraph]: ignore minigraph ports which are not in port_config.ini (#1593) Signed-off-by: Guohan Lu --- src/sonic-config-engine/minigraph.py | 8 ++++ .../tests/simple-sample-graph.xml | 13 +++++++ src/sonic-config-engine/tests/test_cfggen.py | 37 +++++++++++++++++++ 3 files changed, 58 insertions(+) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 731f449ab028..570f5de24188 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -439,10 +439,18 @@ def parse_xml(filename, platform=None, port_config_file=None): results['PORTCHANNEL_INTERFACE'] = pc_intfs for port_name in port_speeds: + # ignore port not in port_config.ini + if not ports.has_key(port_name): + continue + ports.setdefault(port_name, {})['speed'] = port_speeds[port_name] if port_speeds[port_name] == '100000': ports.setdefault(port_name, {})['fec'] = 'rs' for port_name in port_descriptions: + # ignore port not in port_config.ini + if not ports.has_key(port_name): + continue + ports.setdefault(port_name, {})['description'] = port_descriptions[port_name] results['PORT'] = ports diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index d42a2650321e..33e8a6d616d9 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -222,6 +222,19 @@ 0 10000 + + DeviceInterface + + true + true + 1 + fortyGigE0/1 + + false + 0 + 0 + 10000 + DeviceInterface diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 6059798cbd6e..fbec671aff56 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -153,6 +153,43 @@ def test_minigraph_ethernet_interfaces(self): output = self.run_script(argument) self.assertEqual(output.strip(), "{'alias': 'fortyGigE0/12', 'lanes': '33,34,35,36', 'fec': 'rs', 'speed': '100000', 'description': 'Interface description'}") + def test_minigraph_extra_ethernet_interfaces(self): + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT"' + output = self.run_script(argument) + self.assertEqual(output.strip(), \ + "{'Ethernet8': {'alias': 'fortyGigE0/8', 'lanes': '37,38,39,40', 'description': 'Interface description', 'speed': '40000'}, " + "'Ethernet0': {'alias': 'fortyGigE0/0', 'lanes': '29,30,31,32', 'speed': '10000'}, " + "'Ethernet4': {'alias': 'fortyGigE0/4', 'lanes': '25,26,27,28', 'speed': '25000'}, " + "'Ethernet108': {'alias': 'fortyGigE0/108', 'lanes': '81,82,83,84'}, " + "'Ethernet100': {'alias': 'fortyGigE0/100', 'lanes': '125,126,127,128'}, " + "'Ethernet104': {'alias': 'fortyGigE0/104', 'lanes': '85,86,87,88'}, " + "'Ethernet68': {'alias': 'fortyGigE0/68', 'lanes': '69,70,71,72'}, " + "'Ethernet96': {'alias': 'fortyGigE0/96', 'lanes': '121,122,123,124'}, " + "'Ethernet124': {'alias': 'fortyGigE0/124', 'lanes': '101,102,103,104'}, " + "'Ethernet92': {'alias': 'fortyGigE0/92', 'lanes': '113,114,115,116'}, " + "'Ethernet120': {'alias': 'fortyGigE0/120', 'lanes': '97,98,99,100'}, " + "'Ethernet52': {'alias': 'fortyGigE0/52', 'lanes': '53,54,55,56'}, " + "'Ethernet56': {'alias': 'fortyGigE0/56', 'lanes': '61,62,63,64'}, " + "'Ethernet76': {'alias': 'fortyGigE0/76', 'lanes': '73,74,75,76'}, " + "'Ethernet72': {'alias': 'fortyGigE0/72', 'lanes': '77,78,79,80'}, " + "'Ethernet64': {'alias': 'fortyGigE0/64', 'lanes': '65,66,67,68'}, " + "'Ethernet32': {'alias': 'fortyGigE0/32', 'lanes': '9,10,11,12'}, " + "'Ethernet16': {'alias': 'fortyGigE0/16', 'lanes': '41,42,43,44'}, " + "'Ethernet36': {'alias': 'fortyGigE0/36', 'lanes': '13,14,15,16'}, " + "'Ethernet12': {'alias': 'fortyGigE0/12', 'lanes': '33,34,35,36', 'fec': 'rs', 'speed': '100000', 'description': 'Interface description'}, " + "'Ethernet88': {'alias': 'fortyGigE0/88', 'lanes': '117,118,119,120'}, " + "'Ethernet116': {'alias': 'fortyGigE0/116', 'lanes': '93,94,95,96'}, " + "'Ethernet80': {'alias': 'fortyGigE0/80', 'lanes': '105,106,107,108'}, " + "'Ethernet112': {'alias': 'fortyGigE0/112', 'lanes': '89,90,91,92'}, " + "'Ethernet84': {'alias': 'fortyGigE0/84', 'lanes': '109,110,111,112'}, " + "'Ethernet48': {'alias': 'fortyGigE0/48', 'lanes': '49,50,51,52'}, " + "'Ethernet44': {'alias': 'fortyGigE0/44', 'lanes': '17,18,19,20'}, " + "'Ethernet40': {'alias': 'fortyGigE0/40', 'lanes': '21,22,23,24'}, " + "'Ethernet28': {'alias': 'fortyGigE0/28', 'lanes': '1,2,3,4'}, " + "'Ethernet60': {'alias': 'fortyGigE0/60', 'lanes': '57,58,59,60'}, " + "'Ethernet20': {'alias': 'fortyGigE0/20', 'lanes': '45,46,47,48'}, " + "'Ethernet24': {'alias': 'fortyGigE0/24', 'lanes': '5,6,7,8'}}") + def test_metadata_everflow(self): argument = '-m "' + self.sample_graph_metadata + '" -p "' + self.port_config + '" -v "MIRROR_SESSION"' output = self.run_script(argument) From f12ab9473ef2e6fb9d1442ed3c34a83e35a5fe9d Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 12 Apr 2018 15:44:57 -0700 Subject: [PATCH 116/274] [minigraph] Fix parser on PNG DeviceInterfaceLink Bandwidth (#1592) * [minigraph] Fix parser on PNG DeviceInterfaceLink Bandwidth Signed-off-by: Qi Luo --- src/sonic-config-engine/minigraph.py | 35 ++++++++++++++----- .../tests/sample_output/ports.json | 2 +- .../tests/simple-sample-graph.xml | 14 +++++++- src/sonic-config-engine/tests/test_cfggen.py | 4 +-- 4 files changed, 42 insertions(+), 13 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 570f5de24188..4ac7e9d68c92 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -62,6 +62,7 @@ def parse_png(png, hname): console_port = '' mgmt_dev = '' mgmt_port = '' + port_speeds = {} for child in png: if child.tag == str(QName(ns, "DeviceInterfaceLinks")): for link in child.findall(str(QName(ns, "DeviceLinkBase"))): @@ -73,15 +74,21 @@ def parse_png(png, hname): endport = link.find(str(QName(ns, "EndPort"))).text startdevice = link.find(str(QName(ns, "StartDevice"))).text startport = link.find(str(QName(ns, "StartPort"))).text + bandwidth_node = link.find(str(QName(ns, "Bandwidth"))) + bandwidth = bandwidth_node.text if bandwidth_node is not None else None if enddevice == hname: if port_alias_map.has_key(endport): endport = port_alias_map[endport] neighbors[endport] = {'name': startdevice, 'port': startport} + if bandwidth: + port_speeds[endport] = bandwidth else: if port_alias_map.has_key(startport): startport = port_alias_map[startport] neighbors[startport] = {'name': enddevice, 'port': endport} + if bandwidth: + port_speeds[startport] = bandwidth if child.tag == str(QName(ns, "Devices")): for device in child.findall(str(QName(ns, "Device"))): @@ -106,7 +113,7 @@ def parse_png(png, hname): elif node.tag == str(QName(ns, "EndDevice")): mgmt_dev = node.text - return (neighbors, devices, console_dev, console_port, mgmt_dev, mgmt_port) + return (neighbors, devices, console_dev, console_port, mgmt_dev, mgmt_port, port_speeds) def parse_dpg(dpg, hname): @@ -368,7 +375,8 @@ def parse_xml(filename, platform=None, port_config_file=None): neighbors = None devices = None hostname = None - port_speeds = {} + port_speeds_default = {} + port_speed_png = {} port_descriptions = {} syslog_servers = [] dhcp_servers = [] @@ -395,13 +403,13 @@ def parse_xml(filename, platform=None, port_config_file=None): elif child.tag == str(QName(ns, "CpgDec")): (bgp_sessions, bgp_asn, bgp_peers_with_range) = parse_cpg(child, hostname) elif child.tag == str(QName(ns, "PngDec")): - (neighbors, devices, console_dev, console_port, mgmt_dev, mgmt_port) = parse_png(child, hostname) + (neighbors, devices, console_dev, console_port, mgmt_dev, mgmt_port, port_speed_png) = parse_png(child, hostname) elif child.tag == str(QName(ns, "UngDec")): - (u_neighbors, u_devices, _, _, _, _) = parse_png(child, hostname) + (u_neighbors, u_devices, _, _, _, _, _) = parse_png(child, hostname) elif child.tag == str(QName(ns, "MetadataDeclaration")): (syslog_servers, dhcp_servers, ntp_servers, tacacs_servers, mgmt_routes, erspan_dst, deployment_id) = parse_meta(child, hostname) elif child.tag == str(QName(ns, "DeviceInfos")): - (port_speeds, port_descriptions) = parse_deviceinfo(child, hwsku) + (port_speeds_default, port_descriptions) = parse_deviceinfo(child, hwsku) results = {} results['DEVICE_METADATA'] = {'localhost': { @@ -438,14 +446,23 @@ def parse_xml(filename, platform=None, port_config_file=None): results['VLAN_INTERFACE'] = vlan_intfs results['PORTCHANNEL_INTERFACE'] = pc_intfs - for port_name in port_speeds: + for port_name in port_speeds_default: # ignore port not in port_config.ini if not ports.has_key(port_name): continue - ports.setdefault(port_name, {})['speed'] = port_speeds[port_name] - if port_speeds[port_name] == '100000': - ports.setdefault(port_name, {})['fec'] = 'rs' + ports.setdefault(port_name, {})['speed'] = port_speeds_default[port_name] + + for port_name in port_speed_png: + # if port_name is not in port_config.ini, still consider it. + # and later swss will pick up and behave on-demand port break-up. + # if on-deman port break-up is not supported on a specific platform, swss will return error. + ports.setdefault(port_name, {})['speed'] = port_speed_png[port_name] + + for port_name, port in ports.items(): + if port.get('speed') == '100000': + port['fec'] = 'rs' + for port_name in port_descriptions: # ignore port not in port_config.ini if not ports.has_key(port_name): diff --git a/src/sonic-config-engine/tests/sample_output/ports.json b/src/sonic-config-engine/tests/sample_output/ports.json index 7533fb7377ef..3fa2e29a8b0a 100644 --- a/src/sonic-config-engine/tests/sample_output/ports.json +++ b/src/sonic-config-engine/tests/sample_output/ports.json @@ -1,7 +1,7 @@ [ { "PORT_TABLE:Ethernet8": { - "speed": "40000", + "speed": "1000", "description": "Interface description" }, "OP": "SET" diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index 33e8a6d616d9..6e351e1cd003 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -181,7 +181,19 @@ - + + + DeviceInterfaceLink + true + 1000 + ARISTA01T1 + et1 + true + switch-t0 + fortyGigE0/8 + true + + switch-t0 diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index fbec671aff56..901b882f7048 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -148,7 +148,7 @@ def test_minigraph_deployment_id(self): def test_minigraph_ethernet_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet8\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'alias': 'fortyGigE0/8', 'lanes': '37,38,39,40', 'description': 'Interface description', 'speed': '40000'}") + self.assertEqual(output.strip(), "{'alias': 'fortyGigE0/8', 'lanes': '37,38,39,40', 'description': 'Interface description', 'speed': '1000'}") argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet12\']"' output = self.run_script(argument) self.assertEqual(output.strip(), "{'alias': 'fortyGigE0/12', 'lanes': '33,34,35,36', 'fec': 'rs', 'speed': '100000', 'description': 'Interface description'}") @@ -157,7 +157,7 @@ def test_minigraph_extra_ethernet_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT"' output = self.run_script(argument) self.assertEqual(output.strip(), \ - "{'Ethernet8': {'alias': 'fortyGigE0/8', 'lanes': '37,38,39,40', 'description': 'Interface description', 'speed': '40000'}, " + "{'Ethernet8': {'alias': 'fortyGigE0/8', 'lanes': '37,38,39,40', 'description': 'Interface description', 'speed': '1000'}, " "'Ethernet0': {'alias': 'fortyGigE0/0', 'lanes': '29,30,31,32', 'speed': '10000'}, " "'Ethernet4': {'alias': 'fortyGigE0/4', 'lanes': '25,26,27,28', 'speed': '25000'}, " "'Ethernet108': {'alias': 'fortyGigE0/108', 'lanes': '81,82,83,84'}, " From 7759bc8b92aa456d831b1ac95d5334a9c004c75c Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 12 Apr 2018 17:55:08 -0700 Subject: [PATCH 117/274] [Broadcom SAI] upgrade Broadcom SAI to version 3.1.3.4-10 (#1591) * [Broadcom SAI] upgrade Broadcom SAI to version 3.1.3.4-9 Includes configuration files for following devices: - Quanta 1X1B-32X - Dell Z9264F - Inventec D7054Q28B and D7032Q28B * [bcm sai] upgrade sai version to 3.1.3.4-10 include configuration change to 7060 T0. --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 1f124e1b9232..5120b1518f6e 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.4-7_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-7_amd64.deb?sv=2015-04-05&sr=b&sig=elzOgHCA3G8oKKMfWcbFa%2BvQzAh727mtYJnnVOzVJtY%3D&se=2155-02-07T23%3A37%3A54Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.4-10_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-10_amd64.deb?sv=2015-04-05&sr=b&sig=72n19AElVmbqo3ahrEFVBwMgR%2FoQ7fhUj4tcadx8pVE%3D&se=2031-12-20T20%3A27%3A14Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-7_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-10_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-7_amd64.deb?sv=2015-04-05&sr=b&sig=rysxdbCA%2BaqBgDnxztdRA2ixiME3ypqRvzyEds8hLw4%3D&se=2155-02-07T23%3A38%3A39Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-10_amd64.deb?sv=2015-04-05&sr=b&sig=cN4qsWX8XW04ZObBDonwh5Uzgmp5A0iRBkpZA9N5Zb8%3D&se=2031-12-20T20%3A26%3A45Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From fcbbb8a3690094e4b950f043419a94f175274269 Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Thu, 12 Apr 2018 18:06:26 -0700 Subject: [PATCH 118/274] 50G support for Arista 7060 (#1580) * 50G SKU for Arista 7060 --- .../Arista-7060CX-32S-D48C8/buffers.json.j2 | 2 + .../buffers_defaults_t0.j2 | 61 +++++++ .../pg_profile_lookup.ini | 17 ++ .../Arista-7060CX-32S-D48C8/port_config.ini | 57 ++++++ .../Arista-7060CX-32S-D48C8/qos.json | 167 ++++++++++++++++++ .../Arista-7060CX-32S-D48C8/sai.profile | 1 + 6 files changed, 305 insertions(+) create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers.json.j2 create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers_defaults_t0.j2 create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/pg_profile_lookup.ini create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/port_config.ini create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/sai.profile diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers.json.j2 new file mode 100644 index 000000000000..1083a6210fc9 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..2b7215243f12 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers_defaults_t0.j2 @@ -0,0 +1,61 @@ +{%- set default_cable = '5m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,6) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(10,22) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(24,32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(6,10) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(22,24) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "11213696", + "type": "ingress", + "mode": "dynamic", + "xoff": "8356608" + }, + "egress_lossy_pool": { + "size": "9532224", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"1518", + "static_th":"3995680" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/pg_profile_lookup.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/pg_profile_lookup.ini new file mode 100644 index 000000000000..7222f8014925 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 1248 2288 35776 -4 2288 + 25000 5m 1248 2288 53248 -4 2288 + 40000 5m 1248 2288 66560 -4 2288 + 50000 5m 1248 2288 79872 -4 2288 + 100000 5m 1248 2288 165568 -4 2288 + 10000 40m 1248 2288 37024 -4 2288 + 25000 40m 1248 2288 56160 -4 2288 + 40000 40m 1248 2288 71552 -4 2288 + 50000 40m 1248 2288 85696 -4 2288 + 100000 40m 1248 2288 177632 -4 2288 + 10000 300m 1248 2288 46176 -4 2288 + 25000 300m 1248 2288 79040 -4 2288 + 40000 300m 1248 2288 108160 -4 2288 + 50000 300m 1248 2288 131456 -4 2288 + 100000 300m 1248 2288 268736 -4 2288 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/port_config.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/port_config.ini new file mode 100644 index 000000000000..0366a339f6f9 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/port_config.ini @@ -0,0 +1,57 @@ +# name lanes alias index speed +Ethernet0 33,34 Ethernet1/1 1 50000 +Ethernet2 35,36 Ethernet1/3 1 50000 +Ethernet4 37,38 Ethernet2/1 2 50000 +Ethernet6 39,40 Ethernet2/3 2 50000 +Ethernet8 41,42 Ethernet3/1 3 50000 +Ethernet10 43,44 Ethernet3/3 3 50000 +Ethernet12 45,46 Ethernet4/1 4 50000 +Ethernet14 47,48 Ethernet4/3 4 50000 +Ethernet16 49,50 Ethernet5/1 5 50000 +Ethernet18 51,52 Ethernet5/3 5 50000 +Ethernet20 53,54 Ethernet6/1 6 50000 +Ethernet22 55,56 Ethernet6/3 6 50000 +Ethernet24 57,58,59,60 Ethernet7/1 7 100000 +Ethernet28 61,62,63,64 Ethernet8/1 8 100000 +Ethernet32 65,66,67,68 Ethernet9/1 9 100000 +Ethernet36 69,70,71,72 Ethernet10/1 10 100000 +Ethernet40 73,74 Ethernet11/1 11 50000 +Ethernet42 75,76 Ethernet11/3 11 50000 +Ethernet44 77,78 Ethernet12/1 12 50000 +Ethernet46 79,80 Ethernet12/3 12 50000 +Ethernet48 81,82 Ethernet13/1 13 50000 +Ethernet50 83,84 Ethernet13/3 13 50000 +Ethernet52 85,86 Ethernet14/1 14 50000 +Ethernet54 87,88 Ethernet14/3 14 50000 +Ethernet56 89,90 Ethernet15/1 15 50000 +Ethernet58 91,92 Ethernet15/3 15 50000 +Ethernet60 93,94 Ethernet16/1 16 50000 +Ethernet62 95,96 Ethernet16/3 16 50000 +Ethernet64 97,98 Ethernet17/1 17 50000 +Ethernet66 99,100 Ethernet17/3 17 50000 +Ethernet68 101,102 Ethernet18/1 18 50000 +Ethernet70 103,104 Ethernet18/3 18 50000 +Ethernet72 105,106 Ethernet19/1 19 50000 +Ethernet74 107,108 Ethernet19/3 19 50000 +Ethernet76 109,110 Ethernet20/1 20 50000 +Ethernet78 111,112 Ethernet20/3 20 50000 +Ethernet80 113,114 Ethernet21/1 21 50000 +Ethernet82 115,116 Ethernet21/3 21 50000 +Ethernet84 117,118 Ethernet22/1 22 50000 +Ethernet86 119,120 Ethernet22/3 22 50000 +Ethernet88 121,122,123,124 Ethernet23/1 23 100000 +Ethernet92 125,126,127,128 Ethernet24/1 24 100000 +Ethernet96 1,2,3,4 Ethernet25/1 25 100000 +Ethernet100 5,6,7,8 Ethernet26/1 26 100000 +Ethernet104 9,10 Ethernet27/1 27 50000 +Ethernet106 11,12 Ethernet27/3 27 50000 +Ethernet108 13,14 Ethernet28/1 28 50000 +Ethernet110 15,16 Ethernet28/3 28 50000 +Ethernet112 17,18 Ethernet29/1 29 50000 +Ethernet114 19,20 Ethernet29/3 29 50000 +Ethernet116 21,22 Ethernet30/1 30 50000 +Ethernet118 23,24 Ethernet30/3 30 50000 +Ethernet120 25,26 Ethernet31/1 31 50000 +Ethernet122 27,28 Ethernet31/3 31 50000 +Ethernet124 29,30 Ethernet32/1 32 50000 +Ethernet126 31,32 Ethernet32/3 32 50000 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json new file mode 100644 index 000000000000..8149f1f111ce --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json @@ -0,0 +1,167 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"512000", + "red_min_threshold":"512000", + "yellow_max_threshold":"512000", + "yellow_min_threshold":"512000", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + }, + "AZURE_LOSSLESS" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"512000", + "red_min_threshold":"512000", + "yellow_max_threshold":"512000", + "yellow_min_threshold":"512000", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126|0-1": { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126|3-4": { + "scheduler" : "[SCHEDULER|scheduler.0]" + }, + "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126|0": { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126|1": { + "scheduler" : "[SCHEDULER|scheduler.2]" + } + } +} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/sai.profile b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/sai.profile new file mode 100644 index 000000000000..0c3ab159868b --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-a7060-cx32s-8x100G+48x50G.config.bcm From b097b9672c4586d31d5c4630ee8088823c83df5e Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 13 Apr 2018 10:50:58 -0700 Subject: [PATCH 119/274] Fix syntax error in snmpd.conf.j2 (#1597) Signed-off-by: Qi Luo --- dockers/docker-snmp-sv2/snmpd.conf.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-snmp-sv2/snmpd.conf.j2 b/dockers/docker-snmp-sv2/snmpd.conf.j2 index 57cdccd85f6b..6353246acb08 100644 --- a/dockers/docker-snmp-sv2/snmpd.conf.j2 +++ b/dockers/docker-snmp-sv2/snmpd.conf.j2 @@ -33,7 +33,7 @@ rocommunity {{ community }} {% endfor %} {% else %} rocommunity {{ snmp_rocommunity }} -{$ endif %} +{% endif %} ############################################################################### # From 2b9f877b8f5c55288ef01bce8e3adc7ab0e95e26 Mon Sep 17 00:00:00 2001 From: yurypm Date: Sat, 14 Apr 2018 01:00:38 +0100 Subject: [PATCH 120/274] [baseimage]: Fix tcpdmatch dependency (#1594) * Fix tcpdmatch dependency Issue: sonic_debian_extension.j2 uses tcpdmatch from src folder which is result of libwrap build Fix: added tcpd.deb to build results and extract required files from build results * Install libwrap0 and tcpd deb packages --- files/build_templates/sonic_debian_extension.j2 | 5 ++++- rules/libwrap.mk | 2 ++ src/libwrap/Makefile | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 0849118b83a4..d0afa4659667 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -246,7 +246,10 @@ sudo cp $IMAGE_CONFIGS/ssh/sshd-config-updater $FILESYSTEM_ROOT/usr/bin/ sudo chmod +x $FILESYSTEM_ROOT/usr/bin/sshd-config-updater sudo cp $IMAGE_CONFIGS/ssh/sshd-clear-denied-sessions $FILESYSTEM_ROOT/usr/bin sudo chmod +x $FILESYSTEM_ROOT/usr/bin/sshd-clear-denied-sessions -sudo cp src/libwrap/tcp-wrappers-7.6.q/tcpdmatch $FILESYSTEM_ROOT/usr/bin +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libwrap0_*_amd64.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/tcpd_*_amd64.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f ## copy platform rc.local sudo cp $IMAGE_CONFIGS/platform/rc.local $FILESYSTEM_ROOT/etc/ diff --git a/rules/libwrap.mk b/rules/libwrap.mk index 336a2ec68c9f..aab8e959d143 100644 --- a/rules/libwrap.mk +++ b/rules/libwrap.mk @@ -8,3 +8,5 @@ LIBWRAP = libwrap0_$(LIBWRAP_VERSION)_amd64.deb $(LIBWRAP)_SRC_PATH = $(SRC_PATH)/libwrap SONIC_MAKE_DEBS += $(LIBWRAP) +TCPD = tcpd_$(LIBWRAP_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(LIBWRAP),$(TCPD))) diff --git a/src/libwrap/Makefile b/src/libwrap/Makefile index fea6f134ab58..4cb2e88a0c46 100644 --- a/src/libwrap/Makefile +++ b/src/libwrap/Makefile @@ -3,6 +3,7 @@ SHELL = /bin/bash .SHELLFLAGS += -e MAIN_TARGET = libwrap0_$(LIBWRAP_VERSION)_amd64.deb +DERIVED_TARGETS = tcpd_$(LIBWRAP_VERSION)_amd64.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Remove any stale files @@ -19,5 +20,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : popd # Move the newly-built .deb packages to the destination directory - mv $* $(DEST)/ + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) From 0bdb407d3f5b89724f836d69ff6f5386e7913211 Mon Sep 17 00:00:00 2001 From: klhaung <38268572+klhaung@users.noreply.github.com> Date: Sat, 14 Apr 2018 08:06:12 +0800 Subject: [PATCH 121/274] [device]: Add LED initialzation file for Inventec-d7054q28b-r0 (#1595) * update SAI profile * Add a new Initialization file for Broadcom LED microprocessors --- .../INVENTEC-D7054Q28B-S48-Q6/sai.profile | 2 +- .../led_proc_init.soc | 200 ++++++++++++++++++ 2 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 device/inventec/x86_64-inventec_d7054q28b-r0/led_proc_init.soc diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/sai.profile b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/sai.profile index 6f60cbd6118c..7e019adbbb94 100644 --- a/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/sai.profile +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/sai.profile @@ -1,2 +1,2 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-d7054q28b-48x10g-6x100g.config.bcm +SAI_INIT_CONFIG_FILE=/etc/bcm/th-d7054q28b-48x25g-6x100g.config.bcm SAI_NUM_ECMP_MEMBERS=32 diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/led_proc_init.soc b/device/inventec/x86_64-inventec_d7054q28b-r0/led_proc_init.soc new file mode 100644 index 000000000000..ceaa9a8e6d5d --- /dev/null +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/led_proc_init.soc @@ -0,0 +1,200 @@ +#LED processor initialization for Inventec d7054q28b platform + +led 0 stop +led 0 prog 02 00 60 F1 12 00 DA 0F 70 10 67 61 67 5C 77 06 02 A0 60 F0 02 00 60 F2 12 00 06 F0 4A 01 71 38 4A 02 27 67 5C 06 F2 28 32 08 67 5C 06 F2 28 32 00 32 01 B7 67 5C 77 44 67 64 67 5C 67 64 67 5C 67 61 67 5C DA 6C 70 4E 86 F0 86 F2 77 1A 12 00 DA 03 70 5A 67 64 67 5C 77 50 3E F1 87 86 F1 81 57 17 27 57 07 27 57 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=14 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=15 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=13 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=10 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=11 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=9 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=6 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=7 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=4 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=5 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=2 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=3 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=0 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=1 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=31 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=30 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=29 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=35 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=34 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=33 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=32 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=23 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=22 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=21 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=27 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=26 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=25 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=19 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=18 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=17 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=16 +led 0 start + +led 1 stop +led 1 prog 02 00 60 F1 12 00 DA 0F 70 10 67 61 67 5C 77 06 02 A0 60 F0 02 00 60 F2 12 00 06 F0 4A 01 71 38 4A 02 27 67 5C 06 F2 28 32 08 67 5C 06 F2 28 32 00 32 01 B7 67 5C 77 44 67 64 67 5C 67 64 67 5C 67 61 67 5C DA 6C 70 4E 86 F0 86 F2 77 1A 12 00 DA 03 70 5A 67 64 67 5C 77 50 3E F1 87 86 F1 81 57 17 27 57 07 27 57 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=2 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=3 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=0 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=1 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=6 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=7 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=4 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=5 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=10 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=11 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=8 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=9 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=14 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=15 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=12 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=13 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=18 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=19 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=16 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=17 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=22 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=23 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=20 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=21 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=26 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=27 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=24 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=25 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=30 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=31 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=28 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=29 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=35 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=34 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=33 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=63 +led 1 start + +# Set per port speed config of LED Color register +# For Invnetec Cypress platform, +# If we want to set 10G speed per port, We need to set amber color light, so use cmd "setreg CMIC_LEDUP0_DATA_RAM(160) 0x04". +# If we want to set 25G ( or up ) speed per port, we need to set green color light, so use cmd "setreg CMIC_LEDUP0_DATA_RAM(160) 0x00". + +setreg CMIC_LEDUP0_DATA_RAM(160) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(161) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(162) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(163) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(164) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(165) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(166) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(167) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(168) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(169) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(170) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(171) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(172) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(173) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(174) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(175) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(176) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(177) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(178) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(179) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(180) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(181) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(182) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(183) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(184) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(185) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(186) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(187) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(188) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(189) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(190) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(191) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(192) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(193) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(194) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(195) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(196) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(197) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(198) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(199) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(200) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(201) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(202) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(203) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(204) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(205) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(206) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(207) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(208) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(209) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(210) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(211) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(212) 0x00 +setreg CMIC_LEDUP0_DATA_RAM(213) 0x00 + +age 150 + From f947172c0a0257162f0e2ca3746d1ab89c6dd54c Mon Sep 17 00:00:00 2001 From: "Wenda Ni, Ph.D" Date: Fri, 13 Apr 2018 22:22:21 -0700 Subject: [PATCH 122/274] [devices]: Merge ingress service pools of lossless and lossy traffic for TD2 (#1578) Signed-off-by: Wenda --- .../Arista-7050-QX32/buffers.json.j2 | 19 +++++++------------ .../Arista-7050-QX-32S/buffers.json.j2 | 19 +++++++------------ .../Force10-S6000/buffers.json.j2 | 19 +++++++------------ 3 files changed, 21 insertions(+), 36 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 index 10f9da575a1b..551f73ca0477 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 @@ -69,22 +69,17 @@ }, "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "7274496", - "type": "ingress", - "mode": "dynamic" - }, - "ingress_lossy_pool": { - "size": "5491712", + "size": "12766208", "type": "ingress", "mode": "dynamic" }, "egress_lossless_pool": { - "size": "7274496", + "size": "12766208", "type": "egress", "mode": "static" }, "egress_lossy_pool": { - "size": "5491712", + "size": "8072396", "type": "egress", "mode": "dynamic" } @@ -95,18 +90,18 @@ "xon":"18432", "xoff":"40560", "size":"41808", - "dynamic_th":"-3", + "dynamic_th":"-4", "xon_offset":"2496" }, "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", - "size":"1518", + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", "dynamic_th":"3" }, "egress_lossless_profile": { "pool":"[BUFFER_POOL|egress_lossless_pool]", "size":"0", - "static_th":"7274496" + "static_th":"12766208" }, "egress_lossy_profile": { "pool":"[BUFFER_POOL|egress_lossy_pool]", diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 index 10f9da575a1b..551f73ca0477 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 @@ -69,22 +69,17 @@ }, "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "7274496", - "type": "ingress", - "mode": "dynamic" - }, - "ingress_lossy_pool": { - "size": "5491712", + "size": "12766208", "type": "ingress", "mode": "dynamic" }, "egress_lossless_pool": { - "size": "7274496", + "size": "12766208", "type": "egress", "mode": "static" }, "egress_lossy_pool": { - "size": "5491712", + "size": "8072396", "type": "egress", "mode": "dynamic" } @@ -95,18 +90,18 @@ "xon":"18432", "xoff":"40560", "size":"41808", - "dynamic_th":"-3", + "dynamic_th":"-4", "xon_offset":"2496" }, "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", - "size":"1518", + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", "dynamic_th":"3" }, "egress_lossless_profile": { "pool":"[BUFFER_POOL|egress_lossless_pool]", "size":"0", - "static_th":"7274496" + "static_th":"12766208" }, "egress_lossy_profile": { "pool":"[BUFFER_POOL|egress_lossy_pool]", diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 index 10f9da575a1b..551f73ca0477 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 @@ -69,22 +69,17 @@ }, "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "7274496", - "type": "ingress", - "mode": "dynamic" - }, - "ingress_lossy_pool": { - "size": "5491712", + "size": "12766208", "type": "ingress", "mode": "dynamic" }, "egress_lossless_pool": { - "size": "7274496", + "size": "12766208", "type": "egress", "mode": "static" }, "egress_lossy_pool": { - "size": "5491712", + "size": "8072396", "type": "egress", "mode": "dynamic" } @@ -95,18 +90,18 @@ "xon":"18432", "xoff":"40560", "size":"41808", - "dynamic_th":"-3", + "dynamic_th":"-4", "xon_offset":"2496" }, "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", - "size":"1518", + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", "dynamic_th":"3" }, "egress_lossless_profile": { "pool":"[BUFFER_POOL|egress_lossless_pool]", "size":"0", - "static_th":"7274496" + "static_th":"12766208" }, "egress_lossy_profile": { "pool":"[BUFFER_POOL|egress_lossy_pool]", From 6383de3907ae7f951649acd9b83668769e40450c Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Wed, 11 Apr 2018 12:30:16 +0300 Subject: [PATCH 123/274] [Mellanox] Add support for a new platform LS-SN2700 Signed-off-by: Andriy Moroz --- .../LS-SN2700/buffers.json.j2 | 162 +++ .../LS-SN2700/pg_profile_lookup.ini | 17 + .../LS-SN2700/port_config.ini | 33 + .../LS-SN2700/qos.json | 166 +++ .../LS-SN2700/sai.profile | 1 + .../x86_64-mlnx_lssn2700-r0/hw-management | 1 + .../x86_64-mlnx_lssn2700-r0/installer.conf | 1 + .../x86_64-mlnx_lssn2700-r0/minigraph.xml | 1079 +++++++++++++++++ .../x86_64-mlnx_lssn2700-r0/plugins/eeprom.py | 32 + .../plugins/psuutil.py | 74 ++ .../plugins/sfplpmget.py | 43 + .../plugins/sfplpmset.py | 107 ++ .../plugins/sfpreset.py | 45 + .../plugins/sfputil.py | 151 +++ .../x86_64-mlnx_lssn2700-r0/sensors.conf | 21 + 15 files changed, 1933 insertions(+) create mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers.json.j2 create mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/pg_profile_lookup.ini create mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/port_config.ini create mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json create mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai.profile create mode 120000 device/mellanox/x86_64-mlnx_lssn2700-r0/hw-management create mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/installer.conf create mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/minigraph.xml create mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/eeprom.py create mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/psuutil.py create mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfplpmget.py create mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfplpmset.py create mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfpreset.py create mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfputil.py create mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/sensors.conf diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers.json.j2 b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers.json.j2 new file mode 100644 index 000000000000..da9c764db92b --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers.json.j2 @@ -0,0 +1,162 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, +{%if switch_role == 'ToRRouter' %} +{% set ingress_lossless_pool_size = '4194304' %} +{% set ingress_lossy_pool_size = '7340032' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '7340032' %} +{% else %} +{% set ingress_lossless_pool_size = '2097152' %} +{% set ingress_lossy_pool_size = '5242880' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '5242880' %} +{%endif %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "pg_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "q_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|q_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } + } +} diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/pg_profile_lookup.ini new file mode 100644 index 000000000000..b66b129fe43f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/port_config.ini b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/port_config.ini new file mode 100644 index 000000000000..816bb0e94a70 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/port_config.ini @@ -0,0 +1,33 @@ +# name lanes +Ethernet0 0,1,2,3 +Ethernet4 4,5,6,7 +Ethernet8 8,9,10,11 +Ethernet12 12,13,14,15 +Ethernet16 16,17,18,19 +Ethernet20 20,21,22,23 +Ethernet24 24,25,26,27 +Ethernet28 28,29,30,31 +Ethernet32 32,33,34,35 +Ethernet36 36,37,38,39 +Ethernet40 40,41,42,43 +Ethernet44 44,45,46,47 +Ethernet48 48,49,50,51 +Ethernet52 52,53,54,55 +Ethernet56 56,57,58,59 +Ethernet60 60,61,62,63 +Ethernet64 64,65,66,67 +Ethernet68 68,69,70,71 +Ethernet72 72,73,74,75 +Ethernet76 76,77,78,79 +Ethernet80 80,81,82,83 +Ethernet84 84,85,86,87 +Ethernet88 88,89,90,91 +Ethernet92 92,93,94,95 +Ethernet96 96,97,98,99 +Ethernet100 100,101,102,103 +Ethernet104 104,105,106,107 +Ethernet108 108,109,110,111 +Ethernet112 112,113,114,115 +Ethernet116 116,117,118,119 +Ethernet120 120,121,122,123 +Ethernet124 124,125,126,127 diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json new file mode 100644 index 000000000000..3e01af3f2c64 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json @@ -0,0 +1,166 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1": { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2": { + "type":"DWRR", + "weight": "20" + } + }, + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + }, + "AZURE_LOSSLESS": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0": { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1": { + "scheduler" : "[SCHEDULER|scheduler.2]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4": { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + } + } +} + diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai.profile b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai.profile new file mode 100644 index 000000000000..9a9a38aeb068 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sai_2700.xml diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/hw-management b/device/mellanox/x86_64-mlnx_lssn2700-r0/hw-management new file mode 120000 index 000000000000..eb5e941daad7 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/hw-management @@ -0,0 +1 @@ +/etc/mlnx/msn2700 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/installer.conf b/device/mellanox/x86_64-mlnx_lssn2700-r0/installer.conf new file mode 100644 index 000000000000..c9c9493a5404 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/installer.conf @@ -0,0 +1 @@ +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=lax acpi=noirq" diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_lssn2700-r0/minigraph.xml new file mode 100644 index 000000000000..40eb5252610b --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/minigraph.xml @@ -0,0 +1,1079 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + sonic + 10.0.0.32 + 1 + 180 + 60 + + + sonic + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + sonic + 10.0.0.34 + 1 + 180 + 60 + + + sonic + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + sonic + 10.0.0.36 + 1 + 180 + 60 + + + sonic + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + sonic + 10.0.0.38 + 1 + 180 + 60 + + + sonic + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + sonic + 10.0.0.40 + 1 + 180 + 60 + + + sonic + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + sonic + 10.0.0.42 + 1 + 180 + 60 + + + sonic + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + sonic + 10.0.0.44 + 1 + 180 + 60 + + + sonic + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + sonic + 10.0.0.46 + 1 + 180 + 60 + + + sonic + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + sonic + 10.0.0.48 + 1 + 180 + 60 + + + sonic + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + sonic + 10.0.0.50 + 1 + 180 + 60 + + + sonic + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + sonic + 10.0.0.52 + 1 + 180 + 60 + + + sonic + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + sonic + 10.0.0.54 + 1 + 180 + 60 + + + sonic + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + sonic + 10.0.0.56 + 1 + 180 + 60 + + + sonic + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + sonic + 10.0.0.58 + 1 + 180 + 60 + + + sonic + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + sonic + 10.0.0.60 + 1 + 180 + 60 + + + sonic + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + sonic + 10.0.0.62 + 1 + 180 + 60 + + + sonic + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + sonic + + +
10.0.0.33
+ + +
+ +
10.0.0.1
+ + +
+ +
10.0.0.35
+ + +
+ +
10.0.0.3
+ + +
+ +
10.0.0.37
+ + +
+ +
10.0.0.5
+ + +
+ +
10.0.0.39
+ + +
+ +
10.0.0.7
+ + +
+ +
10.0.0.41
+ + +
+ +
10.0.0.9
+ + +
+ +
10.0.0.43
+ + +
+ +
10.0.0.11
+ + +
+ +
10.0.0.45
+ + +
+ +
10.0.0.13
+ + +
+ +
10.0.0.47
+ + +
+ +
10.0.0.15
+ + +
+ +
10.0.0.49
+ + +
+ +
10.0.0.17
+ + +
+ +
10.0.0.51
+ + +
+ +
10.0.0.19
+ + +
+ +
10.0.0.53
+ + +
+ +
10.0.0.21
+ + +
+ +
10.0.0.55
+ + +
+ +
10.0.0.23
+ + +
+ +
10.0.0.57
+ + +
+ +
10.0.0.25
+ + +
+ +
10.0.0.59
+ + +
+ +
10.0.0.27
+ + +
+ +
10.0.0.61
+ + +
+ +
10.0.0.29
+ + +
+ +
10.0.0.63
+ + +
+ +
10.0.0.31
+ + +
+
+ +
+ + 64001 + ARISTA01T0 + + + + 65200 + ARISTA01T2 + + + + 64002 + ARISTA02T0 + + + + 65200 + ARISTA02T2 + + + + 64003 + ARISTA03T0 + + + + 65200 + ARISTA03T2 + + + + 64004 + ARISTA04T0 + + + + 65200 + ARISTA04T2 + + + + 64005 + ARISTA05T0 + + + + 65200 + ARISTA05T2 + + + + 64006 + ARISTA06T0 + + + + 65200 + ARISTA06T2 + + + + 64007 + ARISTA07T0 + + + + 65200 + ARISTA07T2 + + + + 64008 + ARISTA08T0 + + + + 65200 + ARISTA08T2 + + + + 64009 + ARISTA09T0 + + + + 65200 + ARISTA09T2 + + + + 64010 + ARISTA10T0 + + + + 65200 + ARISTA10T2 + + + + 64011 + ARISTA11T0 + + + + 65200 + ARISTA11T2 + + + + 64012 + ARISTA12T0 + + + + 65200 + ARISTA12T2 + + + + 64013 + ARISTA13T0 + + + + 65200 + ARISTA13T2 + + + + 64014 + ARISTA14T0 + + + + 65200 + ARISTA14T2 + + + + 64015 + ARISTA15T0 + + + + 65200 + ARISTA15T2 + + + + 64016 + ARISTA16T0 + + + + 65200 + ARISTA16T2 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + + + + + + sonic + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet60 + 10.0.0.30/31 + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet84 + 10.0.0.42/31 + + + + Ethernet88 + 10.0.0.44/31 + + + + Ethernet92 + 10.0.0.46/31 + + + + Ethernet96 + 10.0.0.48/31 + + + + Ethernet100 + 10.0.0.50/31 + + + + Ethernet104 + 10.0.0.52/31 + + + + Ethernet108 + 10.0.0.54/31 + + + + Ethernet112 + 10.0.0.56/31 + + + + Ethernet116 + 10.0.0.58/31 + + + + Ethernet120 + 10.0.0.60/31 + + + + Ethernet124 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + sonic + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet64 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet68 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet72 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet76 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet80 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet84 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet88 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet92 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet96 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet100 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet104 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet108 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet112 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet116 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet120 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet124 + ARISTA16T0 + Ethernet1 + + + + + sonic + LS-SN2700 + + + + + + + sonic + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + ErspanDestinationIpv4 + + 2.2.2.2 + + + + + + + sonic + LS-SN2700 +
diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/eeprom.py new file mode 100644 index 000000000000..3650d9c8b70b --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/eeprom.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + _TLV_INFO_MAX_LEN = 256 + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/bsp/eeprom/sys_eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/psuutil.py new file mode 100644 index 000000000000..301569c13a94 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/psuutil.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/2-0060/" + self.psu_presence = "psu{}_status" + self.psu_oper_status = "psu{}_pg_status" + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is faulty + """ + if index is None: + return False + + status = 0 + try: + with open(self.psu_path + self.psu_oper_status.format(index), 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + if index is None: + return False + + status = 0 + try: + with open(self.psu_path + self.psu_presence.format(index), 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfplpmget.py b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfplpmget.py new file mode 100644 index 000000000000..170766e9bce4 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfplpmget.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +import sys, errno +import os +from python_sdk_api.sxd_api import * +from python_sdk_api.sx_api import * + +# Check if SFP port number is provided +if len(sys.argv) < 2: + print "SFP module number is missed." + print "Usage: sfplpmget.py " + sys.exit(errno.EINVAL) + +# Init SDK API +rc, handle = sx_api_open(None) +if (rc != SX_STATUS_SUCCESS): + print "Failed to open api handle.\nPlease check that SDK is running." + sys.exit(errno.EACCES) + +pid = os.getpid() +rc = sxd_access_reg_init(pid, None, 0) +if (rc != 0): + print "Failed to initializing register access.\nPlease check that SDK is running." + sys.exit(errno.EACCES) + +# Get SFP module number +sfp_module = int(sys.argv[1]) + +# Get MCION +mcion = ku_mcion_reg() +mcion.module = sfp_module +meta = sxd_reg_meta_t() +meta.dev_id = 1 +meta.swid = 0 +meta.access_cmd = SXD_ACCESS_CMD_GET + +rc = sxd_access_reg_mcion(mcion, meta, 1, None, None) +assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_mcion failed, rc = %d" % rc + +# Get low power mode status +lpm_mask = 1 << 8 +lpm_status = (lpm_mask & mcion.module_status_bits) != 0 +print "LPM ON" if lpm_status else "LPM OFF" diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfplpmset.py new file mode 100644 index 000000000000..3f31af9f2944 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfplpmset.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python + +import sys, errno +import time +import os +from python_sdk_api.sxd_api import * +from python_sdk_api.sx_api import * + +def get_log_ports(handle, sfp_module): + port_attributes_list = new_sx_port_attributes_t_arr(64) + port_cnt_p = new_uint32_t_p() + uint32_t_p_assign(port_cnt_p, 64) + + rc = sx_api_port_device_get(handle, 1 , 0, port_attributes_list, port_cnt_p) + assert rc == SX_STATUS_SUCCESS, "sx_api_port_device_get failed, rc = %d" % rc + + port_cnt = uint32_t_p_value(port_cnt_p) + log_port_list = [] + for i in range(0, port_cnt): + port_attributes = sx_port_attributes_t_arr_getitem(port_attributes_list, i) + if port_attributes.port_mapping.module_port == sfp_module: + log_port_list.append(port_attributes.log_port) + + return log_port_list + +def set_sfp_admin_status(handle, meta, sfp_module, sfp_log_port_list, admin_status): + # Get PMAOS + pmaos = ku_pmaos_reg() + pmaos.module = sfp_module + meta.access_cmd = SXD_ACCESS_CMD_GET + rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) + assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc + + # Set admin status to PMAOS + pmaos.ase = 1 + pmaos.ee = 1 + pmaos.e = 2 + pmaos.rst = 0 + if admin_status == SX_PORT_ADMIN_STATUS_DOWN: + pmaos.admin_status = 2 + else: + pmaos.admin_status = 1 + + meta.access_cmd = SXD_ACCESS_CMD_SET + rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) + assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc + +# Check if SFP port number is provided +if len(sys.argv) < 3: + print "SFP module number or LPM is missed." + print "Usage: sfplpmset.py " + sys.exit(errno.EINVAL) + +lpm_enable = None +if sys.argv[2] == 'on': + lpm_enable = True +elif sys.argv[2] == 'off': + lpm_enable = False +else: + print "Unrecognized LPM parameter. Please use or values" + sys.exit(errno.EINVAL) + +# Init SDK API +rc, handle = sx_api_open(None) +if (rc != SX_STATUS_SUCCESS): + print "Failed to open api handle.\nPlease check that SDK is running." + sys.exit(errno.EACCES) + +pid = os.getpid() +rc = sxd_access_reg_init(pid, None, 0) +if (rc != 0): + print "Failed to initializing register access.\nPlease check that SDK is running." + sys.exit(errno.EACCES); + +# Get SFP module and log ports number and LPM status +sfp_module = int(sys.argv[1]) +log_port_list = get_log_ports(handle, sfp_module) +if not log_port_list: + print "Failed to get log ports" + sys.exit(errno.EACCES) + +# Get PMMP +pmmp = ku_pmmp_reg() +pmmp.module = sfp_module +meta = sxd_reg_meta_t() +meta.dev_id = 1 +meta.swid = 0 +meta.access_cmd = SXD_ACCESS_CMD_GET +rc = sxd_access_reg_pmmp(pmmp, meta, 1, None, None) +assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmmp failed, rc = %d" % rc + +# Disable admin status before LPM settings +set_sfp_admin_status(handle, meta, sfp_module, log_port_list, SX_PORT_ADMIN_STATUS_DOWN) + +# Set low power mode status +lpm_mask = 1 << 8 +if lpm_enable: + pmmp.eeprom_override = pmmp.eeprom_override | lpm_mask +else: + pmmp.eeprom_override = pmmp.eeprom_override & (~lpm_mask) + +meta.access_cmd = SXD_ACCESS_CMD_SET +rc = sxd_access_reg_pmmp(pmmp, meta, 1, None, None) +assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmmp failed, rc = %d" % rc + +# Enable admin status after LPM settings +set_sfp_admin_status(handle, meta, sfp_module, log_port_list, SX_PORT_ADMIN_STATUS_UP) diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfpreset.py b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfpreset.py new file mode 100644 index 000000000000..69fa2be614c2 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfpreset.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +import sys, errno +import os +from python_sdk_api.sxd_api import * +from python_sdk_api.sx_api import * + +# Check if SFP port number is provided +if len(sys.argv) < 2: + print "SFP module number or LPM is missed." + print "Usage: sfpreset.py " + sys.exit(errno.EINVAL) + +# Init SDK API +rc, handle = sx_api_open(None) +if (rc != SX_STATUS_SUCCESS): + print "Failed to open api handle.\nPlease check that SDK is running." + sys.exit(errno.EACCES) + +pid = os.getpid() +rc = sxd_access_reg_init(pid, None, 0) +if (rc != 0): + print "Failed to initializing register access.\nPlease check that SDK is running." + sys.exit(errno.EACCES) + +# Get SFP module number +sfp_module = int(sys.argv[1]) + +# Get PMAOS +pmaos = ku_pmaos_reg() +pmaos.module = sfp_module +meta = sxd_reg_meta_t() +meta.dev_id = 1 +meta.swid = 0 +meta.access_cmd = SXD_ACCESS_CMD_GET + +rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) +assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc + +# Reset SFP +pmaos.rst = 1 +meta.access_cmd = SXD_ACCESS_CMD_SET +rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) +assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc +print "Reset flag is set" diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfputil.py new file mode 100644 index 000000000000..6aef1310d51f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfputil.py @@ -0,0 +1,151 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + import subprocess + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 + + EEPROM_OFFSET = 1 + + _port_to_eeprom_mapping = {} + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/bsp/qsfp/qsfp{0}" + + for x in range(0, self.port_end + 1): + self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/bsp/qsfp/qsfp%d_status" % (port_num+1)) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string with the qsfp status + if content == "good": + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfplpmget.py {}".format(port_num) + + try: + output = subprocess.check_output(lpm_cmd, shell=True) + if 'LPM ON' in output: + return True + except subprocess.CalledProcessError as e: + print "Error! Unable to get LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) + return False + + return False + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + curr_lpmode = self.get_low_power_mode(port_num) + if curr_lpmode == lpmode: + return True + + lpm = 'on' if lpmode else 'off' + lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfplpmset.py {} {}".format(port_num, lpm) + sfp_port_names = self.physical_to_logical[port_num] + + # Get port admin status + try: + enabled_ports = subprocess.check_output("ip link show up", shell=True) + except subprocess.CalledProcessError as e: + print "Error! Unable to get ports status, err msg: {}".format(e.output) + return False + + port_to_disable = [] + for port in sfp_port_names: + if port in enabled_ports: + port_to_disable.append(port) + + # Disable ports before LPM settings + for port in port_to_disable: + try: + subprocess.check_output("ifconfig {} down".format(port), shell=True) + except subprocess.CalledProcessError as e: + print "Error! Unable to set admin status to DOWN for {}, rc = {}, err msg: {}".format(port, e.returncode, e.output) + return False + + time.sleep(3) + + # Set LPM + try: + subprocess.check_output(lpm_cmd, shell=True) + except subprocess.CalledProcessError as e: + print "Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) + return False + + # Enable ports after LPM settings + for port in port_to_disable: + try: + subprocess.check_output("ifconfig {} up".format(port), shell=True) + except subprocess.CalledProcessError as e: + print "Error! Unable to set admin status to UP for {}, rc = {}, err msg: {}".format(port, e.returncode, e.output) + return False + + return True + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfpreset.py {}".format(port_num) + + try: + subprocess.check_output(lpm_cmd, shell=True) + return True + except subprocess.CalledProcessError as e: + print "Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) + return False + + return False diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/sensors.conf b/device/mellanox/x86_64-mlnx_lssn2700-r0/sensors.conf new file mode 100644 index 000000000000..a3e30391863e --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/sensors.conf @@ -0,0 +1,21 @@ +bus "i2c-7" "i2c-1-mux (chan_id 5)" +chip "lm75-i2c-7-4a" + label temp1 "Ambient Port Temp" + +bus "i2c-5" "i2c-1-mux (chan_id 3)" +chip "ucd9200-i2c-5-27" + label in1 "UCD1 vin" + label in2 "ASIC 3.3 vout" + label in3 "ASIC 1.2 vout" + label temp1 "UCD1 Temp" + label temp2 "UCD1 Temp2" + +chip "ucd9200-i2c-5-41" + label in1 "UCD2 vin" + label in2 "ASIC Vcore vout" + label temp1 "UCD2 Temp1" + label temp2 "UCD2 Temp2" + +bus "i2c-17" "i2c-1-mux (chan_id 7)" +chip "lm75-i2c-17-49" + label temp1 "Ambient Board Temp" From 8a714c88c770f3a60abbe77724f3232bf906ebb0 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Mon, 16 Apr 2018 18:38:48 -0700 Subject: [PATCH 124/274] Use refactored Selectables from sonic-swss-common (#1604) --- dockers/docker-lldp-sv2/lldpmgrd | 2 +- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dockers/docker-lldp-sv2/lldpmgrd b/dockers/docker-lldp-sv2/lldpmgrd index b34bd49b3d8c..89bba918bf3d 100755 --- a/dockers/docker-lldp-sv2/lldpmgrd +++ b/dockers/docker-lldp-sv2/lldpmgrd @@ -195,7 +195,7 @@ class LldpManager(object): # Listen indefinitely for changes to the PORT table in the State DB while True: - (state, c, fd) = sel.select(SELECT_TIMEOUT_MS) + (state, c) = sel.select(SELECT_TIMEOUT_MS) if state == swsscommon.Select.OBJECT: (key, op, fvp) = sst.pop() diff --git a/src/sonic-sairedis b/src/sonic-sairedis index d1c52239635b..177f768c6ffe 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit d1c52239635b68c672a9c8f59854a474f3e99d3b +Subproject commit 177f768c6ffe0806ee500f739bd06203ab913b72 diff --git a/src/sonic-swss b/src/sonic-swss index 114faa4c5919..880c1e9284a1 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 114faa4c591917540933348801d9f96cffcd8ca1 +Subproject commit 880c1e9284a1737dfbb18ad5fa03d893482e4b18 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 821377734ab8..1ef337a96df3 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 821377734ab86ca931ffa45609c17a08c7859e99 +Subproject commit 1ef337a96df371162686b825964ed76bc68325c9 From 5c66beee66bbda88703d341712dbb678dc4a43ab Mon Sep 17 00:00:00 2001 From: hui-ma Date: Tue, 17 Apr 2018 10:14:07 -0700 Subject: [PATCH 125/274] [sonic-utilities] add pfcstat and queuestat tool (#1606) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 5e476d6d549c..ca11c1533fce 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 5e476d6d549cf40b68e86ae01dcb703b567b85e3 +Subproject commit ca11c1533fce57365824902c9bc382cb0b269554 From ee811f374e15e1d269bc2d8eb1dfb28a238783c5 Mon Sep 17 00:00:00 2001 From: padmanarayana Date: Wed, 18 Apr 2018 06:48:09 +0530 Subject: [PATCH 126/274] Add support for S6100 switchport LEDs (#1610) --- .../x86_64-dell_s6100_c2538-r0/led_proc_init.soc | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/led_proc_init.soc diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/led_proc_init.soc b/device/dell/x86_64-dell_s6100_c2538-r0/led_proc_init.soc new file mode 100644 index 000000000000..a4a44f15bcf1 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/led_proc_init.soc @@ -0,0 +1,13 @@ +# LED microprocessor initialization for Dell S6100 + +led 0 stop +led 0 prog 02 00 60 FE 2E FE 67 2C 86 FE 67 5B 67 5B 67 5B 86 FE 2E FE 67 2C 86 FE 86 FE 06 FE D2 40 71 04 12 FF 85 05 D2 05 71 2A 52 00 3A A0 32 08 97 71 33 77 5B 32 00 32 01 B7 97 75 42 12 BC FE FE 02 0A 50 12 BC FE FE 95 75 4C 85 77 54 16 FF DA 02 71 5B 77 54 22 0E 87 22 0E 87 57 22 0F 87 22 0F 87 57 22 0F 87 22 0E 87 57 +led 0 auto on +led 0 start + +led 1 stop +led 1 prog 02 00 60 FE 2E FE 67 2C 86 FE 67 5B 67 5B 67 5B 86 FE 2E FE 67 2C 86 FE 86 FE 06 FE D2 40 71 04 12 FF 85 05 D2 05 71 2A 52 00 3A A0 32 08 97 71 33 77 5B 32 00 32 01 B7 97 75 42 12 BC FE FE 02 0A 50 12 BC FE FE 95 75 4C 85 77 54 16 FF DA 02 71 5B 77 54 22 0E 87 22 0E 87 57 22 0F 87 22 0F 87 57 22 0F 87 22 0E 87 57 +led 1 auto on +led 1 start + +led 2 stop From 1ba00d27d0f20369aeca3852a1ce87c40817e2a2 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 17 Apr 2018 18:56:07 -0700 Subject: [PATCH 127/274] Update sonic-swss submodule (#1612) This includes priorities into orchagent --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 880c1e9284a1..e849afeeef0b 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 880c1e9284a1737dfbb18ad5fa03d893482e4b18 +Subproject commit e849afeeef0ba0d09facfe61a4b0912684021ac6 From 37280096909e5a5d03de444aadf7e19e70a3cd33 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Tue, 17 Apr 2018 20:15:46 -0700 Subject: [PATCH 128/274] [utilities]: Update sonic-utilities submodule (#1613) Signed-off-by: Sihui Han --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index ca11c1533fce..b2da06271c0a 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit ca11c1533fce57365824902c9bc382cb0b269554 +Subproject commit b2da06271c0ad9b9f054d16b8913f8279c9aea17 From 58584ca30ce8b083b7607fb5274a9222734aca3e Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 17 Apr 2018 21:10:17 -0700 Subject: [PATCH 129/274] [test] Adding Broadcom configuration file test (#1611) * [test] Adding Broadcom configuration file test In order to allow SONiC community to check in Broadcom configuration file directly under device folder. We need to add this test to make sure the contents of the configuration is compliant with Broadcom specifications. * Invoke test from Debian package builder * Use $() syntax * Remove the debug echo statement --- .../Arista-7260CX3-D108C8/sai.profile | 2 +- .../th2-a7260cx3-64-112x50G+8x100G.config.bcm | 939 ++++++++++++++++++ src/sonic-device-data/src/Makefile | 11 + src/sonic-device-data/tests/LICENSE | 42 + src/sonic-device-data/tests/config_checker | 92 ++ src/sonic-device-data/tests/permitted_list | 134 +++ 6 files changed, 1219 insertions(+), 1 deletion(-) create mode 100644 device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/th2-a7260cx3-64-112x50G+8x100G.config.bcm create mode 100644 src/sonic-device-data/src/Makefile create mode 100644 src/sonic-device-data/tests/LICENSE create mode 100755 src/sonic-device-data/tests/config_checker create mode 100644 src/sonic-device-data/tests/permitted_list diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/sai.profile b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/sai.profile index 9ceb20f96a48..235f2423df82 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/sai.profile +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th2-a7260cx3-64-112x50G+8x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th2-a7260cx3-64-112x50G+8x100G.config.bcm diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/th2-a7260cx3-64-112x50G+8x100G.config.bcm b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/th2-a7260cx3-64-112x50G+8x100G.config.bcm new file mode 100644 index 000000000000..120b13c037aa --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/th2-a7260cx3-64-112x50G+8x100G.config.bcm @@ -0,0 +1,939 @@ +PHY_AN_ALLOW_PLL_CHANGE=1 +arl_clean_timeout_usec=15000000 +asf_mem_profile=2 +bcm_num_cos=8 +bcm_stat_flags=1 +bcm_stat_jumbo=9236 +cdma_timeout_usec=15000000 +core_clock_frequency=1700 +dma_desc_timeout_usec=15000000 +dpp_clock_ratio=2:3 +higig2_hdr_mode=1 +ipv6_lpm_128b_enable=1 +l3_alpm_enable=2 +lpm_scaling_enable=0 +l2xmsg_mode=1 +max_vp_lags=0 +mem_scan_enable=1 +miim_intr_enable=0 +module_64ports=1 +os=unix +oversubscribe_mode=1 +pbmp_xport_xe=0xfffffffd3fffffff4fffffffc7ffffffe +#pbmp_xport_xe=0x47fffffff1fffffffcfffffffe7ffffffe +phy_an_allow_pll_change_hg=0 +phy_an_c73=1 +phy_chain_rx_lane_map_physical{1.0}=0x3210 +phy_chain_rx_lane_map_physical{101.0}=0x0123 +phy_chain_rx_lane_map_physical{105.0}=0x0123 +phy_chain_rx_lane_map_physical{109.0}=0x0123 +phy_chain_rx_lane_map_physical{113.0}=0x2301 +phy_chain_rx_lane_map_physical{117.0}=0x3210 +phy_chain_rx_lane_map_physical{121.0}=0x3210 +phy_chain_rx_lane_map_physical{125.0}=0x1203 +phy_chain_rx_lane_map_physical{129.0}=0x3210 +phy_chain_rx_lane_map_physical{13.0}=0x0321 +phy_chain_rx_lane_map_physical{133.0}=0x1032 +phy_chain_rx_lane_map_physical{137.0}=0x3210 +phy_chain_rx_lane_map_physical{141.0}=0x0123 +phy_chain_rx_lane_map_physical{145.0}=0x3210 +phy_chain_rx_lane_map_physical{149.0}=0x2310 +phy_chain_rx_lane_map_physical{153.0}=0x0132 +phy_chain_rx_lane_map_physical{157.0}=0x1302 +phy_chain_rx_lane_map_physical{161.0}=0x3021 +phy_chain_rx_lane_map_physical{165.0}=0x2031 +phy_chain_rx_lane_map_physical{169.0}=0x2031 +phy_chain_rx_lane_map_physical{17.0}=0x3210 +phy_chain_rx_lane_map_physical{173.0}=0x1302 +phy_chain_rx_lane_map_physical{177.0}=0x2031 +phy_chain_rx_lane_map_physical{181.0}=0x0213 +phy_chain_rx_lane_map_physical{185.0}=0x0213 +phy_chain_rx_lane_map_physical{189.0}=0x1302 +phy_chain_rx_lane_map_physical{193.0}=0x3120 +phy_chain_rx_lane_map_physical{197.0}=0x0231 +phy_chain_rx_lane_map_physical{201.0}=0x2031 +phy_chain_rx_lane_map_physical{205.0}=0x0213 +phy_chain_rx_lane_map_physical{209.0}=0x2013 +phy_chain_rx_lane_map_physical{21.0}=0x3021 +phy_chain_rx_lane_map_physical{213.0}=0x3021 +phy_chain_rx_lane_map_physical{217.0}=0x0231 +phy_chain_rx_lane_map_physical{221.0}=0x2031 +phy_chain_rx_lane_map_physical{225.0}=0x1203 +phy_chain_rx_lane_map_physical{229.0}=0x1230 +phy_chain_rx_lane_map_physical{233.0}=0x3021 +phy_chain_rx_lane_map_physical{237.0}=0x1032 +phy_chain_rx_lane_map_physical{241.0}=0x2301 +phy_chain_rx_lane_map_physical{245.0}=0x0321 +phy_chain_rx_lane_map_physical{249.0}=0x2301 +phy_chain_rx_lane_map_physical{25.0}=0x2301 +phy_chain_rx_lane_map_physical{253.0}=0x2301 +phy_chain_rx_lane_map_physical{257.0}=0x3210 +phy_chain_rx_lane_map_physical{29.0}=0x3021 +phy_chain_rx_lane_map_physical{33.0}=0x1302 +phy_chain_rx_lane_map_physical{37.0}=0x2031 +phy_chain_rx_lane_map_physical{41.0}=0x3021 +phy_chain_rx_lane_map_physical{45.0}=0x1023 +phy_chain_rx_lane_map_physical{49.0}=0x0213 +phy_chain_rx_lane_map_physical{5.0}=0x3201 +phy_chain_rx_lane_map_physical{53.0}=0x3201 +phy_chain_rx_lane_map_physical{57.0}=0x2013 +phy_chain_rx_lane_map_physical{61.0}=0x0213 +phy_chain_rx_lane_map_physical{65.0}=0x1203 +phy_chain_rx_lane_map_physical{69.0}=0x0213 +phy_chain_rx_lane_map_physical{73.0}=0x0213 +phy_chain_rx_lane_map_physical{77.0}=0x3120 +phy_chain_rx_lane_map_physical{81.0}=0x0213 +phy_chain_rx_lane_map_physical{85.0}=0x2031 +phy_chain_rx_lane_map_physical{89.0}=0x2031 +phy_chain_rx_lane_map_physical{9.0}=0x0321 +phy_chain_rx_lane_map_physical{93.0}=0x3120 +phy_chain_rx_lane_map_physical{97.0}=0x1203 +phy_chain_rx_polarity_flip_physical{1.0}=0x1 +phy_chain_rx_polarity_flip_physical{10.0}=0x0 +phy_chain_rx_polarity_flip_physical{100.0}=0x1 +phy_chain_rx_polarity_flip_physical{101.0}=0x1 +phy_chain_rx_polarity_flip_physical{102.0}=0x0 +phy_chain_rx_polarity_flip_physical{103.0}=0x1 +phy_chain_rx_polarity_flip_physical{104.0}=0x0 +phy_chain_rx_polarity_flip_physical{105.0}=0x1 +phy_chain_rx_polarity_flip_physical{106.0}=0x0 +phy_chain_rx_polarity_flip_physical{107.0}=0x1 +phy_chain_rx_polarity_flip_physical{108.0}=0x0 +phy_chain_rx_polarity_flip_physical{109.0}=0x0 +phy_chain_rx_polarity_flip_physical{11.0}=0x1 +phy_chain_rx_polarity_flip_physical{110.0}=0x1 +phy_chain_rx_polarity_flip_physical{111.0}=0x0 +phy_chain_rx_polarity_flip_physical{112.0}=0x1 +phy_chain_rx_polarity_flip_physical{113.0}=0x1 +phy_chain_rx_polarity_flip_physical{114.0}=0x0 +phy_chain_rx_polarity_flip_physical{115.0}=0x1 +phy_chain_rx_polarity_flip_physical{116.0}=0x0 +phy_chain_rx_polarity_flip_physical{117.0}=0x0 +phy_chain_rx_polarity_flip_physical{118.0}=0x0 +phy_chain_rx_polarity_flip_physical{119.0}=0x1 +phy_chain_rx_polarity_flip_physical{12.0}=0x1 +phy_chain_rx_polarity_flip_physical{120.0}=0x0 +phy_chain_rx_polarity_flip_physical{121.0}=0x1 +phy_chain_rx_polarity_flip_physical{122.0}=0x0 +phy_chain_rx_polarity_flip_physical{123.0}=0x1 +phy_chain_rx_polarity_flip_physical{124.0}=0x0 +phy_chain_rx_polarity_flip_physical{125.0}=0x0 +phy_chain_rx_polarity_flip_physical{126.0}=0x1 +phy_chain_rx_polarity_flip_physical{127.0}=0x1 +phy_chain_rx_polarity_flip_physical{128.0}=0x1 +phy_chain_rx_polarity_flip_physical{129.0}=0x0 +phy_chain_rx_polarity_flip_physical{13.0}=0x1 +phy_chain_rx_polarity_flip_physical{130.0}=0x1 +phy_chain_rx_polarity_flip_physical{131.0}=0x1 +phy_chain_rx_polarity_flip_physical{132.0}=0x0 +phy_chain_rx_polarity_flip_physical{133.0}=0x1 +phy_chain_rx_polarity_flip_physical{134.0}=0x1 +phy_chain_rx_polarity_flip_physical{135.0}=0x1 +phy_chain_rx_polarity_flip_physical{136.0}=0x0 +phy_chain_rx_polarity_flip_physical{137.0}=0x0 +phy_chain_rx_polarity_flip_physical{138.0}=0x0 +phy_chain_rx_polarity_flip_physical{139.0}=0x1 +phy_chain_rx_polarity_flip_physical{14.0}=0x0 +phy_chain_rx_polarity_flip_physical{140.0}=0x0 +phy_chain_rx_polarity_flip_physical{141.0}=0x1 +phy_chain_rx_polarity_flip_physical{142.0}=0x0 +phy_chain_rx_polarity_flip_physical{143.0}=0x1 +phy_chain_rx_polarity_flip_physical{144.0}=0x0 +phy_chain_rx_polarity_flip_physical{145.0}=0x1 +phy_chain_rx_polarity_flip_physical{146.0}=0x0 +phy_chain_rx_polarity_flip_physical{147.0}=0x1 +phy_chain_rx_polarity_flip_physical{148.0}=0x0 +phy_chain_rx_polarity_flip_physical{149.0}=0x0 +phy_chain_rx_polarity_flip_physical{15.0}=0x1 +phy_chain_rx_polarity_flip_physical{150.0}=0x1 +phy_chain_rx_polarity_flip_physical{151.0}=0x1 +phy_chain_rx_polarity_flip_physical{152.0}=0x0 +phy_chain_rx_polarity_flip_physical{153.0}=0x0 +phy_chain_rx_polarity_flip_physical{154.0}=0x1 +phy_chain_rx_polarity_flip_physical{155.0}=0x1 +phy_chain_rx_polarity_flip_physical{156.0}=0x0 +phy_chain_rx_polarity_flip_physical{157.0}=0x0 +phy_chain_rx_polarity_flip_physical{158.0}=0x0 +phy_chain_rx_polarity_flip_physical{159.0}=0x1 +phy_chain_rx_polarity_flip_physical{16.0}=0x0 +phy_chain_rx_polarity_flip_physical{160.0}=0x0 +phy_chain_rx_polarity_flip_physical{161.0}=0x1 +phy_chain_rx_polarity_flip_physical{162.0}=0x1 +phy_chain_rx_polarity_flip_physical{163.0}=0x0 +phy_chain_rx_polarity_flip_physical{164.0}=0x1 +phy_chain_rx_polarity_flip_physical{165.0}=0x0 +phy_chain_rx_polarity_flip_physical{166.0}=0x0 +phy_chain_rx_polarity_flip_physical{167.0}=0x1 +phy_chain_rx_polarity_flip_physical{168.0}=0x1 +phy_chain_rx_polarity_flip_physical{169.0}=0x1 +phy_chain_rx_polarity_flip_physical{17.0}=0x1 +phy_chain_rx_polarity_flip_physical{170.0}=0x1 +phy_chain_rx_polarity_flip_physical{171.0}=0x0 +phy_chain_rx_polarity_flip_physical{172.0}=0x0 +phy_chain_rx_polarity_flip_physical{173.0}=0x0 +phy_chain_rx_polarity_flip_physical{174.0}=0x0 +phy_chain_rx_polarity_flip_physical{175.0}=0x1 +phy_chain_rx_polarity_flip_physical{176.0}=0x1 +phy_chain_rx_polarity_flip_physical{177.0}=0x1 +phy_chain_rx_polarity_flip_physical{178.0}=0x1 +phy_chain_rx_polarity_flip_physical{179.0}=0x0 +phy_chain_rx_polarity_flip_physical{18.0}=0x0 +phy_chain_rx_polarity_flip_physical{180.0}=0x0 +phy_chain_rx_polarity_flip_physical{181.0}=0x1 +phy_chain_rx_polarity_flip_physical{182.0}=0x1 +phy_chain_rx_polarity_flip_physical{183.0}=0x0 +phy_chain_rx_polarity_flip_physical{184.0}=0x0 +phy_chain_rx_polarity_flip_physical{185.0}=0x0 +phy_chain_rx_polarity_flip_physical{186.0}=0x0 +phy_chain_rx_polarity_flip_physical{187.0}=0x1 +phy_chain_rx_polarity_flip_physical{188.0}=0x1 +phy_chain_rx_polarity_flip_physical{189.0}=0x0 +phy_chain_rx_polarity_flip_physical{19.0}=0x1 +phy_chain_rx_polarity_flip_physical{190.0}=0x0 +phy_chain_rx_polarity_flip_physical{191.0}=0x1 +phy_chain_rx_polarity_flip_physical{192.0}=0x0 +phy_chain_rx_polarity_flip_physical{193.0}=0x0 +phy_chain_rx_polarity_flip_physical{194.0}=0x0 +phy_chain_rx_polarity_flip_physical{195.0}=0x1 +phy_chain_rx_polarity_flip_physical{196.0}=0x1 +phy_chain_rx_polarity_flip_physical{197.0}=0x1 +phy_chain_rx_polarity_flip_physical{198.0}=0x1 +phy_chain_rx_polarity_flip_physical{199.0}=0x0 +phy_chain_rx_polarity_flip_physical{2.0}=0x0 +phy_chain_rx_polarity_flip_physical{20.0}=0x0 +phy_chain_rx_polarity_flip_physical{200.0}=0x0 +phy_chain_rx_polarity_flip_physical{201.0}=0x0 +phy_chain_rx_polarity_flip_physical{202.0}=0x0 +phy_chain_rx_polarity_flip_physical{203.0}=0x1 +phy_chain_rx_polarity_flip_physical{204.0}=0x0 +phy_chain_rx_polarity_flip_physical{205.0}=0x1 +phy_chain_rx_polarity_flip_physical{206.0}=0x1 +phy_chain_rx_polarity_flip_physical{207.0}=0x0 +phy_chain_rx_polarity_flip_physical{208.0}=0x0 +phy_chain_rx_polarity_flip_physical{209.0}=0x1 +phy_chain_rx_polarity_flip_physical{21.0}=0x0 +phy_chain_rx_polarity_flip_physical{210.0}=0x1 +phy_chain_rx_polarity_flip_physical{211.0}=0x0 +phy_chain_rx_polarity_flip_physical{212.0}=0x0 +phy_chain_rx_polarity_flip_physical{213.0}=0x0 +phy_chain_rx_polarity_flip_physical{214.0}=0x0 +phy_chain_rx_polarity_flip_physical{215.0}=0x1 +phy_chain_rx_polarity_flip_physical{216.0}=0x0 +phy_chain_rx_polarity_flip_physical{217.0}=0x0 +phy_chain_rx_polarity_flip_physical{218.0}=0x0 +phy_chain_rx_polarity_flip_physical{219.0}=0x1 +phy_chain_rx_polarity_flip_physical{22.0}=0x0 +phy_chain_rx_polarity_flip_physical{220.0}=0x1 +phy_chain_rx_polarity_flip_physical{221.0}=0x0 +phy_chain_rx_polarity_flip_physical{222.0}=0x0 +phy_chain_rx_polarity_flip_physical{223.0}=0x1 +phy_chain_rx_polarity_flip_physical{224.0}=0x1 +phy_chain_rx_polarity_flip_physical{225.0}=0x1 +phy_chain_rx_polarity_flip_physical{226.0}=0x0 +phy_chain_rx_polarity_flip_physical{227.0}=0x0 +phy_chain_rx_polarity_flip_physical{228.0}=0x1 +phy_chain_rx_polarity_flip_physical{229.0}=0x0 +phy_chain_rx_polarity_flip_physical{23.0}=0x1 +phy_chain_rx_polarity_flip_physical{230.0}=0x0 +phy_chain_rx_polarity_flip_physical{231.0}=0x1 +phy_chain_rx_polarity_flip_physical{232.0}=0x1 +phy_chain_rx_polarity_flip_physical{233.0}=0x1 +phy_chain_rx_polarity_flip_physical{234.0}=0x0 +phy_chain_rx_polarity_flip_physical{235.0}=0x0 +phy_chain_rx_polarity_flip_physical{236.0}=0x0 +phy_chain_rx_polarity_flip_physical{237.0}=0x1 +phy_chain_rx_polarity_flip_physical{238.0}=0x0 +phy_chain_rx_polarity_flip_physical{239.0}=0x1 +phy_chain_rx_polarity_flip_physical{24.0}=0x0 +phy_chain_rx_polarity_flip_physical{240.0}=0x0 +phy_chain_rx_polarity_flip_physical{241.0}=0x1 +phy_chain_rx_polarity_flip_physical{242.0}=0x0 +phy_chain_rx_polarity_flip_physical{243.0}=0x1 +phy_chain_rx_polarity_flip_physical{244.0}=0x0 +phy_chain_rx_polarity_flip_physical{245.0}=0x1 +phy_chain_rx_polarity_flip_physical{246.0}=0x1 +phy_chain_rx_polarity_flip_physical{247.0}=0x1 +phy_chain_rx_polarity_flip_physical{248.0}=0x0 +phy_chain_rx_polarity_flip_physical{249.0}=0x0 +phy_chain_rx_polarity_flip_physical{25.0}=0x1 +phy_chain_rx_polarity_flip_physical{250.0}=0x1 +phy_chain_rx_polarity_flip_physical{251.0}=0x0 +phy_chain_rx_polarity_flip_physical{252.0}=0x1 +phy_chain_rx_polarity_flip_physical{253.0}=0x1 +phy_chain_rx_polarity_flip_physical{254.0}=0x0 +phy_chain_rx_polarity_flip_physical{255.0}=0x1 +phy_chain_rx_polarity_flip_physical{256.0}=0x0 +phy_chain_rx_polarity_flip_physical{257.0}=0x0 +phy_chain_rx_polarity_flip_physical{259.0}=0x0 +phy_chain_rx_polarity_flip_physical{26.0}=0x0 +phy_chain_rx_polarity_flip_physical{27.0}=0x1 +phy_chain_rx_polarity_flip_physical{28.0}=0x0 +phy_chain_rx_polarity_flip_physical{29.0}=0x0 +phy_chain_rx_polarity_flip_physical{3.0}=0x1 +phy_chain_rx_polarity_flip_physical{30.0}=0x0 +phy_chain_rx_polarity_flip_physical{31.0}=0x0 +phy_chain_rx_polarity_flip_physical{32.0}=0x1 +phy_chain_rx_polarity_flip_physical{33.0}=0x0 +phy_chain_rx_polarity_flip_physical{34.0}=0x0 +phy_chain_rx_polarity_flip_physical{35.0}=0x1 +phy_chain_rx_polarity_flip_physical{36.0}=0x1 +phy_chain_rx_polarity_flip_physical{37.0}=0x1 +phy_chain_rx_polarity_flip_physical{38.0}=0x1 +phy_chain_rx_polarity_flip_physical{39.0}=0x0 +phy_chain_rx_polarity_flip_physical{4.0}=0x0 +phy_chain_rx_polarity_flip_physical{40.0}=0x0 +phy_chain_rx_polarity_flip_physical{41.0}=0x0 +phy_chain_rx_polarity_flip_physical{42.0}=0x1 +phy_chain_rx_polarity_flip_physical{43.0}=0x1 +phy_chain_rx_polarity_flip_physical{44.0}=0x1 +phy_chain_rx_polarity_flip_physical{45.0}=0x1 +phy_chain_rx_polarity_flip_physical{46.0}=0x0 +phy_chain_rx_polarity_flip_physical{47.0}=0x0 +phy_chain_rx_polarity_flip_physical{48.0}=0x1 +phy_chain_rx_polarity_flip_physical{49.0}=0x1 +phy_chain_rx_polarity_flip_physical{5.0}=0x1 +phy_chain_rx_polarity_flip_physical{50.0}=0x1 +phy_chain_rx_polarity_flip_physical{51.0}=0x0 +phy_chain_rx_polarity_flip_physical{52.0}=0x0 +phy_chain_rx_polarity_flip_physical{53.0}=0x0 +phy_chain_rx_polarity_flip_physical{54.0}=0x0 +phy_chain_rx_polarity_flip_physical{55.0}=0x1 +phy_chain_rx_polarity_flip_physical{56.0}=0x0 +phy_chain_rx_polarity_flip_physical{57.0}=0x0 +phy_chain_rx_polarity_flip_physical{58.0}=0x0 +phy_chain_rx_polarity_flip_physical{59.0}=0x1 +phy_chain_rx_polarity_flip_physical{6.0}=0x0 +phy_chain_rx_polarity_flip_physical{60.0}=0x1 +phy_chain_rx_polarity_flip_physical{61.0}=0x0 +phy_chain_rx_polarity_flip_physical{62.0}=0x0 +phy_chain_rx_polarity_flip_physical{63.0}=0x1 +phy_chain_rx_polarity_flip_physical{64.0}=0x1 +phy_chain_rx_polarity_flip_physical{65.0}=0x1 +phy_chain_rx_polarity_flip_physical{66.0}=0x1 +phy_chain_rx_polarity_flip_physical{67.0}=0x0 +phy_chain_rx_polarity_flip_physical{68.0}=0x1 +phy_chain_rx_polarity_flip_physical{69.0}=0x0 +phy_chain_rx_polarity_flip_physical{7.0}=0x0 +phy_chain_rx_polarity_flip_physical{70.0}=0x0 +phy_chain_rx_polarity_flip_physical{71.0}=0x1 +phy_chain_rx_polarity_flip_physical{72.0}=0x1 +phy_chain_rx_polarity_flip_physical{73.0}=0x1 +phy_chain_rx_polarity_flip_physical{74.0}=0x1 +phy_chain_rx_polarity_flip_physical{75.0}=0x0 +phy_chain_rx_polarity_flip_physical{76.0}=0x0 +phy_chain_rx_polarity_flip_physical{77.0}=0x0 +phy_chain_rx_polarity_flip_physical{78.0}=0x0 +phy_chain_rx_polarity_flip_physical{79.0}=0x1 +phy_chain_rx_polarity_flip_physical{8.0}=0x1 +phy_chain_rx_polarity_flip_physical{80.0}=0x1 +phy_chain_rx_polarity_flip_physical{81.0}=0x1 +phy_chain_rx_polarity_flip_physical{82.0}=0x1 +phy_chain_rx_polarity_flip_physical{83.0}=0x0 +phy_chain_rx_polarity_flip_physical{84.0}=0x0 +phy_chain_rx_polarity_flip_physical{85.0}=0x1 +phy_chain_rx_polarity_flip_physical{86.0}=0x1 +phy_chain_rx_polarity_flip_physical{87.0}=0x0 +phy_chain_rx_polarity_flip_physical{88.0}=0x0 +phy_chain_rx_polarity_flip_physical{89.0}=0x0 +phy_chain_rx_polarity_flip_physical{9.0}=0x1 +phy_chain_rx_polarity_flip_physical{90.0}=0x0 +phy_chain_rx_polarity_flip_physical{91.0}=0x1 +phy_chain_rx_polarity_flip_physical{92.0}=0x1 +phy_chain_rx_polarity_flip_physical{93.0}=0x0 +phy_chain_rx_polarity_flip_physical{94.0}=0x0 +phy_chain_rx_polarity_flip_physical{95.0}=0x1 +phy_chain_rx_polarity_flip_physical{96.0}=0x0 +phy_chain_rx_polarity_flip_physical{97.0}=0x1 +phy_chain_rx_polarity_flip_physical{98.0}=0x1 +phy_chain_rx_polarity_flip_physical{99.0}=0x0 +phy_chain_tx_lane_map_physical{1.0}=0x2031 +phy_chain_tx_lane_map_physical{101.0}=0x1023 +phy_chain_tx_lane_map_physical{105.0}=0x1302 +phy_chain_tx_lane_map_physical{109.0}=0x0321 +phy_chain_tx_lane_map_physical{113.0}=0x2301 +phy_chain_tx_lane_map_physical{117.0}=0x3120 +phy_chain_tx_lane_map_physical{121.0}=0x3102 +phy_chain_tx_lane_map_physical{125.0}=0x3210 +phy_chain_tx_lane_map_physical{129.0}=0x1023 +phy_chain_tx_lane_map_physical{13.0}=0x3021 +phy_chain_tx_lane_map_physical{133.0}=0x3210 +phy_chain_tx_lane_map_physical{137.0}=0x2031 +phy_chain_tx_lane_map_physical{141.0}=0x1302 +phy_chain_tx_lane_map_physical{145.0}=0x3210 +phy_chain_tx_lane_map_physical{149.0}=0x0213 +phy_chain_tx_lane_map_physical{153.0}=0x3210 +phy_chain_tx_lane_map_physical{157.0}=0x1320 +phy_chain_tx_lane_map_physical{161.0}=0x3210 +phy_chain_tx_lane_map_physical{165.0}=0x0231 +phy_chain_tx_lane_map_physical{169.0}=0x3120 +phy_chain_tx_lane_map_physical{17.0}=0x1032 +phy_chain_tx_lane_map_physical{173.0}=0x0312 +phy_chain_tx_lane_map_physical{177.0}=0x0231 +phy_chain_tx_lane_map_physical{181.0}=0x3210 +phy_chain_tx_lane_map_physical{185.0}=0x3210 +phy_chain_tx_lane_map_physical{189.0}=0x1320 +phy_chain_tx_lane_map_physical{193.0}=0x0321 +phy_chain_tx_lane_map_physical{197.0}=0x3120 +phy_chain_tx_lane_map_physical{201.0}=0x3120 +phy_chain_tx_lane_map_physical{205.0}=0x0123 +phy_chain_tx_lane_map_physical{209.0}=0x3120 +phy_chain_tx_lane_map_physical{21.0}=0x0213 +phy_chain_tx_lane_map_physical{213.0}=0x3021 +phy_chain_tx_lane_map_physical{217.0}=0x0312 +phy_chain_tx_lane_map_physical{221.0}=0x2301 +phy_chain_tx_lane_map_physical{225.0}=0x0123 +phy_chain_tx_lane_map_physical{229.0}=0x2031 +phy_chain_tx_lane_map_physical{233.0}=0x0231 +phy_chain_tx_lane_map_physical{237.0}=0x0213 +phy_chain_tx_lane_map_physical{241.0}=0x1320 +phy_chain_tx_lane_map_physical{245.0}=0x2031 +phy_chain_tx_lane_map_physical{249.0}=0x3120 +phy_chain_tx_lane_map_physical{25.0}=0x0231 +phy_chain_tx_lane_map_physical{253.0}=0x0321 +phy_chain_tx_lane_map_physical{257.0}=0x3210 +phy_chain_tx_lane_map_physical{29.0}=0x1230 +phy_chain_tx_lane_map_physical{33.0}=0x1032 +phy_chain_tx_lane_map_physical{37.0}=0x0123 +phy_chain_tx_lane_map_physical{41.0}=0x0213 +phy_chain_tx_lane_map_physical{45.0}=0x0132 +phy_chain_tx_lane_map_physical{49.0}=0x2031 +phy_chain_tx_lane_map_physical{5.0}=0x2301 +phy_chain_tx_lane_map_physical{53.0}=0x2301 +phy_chain_tx_lane_map_physical{57.0}=0x2031 +phy_chain_tx_lane_map_physical{61.0}=0x2031 +phy_chain_tx_lane_map_physical{65.0}=0x1230 +phy_chain_tx_lane_map_physical{69.0}=0x2013 +phy_chain_tx_lane_map_physical{73.0}=0x0213 +phy_chain_tx_lane_map_physical{77.0}=0x2310 +phy_chain_tx_lane_map_physical{81.0}=0x0321 +phy_chain_tx_lane_map_physical{85.0}=0x2013 +phy_chain_tx_lane_map_physical{89.0}=0x0213 +phy_chain_tx_lane_map_physical{9.0}=0x3012 +phy_chain_tx_lane_map_physical{93.0}=0x3102 +phy_chain_tx_lane_map_physical{97.0}=0x3210 +phy_chain_tx_polarity_flip_physical{1.0}=0x0 +phy_chain_tx_polarity_flip_physical{10.0}=0x1 +phy_chain_tx_polarity_flip_physical{100.0}=0x0 +phy_chain_tx_polarity_flip_physical{101.0}=0x0 +phy_chain_tx_polarity_flip_physical{102.0}=0x1 +phy_chain_tx_polarity_flip_physical{103.0}=0x0 +phy_chain_tx_polarity_flip_physical{104.0}=0x0 +phy_chain_tx_polarity_flip_physical{105.0}=0x0 +phy_chain_tx_polarity_flip_physical{106.0}=0x1 +phy_chain_tx_polarity_flip_physical{107.0}=0x1 +phy_chain_tx_polarity_flip_physical{108.0}=0x1 +phy_chain_tx_polarity_flip_physical{109.0}=0x0 +phy_chain_tx_polarity_flip_physical{11.0}=0x1 +phy_chain_tx_polarity_flip_physical{110.0}=0x0 +phy_chain_tx_polarity_flip_physical{111.0}=0x0 +phy_chain_tx_polarity_flip_physical{112.0}=0x1 +phy_chain_tx_polarity_flip_physical{113.0}=0x1 +phy_chain_tx_polarity_flip_physical{114.0}=0x1 +phy_chain_tx_polarity_flip_physical{115.0}=0x1 +phy_chain_tx_polarity_flip_physical{116.0}=0x0 +phy_chain_tx_polarity_flip_physical{117.0}=0x1 +phy_chain_tx_polarity_flip_physical{118.0}=0x0 +phy_chain_tx_polarity_flip_physical{119.0}=0x0 +phy_chain_tx_polarity_flip_physical{12.0}=0x0 +phy_chain_tx_polarity_flip_physical{120.0}=0x0 +phy_chain_tx_polarity_flip_physical{121.0}=0x0 +phy_chain_tx_polarity_flip_physical{122.0}=0x0 +phy_chain_tx_polarity_flip_physical{123.0}=0x0 +phy_chain_tx_polarity_flip_physical{124.0}=0x1 +phy_chain_tx_polarity_flip_physical{125.0}=0x0 +phy_chain_tx_polarity_flip_physical{126.0}=0x1 +phy_chain_tx_polarity_flip_physical{127.0}=0x1 +phy_chain_tx_polarity_flip_physical{128.0}=0x1 +phy_chain_tx_polarity_flip_physical{129.0}=0x1 +phy_chain_tx_polarity_flip_physical{13.0}=0x0 +phy_chain_tx_polarity_flip_physical{130.0}=0x0 +phy_chain_tx_polarity_flip_physical{131.0}=0x1 +phy_chain_tx_polarity_flip_physical{132.0}=0x0 +phy_chain_tx_polarity_flip_physical{133.0}=0x1 +phy_chain_tx_polarity_flip_physical{134.0}=0x1 +phy_chain_tx_polarity_flip_physical{135.0}=0x1 +phy_chain_tx_polarity_flip_physical{136.0}=0x1 +phy_chain_tx_polarity_flip_physical{137.0}=0x1 +phy_chain_tx_polarity_flip_physical{138.0}=0x1 +phy_chain_tx_polarity_flip_physical{139.0}=0x1 +phy_chain_tx_polarity_flip_physical{14.0}=0x1 +phy_chain_tx_polarity_flip_physical{140.0}=0x1 +phy_chain_tx_polarity_flip_physical{141.0}=0x0 +phy_chain_tx_polarity_flip_physical{142.0}=0x1 +phy_chain_tx_polarity_flip_physical{143.0}=0x1 +phy_chain_tx_polarity_flip_physical{144.0}=0x1 +phy_chain_tx_polarity_flip_physical{145.0}=0x1 +phy_chain_tx_polarity_flip_physical{146.0}=0x1 +phy_chain_tx_polarity_flip_physical{147.0}=0x1 +phy_chain_tx_polarity_flip_physical{148.0}=0x0 +phy_chain_tx_polarity_flip_physical{149.0}=0x1 +phy_chain_tx_polarity_flip_physical{15.0}=0x0 +phy_chain_tx_polarity_flip_physical{150.0}=0x0 +phy_chain_tx_polarity_flip_physical{151.0}=0x0 +phy_chain_tx_polarity_flip_physical{152.0}=0x0 +phy_chain_tx_polarity_flip_physical{153.0}=0x1 +phy_chain_tx_polarity_flip_physical{154.0}=0x0 +phy_chain_tx_polarity_flip_physical{155.0}=0x0 +phy_chain_tx_polarity_flip_physical{156.0}=0x0 +phy_chain_tx_polarity_flip_physical{157.0}=0x0 +phy_chain_tx_polarity_flip_physical{158.0}=0x0 +phy_chain_tx_polarity_flip_physical{159.0}=0x0 +phy_chain_tx_polarity_flip_physical{16.0}=0x0 +phy_chain_tx_polarity_flip_physical{160.0}=0x0 +phy_chain_tx_polarity_flip_physical{161.0}=0x0 +phy_chain_tx_polarity_flip_physical{162.0}=0x1 +phy_chain_tx_polarity_flip_physical{163.0}=0x1 +phy_chain_tx_polarity_flip_physical{164.0}=0x0 +phy_chain_tx_polarity_flip_physical{165.0}=0x1 +phy_chain_tx_polarity_flip_physical{166.0}=0x1 +phy_chain_tx_polarity_flip_physical{167.0}=0x1 +phy_chain_tx_polarity_flip_physical{168.0}=0x0 +phy_chain_tx_polarity_flip_physical{169.0}=0x0 +phy_chain_tx_polarity_flip_physical{17.0}=0x0 +phy_chain_tx_polarity_flip_physical{170.0}=0x1 +phy_chain_tx_polarity_flip_physical{171.0}=0x1 +phy_chain_tx_polarity_flip_physical{172.0}=0x1 +phy_chain_tx_polarity_flip_physical{173.0}=0x0 +phy_chain_tx_polarity_flip_physical{174.0}=0x0 +phy_chain_tx_polarity_flip_physical{175.0}=0x1 +phy_chain_tx_polarity_flip_physical{176.0}=0x0 +phy_chain_tx_polarity_flip_physical{177.0}=0x1 +phy_chain_tx_polarity_flip_physical{178.0}=0x0 +phy_chain_tx_polarity_flip_physical{179.0}=0x0 +phy_chain_tx_polarity_flip_physical{18.0}=0x1 +phy_chain_tx_polarity_flip_physical{180.0}=0x0 +phy_chain_tx_polarity_flip_physical{181.0}=0x0 +phy_chain_tx_polarity_flip_physical{182.0}=0x0 +phy_chain_tx_polarity_flip_physical{183.0}=0x0 +phy_chain_tx_polarity_flip_physical{184.0}=0x1 +phy_chain_tx_polarity_flip_physical{185.0}=0x0 +phy_chain_tx_polarity_flip_physical{186.0}=0x1 +phy_chain_tx_polarity_flip_physical{187.0}=0x1 +phy_chain_tx_polarity_flip_physical{188.0}=0x1 +phy_chain_tx_polarity_flip_physical{189.0}=0x0 +phy_chain_tx_polarity_flip_physical{19.0}=0x1 +phy_chain_tx_polarity_flip_physical{190.0}=0x0 +phy_chain_tx_polarity_flip_physical{191.0}=0x0 +phy_chain_tx_polarity_flip_physical{192.0}=0x0 +phy_chain_tx_polarity_flip_physical{193.0}=0x1 +phy_chain_tx_polarity_flip_physical{194.0}=0x1 +phy_chain_tx_polarity_flip_physical{195.0}=0x1 +phy_chain_tx_polarity_flip_physical{196.0}=0x0 +phy_chain_tx_polarity_flip_physical{197.0}=0x0 +phy_chain_tx_polarity_flip_physical{198.0}=0x1 +phy_chain_tx_polarity_flip_physical{199.0}=0x1 +phy_chain_tx_polarity_flip_physical{2.0}=0x1 +phy_chain_tx_polarity_flip_physical{20.0}=0x1 +phy_chain_tx_polarity_flip_physical{200.0}=0x1 +phy_chain_tx_polarity_flip_physical{201.0}=0x1 +phy_chain_tx_polarity_flip_physical{202.0}=0x1 +phy_chain_tx_polarity_flip_physical{203.0}=0x1 +phy_chain_tx_polarity_flip_physical{204.0}=0x1 +phy_chain_tx_polarity_flip_physical{205.0}=0x0 +phy_chain_tx_polarity_flip_physical{206.0}=0x1 +phy_chain_tx_polarity_flip_physical{207.0}=0x1 +phy_chain_tx_polarity_flip_physical{208.0}=0x1 +phy_chain_tx_polarity_flip_physical{209.0}=0x1 +phy_chain_tx_polarity_flip_physical{21.0}=0x0 +phy_chain_tx_polarity_flip_physical{210.0}=0x1 +phy_chain_tx_polarity_flip_physical{211.0}=0x1 +phy_chain_tx_polarity_flip_physical{212.0}=0x0 +phy_chain_tx_polarity_flip_physical{213.0}=0x0 +phy_chain_tx_polarity_flip_physical{214.0}=0x1 +phy_chain_tx_polarity_flip_physical{215.0}=0x0 +phy_chain_tx_polarity_flip_physical{216.0}=0x1 +phy_chain_tx_polarity_flip_physical{217.0}=0x1 +phy_chain_tx_polarity_flip_physical{218.0}=0x1 +phy_chain_tx_polarity_flip_physical{219.0}=0x0 +phy_chain_tx_polarity_flip_physical{22.0}=0x0 +phy_chain_tx_polarity_flip_physical{220.0}=0x1 +phy_chain_tx_polarity_flip_physical{221.0}=0x0 +phy_chain_tx_polarity_flip_physical{222.0}=0x0 +phy_chain_tx_polarity_flip_physical{223.0}=0x0 +phy_chain_tx_polarity_flip_physical{224.0}=0x1 +phy_chain_tx_polarity_flip_physical{225.0}=0x1 +phy_chain_tx_polarity_flip_physical{226.0}=0x1 +phy_chain_tx_polarity_flip_physical{227.0}=0x1 +phy_chain_tx_polarity_flip_physical{228.0}=0x0 +phy_chain_tx_polarity_flip_physical{229.0}=0x0 +phy_chain_tx_polarity_flip_physical{23.0}=0x0 +phy_chain_tx_polarity_flip_physical{230.0}=0x1 +phy_chain_tx_polarity_flip_physical{231.0}=0x1 +phy_chain_tx_polarity_flip_physical{232.0}=0x1 +phy_chain_tx_polarity_flip_physical{233.0}=0x0 +phy_chain_tx_polarity_flip_physical{234.0}=0x0 +phy_chain_tx_polarity_flip_physical{235.0}=0x0 +phy_chain_tx_polarity_flip_physical{236.0}=0x0 +phy_chain_tx_polarity_flip_physical{237.0}=0x1 +phy_chain_tx_polarity_flip_physical{238.0}=0x1 +phy_chain_tx_polarity_flip_physical{239.0}=0x1 +phy_chain_tx_polarity_flip_physical{24.0}=0x0 +phy_chain_tx_polarity_flip_physical{240.0}=0x0 +phy_chain_tx_polarity_flip_physical{241.0}=0x1 +phy_chain_tx_polarity_flip_physical{242.0}=0x1 +phy_chain_tx_polarity_flip_physical{243.0}=0x1 +phy_chain_tx_polarity_flip_physical{244.0}=0x0 +phy_chain_tx_polarity_flip_physical{245.0}=0x1 +phy_chain_tx_polarity_flip_physical{246.0}=0x1 +phy_chain_tx_polarity_flip_physical{247.0}=0x1 +phy_chain_tx_polarity_flip_physical{248.0}=0x1 +phy_chain_tx_polarity_flip_physical{249.0}=0x1 +phy_chain_tx_polarity_flip_physical{25.0}=0x1 +phy_chain_tx_polarity_flip_physical{250.0}=0x0 +phy_chain_tx_polarity_flip_physical{251.0}=0x0 +phy_chain_tx_polarity_flip_physical{252.0}=0x0 +phy_chain_tx_polarity_flip_physical{253.0}=0x1 +phy_chain_tx_polarity_flip_physical{254.0}=0x1 +phy_chain_tx_polarity_flip_physical{255.0}=0x1 +phy_chain_tx_polarity_flip_physical{256.0}=0x0 +phy_chain_tx_polarity_flip_physical{257.0}=0x0 +phy_chain_tx_polarity_flip_physical{259.0}=0x0 +phy_chain_tx_polarity_flip_physical{26.0}=0x0 +phy_chain_tx_polarity_flip_physical{27.0}=0x0 +phy_chain_tx_polarity_flip_physical{28.0}=0x0 +phy_chain_tx_polarity_flip_physical{29.0}=0x1 +phy_chain_tx_polarity_flip_physical{3.0}=0x1 +phy_chain_tx_polarity_flip_physical{30.0}=0x1 +phy_chain_tx_polarity_flip_physical{31.0}=0x1 +phy_chain_tx_polarity_flip_physical{32.0}=0x0 +phy_chain_tx_polarity_flip_physical{33.0}=0x0 +phy_chain_tx_polarity_flip_physical{34.0}=0x0 +phy_chain_tx_polarity_flip_physical{35.0}=0x0 +phy_chain_tx_polarity_flip_physical{36.0}=0x1 +phy_chain_tx_polarity_flip_physical{37.0}=0x1 +phy_chain_tx_polarity_flip_physical{38.0}=0x1 +phy_chain_tx_polarity_flip_physical{39.0}=0x1 +phy_chain_tx_polarity_flip_physical{4.0}=0x1 +phy_chain_tx_polarity_flip_physical{40.0}=0x0 +phy_chain_tx_polarity_flip_physical{41.0}=0x0 +phy_chain_tx_polarity_flip_physical{42.0}=0x0 +phy_chain_tx_polarity_flip_physical{43.0}=0x0 +phy_chain_tx_polarity_flip_physical{44.0}=0x0 +phy_chain_tx_polarity_flip_physical{45.0}=0x1 +phy_chain_tx_polarity_flip_physical{46.0}=0x0 +phy_chain_tx_polarity_flip_physical{47.0}=0x1 +phy_chain_tx_polarity_flip_physical{48.0}=0x1 +phy_chain_tx_polarity_flip_physical{49.0}=0x0 +phy_chain_tx_polarity_flip_physical{5.0}=0x1 +phy_chain_tx_polarity_flip_physical{50.0}=0x0 +phy_chain_tx_polarity_flip_physical{51.0}=0x0 +phy_chain_tx_polarity_flip_physical{52.0}=0x1 +phy_chain_tx_polarity_flip_physical{53.0}=0x0 +phy_chain_tx_polarity_flip_physical{54.0}=0x1 +phy_chain_tx_polarity_flip_physical{55.0}=0x1 +phy_chain_tx_polarity_flip_physical{56.0}=0x0 +phy_chain_tx_polarity_flip_physical{57.0}=0x0 +phy_chain_tx_polarity_flip_physical{58.0}=0x1 +phy_chain_tx_polarity_flip_physical{59.0}=0x1 +phy_chain_tx_polarity_flip_physical{6.0}=0x1 +phy_chain_tx_polarity_flip_physical{60.0}=0x1 +phy_chain_tx_polarity_flip_physical{61.0}=0x0 +phy_chain_tx_polarity_flip_physical{62.0}=0x1 +phy_chain_tx_polarity_flip_physical{63.0}=0x1 +phy_chain_tx_polarity_flip_physical{64.0}=0x1 +phy_chain_tx_polarity_flip_physical{65.0}=0x0 +phy_chain_tx_polarity_flip_physical{66.0}=0x1 +phy_chain_tx_polarity_flip_physical{67.0}=0x1 +phy_chain_tx_polarity_flip_physical{68.0}=0x0 +phy_chain_tx_polarity_flip_physical{69.0}=0x1 +phy_chain_tx_polarity_flip_physical{7.0}=0x1 +phy_chain_tx_polarity_flip_physical{70.0}=0x1 +phy_chain_tx_polarity_flip_physical{71.0}=0x1 +phy_chain_tx_polarity_flip_physical{72.0}=0x0 +phy_chain_tx_polarity_flip_physical{73.0}=0x1 +phy_chain_tx_polarity_flip_physical{74.0}=0x0 +phy_chain_tx_polarity_flip_physical{75.0}=0x0 +phy_chain_tx_polarity_flip_physical{76.0}=0x0 +phy_chain_tx_polarity_flip_physical{77.0}=0x0 +phy_chain_tx_polarity_flip_physical{78.0}=0x0 +phy_chain_tx_polarity_flip_physical{79.0}=0x1 +phy_chain_tx_polarity_flip_physical{8.0}=0x0 +phy_chain_tx_polarity_flip_physical{80.0}=0x0 +phy_chain_tx_polarity_flip_physical{81.0}=0x1 +phy_chain_tx_polarity_flip_physical{82.0}=0x1 +phy_chain_tx_polarity_flip_physical{83.0}=0x1 +phy_chain_tx_polarity_flip_physical{84.0}=0x0 +phy_chain_tx_polarity_flip_physical{85.0}=0x1 +phy_chain_tx_polarity_flip_physical{86.0}=0x0 +phy_chain_tx_polarity_flip_physical{87.0}=0x0 +phy_chain_tx_polarity_flip_physical{88.0}=0x0 +phy_chain_tx_polarity_flip_physical{89.0}=0x1 +phy_chain_tx_polarity_flip_physical{9.0}=0x0 +phy_chain_tx_polarity_flip_physical{90.0}=0x1 +phy_chain_tx_polarity_flip_physical{91.0}=0x1 +phy_chain_tx_polarity_flip_physical{92.0}=0x0 +phy_chain_tx_polarity_flip_physical{93.0}=0x0 +phy_chain_tx_polarity_flip_physical{94.0}=0x0 +phy_chain_tx_polarity_flip_physical{95.0}=0x0 +phy_chain_tx_polarity_flip_physical{96.0}=0x0 +phy_chain_tx_polarity_flip_physical{97.0}=0x0 +phy_chain_tx_polarity_flip_physical{98.0}=0x1 +phy_chain_tx_polarity_flip_physical{99.0}=0x1 + +port_init_cl72_hg=1 + + + + + + + +robust_hash_disable_egress_vlan=1 +robust_hash_disable_mpls=1 +robust_hash_disable_vlan=1 +scache_filename=/tmp/scache +scache_filename=/tmp/scache +sram_scan_enable=0 +stable_size=0x5500000 +stable_size=0x5500000 +tdma_timeout_usec=15000000 +tslam_timeout_usec=15000000 +dport_map_direct=1 +portmap_1=5:50 +portmap_2=7:50 +portmap_3=13:50 +portmap_4=15:50 +portmap_5=25:50 +portmap_6=27:50 +portmap_7=21:50 +portmap_8=23:50 +portmap_9=37:50 +portmap_10=39:50 +portmap_11=45:50 +portmap_12=47:50 +portmap_13=57:100 +portmap_14=53:100 +portmap_15=9:50 +portmap_16=11:50 +portmap_17=1:50 +portmap_18=3:50 +portmap_19=17:50 +portmap_20=19:50 +portmap_21=29:50 +portmap_22=31:50 +portmap_23=41:50 +portmap_24=43:50 +portmap_25=33:50 +portmap_26=35:50 +portmap_27=49:50 +portmap_28=51:50 +portmap_29=61:50 +portmap_30=63:50 +portmap_34=77:50 +portmap_35=79:50 +portmap_36=65:50 +portmap_37=67:50 +portmap_38=85:50 +portmap_39=87:50 +portmap_40=89:50 +portmap_41=91:50 +portmap_42=109:50 +portmap_43=111:50 +portmap_44=97:50 +portmap_45=99:50 +portmap_46=117:100 +portmap_47=121:100 +portmap_48=69:50 +portmap_49=71:50 +portmap_50=73:50 +portmap_51=75:50 +portmap_52=93:50 +portmap_53=95:50 +portmap_54=81:50 +portmap_55=83:50 +portmap_56=101:50 +portmap_57=103:50 +portmap_58=105:50 +portmap_59=107:50 +portmap_60=125:50 +portmap_61=127:50 +portmap_62=113:50 +portmap_63=115:50 +portmap_66=257:10 +portmap_68=141:100 +portmap_69=133:100 +portmap_70=149:50 +portmap_71=151:50 +portmap_72=153:50 +portmap_73=155:50 +portmap_74=173:50 +portmap_75=175:50 +portmap_76=161:50 +portmap_77=163:50 +portmap_78=181:50 +portmap_79=183:50 +portmap_80=185:50 +portmap_81=187:50 +portmap_82=129:50 +portmap_83=131:50 +portmap_84=137:50 +portmap_85=139:50 +portmap_86=157:50 +portmap_87=159:50 +portmap_88=145:50 +portmap_89=147:50 +portmap_90=165:50 +portmap_91=167:50 +portmap_92=169:50 +portmap_93=171:50 +portmap_94=189:50 +portmap_95=191:50 +portmap_96=177:50 +portmap_97=179:50 +portmap_100=259:10 +portmap_102=197:100 +portmap_103=205:100 +portmap_104=217:50 +portmap_105=219:50 +portmap_106=213:50 +portmap_107=215:50 +portmap_108=229:50 +portmap_109=231:50 +portmap_110=237:50 +portmap_111=239:50 +portmap_112=249:50 +portmap_113=251:50 +portmap_114=245:50 +portmap_115=247:50 +portmap_116=201:50 +portmap_117=203:50 +portmap_118=193:50 +portmap_119=195:50 +portmap_120=209:50 +portmap_121=211:50 +portmap_122=221:50 +portmap_123=223:50 +portmap_124=233:50 +portmap_125=235:50 +portmap_126=225:50 +portmap_127=227:50 +portmap_128=241:50 +portmap_129=243:50 +portmap_130=253:50 +portmap_131=255:50 + +# tuning parameters +serdes_preemphasis_1=0x580c +serdes_preemphasis_2=0x580c +serdes_preemphasis_3=0x580c +serdes_preemphasis_4=0x580c +serdes_preemphasis_5=0x580c +serdes_preemphasis_6=0x580c +serdes_preemphasis_7=0x580c +serdes_preemphasis_8=0x580c +serdes_preemphasis_9=0x580c +serdes_preemphasis_10=0x580c +serdes_preemphasis_11=0x580c +serdes_preemphasis_12=0x580c +serdes_preemphasis_13=0x144108 +serdes_preemphasis_14=0x144108 +serdes_preemphasis_15=0x580c +serdes_preemphasis_16=0x580c +serdes_preemphasis_17=0x580c +serdes_preemphasis_18=0x580c +serdes_preemphasis_19=0x580c +serdes_preemphasis_20=0x580c +serdes_preemphasis_21=0x580c +serdes_preemphasis_22=0x580c +serdes_preemphasis_23=0x580c +serdes_preemphasis_24=0x580c +serdes_preemphasis_25=0x580c +serdes_preemphasis_26=0x580c +serdes_preemphasis_27=0x580c +serdes_preemphasis_28=0x580c +serdes_preemphasis_29=0x580c +serdes_preemphasis_30=0x580c +serdes_preemphasis_34=0x580c +serdes_preemphasis_35=0x580c +serdes_preemphasis_36=0x580c +serdes_preemphasis_37=0x580c +serdes_preemphasis_38=0x580c +serdes_preemphasis_39=0x580c +serdes_preemphasis_40=0x580c +serdes_preemphasis_41=0x580c +serdes_preemphasis_42=0x580c +serdes_preemphasis_43=0x580c +serdes_preemphasis_44=0x580c +serdes_preemphasis_45=0x580c +serdes_preemphasis_46=0x144108 +serdes_preemphasis_47=0x103a07 +serdes_preemphasis_48=0x580c +serdes_preemphasis_49=0x580c +serdes_preemphasis_50=0x580c +serdes_preemphasis_51=0x580c +serdes_preemphasis_52=0x580c +serdes_preemphasis_53=0x580c +serdes_preemphasis_54=0x580c +serdes_preemphasis_55=0x580c +serdes_preemphasis_56=0x580c +serdes_preemphasis_57=0x580c +serdes_preemphasis_58=0x580c +serdes_preemphasis_59=0x580c +serdes_preemphasis_60=0x580c +serdes_preemphasis_61=0x580c +serdes_preemphasis_62=0x580c +serdes_preemphasis_63=0x580c +serdes_preemphasis_66=0x62f01 +serdes_preemphasis_68=0x184606 +serdes_preemphasis_69=0x184407 +serdes_preemphasis_70=0x580c +serdes_preemphasis_71=0x580c +serdes_preemphasis_72=0x580c +serdes_preemphasis_73=0x580c +serdes_preemphasis_74=0x580c +serdes_preemphasis_75=0x580c +serdes_preemphasis_76=0x580c +serdes_preemphasis_77=0x580c +serdes_preemphasis_78=0x580c +serdes_preemphasis_79=0x580c +serdes_preemphasis_80=0x580c +serdes_preemphasis_81=0x580c +serdes_preemphasis_82=0x580c +serdes_preemphasis_83=0x580c +serdes_preemphasis_84=0x580c +serdes_preemphasis_85=0x580c +serdes_preemphasis_86=0x580c +serdes_preemphasis_87=0x580c +serdes_preemphasis_88=0x580c +serdes_preemphasis_89=0x580c +serdes_preemphasis_90=0x580c +serdes_preemphasis_91=0x580c +serdes_preemphasis_92=0x580c +serdes_preemphasis_93=0x580c +serdes_preemphasis_94=0x580c +serdes_preemphasis_95=0x580c +serdes_preemphasis_96=0x580c +serdes_preemphasis_97=0x580c +serdes_preemphasis_100=0x62f01 +serdes_preemphasis_102=0x174507 +serdes_preemphasis_103=0x184606 +serdes_preemphasis_104=0x580c +serdes_preemphasis_105=0x580c +serdes_preemphasis_106=0x580c +serdes_preemphasis_107=0x580c +serdes_preemphasis_108=0x580c +serdes_preemphasis_109=0x580c +serdes_preemphasis_110=0x580c +serdes_preemphasis_111=0x580c +serdes_preemphasis_112=0x580c +serdes_preemphasis_113=0x580c +serdes_preemphasis_114=0x580c +serdes_preemphasis_115=0x580c +serdes_preemphasis_116=0x580c +serdes_preemphasis_117=0x580c +serdes_preemphasis_118=0x580c +serdes_preemphasis_119=0x580c +serdes_preemphasis_120=0x580c +serdes_preemphasis_121=0x580c +serdes_preemphasis_122=0x580c +serdes_preemphasis_123=0x580c +serdes_preemphasis_124=0x580c +serdes_preemphasis_125=0x580c +serdes_preemphasis_126=0x580c +serdes_preemphasis_127=0x580c +serdes_preemphasis_128=0x580c +serdes_preemphasis_129=0x580c +serdes_preemphasis_130=0x580c +serdes_preemphasis_131=0x580c + +mmu_init_config="MSFT-TH2-Tier0" diff --git a/src/sonic-device-data/src/Makefile b/src/sonic-device-data/src/Makefile new file mode 100644 index 000000000000..9c0037fd50c7 --- /dev/null +++ b/src/sonic-device-data/src/Makefile @@ -0,0 +1,11 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +test: + # Execute Broadcom config file test + pushd ../tests/ + for f in $$(find ../../../device -name "*.config.bcm"); do + ./config_checker $$f + done + popd diff --git a/src/sonic-device-data/tests/LICENSE b/src/sonic-device-data/tests/LICENSE new file mode 100644 index 000000000000..fd8968a9bd4e --- /dev/null +++ b/src/sonic-device-data/tests/LICENSE @@ -0,0 +1,42 @@ +Copyright: Copyright 2017 Broadcom Corporation. + +This program is the proprietary software of Broadcom Corporation +and/or its licensors, and may only be used, duplicated, modified +or distributed pursuant to the terms and conditions of a separate, +written license agreement executed between you and Broadcom +(an "Authorized License"). Except as set forth in an Authorized +License, Broadcom grants no license (express or implied), right +to use, or waiver of any kind with respect to the Software, and +Broadcom expressly reserves all rights in and to the Software +and all intellectual property rights therein. IF YOU HAVE +NO AUTHORIZED LICENSE, THEN YOU HAVE NO RIGHT TO USE THIS SOFTWARE +IN ANY WAY, AND SHOULD IMMEDIATELY NOTIFY BROADCOM AND DISCONTINUE +ALL USE OF THE SOFTWARE. + + Except as expressly set forth in the Authorized License, + + 1. This program, including its structure, sequence and organization, +constitutes the valuable trade secrets of Broadcom, and you shall use +all reasonable efforts to protect the confidentiality thereof, +and to use this information only in connection with your use of +Broadcom integrated circuit products. + + 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS +PROVIDED "AS IS" AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, +REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, +OR OTHERWISE, WITH RESPECT TO THE SOFTWARE. BROADCOM SPECIFICALLY +DISCLAIMS ANY AND ALL IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, +NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, +ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR +CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING +OUT OF USE OR PERFORMANCE OF THE SOFTWARE. + + 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL +BROADCOM OR ITS LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, +INCIDENTAL, SPECIAL, INDIRECT, OR EXEMPLARY DAMAGES WHATSOEVER +ARISING OUT OF OR IN ANY WAY RELATING TO YOUR USE OF OR INABILITY +TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF +THE AMOUNT ACTUALLY PAID FOR THE SOFTWARE ITSELF OR USD 1.00, +WHICHEVER IS GREATER. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING +ANY FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY. diff --git a/src/sonic-device-data/tests/config_checker b/src/sonic-device-data/tests/config_checker new file mode 100755 index 000000000000..51c32c19c3e4 --- /dev/null +++ b/src/sonic-device-data/tests/config_checker @@ -0,0 +1,92 @@ +#!/usr/bin/env python +import re +import sys +import glob + +permitted_properties = [] + +def usage(): + print "Usage: " + sys.argv[0] + " " + sys.exit(1) + +def check_property(p): + if p in permitted_properties: + return True + # Try to remove trailing . + if re.sub(r".\d+$", "", p) in permitted_properties: + return True + # Try to remove trailing _. + if re.sub(r"_\d+.\d+$", "", p) in permitted_properties: + return True + # Try to remove trailing _hg. + if re.sub(r"_hg.0$", "", p) in permitted_properties: + return True + # Try to remove trailing _[cx]e + if re.sub(r"_[cx]e\d*$", "", p) in permitted_properties: + return True + # Try to remove trailing _lane_ + if re.sub(r"_lane\d_\d+$", "", p) in permitted_properties: + return True + # Try to remove trailing _lane_. + if re.sub(r"_lane\d_\d+.\d+$", "", p) in permitted_properties: + return True + # Try to remove trailing _lane_[cx]e + if re.sub(r"_lane\d_[cx]e\d+$", "", p) in permitted_properties: + return True + return False + +def check_file(file_name): + try: + file_ok = True + failed_properties = [] + lineno = 0 + with open(file_name) as f: + for line in f.readlines(): + lineno = lineno + 1 + # Check both commented and uncommented lines + line = line.strip().lstrip('#').strip().lower() + if line.find("=") == -1: + continue + p = line.split("=", 1)[0] + # Remove trailing "{.}" + p = re.sub('{[0-9]+\.[0-9]+}', '', p) + # Check if = in the line + if not check_property(p): + file_ok = False + print("[line %d] Error: %s is not permitted" % (lineno, p)) + if file_ok: + print "Result: " + file_name + " PASSED the config check!" + else: + print "Result: " + file_name + " FAILED the config check!" + return file_ok + except IOError: + print "Error: Cannot open file " + file_name + return False + + +def main(argv): + global permitted_properties + + if len(argv) > 0 and argv[0] == "-h": + usage() + + # Load permitted properties + with open("permitted_list") as f: + permitted_properties = [p.strip().lower() for p in f.readlines()] + + # Load target file + if len(argv) == 0: + files = glob.glob('*.config.bcm') + else: + files = argv + + all_good = True + for f in files: + good = check_file(f) + all_good = all_good and good + + if not all_good: + sys.exit(-1) + +if __name__ == "__main__": + main(sys.argv[1:]) diff --git a/src/sonic-device-data/tests/permitted_list b/src/sonic-device-data/tests/permitted_list new file mode 100644 index 000000000000..150a16292c91 --- /dev/null +++ b/src/sonic-device-data/tests/permitted_list @@ -0,0 +1,134 @@ +arl_clean_timeout_usec +asf_mem_profile +bcm_linkscan_interval +bcm_num_cos +bcm_stat_flags +bcm_stat_interval +bcm_stat_jumbo +bcm_tunnel_term_compatible_mode +bcm_xlate_port_enable +cdma_timeout_usec +core_clock_frequency +ctr_evict_enable +dma_desc_timeout_usec +dport_map_direct +dport_map_enable +dport_map_indexed +dport_map_port +dpp_clock_ratio +force_core_pll +fpem_mem_entries +higig2_hdr_mode +ipmc_do_vlan +ipv6_lpm_128b_enable +knet_filter_persist +l2_mem_entries +l2delete_chunks +l2mod_dma_intr_enable +l2xmsg_hostbuf_size +l2xmsg_mode +l3_alpm_enable +l3_intf_vlan_split_egress +l3_max_ecmp_mode +l3_mem_entries +lls_num_l2uc +load_firmware +logical_ports +lpm_ipv6_128b_reserved +lpm_scaling_enable +max_vp_lags +mdio_output_delay +mem_cache_enable +mem_check_nocache_override +mem_clear_hw_a +mem_nocache +mem_scan_enable +memcmd_intr_enable +miim_intr_enable +miim_timeout_usec +mmu_init_config +mmu_lossless +module_64ports +multicast_l2_r +multicast_l2_range +multicast_l3_range +no_leds_proc +num_ipv6_lpm_128b_entries +os +oversubscribe_mode +parity_correction +parity_enable +pbmp_oversubscribe +pbmp_xport_xe +pci2eb_overrid +pfc_deadlock_seq_control +phy_84328 +phy_84752 +phy_an_allow_pll_change +phy_an_allow_pll_change_hg +phy_an_c37 +phy_an_c73 +phy_an_fec +phy_aux_voltage_enable +phy_chain_rx_lane_map_physical +phy_chain_rx_polarity_flip_physical +phy_chain_tx_lane_map_physical +phy_chain_tx_polarity_flip_physical +phy_ext_rom_boot +phy_gearbox_enable +phy_line_tx_mode +phy_pcs_rx_polarity_flip +phy_pcs_tx_polarity_flip +phy_port_primary_and_offset +phy_rx_polarity_flip +phy_system_tx_mode +phy_tx_polarity_flip +phy_xaui_rx_polarity_flip +phy_xaui_tx_polarity_flip +physical_ports +port_init_autoneg +port_init_cl72 +port_init_cl72_hg +port_init_speed_xe +port_phy_addr +port_phy_clause +port_phy_id0 +port_phy_id1 +portmap +prbs_polynomial +ptp_bs_fref +ptp_ts_pll_fref +rate_ext_mdio_divisor +robust_hash_disable_egress_vlan +robust_hash_disable_mpls +robust_hash_disable_vlan +scache_filename +schan_intr_enable +schan_timeout_usec +serdes_automed +serdes_automedium +serdes_driver_current +serdes_fiber_pref +serdes_firmware_mode +serdes_if_type +serdes_pre_driver_current +serdes_preemphasis +serdes_rx_los_xe +serdes_sgmii_m +skip_L2_USER_ENTRY +sram_scan_enable +stable_size +start_vlan +stat_if_parity_enable +switch_bypass_mode +table_dma_enable +tdma_intr_enable +tdma_timeout_usec +tslam_dma_enable +tslam_intr_enable +tslam_timeout_usec +uplink_ports +xgxs_lcpll_xtal_refclk +xgxs_pdetect_1 +xgxs_rx_lane_map +xgxs_tx_lane_map From f0690b246b28ba8c8162ca8800387dd12060c9c9 Mon Sep 17 00:00:00 2001 From: Jipan Yang Date: Wed, 18 Apr 2018 00:31:12 -0700 Subject: [PATCH 130/274] [build]: Fix the problem of ENABLE_SYSTEM_TELEMETRY not taking effect in rules/config (#1615) Signed-off-by: Jipan Yang --- Makefile | 2 +- slave.mk | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6471f7f757b9..c954402ab312 100644 --- a/Makefile +++ b/Makefile @@ -71,7 +71,7 @@ SONIC_BUILD_INSTRUCTION := make \ SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \ HTTP_PROXY=$(http_proxy) \ HTTPS_PROXY=$(https_proxy) \ - ENABLE_SYSTEM_TELEMETRY=$(ENABLE_SYSTEM_TELEMETRY) + SONIC_ENABLE_SYSTEM_TELEMETRY=$(ENABLE_SYSTEM_TELEMETRY) .PHONY: sonic-slave-build sonic-slave-bash init reset diff --git a/slave.mk b/slave.mk index 7430f3a80d10..09591b7a9f2c 100644 --- a/slave.mk +++ b/slave.mk @@ -63,6 +63,10 @@ ifeq ($(SONIC_ENABLE_PFCWD_ON_START),y) ENABLE_PFCWD_ON_START = y endif +ifeq ($(SONIC_ENABLE_SYSTEM_TELEMETRY),y) +ENABLE_SYSTEM_TELEMETRY = y +endif + include $(RULES_PATH)/config include $(RULES_PATH)/functions include $(RULES_PATH)/*.mk From 61793dd05af59518c69d6038b549e4ffabb26789 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Wed, 18 Apr 2018 19:37:27 +0300 Subject: [PATCH 131/274] [ip-in-ip]: Fix config template to apply correct platform depended values (#1619) Signed-off-by: Volodymyr Samotiy --- dockers/docker-orchagent/ipinip.json.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-orchagent/ipinip.json.j2 b/dockers/docker-orchagent/ipinip.json.j2 index 2554755c701d..bee97f45b8ae 100644 --- a/dockers/docker-orchagent/ipinip.json.j2 +++ b/dockers/docker-orchagent/ipinip.json.j2 @@ -11,7 +11,7 @@ "tunnel_type":"IPINIP", "src_ip":"{{ ipv4_loopback_addresses | first | ip }}", "dst_ip":"{% for prefix in ipv4_loopback_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}", -{% if onie_switch_asic == "mlnx" %} +{% if "mlnx" in DEVICE_METADATA.localhost.platform %} "dscp_mode":"uniform", "ecn_mode":"standard", {% else %} From 01551363e2ade5aa1c3d887de58ff11f5ae16607 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 18 Apr 2018 14:54:15 -0700 Subject: [PATCH 132/274] [platform-common]: Update sonic-platform-common submodule (#1620) [sfputilbase]: Add logic to parse the title of port_config.ini file Signed-off-by: Shu0T1an ChenG --- src/sonic-platform-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-platform-common b/src/sonic-platform-common index 560b465cb516..b553dba4ca82 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit 560b465cb5166d0ad0c56312292bba990a122419 +Subproject commit b553dba4ca82997dcc60a3b3a68111d7af8d62fc From 5ebefeb8413d64f015794815fabd439fc1983e98 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 18 Apr 2018 18:26:09 -0700 Subject: [PATCH 133/274] [sonic-cfggen] Be case insensitive to hostname in minigraph (#1614) --- src/sonic-config-engine/minigraph.py | 19 +- .../tests/simple-sample-graph-case.xml | 317 ++++++++++++++++++ .../tests/test_minigraph_case.py | 111 ++++++ 3 files changed, 438 insertions(+), 9 deletions(-) create mode 100644 src/sonic-config-engine/tests/simple-sample-graph-case.xml create mode 100644 src/sonic-config-engine/tests/test_minigraph_case.py diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 4ac7e9d68c92..dba1a6516cf4 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -77,7 +77,7 @@ def parse_png(png, hname): bandwidth_node = link.find(str(QName(ns, "Bandwidth"))) bandwidth = bandwidth_node.text if bandwidth_node is not None else None - if enddevice == hname: + if enddevice.lower() == hname.lower(): if port_alias_map.has_key(endport): endport = port_alias_map[endport] neighbors[endport] = {'name': startdevice, 'port': startport} @@ -119,7 +119,7 @@ def parse_png(png, hname): def parse_dpg(dpg, hname): for child in dpg: hostname = child.find(str(QName(ns, "Hostname"))) - if hostname.text != hname: + if hostname.text.lower() != hname.lower(): continue ipintfs = child.find(str(QName(ns, "IPInterfaces"))) @@ -263,7 +263,7 @@ def parse_cpg(cpg, hname): else: keepalive = 60 nhopself = 1 if session.find(str(QName(ns, "NextHopSelf"))) is not None else 0 - if end_router == hname: + if end_router.lower() == hname.lower(): bgp_sessions[start_peer.lower()] = { 'name': start_router, 'local_addr': end_peer.lower(), @@ -285,7 +285,7 @@ def parse_cpg(cpg, hname): for router in child.findall(str(QName(ns1, "BGPRouterDeclaration"))): asn = router.find(str(QName(ns1, "ASN"))).text hostname = router.find(str(QName(ns1, "Hostname"))).text - if hostname == hname: + if hostname.lower() == hname.lower(): myasn = asn peers = router.find(str(QName(ns1, "Peers"))) for bgpPeer in peers.findall(str(QName(ns, "BGPPeer"))): @@ -301,7 +301,7 @@ def parse_cpg(cpg, hname): else: for peer in bgp_sessions: bgp_session = bgp_sessions[peer] - if hostname == bgp_session['name']: + if hostname.lower() == bgp_session['name'].lower(): bgp_session['asn'] = asn bgp_sessions = { key: bgp_sessions[key] for key in bgp_sessions if bgp_sessions[key].has_key('asn') and int(bgp_sessions[key]['asn']) != 0 } return bgp_sessions, myasn, bgp_peers_with_range @@ -317,7 +317,7 @@ def parse_meta(meta, hname): deployment_id = None device_metas = meta.find(str(QName(ns, "Devices"))) for device in device_metas.findall(str(QName(ns1, "DeviceMetadata"))): - if device.find(str(QName(ns1, "Name"))).text == hname: + if device.find(str(QName(ns1, "Name"))).text.lower() == hname.lower(): properties = device.find(str(QName(ns1, "Properties"))) for device_property in properties.findall(str(QName(ns1, "DeviceProperty"))): name = device_property.find(str(QName(ns1, "Name"))).text @@ -411,13 +411,14 @@ def parse_xml(filename, platform=None, port_config_file=None): elif child.tag == str(QName(ns, "DeviceInfos")): (port_speeds_default, port_descriptions) = parse_deviceinfo(child, hwsku) - results = {} + current_device = [devices[key] for key in devices if key.lower() == hostname.lower()][0] + results = {} results['DEVICE_METADATA'] = {'localhost': { 'bgp_asn': bgp_asn, 'deployment_id': deployment_id, 'hostname': hostname, 'hwsku': hwsku, - 'type': devices[hostname]['type'] + 'type': current_device['type'] }} results['BGP_NEIGHBOR'] = bgp_sessions results['BGP_PEER_RANGE'] = bgp_peers_with_range @@ -476,7 +477,7 @@ def parse_xml(filename, platform=None, port_config_file=None): results['VLAN_MEMBER'] = vlan_members results['DEVICE_NEIGHBOR'] = neighbors - results['DEVICE_NEIGHBOR_METADATA'] = { key:devices[key] for key in devices if key != hostname } + results['DEVICE_NEIGHBOR_METADATA'] = { key:devices[key] for key in devices if key.lower() != hostname.lower() } results['SYSLOG_SERVER'] = dict((item, {}) for item in syslog_servers) results['DHCP_SERVER'] = dict((item, {}) for item in dhcp_servers) results['NTP_SERVER'] = dict((item, {}) for item in ntp_servers) diff --git a/src/sonic-config-engine/tests/simple-sample-graph-case.xml b/src/sonic-config-engine/tests/simple-sample-graph-case.xml new file mode 100644 index 000000000000..2d2f08f4d0d2 --- /dev/null +++ b/src/sonic-config-engine/tests/simple-sample-graph-case.xml @@ -0,0 +1,317 @@ + + + + + + false + switch-t0 + 10.0.0.56 + ARISTA01T1 + 10.0.0.57 + 1 + 180 + 60 + + + switch-t0 + FC00::71 + ARISTA01T1 + FC00::72 + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.58 + ARISTA02T1 + 10.0.0.59 + 1 + 180 + 60 + + + switch-t0 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 180 + 60 + + + + + 65100 + switch-t0 + + +
10.0.0.57
+ + + +
+ +
10.0.0.59
+ + + +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.0.0.100/24 + + 10.0.0.100/24 + + + + + + + switch-t0 + + + PortChannel01 + fortyGigE0/4 + + + + + + ab1 + fortyGigE0/8 + 192.0.0.1;192.0.0.2 + 1000 + 1000 + 192.168.0.0/27 + + + + + + PortChannel01 + 10.0.0.56/31 + + + + PortChannel01 + FC00::71/126 + + + + fortyGigE0/0 + 10.0.0.58/31 + + + + fortyGigE0/0 + FC00::75/126 + + + + ab1 + 192.168.0.1/27 + + + + + + PortChannel01 + DataAcl + DataPlane + + + SNMP + SNMP_ACL + SNMP + + + + + + + + + + + switch-t0 + Force10-S6000 + + + ARISTA01T1 + Arista + + + ARISTA02T1 + Arista + + + ARISTA03T1 + Arista + + + ARISTA04T1 + Arista + + + + + + + switch-t0 + + + DeploymentId + + 1 + + + ErspanDestinationIpv4 + + 10.0.100.1 + + + NtpResources + + 10.0.10.1;10.0.10.2 + + + + SnmpResources + + 10.0.10.3;10.0.10.4 + + + + SyslogResources + + 10.0.10.5;10.0.10.6; + + + + TacacsServer + + 10.0.10.7;10.0.10.8 + + + + + + + + + true + + + DeviceInterface + + true + true + 1 + fortyGigE0/0 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + true + 1 + fortyGigE0/4 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + fortyGigE0/8 + + false + 0 + 0 + 40000 + Interface description + + + DeviceInterface + + true + true + 1 + fortyGigE0/12 + + false + 0 + 0 + 100000 + Interface description + + + true + 0 + Force10-S6000 + + + switch-T0 + Force10-S6000 +
diff --git a/src/sonic-config-engine/tests/test_minigraph_case.py b/src/sonic-config-engine/tests/test_minigraph_case.py new file mode 100644 index 000000000000..754bdae799f4 --- /dev/null +++ b/src/sonic-config-engine/tests/test_minigraph_case.py @@ -0,0 +1,111 @@ +from unittest import TestCase +import subprocess +import os + +class TestCfgGenCaseInsensitive(TestCase): + + def setUp(self): + self.test_dir = os.path.dirname(os.path.realpath(__file__)) + self.script_file = os.path.join(self.test_dir, '..', 'sonic-cfggen') + self.sample_graph = os.path.join(self.test_dir, 'simple-sample-graph-case.xml') + self.port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini') + + def run_script(self, argument, check_stderr=False): + print '\n Running sonic-cfggen ' + argument + if check_stderr: + output = subprocess.check_output(self.script_file + ' ' + argument, stderr=subprocess.STDOUT, shell=True) + else: + output = subprocess.check_output(self.script_file + ' ' + argument, shell=True) + + linecount = output.strip().count('\n') + if linecount <= 0: + print ' Output: ' + output.strip() + else: + print ' Output: ({0} lines, {1} bytes)'.format(linecount + 1, len(output)) + return output + + def test_dummy_run(self): + argument = '' + output = self.run_script(argument) + self.assertEqual(output, '') + + def test_minigraph_sku(self): + argument = '-v "DEVICE_METADATA[\'localhost\'][\'hwsku\']" -m "' + self.sample_graph + '"' + output = self.run_script(argument) + self.assertEqual(output.strip(), 'Force10-S6000') + + def test_print_data(self): + argument = '-m "' + self.sample_graph + '" --print-data' + output = self.run_script(argument) + self.assertTrue(len(output.strip()) > 0) + + def test_jinja_expression(self): + argument = '-m "' + self.sample_graph + '" -v "DEVICE_METADATA[\'localhost\'][\'type\']"' + output = self.run_script(argument) + self.assertEqual(output.strip(), 'ToRRouter') + + def test_additional_json_data(self): + argument = '-a \'{"key1":"value1"}\' -v key1' + output = self.run_script(argument) + self.assertEqual(output.strip(), 'value1') + + def test_read_yaml(self): + argument = '-v yml_item -y ' + os.path.join(self.test_dir, 'test.yml') + output = self.run_script(argument) + self.assertEqual(output.strip(), '[\'value1\', \'value2\']') + + def test_render_template(self): + argument = '-y ' + os.path.join(self.test_dir, 'test.yml') + ' -t ' + os.path.join(self.test_dir, 'test.j2') + output = self.run_script(argument) + self.assertEqual(output.strip(), 'value1\nvalue2') + + def test_minigraph_everflow(self): + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v MIRROR_SESSION' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'everflow0': {'src_ip': '10.1.0.32', 'dst_ip': '10.0.100.1'}}") + + def test_minigraph_interfaces(self): + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v \'INTERFACE.keys()\'' + output = self.run_script(argument) + self.assertEqual(output.strip(), "[('Ethernet0', '10.0.0.58/31'), ('Ethernet0', 'FC00::75/126')]") + + def test_minigraph_vlans(self): + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v VLAN' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'Vlan1000': {'alias': 'ab1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '1000'}}") + + def test_minigraph_vlan_members(self): + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v VLAN_MEMBER' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'Vlan1000|Ethernet8': {'tagging_mode': 'untagged'}}") + + def test_minigraph_vlan_interfaces(self): + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "VLAN_INTERFACE.keys()"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "[('Vlan1000', '192.168.0.1/27')]") + + def test_minigraph_portchannels(self): + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v PORTCHANNEL' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'PortChannel01': {'members': ['Ethernet4']}}") + + def test_minigraph_deployment_id(self): + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'deployment_id\']"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "1") + + def test_metadata_everflow(self): + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "MIRROR_SESSION"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'everflow0': {'src_ip': '10.1.0.32', 'dst_ip': '10.0.100.1'}}") + + def test_metadata_tacacs(self): + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "TACPLUS_SERVER"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'10.0.10.7': {'priority': '1', 'tcp_port': '49'}, '10.0.10.8': {'priority': '1', 'tcp_port': '49'}}") + + def test_metadata_ntp(self): + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "NTP_SERVER"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'10.0.10.1': {}, '10.0.10.2': {}}") + From d42384168c4770adc9439a9ccf2c7f0bc9e1f46d Mon Sep 17 00:00:00 2001 From: Rodny Molina Date: Thu, 19 Apr 2018 01:43:00 -0700 Subject: [PATCH 134/274] [sonic-cfggen]: Sorting the information generated by sonic-cfggen for all j2 templates. (#1616) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With this patch all the content of the files generated by "sonic-cfggen -d -t" instructions will now be sorted, which is very useful for operational and troubleshooting purposes. See below a few examples of this behavior. Also, a few sonic-cfggen UT's have been modified to accomodate the new sorted configurations. admin@lnos-x1-a-asw02:~$ sonic-cfggen -d -t /usr/share/sonic/templates/interfaces.j2 | more … auto lo iface lo inet loopback iface lo inet static address 10.10.1.2 netmask 255.255.255.255 auto eth0 iface eth0 inet dhcp allow-hotplug Ethernet112 iface Ethernet112 inet static mtu 9100 address 10.1.2.2 netmask 255.255.255.0 allow-hotplug Ethernet112 iface Ethernet112 inet6 static mtu 9100 address fc00:1:2::2 netmask 64 allow-hotplug Ethernet116 iface Ethernet116 inet static mtu 9100 address 10.2.2.2 netmask 255.255.255.0 allow-hotplug Ethernet116 iface Ethernet116 inet6 static mtu 9100 address fc00:2:2::2 netmask 64 allow-hotplug Ethernet120 iface Ethernet120 inet static mtu 9100 address 10.3.2.2 netmask 255.255.255.0 root@lnos-x1-a-csw01:/# sonic-cfggen -d -y /etc/sonic/deployment_id_asn_map.yml -t /usr/share/sonic/templates/bgpd.conf.j2 … router bgp 65100 … network 10.10.2.1/32 neighbor 10.0.0.1 remote-as 65200 neighbor 10.0.0.1 description ARISTA01T2 address-family ipv4 neighbor 10.0.0.1 activate maximum-paths 64 exit-address-family neighbor 10.0.0.11 remote-as 65200 neighbor 10.0.0.11 description ARISTA06T2 address-family ipv4 neighbor 10.0.0.11 activate maximum-paths 64 exit-address-family neighbor 10.0.0.13 remote-as 65200 neighbor 10.0.0.13 description ARISTA07T2 address-family ipv4 neighbor 10.0.0.13 activate maximum-paths 64 exit-address-family neighbor 10.0.0.15 remote-as 65200 neighbor 10.0.0.15 description ARISTA08T2 address-family ipv4 neighbor 10.0.0.15 activate maximum-paths 64 exit-address-family root@lnos-x1-a-asw02:/# sonic-cfggen -d -t /usr/share/sonic/templates/lldpd.conf.j2 … configure ports Ethernet4 lldp portidsubtype local Eth2/1 description ixia-card2-port8:Eth1/2/8 configure ports Ethernet112 lldp portidsubtype local Eth29/1 description lnos-x1-a-csw01:Eth29/1 configure ports Ethernet116 lldp portidsubtype local Eth30/1 description lnos-x1-a-csw02:Eth30/1 configure ports Ethernet120 lldp portidsubtype local Eth31/1 description lnos-x1-a-csw03:Eth31/1 configure ports Ethernet124 lldp portidsubtype local Eth32/1 description lnos-x1-a-csw04:Eth32/1 root@lnos-x1-a-asw02:/# sonic-cfggen -d -t /usr/share/sonic/templates/ports.json.j2 | more [ { "PORT_TABLE:Ethernet0": { "speed": "10000", "description": "" }, "OP": "SET" }, { "PORT_TABLE:Ethernet1": { "speed": "10000", "description": "" }, "OP": "SET" }, { "PORT_TABLE:Ethernet2": { "speed": "10000", "description": "" }, "OP": "SET" }, ] --- src/sonic-config-engine/sonic-cfggen | 10 +++- .../docker-dhcp-relay.supervisord.conf | 2 +- .../tests/sample_output/lldpd.conf | 4 +- .../tests/sample_output/msn27.32ports.json | 60 +++++++++---------- .../tests/sample_output/ports.json | 14 ++--- .../tests/sample_output/wait_for_intf.sh | 8 +-- 6 files changed, 52 insertions(+), 46 deletions(-) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index b11385ab8c8b..2495bc89fe06 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -128,6 +128,12 @@ def deep_update(dst, src): dst[key] = value return dst +def sort_data(data): + for table in data: + if type(data[table]) is dict: + data[table] = OrderedDict(natsorted(data[table].items())) + return data + def main(): parser=argparse.ArgumentParser(description="Render configuration file from minigraph data and jinja2 template.") @@ -210,8 +216,8 @@ def main(): for attr in ['ip', 'network', 'prefixlen', 'netmask']: env.filters[attr] = partial(prefix_attr, attr) template = env.get_template(template_file) - print template.render(data) - + print template.render(sort_data(data)) + if args.var != None: template = jinja2.Template('{{' + args.var + '}}') print template.render(data) diff --git a/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf b/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf index f955546cdc09..ed14f2ca0f8c 100644 --- a/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf +++ b/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf @@ -23,7 +23,7 @@ stderr_logfile=syslog programs=isc-dhcp-relay-Vlan1000 [program:isc-dhcp-relay-Vlan1000] -command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /tmp/port-name-alias-map.txt -i Vlan1000 -i PortChannel02 -i PortChannel03 -i PortChannel04 -i PortChannel01 192.0.0.1 192.0.0.2 +command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /tmp/port-name-alias-map.txt -i Vlan1000 -i PortChannel01 -i PortChannel02 -i PortChannel03 -i PortChannel04 192.0.0.1 192.0.0.2 priority=3 autostart=false autorestart=false diff --git a/src/sonic-config-engine/tests/sample_output/lldpd.conf b/src/sonic-config-engine/tests/sample_output/lldpd.conf index d906f909bc7d..049d9f09059c 100644 --- a/src/sonic-config-engine/tests/sample_output/lldpd.conf +++ b/src/sonic-config-engine/tests/sample_output/lldpd.conf @@ -1,6 +1,6 @@ configure ports eth0 lldp portidsubtype local eth0 -configure ports Ethernet116 lldp portidsubtype local fortyGigE0/116 description ARISTA02T1:Ethernet1/1 -configure ports Ethernet124 lldp portidsubtype local fortyGigE0/124 description ARISTA04T1:Ethernet1/1 configure ports Ethernet112 lldp portidsubtype local fortyGigE0/112 description ARISTA01T1:Ethernet1/1 +configure ports Ethernet116 lldp portidsubtype local fortyGigE0/116 description ARISTA02T1:Ethernet1/1 configure ports Ethernet120 lldp portidsubtype local fortyGigE0/120 description ARISTA03T1:Ethernet1/1 +configure ports Ethernet124 lldp portidsubtype local fortyGigE0/124 description ARISTA04T1:Ethernet1/1 diff --git a/src/sonic-config-engine/tests/sample_output/msn27.32ports.json b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json index 2a878c95f2c5..fd457c4be9b4 100644 --- a/src/sonic-config-engine/tests/sample_output/msn27.32ports.json +++ b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json @@ -1,38 +1,38 @@ { "CABLE_LENGTH": { "AZURE": { - "Ethernet8": "300m", "Ethernet0": "300m", "Ethernet4": "300m", - "Ethernet108": "300m", - "Ethernet100": "300m", - "Ethernet104": "300m", - "Ethernet68": "300m", - "Ethernet96": "300m", - "Ethernet124": "300m", - "Ethernet92": "300m", - "Ethernet120": "300m", + "Ethernet8": "300m", + "Ethernet12": "300m", + "Ethernet16": "300m", + "Ethernet20": "300m", + "Ethernet24": "300m", + "Ethernet28": "300m", + "Ethernet32": "300m", + "Ethernet36": "300m", + "Ethernet40": "300m", + "Ethernet44": "300m", + "Ethernet48": "300m", "Ethernet52": "300m", "Ethernet56": "300m", - "Ethernet76": "300m", - "Ethernet72": "300m", + "Ethernet60": "300m", "Ethernet64": "300m", - "Ethernet32": "300m", - "Ethernet16": "300m", - "Ethernet36": "300m", - "Ethernet12": "300m", - "Ethernet88": "300m", - "Ethernet116": "300m", + "Ethernet68": "300m", + "Ethernet72": "300m", + "Ethernet76": "300m", "Ethernet80": "300m", - "Ethernet112": "300m", "Ethernet84": "300m", - "Ethernet48": "300m", - "Ethernet44": "300m", - "Ethernet40": "300m", - "Ethernet28": "300m", - "Ethernet60": "300m", - "Ethernet20": "300m", - "Ethernet24": "300m" + "Ethernet88": "300m", + "Ethernet92": "300m", + "Ethernet96": "300m", + "Ethernet100": "300m", + "Ethernet104": "300m", + "Ethernet108": "300m", + "Ethernet112": "300m", + "Ethernet116": "300m", + "Ethernet120": "300m", + "Ethernet124": "300m" } }, "BUFFER_POOL": { @@ -95,25 +95,25 @@ } }, "BUFFER_PORT_INGRESS_PROFILE_LIST": { - "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" } }, "BUFFER_PORT_EGRESS_PROFILE_LIST": { - "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" } }, "BUFFER_PG": { - "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24|0-1": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" } }, "BUFFER_QUEUE": { - "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24|3-4": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4": { "profile" : "[BUFFER_PROFILE|q_lossless_profile]" }, - "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24|0-1": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { "profile" : "[BUFFER_PROFILE|q_lossy_profile]" } } diff --git a/src/sonic-config-engine/tests/sample_output/ports.json b/src/sonic-config-engine/tests/sample_output/ports.json index 3fa2e29a8b0a..62fe4bbb5ccd 100644 --- a/src/sonic-config-engine/tests/sample_output/ports.json +++ b/src/sonic-config-engine/tests/sample_output/ports.json @@ -1,11 +1,4 @@ [ - { - "PORT_TABLE:Ethernet8": { - "speed": "1000", - "description": "Interface description" - }, - "OP": "SET" - }, { "PORT_TABLE:Ethernet0": { "speed": "10000", @@ -20,6 +13,13 @@ }, "OP": "SET" }, + { + "PORT_TABLE:Ethernet8": { + "speed": "1000", + "description": "Interface description" + }, + "OP": "SET" + }, { "PORT_TABLE:Ethernet12": { "speed": "100000", diff --git a/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh b/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh index 3cbde972fe18..0f06235eb0dc 100644 --- a/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh +++ b/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh @@ -32,12 +32,12 @@ function wait_until_iface_ready # Wait for all interfaces to come up and have IPv4 addresses assigned wait_until_iface_ready Vlan1000 -wait_until_iface_ready PortChannel04 +wait_until_iface_ready PortChannel01 +wait_until_iface_ready PortChannel01 +wait_until_iface_ready PortChannel02 wait_until_iface_ready PortChannel02 wait_until_iface_ready PortChannel03 wait_until_iface_ready PortChannel03 -wait_until_iface_ready PortChannel01 -wait_until_iface_ready PortChannel02 wait_until_iface_ready PortChannel04 -wait_until_iface_ready PortChannel01 +wait_until_iface_ready PortChannel04 From 8153ce7f05e8df8c576d6d302b0f1a7ff40f7261 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 19 Apr 2018 11:25:08 -0700 Subject: [PATCH 135/274] [sudoer] Enable read-only commands for all users (#1558) --- files/image_config/sudoers/sudoers | 3 +++ 1 file changed, 3 insertions(+) diff --git a/files/image_config/sudoers/sudoers b/files/image_config/sudoers/sudoers index 952a2313bad2..7cfa0baba0f1 100644 --- a/files/image_config/sudoers/sudoers +++ b/files/image_config/sudoers/sudoers @@ -37,6 +37,9 @@ Cmnd_Alias PASSWD_CMDS = /usr/bin/config tacacs passkey *, \ # User privilege specification root ALL=(ALL:ALL) ALL +# Allow all users to execute read only commands +ALL ALL=NOPASSWD: READ_ONLY_CMDS + # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) NOPASSWD: ALL From cde9a60c41c2a6123fb18669dd7cee29a3b1feb3 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 19 Apr 2018 14:53:37 -0700 Subject: [PATCH 136/274] swss submodule update. Remove the global lock from swss (#1624) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index e849afeeef0b..39523aa95915 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit e849afeeef0ba0d09facfe61a4b0912684021ac6 +Subproject commit 39523aa95915b1c78b559b5ec3917fe6fe837fad From 1df7c9a99345b8b0ff3b4e29d63b4cf8ff063e4c Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 20 Apr 2018 10:42:19 -0700 Subject: [PATCH 137/274] [docker-platform-monitor] Convert ledd from polling-based to subscription-based model (#1623) --- dockers/docker-platform-monitor/Dockerfile.j2 | 43 +++++++++---------- rules/docker-platform-monitor.mk | 2 +- src/sonic-platform-daemons | 2 +- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index 4dd8acaf0e26..95e9d150ea2c 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -3,35 +3,34 @@ FROM docker-config-engine # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -# Update apt's package index files +# Update apt's cache of available packages RUN apt-get update # Install required packages -RUN apt-get install -y python-pip sensord fancontrol +RUN apt-get install -y python-pip libpython2.7 sensord fancontrol {% if docker_platform_monitor_debs.strip() -%} -# Copy all locally-built Debian package dependencies -COPY{{' '}} -{%- for deb in docker_platform_monitor_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor -%} -/debs/ - -# Install all locally-built Debian package dependencies -# and implicitly install their dependencies -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/*.deb -{% endif %} +# Copy locally-built Debian package dependencies +{%- for deb in docker_platform_monitor_debs.split(' ') %} +COPY debs/{{ deb }} /debs/ +{%- endfor %} + +# Install locally-built Debian packages and implicitly install their dependencies +{%- for deb in docker_platform_monitor_debs.split(' ') %} +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/{{ deb }} +{%- endfor %} +{%- endif %} {% if docker_platform_monitor_whls.strip() -%} -# Copy all locally-built Python wheel dependencies -COPY{{' '}} -{%- for whl in docker_platform_monitor_whls.split(' ') -%} -python-wheels/{{ whl }}{{' '}} -{%- endfor -%} -/python-wheels/ - -# Install all locally-built Python wheel dependencies -RUN pip install /python-wheels/*.whl +# Copy locally-built Python wheel dependencies +{%- for whl in docker_platform_monitor_whls.split(' ') %} +COPY python-wheels/{{ whl }} /python-wheels/ +{%- endfor %} + +# Install locally-built Python wheel dependencies +{%- for whl in docker_platform_monitor_whls.split(' ') %} +RUN pip install /python-wheels/{{ whl }} +{%- endfor %} {% endif %} # Clean up diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index 345e82f7b86f..00b4d48687cd 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -2,7 +2,7 @@ DOCKER_PLATFORM_MONITOR = docker-platform-monitor.gz $(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/docker-platform-monitor -$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(SONIC_LEDD) +$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(LIBSWSSCOMMON) $(PYTHON_SWSSCOMMON) $(SONIC_LEDD) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SWSSSDK_PY2) $(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index 31c007e260ba..c940a7d18ecd 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit 31c007e260ba081bc73cbf467eb27cd8747c2177 +Subproject commit c940a7d18ecd4dc22bbaf2aee6908045cbe24508 From 143842ee8f81f49906cff38fcc52022ab77cc8dc Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 20 Apr 2018 18:30:07 -0700 Subject: [PATCH 138/274] [tacacs] User with priv_lvl 0 should not be in docker group (#1626) --- src/tacacs/nss/0001-Modify-user-map-profile.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tacacs/nss/0001-Modify-user-map-profile.patch b/src/tacacs/nss/0001-Modify-user-map-profile.patch index 49e02cf0da58..971f1f682f71 100644 --- a/src/tacacs/nss/0001-Modify-user-map-profile.patch +++ b/src/tacacs/nss/0001-Modify-user-map-profile.patch @@ -564,9 +564,9 @@ index 79e62b9..ecfa0b0 100644 + useradd_info_t *user; + + user = &useradd_grp_list[MIN_TACACS_USER_PRIV]; -+ user->gid = 999; ++ user->gid = 100; + user->info = strdup("remote_user"); -+ user->secondary_grp = strdup("docker"); ++ user->secondary_grp = strdup("users"); + user->shell = strdup("/bin/bash"); + + user = &useradd_grp_list[MAX_TACACS_USER_PRIV]; From 1f05332e5aaf7c5cd702d15633ebd93b59b92155 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Fri, 20 Apr 2018 22:19:01 -0700 Subject: [PATCH 139/274] [snmp]: Fix a race between snmpd-config-updater and snmpd (#1628) There is a small window in which snmpd might not have registered a callback for SIGHUP and which will result in its death if snmpd-config-updater send this signal meant for a config reload. --- dockers/docker-snmp-sv2/snmpd-config-updater | 63 +++++++++++++++++++- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/dockers/docker-snmp-sv2/snmpd-config-updater b/dockers/docker-snmp-sv2/snmpd-config-updater index ea837e5a787f..487160ba6425 100755 --- a/dockers/docker-snmp-sv2/snmpd-config-updater +++ b/dockers/docker-snmp-sv2/snmpd-config-updater @@ -11,6 +11,7 @@ import os import re +import signal import subprocess import sys import syslog @@ -24,6 +25,62 @@ SYSLOG_IDENTIFIER = "snmpd-config-updater" # ============================== Classes ============================== +class Process(object): + def __init__(self, pid): + self.pid = pid + self.path = '/proc/%d/status' % pid + self.status = None + + def read_proc_status(self): + data = {} + with open(self.path) as f: + for line in f.readlines(): + key, value = line.split(':', 1) + data[ key ] = value.strip() + self.status = data + + def get_proc_signals(self): + assert self.status + sigBlk = int(self.status[ 'SigBlk' ], 16) + sigIgn = int(self.status[ 'SigIgn' ], 16) + sigCgt = int(self.status[ 'SigCgt' ], 16) + return (sigBlk, sigIgn, sigCgt) + + def handle_signal(self, sig): + sigBlk, sigIgn, sigCgt = self.get_proc_signals() + mask = 1 << ( sig - 1 ) + if mask & sigBlk: + return True + if mask & sigIgn: + return True + if mask & sigCgt: + return True + return False + + def send_signal(self, sig): + log_info('Sending signal %s to %d' % (sig, self.pid)) + os.kill(self.pid, sig) + + def safe_send_signal(self, sig): + self.read_proc_status() + if not self.handle_signal(sig): + return False + self.send_signal(sig) + return True + + def wait_send_signal(self, sig, interval=0.1): + while not self.safe_send_signal(sig): + log_info('Process %s has not yet registered %s' % (self.pid, sig)) + time.sleep(interval) + + @staticmethod + def by_name(name): + try: + pid = subprocess.check_output([ 'pidof', '-s', name ]) + except subprocess.CalledProcessError: + return None + return Process(int(pid.rstrip())) + class ConfigUpdater(object): SERVICE = "snmpd" CONFIG_FILE_PATH = "/etc/snmp" @@ -125,8 +182,10 @@ class ConfigUpdater(object): os.rename(filename_tmp, filename) - # Force snmpd to reload its configuration - os.system("kill -HUP $(pgrep snmpd) > /dev/null 2> /dev/null || :") + # Force snmpd process to reload its configuration if it is running + proc = Process.by_name(self.SERVICE) + if proc: + proc.wait_send_signal(signal.SIGHUP) def notification_handler(self, key, data): log_info("ACL configuration changed. Updating {} config accordingly...".format(self.SERVICE)) From 0abb653cf27c29db5d2ce47607b46d9495204a88 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Fri, 20 Apr 2018 22:19:22 -0700 Subject: [PATCH 140/274] [swss]:update submodule (#1630) Signed-off-by: Sihui Han --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 39523aa95915..84ce5ed82ae5 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 39523aa95915b1c78b559b5ec3917fe6fe837fad +Subproject commit 84ce5ed82ae564f74b3813db6abebd0e486f695d From f403c1be04de5369c833b7cdb40fdce42a01d8ba Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 23 Apr 2018 00:09:26 -0700 Subject: [PATCH 141/274] [cfggen]: Fix build by fixing pyangbind version (#1633) Signed-off-by: Qi Luo --- src/sonic-config-engine/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-config-engine/setup.py b/src/sonic-config-engine/setup.py index 296b7a03a6b9..e1530d0d3d32 100755 --- a/src/sonic-config-engine/setup.py +++ b/src/sonic-config-engine/setup.py @@ -17,6 +17,6 @@ def get_test_suite(): url='https://github.com/Azure/sonic-buildimage', py_modules=['portconfig', 'minigraph', 'openconfig_acl', 'sonic_platform'], scripts=['sonic-cfggen'], - install_requires=['lxml', 'jinja2', 'netaddr', 'ipaddr', 'pyyaml', 'pyangbind'], + install_requires=['lxml', 'jinja2', 'netaddr', 'ipaddr', 'pyyaml', 'pyangbind==0.6.0'], test_suite='setup.get_test_suite', ) From 509e1c47492d0a63849433676b239b2c2a15b5b1 Mon Sep 17 00:00:00 2001 From: yurypm Date: Mon, 23 Apr 2018 16:52:21 +0100 Subject: [PATCH 142/274] [snmpd]: Fix typo in is_platform_arista (#1634) --- dockers/docker-snmp-sv2/snmpd-config-updater | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-snmp-sv2/snmpd-config-updater b/dockers/docker-snmp-sv2/snmpd-config-updater index 487160ba6425..19702451495c 100755 --- a/dockers/docker-snmp-sv2/snmpd-config-updater +++ b/dockers/docker-snmp-sv2/snmpd-config-updater @@ -238,7 +238,7 @@ def is_platform_arista(): if proc.returncode != 0: log_error("Failed to retrieve platform string") - return false + return False return "arista" in stdout From 242f86d2dc510feb417fa90412a4ec64fa873dbf Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 23 Apr 2018 13:43:16 -0700 Subject: [PATCH 143/274] [cli]: Update sudoers file to ensure no 'show' commands prompt for sudo password (#1632) * [sonic-utilities] Update submodule * Update sudoers file to ensure no 'show' commands prompt for sudo --- files/image_config/sudoers/sudoers | 16 ++++++++++------ src/sonic-utilities | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/files/image_config/sudoers/sudoers b/files/image_config/sudoers/sudoers index 7cfa0baba0f1..4d651957afe2 100644 --- a/files/image_config/sudoers/sudoers +++ b/files/image_config/sudoers/sudoers @@ -17,19 +17,22 @@ Defaults env_keep += "VTYSH_PAGER" # Cmnd alias specification # Note: bcmcmd is dangerous for users in read only netgroups because it may operate ASIC -Cmnd_Alias READ_ONLY_CMDS = /usr/bin/decode-syseeprom, \ +Cmnd_Alias READ_ONLY_CMDS = /sbin/brctl show, \ + /usr/bin/decode-syseeprom, \ /usr/bin/docker images *, \ - /usr/bin/docker exec -it snmp cat /etc/snmp/snmpd.conf, \ - /usr/bin/docker exec -it bgp cat /etc/quagga/bgpd.conf, \ - /usr/bin/docker ps, \ + /usr/bin/docker exec snmp cat /etc/snmp/snmpd.conf, \ + /usr/bin/docker exec bgp cat /etc/quagga/bgpd.conf, \ + /usr/bin/docker exec * ps aux, \ + /usr/bin/docker ps*, \ /usr/bin/generate_dump, \ /usr/bin/lldpctl, \ /usr/bin/lldpshow, \ + /usr/bin/psuutil *, \ /usr/bin/sensors, \ /usr/bin/sfputil show *, \ /usr/bin/vtysh -c show *, \ - /bin/cat /var/log/syslog, \ - /usr/bin/tail -f /var/log/syslog + /bin/cat /var/log/syslog*, \ + /usr/bin/tail -F /var/log/syslog Cmnd_Alias PASSWD_CMDS = /usr/bin/config tacacs passkey *, \ /usr/sbin/chpasswd * @@ -49,3 +52,4 @@ Defaults!PASSWD_CMDS !syslog # See sudoers(5) for more information on "#include" directives: #includedir /etc/sudoers.d + diff --git a/src/sonic-utilities b/src/sonic-utilities index b2da06271c0a..da9476e90a7d 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit b2da06271c0ad9b9f054d16b8913f8279c9aea17 +Subproject commit da9476e90a7d5c9f784f5f22e0bcda13f4450c2b From 0adbf782b424bcf740367bb0de20543252dfa56d Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 24 Apr 2018 00:14:19 -0700 Subject: [PATCH 144/274] [sonic-mgmt]: Install more azure packages (#1635) Signed-off-by: Qi Luo --- dockers/docker-sonic-mgmt/Dockerfile.j2 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index be2f1b6518b5..c2f600c3c963 100644 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -46,6 +46,8 @@ RUN pip install ipaddr \ paramiko==2.1.2 \ adal +# Install Azure Storage package +RUN pip install azure-storage ## Copy and install sonic-mgmt docker dependencies COPY \ @@ -95,4 +97,8 @@ RUN curl -L https://aka.ms/InstallAzureCliBundled -o azure-cli_bundle.tar.gz RUN tar -xvzf azure-cli_bundle.tar.gz RUN azure-cli_bundle_*/installer +# Known bug: azure keyvault cannot work behind a proxy +# Temporary fix: upgrade the azure-keyvault package within az cli +RUN ~/lib/azure-cli/bin/python -m pip install azure-keyvault -U + RUN git clone https://github.com/Azure/sonic-mgmt From f7151e8ddba235848e6707e020fdf8a680fbad77 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 24 Apr 2018 15:13:51 -0700 Subject: [PATCH 145/274] [radvd] Ensure at least one interface is specified in radvd.conf before starting radvd (#1636) --- dockers/docker-router-advertiser/start.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dockers/docker-router-advertiser/start.sh b/dockers/docker-router-advertiser/start.sh index 7fcaf65a79c9..159006a176bd 100755 --- a/dockers/docker-router-advertiser/start.sh +++ b/dockers/docker-router-advertiser/start.sh @@ -14,5 +14,12 @@ fi # Generate /etc/radvd.conf config file sonic-cfggen -d -t /usr/share/sonic/templates/radvd.conf.j2 > /etc/radvd.conf +# Enusre at least one interface is specified in radvd.conf +NUM_IFACES=$(grep -c "^interface " /etc/radvd.conf) +if [ $NUM_IFACES -eq 0 ]; then + echo "No interfaces specified in radvd.conf. Not starting router advertiser process." + exit 0 +fi + # Start the router advertiser supervisorctl start radvd From d117172b239bb3c46bd5e2c2661c306c15b01629 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 24 Apr 2018 16:01:17 -0700 Subject: [PATCH 146/274] sonic-cfggen supports hwsku parameter (#1631) --- sonic-slave/Dockerfile | 18 +-- src/sonic-config-engine/data/l2switch.j2 | 21 ++++ src/sonic-config-engine/setup.py | 6 +- src/sonic-config-engine/sonic-cfggen | 29 +++-- .../tests/sample_output/l2switch.json | 107 ++++++++++++++++++ src/sonic-config-engine/tests/test_j2files.py | 8 ++ 6 files changed, 171 insertions(+), 18 deletions(-) create mode 100644 src/sonic-config-engine/data/l2switch.j2 create mode 100644 src/sonic-config-engine/tests/sample_output/l2switch.json diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index ed85b0ca436a..213daf1a8e47 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -184,16 +184,12 @@ RUN apt-get update && apt-get install -y \ libjs-sphinxdoc \ libjs-underscore \ python-docutils \ - python-jinja2 \ python-markupsafe \ python-pygments \ python-roman \ - python-sphinx \ sphinx-common \ - python3-sphinx \ # For sonic config engine testing python-lxml \ - python-jinja2 \ python-netaddr \ python-ipaddr \ python-yaml \ @@ -229,16 +225,22 @@ RUN export VERSION=1.8.3 \ && echo 'export GOROOT=/usr/local/go' >> /etc/bash.bashrc \ && echo 'export PATH=$PATH:$GOROOT/bin' >> /etc/bash.bashrc +# Upgrade pip2 +# Note: use pip2 specific version so jinja2 2.10 will install +RUN python2 -m pip install -U pip==9.0.3 + # For p4 build RUN pip install \ ctypesgen \ crc16 -# For templating -RUN pip install j2cli - # For sonic config engine testing -RUN pip install pyangbind==0.5.10 +RUN pip install pyangbind==0.6.0 +# Note: force upgrade debian packaged jinja2, if installed +RUN pip install --force-reinstall --upgrade jinja2>=2.10 + +# For templating (requiring jinja2) +RUN pip install j2cli # For sonic utilities testing RUN pip install click-default-group click natsort tabulate diff --git a/src/sonic-config-engine/data/l2switch.j2 b/src/sonic-config-engine/data/l2switch.j2 new file mode 100644 index 000000000000..ee24f5ebd19d --- /dev/null +++ b/src/sonic-config-engine/data/l2switch.j2 @@ -0,0 +1,21 @@ +{ + "DEVICE_METADATA": {{ DEVICE_METADATA | tojson }}, + "PORT": {{ PORT | tojson }}, + "VLAN": { + "Vlan1000": { + "vlanid": "1000" + } + }, + {% set ns = {'firstPrinted': False} -%} + "VLAN_MEMBER": { + {%- for port in PORT -%} + {%- if ns.firstPrinted %},{% endif %} + + "Vlan1000|{{ port }}": { + "tagging_mode": "untagged" + } + {%- if ns.update({'firstPrinted': True}) %}{% endif -%} + {%- endfor %} + + } +} diff --git a/src/sonic-config-engine/setup.py b/src/sonic-config-engine/setup.py index e1530d0d3d32..1d0c7f99fa41 100755 --- a/src/sonic-config-engine/setup.py +++ b/src/sonic-config-engine/setup.py @@ -3,6 +3,7 @@ from setuptools import setup import os.path import unittest +import glob def get_test_suite(): test_loader = unittest.TestLoader() @@ -17,6 +18,9 @@ def get_test_suite(): url='https://github.com/Azure/sonic-buildimage', py_modules=['portconfig', 'minigraph', 'openconfig_acl', 'sonic_platform'], scripts=['sonic-cfggen'], - install_requires=['lxml', 'jinja2', 'netaddr', 'ipaddr', 'pyyaml', 'pyangbind==0.6.0'], + install_requires=['lxml', 'jinja2>=2.10', 'netaddr', 'ipaddr', 'pyyaml', 'pyangbind==0.6.0'], test_suite='setup.get_test_suite', + data_files=[ + ('/usr/share/sonic/templates', glob.glob('data/*')), + ], ) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 2495bc89fe06..bdb3c804fc73 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -15,6 +15,7 @@ Examples: See usage string for detail description for arguments. """ +from __future__ import print_function import sys import os.path import argparse @@ -26,6 +27,7 @@ from functools import partial from minigraph import minigraph_encoder from minigraph import parse_xml from minigraph import parse_device_desc_xml +from portconfig import get_port_config from sonic_platform import get_machine_info from sonic_platform import get_platform_info from sonic_platform import get_system_mac @@ -140,7 +142,8 @@ def main(): group = parser.add_mutually_exclusive_group() group.add_argument("-m", "--minigraph", help="minigraph xml file", nargs='?', const='/etc/sonic/minigraph.xml') group.add_argument("-M", "--device-description", help="device description xml file") - parser.add_argument("-p", "--port-config", help="port config file, used with -m") + group.add_argument("-k", "--hwsku", help="HwSKU") + parser.add_argument("-p", "--port-config", help="port config file, used with -m or -k", nargs='?', const=None) parser.add_argument("-y", "--yaml", help="yaml file that contains additional variables", action='append', default=[]) parser.add_argument("-j", "--json", help="json file that contains additional variables", action='append', default=[]) parser.add_argument("-a", "--additional-data", help="addition data, in json string") @@ -162,7 +165,18 @@ def main(): db_kwargs['unix_socket_path'] = args.redis_unix_sock_file data = {} + hwsku = args.hwsku + if hwsku is not None: + hardware_data = {'DEVICE_METADATA': {'localhost': { + 'hwsku': hwsku + }}} + deep_update(data, hardware_data) + (ports, _) = get_port_config(hwsku, platform, args.port_config) + if not ports: + print('Failed to get port config', file=sys.stderr) + sys.exit(1) + deep_update(data, {'PORT': ports}) if args.minigraph != None: minigraph = args.minigraph @@ -172,10 +186,7 @@ def main(): else: deep_update(data, parse_xml(minigraph, platform)) else: - if args.port_config != None: - deep_update(data, parse_xml(minigraph, port_config_file=args.port_config)) - else: - deep_update(data, parse_xml(minigraph)) + deep_update(data, parse_xml(minigraph, port_config_file=args.port_config)) if args.device_description != None: deep_update(data, parse_device_desc_xml(args.device_description)) @@ -216,14 +227,14 @@ def main(): for attr in ['ip', 'network', 'prefixlen', 'netmask']: env.filters[attr] = partial(prefix_attr, attr) template = env.get_template(template_file) - print template.render(sort_data(data)) + print(template.render(sort_data(data))) if args.var != None: template = jinja2.Template('{{' + args.var + '}}') - print template.render(data) + print(template.render(data)) if args.var_json != None: - print json.dumps(FormatConverter.to_serialized(data[args.var_json]), indent=4, cls=minigraph_encoder) + print(json.dumps(FormatConverter.to_serialized(data[args.var_json]), indent=4, cls=minigraph_encoder)) if args.write_to_db: configdb = ConfigDBConnector(**db_kwargs) @@ -231,7 +242,7 @@ def main(): configdb.mod_config(FormatConverter.output_to_db(data)) if args.print_data: - print json.dumps(FormatConverter.to_serialized(data), indent=4, cls=minigraph_encoder) + print(json.dumps(FormatConverter.to_serialized(data), indent=4, cls=minigraph_encoder)) if __name__ == "__main__": diff --git a/src/sonic-config-engine/tests/sample_output/l2switch.json b/src/sonic-config-engine/tests/sample_output/l2switch.json new file mode 100644 index 000000000000..e8af54869e02 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/l2switch.json @@ -0,0 +1,107 @@ +{ + "DEVICE_METADATA": {"localhost": {"hwsku": "Mellanox-SN2700"}}, + "PORT": {"Ethernet0": {"alias": "fortyGigE0/0", "lanes": "29,30,31,32"}, "Ethernet100": {"alias": "fortyGigE0/100", "lanes": "125,126,127,128"}, "Ethernet104": {"alias": "fortyGigE0/104", "lanes": "85,86,87,88"}, "Ethernet108": {"alias": "fortyGigE0/108", "lanes": "81,82,83,84"}, "Ethernet112": {"alias": "fortyGigE0/112", "lanes": "89,90,91,92"}, "Ethernet116": {"alias": "fortyGigE0/116", "lanes": "93,94,95,96"}, "Ethernet12": {"alias": "fortyGigE0/12", "lanes": "33,34,35,36"}, "Ethernet120": {"alias": "fortyGigE0/120", "lanes": "97,98,99,100"}, "Ethernet124": {"alias": "fortyGigE0/124", "lanes": "101,102,103,104"}, "Ethernet16": {"alias": "fortyGigE0/16", "lanes": "41,42,43,44"}, "Ethernet20": {"alias": "fortyGigE0/20", "lanes": "45,46,47,48"}, "Ethernet24": {"alias": "fortyGigE0/24", "lanes": "5,6,7,8"}, "Ethernet28": {"alias": "fortyGigE0/28", "lanes": "1,2,3,4"}, "Ethernet32": {"alias": "fortyGigE0/32", "lanes": "9,10,11,12"}, "Ethernet36": {"alias": "fortyGigE0/36", "lanes": "13,14,15,16"}, "Ethernet4": {"alias": "fortyGigE0/4", "lanes": "25,26,27,28"}, "Ethernet40": {"alias": "fortyGigE0/40", "lanes": "21,22,23,24"}, "Ethernet44": {"alias": "fortyGigE0/44", "lanes": "17,18,19,20"}, "Ethernet48": {"alias": "fortyGigE0/48", "lanes": "49,50,51,52"}, "Ethernet52": {"alias": "fortyGigE0/52", "lanes": "53,54,55,56"}, "Ethernet56": {"alias": "fortyGigE0/56", "lanes": "61,62,63,64"}, "Ethernet60": {"alias": "fortyGigE0/60", "lanes": "57,58,59,60"}, "Ethernet64": {"alias": "fortyGigE0/64", "lanes": "65,66,67,68"}, "Ethernet68": {"alias": "fortyGigE0/68", "lanes": "69,70,71,72"}, "Ethernet72": {"alias": "fortyGigE0/72", "lanes": "77,78,79,80"}, "Ethernet76": {"alias": "fortyGigE0/76", "lanes": "73,74,75,76"}, "Ethernet8": {"alias": "fortyGigE0/8", "lanes": "37,38,39,40"}, "Ethernet80": {"alias": "fortyGigE0/80", "lanes": "105,106,107,108"}, "Ethernet84": {"alias": "fortyGigE0/84", "lanes": "109,110,111,112"}, "Ethernet88": {"alias": "fortyGigE0/88", "lanes": "117,118,119,120"}, "Ethernet92": {"alias": "fortyGigE0/92", "lanes": "113,114,115,116"}, "Ethernet96": {"alias": "fortyGigE0/96", "lanes": "121,122,123,124"}}, + "VLAN": { + "Vlan1000": { + "vlanid": "1000" + } + }, + "VLAN_MEMBER": { + "Vlan1000|Ethernet0": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet4": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet8": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet12": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet16": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet20": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet24": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet28": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet32": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet36": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet40": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet44": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet48": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet52": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet56": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet60": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet64": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet68": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet72": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet76": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet80": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet84": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet88": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet92": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet96": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet100": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet104": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet108": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet112": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet116": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet120": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet124": { + "tagging_mode": "untagged" + } + } +} diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 129c3973d7b5..8ff974c1eb10 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -106,6 +106,14 @@ def test_msn27xx_32ports_buffers(self): self.assertTrue(filecmp.cmp(sample_output_file, self.output_file)) + def test_sku_render_template(self): + argument = '-k Mellanox-SN2700 -t ' + os.path.join(self.test_dir, '../data/l2switch.j2') + ' -p ' + self.t0_port_config + ' > ' + self.output_file + self.run_script(argument) + + sample_output_file = os.path.join(self.test_dir, 'sample_output', 'l2switch.json') + + self.assertTrue(filecmp.cmp(sample_output_file, self.output_file)) + def tearDown(self): try: os.remove(self.output_file) From 3726c9fa2f94a5931ce76ff64cb9515837b72def Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Wed, 25 Apr 2018 20:18:07 +0300 Subject: [PATCH 147/274] Update swss submodule pointer (#1641) Includes: - fix for PFCWD zero profile - fix for racing condition in buffermgrd Signed-off-by: Andriy Moroz --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 84ce5ed82ae5..32bb66f48efe 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 84ce5ed82ae564f74b3813db6abebd0e486f695d +Subproject commit 32bb66f48efe0070e5bf573ef5ec3ebaf7ab92b9 From 4dc327d87adc5e7260031b0941671eaf7530a62b Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 25 Apr 2018 14:28:20 -0700 Subject: [PATCH 148/274] [submodule]: Update submodule sonic-snmpagent (#1642) Signed-off-by: Qi Luo --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 12bc0e0c9843..a03f7794d6b2 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 12bc0e0c98432eb21add3b547e13bcf10e77ab51 +Subproject commit a03f7794d6b2faec23088ba064cb6ce7e7d2122a From 65b3774487ef7599e6deec07356935284d168fdc Mon Sep 17 00:00:00 2001 From: simonJi2018 <37395146+simonJi2018@users.noreply.github.com> Date: Wed, 25 Apr 2018 22:20:14 -0700 Subject: [PATCH 149/274] [nehpos] fix libsainps and nps-sdk bug for support sai 1.2.4 (#1639) --- .../Accton-AS7116-54X/buffers.json.j2 | 1 + .../Accton-AS7116-54X/qos.json | 153 ++++++++++++++++++ .../INGRASYS-S9130-32X/buffers.json.j2 | 1 + .../INGRASYS-S9130-32X/qos.json | 153 ++++++++++++++++++ .../INGRASYS-S9230-64X/buffers.json.j2 | 1 + .../INGRASYS-S9230-64X/qos.json | 153 ++++++++++++++++++ platform/nephos/sai.mk | 8 +- platform/nephos/sdk.mk | 4 +- 8 files changed, 468 insertions(+), 6 deletions(-) create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers.json.j2 create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/qos.json create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers.json.j2 create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/qos.json create mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers.json.j2 create mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/qos.json diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers.json.j2 b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers.json.j2 new file mode 100644 index 000000000000..9e26dfeeb6e6 --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers.json.j2 @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/qos.json b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/qos.json new file mode 100644 index 000000000000..6f3f6990d87c --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/qos.json @@ -0,0 +1,153 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "1", + "1": "0", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "1", + "1": "0", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"1", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184128", + "green_min_threshold": "184128" + }, + "AZURE_LOSSLESS" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184128", + "green_min_threshold": "184128" + } + }, + "QUEUE": { + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53|3-4" : { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53|0" : { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53|1" : { + "scheduler" : "[SCHEDULER|scheduler.2]" + } + } +} diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers.json.j2 b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers.json.j2 new file mode 100644 index 000000000000..9e26dfeeb6e6 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers.json.j2 @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/qos.json b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/qos.json new file mode 100644 index 000000000000..62464d7d39f0 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/qos.json @@ -0,0 +1,153 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "1", + "1": "0", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "1", + "1": "0", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"1", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184128", + "green_min_threshold": "184128" + }, + "AZURE_LOSSLESS" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184128", + "green_min_threshold": "184128" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1" : { + "scheduler" : "[SCHEDULER|scheduler.2]" + } + } +} diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers.json.j2 b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers.json.j2 new file mode 100644 index 000000000000..9e26dfeeb6e6 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers.json.j2 @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/qos.json b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/qos.json new file mode 100644 index 000000000000..434226afca71 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/qos.json @@ -0,0 +1,153 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "1", + "1": "0", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "1", + "1": "0", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"1", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220,Ethernet224,Ethernet228,Ethernet232,Ethernet236,Ethernet240,Ethernet244,Ethernet248,Ethernet252": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184128", + "green_min_threshold": "184128" + }, + "AZURE_LOSSLESS" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184128", + "green_min_threshold": "184128" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220,Ethernet224,Ethernet228,Ethernet232,Ethernet236,Ethernet240,Ethernet244,Ethernet248,Ethernet252|3-4" : { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220,Ethernet224,Ethernet228,Ethernet232,Ethernet236,Ethernet240,Ethernet244,Ethernet248,Ethernet252|0" : { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220,Ethernet224,Ethernet228,Ethernet232,Ethernet236,Ethernet240,Ethernet244,Ethernet248,Ethernet252|1" : { + "scheduler" : "[SCHEDULER|scheduler.2]" + } + } +} diff --git a/platform/nephos/sai.mk b/platform/nephos/sai.mk index 7c898bbada6b..213692d0fe6a 100644 --- a/platform/nephos/sai.mk +++ b/platform/nephos/sai.mk @@ -1,9 +1,9 @@ -NEPHOS_SAI = libsainps_2.0.4_amd64.deb -$(NEPHOS_SAI)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps_2.0.4_amd64.deb" +NEPHOS_SAI = libsainps_2.0.3_sai_1.2.4_d15aca_amd64.deb +$(NEPHOS_SAI)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps_2.0.3_sai_1.2.4_d15aca_amd64.deb" -NEPHOS_SAI_DEV = libsainps-dev_2.0.4_sai_1.2.4_amd64.deb +NEPHOS_SAI_DEV = libsainps-dev_2.0.3_sai_1.2.4_d15aca_amd64.deb $(eval $(call add_derived_package,$(NEPHOS_SAI),$(NEPHOS_SAI_DEV))) -$(NEPHOS_SAI_DEV)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps-dev_2.0.4_sai_1.2.4_amd64.deb" +$(NEPHOS_SAI_DEV)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps-dev_2.0.3_sai_1.2.4_d15aca_amd64.deb" SONIC_ONLINE_DEBS += $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) $(NEPHOS_SAI_DEV)_DEPENDS += $(NEPHOS_SAI) diff --git a/platform/nephos/sdk.mk b/platform/nephos/sdk.mk index 743512366db6..92642a19d028 100644 --- a/platform/nephos/sdk.mk +++ b/platform/nephos/sdk.mk @@ -1,4 +1,4 @@ -NEPHOS_NPS_KERNEL = nps-modules-3.16.0-5-amd64_2.0.3_amd64.deb -$(NEPHOS_NPS_KERNEL)_URL = "https://github.com/NephosInc/SONiC/raw/master/sdk/nps-modules-3.16.0-5-amd64_2.0.3_amd64.deb" +NEPHOS_NPS_KERNEL = nps-modules-3.16.0-5_2.0.3_d15aca_amd64.deb +$(NEPHOS_NPS_KERNEL)_URL = "https://github.com/NephosInc/SONiC/raw/master/sdk/nps-modules-3.16.0-5_2.0.3_d15aca_amd64.deb" SONIC_ONLINE_DEBS += $(NEPHOS_NPS_KERNEL) From 8d2a30a75baaaae68eaa921e92441ed9ceebd40c Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 26 Apr 2018 13:53:39 -0700 Subject: [PATCH 150/274] [kernel]: update sonic linux kernel (#1645) b511c96 2018-04-17 | Add kexec reboot string (#46) (HEAD, origin/master, origin/HEAD) [Joe LeVeque] Signed-off-by: Guohan Lu --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index ed04b3690388..b511c96bcea0 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit ed04b36903885ec065274174aa775e47695db2cb +Subproject commit b511c96bcea09ae2b2adb3c3df7c4c41f14b6929 From d2692639383e510334ae4c599eba9b763fa759a0 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 26 Apr 2018 13:53:54 -0700 Subject: [PATCH 151/274] [baseimage]: add screen package (#1644) --- build_debian.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index 2b2294194d7b..ed5d180859f6 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -225,7 +225,8 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in gdisk \ sysfsutils \ grub2-common \ - ethtool + ethtool \ + screen sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y download \ grub-pc-bin From 321ff4ebdc634abfc7a25c149bcf4c375b686700 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 26 Apr 2018 13:54:39 -0700 Subject: [PATCH 152/274] [swss]: update sonic-swss (#1638) [counters]:separate query of port/queue counters [buffermgr]: remove the item from consumer queue if invalid Signed-off-by: Guohan Lu --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 32bb66f48efe..edafa3424d64 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 32bb66f48efe0070e5bf573ef5ec3ebaf7ab92b9 +Subproject commit edafa3424d64e0e97f826d0c84040bc6bc6bdd09 From 3993e58d1d2cefa1444a3dd5c5296987ba99734b Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Thu, 26 Apr 2018 15:27:20 -0700 Subject: [PATCH 153/274] [updategraph]: Keep updategraph service active after start (#1651) --- files/image_config/updategraph/updategraph.service | 1 + 1 file changed, 1 insertion(+) diff --git a/files/image_config/updategraph/updategraph.service b/files/image_config/updategraph/updategraph.service index 4599f56bdc64..ec478d93a132 100644 --- a/files/image_config/updategraph/updategraph.service +++ b/files/image_config/updategraph/updategraph.service @@ -7,6 +7,7 @@ Requires=database.service [Service] Type=oneshot ExecStart=/usr/bin/updategraph +RemainAfterExit=yes [Install] WantedBy=multi-user.target From 18e97fba2cda0da281869531ce291ee9af4a9576 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 26 Apr 2018 19:01:33 -0700 Subject: [PATCH 154/274] [docker-lldpd]: Various fixes (#1650) * We don't need configure anything until we have interfaces created * Don't run lldpcli for a port, until a port is up and running * Remove lldpd socket before starting lldpd * Fix sample files for lldpd configuration * Another attempt to make the test working * Quick fix for lldpd paused after start bug --- dockers/docker-lldp-sv2/lldpd.conf.j2 | 3 --- dockers/docker-lldp-sv2/lldpmgrd | 19 +++++++++++++++ dockers/docker-lldp-sv2/start.sh | 24 +++++++++++++++++++ .../tests/sample_output/lldpd.conf | 4 ---- 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/dockers/docker-lldp-sv2/lldpd.conf.j2 b/dockers/docker-lldp-sv2/lldpd.conf.j2 index ea8be54b097d..94a04596699f 100644 --- a/dockers/docker-lldp-sv2/lldpd.conf.j2 +++ b/dockers/docker-lldp-sv2/lldpd.conf.j2 @@ -1,6 +1,3 @@ {% if MGMT_INTERFACE %} configure ports eth0 lldp portidsubtype local {{ MGMT_INTERFACE.keys()[0][0] }} {% endif %} -{% for local_port in DEVICE_NEIGHBOR %} -configure ports {{ local_port }} lldp portidsubtype local {{ PORT[local_port]['alias'] }} description {{ DEVICE_NEIGHBOR[local_port]['name'] }}:{{ DEVICE_NEIGHBOR[local_port]['port'] }} -{% endfor %} diff --git a/dockers/docker-lldp-sv2/lldpmgrd b/dockers/docker-lldp-sv2/lldpmgrd index 89bba918bf3d..a044d5ed9d77 100755 --- a/dockers/docker-lldp-sv2/lldpmgrd +++ b/dockers/docker-lldp-sv2/lldpmgrd @@ -20,6 +20,7 @@ try: import subprocess import sys import syslog + import os.path from swsscommon import swsscommon except ImportError as err: raise ImportError("%s - required module not found" % str(err)) @@ -70,6 +71,19 @@ def signal_handler(sig, frame): else: log_warning("Caught unhandled signal '" + sig + "'") +# ========================== Helpers ================================== + +def is_port_up(port_name): + filename = "/sys/class/net/%s/operstate" % port_name + if not os.path.exists(filename): + return False + + with open(filename) as fp: + state = fp.read() + if 'up' in state: + return True + else: + return False # ============================== Classes ============================== @@ -159,6 +173,11 @@ class LldpManager(object): to_delete = [] for (port_name, cmd) in self.pending_cmds.iteritems(): + if not is_port_up(port_name): + # it doesn't make any sense to configure lldpd if the target port is unavailable + # let's postpone the command for the next iteration + continue + log_debug("Running command: '{}'".format(cmd)) proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) diff --git a/dockers/docker-lldp-sv2/start.sh b/dockers/docker-lldp-sv2/start.sh index 26337fb0667d..adc322979813 100755 --- a/dockers/docker-lldp-sv2/start.sh +++ b/dockers/docker-lldp-sv2/start.sh @@ -6,8 +6,32 @@ mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status rm -f /var/run/rsyslogd.pid +rm -f /var/run/lldpd.socket supervisorctl start rsyslogd supervisorctl start lldpd supervisorctl start lldp-syncd supervisorctl start lldpmgrd + +# Current lldpd version has a bug. +# When lldpd starts it is in the pause state by default +# But then it execute 'lldpcli resume' to configure and unpause itself. +# When lldpd execute lldpcli, it doesn't check the return code +# Sometimes lldpcli returns failure, but lldpd doesn't catch it +# and keeps working paused and unconfigured +# +# The fix below addresses the issue. +# + +# wait until lldpd started +until [[ -e /var/run/lldpd.socket ]]; +do + sleep 1; +done + +# Manually try to resume lldpd, until it's successful +while /bin/true; +do + lldpcli -u /var/run/lldpd.socket -c /etc/lldpd.conf -c /etc/lldpd.d resume > /dev/null && break + sleep 1 +done diff --git a/src/sonic-config-engine/tests/sample_output/lldpd.conf b/src/sonic-config-engine/tests/sample_output/lldpd.conf index 049d9f09059c..29739cb890d0 100644 --- a/src/sonic-config-engine/tests/sample_output/lldpd.conf +++ b/src/sonic-config-engine/tests/sample_output/lldpd.conf @@ -1,6 +1,2 @@ configure ports eth0 lldp portidsubtype local eth0 -configure ports Ethernet112 lldp portidsubtype local fortyGigE0/112 description ARISTA01T1:Ethernet1/1 -configure ports Ethernet116 lldp portidsubtype local fortyGigE0/116 description ARISTA02T1:Ethernet1/1 -configure ports Ethernet120 lldp portidsubtype local fortyGigE0/120 description ARISTA03T1:Ethernet1/1 -configure ports Ethernet124 lldp portidsubtype local fortyGigE0/124 description ARISTA04T1:Ethernet1/1 From 764d0813c3248833c8bcc2a82c7b053f1c25476e Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Thu, 26 Apr 2018 19:02:44 -0700 Subject: [PATCH 155/274] [sonic-utilities]: Submodule update for sonic-utilities (#1653) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index da9476e90a7d..b69837c009c9 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit da9476e90a7d5c9f784f5f22e0bcda13f4450c2b +Subproject commit b69837c009c9167651a59ee9bd90c3938b4d06b2 From 02f706a35656ee7e89de4a6d1aecee53cdad01fd Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Sat, 28 Apr 2018 08:48:44 +0300 Subject: [PATCH 156/274] [mellanox]: Update SAI version to 1.11.4 and SDK to 4.2.7303 (#1655) Signed-off-by: Andriy Moroz --- platform/mellanox/mlnx-sai.mk | 4 ++-- platform/mellanox/sdk.mk | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 23ef8c60458b..9432b596428c 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.11.4-master -MLNX_SAI_REVISION = 1a44c29b22e1f36f4856f4aee92ad513c963c2b8 +MLNX_SAI_VERSION = SAIRel1.11.5-master +MLNX_SAI_REVISION = 15f8f0f0a3d5e33e62a404bae829f1d6b378b0f7 export MLNX_SAI_VERSION MLNX_SAI_REVISION diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 2ebb7d23f9c6..2ae9e43ac52a 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,5 +1,5 @@ -MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/6367854b48b73470a6e093f6fbbd45b3341edaba/sdk -MLNX_SDK_VERSION = 4.2.7201 +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/56130a854a3b0f4e46d6d84749a5d758e7d1f297/sdk +MLNX_SDK_VERSION = 4.2.7303 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ $(SXD_LIBS) $(TESTX) From 8d3c5fbcc21e72d38827c742f208a9984456be2d Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Sun, 29 Apr 2018 20:19:06 -0700 Subject: [PATCH 157/274] [docker-dhcp]: Fix the sonic build issue (#1659) Install the built version of isc-dhcp-client in docker-dhcp-relay --- rules/docker-dhcp-relay.mk | 2 +- rules/isc-dhcp.mk | 6 +++++- src/isc-dhcp/Makefile | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index 44d3904d7394..53406ad1e15f 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -2,7 +2,7 @@ DOCKER_DHCP_RELAY = docker-dhcp-relay.gz $(DOCKER_DHCP_RELAY)_PATH = $(DOCKERS_PATH)/docker-dhcp-relay -$(DOCKER_DHCP_RELAY)_DEPENDS += $(ISC_DHCP_COMMON) $(ISC_DHCP_RELAY) +$(DOCKER_DHCP_RELAY)_DEPENDS += $(ISC_DHCP_COMMON) $(ISC_DHCP_RELAY) $(ISC_DHCP_CLIENT) $(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) diff --git a/rules/isc-dhcp.mk b/rules/isc-dhcp.mk index 7b7f69c6cfc6..37c775da017a 100644 --- a/rules/isc-dhcp.mk +++ b/rules/isc-dhcp.mk @@ -8,5 +8,9 @@ ISC_DHCP_COMMON = isc-dhcp-common_$(ISC_DHCP_VERSION)_amd64.deb $(ISC_DHCP_COMMON)_SRC_PATH = $(SRC_PATH)/isc-dhcp SONIC_MAKE_DEBS += $(ISC_DHCP_COMMON) +ISC_DHCP_CLIENT = isc-dhcp-client_$(ISC_DHCP_VERSION)_amd64.deb +$(ISC_DHCP_CLIENT)_SRC_PATH = $(SRC_PATH)/isc-dhcp +SONIC_MAKE_DEBS += $(ISC_DHCP_CLIENT) + ISC_DHCP_RELAY = isc-dhcp-relay_$(ISC_DHCP_VERSION)_amd64.deb -$(eval $(call add_derived_package,$(ISC_DHCP_COMMON),$(ISC_DHCP_RELAY))) +$(eval $(call add_derived_package,$(ISC_DHCP_COMMON),$(ISC_DHCP_RELAY),$(ISC_DHCP_CLIENT))) diff --git a/src/isc-dhcp/Makefile b/src/isc-dhcp/Makefile index 5b1cb8407005..b439ec7c1ee6 100644 --- a/src/isc-dhcp/Makefile +++ b/src/isc-dhcp/Makefile @@ -3,7 +3,8 @@ SHELL = /bin/bash .SHELLFLAGS += -e MAIN_TARGET = isc-dhcp-common_$(ISC_DHCP_VERSION)_amd64.deb -DERIVED_TARGETS = isc-dhcp-relay_$(ISC_DHCP_VERSION)_amd64.deb +DERIVED_TARGETS = isc-dhcp-relay_$(ISC_DHCP_VERSION)_amd64.deb \ + isc-dhcp-client_$(ISC_DHCP_VERSION)_amd64.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Remove any stale files From 3ed4513d65861edb77ad078c6262428f676da065 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Mon, 30 Apr 2018 11:06:47 -0700 Subject: [PATCH 158/274] [minigraph.py] Fix an issue that mirror table might be considered ctrlplane table (#1656) --- src/sonic-config-engine/minigraph.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index dba1a6516cf4..443893c66c25 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -216,6 +216,8 @@ def parse_dpg(dpg, hname): acls[aclname] = {'policy_desc': aclname, 'ports': acl_intfs, 'type': 'MIRROR' if is_mirror else 'L3'} + elif is_mirror: + acls[aclname] = {'policy_desc': aclname, 'type': 'MIRROR'} else: # This ACL has no interfaces to attach to -- consider this a control plane ACL try: From f3426e32dcf086cd02b82acfaa3956f96395b3e0 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Mon, 30 Apr 2018 21:18:56 +0300 Subject: [PATCH 159/274] Decrease usable space in log partition to 90% (#1648) 95 is too close to the edge because by default 5% is already reserved for super-user Signed-off-by: Andriy Moroz --- files/image_config/logrotate/logrotate.d/rsyslog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/image_config/logrotate/logrotate.d/rsyslog b/files/image_config/logrotate/logrotate.d/rsyslog index ed54c62082f9..6788762d7687 100644 --- a/files/image_config/logrotate/logrotate.d/rsyslog +++ b/files/image_config/logrotate/logrotate.d/rsyslog @@ -57,8 +57,8 @@ VAR_LOG_SIZE_KB=$(df -k /var/log | sed -n 2p | awk '{ print $2 }') - # Limit usable space to 95% of the partition minus the reserved space for other logs - USABLE_SPACE_KB=$(( (VAR_LOG_SIZE_KB * 95 / 100) - RESERVED_SPACE_KB)) + # Limit usable space to 90% of the partition minus the reserved space for other logs + USABLE_SPACE_KB=$(( (VAR_LOG_SIZE_KB * 90 / 100) - RESERVED_SPACE_KB)) # Set our threshold so as to maintain enough space to write all logs from empty to full # Most likely, some logs will have non-zero size when this is called, so this errs on the side From 1ae4db3af77744badc4c50a5327b803474ad100d Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Mon, 30 Apr 2018 16:52:22 -0700 Subject: [PATCH 160/274] Quagga: Use bgp keepalive and holdtime timers from configdb (#1661) --- dockers/docker-fpm-quagga/bgpd.conf.j2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index bd8de7e4ba15..1adb660ec00a 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -64,6 +64,11 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% if bgp_session['asn'] | int != 0 %} neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }} neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }} +{# set the bgp neighbor timers if they have not default values #} +{% if (bgp_session['keepalive'] is defined and bgp_session['keepalive'] | int != 60) + or (bgp_session['holdtime'] is defined and bgp_session['holdtime'] | int != 180) %} + neighbor {{ neighbor_addr }} timers {{ bgp_session['keepalive'] }} {{ bgp_session['holdtime'] }} +{% endif %} {% if bgp_session.has_key('admin_status') and bgp_session['admin_status'] == 'down' or not bgp_session.has_key('admin_status') and DEVICE_METADATA['localhost'].has_key('default_bgp_status') and DEVICE_METADATA['localhost']['default_bgp_status'] == 'down' %} neighbor {{ neighbor_addr }} shutdown {% endif %} From 3d61df9d757e33524a26349865f21c8b0df5b10f Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 30 Apr 2018 23:06:51 -0700 Subject: [PATCH 161/274] Remove snmpd hw_fsys module, remove disk monitoring which are not in use (#1663) Signed-off-by: Qi Luo --- dockers/docker-snmp-sv2/snmpd.conf.j2 | 8 -------- dockers/docker-snmp-sv2/supervisord.conf | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/dockers/docker-snmp-sv2/snmpd.conf.j2 b/dockers/docker-snmp-sv2/snmpd.conf.j2 index 6353246acb08..62188892fa68 100644 --- a/dockers/docker-snmp-sv2/snmpd.conf.j2 +++ b/dockers/docker-snmp-sv2/snmpd.conf.j2 @@ -60,14 +60,6 @@ sysServices 72 # Note that this table will be empty if there are no "proc" entries in the snmpd.conf file -# -# Disk Monitoring -# - # 10MBs required on root disk, 5% free on /var, 10% free on all other disks -disk / 10000 -disk /var 5% -includeAllDisks 10% - # Walk the UCD-SNMP-MIB::dskTable to see the resulting output # Note that this table will be empty if there are no "disk" entries in the snmpd.conf file diff --git a/dockers/docker-snmp-sv2/supervisord.conf b/dockers/docker-snmp-sv2/supervisord.conf index b3db3be95a2f..d07f584a6933 100644 --- a/dockers/docker-snmp-sv2/supervisord.conf +++ b/dockers/docker-snmp-sv2/supervisord.conf @@ -29,7 +29,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:snmpd] -command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable,ipCidrRouteTable,ip,disk_hw -p /run/snmpd.pid +command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable,ipCidrRouteTable,ip,disk_hw,hw_fsys -p /run/snmpd.pid priority=4 autostart=false autorestart=false From c74be37ae016bbe4d64f711b38a3bd4edae767db Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 1 May 2018 08:33:35 -0700 Subject: [PATCH 162/274] [swss]: update swss submodule (#1664) * bb85c72 2018-05-01 | Populate existing interface cache, bring down before configDone (#491) (HEAD -> master, origin/master, origin/HEAD) [Prince Sunny] * bc97597 2018-04-30 | Add ipv6 ACL support in schema file (#490) [zhenggen-xu] * f939b95 2018-04-27 | [qosorch]: Optimizations of qosorch (#488) [pavel-shirshov] Signed-off-by: Guohan Lu --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index edafa3424d64..bb85c729c44b 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit edafa3424d64e0e97f826d0c84040bc6bc6bdd09 +Subproject commit bb85c729c44b5fe1ea34ce59a368f34112180d30 From 5817e995203e41d3d3198175a8e814cc133d8bcf Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 1 May 2018 18:32:49 -0700 Subject: [PATCH 163/274] Revert "Remove snmpd hw_fsys module, remove disk monitoring which is not in use" (#1665) * Revert "[swss]: update swss submodule (#1664)" This reverts commit c74be37ae016bbe4d64f711b38a3bd4edae767db. * Revert "Remove snmpd hw_fsys module, remove disk monitoring which are not in use (#1663)" This reverts commit 3d61df9d757e33524a26349865f21c8b0df5b10f. --- dockers/docker-snmp-sv2/snmpd.conf.j2 | 8 ++++++++ dockers/docker-snmp-sv2/supervisord.conf | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dockers/docker-snmp-sv2/snmpd.conf.j2 b/dockers/docker-snmp-sv2/snmpd.conf.j2 index 62188892fa68..6353246acb08 100644 --- a/dockers/docker-snmp-sv2/snmpd.conf.j2 +++ b/dockers/docker-snmp-sv2/snmpd.conf.j2 @@ -60,6 +60,14 @@ sysServices 72 # Note that this table will be empty if there are no "proc" entries in the snmpd.conf file +# +# Disk Monitoring +# + # 10MBs required on root disk, 5% free on /var, 10% free on all other disks +disk / 10000 +disk /var 5% +includeAllDisks 10% + # Walk the UCD-SNMP-MIB::dskTable to see the resulting output # Note that this table will be empty if there are no "disk" entries in the snmpd.conf file diff --git a/dockers/docker-snmp-sv2/supervisord.conf b/dockers/docker-snmp-sv2/supervisord.conf index d07f584a6933..b3db3be95a2f 100644 --- a/dockers/docker-snmp-sv2/supervisord.conf +++ b/dockers/docker-snmp-sv2/supervisord.conf @@ -29,7 +29,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:snmpd] -command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable,ipCidrRouteTable,ip,disk_hw,hw_fsys -p /run/snmpd.pid +command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable,ipCidrRouteTable,ip,disk_hw -p /run/snmpd.pid priority=4 autostart=false autorestart=false From bebb7a0fa27374b884959c3bcd113ffd2d549ba9 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 1 May 2018 20:53:47 -0700 Subject: [PATCH 164/274] [zebra.conf] Fix template issue with multiple lo addresses (#1662) * [zebra.conf] Fix template issue with multiple lo addresses * Add unitest for Loopback1 --- dockers/docker-fpm-quagga/zebra.conf.j2 | 12 ++- dockers/docker-orchagent/ipinip.json.j2 | 2 +- .../tests/sample_output/bgpd.conf | 91 +++++++++++++++++++ .../tests/sample_output/interfaces | 4 + .../tests/sample_output/zebra.conf | 44 +++++++++ .../tests/t0-sample-graph.xml | 10 +- src/sonic-config-engine/tests/test_j2files.py | 16 +++- 7 files changed, 171 insertions(+), 8 deletions(-) create mode 100644 src/sonic-config-engine/tests/sample_output/bgpd.conf create mode 100644 src/sonic-config-engine/tests/sample_output/zebra.conf diff --git a/dockers/docker-fpm-quagga/zebra.conf.j2 b/dockers/docker-fpm-quagga/zebra.conf.j2 index 8b967f98671c..e4586e72dd62 100644 --- a/dockers/docker-fpm-quagga/zebra.conf.j2 +++ b/dockers/docker-fpm-quagga/zebra.conf.j2 @@ -40,11 +40,13 @@ ip route 0.0.0.0/0 {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} 200 {% set lo_ipv6_addrs = [] %} {% if LOOPBACK_INTERFACE %} {% for (name, prefix) in LOOPBACK_INTERFACE %} -{% if prefix | ipv6 %} -{% if lo_ipv6_addrs.append(prefix) %} -{% endif %} -{% else %} -{% if lo_ipv4_addrs.append(prefix) %} +{% if name == 'Loopback0' %} +{% if prefix | ipv6 %} +{% if lo_ipv6_addrs.append(prefix) %} +{% endif %} +{% else %} +{% if lo_ipv4_addrs.append(prefix) %} +{% endif %} {% endif %} {% endif %} {% endfor %} diff --git a/dockers/docker-orchagent/ipinip.json.j2 b/dockers/docker-orchagent/ipinip.json.j2 index bee97f45b8ae..36fccddc237a 100644 --- a/dockers/docker-orchagent/ipinip.json.j2 +++ b/dockers/docker-orchagent/ipinip.json.j2 @@ -1,7 +1,7 @@ {# only IPv4 decapsulation is supported #} {% set ipv4_loopback_addresses = [] %} {% for (name, prefix) in LOOPBACK_INTERFACE %} - {%- if prefix | ipv4 %} + {%- if prefix | ipv4 and name == 'Loopback0' %} {%- set ipv4_loopback_addresses = ipv4_loopback_addresses.append(prefix) %} {%- endif %} {% endfor %} diff --git a/src/sonic-config-engine/tests/sample_output/bgpd.conf b/src/sonic-config-engine/tests/sample_output/bgpd.conf new file mode 100644 index 000000000000..4416b4628569 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/bgpd.conf @@ -0,0 +1,91 @@ +! +! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== +! generated by templates/quagga/bgpd.conf.j2 with config DB data +! file: bgpd.conf +! +! +hostname switch-t0 +password zebra +log syslog informational +log facility local4 +! enable password ! +! +! bgp multiple-instance +! +route-map FROM_BGP_SPEAKER_V4 permit 10 +! +route-map TO_BGP_SPEAKER_V4 deny 10 +! +router bgp 65100 + bgp log-neighbor-changes + bgp bestpath as-path multipath-relax + no bgp default ipv4-unicast + bgp graceful-restart + bgp router-id 10.1.0.32 + network 10.1.0.32/32 + address-family ipv6 + network fc00:1::32/64 + exit-address-family + network 192.168.0.1/27 + neighbor 10.0.0.57 remote-as 64600 + neighbor 10.0.0.57 description ARISTA01T1 + address-family ipv4 + neighbor 10.0.0.57 allowas-in 1 + neighbor 10.0.0.57 activate + maximum-paths 64 + exit-address-family + neighbor 10.0.0.59 remote-as 64600 + neighbor 10.0.0.59 description ARISTA02T1 + address-family ipv4 + neighbor 10.0.0.59 allowas-in 1 + neighbor 10.0.0.59 activate + maximum-paths 64 + exit-address-family + neighbor 10.0.0.61 remote-as 64600 + neighbor 10.0.0.61 description ARISTA03T1 + address-family ipv4 + neighbor 10.0.0.61 allowas-in 1 + neighbor 10.0.0.61 activate + maximum-paths 64 + exit-address-family + neighbor 10.0.0.63 remote-as 64600 + neighbor 10.0.0.63 description ARISTA04T1 + address-family ipv4 + neighbor 10.0.0.63 allowas-in 1 + neighbor 10.0.0.63 activate + maximum-paths 64 + exit-address-family + neighbor fc00::7a remote-as 64600 + neighbor fc00::7a description ARISTA03T1 + address-family ipv6 + neighbor fc00::7a allowas-in 1 + neighbor fc00::7a activate + maximum-paths 64 + exit-address-family + neighbor fc00::7e remote-as 64600 + neighbor fc00::7e description ARISTA04T1 + address-family ipv6 + neighbor fc00::7e allowas-in 1 + neighbor fc00::7e activate + maximum-paths 64 + exit-address-family + neighbor fc00::72 remote-as 64600 + neighbor fc00::72 description ARISTA01T1 + address-family ipv6 + neighbor fc00::72 allowas-in 1 + neighbor fc00::72 activate + maximum-paths 64 + exit-address-family + neighbor fc00::76 remote-as 64600 + neighbor fc00::76 description ARISTA02T1 + address-family ipv6 + neighbor fc00::76 allowas-in 1 + neighbor fc00::76 activate + maximum-paths 64 + exit-address-family +! +maximum-paths 64 +! +route-map ISOLATE permit 10 +set as-path prepend 65100 +! diff --git a/src/sonic-config-engine/tests/sample_output/interfaces b/src/sonic-config-engine/tests/sample_output/interfaces index c8da2fee8f76..96dc577ffe8b 100644 --- a/src/sonic-config-engine/tests/sample_output/interfaces +++ b/src/sonic-config-engine/tests/sample_output/interfaces @@ -15,6 +15,10 @@ iface lo inet6 static address fc00:1::32 netmask 128 # +iface lo inet static + address 10.10.0.99 + netmask 255.255.255.255 +# # The management network interface auto eth0 iface eth0 inet static diff --git a/src/sonic-config-engine/tests/sample_output/zebra.conf b/src/sonic-config-engine/tests/sample_output/zebra.conf new file mode 100644 index 000000000000..aa3486b0163a --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/zebra.conf @@ -0,0 +1,44 @@ +! +! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== +! generated by templates/quagga/zebra.conf.j2 using config DB data +! file: zebra.conf +! +! +hostname switch-t0 +password zebra +enable password zebra +! +! Enable link-detect (default disabled) +interface PortChannel01 +link-detect +! +interface PortChannel02 +link-detect +! +interface PortChannel03 +link-detect +! +interface PortChannel04 +link-detect +! +! +! set static default route to mgmt gateway as a backup to learned default +ip route 0.0.0.0/0 10.0.0.1 200 +! +! Set ip source to loopback for bgp learned routes +route-map RM_SET_SRC permit 10 + set src 10.1.0.32 +! + +route-map RM_SET_SRC6 permit 10 + set src fc00:1::32 +! +ip protocol bgp route-map RM_SET_SRC +! +ipv6 protocol bgp route-map RM_SET_SRC6 +! +! +log syslog informational +log facility local4 +! + diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index bda5517771e5..ce0177d4c158 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -153,7 +153,15 @@ FC00:1::32/128 - + + LoopbackIP1 + Loopback1 + + 10.10.0.99/32 + + 10.10.0.99/32 + + HostIP diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 8ff974c1eb10..bda3a20dbdfb 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -20,6 +20,9 @@ def setUp(self): def run_script(self, argument): print 'CMD: sonic-cfggen ' + argument return subprocess.check_output(self.script_file + ' ' + argument, shell=True) + + def run_diff(self, file1, file2, diff): + return subprocess.check_output('diff {} {} >{}'.format(file1, file2, diff), shell=True) def test_interfaces(self): interfaces_template = os.path.join(self.test_dir, '..', '..', '..', 'files', 'image_config', 'interfaces', 'interfaces.j2') @@ -59,6 +62,18 @@ def test_lldp(self): self.run_script(argument) self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'lldpd.conf'), self.output_file)) + def test_bgpd(self): + conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-fpm-quagga', 'bgpd.conf.j2') + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + conf_template + ' > ' + self.output_file + self.run_script(argument) + self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'bgpd.conf'), self.output_file)) + + def test_zebra(self): + conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-fpm-quagga', 'zebra.conf.j2') + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + conf_template + ' > ' + self.output_file + self.run_script(argument) + self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'zebra.conf'), self.output_file)) + def test_teamd(self): def test_render_teamd(self, pc, minigraph, sample_output): @@ -94,7 +109,6 @@ def test_ipinip(self): self.run_script(argument) sample_output_file = os.path.join(self.test_dir, 'sample_output', 'ipinip.json') - assert filecmp.cmp(sample_output_file, self.output_file) def test_msn27xx_32ports_buffers(self): From e082cd6d91a85865aa863424518c197789ca551c Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 1 May 2018 21:58:33 -0700 Subject: [PATCH 165/274] [swss]: Change the hash seed to 0 for ToR and 10 for Leaf routers (#1667) Due to some ASIC platform limitations, the hash seed range is from 0 to 15. Thus the switch.json.j2 template is updated so that ToRRouter is using hash seed 0 and LeafRouter is using hash seed 10. Signed-off-by: Shu0T1an ChenG --- dockers/docker-orchagent/switch.json.j2 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dockers/docker-orchagent/switch.json.j2 b/dockers/docker-orchagent/switch.json.j2 index 7a8c3522ecee..7aaada1b1e40 100644 --- a/dockers/docker-orchagent/switch.json.j2 +++ b/dockers/docker-orchagent/switch.json.j2 @@ -1,10 +1,11 @@ +{# the range of hash_seed is 0-15 #} {# set default hash seed to 0 #} {% set hash_seed = 0 %} {% if DEVICE_METADATA.localhost.type %} {% if DEVICE_METADATA.localhost.type == "ToRRouter" %} -{% set hash_seed = 10 %} +{% set hash_seed = 0 %} {% elif DEVICE_METADATA.localhost.type == "LeafRouter" %} -{% set hash_seed = 20 %} +{% set hash_seed = 10 %} {% endif %} {% endif %} [ From 74e8beaa12f0d252b9fbca8f931a0c45ed0c5aee Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 1 May 2018 22:41:58 -0700 Subject: [PATCH 166/274] [snmp]: Stop spamming logs with statfs permission denied log message (#1668) --- src/snmpd/Makefile | 1 + src/snmpd/statfs_error.patch | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/snmpd/statfs_error.patch diff --git a/src/snmpd/Makefile b/src/snmpd/Makefile index 457cd2ef05da..b372f0d22458 100644 --- a/src/snmpd/Makefile +++ b/src/snmpd/Makefile @@ -23,6 +23,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : dpkg-source -x net-snmp_$(SNMPD_VERSION_FULL).dsc pushd net-snmp-$(SNMPD_VERSION) + patch -p0 < ../statfs_error.patch fakeroot debian/rules -j$(SONIC_CONFIG_MAKE_JOBS) binary popd diff --git a/src/snmpd/statfs_error.patch b/src/snmpd/statfs_error.patch new file mode 100644 index 000000000000..a07b59bc9175 --- /dev/null +++ b/src/snmpd/statfs_error.patch @@ -0,0 +1,22 @@ +--- agent/mibgroup/hardware/fsys/fsys_mntctl.c.old 2018-04-30 23:26:58.097636453 +0000 ++++ agent/mibgroup/hardware/fsys/fsys_mntctl.c 2018-04-30 23:27:36.189499479 +0000 +@@ -163,8 +163,6 @@ + continue; + + if ( statfs( entry->path, &stat_buf ) < 0 ) { +- snprintf( tmpbuf, sizeof(tmpbuf), "Cannot statfs %s", entry->path ); +- snmp_log_perror( tmpbuf ); + continue; + } + entry->units = stat_buf.f_bsize; +--- agent/mibgroup/hardware/fsys/fsys_mntent.c.old 2018-04-30 23:26:54.569649140 +0000 ++++ agent/mibgroup/hardware/fsys/fsys_mntent.c 2018-04-30 23:27:22.001550497 +0000 +@@ -238,8 +238,6 @@ + if ( NSFS_STATFS( entry->path, &stat_buf ) < 0 ) + #endif + { +- snprintf( tmpbuf, sizeof(tmpbuf), "Cannot statfs %s", entry->path ); +- snmp_log_perror( tmpbuf ); + continue; + } + entry->units = stat_buf.NSFS_SIZE; From 9a237701730d2a727218db6c1355ae6e9f193c32 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 2 May 2018 02:36:12 -0700 Subject: [PATCH 167/274] [broadcom]: update broadcom SAI to 3.1.3.4-11 (#1670) Provide better ECMP load-balancing via hash seed Signed-off-by: Guohan Lu --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 5120b1518f6e..572ad5271f10 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.4-10_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-10_amd64.deb?sv=2015-04-05&sr=b&sig=72n19AElVmbqo3ahrEFVBwMgR%2FoQ7fhUj4tcadx8pVE%3D&se=2031-12-20T20%3A27%3A14Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.4-11_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-11_amd64.deb?sv=2015-04-05&sr=b&sig=0pctCvAKfSqT8O%2FWSMxw532XAXFsxXdKljQqWfOX8xA%3D&se=2155-03-25T07%3A23%3A41Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-10_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-11_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-10_amd64.deb?sv=2015-04-05&sr=b&sig=cN4qsWX8XW04ZObBDonwh5Uzgmp5A0iRBkpZA9N5Zb8%3D&se=2031-12-20T20%3A26%3A45Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-11_amd64.deb?sv=2015-04-05&sr=b&sig=IO1g%2FdcObkureizN8ZMPqISP6opZXu%2FrHostog6aIrU%3D&se=2155-03-25T08%3A13%3A34Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From 832be7b8f4c37c3f41e022e62746fea24ab790d0 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 2 May 2018 11:46:21 -0700 Subject: [PATCH 168/274] [dockers] Prevent apt-get from installing suggested and recommended packages by default (#1666) * [docker-base] Instruct apt-get to NOT install 'recommended' or 'suggested' packages * Modify docker-fpm-quagga, docker-snmp-sv2 and docker-sonic-vs Dockerfile templates in order to properly install .deb dependencies * REDIS_SERVER depends on REDIS_TOOLS; ensure REDIS_TOOLS is always installed before REDIS_SERVER --- dockers/docker-base/Dockerfile.j2 | 3 +- .../docker-base/no_install_recommend_suggest | 5 ++ dockers/docker-database/Dockerfile.j2 | 46 +++++----- dockers/docker-fpm-quagga/Dockerfile.j2 | 31 ++++--- dockers/docker-snmp-sv2/Dockerfile.j2 | 84 +++++++++++-------- platform/p4/docker-sonic-p4.mk | 2 +- platform/vs/docker-sonic-vs.mk | 2 +- platform/vs/docker-sonic-vs/Dockerfile.j2 | 25 +++--- rules/docker-database.mk | 2 +- rules/docker-snmp-sv2.mk | 2 +- 10 files changed, 114 insertions(+), 88 deletions(-) create mode 100644 dockers/docker-base/no_install_recommend_suggest diff --git a/dockers/docker-base/Dockerfile.j2 b/dockers/docker-base/Dockerfile.j2 index ff52cf88e7d3..db693540fb32 100644 --- a/dockers/docker-base/Dockerfile.j2 +++ b/dockers/docker-base/Dockerfile.j2 @@ -18,8 +18,9 @@ RUN rm -rf \ ENV DEBIAN_FRONTEND=noninteractive # Configure data sources for apt/dpkg -COPY ["sources.list", "/etc/apt/sources.list"] COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"] +COPY ["sources.list", "/etc/apt/sources.list"] +COPY ["no_install_recommend_suggest", "/etc/apt/apt.conf.d"] RUN apt-get update # Pre-install fundamental packages diff --git a/dockers/docker-base/no_install_recommend_suggest b/dockers/docker-base/no_install_recommend_suggest new file mode 100644 index 000000000000..b5bca577de1e --- /dev/null +++ b/dockers/docker-base/no_install_recommend_suggest @@ -0,0 +1,5 @@ +# Instruct apt-get to NOT install "recommended" or "suggested" packages by +# default when installing a package. + +APT::Install-Recommends "false"; +APT::Install-Suggests "false"; diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index 7fb3401184f2..4690e1587c14 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -1,34 +1,34 @@ FROM docker-config-engine -## Make apt-get non-interactive +# Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive +# Update apt's cache of available packages RUN apt-get update -COPY \ -{% for deb in docker_database_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor -%} -debs/ - -## Install redis-tools dependencies -## TODO: implicitly install dependencies -RUN apt-get -y install libjemalloc1 - -RUN dpkg -i \ -{% for deb in docker_database_debs.split(' ') -%} -debs/{{ deb }}{{' '}} +{% if docker_database_debs.strip() -%} +# Copy locally-built Debian package dependencies +{%- for deb in docker_database_debs.split(' ') %} +COPY debs/{{ deb }} /debs/ {%- endfor %} -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs - -RUN sed -ri 's/^(save .*$)/# \1/g; \ - s/^daemonize yes$/daemonize no/; \ - s/^logfile .*$/logfile ""/; \ - s/^# syslog-enabled no$/syslog-enabled no/; \ - s/^# unixsocket/unixsocket/; \ +# Install locally-built Debian packages and implicitly install their dependencies +{%- for deb in docker_database_debs.split(' ') %} +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/{{ deb }} +{%- endfor %} +{%- endif %} + +# Clean up +RUN apt-get clean -y +RUN apt-get autoclean -y +RUN apt-get autoremove -y +RUN rm -rf /debs ~/.cache + +RUN sed -ri 's/^(save .*$)/# \1/g; \ + s/^daemonize yes$/daemonize no/; \ + s/^logfile .*$/logfile ""/; \ + s/^# syslog-enabled no$/syslog-enabled no/; \ + s/^# unixsocket/unixsocket/; \ s/^client-output-buffer-limit pubsub [0-9]+mb [0-9]+mb [0-9]+/client-output-buffer-limit pubsub 0 0 0/ \ ' /etc/redis/redis.conf diff --git a/dockers/docker-fpm-quagga/Dockerfile.j2 b/dockers/docker-fpm-quagga/Dockerfile.j2 index c10cf0fd71d9..8836459e4e93 100644 --- a/dockers/docker-fpm-quagga/Dockerfile.j2 +++ b/dockers/docker-fpm-quagga/Dockerfile.j2 @@ -1,26 +1,31 @@ FROM docker-config-engine -## Make apt-get non-interactive +# Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive +# Update apt's cache of available packages RUN apt-get update -RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 +# Install required packages +RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 -COPY \ -{% for deb in docker_fpm_quagga_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor -%} -debs/ +{% if docker_fpm_quagga_debs.strip() -%} +# Copy locally-built Debian package dependencies +{%- for deb in docker_fpm_quagga_debs.split(' ') %} +COPY debs/{{ deb }} /debs/ +{%- endfor %} -RUN dpkg -i \ -{% for deb in docker_fpm_quagga_debs.split(' ') -%} -debs/{{ deb }}{{' '}} +# Install locally-built Debian packages and implicitly install their dependencies +{%- for deb in docker_fpm_quagga_debs.split(' ') %} +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/{{ deb }} {%- endfor %} +{%- endif %} -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs +# Clean up +RUN apt-get clean -y +RUN apt-get autoclean -y +RUN apt-get autoremove -y +RUN rm -rf /debs ~/.cache COPY ["bgpcfgd", "start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index da46cb9b1cfb..2605e9b50c2d 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -1,44 +1,56 @@ FROM docker-config-engine -COPY [ \ -{% for deb in docker_snmp_sv2_debs.split(' ') -%} - "debs/{{ deb }}", -{%- endfor %} \ - "/debs/"] - -# Install Python SwSSSDK (SNMP subagent dependency) -COPY python-wheels/sonic_platform_common-*-py3-*.whl /python-wheels/ -COPY python-wheels/swsssdk-*-py3-*.whl /python-wheels/ -COPY python-wheels/asyncsnmp-*-py3-*.whl /python-wheels/ - -# enable -O for all Python calls +# Enable -O for all Python calls ENV PYTHONOPTIMIZE 1 -## Make apt-get non-interactive +# Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -# install libsnmp30 dependencies -# install libpython3.6-dev dependencies -# install pip dependencies -# TODO: remove libpython3.6-dev, its and pip's dependencies if we can get pip3 directly -# install subagent -# clean up -RUN apt-get update && apt-get install -y libperl5.20 libpci3 libwrap0 \ - libexpat1-dev \ - curl gcc && \ - dpkg -i \ -{% for deb in docker_snmp_sv2_debs.split(' ') -%} - debs/{{ deb }}{{' '}} -{%- endfor %} && \ - rm -rf /debs && \ - curl https://bootstrap.pypa.io/get-pip.py | python3.6 && \ - python3.6 -m pip install --no-cache-dir /python-wheels/*py3*.whl hiredis && \ - rm -rf /python-wheels && \ - python3.6 -m sonic_ax_impl install && \ - apt-get -y purge libpython3.6-dev libexpat1-dev curl gcc && \ - apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y --purge && \ - find / | grep -E "__pycache__" | xargs rm -rf && \ - rm -rf ~/.cache +# Update apt's cache of available packages +RUN apt-get update + +# Install curl so we can download and install pip later +# Also install major root CA certificates for curl to reference +RUN apt-get install -y curl ca-certificates + +# Install gcc which is required for installing hiredis +RUN apt-get install -y gcc + +{% if docker_snmp_sv2_debs.strip() -%} +# Copy locally-built Debian package dependencies +{%- for deb in docker_snmp_sv2_debs.split(' ') %} +COPY debs/{{ deb }} /debs/ +{%- endfor %} + +# Install locally-built Debian packages and implicitly install their dependencies +{%- for deb in docker_snmp_sv2_debs.split(' ') %} +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/{{ deb }} +{%- endfor %} +{%- endif %} + +# Install up-to-date version of pip +RUN curl https://bootstrap.pypa.io/get-pip.py | python3.6 +RUN python3.6 -m pip install --no-cache-dir hiredis + +{% if docker_snmp_sv2_whls.strip() -%} +# Copy locally-built Python wheel dependencies +{%- for whl in docker_snmp_sv2_whls.split(' ') %} +COPY python-wheels/{{ whl }} /python-wheels/ +{%- endfor %} + +# Install locally-built Python wheel dependencies +{%- for whl in docker_snmp_sv2_whls.split(' ') %} +RUN pip install /python-wheels/{{ whl }} +{%- endfor %} +{% endif %} + +RUN python3.6 -m sonic_ax_impl install + +# Clean up +RUN apt-get -y purge libpython3.6-dev curl gcc +RUN apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y --purge +RUN find / | grep -E "__pycache__" | xargs rm -rf +RUN rm -rf /debs /python-wheels ~/.cache COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] @@ -46,7 +58,7 @@ COPY ["*.j2", "/usr/share/sonic/templates/"] COPY ["snmpd-config-updater", "/usr/bin/snmpd-config-updater"] RUN chmod +x /usr/bin/snmpd-config-updater -## Although exposing ports is not needed for host net mode, keep it for possible bridge mode +# Although exposing ports is not needed for host net mode, keep it for possible bridge mode EXPOSE 161/udp 162/udp ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/platform/p4/docker-sonic-p4.mk b/platform/p4/docker-sonic-p4.mk index 1cd15439fb77..534d161631f5 100644 --- a/platform/p4/docker-sonic-p4.mk +++ b/platform/p4/docker-sonic-p4.mk @@ -5,8 +5,8 @@ $(DOCKER_SONIC_P4)_PATH = $(PLATFORM_PATH)/docker-sonic-p4 $(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) \ $(SYNCD) \ $(P4_SWITCH) \ - $(REDIS_SERVER) \ $(REDIS_TOOLS) \ + $(REDIS_SERVER) \ $(PYTHON_SWSSCOMMON) \ $(LIBTEAMDCT) \ $(LIBTEAM_UTILS) \ diff --git a/platform/vs/docker-sonic-vs.mk b/platform/vs/docker-sonic-vs.mk index 656c53644637..ce0f4f3dea09 100644 --- a/platform/vs/docker-sonic-vs.mk +++ b/platform/vs/docker-sonic-vs.mk @@ -4,8 +4,8 @@ DOCKER_SONIC_VS = docker-sonic-vs.gz $(DOCKER_SONIC_VS)_PATH = $(PLATFORM_PATH)/docker-sonic-vs $(DOCKER_SONIC_VS)_DEPENDS += $(SWSS) \ $(SYNCD_VS) \ - $(REDIS_SERVER) \ $(REDIS_TOOLS) \ + $(REDIS_SERVER) \ $(PYTHON_SWSSCOMMON) \ $(LIBTEAMDCT) \ $(LIBTEAM_UTILS) \ diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index 7599059164cb..0c242bb373ef 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -43,20 +43,23 @@ RUN apt-get install -y net-tools \ RUN pip install setuptools RUN pip install py2_ipaddress -COPY \ -{% for deb in docker_sonic_vs_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor -%} -debs/ +{% if docker_sonic_vs_debs.strip() -%} +# Copy locally-built Debian package dependencies +{%- for deb in docker_sonic_vs_debs.split(' ') %} +COPY debs/{{ deb }} /debs/ +{%- endfor %} -RUN dpkg -i \ -{% for deb in docker_sonic_vs_debs.split(' ') -%} -debs/{{ deb }}{{' '}} +# Install locally-built Debian packages and implicitly install their dependencies +{%- for deb in docker_sonic_vs_debs.split(' ') %} +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/{{ deb }} {%- endfor %} +{%- endif %} -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs +# Clean up +RUN apt-get clean -y +RUN apt-get autoclean -y +RUN apt-get autoremove -y +RUN rm -rf /debs ~/.cache RUN sed -ri 's/^(save .*$)/# \1/g; \ s/^daemonize yes$/daemonize no/; \ diff --git a/rules/docker-database.mk b/rules/docker-database.mk index ef77047e8431..7625f8b37ab6 100644 --- a/rules/docker-database.mk +++ b/rules/docker-database.mk @@ -2,7 +2,7 @@ DOCKER_DATABASE = docker-database.gz $(DOCKER_DATABASE)_PATH = $(DOCKERS_PATH)/docker-database -$(DOCKER_DATABASE)_DEPENDS += $(REDIS_SERVER) $(REDIS_TOOLS) +$(DOCKER_DATABASE)_DEPENDS += $(REDIS_TOOLS) $(REDIS_SERVER) $(DOCKER_DATABASE)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_DATABASE) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DATABASE) diff --git a/rules/docker-snmp-sv2.mk b/rules/docker-snmp-sv2.mk index dc5bc1cc702a..f0e354b9ed59 100644 --- a/rules/docker-snmp-sv2.mk +++ b/rules/docker-snmp-sv2.mk @@ -4,7 +4,7 @@ DOCKER_SNMP_SV2 = docker-snmp-sv2.gz $(DOCKER_SNMP_SV2)_PATH = $(DOCKERS_PATH)/docker-snmp-sv2 ## TODO: remove LIBPY3_DEV if we can get pip3 directly $(DOCKER_SNMP_SV2)_DEPENDS += $(SNMP) $(SNMPD) $(PY3) $(LIBPY3_DEV) -$(DOCKER_SNMP_SV2)_PYTHON_WHEELS += $(ASYNCSNMP_PY3) +$(DOCKER_SNMP_SV2)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY3) $(SWSSSDK_PY3) $(ASYNCSNMP_PY3) $(DOCKER_SNMP_SV2)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SNMP_SV2) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SNMP_SV2) From 0c9e8eee65a377a2e7fbc521dc34b7d34aa3dd5a Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 2 May 2018 14:17:04 -0700 Subject: [PATCH 169/274] Revert "Fix the sonic build issue" (#1671) * Revert "[docker-dhcp]: Fix the sonic build issue (#1659)" This reverts commit 8d3c5fbcc21e72d38827c742f208a9984456be2d. --- rules/docker-dhcp-relay.mk | 2 +- rules/isc-dhcp.mk | 6 +----- src/isc-dhcp/Makefile | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index 53406ad1e15f..44d3904d7394 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -2,7 +2,7 @@ DOCKER_DHCP_RELAY = docker-dhcp-relay.gz $(DOCKER_DHCP_RELAY)_PATH = $(DOCKERS_PATH)/docker-dhcp-relay -$(DOCKER_DHCP_RELAY)_DEPENDS += $(ISC_DHCP_COMMON) $(ISC_DHCP_RELAY) $(ISC_DHCP_CLIENT) +$(DOCKER_DHCP_RELAY)_DEPENDS += $(ISC_DHCP_COMMON) $(ISC_DHCP_RELAY) $(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) diff --git a/rules/isc-dhcp.mk b/rules/isc-dhcp.mk index 37c775da017a..7b7f69c6cfc6 100644 --- a/rules/isc-dhcp.mk +++ b/rules/isc-dhcp.mk @@ -8,9 +8,5 @@ ISC_DHCP_COMMON = isc-dhcp-common_$(ISC_DHCP_VERSION)_amd64.deb $(ISC_DHCP_COMMON)_SRC_PATH = $(SRC_PATH)/isc-dhcp SONIC_MAKE_DEBS += $(ISC_DHCP_COMMON) -ISC_DHCP_CLIENT = isc-dhcp-client_$(ISC_DHCP_VERSION)_amd64.deb -$(ISC_DHCP_CLIENT)_SRC_PATH = $(SRC_PATH)/isc-dhcp -SONIC_MAKE_DEBS += $(ISC_DHCP_CLIENT) - ISC_DHCP_RELAY = isc-dhcp-relay_$(ISC_DHCP_VERSION)_amd64.deb -$(eval $(call add_derived_package,$(ISC_DHCP_COMMON),$(ISC_DHCP_RELAY),$(ISC_DHCP_CLIENT))) +$(eval $(call add_derived_package,$(ISC_DHCP_COMMON),$(ISC_DHCP_RELAY))) diff --git a/src/isc-dhcp/Makefile b/src/isc-dhcp/Makefile index b439ec7c1ee6..5b1cb8407005 100644 --- a/src/isc-dhcp/Makefile +++ b/src/isc-dhcp/Makefile @@ -3,8 +3,7 @@ SHELL = /bin/bash .SHELLFLAGS += -e MAIN_TARGET = isc-dhcp-common_$(ISC_DHCP_VERSION)_amd64.deb -DERIVED_TARGETS = isc-dhcp-relay_$(ISC_DHCP_VERSION)_amd64.deb \ - isc-dhcp-client_$(ISC_DHCP_VERSION)_amd64.deb +DERIVED_TARGETS = isc-dhcp-relay_$(ISC_DHCP_VERSION)_amd64.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Remove any stale files From e07687f156807b6ba97537615d7c70c9ffe378ec Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 3 May 2018 18:55:26 -0700 Subject: [PATCH 170/274] [sonic-platform-common] Update submodule (#1672) --- src/sonic-platform-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-platform-common b/src/sonic-platform-common index b553dba4ca82..9adb75feee6d 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit b553dba4ca82997dcc60a3b3a68111d7af8d62fc +Subproject commit 9adb75feee6de75bd2e9faf542ac5610edc3fa35 From 724aaf162c52e4209ad78128cdfd6f8b806d1acc Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Thu, 3 May 2018 22:26:50 -0700 Subject: [PATCH 171/274] [device] Update arista driver submodule (#1674) --- platform/broadcom/sonic-platform-modules-arista | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 86221d907f27..a35c7eddaf94 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 86221d907f27e7f6df40393a5bfe217bf22b19af +Subproject commit a35c7eddaf945a1ff09ea71b47f69b6ddba5e892 From f3f8b9ff57e227d7f39f5bed48a7c7c46822bb8c Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 4 May 2018 09:27:01 -0700 Subject: [PATCH 172/274] [syncd]: Add socat and bcmsh wrapper (#1657) * [syncd]: Add socat and bcmsh wrapper * Install socat in docker-base * Add hint banner, add host wrapper * Refine banner message --- dockers/docker-base/Dockerfile.j2 | 3 ++ .../broadcom/docker-syncd-brcm/Dockerfile.j2 | 2 +- .../docker-syncd-brcm/base_image_files/bcmsh | 3 ++ platform/broadcom/docker-syncd-brcm/bcmsh | 35 +++++++++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100755 platform/broadcom/docker-syncd-brcm/base_image_files/bcmsh create mode 100755 platform/broadcom/docker-syncd-brcm/bcmsh diff --git a/dockers/docker-base/Dockerfile.j2 b/dockers/docker-base/Dockerfile.j2 index db693540fb32..98f8237cee57 100644 --- a/dockers/docker-base/Dockerfile.j2 +++ b/dockers/docker-base/Dockerfile.j2 @@ -31,6 +31,9 @@ RUN apt-get -y install \ python \ less +# Pre-install troubleshooting packages +RUN apt-get -y install socat + COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"] COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"] COPY ["root/.vimrc", "/root/.vimrc"] diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index 96ae65ee8897..042e7e764fd1 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -19,7 +19,7 @@ debs/{{ deb }}{{' '}} ## TODO: add kmod into Depends RUN apt-get install -f kmod -COPY ["files/dsserve", "files/bcmcmd", "start.sh", "/usr/bin/"] +COPY ["files/dsserve", "files/bcmcmd", "start.sh", "bcmsh", "/usr/bin/"] RUN chmod +x /usr/bin/dsserve /usr/bin/bcmcmd COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] diff --git a/platform/broadcom/docker-syncd-brcm/base_image_files/bcmsh b/platform/broadcom/docker-syncd-brcm/base_image_files/bcmsh new file mode 100755 index 000000000000..c3a38742575d --- /dev/null +++ b/platform/broadcom/docker-syncd-brcm/base_image_files/bcmsh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker exec -i syncd bcmsh "$@" diff --git a/platform/broadcom/docker-syncd-brcm/bcmsh b/platform/broadcom/docker-syncd-brcm/bcmsh new file mode 100755 index 000000000000..7d2fa2f4d3c3 --- /dev/null +++ b/platform/broadcom/docker-syncd-brcm/bcmsh @@ -0,0 +1,35 @@ +#!/bin/bash +usage="$(basename "$0") [-h] [-q] -- interactive shell for bcm service + +where: + -h show this help text + -q quite, no banner (default: verbose)" + +banner="Press Enter to show prompt. +Press Ctrl+C to exit. +" + +# Default verbose +quiet=false + +while getopts 'hq' option; do + case "$option" in + h) echo "$usage" + exit + ;; + q) quiet=true + ;; + \?) printf "illegal option: -%s\n" "$OPTARG" >&2 + echo "$usage" >&2 + exit 1 + ;; + esac +done +shift $((OPTIND - 1)) + +if [ "$quiet" = false ]; then + echo "$banner" +fi + +/usr/bin/socat - UNIX-CONNECT:/var/run/sswsyncd/sswsyncd.socket + From c63b828bf6bbfff69abe0e636cc18f8129a4ced1 Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Mon, 7 May 2018 11:02:30 -0700 Subject: [PATCH 173/274] 40G profile for Arista 7060 (#1677) --- .../Arista-7060CX-32S-Q32/buffers.json.j2 | 2 + .../buffers_defaults_t0.j2 | 47 +++++ .../buffers_defaults_t1.j2 | 47 +++++ .../pg_profile_lookup.ini | 17 ++ .../Arista-7060CX-32S-Q32/port_config.ini | 33 ++++ .../Arista-7060CX-32S-Q32/qos.json | 167 ++++++++++++++++++ .../Arista-7060CX-32S-Q32/sai.profile.j2 | 13 ++ 7 files changed, 326 insertions(+) create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers.json.j2 create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t0.j2 create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t1.j2 create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/pg_profile_lookup.ini create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/port_config.ini create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/sai.profile.j2 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers.json.j2 new file mode 100644 index 000000000000..0b1cb2c541b6 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't1' %} +{%- include 'buffers_config.j2' %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..3e39d411e8bf --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t0.j2 @@ -0,0 +1,47 @@ + +{%- set default_cable = '5m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,128,4) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "11213696", + "type": "ingress", + "mode": "dynamic", + "xoff": "3855488" + }, + "egress_lossy_pool": { + "size": "9532224", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"1518", + "static_th":"3995680" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..d9f562f95624 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t1.j2 @@ -0,0 +1,47 @@ + +{%- set default_cable = '40m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,128,4) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "10443264", + "type": "ingress", + "mode": "dynamic", + "xoff": "4625920" + }, + "egress_lossy_pool": { + "size": "8877440", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"1518", + "static_th":"3995680" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/pg_profile_lookup.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/pg_profile_lookup.ini new file mode 100644 index 000000000000..3b2a417cebcd --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 1248 2288 35776 -4 2288 + 25000 5m 1248 2288 53248 -4 2288 + 40000 5m 1248 2288 66560 -4 2288 + 50000 5m 1248 2288 90272 -4 2288 + 100000 5m 1248 2288 165568 -4 2288 + 10000 40m 1248 2288 37024 -4 2288 + 25000 40m 1248 2288 53248 -4 2288 + 40000 40m 1248 2288 71552 -4 2288 + 50000 40m 1248 2288 96096 -4 2288 + 100000 40m 1248 2288 177632 -4 2288 + 10000 300m 1248 2288 46176 -4 2288 + 25000 300m 1248 2288 79040 -4 2288 + 40000 300m 1248 2288 108160 -4 2288 + 50000 300m 1248 2288 141856 -4 2288 + 100000 300m 1248 2288 268736 -4 2288 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/port_config.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/port_config.ini new file mode 100644 index 000000000000..bfe4a721141d --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias index +Ethernet0 33,34,35,36 Ethernet1/1 1 +Ethernet4 37,38,39,40 Ethernet2/1 2 +Ethernet8 41,42,43,44 Ethernet3/1 3 +Ethernet12 45,46,47,48 Ethernet4/1 4 +Ethernet16 49,50,51,52 Ethernet5/1 5 +Ethernet20 53,54,55,56 Ethernet6/1 6 +Ethernet24 57,58,59,60 Ethernet7/1 7 +Ethernet28 61,62,63,64 Ethernet8/1 8 +Ethernet32 65,66,67,68 Ethernet9/1 9 +Ethernet36 69,70,71,72 Ethernet10/1 10 +Ethernet40 73,74,75,76 Ethernet11/1 11 +Ethernet44 77,78,79,80 Ethernet12/1 12 +Ethernet48 81,82,83,84 Ethernet13/1 13 +Ethernet52 85,86,87,88 Ethernet14/1 14 +Ethernet56 89,90,91,92 Ethernet15/1 15 +Ethernet60 93,94,95,96 Ethernet16/1 16 +Ethernet64 97,98,99,100 Ethernet17/1 17 +Ethernet68 101,102,103,104 Ethernet18/1 18 +Ethernet72 105,106,107,108 Ethernet19/1 19 +Ethernet76 109,110,111,112 Ethernet20/1 20 +Ethernet80 113,114,115,116 Ethernet21/1 21 +Ethernet84 117,118,119,120 Ethernet22/1 22 +Ethernet88 121,122,123,124 Ethernet23/1 23 +Ethernet92 125,126,127,128 Ethernet24/1 24 +Ethernet96 1,2,3,4 Ethernet25/1 25 +Ethernet100 5,6,7,8 Ethernet26/1 26 +Ethernet104 9,10,11,12 Ethernet27/1 27 +Ethernet108 13,14,15,16 Ethernet28/1 28 +Ethernet112 17,18,19,20 Ethernet29/1 29 +Ethernet116 21,22,23,24 Ethernet30/1 30 +Ethernet120 25,26,27,28 Ethernet31/1 31 +Ethernet124 29,30,31,32 Ethernet32/1 32 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json new file mode 100644 index 000000000000..b724b48c2c23 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json @@ -0,0 +1,167 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"512000", + "red_min_threshold":"512000", + "yellow_max_threshold":"512000", + "yellow_min_threshold":"512000", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + }, + "AZURE_LOSSLESS" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"512000", + "red_min_threshold":"512000", + "yellow_max_threshold":"512000", + "yellow_min_threshold":"512000", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1" : { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { + "scheduler" : "[SCHEDULER|scheduler.0]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1" : { + "scheduler" : "[SCHEDULER|scheduler.2]" + } + } +} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/sai.profile.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/sai.profile.j2 new file mode 100644 index 000000000000..bef6932f1eac --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/sai.profile.j2 @@ -0,0 +1,13 @@ +{# Get sai.profile based on switch_role #} +{%- if DEVICE_METADATA is defined -%} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] -%} +{%- if switch_role.lower() == 'torrouter' %} +{% set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/etc/bcm/th-a7060-cx32s-32x40G.config.bcm' -%} +{%- else %} +{%- set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/etc/bcm/th-a7060-cx32s-32x40G-t1.config.bcm' -%} +{%- endif %} +{%- else %} +{%- set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/etc/bcm/th-a7060-cx32s-32x40G-t1.config.bcm' -%} +{%- endif %} +{# Write the contents of sai_ profile_filename to sai.profile file #} +{{ sai_profile_contents }} From 872f69a5662efc6cfc74097d88f586ffe677f52a Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Tue, 8 May 2018 18:37:35 +0300 Subject: [PATCH 174/274] Update buffers config for Mellanox 27xx devices (#1649) * Update buffers config for Mellanox 27xx devices Signed-off-by: Andriy Moroz * Remove buffers template test for msn27xx Signed-off-by: Andriy Moroz --- .../LS-SN2700/buffers.json.j2 | 163 +---------------- .../LS-SN2700/buffers_defaults_t0.j2 | 1 + .../LS-SN2700/buffers_defaults_t1.j2 | 1 + .../ACS-MSN2700/buffers.json.j2 | 164 +----------------- .../ACS-MSN2700/buffers_defaults_t0.j2 | 90 ++++++++++ .../ACS-MSN2700/buffers_defaults_t1.j2 | 90 ++++++++++ .../ACS-MSN2740/buffers.json.j2 | 163 +---------------- .../ACS-MSN2740/buffers_defaults_t0.j2 | 1 + .../ACS-MSN2740/buffers_defaults_t1.j2 | 1 + files/build_templates/buffers_config.j2 | 26 ++- src/sonic-config-engine/tests/test_j2files.py | 9 - 11 files changed, 209 insertions(+), 500 deletions(-) mode change 100644 => 120000 device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers_defaults_t0.j2 create mode 120000 device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers_defaults_t1.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers_defaults_t0.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers_defaults_t1.j2 diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers.json.j2 b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers.json.j2 deleted file mode 100644 index da9c764db92b..000000000000 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers.json.j2 +++ /dev/null @@ -1,162 +0,0 @@ -{# Default values which will be used if no actual configura available #} -{% set default_cable = '300m' %} -{% set default_ports_num = 32 -%} - -{# Port configuration to cable length look-up table #} -{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} -{# Roles described in the minigraph #} -{% set ports2cable = { - 'torrouter_server' : '5m', - 'leafrouter_torrouter' : '40m', - 'spinerouter_leafrouter' : '300m' - } -%} - -{%- macro cable_length(port_name) -%} - {%- set cable_len = [] -%} - {%- for local_port in DEVICE_NEIGHBOR -%} - {%- if local_port == port_name -%} - {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor_role = neighbor.type -%} - {%- set roles1 = switch_role + '_' + neighbor_role %} - {%- set roles2 = neighbor_role + '_' + switch_role -%} - {%- set roles1 = roles1 | lower -%} - {%- set roles2 = roles2 | lower -%} - {%- if roles1 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} - {%- elif roles2 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {%- if cable_len -%} - {{ cable_len.0 }} - {%- else -%} - {{ default_cable }} - {%- endif -%} -{% endmacro %} - -{%- if DEVICE_METADATA is defined %} -{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} -{%- endif -%} - -{# Generate list of ports if not defined #} -{% if PORT is not defined %} - {% set PORT = [] %} - {% for port_idx in range(0,default_ports_num) %} - {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} - {% endfor %} -{% endif -%} - -{% set port_names_list = [] %} -{% for port in PORT %} - {%- if port_names_list.append(port) %}{% endif %} -{% endfor %} -{% set port_names = port_names_list | join(',') -%} - -{ - "CABLE_LENGTH": { - "AZURE": { - {% for port in PORT %} - {% set cable = cable_length(port) -%} - "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} - - {% endfor %} - } - }, -{%if switch_role == 'ToRRouter' %} -{% set ingress_lossless_pool_size = '4194304' %} -{% set ingress_lossy_pool_size = '7340032' %} -{% set egress_lossless_pool_size = '16777152' %} -{% set egress_lossy_pool_size = '7340032' %} -{% else %} -{% set ingress_lossless_pool_size = '2097152' %} -{% set ingress_lossy_pool_size = '5242880' %} -{% set egress_lossless_pool_size = '16777152' %} -{% set egress_lossy_pool_size = '5242880' %} -{%endif %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "ingress_lossy_pool": { - "size": "{{ ingress_lossy_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", - "size":"0", - "dynamic_th":"0" - }, - "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"4096", - "dynamic_th":"3" - }, - "pg_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "q_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - } - }, - "BUFFER_PORT_INGRESS_PROFILE_LIST": { - "{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" - } - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { - "{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" - } - }, - "BUFFER_PG": { - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" - } - }, - "BUFFER_QUEUE": { - "{{ port_names }}|3-4": { - "profile" : "[BUFFER_PROFILE|q_lossless_profile]" - }, - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|q_lossy_profile]" - } - } -} diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers.json.j2 b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers.json.j2 new file mode 120000 index 000000000000..add8bf8bb7c2 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..7bcae62336f6 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..a437d613434d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 index da9c764db92b..1083a6210fc9 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 @@ -1,162 +1,2 @@ -{# Default values which will be used if no actual configura available #} -{% set default_cable = '300m' %} -{% set default_ports_num = 32 -%} - -{# Port configuration to cable length look-up table #} -{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} -{# Roles described in the minigraph #} -{% set ports2cable = { - 'torrouter_server' : '5m', - 'leafrouter_torrouter' : '40m', - 'spinerouter_leafrouter' : '300m' - } -%} - -{%- macro cable_length(port_name) -%} - {%- set cable_len = [] -%} - {%- for local_port in DEVICE_NEIGHBOR -%} - {%- if local_port == port_name -%} - {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor_role = neighbor.type -%} - {%- set roles1 = switch_role + '_' + neighbor_role %} - {%- set roles2 = neighbor_role + '_' + switch_role -%} - {%- set roles1 = roles1 | lower -%} - {%- set roles2 = roles2 | lower -%} - {%- if roles1 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} - {%- elif roles2 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {%- if cable_len -%} - {{ cable_len.0 }} - {%- else -%} - {{ default_cable }} - {%- endif -%} -{% endmacro %} - -{%- if DEVICE_METADATA is defined %} -{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} -{%- endif -%} - -{# Generate list of ports if not defined #} -{% if PORT is not defined %} - {% set PORT = [] %} - {% for port_idx in range(0,default_ports_num) %} - {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} - {% endfor %} -{% endif -%} - -{% set port_names_list = [] %} -{% for port in PORT %} - {%- if port_names_list.append(port) %}{% endif %} -{% endfor %} -{% set port_names = port_names_list | join(',') -%} - -{ - "CABLE_LENGTH": { - "AZURE": { - {% for port in PORT %} - {% set cable = cable_length(port) -%} - "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} - - {% endfor %} - } - }, -{%if switch_role == 'ToRRouter' %} -{% set ingress_lossless_pool_size = '4194304' %} -{% set ingress_lossy_pool_size = '7340032' %} -{% set egress_lossless_pool_size = '16777152' %} -{% set egress_lossy_pool_size = '7340032' %} -{% else %} -{% set ingress_lossless_pool_size = '2097152' %} -{% set ingress_lossy_pool_size = '5242880' %} -{% set egress_lossless_pool_size = '16777152' %} -{% set egress_lossy_pool_size = '5242880' %} -{%endif %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "ingress_lossy_pool": { - "size": "{{ ingress_lossy_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", - "size":"0", - "dynamic_th":"0" - }, - "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"4096", - "dynamic_th":"3" - }, - "pg_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "q_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - } - }, - "BUFFER_PORT_INGRESS_PROFILE_LIST": { - "{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" - } - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { - "{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" - } - }, - "BUFFER_PG": { - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" - } - }, - "BUFFER_QUEUE": { - "{{ port_names }}|3-4": { - "profile" : "[BUFFER_PROFILE|q_lossless_profile]" - }, - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|q_lossy_profile]" - } - } -} +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..475a0227143c --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 @@ -0,0 +1,90 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '4194304' %} +{% set ingress_lossy_pool_size = '7340032' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '7340032' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0, 32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_profile_lists(port_names) %} + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" + } + } +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } + } +{%- endmacro %} + + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..c292ecc2f21a --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 @@ -0,0 +1,90 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '2097152' %} +{% set ingress_lossy_pool_size = '5242880' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '5242880' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0, 32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_profile_lists(port_names) %} + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" + } + } +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } + } +{%- endmacro %} + + diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 deleted file mode 100644 index da9c764db92b..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 +++ /dev/null @@ -1,162 +0,0 @@ -{# Default values which will be used if no actual configura available #} -{% set default_cable = '300m' %} -{% set default_ports_num = 32 -%} - -{# Port configuration to cable length look-up table #} -{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} -{# Roles described in the minigraph #} -{% set ports2cable = { - 'torrouter_server' : '5m', - 'leafrouter_torrouter' : '40m', - 'spinerouter_leafrouter' : '300m' - } -%} - -{%- macro cable_length(port_name) -%} - {%- set cable_len = [] -%} - {%- for local_port in DEVICE_NEIGHBOR -%} - {%- if local_port == port_name -%} - {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor_role = neighbor.type -%} - {%- set roles1 = switch_role + '_' + neighbor_role %} - {%- set roles2 = neighbor_role + '_' + switch_role -%} - {%- set roles1 = roles1 | lower -%} - {%- set roles2 = roles2 | lower -%} - {%- if roles1 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} - {%- elif roles2 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {%- if cable_len -%} - {{ cable_len.0 }} - {%- else -%} - {{ default_cable }} - {%- endif -%} -{% endmacro %} - -{%- if DEVICE_METADATA is defined %} -{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} -{%- endif -%} - -{# Generate list of ports if not defined #} -{% if PORT is not defined %} - {% set PORT = [] %} - {% for port_idx in range(0,default_ports_num) %} - {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} - {% endfor %} -{% endif -%} - -{% set port_names_list = [] %} -{% for port in PORT %} - {%- if port_names_list.append(port) %}{% endif %} -{% endfor %} -{% set port_names = port_names_list | join(',') -%} - -{ - "CABLE_LENGTH": { - "AZURE": { - {% for port in PORT %} - {% set cable = cable_length(port) -%} - "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} - - {% endfor %} - } - }, -{%if switch_role == 'ToRRouter' %} -{% set ingress_lossless_pool_size = '4194304' %} -{% set ingress_lossy_pool_size = '7340032' %} -{% set egress_lossless_pool_size = '16777152' %} -{% set egress_lossy_pool_size = '7340032' %} -{% else %} -{% set ingress_lossless_pool_size = '2097152' %} -{% set ingress_lossy_pool_size = '5242880' %} -{% set egress_lossless_pool_size = '16777152' %} -{% set egress_lossy_pool_size = '5242880' %} -{%endif %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "ingress_lossy_pool": { - "size": "{{ ingress_lossy_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", - "size":"0", - "dynamic_th":"0" - }, - "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"4096", - "dynamic_th":"3" - }, - "pg_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "q_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - } - }, - "BUFFER_PORT_INGRESS_PROFILE_LIST": { - "{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" - } - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { - "{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" - } - }, - "BUFFER_PG": { - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" - } - }, - "BUFFER_QUEUE": { - "{{ port_names }}|3-4": { - "profile" : "[BUFFER_PROFILE|q_lossless_profile]" - }, - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|q_lossy_profile]" - } - } -} diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 new file mode 120000 index 000000000000..add8bf8bb7c2 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..7bcae62336f6 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..a437d613434d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index 6c55b257342e..20019d20afae 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -4,7 +4,7 @@ {%- else %} def {%- endif %} -{%- endmacro %} +{%- endmacro -%} {# Determine device topology and filename postfix #} {%- if DEVICE_METADATA is defined %} @@ -19,12 +19,12 @@ def {%- else %} {%- set filename_postfix = set_default_topology() %} {%- set switch_role = '' %} -{%- endif %} +{%- endif -%} {# Import default values from device HWSKU folder #} {%- import 'buffers_defaults_%s.j2' % filename_postfix as defs %} -{%- set default_cable = defs.default_cable %} +{%- set default_cable = defs.default_cable -%} {# Port configuration to cable length look-up table #} {# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} @@ -106,13 +106,28 @@ def {% endfor %} } }, -{% set bufs = defs.generate_buffer_pool_and_profiles() %} -{{ bufs }} + +{% if defs.generate_buffer_pool_and_profiles is defined %} +{{ defs.generate_buffer_pool_and_profiles() }} +{% endif %} + +{%- if defs.generate_profile_lists is defined %} +{{ defs.generate_profile_lists(port_names_all) }}, +{% endif %} + +{%- if defs.generate_pg_profils is defined %} +{{ defs.generate_pg_profils }}, +{% else %} "BUFFER_PG": { "{{ port_names_all }}|0-1": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" } }, +{% endif %} + +{% if defs.generate_queue_buffers is defined %} +{{ defs.generate_queue_buffers(port_names_all) }} +{% else %} "BUFFER_QUEUE": { "{{ port_names_all }}|3-4": { "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" @@ -121,4 +136,5 @@ def "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" } } +{% endif %} } diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index bda3a20dbdfb..aba7feb194ad 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -111,15 +111,6 @@ def test_ipinip(self): sample_output_file = os.path.join(self.test_dir, 'sample_output', 'ipinip.json') assert filecmp.cmp(sample_output_file, self.output_file) - def test_msn27xx_32ports_buffers(self): - buffer_file = os.path.join(self.test_dir, '..', '..', '..', 'device', 'mellanox', 'x86_64-mlnx_msn2700-r0', 'ACS-MSN2700', 'buffers.json.j2') - argument = '-m ' + self.t1_mlnx_minigraph + ' -p ' + self.mlnx_port_config + ' -t ' + buffer_file + ' > ' + self.output_file - self.run_script(argument) - - sample_output_file = os.path.join(self.test_dir, 'sample_output', 'msn27.32ports.json') - - self.assertTrue(filecmp.cmp(sample_output_file, self.output_file)) - def test_sku_render_template(self): argument = '-k Mellanox-SN2700 -t ' + os.path.join(self.test_dir, '../data/l2switch.j2') + ' -p ' + self.t0_port_config + ' > ' + self.output_file self.run_script(argument) From d62c6ffef97bce7c6c54e6b40adf8999b54c4b7a Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Wed, 9 May 2018 00:45:36 +0300 Subject: [PATCH 175/274] [mellanox]: Update MLNX SAI pointer (#1683) Signed-off-by: Volodymyr Samotiy --- platform/mellanox/mlnx-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 9432b596428c..53e74021bb84 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = SAIRel1.11.5-master -MLNX_SAI_REVISION = 15f8f0f0a3d5e33e62a404bae829f1d6b378b0f7 +MLNX_SAI_REVISION = 957f61820e441e490081cb3724f702ed507f7477 export MLNX_SAI_VERSION MLNX_SAI_REVISION From 32dc2cd2b433cbc77ec67e4c259fd70869363619 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 9 May 2018 17:49:21 -0700 Subject: [PATCH 176/274] [utilities]: Update sonic-utilities submodule (#1687) [acl-loader]: Change the header from Rule ID to Table (#250) [acl-loader]: Add --table_name option to update full operation (#249) [generate_dump]: fix a saidump file copy bug (#248) Signed-off-by: Shu0T1an ChenG --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index b69837c009c9..e2a3228843be 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit b69837c009c9167651a59ee9bd90c3938b4d06b2 +Subproject commit e2a3228843bec8280c965b847f5c168f4d96d231 From 685282da9dcbec2fd2d7bc1e505bc37f0a4bb0c8 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 9 May 2018 19:18:35 -0700 Subject: [PATCH 177/274] [submodule]: Update submodule sonic-snmpagent: Improve mib fundamental classes (#1689) Signed-off-by: Qi Luo --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index a03f7794d6b2..b6bf4a77e07a 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit a03f7794d6b2faec23088ba064cb6ce7e7d2122a +Subproject commit b6bf4a77e07a1d70d750aad69125532df33276dc From 1102acec4835d0e9f89ff42bf5a7578e427ab88a Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 10 May 2018 01:20:22 -0700 Subject: [PATCH 178/274] [ledd] Exit with code 0 if we fail to find a platform-specific led_control module; no autorestart (#1688) --- dockers/docker-platform-monitor/supervisord.conf | 1 + src/sonic-platform-daemons | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dockers/docker-platform-monitor/supervisord.conf b/dockers/docker-platform-monitor/supervisord.conf index 0a05e61efff1..13790d70f614 100644 --- a/dockers/docker-platform-monitor/supervisord.conf +++ b/dockers/docker-platform-monitor/supervisord.conf @@ -41,6 +41,7 @@ stderr_logfile=syslog command=/usr/bin/ledd priority=5 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog startsecs=0 diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index c940a7d18ecd..6d35814d9841 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit c940a7d18ecd4dc22bbaf2aee6908045cbe24508 +Subproject commit 6d35814d9841f34effa99fe053a5156602e106f4 From d7cd056ff4b36b7a88b58d7385c0789d5c984d61 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Thu, 10 May 2018 16:22:03 +0800 Subject: [PATCH 179/274] [minigraph parser] Fix minigraph parser issue when handling LAG related ACL table configuration (#1609) * Fix minigraph parser issue when handling LAG related ACL table configuration Changes to be committed: modified: src/sonic-config-engine/minigraph.py modified: src/sonic-config-engine/tests/test_cfggen.py signed-off-by kebol@mellanox.com --- src/sonic-config-engine/minigraph.py | 20 +++++++++++++++++--- src/sonic-config-engine/tests/test_cfggen.py | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 443893c66c25..4b6b185d854d 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -149,12 +149,15 @@ def parse_dpg(dpg, hname): pcintfs = child.find(str(QName(ns, "PortChannelInterfaces"))) pc_intfs = [] pcs = {} + intfs_inpc = [] # List to hold all the LAG member interfaces for pcintf in pcintfs.findall(str(QName(ns, "PortChannel"))): pcintfname = pcintf.find(str(QName(ns, "Name"))).text pcintfmbr = pcintf.find(str(QName(ns, "AttachTo"))).text pcmbr_list = pcintfmbr.split(';') + pc_intfs.append(pcintfname) for i, member in enumerate(pcmbr_list): pcmbr_list[i] = port_alias_map.get(member, member) + intfs_inpc.append(pcmbr_list[i]) if pcintf.find(str(QName(ns, "Fallback"))) != None: pcs[pcintfname] = {'members': pcmbr_list, 'fallback': pcintf.find(str(QName(ns, "Fallback"))).text} else: @@ -202,15 +205,26 @@ def parse_dpg(dpg, hname): for member in aclattach: member = member.strip() if pcs.has_key(member): - acl_intfs.extend(pcs[member]['members']) # For ACL attaching to port channels, we break them into port channel members + # If try to attach ACL to a LAG interface then we shall add the LAG to + # to acl_intfs directly instead of break it into member ports, ACL attach + # to LAG will be applied to all the LAG members internally by SAI/SDK + acl_intfs.append(member) elif vlans.has_key(member): print >> sys.stderr, "Warning: ACL " + aclname + " is attached to a Vlan interface, which is currently not supported" elif port_alias_map.has_key(member): acl_intfs.append(port_alias_map[member]) + # Give a warning if trying to attach ACL to a LAG member interface, correct way is to attach ACL to the LAG interface + if port_alias_map[member] in intfs_inpc: + print >> sys.stderr, "Warning: ACL " + aclname + " is attached to a LAG member interface " + port_alias_map[member] + ", instead of LAG interface" elif member.lower() == 'erspan': is_mirror = True; - # Erspan session will be attached to all front panel ports - acl_intfs = port_alias_map.values() + # Erspan session will be attached to all front panel ports, + # if panel ports is a member port of LAG, should add the LAG + # to acl table instead of the panel ports + acl_intfs = pc_intfs + for panel_port in port_alias_map.values(): + if panel_port not in intfs_inpc: + acl_intfs.append(panel_port) break; if acl_intfs: acls[aclname] = {'policy_desc': aclname, diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 901b882f7048..dacd3cecaf85 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -81,7 +81,7 @@ def test_minigraph_acl(self): self.assertEqual(output.strip(), "Warning: Ignoring Control Plane ACL NTP_ACL without type\n" "{'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL'}," " 'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL'}," - " 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}," + " 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04']}," " 'NTP_ACL': {'services': ['NTP'], 'type': 'CTRLPLANE', 'policy_desc': 'NTP_ACL'}," " 'ROUTER_PROTECT': {'services': ['SSH', 'SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'ROUTER_PROTECT'}}") From dc938898487be1af6b45352c165d4caeffb31ae1 Mon Sep 17 00:00:00 2001 From: Liat Grozovik Date: Thu, 10 May 2018 13:02:28 +0300 Subject: [PATCH 180/274] Revert "[minigraph parser] Fix minigraph parser issue when handling LAG related ACL table configuration (#1609)" (#1693) This reverts commit d7cd056ff4b36b7a88b58d7385c0789d5c984d61. --- src/sonic-config-engine/minigraph.py | 20 +++----------------- src/sonic-config-engine/tests/test_cfggen.py | 2 +- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 4b6b185d854d..443893c66c25 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -149,15 +149,12 @@ def parse_dpg(dpg, hname): pcintfs = child.find(str(QName(ns, "PortChannelInterfaces"))) pc_intfs = [] pcs = {} - intfs_inpc = [] # List to hold all the LAG member interfaces for pcintf in pcintfs.findall(str(QName(ns, "PortChannel"))): pcintfname = pcintf.find(str(QName(ns, "Name"))).text pcintfmbr = pcintf.find(str(QName(ns, "AttachTo"))).text pcmbr_list = pcintfmbr.split(';') - pc_intfs.append(pcintfname) for i, member in enumerate(pcmbr_list): pcmbr_list[i] = port_alias_map.get(member, member) - intfs_inpc.append(pcmbr_list[i]) if pcintf.find(str(QName(ns, "Fallback"))) != None: pcs[pcintfname] = {'members': pcmbr_list, 'fallback': pcintf.find(str(QName(ns, "Fallback"))).text} else: @@ -205,26 +202,15 @@ def parse_dpg(dpg, hname): for member in aclattach: member = member.strip() if pcs.has_key(member): - # If try to attach ACL to a LAG interface then we shall add the LAG to - # to acl_intfs directly instead of break it into member ports, ACL attach - # to LAG will be applied to all the LAG members internally by SAI/SDK - acl_intfs.append(member) + acl_intfs.extend(pcs[member]['members']) # For ACL attaching to port channels, we break them into port channel members elif vlans.has_key(member): print >> sys.stderr, "Warning: ACL " + aclname + " is attached to a Vlan interface, which is currently not supported" elif port_alias_map.has_key(member): acl_intfs.append(port_alias_map[member]) - # Give a warning if trying to attach ACL to a LAG member interface, correct way is to attach ACL to the LAG interface - if port_alias_map[member] in intfs_inpc: - print >> sys.stderr, "Warning: ACL " + aclname + " is attached to a LAG member interface " + port_alias_map[member] + ", instead of LAG interface" elif member.lower() == 'erspan': is_mirror = True; - # Erspan session will be attached to all front panel ports, - # if panel ports is a member port of LAG, should add the LAG - # to acl table instead of the panel ports - acl_intfs = pc_intfs - for panel_port in port_alias_map.values(): - if panel_port not in intfs_inpc: - acl_intfs.append(panel_port) + # Erspan session will be attached to all front panel ports + acl_intfs = port_alias_map.values() break; if acl_intfs: acls[aclname] = {'policy_desc': aclname, diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index dacd3cecaf85..901b882f7048 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -81,7 +81,7 @@ def test_minigraph_acl(self): self.assertEqual(output.strip(), "Warning: Ignoring Control Plane ACL NTP_ACL without type\n" "{'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL'}," " 'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL'}," - " 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04']}," + " 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}," " 'NTP_ACL': {'services': ['NTP'], 'type': 'CTRLPLANE', 'policy_desc': 'NTP_ACL'}," " 'ROUTER_PROTECT': {'services': ['SSH', 'SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'ROUTER_PROTECT'}}") From e900369fa3f67dd81e472f8d99fd182d785d5cde Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 10 May 2018 18:52:38 -0700 Subject: [PATCH 181/274] [slave.mk] Define SPACE variable differently such that the line doesn't end in whitespace (#1676) --- slave.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slave.mk b/slave.mk index 09591b7a9f2c..f642d3341a5c 100644 --- a/slave.mk +++ b/slave.mk @@ -12,8 +12,8 @@ GUID = $(shell id -g) .SECONDEXPANSION: -SPACE := -SPACE += +NULL := +SPACE := $(NULL) $(NULL) ############################################################################### ## General definitions From 931b5dee1356255c08b92b4591c959a7e2107719 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 11 May 2018 14:02:10 -0700 Subject: [PATCH 182/274] [quagga]: update quagga submodule (#1698) * [quagga]: update quagga submodule 0bc6bd6 2018-05-11 | ignore nexthop attribute when NLRI is present (#18) (HEAD, origin/debian/0.99.24.1, origin/HEAD) [lguohan] Signed-off-by: Guohan Lu * add vs bgp test Signed-off-by: Guohan Lu --- platform/vs/README.md | 2 +- platform/vs/tests/README.md | 4 + platform/vs/tests/bgp/files/bgpd.conf | 7 + .../vs/tests/bgp/files/invalid_nexthop.conf | 19 ++ platform/vs/tests/bgp/test_invalid_nexthop.py | 32 +++ platform/vs/tests/conftest.py | 231 ++++++++++++++++++ src/sonic-quagga | 2 +- 7 files changed, 295 insertions(+), 2 deletions(-) create mode 100644 platform/vs/tests/README.md create mode 100644 platform/vs/tests/bgp/files/bgpd.conf create mode 100644 platform/vs/tests/bgp/files/invalid_nexthop.conf create mode 100644 platform/vs/tests/bgp/test_invalid_nexthop.py create mode 100644 platform/vs/tests/conftest.py diff --git a/platform/vs/README.md b/platform/vs/README.md index 52f3f30eac6d..30d29b371b6e 100644 --- a/platform/vs/README.md +++ b/platform/vs/README.md @@ -44,7 +44,7 @@ sw-srv0 (id: 5) 2. Start sonic virtual switch docker ``` -$ docker run --privileged --network container:sw -d docker-sonic-vs +$ docker run --privileged --network container:sw --name vs -d docker-sonic-vs ``` 3. Setup IP in the virtual switch docker diff --git a/platform/vs/tests/README.md b/platform/vs/tests/README.md new file mode 100644 index 000000000000..29ba27db62fc --- /dev/null +++ b/platform/vs/tests/README.md @@ -0,0 +1,4 @@ +Requirements: + +- Enable IPv6 for docker engine +- pip install exabgp diff --git a/platform/vs/tests/bgp/files/bgpd.conf b/platform/vs/tests/bgp/files/bgpd.conf new file mode 100644 index 000000000000..b22bf17f92e3 --- /dev/null +++ b/platform/vs/tests/bgp/files/bgpd.conf @@ -0,0 +1,7 @@ +router bgp 65501 + bgp router-id 1.1.1.1 + no bgp default ipv4-unicast + neighbor fc00::2 remote-as 65502 + address-family ipv6 + neighbor fc00::2 activate + exit-address-family diff --git a/platform/vs/tests/bgp/files/invalid_nexthop.conf b/platform/vs/tests/bgp/files/invalid_nexthop.conf new file mode 100644 index 000000000000..60a327d7121d --- /dev/null +++ b/platform/vs/tests/bgp/files/invalid_nexthop.conf @@ -0,0 +1,19 @@ +neighbor fc00::1 { + router-id 1.2.3.4; + local-address fc00::2; + local-as 65502; + peer-as 65501; + group-updates false; + + family { + ipv4 unicast; + ipv6 unicast; + } + + static { + route 3333::0/64 { + next-hop 0.0.0.0; + next-hop fc00::2; + } + } +} diff --git a/platform/vs/tests/bgp/test_invalid_nexthop.py b/platform/vs/tests/bgp/test_invalid_nexthop.py new file mode 100644 index 000000000000..cdb67337b896 --- /dev/null +++ b/platform/vs/tests/bgp/test_invalid_nexthop.py @@ -0,0 +1,32 @@ +from swsscommon import swsscommon +import os +import re +import time +import json + +def test_InvalidNexthop(dvs): + + dvs.copy_file("/etc/quagga/", "bgp/files/bgpd.conf") + dvs.runcmd("supervisorctl start bgpd") + dvs.runcmd("ip addr add fc00::1/126 dev Ethernet0") + dvs.runcmd("ifconfig Ethernet0 up") + + dvs.servers[0].runcmd("ip addr add fc00::2/126 dev eth0") + dvs.servers[0].runcmd("ifconfig eth0 up") + + time.sleep(5) + + print dvs.runcmd("supervisorctl status") + + p = dvs.servers[0].runcmd_async("exabgp -d bgp/files/invalid_nexthop.conf") + + time.sleep(10) + + output = dvs.runcmd(["vtysh", "-c", "show ipv6 bgp"]) + + p.terminate() + p = p.wait() + + print output + + assert "3333::/64" in output diff --git a/platform/vs/tests/conftest.py b/platform/vs/tests/conftest.py new file mode 100644 index 000000000000..98b6b2a2e1a6 --- /dev/null +++ b/platform/vs/tests/conftest.py @@ -0,0 +1,231 @@ +import os +import os.path +import re +import time +import docker +import pytest +import commands +import tarfile +import StringIO +import subprocess +from swsscommon import swsscommon + +def pytest_addoption(parser): + parser.addoption("--dvsname", action="store", default=None, + help="dvs name") + +class AsicDbValidator(object): + def __init__(self, dvs): + self.adb = swsscommon.DBConnector(1, dvs.redis_sock, 0) + + # get default dot1q vlan id + atbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_VLAN") + + keys = atbl.getKeys() + assert len(keys) == 1 + self.default_vlan_id = keys[0] + + # build port oid to front port name mapping + self.portoidmap = {} + self.portnamemap = {} + self.hostifoidmap = {} + self.hostifnamemap = {} + atbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_HOSTIF") + keys = atbl.getKeys() + + assert len(keys) == 32 + for k in keys: + (status, fvs) = atbl.get(k) + + assert status == True + + for fv in fvs: + if fv[0] == "SAI_HOSTIF_ATTR_OBJ_ID": + port_oid = fv[1] + elif fv[0] == "SAI_HOSTIF_ATTR_NAME": + port_name = fv[1] + + self.portoidmap[port_oid] = port_name + self.portnamemap[port_name] = port_oid + self.hostifoidmap[k] = port_name + self.hostifnamemap[port_name] = k + + # get default acl table and acl rules + atbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_ACL_TABLE") + keys = atbl.getKeys() + + assert len(keys) == 1 + self.default_acl_table = keys[0] + + atbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_ACL_ENTRY") + keys = atbl.getKeys() + + assert len(keys) == 2 + self.default_acl_entries = keys + +class VirtualServer(object): + def __init__(self, ctn_name, pid, i): + self.nsname = "%s-srv%d" % (ctn_name, i) + self.vifname = "vEthernet%d" % (i * 4) + self.cleanup = True + + # create netns + if os.path.exists("/var/run/netns/%s" % self.nsname): + self.cleanup = False + else: + os.system("ip netns add %s" % self.nsname) + + # create vpeer link + os.system("ip link add %s type veth peer name %s" % (self.nsname[0:12], self.vifname)) + os.system("ip link set %s netns %s" % (self.nsname[0:12], self.nsname)) + os.system("ip link set %s netns %d" % (self.vifname, pid)) + + # bring up link in the virtual server + os.system("ip netns exec %s ip link set dev %s name eth0" % (self.nsname, self.nsname[0:12])) + os.system("ip netns exec %s ip link set dev eth0 up" % (self.nsname)) + os.system("ip netns exec %s ethtool -K eth0 tx off" % (self.nsname)) + + # bring up link in the virtual switch + os.system("nsenter -t %d -n ip link set dev %s up" % (pid, self.vifname)) + + def __del__(self): + if self.cleanup: + os.system("ip netns delete %s" % self.nsname) + + def runcmd(self, cmd): + os.system("ip netns exec %s %s" % (self.nsname, cmd)) + + def runcmd_async(self, cmd): + return subprocess.Popen("ip netns exec %s %s" % (self.nsname, cmd), shell=True) + +class DockerVirtualSwitch(object): + def __init__(self, name=None): + self.pnames = ['fpmsyncd', + 'intfmgrd', + 'intfsyncd', + 'neighsyncd', + 'orchagent', + 'portsyncd', + 'redis-server', + 'rsyslogd', + 'syncd', + 'teamsyncd', + 'vlanmgrd', + 'zebra'] + self.mount = "/var/run/redis-vs" + self.redis_sock = self.mount + '/' + "redis.sock" + self.client = docker.from_env() + + self.ctn = None + self.cleanup = True + if name != None: + # get virtual switch container + for ctn in self.client.containers.list(): + if ctn.name == name: + self.ctn = ctn + (status, output) = commands.getstatusoutput("docker inspect --format '{{.HostConfig.NetworkMode}}' %s" % name) + ctn_sw_id = output.split(':')[1] + self.cleanup = False + if self.ctn == None: + raise NameError("cannot find container %s" % name) + + # get base container + for ctn in self.client.containers.list(): + if ctn.id == ctn_sw_id or ctn.name == ctn_sw_id: + ctn_sw_name = ctn.name + + (status, output) = commands.getstatusoutput("docker inspect --format '{{.State.Pid}}' %s" % ctn_sw_name) + self.ctn_sw_pid = int(output) + + # create virtual servers + self.servers = [] + for i in range(32): + server = VirtualServer(ctn_sw_name, self.ctn_sw_pid, i) + self.servers.append(server) + + self.restart() + else: + self.ctn_sw = self.client.containers.run('debian:jessie', privileged=True, detach=True, + command="bash", stdin_open=True) + (status, output) = commands.getstatusoutput("docker inspect --format '{{.State.Pid}}' %s" % self.ctn_sw.name) + self.ctn_sw_pid = int(output) + + # create virtual server + self.servers = [] + for i in range(32): + server = VirtualServer(self.ctn_sw.name, self.ctn_sw_pid, i) + self.servers.append(server) + + # create virtual switch container + self.ctn = self.client.containers.run('docker-sonic-vs', privileged=True, detach=True, + network_mode="container:%s" % self.ctn_sw.name, + volumes={ self.mount: { 'bind': '/var/run/redis', 'mode': 'rw' } }) + + self.ctn.exec_run("sysctl -w net.ipv6.conf.all.disable_ipv6=0") + self.check_ready() + self.init_asicdb_validator() + + def destroy(self): + if self.cleanup: + self.ctn.remove(force=True) + self.ctn_sw.remove(force=True) + for s in self.servers: + del(s) + + def check_ready(self, timeout=30): + '''check if all processes in the dvs is ready''' + + re_space = re.compile('\s+') + process_status = {} + ready = False + started = 0 + while True: + # get process status + out = self.ctn.exec_run("supervisorctl status") + for l in out.split('\n'): + fds = re_space.split(l) + if len(fds) < 2: + continue + process_status[fds[0]] = fds[1] + + # check if all processes are running + ready = True + for pname in self.pnames: + try: + if process_status[pname] != "RUNNING": + ready = False + except KeyError: + ready = False + + if ready == True: + break + + started += 1 + if started > timeout: + raise ValueError(out) + + time.sleep(1) + + def restart(self): + self.ctn.restart() + + def init_asicdb_validator(self): + self.asicdb = AsicDbValidator(self) + + def runcmd(self, cmd): + return self.ctn.exec_run(cmd) + + def copy_file(self, path, filename): + tarstr = StringIO.StringIO() + tar = tarfile.open(fileobj=tarstr, mode="w") + tar.add(filename, os.path.basename(filename)) + tar.close() + self.ctn.put_archive(path, tarstr.getvalue()) + tarstr.close() + +@pytest.yield_fixture(scope="module") +def dvs(request): + name = request.config.getoption("--dvsname") + dvs = DockerVirtualSwitch(name) + yield dvs + dvs.destroy() diff --git a/src/sonic-quagga b/src/sonic-quagga index e1217a526999..0bc6bd6b208e 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit e1217a5269990926dff30624063975673b1da065 +Subproject commit 0bc6bd6b208e3701df89c3e231c48f3bdb3d046f From d692905aee1b18a84bf91d8a89bbeae3c6897f4f Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 11 May 2018 16:38:44 -0700 Subject: [PATCH 183/274] [swss]: Update sonic-swss submodule (#1699) [lua]: use not to check whether the field exists (#492) [PFCWD]: Periodically poll WD counters (#473) [teamsyncd]: Add team_ifindex2ifname return value check (#500) [qos]: fix SAI_BUFFER_PROFILE_ATTR_SHARED_DYNAMIC_TH value mismatch bug (#495) [copporch]: Add SAI_HOSTIF_TRAP_TYPE_UDLD (#480) Signed-off-by: Shu0T1an ChenG --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index bb85c729c44b..0246df719c5f 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit bb85c729c44b5fe1ea34ce59a368f34112180d30 +Subproject commit 0246df719c5fc41b9b7b1a426182d4f9d861df81 From 2d37aa8a7d5130c0f3891cddef5358534d98d526 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 11 May 2018 21:23:01 -0700 Subject: [PATCH 184/274] [submodule]: Update submodule sonic-snmpagent: Improve mib fundamental classes: retry after reinit_data() throws (#1700) --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index b6bf4a77e07a..f28315252698 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit b6bf4a77e07a1d70d750aad69125532df33276dc +Subproject commit f28315252698aabc927eca84b836493385fcf4a1 From 5e64310a56ba69a7e156257a59fcda1e7898336a Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Sat, 12 May 2018 01:31:17 -0700 Subject: [PATCH 185/274] [baseimage]: Disable DAD for eth0 explicitly (#1701) --- build_debian.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build_debian.sh b/build_debian.sh index ed5d180859f6..fa461a7ca415 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -301,6 +301,7 @@ set /files/etc/sysctl.conf/net.ipv6.conf.eth0.forwarding 0 set /files/etc/sysctl.conf/net.ipv6.conf.default.accept_dad 0 set /files/etc/sysctl.conf/net.ipv6.conf.all.accept_dad 0 +set /files/etc/sysctl.conf/net.ipv6.conf.eth0.accept_dad 0 set /files/etc/sysctl.conf/net.ipv6.conf.eth0.accept_ra_defrtr 0 From e9672b2b06645539732090a3df18605f5ec52aa0 Mon Sep 17 00:00:00 2001 From: loshihyu Date: Sat, 12 May 2018 01:32:55 -0700 Subject: [PATCH 186/274] [devices]: Add inventec D7032 D7054 platform psustatus (#1696) --- .../plugins/psuutil.py | 88 +++++++++++++++++++ .../plugins/psuutil.py | 84 ++++++++++++++++++ 2 files changed, 172 insertions(+) create mode 100644 device/inventec/x86_64-inventec_d7032q28b-r0/plugins/psuutil.py create mode 100644 device/inventec/x86_64-inventec_d7054q28b-r0/plugins/psuutil.py diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/psuutil.py b/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/psuutil.py new file mode 100644 index 000000000000..cc5ca004dadf --- /dev/null +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/psuutil.py @@ -0,0 +1,88 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + PSU_DIR = "/sys/bus/i2c/devices/0-0066" + + def __init__(self): + PsuBase.__init__(self) + +# Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip(' \t\n\r') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + if (index == 1): + ind = 2 + if (index == 2): + ind = 1 + attr_file = 'psu'+ str(ind) + '_iout' + attr_path = self.PSU_DIR +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + if (attr_value != 'ERR'): + # Check for PSU status + if (attr_value != 0): + status = 1 + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_absent = 0 + ind = index-1 + attr_file ='psu'+ str(ind) + attr_path = self.PSU_DIR +'/' + attr_file + normal_attr_value = '0 : normal' + attr_value = self.get_attr_value(attr_path) + if (attr_value != 'ERR'): + # Check for PSU presence + if (attr_value == normal_attr_value): + status = 1 + return status diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/plugins/psuutil.py b/device/inventec/x86_64-inventec_d7054q28b-r0/plugins/psuutil.py new file mode 100644 index 000000000000..4bd3f7a27052 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/plugins/psuutil.py @@ -0,0 +1,84 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + PSU_DIR = "/sys/bus/i2c/devices/0-0066" + + def __init__(self): + PsuBase.__init__(self) + +# Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip(' \t\n\r') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psoc_psu'+ str(index) + '_iout' + attr_path = self.PSU_DIR +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + if (attr_value != 'ERR'): + # Check for PSU status + if (attr_value != 0): + status = 1 + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_absent = 0 + ind = index-1 + attr_file ='psu'+ str(ind) + attr_path = self.PSU_DIR +'/' + attr_file + normal_attr_value = '0 : normal' + attr_value = self.get_attr_value(attr_path) + if (attr_value != 'ERR'): + # Check for PSU presence + if (attr_value == normal_attr_value): + status = 1 + return status From e55778faa4704a9a36ed6eff3d45959732f81753 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Mon, 14 May 2018 18:01:02 -0700 Subject: [PATCH 187/274] Update sonic-sairedis (#1705) --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 177f768c6ffe..7c29ecb0555c 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 177f768c6ffe0806ee500f739bd06203ab913b72 +Subproject commit 7c29ecb0555c66885d3ff6d5491dca3637ccea85 From c1e37a6be9fbf437bb09fc31fdb96d0c94b5a631 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Tue, 15 May 2018 05:27:10 -0700 Subject: [PATCH 188/274] [Arista]: Add a reboot script for all remaining platforms. (#1706) Adds a platform_reboot script for 7050QX-32, 7050QX-32S and 7060CX-32S. This allow a proper cold reboot to happen. --- .../x86_64-arista_7050_qx32/platform_reboot | 87 +++++++++++++++++++ .../x86_64-arista_7050_qx32s/platform_reboot | 87 +++++++++++++++++++ .../x86_64-arista_7060_cx32s/platform_reboot | 18 ++++ 3 files changed, 192 insertions(+) create mode 100755 device/arista/x86_64-arista_7050_qx32/platform_reboot create mode 100755 device/arista/x86_64-arista_7050_qx32s/platform_reboot create mode 100755 device/arista/x86_64-arista_7060_cx32s/platform_reboot diff --git a/device/arista/x86_64-arista_7050_qx32/platform_reboot b/device/arista/x86_64-arista_7050_qx32/platform_reboot new file mode 100755 index 000000000000..da438b8fe52b --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/platform_reboot @@ -0,0 +1,87 @@ +#!/usr/bin/env python +# Copyright (c) 2018 Arista Networks, Inc. All rights reserved. +# Arista Networks, Inc. Confidential and Proprietary. + +# Reboot script for 7050QX-32 + +from __future__ import print_function +import sys +import mmap, os +import subprocess +from struct import pack, unpack + +class MmapResource( object ): + """Resource implementation for a directly-mapped memory region.""" + + def __init__( self, path ): + try: + fd = os.open( path, os.O_RDWR ) + except EnvironmentError: + print( "FAIL can not open scd memory-map resource file" ) + print( "FAIL are you running on the proper platform?" ) + sys.exit( 1 ) + try: + size = os.fstat( fd ).st_size + except EnvironmentError: + print( "FAIL can not fstat scd memory-map resource file" ) + print( "FAIL are you running on the proper platform?" ) + sys.exit( 1 ) + try: + self.mmap_ = mmap.mmap( fd, size, mmap.MAP_SHARED, + mmap.PROT_READ | mmap.PROT_WRITE ) + except EnvironmentError: + print( "FAIL can not map scd memory-map file" ) + print( "FAIL are you running on the proper platform?" ) + sys.exit( 1 ) + finally: + try: + # Note that closing the file descriptor has no effect on the memory map + os.close( fd ) + except EnvironmentError: + print( "FAIL failed to close scd memory-map file" ) + sys.exit( 1 ) + + def read32( self, addr ): + return unpack( ' Date: Wed, 16 May 2018 10:04:17 -0700 Subject: [PATCH 189/274] [fast-reboot]: support encoded & gzipped minigraph in fast reboot (#1716) * [fast-reboot]: support encoded & gzipped minigraph in fast reboot Signed-off-by: Guohan Lu * add acl.json and snmp.yml into fast-reboot Signed-off-by: Guohan Lu --- files/image_config/platform/rc.local | 34 ++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index a931efb5b469..de54d141ef7e 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -126,19 +126,31 @@ if [ ! -e /host/machine.conf ]; then if [ -n "$nos_dev" ]; then # Mount the previous NOS's partition - mkdir -p /mnt/nos_migration - mount $nos_dev /mnt/nos_migration + NOS_DIR=/mnt/nos_migration + MG_GZFILE=$NOS_DIR/minigraph.xml.gz.base64.txt + MG_FILE=$NOS_DIR/minigraph.xml + ACL_GZFILE=$NOS_DIR/acl.json.gz.base64.txt + ACL_FILE=$NOS_DIR/acl.json + SNMP_FILE=$NOS_DIR/snmp.yml + mkdir -p $NOS_DIR + mount $nos_dev $NOS_DIR mkdir -p /host/fast-reboot + # decode & unzip minigraph.xml.gz.base64.txt + [ -f $MG_GZFILE ] && /usr/bin/base64 -d $MG_GZFILE | /bin/gunzip > $MG_FILE + [ -f $ACL_GZFILE ] && /usr/bin/base64 -d $ACL_GZFILE | /bin/gunzip > $ACL_FILE + # Copy relevant files - nos_migration_import /mnt/nos_migration/mgmt_interface.cfg /host/migration - nos_migration_import /mnt/nos_migration/minigraph.xml /host/migration - nos_migration_import /mnt/nos_migration/arp.json /host/fast-reboot - nos_migration_import /mnt/nos_migration/fdb.json /host/fast-reboot - nos_migration_import /mnt/nos_migration/default_routes.json /host/fast-reboot - - umount /mnt/nos_migration - rmdir /mnt/nos_migration + nos_migration_import $NOS_DIR/mgmt_interface.cfg /host/migration + nos_migration_import $MG_FILE /host/migration + nos_migration_import $ACL_FILE /host/migration + nos_migration_import $SNMP_FILE /host/migration + nos_migration_import $NOS_DIR/arp.json /host/fast-reboot + nos_migration_import $NOS_DIR/fdb.json /host/fast-reboot + nos_migration_import $NOS_DIR/default_routes.json /host/fast-reboot + + umount $NOS_DIR + rmdir $NOS_DIR fi update_mgmt_interface_macaddr /host/migration/mgmt_interface.cfg @@ -196,6 +208,8 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then elif [ -n "$migration" ] && [ -f /host/migration/minigraph.xml ]; then mkdir -p /etc/sonic/old_config mv /host/migration/minigraph.xml /etc/sonic/old_config/ + [ -f /host/migration/acl.json ] && mv /host/migration/acl.json /etc/sonic/old_config/ + [ -f /host/migration/snmp.yml ] && mv /host/migration/snmp.yml /etc/sonic/old_config/ touch /tmp/pending_config_migration [ -f /etc/sonic/updategraph.conf ] && sed -i -e "s/enabled=false/enabled=true/g" /etc/sonic/updategraph.conf else From 6b8e34055840e4e25a4e31156ee0c5c4955f04f2 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 16 May 2018 14:32:42 -0700 Subject: [PATCH 190/274] [dhcp_relay] Only attempt to start 'isc-dhcp-relay' group if it is not empty (#1713) --- dockers/docker-dhcp-relay/start.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/dockers/docker-dhcp-relay/start.sh b/dockers/docker-dhcp-relay/start.sh index 2ee80c4e3388..0ac5ea1a10ec 100755 --- a/dockers/docker-dhcp-relay/start.sh +++ b/dockers/docker-dhcp-relay/start.sh @@ -6,13 +6,16 @@ rm -f /var/run/rsyslogd.pid # Start rsyslog supervisorctl start rsyslogd -# Wait for all interfaces to come up and be assigned IPv4 addresses before -# starting the DHCP relay agent(s). If an interface the relay should listen -# on is down, the relay agent will not start. If an interface the relay should -# listen on is up but does not have an IP address assigned when the relay -# agent starts, it will not listen or send on that interface for the lifetime -# of the process. -/usr/bin/wait_for_intf.sh +# If our supervisor config has entries in the "isc-dhcp-relay" group... +if [ $(supervisorctl status | grep -c "^isc-dhcp-relay:") -gt 0 ]; then + # Wait for all interfaces to come up and be assigned IPv4 addresses before + # starting the DHCP relay agent(s). If an interface the relay should listen + # on is down, the relay agent will not start. If an interface the relay + # should listen on is up but does not have an IP address assigned when the + # relay agent starts, it will not listen or send on that interface for the + # lifetime of the process. + /usr/bin/wait_for_intf.sh -# Start the DHCP relay agent(s) -supervisorctl start isc-dhcp-relay:* + # Start all DHCP relay agent(s) + supervisorctl start isc-dhcp-relay:* +fi From 174960cc2274c711c20472609cc232520e4d0442 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Thu, 17 May 2018 21:12:07 +0300 Subject: [PATCH 191/274] [mellanox]: Update FW pointer (#1721) Signed-off-by: Volodymyr Samotiy --- platform/mellanox/fw.mk | 2 +- platform/mellanox/sdk.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 0ac9dd9b7aa6..73d1236f5a9a 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,6 +1,6 @@ # mellanox firmware -MLNX_FW_VERSION = 13.1620.0208 +MLNX_FW_VERSION = 13.1620.0222 MLNX_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_FW_VERSION))-EVB.mfa $(MLNX_FW_FILE)_URL = $(MLNX_SDK_BASE_URL)/$(MLNX_FW_FILE) SONIC_ONLINE_FILES += $(MLNX_FW_FILE) diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 2ae9e43ac52a..f301032846c3 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,4 +1,4 @@ -MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/56130a854a3b0f4e46d6d84749a5d758e7d1f297/sdk +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/957f61820e441e490081cb3724f702ed507f7477/sdk MLNX_SDK_VERSION = 4.2.7303 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ From eb9b86aca497d80902bbc695ae9e274356cddbfa Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 17 May 2018 11:12:59 -0700 Subject: [PATCH 192/274] [vs]: add teamd test on vs platform (#1720) Signed-off-by: Guohan Lu --- platform/vs/tests/conftest.py | 1 + platform/vs/tests/teamd/files/po01.conf | 14 ++++++++ platform/vs/tests/teamd/test_portchannel.py | 37 +++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 platform/vs/tests/teamd/files/po01.conf create mode 100644 platform/vs/tests/teamd/test_portchannel.py diff --git a/platform/vs/tests/conftest.py b/platform/vs/tests/conftest.py index 98b6b2a2e1a6..0752b86fde1b 100644 --- a/platform/vs/tests/conftest.py +++ b/platform/vs/tests/conftest.py @@ -220,6 +220,7 @@ def copy_file(self, path, filename): tar = tarfile.open(fileobj=tarstr, mode="w") tar.add(filename, os.path.basename(filename)) tar.close() + self.ctn.exec_run("mkdir -p %s" % path) self.ctn.put_archive(path, tarstr.getvalue()) tarstr.close() diff --git a/platform/vs/tests/teamd/files/po01.conf b/platform/vs/tests/teamd/files/po01.conf new file mode 100644 index 000000000000..c2a1a4652aa2 --- /dev/null +++ b/platform/vs/tests/teamd/files/po01.conf @@ -0,0 +1,14 @@ +{ + "device": "PortChannel0001", + "hwaddr": "ec:f4:bb:fe:80:90", + "runner": { + "name": "loadbalance", + "tx_hash": ["eth", "ipv4", "ipv6"] + }, + "link_watch": { + "name": "ethtool" + }, + "ports": { + "Ethernet112": {} + } +} diff --git a/platform/vs/tests/teamd/test_portchannel.py b/platform/vs/tests/teamd/test_portchannel.py new file mode 100644 index 000000000000..820651c1be65 --- /dev/null +++ b/platform/vs/tests/teamd/test_portchannel.py @@ -0,0 +1,37 @@ +from swsscommon import swsscommon +import time +import re +import json + +def test_PortChannel(dvs): + + dvs.copy_file("/etc/teamd/", "teamd/files/po01.conf") + dvs.runcmd("teamd -f /etc/teamd/po01.conf -d") + dvs.runcmd("ifconfig PortChannel0001 up") + + time.sleep(1) + + # test lag table in app db + appdb = swsscommon.DBConnector(0, dvs.redis_sock, 0) + + tbl = swsscommon.Table(appdb, "LAG_TABLE") + + (status, fvs) = tbl.get("PortChannel0001") + + assert status == True + + # test lag member table in app db + tbl = swsscommon.Table(appdb, "LAG_MEMBER_TABLE") + + (status, fvs) = tbl.get("PortChannel0001:Ethernet112") + + assert status == True + + # test lag table in state db + confdb = swsscommon.DBConnector(6, dvs.redis_sock, 0) + + tbl = swsscommon.Table(confdb, "LAG_TABLE") + + (status, fvs) = tbl.get("PortChannel0001") + + assert status == True From 9e8883b97b09a49b0317586c49d2a23246f392f1 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 17 May 2018 13:53:35 -0700 Subject: [PATCH 193/274] Update sonic-sairedis and sonic-swss submodules (#1724) --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 7c29ecb0555c..a314ac45a189 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 7c29ecb0555c66885d3ff6d5491dca3637ccea85 +Subproject commit a314ac45a1899fafc913fbf6f1df83cbf5d7d069 diff --git a/src/sonic-swss b/src/sonic-swss index 0246df719c5f..8d810bef7fcb 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 0246df719c5fc41b9b7b1a426182d4f9d861df81 +Subproject commit 8d810bef7fcb81b0607afe71611e7bf34e8a3c12 From 74aa48279f2e0212df9297a84ba0557f4a859b5d Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Thu, 17 May 2018 17:41:43 -0700 Subject: [PATCH 194/274] [devices]: Reverting the xoff value for Arista 7060 t0 topology (#1726) --- .../Arista-7060CX-32S-D48C8/buffers_defaults_t0.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers_defaults_t0.j2 index 2b7215243f12..7463e20afabe 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers_defaults_t0.j2 +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers_defaults_t0.j2 @@ -28,7 +28,7 @@ "size": "11213696", "type": "ingress", "mode": "dynamic", - "xoff": "8356608" + "xoff": "3855488" }, "egress_lossy_pool": { "size": "9532224", From c0bb2e04d5a69b3c7a3fcc12fbdf75a818c8fafb Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 18 May 2018 16:32:49 -0700 Subject: [PATCH 195/274] [devices]: add Mellanox-SN2700-D48C8 hwsku (#1717) Signed-off-by: Guohan Lu --- .../Mellanox-SN2700-D48C8/buffers.json.j2 | 2 + .../buffers_defaults_t0.j2 | 90 ++++++ .../buffers_defaults_t1.j2 | 90 ++++++ .../pg_profile_lookup.ini | 17 ++ .../Mellanox-SN2700-D48C8/port_config.ini | 57 ++++ .../Mellanox-SN2700-D48C8/qos.json | 166 +++++++++++ .../Mellanox-SN2700-D48C8/sai.profile | 1 + .../sai_2700_48x50g_8x100g.xml | 267 ++++++++++++++++++ 8 files changed, 690 insertions(+) create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers.json.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/pg_profile_lookup.ini create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/port_config.ini create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/sai.profile create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/sai_2700_48x50g_8x100g.xml diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers.json.j2 new file mode 100644 index 000000000000..1083a6210fc9 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..475a0227143c --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 @@ -0,0 +1,90 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '4194304' %} +{% set ingress_lossy_pool_size = '7340032' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '7340032' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0, 32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_profile_lists(port_names) %} + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" + } + } +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } + } +{%- endmacro %} + + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..c292ecc2f21a --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 @@ -0,0 +1,90 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '2097152' %} +{% set ingress_lossy_pool_size = '5242880' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '5242880' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0, 32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_profile_lists(port_names) %} + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" + } + } +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } + } +{%- endmacro %} + + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/pg_profile_lookup.ini new file mode 100644 index 000000000000..b66b129fe43f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/port_config.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/port_config.ini new file mode 100644 index 000000000000..d54a31851614 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/port_config.ini @@ -0,0 +1,57 @@ +# name lanes speed +Ethernet0 0,1 50000 +Ethernet2 2,3 50000 +Ethernet4 4,5 50000 +Ethernet6 6,7 50000 +Ethernet8 8,9 50000 +Ethernet10 10,11 50000 +Ethernet12 12,13 50000 +Ethernet14 14,15 50000 +Ethernet16 16,17 50000 +Ethernet18 18,19 50000 +Ethernet20 20,21 50000 +Ethernet22 22,23 50000 +Ethernet24 24,25,26,27 100000 +Ethernet28 28,29,30,31 100000 +Ethernet32 32,33,34,35 100000 +Ethernet36 36,37,38,39 100000 +Ethernet40 40,41 50000 +Ethernet42 42,43 50000 +Ethernet44 44,45 50000 +Ethernet46 46,47 50000 +Ethernet48 48,49 50000 +Ethernet50 50,51 50000 +Ethernet52 52,53 50000 +Ethernet54 54,55 50000 +Ethernet56 56,57 50000 +Ethernet58 58,59 50000 +Ethernet60 60,61 50000 +Ethernet62 62,63 50000 +Ethernet64 64,65 50000 +Ethernet66 66,67 50000 +Ethernet68 68,69 50000 +Ethernet70 70,71 50000 +Ethernet72 72,73 50000 +Ethernet74 74,75 50000 +Ethernet76 76,77 50000 +Ethernet78 78,79 50000 +Ethernet80 80,81 50000 +Ethernet82 82,83 50000 +Ethernet84 84,85 50000 +Ethernet86 86,87 50000 +Ethernet88 88,89,90,91 100000 +Ethernet92 92,93,94,95 100000 +Ethernet96 96,97,98,99 100000 +Ethernet100 100,101,102,103 100000 +Ethernet104 104,105 50000 +Ethernet106 106,107 50000 +Ethernet108 108,109 50000 +Ethernet110 110,111 50000 +Ethernet112 112,113 50000 +Ethernet114 114,115 50000 +Ethernet116 116,117 50000 +Ethernet118 118,119 50000 +Ethernet120 120,121 50000 +Ethernet122 122,123 50000 +Ethernet124 124,125 50000 +Ethernet126 126,127 50000 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json new file mode 100644 index 000000000000..d35f614de635 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json @@ -0,0 +1,166 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1": { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2": { + "type":"DWRR", + "weight": "20" + } + }, + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "PORT_QOS_MAP": { + "Ethernet8,Ethernet2,Ethernet0,Ethernet6,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet106,Ethernet58,Ethernet126,Ethernet96,Ethernet124,Ethernet122,Ethernet92,Ethernet120,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet76,Ethernet74,Ethernet18,Ethernet70,Ethernet32,Ethernet72,Ethernet16,Ethernet36,Ethernet78,Ethernet60,Ethernet28,Ethernet62,Ethernet14,Ethernet88,Ethernet118,Ethernet24,Ethernet116,Ethernet82,Ethernet114,Ethernet80,Ethernet112,Ethernet86,Ethernet110,Ethernet84,Ethernet48,Ethernet10,Ethernet44,Ethernet42,Ethernet40,Ethernet64,Ethernet66,Ethernet12,Ethernet46,Ethernet20,Ethernet22,Ethernet68": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + }, + "AZURE_LOSSLESS": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet8,Ethernet2,Ethernet0,Ethernet6,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet106,Ethernet58,Ethernet126,Ethernet96,Ethernet124,Ethernet122,Ethernet92,Ethernet120,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet76,Ethernet74,Ethernet18,Ethernet70,Ethernet32,Ethernet72,Ethernet16,Ethernet36,Ethernet78,Ethernet60,Ethernet28,Ethernet62,Ethernet14,Ethernet88,Ethernet118,Ethernet24,Ethernet116,Ethernet82,Ethernet114,Ethernet80,Ethernet112,Ethernet86,Ethernet110,Ethernet84,Ethernet48,Ethernet10,Ethernet44,Ethernet42,Ethernet40,Ethernet64,Ethernet66,Ethernet12,Ethernet46,Ethernet20,Ethernet22,Ethernet68|0": { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet8,Ethernet2,Ethernet0,Ethernet6,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet106,Ethernet58,Ethernet126,Ethernet96,Ethernet124,Ethernet122,Ethernet92,Ethernet120,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet76,Ethernet74,Ethernet18,Ethernet70,Ethernet32,Ethernet72,Ethernet16,Ethernet36,Ethernet78,Ethernet60,Ethernet28,Ethernet62,Ethernet14,Ethernet88,Ethernet118,Ethernet24,Ethernet116,Ethernet82,Ethernet114,Ethernet80,Ethernet112,Ethernet86,Ethernet110,Ethernet84,Ethernet48,Ethernet10,Ethernet44,Ethernet42,Ethernet40,Ethernet64,Ethernet66,Ethernet12,Ethernet46,Ethernet20,Ethernet22,Ethernet68|1": { + "scheduler" : "[SCHEDULER|scheduler.2]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet8,Ethernet2,Ethernet0,Ethernet6,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet106,Ethernet58,Ethernet126,Ethernet96,Ethernet124,Ethernet122,Ethernet92,Ethernet120,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet76,Ethernet74,Ethernet18,Ethernet70,Ethernet32,Ethernet72,Ethernet16,Ethernet36,Ethernet78,Ethernet60,Ethernet28,Ethernet62,Ethernet14,Ethernet88,Ethernet118,Ethernet24,Ethernet116,Ethernet82,Ethernet114,Ethernet80,Ethernet112,Ethernet86,Ethernet110,Ethernet84,Ethernet48,Ethernet10,Ethernet44,Ethernet42,Ethernet40,Ethernet64,Ethernet66,Ethernet12,Ethernet46,Ethernet20,Ethernet22,Ethernet68|3-4": { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + } + } +} + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/sai.profile b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/sai.profile new file mode 100644 index 000000000000..bfbcb1e78f47 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2700_48x50g_8x100g.xml diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/sai_2700_48x50g_8x100g.xml b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/sai_2700_48x50g_8x100g.xml new file mode 100644 index 000000000000..bda7a3e1cc17 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/sai_2700_48x50g_8x100g.xml @@ -0,0 +1,267 @@ + + + + + + 00:02:03:04:05:00 + + + 32 + + + + + 1 + 4 + 16 + + + 3 + + + 3221225472 + 2 + + + 3 + 4 + 17 + 1 + 3221225472 + 2 + + + 5 + 4 + 18 + 3 + 3221225472 + 2 + + + 7 + 4 + 19 + 1 + 3221225472 + 2 + + + 9 + 4 + 20 + 3 + 3221225472 + 2 + + + 11 + 4 + 21 + 1 + 3221225472 + 2 + + + 13 + 4 + 22 + 3 + 11534336 + + + 15 + 4 + 23 + 1 + 11534336 + + + 17 + 4 + 24 + 3 + 11534336 + + + 19 + 4 + 25 + 1 + 11534336 + + + 21 + 4 + 26 + 3 + 3221225472 + 2 + + + 23 + 4 + 27 + 1 + 3221225472 + 2> + + + 25 + 4 + 28 + 3 + 3221225472 + 2 + + + 27 + 4 + 29 + 1 + 3221225472 + 2 + + + 29 + 4 + 30 + 3 + 3221225472 + 2 + + + 31 + 4 + 31 + 1 + 3221225472 + 2 + + + 33 + 4 + 14 + 3 + 3221225472 + 2 + + + 35 + 4 + 15 + 1 + 3221225472 + 2 + + + 37 + 4 + 12 + 3 + 3221225472 + 2 + + + 39 + 4 + 13 + 1 + 3221225472 + 2 + + + 41 + 4 + 10 + 3 + 3221225472 + 2 + + + 43 + 4 + 11 + 1 + 3221225472 + 2 + + + 45 + 4 + 8 + 3 + 11534336 + + + 47 + 4 + 9 + 1 + 11534336 + + + 49 + 4 + 6 + 3 + 11534336 + + + 51 + 4 + 7 + 1 + 11534336 + + + 53 + 4 + 4 + 3 + 3221225472 + 2 + + + 55 + 4 + 5 + 1 + 3221225472 + 2 + + + 57 + 4 + 2 + 3 + 3221225472 + 2 + + + 59 + 4 + 3 + 1 + 3221225472 + 2 + + + 61 + 4 + 0 + 3 + 3221225472 + 2 + + + 63 + 4 + 1 + 1 + 3221225472 + 2 + + + + From 46dc46e1104fce14c10047d29a43da6d600a304e Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 18 May 2018 20:06:49 -0700 Subject: [PATCH 196/274] [submodule update]: sonic-swss. Don't collect unwanted counters (#1729) * Update sonic-sairedis and sonic-swss submodules * Update sonic-swss submodule. Don't collect unwanted counters * sonic-swss-common update too --- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index 8d810bef7fcb..7331f922de7a 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 8d810bef7fcb81b0607afe71611e7bf34e8a3c12 +Subproject commit 7331f922de7af71b0f40d8b2bdd2e1d30fcba6b0 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 1ef337a96df3..b4367a440fb7 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 1ef337a96df371162686b825964ed76bc68325c9 +Subproject commit b4367a440fb7b188c60774808195164438061bba From 5feb3632c93bb0578550fd19a9ede2342119407a Mon Sep 17 00:00:00 2001 From: Harish Venkatraman Date: Mon, 21 May 2018 13:57:25 -0700 Subject: [PATCH 197/274] [device/dell] Add z9100 pfc T0 support (#1708) This commit adds new code to support z9100 PFC T0 support with broadcom recommended MMU settings for PFC feature. Unit tested the setting by loading sonic-broadcom.bin and checking the hardware for the values from the JSON file. The T0 configs supports fan-out of 100G ports on Z9100. Added new config.bcm for fanout of 100G ports and tested the fanout by sending traffic using bcmcmd, new config.bcm file will be copied to /usr/share/sonic/hwsku/th-z9100-8x100-48x50G.config.bcm. The sai.profile file is updated to point to hwsku directory. Signed-off-by: Harish Venkatraman --- .../Force10-Z9100-T0/buffers.json.j2 | 2 + .../Force10-Z9100-T0/buffers_defaults_t0.j2 | 61 +++ .../Force10-Z9100-T0/pg_profile_lookup.ini | 17 + .../Force10-Z9100-T0/port_config.ini | 57 +++ .../Force10-Z9100-T0/qos.json | 167 ++++++++ .../Force10-Z9100-T0/sai.profile | 1 + .../th-z9100-8x100G-48x50G.config.bcm | 377 ++++++++++++++++++ 7 files changed, 682 insertions(+) create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/buffers.json.j2 create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/buffers_defaults_t0.j2 create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/pg_profile_lookup.ini create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/port_config.ini create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/sai.profile create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/th-z9100-8x100G-48x50G.config.bcm diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/buffers.json.j2 b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/buffers.json.j2 new file mode 100644 index 000000000000..1083a6210fc9 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/buffers_defaults_t0.j2 b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..77c5761b9b30 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/buffers_defaults_t0.j2 @@ -0,0 +1,61 @@ +{%- set default_cable = '5m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,6) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(10,26) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(30,32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(6,10) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(26,30) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "11213696", + "type": "ingress", + "mode": "dynamic", + "xoff": "8356608" + }, + "egress_lossy_pool": { + "size": "9532224", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"1518", + "static_th":"3995680" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/pg_profile_lookup.ini b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/pg_profile_lookup.ini new file mode 100644 index 000000000000..7222f8014925 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 1248 2288 35776 -4 2288 + 25000 5m 1248 2288 53248 -4 2288 + 40000 5m 1248 2288 66560 -4 2288 + 50000 5m 1248 2288 79872 -4 2288 + 100000 5m 1248 2288 165568 -4 2288 + 10000 40m 1248 2288 37024 -4 2288 + 25000 40m 1248 2288 56160 -4 2288 + 40000 40m 1248 2288 71552 -4 2288 + 50000 40m 1248 2288 85696 -4 2288 + 100000 40m 1248 2288 177632 -4 2288 + 10000 300m 1248 2288 46176 -4 2288 + 25000 300m 1248 2288 79040 -4 2288 + 40000 300m 1248 2288 108160 -4 2288 + 50000 300m 1248 2288 131456 -4 2288 + 100000 300m 1248 2288 268736 -4 2288 diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/port_config.ini b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/port_config.ini new file mode 100644 index 000000000000..c1a086764854 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/port_config.ini @@ -0,0 +1,57 @@ +# name lanes alias index speed +Ethernet0 49,50 fiftyGigE1/1/1 1 50000 +Ethernet2 51,52 fiftyGigE1/1/2 1 50000 +Ethernet4 53,54 fiftyGigE1/2/1 2 50000 +Ethernet6 55,56 fiftyGigE1/2/2 2 50000 +Ethernet8 57,58 fiftyGigE1/3/1 3 50000 +Ethernet10 59,60 fiftyGigE1/3/2 3 50000 +Ethernet12 61,62 fiftyGigE1/4/1 4 50000 +Ethernet14 63,64 fiftyGigE1/4/2 4 50000 +Ethernet16 65,66 fiftyGigE1/5/1 5 50000 +Ethernet18 67,68 fiftyGigE1/5/2 5 50000 +Ethernet20 69,70 fiftyGigE1/6/1 6 50000 +Ethernet22 71,72 fiftyGigE1/6/2 6 50000 +Ethernet24 73,74,75,76 hundredGigE1/7 7 100000 +Ethernet28 77,78,79,80 hundredGigE1/8 8 100000 +Ethernet32 37,38,39,40 hundredGigE1/9 9 100000 +Ethernet36 33,34,35,36 hundredGigE1/10 10 100000 +Ethernet40 45,46 fiftyGigE1/11/1 11 50000 +Ethernet42 47,48 fiftyGigE1/11/2 11 50000 +Ethernet44 41,42 fiftyGigE1/12/1 12 50000 +Ethernet46 43,44 fiftyGigE1/12/2 12 50000 +Ethernet48 81,82 fiftyGigE1/13/1 13 50000 +Ethernet50 83,84 fiftyGigE1/13/2 13 50000 +Ethernet52 85,86 fiftyGigE1/14/1 14 50000 +Ethernet54 87,88 fiftyGigE1/14/2 14 50000 +Ethernet56 89,90 fiftyGigE1/15/1 15 50000 +Ethernet58 91,92 fiftyGigE1/15/2 15 50000 +Ethernet60 93,94 fiftyGigE1/16/1 16 50000 +Ethernet62 95,96 fiftyGigE1/16/2 16 50000 +Ethernet64 97,98 fiftyGigE1/17/1 17 50000 +Ethernet66 99,100 fiftyGigE1/17/2 17 50000 +Ethernet68 101,102 fiftyGigE1/18/1 18 50000 +Ethernet70 103,104 fiftyGigE1/18/2 18 50000 +Ethernet72 105,106 fiftyGigE1/19/1 19 50000 +Ethernet74 107,108 fiftyGigE1/19/2 19 50000 +Ethernet76 109,110 fiftyGigE1/20/1 20 50000 +Ethernet78 111,112 fiftyGigE1/20/2 20 50000 +Ethernet80 21,22 fiftyGigE1/21/1 21 50000 +Ethernet82 23,24 fiftyGigE1/21/2 21 50000 +Ethernet84 17,18 fiftyGigE1/22/1 22 50000 +Ethernet86 19,20 fiftyGigE1/22/2 22 50000 +Ethernet88 29,30 fiftyGigE1/23/1 23 50000 +Ethernet90 31,32 fiftyGigE1/23/2 23 50000 +Ethernet92 25,26 fiftyGigE1/24/1 24 50000 +Ethernet94 27,28 fiftyGigE1/24/2 24 50000 +Ethernet96 117,118 fiftyGigE1/25/1 25 50000 +Ethernet98 119,120 fiftyGigE1/25/2 25 50000 +Ethernet100 113,114 fiftyGigE1/26/1 26 50000 +Ethernet102 115,116 fiftyGigE1/26/2 26 50000 +Ethernet104 125,126,127,128 hundredGigE1/27 27 100000 +Ethernet108 121,122,123,124 hundredGigE1/28 28 100000 +Ethernet112 5,6,7,8 hundredGigE1/29 29 100000 +Ethernet116 1,2,3,4 hundredGigE1/30 30 100000 +Ethernet120 13,14 fiftyGigE1/31/1 31 50000 +Ethernet122 15,16 fiftyGigE1/31/2 31 50000 +Ethernet124 9,10 fiftyGigE1/32/1 32 50000 +Ethernet126 11,12 fiftyGigE1/32/2 32 50000 diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json new file mode 100644 index 000000000000..09cb63d5d474 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json @@ -0,0 +1,167 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet122,Ethernet124,Ethernet126": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"512000", + "red_min_threshold":"512000", + "yellow_max_threshold":"512000", + "yellow_min_threshold":"512000", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + }, + "AZURE_LOSSLESS" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"512000", + "red_min_threshold":"512000", + "yellow_max_threshold":"512000", + "yellow_min_threshold":"512000", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet122,Ethernet124,Ethernet126|0-1": { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet122,Ethernet124,Ethernet126|3-4": { + "scheduler" : "[SCHEDULER|scheduler.0]" + }, + "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet122,Ethernet124,Ethernet126|0": { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet122,Ethernet124,Ethernet126|1": { + "scheduler" : "[SCHEDULER|scheduler.2]" + } + } +} diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/sai.profile b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/sai.profile new file mode 100644 index 000000000000..182624c19bd4 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-z9100-8x100G-48x50G.config.bcm diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/th-z9100-8x100G-48x50G.config.bcm b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/th-z9100-8x100G-48x50G.config.bcm new file mode 100644 index 000000000000..68768cfa0666 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/th-z9100-8x100G-48x50G.config.bcm @@ -0,0 +1,377 @@ + phy_xaui_rx_polarity_flip_103.0=0x0 + phy_xaui_tx_polarity_flip_9.0=0x3 + dport_map_port_72.0=21 + dport_map_port_46.0=41 + xgxs_rx_lane_map_102.0=0x3201 + xgxs_rx_lane_map_103.0=0x3201 + xgxs_tx_lane_map_110.0=0x132 + xgxs_tx_lane_map_111.0=0x132 + portmap_55.0=55:50:2 + portmap_29.0=29:50:2 + portmap_102.0=97:50:2 + dport_map_port_55.0=6 + l2xmsg_hostbuf_size.0=8192 + l3_mem_entries.0=73728 + dport_map_port_29.0=89 + portmap_10.0=11:50:2 + xgxs_rx_lane_map_68.0=0x3201 + xgxs_tx_lane_map_68.0=0x3210 + xgxs_rx_lane_map_69.0=0x3201 + xgxs_tx_lane_map_69.0=0x3210 + dport_map_port_119.0=102 + portmap_38.0=37:100 + dport_map_port_10.0=126 + portmap_111.0=107:50:2 + dport_map_port_38.0=33 + phy_xaui_tx_polarity_flip_119.0=0x0 + dport_map_port_100.0=130 + module_64ports.0=0 + portmap_73.0=71:50:2 + xgxs_tx_lane_map_102.0=0x123 + xgxs_tx_lane_map_103.0=0x123 + portmap_47.0=47:50:2 + phy_xaui_rx_polarity_flip_69.0=0x3 + phy_xaui_tx_polarity_flip_100.0=0x6 + phy_xaui_rx_polarity_flip_130.0=0x4 + dport_map_port_73.0=22 + dport_map_port_47.0=42 + phy_xaui_rx_polarity_flip_50.0=0x0 + phy_xaui_tx_polarity_flip_92.0=0x1 + phy_xaui_tx_polarity_flip_66.0=0x6 + portmap_5.0=5:100 + portmap_103.0=99:50:2 + phy_xaui_tx_polarity_flip_21.0=0x3 + tdma_intr_enable.0=1 + phy_xaui_rx_polarity_flip_122.0=0x0 + ipv6_lpm_128b_enable.0=0 + xgxs_rx_lane_map_50.0=0x1023 + xgxs_tx_lane_map_50.0=0x132 + xgxs_rx_lane_map_51.0=0x1023 + xgxs_tx_lane_map_51.0=0x132 + phy_xaui_tx_polarity_flip_30.0=0x2 + phy_xaui_rx_polarity_flip_42.0=0x3 + phy_xaui_tx_polarity_flip_84.0=0x2 + phy_xaui_rx_polarity_flip_96.0=0x3 + phy_xaui_tx_polarity_flip_58.0=0x2 + stat_if_parity_enable.0=1 + dport_map_port_110.0=73 + phy_xaui_rx_polarity_flip_51.0=0x3 + phy_xaui_tx_polarity_flip_13.0=0x0 + phy_xaui_rx_polarity_flip_25.0=0x2 + oversubscribe_mode=1 + xgxs_rx_lane_map_130.0=0x1023 + phy_xaui_tx_polarity_flip_93.0=0x1 + phy_xaui_tx_polarity_flip_110.0=0x3 + phy_xaui_rx_polarity_flip_114.0=0x0 + portmap_130.0=125:100 + xgxs_rx_lane_map_42.0=0x3210 + xgxs_tx_lane_map_42.0=0x132 + xgxs_rx_lane_map_43.0=0x3210 + xgxs_tx_lane_map_43.0=0x132 + phy_xaui_tx_polarity_flip_22.0=0x3 + phy_xaui_rx_polarity_flip_34.0=0xa + xgxs_rx_lane_map_96.0=0x3210 + xgxs_tx_lane_map_96.0=0x123 + xgxs_rx_lane_map_97.0=0x3210 + xgxs_tx_lane_map_97.0=0x123 + portmap_92.0=89:50:2 + phy_xaui_tx_polarity_flip_76.0=0x0 + portmap_66.0=129:10 + phy_xaui_rx_polarity_flip_88.0=0x1 + phy_xaui_tx_polarity_flip_1.0=0x3 + phy_xaui_rx_polarity_flip_123.0=0x3 + bcm_tunnel_term_compatible_mode.0=1 + dport_map_port_92.0=57 + dport_map_port_66.0=129 + xgxs_rx_lane_map_25.0=0x2310 + xgxs_tx_lane_map_25.0=0x2130 + xgxs_rx_lane_map_26.0=0x2310 + xgxs_tx_lane_map_26.0=0x2130 + dport_map_port_102.0=65 + portmap_21.0=21:50:2 + phy_xaui_rx_polarity_flip_43.0=0x3 + table_dma_enable.0=1 + phy_xaui_rx_polarity_flip_17.0=0x1 + xgxs_rx_lane_map_122.0=0x3201 + xgxs_rx_lane_map_123.0=0x3201 + phy_xaui_tx_polarity_flip_85.0=0x1 + xgxs_tx_lane_map_130.0=0x132 + phy_xaui_rx_polarity_flip_97.0=0x2 + phy_xaui_tx_polarity_flip_59.0=0x2 + dport_map_port_21.0=81 + phy_xaui_tx_polarity_flip_102.0=0x3 + phy_xaui_rx_polarity_flip_106.0=0x1 + portmap_122.0=117:50:2 + xgxs_rx_lane_map_34.0=0x1302 + xgxs_tx_lane_map_34.0=0x2031 + dport_map_port_111.0=74 + portmap_30.0=31:50:2 + phy_xaui_tx_polarity_flip_14.0=0x3 + phy_xaui_rx_polarity_flip_26.0=0x0 + xgxs_rx_lane_map_88.0=0x213 + xgxs_rx_lane_map_89.0=0x213 + dport_map_port_9.0=125 + xgxs_tx_lane_map_88.0=0x1032 + xgxs_tx_lane_map_89.0=0x1032 + xgxs_tx_lane_map_5.0=0x213 + portmap_84.0=81:50:2 + phy_xaui_tx_polarity_flip_68.0=0x2 + portmap_58.0=57:50:2 + dport_map_port_30.0=90 + phy_xaui_tx_polarity_flip_111.0=0x3 + phy_xaui_rx_polarity_flip_115.0=0x0 + dport_map_port_84.0=49 + dport_map_port_58.0=9 + xgxs_rx_lane_map_17.0=0x2103 + xgxs_tx_lane_map_17.0=0x3102 + xgxs_rx_lane_map_18.0=0x2103 + xgxs_tx_lane_map_18.0=0x3102 + portmap_13.0=13:50:2 + xgxs_rx_lane_map_114.0=0x3210 + xgxs_rx_lane_map_115.0=0x3210 + portmap_93.0=91:50:2 + xgxs_tx_lane_map_122.0=0x2310 + xgxs_tx_lane_map_123.0=0x2310 + phy_xaui_rx_polarity_flip_89.0=0x3 + dport_map_port_13.0=121 + schan_intr_enable.0=0 + portmap_114.0=109:50:2 + dport_map_port_93.0=58 + dport_map_port_103.0=66 + portmap_22.0=23:50:2 + phy_xaui_rx_polarity_flip_18.0=0x1 + xgxs_rx_lane_map_5.0=0x1203 + portmap_76.0=73:100 + phy_xaui_rx_polarity_flip_5.0=0x7 + dport_map_port_22.0=82 + phy_xaui_tx_polarity_flip_103.0=0x3 + phy_xaui_rx_polarity_flip_107.0=0x3 + portmap_123.0=119:50:2 + os.0=unix + dport_map_port_76.0=25 + parity_enable.0=1 + xgxs_rx_lane_map_106.0=0x213 + xgxs_rx_lane_map_107.0=0x213 + portmap_85.0=83:50:2 + phy_xaui_tx_polarity_flip_69.0=0x0 + xgxs_tx_lane_map_114.0=0x123 + xgxs_tx_lane_map_115.0=0x123 + portmap_59.0=59:50:2 + pbmp_oversubscribe.0=0x3fffffffdffffffff7fffffffdfffffffe + portmap_106.0=101:50:2 + dport_map_port_85.0=50 + dport_map_port_59.0=10 + tdma_timeout_usec=1000000 + phy_xaui_tx_polarity_flip_50.0=0x2 + phy_xaui_rx_polarity_flip_62.0=0x3 + portmap_14.0=15:50:2 + portmap_68.0=65:50:2 + dport_map_port_14.0=122 + portmap_115.0=111:50:2 + dport_map_port_68.0=17 + dport_map_port_130.0=105 + xgxs_tx_lane_map_106.0=0x123 + xgxs_tx_lane_map_107.0=0x123 + lls_num_l2uc.0=10 + phy_xaui_tx_polarity_flip_130.0=0xb + os=unix + xgxs_rx_lane_map_62.0=0x1302 + xgxs_tx_lane_map_62.0=0x3201 + xgxs_rx_lane_map_63.0=0x1302 + xgxs_tx_lane_map_63.0=0x3201 + phy_xaui_rx_polarity_flip_80.0=0xd + phy_xaui_tx_polarity_flip_42.0=0x2 + phy_xaui_rx_polarity_flip_54.0=0x1 + phy_xaui_tx_polarity_flip_96.0=0x0 + miim_intr_enable.0=0 + portmap_9.0=9:50:2 + portmap_107.0=103:50:2 + dport_map_port_122.0=97 + phy_xaui_tx_polarity_flip_51.0=0x3 + phy_xaui_rx_polarity_flip_63.0=0x3 + phy_xaui_tx_polarity_flip_25.0=0x2 + portmap_69.0=67:50:2 + phy_xaui_tx_polarity_flip_122.0=0x3 + phy_xaui_rx_polarity_flip_126.0=0x7 + xgxs_rx_lane_map_80.0=0x2301 + dport_map_port_69.0=18 + xgxs_rx_lane_map_54.0=0x1302 + xgxs_rx_lane_map_55.0=0x1302 + dport_map_port_1.0=117 + xgxs_tx_lane_map_80.0=0x1320 + xgxs_tx_lane_map_54.0=0x2301 + xgxs_tx_lane_map_55.0=0x2301 + table_dma_enable=1 + portmap_50.0=49:50:2 + phy_xaui_rx_polarity_flip_72.0=0x2 + phy_xaui_tx_polarity_flip_34.0=0xb + phy_xaui_rx_polarity_flip_46.0=0x3 + phy_xaui_tx_polarity_flip_88.0=0x3 + dport_map_port_50.0=1 + l2_mem_entries.0=73728 + l2xmsg_mode.0=1 + dport_map_port_114.0=77 + phy_xaui_tx_polarity_flip_43.0=0x1 + phy_xaui_rx_polarity_flip_55.0=0x3 + phy_xaui_tx_polarity_flip_17.0=0x3 + phy_xaui_rx_polarity_flip_29.0=0x0 + phy_xaui_tx_polarity_flip_97.0=0x2 + phy_xaui_tx_polarity_flip_114.0=0x3 + phy_xaui_rx_polarity_flip_118.0=0x0 + phy_xaui_rx_polarity_flip_10.0=0x2 + xgxs_rx_lane_map_72.0=0x1302 + xgxs_rx_lane_map_73.0=0x1302 + xgxs_rx_lane_map_46.0=0x2103 + xgxs_rx_lane_map_47.0=0x2103 + xgxs_tx_lane_map_72.0=0x2301 + xgxs_tx_lane_map_73.0=0x2301 + xgxs_tx_lane_map_46.0=0x1023 + xgxs_tx_lane_map_47.0=0x1023 + dport_map_port_123.0=98 + portmap_42.0=41:50:2 + phy_xaui_tx_polarity_flip_26.0=0x2 + phy_xaui_rx_polarity_flip_38.0=0xd + portmap_96.0=93:50:2 + phy_xaui_tx_polarity_flip_5.0=0x8 + dport_map_port_42.0=45 + phy_xaui_tx_polarity_flip_123.0=0x3 + dport_map_port_96.0=61 + xgxs_rx_lane_map_29.0=0x2301 + xgxs_tx_lane_map_29.0=0x1023 + xgxs_rx_lane_map_30.0=0x2301 + xgxs_tx_lane_map_30.0=0x1023 + dport_map_port_106.0=69 + portmap_51.0=51:50:2 + phy_xaui_rx_polarity_flip_73.0=0x0 + portmap_25.0=25:50:2 + phy_xaui_rx_polarity_flip_47.0=0x1 + xgxs_rx_lane_map_126.0=0x213 + phy_xaui_tx_polarity_flip_89.0=0x3 + dport_map_port_51.0=2 + dport_map_port_25.0=93 + phy_xaui_tx_polarity_flip_106.0=0x3 + portmap_126.0=121:100 + xgxs_rx_lane_map_38.0=0x312 + xgxs_tx_lane_map_38.0=0x1032 + dport_map_port_115.0=78 + portmap_34.0=33:100 + phy_xaui_tx_polarity_flip_18.0=0x3 + pbmp_xport_xe.0=0x3fffffffdffffffff7fffffffdfffffffe + xgxs_tx_lane_map_9.0=0x123 + xgxs_tx_lane_map_10.0=0x123 + portmap_88.0=85:50:2 + max_vp_lags.0=0 + dport_map_port_34.0=37 + phy_xaui_tx_polarity_flip_115.0=0x3 + phy_xaui_rx_polarity_flip_119.0=0x2 + dport_map_port_88.0=53 + portmap_43.0=43:50:2 + portmap_17.0=17:50:2 + phy_xaui_rx_polarity_flip_100.0=0xf + xgxs_rx_lane_map_118.0=0x123 + xgxs_rx_lane_map_119.0=0x123 + portmap_97.0=95:50:2 + xgxs_tx_lane_map_126.0=0x123 + dport_map_port_43.0=46 + dport_map_port_17.0=85 + portmap_118.0=113:50:2 + dport_map_port_97.0=62 + num_ipv6_lpm_128b_entries.0=0 + phy_xaui_tx_polarity_flip_62.0=0x3 + dport_map_port_107.0=70 + portmap_26.0=27:50:2 + xgxs_rx_lane_map_9.0=0x213 + xgxs_rx_lane_map_10.0=0x213 + portmap_1.0=1:100 + phy_xaui_rx_polarity_flip_9.0=0x0 + dport_map_port_26.0=94 + phy_xaui_tx_polarity_flip_107.0=0x3 + portmap_89.0=87:50:2 + xgxs_tx_lane_map_118.0=0x2013 + xgxs_tx_lane_map_119.0=0x2013 + dport_map_port_89.0=54 + phy_xaui_tx_polarity_flip_80.0=0xa + phy_xaui_rx_polarity_flip_92.0=0x0 + phy_xaui_tx_polarity_flip_54.0=0x2 + phy_xaui_rx_polarity_flip_66.0=0xf + portmap_18.0=19:50:2 + dport_map_port_18.0=86 + portmap_119.0=115:50:2 + phy_xaui_rx_polarity_flip_21.0=0x0 + xgxs_rx_lane_map_100.0=0x3210 + phy_xaui_tx_polarity_flip_63.0=0x2 + phy_xaui_rx_polarity_flip_110.0=0x3 + portmap_100.0=131:10 + phy_xaui_rx_polarity_flip_30.0=0x0 + xgxs_rx_lane_map_92.0=0x3210 + xgxs_rx_lane_map_93.0=0x3210 + xgxs_rx_lane_map_66.0=0x3210 + xgxs_tx_lane_map_92.0=0x132 + xgxs_tx_lane_map_93.0=0x132 + xgxs_tx_lane_map_66.0=0x132 + phy_xaui_tx_polarity_flip_72.0=0x0 + portmap_62.0=61:50:2 + phy_xaui_rx_polarity_flip_84.0=0x3 + phy_xaui_tx_polarity_flip_46.0=0x2 + phy_xaui_rx_polarity_flip_58.0=0x2 + tdma_intr_enable=1 + dport_map_port_62.0=13 + xgxs_rx_lane_map_21.0=0x3102 + xgxs_rx_lane_map_22.0=0x3102 + xgxs_tx_lane_map_21.0=0x132 + xgxs_tx_lane_map_22.0=0x132 + phy_xaui_rx_polarity_flip_13.0=0x0 + tdma_timeout_usec.0=5000000 + dport_map_port_126.0=109 + phy_xaui_rx_polarity_flip_93.0=0x1 + phy_xaui_tx_polarity_flip_55.0=0x0 + xgxs_tx_lane_map_100.0=0x132 + phy_xaui_tx_polarity_flip_29.0=0x3 + phy_xaui_rx_polarity_flip_102.0=0x2 + parity_correction.0=1 + phy_xaui_tx_polarity_flip_126.0=0x7 + phy_xaui_tx_polarity_flip_10.0=0x0 + phy_xaui_rx_polarity_flip_22.0=0x0 + xgxs_rx_lane_map_84.0=0x2301 + xgxs_rx_lane_map_85.0=0x2301 + xgxs_rx_lane_map_58.0=0x1203 + xgxs_rx_lane_map_59.0=0x1203 + dport_map_port_5.0=113 + xgxs_tx_lane_map_84.0=0x213 + xgxs_tx_lane_map_85.0=0x213 + xgxs_tx_lane_map_58.0=0x123 + xgxs_tx_lane_map_59.0=0x123 + mmu_lossless.0=0 + xgxs_tx_lane_map_1.0=0x123 + portmap_80.0=77:100 + portmap_54.0=53:50:2 + phy_xaui_rx_polarity_flip_76.0=0x2 + phy_xaui_tx_polarity_flip_38.0=0x0 + phy_xaui_rx_polarity_flip_111.0=0x3 + dport_map_port_80.0=29 + dport_map_port_54.0=5 + xgxs_rx_lane_map_13.0=0x3201 + xgxs_rx_lane_map_14.0=0x3201 + xgxs_tx_lane_map_13.0=0x2301 + xgxs_tx_lane_map_14.0=0x2301 + xgxs_rx_lane_map_110.0=0x3210 + xgxs_rx_lane_map_111.0=0x3210 + phy_xaui_tx_polarity_flip_73.0=0x0 + dport_map_port_118.0=101 + portmap_63.0=63:50:2 + phy_xaui_rx_polarity_flip_85.0=0x3 + phy_xaui_tx_polarity_flip_47.0=0x3 + phy_xaui_rx_polarity_flip_59.0=0x0 + portmap_110.0=105:50:2 + dport_map_port_63.0=14 + phy_xaui_tx_polarity_flip_118.0=0x0 + phy_xaui_rx_polarity_flip_14.0=0x3 + xgxs_rx_lane_map_76.0=0x1203 + xgxs_tx_lane_map_76.0=0x123 + xgxs_rx_lane_map_1.0=0x213 + portmap_72.0=69:50:2 + portmap_46.0=45:50:2 + phy_xaui_rx_polarity_flip_68.0=0x0 + phy_xaui_rx_polarity_flip_1.0=0x9 + +mmu_init_config="MSFT-TH-Tier0" From d261506f84acd565d2cb8e2f564b72d7b166450f Mon Sep 17 00:00:00 2001 From: Harish Venkatraman Date: Mon, 21 May 2018 13:57:37 -0700 Subject: [PATCH 198/274] [device/dell] Add z9100 pfc T1 support (#1707) This commit adds new code to support z9100 PFC T1 support with broadcom recommended MMU settings for PFC feature. Unit tested the setting by loading sonic-broadcom.bin and checking the hardware for the values from the JSON file. Added the config.bcm file th-z9100-32x100G.config.bcm to this folder and updated the sai.profile file to point to hwsku directory. sai.profile now points to /usr/share/sonic/hwsku/th-z9100-32x100G.config.bcm Signed-off-by: Harish Venkatraman --- .../Force10-Z9100/buffers.json.j2 | 2 + .../Force10-Z9100/buffers_defaults_t1.j2 | 47 ++++ .../Force10-Z9100/pg_profile_lookup.ini | 17 ++ .../Force10-Z9100/qos.json | 167 +++++++++++++ .../Force10-Z9100/sai.profile | 2 +- .../Force10-Z9100/th-z9100-32x100G.config.bcm | 222 ++++++++++++++++++ 6 files changed, 456 insertions(+), 1 deletion(-) create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/buffers.json.j2 create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/buffers_defaults_t1.j2 create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/pg_profile_lookup.ini create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/th-z9100-32x100G.config.bcm diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/buffers.json.j2 b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/buffers.json.j2 new file mode 100644 index 000000000000..0b1cb2c541b6 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't1' %} +{%- include 'buffers_config.j2' %} diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/buffers_defaults_t1.j2 b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..5c654ab9e8a1 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/buffers_defaults_t1.j2 @@ -0,0 +1,47 @@ + +{%- set default_cable = '40m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx*4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "10443264", + "type": "ingress", + "mode": "dynamic", + "xoff": "4625920" + }, + "egress_lossy_pool": { + "size": "8877440", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"1518", + "static_th":"3995680" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/pg_profile_lookup.ini b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/pg_profile_lookup.ini new file mode 100644 index 000000000000..7222f8014925 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 1248 2288 35776 -4 2288 + 25000 5m 1248 2288 53248 -4 2288 + 40000 5m 1248 2288 66560 -4 2288 + 50000 5m 1248 2288 79872 -4 2288 + 100000 5m 1248 2288 165568 -4 2288 + 10000 40m 1248 2288 37024 -4 2288 + 25000 40m 1248 2288 56160 -4 2288 + 40000 40m 1248 2288 71552 -4 2288 + 50000 40m 1248 2288 85696 -4 2288 + 100000 40m 1248 2288 177632 -4 2288 + 10000 300m 1248 2288 46176 -4 2288 + 25000 300m 1248 2288 79040 -4 2288 + 40000 300m 1248 2288 108160 -4 2288 + 50000 300m 1248 2288 131456 -4 2288 + 100000 300m 1248 2288 268736 -4 2288 diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json new file mode 100644 index 000000000000..b724b48c2c23 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json @@ -0,0 +1,167 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"512000", + "red_min_threshold":"512000", + "yellow_max_threshold":"512000", + "yellow_min_threshold":"512000", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + }, + "AZURE_LOSSLESS" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"512000", + "red_min_threshold":"512000", + "yellow_max_threshold":"512000", + "yellow_min_threshold":"512000", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1" : { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { + "scheduler" : "[SCHEDULER|scheduler.0]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1" : { + "scheduler" : "[SCHEDULER|scheduler.2]" + } + } +} diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/sai.profile b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/sai.profile index 2c9a6e54c1ac..a690c3ff8b94 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/sai.profile +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-z9100-32x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-z9100-32x100G.config.bcm diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/th-z9100-32x100G.config.bcm b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/th-z9100-32x100G.config.bcm new file mode 100644 index 000000000000..a1c51ef225f1 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/th-z9100-32x100G.config.bcm @@ -0,0 +1,222 @@ +#TH Z9100 32x100 +l3_alpm_enable=2 +bcm_num_cos=8 +switch_bypass_mode=0 +mmu_lossless=0 +lpm_scaling_enable=0 +lpm_ipv6_128b_reserved=0 +ipv6_lpm_128b_enable=1 + +os=unix + +#Parity +parity_correction=1 +parity_enable=1 + +scache_filename=/tmp/scache + +#Port configuration +portmap_38=49:100 +portmap_39=53:100 +portmap_40=57:100 +portmap_41=61:100 +portmap_68=65:100 +portmap_69=69:100 +portmap_70=73:100 +portmap_71=77:100 +portmap_35=37:100 +portmap_34=33:100 +portmap_37=45:100 +portmap_36=41:100 +portmap_72=81:100 +portmap_73=85:100 +portmap_74=89:100 +portmap_75=93:100 +portmap_102=97:100 +portmap_103=101:100 +portmap_104=105:100 +portmap_105=109:100 +portmap_6=21:100 +portmap_5=17:100 +portmap_8=29:100 +portmap_7=25:100 +portmap_107=117:100 +portmap_106=113:100 +portmap_109=125:100 +portmap_108=121:100 +portmap_2=5:100 +portmap_1=1:100 +portmap_4=13:100 +portmap_3=9:100 +portmap_66=129:10 +portmap_100=131:10 +portmap_33=132:10 +portmap_67=133:10 +portmap_101=134:10 +portmap_135=135:10 +xgxs_tx_lane_map_ce0=0x0132 +xgxs_rx_lane_map_ce0=0x1023 +phy_xaui_tx_polarity_flip_ce0=0xe +phy_xaui_rx_polarity_flip_ce0=0xc +xgxs_tx_lane_map_ce1=0x2301 +xgxs_rx_lane_map_ce1=0x1302 +phy_xaui_tx_polarity_flip_ce1=0x2 +phy_xaui_rx_polarity_flip_ce1=0xd +xgxs_tx_lane_map_ce2=0x0123 +xgxs_rx_lane_map_ce2=0x1203 +phy_xaui_tx_polarity_flip_ce2=0xa +phy_xaui_rx_polarity_flip_ce2=0x2 +xgxs_tx_lane_map_ce3=0x3201 +xgxs_rx_lane_map_ce3=0x1302 +phy_xaui_tx_polarity_flip_ce3=0xb +phy_xaui_rx_polarity_flip_ce3=0xf +xgxs_tx_lane_map_ce4=0x3210 +xgxs_rx_lane_map_ce4=0x3201 +phy_xaui_tx_polarity_flip_ce4=0x2 +phy_xaui_rx_polarity_flip_ce4=0xc +xgxs_tx_lane_map_ce5=0x2301 +xgxs_rx_lane_map_ce5=0x1302 +phy_xaui_tx_polarity_flip_ce5=0x0 +phy_xaui_rx_polarity_flip_ce5=0x2 +xgxs_tx_lane_map_ce6=0x0123 +xgxs_rx_lane_map_ce6=0x1203 +phy_xaui_tx_polarity_flip_ce6=0x0 +phy_xaui_rx_polarity_flip_ce6=0x2 +xgxs_tx_lane_map_ce7=0x1320 +xgxs_rx_lane_map_ce7=0x2301 +phy_xaui_tx_polarity_flip_ce7=0xa +phy_xaui_rx_polarity_flip_ce7=0xd +xgxs_tx_lane_map_ce8=0x1032 +xgxs_rx_lane_map_ce8=0x0312 +phy_xaui_tx_polarity_flip_ce8=0x0 +phy_xaui_rx_polarity_flip_ce8=0xd +xgxs_tx_lane_map_ce9=0x2031 +xgxs_rx_lane_map_ce9=0x1302 +phy_xaui_tx_polarity_flip_ce9=0xb +phy_xaui_rx_polarity_flip_ce9=0xa +xgxs_tx_lane_map_ce10=0x1023 +xgxs_rx_lane_map_ce10=0x2103 +phy_xaui_tx_polarity_flip_ce10=0xe +phy_xaui_rx_polarity_flip_ce10=0x7 +xgxs_tx_lane_map_ce11=0x0132 +xgxs_rx_lane_map_ce11=0x3210 +phy_xaui_tx_polarity_flip_ce11=0x6 +phy_xaui_rx_polarity_flip_ce11=0xf +xgxs_tx_lane_map_ce12=0x0213 +xgxs_rx_lane_map_ce12=0x2301 +phy_xaui_tx_polarity_flip_ce12=0x6 +phy_xaui_rx_polarity_flip_ce12=0xf +xgxs_tx_lane_map_ce13=0x1032 +xgxs_rx_lane_map_ce13=0x0213 +phy_xaui_tx_polarity_flip_ce13=0xf +phy_xaui_rx_polarity_flip_ce13=0xd +xgxs_tx_lane_map_ce14=0x0132 +xgxs_rx_lane_map_ce14=0x3210 +phy_xaui_tx_polarity_flip_ce14=0x5 +phy_xaui_rx_polarity_flip_ce14=0x4 +xgxs_tx_lane_map_ce15=0x0123 +xgxs_rx_lane_map_ce15=0x3210 +phy_xaui_tx_polarity_flip_ce15=0x8 +phy_xaui_rx_polarity_flip_ce15=0xb +xgxs_tx_lane_map_ce16=0x0123 +xgxs_rx_lane_map_ce16=0x3201 +phy_xaui_tx_polarity_flip_ce16=0xf +phy_xaui_rx_polarity_flip_ce16=0x2 +xgxs_tx_lane_map_ce17=0x0123 +xgxs_rx_lane_map_ce17=0x0213 +phy_xaui_tx_polarity_flip_ce17=0xf +phy_xaui_rx_polarity_flip_ce17=0xd +xgxs_tx_lane_map_ce18=0x1032 +xgxs_rx_lane_map_ce18=0x3210 +phy_xaui_tx_polarity_flip_ce18=0xf +phy_xaui_rx_polarity_flip_ce18=0xf +xgxs_tx_lane_map_ce19=0x0123 +xgxs_rx_lane_map_ce19=0x3210 +phy_xaui_tx_polarity_flip_ce19=0xf +phy_xaui_rx_polarity_flip_ce19=0x0 +xgxs_tx_lane_map_ce20=0x2301 +xgxs_rx_lane_map_ce20=0x3102 +phy_xaui_tx_polarity_flip_ce20=0xf +phy_xaui_rx_polarity_flip_ce20=0x0 +xgxs_tx_lane_map_ce21=0x3102 +xgxs_rx_lane_map_ce21=0x2103 +phy_xaui_tx_polarity_flip_ce21=0xf +phy_xaui_rx_polarity_flip_ce21=0x5 +xgxs_tx_lane_map_ce22=0x1023 +xgxs_rx_lane_map_ce22=0x2301 +phy_xaui_tx_polarity_flip_ce22=0xb +phy_xaui_rx_polarity_flip_ce22=0x0 +xgxs_tx_lane_map_ce23=0x2130 +xgxs_rx_lane_map_ce23=0x2310 +phy_xaui_tx_polarity_flip_ce23=0xa +phy_xaui_rx_polarity_flip_ce23=0x2 +xgxs_tx_lane_map_ce24=0x2310 +xgxs_rx_lane_map_ce24=0x3201 +phy_xaui_tx_polarity_flip_ce24=0xf +phy_xaui_rx_polarity_flip_ce24=0xc +xgxs_tx_lane_map_ce25=0x2013 +xgxs_rx_lane_map_ce25=0x0123 +phy_xaui_tx_polarity_flip_ce25=0x0 +phy_xaui_rx_polarity_flip_ce25=0x8 +xgxs_tx_lane_map_ce26=0x0132 +xgxs_rx_lane_map_ce26=0x1023 +phy_xaui_tx_polarity_flip_ce26=0xb +phy_xaui_rx_polarity_flip_ce26=0x4 +xgxs_tx_lane_map_ce27=0x0123 +xgxs_rx_lane_map_ce27=0x0213 +phy_xaui_tx_polarity_flip_ce27=0x7 +phy_xaui_rx_polarity_flip_ce27=0x7 +xgxs_tx_lane_map_ce28=0x0213 +xgxs_rx_lane_map_ce28=0x1203 +phy_xaui_tx_polarity_flip_ce28=0x8 +phy_xaui_rx_polarity_flip_ce28=0x7 +xgxs_tx_lane_map_ce29=0x0123 +xgxs_rx_lane_map_ce29=0x0213 +phy_xaui_tx_polarity_flip_ce29=0x3 +phy_xaui_rx_polarity_flip_ce29=0x9 +xgxs_tx_lane_map_ce30=0x2301 +xgxs_rx_lane_map_ce30=0x3201 +phy_xaui_tx_polarity_flip_ce30=0xc +phy_xaui_rx_polarity_flip_ce30=0xc +xgxs_tx_lane_map_ce31=0x0123 +xgxs_rx_lane_map_ce31=0x0213 +phy_xaui_tx_polarity_flip_ce31=0x3 +phy_xaui_rx_polarity_flip_ce31=0x8 +dport_map_port_38=1 +dport_map_port_39=2 +dport_map_port_40=3 +dport_map_port_41=4 +dport_map_port_68=5 +dport_map_port_69=6 +dport_map_port_70=7 +dport_map_port_71=8 +dport_map_port_35=9 +dport_map_port_34=10 +dport_map_port_37=11 +dport_map_port_36=12 +dport_map_port_72=13 +dport_map_port_73=14 +dport_map_port_74=15 +dport_map_port_75=16 +dport_map_port_102=17 +dport_map_port_103=18 +dport_map_port_104=19 +dport_map_port_105=20 +dport_map_port_6=21 +dport_map_port_5=22 +dport_map_port_8=23 +dport_map_port_7=24 +dport_map_port_107=25 +dport_map_port_106=26 +dport_map_port_109=27 +dport_map_port_108=28 +dport_map_port_2=29 +dport_map_port_1=30 +dport_map_port_4=31 +dport_map_port_3=32 +oversubscribe_mode=1 +pbmp_xport_xe=0x3fd000000ff4000003fc000001fe +serdes_if_type_xe=14 +serdes_if_type_ce=14 + +mmu_init_config="MSFT-TH-Tier1" From c055dd232fd2c47d9e1a2ad87b2502ae6d8ef68b Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 22 May 2018 14:53:35 -0700 Subject: [PATCH 199/274] [submodule]: Update submodule sonic-snmpagent: power_status_handler handles missing PSU (#1732) --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index f28315252698..bf1b165458e4 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit f28315252698aabc927eca84b836493385fcf4a1 +Subproject commit bf1b165458e4e19286d245a3398921057f4df21c From ea465db0464ed7d09cca62531852482226fae6c2 Mon Sep 17 00:00:00 2001 From: Wirut Getbamrung Date: Wed, 23 May 2018 16:55:29 +0700 Subject: [PATCH 200/274] [devices]: update dx010 fan configuration (#1735) --- .../celestica/x86_64-cel_seastone-r0/sensors.conf | 14 ++++++++++++++ platform/broadcom/sonic-platform-modules-cel | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/device/celestica/x86_64-cel_seastone-r0/sensors.conf b/device/celestica/x86_64-cel_seastone-r0/sensors.conf index e25717ac589f..11461a0afef9 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sensors.conf +++ b/device/celestica/x86_64-cel_seastone-r0/sensors.conf @@ -62,3 +62,17 @@ chip "dx010_lm75b-i2c-*-4e" label temp1 "Rear-panel temp sensor 2" set temp1_max 43 set temp1_max_hyst 28 + +chip "emc2305-i2c-*-2e" + label fan2 "fan1" + label fan1 "fan2" + label fan4 "fan3" + label fan5 "fan4" + label fan3 "fan5" + +chip "emc2305-i2c-*-4d" + label fan2 "fan1" + label fan4 "fan2" + label fan5 "fan3" + label fan3 "fan4" + label fan1 "fan5" diff --git a/platform/broadcom/sonic-platform-modules-cel b/platform/broadcom/sonic-platform-modules-cel index 190d0b71ac19..7875e46964fc 160000 --- a/platform/broadcom/sonic-platform-modules-cel +++ b/platform/broadcom/sonic-platform-modules-cel @@ -1 +1 @@ -Subproject commit 190d0b71ac1902679e2d720368e100d78eb09f3e +Subproject commit 7875e46964fcc329ff92a80c379c026da530221f From 6fc38af2f0f568b874d784820e1133f26df58887 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 23 May 2018 17:57:38 -0700 Subject: [PATCH 201/274] Remove fan LED initialization from led_control plugins for Arista 7050-QX32, 7050-QX-32S (#1733) --- .../x86_64-arista_7050_qx32/plugins/led_control.py | 10 ---------- .../x86_64-arista_7050_qx32s/plugins/led_control.py | 11 ----------- 2 files changed, 21 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py b/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py index 1f6034e2e2eb..31effbaf11c6 100644 --- a/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py +++ b/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py @@ -85,16 +85,6 @@ def __init__(self): with open("/sys/class/leds/psu2/brightness", "w") as f: f.write("1") - # Initialize all fan LEDs to green - with open("/sys/devices/platform/sb800-fans/hwmon/hwmon1/fan1_led", "w") as f: - f.write("3") - with open("/sys/devices/platform/sb800-fans/hwmon/hwmon1/fan2_led", "w") as f: - f.write("3") - with open("/sys/devices/platform/sb800-fans/hwmon/hwmon1/fan3_led", "w") as f: - f.write("3") - with open("/sys/devices/platform/sb800-fans/hwmon/hwmon1/fan4_led", "w") as f: - f.write("3") - # Initialize: Turn all front panel QSFP LEDs off for qsfp_index in range(self.QSFP_BREAKOUT_START_IDX, self.QSFP_BREAKOUT_END_IDX + 1): for lane in range(1, 5): diff --git a/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py b/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py index 8fa0c63a473a..6424516a59d9 100644 --- a/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py +++ b/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py @@ -80,17 +80,6 @@ def __init__(self): with open("/sys/class/leds/psu2/brightness", "w") as f: f.write("1") - # Initialize all fan LEDs to green - with open("/sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060/hwmon/hwmon4/fan1_led", "w") as f: - f.write("1") - with open("/sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060/hwmon/hwmon4/fan2_led", "w") as f: - f.write("1") - with open("/sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060/hwmon/hwmon4/fan3_led", "w") as f: - f.write("1") - with open("/sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060/hwmon/hwmon4/fan4_led", "w") as f: - f.write("1") - - # Initialize: Turn all front panel QSFP LEDs off for qsfp_index in range(self.QSFP_BREAKOUT_START_IDX, self.QSFP_BREAKOUT_END_IDX + 1): for lane in range(1, 5): From d32c04348657d18dbac4a52a08bdb630ef8a14ca Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Thu, 24 May 2018 11:05:38 -0700 Subject: [PATCH 202/274] [sonic-cfggen]: Protect config_db.json from minigraph misconfig (#1727) * Add noise config for PortChannel & EthernetInterface in simple-sample-graph.xml * Add noise config for PORTCHANNEL_INTERFACE in simple-sample-graph.xml Signed-off-by: Wenda * Add noice config for DEVICE_NEIGHBOR in t0-sample-graph.xml Add unit test against introducing ports not existing in port_config.ini into DEVICE_NEIGHBOR Signed-off-by: Wenda * DeviceInterfaceLink in minigraph.xml can contain port not existing in port_config.ini but contraining non-zero Bandwidth attribute Add noice config in simple-sample-graph.xml to capture the case that such a port is leaked into config_db.json Signed-off-by: Wenda * Protect PORTCHANNEL from ports not existing in port_config.ini Signed-off-by: Wenda * Protect PORTCHANNEL_INTERFACE from portchannels containing ports not existing in port_config.ini Signed-off-by: Wenda * Protect DEVICE_NEIGHBOR from ports not existing in port_config.ini Signed-off-by: Wenda * Add noise config Ethernet1 in DeviceInterfaceLinks in simple-sample-graph.xml as it is in PortChannel1001 Signed-off-by: Wenda * Add noise config Ethernet1 in DeviceInterfaceLinks in simple-sample-graph.xml as it is in PortChannel1001 Signed-off-by: Wenda * Protect PORTCHANNEL from ports not existing in port_config.ini Signed-off-by: Wenda * Protect PORTCHANNEL_INTERFACE from portchannels containing ports not existing in port_config.ini Signed-off-by: Wenda * Protect DEVICE_NEIGHBOR from ports not existing in port_config.ini Signed-off-by: Wenda * Correct space in minigraph.py Signed-off-by: Wenda * Does not allow non-port_config.ini port to get into the port list Signed-off-by: Wenda * Check PORTCHANNEL against PORT list only if port_config_file exists Signed-off-by: Wenda * Correct format Signed-off-by: Wenda * print warning when a port coming from DeviceInterfaceLink is not in port_config.ini Signed-off-by: Wenda * Change Ethernet1 and 2 to fortyGigE0/1 and 2,respectively Signed-off-by: Wenda * Change Ethernet1 and 2 to fortyGigE0/1 and 2,respectively Signed-off-by: Wenda * print warning when ignoring ports, portchannels, portchannel interfaces, and device neighbors Update t0-sample-graph.xml with interface name 'fortyGigE0/2' and the ACL_TABLE output Signed-off-by: Wenda --- src/sonic-config-engine/minigraph.py | 37 +++++++++++-- .../tests/simple-sample-graph.xml | 52 ++++++++++++++++++- .../tests/t0-sample-graph.xml | 11 ++++ src/sonic-config-engine/tests/test_cfggen.py | 11 ++++ 4 files changed, 105 insertions(+), 6 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 443893c66c25..595915d9bee9 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -414,7 +414,7 @@ def parse_xml(filename, platform=None, port_config_file=None): (port_speeds_default, port_descriptions) = parse_deviceinfo(child, hwsku) current_device = [devices[key] for key in devices if key.lower() == hostname.lower()][0] - results = {} + results = {} results['DEVICE_METADATA'] = {'localhost': { 'bgp_asn': bgp_asn, 'deployment_id': deployment_id, @@ -447,7 +447,6 @@ def parse_xml(filename, platform=None, port_config_file=None): results['INTERFACE'] = phyport_intfs results['VLAN_INTERFACE'] = vlan_intfs - results['PORTCHANNEL_INTERFACE'] = pc_intfs for port_name in port_speeds_default: # ignore port not in port_config.ini @@ -457,9 +456,11 @@ def parse_xml(filename, platform=None, port_config_file=None): ports.setdefault(port_name, {})['speed'] = port_speeds_default[port_name] for port_name in port_speed_png: - # if port_name is not in port_config.ini, still consider it. - # and later swss will pick up and behave on-demand port break-up. - # if on-deman port break-up is not supported on a specific platform, swss will return error. + # not consider port not in port_config.ini + if port_name not in ports: + print >> sys.stderr, "Warning: ignore interface '%s' as it is not in the port_config.ini" % port_name + continue + ports.setdefault(port_name, {})['speed'] = port_speed_png[port_name] for port_name, port in ports.items(): @@ -474,10 +475,36 @@ def parse_xml(filename, platform=None, port_config_file=None): ports.setdefault(port_name, {})['description'] = port_descriptions[port_name] results['PORT'] = ports + + if port_config_file: + port_set = set(ports.keys()) + for (pc_name, mbr_map) in pcs.items(): + # remove portchannels that contain ports not existing in port_config.ini + # when port_config.ini exists + if not set(mbr_map['members']).issubset(port_set): + print >> sys.stderr, "Warning: ignore '%s' as part of its member interfaces is not in the port_config.ini" % pc_name + del pcs[pc_name] + results['PORTCHANNEL'] = pcs + + + for pc_intf in pc_intfs.keys(): + # remove portchannels not in PORTCHANNEL dictionary + if pc_intf[0] not in pcs: + print >> sys.stderr, "Warning: ignore '%s' interface '%s' as '%s' is not in the valid PortChannel list" % (pc_intf[0], pc_intf[1], pc_intf[0]) + del pc_intfs[pc_intf] + + results['PORTCHANNEL_INTERFACE'] = pc_intfs + results['VLAN'] = vlans results['VLAN_MEMBER'] = vlan_members + for nghbr in neighbors.keys(): + # remove port not in port_config.ini + if nghbr not in ports: + print >> sys.stderr, "Warning: ignore interface '%s' in DEVICE_NEIGHBOR as it is not in the port_config.ini" % nghbr + del neighbors[nghbr] + results['DEVICE_NEIGHBOR'] = neighbors results['DEVICE_NEIGHBOR_METADATA'] = { key:devices[key] for key in devices if key.lower() != hostname.lower() } results['SYSLOG_SERVER'] = dict((item, {}) for item in syslog_servers) diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index 6e351e1cd003..f5054bb084d3 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -125,6 +125,11 @@ fortyGigE0/4 + + PortChannel1001 + fortyGigE0/1;fortyGigE0/2 + + @@ -147,6 +152,16 @@ PortChannel01 FC00::71/126 + + + PortChannel1001 + 10.0.0.57/31 + + + + PortChannel1001 + FC00::72/126 + fortyGigE0/0 @@ -193,6 +208,28 @@ fortyGigE0/8 true + + DeviceInterfaceLink + true + 10000 + switch-t0 + fortyGigE0/1 + true + ARISTA05T1 + Ethernet1/32 + true + + + DeviceInterfaceLink + true + 10000 + switch-t0 + fortyGigE0/2 + true + ARISTA06T1 + Ethernet1/33 + true +
@@ -240,7 +277,20 @@ true true 1 - fortyGigE0/1 + Ethernet1 + + false + 0 + 0 + 10000 +
+ + DeviceInterface + + true + true + 1 + Ethernet2 false 0 diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index ce0177d4c158..5eace767c468 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -338,6 +338,17 @@ switch-t0 fortyGigE0/124 + + DeviceInterfaceLink + true + 10000 + switch-t0 + fortyGigE0/2 + true + ARISTA05T1 + Ethernet1/33 + true + diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 901b882f7048..37b66a27b4c4 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -79,6 +79,8 @@ def test_minigraph_acl(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v ACL_TABLE' output = self.run_script(argument, True) self.assertEqual(output.strip(), "Warning: Ignoring Control Plane ACL NTP_ACL without type\n" + "Warning: ignore interface 'fortyGigE0/2' as it is not in the port_config.ini\n" + "Warning: ignore interface 'fortyGigE0/2' in DEVICE_NEIGHBOR as it is not in the port_config.ini\n" "{'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL'}," " 'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL'}," " 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}," @@ -130,6 +132,15 @@ def test_minigraph_neighbors(self): output = self.run_script(argument) self.assertEqual(output.strip(), "{'name': 'ARISTA04T1', 'port': 'Ethernet1/1'}") + def test_minigraph_extra_neighbors(self): + argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v DEVICE_NEIGHBOR' + output = self.run_script(argument) + self.assertEqual(output.strip(), \ + "{'Ethernet116': {'name': 'ARISTA02T1', 'port': 'Ethernet1/1'}, " + "'Ethernet124': {'name': 'ARISTA04T1', 'port': 'Ethernet1/1'}, " + "'Ethernet112': {'name': 'ARISTA01T1', 'port': 'Ethernet1/1'}, " + "'Ethernet120': {'name': 'ARISTA03T1', 'port': 'Ethernet1/1'}}") + def test_minigraph_bgp(self): argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v "BGP_NEIGHBOR[\'10.0.0.59\']"' output = self.run_script(argument) From 4d564688bf75aaf0ff9aae44d2a80d18ea51ed63 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 24 May 2018 16:49:24 -0700 Subject: [PATCH 203/274] [broadcom sai] upgrade Broadcom SAI to version 3.1.3.4-12 (#1740) Signed-off-by: Ying Xie --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 572ad5271f10..62181597e7b3 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.4-11_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-11_amd64.deb?sv=2015-04-05&sr=b&sig=0pctCvAKfSqT8O%2FWSMxw532XAXFsxXdKljQqWfOX8xA%3D&se=2155-03-25T07%3A23%3A41Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.4-12_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-12_amd64.deb?sv=2015-04-05&sr=b&sig=iK79gjz8GQnPLU8OSxgzw35MzqmxwAXQg2N%2BalLUos0%3D&se=2032-01-31T20%3A36%3A51Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-11_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-12_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-11_amd64.deb?sv=2015-04-05&sr=b&sig=IO1g%2FdcObkureizN8ZMPqISP6opZXu%2FrHostog6aIrU%3D&se=2155-03-25T08%3A13%3A34Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-12_amd64.deb?sv=2015-04-05&sr=b&sig=tSBPnK%2BK9axdPbkWP19r5ngM0ggRTWWijUIKTl8WNW0%3D&se=2032-01-31T20%3A36%3A11Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From d165a5030aae03d0a834b35dd12455dbd1381ef8 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 24 May 2018 17:31:03 -0700 Subject: [PATCH 204/274] [sairedis] update sairedis sub-module (#1741) Signed-off-by: Ying Xie --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index a314ac45a189..4ef45eed56a4 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit a314ac45a1899fafc913fbf6f1df83cbf5d7d069 +Subproject commit 4ef45eed56a4ec34c225d2a37cc02efc2131033b From bb6ff62a3235763f4449e05f26f5344878c48daa Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 25 May 2018 10:52:35 -0700 Subject: [PATCH 205/274] [service] introducing serial port watchdog service (#1743) * [rc.local] refactor platform identification code to separate function Signed-off-by: Ying Xie * [rc.local] infrastructure to take action according to installer.conf * [serial port watchdog] add service to watch serial port processes Monitor serial port processes. Kill ones stuck for too long. Signed-off-by: Ying Xie * [rc.local] start watchdog on serial port specified by installer.conf Signed-off-by: Ying Xie --- .../build_templates/sonic_debian_extension.j2 | 5 + files/image_config/platform/rc.local | 44 ++- .../serial-port-watchdog.py | 328 ++++++++++++++++++ .../serial-port-watchdog.service | 12 + 4 files changed, 385 insertions(+), 4 deletions(-) create mode 100755 files/image_config/serial-port-watchdog/serial-port-watchdog.py create mode 100644 files/image_config/serial-port-watchdog/serial-port-watchdog.service diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index d0afa4659667..3d46f09aa67a 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -154,6 +154,11 @@ sudo cp $IMAGE_CONFIGS/hostname/hostname-config.service $FILESYSTEM_ROOT/etc/sy sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable hostname-config.service sudo cp $IMAGE_CONFIGS/hostname/hostname-config.sh $FILESYSTEM_ROOT/usr/bin/ +# Copy serial-port-watchdog configuration scripts +sudo cp $IMAGE_CONFIGS/serial-port-watchdog/serial-port-watchdog.service $FILESYSTEM_ROOT/etc/systemd/system/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable serial-port-watchdog.service +sudo cp $IMAGE_CONFIGS/serial-port-watchdog/serial-port-watchdog.py $FILESYSTEM_ROOT/usr/bin/ + # Copy updategraph script and service file sudo cp $IMAGE_CONFIGS/updategraph/updategraph.service $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable updategraph.service diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index de54d141ef7e..ab88b7a3f5b4 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -183,15 +183,51 @@ for x in "$@"; do done } -eval sonic_version=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ") - -if [ -f /host/image-$sonic_version/platform/firsttime ]; then - +setup_platform() +{ if [ -n "$aboot_platform" ]; then platform=$aboot_platform elif [ -n "$onie_platform" ]; then platform=$onie_platform else + platform='' + fi +} + +# Setup default values in this function before reading installer.conf +# installer.conf could override the value set in this function. +setup_platform_defaults() +{ + # Default serial port: ttyS0 + CONSOLE_DEV=0 +} + +load_platform_installer_config() +{ + INSTALLER_CFG=/usr/share/sonic/device/$platform/installer.conf + if [ -f $INSTALLER_CFG ]; then + . $INSTALLER_CFG + fi +} + +program_serial_port() +{ + sed -i "s|ttyS.|ttyS$CONSOLE_DEV|g" /etc/systemd/system/serial-port-watchdog.service + systemctl daemon-reload + systemctl restart serial-port-watchdog.service +} + +eval sonic_version=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ") + +setup_platform +setup_platform_defaults +load_platform_installer_config + +program_serial_port + +if [ -f /host/image-$sonic_version/platform/firsttime ]; then + + if [ -z "$platform" ]; then echo "Unknown sonic platform" firsttime_exit fi diff --git a/files/image_config/serial-port-watchdog/serial-port-watchdog.py b/files/image_config/serial-port-watchdog/serial-port-watchdog.py new file mode 100755 index 000000000000..15c57556d065 --- /dev/null +++ b/files/image_config/serial-port-watchdog/serial-port-watchdog.py @@ -0,0 +1,328 @@ +#!/usr/bin/env python + +from __future__ import print_function, with_statement + +import argparse +import logging +import logging.handlers +import os +import time +import signal +import socket +import sys + +from collections import namedtuple + +PRGNAME = 'serial-port-watchdog' + +DEVFS_PATH = '/dev' +PROCFS_PATH = '/proc' + +# According to procfs(5) +ProcStat = namedtuple( 'ProcStat', [ + 'pid', 'comm', 'state', 'ppid', 'pgrp', 'session', 'tty_nr', 'tpgid', + 'flags', 'minflt', 'cminflt', 'majflt', 'cmajflt', 'utime', 'stime', + 'cutime', 'cstime', 'priority', 'nice', 'num_threads', 'itrealvalue', + 'starttime', 'vsize', 'rss', 'rsslim', 'startcode', 'endcode', + 'startstack', 'kstkesp', 'kstkeip', 'signal', 'blocked', 'sigignore', + 'sigcatch', 'wchan', 'nswap', 'cnswap', 'exit_signal', 'processor', + 'rt_priority', 'policy', 'delayacct_blkio_ticks', 'guest_time', + 'cguest_time', 'start_data', 'end_data', 'start_brk', 'arg_start', + 'arg_end', 'env_start', 'env_end', 'exit_code' +] ) + +# According to procfs(5) +ProcIo = namedtuple( 'ProcIo', [ + 'rchar', 'wchar', 'syscr', 'syscw', 'read_bytes', 'write_bytes', + 'cancelled_write_bytes' +] ) + +class Process( object ): + def __init__( self, pid, path=PROCFS_PATH ): + self.pid = pid + self.path = os.path.join( path, str( pid ) ) + self.childs = [] + self.parent = None + + self.stat = None + + self.io = None + self.stack = None + self.stackStartTime = None + + def refresh( self ): + with open( os.path.join( self.path, 'stat' ) ) as f: + data = f.read().rstrip().split() + self.stat = ProcStat( *data ) + + def getStat( self, key=None ): + self.refresh() + return self.stat + + def uid( self ): + return '%s/%s' % ( self.pid, self.stat.starttime ) + + def ppid( self ): + return self.stat.ppid + + def name( self ): + with open( os.path.join( self.path, 'comm' ) ) as f: + return f.read().rstrip() + + def getTtyForFd( self, fd ): + path = os.path.join( self.path, 'fd', str( fd ) ) + if not os.path.exists( path ): + return '' + return os.readlink( path ) + + def getStack( self ): + with open( os.path.join( self.path, 'stack' ) ) as f: + return f.read() + + def getIo( self ): + with open( os.path.join( self.path, 'io' ) ) as f: + data = [ int( l.split( ': ' )[ 1 ] ) for l in f.readlines() ] + return ProcIo( *data ) + + def isUsingTty( self, tty ): + return self.getTtyForFd( 0 ).endswith( tty ) + + def checkStuck( self, content ): + stack = self.getStack() + + found = False + for match in content: + if match in stack: + found = True + break + + if not found: + self.io = None + self.stack = None + self.stackStartTime = None + return 0 + + io = self.getIo() + + if self.stack != stack or self.io != io: + self.io = io + self.stack = stack + self.stackStartTime = time.time() + return 0 + + return time.time() - self.stackStartTime + + def __repr__( self ): + return '' % self.uid() + +class ProcessMonitor( object ): + def __init__( self, path=PROCFS_PATH ): + self.path = path + self.procs = {} + self.filters = [] + self.checkers = [] + self.whitelist = [] + + def addProcessFilter( self, func, *args ): + self.filters.append( ( func, args ) ) + + def addStuckChecker( self, func, *args ): + self.checkers.append( ( func, args ) ) + + def setWhitelist( self, whitelist ): + self.whitelist = whitelist + + def shouldHandleProcess( self, proc ): + matched = False + for func, args in self.filters: + if func( proc, *args ): + matched = True + break + + if not matched: + return False + + name = proc.name() + for item in self.whitelist: + if item in name: + return False + + return True + + def getRunningPids( self ): + pids = [] + for entry in os.listdir( self.path ): + if not entry.isdigit(): + continue + pids.append( int( entry ) ) + return pids + + def killStuckProcess( self, proc, elapsed, kill, timeout ): + if not elapsed: + return + + if elapsed < timeout: + if elapsed > timeout / 2: + logging.info( 'process %d seems stuck, idle for %ds, waiting ' + 'some more time', proc.pid, elapsed ) + return + + logging.warning( 'process %d has been stuck for %d seconds, killing...', + proc.pid, elapsed ) + logging.info( 'process %d kernel stack\n%s', proc.pid, proc.stack ) + if kill: + # XXX: SIGTERM sleep then if alive SIGKILL ? + os.kill( proc.pid, signal.SIGKILL ) + + def killStuckProcesses( self, kill, timeout ): + for proc in self.procs.values(): + for checker, args in self.checkers: + elapsed = checker( proc, *args ) + self.killStuckProcess( proc, elapsed, kill, timeout ) + + def updatePid( self, pid ): + p = Process( pid ) + + # if the process is already monitored (previously running) + r = self.procs.get( pid, None ) + if r: + p.refresh() + # if the process is still running + if p.uid() == r.uid(): + logging.debug( 'process %d still running', pid ) + return + # or the pid was reused but the process is different + logging.debug( 'pid %d reused for another process', pid ) + del self.procs[ pid ] + + # check if the process is relevant for monitoring + if not self.shouldHandleProcess( p ): + return + + logging.debug( 'watching process %d', pid ) + p.refresh() + self.procs[ pid ] = p + + def updateParenting( self ): + # clear parent and childs for monitored processes + for proc in self.procs.values(): + del proc.childs[:] + proc.parent = None + + # set parent and childs for monitored processes + for proc in self.procs.values(): + ppid = proc.ppid() + parent = self.procs.get( ppid, None ) + if parent: + proc.parent = parent + parent.childs.append( proc ) + + def update( self ): + pids = self.getRunningPids() + + # remove defunct processes + for pid in list(self.procs.keys()): + if pid not in pids: + logging.debug( 'process %d is defunct', pid ) + del self.procs[ pid ] + + # create or update running processes information + for pid in pids: + try: + self.updatePid( pid ) + except: + logging.warning( 'An issue occured whileupdating process %s', + pid ) + raise + + #self.updateParenting() + +def checkRootPermissions(): + if os.geteuid() != 0: + logging.error( 'You must be root to use this feature' ) + sys.exit( 1 ) + +def getHostname(): + try: + return socket.gethostname() + except: + return 'localhost' + +def setupLogging( verbose=False ): + loglevel = logging.DEBUG if verbose else logging.INFO + dateFmt = '%Y-%m-%d %H:%M:%S' + + log = logging.getLogger() + log.setLevel( logging.DEBUG ) + + logOut = logging.StreamHandler( sys.stdout ) + logOut.setFormatter( logging.Formatter( '%(levelname)s: %(message)s' ) ) + logOut.setLevel( loglevel ) + log.addHandler( logOut ) + + logSys = logging.handlers.SysLogHandler() + # format to rfc5424 format + fmt = '{} {}: %(message)s'.format( getHostname(), PRGNAME ) + logSys.setFormatter( logging.Formatter( fmt ) ) + logSys.setLevel( logging.WARNING ) + log.addHandler( logSys ) + try: + # the connection to the syslog socket happens with the first message + log.info( 'Attaching to syslog' ) + except: + log.warning( 'Failed open syslog' ) + +def listParser( value ): + if not value.strip(): + return [] + return value.split( ',' ) + +def ttyParser( dev, path=DEVFS_PATH ): + if not dev.startswith( DEVFS_PATH ): + dev = os.path.join( DEVFS_PATH, dev ) + if not os.path.exists( dev ): + raise argparse.ArgumentTypeError( '%s is not a device' % dev ) + return dev + +def parseArgs( args ): + parser = argparse.ArgumentParser() + + parser.add_argument( '-d', '--dry-run', action='store_true', + help='only print processes that would be killed' ) + parser.add_argument( '-f', '--funcs', default=[ 'tty_' ], type=listParser, + help='functions to look for in the stack trace' ) + parser.add_argument( '-i', '--interval', default=60, type=float, + help='interval at which to check the procfs' ) + parser.add_argument( '-k', '--timeout', default=3600, type=float, + help='timeout for which a process gets killed' ) + parser.add_argument( '-t', '--tty', default='ttyS0', type=ttyParser, + help='tty to check for stuck process' ) + parser.add_argument( '-v', '--verbose', action='store_true', + help='print all debug messages' ) + parser.add_argument( '-w', '--whitelist', default=[ 'agetty' ], type=listParser, + help='whitelist programs that should never be killed' ) + + return parser.parse_args( args ) + +def main( args ): + args = parseArgs( args ) + + setupLogging( args.verbose ) + checkRootPermissions() + + m = ProcessMonitor() + m.addProcessFilter( Process.isUsingTty, args.tty ) + m.addStuckChecker( Process.checkStuck, args.funcs ) + m.setWhitelist( args.whitelist ) + + while True: + logging.debug( 'updating processes' ) + m.update() + m.killStuckProcesses( kill=( not args.dry_run ), timeout=args.timeout ) + time.sleep( args.interval ) + + return 0 + +if __name__ == '__main__': + sys.exit( main( sys.argv[ 1: ] ) ) + diff --git a/files/image_config/serial-port-watchdog/serial-port-watchdog.service b/files/image_config/serial-port-watchdog/serial-port-watchdog.service new file mode 100644 index 000000000000..b86580ec2767 --- /dev/null +++ b/files/image_config/serial-port-watchdog/serial-port-watchdog.service @@ -0,0 +1,12 @@ +[Unit] +Description=Monitor serial port processes, kill stuck ones +Requires= +After=rc.local.Service + +[Service] +ExecStart=/usr/bin/serial-port-watchdog.py -t ttyS0 +Restart=always +RestartSec=0 + +[Install] +WantedBy=multi-user.target From 46c2d340ff51547442c233c4bbbdeb76ce3c6d67 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 25 May 2018 20:04:08 -0700 Subject: [PATCH 206/274] [docker_image_ctl]: Add --force while removing obsolete dockers (#1744) --- files/build_templates/docker_image_ctl.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index b17c70b4a9d2..1216013e63c2 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -52,7 +52,7 @@ start() { # docker created with a different HWSKU, remove and recreate echo "Removing obsolete {{docker_container_name}} container with HWSKU $DOCKERMOUNT" - docker rm {{docker_container_name}} + docker rm -f {{docker_container_name}} fi {%- if docker_container_name == "database" %} From a917517f60a0e3771421f5ec3e661ae865f04c86 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Sun, 27 May 2018 00:43:36 +0800 Subject: [PATCH 207/274] [minigraph parser] Fix minigraph parser issue when handling LAG related ACL table configuration (#1712) * Fix minigraph parser issue when handling LAG related ACL table configuration * rephrase the warning message. * pick up swss change in https://github.com/Azure/sonic-swss/pull/494 --- src/sonic-config-engine/minigraph.py | 20 +++++++++++++++++--- src/sonic-config-engine/tests/test_cfggen.py | 2 +- src/sonic-swss | 2 +- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 595915d9bee9..a8140408e97f 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -149,12 +149,15 @@ def parse_dpg(dpg, hname): pcintfs = child.find(str(QName(ns, "PortChannelInterfaces"))) pc_intfs = [] pcs = {} + intfs_inpc = [] # List to hold all the LAG member interfaces for pcintf in pcintfs.findall(str(QName(ns, "PortChannel"))): pcintfname = pcintf.find(str(QName(ns, "Name"))).text pcintfmbr = pcintf.find(str(QName(ns, "AttachTo"))).text pcmbr_list = pcintfmbr.split(';') + pc_intfs.append(pcintfname) for i, member in enumerate(pcmbr_list): pcmbr_list[i] = port_alias_map.get(member, member) + intfs_inpc.append(pcmbr_list[i]) if pcintf.find(str(QName(ns, "Fallback"))) != None: pcs[pcintfname] = {'members': pcmbr_list, 'fallback': pcintf.find(str(QName(ns, "Fallback"))).text} else: @@ -202,15 +205,26 @@ def parse_dpg(dpg, hname): for member in aclattach: member = member.strip() if pcs.has_key(member): - acl_intfs.extend(pcs[member]['members']) # For ACL attaching to port channels, we break them into port channel members + # If try to attach ACL to a LAG interface then we shall add the LAG to + # to acl_intfs directly instead of break it into member ports, ACL attach + # to LAG will be applied to all the LAG members internally by SAI/SDK + acl_intfs.append(member) elif vlans.has_key(member): print >> sys.stderr, "Warning: ACL " + aclname + " is attached to a Vlan interface, which is currently not supported" elif port_alias_map.has_key(member): acl_intfs.append(port_alias_map[member]) + # Give a warning if trying to attach ACL to a LAG member interface, correct way is to attach ACL to the LAG interface + if port_alias_map[member] in intfs_inpc: + print >> sys.stderr, "Warning: ACL " + aclname + " is attached to a LAG member interface " + port_alias_map[member] + ", instead of LAG interface" elif member.lower() == 'erspan': is_mirror = True; - # Erspan session will be attached to all front panel ports - acl_intfs = port_alias_map.values() + # Erspan session will be attached to all front panel ports, + # if panel ports is a member port of LAG, should add the LAG + # to acl table instead of the panel ports + acl_intfs = pc_intfs + for panel_port in port_alias_map.values(): + if panel_port not in intfs_inpc: + acl_intfs.append(panel_port) break; if acl_intfs: acls[aclname] = {'policy_desc': aclname, diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 37b66a27b4c4..d88f0525d546 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -83,7 +83,7 @@ def test_minigraph_acl(self): "Warning: ignore interface 'fortyGigE0/2' in DEVICE_NEIGHBOR as it is not in the port_config.ini\n" "{'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL'}," " 'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL'}," - " 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}," + " 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04']}," " 'NTP_ACL': {'services': ['NTP'], 'type': 'CTRLPLANE', 'policy_desc': 'NTP_ACL'}," " 'ROUTER_PROTECT': {'services': ['SSH', 'SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'ROUTER_PROTECT'}}") diff --git a/src/sonic-swss b/src/sonic-swss index 7331f922de7a..4df9c289a6c2 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 7331f922de7af71b0f40d8b2bdd2e1d30fcba6b0 +Subproject commit 4df9c289a6c2d41e4dee09f3055f0ac6d8e98ded From 225b3e5b9155792c542255ad3d6a5b29f4f41eb7 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 29 May 2018 13:46:25 -0700 Subject: [PATCH 208/274] Fix a bug that default graph might be missing when generating minimal config (#1747) --- files/image_config/updategraph/updategraph | 3 +++ 1 file changed, 3 insertions(+) diff --git a/files/image_config/updategraph/updategraph b/files/image_config/updategraph/updategraph index f0cea0894a9c..96827f09f97f 100755 --- a/files/image_config/updategraph/updategraph +++ b/files/image_config/updategraph/updategraph @@ -106,6 +106,9 @@ if [ "$src" = "dhcp" ]; then fi if [ "`cat /tmp/dhcp_graph_url`" = "N/A" ]; then echo "'N/A' found in DHCP response. Skipping graph update and generating an empty configuration." + if [ ! -f /etc/sonic/minigraph.xml ]; then + copy_default_minigraph + fi echo '{"DEVICE_METADATA":' > /tmp/device_meta.json sonic-cfggen -H -m /etc/sonic/minigraph.xml --var-json DEVICE_METADATA >> /tmp/device_meta.json echo '}' >> /tmp/device_meta.json From 2d7046c410558a4c1de86bf2def7163a39fb5eb8 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Wed, 30 May 2018 09:24:05 +0300 Subject: [PATCH 209/274] Add QoS and Buffers configs for Mellanox MSN2100 and MSN2410 (#1739) * Add QoS and Buffers config for Mellanox MSN2410 Signed-off-by: Andriy Moroz * Add QoS and Buffers config for Mellanox MSN2100 Signed-off-by: Andriy Moroz --- .../ACS-MSN2100/buffers.json.j2 | 1 + .../ACS-MSN2100/buffers_defaults_t0.j2 | 1 + .../ACS-MSN2100/buffers_defaults_t1.j2 | 1 + .../ACS-MSN2100/pg_profile_lookup.ini | 17 ++ .../ACS-MSN2100/qos.json | 165 ++++++++++++++++++ .../ACS-MSN2410/buffers.json.j2 | 1 + .../ACS-MSN2410/buffers_defaults_t0.j2 | 1 + .../ACS-MSN2410/buffers_defaults_t1.j2 | 1 + .../ACS-MSN2410/pg_profile_lookup.ini | 17 ++ .../ACS-MSN2410/qos.json | 165 ++++++++++++++++++ 10 files changed, 370 insertions(+) create mode 120000 device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_defaults_t0.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_defaults_t1.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/pg_profile_lookup.ini create mode 100644 device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json create mode 120000 device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_defaults_t0.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_defaults_t1.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/pg_profile_lookup.ini create mode 100644 device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers.json.j2 new file mode 120000 index 000000000000..add8bf8bb7c2 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..7bcae62336f6 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..a437d613434d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/pg_profile_lookup.ini new file mode 100644 index 000000000000..b66b129fe43f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json new file mode 100644 index 000000000000..74045469dbfd --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json @@ -0,0 +1,165 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1": { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2": { + "type":"DWRR", + "weight": "20" + } + }, + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + }, + "AZURE_LOSSLESS": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60|0": { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60|1": { + "scheduler" : "[SCHEDULER|scheduler.2]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60|0-1": { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60|3-4": { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers.json.j2 new file mode 120000 index 000000000000..add8bf8bb7c2 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..7bcae62336f6 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..a437d613434d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/pg_profile_lookup.ini new file mode 100644 index 000000000000..b66b129fe43f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json new file mode 100644 index 000000000000..95652cf96f4e --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json @@ -0,0 +1,165 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1": { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2": { + "type":"DWRR", + "weight": "20" + } + }, + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + }, + "AZURE_LOSSLESS": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220|0": { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220|1": { + "scheduler" : "[SCHEDULER|scheduler.2]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220|0-1": { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220|3-4": { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + } + } +} From c1057177d9488cb1ad119efeb97ddcd7c400967c Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 30 May 2018 18:29:43 -0700 Subject: [PATCH 210/274] [serial watchdog] remove serial watchdog service dependency to rc.local (#1752) * [serial watchdog] remove serial watchdog service dependency to rc.local When restarting this service in rc.local, the dependency causes an error in syslog. Removing the dependency to mute the error log entry. * remove lines with empty inputs --- .../serial-port-watchdog/serial-port-watchdog.service | 2 -- 1 file changed, 2 deletions(-) diff --git a/files/image_config/serial-port-watchdog/serial-port-watchdog.service b/files/image_config/serial-port-watchdog/serial-port-watchdog.service index b86580ec2767..1fcb15a103a5 100644 --- a/files/image_config/serial-port-watchdog/serial-port-watchdog.service +++ b/files/image_config/serial-port-watchdog/serial-port-watchdog.service @@ -1,7 +1,5 @@ [Unit] Description=Monitor serial port processes, kill stuck ones -Requires= -After=rc.local.Service [Service] ExecStart=/usr/bin/serial-port-watchdog.py -t ttyS0 From a6d2d777c478c076f313a72c2e0b407c279dbcfd Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 31 May 2018 18:38:12 -0700 Subject: [PATCH 211/274] Fix links of debian git server (#1755) --- src/initramfs-tools/Makefile | 2 +- src/isc-dhcp/Makefile | 2 +- src/libnl3/Makefile | 2 +- src/libteam/Makefile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/initramfs-tools/Makefile b/src/initramfs-tools/Makefile index 95d5c24d1185..c5010e876d8b 100644 --- a/src/initramfs-tools/Makefile +++ b/src/initramfs-tools/Makefile @@ -7,7 +7,7 @@ MAIN_TARGET = initramfs-tools_$(INITRAMFS_TOOLS_VERSION)_all.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Obtaining the initramfs-tools rm -rf ./initramfs-tools - git clone --branch v0.120 https://anonscm.debian.org/git/kernel/initramfs-tools.git ./initramfs-tools + git clone --branch v0.120 https://salsa.debian.org/kernel-team/initramfs-tools.git ./initramfs-tools # Patch pushd ./initramfs-tools diff --git a/src/isc-dhcp/Makefile b/src/isc-dhcp/Makefile index 5b1cb8407005..ce4fbc62608f 100644 --- a/src/isc-dhcp/Makefile +++ b/src/isc-dhcp/Makefile @@ -10,7 +10,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf ./isc-dhcp # Clone isc-dhcp repo - git clone https://anonscm.debian.org/cgit/pkg-dhcp/isc-dhcp.git + git clone https://salsa.debian.org/berni/isc-dhcp.git pushd ./isc-dhcp # Reset HEAD to the commit of the proper tag diff --git a/src/libnl3/Makefile b/src/libnl3/Makefile index efd234424dff..6f50e4e389fa 100644 --- a/src/libnl3/Makefile +++ b/src/libnl3/Makefile @@ -16,7 +16,7 @@ DERIVED_TARGETS = libnl-3-dev_$(LIBNL3_VERSION)_amd64.deb \ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Obtaining the libnl3 rm -rf ./libnl3 - git clone https://anonscm.debian.org/git/collab-maint/libnl3.git + git clone https://github.com/qiluo-msft/libnl3.git pushd ./libnl3 git checkout -f b77c0e49cb diff --git a/src/libteam/Makefile b/src/libteam/Makefile index c96266a5c7fd..a20f8dbd35b0 100644 --- a/src/libteam/Makefile +++ b/src/libteam/Makefile @@ -22,7 +22,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : popd # Obtain debian packaging - git clone https://anonscm.debian.org/git/collab-maint/libteam.git tmp + git clone https://salsa.debian.org/debian/libteam.git tmp pushd ./tmp git checkout -f da006f2 # v1.26 popd From 54046d4d47b721b713ce4ae0275b9c3790ad2bed Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Fri, 1 Jun 2018 02:59:29 -0700 Subject: [PATCH 212/274] [devices]: change S6100 to use new ECN/WRED config (#1749) Signed-off-by: Wenda --- .../Force10-S6100/qos.json | 30 ++++++------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json index 99642cf8cf4c..e3a84924fd15 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json @@ -127,35 +127,23 @@ } }, "WRED_PROFILE": { - "AZURE_LOSSY" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, "AZURE_LOSSLESS" : { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold": "312000", + "green_min_threshold": "104000" } }, "QUEUE": { - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63|0-1" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]" + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" From e7d17c0a2bce4560c3b267cdc46d930ca34bfe88 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 1 Jun 2018 08:13:58 -0700 Subject: [PATCH 213/274] [broadcom]: update brcm sai to 3.1.3.4-13 (#1760) Signed-off-by: Guohan Lu --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 62181597e7b3..0012e8a8106a 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.4-12_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-12_amd64.deb?sv=2015-04-05&sr=b&sig=iK79gjz8GQnPLU8OSxgzw35MzqmxwAXQg2N%2BalLUos0%3D&se=2032-01-31T20%3A36%3A51Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.4-13_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-13_amd64.deb?sv=2015-04-05&sr=b&sig=Y7mQMOnQEzwb%2FG%2BY9dcEX0Y9tQBDCK2UmF4TjIz3Zn8%3D&se=2155-04-24T09%3A52%3A42Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-12_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-13_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-12_amd64.deb?sv=2015-04-05&sr=b&sig=tSBPnK%2BK9axdPbkWP19r5ngM0ggRTWWijUIKTl8WNW0%3D&se=2032-01-31T20%3A36%3A11Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-13_amd64.deb?sv=2015-04-05&sr=b&sig=YYjwAt47PlCYJgW0RtEsdcmGAc52UdAzHEd5qVKImxc%3D&se=2155-04-24T09%3A53%3A45Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From b58a94dc53e1c40927a27db50625fb25a27b8ba6 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 1 Jun 2018 11:33:13 -0700 Subject: [PATCH 214/274] [sonic-mgmt]: Install the latest Microsoft Azure Kusto Library for Python (#1756) https://github.com/Azure/azure-kusto-python azure-kusto-data Package provides the capability to query Kusto clusters with Python. azure-kusto-ingest Package allows sending data to Kusto service - i.e. ingest data. The removed package adal is a dependent of the Azure Kusto Library. The removed azure-storage is deprecated and being replaced with new packages that are also the dependents of the Azure Kusto Library. (https://github.com/Azure/azure-storage-python) Signed-off-by: Shu0T1an ChenG --- dockers/docker-sonic-mgmt/Dockerfile.j2 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index c2f600c3c963..9396c7e56c0c 100644 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -43,11 +43,11 @@ RUN pip install ipaddr \ pysnmp==4.2.5 \ jinja2==2.7.2 \ cffi==1.10.0 \ - paramiko==2.1.2 \ - adal + paramiko==2.1.2 -# Install Azure Storage package -RUN pip install azure-storage +# Install Microsoft Azure Kusto Library for Python +RUN pip install azure-kusto-data \ + azure-kusto-ingest ## Copy and install sonic-mgmt docker dependencies COPY \ From d54a7ae566bc69d70a7637d73a48ca14c7dd15d3 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 4 Jun 2018 21:01:53 -0700 Subject: [PATCH 215/274] [baseimage] Adding setuid permissions to ping binaries, so sudo is no longer needed (#1765) --- build_debian.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build_debian.sh b/build_debian.sh index fa461a7ca415..c5b395653ec2 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -239,6 +239,12 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libwrap0_*.deb || \ ## Disable kexec supported reboot which was installed by default sudo sed -i 's/LOAD_KEXEC=true/LOAD_KEXEC=false/' $FILESYSTEM_ROOT/etc/default/kexec +## Fix ping tools permission so non root user can directly use them +## Note: this is a workaround since aufs doesn't support extended attributes +## Ref: https://github.com/moby/moby/issues/5650#issuecomment-303499489 +## TODO: remove workaround when the overlay filesystem support extended attributes +sudo chmod u+s $FILESYSTEM_ROOT/bin/ping{,6} + ## Remove sshd host keys, and will regenerate on first sshd start sudo rm -f $FILESYSTEM_ROOT/etc/ssh/ssh_host_*_key* sudo cp files/sshd/host-ssh-keygen.sh $FILESYSTEM_ROOT/usr/local/bin/ From eee36719ea0ce386c586f4a6b611e50c4a752b7b Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 4 Jun 2018 21:06:58 -0700 Subject: [PATCH 216/274] Revert the feature: serial port watchdog service (#1766) * Revert "[serial watchdog] remove serial watchdog service dependency to rc.local (#1752)" * Revert "[service] introducing serial port watchdog service (#1743)" --- .../build_templates/sonic_debian_extension.j2 | 5 - files/image_config/platform/rc.local | 44 +-- .../serial-port-watchdog.py | 328 ------------------ .../serial-port-watchdog.service | 10 - 4 files changed, 4 insertions(+), 383 deletions(-) delete mode 100755 files/image_config/serial-port-watchdog/serial-port-watchdog.py delete mode 100644 files/image_config/serial-port-watchdog/serial-port-watchdog.service diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 3d46f09aa67a..d0afa4659667 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -154,11 +154,6 @@ sudo cp $IMAGE_CONFIGS/hostname/hostname-config.service $FILESYSTEM_ROOT/etc/sy sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable hostname-config.service sudo cp $IMAGE_CONFIGS/hostname/hostname-config.sh $FILESYSTEM_ROOT/usr/bin/ -# Copy serial-port-watchdog configuration scripts -sudo cp $IMAGE_CONFIGS/serial-port-watchdog/serial-port-watchdog.service $FILESYSTEM_ROOT/etc/systemd/system/ -sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable serial-port-watchdog.service -sudo cp $IMAGE_CONFIGS/serial-port-watchdog/serial-port-watchdog.py $FILESYSTEM_ROOT/usr/bin/ - # Copy updategraph script and service file sudo cp $IMAGE_CONFIGS/updategraph/updategraph.service $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable updategraph.service diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index ab88b7a3f5b4..de54d141ef7e 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -183,51 +183,15 @@ for x in "$@"; do done } -setup_platform() -{ +eval sonic_version=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ") + +if [ -f /host/image-$sonic_version/platform/firsttime ]; then + if [ -n "$aboot_platform" ]; then platform=$aboot_platform elif [ -n "$onie_platform" ]; then platform=$onie_platform else - platform='' - fi -} - -# Setup default values in this function before reading installer.conf -# installer.conf could override the value set in this function. -setup_platform_defaults() -{ - # Default serial port: ttyS0 - CONSOLE_DEV=0 -} - -load_platform_installer_config() -{ - INSTALLER_CFG=/usr/share/sonic/device/$platform/installer.conf - if [ -f $INSTALLER_CFG ]; then - . $INSTALLER_CFG - fi -} - -program_serial_port() -{ - sed -i "s|ttyS.|ttyS$CONSOLE_DEV|g" /etc/systemd/system/serial-port-watchdog.service - systemctl daemon-reload - systemctl restart serial-port-watchdog.service -} - -eval sonic_version=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ") - -setup_platform -setup_platform_defaults -load_platform_installer_config - -program_serial_port - -if [ -f /host/image-$sonic_version/platform/firsttime ]; then - - if [ -z "$platform" ]; then echo "Unknown sonic platform" firsttime_exit fi diff --git a/files/image_config/serial-port-watchdog/serial-port-watchdog.py b/files/image_config/serial-port-watchdog/serial-port-watchdog.py deleted file mode 100755 index 15c57556d065..000000000000 --- a/files/image_config/serial-port-watchdog/serial-port-watchdog.py +++ /dev/null @@ -1,328 +0,0 @@ -#!/usr/bin/env python - -from __future__ import print_function, with_statement - -import argparse -import logging -import logging.handlers -import os -import time -import signal -import socket -import sys - -from collections import namedtuple - -PRGNAME = 'serial-port-watchdog' - -DEVFS_PATH = '/dev' -PROCFS_PATH = '/proc' - -# According to procfs(5) -ProcStat = namedtuple( 'ProcStat', [ - 'pid', 'comm', 'state', 'ppid', 'pgrp', 'session', 'tty_nr', 'tpgid', - 'flags', 'minflt', 'cminflt', 'majflt', 'cmajflt', 'utime', 'stime', - 'cutime', 'cstime', 'priority', 'nice', 'num_threads', 'itrealvalue', - 'starttime', 'vsize', 'rss', 'rsslim', 'startcode', 'endcode', - 'startstack', 'kstkesp', 'kstkeip', 'signal', 'blocked', 'sigignore', - 'sigcatch', 'wchan', 'nswap', 'cnswap', 'exit_signal', 'processor', - 'rt_priority', 'policy', 'delayacct_blkio_ticks', 'guest_time', - 'cguest_time', 'start_data', 'end_data', 'start_brk', 'arg_start', - 'arg_end', 'env_start', 'env_end', 'exit_code' -] ) - -# According to procfs(5) -ProcIo = namedtuple( 'ProcIo', [ - 'rchar', 'wchar', 'syscr', 'syscw', 'read_bytes', 'write_bytes', - 'cancelled_write_bytes' -] ) - -class Process( object ): - def __init__( self, pid, path=PROCFS_PATH ): - self.pid = pid - self.path = os.path.join( path, str( pid ) ) - self.childs = [] - self.parent = None - - self.stat = None - - self.io = None - self.stack = None - self.stackStartTime = None - - def refresh( self ): - with open( os.path.join( self.path, 'stat' ) ) as f: - data = f.read().rstrip().split() - self.stat = ProcStat( *data ) - - def getStat( self, key=None ): - self.refresh() - return self.stat - - def uid( self ): - return '%s/%s' % ( self.pid, self.stat.starttime ) - - def ppid( self ): - return self.stat.ppid - - def name( self ): - with open( os.path.join( self.path, 'comm' ) ) as f: - return f.read().rstrip() - - def getTtyForFd( self, fd ): - path = os.path.join( self.path, 'fd', str( fd ) ) - if not os.path.exists( path ): - return '' - return os.readlink( path ) - - def getStack( self ): - with open( os.path.join( self.path, 'stack' ) ) as f: - return f.read() - - def getIo( self ): - with open( os.path.join( self.path, 'io' ) ) as f: - data = [ int( l.split( ': ' )[ 1 ] ) for l in f.readlines() ] - return ProcIo( *data ) - - def isUsingTty( self, tty ): - return self.getTtyForFd( 0 ).endswith( tty ) - - def checkStuck( self, content ): - stack = self.getStack() - - found = False - for match in content: - if match in stack: - found = True - break - - if not found: - self.io = None - self.stack = None - self.stackStartTime = None - return 0 - - io = self.getIo() - - if self.stack != stack or self.io != io: - self.io = io - self.stack = stack - self.stackStartTime = time.time() - return 0 - - return time.time() - self.stackStartTime - - def __repr__( self ): - return '' % self.uid() - -class ProcessMonitor( object ): - def __init__( self, path=PROCFS_PATH ): - self.path = path - self.procs = {} - self.filters = [] - self.checkers = [] - self.whitelist = [] - - def addProcessFilter( self, func, *args ): - self.filters.append( ( func, args ) ) - - def addStuckChecker( self, func, *args ): - self.checkers.append( ( func, args ) ) - - def setWhitelist( self, whitelist ): - self.whitelist = whitelist - - def shouldHandleProcess( self, proc ): - matched = False - for func, args in self.filters: - if func( proc, *args ): - matched = True - break - - if not matched: - return False - - name = proc.name() - for item in self.whitelist: - if item in name: - return False - - return True - - def getRunningPids( self ): - pids = [] - for entry in os.listdir( self.path ): - if not entry.isdigit(): - continue - pids.append( int( entry ) ) - return pids - - def killStuckProcess( self, proc, elapsed, kill, timeout ): - if not elapsed: - return - - if elapsed < timeout: - if elapsed > timeout / 2: - logging.info( 'process %d seems stuck, idle for %ds, waiting ' - 'some more time', proc.pid, elapsed ) - return - - logging.warning( 'process %d has been stuck for %d seconds, killing...', - proc.pid, elapsed ) - logging.info( 'process %d kernel stack\n%s', proc.pid, proc.stack ) - if kill: - # XXX: SIGTERM sleep then if alive SIGKILL ? - os.kill( proc.pid, signal.SIGKILL ) - - def killStuckProcesses( self, kill, timeout ): - for proc in self.procs.values(): - for checker, args in self.checkers: - elapsed = checker( proc, *args ) - self.killStuckProcess( proc, elapsed, kill, timeout ) - - def updatePid( self, pid ): - p = Process( pid ) - - # if the process is already monitored (previously running) - r = self.procs.get( pid, None ) - if r: - p.refresh() - # if the process is still running - if p.uid() == r.uid(): - logging.debug( 'process %d still running', pid ) - return - # or the pid was reused but the process is different - logging.debug( 'pid %d reused for another process', pid ) - del self.procs[ pid ] - - # check if the process is relevant for monitoring - if not self.shouldHandleProcess( p ): - return - - logging.debug( 'watching process %d', pid ) - p.refresh() - self.procs[ pid ] = p - - def updateParenting( self ): - # clear parent and childs for monitored processes - for proc in self.procs.values(): - del proc.childs[:] - proc.parent = None - - # set parent and childs for monitored processes - for proc in self.procs.values(): - ppid = proc.ppid() - parent = self.procs.get( ppid, None ) - if parent: - proc.parent = parent - parent.childs.append( proc ) - - def update( self ): - pids = self.getRunningPids() - - # remove defunct processes - for pid in list(self.procs.keys()): - if pid not in pids: - logging.debug( 'process %d is defunct', pid ) - del self.procs[ pid ] - - # create or update running processes information - for pid in pids: - try: - self.updatePid( pid ) - except: - logging.warning( 'An issue occured whileupdating process %s', - pid ) - raise - - #self.updateParenting() - -def checkRootPermissions(): - if os.geteuid() != 0: - logging.error( 'You must be root to use this feature' ) - sys.exit( 1 ) - -def getHostname(): - try: - return socket.gethostname() - except: - return 'localhost' - -def setupLogging( verbose=False ): - loglevel = logging.DEBUG if verbose else logging.INFO - dateFmt = '%Y-%m-%d %H:%M:%S' - - log = logging.getLogger() - log.setLevel( logging.DEBUG ) - - logOut = logging.StreamHandler( sys.stdout ) - logOut.setFormatter( logging.Formatter( '%(levelname)s: %(message)s' ) ) - logOut.setLevel( loglevel ) - log.addHandler( logOut ) - - logSys = logging.handlers.SysLogHandler() - # format to rfc5424 format - fmt = '{} {}: %(message)s'.format( getHostname(), PRGNAME ) - logSys.setFormatter( logging.Formatter( fmt ) ) - logSys.setLevel( logging.WARNING ) - log.addHandler( logSys ) - try: - # the connection to the syslog socket happens with the first message - log.info( 'Attaching to syslog' ) - except: - log.warning( 'Failed open syslog' ) - -def listParser( value ): - if not value.strip(): - return [] - return value.split( ',' ) - -def ttyParser( dev, path=DEVFS_PATH ): - if not dev.startswith( DEVFS_PATH ): - dev = os.path.join( DEVFS_PATH, dev ) - if not os.path.exists( dev ): - raise argparse.ArgumentTypeError( '%s is not a device' % dev ) - return dev - -def parseArgs( args ): - parser = argparse.ArgumentParser() - - parser.add_argument( '-d', '--dry-run', action='store_true', - help='only print processes that would be killed' ) - parser.add_argument( '-f', '--funcs', default=[ 'tty_' ], type=listParser, - help='functions to look for in the stack trace' ) - parser.add_argument( '-i', '--interval', default=60, type=float, - help='interval at which to check the procfs' ) - parser.add_argument( '-k', '--timeout', default=3600, type=float, - help='timeout for which a process gets killed' ) - parser.add_argument( '-t', '--tty', default='ttyS0', type=ttyParser, - help='tty to check for stuck process' ) - parser.add_argument( '-v', '--verbose', action='store_true', - help='print all debug messages' ) - parser.add_argument( '-w', '--whitelist', default=[ 'agetty' ], type=listParser, - help='whitelist programs that should never be killed' ) - - return parser.parse_args( args ) - -def main( args ): - args = parseArgs( args ) - - setupLogging( args.verbose ) - checkRootPermissions() - - m = ProcessMonitor() - m.addProcessFilter( Process.isUsingTty, args.tty ) - m.addStuckChecker( Process.checkStuck, args.funcs ) - m.setWhitelist( args.whitelist ) - - while True: - logging.debug( 'updating processes' ) - m.update() - m.killStuckProcesses( kill=( not args.dry_run ), timeout=args.timeout ) - time.sleep( args.interval ) - - return 0 - -if __name__ == '__main__': - sys.exit( main( sys.argv[ 1: ] ) ) - diff --git a/files/image_config/serial-port-watchdog/serial-port-watchdog.service b/files/image_config/serial-port-watchdog/serial-port-watchdog.service deleted file mode 100644 index 1fcb15a103a5..000000000000 --- a/files/image_config/serial-port-watchdog/serial-port-watchdog.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Monitor serial port processes, kill stuck ones - -[Service] -ExecStart=/usr/bin/serial-port-watchdog.py -t ttyS0 -Restart=always -RestartSec=0 - -[Install] -WantedBy=multi-user.target From 711be8f7da49c7d5c7d3ef4ff6cfc7685aa884b4 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 5 Jun 2018 03:24:30 -0700 Subject: [PATCH 217/274] [caclmgrd] Heuristically determine whether ACL is IPv4 or IPv6, use iptables/ip6tables accordingly (#1767) * [caclmgrd] Heuristically determine whether ACL is IPv4 or IPv6, use iptables/ip6tables accordingly * Check all rules in table until we find one with a SRC_IP --- files/image_config/caclmgrd/caclmgrd | 31 +++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/files/image_config/caclmgrd/caclmgrd b/files/image_config/caclmgrd/caclmgrd index dee85d2e26ed..0dc59766b3d5 100755 --- a/files/image_config/caclmgrd/caclmgrd +++ b/files/image_config/caclmgrd/caclmgrd @@ -11,6 +11,7 @@ # try: + import ipaddr as ipaddress import os import subprocess import sys @@ -113,12 +114,22 @@ class ControlPlaneAclManager(object): # Add iptables command to delete all non-default chains iptables_cmds.append("iptables -X") + # Add same set of commands for ip6tables + iptables_cmds.append("ip6tables -P INPUT ACCEPT") + iptables_cmds.append("ip6tables -P FORWARD ACCEPT") + iptables_cmds.append("ip6tables -P OUTPUT ACCEPT") + iptables_cmds.append("ip6tables -F") + iptables_cmds.append("ip6tables -X") + # Get current ACL tables and rules from Config DB self._tables_db_info = self.config_db.get_table(self.ACL_TABLE) self._rules_db_info = self.config_db.get_table(self.ACL_RULE) # Walk the ACL tables for (table_name, table_data) in self._tables_db_info.iteritems(): + + table_ip_version = None + # Ignore non-control-plane ACL tables if table_data["type"] != self.ACL_TABLE_TYPE_CTRLPLANE: continue @@ -144,6 +155,23 @@ class ControlPlaneAclManager(object): if rule_table_name == table_name: acl_rules[rule_props["PRIORITY"]] = rule_props + # If we haven't determined the IP version for this ACL table yet, + # try to do it now. We determine heuristically based on whether the + # src IP is an IPv4 or IPv6 address. + if not table_ip_version and "SRC_IP" in rule_props and rule_props["SRC_IP"]: + ip_addr = ipaddress.IPAddress(rule_props["SRC_IP"].split("/")[0]) + if isinstance(ip_addr, ipaddress.IPv6Address): + table_ip_version = 6 + elif isinstance(ip_addr, ipaddress.IPv4Address): + table_ip_version = 4 + + # If we were unable to determine whether this ACL table contains + # IPv4 or IPv6 rules, log a message and skip processing this table. + if not table_ip_version: + log_warning("Unable to determine if ACL table '{}' contains IPv4 or IPv6 rules. Skipping table..." + .format(table_name)) + continue + # For each ACL rule in this table (in descending order of priority) for priority in sorted(acl_rules.iterkeys(), reverse=True): rule_props = acl_rules[priority] @@ -155,7 +183,8 @@ class ControlPlaneAclManager(object): # Apply the rule to the default protocol(s) for this ACL service for ip_protocol in ip_protocols: for dst_port in dst_ports: - rule_cmd = "iptables -A INPUT -p {}".format(ip_protocol) + rule_cmd = "ip6tables" if table_ip_version == 6 else "iptables" + rule_cmd += " -A INPUT -p {}".format(ip_protocol) if "SRC_IP" in rule_props and rule_props["SRC_IP"]: rule_cmd += " -s {}".format(rule_props["SRC_IP"]) From 0ff7ba69f7038f4dcd1940e7f82254494c5fac21 Mon Sep 17 00:00:00 2001 From: Mykola F <37578614+mykolaf@users.noreply.github.com> Date: Wed, 6 Jun 2018 20:05:46 +0300 Subject: [PATCH 218/274] [sai.profile] move hwsku specific device configs to device/mellanox/platform/hwsku (#1768) --- .../LS-SN2700/sai.profile | 2 +- .../LS-SN2700/sai_2700.xml | 243 +++++++++++ .../ACS-MSN2100/sai.profile | 2 +- .../ACS-MSN2100/sai_2100.xml | 131 ++++++ .../ACS-MSN2410/sai.profile | 2 +- .../ACS-MSN2410/sai_2410.xml | 411 ++++++++++++++++++ .../ACS-MSN2700/sai.profile | 2 +- .../ACS-MSN2700/sai_2700.xml | 243 +++++++++++ .../ACS-MSN2740/sai.profile | 2 +- .../ACS-MSN2740/sai_2740.xml | 243 +++++++++++ 10 files changed, 1276 insertions(+), 5 deletions(-) create mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai_2700.xml create mode 100644 device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai_2100.xml create mode 100644 device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai_2410.xml create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai_2700.xml create mode 100644 device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai_2740.xml diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai.profile b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai.profile index 9a9a38aeb068..696f3d8182f9 100644 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai.profile +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sai_2700.xml +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2700.xml diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai_2700.xml b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai_2700.xml new file mode 100644 index 000000000000..7831c9cf59d0 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai_2700.xml @@ -0,0 +1,243 @@ + + + + + + 00:02:03:04:05:00 + + + 32 + + + + + 1 + 4 + 16 + + + 3 + + + 98368 + + + 3 + 4 + 17 + 1 + 98368 + + + 5 + 4 + 18 + 3 + 98368 + + + 7 + 4 + 19 + 1 + 98368 + + + 9 + 4 + 20 + 3 + 98368 + + + 11 + 4 + 21 + 1 + 98368 + + + 13 + 4 + 22 + 3 + 98368 + + + 15 + 4 + 23 + 1 + 98368 + + + 17 + 4 + 24 + 3 + 98368 + + + 19 + 4 + 25 + 1 + 98368 + + + 21 + 4 + 26 + 3 + 98368 + + + 23 + 4 + 27 + 1 + 98368 + + + 25 + 4 + 28 + 3 + 98368 + + + 27 + 4 + 29 + 1 + 98368 + + + 29 + 4 + 30 + 3 + 98368 + + + 31 + 4 + 31 + 1 + 98368 + + + 33 + 4 + 14 + 3 + 98368 + + + 35 + 4 + 15 + 1 + 98368 + + + 37 + 4 + 12 + 3 + 98368 + + + 39 + 4 + 13 + 1 + 98368 + + + 41 + 4 + 10 + 3 + 98368 + + + 43 + 4 + 11 + 1 + 98368 + + + 45 + 4 + 8 + 3 + 98368 + + + 47 + 4 + 9 + 1 + 98368 + + + 49 + 4 + 6 + 3 + 98368 + + + 51 + 4 + 7 + 1 + 98368 + + + 53 + 4 + 4 + 3 + 98368 + + + 55 + 4 + 5 + 1 + 98368 + + + 57 + 4 + 2 + 3 + 98368 + + + 59 + 4 + 3 + 1 + 98368 + + + 61 + 4 + 0 + 3 + 98368 + + + 63 + 4 + 1 + 1 + 98368 + + + + diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai.profile b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai.profile index d2a9fac29a5e..5a381e4666ee 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai.profile +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sai_2100.xml +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2100.xml diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai_2100.xml b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai_2100.xml new file mode 100644 index 000000000000..c9b844cd4bf8 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai_2100.xml @@ -0,0 +1,131 @@ + + + + + + 00:02:03:04:05:00 + + + 16 + + + + + 25 + 4 + 0 + + + 3 + + + 98368 + + + 29 + 4 + 1 + 3 + 98368 + + + 17 + 4 + 2 + 3 + 98368 + + + 21 + 4 + 3 + 3 + 98368 + + + 9 + 4 + 4 + 3 + 98368 + + + 13 + 4 + 5 + 3 + 98368 + + + 1 + 4 + 6 + 3 + 98368 + + + 5 + 4 + 7 + 3 + 98368 + + + 37 + 4 + 8 + 3 + 98368 + + + 33 + 4 + 9 + 3 + 98368 + + + 45 + 4 + 10 + 3 + 98368 + + + 41 + 4 + 11 + 3 + 98368 + + + 53 + 4 + 12 + 3 + 98368 + + + 49 + 4 + 13 + 3 + 98368 + + + 61 + 4 + 14 + 3 + 98368 + + + 57 + 4 + 15 + 3 + 98368 + + + + diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai.profile b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai.profile index e5dff6bfa098..f7cb264c2287 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai.profile +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sai_2410.xml +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2410.xml diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai_2410.xml b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai_2410.xml new file mode 100644 index 000000000000..1f97994f887b --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai_2410.xml @@ -0,0 +1,411 @@ + + + + + + 00:02:03:04:05:00 + + + 56 + + + + + 1 + 32 + 1 + + + 0 + + + 939524096 + + + 2 + 33 + 1 + 0 + 939524096 + + + 3 + 34 + 1 + 0 + 939524096 + + + 4 + 35 + 1 + 0 + 939524096 + + + 5 + 36 + 1 + 0 + 939524096 + + + 6 + 37 + 1 + 0 + 939524096 + + + 7 + 38 + 1 + 0 + 939524096 + + + 8 + 39 + 1 + 0 + 939524096 + + + 9 + 40 + 1 + 0 + 939524096 + + + 10 + 41 + 1 + 0 + 939524096 + + + 11 + 42 + 1 + 0 + 939524096 + + + 12 + 43 + 1 + 0 + 939524096 + + + 13 + 44 + 1 + 0 + 939524096 + + + 14 + 45 + 1 + 0 + 939524096 + + + 15 + 46 + 1 + 0 + 939524096 + + + 16 + 47 + 1 + 0 + 939524096 + + + 17 + 48 + 4 + 3 + 11534336 + + + 19 + 49 + 4 + 1 + 11534336 + + + 21 + 50 + 4 + 3 + 11534336 + + + 23 + 51 + 4 + 1 + 11534336 + + + 25 + 52 + 4 + 3 + 11534336 + + + 27 + 53 + 4 + 1 + 11534336 + + + 29 + 54 + 4 + 3 + 11534336 + + + 31 + 55 + 4 + 1 + 11534336 + + + 33 + 28 + 1 + 0 + 939524096 + + + 34 + 29 + 1 + 0 + 939524096 + + + 35 + 30 + 1 + 0 + 939524096 + + + 36 + 31 + 1 + 0 + 939524096 + + + 37 + 24 + 1 + 0 + 939524096 + + + 38 + 25 + 1 + 0 + 939524096 + + + 39 + 26 + 1 + 0 + 939524096 + + + 40 + 27 + 1 + 0 + 939524096 + + + 41 + 20 + 1 + 0 + 939524096 + + + 42 + 21 + 1 + 0 + 939524096 + + + 43 + 22 + 1 + 0 + 939524096 + + + 44 + 23 + 1 + 0 + 939524096 + + + 45 + 16 + 1 + 0 + 939524096 + + + 46 + 17 + 1 + 0 + 939524096 + + + 47 + 18 + 1 + 0 + 939524096 + + + 48 + 19 + 1 + 0 + 939524096 + + + 49 + 12 + 1 + 0 + 939524096 + + + 50 + 13 + 1 + 0 + 939524096 + + + 51 + 14 + 1 + 0 + 939524096 + + + 52 + 15 + 1 + 0 + 939524096 + + + 53 + 8 + 1 + 0 + 939524096 + + + 54 + 9 + 1 + 0 + 939524096 + + + 55 + 10 + 1 + 0 + 939524096 + + + 56 + 11 + 1 + 0 + 939524096 + + + 57 + 4 + 1 + 0 + 939524096 + + + 58 + 5 + 1 + 0 + 939524096 + + + 59 + 6 + 1 + 0 + 939524096 + + + 60 + 7 + 1 + 0 + 939524096 + + + 61 + 0 + 1 + 0 + 939524096 + + + 62 + 1 + 1 + 0 + 939524096 + + + 63 + 2 + 1 + 0 + 939524096 + + + 64 + 3 + 1 + 0 + 939524096 + + + + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai.profile b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai.profile index 9a9a38aeb068..696f3d8182f9 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai.profile +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sai_2700.xml +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2700.xml diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai_2700.xml b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai_2700.xml new file mode 100644 index 000000000000..7831c9cf59d0 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai_2700.xml @@ -0,0 +1,243 @@ + + + + + + 00:02:03:04:05:00 + + + 32 + + + + + 1 + 4 + 16 + + + 3 + + + 98368 + + + 3 + 4 + 17 + 1 + 98368 + + + 5 + 4 + 18 + 3 + 98368 + + + 7 + 4 + 19 + 1 + 98368 + + + 9 + 4 + 20 + 3 + 98368 + + + 11 + 4 + 21 + 1 + 98368 + + + 13 + 4 + 22 + 3 + 98368 + + + 15 + 4 + 23 + 1 + 98368 + + + 17 + 4 + 24 + 3 + 98368 + + + 19 + 4 + 25 + 1 + 98368 + + + 21 + 4 + 26 + 3 + 98368 + + + 23 + 4 + 27 + 1 + 98368 + + + 25 + 4 + 28 + 3 + 98368 + + + 27 + 4 + 29 + 1 + 98368 + + + 29 + 4 + 30 + 3 + 98368 + + + 31 + 4 + 31 + 1 + 98368 + + + 33 + 4 + 14 + 3 + 98368 + + + 35 + 4 + 15 + 1 + 98368 + + + 37 + 4 + 12 + 3 + 98368 + + + 39 + 4 + 13 + 1 + 98368 + + + 41 + 4 + 10 + 3 + 98368 + + + 43 + 4 + 11 + 1 + 98368 + + + 45 + 4 + 8 + 3 + 98368 + + + 47 + 4 + 9 + 1 + 98368 + + + 49 + 4 + 6 + 3 + 98368 + + + 51 + 4 + 7 + 1 + 98368 + + + 53 + 4 + 4 + 3 + 98368 + + + 55 + 4 + 5 + 1 + 98368 + + + 57 + 4 + 2 + 3 + 98368 + + + 59 + 4 + 3 + 1 + 98368 + + + 61 + 4 + 0 + 3 + 98368 + + + 63 + 4 + 1 + 1 + 98368 + + + + diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai.profile b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai.profile index 79c24358c359..adaa280e6cd5 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai.profile +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sai_2740.xml +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2740.xml diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai_2740.xml b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai_2740.xml new file mode 100644 index 000000000000..559f2bdd10c8 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai_2740.xml @@ -0,0 +1,243 @@ + + + + + + 00:02:03:04:05:00 + + + 32 + + + + + 1 + 4 + 16 + + + 3 + + + 98368 + + + 3 + 4 + 17 + 1 + 98368 + + + 5 + 4 + 18 + 3 + 98368 + + + 7 + 4 + 19 + 1 + 98368 + + + 9 + 4 + 20 + 3 + 98368 + + + 11 + 4 + 21 + 1 + 98368 + + + 13 + 4 + 22 + 3 + 98368 + + + 15 + 4 + 23 + 1 + 98368 + + + 17 + 4 + 24 + 3 + 98368 + + + 19 + 4 + 25 + 1 + 98368 + + + 21 + 4 + 26 + 3 + 98368 + + + 23 + 4 + 27 + 1 + 98368 + + + 25 + 4 + 28 + 3 + 98368 + + + 27 + 4 + 29 + 1 + 98368 + + + 29 + 4 + 30 + 3 + 98368 + + + 31 + 4 + 31 + 1 + 98368 + + + 33 + 4 + 14 + 3 + 98368 + + + 35 + 4 + 15 + 1 + 98368 + + + 37 + 4 + 12 + 3 + 98368 + + + 39 + 4 + 13 + 1 + 98368 + + + 41 + 4 + 10 + 3 + 98368 + + + 43 + 4 + 11 + 1 + 98368 + + + 45 + 4 + 8 + 3 + 98368 + + + 47 + 4 + 9 + 1 + 98368 + + + 49 + 4 + 6 + 3 + 98368 + + + 51 + 4 + 7 + 1 + 98368 + + + 53 + 4 + 4 + 3 + 98368 + + + 55 + 4 + 5 + 1 + 98368 + + + 57 + 4 + 2 + 3 + 98368 + + + 59 + 4 + 3 + 1 + 98368 + + + 61 + 4 + 0 + 3 + 98368 + + + 63 + 4 + 1 + 1 + 98368 + + + + From 83d9c7e5936b899148d68758b5afc770afa1bdb7 Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Wed, 6 Jun 2018 15:39:23 -0700 Subject: [PATCH 219/274] [bcmsh] Fix the bcmsh issues. (#1761) bcmsh is not copied to /usr/bin/ at host side --- platform/broadcom/docker-syncd-brcm.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/broadcom/docker-syncd-brcm.mk b/platform/broadcom/docker-syncd-brcm.mk index 6ef1587adecd..80da1446a9a8 100644 --- a/platform/broadcom/docker-syncd-brcm.mk +++ b/platform/broadcom/docker-syncd-brcm.mk @@ -17,3 +17,4 @@ $(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd $(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_SYNCD_BRCM)_BASE_IMAGE_FILES += bcmcmd:/usr/bin/bcmcmd +$(DOCKER_SYNCD_BRCM)_BASE_IMAGE_FILES += bcmsh:/usr/bin/bcmsh From d2b1a0bcea7a86e82092018574b8bcb265ea0e24 Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Sat, 9 Jun 2018 11:21:01 -0700 Subject: [PATCH 220/274] [devices]: Add index and speed for port_config.ini on Celestica platform (#1780) --- .../Seastone-DX010-10-50/port_config.ini | 226 +++++++++--------- .../Seastone-DX010-50/port_config.ini | 130 +++++----- .../Seastone-DX010/port_config.ini | 66 ++--- 3 files changed, 211 insertions(+), 211 deletions(-) diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/port_config.ini b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/port_config.ini index 16b89088aab8..383cc5a6a7ab 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/port_config.ini +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/port_config.ini @@ -1,113 +1,113 @@ -# name lanes alias -Ethernet0 65 Eth1/1 -Ethernet1 66 Eth1/2 -Ethernet2 67 Eth1/3 -Ethernet3 68 Eth1/4 -Ethernet4 69 Eth2/1 -Ethernet5 70 Eth2/2 -Ethernet6 71 Eth2/3 -Ethernet7 72 Eth2/4 -Ethernet8 73 Eth3/1 -Ethernet9 74 Eth3/2 -Ethernet10 75 Eth3/3 -Ethernet11 76 Eth3/4 -Ethernet12 77 Eth4/1 -Ethernet13 78 Eth4/2 -Ethernet14 79 Eth4/3 -Ethernet15 80 Eth4/4 -Ethernet16 33 Eth5/1 -Ethernet17 34 Eth5/2 -Ethernet18 35 Eth5/3 -Ethernet19 36 Eth5/4 -Ethernet20 37 Eth6/1 -Ethernet21 38 Eth6/2 -Ethernet22 39 Eth6/3 -Ethernet23 40 Eth6/4 -Ethernet24 41 Eth7/1 -Ethernet25 42 Eth7/2 -Ethernet26 43 Eth7/3 -Ethernet27 44 Eth7/4 -Ethernet28 45 Eth8/1 -Ethernet29 46 Eth8/2 -Ethernet30 47 Eth8/3 -Ethernet31 48 Eth8/4 -Ethernet32 49 Eth9/1 -Ethernet33 50 Eth9/2 -Ethernet34 51 Eth9/3 -Ethernet35 52 Eth9/4 -Ethernet36 53 Eth10/1 -Ethernet37 54 Eth10/2 -Ethernet38 55 Eth10/3 -Ethernet39 56 Eth10/4 -Ethernet40 57 Eth11/1 -Ethernet41 58 Eth11/2 -Ethernet42 59 Eth11/3 -Ethernet43 60 Eth11/4 -Ethernet44 61 Eth12/1 -Ethernet45 62 Eth12/2 -Ethernet46 63 Eth12/3 -Ethernet47 64 Eth12/4 -Ethernet48 81 Eth13/1 -Ethernet49 82 Eth13/2 -Ethernet50 83 Eth13/3 -Ethernet51 84 Eth13/4 -Ethernet52 85 Eth14/1 -Ethernet53 86 Eth14/2 -Ethernet54 87 Eth14/3 -Ethernet55 88 Eth14/4 -Ethernet56 89 Eth15/1 -Ethernet57 90 Eth15/2 -Ethernet58 91 Eth15/3 -Ethernet59 92 Eth15/4 -Ethernet60 93 Eth16/1 -Ethernet61 94 Eth16/2 -Ethernet62 95 Eth16/3 -Ethernet63 96 Eth16/4 -Ethernet64 97 Eth17/1 -Ethernet65 98 Eth17/2 -Ethernet66 99 Eth17/3 -Ethernet67 100 Eth17/4 -Ethernet68 101 Eth18/1 -Ethernet69 102 Eth18/2 -Ethernet70 103 Eth18/3 -Ethernet71 104 Eth18/4 -Ethernet72 105 Eth19/1 -Ethernet73 106 Eth19/2 -Ethernet74 107 Eth19/3 -Ethernet75 108 Eth19/4 -Ethernet76 109 Eth20/1 -Ethernet77 110 Eth20/2 -Ethernet78 111 Eth20/3 -Ethernet79 112 Eth20/4 -Ethernet80 1 Eth21/1 -Ethernet81 2 Eth21/2 -Ethernet82 3 Eth21/3 -Ethernet83 4 Eth21/4 -Ethernet84 5 Eth22/1 -Ethernet85 6 Eth22/2 -Ethernet86 7 Eth22/3 -Ethernet87 8 Eth22/4 -Ethernet88 9 Eth23/1 -Ethernet89 10 Eth23/2 -Ethernet90 11 Eth23/3 -Ethernet91 12 Eth23/4 -Ethernet92 13 Eth24/1 -Ethernet93 14 Eth24/2 -Ethernet94 15 Eth24/3 -Ethernet95 16 Eth24/4 -Ethernet96 17,18 Eth25/1 -Ethernet98 19,20 Eth25/2 -Ethernet100 21,22 Eth26/1 -Ethernet102 23,24 Eth26/2 -Ethernet104 25,26 Eth27/1 -Ethernet106 27,28 Eth27/2 -Ethernet108 29,30 Eth28/1 -Ethernet110 31,32 Eth28/2 -Ethernet112 113,114 Eth29/1 -Ethernet114 115,116 Eth29/2 -Ethernet116 117,118 Eth30/1 -Ethernet118 119,120 Eth30/2 -Ethernet120 121,122 Eth31/1 -Ethernet122 123,124 Eth31/2 -Ethernet124 125,126 Eth32/1 -Ethernet126 127,128 Eth32/2 +# name lanes alias index speed +Ethernet0 65 Eth1/1 0 10000 +Ethernet1 66 Eth1/2 0 10000 +Ethernet2 67 Eth1/3 0 10000 +Ethernet3 68 Eth1/4 0 10000 +Ethernet4 69 Eth2/1 1 10000 +Ethernet5 70 Eth2/2 1 10000 +Ethernet6 71 Eth2/3 1 10000 +Ethernet7 72 Eth2/4 1 10000 +Ethernet8 73 Eth3/1 2 10000 +Ethernet9 74 Eth3/2 2 10000 +Ethernet10 75 Eth3/3 2 10000 +Ethernet11 76 Eth3/4 2 10000 +Ethernet12 77 Eth4/1 3 10000 +Ethernet13 78 Eth4/2 3 10000 +Ethernet14 79 Eth4/3 3 10000 +Ethernet15 80 Eth4/4 3 10000 +Ethernet16 33 Eth5/1 4 10000 +Ethernet17 34 Eth5/2 4 10000 +Ethernet18 35 Eth5/3 4 10000 +Ethernet19 36 Eth5/4 4 10000 +Ethernet20 37 Eth6/1 5 10000 +Ethernet21 38 Eth6/2 5 10000 +Ethernet22 39 Eth6/3 5 10000 +Ethernet23 40 Eth6/4 5 10000 +Ethernet24 41 Eth7/1 6 10000 +Ethernet25 42 Eth7/2 6 10000 +Ethernet26 43 Eth7/3 6 10000 +Ethernet27 44 Eth7/4 6 10000 +Ethernet28 45 Eth8/1 7 10000 +Ethernet29 46 Eth8/2 7 10000 +Ethernet30 47 Eth8/3 7 10000 +Ethernet31 48 Eth8/4 7 10000 +Ethernet32 49 Eth9/1 8 10000 +Ethernet33 50 Eth9/2 8 10000 +Ethernet34 51 Eth9/3 8 10000 +Ethernet35 52 Eth9/4 8 10000 +Ethernet36 53 Eth10/1 9 10000 +Ethernet37 54 Eth10/2 9 10000 +Ethernet38 55 Eth10/3 9 10000 +Ethernet39 56 Eth10/4 9 10000 +Ethernet40 57 Eth11/1 10 10000 +Ethernet41 58 Eth11/2 10 10000 +Ethernet42 59 Eth11/3 10 10000 +Ethernet43 60 Eth11/4 10 10000 +Ethernet44 61 Eth12/1 11 10000 +Ethernet45 62 Eth12/2 11 10000 +Ethernet46 63 Eth12/3 11 10000 +Ethernet47 64 Eth12/4 11 10000 +Ethernet48 81 Eth13/1 12 10000 +Ethernet49 82 Eth13/2 12 10000 +Ethernet50 83 Eth13/3 12 10000 +Ethernet51 84 Eth13/4 12 10000 +Ethernet52 85 Eth14/1 13 10000 +Ethernet53 86 Eth14/2 13 10000 +Ethernet54 87 Eth14/3 13 10000 +Ethernet55 88 Eth14/4 13 10000 +Ethernet56 89 Eth15/1 14 10000 +Ethernet57 90 Eth15/2 14 10000 +Ethernet58 91 Eth15/3 14 10000 +Ethernet59 92 Eth15/4 14 10000 +Ethernet60 93 Eth16/1 15 10000 +Ethernet61 94 Eth16/2 15 10000 +Ethernet62 95 Eth16/3 15 10000 +Ethernet63 96 Eth16/4 15 10000 +Ethernet64 97 Eth17/1 16 10000 +Ethernet65 98 Eth17/2 16 10000 +Ethernet66 99 Eth17/3 16 10000 +Ethernet67 100 Eth17/4 16 10000 +Ethernet68 101 Eth18/1 17 10000 +Ethernet69 102 Eth18/2 17 10000 +Ethernet70 103 Eth18/3 17 10000 +Ethernet71 104 Eth18/4 17 10000 +Ethernet72 105 Eth19/1 18 10000 +Ethernet73 106 Eth19/2 18 10000 +Ethernet74 107 Eth19/3 18 10000 +Ethernet75 108 Eth19/4 18 10000 +Ethernet76 109 Eth20/1 19 10000 +Ethernet77 110 Eth20/2 19 10000 +Ethernet78 111 Eth20/3 19 10000 +Ethernet79 112 Eth20/4 19 10000 +Ethernet80 1 Eth21/1 20 10000 +Ethernet81 2 Eth21/2 20 10000 +Ethernet82 3 Eth21/3 20 10000 +Ethernet83 4 Eth21/4 20 10000 +Ethernet84 5 Eth22/1 21 10000 +Ethernet85 6 Eth22/2 21 10000 +Ethernet86 7 Eth22/3 21 10000 +Ethernet87 8 Eth22/4 21 10000 +Ethernet88 9 Eth23/1 22 10000 +Ethernet89 10 Eth23/2 22 10000 +Ethernet90 11 Eth23/3 22 10000 +Ethernet91 12 Eth23/4 22 10000 +Ethernet92 13 Eth24/1 23 10000 +Ethernet93 14 Eth24/2 23 10000 +Ethernet94 15 Eth24/3 23 10000 +Ethernet95 16 Eth24/4 23 10000 +Ethernet96 17,18 Eth25/1 24 50000 +Ethernet98 19,20 Eth25/2 24 50000 +Ethernet100 21,22 Eth26/1 25 50000 +Ethernet102 23,24 Eth26/2 25 50000 +Ethernet104 25,26 Eth27/1 26 50000 +Ethernet106 27,28 Eth27/2 26 50000 +Ethernet108 29,30 Eth28/1 27 50000 +Ethernet110 31,32 Eth28/2 27 50000 +Ethernet112 113,114 Eth29/1 28 50000 +Ethernet114 115,116 Eth29/2 28 50000 +Ethernet116 117,118 Eth30/1 29 50000 +Ethernet118 119,120 Eth30/2 29 50000 +Ethernet120 121,122 Eth31/1 30 50000 +Ethernet122 123,124 Eth31/2 30 50000 +Ethernet124 125,126 Eth32/1 31 50000 +Ethernet126 127,128 Eth32/2 31 50000 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/port_config.ini b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/port_config.ini index 70553360da28..3e2a0ebeafd5 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/port_config.ini +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/port_config.ini @@ -1,65 +1,65 @@ -# name lanes alias -Ethernet0 65,66 Eth1/1 -Ethernet2 67,68 Eth1/2 -Ethernet4 69,70 Eth2/1 -Ethernet6 71,72 Eth2/2 -Ethernet8 73,74 Eth3/1 -Ethernet10 75,76 Eth3/2 -Ethernet12 77,78 Eth4/1 -Ethernet14 79,80 Eth4/2 -Ethernet16 33,34 Eth5/1 -Ethernet18 35,36 Eth5/2 -Ethernet20 37,38 Eth6/1 -Ethernet22 39,40 Eth6/2 -Ethernet24 41,42 Eth7/1 -Ethernet26 43,44 Eth7/2 -Ethernet28 45,46 Eth8/1 -Ethernet30 47,48 Eth8/2 -Ethernet32 49,50 Eth9/1 -Ethernet34 51,52 Eth9/2 -Ethernet36 53,54 Eth10/1 -Ethernet38 55,56 Eth10/2 -Ethernet40 57,58 Eth11/1 -Ethernet42 59,60 Eth11/2 -Ethernet44 61,62 Eth12/1 -Ethernet46 63,64 Eth12/2 -Ethernet48 81,82 Eth13/1 -Ethernet50 83,84 Eth13/2 -Ethernet52 85,86 Eth14/1 -Ethernet54 87,88 Eth14/2 -Ethernet56 89,90 Eth15/1 -Ethernet58 91,92 Eth15/2 -Ethernet60 93,94 Eth16/1 -Ethernet62 95,96 Eth16/2 -Ethernet64 97,98 Eth17/1 -Ethernet66 99,100 Eth17/2 -Ethernet68 101,102 Eth18/1 -Ethernet70 103,104 Eth18/2 -Ethernet72 105,106 Eth19/1 -Ethernet74 107,108 Eth19/2 -Ethernet76 109,110 Eth20/1 -Ethernet78 111,112 Eth20/2 -Ethernet80 1,2 Eth21/1 -Ethernet82 3,4 Eth21/2 -Ethernet84 5,6 Eth22/1 -Ethernet86 7,8 Eth22/2 -Ethernet88 9,10 Eth23/1 -Ethernet90 11,12 Eth23/2 -Ethernet92 13,14 Eth24/1 -Ethernet94 15,16 Eth24/2 -Ethernet96 17,18 Eth25/1 -Ethernet98 19,20 Eth25/2 -Ethernet100 21,22 Eth26/1 -Ethernet102 23,24 Eth26/2 -Ethernet104 25,26 Eth27/1 -Ethernet106 27,28 Eth27/2 -Ethernet108 29,30 Eth28/1 -Ethernet110 31,32 Eth28/2 -Ethernet112 113,114 Eth29/1 -Ethernet114 115,116 Eth29/2 -Ethernet116 117,118 Eth30/1 -Ethernet118 119,120 Eth30/2 -Ethernet120 121,122 Eth31/1 -Ethernet122 123,124 Eth31/2 -Ethernet124 125,126 Eth32/1 -Ethernet126 127,128 Eth32/2 +# name lanes alias index speed +Ethernet0 65,66 Eth1/1 0 50000 +Ethernet2 67,68 Eth1/2 0 50000 +Ethernet4 69,70 Eth2/1 1 50000 +Ethernet6 71,72 Eth2/2 1 50000 +Ethernet8 73,74 Eth3/1 2 50000 +Ethernet10 75,76 Eth3/2 2 50000 +Ethernet12 77,78 Eth4/1 3 50000 +Ethernet14 79,80 Eth4/2 3 50000 +Ethernet16 33,34 Eth5/1 4 50000 +Ethernet18 35,36 Eth5/2 4 50000 +Ethernet20 37,38 Eth6/1 5 50000 +Ethernet22 39,40 Eth6/2 5 50000 +Ethernet24 41,42 Eth7/1 6 50000 +Ethernet26 43,44 Eth7/2 6 50000 +Ethernet28 45,46 Eth8/1 7 50000 +Ethernet30 47,48 Eth8/2 7 50000 +Ethernet32 49,50 Eth9/1 8 50000 +Ethernet34 51,52 Eth9/2 8 50000 +Ethernet36 53,54 Eth10/1 9 50000 +Ethernet38 55,56 Eth10/2 9 50000 +Ethernet40 57,58 Eth11/1 10 50000 +Ethernet42 59,60 Eth11/2 10 50000 +Ethernet44 61,62 Eth12/1 11 50000 +Ethernet46 63,64 Eth12/2 11 50000 +Ethernet48 81,82 Eth13/1 12 50000 +Ethernet50 83,84 Eth13/2 12 50000 +Ethernet52 85,86 Eth14/1 13 50000 +Ethernet54 87,88 Eth14/2 13 50000 +Ethernet56 89,90 Eth15/1 14 50000 +Ethernet58 91,92 Eth15/2 14 50000 +Ethernet60 93,94 Eth16/1 15 50000 +Ethernet62 95,96 Eth16/2 15 50000 +Ethernet64 97,98 Eth17/1 16 50000 +Ethernet66 99,100 Eth17/2 16 50000 +Ethernet68 101,102 Eth18/1 17 50000 +Ethernet70 103,104 Eth18/2 17 50000 +Ethernet72 105,106 Eth19/1 18 50000 +Ethernet74 107,108 Eth19/2 18 50000 +Ethernet76 109,110 Eth20/1 19 50000 +Ethernet78 111,112 Eth20/2 19 50000 +Ethernet80 1,2 Eth21/1 20 50000 +Ethernet82 3,4 Eth21/2 20 50000 +Ethernet84 5,6 Eth22/1 21 50000 +Ethernet86 7,8 Eth22/2 21 50000 +Ethernet88 9,10 Eth23/1 22 50000 +Ethernet90 11,12 Eth23/2 22 50000 +Ethernet92 13,14 Eth24/1 23 50000 +Ethernet94 15,16 Eth24/2 23 50000 +Ethernet96 17,18 Eth25/1 24 50000 +Ethernet98 19,20 Eth25/2 24 50000 +Ethernet100 21,22 Eth26/1 25 50000 +Ethernet102 23,24 Eth26/2 25 50000 +Ethernet104 25,26 Eth27/1 26 50000 +Ethernet106 27,28 Eth27/2 26 50000 +Ethernet108 29,30 Eth28/1 27 50000 +Ethernet110 31,32 Eth28/2 27 50000 +Ethernet112 113,114 Eth29/1 28 50000 +Ethernet114 115,116 Eth29/2 28 50000 +Ethernet116 117,118 Eth30/1 29 50000 +Ethernet118 119,120 Eth30/2 29 50000 +Ethernet120 121,122 Eth31/1 30 50000 +Ethernet122 123,124 Eth31/2 30 50000 +Ethernet124 125,126 Eth32/1 31 50000 +Ethernet126 127,128 Eth32/2 31 50000 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/port_config.ini b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/port_config.ini index 9f039e003488..94282c3379e4 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/port_config.ini +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/port_config.ini @@ -1,33 +1,33 @@ -# name lanes alias -Ethernet0 65,66,67,68 Eth1 -Ethernet4 69,70,71,72 Eth2 -Ethernet8 73,74,75,76 Eth3 -Ethernet12 77,78,79,80 Eth4 -Ethernet16 33,34,35,36 Eth5 -Ethernet20 37,38,39,40 Eth6 -Ethernet24 41,42,43,44 Eth7 -Ethernet28 45,46,47,48 Eth8 -Ethernet32 49,50,51,52 Eth9 -Ethernet36 53,54,55,56 Eth10 -Ethernet40 57,58,59,60 Eth11 -Ethernet44 61,62,63,64 Eth12 -Ethernet48 81,82,83,84 Eth13 -Ethernet52 85,86,87,88 Eth14 -Ethernet56 89,90,91,92 Eth15 -Ethernet60 93,94,95,96 Eth16 -Ethernet64 97,98,99,100 Eth17 -Ethernet68 101,102,103,104 Eth18 -Ethernet72 105,106,107,108 Eth19 -Ethernet76 109,110,111,112 Eth20 -Ethernet80 1,2,3,4 Eth21 -Ethernet84 5,6,7,8 Eth22 -Ethernet88 9,10,11,12 Eth23 -Ethernet92 13,14,15,16 Eth24 -Ethernet96 17,18,19,20 Eth25 -Ethernet100 21,22,23,24 Eth26 -Ethernet104 25,26,27,28 Eth27 -Ethernet108 29,30,31,32 Eth28 -Ethernet112 113,114,115,116 Eth29 -Ethernet116 117,118,119,120 Eth30 -Ethernet120 121,122,123,124 Eth31 -Ethernet124 125,126,127,128 Eth32 +# name lanes alias index speed +Ethernet0 65,66,67,68 Eth1 0 100000 +Ethernet4 69,70,71,72 Eth2 1 100000 +Ethernet8 73,74,75,76 Eth3 2 100000 +Ethernet12 77,78,79,80 Eth4 3 100000 +Ethernet16 33,34,35,36 Eth5 4 100000 +Ethernet20 37,38,39,40 Eth6 5 100000 +Ethernet24 41,42,43,44 Eth7 6 100000 +Ethernet28 45,46,47,48 Eth8 7 100000 +Ethernet32 49,50,51,52 Eth9 8 100000 +Ethernet36 53,54,55,56 Eth10 9 100000 +Ethernet40 57,58,59,60 Eth11 10 100000 +Ethernet44 61,62,63,64 Eth12 11 100000 +Ethernet48 81,82,83,84 Eth13 12 100000 +Ethernet52 85,86,87,88 Eth14 13 100000 +Ethernet56 89,90,91,92 Eth15 14 100000 +Ethernet60 93,94,95,96 Eth16 15 100000 +Ethernet64 97,98,99,100 Eth17 16 100000 +Ethernet68 101,102,103,104 Eth18 17 100000 +Ethernet72 105,106,107,108 Eth19 18 100000 +Ethernet76 109,110,111,112 Eth20 19 100000 +Ethernet80 1,2,3,4 Eth21 20 100000 +Ethernet84 5,6,7,8 Eth22 21 100000 +Ethernet88 9,10,11,12 Eth23 22 100000 +Ethernet92 13,14,15,16 Eth24 23 100000 +Ethernet96 17,18,19,20 Eth25 24 100000 +Ethernet100 21,22,23,24 Eth26 25 100000 +Ethernet104 25,26,27,28 Eth27 26 100000 +Ethernet108 29,30,31,32 Eth28 27 100000 +Ethernet112 113,114,115,116 Eth29 28 100000 +Ethernet116 117,118,119,120 Eth30 29 100000 +Ethernet120 121,122,123,124 Eth31 30 100000 +Ethernet124 125,126,127,128 Eth32 31 100000 From 8d88455509fc3469574b32cfb635189778d963c9 Mon Sep 17 00:00:00 2001 From: Serhey Popovych Date: Sat, 9 Jun 2018 21:29:16 +0300 Subject: [PATCH 221/274] [baseimage]: Improve password hashing for default user account (#1748) * [slave.mk]: Fix displaying username and password in build summary We display contents of DEFAULT_USERNAME and DEFAULT_PASSWORD, while image can be build with USERNAME and/or PASSWORD given on make(1) command line. For example: $ make USERNAME=adm PASSWORD=mypass target/sonic-broadcom.bin Fix by displaying USERNAME and PASSWORD variables in build summary. Signed-off-by: Sergey Popovich * [baseimage]: Improve default user account handling There are couple of issues with current implementation of default user account management in baseimage: 1) It uses DES to encrypt accounts password. Furthermore this effectively limits password length to 8 symbols, even if more provided with PASSWORD or DEFAULT_PASSWORD from rules/config. 2) Salt value for password is same on all builds even with different password increasing attack surface. 3) During the build process password passed as command line parameter either as plain text (if given to make(1) as "make PASSWORD=...") or DES encrypted (if given to build_debian.sh) can be seen by non-build users using /proc//cmdline file that has group and world readable permissions. Both 1) and 2) come from: perl -e 'print crypt("$(PASSWORD)", "salt"),"\n"')" that by defalt uses DES if salt does not have format $$$, where is hashing function id. See crypt(3) for more details on valid values. To address issues above we propose following changes: 1) Do not create password by hands (e.g. using perl snippet above): put this job to chpasswd(8) which is aware about system wide password hashing policy specified in /etc/login.defs with ENCRYPT_METHOD (by default it is SHA512 for Debian 8). 2) Now chpasswd(8) will take care about proper salt value. 3) This has two steps: 3.1) For compatibility reasons accept USERNAME and PASSWORD as make(1) parameters, but warn user that this is unsafe. 3.2) Use process environment to pass USERNAME and PASSWORD variables from Makefile to build_debian.sh as more secure alternative to passing via command line parameters: /proc//environ readable only by user running process or privileged users like root. Before change: -------------- hash1 ----- # u='admin' # p="$(LANG=C perl -e 'print crypt("YourPaSs", "salt"),"\n"')" ^^^^^^^^ 8 symbols # echo "$u:$p" | chpasswd -e # getent shadow admin admin:sazQDkwgZPfSk:17680:0:99999:7::: ^^^^^^^^^^^^^ Note the hash (DES encrypted password) hash2 ----- # u='admin' # p="$(LANG=C perl -e 'print crypt("YourPaSsWoRd", "salt"),"\n"')" ^^^^^^^^^^^^ 12 symbols # echo "$u:$p" | chpasswd -e # getent shadow admin admin:sazQDkwgZPfSk:17680:0:99999:7::: ^^^^^^^^^^^^^ Hash is the same as for "YourPaSs" After change: ------------- hash1 ----- # echo "admin:YourPaSs" | chpasswd # getent shadow admin admin:$6$1Nho1jHC$T8YwK58FYToXMFuetQta7/XouAAN2q1IzWC3bdIg86woAs6WuTg\ ^^^^^^^^ Note salt here ksLO3oyQInax/wNVq.N4de6dyWZDsCAvsZ1:17681:0:99999:7::: hash2 ----- # echo "admin:YourPaSs" | chpasswd # getent shadow admin admin:$6$yKU5g7BO$kdT02Z1wHXhr1VCniKkZbLaMPZXK0WSSVGhSLGrNhsrsVxCJ.D9\ ^^^^^^^^ Here salt completely different from case above plFpd8ksGNpw/Vb92hvgYyCL2i5cfI8QEY/:17681:0:99999:7::: Since salt is different hashes for same password different too. hash1 ----- # LANG=C perl -e 'print crypt("YourPaSs", "\$6\$salt\$"),"\n"' ^^^^^ We want SHA512 hash $6$salt$qkwPvXqUeGpexO1vatnIQFAreOTXs6rnDX.OI.Sz2rcy51JrO8dFc9aGv82bB\ yd2ELrIMJ.FQLNjgSD0nNha7/ hash2 ----- # LANG=C perl -e 'print crypt("YourPaSsWoRd", "\$6\$salt\$"),"\n"' $6$salt$1JVndGzyy/dj7PaXo6hNcttlQoZe23ob8GWYWxVGEiGOlh6sofbaIvwl6Ho7N\ kYDI8zwRumRwga/A29nHm4mZ1 Now with same "salt" and $$, and same 8 symbol prefix in password, but different password length we have different hashes. Signed-off-by: Sergey Popovich --- build_debian.sh | 22 +++++++++------------- slave.mk | 18 ++++++++++++++---- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index c5b395653ec2..f66cf4ba62d1 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -3,26 +3,22 @@ ## an ONIE installer image. ## ## USAGE: -## ./build_debian USERNAME PASSWORD_ENCRYPTED -## PARAMETERS: +## USERNAME=username PASSWORD=password ./build_debian +## ENVIRONMENT: ## USERNAME ## The name of the default admin user -## PASSWORD_ENCRYPTED -## The encrypted password, expected by chpasswd command +## PASSWORD +## The password, expected by chpasswd command ## Default user -USERNAME=$1 [ -n "$USERNAME" ] || { - echo "Error: no or empty USERNAME argument" + echo "Error: no or empty USERNAME" exit 1 } -## Password for the default user, customizable by environment variable -## By default it is an empty password -## You may get a crypted password by: perl -e 'print crypt("YourPaSsWoRd", "salt"),"\n"' -PASSWORD_ENCRYPTED=$2 -[ -n "$PASSWORD_ENCRYPTED" ] || { - echo "Error: no or empty PASSWORD_ENCRYPTED argument" +## Password for the default user +[ -n "$PASSWORD" ] || { + echo "Error: no or empty PASSWORD" exit 1 } @@ -178,7 +174,7 @@ sudo cp files/docker/docker.service.conf $_ ## Note: user should be in the group with the same name, and also in sudo/docker group sudo LANG=C chroot $FILESYSTEM_ROOT useradd -G sudo,docker $USERNAME -c "$DEFAULT_USERINFO" -m -s /bin/bash ## Create password for the default user -echo $USERNAME:$PASSWORD_ENCRYPTED | sudo LANG=C chroot $FILESYSTEM_ROOT chpasswd -e +echo "$USERNAME:$PASSWORD" | sudo LANG=C chroot $FILESYSTEM_ROOT chpasswd ## Pre-install hardware drivers sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install \ diff --git a/slave.mk b/slave.mk index f642d3341a5c..a81acb1798f4 100644 --- a/slave.mk +++ b/slave.mk @@ -76,10 +76,14 @@ endif ifeq ($(USERNAME),) override USERNAME := $(DEFAULT_USERNAME) +else +$(warning USERNAME given on command line: could be visible to other users) endif ifeq ($(PASSWORD),) override PASSWORD := $(DEFAULT_PASSWORD) +else +$(warning PASSWORD given on command line: could be visible to other users) endif ifeq ($(SONIC_BUILD_JOBS),) @@ -100,8 +104,8 @@ $(info "CONFIGURED_PLATFORM" : "$(if $(PLATFORM),$(PLATFORM),$(CONFI $(info "SONIC_CONFIG_PRINT_DEPENDENCIES" : "$(SONIC_CONFIG_PRINT_DEPENDENCIES)") $(info "SONIC_BUILD_JOBS" : "$(SONIC_BUILD_JOBS)") $(info "SONIC_CONFIG_MAKE_JOBS" : "$(SONIC_CONFIG_MAKE_JOBS)") -$(info "DEFAULT_USERNAME" : "$(DEFAULT_USERNAME)") -$(info "DEFAULT_PASSWORD" : "$(DEFAULT_PASSWORD)") +$(info "USERNAME" : "$(USERNAME)") +$(info "PASSWORD" : "$(PASSWORD)") $(info "ENABLE_DHCP_GRAPH_SERVICE" : "$(ENABLE_DHCP_GRAPH_SERVICE)") $(info "SHUTDOWN_BGP_ON_START" : "$(SHUTDOWN_BGP_ON_START)") $(info "ENABLE_PFCWD_ON_START" : "$(ENABLE_PFCWD_ON_START)") @@ -484,8 +488,14 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ DIRTY_SUFFIX="$(shell date +%Y%m%d\.%H%M%S)" export DIRTY_SUFFIX - ./build_debian.sh "$(USERNAME)" "$(shell perl -e 'print crypt("$(PASSWORD)", "salt"),"\n"')" $(LOG) - TARGET_MACHINE=$($*_MACHINE) IMAGE_TYPE=$($*_IMAGE_TYPE) ./build_image.sh $(LOG) + + USERNAME="$(USERNAME)" \ + PASSWORD="$(PASSWORD)" \ + ./build_debian.sh $(LOG) + + TARGET_MACHINE=$($*_MACHINE) \ + IMAGE_TYPE=$($*_IMAGE_TYPE) \ + ./build_image.sh $(LOG) $(foreach docker, $($*_DOCKERS), \ rm -f $($(docker)_CONTAINER_NAME).sh From a4b830b3af256dc80dc358644290663c2a06880d Mon Sep 17 00:00:00 2001 From: stepanblyschak <38952541+stepanblyschak@users.noreply.github.com> Date: Sat, 9 Jun 2018 21:29:52 +0300 Subject: [PATCH 222/274] [mellanox] Update hw-mgmt pointer (#1759) Signed-off-by: Stepan Blyschak --- platform/mellanox/hw-management.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk index dcbce4564ee8..70dd2d330167 100644 --- a/platform/mellanox/hw-management.mk +++ b/platform/mellanox/hw-management.mk @@ -1,6 +1,6 @@ # Mellanox HW Management -MLNX_HW_MANAGEMENT_VERSION = V1.0.0160 +MLNX_HW_MANAGEMENT_VERSION = V1.0.0190 export MLNX_HW_MANAGEMENT_VERSION From dc547e4c8d4498d3d10c5495c5bfa871720c9088 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Sat, 9 Jun 2018 11:30:55 -0700 Subject: [PATCH 223/274] [sonic-platform-daemons] Update submodule (#1754) --- src/sonic-platform-daemons | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index 6d35814d9841..ce83d58b0aff 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit 6d35814d9841f34effa99fe053a5156602e106f4 +Subproject commit ce83d58b0afffaa3e0b9d57686c814a2b5fd771e From ed06aca40e715fee8d9ecf869848fed52aa160df Mon Sep 17 00:00:00 2001 From: stepanblyschak <38952541+stepanblyschak@users.noreply.github.com> Date: Sat, 9 Jun 2018 21:31:34 +0300 Subject: [PATCH 224/274] [mellanox] Add cpldupdate utility to SONiC image (#1746) Signed-off-by: Stepan Blyschak --- platform/mellanox/mft.mk | 12 ++++++++++-- platform/mellanox/mft/Makefile | 14 +++++++------- platform/mellanox/one-image.mk | 2 +- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/platform/mellanox/mft.mk b/platform/mellanox/mft.mk index 2fb3af338d75..1c84d3a66cd9 100644 --- a/platform/mellanox/mft.mk +++ b/platform/mellanox/mft.mk @@ -1,9 +1,17 @@ # Mellanox SAI -MFT = mft-4.5.0-31.amd64.deb +MFT_VERSION = 4.5.0 +MFT_REVISION = 31 + +export MFT_VERSION MFT_REVISION + +MFT = mft-$(MFT_VERSION)-$(MFT_REVISION).amd64.deb $(MFT)_SRC_PATH = $(PLATFORM_PATH)/mft $(MFT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) SONIC_MAKE_DEBS += $(MFT) -KERNEL_MFT = kernel-mft-dkms_4.5.0-$(KVERSION)_all.deb +KERNEL_MFT = kernel-mft-dkms_$(MFT_VERSION)-$(KVERSION)_all.deb $(eval $(call add_derived_package,$(MFT),$(KERNEL_MFT))) + +MFT_OEM = mft-oem-$(MFT_VERSION)-$(MFT_REVISION).amd64.deb +$(eval $(call add_derived_package,$(MFT),$(MFT_OEM))) diff --git a/platform/mellanox/mft/Makefile b/platform/mellanox/mft/Makefile index eea78cd76031..450e59eec44b 100644 --- a/platform/mellanox/mft/Makefile +++ b/platform/mellanox/mft/Makefile @@ -1,12 +1,12 @@ .ONESHELL: SHELL = /bin/bash -MFT_NAME = mft-4.5.0-31-x86_64-deb +MFT_NAME = mft-$(MFT_VERSION)-$(MFT_REVISION)-x86_64-deb MFT_TGZ = $(MFT_NAME).tgz -SRC_DEB = kernel-mft-dkms_4.5.0-31_all.deb +SRC_DEB = kernel-mft-dkms_$(MFT_VERSION)-$(MFT_REVISION)_all.deb -MAIN_TARGET = mft-4.5.0-31.amd64.deb -DERIVED_TARGETS = kernel-mft-dkms_4.5.0-$(KVERSION)_all.deb +MAIN_TARGET = mft-$(MFT_VERSION)-$(MFT_REVISION).amd64.deb +DERIVED_TARGETS = kernel-mft-dkms_$(MFT_VERSION)-$(KVERSION)_all.deb mft-oem-$(MFT_VERSION)-$(MFT_REVISION).amd64.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf $(MFT_NAME) @@ -21,11 +21,11 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : fi done - tar xvf `sudo dkms mkdriverdisk kernel-mft-dkms/4.5.0 -a all -d ubuntu -k $(KVERSION) --media tar | grep "Disk image location" | cut -d':' -f2` + tar xvf `sudo dkms mkdriverdisk kernel-mft-dkms/$(MFT_VERSION) -a all -d ubuntu -k $(KVERSION) --media tar | grep "Disk image location" | cut -d':' -f2` popd # fix timestamp because we do not actually build tools, only kernel - touch $(MFT_NAME)/DEBS/$* - mv $(MFT_NAME)/SDEBS/ubuntu-drivers/3.16.0/$(DERIVED_TARGETS) $(MFT_NAME)/DEBS/$* $(DEST) + touch $(MFT_NAME)/DEBS/* + mv $(MFT_NAME)/SDEBS/ubuntu-drivers/3.16.0/kernel-mft-dkms_$(MFT_VERSION)-$(KVERSION)_all.deb $(MFT_NAME)/DEBS/* $(DEST) $(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/platform/mellanox/one-image.mk b/platform/mellanox/one-image.mk index 6f478ba76a51..5360a4c27745 100644 --- a/platform/mellanox/one-image.mk +++ b/platform/mellanox/one-image.mk @@ -3,7 +3,7 @@ SONIC_ONE_IMAGE = sonic-mellanox.bin $(SONIC_ONE_IMAGE)_MACHINE = mellanox $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_ONE_IMAGE)_INSTALLS += $(SX_KERNEL) $(KERNEL_MFT) $(MFT) $(MLNX_HW_MANAGEMENT) +$(SONIC_ONE_IMAGE)_INSTALLS += $(SX_KERNEL) $(KERNEL_MFT) $(MFT_OEM) $(MFT) $(MLNX_HW_MANAGEMENT) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) $(SONIC_ONE_IMAGE)_FILES += $(MLNX_FW_FILE) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) From 481463ccbf84c57725d731336c759370c80a7955 Mon Sep 17 00:00:00 2001 From: Pradchaya P Date: Tue, 12 Jun 2018 00:40:58 +0700 Subject: [PATCH 225/274] Add Celestica seastone dx010 psuutil.py plugins (#1781) --- .../x86_64-cel_seastone-r0/plugins/psuutil.py | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 device/celestica/x86_64-cel_seastone-r0/plugins/psuutil.py diff --git a/device/celestica/x86_64-cel_seastone-r0/plugins/psuutil.py b/device/celestica/x86_64-cel_seastone-r0/plugins/psuutil.py new file mode 100644 index 000000000000..9e8f99e7a7f2 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/plugins/psuutil.py @@ -0,0 +1,102 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + # DX010 PSU pin mapping + self.psu = [ + {'base':216}, # Reserved + {'abs':27, 'power':22}, + {'abs':28, 'power':25} + ] + + def init_psu_gpio(self, pinnum): + # export pin, input as default + gpio_base = self.psu[0]['base'] + export_file = "/sys/class/gpio/export" + direction_file = '/sys/class/gpio/gpio' + str(gpio_base+pinnum) + '/direction' + + try: + with open(export_file, 'w') as fd: + fd.write(str(gpio_base+pinnum)) + except Exception as error: + logging.error("Unable to export gpio ", pinnum) + + + # Get a psu status and presence + def read_psu_statuses(self, pinnum): + sys_gpio_dir = "/sys/class/gpio" + retval = 'ERR' + gpio_base = self.psu[0]['base'] + + gpio_dir = sys_gpio_dir + '/gpio' + str(gpio_base+pinnum) + gpio_file = gpio_dir + "/value" + + # init gpio + if (not os.path.isdir(gpio_dir)): + self.init_psu_gpio(pinnum) + + try: + with open(gpio_file, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", gpio_file, "file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + DX010_MAX_PSUS = 2 + return DX010_MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + psu_status = self.read_psu_statuses(self.psu[index]['power']) + if (psu_status != 'ERR'): + psu_status = int(psu_status, 10) + # Check for PSU status + if (psu_status == 1): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_absence = self.read_psu_statuses(self.psu[index]['abs']) + if (psu_absence != 'ERR'): + psu_absence = (int(psu_absence, 10)) + # Check for PSU presence + if (psu_absence == 0): + status = 1 + + return status From 19421831857c48dda1f3bb08a0c5e2bed7a26dc3 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 11 Jun 2018 13:54:02 -0700 Subject: [PATCH 226/274] [devices]: Add Broadcom config files for Arista 7050 SKUs; Remove 'serdes_firmware_mode_xe=0x1' line (#1779) * Add Broadcom config files for Arista-7050-QX32 and Arista-7050-Q16S64 SKUs under respective directories * Remove 'serdes_firmware_mode_xe=0x1' line from Arista 7050 Broadcom config files --- .../Arista-7050-Q16S64/sai.profile | 2 +- ...-a7050-qx32-16x40G+32x10G+8x40G.config.bcm | 707 ++++++++++++++ .../Arista-7050-QX32/sai.profile | 2 +- .../td2-a7050-qx32-32x40G.config.bcm | 873 ++++++++++++++++++ 4 files changed, 1582 insertions(+), 2 deletions(-) create mode 100644 device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm create mode 100644 device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/td2-a7050-qx32-32x40G.config.bcm diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/sai.profile b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/sai.profile index 0175b59a5da3..5c613675c37f 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/sai.profile +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/sai.profile @@ -1,2 +1,2 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm SAI_NUM_ECMP_MEMBERS=32 diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm new file mode 100644 index 000000000000..6d72e20b2104 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm @@ -0,0 +1,707 @@ +#/****************************************************************************** +# * +# * File: config.bcm.cloverdales (7050-QX32) +# * Name: +# * +# * Description: This file contains SDK properties for an Arista +# * Cloverdales platform. +# * +# *----------------------------------------------------------------------------- +# ******************************************************************************/ +#################################################################### +# BCM Config file for Cloverdale platform +# - 16x40g + 32x10g + 8x40G Portmode + +# Old LPM only configuration +# l2_mem_entries=163840 +# l3_mem_entries=90112 +# l3_alpm_enable=0 +# ipv6_lpm_128b_enable=0 +# +# ALPM enable +l3_alpm_enable=2 +ipv6_lpm_128b_enable=1 +l2_mem_entries=32768 +l3_mem_entries=16384 + +# From old config file +os=unix +higig2_hdr_mode=1 + +# Parity +parity_correction=1 +parity_enable=1 +stat_if_parity_enable=0 + +# l2 thread related config vars +l2xmsg_hostbuf_size=8192 +l2xmsg_mode=1 + +bcm_num_cos=8 +bcm_stat_interval=2000000 +lls_num_l2uc=12 +max_vp_lags=0 +miim_intr_enable=0 +mmu_lossless=0 +module_64ports=0 +scache_filename=/tmp/scache +schan_intr_enable=0 +stable_size=0x2000000 +tdma_timeout_usec=5000000 + +# for GLC transceiver +phy_an_c73=0x0 +phy_an_c37=0x3 + +########################### +#port_init_speed_xe=40000 +#port_init_speed_xe.0=40000 + +#load_firmware=0x0102 +load_firmware.0=2 + +######################### +# All ports are in oversubscription mode +pbmp_oversubscribe=0x1fffffffffffffffffffffffffe +pbmp_xport_xe.0=0x1fffffffffffffffffffffffffe + +########################################## +#skip_L2_USER_ENTRY=0 +phy_aux_voltage_enable=1 +############################### +serdes_fiber_pref=1 +############################### +mdio_output_delay.0=0x0d +############################### +serdes_sgmii_m=0 +xgxs_lcpll_xtal_refclk=1 +xgxs_lcpll_xtal_refclk.0=1 +xgxs_lcpll_xtal_refclk.1=1 +xgxs_lcpll_xtal_refclk.2=1 +xgxs_lcpll_xtal_refclk.3=1 +tdma_intr_enable=1 +tslam_intr_enable=1 +tslam_dma_enable.2=1 +tslam_dma_enable.3=1 +#dport_map_port=0 +#pci2eb_overrid=0 +#bcm_xlate_port_enable.0=0 +#xgxs_pdetect_1=0 +table_dma_enable.0=1 +table_dma_enable.1=1 +table_dma_enable.2=1 +table_dma_enable.3=1 + + +phy_84328_1.0=1 +phy_84328_5.0=1 +phy_84328_9.0=1 +phy_84328_13.0=1 +phy_84328_101.0=1 +phy_84328_102.0=1 +phy_84328_103.0=1 +phy_84328_104.0=1 + +phy_an_c37_1.0=0 +phy_an_c37_5.0=0 +phy_an_c37_9.0=0 +phy_an_c37_13.0=0 +phy_an_c37_17.0=0 +phy_an_c37_21.0=0 +phy_an_c37_25.0=0 +phy_an_c37_29.0=0 +phy_an_c37_33.0=0 +phy_an_c37_37.0=0 +phy_an_c37_41.0=0 +phy_an_c37_45.0=0 +phy_an_c37_49.0=0 +phy_an_c37_53.0=0 +phy_an_c37_57.0=0 +phy_an_c37_61.0=0 +phy_an_c37_65.0=3 +phy_an_c37_66.0=3 +phy_an_c37_67.0=3 +phy_an_c37_68.0=3 +phy_an_c37_69.0=3 +phy_an_c37_70.0=3 +phy_an_c37_71.0=3 +phy_an_c37_72.0=3 +phy_an_c37_73.0=3 +phy_an_c37_74.0=3 +phy_an_c37_75.0=3 +phy_an_c37_76.0=3 +phy_an_c37_77.0=3 +phy_an_c37_78.0=3 +phy_an_c37_79.0=3 +phy_an_c37_80.0=3 +phy_an_c37_81.0=3 +phy_an_c37_82.0=3 +phy_an_c37_83.0=3 +phy_an_c37_84.0=3 +phy_an_c37_85.0=3 +phy_an_c37_86.0=3 +phy_an_c37_87.0=3 +phy_an_c37_88.0=3 +phy_an_c37_89.0=3 +phy_an_c37_90.0=3 +phy_an_c37_91.0=3 +phy_an_c37_92.0=3 +phy_an_c37_93.0=3 +phy_an_c37_94.0=3 +phy_an_c37_95.0=3 +phy_an_c37_96.0=3 +phy_an_c37_97.0=0 +phy_an_c37_98.0=0 +phy_an_c37_99.0=0 +phy_an_c37_100.0=0 +phy_an_c37_101.0=0 +phy_an_c37_102.0=0 +phy_an_c37_103.0=0 +phy_an_c37_104.0=0 + +phy_an_c73_1.0=2 +phy_an_c73_5.0=2 +phy_an_c73_9.0=2 +phy_an_c73_13.0=2 +phy_an_c73_17.0=2 +phy_an_c73_21.0=2 +phy_an_c73_25.0=2 +phy_an_c73_29.0=2 +phy_an_c73_33.0=2 +phy_an_c73_37.0=2 +phy_an_c73_41.0=2 +phy_an_c73_45.0=2 +phy_an_c73_49.0=2 +phy_an_c73_53.0=2 +phy_an_c73_57.0=2 +phy_an_c73_61.0=2 +phy_an_c73_65.0=0 +phy_an_c73_66.0=0 +phy_an_c73_67.0=0 +phy_an_c73_68.0=0 +phy_an_c73_69.0=0 +phy_an_c73_70.0=0 +phy_an_c73_71.0=0 +phy_an_c73_72.0=0 +phy_an_c73_73.0=0 +phy_an_c73_74.0=0 +phy_an_c73_75.0=0 +phy_an_c73_76.0=0 +phy_an_c73_77.0=0 +phy_an_c73_78.0=0 +phy_an_c73_79.0=0 +phy_an_c73_80.0=0 +phy_an_c73_81.0=0 +phy_an_c73_82.0=0 +phy_an_c73_83.0=0 +phy_an_c73_84.0=0 +phy_an_c73_85.0=0 +phy_an_c73_86.0=0 +phy_an_c73_87.0=0 +phy_an_c73_88.0=0 +phy_an_c73_89.0=0 +phy_an_c73_90.0=0 +phy_an_c73_91.0=0 +phy_an_c73_92.0=0 +phy_an_c73_93.0=0 +phy_an_c73_94.0=0 +phy_an_c73_95.0=0 +phy_an_c73_96.0=0 +phy_an_c73_97.0=2 +phy_an_c73_98.0=2 +phy_an_c73_99.0=2 +phy_an_c73_100.0=2 +phy_an_c73_101.0=2 +phy_an_c73_102.0=2 +phy_an_c73_103.0=2 +phy_an_c73_104.0=2 + +phy_aux_voltage_enable_1.0=0x1 +phy_aux_voltage_enable_5.0=0x1 +phy_aux_voltage_enable_9.0=0x1 +phy_aux_voltage_enable_13.0=0x1 +phy_aux_voltage_enable_101.0=0x1 +phy_aux_voltage_enable_102.0=0x1 +phy_aux_voltage_enable_103.0=0x1 +phy_aux_voltage_enable_104.0=0x1 + +phy_ext_rom_boot.0=0 + +phy_ext_rom_boot_1.0=0x0 +phy_ext_rom_boot_5.0=0x0 +phy_ext_rom_boot_9.0=0x0 +phy_ext_rom_boot_13.0=0x0 +phy_ext_rom_boot_101.0=0x0 +phy_ext_rom_boot_102.0=0x0 +phy_ext_rom_boot_103.0=0x0 +phy_ext_rom_boot_104.0=0x0 + + +phy_line_tx_mode_1.0=1 +phy_line_tx_mode_5.0=1 +phy_line_tx_mode_9.0=1 +phy_line_tx_mode_13.0=1 +phy_line_tx_mode_101.0=1 +phy_line_tx_mode_102.0=1 +phy_line_tx_mode_103.0=1 +phy_line_tx_mode_104.0=1 + + +phy_rx_polarity_flip_1.0=0x0 +phy_rx_polarity_flip_5.0=0x0 +phy_rx_polarity_flip_9.0=0x0 +phy_rx_polarity_flip_13.0=0x0 +phy_rx_polarity_flip_101.0=0x0 +phy_rx_polarity_flip_102.0=0x0 +phy_rx_polarity_flip_103.0=0x0 +phy_rx_polarity_flip_104.0=0x0 + +phy_system_tx_mode_1.0=0 +phy_system_tx_mode_5.0=0 +phy_system_tx_mode_9.0=0 +phy_system_tx_mode_13.0=0 +phy_system_tx_mode_101.0=0 +phy_system_tx_mode_102.0=0 +phy_system_tx_mode_103.0=0 +phy_system_tx_mode_104.0=0 + + +phy_tx_polarity_flip_1.0=0x0 +phy_tx_polarity_flip_5.0=0x0 +phy_tx_polarity_flip_9.0=0x0 +phy_tx_polarity_flip_13.0=0x0 +phy_tx_polarity_flip_101.0=0x0 +phy_tx_polarity_flip_102.0=0x0 +phy_tx_polarity_flip_103.0=0x0 +phy_tx_polarity_flip_104.0=0x0 + + +phy_xaui_rx_polarity_flip_1.0=0x0 +phy_xaui_rx_polarity_flip_5.0=0x0 +phy_xaui_rx_polarity_flip_9.0=0x0 +phy_xaui_rx_polarity_flip_13.0=0x0 +phy_xaui_rx_polarity_flip_17.0=0x0 +phy_xaui_rx_polarity_flip_21.0=0x0 +phy_xaui_rx_polarity_flip_25.0=0x0 +phy_xaui_rx_polarity_flip_29.0=0x0 +phy_xaui_rx_polarity_flip_33.0=0x0 +phy_xaui_rx_polarity_flip_37.0=0x0 +phy_xaui_rx_polarity_flip_41.0=0x0 +phy_xaui_rx_polarity_flip_45.0=0x0 +phy_xaui_rx_polarity_flip_49.0=0x0 +phy_xaui_rx_polarity_flip_53.0=0x0 +phy_xaui_rx_polarity_flip_57.0=0x0 +phy_xaui_rx_polarity_flip_61.0=0x0 +phy_xaui_rx_polarity_flip_65.0=0x0 +phy_xaui_rx_polarity_flip_66.0=0x0 +phy_xaui_rx_polarity_flip_67.0=0x0 +phy_xaui_rx_polarity_flip_68.0=0x0 +phy_xaui_rx_polarity_flip_69.0=0x0 +phy_xaui_rx_polarity_flip_70.0=0x0 +phy_xaui_rx_polarity_flip_71.0=0x0 +phy_xaui_rx_polarity_flip_72.0=0x0 +phy_xaui_rx_polarity_flip_73.0=0x0 +phy_xaui_rx_polarity_flip_74.0=0x0 +phy_xaui_rx_polarity_flip_75.0=0x0 +phy_xaui_rx_polarity_flip_76.0=0x0 +phy_xaui_rx_polarity_flip_77.0=0x0 +phy_xaui_rx_polarity_flip_78.0=0x0 +phy_xaui_rx_polarity_flip_79.0=0x0 +phy_xaui_rx_polarity_flip_80.0=0x0 +phy_xaui_rx_polarity_flip_81.0=0x0 +phy_xaui_rx_polarity_flip_82.0=0x0 +phy_xaui_rx_polarity_flip_83.0=0x0 +phy_xaui_rx_polarity_flip_84.0=0x0 +phy_xaui_rx_polarity_flip_85.0=0x0 +phy_xaui_rx_polarity_flip_86.0=0x0 +phy_xaui_rx_polarity_flip_87.0=0x0 +phy_xaui_rx_polarity_flip_88.0=0x0 +phy_xaui_rx_polarity_flip_89.0=0x0 +phy_xaui_rx_polarity_flip_90.0=0x0 +phy_xaui_rx_polarity_flip_91.0=0x0 +phy_xaui_rx_polarity_flip_92.0=0x0 +phy_xaui_rx_polarity_flip_93.0=0x0 +phy_xaui_rx_polarity_flip_94.0=0x0 +phy_xaui_rx_polarity_flip_95.0=0x0 +phy_xaui_rx_polarity_flip_96.0=0x0 +phy_xaui_rx_polarity_flip_97.0=0x0 +phy_xaui_rx_polarity_flip_98.0=0x0 +phy_xaui_rx_polarity_flip_99.0=0x0 +phy_xaui_rx_polarity_flip_100.0=0x0 +phy_xaui_rx_polarity_flip_101.0=0x0 +phy_xaui_rx_polarity_flip_102.0=0x0 +phy_xaui_rx_polarity_flip_103.0=0x0 +phy_xaui_rx_polarity_flip_104.0=0x0 + +phy_xaui_tx_polarity_flip_1.0=0x0 +phy_xaui_tx_polarity_flip_5.0=0x0 +phy_xaui_tx_polarity_flip_9.0=0x0 +phy_xaui_tx_polarity_flip_13.0=0x0 +phy_xaui_tx_polarity_flip_17.0=0x0 +phy_xaui_tx_polarity_flip_21.0=0x0 +phy_xaui_tx_polarity_flip_25.0=0x0 +phy_xaui_tx_polarity_flip_29.0=0x0 +phy_xaui_tx_polarity_flip_33.0=0x0 +phy_xaui_tx_polarity_flip_37.0=0x0 +phy_xaui_tx_polarity_flip_41.0=0x0 +phy_xaui_tx_polarity_flip_45.0=0x0 +phy_xaui_tx_polarity_flip_49.0=0x0 +phy_xaui_tx_polarity_flip_53.0=0x0 +phy_xaui_tx_polarity_flip_57.0=0x0 +phy_xaui_tx_polarity_flip_61.0=0x0 +phy_xaui_tx_polarity_flip_65.0=0x0 +phy_xaui_tx_polarity_flip_66.0=0x0 +phy_xaui_tx_polarity_flip_67.0=0x0 +phy_xaui_tx_polarity_flip_68.0=0x0 +phy_xaui_tx_polarity_flip_69.0=0x0 +phy_xaui_tx_polarity_flip_70.0=0x0 +phy_xaui_tx_polarity_flip_71.0=0x0 +phy_xaui_tx_polarity_flip_72.0=0x0 +phy_xaui_tx_polarity_flip_73.0=0x0 +phy_xaui_tx_polarity_flip_74.0=0x0 +phy_xaui_tx_polarity_flip_75.0=0x0 +phy_xaui_tx_polarity_flip_76.0=0x0 +phy_xaui_tx_polarity_flip_77.0=0x0 +phy_xaui_tx_polarity_flip_78.0=0x0 +phy_xaui_tx_polarity_flip_79.0=0x0 +phy_xaui_tx_polarity_flip_80.0=0x0 +phy_xaui_tx_polarity_flip_81.0=0x0 +phy_xaui_tx_polarity_flip_82.0=0x0 +phy_xaui_tx_polarity_flip_83.0=0x0 +phy_xaui_tx_polarity_flip_84.0=0x0 +phy_xaui_tx_polarity_flip_85.0=0x0 +phy_xaui_tx_polarity_flip_86.0=0x0 +phy_xaui_tx_polarity_flip_87.0=0x0 +phy_xaui_tx_polarity_flip_88.0=0x0 +phy_xaui_tx_polarity_flip_89.0=0x0 +phy_xaui_tx_polarity_flip_90.0=0x0 +phy_xaui_tx_polarity_flip_91.0=0x0 +phy_xaui_tx_polarity_flip_92.0=0x0 +phy_xaui_tx_polarity_flip_93.0=0x0 +phy_xaui_tx_polarity_flip_94.0=0x0 +phy_xaui_tx_polarity_flip_95.0=0x0 +phy_xaui_tx_polarity_flip_96.0=0x0 +phy_xaui_tx_polarity_flip_97.0=0x0 +phy_xaui_tx_polarity_flip_98.0=0x0 +phy_xaui_tx_polarity_flip_99.0=0x0 +phy_xaui_tx_polarity_flip_100.0=0x0 +phy_xaui_tx_polarity_flip_101.0=0x0 +phy_xaui_tx_polarity_flip_102.0=0x0 +phy_xaui_tx_polarity_flip_103.0=0x0 +phy_xaui_tx_polarity_flip_104.0=0x0 + +port_init_autoneg_17.0=0 +port_init_autoneg_21.0=0 +port_init_autoneg_25.0=0 +port_init_autoneg_29.0=0 +port_init_autoneg_33.0=0 +port_init_autoneg_37.0=0 +port_init_autoneg_41.0=0 +port_init_autoneg_45.0=0 +port_init_autoneg_49.0=0 +port_init_autoneg_53.0=0 +port_init_autoneg_57.0=0 +port_init_autoneg_61.0=0 +port_init_autoneg_65.0=0 +port_init_autoneg_66.0=0 +port_init_autoneg_67.0=0 +port_init_autoneg_68.0=0 +port_init_autoneg_69.0=0 +port_init_autoneg_70.0=0 +port_init_autoneg_71.0=0 +port_init_autoneg_72.0=0 +port_init_autoneg_73.0=0 +port_init_autoneg_74.0=0 +port_init_autoneg_75.0=0 +port_init_autoneg_76.0=0 +port_init_autoneg_77.0=0 +port_init_autoneg_78.0=0 +port_init_autoneg_79.0=0 +port_init_autoneg_80.0=0 +port_init_autoneg_81.0=0 +port_init_autoneg_82.0=0 +port_init_autoneg_83.0=0 +port_init_autoneg_84.0=0 +port_init_autoneg_85.0=0 +port_init_autoneg_86.0=0 +port_init_autoneg_87.0=0 +port_init_autoneg_88.0=0 +port_init_autoneg_89.0=0 +port_init_autoneg_90.0=0 +port_init_autoneg_91.0=0 +port_init_autoneg_92.0=0 +port_init_autoneg_93.0=0 +port_init_autoneg_94.0=0 +port_init_autoneg_95.0=0 +port_init_autoneg_96.0=0 +port_init_autoneg_97.0=0 +port_init_autoneg_98.0=0 +port_init_autoneg_99.0=0 +port_init_autoneg_100.0=0 + +port_init_cl72_hg.0=0x11 + + +portmap_1.0=125:40 +portmap_5.0=121:40 +portmap_9.0=13:40 +portmap_13.0=9:40 +portmap_17.0=17:40 +portmap_21.0=21:40 +portmap_25.0=25:40 +portmap_29.0=29:40 +portmap_33.0=37:40 +portmap_37.0=33:40 +portmap_41.0=45:40 +portmap_45.0=41:40 +portmap_49.0=53:40 +portmap_53.0=49:40 +portmap_57.0=69:40 +portmap_61.0=65:40 +portmap_65.0=77:10 +portmap_66.0=78:10 +portmap_67.0=79:10 +portmap_68.0=80:10 +portmap_69.0=73:10 +portmap_70.0=74:10 +portmap_71.0=75:10 +portmap_72.0=76:10 +portmap_73.0=93:10 +portmap_74.0=94:10 +portmap_75.0=95:10 +portmap_76.0=96:10 +portmap_77.0=89:10 +portmap_78.0=90:10 +portmap_79.0=91:10 +portmap_80.0=92:10 +portmap_81.0=101:10 +portmap_82.0=102:10 +portmap_83.0=103:10 +portmap_84.0=104:10 +portmap_85.0=97:10 +portmap_86.0=98:10 +portmap_87.0=99:10 +portmap_88.0=100:10 +portmap_89.0=109:10 +portmap_90.0=110:10 +portmap_91.0=111:10 +portmap_92.0=112:10 +portmap_93.0=105:10 +portmap_94.0=106:10 +portmap_95.0=107:10 +portmap_96.0=108:10 +portmap_97.0=61:40 +portmap_98.0=57:40 +portmap_99.0=81:40 +portmap_100.0=85:40 +portmap_101.0=117:40 +portmap_102.0=113:40 +portmap_103.0=5:40 +portmap_104.0=1:40 + +port_phy_addr_1.0=0x4 +port_phy_addr_5.0=0x0 +port_phy_addr_9.0=0x2c +port_phy_addr_13.0=0x28 +port_phy_addr_17.0=0x7f +port_phy_addr_21.0=0x7f +port_phy_addr_25.0=0x7f +port_phy_addr_29.0=0x7f +port_phy_addr_33.0=0x7f +port_phy_addr_37.0=0x7f +port_phy_addr_41.0=0x7f +port_phy_addr_45.0=0x7f +port_phy_addr_49.0=0x7f +port_phy_addr_53.0=0x7f +port_phy_addr_57.0=0x7f +port_phy_addr_61.0=0x7f +port_phy_addr_65.0=0x7f +port_phy_addr_66.0=0x7f +port_phy_addr_67.0=0x7f +port_phy_addr_68.0=0x7f +port_phy_addr_69.0=0x7f +port_phy_addr_70.0=0x7f +port_phy_addr_71.0=0x7f +port_phy_addr_72.0=0x7f +port_phy_addr_73.0=0x7f +port_phy_addr_74.0=0x7f +port_phy_addr_75.0=0x7f +port_phy_addr_76.0=0x7f +port_phy_addr_77.0=0x7f +port_phy_addr_78.0=0x7f +port_phy_addr_79.0=0x7f +port_phy_addr_80.0=0x7f +port_phy_addr_81.0=0x7f +port_phy_addr_82.0=0x7f +port_phy_addr_83.0=0x7f +port_phy_addr_84.0=0x7f +port_phy_addr_85.0=0x7f +port_phy_addr_86.0=0x7f +port_phy_addr_87.0=0x7f +port_phy_addr_88.0=0x7f +port_phy_addr_89.0=0x7f +port_phy_addr_90.0=0x7f +port_phy_addr_91.0=0x7f +port_phy_addr_92.0=0x7f +port_phy_addr_93.0=0x7f +port_phy_addr_94.0=0x7f +port_phy_addr_95.0=0x7f +port_phy_addr_96.0=0x7f +port_phy_addr_97.0=0x7f +port_phy_addr_98.0=0x7f +port_phy_addr_99.0=0x7f +port_phy_addr_100.0=0x7f +port_phy_addr_101.0=0x54 +port_phy_addr_102.0=0x50 +port_phy_addr_103.0=0x7c +port_phy_addr_104.0=0x78 + +port_phy_clause_1.0=0x2d +port_phy_clause_5.0=0x2d +port_phy_clause_9.0=0x2d +port_phy_clause_13.0=0x2d +port_phy_clause_101.0=0x2d +port_phy_clause_102.0=0x2d +port_phy_clause_103.0=0x2d +port_phy_clause_104.0=0x2d + +port_phy_id0_1.0=0x600d +port_phy_id0_5.0=0x600d +port_phy_id0_9.0=0x600d +port_phy_id0_13.0=0x600d +port_phy_id0_101.0=0x600d +port_phy_id0_102.0=0x600d +port_phy_id0_103.0=0x600d +port_phy_id0_104.0=0x600d + +port_phy_id1_1.0=0x8500 +port_phy_id1_5.0=0x8500 +port_phy_id1_9.0=0x8500 +port_phy_id1_13.0=0x8500 +port_phy_id1_101.0=0x8500 +port_phy_id1_102.0=0x8500 +port_phy_id1_103.0=0x8500 +port_phy_id1_104.0=0x8500 + +xgxs_rx_lane_map_1.0=0x0123 +xgxs_rx_lane_map_5.0=0x0123 +xgxs_rx_lane_map_9.0=0x0123 +xgxs_rx_lane_map_13.0=0x0123 +xgxs_rx_lane_map_17.0=0x2031 +xgxs_rx_lane_map_21.0=0x2031 +xgxs_rx_lane_map_25.0=0x2031 +xgxs_rx_lane_map_29.0=0x2031 +xgxs_rx_lane_map_33.0=0x3120 +xgxs_rx_lane_map_37.0=0x3120 +xgxs_rx_lane_map_41.0=0x3120 +xgxs_rx_lane_map_45.0=0x3120 +xgxs_rx_lane_map_49.0=0x3120 +xgxs_rx_lane_map_53.0=0x3120 +xgxs_rx_lane_map_57.0=0x3120 +xgxs_rx_lane_map_61.0=0x3120 +xgxs_rx_lane_map_65.0=0x3120 +xgxs_rx_lane_map_69.0=0x3120 +xgxs_rx_lane_map_73.0=0x3120 +xgxs_rx_lane_map_77.0=0x3120 +xgxs_rx_lane_map_81.0=0x3120 +xgxs_rx_lane_map_85.0=0x3120 +xgxs_rx_lane_map_89.0=0x3120 +xgxs_rx_lane_map_93.0=0x3120 +xgxs_rx_lane_map_97.0=0x1302 +xgxs_rx_lane_map_98.0=0x1302 +xgxs_rx_lane_map_99.0=0x0213 +xgxs_tx_lane_map_100.0=0x0213 +xgxs_tx_lane_map_101.0=0x0123 +xgxs_tx_lane_map_102.0=0x0123 +xgxs_tx_lane_map_103.0=0x0123 +xgxs_tx_lane_map_104.0=0x0123 + +xgxs_tx_lane_map_1.0=0x0123 +xgxs_tx_lane_map_5.0=0x0123 +xgxs_tx_lane_map_9.0=0x0123 +xgxs_tx_lane_map_13.0=0x0123 +xgxs_tx_lane_map_17.0=0x1302 +xgxs_tx_lane_map_21.0=0x1302 +xgxs_tx_lane_map_25.0=0x1302 +xgxs_tx_lane_map_29.0=0x1302 +xgxs_tx_lane_map_33.0=0x3120 +xgxs_tx_lane_map_37.0=0x3120 +xgxs_tx_lane_map_41.0=0x3120 +xgxs_tx_lane_map_45.0=0x3120 +xgxs_tx_lane_map_49.0=0x3120 +xgxs_tx_lane_map_53.0=0x3120 +xgxs_tx_lane_map_57.0=0x3120 +xgxs_tx_lane_map_61.0=0x3120 +xgxs_tx_lane_map_65.0=0x3120 +xgxs_tx_lane_map_69.0=0x3120 +xgxs_tx_lane_map_73.0=0x3120 +xgxs_tx_lane_map_77.0=0x3120 +xgxs_tx_lane_map_81.0=0x3120 +xgxs_tx_lane_map_85.0=0x3120 +xgxs_tx_lane_map_89.0=0x3120 +xgxs_tx_lane_map_93.0=0x3120 +xgxs_tx_lane_map_97.0=0x2031 +xgxs_tx_lane_map_98.0=0x2031 +xgxs_tx_lane_map_99.0=0x0213 +xgxs_rx_lane_map_100.0=0x0213 +xgxs_rx_lane_map_101.0=0x0123 +xgxs_rx_lane_map_102.0=0x0123 +xgxs_rx_lane_map_103.0=0x0123 +xgxs_rx_lane_map_104.0=0x0123 + +serdes_firmware_mode_1.0=1 +serdes_firmware_mode_5.0=1 +serdes_firmware_mode_9.0=1 +serdes_firmware_mode_13.0=1 +serdes_firmware_mode_17.0=2 +serdes_firmware_mode_21.0=2 +serdes_firmware_mode_25.0=2 +serdes_firmware_mode_29.0=2 +serdes_firmware_mode_33.0=2 +serdes_firmware_mode_37.0=2 +serdes_firmware_mode_41.0=2 +serdes_firmware_mode_45.0=2 +serdes_firmware_mode_49.0=2 +serdes_firmware_mode_53.0=2 +serdes_firmware_mode_57.0=2 +serdes_firmware_mode_61.0=2 +serdes_firmware_mode_65.0=2 +serdes_firmware_mode_66.0=2 +serdes_firmware_mode_67.0=2 +serdes_firmware_mode_68.0=2 +serdes_firmware_mode_69.0=2 +serdes_firmware_mode_70.0=2 +serdes_firmware_mode_71.0=2 +serdes_firmware_mode_72.0=2 +serdes_firmware_mode_73.0=2 +serdes_firmware_mode_74.0=2 +serdes_firmware_mode_75.0=2 +serdes_firmware_mode_76.0=2 +serdes_firmware_mode_77.0=2 +serdes_firmware_mode_78.0=2 +serdes_firmware_mode_79.0=2 +serdes_firmware_mode_80.0=2 +serdes_firmware_mode_81.0=2 +serdes_firmware_mode_82.0=2 +serdes_firmware_mode_83.0=2 +serdes_firmware_mode_84.0=2 +serdes_firmware_mode_85.0=2 +serdes_firmware_mode_86.0=2 +serdes_firmware_mode_87.0=2 +serdes_firmware_mode_88.0=2 +serdes_firmware_mode_89.0=2 +serdes_firmware_mode_90.0=2 +serdes_firmware_mode_91.0=2 +serdes_firmware_mode_92.0=2 +serdes_firmware_mode_93.0=2 +serdes_firmware_mode_94.0=2 +serdes_firmware_mode_95.0=2 +serdes_firmware_mode_96.0=2 +serdes_firmware_mode_97.0=2 +serdes_firmware_mode_98.0=2 +serdes_firmware_mode_99.0=2 +serdes_firmware_mode_100.0=2 +serdes_firmware_mode_101.0=1 +serdes_firmware_mode_102.0=1 +serdes_firmware_mode_103.0=1 +serdes_firmware_mode_104.0=1 diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile index 938d37180676..27d83fcc20e9 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile @@ -1,2 +1,2 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/td2-a7050-qx32-32x40G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td2-a7050-qx32-32x40G.config.bcm SAI_NUM_ECMP_MEMBERS=32 diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/td2-a7050-qx32-32x40G.config.bcm b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/td2-a7050-qx32-32x40G.config.bcm new file mode 100644 index 000000000000..701a8480dcb3 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/td2-a7050-qx32-32x40G.config.bcm @@ -0,0 +1,873 @@ +#/****************************************************************************** +# * +# * File: config.bcm.cloverdales (7050-QX32) +# * Name: +# * +# * Description: This file contains SDK properties for an Arista +# * Cloverdales platform. +# * +# *----------------------------------------------------------------------------- +# ******************************************************************************/ +#################################################################### +# BCM Config file for Cloverdale platform +# - 32x40g Portmode + +# Old LPM only configuration +# l2_mem_entries=163840 +# l3_mem_entries=90112 +# l3_alpm_enable=0 +# ipv6_lpm_128b_enable=0 +# +# ALPM enable +l3_alpm_enable=2 +ipv6_lpm_128b_enable=1 +l2_mem_entries=32768 +l3_mem_entries=16384 + +# From old config file +os=unix +higig2_hdr_mode=1 + +# Parity +parity_correction=1 +parity_enable=1 +stat_if_parity_enable=0 + +# l2 thread related config vars +l2xmsg_hostbuf_size=8192 +l2xmsg_mode=1 + +bcm_num_cos=8 +bcm_stat_interval=2000000 +lls_num_l2uc=12 +max_vp_lags=0 +miim_intr_enable=0 +mmu_lossless=0 +module_64ports=0 +scache_filename=/tmp/scache +schan_intr_enable=0 +stable_size=0x2000000 +tdma_timeout_usec=5000000 + +# for GLC transceiver +phy_an_c73=0x0 +phy_an_c37=0x3 + +########################### +#port_init_speed_xe=40000 +#port_init_speed_xe.0=40000 + +#load_firmware=0x0102 +load_firmware.0=2 + +######################### +# All ports are in oversubscription mode +pbmp_oversubscribe=0x1fffffffffffffffffffffffffe +pbmp_xport_xe.0=0x1fffffffe + +phy_84328_1.0=1 +phy_84328_2.0=1 +phy_84328_29.0=1 +phy_84328_3.0=1 +phy_84328_30.0=1 +phy_84328_31.0=1 +phy_84328_32.0=1 +phy_84328_4.0=1 +phy_an_c37_1.0=3 +phy_an_c37_10.0=3 +phy_an_c37_11.0=3 +phy_an_c37_12.0=3 +phy_an_c37_13.0=3 +phy_an_c37_14.0=3 +phy_an_c37_15.0=3 +phy_an_c37_16.0=3 +phy_an_c37_17.0=3 +phy_an_c37_18.0=3 +phy_an_c37_19.0=3 +phy_an_c37_2.0=3 +phy_an_c37_20.0=3 +phy_an_c37_21.0=3 +phy_an_c37_22.0=3 +phy_an_c37_23.0=3 +phy_an_c37_24.0=3 +phy_an_c37_25.0=3 +phy_an_c37_26.0=3 +phy_an_c37_27.0=3 +phy_an_c37_28.0=3 +phy_an_c37_29.0=3 +phy_an_c37_3.0=3 +phy_an_c37_30.0=3 +phy_an_c37_31.0=3 +phy_an_c37_32.0=3 +phy_an_c37_4.0=3 +phy_an_c37_5.0=3 +phy_an_c37_6.0=3 +phy_an_c37_7.0=3 +phy_an_c37_8.0=3 +phy_an_c37_9.0=3 +phy_an_c73_1.0=1 +phy_an_c73_10.0=1 +phy_an_c73_11.0=1 +phy_an_c73_12.0=1 +phy_an_c73_13.0=1 +phy_an_c73_14.0=1 +phy_an_c73_15.0=1 +phy_an_c73_16.0=1 +phy_an_c73_17.0=1 +phy_an_c73_18.0=1 +phy_an_c73_19.0=1 +phy_an_c73_2.0=1 +phy_an_c73_20.0=1 +phy_an_c73_21.0=1 +phy_an_c73_22.0=1 +phy_an_c73_23.0=1 +phy_an_c73_24.0=1 +phy_an_c73_25.0=1 +phy_an_c73_26.0=1 +phy_an_c73_27.0=1 +phy_an_c73_28.0=1 +phy_an_c73_29.0=1 +phy_an_c73_3.0=1 +phy_an_c73_30.0=1 +phy_an_c73_31.0=1 +phy_an_c73_32.0=1 +phy_an_c73_4.0=1 +phy_an_c73_5.0=1 +phy_an_c73_6.0=1 +phy_an_c73_7.0=1 +phy_an_c73_8.0=1 +phy_an_c73_9.0=1 +phy_aux_voltage_enable_1.0=0x1 +phy_aux_voltage_enable_2.0=0x1 +phy_aux_voltage_enable_29.0=0x1 +phy_aux_voltage_enable_3.0=0x1 +phy_aux_voltage_enable_30.0=0x1 +phy_aux_voltage_enable_31.0=0x1 +phy_aux_voltage_enable_32.0=0x1 +phy_aux_voltage_enable_4.0=0x1 +phy_ext_rom_boot.0=0 +phy_ext_rom_boot_1.0=0x0 +phy_ext_rom_boot_2.0=0x0 +phy_ext_rom_boot_29.0=0x0 +phy_ext_rom_boot_3.0=0x0 +phy_ext_rom_boot_30.0=0x0 +phy_ext_rom_boot_31.0=0x0 +phy_ext_rom_boot_32.0=0x0 +phy_ext_rom_boot_4.0=0x0 +phy_line_tx_mode_1.0=1 +phy_line_tx_mode_2.0=1 +phy_line_tx_mode_29.0=1 +phy_line_tx_mode_3.0=1 +phy_line_tx_mode_30.0=1 +phy_line_tx_mode_31.0=1 +phy_line_tx_mode_32.0=1 +phy_line_tx_mode_4.0=1 +phy_rx_polarity_flip_1.0=0x0 +phy_rx_polarity_flip_2.0=0x0 +phy_rx_polarity_flip_29.0=0x0 +phy_rx_polarity_flip_3.0=0x0 +phy_rx_polarity_flip_30.0=0x0 +phy_rx_polarity_flip_31.0=0x0 +phy_rx_polarity_flip_32.0=0x0 +phy_rx_polarity_flip_4.0=0x0 +phy_system_tx_mode_1.0=0 +phy_system_tx_mode_2.0=0 +phy_system_tx_mode_29.0=0 +phy_system_tx_mode_3.0=0 +phy_system_tx_mode_30.0=0 +phy_system_tx_mode_31.0=0 +phy_system_tx_mode_32.0=0 +phy_system_tx_mode_4.0=0 +phy_tx_polarity_flip_1.0=0x0 +phy_tx_polarity_flip_2.0=0x0 +phy_tx_polarity_flip_29.0=0x0 +phy_tx_polarity_flip_3.0=0x0 +phy_tx_polarity_flip_30.0=0x0 +phy_tx_polarity_flip_31.0=0x0 +phy_tx_polarity_flip_32.0=0x0 +phy_tx_polarity_flip_4.0=0x0 +phy_xaui_rx_polarity_flip_1.0=0x0 +phy_xaui_rx_polarity_flip_10.0=0x0 +phy_xaui_rx_polarity_flip_11.0=0x0 +phy_xaui_rx_polarity_flip_12.0=0x0 +phy_xaui_rx_polarity_flip_13.0=0x0 +phy_xaui_rx_polarity_flip_14.0=0x0 +phy_xaui_rx_polarity_flip_15.0=0x0 +phy_xaui_rx_polarity_flip_16.0=0x0 +phy_xaui_rx_polarity_flip_17.0=0x0 +phy_xaui_rx_polarity_flip_18.0=0x0 +phy_xaui_rx_polarity_flip_19.0=0x0 +phy_xaui_rx_polarity_flip_2.0=0x0 +phy_xaui_rx_polarity_flip_20.0=0x0 +phy_xaui_rx_polarity_flip_21.0=0x0 +phy_xaui_rx_polarity_flip_22.0=0x0 +phy_xaui_rx_polarity_flip_23.0=0x0 +phy_xaui_rx_polarity_flip_24.0=0x0 +phy_xaui_rx_polarity_flip_25.0=0x0 +phy_xaui_rx_polarity_flip_26.0=0x0 +phy_xaui_rx_polarity_flip_27.0=0x0 +phy_xaui_rx_polarity_flip_28.0=0x0 +phy_xaui_rx_polarity_flip_29.0=0x0 +phy_xaui_rx_polarity_flip_3.0=0x0 +phy_xaui_rx_polarity_flip_30.0=0x0 +phy_xaui_rx_polarity_flip_31.0=0x0 +phy_xaui_rx_polarity_flip_32.0=0x0 +phy_xaui_rx_polarity_flip_4.0=0x0 +phy_xaui_rx_polarity_flip_5.0=0x0 +phy_xaui_rx_polarity_flip_6.0=0x0 +phy_xaui_rx_polarity_flip_7.0=0x0 +phy_xaui_rx_polarity_flip_8.0=0x0 +phy_xaui_rx_polarity_flip_9.0=0x0 +phy_xaui_tx_polarity_flip_1.0=0x0 +phy_xaui_tx_polarity_flip_10.0=0x0 +phy_xaui_tx_polarity_flip_11.0=0x0 +phy_xaui_tx_polarity_flip_12.0=0x0 +phy_xaui_tx_polarity_flip_13.0=0x0 +phy_xaui_tx_polarity_flip_14.0=0x0 +phy_xaui_tx_polarity_flip_15.0=0x0 +phy_xaui_tx_polarity_flip_16.0=0x0 +phy_xaui_tx_polarity_flip_17.0=0x0 +phy_xaui_tx_polarity_flip_18.0=0x0 +phy_xaui_tx_polarity_flip_19.0=0x0 +phy_xaui_tx_polarity_flip_2.0=0x0 +phy_xaui_tx_polarity_flip_20.0=0x0 +phy_xaui_tx_polarity_flip_21.0=0x0 +phy_xaui_tx_polarity_flip_22.0=0x0 +phy_xaui_tx_polarity_flip_23.0=0x0 +phy_xaui_tx_polarity_flip_24.0=0x0 +phy_xaui_tx_polarity_flip_25.0=0x0 +phy_xaui_tx_polarity_flip_26.0=0x0 +phy_xaui_tx_polarity_flip_27.0=0x0 +phy_xaui_tx_polarity_flip_28.0=0x0 +phy_xaui_tx_polarity_flip_29.0=0x0 +phy_xaui_tx_polarity_flip_3.0=0x0 +phy_xaui_tx_polarity_flip_30.0=0x0 +phy_xaui_tx_polarity_flip_31.0=0x0 +phy_xaui_tx_polarity_flip_32.0=0x0 +phy_xaui_tx_polarity_flip_4.0=0x0 +phy_xaui_tx_polarity_flip_5.0=0x0 +phy_xaui_tx_polarity_flip_6.0=0x0 +phy_xaui_tx_polarity_flip_7.0=0x0 +phy_xaui_tx_polarity_flip_8.0=0x0 +phy_xaui_tx_polarity_flip_9.0=0x0 +port_init_autoneg_10.0=0 +port_init_autoneg_11.0=0 +port_init_autoneg_12.0=0 +port_init_autoneg_13.0=0 +port_init_autoneg_14.0=0 +port_init_autoneg_15.0=0 +port_init_autoneg_16.0=0 +port_init_autoneg_17.0=0 +port_init_autoneg_18.0=0 +port_init_autoneg_19.0=0 +port_init_autoneg_20.0=0 +port_init_autoneg_21.0=0 +port_init_autoneg_22.0=0 +port_init_autoneg_23.0=0 +port_init_autoneg_24.0=0 +port_init_autoneg_25.0=0 +port_init_autoneg_26.0=0 +port_init_autoneg_27.0=0 +port_init_autoneg_28.0=0 +port_init_autoneg_5.0=0 +port_init_autoneg_6.0=0 +port_init_autoneg_7.0=0 +port_init_autoneg_8.0=0 +port_init_autoneg_9.0=0 +port_init_cl72_hg.0=0x11 +port_phy_addr_1.0=0x4 +port_phy_addr_10.0=0x7f +port_phy_addr_11.0=0x7f +port_phy_addr_12.0=0x7f +port_phy_addr_13.0=0x7f +port_phy_addr_14.0=0x7f +port_phy_addr_15.0=0x7f +port_phy_addr_16.0=0x7f +port_phy_addr_17.0=0x7f +port_phy_addr_18.0=0x7f +port_phy_addr_19.0=0x7f +port_phy_addr_2.0=0x0 +port_phy_addr_20.0=0x7f +port_phy_addr_21.0=0x7f +port_phy_addr_22.0=0x7f +port_phy_addr_23.0=0x7f +port_phy_addr_24.0=0x7f +port_phy_addr_25.0=0x7f +port_phy_addr_26.0=0x7f +port_phy_addr_27.0=0x7f +port_phy_addr_28.0=0x7f +port_phy_addr_29.0=0x54 +port_phy_addr_3.0=0x2c +port_phy_addr_30.0=0x50 +port_phy_addr_31.0=0x7c +port_phy_addr_32.0=0x78 +port_phy_addr_4.0=0x28 +port_phy_addr_5.0=0x7f +port_phy_addr_6.0=0x7f +port_phy_addr_7.0=0x7f +port_phy_addr_8.0=0x7f +port_phy_addr_9.0=0x7f +port_phy_clause_1.0=0x2d +port_phy_clause_2.0=0x2d +port_phy_clause_29.0=0x2d +port_phy_clause_3.0=0x2d +port_phy_clause_30.0=0x2d +port_phy_clause_31.0=0x2d +port_phy_clause_32.0=0x2d +port_phy_clause_4.0=0x2d +port_phy_id0_1.0=0x600d +port_phy_id0_2.0=0x600d +port_phy_id0_29.0=0x600d +port_phy_id0_3.0=0x600d +port_phy_id0_30.0=0x600d +port_phy_id0_31.0=0x600d +port_phy_id0_32.0=0x600d +port_phy_id0_4.0=0x600d +port_phy_id1_1.0=0x8500 +port_phy_id1_2.0=0x8500 +port_phy_id1_29.0=0x8500 +port_phy_id1_3.0=0x8500 +port_phy_id1_30.0=0x8500 +port_phy_id1_31.0=0x8500 +port_phy_id1_32.0=0x8500 +port_phy_id1_4.0=0x8500 +portmap_1.0=125:40 +portmap_10.0=33:40 +portmap_11.0=45:40 +portmap_12.0=41:40 +portmap_13.0=53:40 +portmap_14.0=49:40 +portmap_15.0=69:40 +portmap_16.0=65:40 +portmap_17.0=77:40 +portmap_18.0=73:40 +portmap_19.0=93:40 +portmap_2.0=121:40 +portmap_20.0=89:40 +portmap_21.0=101:40 +portmap_22.0=97:40 +portmap_23.0=109:40 +portmap_24.0=105:40 +portmap_25.0=61:40 +portmap_26.0=57:40 +portmap_27.0=81:40 +portmap_28.0=85:40 +portmap_29.0=117:40 +portmap_3.0=13:40 +portmap_30.0=113:40 +portmap_31.0=5:40 +portmap_32.0=1:40 +portmap_4.0=9:40 +portmap_5.0=17:40 +portmap_6.0=21:40 +portmap_7.0=25:40 +portmap_8.0=29:40 +portmap_9.0=37:40 +serdes_firmware_mode_1.0=1 +serdes_firmware_mode_10.0=2 +serdes_firmware_mode_11.0=2 +serdes_firmware_mode_12.0=2 +serdes_firmware_mode_13.0=2 +serdes_firmware_mode_14.0=2 +serdes_firmware_mode_15.0=2 +serdes_firmware_mode_16.0=2 +serdes_firmware_mode_17.0=2 +serdes_firmware_mode_18.0=2 +serdes_firmware_mode_19.0=2 +serdes_firmware_mode_2.0=1 +serdes_firmware_mode_20.0=2 +serdes_firmware_mode_21.0=2 +serdes_firmware_mode_22.0=2 +serdes_firmware_mode_23.0=2 +serdes_firmware_mode_24.0=2 +serdes_firmware_mode_25.0=2 +serdes_firmware_mode_26.0=2 +serdes_firmware_mode_27.0=2 +serdes_firmware_mode_28.0=2 +serdes_firmware_mode_29.0=1 +serdes_firmware_mode_3.0=1 +serdes_firmware_mode_30.0=1 +serdes_firmware_mode_31.0=1 +serdes_firmware_mode_32.0=1 +serdes_firmware_mode_4.0=1 +serdes_firmware_mode_5.0=2 +serdes_firmware_mode_6.0=2 +serdes_firmware_mode_7.0=2 +serdes_firmware_mode_8.0=2 +serdes_firmware_mode_9.0=2 +xgxs_lcpll_xtal_refclk.0=1 +xgxs_rx_lane_map_1.0=0x0123 +xgxs_rx_lane_map_10.0=0x3120 +xgxs_rx_lane_map_11.0=0x3120 +xgxs_rx_lane_map_12.0=0x3120 +xgxs_rx_lane_map_13.0=0x3120 +xgxs_rx_lane_map_14.0=0x3120 +xgxs_rx_lane_map_15.0=0x3120 +xgxs_rx_lane_map_16.0=0x3120 +xgxs_rx_lane_map_17.0=0x3120 +xgxs_rx_lane_map_18.0=0x3120 +xgxs_rx_lane_map_19.0=0x3120 +xgxs_rx_lane_map_2.0=0x0123 +xgxs_rx_lane_map_20.0=0x3120 +xgxs_rx_lane_map_21.0=0x3120 +xgxs_rx_lane_map_22.0=0x3120 +xgxs_rx_lane_map_23.0=0x3120 +xgxs_rx_lane_map_24.0=0x3120 +xgxs_rx_lane_map_25.0=0x2031 +xgxs_rx_lane_map_26.0=0x2031 +xgxs_rx_lane_map_27.0=0x0213 +xgxs_rx_lane_map_28.0=0x0213 +xgxs_rx_lane_map_29.0=0x0123 +xgxs_rx_lane_map_3.0=0x0123 +xgxs_rx_lane_map_30.0=0x0123 +xgxs_rx_lane_map_31.0=0x0123 +xgxs_rx_lane_map_32.0=0x0123 +xgxs_rx_lane_map_4.0=0x0123 +xgxs_rx_lane_map_5.0=0x2031 +xgxs_rx_lane_map_6.0=0x2031 +xgxs_rx_lane_map_7.0=0x2031 +xgxs_rx_lane_map_8.0=0x2031 +xgxs_rx_lane_map_9.0=0x3120 +xgxs_tx_lane_map_1.0=0x0123 +xgxs_tx_lane_map_10.0=0x3120 +xgxs_tx_lane_map_11.0=0x3120 +xgxs_tx_lane_map_12.0=0x3120 +xgxs_tx_lane_map_13.0=0x3120 +xgxs_tx_lane_map_14.0=0x3120 +xgxs_tx_lane_map_15.0=0x3120 +xgxs_tx_lane_map_16.0=0x3120 +xgxs_tx_lane_map_17.0=0x3120 +xgxs_tx_lane_map_18.0=0x3120 +xgxs_tx_lane_map_19.0=0x3120 +xgxs_tx_lane_map_2.0=0x0123 +xgxs_tx_lane_map_20.0=0x3120 +xgxs_tx_lane_map_21.0=0x3120 +xgxs_tx_lane_map_22.0=0x3120 +xgxs_tx_lane_map_23.0=0x3120 +xgxs_tx_lane_map_24.0=0x3120 +xgxs_tx_lane_map_25.0=0x2031 +xgxs_tx_lane_map_26.0=0x2031 +xgxs_tx_lane_map_27.0=0x0213 +xgxs_tx_lane_map_28.0=0x0213 +xgxs_tx_lane_map_29.0=0x0123 +xgxs_tx_lane_map_3.0=0x0123 +xgxs_tx_lane_map_30.0=0x0123 +xgxs_tx_lane_map_31.0=0x0123 +xgxs_tx_lane_map_32.0=0x0123 +xgxs_tx_lane_map_4.0=0x0123 +xgxs_tx_lane_map_5.0=0x1302 +xgxs_tx_lane_map_6.0=0x1302 +xgxs_tx_lane_map_7.0=0x1302 +xgxs_tx_lane_map_8.0=0x1302 +xgxs_tx_lane_map_9.0=0x3120 + +########################################## +#skip_L2_USER_ENTRY=0 +phy_aux_voltage_enable=1 +############################### +serdes_fiber_pref=1 +############################### +mdio_output_delay.0=0x0d +############################### +serdes_sgmii_m=0 +xgxs_lcpll_xtal_refclk=1 +xgxs_lcpll_xtal_refclk.1=1 +xgxs_lcpll_xtal_refclk.2=1 +xgxs_lcpll_xtal_refclk.3=1 +tdma_intr_enable=1 +tslam_intr_enable=1 +tslam_dma_enable.2=1 +tslam_dma_enable.3=1 +#dport_map_port=0 +#dport_map_enable=0 +#dport_map_indexed=0 +#bcm_xlate_port_enable.0=0 +#xgxs_pdetect_1=0 +table_dma_enable.0=1 +table_dma_enable.1=1 +table_dma_enable.2=1 +table_dma_enable.3=1 +serdes_driver_current_lane0_1=2 +serdes_pre_driver_current_lane0_1=2 +serdes_preemphasis_lane0_1=0x8fc0 +serdes_driver_current_lane1_1=2 +serdes_pre_driver_current_lane1_1=2 +serdes_preemphasis_lane1_1=0x8fc0 +serdes_driver_current_lane2_1=2 +serdes_pre_driver_current_lane2_1=2 +serdes_preemphasis_lane2_1=0x8fc0 +serdes_driver_current_lane3_1=2 +serdes_pre_driver_current_lane3_1=2 +serdes_preemphasis_lane3_1=0x8fc0 +serdes_driver_current_lane0_2=3 +serdes_pre_driver_current_lane0_2=2 +serdes_preemphasis_lane0_2=0x8fc0 +serdes_driver_current_lane1_2=3 +serdes_pre_driver_current_lane1_2=2 +serdes_preemphasis_lane1_2=0x8fc0 +serdes_driver_current_lane2_2=3 +serdes_pre_driver_current_lane2_2=2 +serdes_preemphasis_lane2_2=0x8fc0 +serdes_driver_current_lane3_2=3 +serdes_pre_driver_current_lane3_2=2 +serdes_preemphasis_lane3_2=0x8fc0 +serdes_driver_current_lane0_3=2 +serdes_pre_driver_current_lane0_3=2 +serdes_preemphasis_lane0_3=0x8fc0 +serdes_driver_current_lane1_3=2 +serdes_pre_driver_current_lane1_3=2 +serdes_preemphasis_lane1_3=0x8fc0 +serdes_driver_current_lane2_3=2 +serdes_pre_driver_current_lane2_3=2 +serdes_preemphasis_lane2_3=0x8fc0 +serdes_driver_current_lane3_3=2 +serdes_pre_driver_current_lane3_3=2 +serdes_preemphasis_lane3_3=0x8fc0 +serdes_driver_current_lane0_4=2 +serdes_pre_driver_current_lane0_4=2 +serdes_preemphasis_lane0_4=0x8fc0 +serdes_driver_current_lane1_4=2 +serdes_pre_driver_current_lane1_4=2 +serdes_preemphasis_lane1_4=0x8fc0 +serdes_driver_current_lane2_4=2 +serdes_pre_driver_current_lane2_4=2 +serdes_preemphasis_lane2_4=0x8fc0 +serdes_driver_current_lane3_4=2 +serdes_pre_driver_current_lane3_4=2 +serdes_preemphasis_lane3_4=0x8fc0 +serdes_driver_current_lane0_5=4 +serdes_pre_driver_current_lane0_5=4 +serdes_preemphasis_lane0_5=0xbf00 +serdes_driver_current_lane1_5=4 +serdes_pre_driver_current_lane1_5=4 +serdes_preemphasis_lane1_5=0xbf00 +serdes_driver_current_lane2_5=4 +serdes_pre_driver_current_lane2_5=4 +serdes_preemphasis_lane2_5=0xbf00 +serdes_driver_current_lane3_5=4 +serdes_pre_driver_current_lane3_5=4 +serdes_preemphasis_lane3_5=0xbf00 +serdes_driver_current_lane0_6=4 +serdes_pre_driver_current_lane0_6=4 +serdes_preemphasis_lane0_6=0xbb10 +serdes_driver_current_lane1_6=4 +serdes_pre_driver_current_lane1_6=4 +serdes_preemphasis_lane1_6=0xbb10 +serdes_driver_current_lane2_6=4 +serdes_pre_driver_current_lane2_6=4 +serdes_preemphasis_lane2_6=0xbb10 +serdes_driver_current_lane3_6=4 +serdes_pre_driver_current_lane3_6=4 +serdes_preemphasis_lane3_6=0xbb10 +serdes_driver_current_lane0_7=3 +serdes_pre_driver_current_lane0_7=3 +serdes_preemphasis_lane0_7=0xcad0 +serdes_driver_current_lane1_7=3 +serdes_pre_driver_current_lane1_7=3 +serdes_preemphasis_lane1_7=0xcad0 +serdes_driver_current_lane2_7=3 +serdes_pre_driver_current_lane2_7=3 +serdes_preemphasis_lane2_7=0xcad0 +serdes_driver_current_lane3_7=3 +serdes_pre_driver_current_lane3_7=3 +serdes_preemphasis_lane3_7=0xcad0 +serdes_driver_current_lane0_8=3 +serdes_pre_driver_current_lane0_8=3 +serdes_preemphasis_lane0_8=0xcad0 +serdes_driver_current_lane1_8=3 +serdes_pre_driver_current_lane1_8=3 +serdes_preemphasis_lane1_8=0xcad0 +serdes_driver_current_lane2_8=3 +serdes_pre_driver_current_lane2_8=3 +serdes_preemphasis_lane2_8=0xcad0 +serdes_driver_current_lane3_8=3 +serdes_pre_driver_current_lane3_8=3 +serdes_preemphasis_lane3_8=0xcad0 +serdes_driver_current_lane0_9=3 +serdes_pre_driver_current_lane0_9=3 +serdes_preemphasis_lane0_9=0xc2f0 +serdes_driver_current_lane1_9=3 +serdes_pre_driver_current_lane1_9=3 +serdes_preemphasis_lane1_9=0xc2f0 +serdes_driver_current_lane2_9=3 +serdes_pre_driver_current_lane2_9=3 +serdes_preemphasis_lane2_9=0xc2f0 +serdes_driver_current_lane3_9=3 +serdes_pre_driver_current_lane3_9=3 +serdes_preemphasis_lane3_9=0xc2f0 +serdes_driver_current_lane0_10=3 +serdes_pre_driver_current_lane0_10=3 +serdes_preemphasis_lane0_10=0xc6e0 +serdes_driver_current_lane1_10=3 +serdes_pre_driver_current_lane1_10=3 +serdes_preemphasis_lane1_10=0xc6e0 +serdes_driver_current_lane2_10=3 +serdes_pre_driver_current_lane2_10=3 +serdes_preemphasis_lane2_10=0xc6e0 +serdes_driver_current_lane3_10=3 +serdes_pre_driver_current_lane3_10=3 +serdes_preemphasis_lane3_10=0xc6e0 +serdes_driver_current_lane0_11=3 +serdes_pre_driver_current_lane0_11=3 +serdes_preemphasis_lane0_11=0xc2f0 +serdes_driver_current_lane1_11=3 +serdes_pre_driver_current_lane1_11=3 +serdes_preemphasis_lane1_11=0xc2f0 +serdes_driver_current_lane2_11=3 +serdes_pre_driver_current_lane2_11=3 +serdes_preemphasis_lane2_11=0xc2f0 +serdes_driver_current_lane3_11=3 +serdes_pre_driver_current_lane3_11=3 +serdes_preemphasis_lane3_11=0xc2f0 +serdes_driver_current_lane0_12=3 +serdes_pre_driver_current_lane0_12=3 +serdes_preemphasis_lane0_12=0xc2f0 +serdes_driver_current_lane1_12=3 +serdes_pre_driver_current_lane1_12=3 +serdes_preemphasis_lane1_12=0xc2f0 +serdes_driver_current_lane2_12=3 +serdes_pre_driver_current_lane2_12=3 +serdes_preemphasis_lane2_12=0xc2f0 +serdes_driver_current_lane3_12=3 +serdes_pre_driver_current_lane3_12=3 +serdes_preemphasis_lane3_12=0xc2f0 +serdes_driver_current_lane0_13=3 +serdes_pre_driver_current_lane0_13=3 +serdes_preemphasis_lane0_13=0xc2f0 +serdes_driver_current_lane1_13=3 +serdes_pre_driver_current_lane1_13=3 +serdes_preemphasis_lane1_13=0xc2f0 +serdes_driver_current_lane2_13=3 +serdes_pre_driver_current_lane2_13=3 +serdes_preemphasis_lane2_13=0xc2f0 +serdes_driver_current_lane3_13=3 +serdes_pre_driver_current_lane3_13=3 +serdes_preemphasis_lane3_13=0xc2f0 +serdes_driver_current_lane0_14=3 +serdes_pre_driver_current_lane0_14=3 +serdes_preemphasis_lane0_14=0xc2f0 +serdes_driver_current_lane1_14=3 +serdes_pre_driver_current_lane1_14=3 +serdes_preemphasis_lane1_14=0xc2f0 +serdes_driver_current_lane2_14=3 +serdes_pre_driver_current_lane2_14=3 +serdes_preemphasis_lane2_14=0xc2f0 +serdes_driver_current_lane3_14=3 +serdes_pre_driver_current_lane3_14=3 +serdes_preemphasis_lane3_14=0xc2f0 +serdes_driver_current_lane0_15=3 +serdes_pre_driver_current_lane0_15=3 +serdes_preemphasis_lane0_15=0xc2f0 +serdes_driver_current_lane1_15=3 +serdes_pre_driver_current_lane1_15=3 +serdes_preemphasis_lane1_15=0xc2f0 +serdes_driver_current_lane2_15=3 +serdes_pre_driver_current_lane2_15=3 +serdes_preemphasis_lane2_15=0xc2f0 +serdes_driver_current_lane3_15=3 +serdes_pre_driver_current_lane3_15=3 +serdes_preemphasis_lane3_15=0xc2f0 +serdes_driver_current_lane0_16=3 +serdes_pre_driver_current_lane0_16=3 +serdes_preemphasis_lane0_16=0xc2f0 +serdes_driver_current_lane1_16=3 +serdes_pre_driver_current_lane1_16=3 +serdes_preemphasis_lane1_16=0xc2f0 +serdes_driver_current_lane2_16=3 +serdes_pre_driver_current_lane2_16=3 +serdes_preemphasis_lane2_16=0xc2f0 +serdes_driver_current_lane3_16=3 +serdes_pre_driver_current_lane3_16=3 +serdes_preemphasis_lane3_16=0xc2f0 +serdes_driver_current_lane0_17=3 +serdes_pre_driver_current_lane0_17=3 +serdes_preemphasis_lane0_17=0xc2f0 +serdes_driver_current_lane1_17=3 +serdes_pre_driver_current_lane1_17=3 +serdes_preemphasis_lane1_17=0xc2f0 +serdes_driver_current_lane2_17=3 +serdes_pre_driver_current_lane2_17=3 +serdes_preemphasis_lane2_17=0xc2f0 +serdes_driver_current_lane3_17=3 +serdes_pre_driver_current_lane3_17=3 +serdes_preemphasis_lane3_17=0xc2f0 +serdes_driver_current_lane0_18=3 +serdes_pre_driver_current_lane0_18=3 +serdes_preemphasis_lane0_18=0xc2f0 +serdes_driver_current_lane1_18=3 +serdes_pre_driver_current_lane1_18=3 +serdes_preemphasis_lane1_18=0xc2f0 +serdes_driver_current_lane2_18=3 +serdes_pre_driver_current_lane2_18=3 +serdes_preemphasis_lane2_18=0xc2f0 +serdes_driver_current_lane3_18=3 +serdes_pre_driver_current_lane3_18=3 +serdes_preemphasis_lane3_18=0xc2f0 +serdes_driver_current_lane0_19=3 +serdes_pre_driver_current_lane0_19=3 +serdes_preemphasis_lane0_19=0xc2f0 +serdes_driver_current_lane1_19=3 +serdes_pre_driver_current_lane1_19=3 +serdes_preemphasis_lane1_19=0xc2f0 +serdes_driver_current_lane2_19=3 +serdes_pre_driver_current_lane2_19=3 +serdes_preemphasis_lane2_19=0xc2f0 +serdes_driver_current_lane3_19=3 +serdes_pre_driver_current_lane3_19=3 +serdes_preemphasis_lane3_19=0xc2f0 +serdes_driver_current_lane0_20=3 +serdes_pre_driver_current_lane0_20=3 +serdes_preemphasis_lane0_20=0xc2f0 +serdes_driver_current_lane1_20=3 +serdes_pre_driver_current_lane1_20=3 +serdes_preemphasis_lane1_20=0xc2f0 +serdes_driver_current_lane2_20=3 +serdes_pre_driver_current_lane2_20=3 +serdes_preemphasis_lane2_20=0xc2f0 +serdes_driver_current_lane3_20=3 +serdes_pre_driver_current_lane3_20=3 +serdes_preemphasis_lane3_20=0xc2f0 +serdes_driver_current_lane0_21=3 +serdes_pre_driver_current_lane0_21=3 +serdes_preemphasis_lane0_21=0xc6e0 +serdes_driver_current_lane1_21=3 +serdes_pre_driver_current_lane1_21=3 +serdes_preemphasis_lane1_21=0xc6e0 +serdes_driver_current_lane2_21=3 +serdes_pre_driver_current_lane2_21=3 +serdes_preemphasis_lane2_21=0xc6e0 +serdes_driver_current_lane3_21=3 +serdes_pre_driver_current_lane3_21=3 +serdes_preemphasis_lane3_21=0xc6e0 +serdes_driver_current_lane0_22=3 +serdes_pre_driver_current_lane0_22=3 +serdes_preemphasis_lane0_22=0xc6e0 +serdes_driver_current_lane1_22=3 +serdes_pre_driver_current_lane1_22=3 +serdes_preemphasis_lane1_22=0xc6e0 +serdes_driver_current_lane2_22=3 +serdes_pre_driver_current_lane2_22=3 +serdes_preemphasis_lane2_22=0xc6e0 +serdes_driver_current_lane3_22=3 +serdes_pre_driver_current_lane3_22=3 +serdes_preemphasis_lane3_22=0xc6e0 +serdes_driver_current_lane0_23=3 +serdes_pre_driver_current_lane0_23=3 +serdes_preemphasis_lane0_23=0xcad0 +serdes_driver_current_lane1_23=3 +serdes_pre_driver_current_lane1_23=3 +serdes_preemphasis_lane1_23=0xcad0 +serdes_driver_current_lane2_23=3 +serdes_pre_driver_current_lane2_23=3 +serdes_preemphasis_lane2_23=0xcad0 +serdes_driver_current_lane3_23=3 +serdes_pre_driver_current_lane3_23=3 +serdes_preemphasis_lane3_23=0xcad0 +serdes_driver_current_lane0_24=3 +serdes_pre_driver_current_lane0_24=3 +serdes_preemphasis_lane0_24=0xcad0 +serdes_driver_current_lane1_24=3 +serdes_pre_driver_current_lane1_24=3 +serdes_preemphasis_lane1_24=0xcad0 +serdes_driver_current_lane2_24=3 +serdes_pre_driver_current_lane2_24=3 +serdes_preemphasis_lane2_24=0xcad0 +serdes_driver_current_lane3_24=3 +serdes_pre_driver_current_lane3_24=3 +serdes_preemphasis_lane3_24=0xcad0 +serdes_driver_current_lane0_25=5 +serdes_pre_driver_current_lane0_25=5 +serdes_preemphasis_lane0_25=0xc2f0 +serdes_driver_current_lane1_25=5 +serdes_pre_driver_current_lane1_25=5 +serdes_preemphasis_lane1_25=0xc2f0 +serdes_driver_current_lane2_25=5 +serdes_pre_driver_current_lane2_25=5 +serdes_preemphasis_lane2_25=0xc2f0 +serdes_driver_current_lane3_25=5 +serdes_pre_driver_current_lane3_25=5 +serdes_preemphasis_lane3_25=0xc2f0 +serdes_driver_current_lane0_26=5 +serdes_pre_driver_current_lane0_26=5 +serdes_preemphasis_lane0_26=0xc2f0 +serdes_driver_current_lane1_26=5 +serdes_pre_driver_current_lane1_26=5 +serdes_preemphasis_lane1_26=0xc2f0 +serdes_driver_current_lane2_26=5 +serdes_pre_driver_current_lane2_26=5 +serdes_preemphasis_lane2_26=0xc2f0 +serdes_driver_current_lane3_26=5 +serdes_pre_driver_current_lane3_26=5 +serdes_preemphasis_lane3_26=0xc2f0 +serdes_driver_current_lane0_27=5 +serdes_pre_driver_current_lane0_27=5 +serdes_preemphasis_lane0_27=0xc2f0 +serdes_driver_current_lane1_27=5 +serdes_pre_driver_current_lane1_27=5 +serdes_preemphasis_lane1_27=0xc2f0 +serdes_driver_current_lane2_27=5 +serdes_pre_driver_current_lane2_27=5 +serdes_preemphasis_lane2_27=0xc2f0 +serdes_driver_current_lane3_27=5 +serdes_pre_driver_current_lane3_27=5 +serdes_preemphasis_lane3_27=0xc2f0 +serdes_driver_current_lane0_28=8 +serdes_pre_driver_current_lane0_28=6 +serdes_preemphasis_lane0_28=0xc2f0 +serdes_driver_current_lane1_28=8 +serdes_pre_driver_current_lane1_28=6 +serdes_preemphasis_lane1_28=0xc2f0 +serdes_driver_current_lane2_28=8 +serdes_pre_driver_current_lane2_28=6 +serdes_preemphasis_lane2_28=0xc2f0 +serdes_driver_current_lane3_28=8 +serdes_pre_driver_current_lane3_28=6 +serdes_preemphasis_lane3_28=0xc2f0 +serdes_driver_current_lane0_29=2 +serdes_pre_driver_current_lane0_29=2 +serdes_preemphasis_lane0_29=0x8fc0 +serdes_driver_current_lane1_29=2 +serdes_pre_driver_current_lane1_29=2 +serdes_preemphasis_lane1_29=0x8fc0 +serdes_driver_current_lane2_29=2 +serdes_pre_driver_current_lane2_29=2 +serdes_preemphasis_lane2_29=0x8fc0 +serdes_driver_current_lane3_29=2 +serdes_pre_driver_current_lane3_29=2 +serdes_preemphasis_lane3_29=0x8fc0 +serdes_driver_current_lane0_30=2 +serdes_pre_driver_current_lane0_30=2 +serdes_preemphasis_lane0_30=0x8fc0 +serdes_driver_current_lane1_30=2 +serdes_pre_driver_current_lane1_30=2 +serdes_preemphasis_lane1_30=0x8fc0 +serdes_driver_current_lane2_30=2 +serdes_pre_driver_current_lane2_30=2 +serdes_preemphasis_lane2_30=0x8fc0 +serdes_driver_current_lane3_30=2 +serdes_pre_driver_current_lane3_30=2 +serdes_preemphasis_lane3_30=0x8fc0 +serdes_driver_current_lane0_31=2 +serdes_pre_driver_current_lane0_31=2 +serdes_preemphasis_lane0_31=0x8fc0 +serdes_driver_current_lane1_31=2 +serdes_pre_driver_current_lane1_31=2 +serdes_preemphasis_lane1_31=0x8fc0 +serdes_driver_current_lane2_31=2 +serdes_pre_driver_current_lane2_31=2 +serdes_preemphasis_lane2_31=0x8fc0 +serdes_driver_current_lane3_31=2 +serdes_pre_driver_current_lane3_31=2 +serdes_preemphasis_lane3_31=0x8fc0 +serdes_driver_current_lane0_32=2 +serdes_pre_driver_current_lane0_32=2 +serdes_preemphasis_lane0_32=0x8fc0 +serdes_driver_current_lane1_32=2 +serdes_pre_driver_current_lane1_32=2 +serdes_preemphasis_lane1_32=0x8fc0 +serdes_driver_current_lane2_32=2 +serdes_pre_driver_current_lane2_32=2 +serdes_preemphasis_lane2_32=0x8fc0 +serdes_driver_current_lane3_32=2 +serdes_pre_driver_current_lane3_32=2 +serdes_preemphasis_lane3_32=0x8fc0 From fae346f586e816d2852d86d5bd35d513d095b455 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 14 Jun 2018 12:11:29 -0700 Subject: [PATCH 227/274] Don't create a pty to run vtysh inside of the docker container (#1792) --- dockers/docker-fpm-frr/base_image_files/vtysh | 9 +-------- dockers/docker-fpm-quagga/base_image_files/vtysh | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/dockers/docker-fpm-frr/base_image_files/vtysh b/dockers/docker-fpm-frr/base_image_files/vtysh index 8f8cb2e67960..c479fcd3653b 100755 --- a/dockers/docker-fpm-frr/base_image_files/vtysh +++ b/dockers/docker-fpm-frr/base_image_files/vtysh @@ -1,10 +1,3 @@ #!/bin/bash -DOCKER_EXEC_FLAGS="i" - -# Determine whether stdout is on a terminal -if [ -t 1 ] ; then - DOCKER_EXEC_FLAGS+="t" -fi - -docker exec -$DOCKER_EXEC_FLAGS bgp vtysh "$@" +docker exec -i bgp vtysh "$@" diff --git a/dockers/docker-fpm-quagga/base_image_files/vtysh b/dockers/docker-fpm-quagga/base_image_files/vtysh index 8f8cb2e67960..c479fcd3653b 100755 --- a/dockers/docker-fpm-quagga/base_image_files/vtysh +++ b/dockers/docker-fpm-quagga/base_image_files/vtysh @@ -1,10 +1,3 @@ #!/bin/bash -DOCKER_EXEC_FLAGS="i" - -# Determine whether stdout is on a terminal -if [ -t 1 ] ; then - DOCKER_EXEC_FLAGS+="t" -fi - -docker exec -$DOCKER_EXEC_FLAGS bgp vtysh "$@" +docker exec -i bgp vtysh "$@" From 1c8bacb0078714f63b6f0428b6d471c3ed719f9d Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 14 Jun 2018 21:53:31 -0700 Subject: [PATCH 228/274] Fix comment typos (#1794) Signed-off-by: Qi Luo --- dockers/docker-fpm-frr/isolate.j2 | 2 +- dockers/docker-fpm-frr/unisolate.j2 | 2 +- dockers/docker-fpm-quagga/isolate.j2 | 2 +- dockers/docker-fpm-quagga/unisolate.j2 | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dockers/docker-fpm-frr/isolate.j2 b/dockers/docker-fpm-frr/isolate.j2 index 7b7fecf9fa9e..cfcd023ea1f3 100755 --- a/dockers/docker-fpm-frr/isolate.j2 +++ b/dockers/docker-fpm-frr/isolate.j2 @@ -5,7 +5,7 @@ sed -n -e '9,$p' < "$0" | vtysh "$@" ## Exit with vtysh return code exit $? -## vtysh script start from next line, which line number MUST eqaul in 'sed' command above +## vtysh script start from next line, which line number MUST equal in 'sed' command above configure terminal router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} diff --git a/dockers/docker-fpm-frr/unisolate.j2 b/dockers/docker-fpm-frr/unisolate.j2 index f2129556747b..2a0780745d75 100755 --- a/dockers/docker-fpm-frr/unisolate.j2 +++ b/dockers/docker-fpm-frr/unisolate.j2 @@ -5,7 +5,7 @@ sed -n -e '9,$p' < "$0" | vtysh "$@" ## Exit with vtysh return code exit $? -## vtysh script start from next line, which line number MUST eqaul in 'sed' command above +## vtysh script start from next line, which line number MUST equal in 'sed' command above configure terminal router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} diff --git a/dockers/docker-fpm-quagga/isolate.j2 b/dockers/docker-fpm-quagga/isolate.j2 index 7b7fecf9fa9e..cfcd023ea1f3 100755 --- a/dockers/docker-fpm-quagga/isolate.j2 +++ b/dockers/docker-fpm-quagga/isolate.j2 @@ -5,7 +5,7 @@ sed -n -e '9,$p' < "$0" | vtysh "$@" ## Exit with vtysh return code exit $? -## vtysh script start from next line, which line number MUST eqaul in 'sed' command above +## vtysh script start from next line, which line number MUST equal in 'sed' command above configure terminal router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} diff --git a/dockers/docker-fpm-quagga/unisolate.j2 b/dockers/docker-fpm-quagga/unisolate.j2 index f2129556747b..2a0780745d75 100755 --- a/dockers/docker-fpm-quagga/unisolate.j2 +++ b/dockers/docker-fpm-quagga/unisolate.j2 @@ -5,7 +5,7 @@ sed -n -e '9,$p' < "$0" | vtysh "$@" ## Exit with vtysh return code exit $? -## vtysh script start from next line, which line number MUST eqaul in 'sed' command above +## vtysh script start from next line, which line number MUST equal in 'sed' command above configure terminal router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} From a8a7b795dbdb5f5f79a4c9088174391274ca6d05 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 19 Jun 2018 13:12:28 -0700 Subject: [PATCH 229/274] [libnl3]: Upgrade libnl3 version to 3.2.27-2, same version as in Debian Stretch (#1795) Signed-off-by: Qi Luo --- rules/libnl3.mk | 4 +++- src/libnl3/Makefile | 17 ++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/rules/libnl3.mk b/rules/libnl3.mk index 70ffa87963d0..30e27c5c5157 100644 --- a/rules/libnl3.mk +++ b/rules/libnl3.mk @@ -1,7 +1,9 @@ # libnl3 -LIBNL3_VERSION = 3.2.27-1 +LIBNL3_VERSION_BASE = 3.2.27 +LIBNL3_VERSION = $(LIBNL3_VERSION_BASE)-2 +export LIBNL3_VERSION_BASE export LIBNL3_VERSION LIBNL3 = libnl-3-200_$(LIBNL3_VERSION)_amd64.deb diff --git a/src/libnl3/Makefile b/src/libnl3/Makefile index 6f50e4e389fa..3ebe885ea5dd 100644 --- a/src/libnl3/Makefile +++ b/src/libnl3/Makefile @@ -15,18 +15,13 @@ DERIVED_TARGETS = libnl-3-dev_$(LIBNL3_VERSION)_amd64.deb \ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Obtaining the libnl3 - rm -rf ./libnl3 - git clone https://github.com/qiluo-msft/libnl3.git - pushd ./libnl3 - git checkout -f b77c0e49cb + rm -rf ./libnl3-$(LIBNL3_VERSION_BASE) + wget -O libnl3_$(LIBNL3_VERSION_BASE).orig.tar.gz -N "http://http.debian.net/debian/pool/main/libn/libnl3/libnl3_$(LIBNL3_VERSION_BASE).orig.tar.gz" + wget -O libnl3_$(LIBNL3_VERSION).dsc -N "http://http.debian.net/debian/pool/main/libn/libnl3/libnl3_$(LIBNL3_VERSION).dsc" + wget -O libnl3_$(LIBNL3_VERSION).debian.tar.xz -N "http://http.debian.net/debian/pool/main/libn/libnl3/libnl3_$(LIBNL3_VERSION).debian.tar.xz" + dpkg-source -x libnl3_$(LIBNL3_VERSION).dsc - # Patch - export QUILT_PATCHES=debian/patches - quilt push - quilt push - quilt push - quilt push - quilt push + pushd ./libnl3-$(LIBNL3_VERSION_BASE) dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) popd From b5f153b3ae291794d6a7f71ae48a279738dc9760 Mon Sep 17 00:00:00 2001 From: Rodny Molina Date: Tue, 19 Jun 2018 15:59:12 -0700 Subject: [PATCH 230/274] Introducing 'debugging' and 'profiling' options in sonic build-infra (#1782) --- rules/config | 12 ++++++++++-- rules/docker-base.mk | 2 +- slave.mk | 18 ++++++++++++++---- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/rules/config b/rules/config index 86d106637de2..1505dfd71782 100644 --- a/rules/config +++ b/rules/config @@ -40,9 +40,9 @@ DEFAULT_PASSWORD = YourPaSsWoRd # by default for TOR switch # ENABLE_PFCWD_ON_START = y -# SONIC_CONFIG_DEBUG - install debug packages +# SONIC_INSTALL_DEBUG_TOOLS - installs debugging tools in baseline docker # Uncomment next line to enable: -# SONIC_CONFIG_DEBUG = y +# SONIC_INSTALL_DEBUG_TOOLS = y # SONIC_ROUTING_STACK - specify the routing-stack being elected to drive SONiC's control-plane. # Quagga will be the default routing-stack for all the SONiC platforms. Other supported @@ -56,5 +56,13 @@ SONIC_ROUTING_STACK = quagga # Enable Origanization Extensions - Specific to the deployment scenarios of the Organization ENABLE_ORGANIZATION_EXTENSIONS = y +# Debugging option allows sonic debian packages to get built including symbols +# information. Profiling option, disables compiler optimizations (-O0) as well +# as includes symbols information. Given that 'profiling' option is a superset +# of 'debugging' one, user should only enable either one option or the other -- +# if both options are enabled, the 'profiling' one will prevail. +#SONIC_DEBUGGING_ON = y +#SONIC_PROFILING_ON = y + # ENABLE_SYSTEM_TELEMETRY - build docker-sonic-telemetry for system telemetry support # ENABLE_SYSTEM_TELEMETRY = y diff --git a/rules/docker-base.mk b/rules/docker-base.mk index 4a419008e915..1bdaaa0b4de0 100644 --- a/rules/docker-base.mk +++ b/rules/docker-base.mk @@ -5,7 +5,7 @@ $(DOCKER_BASE)_PATH = $(DOCKERS_PATH)/docker-base $(DOCKER_BASE)_DEPENDS += $(SUPERVISOR) $(DOCKER_BASE)_DEPENDS += $(LIBWRAP) -ifeq ($(SONIC_CONFIG_DEBUG),y) +ifeq ($(SONIC_INSTALL_DEBUG_TOOLS),y) GDB = gdb VIM = vim OPENSSH = openssh-client diff --git a/slave.mk b/slave.mk index a81acb1798f4..7ca92dc4ce1b 100644 --- a/slave.mk +++ b/slave.mk @@ -86,6 +86,14 @@ else $(warning PASSWORD given on command line: could be visible to other users) endif +ifeq ($(SONIC_DEBUGGING_ON),y) +DEB_BUILD_OPTIONS_GENERIC := "nostrip" +endif + +ifeq ($(SONIC_PROFILING_ON),y) +DEB_BUILD_OPTIONS_GENERIC := "nostrip noopt" +endif + ifeq ($(SONIC_BUILD_JOBS),) override SONIC_BUILD_JOBS := $(SONIC_CONFIG_BUILD_JOBS) endif @@ -109,13 +117,15 @@ $(info "PASSWORD" : "$(PASSWORD)") $(info "ENABLE_DHCP_GRAPH_SERVICE" : "$(ENABLE_DHCP_GRAPH_SERVICE)") $(info "SHUTDOWN_BGP_ON_START" : "$(SHUTDOWN_BGP_ON_START)") $(info "ENABLE_PFCWD_ON_START" : "$(ENABLE_PFCWD_ON_START)") -$(info "SONIC_CONFIG_DEBUG" : "$(SONIC_CONFIG_DEBUG)") +$(info "SONIC_INSTALL_DEBUG_TOOLS" : "$(SONIC_INSTALL_DEBUG_TOOLS)") $(info "ROUTING_STACK" : "$(SONIC_ROUTING_STACK)") $(info "ENABLE_SYNCD_RPC" : "$(ENABLE_SYNCD_RPC)") $(info "ENABLE_ORGANIZATION_EXTENSIONS" : "$(ENABLE_ORGANIZATION_EXTENSIONS)") $(info "HTTP_PROXY" : "$(HTTP_PROXY)") $(info "HTTPS_PROXY" : "$(HTTPS_PROXY)") $(info "ENABLE_SYSTEM_TELEMETRY" : "$(ENABLE_SYSTEM_TELEMETRY)") +$(info "SONIC_DEBUGGING_ON" : "$(SONIC_DEBUGGING_ON)") +$(info "SONIC_PROFILING_ON" : "$(SONIC_PROFILING_ON)") $(info ) ############################################################################### @@ -201,7 +211,7 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_MAKE_DEBS)) : $(DEBS_PATH)/% : .platform $$(a # Apply series of patches if exist if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi # Build project and take package - make DEST=$(shell pwd)/$(DEBS_PATH) -C $($*_SRC_PATH) $(shell pwd)/$(DEBS_PATH)/$* $(LOG) + DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS_GENERIC}" make DEST=$(shell pwd)/$(DEBS_PATH) -C $($*_SRC_PATH) $(shell pwd)/$(DEBS_PATH)/$* $(LOG) # Clean up if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; popd; fi $(FOOTER) @@ -224,8 +234,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(a pushd $($*_SRC_PATH) $(LOG) [ ! -f ./autogen.sh ] || ./autogen.sh $(LOG) $(if $($*_DPKG_TARGET), - DEB_BUILD_OPTIONS=$($*_DEB_BUILD_OPTIONS) dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --as-root -T$($*_DPKG_TARGET) $(LOG), - DEB_BUILD_OPTIONS=$($*_DEB_BUILD_OPTIONS) dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) $(LOG) + DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS_GENERIC} ${$*_DEB_BUILD_OPTIONS}" dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --as-root -T$($*_DPKG_TARGET) $(LOG), + DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS_GENERIC} ${$*_DEB_BUILD_OPTIONS}" dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) $(LOG) ) popd $(LOG) # Clean up From 493ae71f8f31b5f8592523db345fb921650d90c3 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 19 Jun 2018 17:52:09 -0700 Subject: [PATCH 231/274] [Broadcom]: update Broadcom SAI to 3.1.3.4-14 (#1797) Fix mirror session destination update bug causing no resources issue Signed-off-by: Shu0T1an ChenG --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 0012e8a8106a..52214493edd0 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.4-13_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-13_amd64.deb?sv=2015-04-05&sr=b&sig=Y7mQMOnQEzwb%2FG%2BY9dcEX0Y9tQBDCK2UmF4TjIz3Zn8%3D&se=2155-04-24T09%3A52%3A42Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.4-14_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-14_amd64.deb?sv=2015-04-05&sr=b&sig=RUib2nzuTwstNgT9OJ6DGv5OraWc6oyOmMtaRh6pDdw%3D&se=2032-02-25T17%3A38%3A41Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-13_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-14_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-13_amd64.deb?sv=2015-04-05&sr=b&sig=YYjwAt47PlCYJgW0RtEsdcmGAc52UdAzHEd5qVKImxc%3D&se=2155-04-24T09%3A53%3A45Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-14_amd64.deb?sv=2015-04-05&sr=b&sig=GRdByGTrNZbZoQmXhsVC%2BL7ZeDwzstl4Vq6vGssrmyo%3D&se=2032-02-25T17%3A39%3A09Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From 81b782cb8658417caad8636ed2dceb5b886ad4e6 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 19 Jun 2018 21:09:08 -0700 Subject: [PATCH 232/274] [libnl3]: Backup libnl3 source packages in Azure Storage (#1799) Signed-off-by: Qi Luo --- src/libnl3/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libnl3/Makefile b/src/libnl3/Makefile index 3ebe885ea5dd..bf5ba60ab91d 100644 --- a/src/libnl3/Makefile +++ b/src/libnl3/Makefile @@ -16,9 +16,9 @@ DERIVED_TARGETS = libnl-3-dev_$(LIBNL3_VERSION)_amd64.deb \ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Obtaining the libnl3 rm -rf ./libnl3-$(LIBNL3_VERSION_BASE) - wget -O libnl3_$(LIBNL3_VERSION_BASE).orig.tar.gz -N "http://http.debian.net/debian/pool/main/libn/libnl3/libnl3_$(LIBNL3_VERSION_BASE).orig.tar.gz" - wget -O libnl3_$(LIBNL3_VERSION).dsc -N "http://http.debian.net/debian/pool/main/libn/libnl3/libnl3_$(LIBNL3_VERSION).dsc" - wget -O libnl3_$(LIBNL3_VERSION).debian.tar.xz -N "http://http.debian.net/debian/pool/main/libn/libnl3/libnl3_$(LIBNL3_VERSION).debian.tar.xz" + wget -O libnl3_$(LIBNL3_VERSION_BASE).orig.tar.gz -N "https://sonicstorage.blob.core.windows.net/packages/libnl3_$(LIBNL3_VERSION_BASE).orig.tar.gz?sv=2015-04-05&sr=b&sig=b4DnqrIsyVBDLmYhw7qwfaUJWqGCX2lDVMmmx7ihfrU%3D&se=2028-06-16T21%3A06%3A00Z&sp=r" + wget -O libnl3_$(LIBNL3_VERSION).dsc -N "https://sonicstorage.blob.core.windows.net/packages/libnl3_$(LIBNL3_VERSION).dsc?sv=2015-04-05&sr=b&sig=AWTX45oDbeGA%2BRJZyiCcHmeIfCAgSeNV3IqopOBaRDg%3D&se=2028-06-16T21%3A05%3A30Z&sp=r" + wget -O libnl3_$(LIBNL3_VERSION).debian.tar.xz -N "https://sonicstorage.blob.core.windows.net/packages/libnl3_$(LIBNL3_VERSION).debian.tar.xz?sv=2015-04-05&sr=b&sig=upIZ9dp5WEcLqp3ODeWKJXq5pJWCfeT0TIM0bx76wxM%3D&se=2028-06-16T21%3A04%3A44Z&sp=r" dpkg-source -x libnl3_$(LIBNL3_VERSION).dsc pushd ./libnl3-$(LIBNL3_VERSION_BASE) From d82db79051468c1548bb5f6cd07dc2ea1d395ed6 Mon Sep 17 00:00:00 2001 From: Denis Maslov Date: Wed, 20 Jun 2018 07:14:49 +0300 Subject: [PATCH 233/274] [caclmgrd] Translation of ACL Control Plane rules into iptables commands fixed (#1798) Signed-off-by: Denis Maslov --- files/image_config/caclmgrd/caclmgrd | 61 ++++++++++++++++------------ 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/files/image_config/caclmgrd/caclmgrd b/files/image_config/caclmgrd/caclmgrd index 0dc59766b3d5..ec26b6001f50 100755 --- a/files/image_config/caclmgrd/caclmgrd +++ b/files/image_config/caclmgrd/caclmgrd @@ -89,6 +89,32 @@ class ControlPlaneAclManager(object): if proc.returncode != 0: log_error("Error running command '{}'".format(cmd)) + def parse_int_to_tcp_flags(self, hex_value): + tcp_flags_str = "" + if hex_value & 0x01: + tcp_flags_str += "FIN," + if hex_value & 0x02: + tcp_flags_str += "SYN," + if hex_value & 0x04: + tcp_flags_str += "RST," + if hex_value & 0x08: + tcp_flags_str += "PSH," + if hex_value & 0x10: + tcp_flags_str += "ACK," + if hex_value & 0x20: + tcp_flags_str += "URG," + # iptables doesn't handle the flags below now. It has some special keys for it: + # --ecn-tcp-cwr This matches if the TCP ECN CWR (Congestion Window Received) bit is set. + # --ecn-tcp-ece This matches if the TCP ECN ECE (ECN Echo) bit is set. + # if hex_value & 0x40: + # tcp_flags_str += "ECE," + # if hex_value & 0x80: + # tcp_flags_str += "CWR," + + # Delete the trailing comma + tcp_flags_str = tcp_flags_str[:-1] + return tcp_flags_str + def get_acl_rules_and_translate_to_iptables_commands(self): """ Retrieves current ACL tables and rules from Config DB, translates @@ -191,32 +217,15 @@ class ControlPlaneAclManager(object): rule_cmd += " --dport {}".format(dst_port) - # If there are TCP flags present, append them - if "TCP_FLAGS" in rule_props and rule_props["TCP_FLAGS"]: - tcp_flags = int(rule_props["TCP_FLAGS"], 16) - - if tcp_flags > 0: - rule_cmd += " --tcp-flags " - - if tcp_flags & 0x01: - rule_cmd += "FIN," - if tcp_flags & 0x02: - rule_cmd += "SYN," - if tcp_flags & 0x04: - rule_cmd += "RST," - if tcp_flags & 0x08: - rule_cmd += "PSH," - if tcp_flags & 0x10: - rule_cmd += "ACK," - if tcp_flags & 0x20: - rule_cmd += "URG," - if tcp_flags & 0x40: - rule_cmd += "ECE," - if tcp_flags & 0x80: - rule_cmd += "CWR," - - # Delete the trailing comma - rule_cmd = rule_cmd[:-1] + # If there are TCP flags present and ip protocol is TCP, append them + if ip_protocol == "tcp" and "TCP_FLAGS" in rule_props and rule_props["TCP_FLAGS"]: + tcp_flags, tcp_flags_mask = rule_props["TCP_FLAGS"].split("/") + + tcp_flags = int(tcp_flags, 16) + tcp_flags_mask = int(tcp_flags_mask, 16) + + if tcp_flags_mask > 0: + rule_cmd += " --tcp-flags {mask} {flags}".format(mask = self.parse_int_to_tcp_flags(tcp_flags_mask), flags = self.parse_int_to_tcp_flags(tcp_flags)) # Append the packet action as the jump target rule_cmd += " -j {}".format(rule_props["PACKET_ACTION"]) From bbca58329bf4ebc41a53ea768fc4595f346aae4d Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 20 Jun 2018 12:15:09 -0700 Subject: [PATCH 234/274] Manually send SIGHUP to vtysh when the current session was disconnected (#1801) * Manually send SIGHUP to vtysh when the current session was disconnected * Address comments --- dockers/docker-fpm-frr/base_image_files/vtysh | 15 ++++++++++++++- dockers/docker-fpm-quagga/base_image_files/vtysh | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/dockers/docker-fpm-frr/base_image_files/vtysh b/dockers/docker-fpm-frr/base_image_files/vtysh index c479fcd3653b..24016bd96b2c 100755 --- a/dockers/docker-fpm-frr/base_image_files/vtysh +++ b/dockers/docker-fpm-frr/base_image_files/vtysh @@ -1,3 +1,16 @@ #!/bin/bash -docker exec -i bgp vtysh "$@" +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + # Prepare a function to send HUP signal to vtysh in the container + # we mark the new instance of vtysh with the current tty as a tag + TTY=$(tty) + function cleanup + { + docker exec -i bgp pkill -HUP -f "vtysh $TTY" + } + trap cleanup HUP + docker exec -ti bgp vtysh "$TTY" "$@" +else + docker exec -i bgp vtysh "$@" +fi diff --git a/dockers/docker-fpm-quagga/base_image_files/vtysh b/dockers/docker-fpm-quagga/base_image_files/vtysh index c479fcd3653b..24016bd96b2c 100755 --- a/dockers/docker-fpm-quagga/base_image_files/vtysh +++ b/dockers/docker-fpm-quagga/base_image_files/vtysh @@ -1,3 +1,16 @@ #!/bin/bash -docker exec -i bgp vtysh "$@" +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + # Prepare a function to send HUP signal to vtysh in the container + # we mark the new instance of vtysh with the current tty as a tag + TTY=$(tty) + function cleanup + { + docker exec -i bgp pkill -HUP -f "vtysh $TTY" + } + trap cleanup HUP + docker exec -ti bgp vtysh "$TTY" "$@" +else + docker exec -i bgp vtysh "$@" +fi From 75570077613f2da77aedac7fa207670094d17f21 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 21 Jun 2018 10:40:28 -0700 Subject: [PATCH 235/274] [interface-config] Force eth0 before reconfiguration (#1802) --- files/image_config/interfaces/interfaces-config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index 75660e713e7f..a702917419ca 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -1,6 +1,6 @@ #!/bin/bash -ifdown eth0 +ifdown --force eth0 sonic-cfggen -d -t /usr/share/sonic/templates/interfaces.j2 > /etc/network/interfaces From b745c0bf1b50ed91e64109ab11514a3f8e60c3e3 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 21 Jun 2018 10:41:50 -0700 Subject: [PATCH 236/274] Modify sudo lecture message to be more informational (#1800) --- files/build_templates/sonic_debian_extension.j2 | 1 + files/image_config/sudoers/sudoers | 1 + files/image_config/sudoers/sudoers.lecture | 4 ++++ 3 files changed, 6 insertions(+) create mode 100644 files/image_config/sudoers/sudoers.lecture diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index d0afa4659667..698a29ec22a7 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -179,6 +179,7 @@ sudo cp $IMAGE_CONFIGS/asn/deployment_id_asn_map.yml $FILESYSTEM_ROOT/etc/sonic/ # Copy sudoers configuration file sudo cp $IMAGE_CONFIGS/sudoers/sudoers $FILESYSTEM_ROOT/etc/ +sudo cp $IMAGE_CONFIGS/sudoers/sudoers.lecture $FILESYSTEM_ROOT/etc/ # Copy control plane ACL management daemon files sudo cp $IMAGE_CONFIGS/caclmgrd/caclmgrd.service $FILESYSTEM_ROOT/etc/systemd/system/ diff --git a/files/image_config/sudoers/sudoers b/files/image_config/sudoers/sudoers index 4d651957afe2..66ca00f9de95 100644 --- a/files/image_config/sudoers/sudoers +++ b/files/image_config/sudoers/sudoers @@ -10,6 +10,7 @@ Defaults env_reset #Defaults mail_badpass Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" Defaults env_keep += "VTYSH_PAGER" +Defaults lecture_file = /etc/sudoers.lecture # Host alias specification diff --git a/files/image_config/sudoers/sudoers.lecture b/files/image_config/sudoers/sudoers.lecture new file mode 100644 index 000000000000..e89340092c70 --- /dev/null +++ b/files/image_config/sudoers/sudoers.lecture @@ -0,0 +1,4 @@ + +Make sure your account has RW permission to current device. +Otherwise sudo requests will be rejected. + From aaac49737087a66777bc69b2a94d1795bb3645d0 Mon Sep 17 00:00:00 2001 From: Wirut Getbamrung Date: Fri, 22 Jun 2018 00:57:32 +0700 Subject: [PATCH 237/274] [device]: Fix a bug that psuutil cannot access gpio sysfs to get PSU status (#1789) --- .../x86_64-cel_seastone-r0/plugins/psuutil.py | 49 +++++++------------ 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/device/celestica/x86_64-cel_seastone-r0/plugins/psuutil.py b/device/celestica/x86_64-cel_seastone-r0/plugins/psuutil.py index 9e8f99e7a7f2..510c03a43ff1 100644 --- a/device/celestica/x86_64-cel_seastone-r0/plugins/psuutil.py +++ b/device/celestica/x86_64-cel_seastone-r0/plugins/psuutil.py @@ -3,7 +3,8 @@ # Platform-specific PSU status interface for SONiC # -import os.path +import os + try: from sonic_psu.psu_base import PsuBase @@ -18,42 +19,32 @@ def __init__(self): PsuBase.__init__(self) # DX010 PSU pin mapping self.psu = [ - {'base':216}, # Reserved + {'base': self.get_gpio_base()}, {'abs':27, 'power':22}, {'abs':28, 'power':25} ] - def init_psu_gpio(self, pinnum): - # export pin, input as default - gpio_base = self.psu[0]['base'] - export_file = "/sys/class/gpio/export" - direction_file = '/sys/class/gpio/gpio' + str(gpio_base+pinnum) + '/direction' - - try: - with open(export_file, 'w') as fd: - fd.write(str(gpio_base+pinnum)) - except Exception as error: - logging.error("Unable to export gpio ", pinnum) + def get_gpio_base(self): + sys_gpio_dir = "/sys/class/gpio" + for r in os.listdir(sys_gpio_dir): + if "gpiochip" in r: + return int(r[8:],10) + return 216 #Reserve # Get a psu status and presence def read_psu_statuses(self, pinnum): sys_gpio_dir = "/sys/class/gpio" - retval = 'ERR' gpio_base = self.psu[0]['base'] gpio_dir = sys_gpio_dir + '/gpio' + str(gpio_base+pinnum) gpio_file = gpio_dir + "/value" - - # init gpio - if (not os.path.isdir(gpio_dir)): - self.init_psu_gpio(pinnum) try: with open(gpio_file, 'r') as fd: retval = fd.read() - except Exception as error: - logging.error("Unable to open ", gpio_file, "file !") + except IOError: + raise IOError("Unable to open " + gpio_file + "file !") retval = retval.rstrip('\r\n') return retval @@ -76,11 +67,10 @@ def get_psu_status(self, index): """ status = 0 psu_status = self.read_psu_statuses(self.psu[index]['power']) - if (psu_status != 'ERR'): - psu_status = int(psu_status, 10) - # Check for PSU status - if (psu_status == 1): - status = 1 + psu_status = int(psu_status, 10) + # Check for PSU status + if (psu_status == 1): + status = 1 return status @@ -93,10 +83,9 @@ def get_psu_presence(self, index): """ status = 0 psu_absence = self.read_psu_statuses(self.psu[index]['abs']) - if (psu_absence != 'ERR'): - psu_absence = (int(psu_absence, 10)) - # Check for PSU presence - if (psu_absence == 0): - status = 1 + psu_absence = (int(psu_absence, 10)) + # Check for PSU presence + if (psu_absence == 0): + status = 1 return status From 3681cfa55351000daf765e220a464c95e55118cd Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 21 Jun 2018 11:51:37 -0700 Subject: [PATCH 238/274] Use only active ports when applying buffers/qos configuration (#1787) * First part of skipping not used port for qos configuration * Use active ports only to set QoS parameters for 6100 * Add a test for qos.json.j2 * Add a test for Dell S6100 buffers.json template * Update submodulre --- .../{qos.json => qos.json.j2} | 0 .../AS7212-54x/{qos.json => qos.json.j2} | 0 .../{qos.json => qos.json.j2} | 0 .../{qos.json => qos.json.j2} | 0 .../{qos.json => qos.json.j2} | 0 .../{qos.json => qos.json.j2} | 0 .../{qos.json => qos.json.j2} | 0 .../{qos.json => qos.json.j2} | 0 .../Force10-S6000/{qos.json => qos.json.j2} | 0 .../Force10-S6100/{qos.json => qos.json.j2} | 35 +- .../{qos.json => qos.json.j2} | 0 .../Force10-Z9100/{qos.json => qos.json.j2} | 0 .../{qos.json => qos.json.j2} | 0 .../{qos.json => qos.json.j2} | 0 .../LS-SN2700/{qos.json => qos.json.j2} | 0 .../ACS-MSN2100/{qos.json => qos.json.j2} | 0 .../ACS-MSN2410/{qos.json => qos.json.j2} | 0 .../ACS-MSN2700/{qos.json => qos.json.j2} | 0 .../{qos.json => qos.json.j2} | 0 .../ACS-MSN2740/{qos.json => qos.json.j2} | 0 files/build_templates/buffers_config.j2 | 27 +- .../tests/sample-dell-6100-t0-minigraph.xml | 770 ++++++++++++++++++ .../tests/sample_output/buffers-dell6100.json | 121 +++ .../tests/sample_output/qos-dell6100.json | 156 ++++ src/sonic-config-engine/tests/test_j2files.py | 31 + src/sonic-utilities | 2 +- 26 files changed, 1128 insertions(+), 14 deletions(-) rename device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/{qos.json => qos.json.j2} (100%) rename device/accton/x86_64-accton_as7212_54x-r0/AS7212-54x/{qos.json => qos.json.j2} (100%) rename device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/{qos.json => qos.json.j2} (100%) rename device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/{qos.json => qos.json.j2} (100%) rename device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/{qos.json => qos.json.j2} (100%) rename device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/{qos.json => qos.json.j2} (100%) rename device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/{qos.json => qos.json.j2} (100%) rename device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/{qos.json => qos.json.j2} (100%) rename device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/{qos.json => qos.json.j2} (100%) rename device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/{qos.json => qos.json.j2} (55%) rename device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/{qos.json => qos.json.j2} (100%) rename device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/{qos.json => qos.json.j2} (100%) rename device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/{qos.json => qos.json.j2} (100%) rename device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/{qos.json => qos.json.j2} (100%) rename device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/{qos.json => qos.json.j2} (100%) rename device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/{qos.json => qos.json.j2} (100%) rename device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/{qos.json => qos.json.j2} (100%) rename device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/{qos.json => qos.json.j2} (100%) rename device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/{qos.json => qos.json.j2} (100%) rename device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/{qos.json => qos.json.j2} (100%) create mode 100644 src/sonic-config-engine/tests/sample-dell-6100-t0-minigraph.xml create mode 100644 src/sonic-config-engine/tests/sample_output/buffers-dell6100.json create mode 100644 src/sonic-config-engine/tests/sample_output/qos-dell6100.json diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/qos.json b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/qos.json.j2 similarity index 100% rename from device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/qos.json rename to device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/qos.json.j2 diff --git a/device/accton/x86_64-accton_as7212_54x-r0/AS7212-54x/qos.json b/device/accton/x86_64-accton_as7212_54x-r0/AS7212-54x/qos.json.j2 similarity index 100% rename from device/accton/x86_64-accton_as7212_54x-r0/AS7212-54x/qos.json rename to device/accton/x86_64-accton_as7212_54x-r0/AS7212-54x/qos.json.j2 diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json.j2 similarity index 100% rename from device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json rename to device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json.j2 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json.j2 similarity index 100% rename from device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json rename to device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json.j2 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 similarity index 100% rename from device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json rename to device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 similarity index 100% rename from device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json rename to device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 similarity index 100% rename from device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json rename to device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 similarity index 100% rename from device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json rename to device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json.j2 similarity index 100% rename from device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json rename to device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json.j2 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json.j2 similarity index 55% rename from device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json rename to device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json.j2 index e3a84924fd15..054a8f832cd4 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json.j2 @@ -1,3 +1,30 @@ +{%- set PORT_ALL = [] %} + +{%- if PORT is not defined %} + {%- for port_idx in range(0,64) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- else %} + {%- for port in PORT %} + {%- if PORT_ALL.append(port) %}{%- endif %} + {%- endfor %} +{%- endif %} + +{%- set PORT_ACTIVE = [] %} +{%- if DEVICE_NEIGHBOR is not defined %} + {%- set PORT_ACTIVE = PORT_ALL %} +{%- else %} + {%- for port in DEVICE_NEIGHBOR.keys() %} + {%- if PORT_ACTIVE.append(port) %}{%- endif %} + {%- endfor %} +{%- endif %} + +{%- set port_names_list_active = [] %} +{%- for port in PORT_ACTIVE %} + {%- if port_names_list_active.append(port) %}{%- endif %} +{%- endfor %} +{%- set port_names_active = port_names_list_active | join(',') %} + { "TC_TO_PRIORITY_GROUP_MAP": { "AZURE": { @@ -118,7 +145,7 @@ } }, "PORT_QOS_MAP": { - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63": { + "{{ port_names_active }}": { "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", @@ -141,14 +168,14 @@ } }, "QUEUE": { - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63|3-4" : { + "{{ port_names_active }}|3-4" : { "scheduler" : "[SCHEDULER|scheduler.0]", "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63|0" : { + "{{ port_names_active }}|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" }, - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63|1" : { + "{{ port_names_active }}|1" : { "scheduler" : "[SCHEDULER|scheduler.2]" } } diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json.j2 similarity index 100% rename from device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json rename to device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json.j2 diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json.j2 similarity index 100% rename from device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json rename to device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json.j2 diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/qos.json b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/qos.json.j2 similarity index 100% rename from device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/qos.json rename to device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/qos.json.j2 diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/qos.json b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/qos.json.j2 similarity index 100% rename from device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/qos.json rename to device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/qos.json.j2 diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json.j2 similarity index 100% rename from device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json rename to device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json.j2 diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 similarity index 100% rename from device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json rename to device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 similarity index 100% rename from device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json rename to device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 similarity index 100% rename from device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json rename to device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 similarity index 100% rename from device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json rename to device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json.j2 similarity index 100% rename from device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json rename to device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json.j2 diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index 20019d20afae..23503017f179 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -90,11 +90,20 @@ def {%- endfor %} {%- endif %} -{%- set port_names_list_all = [] %} -{%- for port in PORT_ALL %} - {%- if port_names_list_all.append(port) %}{%- endif %} +{%- set PORT_ACTIVE = [] %} +{%- if DEVICE_NEIGHBOR is not defined %} + {%- set PORT_ACTIVE = PORT_ALL %} +{%- else %} + {%- for port in DEVICE_NEIGHBOR.keys() %} + {%- if PORT_ACTIVE.append(port) %}{%- endif %} + {%- endfor %} +{%- endif %} + +{%- set port_names_list_active = [] %} +{%- for port in PORT_ACTIVE %} + {%- if port_names_list_active.append(port) %}{%- endif %} {%- endfor %} -{%- set port_names_all = port_names_list_all | join(',') %} +{%- set port_names_active = port_names_list_active | join(',') %} { "CABLE_LENGTH": { @@ -112,27 +121,27 @@ def {% endif %} {%- if defs.generate_profile_lists is defined %} -{{ defs.generate_profile_lists(port_names_all) }}, +{{ defs.generate_profile_lists(port_names_active) }}, {% endif %} {%- if defs.generate_pg_profils is defined %} {{ defs.generate_pg_profils }}, {% else %} "BUFFER_PG": { - "{{ port_names_all }}|0-1": { + "{{ port_names_active }}|0-1": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" } }, {% endif %} {% if defs.generate_queue_buffers is defined %} -{{ defs.generate_queue_buffers(port_names_all) }} +{{ defs.generate_queue_buffers(port_names_active) }} {% else %} "BUFFER_QUEUE": { - "{{ port_names_all }}|3-4": { + "{{ port_names_active }}|3-4": { "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" }, - "{{ port_names_all }}|0-1": { + "{{ port_names_active }}|0-1": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" } } diff --git a/src/sonic-config-engine/tests/sample-dell-6100-t0-minigraph.xml b/src/sonic-config-engine/tests/sample-dell-6100-t0-minigraph.xml new file mode 100644 index 000000000000..536a2c8a73c7 --- /dev/null +++ b/src/sonic-config-engine/tests/sample-dell-6100-t0-minigraph.xml @@ -0,0 +1,770 @@ + + + + + + ARISTA01T1 + 10.0.0.1 + s6100-dev-1 + 10.0.0.0 + 1 + 180 + 60 + + + ARISTA02T1 + 10.0.0.5 + s6100-dev-1 + 10.0.0.4 + 1 + 180 + 60 + + + ARISTA03T1 + 10.0.0.9 + s6100-dev-1 + 10.0.0.8 + 1 + 180 + 60 + + + ARISTA04T1 + 10.0.0.13 + s6100-dev-1 + 10.0.0.12 + 1 + 180 + 60 + + + ARISTA01T1 + FC00::2 + s6100-dev-1 + FC00::1 + 1 + 180 + 60 + + + ARISTA02T1 + FC00::A + s6100-dev-1 + FC00::9 + 1 + 180 + 60 + + + ARISTA03T1 + FC00::12 + s6100-dev-1 + FC00::11 + 1 + 180 + 60 + + + ARISTA04T1 + FC00::1A + s6100-dev-1 + FC00::19 + 1 + 180 + 60 + + + + + 64601 + s6100-dev-1 + + + BGPPeer +
10.0.0.1
+ + + +
+ + BGPPeer +
10.0.0.5
+ + + +
+ + BGPPeer +
10.0.0.9
+ + + +
+ + BGPPeer +
10.0.0.13
+ + + +
+ + BGPPeer +
FC00::2
+ + + +
+ + BGPPeer +
FC00::A
+ + + +
+ + BGPPeer +
FC00::12
+ + + +
+ + BGPPeer +
FC00::1A
+ + + +
+
+ +
+ + 64802 + ARISTA01T1 + + + + 64802 + ARISTA02T1 + + + + 64802 + ARISTA03T1 + + + + 64802 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.0.0.243/23 + + 10.0.0.243/23 + + + + + + s6100-dev-1 + + + PortChannelInterface + PortChannel1 + fortyGigE1/1/1;fortyGigE1/1/2 + + + + PortChannelInterface + PortChannel4 + fortyGigE1/1/5;fortyGigE1/1/6 + + + + PortChannelInterface + PortChannel16 + fortyGigE1/2/1;fortyGigE1/2/2 + + + + PortChannelInterface + PortChannel20 + fortyGigE1/2/5;fortyGigE1/2/6 + + + + + + VlanInterface + Vlan2 + fortyGigE1/1/7;fortyGigE1/1/8;fortyGigE1/1/9;fortyGigE1/1/10;fortyGigE1/1/11;fortyGigE1/1/12;fortyGigE1/1/13;fortyGigE1/1/14;fortyGigE1/1/15;fortyGigE1/1/16;fortyGigE1/3/1;fortyGigE1/3/5;fortyGigE1/3/6;fortyGigE1/3/7;fortyGigE1/3/8;fortyGigE1/3/9;fortyGigE1/3/10;fortyGigE1/3/11;fortyGigE1/2/7;fortyGigE1/2/8;fortyGigE1/2/9;fortyGigE1/2/10;fortyGigE1/2/11;fortyGigE1/2/12;fortyGigE1/2/13;fortyGigE1/2/14;fortyGigE1/2/15;fortyGigE1/2/16;fortyGigE1/4/1;fortyGigE1/4/5;fortyGigE1/4/6;fortyGigE1/4/7;fortyGigE1/4/8;fortyGigE1/4/9;fortyGigE1/4/10;fortyGigE1/4/11 + False + 0.0.0.0/0 + + 2 + 2 + 172.0.0.0/21 + + + + + IPInterface + + PortChannel1 + 10.0.0.0/31 + + + IPInterface + + PortChannel4 + 10.0.0.4/31 + + + IPInterface + + PortChannel16 + 10.0.0.8/31 + + + IPInterface + + PortChannel20 + 10.0.0.12/31 + + + IPInterface + + PortChannel1 + FC00::1/126 + + + IPInterface + + PortChannel4 + FC00::9/126 + + + IPInterface + + PortChannel16 + FC00::11/126 + + + IPInterface + + PortChannel20 + FC00::19/126 + + + IPInterface + + Vlan2 + 172.0.0.1/21 + + + + + + + + + + + + DeviceInterfaceLink + true + 40000 + ARISTA01T1 + Ethernet1 + true + s6100-dev-1 + fortyGigE1/1/1 + + + DeviceInterfaceLink + true + 40000 + ARISTA01T1 + Ethernet2 + true + s6100-dev-1 + fortyGigE1/1/2 + + + DeviceInterfaceLink + true + 40000 + ARISTA02T1 + Ethernet1 + true + s6100-dev-1 + fortyGigE1/1/5 + + + DeviceInterfaceLink + true + 40000 + ARISTA02T1 + Ethernet2 + true + s6100-dev-1 + fortyGigE1/1/6 + + + DeviceInterfaceLink + true + 40000 + ARISTA03T1 + Ethernet1 + true + s6100-dev-1 + fortyGigE1/2/1 + + + DeviceInterfaceLink + true + 40000 + ARISTA03T1 + Ethernet2 + true + s6100-dev-1 + fortyGigE1/2/2 + + + DeviceInterfaceLink + true + 40000 + ARISTA04T1 + Ethernet1 + true + s6100-dev-1 + fortyGigE1/2/5 + + + DeviceInterfaceLink + true + 40000 + ARISTA04T1 + Ethernet2 + true + s6100-dev-1 + fortyGigE1/2/6 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/7 + true + server-01 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/8 + true + server-02 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/9 + true + server-03 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/10 + true + server-04 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/11 + true + server-05 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/12 + true + server-06 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/13 + true + server-07 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/14 + true + server-08 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/15 + true + server-09 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/16 + true + server-10 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/3/1 + true + server-11 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/3/5 + true + server-12 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/3/6 + true + server-13 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/3/7 + true + server-14 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/3/8 + true + server-15 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/3/9 + true + server-16 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/3/10 + true + server-17 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/3/11 + true + server-18 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/7 + true + server-19 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/8 + true + server-20 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/9 + true + server-21 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/10 + true + server-22 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/11 + true + server-23 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/12 + true + server-24 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/13 + true + server-25 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/14 + true + server-26 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/15 + true + server-27 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/16 + true + server-28 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/4/1 + true + server-29 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/4/5 + true + server-30 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/4/6 + true + server-31 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/4/7 + true + server-32 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/4/8 + true + server-33 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/4/9 + true + server-34 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/4/10 + true + server-35 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/4/11 + true + server-36 + 0 + + + + + s6100-dev-1 + Force10-S6100 + + 10.0.0.243 + + + + + + + + s6100-dev-1 + + + ErspanDestinationIpv4 + + 10.0.0.16 + + + + + + + s6100-dev-1 + Force10-S6100 +
\ No newline at end of file diff --git a/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json b/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json new file mode 100644 index 000000000000..9f2ae6583913 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json @@ -0,0 +1,121 @@ + +{ + "CABLE_LENGTH": { + "AZURE": { + "Ethernet0": "5m", + "Ethernet1": "5m", + "Ethernet2": "5m", + "Ethernet3": "5m", + "Ethernet4": "5m", + "Ethernet5": "5m", + "Ethernet6": "5m", + "Ethernet7": "5m", + "Ethernet8": "5m", + "Ethernet9": "5m", + "Ethernet10": "5m", + "Ethernet11": "5m", + "Ethernet12": "5m", + "Ethernet13": "5m", + "Ethernet14": "5m", + "Ethernet15": "5m", + "Ethernet16": "5m", + "Ethernet17": "5m", + "Ethernet18": "5m", + "Ethernet19": "5m", + "Ethernet20": "5m", + "Ethernet21": "5m", + "Ethernet22": "5m", + "Ethernet23": "5m", + "Ethernet24": "5m", + "Ethernet25": "5m", + "Ethernet26": "5m", + "Ethernet27": "5m", + "Ethernet28": "5m", + "Ethernet29": "5m", + "Ethernet30": "5m", + "Ethernet31": "5m", + "Ethernet32": "5m", + "Ethernet33": "5m", + "Ethernet34": "5m", + "Ethernet35": "5m", + "Ethernet36": "5m", + "Ethernet37": "5m", + "Ethernet38": "5m", + "Ethernet39": "5m", + "Ethernet40": "5m", + "Ethernet41": "5m", + "Ethernet42": "5m", + "Ethernet43": "5m", + "Ethernet44": "5m", + "Ethernet45": "5m", + "Ethernet46": "5m", + "Ethernet47": "5m", + "Ethernet48": "5m", + "Ethernet49": "5m", + "Ethernet50": "5m", + "Ethernet51": "5m", + "Ethernet52": "5m", + "Ethernet53": "5m", + "Ethernet54": "5m", + "Ethernet55": "5m", + "Ethernet56": "5m", + "Ethernet57": "5m", + "Ethernet58": "5m", + "Ethernet59": "5m", + "Ethernet60": "5m", + "Ethernet61": "5m", + "Ethernet62": "5m", + "Ethernet63": "5m" + } + }, + + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "11213696", + "type": "ingress", + "mode": "dynamic", + "xoff": "3855488" + }, + "egress_lossy_pool": { + "size": "9532224", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"1518", + "static_th":"3995680" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|0-1": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + + "BUFFER_QUEUE": { + "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|0-1": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/qos-dell6100.json b/src/sonic-config-engine/tests/sample_output/qos-dell6100.json new file mode 100644 index 000000000000..0db51148bdc5 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/qos-dell6100.json @@ -0,0 +1,156 @@ + +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold": "312000", + "green_min_threshold": "104000" + } + }, + "QUEUE": { + "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|3-4" : { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + }, + "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|0" : { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|1" : { + "scheduler" : "[SCHEDULER|scheduler.2]" + } + } +} diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index aba7feb194ad..ce4b17500f8d 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -2,6 +2,7 @@ import os import subprocess import json +import shutil from unittest import TestCase @@ -15,6 +16,7 @@ def setUp(self): self.t0_port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini') self.t1_mlnx_minigraph = os.path.join(self.test_dir, 't1-sample-graph-mlnx.xml') self.mlnx_port_config = os.path.join(self.test_dir, 'sample-port-config-mlnx.ini') + self.dell6100_t0_minigraph = os.path.join(self.test_dir, 'sample-dell-6100-t0-minigraph.xml') self.output_file = os.path.join(self.test_dir, 'output') def run_script(self, argument): @@ -119,6 +121,35 @@ def test_sku_render_template(self): self.assertTrue(filecmp.cmp(sample_output_file, self.output_file)) + def test_qos_dell6100_render_template(self): + dell_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'dell', 'x86_64-dell_s6100_c2538-r0', 'Force10-S6100') + qos_file = os.path.join(dell_dir_path, 'qos.json.j2') + port_config_ini_file = os.path.join(dell_dir_path, 'port_config.ini') + argument = '-m ' + self.dell6100_t0_minigraph + ' -p ' + port_config_ini_file + ' -t ' + qos_file + ' > ' + self.output_file + self.run_script(argument) + + sample_output_file = os.path.join(self.test_dir, 'sample_output', 'qos-dell6100.json') + assert filecmp.cmp(sample_output_file, self.output_file) + + def test_buffers_dell6100_render_template(self): + dell_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'dell', 'x86_64-dell_s6100_c2538-r0', 'Force10-S6100') + buffers_file = os.path.join(dell_dir_path, 'buffers.json.j2') + port_config_ini_file = os.path.join(dell_dir_path, 'port_config.ini') + + # copy buffers_config.j2 to the Dell S6100 directory to have all templates in one directory + buffers_config_file = os.path.join(self.test_dir, '..', '..', '..', 'files', 'build_templates', 'buffers_config.j2') + shutil.copy2(buffers_config_file, dell_dir_path) + + argument = '-m ' + self.dell6100_t0_minigraph + ' -p ' + port_config_ini_file + ' -t ' + buffers_file + ' > ' + self.output_file + self.run_script(argument) + + # cleanup + buffers_config_file_new = os.path.join(dell_dir_path, 'buffers_config.j2') + os.remove(buffers_config_file_new) + + sample_output_file = os.path.join(self.test_dir, 'sample_output', 'buffers-dell6100.json') + assert filecmp.cmp(sample_output_file, self.output_file) + def tearDown(self): try: os.remove(self.output_file) diff --git a/src/sonic-utilities b/src/sonic-utilities index e2a3228843be..5baa30528bd7 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit e2a3228843bec8280c965b847f5c168f4d96d231 +Subproject commit 5baa30528bd73ffc364de03c9098263d42a2d320 From 3ea616dcc34e6110f74e6dae77456f0d12dde234 Mon Sep 17 00:00:00 2001 From: Pradchaya P Date: Sat, 23 Jun 2018 01:56:22 +0700 Subject: [PATCH 239/274] [platform] Celestica: dx010 init gpio sysfs (#1807) --- platform/broadcom/platform-modules-cel.mk | 2 +- platform/broadcom/sonic-platform-modules-cel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/broadcom/platform-modules-cel.mk b/platform/broadcom/platform-modules-cel.mk index 09e8b374e861..551ff37e3b37 100644 --- a/platform/broadcom/platform-modules-cel.mk +++ b/platform/broadcom/platform-modules-cel.mk @@ -1,6 +1,6 @@ # Celestica DX010 Platform modules -CEL_DX010_PLATFORM_MODULE_VERSION = 0.6 +CEL_DX010_PLATFORM_MODULE_VERSION = 0.7 export CEL_DX010_PLATFORM_MODULE_VERSION diff --git a/platform/broadcom/sonic-platform-modules-cel b/platform/broadcom/sonic-platform-modules-cel index 7875e46964fc..4c8bcd1584e5 160000 --- a/platform/broadcom/sonic-platform-modules-cel +++ b/platform/broadcom/sonic-platform-modules-cel @@ -1 +1 @@ -Subproject commit 7875e46964fcc329ff92a80c379c026da530221f +Subproject commit 4c8bcd1584e5afb05476a67e0ed82ca02fba6da0 From d0803b76ce8b9e7a495bb63dc77dbd8628a77e0a Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 22 Jun 2018 11:56:57 -0700 Subject: [PATCH 240/274] [sonic-platform-common] Update submodule (#1806) --- src/sonic-platform-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-platform-common b/src/sonic-platform-common index 9adb75feee6d..76ae431e41dc 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit 9adb75feee6de75bd2e9faf542ac5610edc3fa35 +Subproject commit 76ae431e41dca1255f8056b590668c9ca187f031 From deacbb8261f4e807635a8efce697e0a4fb1ad29d Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 22 Jun 2018 11:57:44 -0700 Subject: [PATCH 241/274] [tacacs] To modify local user permission according to priv lvl (#1804) --- ...able-modifying-local-user-permission.patch | 71 +++++++++++++++++++ src/tacacs/nss/Makefile | 3 +- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 src/tacacs/nss/0002-Enable-modifying-local-user-permission.patch diff --git a/src/tacacs/nss/0002-Enable-modifying-local-user-permission.patch b/src/tacacs/nss/0002-Enable-modifying-local-user-permission.patch new file mode 100644 index 000000000000..2c476354705a --- /dev/null +++ b/src/tacacs/nss/0002-Enable-modifying-local-user-permission.patch @@ -0,0 +1,71 @@ +From 7045acb8f530331d3fbabef20bcf2787d3430c55 Mon Sep 17 00:00:00 2001 +From: Taoyu Li +Date: Thu, 21 Jun 2018 19:21:01 +0000 +Subject: [PATCH] Do authorization and modify user permission even if local + user exists + +--- + nss_tacplus.c | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +diff --git a/nss_tacplus.c b/nss_tacplus.c +index 63f01d4..a13c278 100644 +--- a/nss_tacplus.c ++++ b/nss_tacplus.c +@@ -408,7 +408,7 @@ static int delete_conf_line(const char *name) + * conf, it will be written in conf and created by command 'useradd'. When + * useradd command use getpwnam(), it will return when username found in conf. + */ +-static int create_local_user(const char *name, int level) ++static int create_or_modify_local_user(const char *name, int level, bool existing_user) + { + FILE *fp; + useradd_info_t *user; +@@ -416,6 +416,7 @@ static int create_local_user(const char *name, int level) + int len = 512; + int lvl, cnt; + bool found = false; ++ const char* command = existing_user ? "/usr/sbin/usermod": "/usr/sbin/useradd"; + + fp = fopen(user_conf, "ab+"); + if(!fp) { +@@ -458,17 +459,18 @@ static int create_local_user(const char *name, int level) + while(lvl >= MIN_TACACS_USER_PRIV) { + user = &useradd_grp_list[lvl]; + if(user->info && user->secondary_grp && user->shell) { +- snprintf(buf, len, "useradd -G %s \"%s\" -g %d -c \"%s\" -d /home/%s -m -s %s", +- user->secondary_grp, name, user->gid, user->info, name, user->shell); ++ snprintf(buf, len, "%s -G %s \"%s\" -g %d -c \"%s\" -d /home/%s -m -s %s", ++ command, user->secondary_grp, name, user->gid, user->info, name, user->shell); ++ if(debug) syslog(LOG_DEBUG, "%s", buf); + fp = popen(buf, "r"); + if(!fp || -1 == pclose(fp)) { +- syslog(LOG_ERR, "%s: useradd popen failed errno=%d %s", +- nssname, errno, strerror(errno)); ++ syslog(LOG_ERR, "%s: %s popen failed errno=%d %s", ++ nssname, command, errno, strerror(errno)); + delete_conf_line(name); + return -1; + } + if(debug) +- syslog(LOG_DEBUG, "%s: create local user %s success", nssname, name); ++ syslog(LOG_DEBUG, "%s: %s %s success", nssname, command, name); + delete_conf_line(name); + return 0; + } +@@ -558,10 +560,10 @@ static int lookup_user_pw(struct pwbuf *pb, int level) + if(debug) + syslog(LOG_DEBUG, "%s: %s passwd %s found in local", nssname, username, + found ? "is" : "isn't"); +- if(0 != ret || found) ++ if(0 != ret) + return ret; + +- if(0 != create_local_user(username, level)) ++ if(0 != create_or_modify_local_user(username, level, found)) + return -1; + + ret = lookup_pw_local(username, pb, &found); +-- +2.9.3 + diff --git a/src/tacacs/nss/Makefile b/src/tacacs/nss/Makefile index 4f1a337b34b4..259e9b281389 100644 --- a/src/tacacs/nss/Makefile +++ b/src/tacacs/nss/Makefile @@ -12,7 +12,8 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : git checkout -f 19008ab # Apply patch - git apply ../0001-Modify-user-map-profile.patch + git am ../0001-Modify-user-map-profile.patch + git am ../0002-Enable-modifying-local-user-permission.patch dpkg-buildpackage -rfakeroot -b -us -uc popd From b37540febd70a1dddf54aadfebf11007968585c9 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Fri, 22 Jun 2018 12:14:09 -0700 Subject: [PATCH 242/274] [vs-test]: not forward routes with no-export community (#1774) Signed-off-by: Sihui Han --- platform/vs/tests/bounce/files/bgpd.conf | 13 ++++++ platform/vs/tests/bounce/files/exabgp1.conf | 21 ++++++++++ platform/vs/tests/bounce/files/exabgp2.conf | 11 +++++ platform/vs/tests/bounce/test_bounce.py | 45 +++++++++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 platform/vs/tests/bounce/files/bgpd.conf create mode 100644 platform/vs/tests/bounce/files/exabgp1.conf create mode 100644 platform/vs/tests/bounce/files/exabgp2.conf create mode 100644 platform/vs/tests/bounce/test_bounce.py diff --git a/platform/vs/tests/bounce/files/bgpd.conf b/platform/vs/tests/bounce/files/bgpd.conf new file mode 100644 index 000000000000..40322cedbc69 --- /dev/null +++ b/platform/vs/tests/bounce/files/bgpd.conf @@ -0,0 +1,13 @@ +router bgp 65501 + bgp router-id 1.1.1.1 + no bgp default ipv4-unicast + neighbor 10.0.0.1 remote-as 65502 + address-family ipv4 + neighbor 10.0.0.1 activate + maximum-paths 64 + exit-address-family + neighbor 10.0.0.3 remote-as 65503 + address-family ipv4 + neighbor 10.0.0.3 activate + maximum-paths 64 + exit-address-family diff --git a/platform/vs/tests/bounce/files/exabgp1.conf b/platform/vs/tests/bounce/files/exabgp1.conf new file mode 100644 index 000000000000..0e78bd61db42 --- /dev/null +++ b/platform/vs/tests/bounce/files/exabgp1.conf @@ -0,0 +1,21 @@ +neighbor 10.0.0.0 { + router-id 1.1.1.2; + local-address 10.0.0.1; + local-as 65502; + peer-as 65501; + group-updates false; + + family{ + ipv4 unicast; + } + + static { + route 1.1.1.1/32{ + next-hop 10.0.0.1; + community no-export; + } + route 2.2.2.2/32{ + next-hop 10.0.0.1; + } + } +} diff --git a/platform/vs/tests/bounce/files/exabgp2.conf b/platform/vs/tests/bounce/files/exabgp2.conf new file mode 100644 index 000000000000..3e67c18a82f6 --- /dev/null +++ b/platform/vs/tests/bounce/files/exabgp2.conf @@ -0,0 +1,11 @@ +neighbor 10.0.0.2 { + router-id 1.1.1.3; + local-address 10.0.0.3; + local-as 65503; + peer-as 65501; + group-updates false; + + family { + ipv4 unicast; + } +} diff --git a/platform/vs/tests/bounce/test_bounce.py b/platform/vs/tests/bounce/test_bounce.py new file mode 100644 index 000000000000..57616ec0bc76 --- /dev/null +++ b/platform/vs/tests/bounce/test_bounce.py @@ -0,0 +1,45 @@ +from swsscommon import swsscommon +import os +import re +import time +import json + +def test_bounce(dvs): + dvs.servers[0].runcmd("pkill -f exabgp") + dvs.copy_file("/etc/quagga/", "bounce/files/bgpd.conf") + dvs.runcmd("supervisorctl start bgpd") + dvs.runcmd("ip addr add 10.0.0.0/31 dev Ethernet0") + dvs.runcmd("ifconfig Ethernet0 up") + + dvs.runcmd("ip addr add 10.0.0.2/31 dev Ethernet4") + dvs.runcmd("ifconfig Ethernet4 up") + + dvs.servers[0].runcmd("ip addr add 10.0.0.1/31 dev eth0") + dvs.servers[0].runcmd("ifconfig eth0 up") + + dvs.servers[1].runcmd("ip addr add 10.0.0.3/31 dev eth0") + dvs.servers[1].runcmd("ifconfig eth0 up") + + time.sleep(5) + + p1 = dvs.servers[0].runcmd_async("exabgp -d bounce/files/exabgp1.conf") + p2 = dvs.servers[1].runcmd_async("exabgp -d bounce/files/exabgp2.conf") + + time.sleep(20) + + sum_res = dvs.runcmd(["vtysh", "-c", "show ip bgp sum"]) + all_route = dvs.runcmd(["vtysh", "-c", "show ip bgp"]) + announce_route = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 advertised-routes"]) + + p1.terminate() + p1 = p1.wait() + + p2.terminate() + p2 = p2.wait() + + print sum_res + print announce_route + assert "1.1.1.1/32" in all_route + assert "1.1.1.1/32" not in announce_route + assert "2.2.2.2/32" in all_route + assert "2.2.2.2/32" in announce_route From 82343ca1655b7c7406e15f29063130ac68e743e3 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Fri, 22 Jun 2018 18:03:27 -0700 Subject: [PATCH 243/274] [sai]: update SAI version to 3.1.3.4-15 (#1808) Signed-off-by: Sihui Han --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 52214493edd0..5cda170b3391 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.4-14_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-14_amd64.deb?sv=2015-04-05&sr=b&sig=RUib2nzuTwstNgT9OJ6DGv5OraWc6oyOmMtaRh6pDdw%3D&se=2032-02-25T17%3A38%3A41Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.4-15_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-15_amd64.deb?sv=2015-04-05&sr=b&sig=7CIkdlBB%2BY6Xjae0vc1QBnlAVedRkreJRhWM93SyHOI%3D&se=2032-02-29T18%3A31%3A54Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-14_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-15_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-14_amd64.deb?sv=2015-04-05&sr=b&sig=GRdByGTrNZbZoQmXhsVC%2BL7ZeDwzstl4Vq6vGssrmyo%3D&se=2032-02-25T17%3A39%3A09Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-15_amd64.deb?sv=2015-04-05&sr=b&sig=rBOT802o1o%2BAcogaXq%2FgqyuTAmSlFKhtPzYM%2BtXlIdM%3D&se=2032-02-29T18%3A34%3A10Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From a2a6aead4cd6c952fb75b05fd9059229342132f7 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 22 Jun 2018 18:04:18 -0700 Subject: [PATCH 244/274] [bgp]: Enable bgp soft-reconfiguration inbound for quagga templates (#1803) * Enable bgp soft-reconfiguration inbound for quagga templates --- dockers/docker-fpm-quagga/bgpd.conf.j2 | 2 ++ src/sonic-config-engine/tests/sample_output/bgpd.conf | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index 1adb660ec00a..ee3aba2c23c3 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -78,6 +78,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} neighbor {{ neighbor_addr }} activate + neighbor {{ neighbor_addr }} soft-reconfiguration inbound maximum-paths 64 exit-address-family {% endif %} @@ -87,6 +88,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} neighbor {{ neighbor_addr }} activate + neighbor {{ neighbor_addr }} soft-reconfiguration inbound maximum-paths 64 exit-address-family {% endif %} diff --git a/src/sonic-config-engine/tests/sample_output/bgpd.conf b/src/sonic-config-engine/tests/sample_output/bgpd.conf index 4416b4628569..86ce28f3b67d 100644 --- a/src/sonic-config-engine/tests/sample_output/bgpd.conf +++ b/src/sonic-config-engine/tests/sample_output/bgpd.conf @@ -32,6 +32,7 @@ router bgp 65100 address-family ipv4 neighbor 10.0.0.57 allowas-in 1 neighbor 10.0.0.57 activate + neighbor 10.0.0.57 soft-reconfiguration inbound maximum-paths 64 exit-address-family neighbor 10.0.0.59 remote-as 64600 @@ -39,6 +40,7 @@ router bgp 65100 address-family ipv4 neighbor 10.0.0.59 allowas-in 1 neighbor 10.0.0.59 activate + neighbor 10.0.0.59 soft-reconfiguration inbound maximum-paths 64 exit-address-family neighbor 10.0.0.61 remote-as 64600 @@ -46,6 +48,7 @@ router bgp 65100 address-family ipv4 neighbor 10.0.0.61 allowas-in 1 neighbor 10.0.0.61 activate + neighbor 10.0.0.61 soft-reconfiguration inbound maximum-paths 64 exit-address-family neighbor 10.0.0.63 remote-as 64600 @@ -53,6 +56,7 @@ router bgp 65100 address-family ipv4 neighbor 10.0.0.63 allowas-in 1 neighbor 10.0.0.63 activate + neighbor 10.0.0.63 soft-reconfiguration inbound maximum-paths 64 exit-address-family neighbor fc00::7a remote-as 64600 @@ -60,6 +64,7 @@ router bgp 65100 address-family ipv6 neighbor fc00::7a allowas-in 1 neighbor fc00::7a activate + neighbor fc00::7a soft-reconfiguration inbound maximum-paths 64 exit-address-family neighbor fc00::7e remote-as 64600 @@ -67,6 +72,7 @@ router bgp 65100 address-family ipv6 neighbor fc00::7e allowas-in 1 neighbor fc00::7e activate + neighbor fc00::7e soft-reconfiguration inbound maximum-paths 64 exit-address-family neighbor fc00::72 remote-as 64600 @@ -74,6 +80,7 @@ router bgp 65100 address-family ipv6 neighbor fc00::72 allowas-in 1 neighbor fc00::72 activate + neighbor fc00::72 soft-reconfiguration inbound maximum-paths 64 exit-address-family neighbor fc00::76 remote-as 64600 @@ -81,6 +88,7 @@ router bgp 65100 address-family ipv6 neighbor fc00::76 allowas-in 1 neighbor fc00::76 activate + neighbor fc00::76 soft-reconfiguration inbound maximum-paths 64 exit-address-family ! From bac572229e62a42a95b3a92781278054b49cc210 Mon Sep 17 00:00:00 2001 From: Serhey Popovych Date: Sat, 23 Jun 2018 04:46:05 +0300 Subject: [PATCH 245/274] [docker-fpm-frr]: Fix build with frr used for routing stack (#1728) After commit 832be7b8f4c3 ("[dockers] Prevent apt-get from installing suggested and recommended packages by default (#1666)") SONiC fails to build when FRR is used for routing stack (e.g. SONIC_ROUTING_STACK is set to frr in rules/config). To fix issue just replicate changes from docker-fpm-quagga to docker-fpm-frr to make dependencies installed correctly after above change to package installing behaviour. Signed-off-by: Sergey Popovich --- dockers/docker-fpm-frr/Dockerfile.j2 | 29 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/dockers/docker-fpm-frr/Dockerfile.j2 b/dockers/docker-fpm-frr/Dockerfile.j2 index 332a0cdd508d..350b3b2efb91 100644 --- a/dockers/docker-fpm-frr/Dockerfile.j2 +++ b/dockers/docker-fpm-frr/Dockerfile.j2 @@ -1,26 +1,31 @@ FROM docker-config-engine -## Make apt-get non-interactive +# Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive +# Update apt's cache of available packages RUN apt-get update +# Install required packages RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 libc-ares2 iproute -COPY \ -{% for deb in docker_fpm_frr_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor -%} -debs/ +{% if docker_fpm_frr_debs.strip() -%} +# Copy locally-built Debian package dependencies +{%- for deb in docker_fpm_frr_debs.split(' ') %} +COPY debs/{{ deb }} /debs/ +{%- endfor %} -RUN dpkg -i \ -{% for deb in docker_fpm_frr_debs.split(' ') -%} -debs/{{ deb }}{{' '}} +# Install locally-built Debian packages and implicitly install their dependencies +{%- for deb in docker_fpm_frr_debs.split(' ') %} +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/{{ deb }} {%- endfor %} +{%- endif %} -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs +# Clean up +RUN apt-get clean -y +RUN apt-get autoclean -y +RUN apt-get autoremove -y +RUN rm -rf /debs ~/.cache COPY ["*.j2", "/usr/share/sonic/templates/"] COPY ["start.sh", "config.sh", "/usr/bin/"] From 7389443597d3b9571bc7046e7e7bfaffc58a146c Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Fri, 22 Jun 2018 18:53:30 -0700 Subject: [PATCH 246/274] [devices]: Migrate a7050-qx-32s to use the new buffers config architecture and create the profile for t1 (#1709) Move the ingress lossless profile from buffers.json.j2 to pg_profile_lookup.ini Move pool and the rest of the profile from buffers.json.j2 to buffers_defaults_t1.j2 Add port speed info in port_config.ini Make buffers_default_t1.j2 the default profile in buffers.json.j2 Signed-off-by: Wenda Ni --- .../Arista-7050-QX-32S/buffers.json.j2 | 129 +----------------- .../Arista-7050-QX-32S/buffers_defaults_t1.j2 | 45 ++++++ .../Arista-7050-QX-32S/pg_profile_lookup.ini | 11 ++ .../Arista-7050-QX-32S/port_config.ini | 66 ++++----- 4 files changed, 91 insertions(+), 160 deletions(-) create mode 100644 device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers_defaults_t1.j2 create mode 100644 device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/pg_profile_lookup.ini diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 index 551f73ca0477..b67cf577ab75 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 @@ -1,128 +1,3 @@ -{# Default values which will be used if no actual configura available #} -{% set default_cable = '300m' %} -{% set default_speed = '100G' %} -{% set default_ports_num = 32 -%} +{%- set default_topo = 't1' %} +{%- include 'buffers_config.j2' %} -{# Port configuration to cable length look-up table #} -{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} -{# Roles described in the minigraph #} -{% set ports2cable = { - 'torrouter_server' : '5m', - 'leafrouter_torrouter' : '40m', - 'spinerouter_leafrouter' : '300m' - } -%} - -{%- macro cable_length(port_name) -%} - {%- set cable_len = [] -%} - {%- for local_port in DEVICE_NEIGHBOR -%} - {%- if local_port == port_name -%} - {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor_role = neighbor.type -%} - {%- set roles1 = switch_role + '_' + neighbor_role %} - {%- set roles2 = neighbor_role + '_' + switch_role -%} - {%- set roles1 = roles1 | lower -%} - {%- set roles2 = roles2 | lower -%} - {%- if roles1 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} - {%- elif roles2 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {%- if cable_len -%} - {{ cable_len.0 }} - {%- else -%} - {{ default_cable }} - {%- endif -%} -{% endmacro %} - -{%- if DEVICE_METADATA is defined %} -{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} -{%- endif -%} - -{# Generate list of ports if not defined #} -{% if PORT is not defined %} - {% set PORT = [] %} - {% for port_idx in range(0,default_ports_num) %} - {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} - {% endfor %} -{% endif -%} - -{% set port_names_list = [] %} -{% for port in PORT %} - {%- if port_names_list.append(port) %}{% endif %} -{% endfor %} -{% set port_names = port_names_list | join(',') -%} - -{ - "CABLE_LENGTH": { - "AZURE": { - {% for port in PORT %} - {% set cable = cable_length(port) -%} - "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} - - {% endfor %} - } - }, - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "12766208", - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "12766208", - "type": "egress", - "mode": "static" - }, - "egress_lossy_pool": { - "size": "8072396", - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", - "xon":"18432", - "xoff":"40560", - "size":"41808", - "dynamic_th":"-4", - "xon_offset":"2496" - }, - "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"0", - "static_th":"12766208" - }, - "egress_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"1518", - "dynamic_th":"3" - } - }, - "BUFFER_PG": { - "{{ port_names }}|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" - }, - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - } - }, - "BUFFER_QUEUE": { - "{{ port_names }}|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - } - } -} diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..2d0cc548be30 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers_defaults_t1.j2 @@ -0,0 +1,45 @@ +{%- set default_cable = '300m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {% for port_idx in range(0,32) %} + {% if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{% endif %} + {% endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "12766208", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "12766208", + "type": "egress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "8072396", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "static_th":"12766208" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/pg_profile_lookup.ini new file mode 100644 index 000000000000..a1181e7befff --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/pg_profile_lookup.ini @@ -0,0 +1,11 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 40000 5m 41808 18432 40560 -4 2496 + 50000 5m 41808 18432 40560 -4 2496 + 100000 5m 41808 18432 40560 -4 2496 + 40000 40m 41808 18432 40560 -4 2496 + 50000 40m 41808 18432 40560 -4 2496 + 100000 40m 41808 18432 40560 -4 2496 + 40000 300m 41808 18432 40560 -4 2496 + 50000 300m 41808 18432 40560 -4 2496 + 100000 300m 41808 18432 40560 -4 2496 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini index fda62e998c1a..857b126bf833 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini @@ -1,33 +1,33 @@ -# name lanes alias index -Ethernet0 9,10,11,12 Ethernet5/1 5 -Ethernet4 13,14,15,16 Ethernet6/1 6 -Ethernet8 17,18,19,20 Ethernet7/1 7 -Ethernet12 21,22,23,24 Ethernet8/1 8 -Ethernet16 29,30,31,32 Ethernet9/1 9 -Ethernet20 25,26,27,28 Ethernet10/1 10 -Ethernet24 33,34,35,36 Ethernet11/1 11 -Ethernet28 37,38,39,40 Ethernet12/1 12 -Ethernet32 45,46,47,48 Ethernet13/1 13 -Ethernet36 41,42,43,44 Ethernet14/1 14 -Ethernet40 49,50,51,52 Ethernet15/1 15 -Ethernet44 53,54,55,56 Ethernet16/1 16 -Ethernet48 69,70,71,72 Ethernet17/1 17 -Ethernet52 65,66,67,68 Ethernet18/1 18 -Ethernet56 73,74,75,76 Ethernet19/1 19 -Ethernet60 77,78,79,80 Ethernet20/1 20 -Ethernet64 93,94,95,96 Ethernet21/1 21 -Ethernet68 89,90,91,92 Ethernet22/1 22 -Ethernet72 97,98,99,100 Ethernet23/1 23 -Ethernet76 101,102,103,104 Ethernet24/1 24 -Ethernet80 109,110,111,112 Ethernet25/1 25 -Ethernet84 105,106,107,108 Ethernet26/1 26 -Ethernet88 121,122,123,124 Ethernet27/1 27 -Ethernet92 125,126,127,128 Ethernet28/1 28 -Ethernet96 61,62,63,64 Ethernet29 29 -Ethernet100 57,58,59,60 Ethernet30 30 -Ethernet104 81,82,83,84 Ethernet31 31 -Ethernet108 85,86,87,88 Ethernet32 32 -Ethernet112 117,118,119,120 Ethernet33 33 -Ethernet116 113,114,115,116 Ethernet34 34 -Ethernet120 1,2,3,4 Ethernet35 35 -Ethernet124 5,6,7,8 Ethernet36 36 +# name lanes alias index speed +Ethernet0 9,10,11,12 Ethernet5/1 5 40000 +Ethernet4 13,14,15,16 Ethernet6/1 6 40000 +Ethernet8 17,18,19,20 Ethernet7/1 7 40000 +Ethernet12 21,22,23,24 Ethernet8/1 8 40000 +Ethernet16 29,30,31,32 Ethernet9/1 9 40000 +Ethernet20 25,26,27,28 Ethernet10/1 10 40000 +Ethernet24 33,34,35,36 Ethernet11/1 11 40000 +Ethernet28 37,38,39,40 Ethernet12/1 12 40000 +Ethernet32 45,46,47,48 Ethernet13/1 13 40000 +Ethernet36 41,42,43,44 Ethernet14/1 14 40000 +Ethernet40 49,50,51,52 Ethernet15/1 15 40000 +Ethernet44 53,54,55,56 Ethernet16/1 16 40000 +Ethernet48 69,70,71,72 Ethernet17/1 17 40000 +Ethernet52 65,66,67,68 Ethernet18/1 18 40000 +Ethernet56 73,74,75,76 Ethernet19/1 19 40000 +Ethernet60 77,78,79,80 Ethernet20/1 20 40000 +Ethernet64 93,94,95,96 Ethernet21/1 21 40000 +Ethernet68 89,90,91,92 Ethernet22/1 22 40000 +Ethernet72 97,98,99,100 Ethernet23/1 23 40000 +Ethernet76 101,102,103,104 Ethernet24/1 24 40000 +Ethernet80 109,110,111,112 Ethernet25/1 25 40000 +Ethernet84 105,106,107,108 Ethernet26/1 26 40000 +Ethernet88 121,122,123,124 Ethernet27/1 27 40000 +Ethernet92 125,126,127,128 Ethernet28/1 28 40000 +Ethernet96 61,62,63,64 Ethernet29 29 40000 +Ethernet100 57,58,59,60 Ethernet30 30 40000 +Ethernet104 81,82,83,84 Ethernet31 31 40000 +Ethernet108 85,86,87,88 Ethernet32 32 40000 +Ethernet112 117,118,119,120 Ethernet33 33 40000 +Ethernet116 113,114,115,116 Ethernet34 34 40000 +Ethernet120 1,2,3,4 Ethernet35 35 40000 +Ethernet124 5,6,7,8 Ethernet36 36 40000 From 07ea9741fba01d862343f16fedb5fe5f1d27a01f Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 22 Jun 2018 19:53:51 -0700 Subject: [PATCH 247/274] Enable sairedis counter thread in 3 minutes after SONiC was started (#1805) --- files/build_templates/enable_counters.service | 7 +++++++ files/build_templates/enable_counters.timer | 9 +++++++++ files/build_templates/snmp.service.j2 | 7 ++----- files/build_templates/snmp.timer | 9 +++++++++ files/build_templates/sonic_debian_extension.j2 | 8 ++++++++ src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 8 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 files/build_templates/enable_counters.service create mode 100644 files/build_templates/enable_counters.timer create mode 100644 files/build_templates/snmp.timer diff --git a/files/build_templates/enable_counters.service b/files/build_templates/enable_counters.service new file mode 100644 index 000000000000..98db4da3d2a3 --- /dev/null +++ b/files/build_templates/enable_counters.service @@ -0,0 +1,7 @@ +[Unit] +Description=Enable SONiC counters + +[Service] +Type=oneshot +ExecStart=/usr/bin/counterpoll queue enable +RemainAfterExit=yes diff --git a/files/build_templates/enable_counters.timer b/files/build_templates/enable_counters.timer new file mode 100644 index 000000000000..7382a1658c1b --- /dev/null +++ b/files/build_templates/enable_counters.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Delays the SONiC counters gathering until SONiC has started + +[Timer] +OnBootSec=3min +Unit=enable_counters.service + +[Install] +WantedBy=timers.target diff --git a/files/build_templates/snmp.service.j2 b/files/build_templates/snmp.service.j2 index f0612a9cfcb6..93ef869b86e1 100644 --- a/files/build_templates/snmp.service.j2 +++ b/files/build_templates/snmp.service.j2 @@ -1,12 +1,9 @@ [Unit] Description=SNMP container -Requires=updategraph.service swss.service -After=updategraph.service swss.service +Requires=updategraph.service swss.service enable_counters.service +After=updategraph.service swss.service enable_counters.service [Service] ExecStartPre=/usr/bin/{{docker_container_name}}.sh start ExecStart=/usr/bin/{{docker_container_name}}.sh attach ExecStop=/usr/bin/{{docker_container_name}}.sh stop - -[Install] -WantedBy=multi-user.target diff --git a/files/build_templates/snmp.timer b/files/build_templates/snmp.timer new file mode 100644 index 000000000000..464cf01459ba --- /dev/null +++ b/files/build_templates/snmp.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Delays snmp container until SONiC has started + +[Timer] +OnBootSec=3min 30 sec +Unit=snmp.service + +[Install] +WantedBy=timers.target diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 698a29ec22a7..b4a45ed16149 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -276,6 +276,14 @@ sudo LANG=C chroot $FILESYSTEM_ROOT fuser -km /sys || true sudo LANG=C chroot $FILESYSTEM_ROOT umount -lf /sys {% endif %} +# Copy systemd timer configuration +# It implements delayed start of services +sudo cp $BUILD_TEMPLATES/enable_counters.timer $FILESYSTEM_ROOT/etc/systemd/system/ +sudo cp $BUILD_TEMPLATES/enable_counters.service $FILESYSTEM_ROOT/etc/systemd/system/ +sudo cp $BUILD_TEMPLATES/snmp.timer $FILESYSTEM_ROOT/etc/systemd/system/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable enable_counters.timer +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable snmp.timer + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get remove -y python-dev sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get clean -y sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get autoremove -y diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 4ef45eed56a4..5fee797a1d2a 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 4ef45eed56a4ec34c225d2a37cc02efc2131033b +Subproject commit 5fee797a1d2ae4d4ba7d7c7ea8cc79578f5c19f5 diff --git a/src/sonic-swss b/src/sonic-swss index 4df9c289a6c2..98ad0bd500fc 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 4df9c289a6c2d41e4dee09f3055f0ac6d8e98ded +Subproject commit 98ad0bd500fc23fb61197e0ff8390d332216c9e8 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index b4367a440fb7..8c5dab6b3417 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit b4367a440fb7b188c60774808195164438061bba +Subproject commit 8c5dab6b341752b4bda3f63917a9c143df778322 From ec850df74b36eb5580e40e23c88e0923bd42e7fd Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Sat, 23 Jun 2018 17:24:56 -0700 Subject: [PATCH 248/274] [devices]: Use arista library as led plugin for more platforms. (#1809) This apply to arista_7050_qx32 and arista_7050_qx32s. --- .../plugins/led_control.py | 98 +------------------ .../plugins/led_control.py | 93 +----------------- 2 files changed, 6 insertions(+), 185 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py b/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py index 31effbaf11c6..8d387e513c6c 100644 --- a/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py +++ b/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py @@ -1,98 +1,6 @@ -#!/usr/bin/env python -# -# led_control.py -# -# Platform-specific LED control functionality for SONiC -# - try: - from sonic_led.led_control_base import LedControlBase - import swsssdk + import arista.utils.sonic_leds as arista_leds except ImportError, e: - raise ImportError (str(e) + " - required module not found") - - -class LedControl(LedControlBase): - """Platform specific LED control class""" - PORT_TABLE_PREFIX = "PORT_TABLE:" - - SONIC_PORT_NAME_PREFIX = "Ethernet" - - LED_SYSFS_PATH_BREAKOUT_CAPABLE = "/sys/class/leds/qsfp{0}_{1}/brightness" - LED_SYSFS_PATH_NO_BREAKOUT = "/sys/class/leds/qsfp{0}/brightness" - - QSFP_BREAKOUT_START_IDX = 1 - QSFP_BREAKOUT_END_IDX = 24 - QSFP_NO_BREAKOUT_START_IDX = 25 - QSFP_NO_BREAKOUT_END_IDX = 32 - - LED_COLOR_OFF = 0 - LED_COLOR_GREEN = 1 - LED_COLOR_YELLOW = 2 - - # Helper method to map SONiC port name to Arista QSFP index - def _port_name_to_qsfp_index(self, port_name): - # Strip "Ethernet" off port name - if not port_name.startswith(self.SONIC_PORT_NAME_PREFIX): - return -1 - - sonic_port_num = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):]) - - swss = swsssdk.SonicV2Connector() - swss.connect(swss.APPL_DB) - - lanes = swss.get(swss.APPL_DB, self.PORT_TABLE_PREFIX + port_name, 'lanes') - - # SONiC port nums are 0-based and increment by 4 - # Arista QSFP indices are 1-based and increment by 1 - return (((sonic_port_num/4) + 1), sonic_port_num%4, len(lanes.split(','))) - - # Concrete implementation of port_link_state_change() method - def port_link_state_change(self, port, state): - qsfp_index, lane_index, lanes = self._port_name_to_qsfp_index(port) - - # Ignore invalid QSFP indices - if qsfp_index <= 0 or lanes <= 0 or lanes > 4: - return - - # QSFP indices 1-24 are breakout-capable and have four LEDs, and each LED indicate one lane. - # whereas indices 25-32 are not breakout-capable, and only have one - if qsfp_index <= self.QSFP_BREAKOUT_END_IDX: - # assuming 40G, then we need to control four lanes - led_sysfs_paths = [ self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index, i) for i in range(lane_index + 1, lane_index + 1 + lanes) ] - else: - led_sysfs_paths = [ self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index) ] - - for led_sysfs_path in led_sysfs_paths: - led_file = open(led_sysfs_path, "w") - - if state == "up": - led_file.write("%d" % self.LED_COLOR_GREEN) - else: - led_file.write("%d" % self.LED_COLOR_OFF) - - led_file.close() - - # Constructor - def __init__(self): - # Initialize all front-panel status LEDs to green - with open("/sys/class/leds/status/brightness", "w") as f: - f.write("1") - with open("/sys/class/leds/fan_status/brightness", "w") as f: - f.write("1") - with open("/sys/class/leds/psu1/brightness", "w") as f: - f.write("1") - with open("/sys/class/leds/psu2/brightness", "w") as f: - f.write("1") - - # Initialize: Turn all front panel QSFP LEDs off - for qsfp_index in range(self.QSFP_BREAKOUT_START_IDX, self.QSFP_BREAKOUT_END_IDX + 1): - for lane in range(1, 5): - led_sysfs_path = self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index, lane) - with open(led_sysfs_path, 'w') as led_file: - led_file.write("%d" % self.LED_COLOR_OFF) + raise ImportError (str(e) + "- required module not found") - for qsfp_index in range(self.QSFP_NO_BREAKOUT_START_IDX, self.QSFP_NO_BREAKOUT_END_IDX + 1): - led_sysfs_path = self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index) - with open(led_sysfs_path, 'w') as led_file: - led_file.write("%d" % self.LED_COLOR_OFF) +LedControl = arista_leds.getLedControl() diff --git a/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py b/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py index 6424516a59d9..8d387e513c6c 100644 --- a/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py +++ b/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py @@ -1,93 +1,6 @@ -#!/usr/bin/env python -# -# led_control.py -# -# Platform-specific LED control functionality for SONiC -# - try: - from sonic_led.led_control_base import LedControlBase + import arista.utils.sonic_leds as arista_leds except ImportError, e: - raise ImportError (str(e) + " - required module not found") - - -class LedControl(LedControlBase): - """Platform specific LED control class""" - - SONIC_PORT_NAME_PREFIX = "Ethernet" - - LED_SYSFS_PATH_BREAKOUT_CAPABLE = "/sys/class/leds/qsfp{0}_{1}/brightness" - LED_SYSFS_PATH_NO_BREAKOUT = "/sys/class/leds/qsfp{0}/brightness" - - QSFP_BREAKOUT_START_IDX = 1 - QSFP_BREAKOUT_END_IDX = 24 - QSFP_NO_BREAKOUT_START_IDX = 25 - QSFP_NO_BREAKOUT_END_IDX = 32 - - LED_QSFP_OFFSET = 4 - - LED_COLOR_OFF = 0 - LED_COLOR_GREEN = 1 - LED_COLOR_YELLOW = 2 - - # Helper method to map SONiC port name to Arista QSFP index - def _port_name_to_qsfp_index(self, port_name): - # Strip "Ethernet" off port name - if not port_name.startswith(self.SONIC_PORT_NAME_PREFIX): - return -1 - - sonic_port_num = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):]) - - # SONiC port nums are 0-based and increment by 4 - # Arista QSFP indices are 1-based and increment by 1 - return ((sonic_port_num/4) + 1) - - # Concrete implementation of port_link_state_change() method - def port_link_state_change(self, port, state): - qsfp_index = self._port_name_to_qsfp_index(port) - - # Ignore invalid QSFP indices - if qsfp_index <= 0: - return - - # QSFP indices 1-24 are breakout-capable and have four LEDs, and each LED indicate one lane. - # whereas indices 25-32 are not breakout-capable, and only have one - if qsfp_index <= self.QSFP_BREAKOUT_END_IDX: - # assuming 40G, then we need to control four lanes - led_sysfs_paths = [ self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index + self.LED_QSFP_OFFSET, i) for i in range(1, 5) ] - else: - led_sysfs_paths = [ self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index + self.LED_QSFP_OFFSET) ] - - for led_sysfs_path in led_sysfs_paths: - led_file = open(led_sysfs_path, "w") - - if state == "up": - led_file.write("%d" % self.LED_COLOR_GREEN) - else: - led_file.write("%d" % self.LED_COLOR_OFF) - - led_file.close() - - # Constructor - def __init__(self): - # Initialize all front-panel status LEDs to green - with open("/sys/class/leds/status/brightness", "w") as f: - f.write("1") - with open("/sys/class/leds/fan_status/brightness", "w") as f: - f.write("1") - with open("/sys/class/leds/psu1/brightness", "w") as f: - f.write("1") - with open("/sys/class/leds/psu2/brightness", "w") as f: - f.write("1") - - # Initialize: Turn all front panel QSFP LEDs off - for qsfp_index in range(self.QSFP_BREAKOUT_START_IDX, self.QSFP_BREAKOUT_END_IDX + 1): - for lane in range(1, 5): - led_sysfs_path = self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index + self.LED_QSFP_OFFSET, lane) - with open(led_sysfs_path, 'w') as led_file: - led_file.write("%d" % self.LED_COLOR_OFF) + raise ImportError (str(e) + "- required module not found") - for qsfp_index in range(self.QSFP_NO_BREAKOUT_START_IDX, self.QSFP_NO_BREAKOUT_END_IDX + 1): - led_sysfs_path = self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index + self.LED_QSFP_OFFSET) - with open(led_sysfs_path, 'w') as led_file: - led_file.write("%d" % self.LED_COLOR_OFF) +LedControl = arista_leds.getLedControl() From 3d2430525314521d8eb190953ddff1ba2ac1060c Mon Sep 17 00:00:00 2001 From: stepanblyschak <38952541+stepanblyschak@users.noreply.github.com> Date: Mon, 25 Jun 2018 18:43:22 +0300 Subject: [PATCH 249/274] [mellanox] Update SAI, SDK, FW pointers (#1811) SAI 1.12.0 SDK 4.2.8103 FW 13.1701.0008 Signed-off-by: Stepan Blyschak --- platform/mellanox/fw.mk | 2 +- platform/mellanox/mlnx-sai.mk | 4 ++-- platform/mellanox/sdk.mk | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 73d1236f5a9a..579c5e5e4986 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,6 +1,6 @@ # mellanox firmware -MLNX_FW_VERSION = 13.1620.0222 +MLNX_FW_VERSION = 13.1701.0008 MLNX_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_FW_VERSION))-EVB.mfa $(MLNX_FW_FILE)_URL = $(MLNX_SDK_BASE_URL)/$(MLNX_FW_FILE) SONIC_ONLINE_FILES += $(MLNX_FW_FILE) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 53e74021bb84..5b2994360621 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.11.5-master -MLNX_SAI_REVISION = 957f61820e441e490081cb3724f702ed507f7477 +MLNX_SAI_VERSION = SAIRel1.12.0-master +MLNX_SAI_REVISION = 5be04c71508e0688ae004ed838b998dba521f693 export MLNX_SAI_VERSION MLNX_SAI_REVISION diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index f301032846c3..88bfe76d0f0d 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,5 +1,5 @@ -MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/957f61820e441e490081cb3724f702ed507f7477/sdk -MLNX_SDK_VERSION = 4.2.7303 +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/5be04c71508e0688ae004ed838b998dba521f693/sdk +MLNX_SDK_VERSION = 4.2.8103 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ $(SXD_LIBS) $(TESTX) From 7ba08e5bf6eb2b37ec0a79785b64b456eba4b59f Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 25 Jun 2018 10:48:42 -0700 Subject: [PATCH 250/274] Prefix docker container name to syslog syslogtag (program name) (#1810) --- dockers/docker-base/etc/rsyslog.conf | 6 ++++-- dockers/docker-database/Dockerfile.j2 | 3 +++ dockers/docker-dhcp-relay/Dockerfile.j2 | 3 +++ dockers/docker-fpm-frr/Dockerfile.j2 | 3 +++ dockers/docker-fpm-quagga/Dockerfile.j2 | 3 +++ dockers/docker-lldp-sv2/Dockerfile.j2 | 3 +++ dockers/docker-orchagent/Dockerfile.j2 | 3 +++ dockers/docker-platform-monitor/Dockerfile.j2 | 3 +++ dockers/docker-router-advertiser/Dockerfile.j2 | 3 +++ dockers/docker-snmp-sv2/Dockerfile.j2 | 3 +++ dockers/docker-sonic-telemetry/Dockerfile.j2 | 3 +++ dockers/docker-teamd/Dockerfile.j2 | 3 +++ platform/broadcom/docker-syncd-brcm/Dockerfile.j2 | 3 +++ platform/cavium/docker-syncd-cavm/Dockerfile.j2 | 3 +++ platform/centec/docker-syncd-centec/Dockerfile.j2 | 3 +++ platform/marvell/docker-syncd-mrvl/Dockerfile.j2 | 3 +++ platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 | 3 +++ platform/nephos/docker-syncd-nephos/Dockerfile.j2 | 3 +++ platform/p4/docker-sonic-p4/Dockerfile.j2 | 5 ++++- platform/vs/docker-sonic-vs/Dockerfile.j2 | 3 +++ slave.mk | 2 ++ 21 files changed, 64 insertions(+), 3 deletions(-) diff --git a/dockers/docker-base/etc/rsyslog.conf b/dockers/docker-base/etc/rsyslog.conf index 8cd8928e2b14..cf5509a3e8b3 100644 --- a/dockers/docker-base/etc/rsyslog.conf +++ b/dockers/docker-base/etc/rsyslog.conf @@ -29,8 +29,10 @@ $ModLoad imuxsock # provides support for local system logging ########################### #### GLOBAL DIRECTIVES #### ########################### -#Set remote syslog server -*.* @127.0.0.1:514 + +# Set remote syslog server +template (name="ForwardFormatInContainer" type="string" string="<%PRI%>%TIMESTAMP:::date-rfc3339% %HOSTNAME% %syslogtag%%msg:::sp-if-no-1st-sp%%msg%") +*.* action(type="omfwd" target="127.0.0.1" port="514" protocol="udp" Template="ForwardFormatInContainer") # # Use traditional timestamp format. diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index 4690e1587c14..712ada91a904 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 index 2c2bdcaecbf7..7382664c64f3 100644 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-fpm-frr/Dockerfile.j2 b/dockers/docker-fpm-frr/Dockerfile.j2 index 350b3b2efb91..4796552d20c7 100644 --- a/dockers/docker-fpm-frr/Dockerfile.j2 +++ b/dockers/docker-fpm-frr/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-fpm-quagga/Dockerfile.j2 b/dockers/docker-fpm-quagga/Dockerfile.j2 index 8836459e4e93..39037f3d042d 100644 --- a/dockers/docker-fpm-quagga/Dockerfile.j2 +++ b/dockers/docker-fpm-quagga/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-lldp-sv2/Dockerfile.j2 b/dockers/docker-lldp-sv2/Dockerfile.j2 index f75e4ea31422..fb91af231592 100644 --- a/dockers/docker-lldp-sv2/Dockerfile.j2 +++ b/dockers/docker-lldp-sv2/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 3d6671996358..0df8e9ba1bb4 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index 95e9d150ea2c..c53ed494c474 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-router-advertiser/Dockerfile.j2 b/dockers/docker-router-advertiser/Dockerfile.j2 index 5007daf122cf..c6c770bb7677 100644 --- a/dockers/docker-router-advertiser/Dockerfile.j2 +++ b/dockers/docker-router-advertiser/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 2605e9b50c2d..e463d00441c7 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + # Enable -O for all Python calls ENV PYTHONOPTIMIZE 1 diff --git a/dockers/docker-sonic-telemetry/Dockerfile.j2 b/dockers/docker-sonic-telemetry/Dockerfile.j2 index bbb15db69aaa..51d272c2a212 100644 --- a/dockers/docker-sonic-telemetry/Dockerfile.j2 +++ b/dockers/docker-sonic-telemetry/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index f604433a6c3f..f405fdde10e2 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index 042e7e764fd1..bd6d6cc35706 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 index a35abf576f6d..9f6e872ff1e1 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/centec/docker-syncd-centec/Dockerfile.j2 b/platform/centec/docker-syncd-centec/Dockerfile.j2 index d9b12bb426e4..7fa2bd2ae0e4 100755 --- a/platform/centec/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 index 7676b3f2ffa1..6e7c34d644d5 100755 --- a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index 966ef35ac9c8..73a16fac2a4b 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/nephos/docker-syncd-nephos/Dockerfile.j2 b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 index e0248d460a12..b25272be1a0d 100755 --- a/platform/nephos/docker-syncd-nephos/Dockerfile.j2 +++ b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/p4/docker-sonic-p4/Dockerfile.j2 b/platform/p4/docker-sonic-p4/Dockerfile.j2 index 95ac5cc1646d..971d7a962ed3 100644 --- a/platform/p4/docker-sonic-p4/Dockerfile.j2 +++ b/platform/p4/docker-sonic-p4/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive @@ -76,4 +79,4 @@ COPY ["files/arp_update", "/usr/bin"] RUN echo "docker-sonic-p4" > /etc/hostname RUN touch /etc/quagga/zebra.conf -ENTRYPOINT ["/bin/bash"] \ No newline at end of file +ENTRYPOINT ["/bin/bash"] diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index 0c242bb373ef..2d9b72aa3298 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/slave.mk b/slave.mk index 7ca92dc4ce1b..fc14a8f10a61 100644 --- a/slave.mk +++ b/slave.mk @@ -382,6 +382,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.g --build-arg user=$(USER) \ --build-arg uid=$(UID) \ --build-arg guid=$(GUID) \ + --build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \ -t $* $($*.gz_PATH) $(LOG) docker save $* | gzip -c > $@ # Clean up @@ -412,6 +413,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl --build-arg user=$(USER) \ --build-arg uid=$(UID) \ --build-arg guid=$(GUID) \ + --build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \ -t $* $($*.gz_PATH) $(LOG) docker save $* | gzip -c > $@ # Clean up From d57bef55dbb584352c05e7d0bdb2cea215a537a9 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 26 Jun 2018 06:34:25 -0700 Subject: [PATCH 251/274] Enable all counters: queue, port, and pfcwd (#1814) * Enable all counters: queue, port, and pfcwd * Fixed a small bug inside of sonic-utilities * Another typo --- files/build_templates/enable_counters.service | 2 +- src/sonic-swss | 2 +- src/sonic-utilities | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/build_templates/enable_counters.service b/files/build_templates/enable_counters.service index 98db4da3d2a3..f19249369f87 100644 --- a/files/build_templates/enable_counters.service +++ b/files/build_templates/enable_counters.service @@ -3,5 +3,5 @@ Description=Enable SONiC counters [Service] Type=oneshot -ExecStart=/usr/bin/counterpoll queue enable +ExecStart=/bin/bash -c '/usr/bin/counterpoll queue enable ; /usr/bin/counterpoll port enable ; /usr/bin/pfcwd counter_poll enable' RemainAfterExit=yes diff --git a/src/sonic-swss b/src/sonic-swss index 98ad0bd500fc..72a7f3a5cb99 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 98ad0bd500fc23fb61197e0ff8390d332216c9e8 +Subproject commit 72a7f3a5cb99cec297c7eb0e9e3b2b583eccf8bd diff --git a/src/sonic-utilities b/src/sonic-utilities index 5baa30528bd7..27ae65122582 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 5baa30528bd73ffc364de03c9098263d42a2d320 +Subproject commit 27ae651225820e3eb4f08ed4cd80f93bbb5fe9bf From 0a41247402533af6ab6bf736193da33cbece356d Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 26 Jun 2018 14:48:07 -0700 Subject: [PATCH 252/274] Update sonic-swss. Postpone creation of queue maps (#1816) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 72a7f3a5cb99..258ffe64c7f1 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 72a7f3a5cb99cec297c7eb0e9e3b2b583eccf8bd +Subproject commit 258ffe64c7f11a3e63f7cff09ae8bd2f98788c03 From 9a646553939b595c8a45d413c9db3addccd50589 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 26 Jun 2018 17:29:33 -0700 Subject: [PATCH 253/274] sonic-quagga update. Don't spam with 'Vtysh connected from' message (#1817) --- src/sonic-quagga | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-quagga b/src/sonic-quagga index 0bc6bd6b208e..cde29666c363 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit 0bc6bd6b208e3701df89c3e231c48f3bdb3d046f +Subproject commit cde29666c363e34ea7f230bb827644457acedcbc From d995147050dd5bf6aaf94a2779cf263dc67e2d84 Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Wed, 27 Jun 2018 19:22:37 -0700 Subject: [PATCH 254/274] Migrate brcm platform to use new ECN config, which is (#1818) applied on lossless traffic Arista-7060CX-32S-C32 Arista-7060CX-32S-D48C8 Arista-7060CX-32S-Q32 Arista-7260CX3-D108C8 Force10-Z9100-T0 Force10-Z9100 Signed-off-by: Wenda Ni --- .../Arista-7060CX-32S-C32/qos.json.j2 | 30 ++++++------------- .../Arista-7060CX-32S-D48C8/qos.json.j2 | 30 ++++++------------- .../Arista-7060CX-32S-Q32/qos.json.j2 | 30 ++++++------------- .../Arista-7260CX3-D108C8/qos.json.j2 | 30 ++++++------------- .../Force10-Z9100-T0/qos.json.j2 | 30 ++++++------------- .../Force10-Z9100/qos.json.j2 | 30 ++++++------------- 6 files changed, 54 insertions(+), 126 deletions(-) diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 index b724b48c2c23..84f74ecab3be 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 @@ -127,35 +127,23 @@ } }, "WRED_PROFILE": { - "AZURE_LOSSY" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, "AZURE_LOSSLESS" : { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold": "312000", + "green_min_threshold": "104000" } }, "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]" + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 index 8149f1f111ce..5142832ecae4 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 @@ -127,35 +127,23 @@ } }, "WRED_PROFILE": { - "AZURE_LOSSY" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, "AZURE_LOSSLESS" : { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold": "312000", + "green_min_threshold": "104000" } }, "QUEUE": { - "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126|0-1": { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126|3-4": { - "scheduler" : "[SCHEDULER|scheduler.0]" + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126|0": { "scheduler" : "[SCHEDULER|scheduler.1]" diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 index b724b48c2c23..84f74ecab3be 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 @@ -127,35 +127,23 @@ } }, "WRED_PROFILE": { - "AZURE_LOSSY" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, "AZURE_LOSSLESS" : { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold": "312000", + "green_min_threshold": "104000" } }, "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]" + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 index 2aa5a902448b..06efa3591771 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 @@ -127,35 +127,23 @@ } }, "WRED_PROFILE": { - "AZURE_LOSSY" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, "AZURE_LOSSLESS" : { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold": "312000", + "green_min_threshold": "104000" } }, "QUEUE": { - "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet26,Ethernet28,Ethernet30,Ethernet32,Ethernet34,Ethernet36,Ethernet38,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126,Ethernet128,Ethernet130,Ethernet132,Ethernet134,Ethernet136,Ethernet138,Ethernet140,Ethernet142,Ethernet144,Ethernet146,Ethernet148,Ethernet150,Ethernet152,Ethernet154,Ethernet156,Ethernet158,Ethernet160,Ethernet162,Ethernet164,Ethernet166,Ethernet168,Ethernet170,Ethernet172,Ethernet174,Ethernet176,Ethernet178,Ethernet180,Ethernet182,Ethernet184,Ethernet186,Ethernet188,Ethernet190,Ethernet192,Ethernet194,Ethernet196,Ethernet198,Ethernet200,Ethernet202,Ethernet204,Ethernet206,Ethernet208,Ethernet210,Ethernet212,Ethernet214,Ethernet216,Ethernet218,Ethernet220,Ethernet222,Ethernet224,Ethernet226,Ethernet228,Ethernet230,Ethernet232,Ethernet234,Ethernet236,Ethernet238,Ethernet240,Ethernet242,Ethernet244,Ethernet246,Ethernet248,Ethernet250,Ethernet252,Ethernet254|0-1" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet26,Ethernet28,Ethernet30,Ethernet32,Ethernet34,Ethernet36,Ethernet38,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126,Ethernet128,Ethernet130,Ethernet132,Ethernet134,Ethernet136,Ethernet138,Ethernet140,Ethernet142,Ethernet144,Ethernet146,Ethernet148,Ethernet150,Ethernet152,Ethernet154,Ethernet156,Ethernet158,Ethernet160,Ethernet162,Ethernet164,Ethernet166,Ethernet168,Ethernet170,Ethernet172,Ethernet174,Ethernet176,Ethernet178,Ethernet180,Ethernet182,Ethernet184,Ethernet186,Ethernet188,Ethernet190,Ethernet192,Ethernet194,Ethernet196,Ethernet198,Ethernet200,Ethernet202,Ethernet204,Ethernet206,Ethernet208,Ethernet210,Ethernet212,Ethernet214,Ethernet216,Ethernet218,Ethernet220,Ethernet222,Ethernet224,Ethernet226,Ethernet228,Ethernet230,Ethernet232,Ethernet234,Ethernet236,Ethernet238,Ethernet240,Ethernet242,Ethernet244,Ethernet246,Ethernet248,Ethernet250,Ethernet252,Ethernet254|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]" + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet26,Ethernet28,Ethernet30,Ethernet32,Ethernet34,Ethernet36,Ethernet38,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126,Ethernet128,Ethernet130,Ethernet132,Ethernet134,Ethernet136,Ethernet138,Ethernet140,Ethernet142,Ethernet144,Ethernet146,Ethernet148,Ethernet150,Ethernet152,Ethernet154,Ethernet156,Ethernet158,Ethernet160,Ethernet162,Ethernet164,Ethernet166,Ethernet168,Ethernet170,Ethernet172,Ethernet174,Ethernet176,Ethernet178,Ethernet180,Ethernet182,Ethernet184,Ethernet186,Ethernet188,Ethernet190,Ethernet192,Ethernet194,Ethernet196,Ethernet198,Ethernet200,Ethernet202,Ethernet204,Ethernet206,Ethernet208,Ethernet210,Ethernet212,Ethernet214,Ethernet216,Ethernet218,Ethernet220,Ethernet222,Ethernet224,Ethernet226,Ethernet228,Ethernet230,Ethernet232,Ethernet234,Ethernet236,Ethernet238,Ethernet240,Ethernet242,Ethernet244,Ethernet246,Ethernet248,Ethernet250,Ethernet252,Ethernet254|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json.j2 b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json.j2 index 09cb63d5d474..57bb4c532177 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json.j2 +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json.j2 @@ -127,35 +127,23 @@ } }, "WRED_PROFILE": { - "AZURE_LOSSY" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, "AZURE_LOSSLESS" : { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold": "312000", + "green_min_threshold": "104000" } }, "QUEUE": { - "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet122,Ethernet124,Ethernet126|0-1": { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet122,Ethernet124,Ethernet126|3-4": { - "scheduler" : "[SCHEDULER|scheduler.0]" + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet122,Ethernet124,Ethernet126|0": { "scheduler" : "[SCHEDULER|scheduler.1]" diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json.j2 b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json.j2 index b724b48c2c23..84f74ecab3be 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json.j2 +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json.j2 @@ -127,35 +127,23 @@ } }, "WRED_PROFILE": { - "AZURE_LOSSY" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, "AZURE_LOSSLESS" : { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold": "312000", + "green_min_threshold": "104000" } }, "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]" + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" From 301fc282a7fd2d9627f9c56b5e4c361e6bf474ba Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 28 Jun 2018 05:29:14 -0700 Subject: [PATCH 255/274] Add initial support for keeping track of and displaying reboot cause (#1812) * [rc.local] Move all constants and functions to top of file; Unify style; Reword messages * Add function to process reboot cause upon boot * Simplify retrieval of SONIC_VERSION per comments * Change wording --- files/image_config/platform/rc.local | 84 ++++++++++++++++++---------- 1 file changed, 55 insertions(+), 29 deletions(-) diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index de54d141ef7e..b99ecdbcee9d 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -11,6 +11,9 @@ # # By default this script does nothing. +SONIC_VERSION=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v build_version) +FIRST_BOOT_FILE="/host/image-${SONIC_VERSION}/platform/firsttime" + # In case the unit is migrating from another NOS, save the logs log_migration() { echo $1 >> /host/migration/migration.log @@ -85,6 +88,51 @@ update_mgmt_interface_macaddr() { sed -i "/eth0/ s/ATTR{address}==\"$old_mac\"/ATTR{address}==\"$new_mac\"/g" /etc/udev/rules.d/70-persistent-net.rules } +firsttime_exit() { + rm -rf $FIRST_BOOT_FILE + exit 0 +} + +# Given a string of tuples of the form field=value, extract the value for a field +# In : $string, $field +# Out: $value +value_extract() { + set -- $string + for x in "$@"; do + case "$x" in + $field=*) + value="${x#$field=}" + esac + done +} + +# Set up previous and next reboot cause files +process_reboot_cause() { + REBOOT_CAUSE_FILE="/var/cache/sonic/reboot-cause.txt" + PREVIOUS_REBOOT_CAUSE_FILE="/var/cache/sonic/previous-reboot-cause.txt" + + # Set the previous reboot cause accordingly + # If this is the first boot after an image install, state that as the + # cause. Otherwise, move REBOOT_CAUSE_FILE to PREVIOUS_REBOOT_CAUSE_FILE. + # REBOOT_CAUSE_FILE should always exist, but we add the else case + # to ensure we always generate PREVIOUS_REBOOT_CAUSE_FILE here + if [ -f $FIRST_BOOT_FILE ]; then + echo "SONiC image installation" > $PREVIOUS_REBOOT_CAUSE_FILE + elif [ -f $REBOOT_CAUSE_FILE ]; then + mv -f $REBOOT_CAUSE_FILE $PREVIOUS_REBOOT_CAUSE_FILE + else + echo "Unknown reboot cause" > $PREVIOUS_REBOOT_CAUSE_FILE + fi + + # Set the default cause for the next reboot + echo "Unexpected reboot" > $REBOOT_CAUSE_FILE +} + +#### Begin Main Body #### + +# Set up previous and next reboot cause files +process_reboot_cause + # If the machine.conf is absent, it indicates that the unit booted # into SONiC from another NOS. Extract the machine.conf from ONIE. if [ ! -e /host/machine.conf ]; then @@ -161,38 +209,16 @@ fi . /host/machine.conf -echo "install platform dependent packages at the first boot time" - -firsttime_exit() -{ - rm /host/image-$sonic_version/platform/firsttime - exit 0 -} - -# Given a string of tuples of the form field=value, extract the value for a field -# In : $string, $field -# Out: $value -value_extract() -{ -set -- $string -for x in "$@"; do - case "$x" in - $field=*) - value="${x#$field=}" - esac -done -} - -eval sonic_version=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ") +if [ -f $FIRST_BOOT_FILE ]; then -if [ -f /host/image-$sonic_version/platform/firsttime ]; then + echo "First boot detected. Performing first boot tasks..." if [ -n "$aboot_platform" ]; then platform=$aboot_platform elif [ -n "$onie_platform" ]; then platform=$onie_platform else - echo "Unknown sonic platform" + echo "Unknown SONiC platform" firsttime_exit fi @@ -216,15 +242,15 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then touch /tmp/pending_config_initialization fi - if [ -d /host/image-$sonic_version/platform/$platform ]; then - dpkg -i /host/image-$sonic_version/platform/$platform/*.deb + if [ -d /host/image-$SONIC_VERSION/platform/$platform ]; then + dpkg -i /host/image-$SONIC_VERSION/platform/$platform/*.deb fi # If the unit booted into SONiC from another NOS's grub, # we now install a grub for SONiC. if [ -n "$onie_platform" ] && [ -n "$migration" ]; then - grub_bin=$(ls /host/image-$sonic_version/platform/x86_64-grub/grub-pc-bin*.deb 2> /dev/null) + grub_bin=$(ls /host/image-$SONIC_VERSION/platform/x86_64-grub/grub-pc-bin*.deb 2> /dev/null) if [ -z "$grub_bin" ]; then log_migration "Unable to locate grub package !" firsttime_exit @@ -302,7 +328,7 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then mv /host/grub.cfg /host/grub/grub.cfg fi - rm /host/image-$sonic_version/platform/firsttime + firsttime_exit fi exit 0 From a89b8d86cc35072d5fa243f032b55f7c6f447d89 Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Thu, 28 Jun 2018 16:50:14 -0700 Subject: [PATCH 256/274] Correct a7060 config for tor (#1823) Move a7060 configs out of syncd docker Signed-off-by: Wenda --- .../Arista-7060CX-32S-Q32/sai.profile.j2 | 6 +- .../th-a7060-cx32s-32x40G-t0.config.bcm | 444 ++++++++++++++++++ .../th-a7060-cx32s-32x40G-t1.config.bcm | 444 ++++++++++++++++++ 3 files changed, 891 insertions(+), 3 deletions(-) create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t0.config.bcm create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t1.config.bcm diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/sai.profile.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/sai.profile.j2 index bef6932f1eac..638fd28b0765 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/sai.profile.j2 +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/sai.profile.j2 @@ -2,12 +2,12 @@ {%- if DEVICE_METADATA is defined -%} {%- set switch_role = DEVICE_METADATA['localhost']['type'] -%} {%- if switch_role.lower() == 'torrouter' %} -{% set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/etc/bcm/th-a7060-cx32s-32x40G.config.bcm' -%} +{% set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-a7060-cx32s-32x40G-t0.config.bcm' -%} {%- else %} -{%- set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/etc/bcm/th-a7060-cx32s-32x40G-t1.config.bcm' -%} +{%- set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-a7060-cx32s-32x40G-t1.config.bcm' -%} {%- endif %} {%- else %} -{%- set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/etc/bcm/th-a7060-cx32s-32x40G-t1.config.bcm' -%} +{%- set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-a7060-cx32s-32x40G-t1.config.bcm' -%} {%- endif %} {# Write the contents of sai_ profile_filename to sai.profile file #} {{ sai_profile_contents }} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t0.config.bcm b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t0.config.bcm new file mode 100644 index 000000000000..0cb4ae4a474a --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t0.config.bcm @@ -0,0 +1,444 @@ +# Arista 7060CX-32S + +phy_an_allow_pll_change=1 +arl_clean_timeout_usec=15000000 +asf_mem_profile=2 +bcm_num_cos=8 +bcm_stat_flags=1 +bcm_stat_jumbo=9236 +cdma_timeout_usec=15000000 +dma_desc_timeout_usec=15000000 +higig2_hdr_mode=1 +ipv6_lpm_128b_enable=1 +l3_alpm_enable=2 +lpm_scaling_enable=0 +l2xmsg_mode=1 +max_vp_lags=0 +miim_intr_enable=0 +module_64ports=1 +os=unix +oversubscribe_mode=1 +ptp_bs_fref.0=25000000 +ptp_ts_pll_fref.0=25000000 +robust_hash_disable_egress_vlan.0=1 +robust_hash_disable_mpls.0=1 +robust_hash_disable_vlan.0=1 +tdma_timeout_usec.0=15000000 +tslam_timeout_usec.0=15000000 +pbmp_xport_xe.0=0x7ffffffffffffffffffffffffffffffffe +phy_an_allow_pll_change_hg.0=0 +phy_an_c73_1.0=1 +phy_an_c73_2.0=1 +phy_an_c73_3.0=1 +phy_an_c73_4.0=1 +phy_an_c73_5.0=1 +phy_an_c73_6.0=1 +phy_an_c73_7.0=1 +phy_an_c73_8.0=1 +phy_an_c73_34.0=1 +phy_an_c73_35.0=1 +phy_an_c73_36.0=1 +phy_an_c73_37.0=1 +phy_an_c73_38.0=1 +phy_an_c73_39.0=1 +phy_an_c73_40.0=1 +phy_an_c73_41.0=1 +phy_an_c73_68.0=1 +phy_an_c73_69.0=1 +phy_an_c73_70.0=1 +phy_an_c73_71.0=1 +phy_an_c73_72.0=1 +phy_an_c73_73.0=1 +phy_an_c73_74.0=1 +phy_an_c73_75.0=1 +phy_an_c73_102.0=1 +phy_an_c73_103.0=1 +phy_an_c73_104.0=1 +phy_an_c73_105.0=1 +phy_an_c73_106.0=1 +phy_an_c73_107.0=1 +phy_an_c73_108.0=1 +phy_an_c73_109.0=1 +phy_an_fec_1.0=1 +phy_an_fec_2.0=1 +phy_an_fec_3.0=1 +phy_an_fec_4.0=1 +phy_an_fec_5.0=1 +phy_an_fec_6.0=1 +phy_an_fec_7.0=1 +phy_an_fec_8.0=1 +phy_an_fec_9.0=1 +phy_an_fec_10.0=1 +phy_an_fec_11.0=1 +phy_an_fec_12.0=1 +phy_an_fec_13.0=1 +phy_an_fec_14.0=1 +phy_an_fec_15.0=1 +phy_an_fec_16.0=1 +phy_an_fec_17.0=1 +phy_an_fec_18.0=1 +phy_an_fec_19.0=1 +phy_an_fec_20.0=1 +phy_an_fec_21.0=1 +phy_an_fec_22.0=1 +phy_an_fec_23.0=1 +phy_an_fec_24.0=1 +phy_an_fec_25.0=1 +phy_an_fec_26.0=1 +phy_an_fec_27.0=1 +phy_an_fec_28.0=1 +phy_an_fec_29.0=1 +phy_an_fec_30.0=1 +phy_an_fec_31.0=1 +phy_an_fec_32.0=1 +phy_an_fec_34.0=1 +phy_an_fec_38.0=1 +phy_an_fec_39.0=1 +phy_an_fec_40.0=1 +phy_an_fec_41.0=1 +phy_an_fec_42.0=1 +phy_an_fec_43.0=1 +phy_an_fec_44.0=1 +phy_an_fec_45.0=1 +phy_an_fec_46.0=1 +phy_an_fec_47.0=1 +phy_an_fec_48.0=1 +phy_an_fec_49.0=1 +phy_an_fec_50.0=1 +phy_an_fec_51.0=1 +phy_an_fec_52.0=1 +phy_an_fec_53.0=1 +phy_an_fec_54.0=1 +phy_an_fec_55.0=1 +phy_an_fec_56.0=1 +phy_an_fec_57.0=1 +phy_an_fec_58.0=1 +phy_an_fec_59.0=1 +phy_an_fec_60.0=1 +phy_an_fec_61.0=1 +phy_an_fec_62.0=1 +phy_an_fec_63.0=1 +phy_an_fec_64.0=1 +phy_an_fec_65.0=1 +phy_an_fec_68.0=1 +phy_an_fec_69.0=1 +phy_an_fec_70.0=1 +phy_an_fec_71.0=1 +phy_an_fec_72.0=1 +phy_an_fec_73.0=1 +phy_an_fec_74.0=1 +phy_an_fec_75.0=1 +phy_an_fec_76.0=1 +phy_an_fec_77.0=1 +phy_an_fec_78.0=1 +phy_an_fec_79.0=1 +phy_an_fec_80.0=1 +phy_an_fec_81.0=1 +phy_an_fec_82.0=1 +phy_an_fec_83.0=1 +phy_an_fec_84.0=1 +phy_an_fec_85.0=1 +phy_an_fec_86.0=1 +phy_an_fec_87.0=1 +phy_an_fec_88.0=1 +phy_an_fec_89.0=1 +phy_an_fec_90.0=1 +phy_an_fec_91.0=1 +phy_an_fec_92.0=1 +phy_an_fec_93.0=1 +phy_an_fec_94.0=1 +phy_an_fec_95.0=1 +phy_an_fec_96.0=1 +phy_an_fec_97.0=1 +phy_an_fec_98.0=1 +phy_an_fec_99.0=1 +phy_an_fec_102.0=1 +phy_an_fec_103.0=1 +phy_an_fec_104.0=1 +phy_an_fec_105.0=1 +phy_an_fec_106.0=1 +phy_an_fec_107.0=1 +phy_an_fec_108.0=1 +phy_an_fec_109.0=1 +phy_an_fec_110.0=1 +phy_an_fec_111.0=1 +phy_an_fec_112.0=1 +phy_an_fec_113.0=1 +phy_an_fec_114.0=1 +phy_an_fec_115.0=1 +phy_an_fec_116.0=1 +phy_an_fec_117.0=1 +phy_an_fec_118.0=1 +phy_an_fec_119.0=1 +phy_an_fec_120.0=1 +phy_an_fec_121.0=1 +phy_an_fec_122.0=1 +phy_an_fec_123.0=1 +phy_an_fec_124.0=1 +phy_an_fec_125.0=1 +phy_an_fec_126.0=1 +phy_an_fec_127.0=1 +phy_an_fec_128.0=1 +phy_an_fec_129.0=1 +phy_an_fec_130.0=1 +phy_an_fec_131.0=1 +phy_an_fec_132.0=1 +phy_an_fec_133.0=1 +phy_xaui_rx_polarity_flip_1.0=0x1 +phy_xaui_rx_polarity_flip_2.0=0x5 +phy_xaui_rx_polarity_flip_3.0=0x1 +phy_xaui_rx_polarity_flip_4.0=0x7 +phy_xaui_rx_polarity_flip_5.0=0xc +phy_xaui_rx_polarity_flip_6.0=0xf +phy_xaui_rx_polarity_flip_7.0=0xc +phy_xaui_rx_polarity_flip_8.0=0xf +phy_xaui_rx_polarity_flip_34.0=0x0 +phy_xaui_rx_polarity_flip_35.0=0x7 +phy_xaui_rx_polarity_flip_36.0=0x4 +phy_xaui_rx_polarity_flip_37.0=0x7 +phy_xaui_rx_polarity_flip_38.0=0x4 +phy_xaui_rx_polarity_flip_39.0=0x6 +phy_xaui_rx_polarity_flip_40.0=0x1 +phy_xaui_rx_polarity_flip_41.0=0x2 +phy_xaui_rx_polarity_flip_68.0=0xd +phy_xaui_rx_polarity_flip_69.0=0x6 +phy_xaui_rx_polarity_flip_70.0=0x1 +phy_xaui_rx_polarity_flip_71.0=0x8 +phy_xaui_rx_polarity_flip_72.0=0x7 +phy_xaui_rx_polarity_flip_73.0=0xc +phy_xaui_rx_polarity_flip_74.0=0x7 +phy_xaui_rx_polarity_flip_75.0=0x8 +phy_xaui_rx_polarity_flip_102.0=0xb +phy_xaui_rx_polarity_flip_103.0=0xc +phy_xaui_rx_polarity_flip_104.0=0x3 +phy_xaui_rx_polarity_flip_105.0=0xc +phy_xaui_rx_polarity_flip_106.0=0xb +phy_xaui_rx_polarity_flip_107.0=0x5 +phy_xaui_rx_polarity_flip_108.0=0x1 +phy_xaui_rx_polarity_flip_109.0=0x9 +phy_xaui_tx_polarity_flip_1.0=0x0 +phy_xaui_tx_polarity_flip_2.0=0xe +phy_xaui_tx_polarity_flip_3.0=0x2 +phy_xaui_tx_polarity_flip_4.0=0xe +phy_xaui_tx_polarity_flip_5.0=0xc +phy_xaui_tx_polarity_flip_6.0=0xf +phy_xaui_tx_polarity_flip_7.0=0xc +phy_xaui_tx_polarity_flip_8.0=0xf +phy_xaui_tx_polarity_flip_34.0=0x0 +phy_xaui_tx_polarity_flip_35.0=0xe +phy_xaui_tx_polarity_flip_36.0=0x0 +phy_xaui_tx_polarity_flip_37.0=0xe +phy_xaui_tx_polarity_flip_38.0=0xf +phy_xaui_tx_polarity_flip_39.0=0xe +phy_xaui_tx_polarity_flip_40.0=0x6 +phy_xaui_tx_polarity_flip_41.0=0xb +phy_xaui_tx_polarity_flip_68.0=0x9 +phy_xaui_tx_polarity_flip_69.0=0xb +phy_xaui_tx_polarity_flip_70.0=0xd +phy_xaui_tx_polarity_flip_71.0=0x9 +phy_xaui_tx_polarity_flip_72.0=0x6 +phy_xaui_tx_polarity_flip_73.0=0xc +phy_xaui_tx_polarity_flip_74.0=0x9 +phy_xaui_tx_polarity_flip_75.0=0x9 +phy_xaui_tx_polarity_flip_102.0=0x6 +phy_xaui_tx_polarity_flip_103.0=0xb +phy_xaui_tx_polarity_flip_104.0=0x6 +phy_xaui_tx_polarity_flip_105.0=0xb +phy_xaui_tx_polarity_flip_106.0=0x6 +phy_xaui_tx_polarity_flip_107.0=0xf +phy_xaui_tx_polarity_flip_108.0=0x6 +phy_xaui_tx_polarity_flip_109.0=0xc +portmap_1.0=1:40 +portmap_2.0=5:40 +portmap_3.0=9:40 +portmap_4.0=13:40 +portmap_5.0=17:40 +portmap_6.0=21:40 +portmap_7.0=25:40 +portmap_8.0=29:40 +portmap_34.0=33:40 +portmap_35.0=37:40 +portmap_36.0=41:40 +portmap_37.0=45:40 +portmap_38.0=49:40 +portmap_39.0=53:40 +portmap_40.0=57:40 +portmap_41.0=61:40 +portmap_68.0=65:40 +portmap_69.0=69:40 +portmap_70.0=73:40 +portmap_71.0=77:40 +portmap_72.0=81:40 +portmap_73.0=85:40 +portmap_74.0=89:40 +portmap_75.0=93:40 +portmap_102.0=97:40 +portmap_103.0=101:40 +portmap_104.0=105:40 +portmap_105.0=109:40 +portmap_106.0=113:40 +portmap_107.0=117:40 +portmap_108.0=121:40 +portmap_109.0=125:40 +port_phy_addr_1.0=0xff +port_phy_addr_2.0=0xff +port_phy_addr_3.0=0xff +port_phy_addr_4.0=0xff +port_phy_addr_5.0=0xff +port_phy_addr_6.0=0xff +port_phy_addr_7.0=0xff +port_phy_addr_8.0=0xff +port_phy_addr_34.0=0xff +port_phy_addr_35.0=0xff +port_phy_addr_36.0=0xff +port_phy_addr_37.0=0xff +port_phy_addr_38.0=0xff +port_phy_addr_39.0=0xff +port_phy_addr_40.0=0xff +port_phy_addr_41.0=0xff +port_phy_addr_68.0=0xff +port_phy_addr_69.0=0xff +port_phy_addr_70.0=0xff +port_phy_addr_71.0=0xff +port_phy_addr_72.0=0xff +port_phy_addr_73.0=0xff +port_phy_addr_74.0=0xff +port_phy_addr_75.0=0xff +port_phy_addr_102.0=0xff +port_phy_addr_103.0=0xff +port_phy_addr_104.0=0xff +port_phy_addr_105.0=0xff +port_phy_addr_106.0=0xff +port_phy_addr_107.0=0xff +port_phy_addr_108.0=0xff +port_phy_addr_109.0=0xff +xgxs_rx_lane_map_1.0=0x3210 +xgxs_rx_lane_map_2.0=0x3210 +xgxs_rx_lane_map_3.0=0x3210 +xgxs_rx_lane_map_4.0=0x3210 +xgxs_rx_lane_map_5.0=0x0123 +xgxs_rx_lane_map_6.0=0x2301 +xgxs_rx_lane_map_7.0=0x0123 +xgxs_rx_lane_map_8.0=0x2301 +xgxs_rx_lane_map_34.0=0x0123 +xgxs_rx_lane_map_35.0=0x0321 +xgxs_rx_lane_map_36.0=0x0321 +xgxs_rx_lane_map_37.0=0x0321 +xgxs_rx_lane_map_38.0=0x1230 +xgxs_rx_lane_map_39.0=0x2301 +xgxs_rx_lane_map_40.0=0x1230 +xgxs_rx_lane_map_41.0=0x2103 +xgxs_rx_lane_map_68.0=0x1230 +xgxs_rx_lane_map_69.0=0x2301 +xgxs_rx_lane_map_70.0=0x1230 +xgxs_rx_lane_map_71.0=0x2103 +xgxs_rx_lane_map_72.0=0x1230 +xgxs_rx_lane_map_73.0=0x2301 +xgxs_rx_lane_map_74.0=0x1230 +xgxs_rx_lane_map_75.0=0x2103 +xgxs_rx_lane_map_102.0=0x3210 +xgxs_rx_lane_map_103.0=0x3210 +xgxs_rx_lane_map_104.0=0x3210 +xgxs_rx_lane_map_105.0=0x3210 +xgxs_rx_lane_map_106.0=0x3210 +xgxs_rx_lane_map_107.0=0x3210 +xgxs_rx_lane_map_108.0=0x3210 +xgxs_rx_lane_map_109.0=0x3210 +xgxs_tx_lane_map_1.0=0x0321 +xgxs_tx_lane_map_2.0=0x2301 +xgxs_tx_lane_map_3.0=0x0321 +xgxs_tx_lane_map_4.0=0x2301 +xgxs_tx_lane_map_5.0=0x0123 +xgxs_tx_lane_map_6.0=0x0123 +xgxs_tx_lane_map_7.0=0x0123 +xgxs_tx_lane_map_8.0=0x0123 +xgxs_tx_lane_map_34.0=0x2301 +xgxs_tx_lane_map_35.0=0x0321 +xgxs_tx_lane_map_36.0=0x2301 +xgxs_tx_lane_map_37.0=0x0321 +xgxs_tx_lane_map_38.0=0x0123 +xgxs_tx_lane_map_39.0=0x1230 +xgxs_tx_lane_map_40.0=0x2301 +xgxs_tx_lane_map_41.0=0x1032 +xgxs_tx_lane_map_68.0=0x0123 +xgxs_tx_lane_map_69.0=0x1230 +xgxs_tx_lane_map_70.0=0x2301 +xgxs_tx_lane_map_71.0=0x1032 +xgxs_tx_lane_map_72.0=0x0123 +xgxs_tx_lane_map_73.0=0x1230 +xgxs_tx_lane_map_74.0=0x2301 +xgxs_tx_lane_map_75.0=0x1032 +xgxs_tx_lane_map_102.0=0x0321 +xgxs_tx_lane_map_103.0=0x2301 +xgxs_tx_lane_map_104.0=0x0321 +xgxs_tx_lane_map_105.0=0x2301 +xgxs_tx_lane_map_106.0=0x0321 +xgxs_tx_lane_map_107.0=0x2301 +xgxs_tx_lane_map_108.0=0x0321 +xgxs_tx_lane_map_109.0=0x2301 +serdes_driver_current_1=0x4 +serdes_preemphasis_1=0x145c00 +serdes_driver_current_2=0x4 +serdes_preemphasis_2=0x145c00 +serdes_driver_current_3=0x8 +serdes_preemphasis_3=0x185800 +serdes_driver_current_4=0x8 +serdes_preemphasis_4=0x185800 +serdes_driver_current_5=0x8 +serdes_preemphasis_5=0x185800 +serdes_driver_current_6=0x8 +serdes_preemphasis_6=0x185800 +serdes_driver_current_7=0xf +serdes_preemphasis_7=0x205000 +serdes_driver_current_8=0xf +serdes_preemphasis_8=0x205000 +serdes_driver_current_34=0xf +serdes_preemphasis_34=0x205000 +serdes_driver_current_35=0xf +serdes_preemphasis_35=0x205000 +serdes_driver_current_36=0xf +serdes_preemphasis_36=0x205000 +serdes_driver_current_37=0xf +serdes_preemphasis_37=0x205000 +serdes_driver_current_38=0x8 +serdes_preemphasis_38=0x185800 +serdes_driver_current_39=0x8 +serdes_preemphasis_39=0x185800 +serdes_driver_current_40=0x8 +serdes_preemphasis_40=0x185800 +serdes_driver_current_41=0x8 +serdes_preemphasis_41=0x185800 +serdes_driver_current_68=0x4 +serdes_preemphasis_68=0x145c00 +serdes_driver_current_69=0x4 +serdes_preemphasis_69=0x145c00 +serdes_driver_current_70=0x4 +serdes_preemphasis_70=0x145c00 +serdes_driver_current_71=0x4 +serdes_preemphasis_71=0x145c00 +serdes_driver_current_72=0x4 +serdes_preemphasis_72=0x145c00 +serdes_driver_current_73=0x4 +serdes_preemphasis_73=0x145c00 +serdes_driver_current_74=0x4 +serdes_preemphasis_74=0x145c00 +serdes_driver_current_75=0x4 +serdes_preemphasis_75=0x145c00 +serdes_driver_current_102=0x4 +serdes_preemphasis_102=0x145c00 +serdes_driver_current_103=0x4 +serdes_preemphasis_103=0x145c00 +serdes_driver_current_104=0x4 +serdes_preemphasis_104=0x145c00 +serdes_driver_current_105=0x4 +serdes_preemphasis_105=0x145c00 +serdes_driver_current_106=0x4 +serdes_preemphasis_106=0x145c00 +serdes_driver_current_107=0x4 +serdes_preemphasis_107=0x145c00 +serdes_driver_current_108=0x4 +serdes_preemphasis_108=0x145c00 +serdes_driver_current_109=0x4 +serdes_preemphasis_109=0x145c00 + +mmu_init_config="MSFT-TH-Tier0" diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t1.config.bcm b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t1.config.bcm new file mode 100644 index 000000000000..c3218645ac2d --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t1.config.bcm @@ -0,0 +1,444 @@ +# Arista 7060CX-32S + +phy_an_allow_pll_change=1 +arl_clean_timeout_usec=15000000 +asf_mem_profile=2 +bcm_num_cos=8 +bcm_stat_flags=1 +bcm_stat_jumbo=9236 +cdma_timeout_usec=15000000 +dma_desc_timeout_usec=15000000 +higig2_hdr_mode=1 +ipv6_lpm_128b_enable=1 +l3_alpm_enable=2 +lpm_scaling_enable=0 +l2xmsg_mode=1 +max_vp_lags=0 +miim_intr_enable=0 +module_64ports=1 +os=unix +oversubscribe_mode=1 +ptp_bs_fref.0=25000000 +ptp_ts_pll_fref.0=25000000 +robust_hash_disable_egress_vlan.0=1 +robust_hash_disable_mpls.0=1 +robust_hash_disable_vlan.0=1 +tdma_timeout_usec.0=15000000 +tslam_timeout_usec.0=15000000 +pbmp_xport_xe.0=0x7ffffffffffffffffffffffffffffffffe +phy_an_allow_pll_change_hg.0=0 +phy_an_c73_1.0=1 +phy_an_c73_2.0=1 +phy_an_c73_3.0=1 +phy_an_c73_4.0=1 +phy_an_c73_5.0=1 +phy_an_c73_6.0=1 +phy_an_c73_7.0=1 +phy_an_c73_8.0=1 +phy_an_c73_34.0=1 +phy_an_c73_35.0=1 +phy_an_c73_36.0=1 +phy_an_c73_37.0=1 +phy_an_c73_38.0=1 +phy_an_c73_39.0=1 +phy_an_c73_40.0=1 +phy_an_c73_41.0=1 +phy_an_c73_68.0=1 +phy_an_c73_69.0=1 +phy_an_c73_70.0=1 +phy_an_c73_71.0=1 +phy_an_c73_72.0=1 +phy_an_c73_73.0=1 +phy_an_c73_74.0=1 +phy_an_c73_75.0=1 +phy_an_c73_102.0=1 +phy_an_c73_103.0=1 +phy_an_c73_104.0=1 +phy_an_c73_105.0=1 +phy_an_c73_106.0=1 +phy_an_c73_107.0=1 +phy_an_c73_108.0=1 +phy_an_c73_109.0=1 +phy_an_fec_1.0=1 +phy_an_fec_2.0=1 +phy_an_fec_3.0=1 +phy_an_fec_4.0=1 +phy_an_fec_5.0=1 +phy_an_fec_6.0=1 +phy_an_fec_7.0=1 +phy_an_fec_8.0=1 +phy_an_fec_9.0=1 +phy_an_fec_10.0=1 +phy_an_fec_11.0=1 +phy_an_fec_12.0=1 +phy_an_fec_13.0=1 +phy_an_fec_14.0=1 +phy_an_fec_15.0=1 +phy_an_fec_16.0=1 +phy_an_fec_17.0=1 +phy_an_fec_18.0=1 +phy_an_fec_19.0=1 +phy_an_fec_20.0=1 +phy_an_fec_21.0=1 +phy_an_fec_22.0=1 +phy_an_fec_23.0=1 +phy_an_fec_24.0=1 +phy_an_fec_25.0=1 +phy_an_fec_26.0=1 +phy_an_fec_27.0=1 +phy_an_fec_28.0=1 +phy_an_fec_29.0=1 +phy_an_fec_30.0=1 +phy_an_fec_31.0=1 +phy_an_fec_32.0=1 +phy_an_fec_34.0=1 +phy_an_fec_38.0=1 +phy_an_fec_39.0=1 +phy_an_fec_40.0=1 +phy_an_fec_41.0=1 +phy_an_fec_42.0=1 +phy_an_fec_43.0=1 +phy_an_fec_44.0=1 +phy_an_fec_45.0=1 +phy_an_fec_46.0=1 +phy_an_fec_47.0=1 +phy_an_fec_48.0=1 +phy_an_fec_49.0=1 +phy_an_fec_50.0=1 +phy_an_fec_51.0=1 +phy_an_fec_52.0=1 +phy_an_fec_53.0=1 +phy_an_fec_54.0=1 +phy_an_fec_55.0=1 +phy_an_fec_56.0=1 +phy_an_fec_57.0=1 +phy_an_fec_58.0=1 +phy_an_fec_59.0=1 +phy_an_fec_60.0=1 +phy_an_fec_61.0=1 +phy_an_fec_62.0=1 +phy_an_fec_63.0=1 +phy_an_fec_64.0=1 +phy_an_fec_65.0=1 +phy_an_fec_68.0=1 +phy_an_fec_69.0=1 +phy_an_fec_70.0=1 +phy_an_fec_71.0=1 +phy_an_fec_72.0=1 +phy_an_fec_73.0=1 +phy_an_fec_74.0=1 +phy_an_fec_75.0=1 +phy_an_fec_76.0=1 +phy_an_fec_77.0=1 +phy_an_fec_78.0=1 +phy_an_fec_79.0=1 +phy_an_fec_80.0=1 +phy_an_fec_81.0=1 +phy_an_fec_82.0=1 +phy_an_fec_83.0=1 +phy_an_fec_84.0=1 +phy_an_fec_85.0=1 +phy_an_fec_86.0=1 +phy_an_fec_87.0=1 +phy_an_fec_88.0=1 +phy_an_fec_89.0=1 +phy_an_fec_90.0=1 +phy_an_fec_91.0=1 +phy_an_fec_92.0=1 +phy_an_fec_93.0=1 +phy_an_fec_94.0=1 +phy_an_fec_95.0=1 +phy_an_fec_96.0=1 +phy_an_fec_97.0=1 +phy_an_fec_98.0=1 +phy_an_fec_99.0=1 +phy_an_fec_102.0=1 +phy_an_fec_103.0=1 +phy_an_fec_104.0=1 +phy_an_fec_105.0=1 +phy_an_fec_106.0=1 +phy_an_fec_107.0=1 +phy_an_fec_108.0=1 +phy_an_fec_109.0=1 +phy_an_fec_110.0=1 +phy_an_fec_111.0=1 +phy_an_fec_112.0=1 +phy_an_fec_113.0=1 +phy_an_fec_114.0=1 +phy_an_fec_115.0=1 +phy_an_fec_116.0=1 +phy_an_fec_117.0=1 +phy_an_fec_118.0=1 +phy_an_fec_119.0=1 +phy_an_fec_120.0=1 +phy_an_fec_121.0=1 +phy_an_fec_122.0=1 +phy_an_fec_123.0=1 +phy_an_fec_124.0=1 +phy_an_fec_125.0=1 +phy_an_fec_126.0=1 +phy_an_fec_127.0=1 +phy_an_fec_128.0=1 +phy_an_fec_129.0=1 +phy_an_fec_130.0=1 +phy_an_fec_131.0=1 +phy_an_fec_132.0=1 +phy_an_fec_133.0=1 +phy_xaui_rx_polarity_flip_1.0=0x1 +phy_xaui_rx_polarity_flip_2.0=0x5 +phy_xaui_rx_polarity_flip_3.0=0x1 +phy_xaui_rx_polarity_flip_4.0=0x7 +phy_xaui_rx_polarity_flip_5.0=0xc +phy_xaui_rx_polarity_flip_6.0=0xf +phy_xaui_rx_polarity_flip_7.0=0xc +phy_xaui_rx_polarity_flip_8.0=0xf +phy_xaui_rx_polarity_flip_34.0=0x0 +phy_xaui_rx_polarity_flip_35.0=0x7 +phy_xaui_rx_polarity_flip_36.0=0x4 +phy_xaui_rx_polarity_flip_37.0=0x7 +phy_xaui_rx_polarity_flip_38.0=0x4 +phy_xaui_rx_polarity_flip_39.0=0x6 +phy_xaui_rx_polarity_flip_40.0=0x1 +phy_xaui_rx_polarity_flip_41.0=0x2 +phy_xaui_rx_polarity_flip_68.0=0xd +phy_xaui_rx_polarity_flip_69.0=0x6 +phy_xaui_rx_polarity_flip_70.0=0x1 +phy_xaui_rx_polarity_flip_71.0=0x8 +phy_xaui_rx_polarity_flip_72.0=0x7 +phy_xaui_rx_polarity_flip_73.0=0xc +phy_xaui_rx_polarity_flip_74.0=0x7 +phy_xaui_rx_polarity_flip_75.0=0x8 +phy_xaui_rx_polarity_flip_102.0=0xb +phy_xaui_rx_polarity_flip_103.0=0xc +phy_xaui_rx_polarity_flip_104.0=0x3 +phy_xaui_rx_polarity_flip_105.0=0xc +phy_xaui_rx_polarity_flip_106.0=0xb +phy_xaui_rx_polarity_flip_107.0=0x5 +phy_xaui_rx_polarity_flip_108.0=0x1 +phy_xaui_rx_polarity_flip_109.0=0x9 +phy_xaui_tx_polarity_flip_1.0=0x0 +phy_xaui_tx_polarity_flip_2.0=0xe +phy_xaui_tx_polarity_flip_3.0=0x2 +phy_xaui_tx_polarity_flip_4.0=0xe +phy_xaui_tx_polarity_flip_5.0=0xc +phy_xaui_tx_polarity_flip_6.0=0xf +phy_xaui_tx_polarity_flip_7.0=0xc +phy_xaui_tx_polarity_flip_8.0=0xf +phy_xaui_tx_polarity_flip_34.0=0x0 +phy_xaui_tx_polarity_flip_35.0=0xe +phy_xaui_tx_polarity_flip_36.0=0x0 +phy_xaui_tx_polarity_flip_37.0=0xe +phy_xaui_tx_polarity_flip_38.0=0xf +phy_xaui_tx_polarity_flip_39.0=0xe +phy_xaui_tx_polarity_flip_40.0=0x6 +phy_xaui_tx_polarity_flip_41.0=0xb +phy_xaui_tx_polarity_flip_68.0=0x9 +phy_xaui_tx_polarity_flip_69.0=0xb +phy_xaui_tx_polarity_flip_70.0=0xd +phy_xaui_tx_polarity_flip_71.0=0x9 +phy_xaui_tx_polarity_flip_72.0=0x6 +phy_xaui_tx_polarity_flip_73.0=0xc +phy_xaui_tx_polarity_flip_74.0=0x9 +phy_xaui_tx_polarity_flip_75.0=0x9 +phy_xaui_tx_polarity_flip_102.0=0x6 +phy_xaui_tx_polarity_flip_103.0=0xb +phy_xaui_tx_polarity_flip_104.0=0x6 +phy_xaui_tx_polarity_flip_105.0=0xb +phy_xaui_tx_polarity_flip_106.0=0x6 +phy_xaui_tx_polarity_flip_107.0=0xf +phy_xaui_tx_polarity_flip_108.0=0x6 +phy_xaui_tx_polarity_flip_109.0=0xc +portmap_1.0=1:40 +portmap_2.0=5:40 +portmap_3.0=9:40 +portmap_4.0=13:40 +portmap_5.0=17:40 +portmap_6.0=21:40 +portmap_7.0=25:40 +portmap_8.0=29:40 +portmap_34.0=33:40 +portmap_35.0=37:40 +portmap_36.0=41:40 +portmap_37.0=45:40 +portmap_38.0=49:40 +portmap_39.0=53:40 +portmap_40.0=57:40 +portmap_41.0=61:40 +portmap_68.0=65:40 +portmap_69.0=69:40 +portmap_70.0=73:40 +portmap_71.0=77:40 +portmap_72.0=81:40 +portmap_73.0=85:40 +portmap_74.0=89:40 +portmap_75.0=93:40 +portmap_102.0=97:40 +portmap_103.0=101:40 +portmap_104.0=105:40 +portmap_105.0=109:40 +portmap_106.0=113:40 +portmap_107.0=117:40 +portmap_108.0=121:40 +portmap_109.0=125:40 +port_phy_addr_1.0=0xff +port_phy_addr_2.0=0xff +port_phy_addr_3.0=0xff +port_phy_addr_4.0=0xff +port_phy_addr_5.0=0xff +port_phy_addr_6.0=0xff +port_phy_addr_7.0=0xff +port_phy_addr_8.0=0xff +port_phy_addr_34.0=0xff +port_phy_addr_35.0=0xff +port_phy_addr_36.0=0xff +port_phy_addr_37.0=0xff +port_phy_addr_38.0=0xff +port_phy_addr_39.0=0xff +port_phy_addr_40.0=0xff +port_phy_addr_41.0=0xff +port_phy_addr_68.0=0xff +port_phy_addr_69.0=0xff +port_phy_addr_70.0=0xff +port_phy_addr_71.0=0xff +port_phy_addr_72.0=0xff +port_phy_addr_73.0=0xff +port_phy_addr_74.0=0xff +port_phy_addr_75.0=0xff +port_phy_addr_102.0=0xff +port_phy_addr_103.0=0xff +port_phy_addr_104.0=0xff +port_phy_addr_105.0=0xff +port_phy_addr_106.0=0xff +port_phy_addr_107.0=0xff +port_phy_addr_108.0=0xff +port_phy_addr_109.0=0xff +xgxs_rx_lane_map_1.0=0x3210 +xgxs_rx_lane_map_2.0=0x3210 +xgxs_rx_lane_map_3.0=0x3210 +xgxs_rx_lane_map_4.0=0x3210 +xgxs_rx_lane_map_5.0=0x0123 +xgxs_rx_lane_map_6.0=0x2301 +xgxs_rx_lane_map_7.0=0x0123 +xgxs_rx_lane_map_8.0=0x2301 +xgxs_rx_lane_map_34.0=0x0123 +xgxs_rx_lane_map_35.0=0x0321 +xgxs_rx_lane_map_36.0=0x0321 +xgxs_rx_lane_map_37.0=0x0321 +xgxs_rx_lane_map_38.0=0x1230 +xgxs_rx_lane_map_39.0=0x2301 +xgxs_rx_lane_map_40.0=0x1230 +xgxs_rx_lane_map_41.0=0x2103 +xgxs_rx_lane_map_68.0=0x1230 +xgxs_rx_lane_map_69.0=0x2301 +xgxs_rx_lane_map_70.0=0x1230 +xgxs_rx_lane_map_71.0=0x2103 +xgxs_rx_lane_map_72.0=0x1230 +xgxs_rx_lane_map_73.0=0x2301 +xgxs_rx_lane_map_74.0=0x1230 +xgxs_rx_lane_map_75.0=0x2103 +xgxs_rx_lane_map_102.0=0x3210 +xgxs_rx_lane_map_103.0=0x3210 +xgxs_rx_lane_map_104.0=0x3210 +xgxs_rx_lane_map_105.0=0x3210 +xgxs_rx_lane_map_106.0=0x3210 +xgxs_rx_lane_map_107.0=0x3210 +xgxs_rx_lane_map_108.0=0x3210 +xgxs_rx_lane_map_109.0=0x3210 +xgxs_tx_lane_map_1.0=0x0321 +xgxs_tx_lane_map_2.0=0x2301 +xgxs_tx_lane_map_3.0=0x0321 +xgxs_tx_lane_map_4.0=0x2301 +xgxs_tx_lane_map_5.0=0x0123 +xgxs_tx_lane_map_6.0=0x0123 +xgxs_tx_lane_map_7.0=0x0123 +xgxs_tx_lane_map_8.0=0x0123 +xgxs_tx_lane_map_34.0=0x2301 +xgxs_tx_lane_map_35.0=0x0321 +xgxs_tx_lane_map_36.0=0x2301 +xgxs_tx_lane_map_37.0=0x0321 +xgxs_tx_lane_map_38.0=0x0123 +xgxs_tx_lane_map_39.0=0x1230 +xgxs_tx_lane_map_40.0=0x2301 +xgxs_tx_lane_map_41.0=0x1032 +xgxs_tx_lane_map_68.0=0x0123 +xgxs_tx_lane_map_69.0=0x1230 +xgxs_tx_lane_map_70.0=0x2301 +xgxs_tx_lane_map_71.0=0x1032 +xgxs_tx_lane_map_72.0=0x0123 +xgxs_tx_lane_map_73.0=0x1230 +xgxs_tx_lane_map_74.0=0x2301 +xgxs_tx_lane_map_75.0=0x1032 +xgxs_tx_lane_map_102.0=0x0321 +xgxs_tx_lane_map_103.0=0x2301 +xgxs_tx_lane_map_104.0=0x0321 +xgxs_tx_lane_map_105.0=0x2301 +xgxs_tx_lane_map_106.0=0x0321 +xgxs_tx_lane_map_107.0=0x2301 +xgxs_tx_lane_map_108.0=0x0321 +xgxs_tx_lane_map_109.0=0x2301 +serdes_driver_current_1=0x4 +serdes_preemphasis_1=0x145c00 +serdes_driver_current_2=0x4 +serdes_preemphasis_2=0x145c00 +serdes_driver_current_3=0x8 +serdes_preemphasis_3=0x185800 +serdes_driver_current_4=0x8 +serdes_preemphasis_4=0x185800 +serdes_driver_current_5=0x8 +serdes_preemphasis_5=0x185800 +serdes_driver_current_6=0x8 +serdes_preemphasis_6=0x185800 +serdes_driver_current_7=0xf +serdes_preemphasis_7=0x205000 +serdes_driver_current_8=0xf +serdes_preemphasis_8=0x205000 +serdes_driver_current_34=0xf +serdes_preemphasis_34=0x205000 +serdes_driver_current_35=0xf +serdes_preemphasis_35=0x205000 +serdes_driver_current_36=0xf +serdes_preemphasis_36=0x205000 +serdes_driver_current_37=0xf +serdes_preemphasis_37=0x205000 +serdes_driver_current_38=0x8 +serdes_preemphasis_38=0x185800 +serdes_driver_current_39=0x8 +serdes_preemphasis_39=0x185800 +serdes_driver_current_40=0x8 +serdes_preemphasis_40=0x185800 +serdes_driver_current_41=0x8 +serdes_preemphasis_41=0x185800 +serdes_driver_current_68=0x4 +serdes_preemphasis_68=0x145c00 +serdes_driver_current_69=0x4 +serdes_preemphasis_69=0x145c00 +serdes_driver_current_70=0x4 +serdes_preemphasis_70=0x145c00 +serdes_driver_current_71=0x4 +serdes_preemphasis_71=0x145c00 +serdes_driver_current_72=0x4 +serdes_preemphasis_72=0x145c00 +serdes_driver_current_73=0x4 +serdes_preemphasis_73=0x145c00 +serdes_driver_current_74=0x4 +serdes_preemphasis_74=0x145c00 +serdes_driver_current_75=0x4 +serdes_preemphasis_75=0x145c00 +serdes_driver_current_102=0x4 +serdes_preemphasis_102=0x145c00 +serdes_driver_current_103=0x4 +serdes_preemphasis_103=0x145c00 +serdes_driver_current_104=0x4 +serdes_preemphasis_104=0x145c00 +serdes_driver_current_105=0x4 +serdes_preemphasis_105=0x145c00 +serdes_driver_current_106=0x4 +serdes_preemphasis_106=0x145c00 +serdes_driver_current_107=0x4 +serdes_preemphasis_107=0x145c00 +serdes_driver_current_108=0x4 +serdes_preemphasis_108=0x145c00 +serdes_driver_current_109=0x4 +serdes_preemphasis_109=0x145c00 + +mmu_init_config="MSFT-TH-Tier1" From ff237aaf180981bf9b9d13d6bc180767a84fc6a5 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 29 Jun 2018 08:37:20 -0700 Subject: [PATCH 257/274] [syncd] Treat bcmcmd as a supervisor task so we could collect stdout/stderr (#1825) --- platform/broadcom/docker-syncd-brcm/start.sh | 3 ++- platform/broadcom/docker-syncd-brcm/supervisord.conf | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/platform/broadcom/docker-syncd-brcm/start.sh b/platform/broadcom/docker-syncd-brcm/start.sh index d2180bce1ed7..4f027256a022 100755 --- a/platform/broadcom/docker-syncd-brcm/start.sh +++ b/platform/broadcom/docker-syncd-brcm/start.sh @@ -18,6 +18,7 @@ else fi fi +rm -f /var/run/sswsyncd/sswsyncd.socket supervisorctl start syncd # Function: wait until syncd has created the socket for bcmcmd to connect to @@ -33,5 +34,5 @@ wait_syncd() { # If this platform has an initialization file for the Broadcom LED microprocessor, load it if [ -r ${PLATFORM_DIR}/led_proc_init.soc ]; then wait_syncd - /usr/bin/bcmcmd -t 60 "rcload ${PLATFORM_DIR}/led_proc_init.soc" + supervisorctl start ledinit fi diff --git a/platform/broadcom/docker-syncd-brcm/supervisord.conf b/platform/broadcom/docker-syncd-brcm/supervisord.conf index 1af5d70a1d0c..fe590ede18c5 100644 --- a/platform/broadcom/docker-syncd-brcm/supervisord.conf +++ b/platform/broadcom/docker-syncd-brcm/supervisord.conf @@ -26,3 +26,11 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog + +[program:ledinit] +command=/usr/bin/bcmcmd -t 60 "rcload /usr/share/sonic/platform/led_proc_init.soc" +priority=4 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog From 5ad7d24d168dfe12d55a14e1d3280217c3fd9b43 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 29 Jun 2018 08:39:12 -0700 Subject: [PATCH 258/274] [mgmt] Fix pycparser installation (#1820) --- dockers/docker-sonic-mgmt/Dockerfile.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index 9396c7e56c0c..cd2fd5ff37dd 100644 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -30,6 +30,8 @@ RUN apt-get install -y rsyslog psmisc # Remove cffi 1.5.2, will install 1.10.0 by pip later RUN apt-get remove -y python-cffi python-cffi-backend +# Remove pycparser 2.14, will install >=2.17 by pip later +RUN apt-get remove -y python-ply python-pycparser RUN easy_install pip From 043435958cb5e23fc6b59c33e9adf45a824b563e Mon Sep 17 00:00:00 2001 From: Polly Hsu Date: Sat, 30 Jun 2018 00:40:43 +0800 Subject: [PATCH 259/274] [device]: Add a new supported device AS7312-54XS (#1821) * Switch Vendor: Edge-core * Switch SKU: AS7312-54XS * ASIC Vendor: Broadcom * Swich ASIC: Tomahawk+ * Port Configuration: 48x25G + 6x100G * SONiC Image: SONiC-ONIE-Broadcom Signed-off-by: polly_hsu@edge-core.com --- .../Accton-AS7312-54XS/port_config.ini | 55 + .../Accton-AS7312-54XS/sai.profile | 1 + .../th-as7312-48x25G+6x100G.config.bcm | 519 ++++++++ .../installer.conf | 3 + .../led_proc_init.soc | 79 ++ .../minigraph.xml | 1184 +++++++++++++++++ .../plugins/eeprom.py | 24 + .../plugins/psuutil.py | 61 + .../plugins/sfputil.py | 215 +++ 9 files changed, 2141 insertions(+) create mode 100755 device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/port_config.ini create mode 100644 device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/sai.profile create mode 100644 device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/th-as7312-48x25G+6x100G.config.bcm create mode 100644 device/accton/x86_64-accton_as7312_54xs-r0/installer.conf create mode 100755 device/accton/x86_64-accton_as7312_54xs-r0/led_proc_init.soc create mode 100644 device/accton/x86_64-accton_as7312_54xs-r0/minigraph.xml create mode 100644 device/accton/x86_64-accton_as7312_54xs-r0/plugins/eeprom.py create mode 100644 device/accton/x86_64-accton_as7312_54xs-r0/plugins/psuutil.py create mode 100644 device/accton/x86_64-accton_as7312_54xs-r0/plugins/sfputil.py diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/port_config.ini b/device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/port_config.ini new file mode 100755 index 000000000000..18b0ed20d305 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/port_config.ini @@ -0,0 +1,55 @@ +# name lanes alias index +Ethernet0 41 twentyfiveGigE1 0 +Ethernet1 42 twentyfiveGigE2 1 +Ethernet2 43 twentyfiveGigE3 2 +Ethernet3 44 twentyfiveGigE4 3 +Ethernet4 49 twentyfiveGigE5 4 +Ethernet5 50 twentyfiveGigE6 5 +Ethernet6 51 twentyfiveGigE7 6 +Ethernet7 52 twentyfiveGigE8 7 +Ethernet8 53 twentyfiveGigE9 8 +Ethernet9 54 twentyfiveGigE10 9 +Ethernet10 55 twentyfiveGigE11 10 +Ethernet11 56 twentyfiveGigE12 11 +Ethernet12 65 twentyfiveGigE13 12 +Ethernet13 66 twentyfiveGigE14 13 +Ethernet14 67 twentyfiveGigE15 14 +Ethernet15 68 twentyfiveGigE16 15 +Ethernet16 33 twentyfiveGigE17 16 +Ethernet17 34 twentyfiveGigE18 17 +Ethernet18 35 twentyfiveGigE19 18 +Ethernet19 36 twentyfiveGigE20 19 +Ethernet20 37 twentyfiveGigE21 20 +Ethernet21 38 twentyfiveGigE22 21 +Ethernet22 39 twentyfiveGigE23 22 +Ethernet23 40 twentyfiveGigE24 23 +Ethernet24 69 twentyfiveGigE25 24 +Ethernet25 70 twentyfiveGigE26 25 +Ethernet26 71 twentyfiveGigE27 26 +Ethernet27 72 twentyfiveGigE28 27 +Ethernet28 81 twentyfiveGigE29 28 +Ethernet29 82 twentyfiveGigE30 29 +Ethernet30 83 twentyfiveGigE31 30 +Ethernet31 84 twentyfiveGigE32 31 +Ethernet32 85 twentyfiveGigE33 32 +Ethernet33 86 twentyfiveGigE34 33 +Ethernet34 87 twentyfiveGigE35 34 +Ethernet35 88 twentyfiveGigE36 35 +Ethernet36 97 twentyfiveGigE37 36 +Ethernet37 98 twentyfiveGigE38 37 +Ethernet38 99 twentyfiveGigE39 38 +Ethernet39 100 twentyfiveGigE40 39 +Ethernet40 101 twentyfiveGigE41 40 +Ethernet41 102 twentyfiveGigE42 41 +Ethernet42 103 twentyfiveGigE43 42 +Ethernet43 104 twentyfiveGigE44 43 +Ethernet44 105 twentyfiveGigE45 44 +Ethernet45 106 twentyfiveGigE46 45 +Ethernet46 107 twentyfiveGigE47 46 +Ethernet47 108 twentyfiveGigE48 47 +Ethernet48 5,6,7,8 hundredGigE49 48 +Ethernet52 1,2,3,4 hundredGigE50 52 +Ethernet56 109,110,111,112 hundredGigE51 56 +Ethernet60 21,22,23,24 hundredGigE52 60 +Ethernet64 9,10,11,12 hundredGigE53 64 +Ethernet68 117,118,119,120 hundredGigE54 68 diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/sai.profile b/device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/sai.profile new file mode 100644 index 000000000000..31aefe2c2905 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-as7312-48x25G+6x100G.config.bcm diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/th-as7312-48x25G+6x100G.config.bcm b/device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/th-as7312-48x25G+6x100G.config.bcm new file mode 100644 index 000000000000..eef4d987e8ed --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/th-as7312-48x25G+6x100G.config.bcm @@ -0,0 +1,519 @@ +# accton_as7312_54x 48x25G+6x100G SDK config +os=unix +schan_intr_enable=0 + +l2_mem_entries=40960 +l2xmsg_mode=1 +l3_mem_entries=40960 +mem_cache_enable=0 +parity_correction=0 +parity_enable=0 +mmu_lossless=1 + +pbmp_oversubscribe=0x0407ffc00ff00ff003fc3ffc00200222 +pbmp_xport_xe=0x0407ffd00ff00ff403fc3ffc00200222 + +## FC10 ## +dport_map_port_42=1 +dport_map_port_43=2 +dport_map_port_44=3 +dport_map_port_45=4 + +## FC12 ## +dport_map_port_50=5 +dport_map_port_51=6 +dport_map_port_52=7 +dport_map_port_53=8 + +## FC13 ## +dport_map_port_54=9 +dport_map_port_55=10 +dport_map_port_56=11 +dport_map_port_57=12 + +## FC16 ## +dport_map_port_68=13 +dport_map_port_69=14 +dport_map_port_70=15 +dport_map_port_71=16 + +## FC8 ## +dport_map_port_34=17 +dport_map_port_35=18 +dport_map_port_36=19 +dport_map_port_37=20 + +## FC9 ## +dport_map_port_38=21 +dport_map_port_39=22 +dport_map_port_40=23 +dport_map_port_41=24 + +## FC17 ## +dport_map_port_72=25 +dport_map_port_73=26 +dport_map_port_74=27 +dport_map_port_75=28 + +## FC20 ## +dport_map_port_84=29 +dport_map_port_85=30 +dport_map_port_86=31 +dport_map_port_87=32 + +## FC21 ## +dport_map_port_88=33 +dport_map_port_89=34 +dport_map_port_90=35 +dport_map_port_91=36 + +## FC24 ## +dport_map_port_102=37 +dport_map_port_103=38 +dport_map_port_104=39 +dport_map_port_105=40 + +## FC25 ## +dport_map_port_106=41 +dport_map_port_107=42 +dport_map_port_108=43 +dport_map_port_109=44 + +## FC26 ## +dport_map_port_110=45 +dport_map_port_111=46 +dport_map_port_112=47 +dport_map_port_113=48 + +## FC1 ## +dport_map_port_5=49 + +## FC0 ## +dport_map_port_1=50 + +## FC27 ## +dport_map_port_114=51 + +## FC5 ## +dport_map_port_21=52 + +## FC2 ## +dport_map_port_9=53 + +## FC29 ## +dport_map_port_122=54 + +#for KR +#dport_map_port_66=55 +#dport_map_port_100=56 + +/* Port Map */ +## FC10 ## +portmap_42=41:25 +portmap_43=42:25 +portmap_44=43:25 +portmap_45=44:25 + +## FC12 ## +portmap_50=49:25 +portmap_51=50:25 +portmap_52=51:25 +portmap_53=52:25 + + +## FC13 ## +portmap_54=53:25 +portmap_55=54:25 +portmap_56=55:25 +portmap_57=56:25 + +## FC16 ## +portmap_68=65:25 +portmap_69=66:25 +portmap_70=67:25 +portmap_71=68:25 + + +## FC8 ## +portmap_34=33:25 +portmap_35=34:25 +portmap_36=35:25 +portmap_37=36:25 + +## FC9 ## +portmap_38=37:25 +portmap_39=38:25 +portmap_40=39:25 +portmap_41=40:25 + +## FC17 ## +portmap_72=69:25 +portmap_73=70:25 +portmap_74=71:25 +portmap_75=72:25 + +## FC20 ## +portmap_84=81:25 +portmap_85=82:25 +portmap_86=83:25 +portmap_87=84:25 + + +## FC21 ## +portmap_88=85:25 +portmap_89=86:25 +portmap_90=87:25 +portmap_91=88:25 + +## FC24 ## +portmap_102=97:25 +portmap_103=98:25 +portmap_104=99:25 +portmap_105=100:25 + +## FC25 ## +portmap_106=101:25 +portmap_107=102:25 +portmap_108=103:25 +portmap_109=104:25 + +## FC26 ## +portmap_110=105:25 +portmap_111=106:25 +portmap_112=107:25 +portmap_113=108:25 + +## FC1 ## +portmap_5=5:100 + +## FC0 ## +portmap_1=1:100 + +## FC27 ## +portmap_114=109:100 + +## FC5 ## +portmap_21=21:100 + +## FC2 ## +portmap_9=9:100 + +## FC29 ## +portmap_122=117:100 + +# CPU to MAC +# TSC-E management port 1 +#portmap_66=129:10 +# TSC-E management port 2 +#portmap_100=131:10 + +xgxs_rx_lane_map_42=0x2310 +xgxs_rx_lane_map_43=0x2310 +xgxs_rx_lane_map_44=0x2310 +xgxs_rx_lane_map_45=0x2310 +xgxs_rx_lane_map_50=0x3210 +xgxs_rx_lane_map_51=0x3210 +xgxs_rx_lane_map_52=0x3210 +xgxs_rx_lane_map_53=0x3210 +xgxs_rx_lane_map_54=0x3210 +xgxs_rx_lane_map_55=0x3210 +xgxs_rx_lane_map_56=0x3210 +xgxs_rx_lane_map_57=0x3210 +xgxs_rx_lane_map_68=0x0123 +xgxs_rx_lane_map_69=0x0123 +xgxs_rx_lane_map_70=0x0123 +xgxs_rx_lane_map_71=0x0123 +xgxs_rx_lane_map_34=0x0123 +xgxs_rx_lane_map_35=0x0123 +xgxs_rx_lane_map_36=0x0123 +xgxs_rx_lane_map_37=0x0123 +xgxs_rx_lane_map_38=0x0123 +xgxs_rx_lane_map_39=0x0123 +xgxs_rx_lane_map_40=0x0123 +xgxs_rx_lane_map_41=0x0123 +xgxs_rx_lane_map_72=0x3210 +xgxs_rx_lane_map_73=0x3210 +xgxs_rx_lane_map_74=0x3210 +xgxs_rx_lane_map_75=0x3210 +xgxs_rx_lane_map_84=0x1032 +xgxs_rx_lane_map_85=0x1032 +xgxs_rx_lane_map_86=0x1032 +xgxs_rx_lane_map_87=0x1032 +xgxs_rx_lane_map_88=0x2301 +xgxs_rx_lane_map_89=0x2301 +xgxs_rx_lane_map_90=0x2301 +xgxs_rx_lane_map_91=0x2301 +xgxs_rx_lane_map_102=0x0123 +xgxs_rx_lane_map_103=0x0123 +xgxs_rx_lane_map_104=0x0123 +xgxs_rx_lane_map_105=0x0123 +xgxs_rx_lane_map_106=0x3210 +xgxs_rx_lane_map_107=0x3210 +xgxs_rx_lane_map_108=0x3210 +xgxs_rx_lane_map_109=0x3210 +xgxs_rx_lane_map_110=0x1032 +xgxs_rx_lane_map_111=0x1032 +xgxs_rx_lane_map_112=0x1032 +xgxs_rx_lane_map_113=0x1032 +xgxs_rx_lane_map_5=0x3210 +xgxs_rx_lane_map_1=0x3210 +xgxs_rx_lane_map_114=0x0123 +xgxs_rx_lane_map_21=0x0213 +xgxs_rx_lane_map_9=0x3210 +xgxs_rx_lane_map_122=0x1230 + +xgxs_tx_lane_map_42=0x0132 +xgxs_tx_lane_map_43=0x0132 +xgxs_tx_lane_map_44=0x0132 +xgxs_tx_lane_map_45=0x0132 +xgxs_tx_lane_map_50=0x3210 +xgxs_tx_lane_map_51=0x3210 +xgxs_tx_lane_map_52=0x3210 +xgxs_tx_lane_map_53=0x3210 +xgxs_tx_lane_map_54=0x3210 +xgxs_tx_lane_map_55=0x3210 +xgxs_tx_lane_map_56=0x3210 +xgxs_tx_lane_map_57=0x3210 +xgxs_tx_lane_map_68=0x0123 +xgxs_tx_lane_map_69=0x0123 +xgxs_tx_lane_map_70=0x0123 +xgxs_tx_lane_map_71=0x0123 +xgxs_tx_lane_map_34=0x0123 +xgxs_tx_lane_map_35=0x0123 +xgxs_tx_lane_map_36=0x0123 +xgxs_tx_lane_map_37=0x0123 +xgxs_tx_lane_map_38=0x0123 +xgxs_tx_lane_map_39=0x0123 +xgxs_tx_lane_map_40=0x0123 +xgxs_tx_lane_map_41=0x0123 +xgxs_tx_lane_map_72=0x0123 +xgxs_tx_lane_map_73=0x0123 +xgxs_tx_lane_map_74=0x0123 +xgxs_tx_lane_map_75=0x0123 +xgxs_tx_lane_map_84=0x0123 +xgxs_tx_lane_map_85=0x0123 +xgxs_tx_lane_map_86=0x0123 +xgxs_tx_lane_map_87=0x0123 +xgxs_tx_lane_map_88=0x2301 +xgxs_tx_lane_map_89=0x2301 +xgxs_tx_lane_map_90=0x2301 +xgxs_tx_lane_map_91=0x2301 +xgxs_tx_lane_map_102=0x0123 +xgxs_tx_lane_map_103=0x0123 +xgxs_tx_lane_map_104=0x0123 +xgxs_tx_lane_map_105=0x0123 +xgxs_tx_lane_map_106=0x3210 +xgxs_tx_lane_map_107=0x3210 +xgxs_tx_lane_map_108=0x3210 +xgxs_tx_lane_map_109=0x3210 +xgxs_tx_lane_map_110=0x1032 +xgxs_tx_lane_map_111=0x1032 +xgxs_tx_lane_map_112=0x1032 +xgxs_tx_lane_map_113=0x1032 +xgxs_tx_lane_map_5=0x3210 +xgxs_tx_lane_map_1=0x3210 +xgxs_tx_lane_map_114=0x0123 +xgxs_tx_lane_map_21=0x3210 +xgxs_tx_lane_map_9=0x3210 +xgxs_tx_lane_map_122=0x3210 + +#Polarity RX +phy_xaui_rx_polarity_flip_34=0x1 +phy_xaui_rx_polarity_flip_35=0x1 +phy_xaui_rx_polarity_flip_36=0x1 +phy_xaui_rx_polarity_flip_37=0x1 +phy_xaui_rx_polarity_flip_38=0x1 +phy_xaui_rx_polarity_flip_39=0x1 +phy_xaui_rx_polarity_flip_40=0x1 +phy_xaui_rx_polarity_flip_41=0x1 +phy_xaui_rx_polarity_flip_84=0x1 +phy_xaui_rx_polarity_flip_85=0x0 +phy_xaui_rx_polarity_flip_86=0x1 +phy_xaui_rx_polarity_flip_87=0x0 +phy_xaui_rx_polarity_flip_88=0x1 +phy_xaui_rx_polarity_flip_89=0x0 +phy_xaui_rx_polarity_flip_90=0x1 +phy_xaui_rx_polarity_flip_91=0x1 +phy_xaui_rx_polarity_flip_102=0x0 +phy_xaui_rx_polarity_flip_103=0x0 +phy_xaui_rx_polarity_flip_104=0x1 +phy_xaui_rx_polarity_flip_105=0x0 +phy_xaui_rx_polarity_flip_122=0xf +#Polarity TX +phy_xaui_tx_polarity_flip_42=0x1 +phy_xaui_tx_polarity_flip_43=0x1 +phy_xaui_tx_polarity_flip_44=0x1 +phy_xaui_tx_polarity_flip_45=0x1 +phy_xaui_tx_polarity_flip_34=0x1 +phy_xaui_tx_polarity_flip_35=0x1 +phy_xaui_tx_polarity_flip_36=0x1 +phy_xaui_tx_polarity_flip_37=0x1 +phy_xaui_tx_polarity_flip_38=0x0 +phy_xaui_tx_polarity_flip_39=0x1 +phy_xaui_tx_polarity_flip_40=0x0 +phy_xaui_tx_polarity_flip_41=0x1 +phy_xaui_tx_polarity_flip_72=0x1 +phy_xaui_tx_polarity_flip_73=0x1 +phy_xaui_tx_polarity_flip_74=0x1 +phy_xaui_tx_polarity_flip_75=0x1 +phy_xaui_tx_polarity_flip_84=0x1 +phy_xaui_tx_polarity_flip_85=0x1 +phy_xaui_tx_polarity_flip_86=0x1 +phy_xaui_tx_polarity_flip_87=0x1 +phy_xaui_tx_polarity_flip_88=0x1 +phy_xaui_tx_polarity_flip_89=0x1 +phy_xaui_tx_polarity_flip_90=0x1 +phy_xaui_tx_polarity_flip_91=0x1 +phy_xaui_tx_polarity_flip_102=0x1 +phy_xaui_tx_polarity_flip_103=0x1 +phy_xaui_tx_polarity_flip_104=0x1 +phy_xaui_tx_polarity_flip_105=0x1 +phy_xaui_tx_polarity_flip_122=0xb + +#Driver Current +serdes_driver_current_42=0x8 +serdes_driver_current_43=0x8 +serdes_driver_current_44=0x8 +serdes_driver_current_45=0x8 +serdes_driver_current_50=0x8 +serdes_driver_current_51=0x8 +serdes_driver_current_52=0x8 +serdes_driver_current_53=0x8 +serdes_driver_current_54=0x8 +serdes_driver_current_55=0x8 +serdes_driver_current_56=0x8 +serdes_driver_current_57=0x8 +serdes_driver_current_68=0x8 +serdes_driver_current_69=0x8 +serdes_driver_current_70=0x8 +serdes_driver_current_71=0x8 +serdes_driver_current_34=0x8 +serdes_driver_current_35=0x8 +serdes_driver_current_36=0x8 +serdes_driver_current_37=0x8 +serdes_driver_current_38=0x8 +serdes_driver_current_39=0x8 +serdes_driver_current_40=0x8 +serdes_driver_current_41=0x8 +serdes_driver_current_72=0x8 +serdes_driver_current_73=0x8 +serdes_driver_current_74=0x8 +serdes_driver_current_75=0x8 +serdes_driver_current_84=0x8 +serdes_driver_current_85=0x8 +serdes_driver_current_86=0x8 +serdes_driver_current_87=0x8 +serdes_driver_current_88=0x8 +serdes_driver_current_89=0x8 +serdes_driver_current_90=0x8 +serdes_driver_current_91=0x8 +serdes_driver_current_102=0x8 +serdes_driver_current_103=0x8 +serdes_driver_current_104=0x8 +serdes_driver_current_105=0x8 +serdes_driver_current_106=0x8 +serdes_driver_current_107=0x8 +serdes_driver_current_108=0x8 +serdes_driver_current_109=0x8 +serdes_driver_current_110=0x8 +serdes_driver_current_111=0x8 +serdes_driver_current_112=0x8 +serdes_driver_current_113=0x8 +serdes_driver_current_lane0_5=0x8 +serdes_driver_current_lane1_5=0x8 +serdes_driver_current_lane2_5=0x8 +serdes_driver_current_lane3_5=0x8 +serdes_driver_current_lane0_1=0x8 +serdes_driver_current_lane1_1=0x8 +serdes_driver_current_lane2_1=0x8 +serdes_driver_current_lane3_1=0x8 +serdes_driver_current_lane0_114=0x8 +serdes_driver_current_lane1_114=0x8 +serdes_driver_current_lane2_114=0x8 +serdes_driver_current_lane3_114=0x8 +serdes_driver_current_lane0_21=0x8 +serdes_driver_current_lane1_21=0x8 +serdes_driver_current_lane2_21=0x8 +serdes_driver_current_lane3_21=0x8 +serdes_driver_current_lane0_9=0x8 +serdes_driver_current_lane1_9=0x8 +serdes_driver_current_lane2_9=0x8 +serdes_driver_current_lane3_9=0x8 +serdes_driver_current_lane0_122=0x8 +serdes_driver_current_lane1_122=0x8 +serdes_driver_current_lane2_122=0x8 +serdes_driver_current_lane3_122=0x8 + +#Preemphasis +serdes_preemphasis_42=0x264006 +serdes_preemphasis_43=0x264006 +serdes_preemphasis_44=0x254106 +serdes_preemphasis_45=0x254106 +serdes_preemphasis_50=0x254106 +serdes_preemphasis_51=0x254106 +serdes_preemphasis_52=0x254106 +serdes_preemphasis_53=0x254106 +serdes_preemphasis_54=0x254106 +serdes_preemphasis_55=0x254106 +serdes_preemphasis_56=0x254106 +serdes_preemphasis_57=0x234306 +serdes_preemphasis_68=0x234306 +serdes_preemphasis_69=0x204606 +serdes_preemphasis_70=0x204606 +serdes_preemphasis_71=0x204606 +serdes_preemphasis_34=0x234306 +serdes_preemphasis_35=0x234306 +serdes_preemphasis_36=0x234306 +serdes_preemphasis_37=0x234306 +serdes_preemphasis_38=0x234306 +serdes_preemphasis_39=0x234306 +serdes_preemphasis_40=0x234306 +serdes_preemphasis_41=0x234306 +serdes_preemphasis_72=0x1e4806 +serdes_preemphasis_73=0x1e4806 +serdes_preemphasis_74=0x1e4806 +serdes_preemphasis_75=0x1e4806 +serdes_preemphasis_84=0x1e4806 +serdes_preemphasis_85=0x1a4c06 +serdes_preemphasis_86=0x1a4c06 +serdes_preemphasis_87=0x1b4b06 +serdes_preemphasis_88=0x1b4b06 +serdes_preemphasis_89=0x1e4806 +serdes_preemphasis_90=0x1e4806 +serdes_preemphasis_91=0x1e4806 +serdes_preemphasis_102=0x1e4806 +serdes_preemphasis_103=0x1e4806 +serdes_preemphasis_104=0x1e4806 +serdes_preemphasis_105=0x1e4806 +serdes_preemphasis_106=0x1e4806 +serdes_preemphasis_107=0x1e4806 +serdes_preemphasis_108=0x1e4806 +serdes_preemphasis_109=0x1e4806 +serdes_preemphasis_110=0x1e4806 +serdes_preemphasis_111=0x1d4906 +serdes_preemphasis_112=0x234306 +serdes_preemphasis_113=0x1f4706 +serdes_preemphasis_lane0_5=0x294106 +serdes_preemphasis_lane1_5=0x294106 +serdes_preemphasis_lane2_5=0x294106 +serdes_preemphasis_lane3_5=0x294106 +serdes_preemphasis_lane0_1=0x294106 +serdes_preemphasis_lane1_1=0x294106 +serdes_preemphasis_lane2_1=0x294106 +serdes_preemphasis_lane3_1=0x294106 +serdes_preemphasis_lane0_114=0x2a4006 +serdes_preemphasis_lane1_114=0x2a4006 +serdes_preemphasis_lane2_114=0x2a4006 +serdes_preemphasis_lane3_114=0x2a4006 +serdes_preemphasis_lane0_21=0x2c3c08 +serdes_preemphasis_lane1_21=0x2a4006 +serdes_preemphasis_lane2_21=0x2a4006 +serdes_preemphasis_lane3_21=0x2a4006 +serdes_preemphasis_lane0_9=0x284206 +serdes_preemphasis_lane1_9=0x284206 +serdes_preemphasis_lane2_9=0x284206 +serdes_preemphasis_lane3_9=0x284206 +serdes_preemphasis_lane0_122=0x283e06 +serdes_preemphasis_lane1_122=0x283e06 +serdes_preemphasis_lane2_122=0x283e06 +serdes_preemphasis_lane3_122=0x294601 diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/installer.conf b/device/accton/x86_64-accton_as7312_54xs-r0/installer.conf new file mode 100644 index 000000000000..14404194ef53 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=115200 diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/led_proc_init.soc b/device/accton/x86_64-accton_as7312_54xs-r0/led_proc_init.soc new file mode 100755 index 000000000000..3074649497e0 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/led_proc_init.soc @@ -0,0 +1,79 @@ +# accton_as7312_54x 48x25G+6x100G SDK port LED macro init SOC +s CMIC_LEDUP0_DATA_RAM 0 +s CMIC_LEDUP1_DATA_RAM 0 + +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=63 REMAP_PORT_1=63 REMAP_PORT_2=63 REMAP_PORT_3=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=63 REMAP_PORT_5=63 REMAP_PORT_6=63 REMAP_PORT_7=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=27 REMAP_PORT_9=26 REMAP_PORT_10=25 REMAP_PORT_11=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 REMAP_PORT_13=63 REMAP_PORT_14=63 REMAP_PORT_15=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=63 REMAP_PORT_17=63 REMAP_PORT_18=63 REMAP_PORT_19=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=31 REMAP_PORT_21=30 REMAP_PORT_22=29 REMAP_PORT_23=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=15 REMAP_PORT_25=14 REMAP_PORT_26=13 REMAP_PORT_27=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=19 REMAP_PORT_29=18 REMAP_PORT_30=17 REMAP_PORT_31=16 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=63 REMAP_PORT_33=63 REMAP_PORT_34=63 REMAP_PORT_35=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=63 REMAP_PORT_37=63 REMAP_PORT_38=63 REMAP_PORT_39=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=35 REMAP_PORT_41=34 REMAP_PORT_42=33 REMAP_PORT_43=32 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=63 REMAP_PORT_45=63 REMAP_PORT_46=63 REMAP_PORT_47=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=23 REMAP_PORT_49=22 REMAP_PORT_50=21 REMAP_PORT_51=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 REMAP_PORT_53=10 REMAP_PORT_54=9 REMAP_PORT_55=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 REMAP_PORT_57=6 REMAP_PORT_58=5 REMAP_PORT_59=4 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 REMAP_PORT_61=2 REMAP_PORT_62=1 REMAP_PORT_63=0 + +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=19 REMAP_PORT_1=18 REMAP_PORT_2=17 REMAP_PORT_3=16 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=23 REMAP_PORT_5=22 REMAP_PORT_6=21 REMAP_PORT_7=20 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=3 REMAP_PORT_9=2 REMAP_PORT_10=1 REMAP_PORT_11=0 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 REMAP_PORT_13=63 REMAP_PORT_14=63 REMAP_PORT_15=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=7 REMAP_PORT_17=6 REMAP_PORT_18=5 REMAP_PORT_19=4 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=11 REMAP_PORT_21=10 REMAP_PORT_22=9 REMAP_PORT_23=8 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=63 REMAP_PORT_25=63 REMAP_PORT_26=63 REMAP_PORT_27=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=63 REMAP_PORT_29=63 REMAP_PORT_30=63 REMAP_PORT_31=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=15 REMAP_PORT_33=14 REMAP_PORT_34=13 REMAP_PORT_35=12 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=27 REMAP_PORT_37=26 REMAP_PORT_38=25 REMAP_PORT_39=24 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=63 REMAP_PORT_41=63 REMAP_PORT_42=63 REMAP_PORT_43=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=63 REMAP_PORT_45=63 REMAP_PORT_46=63 REMAP_PORT_47=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=31 REMAP_PORT_49=30 REMAP_PORT_50=29 REMAP_PORT_51=28 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=35 REMAP_PORT_53=34 REMAP_PORT_54=33 REMAP_PORT_55=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=63 REMAP_PORT_57=63 REMAP_PORT_58=63 REMAP_PORT_59=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=63 REMAP_PORT_61=63 REMAP_PORT_62=63 REMAP_PORT_63=63 + +led 0 stop +led 0 prog \ + 02 FD 42 80 02 FF 42 00 02 FE 42 00 02 FA 42 7E \ + 02 FB 42 24 06 F9 D2 00 74 1E 02 F9 42 03 67 AC \ + 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 \ + 86 FE 67 C3 67 52 86 FE 06 FB D6 FE 74 1E 86 FC \ + 3E FA 06 FE 88 4A 03 71 4C 67 84 57 67 84 57 67 \ + 98 57 06 FE 88 80 4A 00 27 97 75 4F 90 4A 00 27 \ + 4A 01 27 B7 97 71 69 77 42 06 F9 D6 FC 74 7C 02 \ + F9 4A 07 37 4E 07 02 FC 42 00 4E 07 06 F9 0A 07 \ + 71 4F 77 42 16 FF 06 FD 17 4D DA 07 74 95 12 FF \ + 52 00 86 FD 57 86 FF 57 16 FF 06 FD 07 4D DA 07 \ + 74 A9 12 FF 52 00 86 FD 57 86 FF 57 06 FE C2 FC \ + 98 98 12 F4 50 C2 FC 98 98 F2 F0 14 06 F4 C2 03 \ + 88 77 D1 06 FE C2 FC 98 98 F2 E0 14 06 FE C2 03 \ + 88 18 71 E2 80 18 71 DD 67 98 67 98 57 67 98 67 \ + 84 57 80 18 71 EB 67 84 67 98 57 67 84 67 84 57 \ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +led 0 start +led auto on + +led 1 stop +led 1 prog \ + 02 FD 42 80 02 FF 42 00 02 FE 42 00 02 FA 42 7E \ + 02 FB 42 24 06 F9 D2 00 74 1E 02 F9 42 03 67 AC \ + 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 \ + 86 FE 67 C3 67 52 86 FE 06 FB D6 FE 74 1E 86 FC \ + 3E FA 06 FE 88 4A 03 71 4C 67 84 57 67 84 57 67 \ + 98 57 06 FE 88 80 4A 00 27 97 75 4F 90 4A 00 27 \ + 4A 01 27 B7 97 71 69 77 42 06 F9 D6 FC 74 7C 02 \ + F9 4A 07 37 4E 07 02 FC 42 00 4E 07 06 F9 0A 07 \ + 71 4F 77 42 16 FF 06 FD 17 4D DA 07 74 95 12 FF \ + 52 00 86 FD 57 86 FF 57 16 FF 06 FD 07 4D DA 07 \ + 74 A9 12 FF 52 00 86 FD 57 86 FF 57 06 FE C2 FC \ + 98 98 12 F4 50 C2 FC 98 98 F2 F0 14 06 F4 C2 03 \ + 88 77 D1 06 FE C2 FC 98 98 F2 E0 14 06 FE C2 03 \ + 88 18 71 E2 80 18 71 DD 67 98 67 98 57 67 98 67 \ + 84 57 80 18 71 EB 67 84 67 98 57 67 84 67 84 57 \ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +led 1 start +led auto on diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/minigraph.xml b/device/accton/x86_64-accton_as7312_54xs-r0/minigraph.xml new file mode 100644 index 000000000000..30f9962d1f11 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/minigraph.xml @@ -0,0 +1,1184 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + sonic + 10.0.0.32 + 1 + 180 + 60 + + + sonic + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + sonic + 10.0.0.34 + 1 + 180 + 60 + + + sonic + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + sonic + 10.0.0.36 + 1 + 180 + 60 + + + sonic + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + sonic + 10.0.0.38 + 1 + 180 + 60 + + + sonic + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + sonic + 10.0.0.40 + 1 + 180 + 60 + + + sonic + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + sonic + 10.0.0.42 + 1 + 180 + 60 + + + sonic + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + sonic + 10.0.0.44 + 1 + 180 + 60 + + + sonic + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + sonic + 10.0.0.46 + 1 + 180 + 60 + + + sonic + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + sonic + 10.0.0.48 + 1 + 180 + 60 + + + sonic + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + sonic + 10.0.0.50 + 1 + 180 + 60 + + + sonic + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + sonic + 10.0.0.52 + 1 + 180 + 60 + + + sonic + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + sonic + 10.0.0.54 + 1 + 180 + 60 + + + sonic + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + sonic + 10.0.0.56 + 1 + 180 + 60 + + + sonic + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + sonic + 10.0.0.58 + 1 + 180 + 60 + + + sonic + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + sonic + 10.0.0.60 + 1 + 180 + 60 + + + sonic + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + sonic + 10.0.0.62 + 1 + 180 + 60 + + + sonic + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + sonic + + +
10.0.0.33
+ + +
+ +
10.0.0.1
+ + +
+ +
10.0.0.35
+ + +
+ +
10.0.0.3
+ + +
+ +
10.0.0.37
+ + +
+ +
10.0.0.5
+ + +
+ +
10.0.0.39
+ + +
+ +
10.0.0.7
+ + +
+ +
10.0.0.41
+ + +
+ +
10.0.0.9
+ + +
+ +
10.0.0.43
+ + +
+ +
10.0.0.11
+ + +
+ +
10.0.0.45
+ + +
+ +
10.0.0.13
+ + +
+ +
10.0.0.47
+ + +
+ +
10.0.0.15
+ + +
+ +
10.0.0.49
+ + +
+ +
10.0.0.17
+ + +
+ +
10.0.0.51
+ + +
+ +
10.0.0.19
+ + +
+ +
10.0.0.53
+ + +
+ +
10.0.0.21
+ + +
+ +
10.0.0.55
+ + +
+ +
10.0.0.23
+ + +
+ +
10.0.0.57
+ + +
+ +
10.0.0.25
+ + +
+ +
10.0.0.59
+ + +
+ +
10.0.0.27
+ + +
+ +
10.0.0.61
+ + +
+ +
10.0.0.29
+ + +
+ +
10.0.0.63
+ + +
+ +
10.0.0.31
+ + +
+
+ +
+ + 64001 + ARISTA01T0 + + + + 65200 + ARISTA01T2 + + + + 64002 + ARISTA02T0 + + + + 65200 + ARISTA02T2 + + + + 64003 + ARISTA03T0 + + + + 65200 + ARISTA03T2 + + + + 64004 + ARISTA04T0 + + + + 65200 + ARISTA04T2 + + + + 64005 + ARISTA05T0 + + + + 65200 + ARISTA05T2 + + + + 64006 + ARISTA06T0 + + + + 65200 + ARISTA06T2 + + + + 64007 + ARISTA07T0 + + + + 65200 + ARISTA07T2 + + + + 64008 + ARISTA08T0 + + + + 65200 + ARISTA08T2 + + + + 64009 + ARISTA09T0 + + + + 65200 + ARISTA09T2 + + + + 64010 + ARISTA10T0 + + + + 65200 + ARISTA10T2 + + + + 64011 + ARISTA11T0 + + + + 65200 + ARISTA11T2 + + + + 64012 + ARISTA12T0 + + + + 65200 + ARISTA12T2 + + + + 64013 + ARISTA13T0 + + + + 65200 + ARISTA13T2 + + + + 64014 + ARISTA14T0 + + + + 65200 + ARISTA14T2 + + + + 64015 + ARISTA15T0 + + + + 65200 + ARISTA15T2 + + + + 64016 + ARISTA16T0 + + + + 65200 + ARISTA16T2 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + + + + + + sonic + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet1 + 10.0.0.2/31 + + + + Ethernet2 + 10.0.0.4/31 + + + + Ethernet3 + 10.0.0.6/31 + + + + Ethernet4 + 10.0.0.8/31 + + + + Ethernet5 + 10.0.0.10/31 + + + + Ethernet6 + 10.0.0.12/31 + + + + Ethernet7 + 10.0.0.14/31 + + + + Ethernet8 + 10.0.0.16/31 + + + + Ethernet9 + 10.0.0.18/31 + + + + Ethernet10 + 10.0.0.20/31 + + + + Ethernet11 + 10.0.0.22/31 + + + + Ethernet12 + 10.0.0.24/31 + + + + Ethernet13 + 10.0.0.26/31 + + + + Ethernet14 + 10.0.0.28/31 + + + + Ethernet15 + 10.0.0.30/31 + + + + Ethernet16 + 10.0.0.32/31 + + + + Ethernet17 + 10.0.0.34/31 + + + + Ethernet18 + 10.0.0.36/31 + + + + Ethernet19 + 10.0.0.38/31 + + + + Ethernet20 + 10.0.0.40/31 + + + + Ethernet21 + 10.0.0.42/31 + + + + Ethernet22 + 10.0.0.44/31 + + + + Ethernet23 + 10.0.0.46/31 + + + + Ethernet24 + 10.0.0.48/31 + + + + Ethernet25 + 10.0.0.50/31 + + + + Ethernet26 + 10.0.0.52/31 + + + + Ethernet27 + 10.0.0.54/31 + + + + Ethernet28 + 10.0.0.56/31 + + + + Ethernet29 + 10.0.0.58/31 + + + + Ethernet30 + 10.0.0.60/31 + + + + Ethernet31 + 10.0.0.62/31 + + + + Ethernet32 + 10.0.0.64/31 + + + + Ethernet33 + 10.0.0.66/31 + + + + Ethernet34 + 10.0.0.68/31 + + + + Ethernet35 + 10.0.0.70/31 + + + + Ethernet36 + 10.0.0.72/31 + + + + Ethernet37 + 10.0.0.74/31 + + + + Ethernet38 + 10.0.0.76/31 + + + + Ethernet39 + 10.0.0.78/31 + + + + Ethernet40 + 10.0.0.80/31 + + + + Ethernet41 + 10.0.0.82/31 + + + + Ethernet42 + 10.0.0.84/31 + + + + Ethernet43 + 10.0.0.86/31 + + + + Ethernet44 + 10.0.0.88/31 + + + + Ethernet45 + 10.0.0.90/31 + + + + Ethernet46 + 10.0.0.92/31 + + + + Ethernet47 + 10.0.0.94/31 + + + + Ethernet48 + 10.0.0.96/31 + + + + Ethernet52 + 10.0.0.98/31 + + + + Ethernet56 + 10.0.0.100/31 + + + + Ethernet60 + 10.0.0.102/31 + + + + Ethernet64 + 10.0.0.104/31 + + + + Ethernet68 + 10.0.0.106/31 + + + + + + + + + + + + DeviceInterfaceLink + sonic + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet1 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet2 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet3 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet4 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet5 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet6 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet7 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet8 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet9 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet10 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet11 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet12 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet13 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet14 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet15 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet16 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet17 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet18 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet19 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet20 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet21 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet22 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet23 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet24 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet25 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet26 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet27 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet28 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet29 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet30 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet31 + ARISTA16T0 + Ethernet1 + + + + + sonic + Accton-AS7312-54XS + + + + + + + sonic + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + sonic + Accton-AS7312-54XS +
diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as7312_54xs-r0/plugins/eeprom.py new file mode 100644 index 000000000000..7681caafeef4 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/plugins/eeprom.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom" + #Two i2c buses might get flipped order, check them both. + if not os.path.exists(self.eeprom_path): + self.eeprom_path = "/sys/bus/i2c/devices/0-0057/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/plugins/psuutil.py b/device/accton/x86_64-accton_as7312_54xs-r0/plugins/psuutil.py new file mode 100644 index 000000000000..d73e65bf7981 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/plugins/psuutil.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +############################################################################# +# Accton +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/" + self.psu_presence = "/psu_present" + self.psu_oper_status = "/psu_power_good" + self.psu_mapping = { + 2: "11-0053", + 1: "10-0050", + } + + def get_num_psus(self): + return len(self.psu_mapping) + + def get_psu_status(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index]+self.psu_oper_status + try: + with open(node, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index] + self.psu_presence + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7312_54xs-r0/plugins/sfputil.py new file mode 100644 index 000000000000..956b6b352f9c --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/plugins/sfputil.py @@ -0,0 +1,215 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 0 + PORT_END = 71 + PORTS_IN_BLOCK = 72 + QSFP_PORT_START = 48 + QSFP_PORT_END = 72 + + BASE_VAL_PATH = "/sys/class/i2c-adapter/i2c-{0}/{1}-0050/" + + _port_to_is_present = {} + _port_to_lp_mode = {} + + _port_to_eeprom_mapping = {} + _cpld_mapping = { + 0: "4-0060", + 1: "5-0062", + 2: "6-0064", + } + _port_to_i2c_mapping = { + 0: 18, + 1: 19, + 2: 20, + 3: 21, + 4: 22, + 5: 23, + 6: 24, + 7: 25, + 8: 26, + 9: 27, + 10: 28, + 11: 29, + 12: 30, + 13: 31, + 14: 32, + 15: 33, + 16: 34, + 17: 35, + 18: 36, + 19: 37, + 20: 38, + 21: 39, + 22: 40, + 23: 41, + 24: 42, + 25: 43, + 26: 44, + 27: 45, + 28: 46, + 29: 47, + 30: 48, + 31: 49, + 32: 50, + 33: 51, + 34: 52, + 35: 53, + 36: 54, + 37: 55, + 38: 56, + 39: 57, + 40: 58, + 41: 59, + 42: 60, + 43: 61, + 44: 62, + 45: 63, + 46: 64, + 47: 65, + 48: 66, #QSFP49 + 49: 66, + 50: 66, + 51: 66, + 52: 67, #QSFP50 + 53: 67, + 54: 67, + 55: 67, + 56: 68, #QSFP51 + 57: 68, + 58: 68, + 59: 68, + 60: 69, #QSFP52 + 61: 69, + 62: 69, + 63: 69, + 64: 70, #QSFP53 + 65: 70, + 66: 70, + 67: 70, + 68: 71, #QSFP54 + 69: 71, + 70: 71, + 71: 71, + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_port_start(self): + return self.QSFP_PORT_START + + @property + def qsfp_port_end(self): + return self.QSFP_PORT_END + + @property + def qsfp_ports(self): + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom' + for x in range(0, self.port_end+1): + self.port_to_eeprom_mapping[x] = eeprom_path.format( + self._port_to_i2c_mapping[x]) + + SfpUtilBase.__init__(self) + + + # For port 48~51 are QSFP, here presumed they're all split to 4 lanes. + def get_cage_num(self, port_num): + cage_num = port_num + if (port_num >= self.QSFP_PORT_START): + cage_num = (port_num - self.QSFP_PORT_START)/4 + cage_num = cage_num + self.QSFP_PORT_START + + return cage_num + + # For cage 0~23 and 48~51 are at cpld2, others are at cpld3. + def get_cpld_num(self, port_num): + cpld_i = 1 + cage_num = self.get_cage_num(port_num) + if (port_num > 23 and port_num < self.QSFP_PORT_START): + cpld_i = 2 + + if (cage_num >= 52): + cpld_i = 2 + + return cpld_i + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + cage_num = self.get_cage_num(port_num) + cpld_i = self.get_cpld_num(port_num) + + cpld_ps = self._cpld_mapping[cpld_i] + path = "/sys/bus/i2c/devices/{0}/module_present_{1}" + port_ps = path.format(cpld_ps, cage_num+1) + + try: + val_file = open(port_ps) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def get_low_power_mode(self, port_num): + raise NotImplementedError + + def set_low_power_mode(self, port_num, lpmode): + raise NotImplementedError + + def reset(self, port_num): + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + return False + + cage_num = self.get_cage_num(port_num) + cpld_i = self.get_cpld_num(port_num) + cpld_ps = self._cpld_mapping[cpld_i] + path = "/sys/bus/i2c/devices/{0}/module_reset_{1}" + port_ps = path.format(cpld_ps, cage_num+1) + try: + reg_file = open(port_ps, 'w') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = '0' + + reg_file.write(reg_value) + reg_file.close() + + return True From f04f0704f70fcd0f114563d3d567b9f2cc9b1ee5 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 29 Jun 2018 09:59:46 -0700 Subject: [PATCH 260/274] Build python-click Debian package from version 6.7-4 source to fix CLI autocomplete/suggest (#1824) --- .gitignore | 2 ++ .../build_templates/sonic_debian_extension.j2 | 6 +++++ rules/python-click.mk | 16 ++++++++++++ slave.mk | 1 + sonic-slave/Dockerfile | 14 +++++++--- src/python-click/Makefile | 26 +++++++++++++++++++ 6 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 rules/python-click.mk create mode 100644 src/python-click/Makefile diff --git a/.gitignore b/.gitignore index 74998573e491..4eb7ab7e9ab7 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,8 @@ src/lldpd/* !src/lldpd/patch/ src/mpdecimal/* !src/mpdecimal/Makefile +src/python-click/* +!src/python-click/Makefile src/python3/* !src/python3/Makefile src/redis/* diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index b4a45ed16149..d12c5a45f9de 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -89,6 +89,12 @@ sudo cp {{platform_common_py2_wheel_path}} $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY2 sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install $PLATFORM_COMMON_PY2_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY2_WHEEL_NAME +# Install built Python Click package (and its dependencies via 'apt-get -y install -f') +# Do this before installing sonic-utilities so that it doesn't attempt to install +# an older version as part of its dependencies +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-click*_all.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f + # Install SONiC Utilities (and its dependencies via 'apt-get -y install -f') sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-sonic-utilities_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f diff --git a/rules/python-click.mk b/rules/python-click.mk new file mode 100644 index 000000000000..0212f5e5584a --- /dev/null +++ b/rules/python-click.mk @@ -0,0 +1,16 @@ +# python-click package +# +# Python Click versions < 6.7 have a bug which causes bash completion +# functionality to stop working after two sublevels. sonic-utilities depends +# on this package, and the most recent version provided by Debian Jessie and +# Stretch is v6.6. We build version 6.7 from source in order to fix this bug. +# TODO: If we upgrade to a distro which provides a version >= 6.7 we will no +# longer need to build this. + +PYTHON_CLICK_VERSION = 6.7-4 + +export PYTHON_CLICK_VERSION + +PYTHON_CLICK = python-click_$(PYTHON_CLICK_VERSION)_all.deb +$(PYTHON_CLICK)_SRC_PATH = $(SRC_PATH)/python-click +SONIC_MAKE_DEBS += $(PYTHON_CLICK) diff --git a/slave.mk b/slave.mk index fc14a8f10a61..57e09d4c74ad 100644 --- a/slave.mk +++ b/slave.mk @@ -447,6 +447,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(IGB_DRIVER) \ $(IXGBE_DRIVER) \ $(SONIC_DEVICE_DATA) \ + $(PYTHON_CLICK) \ $(SONIC_UTILS) \ $(LIBWRAP) \ $(LIBPAM_TACPLUS) \ diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 213daf1a8e47..8949db34a973 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -193,8 +193,6 @@ RUN apt-get update && apt-get install -y \ python-netaddr \ python-ipaddr \ python-yaml \ -# For sonic utilities - python3-netaddr \ # For lockfile procmail \ # For gtest @@ -213,7 +211,17 @@ RUN apt-get update && apt-get install -y \ linuxdoc-tools \ lynx \ texlive-latex-extra \ - texlive-latex-recommended + texlive-latex-recommended \ +# For python-click build + python-sphinx \ + python-docutils \ + python3-all \ + python3-setuptools \ + python3-sphinx \ + python3-docutils \ + python3-requests \ + python3-pytest \ + python3-colorama # For linux build RUN apt-get -y build-dep linux diff --git a/src/python-click/Makefile b/src/python-click/Makefile new file mode 100644 index 000000000000..4deb27257fd2 --- /dev/null +++ b/src/python-click/Makefile @@ -0,0 +1,26 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = python-click_$(PYTHON_CLICK_VERSION)_all.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Remove any stale files + rm -rf ./python-click + + # Clone python-click Debian repo + git clone https://salsa.debian.org/debian/python-click + + pushd ./python-click + + # Reset HEAD to the commit of the proper tag + # NOTE: Using "git checkout " here detaches our HEAD, + # which stg doesn't like, so we use this method instead + git reset --hard debian/$(PYTHON_CLICK_VERSION) + + # Build source and Debian packages + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) + popd + + # Move the newly-built .deb package to the destination directory + mv $* $(DEST)/ From 1caad016f9d674a771246f23ae739c38d28ecfa9 Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Fri, 29 Jun 2018 14:33:11 -0700 Subject: [PATCH 261/274] Support T1 sku, create symlink (#1827) --- device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32-T1 | 1 + 1 file changed, 1 insertion(+) create mode 120000 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32-T1 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32-T1 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32-T1 new file mode 120000 index 000000000000..42c11d5f05fb --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32-T1 @@ -0,0 +1 @@ +Arista-7060CX-32S-C32 \ No newline at end of file From 6459275397eee140892f583375558c51d7e7b613 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 29 Jun 2018 14:33:43 -0700 Subject: [PATCH 262/274] Revert "[vs-test]: not forward routes with no-export community (#1774)" (#1828) This reverts commit b37540febd70a1dddf54aadfebf11007968585c9. --- platform/vs/tests/bounce/files/bgpd.conf | 13 ------ platform/vs/tests/bounce/files/exabgp1.conf | 21 ---------- platform/vs/tests/bounce/files/exabgp2.conf | 11 ----- platform/vs/tests/bounce/test_bounce.py | 45 --------------------- 4 files changed, 90 deletions(-) delete mode 100644 platform/vs/tests/bounce/files/bgpd.conf delete mode 100644 platform/vs/tests/bounce/files/exabgp1.conf delete mode 100644 platform/vs/tests/bounce/files/exabgp2.conf delete mode 100644 platform/vs/tests/bounce/test_bounce.py diff --git a/platform/vs/tests/bounce/files/bgpd.conf b/platform/vs/tests/bounce/files/bgpd.conf deleted file mode 100644 index 40322cedbc69..000000000000 --- a/platform/vs/tests/bounce/files/bgpd.conf +++ /dev/null @@ -1,13 +0,0 @@ -router bgp 65501 - bgp router-id 1.1.1.1 - no bgp default ipv4-unicast - neighbor 10.0.0.1 remote-as 65502 - address-family ipv4 - neighbor 10.0.0.1 activate - maximum-paths 64 - exit-address-family - neighbor 10.0.0.3 remote-as 65503 - address-family ipv4 - neighbor 10.0.0.3 activate - maximum-paths 64 - exit-address-family diff --git a/platform/vs/tests/bounce/files/exabgp1.conf b/platform/vs/tests/bounce/files/exabgp1.conf deleted file mode 100644 index 0e78bd61db42..000000000000 --- a/platform/vs/tests/bounce/files/exabgp1.conf +++ /dev/null @@ -1,21 +0,0 @@ -neighbor 10.0.0.0 { - router-id 1.1.1.2; - local-address 10.0.0.1; - local-as 65502; - peer-as 65501; - group-updates false; - - family{ - ipv4 unicast; - } - - static { - route 1.1.1.1/32{ - next-hop 10.0.0.1; - community no-export; - } - route 2.2.2.2/32{ - next-hop 10.0.0.1; - } - } -} diff --git a/platform/vs/tests/bounce/files/exabgp2.conf b/platform/vs/tests/bounce/files/exabgp2.conf deleted file mode 100644 index 3e67c18a82f6..000000000000 --- a/platform/vs/tests/bounce/files/exabgp2.conf +++ /dev/null @@ -1,11 +0,0 @@ -neighbor 10.0.0.2 { - router-id 1.1.1.3; - local-address 10.0.0.3; - local-as 65503; - peer-as 65501; - group-updates false; - - family { - ipv4 unicast; - } -} diff --git a/platform/vs/tests/bounce/test_bounce.py b/platform/vs/tests/bounce/test_bounce.py deleted file mode 100644 index 57616ec0bc76..000000000000 --- a/platform/vs/tests/bounce/test_bounce.py +++ /dev/null @@ -1,45 +0,0 @@ -from swsscommon import swsscommon -import os -import re -import time -import json - -def test_bounce(dvs): - dvs.servers[0].runcmd("pkill -f exabgp") - dvs.copy_file("/etc/quagga/", "bounce/files/bgpd.conf") - dvs.runcmd("supervisorctl start bgpd") - dvs.runcmd("ip addr add 10.0.0.0/31 dev Ethernet0") - dvs.runcmd("ifconfig Ethernet0 up") - - dvs.runcmd("ip addr add 10.0.0.2/31 dev Ethernet4") - dvs.runcmd("ifconfig Ethernet4 up") - - dvs.servers[0].runcmd("ip addr add 10.0.0.1/31 dev eth0") - dvs.servers[0].runcmd("ifconfig eth0 up") - - dvs.servers[1].runcmd("ip addr add 10.0.0.3/31 dev eth0") - dvs.servers[1].runcmd("ifconfig eth0 up") - - time.sleep(5) - - p1 = dvs.servers[0].runcmd_async("exabgp -d bounce/files/exabgp1.conf") - p2 = dvs.servers[1].runcmd_async("exabgp -d bounce/files/exabgp2.conf") - - time.sleep(20) - - sum_res = dvs.runcmd(["vtysh", "-c", "show ip bgp sum"]) - all_route = dvs.runcmd(["vtysh", "-c", "show ip bgp"]) - announce_route = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 advertised-routes"]) - - p1.terminate() - p1 = p1.wait() - - p2.terminate() - p2 = p2.wait() - - print sum_res - print announce_route - assert "1.1.1.1/32" in all_route - assert "1.1.1.1/32" not in announce_route - assert "2.2.2.2/32" in all_route - assert "2.2.2.2/32" in announce_route From 9b8d985a40ebee70941a3de87d0d709e1333e3aa Mon Sep 17 00:00:00 2001 From: Wirut Getbamrung Date: Sat, 30 Jun 2018 04:34:11 +0700 Subject: [PATCH 263/274] [device/celestica] Update fancontrol configuration file and sensor label in sensor.conf (#1826) * update fancontrol config follow cel fsc document * update lm75 sensors label --- .../x86_64-cel_seastone-r0/fancontrol | 14 +++++------ .../x86_64-cel_seastone-r0/sensors.conf | 25 +++++++++++-------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/device/celestica/x86_64-cel_seastone-r0/fancontrol b/device/celestica/x86_64-cel_seastone-r0/fancontrol index ba3010c7c9cc..8d5cbccb9d00 100644 --- a/device/celestica/x86_64-cel_seastone-r0/fancontrol +++ b/device/celestica/x86_64-cel_seastone-r0/fancontrol @@ -2,11 +2,11 @@ INTERVAL=10 DEVPATH=hwmon6=devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e hwmon7=devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d DEVNAME=hwmon6=emc2305 hwmon7=emc2305 -FCTEMPS=hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input -FCFANS= hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm5 hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm4 hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm3 hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm2 hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm1 hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm5 hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm4 hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm3 hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm2 hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm1 -MINTEMP=hwmon6/device/pwm1=25 hwmon6/device/pwm2=25 hwmon6/device/pwm3=25 hwmon6/device/pwm4=25 hwmon6/device/pwm5=25 hwmon7/device/pwm1=25 hwmon7/device/pwm2=25 hwmon7/device/pwm3=25 hwmon7/device/pwm4=25 hwmon7/device/pwm5=25 -MAXTEMP=hwmon6/device/pwm1=40 hwmon6/device/pwm2=40 hwmon6/device/pwm3=40 hwmon6/device/pwm4=40 hwmon6/device/pwm5=40 hwmon7/device/pwm1=40 hwmon7/device/pwm2=40 hwmon7/device/pwm3=40 hwmon7/device/pwm4=40 hwmon7/device/pwm5=40 -MINSTART=hwmon6/device/pwm1=75 hwmon6/device/pwm2=75 hwmon6/device/pwm3=75 hwmon6/device/pwm4=75 hwmon6/device/pwm5=75 hwmon7/device/pwm1=75 hwmon7/device/pwm2=75 hwmon7/device/pwm3=75 hwmon7/device/pwm4=75 hwmon7/device/pwm5=75 -MINSTOP=hwmon6/device/pwm1=50 hwmon6/device/pwm2=50 hwmon6/device/pwm3=50 hwmon6/device/pwm4=50 hwmon6/device/pwm5=50 hwmon7/device/pwm1=50 hwmon7/device/pwm2=50 hwmon7/device/pwm3=50 hwmon7/device/pwm4=50 hwmon7/device/pwm5=50 -MINPWM=hwmon6/device/pwm1=50 hwmon6/device/pwm2=50 hwmon6/device/pwm3=50 hwmon6/device/pwm4=50 hwmon6/device/pwm5=50 hwmon7/device/pwm1=50 hwmon7/device/pwm2=50 hwmon7/device/pwm3=50 hwmon7/device/pwm4=50 hwmon7/device/pwm5=50 +FCTEMPS=hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input +FCFANS=hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm5 hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm4 hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm3 hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm2 hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm1 hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm5 hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm4 hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm3 hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm2 hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm1 +MINTEMP=hwmon6/device/pwm1=26 hwmon6/device/pwm2=26 hwmon6/device/pwm3=26 hwmon6/device/pwm4=26 hwmon6/device/pwm5=26 hwmon7/device/pwm1=26 hwmon7/device/pwm2=26 hwmon7/device/pwm3=26 hwmon7/device/pwm4=26 hwmon7/device/pwm5=26 +MAXTEMP=hwmon6/device/pwm1=45 hwmon6/device/pwm2=45 hwmon6/device/pwm3=45 hwmon6/device/pwm4=45 hwmon6/device/pwm5=45 hwmon7/device/pwm1=45 hwmon7/device/pwm2=45 hwmon7/device/pwm3=45 hwmon7/device/pwm4=45 hwmon7/device/pwm5=45 +MINSTART=hwmon6/device/pwm1=89 hwmon6/device/pwm2=89 hwmon6/device/pwm3=89 hwmon6/device/pwm4=89 hwmon6/device/pwm5=89 hwmon7/device/pwm1=89 hwmon7/device/pwm2=89 hwmon7/device/pwm3=89 hwmon7/device/pwm4=89 hwmon7/device/pwm5=89 +MINSTOP=hwmon6/device/pwm1=89 hwmon6/device/pwm2=89 hwmon6/device/pwm3=89 hwmon6/device/pwm4=89 hwmon6/device/pwm5=89 hwmon7/device/pwm1=89 hwmon7/device/pwm2=89 hwmon7/device/pwm3=89 hwmon7/device/pwm4=89 hwmon7/device/pwm5=89 +MINPWM=hwmon6/device/pwm1=89 hwmon6/device/pwm2=89 hwmon6/device/pwm3=89 hwmon6/device/pwm4=89 hwmon6/device/pwm5=89 hwmon7/device/pwm1=89 hwmon7/device/pwm2=89 hwmon7/device/pwm3=89 hwmon7/device/pwm4=89 hwmon7/device/pwm5=89 MAXPWM=hwmon6/device/pwm1=255 hwmon6/device/pwm2=255 hwmon6/device/pwm3=255 hwmon6/device/pwm4=255 hwmon6/device/pwm5=255 hwmon7/device/pwm1=255 hwmon7/device/pwm2=255 hwmon7/device/pwm3=255 hwmon7/device/pwm4=255 hwmon7/device/pwm5=255 diff --git a/device/celestica/x86_64-cel_seastone-r0/sensors.conf b/device/celestica/x86_64-cel_seastone-r0/sensors.conf index 11461a0afef9..6ce4540b226e 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sensors.conf +++ b/device/celestica/x86_64-cel_seastone-r0/sensors.conf @@ -36,30 +36,33 @@ chip "dps460-i2c-*-5b" set in3_crit 13.0 set in3_lcrit 11.0 -# These sensors located on Main Switch Board. +# These sensors located on CPU Board. chip "dx010_lm75b-i2c-*-48" - label temp1 "Front-panel temp sensor 1" + label temp1 "CPU_external temp sensor" set temp1_max 43 set temp1_max_hyst 28 -chip "dx010_lm75b-i2c-*-49" - label temp1 "Front-panel temp sensor 2" +chip "dx010_lm75b-i2c-*-4e" + label temp1 "Rear_panel temp sensor" set temp1_max 43 set temp1_max_hyst 28 -chip "dx010_lm75b-i2c-*-4a" - label temp1 "ASIC temp sensor" +# These sensors located on Main Switch Board. +bus "i2c-5" "i2c-1-mux (chan_id 3)" +chip "dx010_lm75b-i2c-5-48" + label temp1 "Front_panel left temp sensor" set temp1_max 43 set temp1_max_hyst 28 -# These sensors located on CPU Board. -chip "dx010_lm75b-i2c-*-48" - label temp1 "Rear-panel temp sensor 1" +bus "i2c-6" "i2c-1-mux (chan_id 4)" +chip "dx010_lm75b-i2c-6-49" + label temp1 "Front_panel right temp sensor" set temp1_max 43 set temp1_max_hyst 28 -chip "dx010_lm75b-i2c-*-4e" - label temp1 "Rear-panel temp sensor 2" +bus "i2c-7" "i2c-1-mux (chan_id 5)" +chip "dx010_lm75b-i2c-7-4a" + label temp1 "Switch_external temp sensor" set temp1_max 43 set temp1_max_hyst 28 From 77aec964e60c6f12bb2f3b600ef013c055c2d001 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 29 Jun 2018 16:34:53 -0700 Subject: [PATCH 264/274] Update sonic-swss with QueueMaps fixes (#1829) * sonic-quagga update. Don't spam with 'Vtysh connected from' message * Update swss submodule with QueueMaps fixes --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 258ffe64c7f1..90ea7a41adfd 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 258ffe64c7f11a3e63f7cff09ae8bd2f98788c03 +Subproject commit 90ea7a41adfdeef69ec20db498f6b737e258cf71 From 3fc56f07e82076f22ee1b35d127c1eaf9094ae27 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Sat, 30 Jun 2018 09:41:39 -0700 Subject: [PATCH 265/274] [sonic-utilities] Update submodule (#1830) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 27ae65122582..9c4c3620e4fb 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 27ae651225820e3eb4f08ed4cd80f93bbb5fe9bf +Subproject commit 9c4c3620e4fb488325e9d146c8b312ae8bb95c15 From 0e5c5f2601c143676be90ae74e35695a330ce887 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 1 Jul 2018 09:46:25 -0700 Subject: [PATCH 266/274] [baseimage]: add commonly used network tools (#1832) * [baseimage]: add commonly used network tools --- build_debian.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index f66cf4ba62d1..c960a3946ca6 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -222,7 +222,11 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in sysfsutils \ grub2-common \ ethtool \ - screen + screen \ + hping3 \ + python-scapy \ + tcptraceroute \ + mtr-tiny sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y download \ grub-pc-bin From 7edbf5d6f0f76008c2d6cbb27ee870a830294361 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 1 Jul 2018 09:46:42 -0700 Subject: [PATCH 267/274] [build]: add show docker tag (#1833) --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index c954402ab312..347041e1b12a 100644 --- a/Makefile +++ b/Makefile @@ -107,6 +107,10 @@ sonic-slave-bash : $(DOCKER_BUILD) ; } @$(DOCKER_RUN) -t $(SLAVE_IMAGE):$(SLAVE_TAG) bash +showtag: + @echo $(SLAVE_IMAGE):$(SLAVE_TAG) + @echo $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) + init : @git submodule update --init --recursive @git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $$(realpath --relative-to=. $$(cut -d" " -f2 .git))" > .git' From 92eb7b47b2992a1b6c21ac0b19370c49f115d8b9 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Tue, 3 Jul 2018 19:39:27 +0300 Subject: [PATCH 268/274] [mellanox]: Fix symlink to QOS config file for MSN2740 platform (#1842) Signed-off-by: Volodymyr Samotiy --- device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json.j2 index ae738e606a9d..eccf286dc879 120000 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json.j2 @@ -1 +1 @@ -../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json \ No newline at end of file +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 \ No newline at end of file From 117dc2b00839e2456ff78e112ea5bcdc7ab6958d Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Wed, 4 Jul 2018 07:42:50 +0800 Subject: [PATCH 269/274] [docker-syncd-mlnx] add new mlnx-sfpd daemon to docker-syncd-mlnx (#1841) * This new daemon will listen to the SDK for the SDK change event, * after got a SFP change event will publish a notification via DB. modified: platform/mellanox/docker-syncd-mlnx-rpc.mk modified: platform/mellanox/docker-syncd-mlnx.mk modified: platform/mellanox/docker-syncd-mlnx/start.sh modified: platform/mellanox/docker-syncd-mlnx/supervisord.conf new file: platform/mellanox/mlnx-sfpd.mk new file: platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd new file: platform/mellanox/mlnx-sfpd/setup.py modified: platform/mellanox/rules.mk signed-off-by Liu Kebo kebol@mellanox.com --- platform/mellanox/docker-syncd-mlnx-rpc.mk | 2 +- platform/mellanox/docker-syncd-mlnx.mk | 2 +- platform/mellanox/docker-syncd-mlnx/start.sh | 2 + .../docker-syncd-mlnx/supervisord.conf | 8 + platform/mellanox/mlnx-sfpd.mk | 5 + platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd | 199 ++++++++++++++++++ platform/mellanox/mlnx-sfpd/setup.py | 28 +++ platform/mellanox/rules.mk | 1 + 8 files changed, 245 insertions(+), 2 deletions(-) create mode 100644 platform/mellanox/mlnx-sfpd.mk create mode 100644 platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd create mode 100644 platform/mellanox/mlnx-sfpd/setup.py diff --git a/platform/mellanox/docker-syncd-mlnx-rpc.mk b/platform/mellanox/docker-syncd-mlnx-rpc.mk index f27242ce17dc..d6011884c45c 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc.mk +++ b/platform/mellanox/docker-syncd-mlnx-rpc.mk @@ -2,7 +2,7 @@ DOCKER_SYNCD_MLNX_RPC = docker-syncd-mlnx-rpc.gz $(DOCKER_SYNCD_MLNX_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-mlnx-rpc -$(DOCKER_SYNCD_MLNX_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) +$(DOCKER_SYNCD_MLNX_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(MLNX_SFPD) $(DOCKER_SYNCD_MLNX_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_MLNX) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC) ifeq ($(ENABLE_SYNCD_RPC),y) diff --git a/platform/mellanox/docker-syncd-mlnx.mk b/platform/mellanox/docker-syncd-mlnx.mk index 2da5961fc046..6ac895d2eb9c 100644 --- a/platform/mellanox/docker-syncd-mlnx.mk +++ b/platform/mellanox/docker-syncd-mlnx.mk @@ -2,7 +2,7 @@ DOCKER_SYNCD_MLNX = docker-syncd-mlnx.gz $(DOCKER_SYNCD_MLNX)_PATH = $(PLATFORM_PATH)/docker-syncd-mlnx -$(DOCKER_SYNCD_MLNX)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) +$(DOCKER_SYNCD_MLNX)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) $(MLNX_SFPD) $(DOCKER_SYNCD_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX) ifneq ($(ENABLE_SYNCD_RPC),y) diff --git a/platform/mellanox/docker-syncd-mlnx/start.sh b/platform/mellanox/docker-syncd-mlnx/start.sh index 623316050475..3adbd04d536a 100755 --- a/platform/mellanox/docker-syncd-mlnx/start.sh +++ b/platform/mellanox/docker-syncd-mlnx/start.sh @@ -5,3 +5,5 @@ rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd supervisorctl start syncd + +supervisorctl start mlnx-sfpd diff --git a/platform/mellanox/docker-syncd-mlnx/supervisord.conf b/platform/mellanox/docker-syncd-mlnx/supervisord.conf index 1af5d70a1d0c..8860bd6c0205 100644 --- a/platform/mellanox/docker-syncd-mlnx/supervisord.conf +++ b/platform/mellanox/docker-syncd-mlnx/supervisord.conf @@ -26,3 +26,11 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog + +[program:mlnx-sfpd] +command=/usr/bin/mlnx-sfpd +priority=4 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/platform/mellanox/mlnx-sfpd.mk b/platform/mellanox/mlnx-sfpd.mk new file mode 100644 index 000000000000..416dd7d0f2cd --- /dev/null +++ b/platform/mellanox/mlnx-sfpd.mk @@ -0,0 +1,5 @@ +# mlnx-sfpd (SONiC MLNX platform sfp event monitoring daemon) Debian package + +MLNX_SFPD = python-mlnx-sfpd_1.0-1_all.deb +$(MLNX_SFPD)_SRC_PATH = $(PLATFORM_PATH)/mlnx-sfpd +SONIC_PYTHON_STDEB_DEBS += $(MLNX_SFPD) diff --git a/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd b/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd new file mode 100644 index 000000000000..e91dbb7a8aa6 --- /dev/null +++ b/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd @@ -0,0 +1,199 @@ +#!/usr/bin/env python +''' +This code is for a mlnx platform specific daemon, mlnx-sfpd. +Which listen to the SDK for the SFP change event and post the event to DB. +''' + +from __future__ import print_function +import sys, errno +import os +import time +import syslog +import signal +import json +from python_sdk_api.sx_api import * +from swsssdk import SonicV2Connector + +VERSION = '1.0' + +SYSLOG_IDENTIFIER = "mlnx-sfpd" + +REDIS_HOSTIP = "127.0.0.1" + +SDK_SFP_STATE_IN = 0x1 +SDK_SFP_STATE_OUT = 0x2 +STATUS_PLUGIN = '1' +STATUS_PLUGOUT = '0' +STATUS_UNKNOWN = '2' + +sfp_value_status_dict = {SDK_SFP_STATE_IN:STATUS_PLUGIN, SDK_SFP_STATE_OUT:STATUS_PLUGOUT} + +#========================== Syslog wrappers ========================== + +def log_info(msg, also_print_to_console=False): + syslog.openlog(SYSLOG_IDENTIFIER) + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + + if also_print_to_console: + print(msg) + +def log_warning(msg, also_print_to_console=False): + syslog.openlog(SYSLOG_IDENTIFIER) + syslog.syslog(syslog.LOG_WARNING, msg) + syslog.closelog() + + if also_print_to_console: + print(msg) + +def log_error(msg, also_print_to_console=False): + syslog.openlog(SYSLOG_IDENTIFIER) + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + + if also_print_to_console: + print(msg) + +#========================== Signal Handling ========================== + +def signal_handler(sig, frame): + if sig == signal.SIGHUP: + log_info("Caught SIGHUP - ignoring...") + return + elif sig == signal.SIGINT: + log_info("Caught SIGINT - exiting...") + sys.exit(128 + sig) + elif sig == signal.SIGTERM: + log_info("Caught SIGTERM - exiting...") + sys.exit(128 + sig) + else: + log_warning("Caught unhandled signal '" + sig + "'") + + +def sx_recv(fd_p, handle): + # recv parameters + pkt_size = 2000 + pkt_size_p = new_uint32_t_p() + uint32_t_p_assign(pkt_size_p, pkt_size) + pkt = new_uint8_t_arr(pkt_size) + recv_info_p = new_sx_receive_info_t_p() + pmpe_t = sx_event_pmpe_t() + logical_port_list = new_sx_port_log_id_t_arr(4) + port_attributes_list = new_sx_port_attributes_t_arr(64) + port_cnt_p = new_uint32_t_p() + uint32_t_p_assign(port_cnt_p,64) + label_port_list = [] + + rc = sx_lib_host_ifc_recv(fd_p, pkt, pkt_size_p, recv_info_p) + if rc != 0: + log_error("event receive exit with error, rc %d" % rc) + exit(rc) + + pmpe_t = recv_info_p.event_info.pmpe + port_list_size = pmpe_t.list_size + logical_port_list = pmpe_t.log_port_list + module_state = pmpe_t.module_state + + for i in range(0, port_list_size): + logical_port = sx_port_log_id_t_arr_getitem(logical_port_list, i) + rc = sx_api_port_device_get(handle, 1 , 0, port_attributes_list, port_cnt_p) + port_cnt = uint32_t_p_value(port_cnt_p) + + for i in range(0,port_cnt): + port_attributes = sx_port_attributes_t_arr_getitem(port_attributes_list,i) + if port_attributes.log_port == logical_port: + lable_port = port_attributes.port_mapping.module_port + break + label_port_list.append(lable_port) + + return label_port_list, module_state + +def send_sfp_notification(db, interface, state): + sfp_notify = [interface,state] + msg = json.dumps(sfp_notify,separators=(',',':')) + db.publish('STATE_DB','TRANSCEIVER_NOTIFY', msg) + return + +# main start +def main(): + # Register our signal handlers + signal.signal(signal.SIGHUP, signal_handler) + signal.signal(signal.SIGINT, signal_handler) + signal.signal(signal.SIGTERM, signal_handler) + + #open SDK handler + log_info("starting mlnx-sfpd...") + rc, handle = sx_api_open(None) + retry_time = 1 + while rc != SX_STATUS_SUCCESS: + time.sleep(2**retry_time) + retry_time += 1 + rc, handle = sx_api_open(None) + if retry_time > 20: + log_error("Failed to open api handle.\nPlease check that SDK is running.") + sys.exit(errno.EACCES) + + #open recv fd + rx_fd_p = new_sx_fd_t_p() + rc = sx_api_host_ifc_open(handle, rx_fd_p) + if rc != 0: + log_error("sx_api_host_ifc_open exit with error, rc %d" % rc) + exit(rc) + + # set up general host ifc parameters + swid = 0 + cmd = SX_ACCESS_CMD_REGISTER + uc_p = new_sx_user_channel_t_p() + uc_p.type = SX_USER_CHANNEL_TYPE_FD + uc_p.channel.fd = rx_fd_p + trap_id = SX_TRAP_ID_PMPE + + rc = sx_api_host_ifc_trap_id_register_set(handle, cmd, swid, trap_id, uc_p) + if rc != 0: + log_error("sx_api_host_ifc_trap_id_register_set exit with error, rc %d" % rc) + exit(rc) + + #connect to state db for notification sending + state_db = SonicV2Connector(host=REDIS_HOSTIP) + state_db.connect(state_db.STATE_DB) + + #main loop for sfp event listening + log_info("mlnx-sfpd started") + while True: + state = STATUS_UNKNOWN + port_list, module_state = sx_recv(rx_fd_p, handle) + if module_state in sfp_value_status_dict: state = sfp_value_status_dict[module_state] + + if state != STATUS_UNKNOWN: + for port in port_list: + log_info("SFP on port %d state %s" % (port, state)) + send_sfp_notification(state_db, str(port), state) + + log_info("sfp change event handling done") + + ''' + # TODO: clean open handlers before exit, need find out which errors can be raised by SDK in this case. + # unregister trap id + cmd = SX_ACCESS_CMD_DEREGISTER + rc = sx_api_host_ifc_trap_id_register_set(handle, cmd, swid, trap_id, uc_p) + if rc != 0: + log_error("sx_api_host_ifc_trap_id_register_set exit with error, rc %d" % rc) + exit(rc) + + # close read fp + rc = sx_api_host_ifc_close(handle, rx_fd_p) + if rc != 0: + log_error("sx_api_host_ifc_close exit with error, rc %d" % rc) + exit(rc) + + # close sdk handler + rc = sx_api_close(handle) + if rc != 0: + log_error("exit with error, rc %d" % rc) + exit(rc) + + log_info("mlnx-sfpd exited") + ''' + +if __name__ == '__main__': + main() diff --git a/platform/mellanox/mlnx-sfpd/setup.py b/platform/mellanox/mlnx-sfpd/setup.py new file mode 100644 index 000000000000..ea9b895cb1f4 --- /dev/null +++ b/platform/mellanox/mlnx-sfpd/setup.py @@ -0,0 +1,28 @@ +from setuptools import setup + +setup( + name='mlnx-sfpd', + version='1.0', + description='SFP event mmonitoring daemon for SONiC on mellanox platform', + license='Apache 2.0', + author='SONiC Community', + url='https://github.com/Azure/sonic-buildimage/', + maintainer='Kebo Liu', + maintainer_email='kebol@mellanox.com', + scripts=[ + 'scripts/mlnx-sfpd', + ], + classifiers=[ + 'Development Status :: 4 - Beta', + 'Environment :: No Input/Output (Daemon)', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 2.7', + 'Topic :: System :: Hardware', + ], + keywords='sonic SONiC SFP sfp MELLANOX mellanox daemon SFPD sfpd', +) diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index 1651f4a66806..ff5c96fe0042 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -10,6 +10,7 @@ include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/python-saithrift.mk include $(PLATFORM_PATH)/docker-ptf-mlnx.mk +include $(PLATFORM_PATH)/mlnx-sfpd.mk SONIC_ALL += $(SONIC_ONE_IMAGE) \ $(DOCKER_FPM) From 78ed06d6be0ef776ae7a48b3e085023f0404f13a Mon Sep 17 00:00:00 2001 From: Pradchaya P Date: Wed, 4 Jul 2018 08:00:13 +0800 Subject: [PATCH 270/274] [Platform/Celestica] Add dx010 fan led control. (#1834) --- platform/broadcom/platform-modules-cel.mk | 2 +- platform/broadcom/sonic-platform-modules-cel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/broadcom/platform-modules-cel.mk b/platform/broadcom/platform-modules-cel.mk index 551ff37e3b37..96cb59144fa5 100644 --- a/platform/broadcom/platform-modules-cel.mk +++ b/platform/broadcom/platform-modules-cel.mk @@ -1,6 +1,6 @@ # Celestica DX010 Platform modules -CEL_DX010_PLATFORM_MODULE_VERSION = 0.7 +CEL_DX010_PLATFORM_MODULE_VERSION = 0.8 export CEL_DX010_PLATFORM_MODULE_VERSION diff --git a/platform/broadcom/sonic-platform-modules-cel b/platform/broadcom/sonic-platform-modules-cel index 4c8bcd1584e5..5ec0c5e5d4fe 160000 --- a/platform/broadcom/sonic-platform-modules-cel +++ b/platform/broadcom/sonic-platform-modules-cel @@ -1 +1 @@ -Subproject commit 4c8bcd1584e5afb05476a67e0ed82ca02fba6da0 +Subproject commit 5ec0c5e5d4fe8f2ec1ab5a6abefa7d168a81ca98 From 162e9b6f56dcf9e76fa999d783d6fb7574b066b0 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 3 Jul 2018 17:00:31 -0700 Subject: [PATCH 271/274] Add monit for /var/log disk usage (#1836) Signed-off-by: Qi Luo --- build_debian.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build_debian.sh b/build_debian.sh index c960a3946ca6..767dd7b83b79 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -269,6 +269,8 @@ sudo sed -i ' sudo tee -a $FILESYSTEM_ROOT/etc/monit/monitrc > /dev/null <<'EOF' check filesystem root-aufs with path / if space usage > 90% for 5 times within 10 cycles then alert +check filesystem var-log with path /var/log + if space usage > 90% for 5 times within 10 cycles then alert check system $HOST if memory usage > 90% for 5 times within 10 cycles then alert if cpu usage (user) > 90% for 5 times within 10 cycles then alert From f6fffda7bbca101b0cd9c56b79ba69b25d86a77a Mon Sep 17 00:00:00 2001 From: yurypm Date: Wed, 4 Jul 2018 01:01:41 +0100 Subject: [PATCH 272/274] [device] Update arista driver submodule (#1835) * [device] Update arista driver submodule * Set Arista scd driver config Set ARISTA_SCD_DRIVER_CONFIG config to build and include scd driver to resulting arista deb packages --- platform/broadcom/platform-modules-arista.mk | 1 + platform/broadcom/sonic-platform-modules-arista | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/broadcom/platform-modules-arista.mk b/platform/broadcom/platform-modules-arista.mk index ec7566318c8d..633435c0550a 100644 --- a/platform/broadcom/platform-modules-arista.mk +++ b/platform/broadcom/platform-modules-arista.mk @@ -20,3 +20,4 @@ $(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODU export ARISTA_PLATFORM_MODULE ARISTA_PLATFORM_MODULE_PYTHON2 ARISTA_PLATFORM_MODULE_PYTHON3 ARISTA_PLATFORM_MODULE_DRIVERS +export ARISTA_SCD_DRIVER_CONFIG=m diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index a35c7eddaf94..c114bb1f903a 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit a35c7eddaf945a1ff09ea71b47f69b6ddba5e892 +Subproject commit c114bb1f903a5630c3a02d450a026949c323defd From 73a2e64d9f3cdb5643d0a71cfb9d7981f2ba4f07 Mon Sep 17 00:00:00 2001 From: byu343 Date: Tue, 3 Jul 2018 17:10:11 -0700 Subject: [PATCH 273/274] [arista]: Add platform support for DCS-7170-64C (#1718) --- .gitmodules | 3 + .../Arista-7170-64C/port_config.ini | 67 ++++++++++++++++++ .../arista/x86_64-arista_7170_64c/fancontrol | 10 +++ .../x86_64-arista_7170_64c/minigraph.xml | 70 +++++++++++++++++++ .../x86_64-arista_7170_64c/plugins/eeprom.py | 8 +++ .../plugins/led_control.py | 8 +++ .../x86_64-arista_7170_64c/plugins/psuutil.py | 12 ++++ .../x86_64-arista_7170_64c/plugins/sfputil.py | 8 +++ .../x86_64-arista_7170_64c/sensors.conf | 53 ++++++++++++++ files/Aboot/boot0.j2 | 6 ++ platform/p4/one-aboot.mk | 12 ++++ platform/p4/platform-modules-arista.mk | 22 ++++++ platform/p4/rules.mk | 2 + platform/p4/sonic-platform-modules-arista | 1 + 14 files changed, 282 insertions(+) create mode 100644 device/arista/x86_64-arista_7170_64c/Arista-7170-64C/port_config.ini create mode 100644 device/arista/x86_64-arista_7170_64c/fancontrol create mode 100644 device/arista/x86_64-arista_7170_64c/minigraph.xml create mode 100644 device/arista/x86_64-arista_7170_64c/plugins/eeprom.py create mode 100644 device/arista/x86_64-arista_7170_64c/plugins/led_control.py create mode 100644 device/arista/x86_64-arista_7170_64c/plugins/psuutil.py create mode 100644 device/arista/x86_64-arista_7170_64c/plugins/sfputil.py create mode 100644 device/arista/x86_64-arista_7170_64c/sensors.conf create mode 100644 platform/p4/one-aboot.mk create mode 100644 platform/p4/platform-modules-arista.mk create mode 160000 platform/p4/sonic-platform-modules-arista diff --git a/.gitmodules b/.gitmodules index e0cfc0869d05..bb4eae528c72 100755 --- a/.gitmodules +++ b/.gitmodules @@ -77,3 +77,6 @@ [submodule "platform/broadcom/sonic-platform-modules-mitac"] path = platform/broadcom/sonic-platform-modules-mitac url = https://github.com/MiTAC-EBU/sonic-platform-modules-mitac.git +[submodule "platform/p4/sonic-platform-modules-arista"] + path = platform/p4/sonic-platform-modules-arista + url = https://github.com/aristanetworks/sonic diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/port_config.ini b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/port_config.ini new file mode 100644 index 000000000000..1020ea1382c2 --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/port_config.ini @@ -0,0 +1,67 @@ +# name lanes alias port +Ethernet0 444,445,446,447 Ethernet1/1 1 +Ethernet4 52,53,54,55 Ethernet2/1 2 +Ethernet8 436,437,438,439 Ethernet3/1 3 +Ethernet12 432,433,434,435 Ethernet4/1 4 +Ethernet16 412,413,414,415 Ethernet5/1 5 +Ethernet20 424,425,426,427 Ethernet6/1 6 +Ethernet24 404,405,406,407 Ethernet7/1 7 +Ethernet28 0,1,2,3 Ethernet8/1 8 +Ethernet32 12,13,14,15 Ethernet9/1 9 +Ethernet36 8,9,10,11 Ethernet10/1 10 +Ethernet40 24,25,26,27 Ethernet11/1 11 +Ethernet44 32,33,34,35 Ethernet12/1 12 +Ethernet48 44,45,46,47 Ethernet13/1 13 +Ethernet52 40,41,42,43 Ethernet14/1 14 +Ethernet56 396,397,398,399 Ethernet15/1 15 +Ethernet60 392,393,394,395 Ethernet16/1 16 +Ethernet64 260,261,262,263 Ethernet17/1 17 +Ethernet68 384,385,386,387 Ethernet18/1 18 +Ethernet72 180,181,182,183 Ethernet19/1 19 +Ethernet76 172,173,174,175 Ethernet20/1 20 +Ethernet80 160,161,162,163 Ethernet21/1 21 +Ethernet84 164,165,166,167 Ethernet22/1 22 +Ethernet88 148,149,150,151 Ethernet23/1 23 +Ethernet92 140,141,142,143 Ethernet24/1 24 +Ethernet96 272,273,274,275 Ethernet25/1 25 +Ethernet100 132,133,134,135 Ethernet26/1 26 +Ethernet104 280,281,282,283 Ethernet27/1 27 +Ethernet108 284,285,286,287 Ethernet28/1 28 +Ethernet112 304,305,306,307 Ethernet29/1 29 +Ethernet116 292,293,294,295 Ethernet30/1 30 +Ethernet120 312,313,314,315 Ethernet31/1 31 +Ethernet124 316,317,318,319 Ethernet32/1 32 +Ethernet128 56,57,58,59 Ethernet33/1 33 +Ethernet132 60,61,62,63 Ethernet34/1 34 +Ethernet136 428,429,430,431 Ethernet35/1 35 +Ethernet140 440,441,442,443 Ethernet36/1 36 +Ethernet144 420,421,422,423 Ethernet37/1 37 +Ethernet148 416,417,418,419 Ethernet38/1 38 +Ethernet152 128,129,130,131 Ethernet39/1 39 +Ethernet156 408,409,410,411 Ethernet40/1 40 +Ethernet160 4,5,6,7 Ethernet41/1 41 +Ethernet164 16,17,18,19 Ethernet42/1 42 +Ethernet168 28,29,30,31 Ethernet43/1 43 +Ethernet172 20,21,22,23 Ethernet44/1 44 +Ethernet176 36,37,38,39 Ethernet45/1 45 +Ethernet180 48,49,50,51 Ethernet46/1 46 +Ethernet184 388,389,390,391 Ethernet47/1 47 +Ethernet188 400,401,402,403 Ethernet48/1 48 +Ethernet192 256,257,258,259 Ethernet49/1 49 +Ethernet196 264,265,266,267 Ethernet50/1 50 +Ethernet200 176,177,178,179 Ethernet51/1 51 +Ethernet204 184,185,186,187 Ethernet52/1 52 +Ethernet208 168,169,170,171 Ethernet53/1 53 +Ethernet212 156,157,158,159 Ethernet54/1 54 +Ethernet216 144,145,146,147 Ethernet55/1 55 +Ethernet220 152,153,154,155 Ethernet56/1 56 +Ethernet224 136,137,138,139 Ethernet57/1 57 +Ethernet228 268,269,270,271 Ethernet58/1 58 +Ethernet232 288,289,290,291 Ethernet59/1 59 +Ethernet236 276,277,278,279 Ethernet60/1 60 +Ethernet240 296,297,298,299 Ethernet61/1 61 +Ethernet244 300,301,302,303 Ethernet62/1 62 +Ethernet248 188,189,190,191 Ethernet63/1 63 +Ethernet252 308,309,310,311 Ethernet64/1 64 +Ethernet256 64 Ethernet65 65 +Ethernet260 65 Ethernet66 66 diff --git a/device/arista/x86_64-arista_7170_64c/fancontrol b/device/arista/x86_64-arista_7170_64c/fancontrol new file mode 100644 index 000000000000..639185a7119f --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/fancontrol @@ -0,0 +1,10 @@ +INTERVAL=5 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:1c.0/0000:06:00.0/i2c-8/8-004c hwmon3=devices/pci0000:ff/0000:ff:0b.3/i2c-93/93-0060 +DEVNAME=hwmon1=max6658 hwmon3=rook_cpld +FCTEMPS=hwmon3/pwm4=hwmon1/temp1_input hwmon3/pwm3=hwmon1/temp1_input hwmon3/pwm2=hwmon1/temp1_input hwmon3/pwm1=hwmon1/temp1_input +FCFANS=hwmon3/pwm4=hwmon3/fan4_input hwmon3/pwm3=hwmon3/fan3_input hwmon3/pwm2=hwmon3/fan2_input hwmon3/pwm1=hwmon3/fan1_input +MINTEMP=hwmon3/pwm4=50 hwmon3/pwm3=50 hwmon3/pwm2=50 hwmon3/pwm1=50 +MINPWM=hwmon3/pwm4=128 hwmon3/pwm3=128 hwmon3/pwm2=128 hwmon3/pwm1=128 +MAXTEMP=hwmon3/pwm4=60 hwmon3/pwm3=60 hwmon3/pwm2=60 hwmon3/pwm1=60 +MINSTART=hwmon3/pwm4=128 hwmon3/pwm3=128 hwmon3/pwm2=128 hwmon3/pwm1=128 +MINSTOP=hwmon3/pwm4=128 hwmon3/pwm3=128 hwmon3/pwm2=128 hwmon3/pwm1=128 diff --git a/device/arista/x86_64-arista_7170_64c/minigraph.xml b/device/arista/x86_64-arista_7170_64c/minigraph.xml new file mode 100644 index 000000000000..2b2586cf7596 --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/minigraph.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + HostIP + Loopback0 + + 100.1.0.1/32 + + 100.1.0.1/32 + + + + + + + ManagementIP1 + Management0 + + 172.24.37.166/18 + + 172.24.37.166/18 + + + + + + + sonic + + + + + + + + + + + + + + + + + + sonic + Arista-7170-64C + + + + + + + + sonic + Arista-7170-64C + diff --git a/device/arista/x86_64-arista_7170_64c/plugins/eeprom.py b/device/arista/x86_64-arista_7170_64c/plugins/eeprom.py new file mode 100644 index 000000000000..d439e442ee33 --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/plugins/eeprom.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python + +try: + import arista.utils.sonic_eeprom as arista_eeprom +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + +board = arista_eeprom.getTlvInfoDecoder() diff --git a/device/arista/x86_64-arista_7170_64c/plugins/led_control.py b/device/arista/x86_64-arista_7170_64c/plugins/led_control.py new file mode 100644 index 000000000000..fae2d504beb6 --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/plugins/led_control.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python + +try: + import arista.utils.sonic_leds as arista_leds +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + +LedControl = arista_leds.getLedControl() diff --git a/device/arista/x86_64-arista_7170_64c/plugins/psuutil.py b/device/arista/x86_64-arista_7170_64c/plugins/psuutil.py new file mode 100644 index 000000000000..1a8682ae3c67 --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/plugins/psuutil.py @@ -0,0 +1,12 @@ +# psuutil.py +# +# Platform-specific PSU interface for SONiC +# + +try: + import arista.utils.sonic_psu as arista_psuutil +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +PsuUtil = arista_psuutil.getPsuUtil() diff --git a/device/arista/x86_64-arista_7170_64c/plugins/sfputil.py b/device/arista/x86_64-arista_7170_64c/plugins/sfputil.py new file mode 100644 index 000000000000..1357ad786434 --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/plugins/sfputil.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python + +try: + import arista.utils.sonic_sfputil as arista_sfputil +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + +SfpUtil = arista_sfputil.getSfpUtil() diff --git a/device/arista/x86_64-arista_7170_64c/sensors.conf b/device/arista/x86_64-arista_7170_64c/sensors.conf new file mode 100644 index 000000000000..196769f95c0c --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/sensors.conf @@ -0,0 +1,53 @@ +# libsensors configuration file for DCS-7260CX3-64 +# ------------------------------------------------ + +bus "i2c-6" "SCD 0000:06:00.0 SMBus master 0 bus 5" +bus "i2c-7" "SCD 0000:06:00.0 SMBus master 0 bus 6" +bus "i2c-8" "SCD 0000:06:00.0 SMBus master 0 bus 7" +bus "i2c-81" "SCD 0000:ff:0b.3 SMBus master 0 bus 0" +bus "i2c-93" "SCD 0000:ff:0b.3 SMBus master 3 bus 0" +bus "i2c-96" "SCD 0000:ff:0b.3 SMBus master 3 bus 3" + +chip "max6658-i2c-8-4c" + label temp1 "Temp sensor near ASIC" + + set temp1_max 100 + set temp1_crit 110 + + ignore temp2 + +chip "dps1900-i2c-6-58" + label temp1 "PSU1 primary hotspot temp" + label temp2 "PSU1 inlet temp" + label temp3 "PSU1 exhaust temp" + + # setting maximum and critical thresholds is not supported for this psu + # fault and warning limits defined internally by hardware + + ignore fan2 + ignore fan3 + +chip "dps1900-i2c-7-58" + label temp1 "PSU2 primary hotspot temp" + label temp2 "PSU2 inlet temp" + label temp3 "PSU2 exhaust temp" + + # setting maximum and critical thresholds is not supported for this psu + # fault and warning limits defined internally by hardware + + ignore fan2 + ignore fan3 + +chip "max6658-i2c-81-4c" + label temp1 "Rear air temp1" + label temp2 "Rear air temp2" + + set temp1_max 50 + set temp1_crit 60 + set temp2_max 50 + set temp2_crit 60 + +chip "lm73-i2c-96-48" + label temp1 "Front air temp" + + set temp1_max 65 diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index ee77746676e0..ab2cdedb6383 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -169,6 +169,11 @@ platform_specific() { aboot_machine=arista_7260cx3_64 flash_size=28000 fi + if [ "$sid" = "Alhambra" ] || [ "$sid" = "AlhambraSsd" ]; then + aboot_machine=arista_7170_64c + flash_size=28000 + echo "hugepages=128" >> /tmp/append + fi if [ "$platform" = "rook" ]; then if [ -x /bin/readprefdl ]; then readprefdl -f /tmp/.system-prefdl -d > /mnt/flash/.system-prefdl @@ -176,6 +181,7 @@ platform_specific() { cp /etc/prefdl /mnt/flash/.system-prefdl chmod a+r /mnt/flash/.system-prefdl fi + echo "reassign_prefmem" >> /tmp/append fi if [ $flash_size -ge 28000 ]; then diff --git a/platform/p4/one-aboot.mk b/platform/p4/one-aboot.mk new file mode 100644 index 000000000000..95babf045c00 --- /dev/null +++ b/platform/p4/one-aboot.mk @@ -0,0 +1,12 @@ +# sonic broadcom one image installer + +SONIC_ONE_ABOOT_IMAGE = sonic-aboot-p4.swi +$(SONIC_ONE_ABOOT_IMAGE)_MACHINE = p4 +$(SONIC_ONE_ABOOT_IMAGE)_IMAGE_TYPE = aboot +$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(ARISTA_PLATFORM_MODULE_DRIVERS) $(ARISTA_PLATFORM_MODULE_PYTHON2) $(ARISTA_PLATFORM_MODULE_PYTHON3) $(ARISTA_PLATFORM_MODULE) + +# FIXME: this is a temporary workaround for testing the platform driver +$(SONIC_ONE_ABOOT_IMAGE)_DOCKERS += docker-platform-monitor.gz +# $(SONIC_ONE_ABOOT_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) + +SONIC_INSTALLERS += $(SONIC_ONE_ABOOT_IMAGE) diff --git a/platform/p4/platform-modules-arista.mk b/platform/p4/platform-modules-arista.mk new file mode 100644 index 000000000000..ec7566318c8d --- /dev/null +++ b/platform/p4/platform-modules-arista.mk @@ -0,0 +1,22 @@ +# Arista Platform modules + +ARISTA_PLATFORM_MODULE_VERSION = 1.0 + +export ARISTA_PLATFORM_MODULE_VERSION + +ARISTA_PLATFORM_MODULE = sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_amd64.deb +$(ARISTA_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-arista +$(ARISTA_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +SONIC_MAKE_DEBS += $(ARISTA_PLATFORM_MODULE) + +ARISTA_PLATFORM_MODULE_PYTHON2 = python-sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_all.deb +$(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODULE_PYTHON2))) + +ARISTA_PLATFORM_MODULE_PYTHON3 = python3-sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_all.deb +$(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODULE_PYTHON3))) + +ARISTA_PLATFORM_MODULE_DRIVERS = drivers-sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_amd64.deb +$(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODULE_DRIVERS))) + +export ARISTA_PLATFORM_MODULE ARISTA_PLATFORM_MODULE_PYTHON2 ARISTA_PLATFORM_MODULE_PYTHON3 ARISTA_PLATFORM_MODULE_DRIVERS + diff --git a/platform/p4/rules.mk b/platform/p4/rules.mk index 7fe6a60fadac..ea3e31e973e2 100644 --- a/platform/p4/rules.mk +++ b/platform/p4/rules.mk @@ -1,4 +1,6 @@ # include $(PLATFORM_PATH)/p4-softswitch.mk +include $(PLATFORM_PATH)/platform-modules-arista.mk +include $(PLATFORM_PATH)/one-aboot.mk include $(PLATFORM_PATH)/tenjin.mk include $(PLATFORM_PATH)/p4-hlir.mk include $(PLATFORM_PATH)/p4c-bm.mk diff --git a/platform/p4/sonic-platform-modules-arista b/platform/p4/sonic-platform-modules-arista new file mode 160000 index 000000000000..02b22ae91135 --- /dev/null +++ b/platform/p4/sonic-platform-modules-arista @@ -0,0 +1 @@ +Subproject commit 02b22ae91135d4e4a9e11e06656dcff3056e2c7f From 3950da10e0b3b64bd26c5cacab1d63e641032957 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Wed, 4 Jul 2018 20:15:03 +0300 Subject: [PATCH 274/274] [sonic-swss]: Update submodule pointer (#1843) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 90ea7a41adfd..22bb2cdf461d 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 90ea7a41adfdeef69ec20db498f6b737e258cf71 +Subproject commit 22bb2cdf461d7456293219fada0998acad2bfe74