Skip to content

Commit

Permalink
CSCwd55908: 3432D fan control fixes (zhenggen-xu#11)
Browse files Browse the repository at this point in the history
Signed-off-by: ankgoyal <ankgoyal@cisco.com>
  • Loading branch information
ankgoyal27 authored and li-pingmao committed Nov 18, 2022
1 parent 11322b1 commit a549843
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 54 deletions.
91 changes: 45 additions & 46 deletions device/cisco/x86_64-cisco_N3K_C3432D/thermal_policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,64 +15,77 @@
],
"policies": [
{
"name": "Any fan absence",
"name": "all fan presence / thermal no warning",
"conditions": [
{
"type": "fan.any.absence"
"type": "fan.all.presence"
},
{
"type": "fan.all.samedirection"
},
{
"type": "fan.all.good"
},
{
"type": "sensor.all.good"
},
{
"type": "sensor.ambient.ok"
}
],
"actions": [
{
"type": "fan.all.set_speed",
"speed": "100"
"type": "thermal_control.active"
}
]
},
{
"name": "All fan absence",
"name": "inlet temp in between low and high threshold",
"conditions": [
{
"type": "fan.all.absence"
"type": "sensor.ambient.warm"
}
],
"actions": [
{
"type": "switch.shutdown"
"type": "fan.all.set_speed",
"speed": "80"
}
]
},
{
"name": "Any fan broken",
"name": "Any thermal minor alarm",
"conditions": [
{
"type": "fan.any.fault"
"type": "sensor.any.minoralarm"
}
],
"actions": [
{
"type": "fan.all.set_speed",
"speed": "100"
"speed": "80"
}
]
},
{
"name": "All fans broken",
"name": "inlet temp crossing high threshold",
"conditions": [
{
"type": "fan.all.fault"
"type": "sensor.ambient.hot"
}
],
"actions": [
{
"type": "switch.shutdown"
"type": "fan.all.set_speed",
"speed": "100"
}
]
},
{
"name": "Any fan in different direction",
"name": "Any thermal major alarm",
"conditions": [
{
"type": "fan.all.differentdirection"
"type": "sensor.any.majoralarm"
}
],
"actions": [
Expand All @@ -83,23 +96,24 @@
]
},
{
"name": "temp over high critical threshold",
"name": "Any fan absence",
"conditions": [
{
"type": "sensor.any.criticalalarm"
"type": "fan.any.absence"
}
],
"actions": [
{
"type": "switch.shutdown"
"type": "fan.all.set_speed",
"speed": "100"
}
]
},
{
"name": "Any thermal major alarm",
"name": "Any fan broken",
"conditions": [
{
"type": "sensor.any.majoralarm"
"type": "fan.any.fault"
}
],
"actions": [
Expand All @@ -110,10 +124,10 @@
]
},
{
"name": "inlet temp crossing high threshold",
"name": "Any fan in different direction",
"conditions": [
{
"type": "sensor.ambient.hot"
"type": "fan.all.differentdirection"
}
],
"actions": [
Expand All @@ -124,56 +138,41 @@
]
},
{
"name": "inlet temp in between low and high threshold",
"name": "All fan absence",
"conditions": [
{
"type": "sensor.ambient.warm"
"type": "fan.all.absence"
}
],
"actions": [
{
"type": "fan.all.set_speed",
"speed": "80"
"type": "switch.shutdown"
}
]
},
{
"name": "Any thermal minor alarm",
"name": "All fans broken",
"conditions": [
{
"type": "sensor.any.minoralarm"
"type": "fan.all.fault"
}
],
"actions": [
{
"type": "fan.all.set_speed",
"speed": "80"
"type": "switch.shutdown"
}
]
},
{
"name": "all fan presence / thermal no warning",
"name": "temp over high critical threshold",
"conditions": [
{
"type": "fan.all.presence"
},
{
"type": "fan.all.samedirection"
},
{
"type": "fan.all.good"
},
{
"type": "sensor.all.good"
},
{
"type": "sensor.ambient.ok"
"type": "sensor.any.criticalalarm"
}
],
"actions": [
{
"type": "fan.all.set_speed",
"speed": "60"
"type": "switch.shutdown"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#Thermal thresholds
'min_temperature' : 55.0,
'max_temperature' : 85.0,
'min_blue_fans_speed' : 80,
'min_blue_fans_speed' : 60,
'min_red_fans_speed' : 60,
'max_blue_fans_speed' : 100,
'max_red_fans_speed' : 100,
Expand All @@ -22,7 +22,7 @@
'thermal_high_thresh_hysteresis' : 5.0,
'thermal_crit_thresh_hysteresis' : 10.0,
'blue_fans_inlet_temp_low_threshold' : 25.0,
'red_fans_inlet_temp_low_threshold' : 25.0,
'red_fans_inlet_temp_low_threshold' : 35.0,
'blue_fans_inlet_temp_high_threshold' : 35.0,
'red_fans_inlet_temp_high_threshold' : 35.0,
'reboot_gpio' : 133,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def __init__(self, fan_index, fan_drawer_index , platform_data, fan_data, psu_f
self.drawer_index = fan_drawer_index + 1
self.fan_speed_tolerance = self.platform_data.get_param(PlatformGlobalData.KEY_FAN_SPEED_TOLERANCE, 10)
self.fan_pwm_path_format = self.platform_data.get_param(PlatformGlobalData.KEY_FAN_PWM_PATH_FORMAT, 1)
self.fan_direction_format = self.platform_data.get_param(PlatformGlobalData.KEY_FAN_DIRECTION_FORMAT, 0)

if self.is_psu_fan:
self.fan_path = self._fan_path.format(psu['bus'], psu['addr'])
Expand Down Expand Up @@ -91,10 +92,15 @@ def get_direction(self):
return FanBase.FAN_DIRECTION_NOT_APPLICABLE
else:
if not os.path.exists(self.dir_path):
return False
return FanBase.FAN_DIRECTION_NOT_APPLICABLE

direction = read_int_from_file(self.dir_path)
return FanBase.FAN_DIRECTION_EXHAUST if (direction) else FanBase.FAN_DIRECTION_INTAKE
if self.fan_direction_format:
#fan direction 0 - b2f ; 1 - f2b
return FanBase.FAN_DIRECTION_INTAKE if (direction) else FanBase.FAN_DIRECTION_EXHAUST
else:
#fan direction 0 - f2b ; 1 - b2f
return FanBase.FAN_DIRECTION_EXHAUST if (direction) else FanBase.FAN_DIRECTION_INTAKE

def get_status(self):
status = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ def execute(self, thermal_info_dict):
ThermalControlActiveAction.THERMAL_DEFAULT_MIN_TEMP)
max_temperature_threshold = platform_globals.get_param(PlatformGlobalData.KEY_MAX_TEMP,
ThermalControlActiveAction.THERMAL_DEFAULT_MAX_TEMP)
if fan_direction == FanBase.FAN_DIRECTION_INTAKE:
if fan_direction == FanBase.FAN_DIRECTION_EXHAUST:
min_fan_speed = platform_globals.get_param(PlatformGlobalData.KEY_MIN_BLUE_FANS_SPEED,
ThermalControlActiveAction.THERMAL_DEFAULT_MIN_SPEED)
max_fan_speed = platform_globals.get_param(PlatformGlobalData.KEY_MAX_BLUE_FANS_SPEED,
ThermalControlActiveAction.THERMAL_DEFAULT_MAX_SPEED)
elif fan_direction == FanBase.FAN_DIRECTION_EXHAUST:
elif fan_direction == FanBase.FAN_DIRECTION_INTAKE:
min_fan_speed = platform_globals.get_param(PlatformGlobalData.KEY_MIN_RED_FANS_SPEED,
ThermalControlActiveAction.THERMAL_DEFAULT_MIN_SPEED)
max_fan_speed = platform_globals.get_param(PlatformGlobalData.KEY_MAX_RED_FANS_SPEED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def is_match(self, thermal_info_dict):
return len(fan_info_obj.get_fault_fans()) > 0 if fan_info_obj else False

@thermal_json_object('fan.all.fault')
class AnyFanFaultCondition(FanCondition):
class AllFanFaultCondition(FanCondition):
def is_match(self, thermal_info_dict):
fan_info_obj = self.get_fan_info(thermal_info_dict)
if fan_info_obj and len(fan_info_obj.get_absence_fans()) == 0:
Expand All @@ -99,7 +99,7 @@ def is_match(self, thermal_info_dict):
return False

@thermal_json_object('fan.all.good')
class AnyFanFaultCondition(FanCondition):
class AllFanGoodCondition(FanCondition):
def is_match(self, thermal_info_dict):
fan_info_obj = self.get_fan_info(thermal_info_dict)
if fan_info_obj and len(fan_info_obj.get_absence_fans()) == 0:
Expand Down

0 comments on commit a549843

Please sign in to comment.