gateway: add helper function gw_default_calc_threshold