linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@kernel.org>
To: Kang Yang <quic_kangyang@quicinc.com>
Cc: <ath12k@lists.infradead.org>,  <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH v6 05/11] wifi: ath12k: implement handling of P2P NoA event
Date: Tue, 06 Feb 2024 18:11:38 +0200	[thread overview]
Message-ID: <87plx9r2rp.fsf@kernel.org> (raw)
In-Reply-To: <20240130040303.370590-6-quic_kangyang@quicinc.com> (Kang Yang's message of "Tue, 30 Jan 2024 12:02:57 +0800")

Kang Yang <quic_kangyang@quicinc.com> writes:

> The NoA(Notice of Absence) attribute is used by the P2P Group Owner to
> signal its absence due to power save timing, concurrent operation, or
> off-channel scanning. It is also used in the P2P Presence Request-Response
> mechanism.
>
> The NoA attribute shall be present in the P2P IE in the beacon frames
> transmitted by a P2P Group Owner when a NoA schedule is being advertised,
> or when the CTWindow is non-zero.
>
> So add support to update P2P information after P2P GO is up through
> event WMI_P2P_NOA_EVENTID, and always put it in probe resp.
>
> Create p2p.c and p2p.h for P2P related functions and definitions.
>
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
>
> Signed-off-by: Kang Yang <quic_kangyang@quicinc.com>

[...]

> +static int ath12k_wmi_p2p_noa_event(struct ath12k_base *ab,
> +				    struct sk_buff *skb)
> +{
> +	const void **tb;
> +	const struct wmi_p2p_noa_event *ev;
> +	const struct ath12k_wmi_p2p_noa_info *noa;
> +	struct ath12k *ar;
> +	int ret, vdev_id;
> +
> +	tb = ath12k_wmi_tlv_parse_alloc(ab, skb, GFP_ATOMIC);
> +	if (IS_ERR(tb)) {
> +		ret = PTR_ERR(tb);
> +		ath12k_warn(ab, "failed to parse tlv: %d\n", ret);
> +		return ret;
> +	}
> +
> +	ev = tb[WMI_TAG_P2P_NOA_EVENT];
> +	noa = tb[WMI_TAG_P2P_NOA_INFO];
> +
> +	if (!ev || !noa) {
> +		kfree(tb);
> +		return -EPROTO;
> +	}
> +
> +	vdev_id = __le32_to_cpu(ev->vdev_id);
> +
> +	ath12k_dbg(ab, ATH12K_DBG_WMI,
> +		   "wmi tlv p2p noa vdev_id %i descriptors %u\n",
> +		   vdev_id, le32_get_bits(noa->noa_attr, WMI_P2P_NOA_INFO_DESC_NUM));
> +	ar = ath12k_mac_get_ar_by_vdev_id(ab, vdev_id);
> +	if (!ar) {
> +		ath12k_warn(ab, "invalid vdev id %d in P2P NoA event\n",
> +			    vdev_id);
> +		return -EINVAL;
> +	}

Aren't we leaking tb here? In this function I revamped the error
handling to use the out label to make sure we are freeing tb in every
error. Please review:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=12e182b47078a48169e873c51d438d7417e7e0c8

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

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

  parent reply	other threads:[~2024-02-06 16:11 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-30  4:02 [PATCH v6 00/11] wifi: ath12k: P2P support for WCN7850 Kang Yang
2024-01-30  4:02 ` [PATCH v6 01/11] wifi: ath12k: fix broken structure wmi_vdev_create_cmd Kang Yang
2024-01-30 16:48   ` Jeff Johnson
2024-02-05 15:46   ` Kalle Valo
2024-02-07 15:07   ` Kalle Valo
2024-01-30  4:02 ` [PATCH v6 02/11] wifi: ath12k: fix incorrect logic of calculating vdev_stats_id Kang Yang
2024-01-30 16:51   ` Jeff Johnson
2024-02-05 15:33     ` Kalle Valo
2024-01-30  4:02 ` [PATCH v6 03/11] wifi: ath12k: change interface combination for P2P mode Kang Yang
2024-01-30 16:52   ` Jeff Johnson
2024-01-30  4:02 ` [PATCH v6 04/11] wifi: ath12k: add P2P IE in beacon template Kang Yang
2024-01-30 17:02   ` Jeff Johnson
2024-02-05 16:24     ` Kalle Valo
2024-02-05 16:17   ` Kalle Valo
2024-02-05 16:35     ` Jeff Johnson
2024-02-06  9:52       ` Kalle Valo
2024-01-30  4:02 ` [PATCH v6 05/11] wifi: ath12k: implement handling of P2P NoA event Kang Yang
2024-01-30 17:14   ` Jeff Johnson
2024-02-02 13:53   ` Kalle Valo
2024-02-02 16:25     ` Jeff Johnson
2024-02-06  2:21     ` Kang Yang
2024-02-06  9:56       ` Kalle Valo
2024-02-06 16:11   ` Kalle Valo [this message]
2024-02-06 18:17     ` Kalle Valo
2024-02-07 17:43       ` Jeff Johnson
2024-02-07  4:36     ` Kang Yang
2024-01-30  4:02 ` [PATCH v6 06/11] wifi: ath12k: implement remain on channel for P2P mode Kang Yang
2024-01-30 17:16   ` Jeff Johnson
2024-01-30  4:02 ` [PATCH v6 07/11] wifi: ath12k: change WLAN_SCAN_PARAMS_MAX_IE_LEN from 256 to 512 Kang Yang
2024-01-30 17:19   ` Jeff Johnson
2024-01-30  4:03 ` [PATCH v6 08/11] wifi: ath12k: allow specific mgmt frame tx while vdev is not up Kang Yang
2024-01-30 17:23   ` Jeff Johnson
2024-02-06 16:24   ` Kalle Valo
2024-02-07  4:44     ` Kang Yang
2024-03-07  9:46     ` Kang Yang
2024-01-30  4:03 ` [PATCH v6 09/11] wifi: ath12k: move peer delete after vdev stop of station for WCN7850 Kang Yang
2024-01-30 17:24   ` Jeff Johnson
2024-01-30  4:03 ` [PATCH v6 10/11] wifi: ath12k: designating channel frequency for ROC scan Kang Yang
2024-01-30 17:24   ` Jeff Johnson
2024-01-30  4:03 ` [PATCH v6 11/11] wifi: ath12k: advertise P2P dev support for WCN7850 Kang Yang
2024-01-30 17:25   ` Jeff Johnson
2024-02-05 15:40 ` [PATCH v6 00/11] wifi: ath12k: P2P " Kalle Valo
2024-02-07  6:50   ` Kang Yang

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=87plx9r2rp.fsf@kernel.org \
    --to=kvalo@kernel.org \
    --cc=ath12k@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=quic_kangyang@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).