int iwl_mvm_fw_dbg_collect_trig(struct iwl_mvm *mvm,
struct iwl_fw_dbg_trigger_tlv *trigger,
- const char *str, size_t len)
+ const char *fmt, ...)
{
unsigned int delay = msecs_to_jiffies(le32_to_cpu(trigger->stop_delay));
u16 occurrences = le16_to_cpu(trigger->occurrences);
- int ret;
+ int ret, len = 0;
+ char buf[64];
if (!occurrences)
return 0;
- ret = iwl_mvm_fw_dbg_collect(mvm, le32_to_cpu(trigger->id), str,
+ if (fmt) {
+ va_list ap;
+
+ buf[sizeof(buf) - 1] = '\0';
+
+ va_start(ap, fmt);
+ vsnprintf(buf, sizeof(buf), fmt, ap);
+ va_end(ap);
+
+ /* check for truncation */
+ if (WARN_ON_ONCE(buf[sizeof(buf) - 1]))
+ buf[sizeof(buf) - 1] = '\0';
+
+ len = strlen(buf) + 1;
+ }
+
+ ret = iwl_mvm_fw_dbg_collect(mvm, le32_to_cpu(trigger->id), buf,
len, delay);
if (ret)
return ret;
if (rx_missed_bcon_since_rx >= stop_trig_missed_bcon_since_rx ||
rx_missed_bcon >= stop_trig_missed_bcon)
- iwl_mvm_fw_dbg_collect_trig(mvm, trigger, NULL, 0);
+ iwl_mvm_fw_dbg_collect_trig(mvm, trigger, NULL);
}
int iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm,
struct ieee80211_vif *vif,
const struct ieee80211_event *event)
{
-#define CHECK_MLME_TRIGGER(_mvm, _trig, _buf, _cnt, _str...) \
+#define CHECK_MLME_TRIGGER(_mvm, _trig, _buf, _cnt, _fmt...) \
do { \
if ((_cnt) && --(_cnt)) \
break; \
- snprintf(_buf, sizeof(_buf), ##_str); \
- iwl_mvm_fw_dbg_collect_trig(_mvm, _trig, _buf, \
- sizeof(_buf)); \
+ iwl_mvm_fw_dbg_collect_trig(_mvm, _trig, _fmt);\
} while (0)
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
struct iwl_fw_dbg_trigger_tlv *trig;
struct iwl_fw_dbg_trigger_mlme *trig_mlme;
- char buf[32];
if (!iwl_fw_dbg_trigger_enabled(mvm->fw, FW_DBG_TRIGGER_MLME))
return;
if (!iwl_fw_dbg_trigger_check_stop(mvm, vif, trig))
return;
- memset(buf, 0, sizeof(buf));
-
if (event->u.mlme.data == ASSOC_EVENT) {
if (event->u.mlme.status == MLME_DENIED)
CHECK_MLME_TRIGGER(mvm, trig, buf,
void iwl_mvm_free_fw_dump_desc(struct iwl_mvm *mvm);
int iwl_mvm_fw_dbg_collect_trig(struct iwl_mvm *mvm,
struct iwl_fw_dbg_trigger_tlv *trigger,
- const char *str, size_t len);
+ const char *fmt, ...) __printf(3, 4);
unsigned int iwl_mvm_get_wd_timeout(struct iwl_mvm *mvm,
struct ieee80211_vif *vif,
bool tdls, bool cmd_q);
if (!iwl_fw_dbg_trigger_check_stop(mvm, vif, trigger))
return;
- iwl_mvm_fw_dbg_collect_trig(mvm, trigger, NULL, 0);
+ iwl_mvm_fw_dbg_collect_trig(mvm, trigger, NULL);
}
#endif /* __IWL_MVM_H__ */
{
struct iwl_fw_dbg_trigger_tlv *trig;
struct iwl_fw_dbg_trigger_cmd *cmds_trig;
- char buf[32];
int i;
if (!iwl_fw_dbg_trigger_enabled(mvm->fw, FW_DBG_TRIGGER_FW_NOTIF))
if (cmds_trig->cmds[i].cmd_id != pkt->hdr.cmd)
continue;
- memset(buf, 0, sizeof(buf));
- snprintf(buf, sizeof(buf), "CMD 0x%02x received", pkt->hdr.cmd);
- iwl_mvm_fw_dbg_collect_trig(mvm, trig, buf, sizeof(buf));
+ iwl_mvm_fw_dbg_collect_trig(mvm, trig,
+ "CMD 0x%02x received",
+ pkt->hdr.cmd);
break;
}
}
iwl_fw_dbg_trigger_check_stop(mvm, mvmsta->vif,
trig);
if (trig_check && rx_status->signal < rssi)
- iwl_mvm_fw_dbg_collect_trig(mvm, trig, NULL, 0);
+ iwl_mvm_fw_dbg_collect_trig(mvm, trig, NULL);
}
}
if (le32_to_cpup((__le32 *) (pkt->data + trig_offset)) < trig_thold)
return;
- iwl_mvm_fw_dbg_collect_trig(mvm, trig, NULL, 0);
+ iwl_mvm_fw_dbg_collect_trig(mvm, trig, NULL);
}
void iwl_mvm_handle_rx_statistics(struct iwl_mvm *mvm,