linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@kernel.org>
To: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
Cc: <ath11k@lists.infradead.org>, <linux-wireless@vger.kernel.org>,
	Govindaraj Saminathan <quic_gsaminat@quicinc.com>,
	Sowmiya Sree Elavalagan <quic_ssreeela@quicinc.com>
Subject: Re: [PATCH 1/2] wifi: ath11k: factory test mode support
Date: Mon, 13 Mar 2023 14:17:05 +0200	[thread overview]
Message-ID: <87ilf4onge.fsf@kernel.org> (raw)
In-Reply-To: <20230213130854.2473-2-quic_rajkbhag@quicinc.com> (Raj Kumar Bhagat's message of "Mon, 13 Feb 2023 18:38:53 +0530")

Raj Kumar Bhagat <quic_rajkbhag@quicinc.com> writes:

> From: Govindaraj Saminathan <quic_gsaminat@quicinc.com>
>
> Add support to process factory test mode commands(FTM) for calibration.
> By default firmware start with NORMAL mode and to process the FTM commands
> firmware needs to be restarted in FTM mode using module parameter ftm_mode.
> The pre-request is all the radios should be down before starting the test.
>
> When start command ATH11K_TM_CMD_TESTMODE_START is received, ar state
> is set to Test Mode. If the FTM command or event length is greater
> than 256 bytes, it will be broken down into multiple segments and
> encoded with TLV header if it is segmented commands, else it is sent
> to firmware as it is.
>
> On receiving UTF event from firmware, if it is segmented event, the driver
> will wait until it receives all the segments and notify the complete
> data to user application. In case the segmented sequence are missed or
> lost from the firmware, driver will skip the already received partial data.
>
> In case of unsegmented UTF event from firmware, driver notifies the
> data to the user application as it comes. Applications handles
> the data further.
>
> Command to boot in ftm mode
> insmod ath11k ftm_mode=1
>
> Tested-on : IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
>
> Signed-off-by: Govindaraj Saminathan <quic_gsaminat@quicinc.com>
> Co-developed-by: Sowmiya Sree Elavalagan <quic_ssreeela@quicinc.com>
> Signed-off-by: Sowmiya Sree Elavalagan <quic_ssreeela@quicinc.com>
> Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>

[...]

> -bool ath11k_tm_event_wmi(struct ath11k *ar, u32 cmd_id, struct sk_buff *skb)

Please do removal of this ath11k_tm_event_wmi() in a separate patch,
then it's easier to read this patch.

>  static int ath11k_tm_cmd_get_version(struct ath11k *ar, struct nlattr *tb[])
>  {
>  	struct sk_buff *skb;
> -	int ret;
>  
>  	ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE,
>  		   "testmode cmd get version_major %d version_minor %d\n",
> @@ -98,21 +205,50 @@ static int ath11k_tm_cmd_get_version(struct ath11k *ar, struct nlattr *tb[])
>  	if (!skb)
>  		return -ENOMEM;
>  
> -	ret = nla_put_u32(skb, ATH11K_TM_ATTR_VERSION_MAJOR,
> -			  ATH11K_TESTMODE_VERSION_MAJOR);
> -	if (ret) {
> +	if (nla_put_u32(skb, ATH11K_TM_ATTR_VERSION_MAJOR,
> +			ATH11K_TESTMODE_VERSION_MAJOR) ||
> +	    nla_put_u32(skb, ATH11K_TM_ATTR_VERSION_MINOR,
> +			ATH11K_TESTMODE_VERSION_MINOR)) {
>  		kfree_skb(skb);
> -		return ret;
> +		return -ENOBUFS;
>  	}
>  
> -	ret = nla_put_u32(skb, ATH11K_TM_ATTR_VERSION_MINOR,
> -			  ATH11K_TESTMODE_VERSION_MINOR);
> -	if (ret) {
> -		kfree_skb(skb);
> -		return ret;
> +	return cfg80211_testmode_reply(skb);
> +}

Please also do the changes in ath11k_tm_cmd_get_version() in a separate
patch.

> @@ -47,4 +49,21 @@ enum ath11k_tm_cmd {
>  	 * ATH11K_TM_ATTR_DATA.
>  	 */
>  	ATH11K_TM_CMD_WMI = 1,
> +
> +	/* Boots the UTF firmware, the netdev interface must be down at the
> +	 * time.
> +	 */
> +	ATH11K_TM_CMD_TESTMODE_START = 2,
> +
> +	/* Shuts down the UTF firmware and puts the driver back into OFF
> +	 * state.
> +	 */
> +	ATH11K_TM_CMD_TESTMODE_STOP = 3,

The documentation for for the STOP command is misleading, now ath11k
just ignores that command. So is there any point even to have the
command if it doesn't do anything?

> @@ -8096,6 +8128,12 @@ static void ath11k_wmi_tlv_op_rx(struct ath11k_base *ab, struct sk_buff *skb)
>  	case WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID:
>  		ath11k_wmi_pdev_csa_switch_count_status_event(ab, skb);
>  		break;
> +	case WMI_PDEV_UTF_EVENTID:
> +		if (test_bit(ATH11K_FLAG_FTM_SEGMENTED, &ab->dev_flags))
> +			ath11k_wmi_tm_event_segmented(ab, id, skb);
> +		else
> +			ath11k_tm_wmi_event_unsegmented(ab, id, skb);
> +		break;

I didn't investigate this in detail, but I find the flag a bit
problematic as it alters the behaviour ATH11K_FLAG_FTM_SEGMENTED and the
behaviour difference it's not documented at all in enum ath11k_tm_cmd.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

  parent reply	other threads:[~2023-03-13 12:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13 13:08 [PATCH 0/2] ath11k: factory test mode support Raj Kumar Bhagat
2023-02-13 13:08 ` [PATCH 1/2] wifi: " Raj Kumar Bhagat
2023-02-27 13:03   ` Kalle Valo
2023-03-13  9:53   ` Kalle Valo
2023-04-20  9:54     ` Raj Kumar Bhagat
2023-03-13 12:17   ` Kalle Valo [this message]
2023-04-20 10:02     ` Raj Kumar Bhagat
2023-02-13 13:08 ` [PATCH 2/2] wifi: ath11k: Allow ath11k to boot without caldata in ftm mode Raj Kumar Bhagat
2023-02-16 14:56 ` [PATCH 0/2] ath11k: factory test mode support Vasanthakumar Thiagarajan
2023-03-13 12:21 ` Kalle Valo
2023-03-28  4:46   ` Raj Kumar Bhagat
2023-05-12  9:05     ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ilf4onge.fsf@kernel.org \
    --to=kvalo@kernel.org \
    --cc=ath11k@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=quic_gsaminat@quicinc.com \
    --cc=quic_rajkbhag@quicinc.com \
    --cc=quic_ssreeela@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).