Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5189392iob; Mon, 9 May 2022 10:30:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4RBpA8WT7xnM+KPSPHhcafubhE1wBiA2PddxAtfre84xH7mIyMkkl4jUDtZF56PG9bczX X-Received: by 2002:a05:6871:5cb:b0:ed:b5ed:667d with SMTP id v11-20020a05687105cb00b000edb5ed667dmr7794692oan.47.1652117409312; Mon, 09 May 2022 10:30:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652117409; cv=none; d=google.com; s=arc-20160816; b=ho2H2aQj0aeLdqJxp71E4I/1jQ2BRI8KZ6TXlGjVEK5oJqssfyZFZ1yrCsGbaZ94no XN62ZnZ8n4KjJcbU+miSPYBl26iN/D1E4+fXuLHwQhnwbSkwTqZ00OYhyefWjX8MPSfH CkHEunQmcPc8IWNZC+BH1tm/wcR/nzT1w/3SKKP51GFLXZPbkFhzxeRZa1rq0YXsnfM7 qT4T3r1TtfDmCOJq+td1iEHFqgJ9r5Km+GmZ2rRqUn+GPqMlDaBCFgvMvJtCmg9oaODo VvtZJesdrVZr6Hs9vysbCBE/kmHSWdDGiGqp0UKih6xb3yBfG/jxOPLnxn1ZRNfdjgIl S+zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=xeiVbBjGZzQmi5hxe8ODrmB4OItgCwayOzZqZR/3bMs=; b=I/ph92WZKR5E4XQ2rVQ5WeT6Czn9Dx19G/tI8dEKNoN9hYRo/F6ZE4yx/wxI0KvrIu TB8DikdKFTgsZH8puxtDmkxhQlXlv+lpv8rqD8FcTzWgPa3kK3NzsINYzStTr5/uVYM8 I5Oxe245NTs4BYARBvYkeoFkpWb8ZDVH2FPCyEtUM1t81vh07AWu3VYGpUS2QJhaAuhT cdquC3BSKM6vx1brbjT2tCYPNsg2LpaAAtzbVVOw3Mo+W9yVrp//x+kobnHnDTga0zsa UA083emtEagcVHK5O3KwR1DeU81Z5KQu2RMjebMcJraOFtxNavjK61vyNniIIRocKTP3 Ch5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=mMPrOVq3; spf=softfail (google.com: domain of transitioning linux-wireless-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id c35-20020a05683034a300b006067275bd35si10032078otu.69.2022.05.09.10.30.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 10:30:09 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-wireless-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=mMPrOVq3; spf=softfail (google.com: domain of transitioning linux-wireless-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5925026BCBF; Mon, 9 May 2022 10:22:56 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239608AbiEIR0s (ORCPT + 69 others); Mon, 9 May 2022 13:26:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239547AbiEIR0q (ORCPT ); Mon, 9 May 2022 13:26:46 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7260C2655E9; Mon, 9 May 2022 10:22:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1652116970; x=1683652970; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=xeiVbBjGZzQmi5hxe8ODrmB4OItgCwayOzZqZR/3bMs=; b=mMPrOVq3Vj478HYgQ8ADOgCxlSSenvHRtG/jyPx/pjH0SHJJNX+vxlvY rUL8FRbk7xTDcoflVez/W8orkRpBXAVly3cyqomKXCtUWf4PQzuT89Fx6 H3uuu6vI3Tx4Ze9nuC9ZwXrujS4emzSVe0zmZ2zoX9zCCk1ZA9MLCkDkp I=; Received: from ironmsg07-lv.qualcomm.com ([10.47.202.151]) by alexa-out.qualcomm.com with ESMTP; 09 May 2022 10:22:50 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg07-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2022 10:22:51 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Mon, 9 May 2022 10:22:49 -0700 Received: from [10.110.84.131] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Mon, 9 May 2022 10:22:48 -0700 Message-ID: Date: Mon, 9 May 2022 10:22:47 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v3] ath10k: improve BDF search fallback strategy Content-Language: en-US To: Abhishek Kumar , CC: , , , , , "David S. Miller" , "Eric Dumazet" , Jakub Kicinski , Paolo Abeni References: <20220509022618.v3.1.Ibfd52b9f0890fffe87f276fa84deaf6f1fb0055c@changeid> From: Jeff Johnson In-Reply-To: <20220509022618.v3.1.Ibfd52b9f0890fffe87f276fa84deaf6f1fb0055c@changeid> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 5/8/2022 7:26 PM, Abhishek Kumar wrote: > Board data files wrapped inside board-2.bin files are > identified based on a combination of bus architecture, > chip-id, board-id or variants. Here is one such example > of a BDF entry in board-2.bin file: > bus=snoc,qmi-board-id=67,qmi-chip-id=320,variant=GO_XXXX > It is possible for few platforms none of the combinations > of bus,qmi-board,chip-id or variants match, e.g. if > board-id is not programmed and thus reads board-id=0xff, > there won't be any matching BDF to be found. In such > situations, the wlan will fail to enumerate. > > Currently, to search for BDF, there are two fallback > boardnames creates to search for BDFs in case the full BDF > is not found. It is still possible that even the fallback > boardnames do not match. > > As an improvement, search for BDF with full BDF combination > and perform the fallback searches by stripping down the last > elements until a BDF entry is found or none is found for all > possible BDF combinations.e.g. > Search for initial BDF first then followed by reduced BDF > names as follows: > bus=snoc,qmi-board-id=67,qmi-chip-id=320,variant=GO_XXXX > bus=snoc,qmi-board-id=67,qmi-chip-id=320 > bus=snoc,qmi-board-id=67 > bus=snoc > > > Tested-on: WCN3990/hw1.0 WLAN.HL.3.2.2.c10-00754-QCAHLSWMTPL-1 > Signed-off-by: Abhishek Kumar > --- > > Changes in v3: > - As discussed, instead of adding support for default BDF in DT, added > a method to drop the last elements from full BDF until a BDF is found. > - Previous patch was "ath10k: search for default BDF name provided in DT" > > drivers/net/wireless/ath/ath10k/core.c | 65 +++++++++++++------------- > 1 file changed, 32 insertions(+), 33 deletions(-) > > diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c > index 688177453b07..ebb0d2a02c28 100644 > --- a/drivers/net/wireless/ath/ath10k/core.c > +++ b/drivers/net/wireless/ath/ath10k/core.c > @@ -1426,15 +1426,31 @@ static int ath10k_core_search_bd(struct ath10k *ar, > return ret; > } > > +static bool ath10k_create_reduced_boardname(struct ath10k *ar, char *boardname) > +{ > + /* Find last BDF element */ > + char *last_field = strrchr(boardname, ','); > + > + if (last_field) { > + /* Drop the last BDF element */ > + last_field[0] = '\0'; > + ath10k_dbg(ar, ATH10K_DBG_BOOT, > + "boardname =%s\n", boardname); nit: strange spacing in the message. i'd expect consistent spacing on both side of "=", either one space on both sides or no space on both sides. also the use of "=" here is inconsistent with the use of ":" in a log later below > + return 0; > + } > + return -ENODATA; > +} > + > static int ath10k_core_fetch_board_data_api_n(struct ath10k *ar, > const char *boardname, > - const char *fallback_boardname1, > - const char *fallback_boardname2, > const char *filename) > { > - size_t len, magic_len; > + size_t len, magic_len, board_len; > const u8 *data; > int ret; > + char temp_boardname[100]; > + > + board_len = 100 * sizeof(temp_boardname[0]); > > /* Skip if already fetched during board data download */ > if (!ar->normal_mode_fw.board) > @@ -1474,20 +1490,24 @@ static int ath10k_core_fetch_board_data_api_n(struct ath10k *ar, > data += magic_len; > len -= magic_len; > > - /* attempt to find boardname in the IE list */ > - ret = ath10k_core_search_bd(ar, boardname, data, len); > + memcpy(temp_boardname, boardname, board_len); > + ath10k_dbg(ar, ATH10K_DBG_BOOT, "boardname :%s\n", boardname); nit: use of ":" inconsistent with use of "=" noted above. also expect space after ":, not before: "boardname: %s\n" > > - /* if we didn't find it and have a fallback name, try that */ > - if (ret == -ENOENT && fallback_boardname1) > - ret = ath10k_core_search_bd(ar, fallback_boardname1, data, len); > +retry_search: > + /* attempt to find boardname in the IE list */ > + ret = ath10k_core_search_bd(ar, temp_boardname, data, len); > > - if (ret == -ENOENT && fallback_boardname2) > - ret = ath10k_core_search_bd(ar, fallback_boardname2, data, len); > + /* If the full BDF entry was not found then drop the last element and > + * recheck until a BDF is found or until all options are exhausted. > + */ > + if (ret == -ENOENT) > + if (!ath10k_create_reduced_boardname(ar, temp_boardname)) > + goto retry_search; > > if (ret == -ENOENT) { note that ath10k_create_reduced_boardname() returns -ENODATA when truncation fails and hence you won't log this error when that occurs > ath10k_err(ar, > "failed to fetch board data for %s from %s/%s\n", > - boardname, ar->hw_params.fw.dir, filename); > + temp_boardname, ar->hw_params.fw.dir, filename); does it really make sense to log the last name tried, temp_boardname? or does it make more sense to still log the original name, boardname? maybe log each failure in the loop, before calling ath10k_create_reduced_boardname()? > ret = -ENODATA; > } > > @@ -1566,7 +1586,7 @@ static int ath10k_core_create_eboard_name(struct ath10k *ar, char *name, > > int ath10k_core_fetch_board_file(struct ath10k *ar, int bd_ie_type) > { > - char boardname[100], fallback_boardname1[100], fallback_boardname2[100]; > + char boardname[100]; > int ret; > > if (bd_ie_type == ATH10K_BD_IE_BOARD) { > @@ -1579,25 +1599,6 @@ int ath10k_core_fetch_board_file(struct ath10k *ar, int bd_ie_type) > return ret; > } > > - /* Without variant and only chip-id */ > - ret = ath10k_core_create_board_name(ar, fallback_boardname1, > - sizeof(boardname), false, > - true); > - if (ret) { > - ath10k_err(ar, "failed to create 1st fallback board name: %d", > - ret); > - return ret; > - } > - > - /* Without variant and without chip-id */ > - ret = ath10k_core_create_board_name(ar, fallback_boardname2, > - sizeof(boardname), false, > - false); > - if (ret) { > - ath10k_err(ar, "failed to create 2nd fallback board name: %d", > - ret); > - return ret; > - } > } else if (bd_ie_type == ATH10K_BD_IE_BOARD_EXT) { > ret = ath10k_core_create_eboard_name(ar, boardname, > sizeof(boardname)); > @@ -1609,8 +1610,6 @@ int ath10k_core_fetch_board_file(struct ath10k *ar, int bd_ie_type) > > ar->bd_api = 2; > ret = ath10k_core_fetch_board_data_api_n(ar, boardname, > - fallback_boardname1, > - fallback_boardname2, > ATH10K_BOARD_API2_FILE); > if (!ret) > goto success;