From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EF6AC4363A for ; Thu, 29 Oct 2020 00:37:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A70FC206B6 for ; Thu, 29 Oct 2020 00:37:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="A8sjR+wh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388688AbgJ2Ahe (ORCPT ); Wed, 28 Oct 2020 20:37:34 -0400 Received: from m42-4.mailgun.net ([69.72.42.4]:13707 "EHLO m42-4.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730563AbgJ2Agy (ORCPT ); Wed, 28 Oct 2020 20:36:54 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1603931812; h=Content-Transfer-Encoding: Content-Type: MIME-Version: Message-ID: Date: Subject: In-Reply-To: References: Cc: To: From: Sender; bh=3TAscz14oWrbc634rB6juc5q//Mynt4kR9cWgTjp0rw=; b=A8sjR+whuDF5E8fl3+IzpDZo57K+EX4b0+XSC4+C5TgVksKYIbAgHnIGto52YXB9JiKNheAK +4Q4wTvHOxvCesnUkewVzl2DC/KVGCCeZ0ri7aADU1GPIDU2yxXqbF+lCFBFAD9phmtZ+3xr M8xu/UOteSy8bGlUZ5rx6fsKfrQ= X-Mailgun-Sending-Ip: 69.72.42.4 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-east-1.postgun.com with SMTP id 5f999f4ec524f1103641ca42 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 28 Oct 2020 16:41:50 GMT Sender: pillair=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 80CF2C433FF; Wed, 28 Oct 2020 16:41:49 +0000 (UTC) Received: from Pillair (unknown [49.205.247.166]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: pillair) by smtp.codeaurora.org (Postfix) with ESMTPSA id 435C8C433CB; Wed, 28 Oct 2020 16:41:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 435C8C433CB Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=pillair@codeaurora.org From: "Rakesh Pillai" To: "'Doug Anderson'" Cc: "'ath10k'" , "'linux-wireless'" , "'LKML'" , "'Abhishek Kumar'" , "'Brian Norris'" References: <1603811067-23058-1-git-send-email-pillair@codeaurora.org> <003801d6ad41$a1bb8970$e5329c50$@codeaurora.org> In-Reply-To: Subject: RE: [PATCH] ath10k: Fix the parsing error in service available event Date: Wed, 28 Oct 2020 22:11:43 +0530 Message-ID: <003a01d6ad49$3a93f040$afbbd0c0$@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQJiqwpvoy2iSO2kR0YP6ePedJFSmQFbRrV/AemjQRUBizF6+6huuv3w Content-Language: en-us Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Doug Anderson > Sent: Wednesday, October 28, 2020 9:33 PM > To: Rakesh Pillai > Cc: ath10k ; linux-wireless wireless@vger.kernel.org>; LKML ; = Abhishek > Kumar ; Brian Norris > Subject: Re: [PATCH] ath10k: Fix the parsing error in service = available event >=20 > Hi, >=20 > On Wed, Oct 28, 2020 at 8:47 AM Rakesh Pillai > wrote: > > > > > -----Original Message----- > > > From: Doug Anderson > > > Sent: Wednesday, October 28, 2020 8:07 PM > > > To: Rakesh Pillai > > > Cc: ath10k ; linux-wireless > > wireless@vger.kernel.org>; LKML ; > Abhishek > > > Kumar ; Brian Norris > > > > Subject: Re: [PATCH] ath10k: Fix the parsing error in service = available > event > > > > > > Hi, > > > > > > On Tue, Oct 27, 2020 at 8:20 AM Rakesh Pillai = > > > wrote: > > > > > > > > The wmi service available event has been > > > > extended to contain extra 128 bit for new services > > > > to be indicated by firmware. > > > > > > > > Currently the presence of any optional TLVs in > > > > the wmi service available event leads to a parsing > > > > error with the below error message: > > > > ath10k_snoc 18800000.wifi: failed to parse svc_avail tlv: -71 > > > > > > > > The wmi service available event parsing should > > > > not return error for the newly added optional TLV. > > > > Fix this parsing for service available event message. > > > > > > > > Tested-on: WCN3990 hw1.0 SNOC > > > > > > > > Signed-off-by: Rakesh Pillai > > > > --- > > > > drivers/net/wireless/ath/ath10k/wmi-tlv.c | 3 +++ > > > > 1 file changed, 3 insertions(+) > > > > > > > > diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c > > > b/drivers/net/wireless/ath/ath10k/wmi-tlv.c > > > > index 932266d..3b49e29 100644 > > > > --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c > > > > +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c > > > > @@ -1404,9 +1404,12 @@ static int > ath10k_wmi_tlv_svc_avail_parse(struct > > > ath10k *ar, u16 tag, u16 len, > > > > arg->service_map_ext_len =3D *(__le32 *)ptr; > > > > arg->service_map_ext =3D ptr + sizeof(__le32); > > > > return 0; > > > > + case WMI_TLV_TAG_FIRST_ARRAY_ENUM: > > > > + return 0; > > > > > > This is at least slightly worrying to me. If I were calling this > > > function, I'd expect that if I didn't get back an error that at = least > > > "arg->service_map_ext_len" was filled in. Seems like you should = do: > > > > > > case WMI_TLV_TAG_FIRST_ARRAY_ENUM: > > > arg->service_map_ext_len =3D 0; > > > arg->service_map_ext =3D NULL; > > > return 0; > > > > > > ...and maybe add a comment about why you're doing that? > > > > > > At the moment things are working OK because > > > ath10k_wmi_event_service_available() happens to init the structure = to > > > 0 before calling with: > > > > > > struct wmi_svc_avail_ev_arg arg =3D {}; > > > > > > ....but it doesn't seem like a great idea to rely on that. > > > > > > That all being said, I'm just a drive-by reviewer and if everyone = else > > > likes it the way it is, feel free to ignore my comments. > > > > > > Hi Doug, > > > > The TLV TAG " WMI_TLV_TAG_STRUCT_SERVICE_AVAILABLE_EVENT" is > the first and a mandatory TLV in the service available event. > > The subsequent TLVs are optional ones and may or may not be present > (based on FW versions). > > This patch just fixes the bug, where the presence of any other TLVs = are > leading to a failure in parsing the service available msg. > > If, in future, we plan to use any other services from firmware, = which is > exposed in the extended TLVs, we will need to add a new variable (and = not > service_map_ext) to set the service. >=20 > I'm not sure I totally understood your response, but look at it from > the perspective of the function ath10k_wmi_event_service_available(). >=20 > That function calls: >=20 > ret =3D ath10k_wmi_pull_svc_avail(ar, skb, &arg); >=20 > ...if it gets back a non-zero error code, it assumes that the > "arg.service_map_ext" and "arg.service_map_ext_len" values are now > valid and it can use them. >=20 > Before your patch, ath10k_wmi_pull_svc_avail() was returning an error > code. That let ath10k_wmi_event_service_available() know that it > shouldn't look at "arg.service_map_ext" and "arg.service_map_ext_len". > After your patch, you're not returning an error code but those fields > aren't being filled in. >=20 > Said another way, if you remove the initialization of "arg" in > ath10k_wmi_event_service_available() then everything is broken. While > things work because you _do_ have an initialization of "arg" in > ath10k_wmi_event_service_available(), it feels fragile to me to rely > on that. Hi Doug, Got it. I will send a v2 which will address this concern. >=20 >=20 > -Doug