From patchwork Thu Feb 20 11:55:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Puzyniak X-Patchwork-Id: 3686621 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CA6949F1EE for ; Thu, 20 Feb 2014 11:56:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D0770200E0 for ; Thu, 20 Feb 2014 11:56:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 78DC920121 for ; Thu, 20 Feb 2014 11:56:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754174AbaBTLzx (ORCPT ); Thu, 20 Feb 2014 06:55:53 -0500 Received: from mail-ee0-f54.google.com ([74.125.83.54]:39371 "EHLO mail-ee0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753656AbaBTLzv (ORCPT ); Thu, 20 Feb 2014 06:55:51 -0500 Received: by mail-ee0-f54.google.com with SMTP id c41so29074eek.13 for ; Thu, 20 Feb 2014 03:55:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id; bh=yA/VRDgQD6NzDC0d4w7LgaGTPTIwsqEN9ep/YIbmqpM=; b=PqOzBbio+B4HfLLh1vz/v7aE7MXbj0tofl0K+60FSqb+sXdFWn9pCWUHQI/VB8nJpW QdHU4oTsvSMng6RBEs5quAhYfWhoN9WGt1Yh6ZEl2BpneFvWxIPUkhZ2TDuIJBoDfDpN CXkS2mnuyaJIZ2BK2RUWCywriVigwYEgwKYVU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=yA/VRDgQD6NzDC0d4w7LgaGTPTIwsqEN9ep/YIbmqpM=; b=Ft3sglmak0cdIsCDAnO6ojoA8Oq647wyNXCnm/ihuEOYcAxqwW3G+J/2vnGeFbINVI 7o9XWDPMBRwrSN7/1d8VKENA4p9tUJPCpgTbjqByg2AcwOfmk5VyXlFFOzBR3n/bK7Uf mkeI4hOvbv0J8pyazzlt+Goi2cw6N7G0T63riKei3eCcA9qBWhowrLq/igTtqyiVXi7w qwHbA54IvUXW+AD9/e+9KaYdzJ2i4kbBXY0/F6qvVbBOf/mZCM+v/AF4f99hHkmmJlW0 Ub8cV5Dv4FZzfURBzadmPED4nMV+0SlC5AgG9VFOAzpBE7gHnfQG9lFttoKdvfePI2KC I14Q== X-Gm-Message-State: ALoCoQn8eNvHqeJK9dpfe4iLsX3+C+V1Cm/sT3pEZj+24K5YOIZUyKwKmwYqMHwwsJ+tn8GOr9eB7qhSFj0mvqWS3VjJi5yO4k1ABJHM1tTSBX9aVoHgErk= X-Received: by 10.15.41.140 with SMTP id s12mr1585589eev.4.1392897350664; Thu, 20 Feb 2014 03:55:50 -0800 (PST) Received: from localhost.localdomain ([91.198.246.8]) by mx.google.com with ESMTPSA id o43sm12913544eef.12.2014.02.20.03.55.48 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Feb 2014 03:55:50 -0800 (PST) From: Marek Puzyniak To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Marek Puzyniak Subject: [PATCH] ath10k: add soft/hard firmware crash option to simulate_fw_crash Date: Thu, 20 Feb 2014 12:55:30 +0100 Message-Id: <1392897330-4678-1-git-send-email-marek.puzyniak@tieto.com> X-Mailer: git-send-email 1.8.1.2 X-DomainID: tieto.com Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Command WMI_FORCE_FW_HANG_CMDID is not supported in firmware 10.1. In order to have firmware crash simulation functionality also in firmware 10.1 driver can force firmware crash by performing not allowed operation. Driver can deliberately crash firmware when setting vdev param for vdev id out of range. This patch introduces two keywords to simulate_fw_crash: 'soft' which will cause firmware crash that is recoverable by warm firmware reset but supported only in main firmware. 'hard' which will cause firmware crash recoverable by cold firmware reset, this option works for both firmwares. Commands to trigger firmware soft/hard crash: echo 'soft' > /sys/kernel/debug/ieee80211/phyX/ath10k/simulate_fw_crash echo 'hard' > /sys/kernel/debug/ieee80211/phyX/ath10k/simulate_fw_crash Signed-off-by: Marek Puzyniak --- This was patch: ath10k:change simulate_fw_crash to work with 10.1 firmware but after review updates I changed commit message. Previous patch was updated to support two keywords 'soft','hard' in order to distinguish different kind of firmware crashes. drivers/net/wireless/ath/ath10k/debug.c | 43 ++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index 6debd28..20f4c4b 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -451,12 +451,23 @@ static ssize_t ath10k_read_simulate_fw_crash(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - const char buf[] = "To simulate firmware crash write the keyword" - " `crash` to this file.\nThis will force firmware" - " to report a crash to the host system.\n"; + const char buf[] = "To simulate firmware crash write one of the" + " keywords to this file:\n `soft` - this will send" + " WMI_FORCE_FW_HANG_ASSERT to firmware if FW" + " supports that command.\n `hard` - this will send" + " to firmware command with illegal parameters" + " causing firmware crash.\n"; + return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); } +/* Simulate firmware crash: + * 'soft': Call wmi command causing firmware hang. This firmware hang is + * recoverable by warm firmware reset. + * 'hard': Force firmware crash by setting any vdev parameter for not allowed + * vdev id. This is hard firmware crash because it is recoverable only by cold + * firmware reset. + */ static ssize_t ath10k_write_simulate_fw_crash(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) @@ -464,14 +475,11 @@ static ssize_t ath10k_write_simulate_fw_crash(struct file *file, struct ath10k *ar = file->private_data; char buf[32] = {}; int ret; + const char *mode; mutex_lock(&ar->conf_mutex); simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count); - if (strcmp(buf, "crash") && strcmp(buf, "crash\n")) { - ret = -EINVAL; - goto exit; - } if (ar->state != ATH10K_STATE_ON && ar->state != ATH10K_STATE_RESTARTED) { @@ -479,15 +487,22 @@ static ssize_t ath10k_write_simulate_fw_crash(struct file *file, goto exit; } - ath10k_info("simulating firmware crash\n"); - - ret = ath10k_wmi_force_fw_hang(ar, WMI_FORCE_FW_HANG_ASSERT, 0); - if (ret) - ath10k_warn("failed to force fw hang (%d)\n", ret); + if (!strcmp(buf, "soft") || !strcmp(buf, "soft\n")) { + mode = "soft"; + ret = ath10k_wmi_force_fw_hang(ar, WMI_FORCE_FW_HANG_ASSERT, 0); + } else if (!strcmp(buf, "hard") || !strcmp(buf, "hard\n")) { + mode = "hard"; + ret = ath10k_wmi_vdev_set_param(ar, TARGET_NUM_VDEVS + 1, + ar->wmi.vdev_param->rts_threshold, 0); + } else { + ret = -EINVAL; + goto exit; + } - if (ret == 0) + if (ret == 0) { ret = count; - + ath10k_info("simulating firmware %s crash\n", mode); + } exit: mutex_unlock(&ar->conf_mutex); return ret;