From d8c27b6ed2b669932b529c35312800c6754e8d9f Mon Sep 17 00:00:00 2001 From: Longxiang Lyu <35479537+lolyu@users.noreply.github.com> Date: Mon, 25 Apr 2022 14:44:40 +0800 Subject: [PATCH 01/47] [YANG][vlan-sub-intf] Enforce Linux interface name length (#10646) Why I did it Allow portchannel vlan sub intf long name format as long as it follows Linux interface name length limit(<16). How I did it Modify the leaf name check. How to verify it Test case passes. --- .../tests/vlan_sub_interface.json | 7 ++ .../tests_config/vlan_sub_interface.json | 82 +++++++++++++++++++ .../yang-models/sonic-vlan-sub-interface.yang | 10 +-- 3 files changed, 94 insertions(+), 5 deletions(-) diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/vlan_sub_interface.json b/src/sonic-yang-models/tests/yang_model_tests/tests/vlan_sub_interface.json index e3ffa9dc44b6..d112587307e4 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/vlan_sub_interface.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/vlan_sub_interface.json @@ -9,6 +9,10 @@ "desc": "Configure vlan sub interface must condition false.", "eStrKey": "Must" }, + "VLAN_SUB_INTERFACE_NAME_LENGTH_LIMIT_MUST_CONDITION_FALSE_TEST": { + "desc": "Configure vlan sub interface name length must condition false.", + "eStrKey": "Must" + }, "VLAN_SUB_INTERFACE_SHORT_NAME_FORMAT_MUST_CONDITION_FALSE_TEST": { "desc": "Configure short name format vlan sub interface must condition false.", "eStrKey": "Must" @@ -16,6 +20,9 @@ "VLAN_SUB_INTERFACE_PO_SHORT_NAME_FORMAT_MUST_CONDITION_TRUE_TEST": { "desc": "Configure valid portchannel short name format vlan sub interface must condition true." }, + "VLAN_SUB_INTERFACE_PO_MUST_CONDITION_TRUE_TEST": { + "desc": "Configure portchannel long name format vlan sub interface must condition true." + }, "VLAN_SUB_INTERFACE_PO_MUST_CONDITION_FALSE_TEST": { "desc": "Configure portchannel long name format vlan sub interface must condition false.", "eStrKey": "Must" diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan_sub_interface.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan_sub_interface.json index 8adff73e497c..860de64ba663 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan_sub_interface.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan_sub_interface.json @@ -95,6 +95,38 @@ } } }, + "VLAN_SUB_INTERFACE_NAME_LENGTH_LIMIT_MUST_CONDITION_FALSE_TEST": { + "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { + "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { + "VLAN_SUB_INTERFACE_LIST": [ + { + "name": "Ethernet12000.10" + } + ], + "VLAN_SUB_INTERFACE_IPPREFIX_LIST": [ + { + "name": "Ethernet12000.10", + "ip-prefix": "10.0.0.1/30" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet12000", + "admin_status": "up", + "alias": "Ethernet12000/1", + "description": "Ethernet12000", + "lanes": "49,50,51,52", + "mtu": 9000, + "speed": 100000 + } + ] + } + } + }, "VLAN_SUB_INTERFACE_SHORT_NAME_FORMAT_MUST_CONDITION_FALSE_TEST": { "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { @@ -177,6 +209,56 @@ } } }, + "VLAN_SUB_INTERFACE_PO_MUST_CONDITION_TRUE_TEST": { + "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { + "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { + "VLAN_SUB_INTERFACE_LIST": [ + { + "name": "PortChannel01.8" + } + ], + "VLAN_SUB_INTERFACE_IPPREFIX_LIST": [ + { + "name": "PortChannel01.8", + "ip-prefix": "10.0.0.1/30" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet0", + "tpid": "0x8100", + "speed": 25000 + } + ] + } + }, + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL": { + "PORTCHANNEL_LIST": [ + { + "admin_status": "up", + "members": [ + "Ethernet0" + ], + "min_links": "1", + "mtu": "9100", + "tpid": "0x8100", + "lacp_key": "auto", + "name": "PortChannel01" + } + ] + } + } + }, "VLAN_SUB_INTERFACE_PO_MUST_CONDITION_FALSE_TEST": { "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { diff --git a/src/sonic-yang-models/yang-models/sonic-vlan-sub-interface.yang b/src/sonic-yang-models/yang-models/sonic-vlan-sub-interface.yang index 953aa7e14c80..212fb5533c3b 100644 --- a/src/sonic-yang-models/yang-models/sonic-vlan-sub-interface.yang +++ b/src/sonic-yang-models/yang-models/sonic-vlan-sub-interface.yang @@ -40,11 +40,11 @@ module sonic-vlan-sub-interface { key "name"; leaf name { - must "(substring-before(current(), '.') = /port:sonic-port/port:PORT/port:PORT_LIST/port:name) or " + - "(starts-with(substring-before(current(), '.'), 'Eth') and " + - "concat('Ethernet', substring-after(substring-before(current(), '.'), 'Eth')) = /port:sonic-port/port:PORT/port:PORT_LIST/port:name) or " + - "(starts-with(substring-before(current(), '.'), 'Po') and " + - "concat('PortChannel', substring-after(substring-before(current(), '.'), 'Po')) = /lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name)" + must "(string-length(current()) <= 15) and " + + "((substring-before(current(), '.') = /port:sonic-port/port:PORT/port:PORT_LIST/port:name) or " + + "(starts-with(substring-before(current(), '.'), 'Eth') and concat('Ethernet', substring-after(substring-before(current(), '.'), 'Eth')) = /port:sonic-port/port:PORT/port:PORT_LIST/port:name) or " + + "(substring-before(current(), '.') = /lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name) or " + + "(starts-with(substring-before(current(), '.'), 'Po') and concat('PortChannel', substring-after(substring-before(current(), '.'), 'Po')) = /lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name))" { error-message "Must condition not satisfied, please follow vlan sub interface naming convention"; } From 3fc3259a35a372e1fad75235742c03120839a4d6 Mon Sep 17 00:00:00 2001 From: bingwang-ms <66248323+bingwang-ms@users.noreply.github.com> Date: Mon, 25 Apr 2022 15:06:10 +0800 Subject: [PATCH 02/47] Define qos map `AZURE_TUNNEL` for QoS remapping of tunnel traffic (#10565) * Add AZURE_TUNNEL map Signed-off-by: bingwang --- .../Arista-7050CX3-32S-D48C8/qos.json.j2 | 100 +++++++++++++++++ .../Arista-7260CX3-C64/qos.json.j2 | 102 +++++++++++++++++- files/build_templates/qos_config.j2 | 3 + .../py3/qos-arista7050cx3-dualtor.json | 98 +++++++++++++++++ .../py3/qos-arista7260-dualtor.json | 98 +++++++++++++++++ 5 files changed, 400 insertions(+), 1 deletion(-) diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 index 04fddf486ace..413bd575413c 100644 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 @@ -66,6 +66,72 @@ "61": "1", "62": "1", "63": "1" + }, + "AZURE_TUNNEL": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "2", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" } }, {%- endmacro %} @@ -80,6 +146,16 @@ "5": "0", "6": "0", "7": "7" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "0", + "2": "0", + "3": "2", + "4": "6", + "5": "0", + "6": "0", + "7": "0" } }, {%- endmacro %} @@ -94,6 +170,30 @@ "5": "5", "6": "6", "7": "7" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "1", + "2": "1", + "3": "2", + "4": "6", + "5": "5", + "6": "1", + "7": "7" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_dscp_map() %} + "TC_TO_DSCP_MAP": { + "AZURE_TUNNEL": { + "0": "8", + "1": "0", + "2": "33", + "3": "2", + "4": "6", + "5": "46", + "6": "0", + "7": "48" } }, {%- endmacro %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 index 4178efbcb7aa..27f6b531cb08 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 @@ -151,6 +151,72 @@ "61": "1", "62": "1", "63": "1" + }, + "AZURE_TUNNEL": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "2", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" } }, {%- endmacro %} @@ -165,6 +231,16 @@ "5": "0", "6": "0", "7": "7" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "0", + "2": "0", + "3": "2", + "4": "6", + "5": "0", + "6": "0", + "7": "0" } }, {%- endmacro %} @@ -173,12 +249,36 @@ "AZURE": { "0": "0", "1": "1", - "2": "1", + "2": "1", "3": "3", "4": "4", "5": "5", "6": "6", "7": "7" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "1", + "2": "1", + "3": "2", + "4": "6", + "5": "5", + "6": "1", + "7": "7" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_dscp_map() %} + "TC_TO_DSCP_MAP": { + "AZURE_TUNNEL": { + "0": "8", + "1": "0", + "2": "33", + "3": "2", + "4": "6", + "5": "46", + "6": "0", + "7": "48" } }, {%- endmacro %} diff --git a/files/build_templates/qos_config.j2 b/files/build_templates/qos_config.j2 index 9df061283034..4062755827ab 100644 --- a/files/build_templates/qos_config.j2 +++ b/files/build_templates/qos_config.j2 @@ -172,6 +172,9 @@ } }, {% endif %} +{% if generate_tc_to_dscp_map is defined %} + {{- generate_tc_to_dscp_map() }} +{% endif %} {% if 'resource_type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['resource_type'] in apollo_resource_types %} "SCHEDULER": { "scheduler.0": { diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050cx3-dualtor.json b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050cx3-dualtor.json index 84a2613df90d..dbab298bb76a 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050cx3-dualtor.json +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050cx3-dualtor.json @@ -21,6 +21,16 @@ "5": "5", "6": "6", "7": "7" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "1", + "2": "1", + "3": "2", + "4": "6", + "5": "5", + "6": "1", + "7": "7" } }, "DSCP_TO_TC_MAP": { @@ -89,6 +99,72 @@ "61": "1", "62": "1", "63": "1" + }, + "AZURE_TUNNEL": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "2", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" } }, "TC_TO_PRIORITY_GROUP_MAP": { @@ -101,6 +177,28 @@ "5": "0", "6": "0", "7": "7" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "0", + "2": "0", + "3": "2", + "4": "6", + "5": "0", + "6": "0", + "7": "0" + } + }, + "TC_TO_DSCP_MAP": { + "AZURE_TUNNEL": { + "0": "8", + "1": "0", + "2": "33", + "3": "2", + "4": "6", + "5": "46", + "6": "0", + "7": "48" } }, "SCHEDULER": { diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-dualtor.json b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-dualtor.json index e8476cc0c865..41f36a273d06 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-dualtor.json +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-dualtor.json @@ -21,6 +21,16 @@ "5": "5", "6": "6", "7": "7" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "1", + "2": "1", + "3": "2", + "4": "6", + "5": "5", + "6": "1", + "7": "7" } }, "DSCP_TO_TC_MAP": { @@ -89,6 +99,72 @@ "61": "1", "62": "1", "63": "1" + }, + "AZURE_TUNNEL": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "2", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" } }, "TC_TO_PRIORITY_GROUP_MAP": { @@ -101,6 +177,28 @@ "5": "0", "6": "0", "7": "7" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "0", + "2": "0", + "3": "2", + "4": "6", + "5": "0", + "6": "0", + "7": "0" + } + }, + "TC_TO_DSCP_MAP": { + "AZURE_TUNNEL": { + "0": "8", + "1": "0", + "2": "33", + "3": "2", + "4": "6", + "5": "46", + "6": "0", + "7": "48" } }, "SCHEDULER": { From d19a953e133a0893496cd6257aba7df1299fc4a0 Mon Sep 17 00:00:00 2001 From: zzhiyuan Date: Mon, 25 Apr 2022 08:11:32 -0700 Subject: [PATCH 03/47] [Arista] Add 1x100G over 4 lanes configuration for 7060DX4 (#10655) Co-authored-by: Zhi Yuan (Carl) Zhao --- .../x86_64-arista_7060dx4_32/platform.json | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/device/arista/x86_64-arista_7060dx4_32/platform.json b/device/arista/x86_64-arista_7060dx4_32/platform.json index 7a38cbe3d9f3..425d9c87d6ce 100644 --- a/device/arista/x86_64-arista_7060dx4_32/platform.json +++ b/device/arista/x86_64-arista_7060dx4_32/platform.json @@ -236,6 +236,9 @@ "Ethernet1/3", "Ethernet1/5", "Ethernet1/7" + ], + "1x100G(4)": [ + "Ethernet1/1" ] } }, @@ -255,6 +258,9 @@ "Ethernet2/3", "Ethernet2/5", "Ethernet2/7" + ], + "1x100G(4)": [ + "Ethernet2/1" ] } }, @@ -274,6 +280,9 @@ "Ethernet3/3", "Ethernet3/5", "Ethernet3/7" + ], + "1x100G(4)": [ + "Ethernet3/1" ] } }, @@ -293,6 +302,9 @@ "Ethernet4/3", "Ethernet4/5", "Ethernet4/7" + ], + "1x100G(4)": [ + "Ethernet4/1" ] } }, @@ -312,6 +324,9 @@ "Ethernet5/3", "Ethernet5/5", "Ethernet5/7" + ], + "1x100G(4)": [ + "Ethernet5/1" ] } }, @@ -331,6 +346,9 @@ "Ethernet6/3", "Ethernet6/5", "Ethernet6/7" + ], + "1x100G(4)": [ + "Ethernet6/1" ] } }, @@ -350,6 +368,9 @@ "Ethernet7/3", "Ethernet7/5", "Ethernet7/7" + ], + "1x100G(4)": [ + "Ethernet7/1" ] } }, @@ -369,6 +390,9 @@ "Ethernet8/3", "Ethernet8/5", "Ethernet8/7" + ], + "1x100G(4)": [ + "Ethernet8/1" ] } }, @@ -388,6 +412,9 @@ "Ethernet9/3", "Ethernet9/5", "Ethernet9/7" + ], + "1x100G(4)": [ + "Ethernet9/1" ] } }, @@ -407,6 +434,9 @@ "Ethernet10/3", "Ethernet10/5", "Ethernet10/7" + ], + "1x100G(4)": [ + "Ethernet10/1" ] } }, @@ -426,6 +456,9 @@ "Ethernet11/3", "Ethernet11/5", "Ethernet11/7" + ], + "1x100G(4)": [ + "Ethernet11/1" ] } }, @@ -445,6 +478,9 @@ "Ethernet12/3", "Ethernet12/5", "Ethernet12/7" + ], + "1x100G(4)": [ + "Ethernet12/1" ] } }, @@ -464,6 +500,9 @@ "Ethernet13/3", "Ethernet13/5", "Ethernet13/7" + ], + "1x100G(4)": [ + "Ethernet13/1" ] } }, @@ -483,6 +522,9 @@ "Ethernet14/3", "Ethernet14/5", "Ethernet14/7" + ], + "1x100G(4)": [ + "Ethernet14/1" ] } }, @@ -502,6 +544,9 @@ "Ethernet15/3", "Ethernet15/5", "Ethernet15/7" + ], + "1x100G(4)": [ + "Ethernet15/1" ] } }, @@ -521,6 +566,9 @@ "Ethernet16/3", "Ethernet16/5", "Ethernet16/7" + ], + "1x100G(4)": [ + "Ethernet16/1" ] } }, @@ -540,6 +588,9 @@ "Ethernet17/3", "Ethernet17/5", "Ethernet17/7" + ], + "1x100G(4)": [ + "Ethernet17/1" ] } }, @@ -559,6 +610,9 @@ "Ethernet18/3", "Ethernet18/5", "Ethernet18/7" + ], + "1x100G(4)": [ + "Ethernet18/1" ] } }, @@ -578,6 +632,9 @@ "Ethernet19/3", "Ethernet19/5", "Ethernet19/7" + ], + "1x100G(4)": [ + "Ethernet19/1" ] } }, @@ -597,6 +654,9 @@ "Ethernet20/3", "Ethernet20/5", "Ethernet20/7" + ], + "1x100G(4)": [ + "Ethernet20/1" ] } }, @@ -616,6 +676,9 @@ "Ethernet21/3", "Ethernet21/5", "Ethernet21/7" + ], + "1x100G(4)": [ + "Ethernet21/1" ] } }, @@ -635,6 +698,9 @@ "Ethernet22/3", "Ethernet22/5", "Ethernet22/7" + ], + "1x100G(4)": [ + "Ethernet22/1" ] } }, @@ -654,6 +720,9 @@ "Ethernet23/3", "Ethernet23/5", "Ethernet23/7" + ], + "1x100G(4)": [ + "Ethernet23/1" ] } }, @@ -673,6 +742,9 @@ "Ethernet24/3", "Ethernet24/5", "Ethernet24/7" + ], + "1x100G(4)": [ + "Ethernet24/1" ] } }, @@ -692,6 +764,9 @@ "Ethernet25/3", "Ethernet25/5", "Ethernet25/7" + ], + "1x100G(4)": [ + "Ethernet25/1" ] } }, @@ -711,6 +786,9 @@ "Ethernet26/3", "Ethernet26/5", "Ethernet26/7" + ], + "1x100G(4)": [ + "Ethernet26/1" ] } }, @@ -730,6 +808,9 @@ "Ethernet27/3", "Ethernet27/5", "Ethernet27/7" + ], + "1x100G(4)": [ + "Ethernet27/1" ] } }, @@ -749,6 +830,9 @@ "Ethernet28/3", "Ethernet28/5", "Ethernet28/7" + ], + "1x100G(4)": [ + "Ethernet28/1" ] } }, @@ -768,6 +852,9 @@ "Ethernet29/3", "Ethernet29/5", "Ethernet29/7" + ], + "1x100G(4)": [ + "Ethernet29/1" ] } }, @@ -787,6 +874,9 @@ "Ethernet30/3", "Ethernet30/5", "Ethernet30/7" + ], + "1x100G(4)": [ + "Ethernet30/1" ] } }, @@ -806,6 +896,9 @@ "Ethernet31/3", "Ethernet31/5", "Ethernet31/7" + ], + "1x100G(4)": [ + "Ethernet31/1" ] } }, @@ -825,6 +918,9 @@ "Ethernet32/3", "Ethernet32/5", "Ethernet32/7" + ], + "1x100G(4)": [ + "Ethernet32/1" ] } }, From 672db8d416798b6d418e98f5bb7693d2ff42214f Mon Sep 17 00:00:00 2001 From: Shilong Liu Date: Mon, 25 Apr 2022 23:16:29 +0800 Subject: [PATCH 04/47] [submodule] Update submodule for sonic-mgmt-common (#10664) submodule update, includes: ec32690 CVE-2020-25614: Update xmlquery, jsonquery and xpath packages. (#58) 5156527 Showtech sonic mgmt framework: Add Management Framework functionality for "show tech-support" (#49) --- src/sonic-mgmt-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-mgmt-common b/src/sonic-mgmt-common index d43a607d759d..ec326905356c 160000 --- a/src/sonic-mgmt-common +++ b/src/sonic-mgmt-common @@ -1 +1 @@ -Subproject commit d43a607d759d23f64d681e38d015ce0be886d440 +Subproject commit ec326905356c59aed51c6f6516db5a1b5d8516d6 From 64187a1b1500c1c8a0cab4b5ab97d4de6135de52 Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Mon, 25 Apr 2022 13:38:52 -0400 Subject: [PATCH 05/47] Remove SSH host keys after installing the custom version of sshd (#10633) * Remove SSH host keys after installing the custom version of sshd Signed-off-by: Saikrishna Arcot * Use an override for for sshd instead of overwriting the service file Don't overwrite upstream's .service file, and instead use an override file for making sure the host key(s) are generated. Signed-off-by: Saikrishna Arcot --- build_debian.sh | 3 ++- .../build_templates/sonic_debian_extension.j2 | 5 +++++ files/sshd/override.conf | 4 ++++ files/sshd/sshd.service | 18 ------------------ 4 files changed, 11 insertions(+), 19 deletions(-) create mode 100644 files/sshd/override.conf delete mode 100644 files/sshd/sshd.service diff --git a/build_debian.sh b/build_debian.sh index b3d692cdb28c..43f509b374c2 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -407,7 +407,8 @@ sudo sed -i 's/LOAD_KEXEC=true/LOAD_KEXEC=false/' $FILESYSTEM_ROOT/etc/default/k ## 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/ -sudo cp -f files/sshd/sshd.service $FILESYSTEM_ROOT/lib/systemd/system/ssh.service +sudo mkdir $FILESYSTEM_ROOT/etc/systemd/system/ssh.service.d +sudo cp files/sshd/override.conf $FILESYSTEM_ROOT/etc/systemd/system/ssh.service.d/override.conf # Config sshd # 1. Set 'UseDNS' to 'no' # 2. Configure sshd to close all SSH connetions after 15 minutes of inactivity diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index a49e29406eeb..924641393c02 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -329,6 +329,11 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in # Install custom-built openssh sshd sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/openssh-server_*.deb +# Remove sshd host keys, and will regenerate on first sshd start. This needs to be +# done again here because our custom version of sshd is being installed, which +# will regenerate the sshd host keys. +sudo rm -f $FILESYSTEM_ROOT/etc/ssh/ssh_host_*_key* + {% if sonic_asic_platform == 'broadcom' %} # Install custom-built flashrom sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/flashrom_*.deb diff --git a/files/sshd/override.conf b/files/sshd/override.conf new file mode 100644 index 000000000000..a1e63ce22b5d --- /dev/null +++ b/files/sshd/override.conf @@ -0,0 +1,4 @@ +[Service] +ExecStartPre= +ExecStartPre=/usr/local/bin/host-ssh-keygen.sh +ExecStartPre=/usr/sbin/sshd -t diff --git a/files/sshd/sshd.service b/files/sshd/sshd.service deleted file mode 100644 index 25d524171c6f..000000000000 --- a/files/sshd/sshd.service +++ /dev/null @@ -1,18 +0,0 @@ -[Unit] -Description=OpenBSD Secure Shell server -After=network.target auditd.service -ConditionPathExists=!/etc/ssh/sshd_not_to_be_run - -[Service] -EnvironmentFile=-/etc/default/ssh -ExecStartPre=-/usr/local/bin/host-ssh-keygen.sh -ExecStart=/usr/sbin/sshd -D $SSHD_OPTS -ExecReload=/bin/kill -HUP $MAINPID -KillMode=process -Restart=on-failure -RuntimeDirectory=sshd -RuntimeDirectoryMode=0755 - -[Install] -WantedBy=multi-user.target -Alias=sshd.service From 9237950a0c8389b360878712db83553c3c910e78 Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Tue, 26 Apr 2022 02:56:05 +0800 Subject: [PATCH 06/47] Align threshold mode of zero buffer profile of egress_lossless_pool (#10627) On vs platform, egress_lossless_pool's mode is static. So the corresponding profile should be of static_th as well. Signed-off-by: Stephen Sun --- platform/vs/docker-sonic-vs/zero_profiles.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/vs/docker-sonic-vs/zero_profiles.json b/platform/vs/docker-sonic-vs/zero_profiles.json index fbd42bf7ec3e..7648fec56b15 100644 --- a/platform/vs/docker-sonic-vs/zero_profiles.json +++ b/platform/vs/docker-sonic-vs/zero_profiles.json @@ -43,7 +43,7 @@ "BUFFER_PROFILE_TABLE:egress_lossless_zero_profile" : { "pool":"egress_lossless_pool", "size":"0", - "dynamic_th":"-8" + "static_th":"0" }, "OP": "SET" }, From 0606add0177e0f7880c5cf7e09c2e0442320a4b5 Mon Sep 17 00:00:00 2001 From: Maxime Lorrillere Date: Mon, 25 Apr 2022 13:09:42 -0700 Subject: [PATCH 07/47] [chassis] Get asic PCI ID from CHASSIS_STATE_DB and update asic_id in CONFIG_DB (#9681) Asic PCI ID (PCI address) is collected by chassisd (inside pmon - Azure/sonic-platform-daemons#175) and saved in CHASSIS_STATE_DB (in redis_chassis). CHASSIS_STATE_DB is accessible by swss containers. At docker-init.sh (script is called after swss container is created and before anything that could run in swss like orchagent...), we wait until asic PCI ID of the corresponding asic is populated by chassisd. We then update asic_id in CONFIG_DB of asic's database. A system supporting dynamic asic PCI ID identification requires to have a file (empty) use_pci_id_chassis in its platform dir. When orchagent runs, it has correct asic PCI ID in its CONFIG_DB. Together with this PR: Azure/sonic-platform-daemons#175 Azure/sonic-platform-common#185 Signed-off-by: Maxime Lorrillere Co-authored-by: Maxime Lorrillere --- dockers/docker-orchagent/docker-init.j2 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dockers/docker-orchagent/docker-init.j2 b/dockers/docker-orchagent/docker-init.j2 index 5b3850613dac..d0a3ef9e2d36 100755 --- a/dockers/docker-orchagent/docker-init.j2 +++ b/dockers/docker-orchagent/docker-init.j2 @@ -40,4 +40,21 @@ if [ "$VLAN" != "" ]; then cp /usr/share/sonic/templates/ndppd.conf /etc/supervisor/conf.d/ fi +USE_PCI_ID_IN_CHASSIS_STATE_DB=/usr/share/sonic/platform/use_pci_id_chassis +ASIC_ID="asic$NAMESPACE_ID" +if [ -f "$USE_PCI_ID_IN_CHASSIS_STATE_DB" ]; then + while true; do + PCI_ID=$(sonic-db-cli -s CHASSIS_STATE_DB HGET "CHASSIS_ASIC_TABLE|$ASIC_ID" asic_pci_address) + if [ -z "$PCI_ID" ]; then + sleep 3 + else + # Update asic_id in CONFIG_DB, which is used by orchagent and fed to syncd + if [[ $PCI_ID == ????:??:??.? ]]; then + sonic-db-cli CONFIG_DB HSET 'DEVICE_METADATA|localhost' 'asic_id' ${PCI_ID#*:} + break + fi + fi + done +fi + exec /usr/local/bin/supervisord From aa62e3333906a79f10e5bdc80f6b9427a128fea2 Mon Sep 17 00:00:00 2001 From: Song Yuan <64041228+ysmanman@users.noreply.github.com> Date: Mon, 25 Apr 2022 13:14:17 -0700 Subject: [PATCH 08/47] [chassis] Do not configure LLDP on recirc ports (#7909) Why I did it Recirc port is used to only forward traffic from one asic to another asic. So it's not required to configure LLDP on it. How I did it Add interface prefix helper for recirc port. Similar to skip configuring LLDP on inband port, add check in lldpmgrd to skip recirc port by checking interface prefix. --- dockers/docker-lldp/lldpmgrd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dockers/docker-lldp/lldpmgrd b/dockers/docker-lldp/lldpmgrd index 9e85406d4510..93461a42837e 100755 --- a/dockers/docker-lldp/lldpmgrd +++ b/dockers/docker-lldp/lldpmgrd @@ -22,7 +22,7 @@ try: from sonic_py_common import daemon_base from swsscommon import swsscommon - from sonic_py_common.interface import inband_prefix + from sonic_py_common.interface import inband_prefix, recirc_prefix except ImportError as err: raise ImportError("%s - required module not found" % str(err)) @@ -133,9 +133,9 @@ class LldpManager(daemon_base.DaemonBase): """ port_desc = None - # Skip inband interface prefixes. These are recycle ports exposed in PORT_TABLE for + # Skip recirc and inband interface prefixes. These are recycle ports exposed in PORT_TABLE for # asic-to-asic communication in VOQ based chassis system. We do not configure LLDP on these. - if port_name.startswith(inband_prefix()): + if port_name.startswith(inband_prefix()) or port_name.startswith(recirc_prefix()): return # Get the port alias. If None or empty string, use port name instead From cc30771f6b97234a6dd19d8f97d5dfd44551cf20 Mon Sep 17 00:00:00 2001 From: Zhaohui Sun <94606222+ZhaohuiS@users.noreply.github.com> Date: Tue, 26 Apr 2022 09:13:26 +0800 Subject: [PATCH 09/47] Add python3 virtual environment for docker-ptf (#10599) Why I did it Migrate ptftests script to python3, in order to do an incremental migration, add python virtual environment firstly, install all required python packages in virtual env as well. Then migrate ptftests scripts from python2 to python3 one by one avoid impacting non-changed scripts. Signed-off-by: Zhaohui Sun zhaohuisun@microsoft.com How I did it Add python3 virtual environment for docker-ptf. Add submodule ptf-py3 and install patched ptf 0.9.3 into virtual environment as well, two ptf issues were reported here: p4lang/ptf#173 p4lang/ptf#174 Signed-off-by: Zhaohui Sun --- .gitmodules | 3 + dockers/docker-ptf/Dockerfile.j2 | 67 ++++++++++++++++++- platform/vs/docker-ptf.mk | 1 + rules/ptf-py3.dep | 11 +++ rules/ptf-py3.mk | 7 ++ src/ptf-py3 | 1 + ...ve-ord-in-get_mac-to-avoid-TypeError.patch | 26 +++++++ ...ted-client-mac-address-in-DHCP-Disco.patch | 36 ++++++++++ src/ptf-py3.patch/series | 2 + 9 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 rules/ptf-py3.dep create mode 100644 rules/ptf-py3.mk create mode 160000 src/ptf-py3 create mode 100644 src/ptf-py3.patch/0001-Remove-ord-in-get_mac-to-avoid-TypeError.patch create mode 100644 src/ptf-py3.patch/0002-Fill-byte-formatted-client-mac-address-in-DHCP-Disco.patch create mode 100644 src/ptf-py3.patch/series diff --git a/.gitmodules b/.gitmodules index 9194c8f4b7a2..59cddea4a8f2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -103,3 +103,6 @@ [submodule "src/sonic-p4rt/sonic-pins"] path = src/sonic-p4rt/sonic-pins url = https://github.com/Azure/sonic-pins.git +[submodule "src/ptf-py3"] + path = src/ptf-py3 + url = https://github.com/p4lang/ptf.git diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index d999d01e0026..bf22ba97ea06 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -7,6 +7,11 @@ FROM {{ prefix }}multiarch/debian-debootstrap:arm64-stretch FROM {{ prefix }}debian:buster {% endif %} +{% from "dockers/dockerfile-macros.j2" import install_python_wheels, copy_files %} + +USER root +WORKDIR /root + MAINTAINER Pavel Shirshov RUN echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian buster-backports main" >> /etc/apt/sources.list @@ -51,6 +56,13 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' / python-libpcap \ python-scapy \ python-six \ + python3 \ + python3-venv \ + python3-pip \ + python3-dev \ + python3-scapy \ + python3-six \ + libpcap-dev \ tacacs+ \ rsyslog \ ntp \ @@ -59,7 +71,9 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' / arping \ bridge-utils \ libteam-utils \ - gdb + gdb \ + automake \ + iproute2 # Install all python modules from pypi. python-scapy is exception, ptf debian package requires python-scapy # TODO: Clean up this step @@ -117,10 +131,61 @@ RUN rm -rf /debs \ && pip install pybrctl pyro4 rpyc yabgp \ && pip install unittest-xml-reporting \ && pip install pyrasite \ + && pip install retrying \ && mkdir -p /opt \ && cd /opt \ && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py +RUN python3 -m venv env-python3 + +# Activating a virtualenv. The virtualenv automatically works for RUN, ENV and CMD. +ENV VIRTUAL_ENV=/root/env-python3 +ARG BACKUP_OF_PATH="$PATH" +ENV PATH="$VIRTUAL_ENV/bin:$PATH" + +ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 PYTHONIOENCODING=UTF-8 + +RUN python3 -m pip install --upgrade --ignore-installed pip + +# Install all python modules from pypi. python3-scapy is exception, ptf debian package requires python3-scapy +RUN python3 -m pip install setuptools \ + && pip3 install supervisor \ + && pip3 install ipython==5.4.1 \ + && pip3 install Cython \ + && pip3 install cffi \ + && pip3 install nnpy \ + && pip3 install dpkt \ + && pip3 install ipaddress \ + && pip3 install pysubnettree \ + && pip3 install paramiko \ + && pip3 install Flask \ + && pip3 install exabgp \ + && pip3 install pyaml \ + && pip3 install pybrctl pyro4 rpyc yabgp \ + && pip3 install unittest-xml-reporting \ + && pip3 install pyrasite \ + && pip3 install python-libpcap \ + && pip3 install enum34 \ + && pip3 install grpcio \ + && pip3 install grpcio-tools \ + && pip3 install protobuf \ + && pip3 install six==1.16.0 \ + && pip3 install itsdangerous \ + && pip3 install retrying \ + && pip3 install jinja2 \ + && pip3 install scapy==2.4.5 + +{% if docker_ptf_whls.strip() -%} +# Copy locally-built Python wheel dependencies +{{ copy_files("python-wheels/", docker_ptf_whls.split(' '), "/python-wheels/") }} + +# Install locally-built Python wheel dependencies +{{ install_python_wheels(docker_ptf_whls.split(' ')) }} +{% endif %} + +# Deactivating a virtualenv. +ENV PATH="$BACKUP_OF_PATH" + ## Adjust sshd settings RUN mkdir /var/run/sshd \ && echo 'root:root' | chpasswd \ diff --git a/platform/vs/docker-ptf.mk b/platform/vs/docker-ptf.mk index 445fc8daf4d3..ef102be967f4 100644 --- a/platform/vs/docker-ptf.mk +++ b/platform/vs/docker-ptf.mk @@ -1,6 +1,7 @@ # docker image for docker-ptf DOCKER_PTF = docker-ptf.gz +$(DOCKER_PTF)_PYTHON_WHEELS += $(PTF_PY3) $(DOCKER_PTF)_PATH = $(DOCKERS_PATH)/docker-ptf $(DOCKER_PTF)_DEPENDS += $(LIBTHRIFT) $(PYTHON_THRIFT) $(PTF) $(PYTHON_SAITHRIFT) SONIC_DOCKER_IMAGES += $(DOCKER_PTF) diff --git a/rules/ptf-py3.dep b/rules/ptf-py3.dep new file mode 100644 index 000000000000..eadb32aabdf4 --- /dev/null +++ b/rules/ptf-py3.dep @@ -0,0 +1,11 @@ + +SPATH := $($(PTF_PY3)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/ptf-py3.mk rules/ptf-py3.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) + +$(PTF_PY3)_CACHE_MODE := GIT_CONTENT_SHA +$(PTF_PY3)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(PTF_PY3)_DEP_FILES := $(DEP_FILES) +$(PTF_PY3)_SMDEP_FILES := $(SMDEP_FILES) +$(PTF_PY3)_SMDEP_PATHS := $(SPATH) diff --git a/rules/ptf-py3.mk b/rules/ptf-py3.mk new file mode 100644 index 000000000000..bf583b57b622 --- /dev/null +++ b/rules/ptf-py3.mk @@ -0,0 +1,7 @@ +# ptf package + +PTF_PY3 = ptf-0.9.3-py3-none-any.whl +$(PTF_PY3)_SRC_PATH = $(SRC_PATH)/ptf-py3 +$(PTF_PY3)_PYTHON_VERSION = 3 +$(PTF_PY3)_TEST = n +SONIC_PYTHON_WHEELS += $(PTF_PY3) diff --git a/src/ptf-py3 b/src/ptf-py3 new file mode 160000 index 000000000000..405513bcad2e --- /dev/null +++ b/src/ptf-py3 @@ -0,0 +1 @@ +Subproject commit 405513bcad2eae3092b0ac4ceb31e8dec5e32311 diff --git a/src/ptf-py3.patch/0001-Remove-ord-in-get_mac-to-avoid-TypeError.patch b/src/ptf-py3.patch/0001-Remove-ord-in-get_mac-to-avoid-TypeError.patch new file mode 100644 index 000000000000..cb2b992548a7 --- /dev/null +++ b/src/ptf-py3.patch/0001-Remove-ord-in-get_mac-to-avoid-TypeError.patch @@ -0,0 +1,26 @@ +From a8b13b9fbaa16ddd305ba2df2238ef606ef222a7 Mon Sep 17 00:00:00 2001 +From: Zhaohui Sun +Date: Wed, 13 Apr 2022 09:24:46 +0000 +Subject: [PATCH 1/2] Remove ord in get_mac() to avoid TypeError + +Signed-off-by: Zhaohui Sun +--- + src/ptf/netutils.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/ptf/netutils.py b/src/ptf/netutils.py +index 752e76c..6aabe79 100644 +--- a/src/ptf/netutils.py ++++ b/src/ptf/netutils.py +@@ -54,7 +54,7 @@ def get_if_index(iff): + + + def get_mac(iff): +- return ":".join(["%02x" % ord(char) for char in get_if(iff, SIOCGIFHWADDR)[18:24]]) ++ return ":".join(["%02x" % char for char in get_if(iff, SIOCGIFHWADDR)[18:24]]) + + + def set_promisc(s, iff, val=1): +-- +2.25.1 + diff --git a/src/ptf-py3.patch/0002-Fill-byte-formatted-client-mac-address-in-DHCP-Disco.patch b/src/ptf-py3.patch/0002-Fill-byte-formatted-client-mac-address-in-DHCP-Disco.patch new file mode 100644 index 000000000000..a0582994539e --- /dev/null +++ b/src/ptf-py3.patch/0002-Fill-byte-formatted-client-mac-address-in-DHCP-Disco.patch @@ -0,0 +1,36 @@ +From 6e570e00ea05882d2db1e480ed041ea631bf37da Mon Sep 17 00:00:00 2001 +From: Zhaohui Sun +Date: Wed, 13 Apr 2022 09:25:28 +0000 +Subject: [PATCH 2/2] Fill byte formatted client mac address in DHCP Discover + packet + +Signed-off-by: Zhaohui Sun +--- + src/ptf/testutils.py | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/src/ptf/testutils.py b/src/ptf/testutils.py +index ab67cea..83a9075 100755 +--- a/src/ptf/testutils.py ++++ b/src/ptf/testutils.py +@@ -2712,12 +2712,13 @@ def __dhcp_mac_to_chaddr(mac_addr="00:01:02:03:04:05"): + """ + Private helper function to convert a 6-byte MAC address of form: + '00:01:02:03:04:05' +- into a 16-byte chaddr byte string of form: +- '\x00\x01\x02\x03\x04\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' ++ into a 16-byte chaddr byte of form: ++ b'\x00\x01\x02\x03\x04\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' + + """ +- chaddr = "".join([chr(int(octet, 16)) for octet in mac_addr.split(":")]) +- chaddr += "\x00" * 10 ++ import binascii ++ chaddr = binascii.unhexlify(mac_addr.replace(':', '')) ++ chaddr += b'\x00\x00\x00\x00\x00\x00' + return chaddr + + +-- +2.25.1 + diff --git a/src/ptf-py3.patch/series b/src/ptf-py3.patch/series new file mode 100644 index 000000000000..d18987dd5913 --- /dev/null +++ b/src/ptf-py3.patch/series @@ -0,0 +1,2 @@ +0001-Remove-ord-in-get_mac-to-avoid-TypeError.patch +0002-Fill-byte-formatted-client-mac-address-in-DHCP-Disco.patch \ No newline at end of file From a06f5493b2daa5d35dd5c7d22f342929bb1c72b4 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Tue, 26 Apr 2022 21:12:36 +0800 Subject: [PATCH 10/47] [Submodule]: update submodule for sonic-restapi (#10680) Why I did it Update submodule sonic-restapi e83e0e8 Fix Ctype_char larger than address space issue in 32-bit armhf (#107) --- src/sonic-restapi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-restapi b/src/sonic-restapi index bd97dfeb4b45..e83e0e862cc4 160000 --- a/src/sonic-restapi +++ b/src/sonic-restapi @@ -1 +1 @@ -Subproject commit bd97dfeb4b4564defbc10e521ee05bbfe0638315 +Subproject commit e83e0e862cc4e8a2627eaf79f1461e7d7d9a4e75 From 9d7387a18e15427ed11103fc8d1724b01fbdc324 Mon Sep 17 00:00:00 2001 From: ganglv <88995770+ganglyu@users.noreply.github.com> Date: Wed, 27 Apr 2022 07:14:51 +0800 Subject: [PATCH 11/47] [sonic-host-services]: Fix import and invalid path (#10660) Why I did it Can not start sonic-hostservice How I did it Install python3-dbus and systemd-python, and replace invalid path How to verify it Start the service with below commands: sudo systemctl start sonic-hostservice sudo systemctl status sonic-hostservice Signed-off-by: Gang Lv ganglv@microsoft.com --- files/build_templates/sonic_debian_extension.j2 | 5 ++++- src/sonic-host-services/scripts/sonic-host-server | 15 ++++++++++++--- src/sonic-host-services/setup.py | 1 + 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 924641393c02..c51d6d4543e8 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -233,7 +233,10 @@ sudo cp -f $IMAGE_CONFIGS/bash/bash.bashrc $FILESYSTEM_ROOT/etc/ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install libcairo2-dev libdbus-1-dev libgirepository1.0-dev libsystemd-dev pkg-config # Mark runtime dependencies as manually installed to avoid them being auto-removed while uninstalling build dependencies -sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-mark manual gir1.2-glib-2.0 libdbus-1-3 libgirepository-1.0-1 libsystemd0 +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-mark manual gir1.2-glib-2.0 libdbus-1-3 libgirepository-1.0-1 libsystemd0 python3-dbus + +# Install systemd-python for SONiC host services +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install systemd-python # Install SONiC host services package SONIC_HOST_SERVICES_PY3_WHEEL_NAME=$(basename {{sonic_host_services_py3_wheel_path}}) diff --git a/src/sonic-host-services/scripts/sonic-host-server b/src/sonic-host-services/scripts/sonic-host-server index a9fdc2eb25fd..bf4449e34eda 100755 --- a/src/sonic-host-services/scripts/sonic-host-server +++ b/src/sonic-host-services/scripts/sonic-host-server @@ -13,9 +13,16 @@ import dbus.mainloop.glib from gi.repository import GObject -def register_modules(): +def find_module_path(): + """Find path for host_moduels""" + try: + from host_modules import host_service + return os.path.dirname(host_service.__file__) + except ImportError as e: + return None + +def register_modules(mod_path): """Register all host modules""" - mod_path = '/usr/local/lib/python3.7/dist-packages/host_modules' sys.path.append(mod_path) for mod_file in glob.glob(os.path.join(mod_path, '*.py')): if os.path.isfile(mod_file) and not mod_file.endswith('__init__.py'): @@ -62,7 +69,9 @@ class SignalManager(object): loop.quit() sigmgr = SignalManager() -register_modules() +mod_path = find_module_path() +if mod_path is not None: + register_modules(mod_path) # Only run if we actually have some handlers if handlers: diff --git a/src/sonic-host-services/setup.py b/src/sonic-host-services/setup.py index 8926e960e311..9ed9e1082a0c 100644 --- a/src/sonic-host-services/setup.py +++ b/src/sonic-host-services/setup.py @@ -24,6 +24,7 @@ ], install_requires = [ 'dbus-python', + 'systemd-python', 'Jinja2>=2.10', 'PyGObject', 'sonic-py-common' From 850e45601bc7672462418dea194cee36b04cf811 Mon Sep 17 00:00:00 2001 From: jingwenxie Date: Tue, 26 Apr 2022 17:26:44 -0700 Subject: [PATCH 12/47] Revert "[sonic-cfggen] make minigraph parser fail when speed and lanes are not in PORT table (#10228)" (#10683) This reverts commit cd330f0e70e646c2ff6fc88c6c8fb9f75e8b40e7. --- src/sonic-config-engine/sonic-cfggen | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index b10002c40809..3f0e047f76fa 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -247,19 +247,6 @@ def _get_jinja2_env(paths): return env -def _must_field_by_yang(data, table, must_fields): - """ - Check if table contains must field based on yang definition - """ - if table not in data: - return - - for must_field in must_fields: - for _, fields in data[table].items(): - if must_field not in fields: - print(must_field, 'is a must field in', table, file=sys.stderr) - sys.exit(1) - def main(): parser=argparse.ArgumentParser(description="Render configuration file from minigraph data and jinja2 template.") group = parser.add_mutually_exclusive_group() @@ -354,8 +341,6 @@ def main(): deep_update(data, parse_xml(minigraph, platform, asic_name=asic_name)) else: deep_update(data, parse_xml(minigraph, port_config_file=args.port_config, asic_name=asic_name, hwsku_config_file=args.hwsku_config)) - # check if minigraph parser has speed and lanes in PORT table - _must_field_by_yang(data, 'PORT', ['speed', 'lanes']) if args.device_description is not None: deep_update(data, parse_device_desc_xml(args.device_description)) From 313cced32b713290cbcdcc1645ea41c4474eca50 Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Wed, 27 Apr 2022 13:20:42 -0400 Subject: [PATCH 13/47] Update Docker to 20.10.14 (#10677) * Upgrade docker version from 20.10.7 to 20.10.14, and pin containerd.io Update the Docker engine version from 20.10.7 to 20.10.14. This brings in some CVE and bug fixes. Additionally, pin the version of containerd.io to a specific version, mainly for consistency/reproducibility. Signed-off-by: Saikrishna Arcot * Remove the containerd ordering change to docker.service This appears to be already present in the current docker.service. Signed-off-by: Saikrishna Arcot * Remove use of apt-key apt-key is considered deprecated, and the current practice is to just add the key into /etc/apt/trusted.gpg.d/. Signed-off-by: Saikrishna Arcot * Upgrade docker container in Bullseye slave to 20.10.14 Signed-off-by: Saikrishna Arcot --- build_debian.sh | 16 +++++----------- sonic-slave-bullseye/Dockerfile.j2 | 2 +- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index 43f509b374c2..b8216c629b8d 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -31,7 +31,8 @@ set -x -e CONFIGURED_ARCH=$([ -f .arch ] && cat .arch || echo amd64) ## docker engine version (with platform) -DOCKER_VERSION=5:20.10.7~3-0~debian-$IMAGE_DISTRO +DOCKER_VERSION=5:20.10.14~3-0~debian-$IMAGE_DISTRO +CONTAINERD_IO_VERSION=1.5.11-1 LINUX_KERNEL_VERSION=5.10.0-8-2 ## Working directory to prepare the file system @@ -233,17 +234,12 @@ if [[ $CONFIGURED_ARCH == armhf ]]; then # update ssl ca certificates for secure pem sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT c_rehash fi -sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT curl -o /tmp/docker.gpg -fsSL https://download.docker.com/linux/debian/gpg -sudo LANG=C chroot $FILESYSTEM_ROOT apt-key add /tmp/docker.gpg -sudo LANG=C chroot $FILESYSTEM_ROOT rm /tmp/docker.gpg +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT curl -o /tmp/docker.asc -fsSL https://download.docker.com/linux/debian/gpg +sudo LANG=C chroot $FILESYSTEM_ROOT mv /tmp/docker.asc /etc/apt/trusted.gpg.d/ sudo LANG=C chroot $FILESYSTEM_ROOT add-apt-repository \ "deb [arch=$CONFIGURED_ARCH] https://download.docker.com/linux/debian $IMAGE_DISTRO stable" sudo LANG=C chroot $FILESYSTEM_ROOT apt-get update -if dpkg --compare-versions ${DOCKER_VERSION} ge "18.09"; then - sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install docker-ce=${DOCKER_VERSION} docker-ce-cli=${DOCKER_VERSION} -else - sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install docker-ce=${DOCKER_VERSION} -fi +sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install docker-ce=${DOCKER_VERSION} docker-ce-cli=${DOCKER_VERSION} containerd.io=${CONTAINERD_IO_VERSION} # Uninstall 'python3-gi' installed as part of 'software-properties-common' to remove debian version of 'PyGObject' # pip version of 'PyGObject' will be installed during installation of 'sonic-host-services' @@ -271,8 +267,6 @@ fi sudo mkdir -p $FILESYSTEM_ROOT/etc/systemd/system/docker.service.d/ ## Note: $_ means last argument of last command sudo cp files/docker/docker.service.conf $_ -## Fix systemd race between docker and containerd -sudo sed -i '/After=/s/$/ containerd.service/' $FILESYSTEM_ROOT/lib/systemd/system/docker.service ## Create default user ## Note: user should be in the group with the same name, and also in sudo/docker/redis groups diff --git a/sonic-slave-bullseye/Dockerfile.j2 b/sonic-slave-bullseye/Dockerfile.j2 index 2c3224999a19..3e69075a0d05 100644 --- a/sonic-slave-bullseye/Dockerfile.j2 +++ b/sonic-slave-bullseye/Dockerfile.j2 @@ -504,7 +504,7 @@ RUN add-apt-repository \ $(lsb_release -cs) \ stable" RUN apt-get update -RUN apt-get install -y docker-ce=5:20.10.7~3-0~debian-bullseye docker-ce-cli=5:20.10.7~3-0~debian-bullseye +RUN apt-get install -y docker-ce=5:20.10.14~3-0~debian-bullseye docker-ce-cli=5:20.10.14~3-0~debian-bullseye containerd.io=1.5.11-1 RUN echo "DOCKER_OPTS=\"--experimental --storage-driver=vfs {{ DOCKER_EXTRA_OPTS }}\"" >> /etc/default/docker RUN update-alternatives --set iptables /usr/sbin/iptables-legacy From bc305283417a1c305bce4035547191e1d480c1d5 Mon Sep 17 00:00:00 2001 From: Kalimuthu-Velappan <53821802+Kalimuthu-Velappan@users.noreply.github.com> Date: Thu, 28 Apr 2022 06:09:37 +0530 Subject: [PATCH 14/47] Parallel building of sonic dockers using native dockerd(dood). (#10352) Currently, the build dockers are created as a user dockers(docker-base-stretch-, etc) that are specific to each user. But the sonic dockers (docker-database, docker-swss, etc) are created with a fixed docker name and common to all the users. docker-database:latest docker-swss:latest When multiple builds are triggered on the same build server that creates parallel building issue because all the build jobs are trying to create the same docker with latest tag. This happens only when sonic dockers are built using native host dockerd for sonic docker image creation. This patch creates all sonic dockers as user sonic dockers and then, while saving and loading the user sonic dockers, it rename the user sonic dockers into correct sonic dockers with tag as latest. docker-database:latest <== SAVE/LOAD ==> docker-database-:tag The user sonic docker names are derived from 'DOCKER_USERNAME and DOCKER_USERTAG' make env variable and using Jinja template, it replaces the FROM docker name with correct user sonic docker name for loading and saving the docker image. --- Makefile | 3 +- Makefile.work | 47 ++++++++++- .../Dockerfile.j2 | 2 +- .../docker-config-engine-buster/Dockerfile.j2 | 2 +- .../Dockerfile.j2 | 2 +- dockers/docker-config-engine/Dockerfile.j2 | 2 +- dockers/docker-database/Dockerfile.j2 | 2 +- dockers/docker-dhcp-relay/Dockerfile.j2 | 2 +- dockers/docker-fpm-frr/Dockerfile.j2 | 2 +- dockers/docker-fpm-gobgp/Dockerfile.j2 | 2 +- dockers/docker-iccpd/Dockerfile.j2 | 2 +- dockers/docker-lldp/Dockerfile.j2 | 2 +- dockers/docker-macsec/Dockerfile.j2 | 2 +- dockers/docker-mux/Dockerfile.j2 | 2 +- dockers/docker-nat/Dockerfile.j2 | 2 +- dockers/docker-orchagent/Dockerfile.j2 | 2 +- dockers/docker-pde/Dockerfile.j2 | 2 +- dockers/docker-platform-monitor/Dockerfile.j2 | 2 +- dockers/docker-ptf-sai/Dockerfile.j2 | 2 +- .../docker-router-advertiser/Dockerfile.j2 | 2 +- dockers/docker-sflow/Dockerfile.j2 | 2 +- dockers/docker-snmp/Dockerfile.j2 | 2 +- .../docker-sonic-mgmt-framework/Dockerfile.j2 | 2 +- dockers/docker-sonic-p4rt/Dockerfile.j2 | 2 +- dockers/docker-sonic-restapi/Dockerfile.j2 | 2 +- .../docker-sonic-sdk-buildenv/Dockerfile.j2 | 2 +- dockers/docker-sonic-sdk/Dockerfile.j2 | 2 +- dockers/docker-sonic-telemetry/Dockerfile.j2 | 2 +- .../docker-swss-layer-buster/Dockerfile.j2 | 2 +- dockers/docker-teamd/Dockerfile.j2 | 2 +- .../docker-syncd-bfn-rpc/Dockerfile.j2 | 2 +- .../barefoot/docker-syncd-bfn/Dockerfile.j2 | 2 +- .../docker-saiserver-brcm/Dockerfile.j2 | 2 +- .../docker-syncd-brcm-dnx-rpc/Dockerfile.j2 | 2 +- .../docker-syncd-brcm-dnx/Dockerfile.j2 | 2 +- .../docker-syncd-brcm-rpc/Dockerfile.j2 | 2 +- .../broadcom/docker-syncd-brcm/Dockerfile.j2 | 2 +- .../docker-syncd-cavm-rpc/Dockerfile.j2 | 2 +- .../cavium/docker-syncd-cavm/Dockerfile.j2 | 2 +- .../docker-saiserver-centec/Dockerfile.j2 | 2 +- .../docker-syncd-centec-rpc/Dockerfile.j2 | 2 +- .../docker-syncd-centec/Dockerfile.j2 | 2 +- .../docker-saiserver-centec/Dockerfile.j2 | 2 +- .../docker-syncd-centec-rpc/Dockerfile.j2 | 2 +- .../centec/docker-syncd-centec/Dockerfile.j2 | 2 +- .../docker-gbsyncd-credo/Dockerfile.j2 | 2 +- .../docker-syncd-invm-rpc/Dockerfile.j2 | 2 +- .../innovium/docker-syncd-invm/Dockerfile.j2 | 2 +- .../docker-syncd-mrvl-rpc/Dockerfile.j2 | 2 +- .../docker-syncd-mrvl/Dockerfile.j2 | 2 +- .../docker-syncd-mrvl-rpc/Dockerfile.j2 | 2 +- .../docker-syncd-mrvl/Dockerfile.j2 | 2 +- .../docker-syncd-mrvl-rpc/Dockerfile.j2 | 2 +- .../marvell/docker-syncd-mrvl/Dockerfile.j2 | 2 +- .../docker-saiserver-mlnx/Dockerfile.j2 | 2 +- .../docker-syncd-mlnx-rpc/Dockerfile.j2 | 2 +- .../mellanox/docker-syncd-mlnx/Dockerfile.j2 | 2 +- .../docker-syncd-nephos-rpc/Dockerfile.j2 | 2 +- .../nephos/docker-syncd-nephos/Dockerfile.j2 | 2 +- platform/p4/docker-sonic-p4/Dockerfile.j2 | 2 +- platform/vs/docker-gbsyncd-vs/Dockerfile.j2 | 2 +- platform/vs/docker-sonic-vs/Dockerfile.j2 | 2 +- platform/vs/docker-syncd-vs/Dockerfile.j2 | 2 +- rules/config | 5 +- slave.mk | 84 ++++++++++++++++--- 65 files changed, 185 insertions(+), 76 deletions(-) diff --git a/Makefile b/Makefile index ace13582cbef..af3d7086ec8e 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,7 @@ endif ifeq ($(NOBULLSEYE), 0) BLDENV=bullseye make -f Makefile.work $@ endif + BLDENV=bullseye make -f Makefile.work docker-cleanup jessie: @echo "+++ Making $@ +++" @@ -83,7 +84,7 @@ $(PLATFORM_PATH): configure : $(PLATFORM_PATH) $(call make_work, $@) -clean reset showtag sonic-slave-build sonic-slave-bash : +clean reset showtag docker-cleanup sonic-slave-build sonic-slave-bash : $(call make_work, $@) # Freeze the versions, see more detail options: scripts/versions_manager.py freeze -h diff --git a/Makefile.work b/Makefile.work index a5ecab1ab58b..cc404b9d7184 100644 --- a/Makefile.work +++ b/Makefile.work @@ -90,6 +90,7 @@ $(shell rm -f .screen) MAKEFLAGS += -B CONFIGURED_ARCH := $(shell [ -f .arch ] && cat .arch || echo $(PLATFORM_ARCH)) +CONFIGURED_PLATFORM = $(if $(PLATFORM),$(PLATFORM),$(shell cat .platform 2>/dev/null)) ifeq ($(CONFIGURED_ARCH),) override CONFIGURED_ARCH = amd64 endif @@ -149,7 +150,9 @@ $(shell BUILD_SLAVE=y DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) s # Add the versions in the tag, if the version change, need to rebuild the slave SLAVE_BASE_TAG = $(shell cat $(SLAVE_DIR)/Dockerfile $(SLAVE_DIR)/buildinfo/versions/versions-* src/sonic-build-hooks/hooks/* | sha1sum | awk '{print substr($$1,0,11);}') -SLAVE_TAG = $(shell cat $(SLAVE_DIR)/Dockerfile.user $(SLAVE_DIR)/Dockerfile $(SLAVE_DIR)/buildinfo/versions/versions-* | sha1sum | awk '{print substr($$1,0,11);}') +# Calculate the slave TAG based on $(USER)/$(PWD)/$(CONFIGURED_PLATFORM) to get unique SHA ID +SLAVE_TAG = $(shell (cat $(SLAVE_DIR)/Dockerfile.user $(SLAVE_DIR)/Dockerfile $(SLAVE_DIR)/buildinfo/versions/versions-* .git/HEAD && echo $(USER)/$(PWD)/$(CONFIGURED_PLATFORM)) \ + | sha1sum | awk '{print substr($$1,0,11);}') OVERLAY_MODULE_CHECK := \ lsmod | grep -q "^overlay " &>/dev/null || \ @@ -159,6 +162,14 @@ OVERLAY_MODULE_CHECK := \ BUILD_TIMESTAMP := $(shell date +%Y%m%d\.%H%M%S) +# Create separate Docker lockfiles for saving vs. loading an image. +ifeq ($(DOCKER_LOCKDIR),) +override DOCKER_LOCKDIR := /tmp/docklock +endif +DOCKER_LOCKFILE_SAVE := $(DOCKER_LOCKDIR)/docker_save.lock +$(shell mkdir -m 0777 -p $(DOCKER_LOCKDIR)) +$(shell [ -f $(DOCKER_LOCKFILE_SAVE) ] || (touch $(DOCKER_LOCKFILE_SAVE) && chmod 0777 $(DOCKER_LOCKFILE_SAVE))) + ifeq ($(DOCKER_BUILDER_MOUNT),) override DOCKER_BUILDER_MOUNT := "$(PWD):/sonic" endif @@ -169,6 +180,7 @@ endif DOCKER_RUN := docker run --rm=true --privileged --init \ -v $(DOCKER_BUILDER_MOUNT) \ + -v "$(DOCKER_LOCKDIR):$(DOCKER_LOCKDIR)" \ -w $(DOCKER_BUILDER_WORKDIR) \ -e "http_proxy=$(http_proxy)" \ -e "https_proxy=$(https_proxy)" \ @@ -199,6 +211,30 @@ ifneq ($(SIGNING_CERT),) endif endif +# User name and tag for "docker-*" images created by native dockerd mode. +ifeq ($(strip $(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD)),y) +DOCKER_USERNAME = $(USER_LC) +DOCKER_USERTAG = $(SLAVE_TAG) +else +DOCKER_USERNAME = sonic +DOCKER_USERTAG = latest +endif + +# Define canned sequence to clean up Docker image cache. +# - These are the remnants from building the runtime Docker images using native (host) Docker daemon. +# - Image naming convention differs on a shared build system vs. non-shared. +# $(docker-image-cleanup) +ifeq ($(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD),y) +define docker-image-cleanup + @for i in $(shell docker images --quiet --filter 'dangling=true') ; do (docker rmi -f $$i &> /dev/null || true) ; done + @for i in $(shell docker images --quiet docker-*$(DOCKER_USERNAME):$(DOCKER_USERTAG)) ; do (docker rmi -f $$i &> /dev/null || true) ; done +endef +else +define docker-image-cleanup + @: +endef +endif + ifeq ($(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD), y) ifneq ($(MULTIARCH_QEMU_ENVIRON), y) DOCKER_RUN += -v /var/run/docker.sock:/var/run/docker.sock @@ -274,6 +310,7 @@ SONIC_BUILD_INSTRUCTION := make \ BUILD_NUMBER=$(BUILD_NUMBER) \ BUILD_TIMESTAMP=$(BUILD_TIMESTAMP) \ SONIC_IMAGE_VERSION=$(SONIC_IMAGE_VERSION) \ + SLAVE_TAG=$(SLAVE_TAG) \ ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \ ENABLE_ZTP=$(ENABLE_ZTP) \ INCLUDE_PDE=$(INCLUDE_PDE) \ @@ -298,6 +335,11 @@ SONIC_BUILD_INSTRUCTION := make \ HTTP_PROXY=$(http_proxy) \ HTTPS_PROXY=$(https_proxy) \ NO_PROXY=$(no_proxy) \ + DOCKER_USERNAME=$(DOCKER_USERNAME) \ + DOCKER_USERTAG=$(DOCKER_USERTAG) \ + DOCKER_LOCKDIR=$(DOCKER_LOCKDIR) \ + DOCKER_LOCKFILE_SAVE=$(DOCKER_LOCKFILE_SAVE) \ + SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD=$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) \ SONIC_INCLUDE_SYSTEM_TELEMETRY=$(INCLUDE_SYSTEM_TELEMETRY) \ INCLUDE_DHCP_RELAY=$(INCLUDE_DHCP_RELAY) \ SONIC_INCLUDE_RESTAPI=$(INCLUDE_RESTAPI) \ @@ -352,6 +394,9 @@ else @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; scripts/collect_build_version_files.sh \$$?" endif +docker-cleanup: + $(docker-image-cleanup) + sonic-build-hooks: @pushd src/sonic-build-hooks; TRUSTED_GPG_URLS=$(TRUSTED_GPG_URLS) make all; popd @cp src/sonic-build-hooks/buildinfo/sonic-build-hooks* $(SLAVE_DIR)/buildinfo diff --git a/dockers/docker-config-engine-bullseye/Dockerfile.j2 b/dockers/docker-config-engine-bullseye/Dockerfile.j2 index 9d0ca97c7604..f7e0de09b9f6 100644 --- a/dockers/docker-config-engine-bullseye/Dockerfile.j2 +++ b/dockers/docker-config-engine-bullseye/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-base-bullseye +FROM docker-base-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-config-engine-buster/Dockerfile.j2 b/dockers/docker-config-engine-buster/Dockerfile.j2 index 1e7a64bfcd36..77ea27e00ee3 100644 --- a/dockers/docker-config-engine-buster/Dockerfile.j2 +++ b/dockers/docker-config-engine-buster/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-base-buster +FROM docker-base-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-config-engine-stretch/Dockerfile.j2 b/dockers/docker-config-engine-stretch/Dockerfile.j2 index 813f41bc296b..a0d5eaedde49 100644 --- a/dockers/docker-config-engine-stretch/Dockerfile.j2 +++ b/dockers/docker-config-engine-stretch/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-base-stretch +FROM docker-base-stretch:-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-config-engine/Dockerfile.j2 b/dockers/docker-config-engine/Dockerfile.j2 index 8790ba67d7f9..ccc4290b951b 100644 --- a/dockers/docker-config-engine/Dockerfile.j2 +++ b/dockers/docker-config-engine/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-base +FROM docker-base-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index f75d258222a0..e1aa3c4bcd7f 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-bullseye +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 index f214edc8516c..9a5eb23c38a4 100644 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-bullseye +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ARG image_version diff --git a/dockers/docker-fpm-frr/Dockerfile.j2 b/dockers/docker-fpm-frr/Dockerfile.j2 index f392d4d3a7a6..f885180c37d4 100644 --- a/dockers/docker-fpm-frr/Dockerfile.j2 +++ b/dockers/docker-fpm-frr/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-swss-layer-buster +FROM docker-swss-layer-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ARG frr_user_uid diff --git a/dockers/docker-fpm-gobgp/Dockerfile.j2 b/dockers/docker-fpm-gobgp/Dockerfile.j2 index 65b104e43b26..89f7e9a92a9e 100644 --- a/dockers/docker-fpm-gobgp/Dockerfile.j2 +++ b/dockers/docker-fpm-gobgp/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-fpm-quagga +FROM docker-fpm-quagga-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-iccpd/Dockerfile.j2 b/dockers/docker-iccpd/Dockerfile.j2 index 51cc306bdd55..95a55159e496 100644 --- a/dockers/docker-iccpd/Dockerfile.j2 +++ b/dockers/docker-iccpd/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/dockers/docker-lldp/Dockerfile.j2 b/dockers/docker-lldp/Dockerfile.j2 index a1c7a1c1bee2..496af3e11601 100644 --- a/dockers/docker-lldp/Dockerfile.j2 +++ b/dockers/docker-lldp/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ARG image_version diff --git a/dockers/docker-macsec/Dockerfile.j2 b/dockers/docker-macsec/Dockerfile.j2 index 586983533e77..481e79aa02d0 100644 --- a/dockers/docker-macsec/Dockerfile.j2 +++ b/dockers/docker-macsec/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-bullseye +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/dockers/docker-mux/Dockerfile.j2 b/dockers/docker-mux/Dockerfile.j2 index f7e1ee3b4454..06e89c3ecf2d 100755 --- a/dockers/docker-mux/Dockerfile.j2 +++ b/dockers/docker-mux/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-bullseye +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/dockers/docker-nat/Dockerfile.j2 b/dockers/docker-nat/Dockerfile.j2 index 066de0a70ed0..04b2883551c3 100644 --- a/dockers/docker-nat/Dockerfile.j2 +++ b/dockers/docker-nat/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, copy_files %} -FROM docker-swss-layer-buster +FROM docker-swss-layer-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index ea4e0abbc2ef..adb084cf2271 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-swss-layer-buster +FROM docker-swss-layer-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/dockers/docker-pde/Dockerfile.j2 b/dockers/docker-pde/Dockerfile.j2 index 0711e563c259..a6e7e62c8647 100644 --- a/dockers/docker-pde/Dockerfile.j2 +++ b/dockers/docker-pde/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM {{ docker_pde_load_image }} +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ENV PYTHONPATH=/usr/share/sonic/platform diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index 4f5e941dd92a..739933aaf1e5 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ARG image_version diff --git a/dockers/docker-ptf-sai/Dockerfile.j2 b/dockers/docker-ptf-sai/Dockerfile.j2 index 1e284bd368ea..d68b39abb01e 100644 --- a/dockers/docker-ptf-sai/Dockerfile.j2 +++ b/dockers/docker-ptf-sai/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-ptf +FROM docker-ptf-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} # 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 44e2430077cb..d36eb7efe8b1 100644 --- a/dockers/docker-router-advertiser/Dockerfile.j2 +++ b/dockers/docker-router-advertiser/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-bullseye +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ARG image_version diff --git a/dockers/docker-sflow/Dockerfile.j2 b/dockers/docker-sflow/Dockerfile.j2 index c8d0757d5fc5..eb97f5708bf7 100644 --- a/dockers/docker-sflow/Dockerfile.j2 +++ b/dockers/docker-sflow/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-swss-layer-buster +FROM docker-swss-layer-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/dockers/docker-snmp/Dockerfile.j2 b/dockers/docker-snmp/Dockerfile.j2 index 528189c2014f..944a8ed41385 100644 --- a/dockers/docker-snmp/Dockerfile.j2 +++ b/dockers/docker-snmp/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python3_wheels, copy_files %} -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ARG image_version diff --git a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 index 937c5368483a..823a2c7ff4bf 100644 --- a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/dockers/docker-sonic-p4rt/Dockerfile.j2 b/dockers/docker-sonic-p4rt/Dockerfile.j2 index 8708518340c8..13713980e1e7 100644 --- a/dockers/docker-sonic-p4rt/Dockerfile.j2 +++ b/dockers/docker-sonic-p4rt/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-bullseye +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ARG git_commit diff --git a/dockers/docker-sonic-restapi/Dockerfile.j2 b/dockers/docker-sonic-restapi/Dockerfile.j2 index 43bc86ee6b68..029f5ec813d7 100644 --- a/dockers/docker-sonic-restapi/Dockerfile.j2 +++ b/dockers/docker-sonic-restapi/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-bullseye +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/dockers/docker-sonic-sdk-buildenv/Dockerfile.j2 b/dockers/docker-sonic-sdk-buildenv/Dockerfile.j2 index 27fa08ec5b7a..ce18bb54f37f 100755 --- a/dockers/docker-sonic-sdk-buildenv/Dockerfile.j2 +++ b/dockers/docker-sonic-sdk-buildenv/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM sonic-sdk +FROM sonic-sdk-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG base_os_version ARG docker_database_version diff --git a/dockers/docker-sonic-sdk/Dockerfile.j2 b/dockers/docker-sonic-sdk/Dockerfile.j2 index 4218a9b702a9..dc28822cfd26 100755 --- a/dockers/docker-sonic-sdk/Dockerfile.j2 +++ b/dockers/docker-sonic-sdk/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-sonic-telemetry/Dockerfile.j2 b/dockers/docker-sonic-telemetry/Dockerfile.j2 index a7a45ab48c22..e9b01f751b85 100644 --- a/dockers/docker-sonic-telemetry/Dockerfile.j2 +++ b/dockers/docker-sonic-telemetry/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-bullseye +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ARG image_version diff --git a/dockers/docker-swss-layer-buster/Dockerfile.j2 b/dockers/docker-swss-layer-buster/Dockerfile.j2 index e8dcb9472a26..36f085936dcf 100644 --- a/dockers/docker-swss-layer-buster/Dockerfile.j2 +++ b/dockers/docker-swss-layer-buster/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index e02000abb1c6..7bcafb60cff0 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-swss-layer-buster +FROM docker-swss-layer-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/barefoot/docker-syncd-bfn-rpc/Dockerfile.j2 b/platform/barefoot/docker-syncd-bfn-rpc/Dockerfile.j2 index 5e5f5f166e5e..e520c55f9c39 100644 --- a/platform/barefoot/docker-syncd-bfn-rpc/Dockerfile.j2 +++ b/platform/barefoot/docker-syncd-bfn-rpc/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-syncd-bfn +FROM docker-syncd-bfn-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 b/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 index e085ef130aed..8fa30bc29874 100755 --- a/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 +++ b/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name diff --git a/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 b/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 index 2fe765febcf3..d77eb46b6aa3 100644 --- a/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages %} -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/broadcom/docker-syncd-brcm-dnx-rpc/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm-dnx-rpc/Dockerfile.j2 index b2af1d98a33d..c476f2823211 100644 --- a/platform/broadcom/docker-syncd-brcm-dnx-rpc/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm-dnx-rpc/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-syncd-brcm-dnx +FROM docker-syncd-brcm-dnx-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/broadcom/docker-syncd-brcm-dnx/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm-dnx/Dockerfile.j2 index e0085b42f4de..95d3db54b11e 100755 --- a/platform/broadcom/docker-syncd-brcm-dnx/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm-dnx/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages %} -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name diff --git a/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 index b832fd58864f..6e5a3d6dadc5 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-syncd-brcm +FROM docker-syncd-brcm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## 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 a70e91bb60b8..e8f9c8c86a97 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages %} -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name diff --git a/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 index e9e9facef5ee..3c962f5da984 100644 --- a/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-syncd-cavm +FROM docker-syncd-cavm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## 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 8ac883e6293d..f60fa0fe5797 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine +FROM docker-config-engine-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name diff --git a/platform/centec-arm64/docker-saiserver-centec/Dockerfile.j2 b/platform/centec-arm64/docker-saiserver-centec/Dockerfile.j2 index 264c8437973d..33941235bf90 100644 --- a/platform/centec-arm64/docker-saiserver-centec/Dockerfile.j2 +++ b/platform/centec-arm64/docker-saiserver-centec/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/centec-arm64/docker-syncd-centec-rpc/Dockerfile.j2 b/platform/centec-arm64/docker-syncd-centec-rpc/Dockerfile.j2 index a760c278396a..cfb888b9e5c4 100755 --- a/platform/centec-arm64/docker-syncd-centec-rpc/Dockerfile.j2 +++ b/platform/centec-arm64/docker-syncd-centec-rpc/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-syncd-centec +FROM docker-syncd-centec-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 b/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 index 7f89c0c98698..046de960cd20 100755 --- a/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name diff --git a/platform/centec/docker-saiserver-centec/Dockerfile.j2 b/platform/centec/docker-saiserver-centec/Dockerfile.j2 index 264c8437973d..33941235bf90 100644 --- a/platform/centec/docker-saiserver-centec/Dockerfile.j2 +++ b/platform/centec/docker-saiserver-centec/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 b/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 index a760c278396a..cfb888b9e5c4 100644 --- a/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-syncd-centec +FROM docker-syncd-centec-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## 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 001e944bb85a..c1d122eeb9a0 100755 --- a/platform/centec/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name diff --git a/platform/components/docker-gbsyncd-credo/Dockerfile.j2 b/platform/components/docker-gbsyncd-credo/Dockerfile.j2 index 1b9631707cb6..98717c31e057 100644 --- a/platform/components/docker-gbsyncd-credo/Dockerfile.j2 +++ b/platform/components/docker-gbsyncd-credo/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 b/platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 index eea52e3398b8..33726548d008 100755 --- a/platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 +++ b/platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-syncd-invm +FROM docker-syncd-invm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/innovium/docker-syncd-invm/Dockerfile.j2 b/platform/innovium/docker-syncd-invm/Dockerfile.j2 index 4bdc7a6ebef1..a3fd750d86da 100755 --- a/platform/innovium/docker-syncd-invm/Dockerfile.j2 +++ b/platform/innovium/docker-syncd-invm/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine-stretch +FROM docker-config-engine-stretch-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name diff --git a/platform/marvell-arm64/docker-syncd-mrvl-rpc/Dockerfile.j2 b/platform/marvell-arm64/docker-syncd-mrvl-rpc/Dockerfile.j2 index 118be5e1c5f2..68670343bf37 100644 --- a/platform/marvell-arm64/docker-syncd-mrvl-rpc/Dockerfile.j2 +++ b/platform/marvell-arm64/docker-syncd-mrvl-rpc/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-syncd-mrvl +FROM docker-syncd-mrvl-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 index b13346cd70c6..7ec04c49fc4b 100755 --- a/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages %} -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name diff --git a/platform/marvell-armhf/docker-syncd-mrvl-rpc/Dockerfile.j2 b/platform/marvell-armhf/docker-syncd-mrvl-rpc/Dockerfile.j2 index 118be5e1c5f2..68670343bf37 100644 --- a/platform/marvell-armhf/docker-syncd-mrvl-rpc/Dockerfile.j2 +++ b/platform/marvell-armhf/docker-syncd-mrvl-rpc/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-syncd-mrvl +FROM docker-syncd-mrvl-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 index b13346cd70c6..7ec04c49fc4b 100755 --- a/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages %} -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name diff --git a/platform/marvell/docker-syncd-mrvl-rpc/Dockerfile.j2 b/platform/marvell/docker-syncd-mrvl-rpc/Dockerfile.j2 index 118be5e1c5f2..68670343bf37 100644 --- a/platform/marvell/docker-syncd-mrvl-rpc/Dockerfile.j2 +++ b/platform/marvell/docker-syncd-mrvl-rpc/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-syncd-mrvl +FROM docker-syncd-mrvl-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## 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 cd9019febe4a..cb2f7eadb911 100755 --- a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages %} -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name diff --git a/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 b/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 index b356f145c9a4..7ad0355886e3 100644 --- a/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 @@ -15,7 +15,7 @@ ## limitations under the License. ## {% from "dockers/dockerfile-macros.j2" import install_debian_packages %} -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 index 50850039c01d..0c93e327d3c5 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 @@ -15,7 +15,7 @@ ## limitations under the License. ## {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-syncd-mlnx +FROM docker-syncd-mlnx-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## 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 386f00e3fe31..e3487c058b58 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -15,7 +15,7 @@ ## limitations under the License. ## {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name diff --git a/platform/nephos/docker-syncd-nephos-rpc/Dockerfile.j2 b/platform/nephos/docker-syncd-nephos-rpc/Dockerfile.j2 index 6c63efb69bb6..3f09bd7524f5 100644 --- a/platform/nephos/docker-syncd-nephos-rpc/Dockerfile.j2 +++ b/platform/nephos/docker-syncd-nephos-rpc/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-syncd-nephos +FROM docker-syncd-nephos-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## 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 3c7ffa1e49c5..5077db796628 100755 --- a/platform/nephos/docker-syncd-nephos/Dockerfile.j2 +++ b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine-stretch +FROM docker-config-engine-stretch-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name diff --git a/platform/p4/docker-sonic-p4/Dockerfile.j2 b/platform/p4/docker-sonic-p4/Dockerfile.j2 index 90ff15472248..e77781223dc1 100644 --- a/platform/p4/docker-sonic-p4/Dockerfile.j2 +++ b/platform/p4/docker-sonic-p4/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine +FROM docker-config-engine-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 b/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 index a9e7f6f53d2c..08956a44ce77 100644 --- a/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index cc867e3d0eeb..e0edc4b4bac2 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/vs/docker-syncd-vs/Dockerfile.j2 b/platform/vs/docker-syncd-vs/Dockerfile.j2 index 78b01690ec10..dd6bc2d0f71e 100644 --- a/platform/vs/docker-syncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-syncd-vs/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine-buster +FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name diff --git a/rules/config b/rules/config index c51fcd84832c..348c23b17cb3 100644 --- a/rules/config +++ b/rules/config @@ -29,7 +29,10 @@ DEFAULT_BUILD_LOG_TIMESTAMP = none # SONIC_USE_DOCKER_BUILDKIT = y # SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD - use native dockerd for build. -# If set to y SONiC build container will use native dockerd instead of dind for faster build +# If set to y SONiC build container will use native dockerd instead of dind for faster build. +# Special handling of the docker image file names is needed to avoid conflicts with +# other SONiC build jobs on the same server. This requires changes to the Dockerfile.j2 FROM statement +# in the dockers/ and platform/ subdirs to use a variable reference instead of an explicit image name. # SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD = y # SONIC_CONFIG_ENABLE_COLORS - enable colored output in build system. diff --git a/slave.mk b/slave.mk index a68a08fcd56a..e43fe9d5b3fe 100644 --- a/slave.mk +++ b/slave.mk @@ -241,6 +241,10 @@ ifeq ($(SONIC_BUILD_JOBS),) override SONIC_BUILD_JOBS := $(SONIC_CONFIG_BUILD_JOBS) endif +DOCKER_IMAGE_REF = $*-$(DOCKER_USERNAME):$(DOCKER_USERTAG) +DOCKER_DBG_IMAGE_REF = $*-$(DBG_IMAGE_MARK)-$(DOCKER_USERNAME):$(DOCKER_USERTAG) +export DOCKER_USERNAME DOCKER_USERTAG + ifeq ($(VS_PREPARE_MEM),) override VS_PREPARE_MEM := $(DEFAULT_VS_PREPARE_MEM) endif @@ -286,6 +290,7 @@ $(info "CONFIGURED_ARCH" : "$(if $(PLATFORM_ARCH),$(PLATFORM_ARC $(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 "USE_NATIVE_DOCKERD_FOR_BUILD" : "$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD)") $(info "SONIC_USE_DOCKER_BUILDKIT" : "$(SONIC_USE_DOCKER_BUILDKIT)") $(info "USERNAME" : "$(USERNAME)") $(info "PASSWORD" : "$(PASSWORD)") @@ -361,6 +366,60 @@ endif export kernel_procure_method=$(KERNEL_PROCURE_METHOD) export vs_build_prepare_mem=$(VS_PREPARE_MEM) +############################################################################### +## Canned sequences +############################################################################### +## When multiple builds are triggered on the same build server that causes the docker image naming problem because +## all the build jobs are trying to create the same docker image with latest as tag. +## This happens only when sonic docker images are built using native host dockerd. +## +## docker-swss:latest <=SAVE/LOAD=> docker-swss-: + +# $(call docker-image-save,from,to) +# Sonic docker images are always created with username as extension. During the save operation, +# it removes the username extension from docker image and saved them as compressed tar file for SONiC image generation. +# The save operation is protected with lock for parallel build. +# +# $(1) => Docker name +# $(2) => Docker target name + +define docker-image-save + @echo "Attempting docker image lock for $(1) save" $(LOG) + $(call MOD_LOCK,$(1),$(DOCKER_LOCKDIR),$(DOCKER_LOCKFILE_SUFFIX),$(DOCKER_LOCKFILE_TIMEOUT)) + @echo "Obtained docker image lock for $(1) save" $(LOG) + @echo "Tagging docker image $(1)-$(DOCKER_USERNAME):$(DOCKER_USERTAG) as $(1):latest" $(LOG) + docker tag $(1)-$(DOCKER_USERNAME):$(DOCKER_USERTAG) $(1):latest $(LOG) + @echo "Saving docker image $(1):latest" $(LOG) + docker save $(1):latest | gzip -c > $(2) + @echo "Removing docker image $(1):latest" $(LOG) + docker rmi -f $(1):latest $(LOG) + $(call MOD_UNLOCK,$(1)) + @echo "Released docker image lock for $(1) save" $(LOG) + @echo "Removing docker image $(1)-$(DOCKER_USERNAME):$(DOCKER_USERTAG)" $(LOG) + docker rmi -f $(1)-$(DOCKER_USERNAME):$(DOCKER_USERTAG) $(LOG) +endef + +# $(call docker-image-load,from) +# Sonic docker images are always created with username as extension. During the load operation, +# it loads the docker image from compressed tar file and tag them with username as extension. +# The load operation is protected with lock for parallel build. +# +# $(1) => Docker name +# $(2) => Docker target name +define docker-image-load + @echo "Attempting docker image lock for $(1) load" $(LOG) + $(call MOD_LOCK,$(1),$(DOCKER_LOCKDIR),$(DOCKER_LOCKFILE_SUFFIX),$(DOCKER_LOCKFILE_TIMEOUT)) + @echo "Obtained docker image lock for $(1) load" $(LOG) + @echo "Loading docker image $(TARGET_PATH)/$(1).gz" $(LOG) + docker load -i $(TARGET_PATH)/$(1).gz $(LOG) + @echo "Tagging docker image $(1):latest as $(1)-$(DOCKER_USERNAME):$(DOCKER_USERTAG)" $(LOG) + docker tag $(1):latest $(1)-$(DOCKER_USERNAME):$(DOCKER_USERTAG) $(LOG) + @echo "Removing docker image $(1):latest" $(LOG) + docker rmi -f $(1):latest $(LOG) + $(call MOD_UNLOCK,$(1)) + @echo "Released docker image lock for $(1) load" $(LOG) +endef + ############################################################################### ## Local targets ############################################################################### @@ -752,9 +811,9 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.g --build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \ --label Tag=$(SONIC_IMAGE_VERSION) \ -f $(TARGET_DOCKERFILE)/Dockerfile.buildinfo \ - -t $* $($*.gz_PATH) $(LOG) - scripts/collect_docker_version_files.sh $* $(TARGET_PATH) - docker save $* | gzip -c > $@ + -t $(DOCKER_IMAGE_REF) $($*.gz_PATH) $(LOG) + scripts/collect_docker_version_files.sh $(DOCKER_IMAGE_REF) $(TARGET_PATH) + $(call docker-image-save,$*,$@) # Clean up if [ -f $($*.gz_PATH).patch/series ]; then pushd $($*.gz_PATH) && quilt pop -a -f; [ -d .pc ] && rm -rf .pc; popd; fi $(FOOTER) @@ -871,9 +930,9 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform --label com.azure.sonic.manifest="$$(cat $($*.gz_PATH)/manifest.json)" \ --label Tag=$(SONIC_IMAGE_VERSION) \ $($(subst -,_,$(notdir $($*.gz_PATH)))_labels) \ - -t $* $($*.gz_PATH) $(LOG) - scripts/collect_docker_version_files.sh $* $(TARGET_PATH) - docker save $* | gzip -c > $@ + -t $(DOCKER_IMAGE_REF) $($*.gz_PATH) $(LOG) + scripts/collect_docker_version_files.sh $(DOCKER_IMAGE_REF) $(TARGET_PATH) + $(call docker-image-save,$*,$@) # Clean up if [ -f $($*.gz_PATH).patch/series ]; then pushd $($*.gz_PATH) && quilt pop -a -f; [ -d .pc ] && rm -rf .pc; popd; fi @@ -885,7 +944,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform SONIC_TARGET_LIST += $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) -# Targets for building docker images +# Targets for building docker debug images $(addprefix $(TARGET_PATH)/, $(DOCKER_DBG_IMAGES)) : $(TARGET_PATH)/%-$(DBG_IMAGE_MARK).gz : .platform docker-start \ $$(addprefix $(TARGET_PATH)/,$$($$*.gz_AFTER)) \ $$(addprefix $$($$*.gz_DEBS_PATH)/,$$($$*.gz_DBG_DEPENDS)) \ @@ -905,7 +964,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_DBG_IMAGES)) : $(TARGET_PATH)/%-$(DBG_IMAG $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbg_debs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_DEPENDS),RDEPENDS))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_image_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_IMAGE_PACKAGES)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbg_pkgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_APT_PACKAGES),RDEPENDS))\n" | awk '!a[$$0]++')) - ./build_debug_docker_j2.sh $* $(subst -,_,$(notdir $($*.gz_PATH)))_dbg_debs $(subst -,_,$(notdir $($*.gz_PATH)))_image_dbgs > $($*.gz_PATH)/Dockerfile-dbg.j2 + ./build_debug_docker_j2.sh $(DOCKER_IMAGE_REF) $(subst -,_,$(notdir $($*.gz_PATH)))_dbg_debs $(subst -,_,$(notdir $($*.gz_PATH)))_image_dbgs > $($*.gz_PATH)/Dockerfile-dbg.j2 j2 $($*.gz_PATH)/Dockerfile-dbg.j2 > $($*.gz_PATH)/Dockerfile-dbg $(call generate_manifest,$*,dbg) # Prepare docker build info @@ -923,10 +982,11 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_DBG_IMAGES)) : $(TARGET_PATH)/%-$(DBG_IMAG --label com.azure.sonic.manifest="$$(cat $($*.gz_PATH)/manifest.json)" \ --label Tag=$(SONIC_IMAGE_VERSION) \ --file $($*.gz_PATH)/Dockerfile-dbg \ - -t $*-dbg $($*.gz_PATH) $(LOG) - scripts/collect_docker_version_files.sh $*-dbg $(TARGET_PATH) - docker save $*-dbg | gzip -c > $@ + -t $(DOCKER_DBG_IMAGE_REF) $($*.gz_PATH) $(LOG) + scripts/collect_docker_version_files.sh $(DOCKER_DBG_IMAGE_REF) $(TARGET_PATH) + $(call docker-image-save,$*-$(DBG_IMAGE_MARK),$@) # Clean up + docker rmi -f $(DOCKER_IMAGE_REF) &> /dev/null || true if [ -f $($*.gz_PATH).patch/series ]; then pushd $($*.gz_PATH) && quilt pop -a -f; [ -d .pc ] && rm -rf .pc; popd; fi # Save the target deb into DPKG cache @@ -952,7 +1012,7 @@ endif $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TARGET_PATH)/$$*.gz $(HEADER) - docker load -i $(TARGET_PATH)/$*.gz $(LOG) + $(call docker-image-load,$*) $(FOOTER) ############################################################################### From 1d84e0d7df0054b80c9958289bd97897d8c869c0 Mon Sep 17 00:00:00 2001 From: shlomibitton <60430976+shlomibitton@users.noreply.github.com> Date: Thu, 28 Apr 2022 10:35:14 +0300 Subject: [PATCH 15/47] [Fastboot] Delay LLDP service for better fastboot performance (#10568) - Why I did it Profiling the system state on init after fast-reboot during create_switch function execution, it is possible to see few python scripts running at the same time. This parallel execution consume CPU time and the duration of create_switch is longer than it should be. Following this finding, and the motivation to ensure these services will not interfere in the future, LLDP is delayed in 90 seconds until the system finish the init flow after fastboot. - How I did it Add a timer for LLDP service. Copy the timer file to the host bin image. - How to verify it Run fast-reboot on MLNX platform and observe faster create_switch execution time. This PR is dependent on PR: #10567 --- files/build_templates/init_cfg.json.j2 | 4 +-- files/build_templates/lldp.timer.j2 | 1 + .../per_namespace/lldp.service.j2 | 3 -- .../per_namespace/lldp.timer.j2 | 12 +++++++ .../build_templates/sonic_debian_extension.j2 | 15 ++++++++- files/scripts/syncd.sh | 13 ++++++-- slave.mk | 31 +++++++++++++++++++ 7 files changed, 70 insertions(+), 9 deletions(-) create mode 120000 files/build_templates/lldp.timer.j2 create mode 100644 files/build_templates/per_namespace/lldp.timer.j2 diff --git a/files/build_templates/init_cfg.json.j2 b/files/build_templates/init_cfg.json.j2 index a7f1e54a4e15..31249abd5823 100644 --- a/files/build_templates/init_cfg.json.j2 +++ b/files/build_templates/init_cfg.json.j2 @@ -29,7 +29,7 @@ }, {%- set features = [("bgp", "enabled", false, "enabled"), ("database", "always_enabled", false, "always_enabled"), - ("lldp", "enabled", false, "enabled"), + ("lldp", "enabled", true, "enabled"), ("pmon", "enabled", false, "enabled"), ("radv", "enabled", false, "enabled"), ("snmp", "enabled", true, "enabled"), @@ -83,6 +83,6 @@ "state" : "disabled", {% endif %} "rate_limit_interval" : "600" }{%if not loop.last %},{% endif -%} -{% endfor %} +{% endfor %} } } diff --git a/files/build_templates/lldp.timer.j2 b/files/build_templates/lldp.timer.j2 new file mode 120000 index 000000000000..8e6950d6f3bc --- /dev/null +++ b/files/build_templates/lldp.timer.j2 @@ -0,0 +1 @@ +per_namespace/lldp.timer.j2 \ No newline at end of file diff --git a/files/build_templates/per_namespace/lldp.service.j2 b/files/build_templates/per_namespace/lldp.service.j2 index 02ab99dca463..d23abc0a127a 100644 --- a/files/build_templates/per_namespace/lldp.service.j2 +++ b/files/build_templates/per_namespace/lldp.service.j2 @@ -20,6 +20,3 @@ ExecStartPre=/usr/local/bin/{{docker_container_name}}.sh start{% if multi_instan ExecStart=/usr/local/bin/{{docker_container_name}}.sh wait{% if multi_instance == 'true' %} %i{% endif %} ExecStop=/usr/local/bin/{{docker_container_name}}.sh stop{% if multi_instance == 'true' %} %i{% endif %} RestartSec=30 - -[Install] -WantedBy=sonic.target diff --git a/files/build_templates/per_namespace/lldp.timer.j2 b/files/build_templates/per_namespace/lldp.timer.j2 new file mode 100644 index 000000000000..67622a32851b --- /dev/null +++ b/files/build_templates/per_namespace/lldp.timer.j2 @@ -0,0 +1,12 @@ +[Unit] +# This delay is for fast/warm reboot performance +Description=Delays LLDP docker until SONiC has started +PartOf=lldp{% if multi_instance == 'true' %}@%i{% endif %}.service + +[Timer] +OnUnitActiveSec=0 sec +OnBootSec=1min 30 sec +Unit=lldp{% if multi_instance == 'true' %}@%i{% endif %}.service + +[Install] +WantedBy=timers.target sonic.target sonic-delayed.target diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index c51d6d4543e8..0cdabf7cfaaa 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -655,7 +655,7 @@ fi ## ensure proc is mounted sudo mount proc /proc -t proc || true if [[ $CONFIGURED_ARCH == armhf ]]; then - # A workaround to fix the armhf build hung issue, caused by sonic-platform-nokia-7215_1.0_armhf.deb post installation script + # A workaround to fix the armhf build hung issue, caused by sonic-platform-nokia-7215_1.0_armhf.deb post installation script ps -eo pid,cmd | grep python | grep "/etc/entropy.py" | awk '{print $1}' | xargs sudo kill -9 2>/dev/null || true fi @@ -774,6 +774,19 @@ if [ -f {{service}} ]; then echo "{{service}}" | sudo tee -a $GENERATED_SERVICE_FILE fi {% endfor %} +{% for timer in installer_timers.split(' ') -%} +if [ -f {{timer}} ]; then + sudo cp {{timer}} $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM + + {% if "@" in timer %} + MULTI_INSTANCE="{{timer}}" + SINGLE_INSTANCE=${MULTI_INSTANCE/"@"} + sudo cp $SINGLE_INSTANCE $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM + {% endif %} + + echo "{{timer}}" | sudo tee -a $GENERATED_SERVICE_FILE +fi +{% endfor %} if [ -f iccpd.service ]; then sudo LANG=C chroot $FILESYSTEM_ROOT systemctl disable iccpd.service fi diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index 889495e8c50a..83f99d70d7e8 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -44,12 +44,19 @@ function startplatform() { } function waitplatform() { - + if [[ x"$sonic_asic_platform" == x"mellanox" ]]; then debug "Starting pmon service..." /bin/systemctl start pmon debug "Started pmon service" fi + if [[ x"$BOOT_TYPE" = @(x"fast"|x"warm"|x"fastfast") ]]; then + debug "LLDP service is delayed by a timer for better fast/warm boot performance" + else + debug "Starting lldp service..." + /bin/systemctl start lldp + debug "Started lldp service" + fi } function stopplatform1() { @@ -64,7 +71,7 @@ function stopplatform1() { debug "${TYPE} shutdown syncd process ..." /usr/bin/docker exec -i syncd$DEV /usr/bin/syncd_request_shutdown --${TYPE} - # wait until syncd quits gracefully or force syncd to exit after + # wait until syncd quits gracefully or force syncd to exit after # waiting for 20 seconds start_in_secs=${SECONDS} end_in_secs=${SECONDS} @@ -76,7 +83,7 @@ function stopplatform1() { done if [[ $((end_in_secs - start_in_secs)) -gt $timer_threshold ]]; then - debug "syncd process in container syncd$DEV did not exit gracefully" + debug "syncd process in container syncd$DEV did not exit gracefully" fi /usr/bin/docker exec -i syncd$DEV /bin/sync diff --git a/slave.mk b/slave.mk index e43fe9d5b3fe..7342870ac2a7 100644 --- a/slave.mk +++ b/slave.mk @@ -1162,6 +1162,14 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(eval $(docker:-dbg.gz=.gz)_GLOBAL = yes) ) fi + if [ -f files/build_templates/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 ]; then + j2 files/build_templates/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 > $($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer + + # Set the flag GLOBAL_TIMER for all the global system-wide dockers timers. + $(if $(shell ls files/build_templates/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 2>/dev/null),\ + $(eval $(docker:-dbg.gz=.gz)_GLOBAL_TIMER = yes) + ) + fi # Any service template, inside instance directory, will be used to generate .service and @.service file. if [ -f files/build_templates/per_namespace/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).service.j2 ]; then export multi_instance="true" @@ -1172,6 +1180,16 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export multi_instance="false" j2 files/build_templates/per_namespace/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).service.j2 > $($(docker:-dbg.gz=.gz)_CONTAINER_NAME).service fi + # Any timer template, inside instance directory, will be used to generate .timer and @.timer file. + if [ -f files/build_templates/per_namespace/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 ]; then + export multi_instance="true" + j2 files/build_templates/per_namespace/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 > $($(docker:-dbg.gz=.gz)_CONTAINER_NAME)@.timer + $(if $(shell ls files/build_templates/per_namespace/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 2>/dev/null),\ + $(eval $(docker:-dbg.gz=.gz)_TEMPLATE_TIMER = yes) + ) + export multi_instance="false" + j2 files/build_templates/per_namespace/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 > $($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer + fi # Any service template, inside share_image directory, will be used to generate -chassis.service file. # TODO: need better way to name the image-shared service if [ -f files/build_templates/share_image/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).service.j2 ]; then @@ -1209,7 +1227,20 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(eval SERVICES += "$(addsuffix -chassis.service, $($(docker:-dbg.gz=.gz)_CONTAINER_NAME))") ) ) + # Marks template timers with an "@" according to systemd convention + # If the $($docker)_TEMPLATE_TIMER) variable is set, the timer will be treated as a template + # If the $($docker)_GLOBAL_TIMER) and $($docker)_TEMPLATE_TIMER) variables are set the timer will be added both as a global and template timer. + $(foreach docker, $($*_DOCKERS),\ + $(if $($(docker:-dbg.gz=.gz)_TEMPLATE_TIMER),\ + $(if $($(docker:-dbg.gz=.gz)_GLOBAL_TIMER),\ + $(eval TIMERS += "$(addsuffix .timer, $($(docker:-dbg.gz=.gz)_CONTAINER_NAME))")\ + )\ + $(eval TIMERS += "$(addsuffix @.timer, $($(docker:-dbg.gz=.gz)_CONTAINER_NAME))"),\ + $(eval TIMERS += "$(addsuffix .timer, $($(docker:-dbg.gz=.gz)_CONTAINER_NAME))") + ) + ) export installer_services="$(SERVICES)" + export installer_timers="$(TIMERS)" export installer_extra_files="$(foreach docker, $($*_DOCKERS), $(foreach file, $($(docker:-dbg.gz=.gz)_BASE_IMAGE_FILES), $($(docker:-dbg.gz=.gz)_PATH)/base_image_files/$(file)))" From 6e88f05a45f24bed1d3d46431705aebef63b318f Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Fri, 29 Apr 2022 07:17:52 +0800 Subject: [PATCH 16/47] Fix the build target error when building sonic-rest-api (#10693) Why I did it Fix target target/debs/bullseye/sonic-rest-api_1.0.1_arm64.deb not existing issue, the correct target is target/debs/bullseye/sonic-rest-api_1.0.1_armhf.deb. Fix issue: #9896 [ FAIL LOG START ] [ target/debs/stretch/sonic-rest-api_1.0.1_amd64.deb ] [ REASON ] : target/debs/stretch/sonic-rest-api_1.0.1_amd64.deb does not exist NON-EXISTENT PREREQUISITES: [ FLAGS FILE ] : [] --- rules/restapi.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/restapi.mk b/rules/restapi.mk index e66b4a1d976a..21eed4cfbb51 100644 --- a/rules/restapi.mk +++ b/rules/restapi.mk @@ -1,6 +1,6 @@ # sonic-rest-api package -RESTAPI = sonic-rest-api_1.0.1_amd64.deb +RESTAPI = sonic-rest-api_1.0.1_$(CONFIGURED_ARCH).deb $(RESTAPI)_SRC_PATH = $(SRC_PATH)/sonic-restapi $(RESTAPI)_DEPENDS += $(LIBHIREDIS_DEV) $(LIBNL3_DEV) $(LIBNL_GENL3_DEV) \ $(LIBNL_ROUTE3_DEV) $(LIBSWSSCOMMON_DEV) $(LIBSWSSCOMMON) From e0f5333d9ceb908cbfc5e25b88197de224c1cfe8 Mon Sep 17 00:00:00 2001 From: Mohamed Ghoneim Date: Thu, 28 Apr 2022 17:29:56 -0700 Subject: [PATCH 17/47] [SY] Adding exceptlionList to validation exception (#10699) #### Why I did it Adding exceptlionList to validation exception #### How I did it Check code. #### How to verify it Ran manually. - Run full config validation from a KVM - Print the thrown exception **Before** ``` Error: Data Loading Failed All Keys are not parsed in FEATURE dict_keys(['telemetry']) ``` **After** ``` Error: Data Loading Failed All Keys are not parsed in FEATURE dict_keys(['telemetry']) exceptionList:["'status'"] ``` #### Which release branch to backport (provide reason below if selected) - [ ] 201811 - [ ] 201911 - [ ] 202006 - [ ] 202012 - [ ] 202106 - [ ] 202111 #### Description for the changelog #### Link to config_db schema for YANG module changes #### A picture of a cute animal (not mandatory but encouraged) --- src/sonic-yang-mgmt/sonic_yang_ext.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-yang-mgmt/sonic_yang_ext.py b/src/sonic-yang-mgmt/sonic_yang_ext.py index d43e52970302..424e567f79d3 100644 --- a/src/sonic-yang-mgmt/sonic_yang_ext.py +++ b/src/sonic-yang-mgmt/sonic_yang_ext.py @@ -661,8 +661,8 @@ def _xlateContainer(self, model, yang, config, table): configC.keys()), debug=syslog.LOG_ERR, doPrint=True) self.sysLog(msg="exceptionList:{}".format(exceptionList), \ debug=syslog.LOG_ERR, doPrint=True) - raise(Exception("All Keys are not parsed in {}\n{}".format(table, \ - configC.keys()))) + raise(Exception("All Keys are not parsed in {}\n{}\nexceptionList:{}".format(table, \ + configC.keys(), exceptionList))) return From ede1e0e88963a4d3646b61341130806d90880760 Mon Sep 17 00:00:00 2001 From: vmittal-msft <46945843+vmittal-msft@users.noreply.github.com> Date: Thu, 28 Apr 2022 20:39:56 -0700 Subject: [PATCH 18/47] Adjustment to ingress pool size to accomodate brcm sai (#10694) --- .../Arista-7050CX3-32S-D48C8/buffers_defaults_t0.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers_defaults_t0.j2 index 6a524f980697..a7441471e0cc 100644 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers_defaults_t0.j2 +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers_defaults_t0.j2 @@ -11,7 +11,7 @@ {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "32669440", + "size": "32689152", "type": "ingress", "mode": "dynamic", "xoff": "2058240" From d258db8aa282b3f0a7a5b00321bc49065c8f3c1d Mon Sep 17 00:00:00 2001 From: Shilong Liu Date: Fri, 29 Apr 2022 13:40:33 +0800 Subject: [PATCH 19/47] [CG] Fix CG alert about underscore version. (#10705) --- .../0004-Remove-underscore-packages.patch | 60 +++++++++++++++++++ src/thrift_0_14_1/thrift.patch/series | 1 + 2 files changed, 61 insertions(+) create mode 100644 src/thrift_0_14_1/thrift.patch/0004-Remove-underscore-packages.patch diff --git a/src/thrift_0_14_1/thrift.patch/0004-Remove-underscore-packages.patch b/src/thrift_0_14_1/thrift.patch/0004-Remove-underscore-packages.patch new file mode 100644 index 000000000000..fd49e9d5655a --- /dev/null +++ b/src/thrift_0_14_1/thrift.patch/0004-Remove-underscore-packages.patch @@ -0,0 +1,60 @@ +diff --git a/lib/ts/package-lock.json b/lib/ts/package-lock.json +index fddef4426..93a3cbb8f 100644 +--- a/lib/ts/package-lock.json ++++ b/lib/ts/package-lock.json +@@ -2639,8 +2639,7 @@ + "mkdirp": "~0.5.1", + "requizzle": "~0.2.1", + "strip-json-comments": "~2.0.1", +- "taffydb": "2.6.2", +- "underscore": "~1.8.3" ++ "taffydb": "2.6.2" + } + }, + "jshint": { +@@ -3873,17 +3872,7 @@ + "requizzle": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.1.tgz", +- "integrity": "sha1-aUPDUwxNmn5G8c3dUcFY/GcM294=", +- "requires": { +- "underscore": "~1.6.0" +- }, +- "dependencies": { +- "underscore": { +- "version": "1.6.0", +- "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", +- "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=" +- } +- } ++ "integrity": "sha1-aUPDUwxNmn5G8c3dUcFY/GcM294=" + }, + "resolve": { + "version": "1.9.0", +@@ -4622,25 +4611,10 @@ + "xtend": "^4.0.1" + } + }, +- "underscore": { +- "version": "1.8.3", +- "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", +- "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" +- }, + "underscore-contrib": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/underscore-contrib/-/underscore-contrib-0.3.0.tgz", +- "integrity": "sha1-ZltmwkeD+PorGMn4y7Dix9SMJsc=", +- "requires": { +- "underscore": "1.6.0" +- }, +- "dependencies": { +- "underscore": { +- "version": "1.6.0", +- "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", +- "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=" +- } +- } ++ "integrity": "sha1-ZltmwkeD+PorGMn4y7Dix9SMJsc=" + }, + "underscore.string": { + "version": "3.3.5", diff --git a/src/thrift_0_14_1/thrift.patch/series b/src/thrift_0_14_1/thrift.patch/series index 9fe00d007f63..19ba4dba26f3 100644 --- a/src/thrift_0_14_1/thrift.patch/series +++ b/src/thrift_0_14_1/thrift.patch/series @@ -1,3 +1,4 @@ 0001-Remove-unneeded-packages.patch 0002-Fix-build-rules.patch 0003-Remove-minimist-packages.patch +0004-Remove-underscore-packages.patch From 53e5fe6a93b051c8319d51e109d317beb5166e77 Mon Sep 17 00:00:00 2001 From: Alexander Allen Date: Fri, 29 Apr 2022 13:50:59 -0400 Subject: [PATCH 20/47] [Mellanox] Upgrade mellanox SDK to 4.5.1500 and mlnx-sai to 1.21.1.1 (#10675) Update SDK/FW to 4.5.1500/2010.1500 and SAI version to 1.21.1.1 SDK/FW features: 1. Added support for Finisar DR4 (FTCD4523E2PCM) on Spectrum-2 and Spectrum-3 systems. SAI Features: 1. ECMP overlay support for IPv6 2. BFD offloading / 4K scale 3. Host interface user traps + improved trap registration (table entry) 4. gcc11 compilation fixes 5. Read support for ACL redirect action 6. Optimize ECMP DB size 7. Buffer descriptors new defaults 8. Updated port mapping for SN2201 SAI Fixes: 1. Debug counter removal when configured with all drop reasons - Why I did it Upgrade Mellanox SDK and SAI versions to latest - How I did it Updated submodule pointers - How to verify it Regression tested --- platform/mellanox/fw.mk | 6 +++--- platform/mellanox/mlnx-sai.mk | 2 +- platform/mellanox/mlnx-sai/SAI-Implementation | 2 +- platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers | 2 +- platform/mellanox/sdk.mk | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 8293b38cd5fe..e2ccc2ad7dc8 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -27,17 +27,17 @@ else FW_FROM_URL = n endif -MLNX_SPC_FW_VERSION = 13.2010.1218 +MLNX_SPC_FW_VERSION = 13.2010.1500 MLNX_SPC_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_SPC_FW_VERSION))-EVB.mfa $(MLNX_SPC_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC_FW_FILE) -MLNX_SPC2_FW_VERSION = 29.2010.1218 +MLNX_SPC2_FW_VERSION = 29.2010.1500 MLNX_SPC2_FW_FILE = fw-SPC2-rel-$(subst .,_,$(MLNX_SPC2_FW_VERSION))-EVB.mfa $(MLNX_SPC2_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC2_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC2_FW_FILE) -MLNX_SPC3_FW_VERSION = 30.2010.1218 +MLNX_SPC3_FW_VERSION = 30.2010.1500 MLNX_SPC3_FW_FILE = fw-SPC3-rel-$(subst .,_,$(MLNX_SPC3_FW_VERSION))-EVB.mfa $(MLNX_SPC3_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC3_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC3_FW_FILE) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index c8a394e1f355..d49a832aff9e 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,6 +1,6 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.20.2.5 +MLNX_SAI_VERSION = SAIRel1.21.1.1 export MLNX_SAI_VERSION diff --git a/platform/mellanox/mlnx-sai/SAI-Implementation b/platform/mellanox/mlnx-sai/SAI-Implementation index 0f9cf1d39107..a01442acd95e 160000 --- a/platform/mellanox/mlnx-sai/SAI-Implementation +++ b/platform/mellanox/mlnx-sai/SAI-Implementation @@ -1 +1 @@ -Subproject commit 0f9cf1d39107f2d8f78c4b2807aa4e32862cca68 +Subproject commit a01442acd95e3a4f78a8e4b04b227fcbe905771e diff --git a/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers b/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers index 37475d91930e..a0416e20a2b9 160000 --- a/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers +++ b/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers @@ -1 +1 @@ -Subproject commit 37475d91930e3aae3490a4423da280a5cae72407 +Subproject commit a0416e20a2b9b304cb2c9b629c071f76db0ca2aa diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 08051e5ca0c7..ba152c953808 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -16,7 +16,7 @@ # MLNX_SDK_BASE_PATH = $(PLATFORM_PATH)/sdk-src/sx-kernel/Switch-SDK-drivers/bin/ MLNX_SDK_PKG_BASE_PATH = $(MLNX_SDK_BASE_PATH)/$(BLDENV)/ -MLNX_SDK_VERSION = 4.5.1208 +MLNX_SDK_VERSION = 4.5.1500 MLNX_SDK_ISSU_VERSION = 101 MLNX_SDK_DEB_VERSION = $(subst -,.,$(subst _,.,$(MLNX_SDK_VERSION))) From 80f5d36a5b70ba2ae3049938e29b5f1dc619f73d Mon Sep 17 00:00:00 2001 From: Sumukha Tumkur Vani Date: Sat, 30 Apr 2022 10:39:13 -0700 Subject: [PATCH 21/47] [SWSS] Update submodule (#10719) Add the following commits: - [orchagent, crm]: Reset crm threshold exceed count when threshold type changed 5ba6a54786c0fd9b155bb9ea2a7ed724a58aab74 - [pbh] [aclorch] Fixed a bug causes by updating the flow-counter value for the PBH rule 841f00389b338e91ddc4de460ace4ff96adfa796 - [ACL]Avoid incrementing crm count when ACL rule create fails 3d3364f9715fa05fbdf2d09b08676c3055903b84 - set remote vtep the netdev down before delete 7f53db782aed2973f4ff6807911b5a549461f3c7 - Removing Vnet with scope default 2ea8581da4ba6f97bebde4845a234d7c810e5515 --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 1fd1dbfe7eaa..2ea8581da4ba 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 1fd1dbfe7eaaa52f1d7edbdd2bb88483f031fd5e +Subproject commit 2ea8581da4ba6f97bebde4845a234d7c810e5515 From 4ec3af86af5c9ed2da21df33111fa84181069a3e Mon Sep 17 00:00:00 2001 From: shlomibitton <60430976+shlomibitton@users.noreply.github.com> Date: Mon, 2 May 2022 10:44:17 +0300 Subject: [PATCH 22/47] [Fastboot] Delay PMON service for better fastboot performance (#10567) - Why I did it Profiling the system state on init after fast-reboot during create_switch function execution, it is possible to see few python scripts running at the same time. This parallel execution consume CPU time and the duration of create_switch is longer than it should be. Following this finding, and the motivation to ensure these services will not interfere in the future, PMON is delayed in 90 seconds until the system finish the init flow after fastboot. - How I did it Add a timer for PMON service. Exclude for MLNX platform the start trigger of PMON when SYNCD starts in case of fastboot. Copy the timer file to the host bin image. - How to verify it Run fast-reboot on MLNX platform and observe faster create_switch execution time. --- files/build_templates/init_cfg.json.j2 | 1 + files/build_templates/pmon.service.j2 | 3 --- files/build_templates/pmon.timer | 12 ++++++++++++ files/build_templates/sonic_debian_extension.j2 | 3 +++ files/scripts/syncd.sh | 11 ++++++++--- 5 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 files/build_templates/pmon.timer diff --git a/files/build_templates/init_cfg.json.j2 b/files/build_templates/init_cfg.json.j2 index 31249abd5823..b51aaf2f0c14 100644 --- a/files/build_templates/init_cfg.json.j2 +++ b/files/build_templates/init_cfg.json.j2 @@ -30,6 +30,7 @@ {%- set features = [("bgp", "enabled", false, "enabled"), ("database", "always_enabled", false, "always_enabled"), ("lldp", "enabled", true, "enabled"), + ("pmon", "enabled", true, "enabled"), ("pmon", "enabled", false, "enabled"), ("radv", "enabled", false, "enabled"), ("snmp", "enabled", true, "enabled"), diff --git a/files/build_templates/pmon.service.j2 b/files/build_templates/pmon.service.j2 index 2cc28b1fc13e..2e7ebca1c72a 100644 --- a/files/build_templates/pmon.service.j2 +++ b/files/build_templates/pmon.service.j2 @@ -17,6 +17,3 @@ ExecStartPre=/usr/bin/{{docker_container_name}}.sh start ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop RestartSec=30 - -[Install] -WantedBy=sonic.target diff --git a/files/build_templates/pmon.timer b/files/build_templates/pmon.timer new file mode 100644 index 000000000000..2993051607ef --- /dev/null +++ b/files/build_templates/pmon.timer @@ -0,0 +1,12 @@ +[Unit] +# This delay is for fast/warm reboot performance +Description=Delays pmon docker until SONiC has started +PartOf=pmon.service + +[Timer] +OnUnitActiveSec=0 sec +OnBootSec=1min 30 sec +Unit=pmon.service + +[Install] +WantedBy=timers.target sonic.target sonic-delayed.target diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 0cdabf7cfaaa..516df5fd224f 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -831,6 +831,9 @@ sudo cp $BUILD_TEMPLATES/mgmt-framework.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_S echo "mgmt-framework.timer" | sudo tee -a $GENERATED_SERVICE_FILE {% endif %} +sudo cp $BUILD_TEMPLATES/pmon.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM +echo "pmon.timer" | sudo tee -a $GENERATED_SERVICE_FILE + sudo cp $BUILD_TEMPLATES/sonic.target $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable sonic.target diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index 83f99d70d7e8..628609e0a5f0 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -45,10 +45,15 @@ function startplatform() { function waitplatform() { + BOOT_TYPE=`getBootType` if [[ x"$sonic_asic_platform" == x"mellanox" ]]; then - debug "Starting pmon service..." - /bin/systemctl start pmon - debug "Started pmon service" + if [[ x"$BOOT_TYPE" = @(x"fast"|x"warm"|x"fastfast") ]]; then + debug "PMON service is delayed by a timer for better fast/warm boot performance" + else + debug "Starting pmon service..." + /bin/systemctl start pmon + debug "Started pmon service" + fi fi if [[ x"$BOOT_TYPE" = @(x"fast"|x"warm"|x"fastfast") ]]; then debug "LLDP service is delayed by a timer for better fast/warm boot performance" From a9d5858da14d7980adacd4e00561e362a4253156 Mon Sep 17 00:00:00 2001 From: Song Yuan <64041228+ysmanman@users.noreply.github.com> Date: Mon, 2 May 2022 09:49:42 -0700 Subject: [PATCH 23/47] Fix buffer template for Arista SKU. (#10663) Why I did it The buffer pool & profile setting in buffer template was not correct and caused the errors like the following: ERR swss#orchagent: :- parseReference: malformed reference:[BUFFER_PROFILE|ingress_lossless_profile]. Must not be surrounded by [ ] How I did it Fix the buffer pool & profile setting by removing "[]". How to verify it Loaded image with this fix in a switch and made sure the error was not seen anymore. --- .../buffers_defaults_t2.j2 | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/buffers_defaults_t2.j2 b/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/buffers_defaults_t2.j2 index b5931bd37268..b292a354b55a 100644 --- a/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/buffers_defaults_t2.j2 +++ b/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/buffers_defaults_t2.j2 @@ -1,4 +1,3 @@ - {%- set default_cable = '5m' %} {%- macro generate_port_lists(PORT_ALL) %} @@ -19,7 +18,7 @@ }, "BUFFER_PROFILE": { "ingress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "pool":"ingress_lossless_pool", "size":"1280", "dynamic_th":"-2", "xon_offset":"2560", @@ -27,18 +26,18 @@ "xoff":"66048" }, "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "pool":"ingress_lossless_pool", "size":"0", "xon_offset":"0", "static_th":"30535680" }, "egress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "pool":"ingress_lossless_pool", "size":"0", "static_th":"33030144" }, "egress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "pool":"ingress_lossless_pool", "size":"0", "dynamic_th":"-1" } @@ -49,18 +48,18 @@ "BUFFER_QUEUE": { {% for port in port_names.split(',') %} "{{ port }}|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, {% endfor %} {% for port in port_names.split(',') %} "{{ port }}|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, {% endfor %} {% for port in port_names.split(',') %} "{{ port }}|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }{% if not loop.last %},{% endif %} {% endfor %} } -{%- endmacro %} \ No newline at end of file +{%- endmacro %} From 0a6bb3f6f0c6ce70d0643a9adc2d8276c7f80e11 Mon Sep 17 00:00:00 2001 From: Andriy Yurkiv <70649192+ayurkiv-nvda@users.noreply.github.com> Date: Mon, 2 May 2022 19:51:30 +0300 Subject: [PATCH 24/47] [yang] add yang options for Context object (#10359) #### Why I did it Need to pass LY_CTX_DISABLE_SEARCHDIR_CWD to Context in order to disable automatically searching for schemas in current working directory (which is by default searched automatically) #### How I did it add additional attribute into YANG context #### How to verify it Create some invalid link on switch : 1) **ln -s /usr/abc xxx** 2) run **spm list** --> There should not be these messages: ``` libyang[1]: Unable to get information about "xxx" file in "/tmp" when searching for (sub)modules (No such file or directory) libyang[1]: Unable to get information about "xxx" file in "/tmp" when searching for (sub)modules (No such file or directory) libyang[1]: Unable to get information about "xxx" file in "/tmp" when searching for (sub)modules (No such file or directory) libyang[1]: Unable to get information about "xxx" file in "/tmp" when searching for (sub)modules (No such file or directory) ``` --- src/sonic-yang-mgmt/sonic_yang.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-yang-mgmt/sonic_yang.py b/src/sonic-yang-mgmt/sonic_yang.py index 16aeb8a9ff8a..6bf590fced38 100644 --- a/src/sonic-yang-mgmt/sonic_yang.py +++ b/src/sonic-yang-mgmt/sonic_yang.py @@ -12,7 +12,7 @@ """ class SonicYang(SonicYangExtMixin): - def __init__(self, yang_dir, debug=False, print_log_enabled=True): + def __init__(self, yang_dir, debug=False, print_log_enabled=True, sonic_yang_options=0): self.yang_dir = yang_dir self.ctx = None self.module = None @@ -46,7 +46,7 @@ def __init__(self, yang_dir, debug=False, print_log_enabled=True): self.preProcessedYang = dict() try: - self.ctx = ly.Context(yang_dir) + self.ctx = ly.Context(yang_dir, sonic_yang_options) except Exception as e: self.fail(e) From a1e76d25b727da8f8493dfa9eb1a1433564d790c Mon Sep 17 00:00:00 2001 From: Polly Hsu Date: Tue, 3 May 2022 02:09:16 +0800 Subject: [PATCH 25/47] [as7816-64x] Update installer.conf (#10418) Co-authored-by: ecsonic Why I did it The customer report of the PCIe Bus Errors upon the SDK initialization of as7816-64x. How I did it Based on the internal info and discussion, update "pcie_aspm=off" into ONIE_PLATFORM_EXTRA_CMDLINE_LINUX of installer.conf to resolve it. --- device/accton/x86_64-accton_as7816_64x-r0/installer.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/accton/x86_64-accton_as7816_64x-r0/installer.conf b/device/accton/x86_64-accton_as7816_64x-r0/installer.conf index 9fa12f888545..ca2e5039b362 100644 --- a/device/accton/x86_64-accton_as7816_64x-r0/installer.conf +++ b/device/accton/x86_64-accton_as7816_64x-r0/installer.conf @@ -1,2 +1,2 @@ CONSOLE_SPEED=115200 -ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="tg3.short_preamble=1 tg3.bcm5718s_reset=1" +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="tg3.short_preamble=1 tg3.bcm5718s_reset=1 pcie_aspm=off" From 243d0c73f96991ec0efbde76c7ea1358c833cd48 Mon Sep 17 00:00:00 2001 From: kellyyeh <42761586+kellyyeh@users.noreply.github.com> Date: Mon, 2 May 2022 17:14:13 -0700 Subject: [PATCH 26/47] [dhcp6relay] Add retry mechanism for binding socket to interface ipv6 addresses (#10712) --- src/dhcp6relay/src/relay.cpp | 71 +++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/src/dhcp6relay/src/relay.cpp b/src/dhcp6relay/src/relay.cpp index 234646c1fb74..951b31f90a0c 100644 --- a/src/dhcp6relay/src/relay.cpp +++ b/src/dhcp6relay/src/relay.cpp @@ -378,44 +378,57 @@ void prepare_socket(int *local_sock, int *server_sock, relay_config *config, int memset(&ll_addr, 0, sizeof(ll_addr)); if ((*local_sock = socket(AF_INET6, SOCK_DGRAM, 0)) == -1) { - syslog(LOG_ERR, "socket: Failed to create socket\n"); + syslog(LOG_ERR, "socket: Failed to create socket on interface %s\n", config->interface.c_str()); } if ((*server_sock= socket(AF_INET6, SOCK_DGRAM, 0)) == -1) { - syslog(LOG_ERR, "socket: Failed to create socket\n"); + syslog(LOG_ERR, "socket: Failed to create socket on interface %s\n", config->interface.c_str()); } - - if (getifaddrs(&ifa) == -1) { - syslog(LOG_WARNING, "getifaddrs: Unable to get network interfaces\n"); - exit(1); - } - - ifa_tmp = ifa; - while (ifa_tmp) { - if (ifa_tmp->ifa_addr->sa_family == AF_INET6) { - struct sockaddr_in6 *in6 = (struct sockaddr_in6*) ifa_tmp->ifa_addr; - if((strcmp(ifa_tmp->ifa_name, config->interface.c_str()) == 0) && !IN6_IS_ADDR_LINKLOCAL(&in6->sin6_addr)) { - in6->sin6_family = AF_INET6; - in6->sin6_port = htons(RELAY_PORT); - addr = *in6; - } - if((strcmp(ifa_tmp->ifa_name, config->interface.c_str()) == 0) && IN6_IS_ADDR_LINKLOCAL(&in6->sin6_addr)) { - in6->sin6_family = AF_INET6; - in6->sin6_port = htons(RELAY_PORT); - ll_addr = *in6; + int retry = 0; + bool bind_addr = false; + bool bind_ll_addr = false; + do { + if (getifaddrs(&ifa) == -1) { + syslog(LOG_WARNING, "getifaddrs: Unable to get network interfaces with %s\n", strerror(errno)); + } + else { + ifa_tmp = ifa; + while (ifa_tmp) { + if ((ifa_tmp->ifa_addr->sa_family == AF_INET6) && (strcmp(ifa_tmp->ifa_name, config->interface.c_str()) == 0)) { + struct sockaddr_in6 *in6 = (struct sockaddr_in6*) ifa_tmp->ifa_addr; + if(!IN6_IS_ADDR_LINKLOCAL(&in6->sin6_addr)) { + bind_addr = true; + in6->sin6_family = AF_INET6; + in6->sin6_port = htons(RELAY_PORT); + addr = *in6; + } + if(IN6_IS_ADDR_LINKLOCAL(&in6->sin6_addr)) { + bind_ll_addr = true; + in6->sin6_family = AF_INET6; + in6->sin6_port = htons(RELAY_PORT); + ll_addr = *in6; + } + } + ifa_tmp = ifa_tmp->ifa_next; } + freeifaddrs(ifa); } - ifa_tmp = ifa_tmp->ifa_next; - } - freeifaddrs(ifa); - - if (bind(*local_sock, (sockaddr *)&addr, sizeof(addr)) == -1) { - syslog(LOG_ERR, "bind: Failed to bind to socket\n"); + + if (bind_addr && bind_ll_addr) { + break; + } + + syslog(LOG_WARNING, "Retry #%d to bind to sockets on interface %s\n", ++retry, config->interface.c_str()); + sleep(5); + } while (retry < 6); + + if ((!bind_addr) || (bind(*local_sock, (sockaddr *)&addr, sizeof(addr)) == -1)) { + syslog(LOG_ERR, "bind: Failed to bind socket to global ipv6 address on interface %s after %d retries with %s\n", config->interface.c_str(), retry, strerror(errno)); } - if (bind(*server_sock, (sockaddr *)&ll_addr, sizeof(addr)) == -1) { - syslog(LOG_ERR, "bind: Failed to bind to socket\n"); + if ((!bind_ll_addr) || (bind(*server_sock, (sockaddr *)&ll_addr, sizeof(addr)) == -1)) { + syslog(LOG_ERR, "bind: Failed to bind socket to link local ipv6 address on interface %s after %d retries with %s\n", config->interface.c_str(), retry, strerror(errno)); } } From 799d0c0313a5ea812919dca497290fc4ea884078 Mon Sep 17 00:00:00 2001 From: DavidZagury <32644413+DavidZagury@users.noreply.github.com> Date: Wed, 4 May 2022 16:56:21 +0300 Subject: [PATCH 27/47] [YANG] Update range of supported port speeds to support 800G ports (#10687) - Why I did it To add support for 800G speed for port in the yang. - How I did it Change limitation from 400G to 800G. - How to verify it Set a port speed to 800G and run the yang DB validation. e.g. by using dynamic port breakout. --- .../tests/yang_model_tests/tests/port.json | 7 +++ .../yang_model_tests/tests_config/port.json | 51 +++++++++++++++++++ .../yang-models/sonic-port.yang | 4 +- 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/port.json b/src/sonic-yang-models/tests/yang_model_tests/tests/port.json index b3aa253c2e72..db9b432714eb 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/port.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/port.json @@ -24,6 +24,13 @@ "eStrKey" : "Pattern", "eStr": ["on|off"] }, + "PORT_VALID_SPEEDS_TEST_1": { + "desc": "PORT_VALID_SPEEDS_TEST_1 no failure." + }, + "PORT_INVALID_SPEEDS_TEST_1": { + "desc": "PORT_INVALID_SPEEDS_TEST_1 InvalidValue condition failure.", + "eStr": ["pattern", "does not satisfy"] + }, "PORT_VALID_ADVSPEEDS_TEST_1": { "desc": "PORT_VALID_ADVSPEEDS_TEST_1 no failure." }, diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json index e1549261cb92..db3334e80d2b 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json @@ -90,6 +90,40 @@ } }, + "PORT_VALID_SPEEDS_TEST_1": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 800000, + "autoneg": "on", + "adv_speeds": [400000, 800000] + } + ] + } + } + }, + + "PORT_INVALID_SPEEDS_TEST_1": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 900000, + "autoneg": "on", + "adv_speeds": [25000,40000] + } + ] + } + } + }, + "PORT_VALID_ADVSPEEDS_TEST_1": { "sonic-port:sonic-port": { "sonic-port:PORT": { @@ -124,6 +158,23 @@ } }, + "PORT_VALID_ADVSPEEDS_TEST_3": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "autoneg": "on", + "adv_speeds": [25000,800000] + } + ] + } + } + }, + "PORT_INVALID_ADVSPEEDS_TEST_1": { "sonic-port:sonic-port": { "sonic-port:PORT": { diff --git a/src/sonic-yang-models/yang-models/sonic-port.yang b/src/sonic-yang-models/yang-models/sonic-port.yang index add4de25ce0a..eab52996fb00 100644 --- a/src/sonic-yang-models/yang-models/sonic-port.yang +++ b/src/sonic-yang-models/yang-models/sonic-port.yang @@ -61,7 +61,7 @@ module sonic-port{ leaf speed { mandatory true; type uint32 { - range 1..400000; + range 1..800000; } } @@ -78,7 +78,7 @@ module sonic-port{ type union { type uint32 { - range 1..400000; + range 1..800000; } type string { pattern "all"; From 6284d136ec964e12f9c05df6b0507ab2dd939294 Mon Sep 17 00:00:00 2001 From: Lior Avramov <73036155+liorghub@users.noreply.github.com> Date: Wed, 4 May 2022 18:21:02 +0300 Subject: [PATCH 28/47] [LLDP] Enhance lldmgrd Redis events handling (#10593) Why I did it When lldpmgrd handled events of other tables besides PORT_TABLE, error message was printed to log. How I did it Handle event according to its file descriptor instead of looping all registered selectables for each coming event. How to verify it I verified same events are being handled by printing events key and operation, before and after the change. Also, before the change, in init flow after config reload, when lldpmgrd handled events of other tables besides PORT_TABLE, error messages were printed to log, this issue is solved now. --- dockers/docker-lldp/lldpmgrd | 62 +++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/dockers/docker-lldp/lldpmgrd b/dockers/docker-lldp/lldpmgrd index 93461a42837e..753aa678eaee 100755 --- a/dockers/docker-lldp/lldpmgrd +++ b/dockers/docker-lldp/lldpmgrd @@ -76,6 +76,9 @@ class LldpManager(daemon_base.DaemonBase): self.app_port_table = swsscommon.Table(self.appl_db, swsscommon.APP_PORT_TABLE_NAME) self.state_port_table = swsscommon.Table(self.state_db, swsscommon.STATE_PORT_TABLE_NAME) + self.port_config_done = False + self.port_init_done = False + def update_hostname(self, hostname): cmd = "lldpcli configure system hostname {0}".format(hostname) self.log_debug("Running command: '{}'".format(cmd)) @@ -247,6 +250,23 @@ class LldpManager(daemon_base.DaemonBase): self.log_info("Hostname changed old {0}, new {1}".format(self.hostname, hostname)) self.update_hostname(hostname) + def lldp_process_port_table_event(self, key, op, fvp): + if (key != "PortInitDone") and (key != "PortConfigDone"): + if op == "SET": + if fvp: + if "up" in dict(fvp).get("oper_status",""): + self.generate_pending_lldp_config_cmd_for_port(key, dict(fvp)) + else: + self.pending_cmds.pop(key, None) + elif op == "DEL": + self.pending_cmds.pop(key, None) + else: + self.log_error("unknown operation '{}'".format(op)) + elif key == "PortInitDone": + self.port_init_done = True + elif key == "PortConfigDone": + self.port_config_done = True + def run(self): """ Subscribes to notifications of changes in the PORT table @@ -267,8 +287,6 @@ class LldpManager(daemon_base.DaemonBase): # Daemon is paused on the configuration file to avoid lldp packets with wrong information # until all interfaces are well configured on lldpd - port_init_done = False - port_config_done = False resume_lldp_sent = False start_time = time.time() @@ -288,34 +306,20 @@ class LldpManager(daemon_base.DaemonBase): # Listen for changes to the PORT table in the CONFIG_DB and APP_DB while True: - (state, c) = sel.select(SELECT_TIMEOUT_MS) + (state, selectableObj) = sel.select(SELECT_TIMEOUT_MS) if state == swsscommon.Select.OBJECT: - (key, op, fvp) = sst_mgmt_ip_confdb.pop() - if key: + if selectableObj.getFd() == sst_mgmt_ip_confdb.getFd(): + (key, op, fvp) = sst_mgmt_ip_confdb.pop() self.lldp_process_mgmt_info_change(op, dict(fvp), key) - - (key, op, fvp) = sst_device_confdb.pop() - if key: + elif selectableObj.getFd() == sst_device_confdb.getFd(): + (key, op, fvp) = sst_device_confdb.pop() self.lldp_process_device_table_event(op, dict(fvp), key) - - (key, op, fvp) = sst_appdb.pop() - if (key != "PortInitDone") and (key != "PortConfigDone"): - if op == "SET": - if fvp: - if "up" in dict(fvp).get("oper_status",""): - self.generate_pending_lldp_config_cmd_for_port(key, dict(fvp)) - else: - self.pending_cmds.pop(key, None) - elif op == "DEL": - self.pending_cmds.pop(key, None) - else: - self.log_error("unknown operation") - - elif key == "PortInitDone": - port_init_done = True - elif key == "PortConfigDone": - port_config_done = True + elif selectableObj.getFd() == sst_appdb.getFd(): + (key, op, fvp) = sst_appdb.pop() + self.lldp_process_port_table_event(key, op, fvp) + else: + self.log_error("Got unexpected selectable object") # Process all pending commands self.process_pending_cmds() @@ -323,9 +327,9 @@ class LldpManager(daemon_base.DaemonBase): # Resume the daemon since all interfaces data updated and configured to the lldpd so no miss leading packets will be sent if not resume_lldp_sent: if check_timeout(self, start_time): - port_init_done = port_config_done = True - if port_init_done and port_config_done: - port_init_done = port_config_done = False + self.port_init_done = self.port_config_done = True + if self.port_init_done and self.port_config_done: + self.port_init_done = self.port_config_done = False rc, stderr = run_cmd(self, "lldpcli resume") if rc != 0: self.log_error("Failed to resume lldpd with command: 'lldpcli resume': {}".format(stderr)) From 288d667c66ddf98defea9ea8e41066e24f2b8dbb Mon Sep 17 00:00:00 2001 From: arlakshm <55814491+arlakshm@users.noreply.github.com> Date: Wed, 4 May 2022 15:05:44 -0700 Subject: [PATCH 29/47] [yang][multi-asic]bgp internal neighbor yang model (#10632) closes #10157 Why I did it Add yang model for the bgp_internal_neighbor table in config_db How I did it Add new yang model file and unit tests How to verify it UT and compile sonic_yang_models-1.0-py3-none-any.whl and sonic_yang_mgmt-1.0-py3-none-any.whl Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan --- src/sonic-yang-models/setup.py | 1 + .../tests/files/sample_config_db.json | 70 +++++++++- .../yang_model_tests/tests/bgp_internal.json | 17 +++ .../tests_config/bgp_internal.json | 128 ++++++++++++++++++ .../sonic-bgp-internal-neighbor.yang | 58 ++++++++ 5 files changed, 270 insertions(+), 4 deletions(-) create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/bgp_internal.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/bgp_internal.json create mode 100644 src/sonic-yang-models/yang-models/sonic-bgp-internal-neighbor.yang diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index 4ca8d065c6ec..1928643c28ed 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -82,6 +82,7 @@ def run(self): './yang-models/sonic-bgp-common.yang', './yang-models/sonic-bgp-global.yang', './yang-models/sonic-bgp-monitor.yang', + './yang-models/sonic-bgp-internal-neighbor.yang', './yang-models/sonic-bgp-neighbor.yang', './yang-models/sonic-bgp-peergroup.yang', './yang-models/sonic-bgp-peerrange.yang', diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 8c5a8c0af909..505c92ba96dd 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -103,18 +103,32 @@ "tpid": "0x9200", "mtu": "9100", "lacp_key": "auto" + }, + "PortChannel42": { + "admin_status": "up", + "members": [ + "Ethernet-BP0", + "Ethernet-BP4" + ], + "min_links": "2", + "mtu": "9100", + "tpid": "0x8100" } }, "PORTCHANNEL_INTERFACE": { "PortChannel0003": { "nat_zone": "1" }, - "PortChannel0004": {"vrf_name": "Vrf_blue"} + "PortChannel0004": {"vrf_name": "Vrf_blue"}, + "PortChannel42|10.1.0.1/31": {}, + "PortChannel42|2603:10e2:400:1::2/126": {} }, "PORTCHANNEL_MEMBER": { "PortChannel0003|Ethernet1": {}, "PortChannel0004|Ethernet2": {}, - "PortChannel2|Ethernet12": {} + "PortChannel2|Ethernet12": {}, + "PortChannel42|Ethernet-BP0": {}, + "PortChannel42|Ethernet-BP4": {} }, "VLAN_INTERFACE": { "Vlan111": { @@ -734,7 +748,33 @@ "speed": "11100", "tpid": "0x8100", "admin_status": "up" - } + }, + "Ethernet-BP0": { + "admin_status": "up", + "alias": "Eth4-ASIC0", + "asic_port_name": "Eth4-ASIC0", + "description": "ASIC2:Eth0-ASIC2", + "index": "0", + "lanes": "17,18,19,20", + "mtu": "9100", + "pfc_asym": "off", + "role": "Int", + "speed": "40000", + "tpid": "0x8100" + }, + "Ethernet-BP4": { + "admin_status": "up", + "alias": "Eth5-ASIC0", + "asic_port_name": "Eth5-ASIC0", + "description": "ASIC2:Eth1-ASIC2", + "index": "1", + "lanes": "21,22,23,24", + "mtu": "9100", + "pfc_asym": "off", + "role": "Int", + "speed": "40000", + "tpid": "0x8100" + } }, "ACL_TABLE": { "V4-ACL-TABLE": { @@ -1704,8 +1744,30 @@ "send_sci": "true", "rekey_period": "3600" } - } + }, + "BGP_INTERNAL_NEIGHBOR": { + "10.1.0.0": { + "asn": "64850", + "holdtime": "180", + "keepalive": "60", + "local_addr": "10.1.0.1", + "name": "ASIC1", + "nhopself": "0", + "rrclient": "0", + "admin_status": "up" + }, + "2603:10e2:400:1::1": { + "asn": "64850", + "holdtime": "180", + "keepalive": "60", + "local_addr": "2603:10e2:400:1::2", + "name": "ASIC0", + "nhopself": "0", + "rrclient": "0", + "admin_status": "up" + } + } }, "SAMPLE_CONFIG_DB_UNKNOWN": { "UNKNOWN_TABLE": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/bgp_internal.json b/src/sonic-yang-models/tests/yang_model_tests/tests/bgp_internal.json new file mode 100644 index 000000000000..3438b70c8c5e --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/bgp_internal.json @@ -0,0 +1,17 @@ +{ + "BGP_INTERNAL_TEST": { + "desc": "Load bgp internal neighbor table with ipv4 and ipv6 neighbors." + }, + "BGP_INTERNAL_INVALID_ASN_TEST": { + "desc": "Load bgp internal neighbor table with ipv4 neighbor having incorrect asn.", + "eStr": ["Internal iBGP neighbors should have same ASN as defined in device metadata"] + }, + "BGP_INVALID_LOCAL_ADDRESS_FAMILY_TEST": { + "desc": "Load bgp internal ipv4 neighboripv6 local address.", + "eStr": ["local address and neighbor address family doesnt match"] + }, + "BGP_LOCAL_ADDRESS_ABSENT_TEST": { + "desc":"Load bgp internal neighbor table no local address.", + "eStrKey" : "Mandatory" + } +} \ No newline at end of file diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/bgp_internal.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/bgp_internal.json new file mode 100644 index 000000000000..07a26ab34556 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/bgp_internal.json @@ -0,0 +1,128 @@ +{ + "BGP_INTERNAL_TEST": { + "sonic-bgp-internal-neighbor:sonic-bgp-internal-neighbor": { + "sonic-bgp-internal-neighbor:BGP_INTERNAL_NEIGHBOR": { + "BGP_INTERNAL_NEIGHBOR_LIST": [ + { + "neighbor": "10.0.0.1", + "asn": "65001", + "holdtime": "180", + "keepalive": "60", + "local_addr": "10.0.0.2", + "name": "ASIC0", + "nhopself": "0", + "rrclient": "0", + "admin_status": "up" + }, + { + "neighbor": "2603:10e2:400:1::1", + "asn": "65001", + "holdtime": "180", + "keepalive": "60", + "local_addr": "2603:10e2:400:1::2", + "name": "ASIC0", + "nhopself": "0", + "rrclient": "0", + "admin_status": "up" + } + ] + } + }, + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "localhost": { + "bgp_asn": "65001", + "default_bgp_status": "up", + "hostname": "MASIC", + "platform": "multi-asic" + } + } + } + }, + "BGP_INTERNAL_INVALID_ASN_TEST": { + "sonic-bgp-internal-neighbor:sonic-bgp-internal-neighbor": { + "sonic-bgp-internal-neighbor:BGP_INTERNAL_NEIGHBOR": { + "BGP_INTERNAL_NEIGHBOR_LIST": [ + { + "neighbor": "10.0.0.1", + "asn": "65002", + "holdtime": "180", + "keepalive": "60", + "local_addr": "10.0.0.2", + "name": "ASIC0", + "nhopself": "0", + "rrclient": "0", + "admin_status": "up" + } + ] + } + }, + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "localhost": { + "bgp_asn": "65001", + "default_bgp_status": "up", + "hostname": "MASIC", + "platform": "multi-asic" + } + } + } + }, + "BGP_INVALID_LOCAL_ADDRESS_FAMILY_TEST": { + "sonic-bgp-internal-neighbor:sonic-bgp-internal-neighbor": { + "sonic-bgp-internal-neighbor:BGP_INTERNAL_NEIGHBOR": { + "BGP_INTERNAL_NEIGHBOR_LIST": [ + { + "neighbor": "10.0.0.1", + "asn": "65001", + "holdtime": "180", + "keepalive": "60", + "local_addr": "2603:10e2:400:1::5", + "name": "ASIC0", + "nhopself": "0", + "rrclient": "0", + "admin_status": "up" + } + ] + } + }, + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "localhost": { + "bgp_asn": "65001", + "default_bgp_status": "up", + "hostname": "MASIC", + "platform": "multi-asic" + } + } + } + }, + "BGP_LOCAL_ADDRESS_ABSENT_TEST": { + "sonic-bgp-internal-neighbor:sonic-bgp-internal-neighbor": { + "sonic-bgp-internal-neighbor:BGP_INTERNAL_NEIGHBOR": { + "BGP_INTERNAL_NEIGHBOR_LIST": [ + { + "neighbor": "2603:10e2:400:1::1", + "asn": "65001", + "holdtime": "180", + "keepalive": "60", + "name": "ASIC0", + "nhopself": "0", + "rrclient": "0", + "admin_status": "up" + } + ] + } + }, + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "localhost": { + "bgp_asn": "65001", + "default_bgp_status": "up", + "hostname": "MASIC", + "platform": "multi-asic" + } + } + } + } +} \ No newline at end of file diff --git a/src/sonic-yang-models/yang-models/sonic-bgp-internal-neighbor.yang b/src/sonic-yang-models/yang-models/sonic-bgp-internal-neighbor.yang new file mode 100644 index 000000000000..69a089f7cab8 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-bgp-internal-neighbor.yang @@ -0,0 +1,58 @@ +module sonic-bgp-internal-neighbor { + namespace "http://github.com/Azure/sonic-bgp-internal-neighbor"; + prefix bgpintnbr; + yang-version 1.1; + + import ietf-inet-types { + prefix inet; + } + + import sonic-device_metadata { + prefix dm; + } + + import sonic-bgp-common { + prefix bgpcmn; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BGP Internal Neighbor for multi asic platforms"; + + revision 2021-04-10 { + description + "Initial revision."; + } + + container sonic-bgp-internal-neighbor { + container BGP_INTERNAL_NEIGHBOR { + list BGP_INTERNAL_NEIGHBOR_LIST { + description "List for internal neighbors in multi asic platforms"; + key "neighbor"; + leaf neighbor { + type inet:ip-address; + description "BGP Neighbor address"; + } + uses bgpcmn:sonic-bgp-cmn-neigh { + refine asn { + must "(current() = /dm:sonic-device_metadata/dm:DEVICE_METADATA/dm:localhost/dm:bgp_asn)" { + error-message "Internal iBGP neighbors should have same ASN as defined in device metadata"; + } + } + refine local_addr { + mandatory true; + must "((contains(../neighbor, '.') and contains(current(), '.')) or + (contains(../neighbor, ':') and contains(current(), ':')))" { + error-message "local address and neighbor address family doesnt match"; + } + } + } + } + } + } +} \ No newline at end of file From 0dcbfa3a9729c814f9e8d7a8f28fbe65ab8a24dd Mon Sep 17 00:00:00 2001 From: arlakshm <55814491+arlakshm@users.noreply.github.com> Date: Wed, 4 May 2022 15:07:59 -0700 Subject: [PATCH 30/47] [chassis][yang]yang model for bgp voq chassis neighbor (#10642) Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan arlakshm@microsoft.com Why I did it Fixes #10158 How I did it Add yang model for config_db table BGP_VOQ_CHASSIS_NEIGHBOR and UT --- src/sonic-yang-models/setup.py | 1 + .../tests/files/sample_config_db.json | 22 ++ .../tests/bgp_voq_chassis_neighbor.json | 21 ++ .../bgp_voq_chassis_neighbor.json | 206 ++++++++++++++++++ .../sonic-bgp-voq-chassis-neighbor.yang | 63 ++++++ 5 files changed, 313 insertions(+) create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/bgp_voq_chassis_neighbor.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/bgp_voq_chassis_neighbor.json create mode 100644 src/sonic-yang-models/yang-models/sonic-bgp-voq-chassis-neighbor.yang diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index 1928643c28ed..2b55946cc144 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -87,6 +87,7 @@ def run(self): './yang-models/sonic-bgp-peergroup.yang', './yang-models/sonic-bgp-peerrange.yang', './yang-models/sonic-bgp-allowed-prefix.yang', + './yang-models/sonic-bgp-voq-chassis-neighbor.yang', './yang-models/sonic-breakout_cfg.yang', './yang-models/sonic-buffer-pg.yang', './yang-models/sonic-buffer-pool.yang', diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 505c92ba96dd..e44e74b531dc 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -1729,6 +1729,28 @@ } }, + "BGP_VOQ_CHASSIS_NEIGHBOR": { + "10.0.0.1": { + "asn": "64850", + "holdtime": "180", + "keepalive": "60", + "local_addr": "10.0.0.2", + "name": "sonic-chassis-lc3", + "nhopself": "0", + "rrclient": "0", + "admin_status": "up" + }, + "3333::3:6": { + "asn": "64850", + "holdtime": "180", + "keepalive": "60", + "local_addr": "3333::3:3", + "name": "sonic-chassis-lc3", + "nhopself": "0", + "rrclient": "0", + "admin_status": "up" + } + }, "MACSEC_PROFILE": { "test": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/bgp_voq_chassis_neighbor.json b/src/sonic-yang-models/tests/yang_model_tests/tests/bgp_voq_chassis_neighbor.json new file mode 100644 index 000000000000..3d575bb9759a --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/bgp_voq_chassis_neighbor.json @@ -0,0 +1,21 @@ +{ + "BGP_VOQ_CHASSIS_NEIGHBOR_TEST" : { + "desc": "Load bgp voq chassis neighbor" + }, + "BGP_VOQ_CHASSIS_WITH_INVALID_SWITCH_TYPE_TEST" : { + "desc": "Load bgp voq chassis on non voq chassis switch", + "eStr": ["Bgp voq neighbor are applicable only when switch_type is voq"] + }, + "BGP_VOQ_CHASSIS_ABSENT_LOCAL_ADDRESS_TEST" : { + "desc": "Load bgp voq chassis with no local address", + "eStrKey" : "Mandatory" + }, + "BGP_VOQ_CHASSIS_INVALID_LOCAL_ADDRESS_ADDRESS_FAMILY_TEST": { + "desc": "Load ipv6 bgp voq chassis with ipv4 local address", + "eStr": ["local address and neighbor address family doesnt match"] + }, + "BGP_VOQ_CHASSIS_INVALID_ASN_TEST": { + "desc" :"Load bgp voq chassis neighbor with asn number different than local asn", + "eStr": ["Voq chassis BGP neighbors should have same ASN as defined in device metadata"] + } +} \ No newline at end of file diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/bgp_voq_chassis_neighbor.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/bgp_voq_chassis_neighbor.json new file mode 100644 index 000000000000..877903912383 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/bgp_voq_chassis_neighbor.json @@ -0,0 +1,206 @@ +{ + "BGP_VOQ_CHASSIS_NEIGHBOR_TEST": { + "sonic-bgp-voq-chassis-neighbor:sonic-bgp-voq-chassis-neighbor": { + "sonic-bgp-voq-chassis-neighbor:BGP_VOQ_CHASSIS_NEIGHBOR": { + "BGP_VOQ_CHASSIS_NEIGHBOR_LIST": [ + { + "neighbor": "10.0.0.1", + "asn": "65001", + "holdtime": "180", + "keepalive": "60", + "local_addr": "10.0.0.2", + "name": "sonic-chassis-lc3", + "nhopself": "0", + "rrclient": "0", + "admin_status": "up" + }, + { + "neighbor": "3333::3:6", + "asn": "65001", + "holdtime": "180", + "keepalive": "60", + "local_addr": "3333::3:3", + "name": "sonic-chassis-lc3", + "nhopself": "0", + "rrclient": "0", + "admin_status": "up" + } + ] + } + }, + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "localhost": { + "bgp_asn": "65001", + "default_bgp_status": "up", + "hostname": "sonic-chassis", + "platform": "voq-chassis", + "switch_type": "voq" + } + } + } + }, + "BGP_VOQ_CHASSIS_WITH_INVALID_SWITCH_TYPE_TEST": { + "sonic-bgp-voq-chassis-neighbor:sonic-bgp-voq-chassis-neighbor": { + "sonic-bgp-voq-chassis-neighbor:BGP_VOQ_CHASSIS_NEIGHBOR": { + "BGP_VOQ_CHASSIS_NEIGHBOR_LIST": [ + { + "neighbor": "10.0.0.1", + "asn": "65001", + "holdtime": "180", + "keepalive": "60", + "local_addr": "10.0.0.2", + "name": "sonic-chassis-lc3", + "nhopself": "0", + "rrclient": "0", + "admin_status": "up" + }, + { + "neighbor": "3333::3:6", + "asn": "65001", + "holdtime": "180", + "keepalive": "60", + "local_addr": "3333::3:3", + "name": "sonic-chassis-lc3", + "nhopself": "0", + "rrclient": "0", + "admin_status": "up" + } + ] + } + }, + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "localhost": { + "bgp_asn": "65001", + "default_bgp_status": "up", + "hostname": "sonic-chassis", + "platform": "voq-chassis", + "switch_type": "chassis-packet" + } + } + } + }, + "BGP_VOQ_CHASSIS_ABSENT_LOCAL_ADDRESS_TEST": { + "sonic-bgp-voq-chassis-neighbor:sonic-bgp-voq-chassis-neighbor": { + "sonic-bgp-voq-chassis-neighbor:BGP_VOQ_CHASSIS_NEIGHBOR": { + "BGP_VOQ_CHASSIS_NEIGHBOR_LIST": [ + { + "neighbor": "10.0.0.1", + "asn": "65001", + "holdtime": "180", + "keepalive": "60", + "local_addr": "10.0.0.2", + "name": "sonic-chassis-lc3", + "nhopself": "0", + "rrclient": "0", + "admin_status": "up" + }, + { + "neighbor": "3333::3:6", + "asn": "65001", + "holdtime": "180", + "keepalive": "60", + "name": "sonic-chassis-lc3", + "nhopself": "0", + "rrclient": "0", + "admin_status": "up" + } + ] + } + }, + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "localhost": { + "bgp_asn": "65001", + "default_bgp_status": "up", + "hostname": "sonic-chassis", + "platform": "voq-chassis", + "switch_type": "voq" + } + } + } + }, + "BGP_VOQ_CHASSIS_INVALID_LOCAL_ADDRESS_ADDRESS_FAMILY_TEST": { + "sonic-bgp-voq-chassis-neighbor:sonic-bgp-voq-chassis-neighbor": { + "sonic-bgp-voq-chassis-neighbor:BGP_VOQ_CHASSIS_NEIGHBOR": { + "BGP_VOQ_CHASSIS_NEIGHBOR_LIST": [ + { + "neighbor": "10.0.0.1", + "asn": "65001", + "holdtime": "180", + "keepalive": "60", + "local_addr": "10.0.0.2", + "name": "sonic-chassis-lc3", + "nhopself": "0", + "rrclient": "0", + "admin_status": "up" + }, + { + "neighbor": "3333::3:6", + "asn": "65001", + "holdtime": "180", + "keepalive": "60", + "local_addr": "3.3.3.3", + "name": "sonic-chassis-lc3", + "nhopself": "0", + "rrclient": "0", + "admin_status": "up" + } + ] + } + }, + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "localhost": { + "bgp_asn": "65001", + "default_bgp_status": "up", + "hostname": "sonic-chassis", + "platform": "voq-chassis", + "switch_type": "voq" + } + } + } + }, + "BGP_VOQ_CHASSIS_INVALID_ASN_TEST": { + "sonic-bgp-voq-chassis-neighbor:sonic-bgp-voq-chassis-neighbor": { + "sonic-bgp-voq-chassis-neighbor:BGP_VOQ_CHASSIS_NEIGHBOR": { + "BGP_VOQ_CHASSIS_NEIGHBOR_LIST": [ + { + "neighbor": "10.0.0.1", + "asn": "65000", + "holdtime": "180", + "keepalive": "60", + "local_addr": "10.0.0.2", + "name": "sonic-chassis-lc3", + "nhopself": "0", + "rrclient": "0", + "admin_status": "up" + }, + { + "neighbor": "3333::3:6", + "asn": "65001", + "holdtime": "180", + "keepalive": "60", + "local_addr": "3333::3:3", + "name": "sonic-chassis-lc3", + "nhopself": "0", + "rrclient": "0", + "admin_status": "up" + } + ] + } + }, + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "localhost": { + "bgp_asn": "65001", + "default_bgp_status": "up", + "hostname": "sonic-chassis", + "platform": "voq-chassis", + "switch_type": "voq" + } + } + } + } +} \ No newline at end of file diff --git a/src/sonic-yang-models/yang-models/sonic-bgp-voq-chassis-neighbor.yang b/src/sonic-yang-models/yang-models/sonic-bgp-voq-chassis-neighbor.yang new file mode 100644 index 000000000000..0a7c6c9f1929 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-bgp-voq-chassis-neighbor.yang @@ -0,0 +1,63 @@ +module sonic-bgp-voq-chassis-neighbor { + namespace "http://github.com/Azure/sonic-bgp-voq-chassis-neighbor"; + prefix bgpintnbr; + yang-version 1.1; + + import ietf-inet-types { + prefix inet; + } + + import sonic-device_metadata { + prefix dm; + } + + import sonic-bgp-common { + prefix bgpcmn; + } + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BGP Internal Neighbor for voq chassis platforms"; + + revision 2021-04-10 { + description + "Initial revision."; + } + + container sonic-bgp-voq-chassis-neighbor { + container BGP_VOQ_CHASSIS_NEIGHBOR { + list BGP_VOQ_CHASSIS_NEIGHBOR_LIST { + description "List for internal neighbors in voq chassis platforms"; + key "neighbor"; + + leaf neighbor { + type inet:ip-address; + description "BGP Neighbor address"; + } + + uses bgpcmn:sonic-bgp-cmn-neigh { + + refine asn { + must "(current() = /dm:sonic-device_metadata/dm:DEVICE_METADATA/dm:localhost/dm:bgp_asn)" { + error-message "Voq chassis BGP neighbors should have same ASN as defined in device metadata"; + } + } + refine local_addr { + mandatory true; + must "((contains(../neighbor, '.') and contains(current(), '.')) or + (contains(../neighbor, ':') and contains(current(), ':')))" { + error-message "local address and neighbor address family doesnt match"; + } + } + } + must "(/dm:sonic-device_metadata/dm:DEVICE_METADATA/dm:localhost/dm:switch_type = 'voq')" { + error-message "Bgp voq neighbor are applicable only when switch_type is voq"; + } + } + } + } +} \ No newline at end of file From 7c4ee4396e80c965bee05997fcb3a1ba49a11863 Mon Sep 17 00:00:00 2001 From: Neetha John Date: Wed, 4 May 2022 15:39:47 -0700 Subject: [PATCH 31/47] Remove referencing in unit test for arista7800 (#10738) Signed-off-by: Neetha John nejo@microsoft.com Why I did it Address build failures due to sonic config engine unit tests failing. Failures are due to referencing format used in Arista 7800 sample output for buffer template How I did it Remove referencing format How to verify it Sonic config engine wheel should be built successfully --- .../py2/buffer-arista7800r3-48cq2-lc.json | 278 +++++++++--------- .../py3/buffer-arista7800r3-48cq2-lc.json | 278 +++++++++--------- 2 files changed, 278 insertions(+), 278 deletions(-) diff --git a/src/sonic-config-engine/tests/sample_output/py2/buffer-arista7800r3-48cq2-lc.json b/src/sonic-config-engine/tests/sample_output/py2/buffer-arista7800r3-48cq2-lc.json index c05eca81eaaa..8ec9e0747110 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/buffer-arista7800r3-48cq2-lc.json +++ b/src/sonic-config-engine/tests/sample_output/py2/buffer-arista7800r3-48cq2-lc.json @@ -62,7 +62,7 @@ }, "BUFFER_PROFILE": { "ingress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "pool":"ingress_lossless_pool", "size":"1280", "dynamic_th":"-2", "xon_offset":"2560", @@ -70,18 +70,18 @@ "xoff":"66048" }, "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "pool":"ingress_lossless_pool", "size":"0", "xon_offset":"0", "static_th":"30535680" }, "egress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "pool":"ingress_lossless_pool", "size":"0", "static_th":"33030144" }, "egress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "pool":"ingress_lossless_pool", "size":"0", "dynamic_th":"-1" } @@ -226,365 +226,365 @@ "BUFFER_QUEUE": { "Ethernet180|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet8|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet184|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet188|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet0|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet4|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet108|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet100|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet128|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet104|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet68|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet96|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet124|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet148|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet92|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet120|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet144|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet52|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet140|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet56|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet164|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet76|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet72|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet64|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet32|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet16|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet36|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet12|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet88|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet116|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet80|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet112|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet84|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet152|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet136|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet156|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet132|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet48|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet44|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet176|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet40|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet28|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet60|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet20|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet24|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet180|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet8|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet184|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet188|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet0|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet4|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet108|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet100|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet128|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet104|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet68|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet96|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet124|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet148|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet92|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet120|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet144|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet52|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet140|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet56|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet164|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet76|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet72|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet64|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet32|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet16|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet36|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet12|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet88|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet116|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet80|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet112|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet84|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet152|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet136|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet156|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet132|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet48|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet44|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet176|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet40|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet28|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet60|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet20|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet24|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet180|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet8|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet184|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet188|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet0|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet4|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet108|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet100|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet128|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet104|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet68|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet96|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet124|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet148|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet92|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet120|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet144|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet52|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet140|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet56|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet164|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet76|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet72|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet64|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet32|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet16|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet36|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet12|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet88|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet116|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet80|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet112|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet84|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet152|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet136|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet156|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet132|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet48|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet44|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet176|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet40|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet28|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet60|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet20|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet24|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" } } } diff --git a/src/sonic-config-engine/tests/sample_output/py3/buffer-arista7800r3-48cq2-lc.json b/src/sonic-config-engine/tests/sample_output/py3/buffer-arista7800r3-48cq2-lc.json index 56538fd0935b..5301516178b2 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/buffer-arista7800r3-48cq2-lc.json +++ b/src/sonic-config-engine/tests/sample_output/py3/buffer-arista7800r3-48cq2-lc.json @@ -62,7 +62,7 @@ }, "BUFFER_PROFILE": { "ingress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "pool":"ingress_lossless_pool", "size":"1280", "dynamic_th":"-2", "xon_offset":"2560", @@ -70,18 +70,18 @@ "xoff":"66048" }, "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "pool":"ingress_lossless_pool", "size":"0", "xon_offset":"0", "static_th":"30535680" }, "egress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "pool":"ingress_lossless_pool", "size":"0", "static_th":"33030144" }, "egress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "pool":"ingress_lossless_pool", "size":"0", "dynamic_th":"-1" } @@ -226,365 +226,365 @@ "BUFFER_QUEUE": { "Ethernet0|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet36|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet40|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet44|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet48|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet52|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet56|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet60|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet64|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet68|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet72|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet4|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet76|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet80|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet84|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet88|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet92|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet96|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet100|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet104|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet108|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet112|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet8|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet116|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet120|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet124|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet128|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet132|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet136|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet140|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet144|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet148|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet152|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet12|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet156|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet164|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet176|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet180|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet184|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet188|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet16|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet20|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet24|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet28|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet32|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + "profile" : "ingress_lossless_profile" }, "Ethernet0|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet36|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet40|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet44|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet48|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet52|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet56|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet60|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet64|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet68|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet72|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet4|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet76|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet80|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet84|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet88|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet92|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet96|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet100|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet104|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet108|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet112|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet8|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet116|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet120|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet124|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet128|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet132|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet136|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet140|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet144|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet148|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet152|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet12|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet156|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet164|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet176|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet180|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet184|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet188|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet16|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet20|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet24|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet28|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet32|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet0|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet36|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet40|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet44|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet48|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet52|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet56|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet60|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet64|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet68|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet72|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet4|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet76|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet80|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet84|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet88|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet92|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet96|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet100|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet104|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet108|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet112|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet8|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet116|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet120|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet124|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet128|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet132|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet136|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet140|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet144|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet148|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet152|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet12|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet156|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet164|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet176|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet180|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet184|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet188|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet16|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet20|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet24|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet28|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" }, "Ethernet32|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + "profile" : "egress_lossy_profile" } } } From f8501224b4c9becc0b41b1fc032df4fc80b3dbfa Mon Sep 17 00:00:00 2001 From: Junchao-Mellanox <57339448+Junchao-Mellanox@users.noreply.github.com> Date: Fri, 6 May 2022 01:11:35 +0800 Subject: [PATCH 32/47] [YANG] Fix issue: Non compliant leaf list in config_db schema (#10291) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### Why I did it Fix issue: Non compliant leaf list in config_db schema: https://github.com/Azure/sonic-buildimage/issues/9801 #### How I did it The basic flow of DPB is like: 1. Transfer config db json value to YANG json value, name it “yangIn” 2. Validate “yangIn” by libyang 3. Generate a YANG json value to represent the target configuration, name it “yangTarget” 4. Do diff between “yangIn” and “yangTarget” 5. Apply the diff to CONFIG DB json and save it back to DB The fix: • For step #1, If value of a leaf-list field string type, transfer it to a list by splitting it with “,” the purpose here is to make step#2 happy. We also need to save .. to a set named “leaf_list_with_string_value_set”. • For step#5, loop “leaf_list_with_string_value_set” and change those fields back to a string. #### How to verify it 1. Manual test 2. Changed sample config DB and unit test passed --- src/sonic-yang-mgmt/sonic_yang.py | 4 +- src/sonic-yang-mgmt/sonic_yang_ext.py | 58 +++++++++++++++++-- .../tests/files/sample_config_db.json | 19 +++--- 3 files changed, 67 insertions(+), 14 deletions(-) diff --git a/src/sonic-yang-mgmt/sonic_yang.py b/src/sonic-yang-mgmt/sonic_yang.py index 6bf590fced38..9af9217ad34b 100644 --- a/src/sonic-yang-mgmt/sonic_yang.py +++ b/src/sonic-yang-mgmt/sonic_yang.py @@ -44,7 +44,9 @@ def __init__(self, yang_dir, debug=False, print_log_enabled=True, sonic_yang_opt # below dict will store preProcessed yang objects, which may be needed by # all yang modules, such as grouping. self.preProcessedYang = dict() - + # element path for CONFIG DB. An example for this list could be: + # ['PORT', 'Ethernet0', 'speed'] + self.elementPath = [] try: self.ctx = ly.Context(yang_dir, sonic_yang_options) except Exception as e: diff --git a/src/sonic-yang-mgmt/sonic_yang_ext.py b/src/sonic-yang-mgmt/sonic_yang_ext.py index 424e567f79d3..8f4279091882 100644 --- a/src/sonic-yang-mgmt/sonic_yang_ext.py +++ b/src/sonic-yang-mgmt/sonic_yang_ext.py @@ -20,6 +20,19 @@ 'CABLE_LENGTH_LIST' ] +# Workaround for those fields who is defined as leaf-list in YANG model but have string value in config DB. +# Dictinary structure key = (, ), value = seperator +LEAF_LIST_WITH_STRING_VALUE_DICT = { + ('MIRROR_SESSION', 'src_ip'): ',', + ('NTP', 'src_intf'): ';', + ('BGP_ALLOWED_PREFIXES', 'prefixes_v4'): ',', + ('BGP_ALLOWED_PREFIXES', 'prefixes_v6'): ',', + ('BUFFER_PORT_EGRESS_PROFILE_LIST', 'profile_list'): ',', + ('BUFFER_PORT_INGRESS_PROFILE_LIST', 'profile_list'): ',', + ('PORT', 'adv_speeds'): ',', + ('PORT', 'adv_interface_types'): ',', +} + """ This is the Exception thrown out of all public function of this class. """ @@ -407,6 +420,11 @@ def _yangConvert(val): # if it is a leaf-list do it for each element if leafDict[key]['__isleafList']: vValue = list() + if isinstance(value, str) and (self.elementPath[0], self.elementPath[-1]) in LEAF_LIST_WITH_STRING_VALUE_DICT: + # For field defined as leaf-list but has string value in CONFIG DB, need do special handling here. For exampe: + # port.adv_speeds in CONFIG DB has value "100,1000,10000", it shall be transferred to [100,1000,10000] as YANG value here to + # make it align with its YANG definition. + value = (x.strip() for x in value.split(LEAF_LIST_WITH_STRING_VALUE_DICT[(self.elementPath[0], self.elementPath[-1])])) for v in value: vValue.append(_yangConvert(v)) else: @@ -545,6 +563,7 @@ def _xlateList(self, model, yang, config, table, exceptionList): primaryKeys = list(config.keys()) for pkey in primaryKeys: try: + self.elementPath.append(pkey) vKey = None self.sysLog(syslog.LOG_DEBUG, "xlateList Extract pkey:{}".\ format(pkey)) @@ -552,9 +571,13 @@ def _xlateList(self, model, yang, config, table, exceptionList): keyDict = self._extractKey(pkey, listKeys) # fill rest of the values in keyDict for vKey in config[pkey]: + self.elementPath.append(vKey) self.sysLog(syslog.LOG_DEBUG, "xlateList vkey {}".format(vKey)) - keyDict[vKey] = self._findYangTypedValue(vKey, \ - config[pkey][vKey], leafDict) + try: + keyDict[vKey] = self._findYangTypedValue(vKey, \ + config[pkey][vKey], leafDict) + finally: + self.elementPath.pop() yang.append(keyDict) # delete pkey from config, done to match one key with one list del config[pkey] @@ -566,6 +589,8 @@ def _xlateList(self, model, yang, config, table, exceptionList): exceptionList.append(str(e)) # with multilist, we continue matching other keys. continue + finally: + self.elementPath.pop() return @@ -596,13 +621,17 @@ def _xlateContainerInContainer(self, model, yang, configC, table): if ccName not in configC: # Inner container doesn't exist in config return + if len(configC[ccName]) == 0: # Empty container, clean config and return del configC[ccName] return self.sysLog(msg="xlateProcessListOfContainer: {}".format(ccName)) + self.elementPath.append(ccName) self._xlateContainer(ccontainer, yang[ccName], \ configC[ccName], table) + self.elementPath.pop() + # clean empty container if len(yang[ccName]) == 0: del yang[ccName] @@ -650,8 +679,10 @@ def _xlateContainer(self, model, yang, config, table): for vKey in vKeys: #vkey must be a leaf\leaf-list\choice in container if leafDict.get(vKey): + self.elementPath.append(vKey) self.sysLog(syslog.LOG_DEBUG, "xlateContainer vkey {}".format(vKey)) yang[vKey] = self._findYangTypedValue(vKey, configC[vKey], leafDict) + self.elementPath.pop() # delete entry from copy of config del configC[vKey] @@ -681,8 +712,10 @@ def _xlateConfigDBtoYang(self, jIn, yangJ): yangJ[key] = dict() if yangJ.get(key) is None else yangJ[key] yangJ[key][subkey] = dict() self.sysLog(msg="xlateConfigDBtoYang {}:{}".format(key, subkey)) + self.elementPath.append(table) self._xlateContainer(cmap['container'], yangJ[key][subkey], \ jIn[table], table) + self.elementPath = [] return @@ -739,9 +772,14 @@ def _revYangConvert(val): # if it is a leaf-list do it for each element if leafDict[key]['__isleafList']: - vValue = list() - for v in value: - vValue.append(_revYangConvert(v)) + if isinstance(value, list) and (self.elementPath[0], self.elementPath[-1]) in LEAF_LIST_WITH_STRING_VALUE_DICT: + # For field defined as leaf-list but has string value in CONFIG DB, we need do special handling here: + # e.g. port.adv_speeds is [10,100,1000] in YANG, need to convert it into a string for CONFIG DB: "10,100,1000" + vValue = LEAF_LIST_WITH_STRING_VALUE_DICT[(self.elementPath[0], self.elementPath[-1])].join((_revYangConvert(x) for x in value)) + else: + vValue = list() + for v in value: + vValue.append(_revYangConvert(v)) elif leafDict[key]['type']['@name'] == 'boolean': vValue = 'true' if value else 'false' else: @@ -850,12 +888,16 @@ def _revXlateList(self, model, yang, config, table): # create key of config DB table pkey, pkeydict = self._createKey(entry, listKeys) self.sysLog(syslog.LOG_DEBUG, "revXlateList pkey:{}".format(pkey)) + self.elementPath.append(pkey) config[pkey]= dict() # fill rest of the entries for key in entry: if key not in pkeydict: + self.elementPath.append(key) config[pkey][key] = self._revFindYangTypedValue(key, \ entry[key], leafDict) + self.elementPath.pop() + self.elementPath.pop() return @@ -879,8 +921,10 @@ def _revXlateContainerInContainer(self, model, yang, config, table): if yang.get(modelContainer['@name']): config[modelContainer['@name']] = dict() self.sysLog(msg="revXlateContainerInContainer {}".format(modelContainer['@name'])) + self.elementPath.append(modelContainer['@name']) self._revXlateContainer(modelContainer, yang[modelContainer['@name']], \ config[modelContainer['@name']], table) + self.elementPath.pop() return """ @@ -912,7 +956,9 @@ def _revXlateContainer(self, model, yang, config, table): #vkey must be a leaf\leaf-list\choice in container if leafDict.get(vKey): self.sysLog(syslog.LOG_DEBUG, "revXlateContainer vkey {}".format(vKey)) + self.elementPath.append(vKey) config[vKey] = self._revFindYangTypedValue(vKey, yang[vKey], leafDict) + self.elementPath.pop() return @@ -940,8 +986,10 @@ def _revXlateYangtoConfigDB(self, yangJ, cDbJson): cDbJson[table] = dict() #print(key + "--" + subkey) self.sysLog(msg="revXlateYangtoConfigDB {}".format(table)) + self.elementPath.append(table) self._revXlateContainer(cmap['container'], yangJ[module_top][container], \ cDbJson[table], table) + self.elementPath = [] return diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index e44e74b531dc..a214560de759 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -65,12 +65,12 @@ }, "BUFFER_PORT_INGRESS_PROFILE_LIST": { "Ethernet9": { - "profile_list": ["ingress_lossy_profile"] + "profile_list": "ingress_lossy_profile" } }, "BUFFER_PORT_EGRESS_PROFILE_LIST": { "Ethernet9": { - "profile_list": ["egress_lossless_profile", "egress_lossy_profile"] + "profile_list": "egress_lossless_profile,egress_lossy_profile" } }, "PORTCHANNEL": { @@ -408,10 +408,7 @@ "NTP": { "global": { "vrf": "mgmt", - "src_intf": [ - "eth0", - "Loopback0" - ] + "src_intf": "eth0;Loopback0" } }, "NTP_SERVER": { @@ -449,7 +446,10 @@ "description": "", "speed": "11100", "tpid": "0x8100", - "admin_status": "up" + "admin_status": "up", + "autoneg": "on", + "adv_speeds": "100000,50000", + "adv_interface_types": "CR,CR4" }, "Ethernet2": { "alias": "Eth1/3", @@ -457,7 +457,10 @@ "description": "", "speed": "11100", "tpid": "0x8100", - "admin_status": "up" + "admin_status": "up", + "autoneg": "on", + "adv_speeds": "all", + "adv_interface_types": "all" }, "Ethernet3": { "alias": "Eth1/4", From db94886ac9d650f47587dacdb16fc5115efda94c Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 5 May 2022 10:24:00 -0700 Subject: [PATCH 33/47] [sonic-snmpagent] Update submodule (#10736) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Includes below commits ``` 1477c36 2022-05-04 | Fix: if routestr does not exist, skip (#257) [Qi Luo] 5c08435 2022-05-04 | Add VoQ Recirc interface (i.e., Ethernet-Rec) to interface maps for S… (#244) [Song Yuan] 57f1af6 2022-05-02 | Fix: not to use blocking get_all() after keys() (#255) [Qi Luo] 33fdf9d 2022-04-06 | [RFC2737, RFC3433] Exclude RJ45 port from Entity MIB and Entity sensor MIB (#247) [Kebo Liu] ``` --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 890f32f333df..1477c368369d 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 890f32f333dfe31c36a8342ff70c0e84910bf9c8 +Subproject commit 1477c368369db44f9a2f9deac0356bbd5fad6364 From 681c24878b9e2ccca9fb4f6549cfca0002d7d05f Mon Sep 17 00:00:00 2001 From: Junchao-Mellanox <57339448+Junchao-Mellanox@users.noreply.github.com> Date: Fri, 6 May 2022 06:21:44 +0800 Subject: [PATCH 34/47] Fix race condition between networking service and interface-config service (#10573) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why I did it The PR is aimed to fix a bug that mgmt port eth0 may loss IP even if user configured static IP of eth0. This is not a always reproduceable issue, the reproducing flow is like: Systemd starts networking service, which runs a dhcp based configuration and assigned an ip from dhcp. Systemd starts interface-config service who depends on networking service Interface-config service runs command “ifdown –force eth0”, check line. but networking service is still running so that this line failed with error: “error: Another instance of this program is already running.”. This error is printed by ifupdown2 lib who is the main process of networking service. So, ifdown actually does not work here, the ip of eth0 is not down. Interface-config service updates /etc/networking/interface to static configuration. Interface-config service runs command “systemctl restart networking”. This command kills the previous networking related processes (log: networking.service: Main process exited, code=killed, status=15/TERM), and try to reconfigure the ip address with static configuration. But it detects that the configured IP and the existing IP are the same, and it does not really configure the ip to kernel. Hence, the ip is still getting from dhcp. (this could be a bug of ifupdown2: previous ip is from dhcp, new ip is a static ip, it treats them as same instead of re-configuring the IP) When the lease of the ip expires, the ip of eth0 is removed by kernel and the issue reproduces. The issue is not always reproduceable because networking service usually runs fast so that it won't hit step#3. How I did it Check networking service state before running "ifdown –force eth0", wait for it done if it is activating. How to verify it Manual test. --- .../interfaces/interfaces-config.sh | 40 +++++++++++++++---- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index 646fd7a94e71..8c8a4e205875 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -1,15 +1,39 @@ #!/bin/bash +function wait_networking_service_done() { + local -i _WDOG_CNT="1" + local -ir _WDOG_MAX="30" + + local -r _TIMEOUT="1s" + + while [[ "${_WDOG_CNT}" -le "${_WDOG_MAX}" ]]; do + networking_status="$(systemctl is-active networking 2>&1)" + + if [[ "${networking_status}" == active || "${networking_status}" == inactive || "${networking_status}" == failed ]] ; then + return + fi + + echo "interfaces-config: networking service is running, wait for it done" + + let "_WDOG_CNT++" + sleep "${_TIMEOUT}" + done + + echo "interfaces-config: networking service is still running after 30 seconds, killing it" + systemctl kill networking 2>&1 +} + if [[ $(ifquery --running eth0) ]]; then + wait_networking_service_done ifdown --force eth0 fi # Check if ZTP DHCP policy has been installed -if [ -e /etc/network/ifupdown2/policy.d/ztp_dhcp.json ]; then +if [[ -e /etc/network/ifupdown2/policy.d/ztp_dhcp.json ]]; then # Obtain port operational state information redis-dump -d 0 -k "PORT_TABLE:Ethernet*" -y > /tmp/ztp_port_data.json - if [ $? -ne 0 ] || [ ! -e /tmp/ztp_port_data.json ] || [ "$(cat /tmp/ztp_port_data.json)" = "" ]; then + if [[ $? -ne 0 || ! -e /tmp/ztp_port_data.json || "$(cat /tmp/ztp_port_data.json)" = "" ]]; then echo "{}" > /tmp/ztp_port_data.json fi @@ -29,28 +53,28 @@ CFGGEN_PARAMS=" \ " sonic-cfggen $CFGGEN_PARAMS -[ -f /var/run/dhclient.eth0.pid ] && kill `cat /var/run/dhclient.eth0.pid` && rm -f /var/run/dhclient.eth0.pid -[ -f /var/run/dhclient6.eth0.pid ] && kill `cat /var/run/dhclient6.eth0.pid` && rm -f /var/run/dhclient6.eth0.pid +[[ -f /var/run/dhclient.eth0.pid ]] && kill `cat /var/run/dhclient.eth0.pid` && rm -f /var/run/dhclient.eth0.pid +[[ -f /var/run/dhclient6.eth0.pid ]] && kill `cat /var/run/dhclient6.eth0.pid` && rm -f /var/run/dhclient6.eth0.pid for intf_pid in $(ls -1 /var/run/dhclient*.Ethernet*.pid 2> /dev/null); do - [ -f ${intf_pid} ] && kill `cat ${intf_pid}` && rm -f ${intf_pid} + [[ -f ${intf_pid} ]] && kill `cat ${intf_pid}` && rm -f ${intf_pid} done # Setup eth1 if we connect to a remote chassis DB. PLATFORM=${PLATFORM:-`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`} CHASSISDB_CONF="/usr/share/sonic/device/$PLATFORM/chassisdb.conf" -[ -f $CHASSISDB_CONF ] && source $CHASSISDB_CONF +[[ -f $CHASSISDB_CONF ]] && source $CHASSISDB_CONF ASIC_CONF="/usr/share/sonic/device/$PLATFORM/asic.conf" -[ -f $ASIC_CONF ] && source $ASIC_CONF +[[ -f $ASIC_CONF ]] && source $ASIC_CONF if [[ -n "$midplane_subnet" && ($NUM_ASIC -gt 1) ]]; then for asic_id in `seq 0 $((NUM_ASIC - 1))`; do NET_NS="asic$asic_id" PIDS=`ip netns pids "$NET_NS" 2>/dev/null` - if [ "$?" -ne "0" ]; then # namespace doesn't exist + if [[ "$?" -ne "0" ]]; then # namespace doesn't exist continue fi From 8ec8900d31806d4f641c91b2b62ec5880b504687 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Fri, 6 May 2022 07:21:30 +0800 Subject: [PATCH 35/47] Support SONiC OpenSSL FIPS 140-3 based on SymCrypt engine (#9573) Why I did it Support OpenSSL FIPS 140-3, see design doc: https://github.com/Azure/SONiC/blob/master/doc/fips/SONiC-OpenSSL-FIPS-140-3.md. How I did it Install the fips packages. To build the fips packages, see https://github.com/Azure/sonic-fips Azure pipelines: https://dev.azure.com/mssonic/build/_build?definitionId=412 How to verify it Validate the SymCrypt engine: admin@sonic:~$ dpkg-query -W | grep openssl openssl 1.1.1k-1+deb11u1+fips symcrypt-openssl 0.1 admin@sonic:~$ openssl engine -v | grep -i symcrypt (symcrypt) SCOSSL (SymCrypt engine for OpenSSL) admin@sonic:~$ --- Makefile.work | 16 +++++- azure-pipelines.yml | 4 +- dockers/docker-base-bullseye/Dockerfile.j2 | 3 +- .../build_templates/sonic_debian_extension.j2 | 12 ++--- installer/x86_64/install.sh | 5 ++ onie-mk-demo.sh | 5 ++ rules/config | 5 ++ rules/docker-base-bullseye.mk | 5 ++ rules/sonic-fips.dep | 10 ++++ rules/sonic-fips.mk | 53 +++++++++++++++++++ slave.mk | 8 ++- sonic-slave-bullseye/Dockerfile.j2 | 20 +++---- src/sonic-fips/.gitignore | 1 + src/sonic-fips/Makefile | 29 ++++++++++ 14 files changed, 152 insertions(+), 24 deletions(-) create mode 100644 rules/sonic-fips.dep create mode 100644 rules/sonic-fips.mk create mode 100644 src/sonic-fips/.gitignore create mode 100644 src/sonic-fips/Makefile diff --git a/Makefile.work b/Makefile.work index cc404b9d7184..9ecd611e92c6 100644 --- a/Makefile.work +++ b/Makefile.work @@ -138,13 +138,25 @@ endif endif SLAVE_IMAGE = $(SLAVE_BASE_IMAGE)-$(USER_LC) +# Support FIPS feature, armhf not supported yet +ifeq ($(PLATFORM_ARCH),armhf) +ENABLE_FIPS_FEATURE := n +ENABLE_FIPS := n +endif + +ifeq ($(ENABLE_FIPS_FEATURE), n) +ifeq ($(ENABLE_FIPS), y) + $(error Cannot set fips config ENABLE_FIPS=y when ENABLE_FIPS_FEATURE=n) +endif +endif + # Generate the version control build info $(shell SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \ TRUSTED_GPG_URLS=$(TRUSTED_GPG_URLS) PACKAGE_URL_PREFIX=$(PACKAGE_URL_PREFIX) \ scripts/generate_buildinfo_config.sh) # Generate the slave Dockerfile, and prepare build info for it -$(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) DOCKER_EXTRA_OPTS=$(DOCKER_EXTRA_OPTS) DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) j2 $(SLAVE_DIR)/Dockerfile.j2 > $(SLAVE_DIR)/Dockerfile) +$(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) ENABLE_FIPS_FEATURE=$(ENABLE_FIPS_FEATURE) DOCKER_EXTRA_OPTS=$(DOCKER_EXTRA_OPTS) DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) j2 $(SLAVE_DIR)/Dockerfile.j2 > $(SLAVE_DIR)/Dockerfile) $(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) j2 $(SLAVE_DIR)/Dockerfile.user.j2 > $(SLAVE_DIR)/Dockerfile.user) $(shell BUILD_SLAVE=y DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) scripts/prepare_docker_buildinfo.sh $(SLAVE_BASE_IMAGE) $(SLAVE_DIR)/Dockerfile $(CONFIGURED_ARCH) "" $(BLDENV)) @@ -355,6 +367,8 @@ SONIC_BUILD_INSTRUCTION := make \ ENABLE_AUTO_TECH_SUPPORT=$(ENABLE_AUTO_TECH_SUPPORT) \ BUILD_MULTIASIC_KVM=$(BUILD_MULTIASIC_KVM) \ ENABLE_ASAN=$(ENABLE_ASAN) \ + ENABLE_FIPS_FEATURE=$(ENABLE_FIPS_FEATURE) \ + ENABLE_FIPS=$(ENABLE_FIPS) \ $(SONIC_OVERRIDE_BUILD_VARS) .PHONY: sonic-slave-build sonic-slave-bash init reset diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 27836a49b1ab..f44704592c9b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -43,7 +43,9 @@ variables: - ${{ else }}: - template: .azure-pipelines/template-variables.yml@buildimage - name: CACHE_MODE - value: rcache + value: rcache +- name: ENABLE_FIPS + value: y stages: - stage: BuildVS diff --git a/dockers/docker-base-bullseye/Dockerfile.j2 b/dockers/docker-base-bullseye/Dockerfile.j2 index cae555174174..f47d56468102 100644 --- a/dockers/docker-base-bullseye/Dockerfile.j2 +++ b/dockers/docker-base-bullseye/Dockerfile.j2 @@ -62,7 +62,8 @@ RUN apt-get update && \ # for processing/handling json files in bash environment jq \ # for sairedis zmq rpc channel - libzmq5 + libzmq5 \ + libwrap0 # Upgrade pip via PyPI and uninstall the Debian version RUN pip3 install --upgrade pip diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 516df5fd224f..419ddf139100 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -330,12 +330,7 @@ sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/restart_service sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install smartmontools=7.2-1 # Install custom-built openssh sshd -sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/openssh-server_*.deb - -# Remove sshd host keys, and will regenerate on first sshd start. This needs to be -# done again here because our custom version of sshd is being installed, which -# will regenerate the sshd host keys. -sudo rm -f $FILESYSTEM_ROOT/etc/ssh/ssh_host_*_key* +sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/openssh-server_${OPENSSH_VERSION}_*.deb {% if sonic_asic_platform == 'broadcom' %} # Install custom-built flashrom @@ -625,6 +620,11 @@ sudo dpkg --root=$FILESYSTEM_ROOT -P {{ debname }} {% endfor %} {% endif %} +# Remove sshd host keys, and will regenerate on first sshd start. This needs to be +# done again here because our custom version of sshd is being installed, which +# will regenerate the sshd host keys. +sudo rm -f $FILESYSTEM_ROOT/etc/ssh/ssh_host_*_key* + sudo rm -f $FILESYSTEM_ROOT/usr/sbin/policy-rc.d # Copy fstrim service and timer file, enable fstrim timer diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index dbab4d54ab72..4411e74edab0 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -666,6 +666,11 @@ else # install_env = "onie" fi fi +# Add extra linux command line +extra_cmdline_linux=%%EXTRA_CMDLINE_LINUX%% +echo "EXTRA_CMDLINE_LINUX=$extra_cmdline_linux" +GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX $extra_cmdline_linux" + cat <> $grub_cfg menuentry '$demo_grub_entry' { search --no-floppy --label --set=root $demo_volume_label diff --git a/onie-mk-demo.sh b/onie-mk-demo.sh index fcfe500e9249..55d0404a1468 100755 --- a/onie-mk-demo.sh +++ b/onie-mk-demo.sh @@ -79,6 +79,11 @@ cp -r $installer_dir/$arch/* $tmp_installdir || clean_up 1 cp onie-image.conf $tmp_installdir cp onie-image-*.conf $tmp_installdir +# Set sonic fips config for the installer script +if [ "$ENABLE_FIPS" = "y" ]; then + EXTRA_CMDLINE_LINUX="$EXTRA_CMDLINE_LINUX sonic_fips=1" +fi + # Escape special chars in the user provide kernel cmdline string for use in # sed. Special chars are: \ / & EXTRA_CMDLINE_LINUX=`echo $EXTRA_CMDLINE_LINUX | sed -e 's/[\/&]/\\\&/g'` diff --git a/rules/config b/rules/config index 348c23b17cb3..415aa795e767 100644 --- a/rules/config +++ b/rules/config @@ -224,3 +224,8 @@ ENABLE_ASAN ?= n # reset default container registry from dockerhub to other DEFAULT_CONTAINER_REGISTRY ?= + +# ENABLE_FIPS_FEATURE - support FIPS feature, only for amd64 or arm64, armhf not supported yet +# ENABLE_FIPS - support FIPS flag, if enabled, no additional config requred for the image to support FIPS +ENABLE_FIPS_FEATURE ?= y +ENABLE_FIPS ?= n diff --git a/rules/docker-base-bullseye.mk b/rules/docker-base-bullseye.mk index fcebb554c777..9d9345bea490 100644 --- a/rules/docker-base-bullseye.mk +++ b/rules/docker-base-bullseye.mk @@ -11,6 +11,11 @@ VIM = vim OPENSSH = openssh-client SSHPASS = sshpass STRACE = strace + +ifeq ($(ENABLE_FIPS_FEATURE), y) +$(DOCKER_BASE_BULLSEYE)_DEPENDS += $(FIPS_OPENSSL_LIBSSL) $(FIPS_OPENSSL_LIBSSL_DEV) $(FIPS_OPENSSL) $(SYMCRYPT_OPENSSL) $(FIPS_KRB5) +endif + $(DOCKER_BASE_BULLSEYE)_DBG_IMAGE_PACKAGES += $(GDB) $(GDBSERVER) $(VIM) $(OPENSSH) $(SSHPASS) $(STRACE) SONIC_DOCKER_IMAGES += $(DOCKER_BASE_BULLSEYE) diff --git a/rules/sonic-fips.dep b/rules/sonic-fips.dep new file mode 100644 index 000000000000..ab2cd62dc2c8 --- /dev/null +++ b/rules/sonic-fips.dep @@ -0,0 +1,10 @@ +SPATH := $($(SYMCRYPT_OPENSSL)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-fips.mk rules/sonic-fips.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) + +$(SYMCRYPT_OPENSSL)_CACHE_MODE := GIT_CONTENT_SHA +$(SYMCRYPT_OPENSSL)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(SYMCRYPT_OPENSSL)_DEP_FILES := $(DEP_FILES) +$(SYMCRYPT_OPENSSL)_SMDEP_FILES := $(SMDEP_FILES) +$(SYMCRYPT_OPENSSL)_SMDEP_PATHS := $(SPATH) diff --git a/rules/sonic-fips.mk b/rules/sonic-fips.mk new file mode 100644 index 000000000000..471f69e9ff4b --- /dev/null +++ b/rules/sonic-fips.mk @@ -0,0 +1,53 @@ +# fips packages + +FIPS_VERSION = 0.1 +FIPS_OPENSSL_VERSION = 1.1.1k-1+deb11u1+fips +FIPS_OPENSSH_VERSION = 8.4p1-5+fips +FIPS_PYTHON_MAIN_VERSION = 3.9 +FIPS_PYTHON_VERSION = 3.9.2-1+fips +FIPS_GOLANG_MAIN_VERSION = 1.15 +FIPS_GOLANG_VERSION = 1.15.15-1~deb11u4+fips +FIPS_KRB5_VERSION = 1.18.3-6+deb11u1+fips +FIPS_URL_PREFIX = https://sonicstorage.blob.core.windows.net/public/fips/$(BLDENV)/$(FIPS_VERSION)/$(CONFIGURED_ARCH) + +SYMCRYPT_OPENSSL_NAME = symcrypt-openssl +SYMCRYPT_OPENSSL = $(SYMCRYPT_OPENSSL_NAME)_$(FIPS_VERSION)_$(CONFIGURED_ARCH).deb +$(SYMCRYPT_OPENSSL)_SRC_PATH = $(SRC_PATH)/sonic-fips + +FIPS_OPENSSL = openssl_$(FIPS_OPENSSL_VERSION)_$(CONFIGURED_ARCH).deb +FIPS_OPENSSL_LIBSSL = libssl1.1_$(FIPS_OPENSSL_VERSION)_$(CONFIGURED_ARCH).deb +FIPS_OPENSSL_LIBSSL_DEV = libssl-dev_$(FIPS_OPENSSL_VERSION)_$(CONFIGURED_ARCH).deb +FIPS_OPENSSL_LIBSSL_DOC = libssl-doc_$(FIPS_OPENSSL_VERSION)_all.deb +FIPS_OPENSSL_ALL = $(FIPS_OPENSSL) $(FIPS_OPENSSL_LIBSSL) $(FIPS_OPENSSL_LIBSSL_DEV) $(FIPS_OPENSSL_LIBSSL_DOC) + +FIPS_OPENSSH = ssh_$(FIPS_OPENSSH_VERSION)_$(CONFIGURED_ARCH).deb +FIPS_OPENSSH_CLIENT = openssh-client_$(FIPS_OPENSSH_VERSION)_$(CONFIGURED_ARCH).deb +FIPS_OPENSSH_SFTP_SERVER = openssh-sftp-server_$(FIPS_OPENSSH_VERSION)_$(CONFIGURED_ARCH).deb +FIPS_OPENSSH_SERVER = openssh-server_$(FIPS_OPENSSH_VERSION)_$(CONFIGURED_ARCH).deb +FIPS_OPENSSH_ALL = $(FIPS_SSH) $(FIPS_OPENSSH_CLIENT) $(FIPS_OPENSSH_SFTP_SERVER) $(FIPS_OPENSSH_SERVER) + +FIPS_PYTHON = python$(FIPS_PYTHON_MAIN_VERSION)_$(FIPS_PYTHON_VERSION)_$(CONFIGURED_ARCH).deb +FIPS_PYTHON_MINIMAL = python$(FIPS_PYTHON_MAIN_VERSION)-minimal_$(FIPS_PYTHON_VERSION)_$(CONFIGURED_ARCH).deb +FIPS_LIBPYTHON = libpython$(FIPS_PYTHON_MAIN_VERSION)_$(FIPS_PYTHON_VERSION)_$(CONFIGURED_ARCH).deb +FIPS_LIBPYTHON_MINIMAL = libpython$(FIPS_PYTHON_MAIN_VERSION)-minimal_$(FIPS_PYTHON_VERSION)_$(CONFIGURED_ARCH).deb +FIPS_LIBPYTHON_STDLIB = libpython$(FIPS_PYTHON_MAIN_VERSION)-stdlib_$(FIPS_PYTHON_VERSION)_$(CONFIGURED_ARCH).deb +FIPS_PYTHON_ALL = $(FIPS_PYTHON) $(FIPS_PYTHON_MINIMAL) $(FIPS_LIBPYTHON) $(FIPS_LIBPYTHON_MINIMAL) $(FIPS_LIBPYTHON_STDLIB) + +FIPS_GOLANG = golang-$(FIPS_GOLANG_MAIN_VERSION)_$(FIPS_GOLANG_VERSION)_all.deb +FIPS_GOLANG_GO = golang-$(FIPS_GOLANG_MAIN_VERSION)-go_$(FIPS_GOLANG_VERSION)_$(CONFIGURED_ARCH).deb +FIPS_GOLANG_SRC = golang-$(FIPS_GOLANG_MAIN_VERSION)-src_$(FIPS_GOLANG_VERSION)_$(CONFIGURED_ARCH).deb +FIPS_GOLANG_DOC = golang-$(FIPS_GOLANG_MAIN_VERSION)-doc_$(FIPS_GOLANG_VERSION)_all.deb +FIPS_GOLANG_ALL = $(FIPS_GOLANG) $(FIPS_GOLANG_GO) $(FIPS_GOLANG_SRC) $(FIPS_GOLANG_DOC) + +FIPS_KRB5 = libk5crypto3_$(FIPS_KRB5_VERSION)_$(CONFIGURED_ARCH).deb +FIPS_KRB5_ALL = $(FIPS_KRB5) + +FIPS_DERIVED_TARGET = $(FIPS_OPENSSL_ALL) $(FIPS_OPENSSH_ALL) $(FIPS_GOLANG_ALL) $(FIPS_PYTHON_ALL) $(FIPS_KRB5_ALL) +FIPS_PACKAGE_ALL = $(SYMCRYPT_OPENSSL) $(FIPS_DERIVED_TARGET) + +$(foreach package,$(FIPS_DERIVED_TARGET),$(eval $(call add_extra_package,$(SYMCRYPT_OPENSSL),$(package)))) + +ifeq ($(ENABLE_FIPS_FEATURE), y) + FIPS_BASEIMAGE_INSTALLERS = $(FIPS_OPENSSL_LIBSSL) $(FIPS_OPENSSL_LIBSSL_DEV) $(FIPS_OPENSSL) $(SYMCRYPT_OPENSSL) $(FIPS_OPENSSH) $(FIPS_OPENSSH_CLIENT) $(FIPS_OPENSSH_SFTP_SERVER) $(FIPS_OPENSSH_SERVER) $(FIPS_KRB5) + SONIC_MAKE_DEBS += $(SYMCRYPT_OPENSSL) +endif diff --git a/slave.mk b/slave.mk index 7342870ac2a7..1a008640b4b9 100644 --- a/slave.mk +++ b/slave.mk @@ -80,6 +80,7 @@ export IMAGE_DISTRO export IMAGE_DISTRO_DEBS_PATH export MULTIARCH_QEMU_ENVIRON export DOCKER_BASE_ARCH +export BLDENV ############################################################################### ## Utility rules @@ -93,7 +94,6 @@ ifneq ($(CONFIGURED_PLATFORM),generic) endif configure : - @mkdir -p $(DEBS_PATH) @mkdir -p $(JESSIE_DEBS_PATH) @mkdir -p $(STRETCH_DEBS_PATH) @mkdir -p $(BUSTER_DEBS_PATH) @@ -271,6 +271,8 @@ endif export SONIC_ROUTING_STACK export FRR_USER_UID export FRR_USER_GID +export ENABLE_FIPS_FEATURE +export ENABLE_FIPS ############################################################################### ## Build Options @@ -332,6 +334,7 @@ $(info "INCLUDE_P4RT" : "$(INCLUDE_P4RT)") $(info "INCLUDE_KUBERNETES" : "$(INCLUDE_KUBERNETES)") $(info "INCLUDE_MACSEC" : "$(INCLUDE_MACSEC)") $(info "INCLUDE_MUX" : "$(INCLUDE_MUX)") +$(info "ENABLE_FIPS_FEATURE" : "$(ENABLE_FIPS_FEATURE)") $(info "TELEMETRY_WRITABLE" : "$(TELEMETRY_WRITABLE)") $(info "ENABLE_AUTO_TECH_SUPPORT" : "$(ENABLE_AUTO_TECH_SUPPORT)") $(info "PDDF_SUPPORT" : "$(PDDF_SUPPORT)") @@ -1054,6 +1057,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $$(addprefix $(FILES_PATH)/,$$($$*_FILES)) \ $(addsuffix -install,$(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$(DEBOOTSTRAP))) \ $(if $(findstring y,$(ENABLE_ZTP)),$(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$(SONIC_ZTP))) \ + $(if $(findstring y,$(ENABLE_FIPS_FEATURE)),$(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$(SYMCRYPT_OPENSSL))) \ $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_UTILITIES_PY3)) \ $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY2)) \ $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY3)) \ @@ -1106,7 +1110,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export include_kubernetes="$(INCLUDE_KUBERNETES)" export kube_docker_proxy="$(KUBE_DOCKER_PROXY)" export enable_pfcwd_on_start="$(ENABLE_PFCWD_ON_START)" - export installer_debs="$(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$($*_INSTALLS))" + export installer_debs="$(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$($*_INSTALLS) $(FIPS_BASEIMAGE_INSTALLERS))" export lazy_installer_debs="$(foreach deb, $($*_LAZY_INSTALLS),$(foreach device, $($(deb)_PLATFORM),$(addprefix $(device)@, $(IMAGE_DISTRO_DEBS_PATH)/$(deb))))" export lazy_build_installer_debs="$(foreach deb, $($*_LAZY_BUILD_INSTALLS), $(addprefix $($(deb)_MACHINE)|,$(deb)))" export installer_images="$(foreach docker, $($*_DOCKERS),\ diff --git a/sonic-slave-bullseye/Dockerfile.j2 b/sonic-slave-bullseye/Dockerfile.j2 index 3e69075a0d05..2d91a3f836c9 100644 --- a/sonic-slave-bullseye/Dockerfile.j2 +++ b/sonic-slave-bullseye/Dockerfile.j2 @@ -397,20 +397,14 @@ RUN sudo augtool --autosave "set /files/etc/dpkg/dpkg.cfg/force-confold" RUN apt-get -y build-dep linux # For gobgp and telemetry build -RUN export VERSION=1.14.2 \ -{%- if CONFIGURED_ARCH == "armhf" %} - && wget https://storage.googleapis.com/golang/go$VERSION.linux-armv6l.tar.gz \ - && tar -C /usr/local -xzf go$VERSION.linux-armv6l.tar.gz \ -{%- elif CONFIGURED_ARCH == "arm64" %} - && wget https://storage.googleapis.com/golang/go$VERSION.linux-arm64.tar.gz \ - && tar -C /usr/local -xzf go$VERSION.linux-arm64.tar.gz \ -{%- else %} - && wget https://storage.googleapis.com/golang/go$VERSION.linux-amd64.tar.gz \ - && tar -C /usr/local -xzf go$VERSION.linux-amd64.tar.gz \ +RUN apt-get install -y golang-1.15 && ln -s /usr/lib/go-1.15 /usr/local/go +{%- if ENABLE_FIPS_FEATURE == "y" %} +RUN wget -O golang-go.deb 'https://sonicstorage.blob.core.windows.net/public/fips/bullseye/0.1/{{ CONFIGURED_ARCH }}/golang-1.15-go_1.15.15-1~deb11u4%2Bfips_{{ CONFIGURED_ARCH }}.deb' \ + && wget -O golang-src.deb 'https://sonicstorage.blob.core.windows.net/public/fips/bullseye/0.1/{{ CONFIGURED_ARCH }}/golang-1.15-src_1.15.15-1~deb11u4%2Bfips_{{ CONFIGURED_ARCH }}.deb' \ + && dpkg -i golang-go.deb golang-src.deb \ + && ln -sf /usr/lib/go-1.15 /usr/local/go \ + && rm golang-go.deb golang-src.deb {%- endif %} - && echo 'export GOROOT=/usr/local/go' >> /etc/bash.bashrc \ - && echo 'export PATH=$PATH:$GOROOT/bin' >> /etc/bash.bashrc \ - && rm go$VERSION.linux-*.tar.gz RUN pip3 install --upgrade pip RUN apt-get purge -y python3-pip python3-yaml diff --git a/src/sonic-fips/.gitignore b/src/sonic-fips/.gitignore new file mode 100644 index 000000000000..f6c56847b1e6 --- /dev/null +++ b/src/sonic-fips/.gitignore @@ -0,0 +1 @@ +sonic-fips diff --git a/src/sonic-fips/Makefile b/src/sonic-fips/Makefile new file mode 100644 index 000000000000..f38583e2f6c8 --- /dev/null +++ b/src/sonic-fips/Makefile @@ -0,0 +1,29 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +SONIC_FIPS_BUILD_FROM_SOURCE =? n + +include ../../rules/sonic-fips.mk + +MAIN_TARGET = $(SYMCRYPT_OPENSSL) + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + if [ "$(SONIC_FIPS_BUILD_FROM_SOURCE)" == "y" ]; then + git clone -b "$(FIPS_VERSION)" https://github.com/Azure/sonic-fips + push sonic-fips + git submodule update --init + push src/SymCrypt; git submodule update --init -- jitterentropy-library; pop + make all + pop + cp sonic-fips/target/*.deb $(DEST)/ + exit 0 + fi + for target in $(FIPS_PACKAGE_ALL); do + filename=$$(basename $$target) + url=$(FIPS_URL_PREFIX)/$$filename + mkdir -p "$$(dirname $(DEST)/$$target)" + wget -O "$(DEST)/$$target" "$$url" + done + +$(addprefix $(DEST)/, $(FIPS_DERIVED_TARGET)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) From cfdb8431df86105698eabe9e5e1ee112c06fd7db Mon Sep 17 00:00:00 2001 From: kellyyeh <42761586+kellyyeh@users.noreply.github.com> Date: Thu, 5 May 2022 18:04:14 -0700 Subject: [PATCH 36/47] [dhcp6relay] Add dhcpv6 option check (#10486) --- .../test_show_dhcp6relay_counters.py | 1 + .../cli/show/plugins/show_dhcp_relay.py | 2 +- src/dhcp6relay/src/relay.cpp | 50 ++++++++++++++----- src/dhcp6relay/src/relay.h | 2 + 4 files changed, 41 insertions(+), 14 deletions(-) diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp6relay_counters.py b/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp6relay_counters.py index 501309ddd4d7..d818fa9c69a3 100644 --- a/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp6relay_counters.py +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp6relay_counters.py @@ -32,6 +32,7 @@ Decline Relay-Forward Relay-Reply + Malformed """ diff --git a/dockers/docker-dhcp-relay/cli/show/plugins/show_dhcp_relay.py b/dockers/docker-dhcp-relay/cli/show/plugins/show_dhcp_relay.py index 2e641c4c4233..91d5082e8f0c 100644 --- a/dockers/docker-dhcp-relay/cli/show/plugins/show_dhcp_relay.py +++ b/dockers/docker-dhcp-relay/cli/show/plugins/show_dhcp_relay.py @@ -12,7 +12,7 @@ DHCPv6_COUNTER_TABLE = 'DHCPv6_COUNTER_TABLE' # DHCPv6 Counter Messages -messages = ["Unknown", "Solicit", "Advertise", "Request", "Confirm", "Renew", "Rebind", "Reply", "Release", "Decline", "Relay-Forward", "Relay-Reply"] +messages = ["Unknown", "Solicit", "Advertise", "Request", "Confirm", "Renew", "Rebind", "Reply", "Release", "Decline", "Relay-Forward", "Relay-Reply", "Malformed"] # DHCP_RELAY Config Table DHCP_RELAY = 'DHCP_RELAY' diff --git a/src/dhcp6relay/src/relay.cpp b/src/dhcp6relay/src/relay.cpp index 951b31f90a0c..f9c7900c2690 100644 --- a/src/dhcp6relay/src/relay.cpp +++ b/src/dhcp6relay/src/relay.cpp @@ -49,18 +49,19 @@ const struct sock_fprog ether_relay_fprog = { /* DHCPv6 Counter */ uint64_t counters[DHCPv6_MESSAGE_TYPE_COUNT]; -std::map counterMap = {{0, "Unknown"}, - {1, "Solicit"}, - {2, "Advertise"}, - {3, "Request"}, - {4, "Confirm"}, - {5, "Renew"}, - {6, "Rebind"}, - {7, "Reply"}, - {8, "Release"}, - {9, "Decline"}, - {12, "Relay-Forward"}, - {13, "Relay-Reply"}}; +std::map counterMap = {{DHCPv6_MESSAGE_TYPE_UNKNOWN, "Unknown"}, + {DHCPv6_MESSAGE_TYPE_SOLICIT, "Solicit"}, + {DHCPv6_MESSAGE_TYPE_ADVERTISE, "Advertise"}, + {DHCPv6_MESSAGE_TYPE_REQUEST, "Request"}, + {DHCPv6_MESSAGE_TYPE_CONFIRM, "Confirm"}, + {DHCPv6_MESSAGE_TYPE_RENEW, "Renew"}, + {DHCPv6_MESSAGE_TYPE_REBIND, "Rebind"}, + {DHCPv6_MESSAGE_TYPE_REPLY, "Reply"}, + {DHCPv6_MESSAGE_TYPE_RELEASE, "Release"}, + {DHCPv6_MESSAGE_TYPE_DECLINE, "Decline"}, + {DHCPv6_MESSAGE_TYPE_RELAY_FORW, "Relay-Forward"}, + {DHCPv6_MESSAGE_TYPE_RELAY_REPL, "Relay-Reply"}, + {DHCPv6_MESSAGE_TYPE_MALFORMED, "Malformed"}}; /** * @code void initialize_counter(swss::DBConnector *db, std::string counterVlan); @@ -85,6 +86,7 @@ void initialize_counter(swss::DBConnector *db, std::string counterVlan) { db->hset(counterVlan, "Decline", toString(counters[DHCPv6_MESSAGE_TYPE_DECLINE])); db->hset(counterVlan, "Relay-Forward", toString(counters[DHCPv6_MESSAGE_TYPE_RELAY_FORW])); db->hset(counterVlan, "Relay-Reply", toString(counters[DHCPv6_MESSAGE_TYPE_RELAY_REPL])); + db->hset(counterVlan, "Malformed", toString(counters[DHCPv6_MESSAGE_TYPE_MALFORMED])); } /** @@ -622,6 +624,8 @@ void callback(evutil_socket_t fd, short event, void *arg) { current_position = tmp; auto msg = parse_dhcpv6_hdr(current_position); + auto option_position = current_position + sizeof(struct dhcpv6_msg); + counters[msg->msg_type]++; std::string counterVlan = counter_table; update_counter(config->db, counterVlan.append(config->interface), msg->msg_type); @@ -632,11 +636,31 @@ void callback(evutil_socket_t fd, short event, void *arg) { relay_relay_forw(config->local_sock, current_position, ntohs(udp_header->len) - sizeof(udphdr), ip_header, config); break; } - default: + case DHCPv6_MESSAGE_TYPE_SOLICIT: + case DHCPv6_MESSAGE_TYPE_REQUEST: + case DHCPv6_MESSAGE_TYPE_RENEW: + case DHCPv6_MESSAGE_TYPE_REBIND: + case DHCPv6_MESSAGE_TYPE_RELEASE: + case DHCPv6_MESSAGE_TYPE_DECLINE: { + while (option_position - message_buffer < len) { + auto option = parse_dhcpv6_opt(option_position, &tmp); + option_position = tmp; + if(ntohs(option->option_code) > DHCPv6_OPTION_LIMIT) { + counters[DHCPv6_MESSAGE_TYPE_MALFORMED]++; + update_counter(config->db, counterVlan.append(config->interface), DHCPv6_MESSAGE_TYPE_MALFORMED); + syslog(LOG_WARNING, "DHCPv6 option is invalid or contains malformed payload\n"); + return; + } + } relay_client(config->local_sock, current_position, ntohs(udp_header->len) - sizeof(udphdr), ip_header, ether_header, config); break; } + default: + { + syslog(LOG_WARNING, "DHCPv6 client message received was not relayed\n"); + break; + } } } diff --git a/src/dhcp6relay/src/relay.h b/src/dhcp6relay/src/relay.h index c224a9b28630..29e365bb5d83 100644 --- a/src/dhcp6relay/src/relay.h +++ b/src/dhcp6relay/src/relay.h @@ -16,6 +16,7 @@ #define RELAY_PORT 547 #define CLIENT_PORT 546 #define HOP_LIMIT 8 //HOP_LIMIT reduced from 32 to 8 as stated in RFC8415 +#define DHCPv6_OPTION_LIMIT 56 // DHCPv6 option code greater than 56 are currently unassigned #define lengthof(A) (sizeof (A) / sizeof (A)[0]) @@ -37,6 +38,7 @@ typedef enum DHCPv6_MESSAGE_TYPE_DECLINE = 9, DHCPv6_MESSAGE_TYPE_RELAY_FORW = 12, DHCPv6_MESSAGE_TYPE_RELAY_REPL = 13, + DHCPv6_MESSAGE_TYPE_MALFORMED = 14, DHCPv6_MESSAGE_TYPE_COUNT } dhcp_message_type_t; From 9ae17e66a392429899d8b371eca2361ced303150 Mon Sep 17 00:00:00 2001 From: vmittal-msft <46945843+vmittal-msft@users.noreply.github.com> Date: Thu, 5 May 2022 20:27:29 -0700 Subject: [PATCH 37/47] [sonic-sairedis update] Support for SAI header v1.10.2 with BRCM SAI v7.1.0.0 and MLNX SAI v1.21.1.0 (#10583) --- platform/broadcom/sai-modules.mk | 4 +- platform/broadcom/sai.mk | 4 +- platform/broadcom/saibcm-modules-dnx | 2 +- .../broadcom/saibcm-modules/debian/changelog | 6 + .../saibcm-modules/include/soc/cmic.h | 37 - .../make/Makefile.linux-bmw-2_6 | 122 - .../saibcm-modules/make/Makefile.linux-gto | 127 -- .../make/Makefile.linux-gto-2_6 | 270 --- .../make/Makefile.linux-jag-2_6 | 166 -- .../make/Makefile.linux-nsx-2_6 | 56 - .../saibcm-modules/make/Makefile.linux-nsx64 | 54 - .../make/Makefile.linux-nsx_wrl-2_6 | 127 -- .../saibcm-modules/make/Makefile.linux-raptor | 53 - .../make/Makefile.linux-raptor-2_6 | 172 -- .../kernel/modules/bcm-ptp-clock/Makefile | 65 - .../modules/bcm-ptp-clock/bcm-ptp-clock.c | 1999 ----------------- .../linux/kernel/modules/knet-cb/psample-cb.c | 2 +- .../linux/kernel/modules/psample/psample.c | 2 + .../linux/kernel/modules/shared/ksal.c | 6 + .../systems/linux/user/bmw-2_6/Makefile | 63 - .../systems/linux/user/gto-2_6/Makefile | 84 - .../systems/linux/user/gto/Makefile | 60 - .../systems/linux/user/jag-2_6/Makefile | 79 - .../systems/linux/user/nsx-2_6/Makefile | 58 - .../systems/linux/user/nsx64/Makefile | 57 - .../systems/linux/user/nsx_wrl-2_6/Makefile | 65 - .../systems/linux/user/raptor-2_6/Makefile | 79 - .../systems/linux/user/raptor/Makefile | 58 - platform/mellanox/mlnx-sai.mk | 2 +- platform/mellanox/mlnx-sai/SAI-Implementation | 2 +- slave.mk | 2 +- src/sonic-sairedis | 2 +- 32 files changed, 24 insertions(+), 3861 deletions(-) delete mode 100644 platform/broadcom/saibcm-modules/include/soc/cmic.h delete mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-bmw-2_6 delete mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-gto delete mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-gto-2_6 delete mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-jag-2_6 delete mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-nsx-2_6 delete mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-nsx64 delete mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-nsx_wrl-2_6 delete mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-raptor delete mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-raptor-2_6 delete mode 100644 platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-ptp-clock/Makefile delete mode 100644 platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-ptp-clock/bcm-ptp-clock.c delete mode 100644 platform/broadcom/saibcm-modules/systems/linux/user/bmw-2_6/Makefile delete mode 100644 platform/broadcom/saibcm-modules/systems/linux/user/gto-2_6/Makefile delete mode 100644 platform/broadcom/saibcm-modules/systems/linux/user/gto/Makefile delete mode 100644 platform/broadcom/saibcm-modules/systems/linux/user/jag-2_6/Makefile delete mode 100644 platform/broadcom/saibcm-modules/systems/linux/user/nsx-2_6/Makefile delete mode 100644 platform/broadcom/saibcm-modules/systems/linux/user/nsx64/Makefile delete mode 100644 platform/broadcom/saibcm-modules/systems/linux/user/nsx_wrl-2_6/Makefile delete mode 100644 platform/broadcom/saibcm-modules/systems/linux/user/raptor-2_6/Makefile delete mode 100644 platform/broadcom/saibcm-modules/systems/linux/user/raptor/Makefile diff --git a/platform/broadcom/sai-modules.mk b/platform/broadcom/sai-modules.mk index 1236e06d6240..5aa7792064cb 100644 --- a/platform/broadcom/sai-modules.mk +++ b/platform/broadcom/sai-modules.mk @@ -1,6 +1,6 @@ # Broadcom SAI modules -BRCM_OPENNSL_KERNEL_VERSION = 6.1.0.3 +BRCM_OPENNSL_KERNEL_VERSION = 7.1.0.0 BRCM_OPENNSL_KERNEL = opennsl-modules_$(BRCM_OPENNSL_KERNEL_VERSION)_amd64.deb $(BRCM_OPENNSL_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/saibcm-modules @@ -10,7 +10,7 @@ $(BRCM_OPENNSL_KERNEL)_MACHINE = broadcom SONIC_DPKG_DEBS += $(BRCM_OPENNSL_KERNEL) # SAI bcm modules for DNX family ASIC -BRCM_DNX_OPENNSL_KERNEL_VERSION = 6.1.0.3 +BRCM_DNX_OPENNSL_KERNEL_VERSION = 7.1.0.0 BRCM_DNX_OPENNSL_KERNEL = opennsl-modules-dnx_$(BRCM_DNX_OPENNSL_KERNEL_VERSION)_amd64.deb $(BRCM_DNX_OPENNSL_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/saibcm-modules-dnx diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 1ec8d915e5bd..872c51276fe5 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,5 +1,5 @@ -LIBSAIBCM_VERSION = 6.1.0.3 -LIBSAIBCM_BRANCH_NAME = REL_6.1 +LIBSAIBCM_VERSION = 7.1.0.0 +LIBSAIBCM_BRANCH_NAME = REL_7.0 LIBSAIBCM_URL_PREFIX = "https://sonicstorage.blob.core.windows.net/public/sai/bcmsai/$(LIBSAIBCM_BRANCH_NAME)/$(LIBSAIBCM_VERSION)" BRCM_SAI = libsaibcm_$(LIBSAIBCM_VERSION)_amd64.deb diff --git a/platform/broadcom/saibcm-modules-dnx b/platform/broadcom/saibcm-modules-dnx index 6bf58f8310bc..fb4cf12529bc 160000 --- a/platform/broadcom/saibcm-modules-dnx +++ b/platform/broadcom/saibcm-modules-dnx @@ -1 +1 @@ -Subproject commit 6bf58f8310bcb29168ae5b2dabed84fc942429fc +Subproject commit fb4cf12529bc27fffc1c988029f4db100138f133 diff --git a/platform/broadcom/saibcm-modules/debian/changelog b/platform/broadcom/saibcm-modules/debian/changelog index 0ff357c57279..daa78471c6b2 100644 --- a/platform/broadcom/saibcm-modules/debian/changelog +++ b/platform/broadcom/saibcm-modules/debian/changelog @@ -1,3 +1,9 @@ +opennsl (7.1.0.0) unstable; urgency=medium + + * Update to Broadcom SAI 7.1.0.0. + + -- Vineet Mittal Tue, 19 APR 2022 12:30:00 +0000 + opennsl (6.1.0.3) unstable; urgency=medium * Update to Broadcom SAI 6.1.0.3 diff --git a/platform/broadcom/saibcm-modules/include/soc/cmic.h b/platform/broadcom/saibcm-modules/include/soc/cmic.h deleted file mode 100644 index 5bf6130237a2..000000000000 --- a/platform/broadcom/saibcm-modules/include/soc/cmic.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2017 Broadcom - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, as - * published by the Free Software Foundation (the "GPL"). - * - * 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 version 2 (GPLv2) for more details. - * - * You should have received a copy of the GNU General Public License - * version 2 (GPLv2) along with this source code. - */ -/* - * $Id: cmic.h,v 1.1 Broadcom SDK $ - * $Copyright: (c) 2005 Broadcom Corp. - * All Rights Reserved.$ - * - * File: cmic.h - * Purpose: Maps out structures used for CMIC operations and - * exports routines and constants. - */ - -#ifndef _SOC_CMIC_H -#define _SOC_CMIC_H - -/* IRQ Register (RO) */ -#define CMIC_IRQ_STAT 0x00000144 - -/* IRQ Mask Registers (R/W) */ -#define CMIC_IRQ_MASK 0x00000148 -#define CMIC_IRQ_MASK_1 0x0000006C -#define CMIC_IRQ_MASK_2 0x00000070 - -#endif /* !_SOC_CMIC_H */ diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-bmw-2_6 b/platform/broadcom/saibcm-modules/make/Makefile.linux-bmw-2_6 deleted file mode 100644 index 6fa170fb75e6..000000000000 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-bmw-2_6 +++ /dev/null @@ -1,122 +0,0 @@ -# -# Copyright 2017 Broadcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License, version 2, as -# published by the Free Software Foundation (the "GPL"). -# -# 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 version 2 (GPLv2) for more details. -# -# You should have received a copy of the GNU General Public License -# version 2 (GPLv2) along with this source code. -# -# $Id: Makefile.linux-bmw-2_6,v 1.20 Broadcom SDK $ -# $Copyright: (c) 2005 Broadcom Corp. -# All Rights Reserved.$ - -# Look for custom tools -ifneq (,$(PPC_TOOLS_DIR)) -ifneq (,$(PPC_CROSS_COMPILE)) -override PATH := $(PPC_TOOLS_DIR):$(PATH) -override CROSS_COMPILE := $(PPC_CROSS_COMPILE) -endif -endif - -# Default tools -ifeq (,$(WRS_LINUX_VERSION)) -WRS_LINUX_VERSION=2.0 -endif - -# Default Linux Kernel directory -ifeq (,$(KERNDIR)) - -ifeq (1.4,$(WRS_LINUX_VERSION)) - -KERNDIR := /projects/ntsw-tools/linux/wrslinux_1.4/bcm98245cpci/build/linux-2.6.14-cgl - -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE = powerpc-wrs-linux-gnu-603e-glibc_std- -endif - -WRLINUX_BASE=/tools/windriver/linux_ed/1.4/Linux -export WIND_LIC_PROXY = $(WRLINUX_BASE)/setup/x86-linux2/bin -override PATH := $(WRLINUX_BASE)/gnu/3.4.4-wrlinux-1.4/x86-linux2/bin:$(PATH) - -WRS_SYSROOT_PATH := $(WRLINUX_GNU_PATH)/../lib/gcc/powerpc-wrs-linux-gnu/3.4.4/include -else - -ifeq (2.0,$(WRS_LINUX_VERSION)) - -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE = powerpc-wrs-linux-gnu-ppc_603e-glibc_std- -endif - -KERNDIR:= /projects/ntsw-tools/linux/wrslinux_2.0/bmw/glibc_std/build/linux-2.6.21-standard - -WRLINUX_BASE=/tools/windriver/linux_ed/2.0_GA/Linux - -TOOLCHAIN_EXEC_PREFIX=$(WRLINUX_BASE)/gnu/4.1-wrlinux-2.0/x86-linux2 -TOOLCHAIN_BIN_DIR=$(TOOLCHAIN_EXEC_PREFIX) -WIND_LIC_PROXY=$(WRLINUX_BASE)/setup/x86-linux2/bin - -WRLINUX_GNU_PATH = $(WRLINUX_BASE)/gnu/4.1-wrlinux-2.0/x86-linux2/bin - -override PATH := $(TOOLCHAIN_EXEC_PREFIX):$(KERNDIR)/../../host-cross/bin:$(KERNDIR)/../../host-cross/powerpc-wrs-linux-gnu/bin:$(WRLINUX_GNU_PATH):$(PATH) - -export TOOLCHAIN_EXEC_PREFIX TOOLCHAIN_BIN_DIR WIND_LIC_PROXY - -WRS_SYSROOT_PATH := $(WRLINUX_GNU_PATH)/../lib/gcc/powerpc-wrs-linux-gnu/4.1.2/include - -comma = , -basetarget = $(basename $(notdir $@)) -modname = $(basetarget) - -# Extra variables. -EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) - -name-fix = $(subst $(comma),_,$(subst -,_,$1)) -basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" -modname_flags = $(if $(filter 1,$(words $(modname))),\ - -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") -endif -endif -endif - -# Default Linux include directory -ifeq (,$(LINUX_INCLUDE)) -LINUX_INCLUDE := $(KERNDIR)/include -endif - -CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1 -ENDIAN = BE_HOST=1 -CFGFLAGS += -D$(ENDIAN) -CFGFLAGS += -DBCM_PLATFORM_STRING=\"BMW_MPC8245/PPC603e\" - -ARCH = ppc -KBUILD_VERBOSE = 1 - -export ARCH KBUILD_VERBOSE - -ifeq (1.4,$(WRS_LINUX_VERSION)) -# From linux/arch/ppc/Makefile - -ifeq (,$(KFLAGS)) -KFLAGS := -D__KERNEL__ -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -fsigned-char -msoft-float -pipe -ffixed-r2 -Wno-uninitialized -mmultiple -mstring -endif - -else -ifeq (2.0,$(WRS_LINUX_VERSION)) - -ifeq (,$(KFLAGS)) -KFLAGS := -D__KERNEL__ -m32 -nostdinc -isystem $(WRS_SYSROOT_PATH) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/linux/autoconf.h -I$(KERNDIR)/arch/ppc -I$(KERNDIR)/arch/ppc/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -msoft-float -pipe -ffixed-r2 -mmultiple -mno-altivec -mstring -fomit-frame-pointer -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -endif - -endif -endif - -ifneq ($(targetplat),user) -include ${SDK}/make/Makefile.linux-kernel-2_6 -endif diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-gto b/platform/broadcom/saibcm-modules/make/Makefile.linux-gto deleted file mode 100644 index 4a20a99dac69..000000000000 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-gto +++ /dev/null @@ -1,127 +0,0 @@ -# -# Copyright 2017 Broadcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License, version 2, as -# published by the Free Software Foundation (the "GPL"). -# -# 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 version 2 (GPLv2) for more details. -# -# You should have received a copy of the GNU General Public License -# version 2 (GPLv2) along with this source code. -# -# $Id: Makefile.linux-gto-4_4,v 1.42 Broadcom SDK $ -# $Copyright: (c) 2015 Broadcom Corp. -# All Rights Reserved.$ - -# User must select one platform from below. -ifeq (,$(BUILD_PLATFORM)) -BUILD_PLATFORM=POWERPC_LINUX -endif - -# TOOLCHAIN_BASE_DIR Toolchain base directory for GTO devices -# TARGET_ARCHITECTURE Compiler for target architecture -# KERNDIR Kernel directory for iPROC-CMICd devices -TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/gto -TARGET_ARCHITECTURE := powerpc-broadcom-linux-gnuspe -KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/current - - -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE := $(TARGET_ARCHITECTURE)- -endif - - -# GTO toolchain -TOOLCHAIN_BIN_DIR := $(TOOLCHAIN_BASE_DIR)/toolchain/host/usr/bin -override PATH := $(TOOLCHAIN_BIN_DIR)/../$(TARGET_ARCHITECTURE)/bin:$(TOOLCHAIN_BIN_DIR):$(PATH) -export TOOLCHAIN_BIN_DIR - - -# Default Linux include directory -ifeq (,$(LINUX_INCLUDE)) -LINUX_INCLUDE := $(KERNDIR)/include -endif - -CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1 -ENDIAN = BE_HOST=1 -CFGFLAGS += -D$(ENDIAN) -CFGFLAGS += -DBCM_PLATFORM_STRING=\"GTO_MPC8548\" -CFGFLAGS += -DSAL_BDE_DMA_MEM_DEFAULT=32 - -# Extra variables. -EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) - -ARCH = powerpc -KBUILD_VERBOSE = 1 - -export ARCH KBUILD_VERBOSE - - -# From linux/arch/ppc/Makefile -comma = , -basetarget = $(basename $(notdir $@)) -modname = $(basetarget) - -name-fix = $(subst $(comma),_,$(subst -,_,$1)) -basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" -modname_flags = $(if $(filter 1,$(words $(modname))),\ - -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") - -KFLAG_INCLD = $(TOOLCHAIN_BIN_DIR)/../lib/gcc/$(TARGET_ARCHITECTURE)/4.6.4/include - -ifdef BROADCOM_SVK -ifeq ($PLX_PCI2LBUS, 1) -CFLAGS += -DBCM_PLX9656_LOCAL_BUS -DBDE_LINUX_NON_INTERRUPTIBLE -endif -endif - -ifdef DPP_CHIPS -CFLAGS += -DDUNE_BCM -D__DUNE_LINUX_BCM_CPU_PCP_DMA__ -CFGFLAGS += -DSOC_CM_FUNCTION -endif - -ifdef DFE_CHIPS -CFLAGS += -DDUNE_BCM -CFGFLAGS += -DSOC_CM_FUNCTION -endif - -ifdef SAND_CHIPS -CFLAGS += -D__DUNE_GTO_BCM_CPU__ -D__DUNE_LINUX_BCM_CPU_PCIE__ -endif - -ifdef SHADOW_PLX -CFLAGS += -DBCM_PLX9656_LOCAL_BUS -DBDE_LINUX_NON_INTERRUPTIBLE -DSHADOW_SVK -endif - -ifdef LTSW_CHIPS -# Default open source target build -OPENSRC_BUILD ?= uclibc_201402_ppc - -# Hardware interface (see $SDKLT/bcma/sys/probe directory) -SYSTEM_INTERFACE ?= ngbde - -# Turn on direct register access if running on real hardware. -ifeq (ngbde,$(SYSTEM_INTERFACE)) -LTSW_ADD_CPPFLAGS += -DBCMDRD_CONFIG_MEMMAP_DIRECT=1 -endif - -export SYSTEM_INTERFACE -endif - -ifeq (,$(KFLAGS)) -KFLAGS := -D__KERNEL__ -m32 -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/generated/uapi/linux/version.h -include $(LINUX_INCLUDE)/generated/autoconf.h -I$(KERNDIR)/arch/powerpc -I$(KERNDIR)/arch/powerpc/include -I$(KERNDIR)/include/asm-powerpc -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -msoft-float -pipe -ffixed-r2 -mmultiple -mno-altivec -funit-at-a-time -Wa,-me500 -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -endif - -ifneq (,$(findstring TCL,$(FEATURE_LIST))) -#LINK_STATIC = 0 -#export LINK_STATIC -endif - -ifneq ($(targetplat),user) -include ${SDK}/make/Makefile.linux-kernel-4_4 -endif - diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-gto-2_6 b/platform/broadcom/saibcm-modules/make/Makefile.linux-gto-2_6 deleted file mode 100644 index 56085c7a3cdd..000000000000 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-gto-2_6 +++ /dev/null @@ -1,270 +0,0 @@ -# -# Copyright 2017 Broadcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License, version 2, as -# published by the Free Software Foundation (the "GPL"). -# -# 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 version 2 (GPLv2) for more details. -# -# You should have received a copy of the GNU General Public License -# version 2 (GPLv2) along with this source code. -# -# $Id: Makefile.linux-gto-2_6,v 1.42 Broadcom SDK $ -# $Copyright: (c) 2005 Broadcom Corp. -# All Rights Reserved.$ - -# User must select one platform from below.By default WR_LINUX is selected. . -ifeq (,$(BUILD_PLATFORM)) -#BUILD_PLATFORM=ELDK -BUILD_PLATFORM=WR_LINUX -endif - -# Specify the ELDK version you want to use for building SDK. -ifeq (,$(ELDK_VERSION)) -ifeq (ELDK,$(BUILD_PLATFORM)) -ELDK_VERSION=4.0 -endif -endif - -# Specify the KERNEL VERSION you want to use for building SDK. -ifeq (,$(KERN_VER)) -ifeq (ELDK,$(BUILD_PLATFORM)) -KERN_VER=2.6.21.7 -endif -endif - - -# Specify the Windriver Linux version here.For example '2.0' as shown below. -ifeq (WR_LINUX,$(BUILD_PLATFORM)) -ifeq (,$(WRS_LINUX_VERSION)) -WRS_LINUX_VERSION=2.0 -endif -endif - - -#glibc_small and glibc_std have their own cross-compilation tools and and path for these tools are different as implemented below. To enable glibc_small build, line given below should be uncommented. - -#WRL_GLIBC_SMALL=TRUE - -ifeq (2.0,$(WRS_LINUX_VERSION)) -ifeq ($(WRL_GLIBC_SMALL),TRUE) - -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE := powerpc-wrs-linux-gnu-ppc_e500v2-glibc_small- -endif - -KERNDIR ?=/projects/ntsw-tools/linux/wrslinux_2.0/gto/glibc_small/build/linux-2.6.21-standard - -else - -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE := powerpc-wrs-linux-gnu-ppc_e500v2-glibc_std- -endif - -KERNDIR ?= /projects/ntsw-tools/linux/wrslinux_2.0/gto/glibc_std/build/linux-2.6.21-standard - -endif - -export WRL_GLIBC_SMALL - -# After this point glibc_std and glibc_small share these flags - -WRLINUX_BASE ?=/tools/windriver/linux_ed/2.0_GA/Linux -TOOLCHAIN_EXEC_PREFIX=$(WRLINUX_BASE)/gnu/4.1-wrlinux-2.0/x86-linux2 -TOOLCHAIN_BIN_DIR=$(TOOLCHAIN_EXEC_PREFIX) -WIND_LIC_PROXY=$(WRLINUX_BASE)/setup/x86-linux2/bin -WRLINUX_GNU_PATH = $(WRLINUX_BASE)/gnu/4.1-wrlinux-2.0/x86-linux2/bin -override PATH := $(TOOLCHAIN_EXEC_PREFIX):$(KERNDIR)/../../host-cross/bin:$(KERNDIR)/../../host-cross/powerpc-wrs-linux-gnu/bin:$(WRLINUX_GNU_PATH):$(PATH) -export TOOLCHAIN_EXEC_PREFIX TOOLCHAIN_BIN_DIR WIND_LIC_PROXY -endif - - -ifeq (3.0,$(WRS_LINUX_VERSION)) -ifeq ($(WRL_GLIBC_SMALL),TRUE) - -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE := powerpc-wrs-linux-gnu-ppc_e500v2-glibc_small- -endif - -KERNDIR ?=/projects/ntsw-tools/linux/wrslinux_3.0/gto/bcm98548xmc_30_glibc_small/build/linux-broadcom_bcm98548xmc-standard-build -KERNDIR_STD ?=/projects/ntsw-tools/linux/wrslinux_3.0/gto/bcm98548xmc_30_glibc_small/build/linux - -else - -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE := powerpc-wrs-linux-gnu-ppc_e500v2-glibc_std- -endif - -KERNDIR ?=/projects/ntsw-tools/linux/wrslinux_3.0/gto/bcm98548xmc_30_glibc_std_debug/build/linux-broadcom_bcm98548xmc-standard-build -KERNDIR_STD ?=/projects/ntsw-tools/linux/wrslinux_3.0/gto/bcm98548xmc_30_glibc_std_debug/build/linux - -endif - -export WRL_GLIBC_SMALL - -# After this point glibc_std and glibc_small share these flags - -WRLINUX_BASE ?=/tools/windriver/linux_ed/3.0/Linux -TOOLCHAIN_EXEC_PREFIX=$(WRLINUX_BASE)/wrlinux-3.0/layers/wrll-toolchain-4.3-85/powerpc/toolchain/x86-linux2 -TOOLCHAIN_BIN_DIR=$(TOOLCHAIN_EXEC_PREFIX) -WIND_LIC_PROXY=$(WRLINUX_BASE)/setup/x86-linux2/bin -WRLINUX_GNU_PATH = $(WRLINUX_BASE)/wrlinux-3.0/layers/wrll-toolchain-4.3-85/powerpc/toolchain/x86-linux2/bin -override PATH := $(TOOLCHAIN_EXEC_PREFIX):$(KERNDIR_STD)/../../host-cross/bin:$(KERNDIR_STD)/../../host-cross/powerpc-wrs-linux-gnu/bin:$(WRLINUX_GNU_PATH):$(PATH) -export TOOLCHAIN_EXEC_PREFIX TOOLCHAIN_BIN_DIR WIND_LIC_PROXY - -LINUX_INCLUDE_STD := $(KERNDIR_STD)/include - -endif - -ifeq (ELDK,$(BUILD_PLATFORM)) -ifeq (2.6.21.7, $(KERN_VER)) - -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE := ppc_85xx- -endif - -ifeq (4.0, $(ELDK_VERSION)) -override PATH := /tools/eldk/4.0/usr/bin:$(PATH) -else -override PATH := /tools/eldk/4.1/usr/bin:$(PATH) -endif -KERNDIR ?= /projects/ntsw-tools/linux/eldk/gto_eldk/linux-2.6.21.7 -endif -endif - -ifeq (ELDK,$(BUILD_PLATFORM)) -ifeq (2.6.24.4, $(KERN_VER)) - -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE := ppc_85xx- -endif - -ifeq (4.0, $(ELDK_VERSION)) -override PATH := /tools/eldk/4.0/usr/bin:$(PATH) -else -override PATH := /tools/eldk/4.1/usr/bin:$(PATH) -endif -KERNDIR ?= /projects/ntsw-tools/linux/eldk/gto_eldk/linux-2.6.24.4 -endif -endif - - -ifeq (ELDK,$(BUILD_PLATFORM)) -ifeq (2.6.25, $(KERN_VER)) - -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE := ppc_85xx- -endif - -ifeq (4.0, $(ELDK_VERSION)) -override PATH := /tools/eldk/4.0/usr/bin:$(PATH) -else -override PATH := /tools/eldk/4.1/usr/bin:$(PATH) -endif -KERNDIR ?= /projects/ntsw-tools/linux/eldk/gto_eldk/linux-2.6.25 -endif -endif - - -# Default Linux include directory -ifeq (,$(LINUX_INCLUDE)) -LINUX_INCLUDE := $(KERNDIR)/include -endif - -CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1 -ENDIAN = BE_HOST=1 -CFGFLAGS += -D$(ENDIAN) -CFGFLAGS += -DBCM_PLATFORM_STRING=\"GTO_MPC8548\" -CFGFLAGS += -DSAL_BDE_DMA_MEM_DEFAULT=32 - -# Extra variables. -EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) - -ARCH = powerpc -KBUILD_VERBOSE = 1 - -export ARCH KBUILD_VERBOSE - - -# From linux/arch/ppc/Makefile -comma = , -basetarget = $(basename $(notdir $@)) -modname = $(basetarget) - -name-fix = $(subst $(comma),_,$(subst -,_,$1)) -basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" -modname_flags = $(if $(filter 1,$(words $(modname))),\ - -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") - - -ifeq (,$(KFLAG_INCLD)) -ifeq (4.0,$(ELDK_VERSION)) -ifeq (ELDK,$(BUILD_PLATFORM)) -KFLAG_INCLD = /tools/eldk/4.0/usr/lib/gcc/powerpc-linux/4.0.0/include -endif -endif - -ifeq (4.1,$(ELDK_VERSION)) -ifeq (ELDK,$(BUILD_PLATFORM)) -KFLAG_INCLD = /tools/eldk/4.1/usr/lib/gcc/powerpc-linux/4.0.0/include -endif -endif - -ifeq (2.0,$(WRS_LINUX_VERSION)) -KFLAG_INCLD = $(WRLINUX_GNU_PATH)/../lib/gcc/powerpc-wrs-linux-gnu/4.1.2/include -endif - -ifeq (3.0,$(WRS_LINUX_VERSION)) -KFLAG_INCLD = $(WRLINUX_GNU_PATH)/../lib/gcc/powerpc-wrs-linux-gnu/4.3.2/include -endif -endif - -ifdef BROADCOM_SVK -ifeq ($PLX_PCI2LBUS, 1) -CFLAGS += -DBCM_PLX9656_LOCAL_BUS -DBDE_LINUX_NON_INTERRUPTIBLE -endif -endif - -ifdef DPP_CHIPS -CFLAGS += -DDUNE_BCM -D__DUNE_LINUX_BCM_CPU_PCP_DMA__ -CFGFLAGS += -DSOC_CM_FUNCTION -endif - -ifdef DFE_CHIPS -CFLAGS += -DDUNE_BCM -CFGFLAGS += -DSOC_CM_FUNCTION -endif - -ifdef SAND_CHIPS -CFLAGS += -D__DUNE_GTO_BCM_CPU__ -D__DUNE_LINUX_BCM_CPU_PCIE__ -endif - -ifdef SHADOW_PLX -CFLAGS += -DBCM_PLX9656_LOCAL_BUS -DBDE_LINUX_NON_INTERRUPTIBLE -DSHADOW_SVK -endif - -ifeq (,$(KFLAGS)) -#autoconf.h was moved in later kernels -LINUX_AUTOCONF = $(LINUX_INCLUDE)/generated/autoconf.h -ifeq (,$(shell ls $(LINUX_AUTOCONF) 2>/dev/null)) -LINUX_AUTOCONF = $(LINUX_INCLUDE)/linux/autoconf.h -endif - -KFLAGS := -D__KERNEL__ -m32 -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/linux/version.h -include $(LINUX_AUTOCONF) -I$(KERNDIR)/arch/powerpc -I$(KERNDIR)/arch/powerpc -I$(KERNDIR)/arch/powerpc/include -I$(KERNDIR)/include/asm-powerpc -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -msoft-float -pipe -ffixed-r2 -mmultiple -mno-altivec -funit-at-a-time -Wa,-me500 -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -endif - -#Wind river Linux 3.0 needs addtional flags -ifeq (3.0,$(WRS_LINUX_VERSION)) - -# Use MSI interrupts if kernel is compiled with MSI support. -#CFLAGS += -DBDE_LINUX_USE_MSI_INTERRUPT -KFLAGS += -I$(LINUX_INCLUDE_STD) -I$(KERNDIR_STD)/arch/powerpc -I$(KERNDIR_STD)/arch/powerpc/include -I$(KERNDIR_STD)/include.asm-powerpc -mno-spe -endif - -ifneq ($(targetplat),user) -include ${SDK}/make/Makefile.linux-kernel-2_6 -endif diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-jag-2_6 b/platform/broadcom/saibcm-modules/make/Makefile.linux-jag-2_6 deleted file mode 100644 index 1e89cdab2434..000000000000 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-jag-2_6 +++ /dev/null @@ -1,166 +0,0 @@ -# -# Copyright 2017 Broadcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License, version 2, as -# published by the Free Software Foundation (the "GPL"). -# -# 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 version 2 (GPLv2) for more details. -# -# You should have received a copy of the GNU General Public License -# version 2 (GPLv2) along with this source code. -# -# $Id: Makefile.linux-jag-2_6,v 1.20 Broadcom SDK $ -# $Copyright: (c) 2007 Broadcom Corp. -# All Rights Reserved.$ - - -# User must select one platform from below.By default WR_LINUX is selected. . -ifeq (,$(BUILD_PLATFORM)) -#BUILD_PLATFORM=ELDK -BUILD_PLATFORM=WR_LINUX -endif - - -# Specify the KERNEL VERSION you want to use for building SDK. -ifeq (ELDK,$(BUILD_PLATFORM)) -ifeq (,$(KERN_VER)) -KERN_VER=2.6.21.7 -endif -endif - -# Specify the Windriver Linux version here.For example '2.0' as shown below. -ifeq (WR_LINUX,$(BUILD_PLATFORM)) -ifeq (,$(WRS_LINUX_VERSION)) -WRS_LINUX_VERSION=2.0 -endif -endif - -ifeq (WR_LINUX,$(BUILD_PLATFORM)) -ifeq (1.4,$(WRS_LINUX_VERSION)) - -KERNDIR := /projects/ntsw-tools/linux/wrslinux_1.4/broadcom_bcm95836cpci_be/build/linux-2.6.14-small - -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE := mips-wrs-linux-gnu- -endif - -export WIND_LIC_PROXY = /projects/ntsw-tools/wrs/wrs_linux/GPP_LE_1.4_PPR/setup/x86-linux2/bin - -override PATH := /projects/ntsw-tools/wrs/wrs_linux/GPP_LE_1.4_PPR/gnu/3.4.4-wrlinux-1.4/x86-linux2/bin:$(PATH) -endif - -ifeq (2.0,$(WRS_LINUX_VERSION)) - -#CROSS_COMPILE = mips-wrs-linux-gnu- - -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE := mips-wrs-linux-gnu-mips_softfp-glibc_std- -endif - -KERNDIR:= /projects/ntsw-tools/linux/wrslinux_2.0/jag/glibc_std/build/linux-2.6.21-standard - -endif - -WRLINUX_BASE=/tools/windriver/linux_ed/2.0_GA/Linux - -TOOLCHAIN_BIN_DIR=$(KERNDIR)/../../host-cross/mips-wrs-linux-gnu/bin -WIND_LIC_PROXY=$(WRLINUX_BASE)/setup/x86-linux2/bin - -WRLINUX_GNU_PATH=$(WRLINUX_BASE)/gnu/4.1-wrlinux-2.0/x86-linux2/bin - -override PATH:=$(KERNDIR)/../../host-cross/bin:$(KERNDIR)/../../host-cross/mips-wrs-linux-gnu/bin:$(WRLINUX_GNU_PATH):$(PATH) - -WRS_SYSROOT_PATH := $(WRLINUX_GNU_PATH)/../lib/gcc/mips-wrs-linux-gnu/4.1.2/include - -export TOOLCHAIN_BIN_DIR WIND_LIC_PROXY -endif - -ifeq (ELDK,$(BUILD_PLATFORM)) -ifeq (2.6.21.7, $(KERN_VER)) - -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE := mips_4KC- -endif - -override PATH := /tools/eldk/4.1/usr/bin:$(PATH) -KERNDIR ?= /projects/ntsw-tools/linux/eldk/jag-ntswics-eldk/linux-2.6.21.7 -endif -endif - - - -comma = , -basetarget = $(basename $(notdir $@)) -modname = $(basetarget) - -# Extra variables. -EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) - -name-fix = $(subst $(comma),_,$(subst -,_,$1)) -basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" -modname_flags = $(if $(filter 1,$(words $(modname))),\ - -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") - - -# Default Linux include directory -ifeq (,$(LINUX_INCLUDE)) -LINUX_INCLUDE := $(KERNDIR)/include -endif - -CFGFLAGS += -DSYS_BE_PIO=0 -DSYS_BE_PACKET=1 -DSYS_BE_OTHER=0 -ENDIAN = BE_HOST=1 -CFGFLAGS += -D$(ENDIAN) -CFGFLAGS += -DBCM_PLATFORM_STRING=\"JAG_BCM4704\" - -ARCH = mips -KBUILD_VERBOSE = 1 - -export ARCH KBUILD_VERBOSE - -ifeq (ELDK,$(BUILD_PLATFORM)) -KFLAG_INCLD = /tools/eldk/4.1/usr/lib/gcc/mips-linux/4.0.0/include/ -endif - -ifeq (1.4,$(WRS_LINUX_VERSION)) -# From linux/arch/mips/Makefile - -ifeq (,$(KFLAGS)) -KFLAGS := -D__KERNEL__ -Wall -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2 -fomit-frame-pointer -g -G 0 -mno-abicalls -fno-pic -pipe -march=mips32 -Wa,-mips32 -Wa,--trap -funit-at-a-time -mlong-calls -Wundef -finline-limit=100000 -mabi=32 -endif - -#-Wdeclaration-after-statement -Wstrict-prototypes -else - -ifeq (2.0,$(WRS_LINUX_VERSION)) - -ifeq (,$(KFLAGS)) -KFLAGS := -D__KERNEL__ -nostdinc -isystem $(WRS_SYSROOT_PATH) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/linux/autoconf.h -I$(KERNDIR)/arch/mips -I$(KERNDIR)/arch/mips -I$(KERNDIR)/arch/mips/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -mabi=32 -G 0 -mno-abicalls -fno-pic -pipe -msoft-float -ffreestanding -march=mips32 -Wa,-mips32 -Wa,--trap -Iinclude/asm-mips/mach-bcm947xx -Iinclude/asm-mips/mach-generic -fomit-frame-pointer -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -mlong-calls -endif - -endif -endif - -ifeq (ELDK,$(BUILD_PLATFORM)) - -ifeq (,$(KFLAGS)) -KFLAGS := -D__KERNEL__ -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/linux/autoconf.h -I$(KERNDIR)/arch/mips -I$(KERNDIR)/arch/mips -I$(KERNDIR)/arch/mips/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -mabi=32 -G 0 -mno-abicalls -fno-pic -pipe -msoft-float -ffreestanding -march=mips32 -Wa,-mips32 -Wa,--trap -Iinclude/asm-mips/mach-bcm947xx -Iinclude/asm-mips/mach-generic -fomit-frame-pointer -g -Wdeclaration-after-statement -mlong-calls -endif - -endif - -ifneq ($(targetplat),user) -include ${SDK}/make/Makefile.linux-kernel-2_6 -endif - -ifneq (,$(findstring TCL,$(FEATURE_LIST))) -LINK_STATIC=0 -export LINK_STATIC -endif - - - - diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-nsx-2_6 b/platform/broadcom/saibcm-modules/make/Makefile.linux-nsx-2_6 deleted file mode 100644 index 785619f31fd4..000000000000 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-nsx-2_6 +++ /dev/null @@ -1,56 +0,0 @@ -# -# Copyright 2017 Broadcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License, version 2, as -# published by the Free Software Foundation (the "GPL"). -# -# 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 version 2 (GPLv2) for more details. -# -# You should have received a copy of the GNU General Public License -# version 2 (GPLv2) along with this source code. -# -# $Id: Makefile.linux-nsx-2_6,v 1.9 Broadcom SDK $ -# $Copyright: (c) 2005 Broadcom Corp. -# All Rights Reserved.$ - -# Look for custom tools -ifneq (,$(MIPS_TOOLS_DIR)) -override PATH := $(MIPS_TOOLS_DIR):$(PATH) -endif -ifneq (,$(MIPS_CROSS_COMPILE)) -override CROSS_COMPILE := $(MIPS_CROSS_COMPILE) -endif - -# Default tools -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE := mips2_fp_be- -override PATH := $(PATH):/projects/ntsw-tools/linux/mvista/mvista-4.0/pro/devkit/mips/mips2_fp_be/bin -endif - -# Default Linux Kernel directory -ifeq (,$(KERNDIR)) -KERNDIR := /projects/ntsw-tools/linux/mvista/mvista-4.0-nsx/linux-2.6.10_dev -endif -# Default Linux include directory -ifeq (,$(LINUX_INCLUDE)) -LINUX_INCLUDE := $(KERNDIR)/include -endif - -CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1 -ENDIAN = BE_HOST=1 -CFGFLAGS += -D$(ENDIAN) -CFGFLAGS += -DBCM_PLATFORM_STRING=\"NSX_BCM1125\" - -# From linux/arch/mips/Makefile - -ifeq (,$(KFLAGS)) -KFLAGS := -D__KERNEL__ -O2 -fomit-frame-pointer -fno-strict-aliasing -G 0 -mno-abicalls -fno-pic -mips64 -mtune=sb1 -Wa,--trap -pipe -mlong-calls -endif - -ifneq ($(targetplat),user) -include ${SDK}/make/Makefile.linux-kernel-2_6 -endif diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-nsx64 b/platform/broadcom/saibcm-modules/make/Makefile.linux-nsx64 deleted file mode 100644 index c4f71995be52..000000000000 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-nsx64 +++ /dev/null @@ -1,54 +0,0 @@ -# -# Copyright 2017 Broadcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License, version 2, as -# published by the Free Software Foundation (the "GPL"). -# -# 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 version 2 (GPLv2) for more details. -# -# You should have received a copy of the GNU General Public License -# version 2 (GPLv2) along with this source code. -# -# $Id: Makefile.linux-nsx64,v 1.9 Broadcom SDK $ -# $Copyright: (c) 2005 Broadcom Corp. -# All Rights Reserved.$ - -# Look for custom tools -ifneq (,$(MIPS_TOOLS_DIR)) -override PATH := $(MIPS_TOOLS_DIR):$(PATH) -endif -ifneq (,$(MIPS_CROSS_COMPILE)) -override CROSS_COMPILE := $(MIPS_CROSS_COMPILE) -endif - -# Default tools -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE := mips64_fp_be- -override PATH := $(PATH):/projects/ntsw-tools/linux/mvista/mips64_be_tools-3.1/bin -endif - -# Default Linux include directory -ifeq (,$(LINUX_INCLUDE)) -LINUX_INCLUDE = /projects/ntsw-tools/linux/headers/mvl-3.1-nsx64/include -endif - -CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1 -ENDIAN = BE_HOST=1 -CFGFLAGS += -D$(ENDIAN) -Wa,-xgot -mips64 -mabi=64 -fno-strict-aliasing -DPTRS_ARE_64BITS -DLONGS_ARE_64BITS -CFGFLAGS += -DBCM_PLATFORM_STRING=\"NSX_BCM1125\" - -# From linux/arch/mips/Makefile - -ifeq (,$(KFLAGS)) -KFLAGS := -D__KERNEL__ -O2 -fomit-frame-pointer -fno-strict-aliasing -G 0 -mno-abicalls -fno-pic -mips64 -mabi=64 -mtune=sb1 -Wa,--trap -pipe -mlong-calls -endif - -ifneq ($(targetplat),user) -include ${SDK}/make/Makefile.linux-kernel -endif - -MODULE_LDFLAGS += -m elf64btsmip diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-nsx_wrl-2_6 b/platform/broadcom/saibcm-modules/make/Makefile.linux-nsx_wrl-2_6 deleted file mode 100644 index 7b549038fd24..000000000000 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-nsx_wrl-2_6 +++ /dev/null @@ -1,127 +0,0 @@ -# -# Copyright 2017 Broadcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License, version 2, as -# published by the Free Software Foundation (the "GPL"). -# -# 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 version 2 (GPLv2) for more details. -# -# You should have received a copy of the GNU General Public License -# version 2 (GPLv2) along with this source code. -# -# $Id: Makefile.linux-nsx_wrl-2_6,v 1.15 Broadcom SDK $ -# $Copyright: (c) 2007 Broadcom Corp. -# All Rights Reserved.$ - -ifeq (,$(WRS_LINUX_VERSION)) -WRS_LINUX_VERSION=2.0 -endif - -# Look for custom tools -ifneq (,$(MIPS_TOOLS_DIR)) -ifneq (,$(MIPS_CROSS_COMPILE)) -override PATH := $(MIPS_TOOLS_DIR):$(PATH) -override CROSS_COMPILE := $(MIPS_CROSS_COMPILE) -endif -endif - -# Default Linux Kernel directory -ifeq (,$(KERNDIR)) - -ifeq (1.4,$(WRS_LINUX_VERSION)) - -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE := mips-wrs-linux-gnu- -endif - -KERNDIR := /projects/ntsw-tools/linux/wrslinux_1.4/broadcom_bcm91125cpci_32_be_glibc_std/build/linux-2.6.14-cgl - -export WIND_LIC_PROXY = /projects/ntsw-tools/wrs/wrs_linux/GPP_LE_1.4_PPR/setup/x86-linux2/bin -override PATH := /projects/ntsw-tools/wrs/wrs_linux/GPP_LE_1.4_PPR/gnu/3.4.4-wrlinux-1.4/x86-linux2/bin:$(PATH) -else - -ifeq (2.0,$(WRS_LINUX_VERSION)) - -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE := mips-wrs-linux-gnu-mips-glibc_std- -endif - -KERNDIR:= /projects/ntsw-tools/linux/wrslinux_2.0/nsx/glibc_std/build/linux-2.6.21-standard - -WRLINUX_BASE=/tools/windriver/linux_ed/2.0_GA/Linux - -TOOLCHAIN_BIN_DIR=$(KERNDIR)/../../host-cross/mips-wrs-linux-gnu/bin -WIND_LIC_PROXY=$(WRLINUX_BASE)/setup/x86-linux2/bin - -WRLINUX_GNU_PATH=$(WRLINUX_BASE)/gnu/4.1-wrlinux-2.0/x86-linux2/bin -override PATH:=$(KERNDIR)/../../host-cross/bin:$(KERNDIR)/../../host-cross/mips-wrs-linux-gnu/bin:$(WRLINUX_GNU_PATH):$(PATH) - -WRS_SYSROOT_PATH := $(WRLINUX_GNU_PATH)/../lib/gcc/mips-wrs-linux-gnu/4.1.2/include - -export TOOLCHAIN_BIN_DIR WIND_LIC_PROXY - -comma = , -basetarget = $(basename $(notdir $@)) -modname = $(basetarget) - -# Extra variables. -EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) - -name-fix = $(subst $(comma),_,$(subst -,_,$1)) -basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" -modname_flags = $(if $(filter 1,$(words $(modname))),\ - -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") - -endif -endif -endif - -# Default Linux include directory -ifeq (,$(LINUX_INCLUDE)) -LINUX_INCLUDE := $(KERNDIR)/include -endif - -CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1 -ENDIAN = BE_HOST=1 -CFGFLAGS += -D$(ENDIAN) -CFGFLAGS += -DBCM_PLATFORM_STRING=\"NSX_BCM1125\" - -ARCH = mips -KBUILD_VERBOSE = 1 - -export ARCH KBUILD_VERBOSE - -ifeq (1.4,$(WRS_LINUX_VERSION)) -# From Linux Kbuild output - -ifeq (,$(KFLAGS)) -KFLAGS := -D__KERNEL__ -Iinclude -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2 -fomit-frame-pointer -g -G 0 -mno-abicalls -fno-pic -pipe -finline-limit=100000 -mabi=32 -march=sb1 -Wa,-32 -Wa,-march=sb1 -Wa,-mips64 -Wa,--trap -DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1250_112x_ALL -mlong-calls -#-Wdeclaration-after-statement -endif - -else - -ifeq (2.0,$(WRS_LINUX_VERSION)) - -ifeq (,$(KFLAGS)) -KFLAGS := -D__KERNEL__ -nostdinc -isystem $(WRS_SYSROOT_PATH) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -mabi=32 -G 0 -mno-abicalls -fno-pic -pipe -msoft-float -ffreestanding -march=sb1 -Wa,--trap -Iinclude/asm-mips/mach-sibyte -Iinclude/asm-mips/mach-generic -DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1250_112x_ALL -fomit-frame-pointer -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -mlong-calls -endif - -endif -endif - -ifneq ($(targetplat),user) -include ${SDK}/make/Makefile.linux-kernel-2_6 -endif - - -ifneq (,$(findstring TCL,$(FEATURE_LIST))) -LINK_STATIC=0 -export LINK_STATIC -endif - - diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-raptor b/platform/broadcom/saibcm-modules/make/Makefile.linux-raptor deleted file mode 100644 index 80c51e782bea..000000000000 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-raptor +++ /dev/null @@ -1,53 +0,0 @@ -# -# Copyright 2017 Broadcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License, version 2, as -# published by the Free Software Foundation (the "GPL"). -# -# 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 version 2 (GPLv2) for more details. -# -# You should have received a copy of the GNU General Public License -# version 2 (GPLv2) along with this source code. -# -# $Id: Makefile.linux-raptor,v 1.6 Broadcom SDK $ -# $Copyright: (c) 2005 Broadcom Corp. -# All Rights Reserved.$ - -# Look for custom tools -ifneq (,$(MIPS_TOOLS_DIR)) -override PATH := $(MIPS_TOOLS_DIR):$(PATH) -endif -ifneq (,$(MIPS_CROSS_COMPILE)) -override CROSS_COMPILE := $(MIPS_CROSS_COMPILE) -endif - -# Default tools -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE := mips_fp_be- -override PATH := $(PATH):/projects/ntsw-tools/linux/mvista/mvista-3.1/pro/devkit/mips/fp_be/bin -endif - -# Default Linux include directory -ifeq (,$(LINUX_INCLUDE)) -LINUX_INCLUDE = /projects/ntsw-tools/linux/headers/mvl-3.1-raptor/include -endif - -CFGFLAGS += -DSYS_BE_PIO=0 -DSYS_BE_PACKET=1 -DSYS_BE_OTHER=0 -DBCM_ICS -ENDIAN = BE_HOST=1 -CFGFLAGS += -D$(ENDIAN) -CFGFLAGS += -DBCM_PLATFORM_STRING=\"Raptor_BCM56218\" - - -ifneq ($(targetplat),user) -include ${SDK}/make/Makefile.linux-kernel -endif - -# From linux/arch/mips/Makefile - -ifeq (,$(KFLAGS)) -KFLAGS := -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe -m$(gcc-tune-flag)=r4600 -mips2 -Wa,--trap -mlong-calls -endif diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-raptor-2_6 b/platform/broadcom/saibcm-modules/make/Makefile.linux-raptor-2_6 deleted file mode 100644 index 0bebdf9564c6..000000000000 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-raptor-2_6 +++ /dev/null @@ -1,172 +0,0 @@ -# -# Copyright 2017 Broadcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License, version 2, as -# published by the Free Software Foundation (the "GPL"). -# -# 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 version 2 (GPLv2) for more details. -# -# You should have received a copy of the GNU General Public License -# version 2 (GPLv2) along with this source code. -# -# $Id: Makefile.linux-raptor-2_6,v 1.21 Broadcom SDK $ -# $Copyright: (c) 2007 Broadcom Corp. -# All Rights Reserved.$ - - -# User must select one platform from below.By default WR_LINUX is selected. . -ifeq (,$(BUILD_PLATFORM)) -#BUILD_PLATFORM=ELDK -BUILD_PLATFORM=WR_LINUX -endif - - -# Specify the KERNEL VERSION you want to use for building SDK. -ifeq (ELDK,$(BUILD_PLATFORM)) -ifeq (,$(KERN_VER)) -KERN_VER=2.6.21.7 -endif -endif - -# Specify the Windriver Linux version here.For example '2.0' as shown below. -ifeq (WR_LINUX,$(BUILD_PLATFORM)) -ifeq (,$(WRS_LINUX_VERSION)) -WRS_LINUX_VERSION=2.0 -endif -endif - - -# Default Linux Kernel directory -ifeq (WR_LINUX,$(BUILD_PLATFORM)) -ifeq (1.4,$(WRS_LINUX_VERSION)) - -KERNDIR ?= /projects/ntsw-tools/linux/wrslinux_1.4/broadcom_bcm95621x_be/build/linux-2.6.14-small - -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE := mips-wrs-linux-gnu- -endif - -export WIND_LIC_PROXY = /projects/ntsw-tools/wrs/wrs_linux/GPP_LE_1.4_PPR/setup/x86-linux2/bin - -override PATH := /projects/ntsw-tools/wrs/wrs_linux/GPP_LE_1.4_PPR/gnu/3.4.4-wrlinux-1.4/x86-linux2/bin:$(PATH) -endif - -ifeq (2.0,$(WRS_LINUX_VERSION)) - -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE := mips-wrs-linux-gnu-mips_softfp-glibc_std- -endif - -KERNDIR ?= /projects/ntsw-tools/linux/wrslinux_2.0/ntswics/glibc_std/build/linux-2.6.21-standard -override PATH:=$(KERNDIR)/../../host-cross/bin:$(KERNDIR)/../../host-cross/mips-wrs-linux-gnu/bin:$(WRLINUX_GNU_PATH):$(PATH) - -endif - -WRLINUX_BASE=/tools/windriver/linux_ed/2.0_GA/Linux - -TOOLCHAIN_BIN_DIR=$(KERNDIR)/../../host-cross/mips-wrs-linux-gnu/bin -WIND_LIC_PROXY=$(WRLINUX_BASE)/setup/x86-linux2/bin - -WRLINUX_GNU_PATH=$(WRLINUX_BASE)/gnu/4.1-wrlinux-2.0/x86-linux2/bin - -override PATH:=$(KERNDIR)/../../host-cross/bin:$(KERNDIR)/../../host-cross/mips-wrs-linux-gnu/bin:$(WRLINUX_GNU_PATH):$(PATH) - -WRS_SYSROOT_PATH := $(WRLINUX_GNU_PATH)/../lib/gcc/mips-wrs-linux-gnu/4.1.2/include - -export TOOLCHAIN_BIN_DIR WIND_LIC_PROXY - -endif - -ifeq (ELDK,$(BUILD_PLATFORM)) -ifeq (2.6.21.7, $(KERN_VER)) -ifeq (,$(CROSS_COMPILE)) -CROSS_COMPILE := mips_4KC- -endif -override PATH := /tools/eldk/4.1/usr/bin:$(PATH) -KERNDIR ?= /projects/ntsw-tools/linux/eldk/raptor_eldk/linux-2.6.21.7 -endif -endif - - - -comma = , -basetarget = $(basename $(notdir $@)) -modname = $(basetarget) - -# Extra variables. -EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) - -name-fix = $(subst $(comma),_,$(subst -,_,$1)) -basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" -modname_flags = $(if $(filter 1,$(words $(modname))),\ - -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") - -# Default Linux include directory -ifeq (,$(LINUX_INCLUDE)) -LINUX_INCLUDE := $(KERNDIR)/include -endif - -CFGFLAGS += -DSYS_BE_PIO=0 -DSYS_BE_PACKET=1 -DSYS_BE_OTHER=0 -DBCM_ICS -ENDIAN = BE_HOST=1 -CFGFLAGS += -D$(ENDIAN) -DRAPTOR -CFGFLAGS += -DBCM_PLATFORM_STRING=\"Raptor_BCM56218\" - - -ARCH = mips -KBUILD_VERBOSE = 1 - -export ARCH KBUILD_VERBOSE - - -ifeq (ELDK,$(BUILD_PLATFORM)) -KFLAG_INCLD = /tools/eldk/4.1/usr/lib/gcc/mips-linux/4.0.0/include -endif - - -# From linux/arch/mips/Makefile -ifeq (WR_LINUX,$(BUILD_PLATFORM)) -ifeq (1.4,$(WRS_LINUX_VERSION)) - -ifeq (,$(KFLAGS)) -KFLAGS := -D__KERNEL__ -Wall -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2 -fomit-frame-pointer -g -G 0 -mno-abicalls -fno-pic -pipe -march=mips32 -Wa,-mips32 -Wa,--trap -funit-at-a-time -mlong-calls -Wundef -finline-limit=100000 -mabi=32 -endif - -endif - -ifeq (2.0,$(WRS_LINUX_VERSION)) - -ifeq (,$(KFLAGS)) -KFLAGS := -D__KERNEL__ -nostdinc -isystem $(WRS_SYSROOT_PATH) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/linux/autoconf.h -I$(KERNDIR)/arch/mips/mach-bcm56218 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -mabi=32 -G 0 -mno-abicalls -fno-pic -pipe -msoft-float -ffreestanding -march=mips32 -Wa,-mips32 -Wa,--trap -Iinclude/asm-mips/mach-bcm56218 -Iinclude/asm-mips/mach-generic -fomit-frame-pointer -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -mlong-calls -endif - -endif -endif - -ifeq (ELDK,$(BUILD_PLATFORM)) - -ifeq (,$(KFLAGS)) -KFLAGS := -D__KERNEL__ -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/linux/autoconf.h -I$(KERNDIR)/arch/mips/mach-bcm56218 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -mabi=32 -G 0 -mno-abicalls -fno-pic -pipe -msoft-float -ffreestanding -march=mips32 -Wa,-mips32 -Wa,--trap -Iinclude/asm-mips/mach-bcm56218 -Iinclude/asm-mips/mach-generic -fomit-frame-pointer -g -Wdeclaration-after-statement -mlong-calls -endif - - -endif - - - -ifneq ($(targetplat),user) -include ${SDK}/make/Makefile.linux-kernel-2_6 -endif - -ifneq (,$(findstring TCL,$(FEATURE_LIST))) -LINK_STATIC=0 -export LINK_STATIC -endif - - - - - diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-ptp-clock/Makefile b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-ptp-clock/Makefile deleted file mode 100644 index 743eb741732b..000000000000 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-ptp-clock/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# -# Copyright 2017 Broadcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License, version 2, as -# published by the Free Software Foundation (the "GPL"). -# -# 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 version 2 (GPLv2) for more details. -# -# You should have received a copy of the GNU General Public License -# version 2 (GPLv2) along with this source code. -# -# -*- Makefile -*- -# $Id: Makefile,v 1.3 2012/07/17 07:39:51 mlarsen Exp $ -# $Copyright: (c) 2005 Broadcom Corp. -# All Rights Reserved.$ -# -LOCALDIR = systems/linux/kernel/modules/bcm-ptp-clock - -include ${SDK}/make/Make.config - -LIBS = $(LIBDIR)/libkern.a - -ifeq ($(kernel_version),2_4) -MODULE = $(LIBDIR)/linux-bcm-ptp-clock.o -else -KERNEL_MODULE_DIR = kernel_module - -THIS_MOD_NAME := linux-bcm-ptp-clock -MODULE = $(LIBDIR)/$(THIS_MOD_NAME).o -KMODULE = $(LIBDIR)/$(THIS_MOD_NAME).ko - -build: $(MODULE) $(KMODULE) -endif - -KBUILD_EXTRA_SYMBOLS := ${BLDDIR}/../../../../bde/linux/kernel/kernel_module/Module.symvers -KBUILD_EXTRA_SYMBOLS += ${BLDDIR}/../bcm-knet/kernel_module/Module.symvers - -# BCM PTP Clock Device - -$(MODULE): $(BLDDIR)/.tree $(BOBJS) $(LIBS) - $(LD) $(MODULE_LDFLAGS) -r -d $(BOBJS) $(LIBS) -o $@ -ifneq ($(kernel_version),2_4) -$(KMODULE): $(MODULE) - rm -fr $(BLDDIR)/$(KERNEL_MODULE_DIR) - mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR) - cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile - cat ${KBUILD_EXTRA_SYMBOLS} > $(BLDDIR)/$(KERNEL_MODULE_DIR)/Module.symvers - MOD_NAME=$(THIS_MOD_NAME) KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko -endif - -# Make.depend is before clean:: so that Make.depend's clean:: runs first. - -include ${SDK}/make/Make.depend - -clean:: - $(RM) $(BLDDIR)/version.c $(BLDDIR)/version.o - $(RM) $(BOBJS) $(MODULE) - -ifneq ($(kernel_version),2_4) -.PHONY: build -endif diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-ptp-clock/bcm-ptp-clock.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-ptp-clock/bcm-ptp-clock.c deleted file mode 100644 index 7c88fae97d62..000000000000 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-ptp-clock/bcm-ptp-clock.c +++ /dev/null @@ -1,1999 +0,0 @@ -/* - * Copyright 2017 Broadcom - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, as - * published by the Free Software Foundation (the "GPL"). - * - * 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 version 2 (GPLv2) for more details. - * - * You should have received a copy of the GNU General Public License - * version 2 (GPLv2) along with this source code. - */ - -/* - * This module implements a Linux PTP Clock driver for Broadcom - * XGS switch devices. - * - * For a list of supported module parameters, please see below. - * debug: Debug level (default 0) - * network_transport : Transport Type (default 0 - Raw) - * base_dev_name: Base device name (default ptp0, ptp1, etc.) - * - * - All the data structures and functions work on the physical port. - * For array indexing purposes, we use (phy_port - 1). - */ - -#include /* Must be included first */ -/* Module Information */ -#define MODULE_MAJOR 125 -#define MODULE_NAME "linux-bcm-ptp-clock" - -MODULE_AUTHOR("Broadcom Corporation"); -MODULE_DESCRIPTION("PTP Clock Driver for Broadcom XGS Switch"); -MODULE_LICENSE("GPL"); - -#if LINUX_VERSION_CODE > KERNEL_VERSION(3,17,0) -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -/* Configuration Parameters */ -static int debug; -LKM_MOD_PARAM(debug, "i", int, 0); -MODULE_PARM_DESC(debug, - "Debug level (default 0)"); - -static int pci_cos; - -static int network_transport; -LKM_MOD_PARAM(network_transport, "i", int, 0); -MODULE_PARM_DESC(network_transport, - "Transport Type (default - Detect from packet)"); - -static char *base_dev_name = "ptp0"; -LKM_MOD_PARAM(base_dev_name, "s", charp, 0); -MODULE_PARM_DESC(base_dev_name, - "Base device name (default ptp0, ptp1, etc.)"); - -static int fw_core; -LKM_MOD_PARAM(fw_core, "i", int, 0); -MODULE_PARM_DESC(fw_core, - "Firmware core (default 0)"); - -/* Debug levels */ -#define DBG_LVL_VERB 0x1 -#define DBG_LVL_WARN 0x2 -#define DBG_LVL_TXTS 0x4 -#define DBG_LVL_CMDS 0x8 - -#define DBG_VERB(_s) do { if (debug & DBG_LVL_VERB) gprintk _s; } while (0) -#define DBG_WARN(_s) do { if (debug & DBG_LVL_WARN) gprintk _s; } while (0) -#define DBG_TXTS(_s) do { if (debug & DBG_LVL_TXTS) gprintk _s; } while (0) -#define DBG_CMDS(_s) do { if (debug & DBG_LVL_CMDS) gprintk _s; } while (0) -#define DBG_ERR(_s) do { if (1) gprintk _s; } while (0) - - -#ifdef LINUX_BDE_DMA_DEVICE_SUPPORT -#define DMA_DEV device -#define DMA_ALLOC_COHERENT(d,s,h) dma_alloc_coherent(d,s,h,GFP_ATOMIC|GFP_DMA32) -#define DMA_FREE_COHERENT(d,s,a,h) dma_free_coherent(d,s,a,h) -#else -#define DMA_DEV pci_dev -#define DMA_ALLOC_COHERENT(d,s,h) pci_alloc_consistent(d,s,h) -#define DMA_FREE_COHERENT(d,s,a,h) pci_free_consistent(d,s,a,h) -#endif - -/* Type length in bytes */ -#define BKSYNC_PACKLEN_U8 1 -#define BKSYNC_PACKLEN_U16 2 -#define BKSYNC_PACKLEN_U24 3 -#define BKSYNC_PACKLEN_U32 4 - -#define BKSYNC_UNPACK_U8(_buf, _var) \ - _var = *_buf++ - -#define BKSYNC_UNPACK_U16(_buf, _var) \ - do { \ - (_var) = (((_buf)[0] << 8) | \ - (_buf)[1]); \ - (_buf) += BKSYNC_PACKLEN_U16; \ - } while (0) - -#define BKSYNC_UNPACK_U24(_buf, _var) \ - do { \ - (_var) = (((_buf)[0] << 16) | \ - ((_buf)[1] << 8) | \ - (_buf)[2]); \ - (_buf) += BKSYNC_PACKLEN_U24; \ - } while (0) - -#define BKSYNC_UNPACK_U32(_buf, _var) \ - do { \ - (_var) = (((_buf)[0] << 24) | \ - ((_buf)[1] << 16) | \ - ((_buf)[2] << 8) | \ - (_buf)[3]); \ - (_buf) += BKSYNC_PACKLEN_U32; \ - } while (0) - - -#define CMICX_DEV_TYPE ((ptp_priv->dcb_type == 38) || \ - (ptp_priv->dcb_type == 36)) - -/* CMIC MCS-0 SCHAN Messaging registers */ -/* Core0:CMC1 Core1:CMC2 */ -#define CMIC_CMC_BASE \ - (CMICX_DEV_TYPE ? (fw_core ? 0x10400 : 0x10300) : \ - (fw_core ? 0x33000 : 0x32000)) - -#define CMIC_CMC_SCHAN_MESSAGE_10r(BASE) (BASE + 0x00000034) -#define CMIC_CMC_SCHAN_MESSAGE_11r(BASE) (BASE + 0x00000038) -#define CMIC_CMC_SCHAN_MESSAGE_12r(BASE) (BASE + 0x0000003c) -#define CMIC_CMC_SCHAN_MESSAGE_13r(BASE) (BASE + 0x00000040) -#define CMIC_CMC_SCHAN_MESSAGE_14r(BASE) (BASE + 0x00000044) -#define CMIC_CMC_SCHAN_MESSAGE_15r(BASE) (BASE + 0x00000048) -#define CMIC_CMC_SCHAN_MESSAGE_16r(BASE) (BASE + 0x0000004c) -#define CMIC_CMC_SCHAN_MESSAGE_17r(BASE) (BASE + 0x00000050) -#define CMIC_CMC_SCHAN_MESSAGE_18r(BASE) (BASE + 0x00000054) -#define CMIC_CMC_SCHAN_MESSAGE_19r(BASE) (BASE + 0x00000058) -#define CMIC_CMC_SCHAN_MESSAGE_20r(BASE) (BASE + 0x0000005c) -#define CMIC_CMC_SCHAN_MESSAGE_21r(BASE) (BASE + 0x00000060) - -u32 hostcmd_regs[5] = { 0 }; - -#define BCMKSYNC_NUM_PORTS 128 /* NUM_PORTS where 2-step is supported. */ -#define BCMKSYNC_MAX_NUM_PORTS 256 /* Max ever NUM_PORTS in the system */ -#define BCMKSYNC_MAX_MTP_IDX 8 /* Max number of mtps in the system */ - -/* Service request commands to Firmware. */ -enum { - BKSYNC_DONE = (0x0), - BKSYNC_INIT = (0x1), - BKSYNC_DEINIT = (0x2), - BKSYNC_GETTIME = (0x3), - BKSYNC_SETTIME = (0x4), - BKSYNC_FREQCOR = (0x5), - BKSYNC_PBM_UPDATE = (0x6), - BKSYNC_ADJTIME = (0x7), - BKSYNC_GET_TSTIME = (0x8), - BKSYNC_MTP_TS_UPDATE_ENABLE = (0x9), - BKSYNC_MTP_TS_UPDATE_DISABLE = (0xa), - BKSYNC_ACK_TSTIME = (0xb), -}; - - -/* 1588 message types. */ -enum -{ - IEEE1588_MSGTYPE_SYNC = (0x0), - IEEE1588_MSGTYPE_DELREQ = (0x1), - IEEE1588_MSGTYPE_PDELREQ = (0x2), - IEEE1588_MSGTYPE_PDELRESP = (0x3), - /* reserved (0x4) */ - /* reserved (0x5) */ - /* reserved (0x6) */ - /* reserved (0x7) */ - IEEE1588_MSGTYPE_GENERALMASK = (0x8), /* all non-event messages have this bit set */ - IEEE1588_MSGTYPE_FLWUP = (0x8), - IEEE1588_MSGTYPE_DELRESP = (0x9), - IEEE1588_MSGTYPE_PDELRES_FLWUP = (0xA), - IEEE1588_MSGTYPE_ANNOUNCE = (0xB), - IEEE1588_MSGTYPE_SGNLNG = (0xC), - IEEE1588_MSGTYPE_MNGMNT = (0xD) - /* reserved (0xE) */ - /* reserved (0xF) */ -}; - -/* Usage macros */ -#define ONE_BILLION (1000000000) - -#define SKB_U16_GET(_skb, _pkt_offset) \ - ((_skb->data[_pkt_offset] << 8) | _skb->data[_pkt_offset + 1]) - -#define BKSYNC_PTP_EVENT_MSG(_ptp_msg_type) \ - ((_ptp_msg_type == IEEE1588_MSGTYPE_DELREQ) || \ - (_ptp_msg_type == IEEE1588_MSGTYPE_SYNC)) - - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) -#define HWTSTAMP_TX_ONESTEP_SYNC 2 -#else -#include -#endif - - -/* - * Hardware specific information. - * 4 words of information used from this data set. - * 0 - 3: 2-step untagged. - * 4 - 7: 2-step tagged. - * 8 - 11: 1-step untagged. - * 12 - 15: 1-step tagged. - * 16 - 19: 1-step untagged with ITS-set. - * 20 - 23: 1-step tagged with ITS-set. - */ -uint32_t sobmhrawpkts_dcb26[24] = {0x00000000, 0x00020E00, 0x00000000, 0x00000000, 0x00000000, 0x00021200, 0x00000000, 0x00000000, - 0x00000000, 0x00100E00, 0x00000000, 0x00000000, 0x00000000, 0x00101200, 0x00000000, 0x00000000, - 0x00000000, 0x00140E00, 0x00000000, 0x00000000, 0x00000000, 0x00141200, 0x00000000, 0x00000000}; - -uint32_t sobmhudpipv4_dcb26[24] = {0x00000000, 0x00022A00, 0x00000000, 0x00000000, 0x00000000, 0x00022E00, 0x00000000, 0x00000000, - 0x00000000, 0x00102A00, 0x00000000, 0x00000000, 0x00000000, 0x00102E00, 0x00000000, 0x00000000, - 0x00000000, 0x00142A00, 0x00000000, 0x00000000, 0x00000000, 0x00142E00, 0x00000000, 0x00000000}; - -uint32_t sobmhudpipv6_dcb26[24] = {0x00000000, 0x00023E00, 0x00000000, 0x00000000, 0x00000000, 0x00024200, 0x00000000, 0x00000000, - 0x00000000, 0x00103E00, 0x00000000, 0x00000000, 0x00000000, 0x00104200, 0x00000000, 0x00000000, - 0x00000000, 0x00143E00, 0x00000000, 0x00000000, 0x00000000, 0x00144200, 0x00000000, 0x00000000}; - -uint32_t sobmhrawpkts_dcb32[24] = {0x00000000, 0x00010E00, 0x00000000, 0x00000000, 0x00000000, 0x00011200, 0x00000000, 0x00000000, - 0x00000000, 0x00080E00, 0x00000000, 0x00000000, 0x00000000, 0x00081200, 0x00000000, 0x00000000, - 0x00000000, 0x00080E00, 0x00000000, 0x00000000, 0x00000000, 0x00081200, 0x00000000, 0x00000000}; - -uint32_t sobmhudpipv4_dcb32[24] = {0x00000000, 0x00012A00, 0x00000000, 0x00000000, 0x00000000, 0x00012E00, 0x00000000, 0x00000000, - 0x00000000, 0x000C2A00, 0x00000000, 0x00000000, 0x00000000, 0x000C2E00, 0x00000000, 0x00000000, - 0x00000000, 0x000C2A00, 0x00000000, 0x00000000, 0x00000000, 0x000C2E00, 0x00000000, 0x00000000}; - -uint32_t sobmhudpipv6_dcb32[24] = {0x00000000, 0x00013E00, 0x00000000, 0x00000000, 0x00000000, 0x00014200, 0x00000000, 0x00000000, - 0x00000000, 0x000C3E00, 0x00000000, 0x00000000, 0x00000000, 0x000C4200, 0x00000000, 0x00000000, - 0x00000000, 0x000C3E00, 0x00000000, 0x00000000, 0x00000000, 0x000C4200, 0x00000000, 0x00000000}; - -uint32_t sobmhrawpkts_dcb35[24] = {0x00000000, 0x0020E000, 0x00000000, 0x00000000, 0x00000000, 0x00212000, 0x00000000, 0x00000000, - 0x00000000, 0x0100E000, 0x00000000, 0x00000000, 0x00000000, 0x01012000, 0x00000000, 0x00000000, - 0x00000000, 0x0140E000, 0x00000000, 0x00000000, 0x00000000, 0x01412000, 0x00000000, 0x00000000}; - -uint32_t sobmhudpipv4_dcb35[24] = {0x00000000, 0x0022A000, 0x00000000, 0x00000000, 0x00000000, 0x0022E000, 0x00000000, 0x00000000, - 0x00000000, 0x0102A000, 0x00000000, 0x00000000, 0x00000000, 0x0102E000, 0x00000000, 0x00000000, - 0x00000000, 0x0142A000, 0x00000000, 0x00000000, 0x00000000, 0x0142E000, 0x00000000, 0x00000000}; - -uint32_t sobmhudpipv6_dcb35[24] = {0x00000000, 0x0023E000, 0x00000000, 0x00000000, 0x00000000, 0x00242000, 0x00000000, 0x00000000, - 0x00000000, 0x0103E000, 0x00000000, 0x00000000, 0x00000000, 0x01042000, 0x00000000, 0x00000000, - 0x00000000, 0x0143E000, 0x00000000, 0x00000000, 0x00000000, 0x01442000, 0x00000000, 0x00000000}; - - -uint32_t sobmhrawpkts_dcb36[24] = {0x00000000, 0x00010E00, 0x00000000, 0x00000000, 0x00000000, 0x00011200, 0x00000000, 0x00000000, - 0x00000000, 0x00080E00, 0x00000000, 0x00000000, 0x00000000, 0x00081200, 0x00000000, 0x00000000, - 0x00000000, 0x00080E00, 0x00000000, 0x00000000, 0x00000000, 0x00081200, 0x00000000, 0x00000000}; - -uint32_t sobmhudpipv4_dcb36[24] = {0x00000000, 0x00012A00, 0x00000000, 0x00000000, 0x00000000, 0x00012E00, 0x00000000, 0x00000000, - 0x00000000, 0x000C2A00, 0x00000000, 0x00000000, 0x00000000, 0x000C2E00, 0x00000000, 0x00000000, - 0x00000000, 0x000C2A00, 0x00000000, 0x00000000, 0x00000000, 0x000C2E00, 0x00000000, 0x00000000}; - -uint32_t sobmhudpipv6_dcb36[24] = {0x00000000, 0x00013E00, 0x00000000, 0x00000000, 0x00000000, 0x00014200, 0x00000000, 0x00000000, - 0x00000000, 0x000C3E00, 0x00000000, 0x00000000, 0x00000000, 0x000C4200, 0x00000000, 0x00000000, - 0x00000000, 0x000C3E00, 0x00000000, 0x00000000, 0x00000000, 0x000C4200, 0x00000000, 0x00000000}; -/* th3: onestep only */ -uint32_t sobmhrawpkts_dcb38[24] = {0x00000000, 0x00080E00, 0x00000000, 0x00000000, 0x00000000, 0x00081200, 0x00000000, 0x00000000, - 0x00000000, 0x00080E00, 0x00000000, 0x00000000, 0x00000000, 0x00081200, 0x00000000, 0x00000000, - 0x00000000, 0x00080E00, 0x00000000, 0x00000000, 0x00000000, 0x00081200, 0x00000000, 0x00000000}; - -uint32_t sobmhudpipv4_dcb38[24] = {0x00000000, 0x00082A00, 0x00000000, 0x00000000, 0x00000000, 0x00082E00, 0x00000000, 0x00000000, - 0x00000000, 0x000C2A00, 0x00000000, 0x00000000, 0x00000000, 0x000C2E00, 0x00000000, 0x00000000, - 0x00000000, 0x000C2A00, 0x00000000, 0x00000000, 0x00000000, 0x000C2E00, 0x00000000, 0x00000000}; - -uint32_t sobmhudpipv6_dcb38[24] = {0x00000000, 0x00083E00, 0x00000000, 0x00000000, 0x00000000, 0x00084200, 0x00000000, 0x00000000, - 0x00000000, 0x000C3E00, 0x00000000, 0x00000000, 0x00000000, 0x000C4200, 0x00000000, 0x00000000, - 0x00000000, 0x000C3E00, 0x00000000, 0x00000000, 0x00000000, 0x000C4200, 0x00000000, 0x00000000}; - -/* Driver Proc Entry root */ -static struct proc_dir_entry *bksync_proc_root = NULL; - -/* Shared data structures with R5 */ -typedef struct _bksync_tx_ts_data_s -{ - u32 ts_valid; /* Timestamp valid indication */ - u32 port_id; /* Port number */ - u32 ts_seq_id; /* Sequency Id */ - u32 ts_cnt; - u64 timestamp; /* Timestamp */ -} bksync_tx_ts_data_t; - -typedef struct _bksync_uc_linux_ipc_s -{ - u32 ksyncinit; - u32 dev_id; - s64 freqcorr; - u64 portmap[BCMKSYNC_NUM_PORTS/64]; /* Two-step enabled ports */ - u64 ptptime; - u64 reftime; - s64 phase_offset; - bksync_tx_ts_data_t port_ts_data[BCMKSYNC_NUM_PORTS]; -} bksync_uc_linux_ipc_t; - -typedef struct bksync_port_stats_s { - u32 pkt_rxctr; /* All ingress packets */ - u32 pkt_txctr; /* All egress packets */ - u32 pkt_txonestep; /* 1-step Tx packet counter */ - u32 tsts_match; /* 2-Step tstamp req match */ - u32 tsts_timeout; /* 2-Step tstamp req timeouts */ - u32 tsts_discard; /* 2-Step tstamp req discards */ - u32 osts_event_pkts; /* 1-step event packet counter */ - u32 osts_tstamp_reqs; /* 1-step events with tstamp request */ - u32 fifo_rxctr; /* 2-Step tstamp req match */ - u64 tsts_best_fetch_time; /* 1-step events with tstamp request */ - u64 tsts_worst_fetch_time; /* 1-step events with tstamp request */ - u32 tsts_avg_fetch_time; /* 1-step events with tstamp request */ -} bksync_port_stats_t; - -/* Clock Private Data */ -struct bksync_ptp_priv { - struct device dev; - int dcb_type; - struct ptp_clock *ptp_clock; - struct ptp_clock_info ptp_caps; - struct mutex ptp_lock; - struct mutex ptp_pair_lock; - volatile void *base_addr; /* address for PCI register access */ - volatile bksync_uc_linux_ipc_t *shared_addr; /* address for shared memory access */ - uint64_t dma_mem; - int dma_mem_size; - struct DMA_DEV *dma_dev; /* Required for DMA memory control */ - int num_pports; - int timekeep_status; - u32 mirror_encap_bmp; - struct delayed_work time_keep; - bksync_port_stats_t *port_stats; -}; - -static struct bksync_ptp_priv *ptp_priv; -volatile bksync_uc_linux_ipc_t *linuxPTPMemory = (bksync_uc_linux_ipc_t*)(0); -static volatile int module_initialized; -static int num_retries = 10; /* Retry count */ - -static void bksync_ptp_time_keep_init(void); -static void bksync_ptp_time_keep_deinit(void); - -#if defined(CMIC_SOFT_BYTE_SWAP) - -#define CMIC_SWAP32(_x) ((((_x) & 0xff000000) >> 24) \ - | (((_x) & 0x00ff0000) >> 8) \ - | (((_x) & 0x0000ff00) << 8) \ - | (((_x) & 0x000000ff) << 24)) - -#define DEV_READ32(_d, _a, _p) \ - do { \ - uint32_t _data; \ - _data = (((volatile uint32_t *)(_d)->base_addr)[(_a)/4]); \ - *(_p) = CMIC_SWAP32(_data); \ - } while(0) - -#define DEV_WRITE32(_d, _a, _v) \ - do { \ - uint32_t _data = CMIC_SWAP32(_v); \ - ((volatile uint32_t *)(_d)->base_addr)[(_a)/4] = (_data); \ - } while(0) - -#else - -#define DEV_READ32(_d, _a, _p) \ - do { \ - *(_p) = (((volatile uint32_t *)(_d)->base_addr)[(_a)/4]); \ - } while(0) - -#define DEV_WRITE32(_d, _a, _v) \ - do { \ - ((volatile uint32_t *)(_d)->base_addr)[(_a)/4] = (_v); \ - } while(0) -#endif /* defined(CMIC_SOFT_BYTE_SWAP) */ - -static void -ptp_usleep(int usec) -{ - usleep_range(usec,usec+1); -} - -static void -ptp_sleep(int jiffies) -{ - wait_queue_head_t wq; - init_waitqueue_head(&wq); - - wait_event_timeout(wq, 0, jiffies); - -} - - -static void bksync_hostcmd_data_op(int setget, u64 *d1, u64 *d2) -{ - u32 w0, w1; - u64 data; - - if (!d1) { - return; - } - - if (setget) { - data = *d1; - w0 = (data & 0xFFFFFFFF); - w1 = (data >> 32); - DEV_WRITE32(ptp_priv, hostcmd_regs[1], w0); - DEV_WRITE32(ptp_priv, hostcmd_regs[2], w1); - } else { - DEV_READ32(ptp_priv, hostcmd_regs[1], &w0); - DEV_READ32(ptp_priv, hostcmd_regs[2], &w1); - data = (((u64)w1 << 32) | (w0)); - *d1 = data; - - if (d2) { - DEV_READ32(ptp_priv, hostcmd_regs[3], &w0); - DEV_READ32(ptp_priv, hostcmd_regs[4], &w1); - data = (((u64)w1 << 32) | (w0)); - *d2 = data; - } - } -} - - -static int bksync_cmd_go(u32 cmd, void *data0, void *data1) -{ - int ret = -1; - int retry_cnt = (1000); /* 1ms default timeout for hostcmd response */ - u32 cmd_status; - char cmd_str[20]; - int port; - uint32_t seq_id; - ktime_t start, now; - - if (ptp_priv == NULL || ptp_priv->shared_addr == NULL) { - return ret; - } - - mutex_lock(&ptp_priv->ptp_lock); - - if (cmd == BKSYNC_GET_TSTIME || cmd == BKSYNC_ACK_TSTIME) { - port = *((uint64_t *)data0) & 0xFFF; - seq_id = *((uint64_t*)data0) >> 16; - } - start = ktime_get(); - - ptp_priv->shared_addr->ksyncinit = cmd; - - /* init data */ - DEV_WRITE32(ptp_priv, hostcmd_regs[1], 0x0); - DEV_WRITE32(ptp_priv, hostcmd_regs[2], 0x0); - DEV_WRITE32(ptp_priv, hostcmd_regs[3], 0x0); - DEV_WRITE32(ptp_priv, hostcmd_regs[4], 0x0); - - switch (cmd) { - case BKSYNC_INIT: - sprintf(cmd_str, "KSYNC_INIT"); - ptp_priv->shared_addr->phase_offset = 0; - bksync_hostcmd_data_op(1, (u64 *)&(ptp_priv->shared_addr->phase_offset), 0); - break; - case BKSYNC_FREQCOR: - sprintf(cmd_str, "KSYNC_FREQCORR"); - ptp_priv->shared_addr->freqcorr = *((s32 *)data0); - bksync_hostcmd_data_op(1, (u64 *)&(ptp_priv->shared_addr->freqcorr), 0); - break; - case BKSYNC_ADJTIME: - sprintf(cmd_str, "KSYNC_ADJTIME"); - ptp_priv->shared_addr->phase_offset = *((s64 *)data0); - bksync_hostcmd_data_op(1, (u64 *)&(ptp_priv->shared_addr->phase_offset), 0); - break; - case BKSYNC_GETTIME: - retry_cnt = (retry_cnt * 2); - sprintf(cmd_str, "KSYNC_GETTIME"); - break; - case BKSYNC_GET_TSTIME: - retry_cnt = (retry_cnt * 2); - sprintf(cmd_str, "KSYNC_GET_TSTIME"); - bksync_hostcmd_data_op(1, data0, data1); - break; - case BKSYNC_ACK_TSTIME: - retry_cnt = (retry_cnt * 2); - sprintf(cmd_str, "KSYNC_ACK_TSTIME"); - bksync_hostcmd_data_op(1, data0, data1); - break; - case BKSYNC_SETTIME: - sprintf(cmd_str, "KSYNC_SETTIME"); - ptp_priv->shared_addr->ptptime = *((s64 *)data0); - ptp_priv->shared_addr->phase_offset = 0; - bksync_hostcmd_data_op(1, (u64 *)&(ptp_priv->shared_addr->ptptime), (u64 *)&(ptp_priv->shared_addr->phase_offset)); - break; - case BKSYNC_MTP_TS_UPDATE_ENABLE: - retry_cnt = (retry_cnt * 6); - sprintf(cmd_str, "KSYNC_MTP_TS_UPDATE_ENABLE"); - bksync_hostcmd_data_op(1, (u64 *)data0, 0); - break; - case BKSYNC_MTP_TS_UPDATE_DISABLE: - retry_cnt = (retry_cnt * 6); - sprintf(cmd_str, "KSYNC_MTP_TS_UPDATE_DISABLE"); - bksync_hostcmd_data_op(1, (u64 *)data0, 0); - break; - case BKSYNC_DEINIT: - retry_cnt = (retry_cnt * 4); - sprintf(cmd_str, "KSYNC_DEINIT"); - break; - default: - sprintf(cmd_str, "KSYNC_XXX"); - break; - } - DEV_WRITE32(ptp_priv, hostcmd_regs[0], ptp_priv->shared_addr->ksyncinit); - - do { - DEV_READ32(ptp_priv, hostcmd_regs[0], &cmd_status); - ptp_priv->shared_addr->ksyncinit = cmd_status; - - if (cmd_status == BKSYNC_DONE) { - ret = 0; - switch (cmd) { - case BKSYNC_GET_TSTIME: - case BKSYNC_GETTIME: - bksync_hostcmd_data_op(0, (u64 *)data0, (u64 *)data1); - break; - default: - break; - } - break; - } - ptp_usleep(100); - retry_cnt--; - } while (retry_cnt); - - now = ktime_get(); - mutex_unlock(&ptp_priv->ptp_lock); - - if (retry_cnt == 0) { - DBG_ERR(("Timeout on response from R5 to cmd %s time taken %lld us\n", cmd_str, ktime_us_delta(now, start))); - if (cmd == BKSYNC_GET_TSTIME) { - DBG_TXTS(("Timeout Port %d SeqId %d\n", port, seq_id)); - } - } - if (debug & DBG_LVL_CMDS) { - if (ktime_us_delta(now, start) > 5000) - DBG_CMDS(("R5 Command %s exceeded time expected (%lld us)\n", cmd_str, ktime_us_delta(now, start))); - } - - - return ret; -} - - -/** - * bksync_ptp_adjfreq - * - * @ptp: pointer to ptp_clock_info structure - * @ppb: frequency correction value - * - * Description: this function will set the frequency correction - */ -static int bksync_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb) -{ - int ret = -1; - u32 cmd_status = BKSYNC_FREQCOR; - - ret = bksync_cmd_go(cmd_status, &ppb, NULL); - DBG_VERB(("applying freq correction: %x\n", ppb)); - - return ret; -} - -/** - * bksync_ptp_adjtime - * - * @ptp: pointer to ptp_clock_info structure - * @delta: desired change in nanoseconds - * - * Description: this function will shift/adjust the hardware clock time. - */ -static int bksync_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) -{ - u32 cmd_status = BKSYNC_ADJTIME; - int ret = -1; - - ret = bksync_cmd_go(cmd_status, (void *)&delta, NULL); - DBG_VERB(("ptp adjtime: 0x%llx \n", delta)); - - return ret; -} - -/** - * bksync_ptp_gettime - * - * @ptp: pointer to ptp_clock_info structure - * @ts: pointer to hold time/result - * - * Description: this function will read the current time from the - * hardware clock and store it in @ts. - */ -static int bksync_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) -{ - int ret = -1; - u32 cmd_status = BKSYNC_GETTIME; - s64 reftime = 0; - s64 refctr = 0; - - ret = bksync_cmd_go(cmd_status, (void *)&reftime, (void *)&refctr); - if (ret == 0) { - DBG_VERB(("ptp gettime: 0x%llx refctr:0x%llx\n", reftime, refctr)); - mutex_lock(&ptp_priv->ptp_pair_lock); - ptp_priv->shared_addr->ptptime = reftime; - ptp_priv->shared_addr->reftime = refctr; - mutex_unlock(&ptp_priv->ptp_pair_lock); - - *ts = ns_to_timespec64(reftime); - } - return ret; -} - - -/** - * bksync_ptp_settime - * - * @ptp: pointer to ptp_clock_info structure - * @ts: time value to set - * - * Description: this function will set the current time on the - * hardware clock. - */ -static int bksync_ptp_settime(struct ptp_clock_info *ptp, - const struct timespec64 *ts) -{ - s64 reftime, phaseadj; - int ret = -1; - u32 cmd_status = BKSYNC_SETTIME; - - phaseadj = 0; - reftime = timespec64_to_ns(ts); - - ret = bksync_cmd_go(cmd_status, (void *)&reftime, (void *)&phaseadj); - DBG_VERB(("ptp settime: 0x%llx \n", reftime)); - - return ret; -} - -static int bksync_ptp_enable(struct ptp_clock_info *ptp, - struct ptp_clock_request *rq, int on) -{ - return 0; -} - - -static int bksync_ptp_mirror_encap_update(struct ptp_clock_info *ptp, - int mtp_idx, int start) -{ - int ret = -1; - u64 mirror_encap_idx; - u32 cmd_status; - - if (mtp_idx > BCMKSYNC_MAX_MTP_IDX) { - return ret; - } - - mirror_encap_idx = mtp_idx; - if (start) { - cmd_status = BKSYNC_MTP_TS_UPDATE_ENABLE; - ptp_priv->mirror_encap_bmp |= (1 << mtp_idx); - } else { - if (!(ptp_priv->mirror_encap_bmp & mtp_idx)) { - /* Not running */ - return ret; - } - cmd_status = BKSYNC_MTP_TS_UPDATE_DISABLE; - ptp_priv->mirror_encap_bmp &= ~mtp_idx; - } - - ret = bksync_cmd_go(cmd_status, &mirror_encap_idx, NULL); - DBG_VERB(("ptp mmirror_encap_update: %d, mpt_index: %d, ret:%d \n", start, mtp_idx, ret)); - - return ret; - -} - -/* structure describing a PTP hardware clock */ -static struct ptp_clock_info bksync_ptp_caps = { - .owner = THIS_MODULE, - .name = "bksync_ptp_clock", - .max_adj = 200000, - .n_alarm = 0, - .n_ext_ts = 0, - .n_per_out = 0, /* will be overwritten in bksync_ptp_register */ - .n_pins = 0, - .pps = 0, - .adjfreq = bksync_ptp_adjfreq, - .adjtime = bksync_ptp_adjtime, - .gettime64 = bksync_ptp_gettime, - .settime64 = bksync_ptp_settime, - .enable = bksync_ptp_enable, -}; - -/** - * bksync_ptp_hw_tstamp_enable - * - * @dev_no: device number - * @port: port number - * - * Description: this is a callback function to enable the timestamping on - * a given port - */ -int bksync_ptp_hw_tstamp_enable(int dev_no, int port, int tx_type) -{ - uint64_t portmap = 0; - int map = 0; - int ret = 0; - - if (!module_initialized) { - ret = -1; - goto exit; - } - - if (tx_type == HWTSTAMP_TX_ONESTEP_SYNC) { - bksync_ptp_time_keep_init(); - goto exit; - } - - DBG_VERB(("Enable timestamp on a given port:%d\n", port)); - if (port <= 0) { - DBG_ERR(("Error enabling timestamp on port:%d\n", port)); - ret = -1; - goto exit; - } - - port -= 1; - map = port/64; port = port%64; - - /* Update the shared structure member */ - if (ptp_priv->shared_addr) { - portmap = ptp_priv->shared_addr->portmap[map]; - portmap |= (uint64_t)0x1 << port; - ptp_priv->shared_addr->portmap[map] = portmap; - /* Command to R5 for the update */ - ptp_priv->shared_addr->ksyncinit=BKSYNC_PBM_UPDATE; - } - -exit: - return ret; -} - -/** - * bksync_ptp_hw_tstamp_disable - * - * @dev_no: device number - * @port: port number - * - * Description: this is a callback function to disable the timestamping on - * a given port - */ -int bksync_ptp_hw_tstamp_disable(int dev_no, int port, int tx_type) -{ - uint64_t portmap = 0; - int map = 0; - int ret = 0; - - if (!module_initialized) { - ret = -1; - goto exit; - } - - if (tx_type == HWTSTAMP_TX_ONESTEP_SYNC) { - goto exit; - } - - DBG_VERB(("Disable timestamp on a given port:%d\n", port)); - if (port <= 0) { - DBG_ERR(("Error disabling timestamp on port:%d\n", port)); - ret = -1; - goto exit; - } - - port -= 1; - map = port/64; port = port%64; - - /* Update the shared structure member */ - if (ptp_priv->shared_addr) { - portmap = ptp_priv->shared_addr->portmap[map]; - portmap &= ~((uint64_t)0x1 << port); - ptp_priv->shared_addr->portmap[map]= portmap; - - /* Command to R5 for the update */ - ptp_priv->shared_addr->ksyncinit = BKSYNC_PBM_UPDATE; - } -exit: - return ret; -} - -int bksync_ptp_transport_get(uint8_t *pkt) -{ - int transport = 0; - uint16_t ethertype; - uint16_t tpid; - int tpid_offset, ethype_offset; - - /* Need to check VLAN tag if packet is tagged */ - tpid_offset = 12; - tpid = pkt[tpid_offset] << 8 | pkt[tpid_offset + 1]; - if (tpid == 0x8100) { - ethype_offset = tpid_offset + 4; - } else { - ethype_offset = tpid_offset; - } - - ethertype = pkt[ethype_offset] << 8 | pkt[ethype_offset+1]; - - switch (ethertype) { - case 0x88f7: /* ETHERTYPE_PTPV2 */ - transport = 2; - break; - - case 0x0800: /* ETHERTYPE_IPV4 */ - transport = 4; - break; - - case 0x86DD: /* ETHERTYPE_IPV6 */ - transport = 6; - break; - - default: - transport = 0; - } - - return transport; -} - -static int -bksync_txpkt_tsts_tsamp_get(int port, uint32_t pkt_seq_id, uint32_t *ts_valid, uint32_t *seq_id, uint64_t *timestamp) -{ - int ret = 0; - uint64_t tmp; - u32 fifo_rxctr = 0; - - tmp = (port & 0xFFFF) | (pkt_seq_id << 16); - - ret = bksync_cmd_go(BKSYNC_GET_TSTIME, &tmp, timestamp); - - if (ret >= 0) { - fifo_rxctr = (tmp >> 32) & 0xFFFF; - *seq_id = ((tmp >> 16) & 0xFFFF); - *ts_valid = (tmp & 0x1); - if (*ts_valid) { - tmp = (port & 0xFFFF) | (pkt_seq_id << 16); - bksync_cmd_go(BKSYNC_ACK_TSTIME, &tmp, 0); - if (fifo_rxctr != 0) { - if (fifo_rxctr != ptp_priv->port_stats[port].fifo_rxctr + 1) { - DBG_ERR(("FW Reset or Lost Timestamp RxSeq:(Prev %d : Current %d)\n", ptp_priv->port_stats[port].fifo_rxctr, fifo_rxctr)); - } - ptp_priv->port_stats[port].fifo_rxctr = fifo_rxctr; - } - } - } - - - return ret; -} - - -/** - * bksync_ptp_hw_tstamp_tx_time_get - * - * @dev_no: device number - * @port: port number - * @pkt: packet address - * @ts: timestamp to be retrieved - * - * Description: this is a callback function to retrieve the timestamp on - * a given port - */ -int bksync_ptp_hw_tstamp_tx_time_get(int dev_no, int port, uint8_t *pkt, uint64_t *ts) -{ - /* Get Timestamp from R5 or CLMAC */ - uint32_t ts_valid = 0; - uint32_t seq_id = 0; - uint32_t pktseq_id = 0; - uint64_t timestamp = 0; - uint16_t tpid = 0; - ktime_t start; - u64 delta; - int retry_cnt = num_retries; - int seq_id_offset, tpid_offset; - int transport = network_transport; - start = ktime_get(); - - if (!ptp_priv || !pkt || !ts || port < 1 || port > 255 || ptp_priv->shared_addr == NULL) { - return -1; - } - - *ts = 0; - - tpid_offset = 12; - - /* Parse for nw transport */ - if (transport == 0) { - transport = bksync_ptp_transport_get(pkt); - } - - switch(transport) - { - case 2: - seq_id_offset = 0x2c; - break; - case 4: - seq_id_offset = 0x48; - break; - case 6: - seq_id_offset = 0x5c; - break; - default: - seq_id_offset = 0x2c; - break; - } - - /* Need to check VLAN tag if packet is tagged */ - tpid = pkt[tpid_offset] << 8 | pkt[tpid_offset + 1]; - if (tpid == 0x8100) { - seq_id_offset += 4; - } - - - pktseq_id = pkt[seq_id_offset] << 8 | pkt[seq_id_offset + 1]; - - port -= 1; - - /* Fetch the TX timestamp from shadow memory */ - do { - bksync_txpkt_tsts_tsamp_get(port, pktseq_id, &ts_valid, &seq_id, ×tamp); - if (ts_valid) { - - /* Clear the shadow memory to get next entry */ - ptp_priv->shared_addr->port_ts_data[port].timestamp = 0; - ptp_priv->shared_addr->port_ts_data[port].port_id = 0; - ptp_priv->shared_addr->port_ts_data[port].ts_seq_id = 0; - ptp_priv->shared_addr->port_ts_data[port].ts_valid = 0; - - if (seq_id == pktseq_id) { - *ts = timestamp; - ptp_priv->port_stats[port].tsts_match += 1; - - delta = ktime_us_delta(ktime_get(), start); - DBG_VERB(("Port: %d Skb_SeqID %d FW_SeqId %d and TS:%llx FetchTime %lld\n", - port, pktseq_id, seq_id, timestamp, delta)); - - if (delta < ptp_priv->port_stats[port].tsts_best_fetch_time || ptp_priv->port_stats[port].tsts_best_fetch_time == 0) { - ptp_priv->port_stats[port].tsts_best_fetch_time = delta; - } - if (delta > ptp_priv->port_stats[port].tsts_worst_fetch_time || ptp_priv->port_stats[port].tsts_worst_fetch_time == 0) { - ptp_priv->port_stats[port].tsts_worst_fetch_time = delta; - } - /* Calculate Moving Average*/ - ptp_priv->port_stats[port].tsts_avg_fetch_time = ((u32)delta + ((ptp_priv->port_stats[port].tsts_match - 1) * ptp_priv->port_stats[port].tsts_avg_fetch_time)) / ptp_priv->port_stats[port].tsts_match; - break; - } else { - DBG_TXTS(("Discard timestamp on port %d Skb_SeqID %d FW_SeqId %d RetryCnt %d TimeLapsed (%lld us)\n", - port, pktseq_id, seq_id, (num_retries - retry_cnt), ktime_us_delta(ktime_get(),start))); - - ptp_priv->port_stats[port].tsts_discard += 1; - continue; - } - } - ptp_sleep(1); - retry_cnt--; - } while(retry_cnt); - - - ptp_priv->port_stats[port].pkt_txctr += 1; - - if (retry_cnt == 0) { - ptp_priv->port_stats[port].tsts_timeout += 1; - DBG_ERR(("FW Response timeout: Tx TS on phy port:%d Skb_SeqID: %d TimeLapsed (%lld us)\n", - port, pktseq_id, ktime_us_delta(ktime_get(), start))); - } - - - return 0; -} - - -enum { - bxconCustomEncapVersionInvalid = 0, - bxconCustomEncapVersionOne = 1, - - bxconCustomEncapVersionCurrent = bxconCustomEncapVersionOne, - bxconCustomEncapVersionReserved = 255 /* last */ -} bxconCustomEncapVersion; - -enum { - bxconCustomEncapOpcodeInvalid = 0, - bxconCustomEncapOpcodePtpRx = 1, - bxconCustomEncapOpcodeReserved = 255 /* last */ -} bxconCustomEncapOpcode; - -enum { - bxconCustomEncapPtpRxTlvInvalid = 0, - bxconCustomEncapPtpRxTlvPtpRxTime = 1, - bxconCustomEncapPtpRxTlvReserved = 255 /* last */ -} bxconCustomEncapPtpRxTlvType; - -void -bksync_dump_pkt(uint8_t *data, int size) -{ - int idx; - char str[128]; - - for (idx = 0; idx < size; idx++) { - if ((idx & 0xf) == 0) { - sprintf(str, "%04x: ", idx); - } - sprintf(&str[strlen(str)], "%02x ", data[idx]); - if ((idx & 0xf) == 0xf) { - sprintf(&str[strlen(str)], "\n"); - gprintk(str); - } - } - if ((idx & 0xf) != 0) { - sprintf(&str[strlen(str)], "\n"); - gprintk(str); - } -} - - -static inline int -bksync_pkt_custom_encap_ptprx_get(uint8_t *pkt, uint64_t *ing_ptptime) -{ - uint8_t *custom_hdr; - uint8_t id[4]; - uint8_t ver, opc; - uint8_t nh_type, nh_rsvd; - uint16_t len, tot_len; - uint16_t nh_len; - uint32_t seq_id = 0; - uint32_t ptp_rx_time[2]; - uint64_t u64_ptp_rx_time = 0; - - custom_hdr = pkt; - - BKSYNC_UNPACK_U8(custom_hdr, id[0]); - BKSYNC_UNPACK_U8(custom_hdr, id[1]); - BKSYNC_UNPACK_U8(custom_hdr, id[2]); - BKSYNC_UNPACK_U8(custom_hdr, id[3]); - if (!((id[0] == 'B') && (id[1] == 'C') && (id[2] == 'M') && (id[3] == 'C'))) { - /* invalid signature */ - return -1; - } - - BKSYNC_UNPACK_U8(custom_hdr, ver); - switch (ver) { - case bxconCustomEncapVersionCurrent: - break; - default: - gprintk("invalid ver\n"); - return -1; - } - - BKSYNC_UNPACK_U8(custom_hdr, opc); - switch (opc) { - case bxconCustomEncapOpcodePtpRx: - break; - default: - gprintk("invalid opcode\n"); - return -1; - } - - - BKSYNC_UNPACK_U16(custom_hdr, len); - BKSYNC_UNPACK_U32(custom_hdr, seq_id); - tot_len = len; - - /* remaining length of custom encap */ - len = len - (custom_hdr - pkt); - - - /* process tlv */ - while (len > 0) { - BKSYNC_UNPACK_U8(custom_hdr, nh_type); - BKSYNC_UNPACK_U8(custom_hdr, nh_rsvd); - BKSYNC_UNPACK_U16(custom_hdr, nh_len); - len = len - (nh_len); - if (nh_rsvd != 0x0) { - continue; /* invalid tlv */ - } - - switch (nh_type) { - case bxconCustomEncapPtpRxTlvPtpRxTime: - BKSYNC_UNPACK_U32(custom_hdr, ptp_rx_time[0]); - BKSYNC_UNPACK_U32(custom_hdr, ptp_rx_time[1]); - u64_ptp_rx_time = ((uint64_t)ptp_rx_time[1] << 32) | (uint64_t)ptp_rx_time[0]; - *ing_ptptime = u64_ptp_rx_time; - break; - default: - custom_hdr += nh_len; - break; - } - } - -#if 0 -if (!(seq_id % 100)) { - gprintk("****** seq_id = %d ptp time = 0x%llx\n", seq_id, u64_ptp_rx_time); - bksync_dump_pkt(pkt, tot_len); -} -#endif - - DBG_VERB(("Custom encap header: ver=%d opcode=%d seq_id=0x%x\n", ver, opc, seq_id)); - - return (tot_len); -} - - - -/** - * bksync_ptp_hw_tstamp_rx_time_upscale - * - * @dev_no: device number - * @ts: timestamp to be retrieved - * - * Description: this is a callback function to retrieve 64b equivalent of - * rx timestamp - */ -int bksync_ptp_hw_tstamp_rx_time_upscale(int dev_no, int port, struct sk_buff *skb, uint32_t *meta, uint64_t *ts) -{ - int ret = 0; - int custom_encap_len = 0; - - switch (KNET_SKB_CB(skb)->dcb_type) { - case 26: - case 32: - case 35: - if (pci_cos != (meta[4] & 0x3F)) { - return -1; - } - break; - case 38: - if (pci_cos != ((meta[12] >> 22) & 0x2F)) { - return -1; - } - break; - case 36: - if (pci_cos != ((meta[6] >> 22) & 0x2F)) { - return -1; - } - break; - default: - return -1; - } - - /* parse custom encap header in pkt for ptp rxtime */ - custom_encap_len = bksync_pkt_custom_encap_ptprx_get((skb->data), ts); - - /* Remove the custom encap header from pkt */ - if (custom_encap_len > 0) { - skb_pull(skb, custom_encap_len); - - DBG_VERB(("###### ptp message type: %d\n", skb->data[42])); - } - - if (port > 0){ - port -= 1; - ptp_priv->port_stats[port].pkt_rxctr += 1; - } - - return ret; -} - - -void bksync_hton64(u8 *buf, const uint64_t *data) -{ -#ifdef __LITTLE_ENDIAN - /* LITTLE ENDIAN */ - buf[0] = (*(((uint8_t*)(data)) + 7u)); - buf[1] = (*(((uint8_t*)(data)) + 6u)); - buf[2] = (*(((uint8_t*)(data)) + 5u)); - buf[3] = (*(((uint8_t*)(data)) + 4u)); - buf[4] = (*(((uint8_t*)(data)) + 3u)); - buf[5] = (*(((uint8_t*)(data)) + 2u)); - buf[6] = (*(((uint8_t*)(data)) + 1u)); - buf[7] = (*(((uint8_t*)(data)) + 0u)); -#else - memcpy(buf, data, 8); -#endif -} - - - -int bksync_ptp_hw_tstamp_tx_meta_get(int dev_no, - int hwts, int hdrlen, - struct sk_buff *skb, - uint64_t *tstamp, - u32 **md) -{ - uint16_t tpid = 0; - int md_offset = 0; - int pkt_offset = 0; - int ptp_hdr_offset = 0; - int transport = network_transport; - s64 ptptime = 0; - s64 ptpcounter = 0; - int64_t corrField; - int32_t negCurTS32; - int64_t negCurTS64; - - if(!ptp_priv || ptp_priv->shared_addr == NULL) { - return 0; - } - - mutex_lock(&ptp_priv->ptp_pair_lock); - ptptime = ptp_priv->shared_addr->ptptime; - ptpcounter = ptp_priv->shared_addr->reftime; - mutex_unlock(&ptp_priv->ptp_pair_lock); - - negCurTS32 = - (int32_t) ptpcounter; - negCurTS64 = - (int64_t)(ptpcounter); - - if (CMICX_DEV_TYPE) { - pkt_offset = ptp_hdr_offset = hdrlen; - } - - /* Need to check VLAN tag if packet is tagged */ - tpid = SKB_U16_GET(skb, (pkt_offset + 12)); - if (tpid == 0x8100) { - md_offset = 4; - ptp_hdr_offset += 4; - } - - /* One Step Meta Data */ - if (hwts == HWTSTAMP_TX_ONESTEP_SYNC) { - md_offset += 8; - if (KNET_SKB_CB(skb)->dcb_type == 26) { - corrField = (((int64_t)negCurTS32) << 16); - if (negCurTS32 >= 0) { - md_offset += 8; - } - } else { - corrField = (((int64_t)negCurTS64) << 16); - } - } - - - /* Parse for nw transport */ - if (transport == 0) { - transport = bksync_ptp_transport_get(skb->data + pkt_offset); - } - - switch(transport) - { - case 2: /* IEEE 802.3 */ - ptp_hdr_offset += 14; - if (KNET_SKB_CB(skb)->dcb_type == 32) { - if (md) *md = &sobmhrawpkts_dcb32[md_offset]; - } else if(KNET_SKB_CB(skb)->dcb_type == 26) { - if (md) *md = &sobmhrawpkts_dcb26[md_offset]; - } else if(KNET_SKB_CB(skb)->dcb_type == 35) { - if (md) *md = &sobmhrawpkts_dcb35[md_offset]; - } else if(KNET_SKB_CB(skb)->dcb_type == 36) { - if (md) *md = &sobmhrawpkts_dcb36[md_offset]; - } else if(KNET_SKB_CB(skb)->dcb_type == 38) { - if (md) *md = &sobmhrawpkts_dcb38[md_offset]; - } - break; - case 4: /* UDP IPv4 */ - ptp_hdr_offset += 42; - if (KNET_SKB_CB(skb)->dcb_type == 32) { - if (md) *md = &sobmhudpipv4_dcb32[md_offset]; - } else if(KNET_SKB_CB(skb)->dcb_type == 26) { - if (md) *md = &sobmhudpipv4_dcb26[md_offset]; - } else if(KNET_SKB_CB(skb)->dcb_type == 35) { - if (md) *md = &sobmhudpipv4_dcb35[md_offset]; - } else if(KNET_SKB_CB(skb)->dcb_type == 36) { - if (md) *md = &sobmhudpipv4_dcb36[md_offset]; - } else if(KNET_SKB_CB(skb)->dcb_type == 38) { - if (md) *md = &sobmhudpipv4_dcb38[md_offset]; - } - break; - case 6: /* UDP IPv6 */ - ptp_hdr_offset += 62; - if (KNET_SKB_CB(skb)->dcb_type == 32) { - if (md) *md = &sobmhudpipv6_dcb32[md_offset]; - } else if(KNET_SKB_CB(skb)->dcb_type == 26) { - if (md) *md = &sobmhudpipv6_dcb26[md_offset]; - } else if(KNET_SKB_CB(skb)->dcb_type == 35) { - if (md) *md = &sobmhudpipv6_dcb35[md_offset]; - } else if(KNET_SKB_CB(skb)->dcb_type == 36) { - if (md) *md = &sobmhudpipv6_dcb36[md_offset]; - } else if(KNET_SKB_CB(skb)->dcb_type == 38) { - if (md) *md = &sobmhudpipv6_dcb38[md_offset]; - } - break; - default: - ptp_hdr_offset += 42; - if (KNET_SKB_CB(skb)->dcb_type == 32) { - if (md) *md = &sobmhudpipv4_dcb32[md_offset]; - } else if(KNET_SKB_CB(skb)->dcb_type == 26) { - if (md) *md = &sobmhudpipv4_dcb26[md_offset]; - } else if(KNET_SKB_CB(skb)->dcb_type == 35) { - if (md) *md = &sobmhudpipv4_dcb35[md_offset]; - } else if(KNET_SKB_CB(skb)->dcb_type == 36) { - if (md) *md = &sobmhudpipv4_dcb36[md_offset]; - } else if(KNET_SKB_CB(skb)->dcb_type == 38) { - if (md) *md = &sobmhudpipv4_dcb38[md_offset]; - } - break; - } - - - if ((hwts == HWTSTAMP_TX_ONESTEP_SYNC) && - BKSYNC_PTP_EVENT_MSG(skb->data[ptp_hdr_offset])) { - /* One Step Timestamp Field updation */ - int corr_offset = ptp_hdr_offset + 8; - int origin_ts_offset = ptp_hdr_offset + 34; - u32 tmp; - struct timespec64 ts; - int udp_csum_regen; - u32 udp_csum20; - u16 udp_csum; - int port; - - udp_csum = SKB_U16_GET(skb, (ptp_hdr_offset - 2)); - - switch (transport) { - case 2: - udp_csum_regen = 0; - break; - case 6: - udp_csum_regen = 1; - break; - default: - udp_csum_regen = (udp_csum != 0x0); - break; - } - - /* Fill the correction field */ - bksync_hton64(&(skb->data[corr_offset]), (const u64 *)&corrField); - - /* Fill the Origin Timestamp Field */ - ts = ns_to_timespec64(ptptime); - - tmp = (ts.tv_sec >> 32); - skb->data[origin_ts_offset + 0] = ((tmp >> 8) & 0xFF); - skb->data[origin_ts_offset + 1] = ((tmp ) & 0xFF); - - tmp = (ts.tv_sec & 0xFFFFFFFFLL); - skb->data[origin_ts_offset + 2] = ((tmp >> 24) & 0xFF); - skb->data[origin_ts_offset + 3] = ((tmp >> 16) & 0xFF); - skb->data[origin_ts_offset + 4] = ((tmp >> 8) & 0xFF); - skb->data[origin_ts_offset + 5] = ((tmp ) & 0xFF); - - tmp = (ts.tv_nsec & 0xFFFFFFFFLL); - skb->data[origin_ts_offset + 6] = ((tmp >> 24) & 0xFF); - skb->data[origin_ts_offset + 7] = ((tmp >> 16) & 0xFF); - skb->data[origin_ts_offset + 8] = ((tmp >> 8) & 0xFF); - skb->data[origin_ts_offset + 9] = ((tmp ) & 0xFF); - - if (udp_csum_regen) { - udp_csum20 = (~udp_csum) & 0xFFFF; - - udp_csum20 += SKB_U16_GET(skb, (corr_offset + 0)); - udp_csum20 += SKB_U16_GET(skb, (corr_offset + 2)); - udp_csum20 += SKB_U16_GET(skb, (corr_offset + 4)); - udp_csum20 += SKB_U16_GET(skb, (corr_offset + 6)); - - udp_csum20 += SKB_U16_GET(skb, (origin_ts_offset + 0)); - udp_csum20 += SKB_U16_GET(skb, (origin_ts_offset + 2)); - udp_csum20 += SKB_U16_GET(skb, (origin_ts_offset + 4)); - udp_csum20 += SKB_U16_GET(skb, (origin_ts_offset + 6)); - udp_csum20 += SKB_U16_GET(skb, (origin_ts_offset + 8)); - - /* Fold 20bit checksum into 16bit udp checksum */ - udp_csum20 = ((udp_csum20 & 0xFFFF) + (udp_csum20 >> 16)); - udp_csum = ((udp_csum20 & 0xFFFF) + (udp_csum20 >> 16)); - - /* invert again to get final checksum. */ - udp_csum = ~udp_csum; - if (udp_csum == 0) { - udp_csum = 0xFFFF; - } - - skb->data[ptp_hdr_offset - 2] = ((udp_csum >> 8) & 0xFF); - skb->data[ptp_hdr_offset - 1] = ((udp_csum ) & 0xFF); - } - - if (skb->data[ptp_hdr_offset] == IEEE1588_MSGTYPE_DELREQ) { - *tstamp = ptptime; - - DBG_VERB(("ptp delay req packet tstamp : 0x%llx corrField: 0x%llx\n", ptptime, corrField)); - } - - port = KNET_SKB_CB(skb)->port; - port -= 1; - ptp_priv->port_stats[port].pkt_txonestep += 1; - } - - return 0; -} - - -int bksync_ptp_hw_tstamp_ptp_clock_index_get(int dev_no) -{ - int phc_index = -1; - if (ptp_priv && ptp_priv->ptp_clock) - phc_index = ptp_clock_index(ptp_priv->ptp_clock); - return phc_index; -} - - -/** -* bcm_ptp_time_keep - call timecounter_read every second to avoid timer overrun -* because a 32bit counter, will timeout in 4s -*/ -static void bksync_ptp_time_keep(struct work_struct *work) -{ - struct delayed_work *dwork = to_delayed_work(work); - struct bksync_ptp_priv *priv = - container_of(dwork, struct bksync_ptp_priv, time_keep); - struct timespec64 ts; - - /* Call bcm_ptp_gettime function to keep the ref_time_64 and ref_counter_48 in sync */ - bksync_ptp_gettime(&(priv->ptp_caps), &ts); - schedule_delayed_work(&priv->time_keep, HZ); -} - -static void bksync_ptp_time_keep_init(void) -{ - if (!ptp_priv->timekeep_status) { - INIT_DELAYED_WORK(&(ptp_priv->time_keep), bksync_ptp_time_keep); - schedule_delayed_work(&ptp_priv->time_keep, HZ); - - ptp_priv->timekeep_status = 1; - } - - return; -} - -static void bksync_ptp_time_keep_deinit(void) -{ - if (ptp_priv->timekeep_status) { - /* Cancel delayed work */ - cancel_delayed_work_sync(&(ptp_priv->time_keep)); - - ptp_priv->timekeep_status = 0; - } - - return; -} - - - -static int bksync_ptp_init(struct ptp_clock_info *ptp) -{ - return bksync_cmd_go(BKSYNC_INIT, NULL, NULL); -} - -static int bksync_ptp_deinit(struct ptp_clock_info *ptp) -{ - bksync_ptp_time_keep_deinit(); - - return bksync_cmd_go(BKSYNC_DEINIT, NULL, NULL); -} - -/* - * Device Debug Statistics Proc Entry - */ -/** -* This function is called at the beginning of a sequence. -* ie, when: -* - the /proc/bcm/ksync/stats file is read (first time) -* - after the function stop (end of sequence) -* -*/ -static void *bksync_proc_seq_start(struct seq_file *s, loff_t *pos) -{ - /* beginning a new sequence ? */ - if ( (int)*pos == 0 && ptp_priv->shared_addr != NULL) - { - seq_printf(s, "TwoStep Port Bitmap : %08llx%08llx\n", - (uint64_t)(ptp_priv->shared_addr->portmap[1]), - (uint64_t)(ptp_priv->shared_addr->portmap[0])); - seq_printf(s,"%4s| %9s| %9s| %9s| %9s| %9s| %9s| %9s| %9s| %9s| %9s| %9s\n", - "Port", "RxCounter", "TxCounter", "TxOneStep", "TSTimeout", "TSRead", "TSMatch", "TSDiscard", - "TimeHi" , "TimeLo", "TimeAvg", "FIFORx"); - } - - if ((int)*pos < (ptp_priv->num_pports)) - return (void *)(unsigned long)(*pos + 1); - /* End of the sequence, return NULL */ - return NULL; -} - -/** -* This function is called after the beginning of a sequence. -* It's called untill the return is NULL (this ends the sequence). -* -*/ -static void *bksync_proc_seq_next(struct seq_file *s, void *v, loff_t *pos) -{ - (*pos)++; - return bksync_proc_seq_start(s, pos); -} -/** -* This function is called at the end of a sequence -* -*/ -static void bksync_proc_seq_stop(struct seq_file *s, void *v) -{ - /* nothing to do, we use a static value in bksync_proc_seq_start() */ -} - -/** -* This function is called for each "step" of a sequence -* -*/ -static int bksync_proc_seq_show(struct seq_file *s, void *v) -{ - unsigned long port = (unsigned long)v; - port = port - 1; - if (ptp_priv->port_stats[port].pkt_rxctr || ptp_priv->port_stats[port].pkt_txctr || - ptp_priv->port_stats[port].pkt_txonestep|| - ptp_priv->port_stats[port].tsts_discard || ptp_priv->port_stats[port].tsts_timeout || - ptp_priv->shared_addr->port_ts_data[port].ts_cnt || ptp_priv->port_stats[port].tsts_match) { - seq_printf(s, "%4lu | %9d| %9d| %9d| %9d| %9d| %9d| %9d| %9lld| %9lld | %9d|%9d | %s\n", (port + 1), - ptp_priv->port_stats[port].pkt_rxctr, - ptp_priv->port_stats[port].pkt_txctr, - ptp_priv->port_stats[port].pkt_txonestep, - ptp_priv->port_stats[port].tsts_timeout, - ptp_priv->shared_addr->port_ts_data[port].ts_cnt, - ptp_priv->port_stats[port].tsts_match, - ptp_priv->port_stats[port].tsts_discard, - ptp_priv->port_stats[port].tsts_worst_fetch_time, - ptp_priv->port_stats[port].tsts_best_fetch_time, - ptp_priv->port_stats[port].tsts_avg_fetch_time, - ptp_priv->port_stats[port].fifo_rxctr, - ptp_priv->port_stats[port].pkt_txctr != ptp_priv->port_stats[port].tsts_match ? "***":""); - } - return 0; -} - -/** -* seq_operations for bsync_proc_*** entries -* -*/ -static struct seq_operations bksync_proc_seq_ops = { - .start = bksync_proc_seq_start, - .next = bksync_proc_seq_next, - .stop = bksync_proc_seq_stop, - .show = bksync_proc_seq_show -}; -static int bksync_proc_txts_open(struct inode * inode, struct file * file) -{ - return seq_open(file, &bksync_proc_seq_ops); -} - -static ssize_t -bksync_proc_txts_write(struct file *file, const char *buf, - size_t count, loff_t *loff) -{ - char debug_str[40]; - char *ptr; - int port; - - if (copy_from_user(debug_str, buf, count)) { - return -EFAULT; - } - - if ((ptr = strstr(debug_str, "clear")) != NULL) { - for (port = 0; port < ptp_priv->num_pports; port++) { - ptp_priv->port_stats[port].pkt_rxctr = 0; - ptp_priv->port_stats[port].pkt_txctr = 0; - ptp_priv->port_stats[port].pkt_txonestep = 0; - ptp_priv->port_stats[port].tsts_timeout = 0; - ptp_priv->port_stats[port].tsts_match = 0; - ptp_priv->port_stats[port].tsts_discard = 0; - if (ptp_priv->shared_addr) - ptp_priv->shared_addr->port_ts_data[port].ts_cnt = 0; - } - } else { - gprintk("Warning: unknown input\n"); - } - - return count; -} - -struct proc_ops bksync_proc_txts_file_ops = { - proc_open: bksync_proc_txts_open, - proc_read: seq_read, - proc_lseek: seq_lseek, - proc_write: bksync_proc_txts_write, - proc_release: seq_release, -}; - -/* - * Driver Debug Proc Entry - */ -static int -bksync_proc_debug_show(struct seq_file *m, void *v) -{ - seq_printf(m, "Configuration:\n"); - seq_printf(m, " debug: 0x%x\n", debug); - return 0; -} - -static ssize_t -bksync_proc_debug_write(struct file *file, const char *buf, - size_t count, loff_t *loff) -{ - char debug_str[40]; - char *ptr; - - if (copy_from_user(debug_str, buf, count)) { - return -EFAULT; - } - - if ((ptr = strstr(debug_str, "debug=")) != NULL) { - ptr += 6; - debug = simple_strtol(ptr, NULL, 0); - } else { - gprintk("Warning: unknown configuration\n"); - } - - return count; -} - -static int bksync_proc_debug_open(struct inode * inode, struct file * file) -{ - return single_open(file, bksync_proc_debug_show, NULL); -} - - -struct proc_ops bksync_proc_debug_file_ops = { - proc_open: bksync_proc_debug_open, - proc_read: seq_read, - proc_lseek: seq_lseek, - proc_write: bksync_proc_debug_write, - proc_release: single_release, -}; - - -static int -bksync_proc_init(void) -{ - struct proc_dir_entry *entry; - - PROC_CREATE(entry, "stats", 0666, bksync_proc_root, &bksync_proc_txts_file_ops); - if (entry == NULL) { - return -1; - } - PROC_CREATE(entry, "debug", 0666, bksync_proc_root, &bksync_proc_debug_file_ops); - if (entry == NULL) { - return -1; - } - return 0; -} - -static int -bksync_proc_cleanup(void) -{ - remove_proc_entry("stats", bksync_proc_root); - remove_proc_entry("debug", bksync_proc_root); - return 0; -} - -static void bksync_ptp_dma_init(int dcb_type) -{ - int endianess; - int num_pports = 256; - - - ptp_priv->num_pports = num_pports; - ptp_priv->dcb_type = dcb_type; - ptp_priv->dma_mem_size = 16384;/*sizeof(bksync_uc_linux_ipc_t);*/ - - if (ptp_priv->shared_addr == NULL) { - ptp_priv->shared_addr = kzalloc(16384, GFP_KERNEL); - ptp_priv->port_stats = kzalloc((sizeof(bksync_port_stats_t) * num_pports), GFP_KERNEL); - } - - if (ptp_priv->shared_addr != NULL) { - /* Reset memory. */ - memset((void *)ptp_priv->shared_addr, 0, ptp_priv->dma_mem_size); - -#ifdef __LITTLE_ENDIAN - endianess = 0; -#else - endianess = 1; -#endif - DEV_WRITE32(ptp_priv, CMIC_CMC_SCHAN_MESSAGE_14r(CMIC_CMC_BASE), ((pci_cos << 16) | endianess)); - - DEV_WRITE32(ptp_priv, CMIC_CMC_SCHAN_MESSAGE_15r(CMIC_CMC_BASE), 1); - DEV_WRITE32(ptp_priv, CMIC_CMC_SCHAN_MESSAGE_16r(CMIC_CMC_BASE), 1); - - } - - if (debug & DBG_LVL_VERB) { - printk(KERN_EMERG"%s %p:%p\n",__FUNCTION__, - ptp_priv->base_addr,(void *)ptp_priv->shared_addr); - } - - ptp_priv->mirror_encap_bmp = 0x0; - - hostcmd_regs[0] = CMIC_CMC_SCHAN_MESSAGE_21r(CMIC_CMC_BASE); - hostcmd_regs[1] = CMIC_CMC_SCHAN_MESSAGE_20r(CMIC_CMC_BASE); - hostcmd_regs[2] = CMIC_CMC_SCHAN_MESSAGE_19r(CMIC_CMC_BASE); - hostcmd_regs[3] = CMIC_CMC_SCHAN_MESSAGE_18r(CMIC_CMC_BASE); - hostcmd_regs[4] = CMIC_CMC_SCHAN_MESSAGE_17r(CMIC_CMC_BASE); - - return; -} - - -/** - * bksync_ioctl_cmd_handler - * @kmsg: kcom message - ptp clock ioctl command. - * Description: This function will handle ioctl commands - * from user mode. - */ -static int -bksync_ioctl_cmd_handler(kcom_msg_clock_cmd_t *kmsg, int len, int dcb_type) -{ - u32 fw_status; - kmsg->hdr.type = KCOM_MSG_TYPE_RSP; - - if (!module_initialized && kmsg->clock_info.cmd != KSYNC_M_HW_INIT) { - kmsg->hdr.status = KCOM_E_NOT_FOUND; - return sizeof(kcom_msg_hdr_t); - } - - switch(kmsg->clock_info.cmd) { - case KSYNC_M_HW_INIT: - pci_cos = kmsg->clock_info.data[0]; - if (kmsg->clock_info.data[1] == 0 || kmsg->clock_info.data[1] == 1) { - fw_core = kmsg->clock_info.data[1]; - DEV_READ32(ptp_priv, CMIC_CMC_SCHAN_MESSAGE_21r(CMIC_CMC_BASE), &fw_status); - - /* Return success if the app is already initialized. */ - if (module_initialized) { - kmsg->hdr.status = KCOM_E_NONE; - return sizeof(kcom_msg_hdr_t); - } - - /* Return error if the app is not ready yet. */ - if (fw_status != 0xBADC0DE1) { - kmsg->hdr.status = KCOM_E_RESOURCE; - return sizeof(kcom_msg_hdr_t); - } - - bksync_ptp_dma_init(dcb_type); - if (bksync_ptp_init(&(ptp_priv->ptp_caps)) >= 0) { - module_initialized = 1; - } - } - break; - case KSYNC_M_HW_DEINIT: - bksync_ptp_deinit(&(ptp_priv->ptp_caps)); - module_initialized = 0; - break; - case KSYNC_M_HW_TS_DISABLE: - bksync_ptp_hw_tstamp_disable(0, kmsg->clock_info.data[0], 0); - break; - case KSYNC_M_MTP_TS_UPDATE_ENABLE: - bksync_ptp_mirror_encap_update(0, kmsg->clock_info.data[0], TRUE); - break; - case KSYNC_M_MTP_TS_UPDATE_DISABLE: - bksync_ptp_mirror_encap_update(0, kmsg->clock_info.data[0], FALSE); - break; - case KSYNC_M_VERSION: - break; - default: - kmsg->hdr.status = KCOM_E_NOT_FOUND; - return sizeof(kcom_msg_hdr_t); - } - - return sizeof(*kmsg); -} - - - -/** - * bksync_ptp_register - * @priv: driver private structure - * Description: this function will register the ptp clock driver - * to kernel. It also does some house keeping work. - */ -static int bksync_ptp_register(void) -{ - int err = -ENODEV; - - /* Support on core-0 or core-1 */ - if (fw_core < 0 || fw_core > 1) { - goto exit; - } - - /* default transport is raw, ieee 802.3 */ - switch (network_transport) { - case 2: /* IEEE 802.3 */ - case 4: /* UDP IPv4 */ - case 6: /* UDP IPv6 */ - break; - default: - network_transport = 0; - } - - ptp_priv = kzalloc(sizeof(*ptp_priv), GFP_KERNEL); - if (!ptp_priv) { - err = -ENOMEM; - goto exit; - } - - /* Reset memory */ - memset(ptp_priv, 0, sizeof(*ptp_priv)); - - err = -ENODEV; - - ptp_priv->ptp_caps = bksync_ptp_caps; - - mutex_init(&(ptp_priv->ptp_lock)); - mutex_init(&(ptp_priv->ptp_pair_lock)); - - /* Register ptp clock driver with bksync_ptp_caps */ - ptp_priv->ptp_clock = ptp_clock_register(&ptp_priv->ptp_caps, NULL); - - /* Initialize the Base address for CMIC and shared Memory access */ - ptp_priv->base_addr = lkbde_get_dev_virt(0); - ptp_priv->dma_dev = lkbde_get_dma_dev(0); - - if (IS_ERR(ptp_priv->ptp_clock)) { - ptp_priv->ptp_clock = NULL; - } else if (ptp_priv->ptp_clock) { - err = 0; - - /* Register BCM-KNET HW Timestamp Callback Functions */ - bkn_hw_tstamp_enable_cb_register(bksync_ptp_hw_tstamp_enable); - bkn_hw_tstamp_disable_cb_register(bksync_ptp_hw_tstamp_disable); - bkn_hw_tstamp_tx_time_get_cb_register(bksync_ptp_hw_tstamp_tx_time_get); - bkn_hw_tstamp_tx_meta_get_cb_register(bksync_ptp_hw_tstamp_tx_meta_get); - bkn_hw_tstamp_rx_time_upscale_cb_register(bksync_ptp_hw_tstamp_rx_time_upscale); - bkn_hw_tstamp_ptp_clock_index_cb_register(bksync_ptp_hw_tstamp_ptp_clock_index_get); - bkn_hw_tstamp_ioctl_cmd_cb_register(bksync_ioctl_cmd_handler); - - } - - /* Initialize proc files */ - bksync_proc_root = proc_mkdir("bcm/ksync", NULL); - bksync_proc_init(); - ptp_priv->shared_addr = NULL; - ptp_priv->port_stats = NULL; -exit: - return err; -} - -static int bksync_ptp_remove(void) -{ - if (!ptp_priv) - return 0; - - bksync_ptp_time_keep_deinit(); - - bksync_proc_cleanup(); - remove_proc_entry("bcm/ksync", NULL); - - /* UnRegister BCM-KNET HW Timestamp Callback Functions */ - bkn_hw_tstamp_enable_cb_unregister(bksync_ptp_hw_tstamp_enable); - bkn_hw_tstamp_disable_cb_unregister(bksync_ptp_hw_tstamp_disable); - bkn_hw_tstamp_tx_time_get_cb_unregister(bksync_ptp_hw_tstamp_tx_time_get); - bkn_hw_tstamp_tx_meta_get_cb_unregister(bksync_ptp_hw_tstamp_tx_meta_get); - bkn_hw_tstamp_rx_time_upscale_cb_unregister(bksync_ptp_hw_tstamp_rx_time_upscale); - bkn_hw_tstamp_ptp_clock_index_cb_unregister(bksync_ptp_hw_tstamp_ptp_clock_index_get); - bkn_hw_tstamp_ioctl_cmd_cb_unregister(bksync_ioctl_cmd_handler); - - if (module_initialized) { - DEV_WRITE32(ptp_priv, CMIC_CMC_SCHAN_MESSAGE_15r(CMIC_CMC_BASE), 0); - DEV_WRITE32(ptp_priv, CMIC_CMC_SCHAN_MESSAGE_16r(CMIC_CMC_BASE), 0); - } - /* Deinitialize the PTP */ - bksync_ptp_deinit(&(ptp_priv->ptp_caps)); - module_initialized = 0; - - if (ptp_priv->port_stats != NULL) { - kfree((void *)ptp_priv->port_stats); - ptp_priv->port_stats = NULL; - } - if (ptp_priv->shared_addr != NULL) { - kfree((void *)ptp_priv->shared_addr); - ptp_priv->shared_addr = NULL; - DBG_ERR(("Free R5 memory\n")); - } - - /* Unregister the bcm ptp clock driver */ - ptp_clock_unregister(ptp_priv->ptp_clock); - - /* Free Memory */ - kfree(ptp_priv); - - return 0; -} -#endif - - -/* - * Generic module functions - */ - -/* - * Function: _pprint - * - * Purpose: - * Print proc filesystem information. - * Parameters: - * None - * Returns: - * Always 0 - */ - static int -_pprint(struct seq_file *m) -{ -#if LINUX_VERSION_CODE > KERNEL_VERSION(3,17,0) - /* put some goodies here */ - pprintf(m, "Broadcom BCM PTP Hardware Clock Module\n"); -#else - pprintf(m, "Broadcom BCM PTP Hardware Clock Module not supported\n"); -#endif - return 0; -} - -/* - * Function: _init - * - * Purpose: - * Module initialization. - * Attached SOC all devices and optionally initializes these. - * Parameters: - * None - * Returns: - * 0 on success, otherwise -1 - */ - static int -_init(void) -{ -#if LINUX_VERSION_CODE > KERNEL_VERSION(3,17,0) - bksync_ptp_register(); - return 0; -#else - return -1; -#endif -} - -/* - * Function: _cleanup - * - * Purpose: - * Module cleanup function - * Parameters: - * None - * Returns: - * Always 0 - */ - static int -_cleanup(void) -{ -#if LINUX_VERSION_CODE > KERNEL_VERSION(3,17,0) - mutex_destroy(&(ptp_priv->ptp_lock)); - mutex_destroy(&(ptp_priv->ptp_pair_lock)); - bksync_ptp_remove(); - return 0; -#else - return -1; -#endif -} - -static gmodule_t _gmodule = { -name: MODULE_NAME, - major: MODULE_MAJOR, - init: _init, - cleanup: _cleanup, - pprint: _pprint, - ioctl: NULL, - open: NULL, - close: NULL, -}; - - gmodule_t* -gmodule_get(void) -{ - EXPORT_NO_SYMBOLS; - return &_gmodule; -} diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/psample-cb.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/psample-cb.c index e67f9191d45e..628ee1780c09 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/psample-cb.c +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/psample-cb.c @@ -509,7 +509,7 @@ psample_filter_cb(uint8_t * pkt, int size, int dev_no, void *pkt_meta, /* setup skb to point to pkt */ memcpy(skb->data, pkt, meta.trunc_size); skb_put(skb, meta.trunc_size); - skb->len = meta.trunc_size; + skb->len = size; /* SONIC-55684 */ psample_pkt->skb = skb; spin_lock_irqsave(&g_psample_work.lock, flags); diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/psample/psample.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/psample/psample.c index 99317cbf30cc..46a84c7f7c4a 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/psample/psample.c +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/psample/psample.c @@ -202,6 +202,7 @@ void psample_group_put(struct psample_group *group) } EXPORT_SYMBOL_GPL(psample_group_put); +#if IS_ENABLED(CONFIG_PSAMPLE) /* FIXUP:- Remove after GTS kernel is recompiled with change in CONFIG_PSAMPLE flag */ void psample_sample_packet(struct psample_group *group, struct sk_buff *skb, u32 trunc_size, int in_ifindex, int out_ifindex, u32 sample_rate) @@ -283,6 +284,7 @@ void psample_sample_packet(struct psample_group *group, struct sk_buff *skb, nlmsg_free(nl_skb); } EXPORT_SYMBOL_GPL(psample_sample_packet); +#endif static int __init psample_module_init(void) { diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/ksal.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/ksal.c index 2161b287f687..9c093e0eacdf 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/ksal.c +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/ksal.c @@ -196,9 +196,15 @@ sal_time_usecs(void) do_gettimeofday(<v); return (ltv.tv_sec * SECOND_USEC + ltv.tv_usec); #else +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0) /* ktime_to_us and ktime_get_real_ns return 64-bit integets, but this */ /* function is returning a 32-bit integer. This should be fine until 2038. */ return ktime_to_us(ktime_get_real_ns()); +#else + struct timeval ltv; + do_gettimeofday(<v); + return (ltv.tv_sec * SECOND_USEC + ltv.tv_usec); +#endif #endif } diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/bmw-2_6/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/bmw-2_6/Makefile deleted file mode 100644 index 899c7b405374..000000000000 --- a/platform/broadcom/saibcm-modules/systems/linux/user/bmw-2_6/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# -# Copyright 2017 Broadcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License, version 2, as -# published by the Free Software Foundation (the "GPL"). -# -# 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 version 2 (GPLv2) for more details. -# -# You should have received a copy of the GNU General Public License -# version 2 (GPLv2) along with this source code. -# -# -*- Makefile -*- -# $Id: Makefile,v 1.4 Broadcom SDK $ -# $Copyright: (c) 2005 Broadcom Corp. -# All Rights Reserved.$ - -# -# This make job requires the following environment variables to be set: -# -# SDK - path to StrataXGS SDK root directory -# -# Optionally the following environment variables can be set to -# override the default build server configuration: -# -# PPC_TOOLS_DIR - path to build tools (if not in PATH already) -# PPC_CROSS_COMPILE - cross compile tools prefix -# LINUX_INCLUDE - path to Linux kernel include directory -# - -SDK :=$(shell if [ -n "$$SDK" ] ; then\ - echo $$SDK;\ - else\ - cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ - dir=`cd ../;pwd`; \ - if [ "$$dir" = "/" ] ; then \ - echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ - exit 1; \ - fi ; \ - cd $$dir; \ - done ; \ - pwd; \ - fi) - -ifeq ($(SDK),) -$(error Please run this in a tree) -endif - -export SDK - -override kernel_version=2_6 -platform=bmw-$(kernel_version) - -# Windriver linux version -#WRS_LINUX_VERSION=1.4 -#WRS_LINUX_VERSION=2.0 - -LINUX_MAKE_USER=1 -include ${SDK}/make/Make.linux - diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/gto-2_6/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/gto-2_6/Makefile deleted file mode 100644 index c157f9ff35fc..000000000000 --- a/platform/broadcom/saibcm-modules/systems/linux/user/gto-2_6/Makefile +++ /dev/null @@ -1,84 +0,0 @@ -# -# Copyright 2017 Broadcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License, version 2, as -# published by the Free Software Foundation (the "GPL"). -# -# 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 version 2 (GPLv2) for more details. -# -# You should have received a copy of the GNU General Public License -# version 2 (GPLv2) along with this source code. -# -# -*- Makefile -*- -# $Id: Makefile,v 1.9 Broadcom SDK $ -# $Copyright: (c) 2007 Broadcom Corp. -# All Rights Reserved.$ - -# -# This make job requires the following environment variables to be set: -# -# SDK - path to StrataXGS SDK root directory -# -# Optionally the following environment variables can be set to -# override the default build server configuration: -# -# PPC_TOOLS_DIR - path to build tools (if not in PATH already) -# PPC_CROSS_COMPILE - cross compile tools prefix -# LINUX_INCLUDE - path to Linux kernel include directory -# - -SDK :=$(shell if [ -n "$$SDK" ] ; then\ - echo $$SDK;\ - else\ - cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ - dir=`cd ../;pwd`; \ - if [ "$$dir" = "/" ] ; then \ - echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ - exit 1; \ - fi ; \ - cd $$dir; \ - done ; \ - pwd; \ - fi) - -ifeq ($(SDK),) -$(error Please run this in a tree) -endif - -export SDK - -override kernel_version=2_6 -platform=gto-$(kernel_version) -LINUX_MAKE_USER=1 -export LINKER_RELAX=1 - -# Select the build environment -#BUILD_PLATFORM=ELDK -#BUILD_PLATFORM=WR_LINUX - -#Select the LINUX KERNEL VERSION -#KERN_VER = 2.6.21.7 -#KERN_VER = 2.6.24.4 -#KERN_VER = 2.6.25 - - -# Select the ELDK version -#ELDK_VERSION=4.1 -#ELDK_VERSION=4.0 - -#Select WRS Linux version -#WRS_LINUX_VERSION=2.0 -#WRS_LINUX_VERSION=3.0 - - -export KERN_VER -export ELDK_VERSION -export BUILD_PLATFORM -export WRS_LINUX_VERSION - -include ${SDK}/make/Make.linux - diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/gto/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/gto/Makefile deleted file mode 100644 index fd98f6d2f963..000000000000 --- a/platform/broadcom/saibcm-modules/systems/linux/user/gto/Makefile +++ /dev/null @@ -1,60 +0,0 @@ -# -# Copyright 2017 Broadcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License, version 2, as -# published by the Free Software Foundation (the "GPL"). -# -# 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 version 2 (GPLv2) for more details. -# -# You should have received a copy of the GNU General Public License -# version 2 (GPLv2) along with this source code. -# -# -*- Makefile -*- -# $Id: Makefile,v 1.9 Broadcom SDK $ -# $Copyright: (c) 2015 Broadcom Corp. -# All Rights Reserved.$ - -# -# This make job requires the following environment variables to be set: -# -# SDK - path to StrataXGS SDK root directory -# -# Optionally the following environment variables can be set to -# override the default build server configuration: -# -# PPC_TOOLS_DIR - path to build tools (if not in PATH already) -# PPC_CROSS_COMPILE - cross compile tools prefix -# LINUX_INCLUDE - path to Linux kernel include directory -# - -SDK :=$(shell if [ -n "$$SDK" ] ; then\ - echo $$SDK;\ - else\ - cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ - dir=`cd ../;pwd`; \ - if [ "$$dir" = "/" ] ; then \ - echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ - exit 1; \ - fi ; \ - cd $$dir; \ - done ; \ - pwd; \ - fi) - -ifeq ($(SDK),) -$(error Please run this in a tree) -endif - -export SDK - -override kernel_version=4_4 -platform=gto -LINUX_MAKE_USER=1 -export LINKER_RELAX=1 - -include ${SDK}/make/Make.linux - diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/jag-2_6/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/jag-2_6/Makefile deleted file mode 100644 index 26a7f520f2d2..000000000000 --- a/platform/broadcom/saibcm-modules/systems/linux/user/jag-2_6/Makefile +++ /dev/null @@ -1,79 +0,0 @@ -# -# Copyright 2017 Broadcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License, version 2, as -# published by the Free Software Foundation (the "GPL"). -# -# 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 version 2 (GPLv2) for more details. -# -# You should have received a copy of the GNU General Public License -# version 2 (GPLv2) along with this source code. -# -# -*- Makefile -*- -# $Id: Makefile,v 1.4 Broadcom SDK $ -# $Copyright: (c) 2005 Broadcom Corp. -# All Rights Reserved.$ - -# -# This make job requires the following environment variables to be set: -# -# SDK - path to StrataXGS SDK root directory -# -# Optionally the following environment variables can be set to -# override the default build server configuration: -# -# MIPS_TOOLS_DIR - path to build tools (if not in PATH already) -# MIPS_CROSS_COMPILE - cross compile tools prefix -# LINUX_INCLUDE - path to Linux kernel include directory -# - -SDK :=$(shell if [ -n "$$SDK" ] ; then\ - echo $$SDK;\ - else\ - cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ - dir=`cd ../;pwd`; \ - if [ "$$dir" = "/" ] ; then \ - echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ - exit 1; \ - fi ; \ - cd $$dir; \ - done ; \ - pwd; \ - fi) - -ifeq ($(SDK),) -$(error Please run this in a tree) -endif - -export SDK - -override kernel_version=2_6 -platform=jag-$(kernel_version) - -# Select the build environment -#BUILD_PLATFORM=ELDK -#BUILD_PLATFORM=WR_LINUX - -#Select the LINUX KERNEL VERSION -#KERN_VER = 2.6.21.7 - - -# Select the ELDK version -#ELDK_VERSION=4.1 - -# Windriver linux version -#WRS_LINUX_VERSION=1.4 -#WRS_LINUX_VERSION=2.0 - -export KERN_VER -export ELDK_VERSION -export BUILD_PLATFORM -export WRS_LINUX_VERSION - -LINUX_MAKE_USER=1 -include ${SDK}/make/Make.linux - diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/nsx-2_6/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/nsx-2_6/Makefile deleted file mode 100644 index 881ec34c2d36..000000000000 --- a/platform/broadcom/saibcm-modules/systems/linux/user/nsx-2_6/Makefile +++ /dev/null @@ -1,58 +0,0 @@ -# -# Copyright 2017 Broadcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License, version 2, as -# published by the Free Software Foundation (the "GPL"). -# -# 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 version 2 (GPLv2) for more details. -# -# You should have received a copy of the GNU General Public License -# version 2 (GPLv2) along with this source code. -# -# -*- Makefile -*- -# $Id: Makefile,v 1.4 Broadcom SDK $ -# $Copyright: (c) 2005 Broadcom Corp. -# All Rights Reserved.$ - -# -# This make job requires the following environment variables to be set: -# -# SDK - path to StrataXGS SDK root directory -# -# Optionally the following environment variables can be set to -# override the default build server configuration: -# -# MIPS_TOOLS_DIR - path to build tools (if not in PATH already) -# MIPS_CROSS_COMPILE - cross compile tools prefix -# LINUX_INCLUDE - path to Linux kernel include directory -# - -SDK :=$(shell if [ -n "$$SDK" ] ; then\ - echo $$SDK;\ - else\ - cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ - dir=`cd ../;pwd`; \ - if [ "$$dir" = "/" ] ; then \ - echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ - exit 1; \ - fi ; \ - cd $$dir; \ - done ; \ - pwd; \ - fi) - -ifeq ($(SDK),) -$(error Please run this in a tree) -endif - -export SDK - -override kernel_version=2_6 -platform=nsx-$(kernel_version) -LINUX_MAKE_USER=1 -include ${SDK}/make/Make.linux - diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/nsx64/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/nsx64/Makefile deleted file mode 100644 index 9e79d90fa992..000000000000 --- a/platform/broadcom/saibcm-modules/systems/linux/user/nsx64/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -# -# Copyright 2017 Broadcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License, version 2, as -# published by the Free Software Foundation (the "GPL"). -# -# 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 version 2 (GPLv2) for more details. -# -# You should have received a copy of the GNU General Public License -# version 2 (GPLv2) along with this source code. -# -# -*- Makefile -*- -# $Id: Makefile,v 1.3 Broadcom SDK $ -# $Copyright: (c) 2005 Broadcom Corp. -# All Rights Reserved.$ - -# -# This make job requires the following environment variables to be set: -# -# SDK - path to StrataXGS SDK root directory -# -# Optionally the following environment variables can be set to -# override the default build server configuration: -# -# MIPS_TOOLS_DIR - path to build tools (if not in PATH already) -# MIPS_CROSS_COMPILE - cross compile tools prefix -# LINUX_INCLUDE - path to Linux kernel include directory -# - -SDK :=$(shell if [ -n "$$SDK" ] ; then\ - echo $$SDK;\ - else\ - cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ - dir=`cd ../;pwd`; \ - if [ "$$dir" = "/" ] ; then \ - echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ - exit 1; \ - fi ; \ - cd $$dir; \ - done ; \ - pwd; \ - fi) - -ifeq ($(SDK),) -$(error Please run this in a tree) -endif - -export SDK - -platform=nsx64 -LINUX_MAKE_USER=1 -include ${SDK}/make/Make.linux - diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/nsx_wrl-2_6/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/nsx_wrl-2_6/Makefile deleted file mode 100644 index 4e86843cdc7c..000000000000 --- a/platform/broadcom/saibcm-modules/systems/linux/user/nsx_wrl-2_6/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# -# Copyright 2017 Broadcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License, version 2, as -# published by the Free Software Foundation (the "GPL"). -# -# 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 version 2 (GPLv2) for more details. -# -# You should have received a copy of the GNU General Public License -# version 2 (GPLv2) along with this source code. -# -# -*- Makefile -*- -# $Id: Makefile,v 1.3 Broadcom SDK $ -# $Copyright: (c) 2005 Broadcom Corp. -# All Rights Reserved.$ - -# -# This make job requires the following environment variables to be set: -# -# SDK - path to StrataXGS SDK root directory -# -# Optionally the following environment variables can be set to -# override the default build server configuration: -# -# MIPS_TOOLS_DIR - path to build tools (if not in PATH already) -# MIPS_CROSS_COMPILE - cross compile tools prefix -# LINUX_INCLUDE - path to Linux kernel include directory -# - -SDK :=$(shell if [ -n "$$SDK" ] ; then\ - echo $$SDK;\ - else\ - cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ - dir=`cd ../;pwd`; \ - if [ "$$dir" = "/" ] ; then \ - echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ - exit 1; \ - fi ; \ - cd $$dir; \ - done ; \ - pwd; \ - fi) - -ifeq ($(SDK),) -$(error Please run this in a tree) -endif - -export SDK - -override kernel_version=2_6 -platform=nsx_wrl-$(kernel_version) - -# Windriver linux version -#WRS_LINUX_VERSION=1.4 -#WRS_LINUX_VERSION=2.0 - -export WRS_LINUX_VERSION - -LINUX_MAKE_USER=1 -include ${SDK}/make/Make.linux - diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/raptor-2_6/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/raptor-2_6/Makefile deleted file mode 100644 index 10ab1a1cc259..000000000000 --- a/platform/broadcom/saibcm-modules/systems/linux/user/raptor-2_6/Makefile +++ /dev/null @@ -1,79 +0,0 @@ -# -# Copyright 2017 Broadcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License, version 2, as -# published by the Free Software Foundation (the "GPL"). -# -# 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 version 2 (GPLv2) for more details. -# -# You should have received a copy of the GNU General Public License -# version 2 (GPLv2) along with this source code. -# -# -*- Makefile -*- -# $Id: Makefile,v 1.5 Broadcom SDK $ -# $Copyright: (c) 2007 Broadcom Corp. -# All Rights Reserved.$ - -# -# This make job requires the following environment variables to be set: -# -# SDK - path to StrataXGS SDK root directory -# -# Optionally the following environment variables can be set to -# override the default build server configuration: -# -# MIPS_TOOLS_DIR - path to build tools (if not in PATH already) -# MIPS_CROSS_COMPILE - cross compile tools prefix -# LINUX_INCLUDE - path to Linux kernel include directory -# - -SDK :=$(shell if [ -n "$$SDK" ] ; then\ - echo $$SDK;\ - else\ - cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ - dir=`cd ../;pwd`; \ - if [ "$$dir" = "/" ] ; then \ - echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ - exit 1; \ - fi ; \ - cd $$dir; \ - done ; \ - pwd; \ - fi) - -ifeq ($(SDK),) -$(error Please run this in a tree) -endif - -export SDK - -override kernel_version=2_6 -platform=raptor-$(kernel_version) - -# Select the build environment -#BUILD_PLATFORM=ELDK -#BUILD_PLATFORM=WR_LINUX - -#Select the LINUX KERNEL VERSION -#KERN_VER = 2.6.21.7 - - -# Select the ELDK version -#ELDK_VERSION=4.1 - -# Windriver linux version -#WRS_LINUX_VERSION=1.4 -#WRS_LINUX_VERSION=2.0 - -export KERN_VER -export ELDK_VERSION -export BUILD_PLATFORM -export WRS_LINUX_VERSION - -LINUX_MAKE_USER=1 -include ${SDK}/make/Make.linux - diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/raptor/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/raptor/Makefile deleted file mode 100644 index df8800a1a786..000000000000 --- a/platform/broadcom/saibcm-modules/systems/linux/user/raptor/Makefile +++ /dev/null @@ -1,58 +0,0 @@ -# -# Copyright 2017 Broadcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License, version 2, as -# published by the Free Software Foundation (the "GPL"). -# -# 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 version 2 (GPLv2) for more details. -# -# You should have received a copy of the GNU General Public License -# version 2 (GPLv2) along with this source code. -# -# -*- Makefile -*- -# $Id: Makefile,v 1.1 Broadcom SDK $ -# $Copyright: (c) 2005 Broadcom Corp. -# All Rights Reserved.$ - -# -# This make job requires the following environment variables to be set: -# -# SDK - path to StrataXGS SDK root directory -# -# Optionally the following environment variables can be set to -# override the default build server configuration: -# -# MIPS_TOOLS_DIR - path to build tools (if not in PATH already) -# MIPS_CROSS_COMPILE - cross compile tools prefix -# LINUX_INCLUDE - path to Linux kernel include directory -# - -SDK :=$(shell if [ -n "$$SDK" ] ; then\ - echo $$SDK;\ - else\ - cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ - dir=`cd ../;pwd`; \ - if [ "$$dir" = "/" ] ; then \ - echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ - exit 1; \ - fi ; \ - cd $$dir; \ - done ; \ - pwd; \ - fi) - -ifeq ($(SDK),) -$(error Please run this in a tree) -endif - -export SDK - -platform=raptor -LINUX_MAKE_USER=1 -CFGFLAGS += -DBCM_ICS -include ${SDK}/make/Make.linux - diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index d49a832aff9e..69279d0844d5 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,6 +1,6 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.21.1.1 +MLNX_SAI_VERSION = SAIRel1.21.1.0 export MLNX_SAI_VERSION diff --git a/platform/mellanox/mlnx-sai/SAI-Implementation b/platform/mellanox/mlnx-sai/SAI-Implementation index a01442acd95e..d6eb22a12cc0 160000 --- a/platform/mellanox/mlnx-sai/SAI-Implementation +++ b/platform/mellanox/mlnx-sai/SAI-Implementation @@ -1 +1 @@ -Subproject commit a01442acd95e3a4f78a8e4b04b227fcbe905771e +Subproject commit d6eb22a12cc0f01e84a71d367f7c4ebe19f58a40 diff --git a/slave.mk b/slave.mk index 1a008640b4b9..72049cebf0bf 100644 --- a/slave.mk +++ b/slave.mk @@ -1370,7 +1370,7 @@ jessie : $$(addprefix $(TARGET_PATH)/,$$(JESSIE_DOCKER_IMAGES)) \ $$(addprefix $(TARGET_PATH)/,$$(JESSIE_DBG_DOCKER_IMAGES)) ############################################################################### -## Standard targets +## Standard targets ############################################################################### .PHONY : $(SONIC_CLEAN_DEBS) $(SONIC_CLEAN_FILES) $(SONIC_CLEAN_TARGETS) $(SONIC_CLEAN_STDEB_DEBS) $(SONIC_CLEAN_WHEELS) $(SONIC_PHONY_TARGETS) clean distclean configure diff --git a/src/sonic-sairedis b/src/sonic-sairedis index c7cbfe80dfcb..f67bcddf15d3 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit c7cbfe80dfcb61deef483f6c99b1c21763134ab1 +Subproject commit f67bcddf15d315a01ac4f3fafe14e9db2231c195 From 05c6488029eea267dbca45fba32e5b0f0a987b97 Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Thu, 5 May 2022 22:48:58 -0700 Subject: [PATCH 38/47] Fix setting the HTTPS proxy (#10739) Some places were not correctly setting the HTTPS proxy, and were only setting the HTTP proxy. This was fine until Docker 20.10.10, which then started using `https_proxy` for HTTPS connections. Signed-off-by: Saikrishna Arcot --- slave.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/slave.mk b/slave.mk index 72049cebf0bf..4858e290cd3a 100644 --- a/slave.mk +++ b/slave.mk @@ -791,8 +791,9 @@ $(SONIC_INSTALL_WHEELS) : $(PYTHON_WHEELS_PATH)/%-install : .platform $$(addsuff # start docker daemon docker-start : - @sudo sed -i '/http_proxy/d' /etc/default/docker + @sudo sed -i -e '/http_proxy/d' -e '/https_proxy/d' /etc/default/docker @sudo bash -c "{ echo \"export http_proxy=$$http_proxy\"; \ + echo \"export https_proxy=$$https_proxy\"; \ echo \"export no_proxy=$$no_proxy\"; } >> /etc/default/docker" @test x$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) != x"y" && sudo service docker status &> /dev/null || ( sudo service docker start &> /dev/null && ./scripts/wait_for_docker.sh 60 ) @@ -979,7 +980,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_DBG_IMAGES)) : $(TARGET_PATH)/%-$(DBG_IMAG docker build \ $(if $($*.gz_DBG_DEPENDS), --squash --no-cache, --no-cache) \ --build-arg http_proxy=$(HTTP_PROXY) \ - --build-arg http_proxy=$(HTTP_PROXY) \ + --build-arg https_proxy=$(HTTPS_PROXY) \ --build-arg no_proxy=$(NO_PROXY) \ --build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \ --label com.azure.sonic.manifest="$$(cat $($*.gz_PATH)/manifest.json)" \ From 7104664c0522f77496d1e53ac3dfff6ea81b56c3 Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Fri, 6 May 2022 09:56:08 -0700 Subject: [PATCH 39/47] Change source path for sonic-pcied to use Python 3 variable (#10676) Python 2 support for sonic-pcied was removed, and the Python 2 version of the variable no longer exists. Signed-off-by: Saikrishna Arcot --- rules/sonic-pcied.dep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/sonic-pcied.dep b/rules/sonic-pcied.dep index 05cd1fe5cf42..60b1d85a5617 100644 --- a/rules/sonic-pcied.dep +++ b/rules/sonic-pcied.dep @@ -1,4 +1,4 @@ -SPATH:= $($(SONIC_PCIED_PY2)_SRC_PATH) +SPATH:= $($(SONIC_PCIED_PY3)_SRC_PATH) DEP_FILES:= $(SONIC_COMMON_FILES_LIST) rules/sonic-pcied.mk rules/sonic-pcied.dep DEP_FILES+= $(SONIC_COMMON_BASE_FILES_LIST) SMDEP_FILES:= $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) From 66c96eaf4c7c8d8649ca7d00db58b9b998048d09 Mon Sep 17 00:00:00 2001 From: SuvarnaMeenakshi <50386592+SuvarnaMeenakshi@users.noreply.github.com> Date: Fri, 6 May 2022 11:12:56 -0700 Subject: [PATCH 40/47] Revert "[portconfig]: Remove try block for db config initialization (#10581)" (#10756) This reverts commit 5cd6bc4ce2a32bd7b1b71dbcc85e7390799da7d0. --- src/sonic-config-engine/portconfig.py | 7 ++++++- src/sonic-config-engine/sonic-cfggen | 8 +------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/sonic-config-engine/portconfig.py b/src/sonic-config-engine/portconfig.py index ea9985a3beb0..0c056d1cdab7 100644 --- a/src/sonic-config-engine/portconfig.py +++ b/src/sonic-config-engine/portconfig.py @@ -72,7 +72,12 @@ def db_connect_configdb(namespace=None): """ Connect to configdb """ - config_db = swsscommon.ConfigDBConnector(use_unix_socket_path=True, namespace=namespace) + try: + if namespace is not None: + swsscommon.SonicDBConfig.load_sonic_global_db_config(namespace=namespace) + config_db = swsscommon.ConfigDBConnector(use_unix_socket_path=True, namespace=namespace) + except Exception as e: + return None if config_db is None: return None try: diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 3f0e047f76fa..bf93ad849fcb 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -32,7 +32,7 @@ from functools import partial from minigraph import minigraph_encoder, parse_xml, parse_device_desc_xml, parse_asic_sub_role, parse_asic_switch_type from portconfig import get_port_config, get_breakout_mode from redis_bcc import RedisBytecodeCache -from sonic_py_common.multi_asic import get_asic_id_from_name, get_asic_device_id, is_multi_asic +from sonic_py_common.multi_asic import get_asic_id_from_name, get_asic_device_id from sonic_py_common import device_info from swsscommon.swsscommon import SonicV2Connector, ConfigDBConnector, SonicDBConfig, ConfigDBPipeConnector @@ -296,12 +296,6 @@ def main(): 'localhost': {'namespace_id': namespace_id} } }) - # load db config - if not SonicDBConfig.isInit(): - if is_multi_asic(): - SonicDBConfig.load_sonic_global_db_config(namespace=asic_name) - else: - SonicDBConfig.load_sonic_db_config() if hwsku is not None: hardware_data = {'DEVICE_METADATA': {'localhost': { 'hwsku': hwsku From 25357d39eddc424d8922216707c2ad21c22f529a Mon Sep 17 00:00:00 2001 From: arlakshm <55814491+arlakshm@users.noreply.github.com> Date: Fri, 6 May 2022 13:23:20 -0700 Subject: [PATCH 41/47] [sonic-swss-common] submodule update (#10747) Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan Why I did it submodule update for the following commits 7a203b1 [chassis] Add new tables in counter db for Voq counter support. (#530) 5effea3 add new table schema for bgp profile (#608) 130dca5 [ci] Update azure pipeline branch variable reference. 708ed39 [ci] Parameterize pipeline and improve azure pipeline (#599) 9c08456 Added new P4RT tables. (#604) --- src/sonic-swss-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index c34a4e1cc733..7a203b1b1fde 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit c34a4e1cc7332fd7368239206a097478fa1dcc90 +Subproject commit 7a203b1b1fdefcd588ec7a72c0db95b32e50f3a7 From 322363b9abab7710e59aa38892fd47e4ae7dc044 Mon Sep 17 00:00:00 2001 From: Jing Zhang Date: Fri, 6 May 2022 13:42:23 -0700 Subject: [PATCH 42/47] [master][sonic-linkmgrd] submodule updates (#10763) [master][sonic-linkmgrd] submodule updates df51322 Longxiang Lyu Fri May 6 10:01:46 2022 +0800 Add `ActiveActiveStateMachine` implementation (#64) e721ceb Jing Zhang Wed May 4 10:07:14 2022 -0700 Add doc for default route related changes (#63) 7bb06fb Jing Zhang Tue May 3 09:48:28 2022 -0700 Add Cli support to enable or disable default route related feature (#68) e4b02cb Jing Zhang Mon May 2 13:27:54 2022 -0700 Reset WaitActiveUp count before switching to active (#70) 212d960 Jing Zhang Wed Apr 27 10:35:05 2022 -0700 lower log level to warning (#69) 48abc9e Jing Zhang Thu Apr 14 16:50:04 2022 -0700 Add support to enable switchover time measurement (with link prober interval decreased to 10ms) feature (#61) c4858a6 Jing Zhang Thu Apr 14 11:27:55 2022 -0700 Avoid proactively switching to `active` if default route is missing (#62) sign-off: Jing Zhang zhangjing@microsoft.com --- dockers/docker-mux/supervisord.conf | 2 +- src/linkmgrd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dockers/docker-mux/supervisord.conf b/dockers/docker-mux/supervisord.conf index 87903f28e155..33eb650e85d4 100644 --- a/dockers/docker-mux/supervisord.conf +++ b/dockers/docker-mux/supervisord.conf @@ -28,7 +28,7 @@ stderr_logfile=syslog dependent_startup=true [program:linkmgrd] -command=nice -n -20 /usr/sbin/linkmgrd -v warning +command=nice -n -20 /usr/sbin/linkmgrd -v warning -d priority=2 autostart=false autorestart=false diff --git a/src/linkmgrd b/src/linkmgrd index 41f5fb9d44f2..df5132254e10 160000 --- a/src/linkmgrd +++ b/src/linkmgrd @@ -1 +1 @@ -Subproject commit 41f5fb9d44f2fd789dea372f2b647d40ec71ed75 +Subproject commit df5132254e104343d099da3b95eaf1336ac485cd From 45c5ca089c287e6c5b5016f790cd3f95a269e35a Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 6 May 2022 14:22:23 -0700 Subject: [PATCH 43/47] Fix: No explicit reading ConfigDB in get_asic_conf_file_path() (#10723) #### Why I did it This function is critical for is_multi_asic() and SonicDBConfig initializing. No explicit reading ConfigDB. Otherwise it will implicitly trigger SonicDBConfig initializing. #### How I did it 1. No explicit reading ConfigDB in get_asic_conf_file_path() 2. Collect asic_conf_path_candidates lazily to prevent any unnecessary side effect and improve the performance --- .../sonic_py_common/device_info.py | 66 ++++++++++++------- .../sonic_py_common/multi_asic.py | 33 +--------- 2 files changed, 43 insertions(+), 56 deletions(-) diff --git a/src/sonic-py-common/sonic_py_common/device_info.py b/src/sonic-py-common/sonic_py_common/device_info.py index e5220e86e2ad..d57e08b3b5cb 100644 --- a/src/sonic-py-common/sonic_py_common/device_info.py +++ b/src/sonic-py-common/sonic_py_common/device_info.py @@ -40,11 +40,12 @@ CHASSIS_INFO_MODEL_FIELD = 'model' CHASSIS_INFO_REV_FIELD = 'revision' - -def get_localhost_info(field): +def get_localhost_info(field, config_db=None): try: - config_db = ConfigDBConnector() - config_db.connect() + # TODO: enforce caller to provide config_db explicitly and remove its default value + if not config_db: + config_db = ConfigDBConnector() + config_db.connect() metadata = config_db.get_table('DEVICE_METADATA') @@ -81,11 +82,16 @@ def get_machine_info(): return machine_vars - -def get_platform(): +def get_platform(**kwargs): """ Retrieve the device's platform identifier + Args: + config_db: a connected ConfigDBConector object. + If explicit None provided, this function will not read ConfigDB. This is useful before SonicDBConfig initializing. + If not provided, this function may implicitly ready ConfigDB. + Otherwise, this function will use it to read ConfigDB + Returns: A string containing the device's platform identifier """ @@ -111,8 +117,13 @@ def get_platform(): # container in SONiC, where the /host directory is not mounted. In this # case the value should already be populated in Config DB so we finally # try reading it from there. - - return get_localhost_info('platform') + if 'config_db' in kwargs: + config_db = kwargs['config_db'] + if config_db is None: + return None + else: + config_db = None + return get_localhost_info('platform', config_db=config_db) def get_hwsku(): @@ -144,21 +155,22 @@ def get_platform_and_hwsku(): def get_asic_conf_file_path(): """ - Retrieves the path to the ASIC conguration file on the device + Retrieves the path to the ASIC configuration file on the device Returns: - A string containing the path to the ASIC conguration file on success, + A string containing the path to the ASIC configuration file on success, None on failure """ - asic_conf_path_candidates = [] - - asic_conf_path_candidates.append(os.path.join(CONTAINER_PLATFORM_PATH, ASIC_CONF_FILENAME)) + def asic_conf_path_candidates(): + yield os.path.join(CONTAINER_PLATFORM_PATH, ASIC_CONF_FILENAME) - platform = get_platform() - if platform: - asic_conf_path_candidates.append(os.path.join(HOST_DEVICE_PATH, platform, ASIC_CONF_FILENAME)) + # Note: this function is critical for is_multi_asic() and SonicDBConfig initializing + # No explicit reading ConfigDB + platform = get_platform(config_db=None) + if platform: + yield os.path.join(HOST_DEVICE_PATH, platform, ASIC_CONF_FILENAME) - for asic_conf_file_path in asic_conf_path_candidates: + for asic_conf_file_path in asic_conf_path_candidates(): if os.path.isfile(asic_conf_file_path): return asic_conf_file_path @@ -167,10 +179,10 @@ def get_asic_conf_file_path(): def get_platform_env_conf_file_path(): """ - Retrieves the path to the PLATFORM ENV conguration file on the device + Retrieves the path to the PLATFORM ENV configuration file on the device Returns: - A string containing the path to the PLATFORM ENV conguration file on success, + A string containing the path to the PLATFORM ENV configuration file on success, None on failure """ platform_env_conf_path_candidates = [] @@ -339,7 +351,7 @@ def get_sonic_version_file(): # Get hardware information -def get_platform_info(): +def get_platform_info(config_db=None): """ This function is used to get the HW info helper function """ @@ -356,8 +368,10 @@ def get_platform_info(): hw_info_dict['asic_count'] = get_num_asics() try: - config_db = ConfigDBConnector() - config_db.connect() + # TODO: enforce caller to provide config_db explicitly and remove its default value + if not config_db: + config_db = ConfigDBConnector() + config_db.connect() metadata = config_db.get_table('DEVICE_METADATA')["localhost"] switch_type = metadata.get('switch_type') @@ -462,7 +476,7 @@ def get_namespaces(): return natsorted(ns_list) -def get_all_namespaces(): +def get_all_namespaces(config_db=None): """ In case of Multi-Asic platform, Each ASIC will have a linux network namespace created. So we loop through the databases in different namespaces and depending on the sub_role @@ -476,8 +490,10 @@ def get_all_namespaces(): if is_multi_npu(): for npu in range(num_npus): namespace = "{}{}".format(NPU_NAME_PREFIX, npu) - config_db = ConfigDBConnector(use_unix_socket_path=True, namespace=namespace) - config_db.connect() + # TODO: enforce caller to provide config_db explicitly and remove its default value + if not config_db: + config_db = ConfigDBConnector(use_unix_socket_path=True, namespace=namespace) + config_db.connect() metadata = config_db.get_table('DEVICE_METADATA') if metadata['localhost']['sub_role'] == FRONTEND_ASIC_SUB_ROLE: diff --git a/src/sonic-py-common/sonic_py_common/multi_asic.py b/src/sonic-py-common/sonic_py_common/multi_asic.py index 662c01800e35..8ba409165f8b 100644 --- a/src/sonic-py-common/sonic_py_common/multi_asic.py +++ b/src/sonic-py-common/sonic_py_common/multi_asic.py @@ -5,11 +5,8 @@ from natsort import natsorted from swsscommon import swsscommon -from .device_info import CONTAINER_PLATFORM_PATH -from .device_info import HOST_DEVICE_PATH -from .device_info import get_platform -from .device_info import is_supervisor -from .device_info import is_chassis +from .device_info import get_asic_conf_file_path +from .device_info import is_supervisor, is_chassis ASIC_NAME_PREFIX = 'asic' NAMESPACE_PATH_GLOB = '/run/netns/*' @@ -78,32 +75,6 @@ def connect_to_all_dbs_for_ns(namespace=DEFAULT_NAMESPACE): db.connect(db_id) return db - -def get_asic_conf_file_path(): - """ - Retrieves the path to the ASIC conguration file on the device - - Returns: - A string containing the path to the ASIC conguration file on success, - None on failure - """ - asic_conf_path_candidates = [] - - asic_conf_path_candidates.append(os.path.join(CONTAINER_PLATFORM_PATH, - ASIC_CONF_FILENAME)) - - platform = get_platform() - if platform: - asic_conf_path_candidates.append(os.path.join( - HOST_DEVICE_PATH, platform, ASIC_CONF_FILENAME)) - - for asic_conf_file_path in asic_conf_path_candidates: - if os.path.isfile(asic_conf_file_path): - return asic_conf_file_path - - return None - - def get_num_asics(): """ Retrieves the num of asics present in the multi ASIC platform From 7e190c783a73b8c264991a6276f26c2a6288a80d Mon Sep 17 00:00:00 2001 From: "Robert J. Halstead" Date: Fri, 6 May 2022 15:35:20 -0700 Subject: [PATCH 44/47] [submodule] Advance sonic-p4rt/sonic-pins pointer (#10566) #### Why I did it To pick up new commits: * 60d2467 Add depends to p4rt debian package #### How I did it update sonic-p4rt/sonic-pins submodule pointer #### How to verify it should be able to build with p4rt enabled. --- src/sonic-p4rt/sonic-pins | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-p4rt/sonic-pins b/src/sonic-p4rt/sonic-pins index 36322d349779..4168fdce1c11 160000 --- a/src/sonic-p4rt/sonic-pins +++ b/src/sonic-p4rt/sonic-pins @@ -1 +1 @@ -Subproject commit 36322d349779f99e30fc52c26fee60945b0eb5e8 +Subproject commit 4168fdce1c1131b923a02b8fffa6089a17f14a11 From d5a182f42e4a33798e907ee5ec7e146d4c4173d3 Mon Sep 17 00:00:00 2001 From: Shilong Liu Date: Sat, 7 May 2022 11:28:25 +0800 Subject: [PATCH 45/47] [build] Add dependencies for sonic-config-engine to block bad PR. (#10770) Add dependencies device/* --- rules/sonic-config.dep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/sonic-config.dep b/rules/sonic-config.dep index 9e6d1e929341..65aabe74d76f 100644 --- a/rules/sonic-config.dep +++ b/rules/sonic-config.dep @@ -4,7 +4,7 @@ SPATH := $($(SONIC_CONFIG_ENGINE_PY3)_SRC_PATH) DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-config.mk rules/sonic-config.dep DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) DEP_FILES += $(shell git ls-files $(SPATH)) -DEP_FILES += files/image_config/interfaces/interfaces.j2 dockers/docker-orchagent/ports.json.j2 dockers/docker-dhcp-relay/wait_for_intf.sh.j2 dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 dockers/docker-lldp/lldpd.conf.j2 dockers/docker-orchagent/ipinip.json.j2 $(wildcard device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/* device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/*) files/build_templates/qos_config.j2 dockers/docker-orchagent/switch.json.j2 dockers/docker-orchagent/vxlan.json.j2 files/image_config/constants/constants.yml +DEP_FILES += files/image_config/interfaces/interfaces.j2 dockers/docker-orchagent/ports.json.j2 dockers/docker-dhcp-relay/wait_for_intf.sh.j2 dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 dockers/docker-lldp/lldpd.conf.j2 dockers/docker-orchagent/ipinip.json.j2 $(shell find device -type f) files/build_templates/qos_config.j2 dockers/docker-orchagent/switch.json.j2 dockers/docker-orchagent/vxlan.json.j2 files/image_config/constants/constants.yml ifeq ($(ENABLE_PY2_MODULES), y) $(SONIC_CONFIG_ENGINE_PY2)_CACHE_MODE := GIT_CONTENT_SHA From 71a515e14b2edc67315e126e00ea5f90a2be3149 Mon Sep 17 00:00:00 2001 From: Ze Gan Date: Sat, 7 May 2022 17:14:36 +0800 Subject: [PATCH 46/47] [iproute2]: Fix format error of SSCI (#10767) Signed-off-by: Ze Gan #### Why I did it The SSCI is wrong in the output of MACsec so that the virtual SAI cannot parse the output corretly. The wrong output: ``` 142: macsec_eth1: protect on validate strict sc off sa off encrypt on send_sci on end_station off scb off replay off cipher suite: GCM-AES-XPN-256, using ICV length 16 TXSC: 5254008f4f1c0001 on SA 0 0: PN 103, state on, key 12cbc4b64e26c9a1ba14d810da20d16e SSCI 33554432, RXSC: 525400edac5b0001, state on 0: PN 107, state on, key 12cbc4b64e26c9a1ba14d810da20d16e offload: off ``` Expected ``` 142: macsec_eth1: protect on validate strict sc off sa off encrypt on send_sci on end_station off scb off replay off cipher suite: GCM-AES-XPN-256, using ICV length 16 TXSC: 5254008f4f1c0001 on SA 0 0: PN 252, state on, SSCI 33554432, key 12cbc4b64e26c9a1ba14d810da20d16e RXSC: 525400edac5b0001, state on 0: PN 264, state on, key 12cbc4b64e26c9a1ba14d810da20d16e ``` #### How I did it Move SSCI before the key so that SSCI will not be the front of SC information. --- src/iproute2/patch/0001-patch-macsec-xpn-support.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iproute2/patch/0001-patch-macsec-xpn-support.patch b/src/iproute2/patch/0001-patch-macsec-xpn-support.patch index c55daa3fd4c6..33e7e6a7dd94 100644 --- a/src/iproute2/patch/0001-patch-macsec-xpn-support.patch +++ b/src/iproute2/patch/0001-patch-macsec-xpn-support.patch @@ -182,11 +182,11 @@ index 18289ecd..1df19bf1 100644 print_bool(PRINT_JSON, "active", NULL, state); print_string(PRINT_FP, NULL, " state %s,", state ? "on" : "off"); - print_key(sa_attr[MACSEC_SA_ATTR_KEYID]); + if (sa_attr[MACSEC_SA_ATTR_SSCI]) { + print_uint(PRINT_ANY, "ssci", " SSCI %u,", + rta_getattr_u32(sa_attr[MACSEC_SA_ATTR_SSCI])); + } + print_key(sa_attr[MACSEC_SA_ATTR_KEYID]); print_txsa_stats(prefix, sa_attr[MACSEC_SA_ATTR_STATS]); close_json_object(); From 0e30ffe4da977e5e2966f02f385911e487061d64 Mon Sep 17 00:00:00 2001 From: Shilong Liu Date: Mon, 9 May 2022 16:43:21 +0800 Subject: [PATCH 47/47] [ci] Support multi tags when pushing docker image (#10771) --- push_docker.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/push_docker.sh b/push_docker.sh index 3e2da08d0b83..131494be2985 100755 --- a/push_docker.sh +++ b/push_docker.sh @@ -54,9 +54,10 @@ docker login -u ${REGISTRY_USERNAME} -p "${REGISTRY_PASSWD}" ${REGISTRY_SERVER_W docker_image_name=$(basename ${DOCKER_IMAGE_FILE} | cut -d. -f1) remote_image_name=${REGISTRY_SERVER_WITH_PORT}/${docker_image_name} -[ -z "${DOCKER_IMAGE_TAG}" ] || { - push_it ${docker_image_name} ${remote_image_name}:${DOCKER_IMAGE_TAG} -} +for tag in ${DOCKER_IMAGE_TAG} +do + push_it ${docker_image_name} ${remote_image_name}:$tag +done if [ -n "${sonic_version}" ] && [ -n "${sonic_platform}" ] then