Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1401014rdb; Wed, 6 Dec 2023 19:15:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IFmBGFXUsNx3BsA4KY6r+XJsF4DF1oRfcnuE22g3Kxc8YjQ98gfBf/qn3k6hXkCmGuPHT8R X-Received: by 2002:a17:902:bf42:b0:1d0:80e3:25d3 with SMTP id u2-20020a170902bf4200b001d080e325d3mr1832842pls.25.1701918938148; Wed, 06 Dec 2023 19:15:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701918938; cv=none; d=google.com; s=arc-20160816; b=HTt0t56SbZMn2Lip52PTaE0c6QZZt9I3tU38YoOM01MgwTB7U2bGAVeuhi9zXZzLjV I80yeykst+7W3n7AJnX6ygMJYGSoPqlsQO/bZBwzr1p26Uj5wdorvWoiN5AwS6wzEr7p yeEq9ok3zFMyuXA+AmC7ijcw9VjruCHZpWdcVD49DiSooELa/Qi9nxQPK/Or81zQT0Cy dzKPqOFu56X8B+8+G4MOL6FFIKkQcDEzbVs/SkkyjIQXydHc0G0HPO4Rq1kGjUyN6NAi zQuBKn2I7eTHowxy2tGlf35omhbdc9O1UZmPgw5nwaK5fMmNRKpRmCBHz+p0ZFaPn7QS j9Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=VHmXHBdVYFGrD2ACeWeQ93UCCo5QwxjvqiBw4JKEIj4=; fh=lP+FyPnTPmJOMA/wP4iC1fr6HzuBVIppIk9dmo9v2y0=; b=xtq2v6xl2UyvPkkeVUL7sxw2YJnx6nmkWW+V6cYMnOSDqnjIiXY4ESmkT7aeaiCafc Y8kCaBZQjV0qhxUSwqF7zZpbzCB87yqUHfntRYxccjfwr1S4jsyruDC/zKsTzMz5QLft qsM3nrTzSrbBpYlM8SSPGynBESf/7BytR/1KMlWxMP/L2lB49XcROHxyaZdYj3ZHXMrt kkv64o4OoaJuwNFFOqxeTYuwRBElah/Kd6QnDnEcPju7XwoIAGjj5sr16f2YnS1mG2+R cMf3n9r620eoerHGSX+3Y066YDilFkRD3L/SlKxn7BZ0W4TX06yiF/COI1Cmw1A2gnWg ck+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=RfhyKQwf; spf=pass (google.com: domain of linux-wireless+bounces-523-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-523-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id je1-20020a170903264100b001c566ea86eesi329360plb.177.2023.12.06.19.15.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 19:15:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-523-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=RfhyKQwf; spf=pass (google.com: domain of linux-wireless+bounces-523-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-523-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B8DC9281379 for ; Thu, 7 Dec 2023 03:15:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 63A9320E5; Thu, 7 Dec 2023 03:15:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="RfhyKQwf" X-Original-To: linux-wireless@vger.kernel.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E30E2110 for ; Wed, 6 Dec 2023 19:15:33 -0800 (PST) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3B73Eco1001663; Thu, 7 Dec 2023 03:15:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=VHmXHBdVYFGrD2ACeWeQ93UCCo5QwxjvqiBw4JKEIj4=; b=RfhyKQwfD+qg8VMMHbYBVBu/qc3yAA9fRTUAlwYNBI428dEMteh4esDy6O44oy6CBLZh UcmI9FVeirrL9V7c1f5cAVVWobs3/a0pHZKhUnAqGjOkZs9IxUQCd9dm48+nKgrbMo3b 3CG2pI1rwCwIae0N4k4xcLYrNY+ENApn3qm2r+P9Tojixc6dzhNotyrc7eRSAAy4p3ed Outc9o6GKS8P5WAx+O6WD4h9Fa49s5X6sfyjI8VVaPEccYsaRKYLvcwVJsJQQbclz6jU uXHPvSHKcWAx5GFjBFxcsM+vTQQpNlvI0kIskuLTRfRUjjHCaVb//wcdYo0eRSEK2YF7 NA== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3utrwq1ykv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Dec 2023 03:15:26 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3B73FPvm026543 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 7 Dec 2023 03:15:25 GMT Received: from [10.216.30.117] (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.1118.40; Wed, 6 Dec 2023 19:15:24 -0800 Message-ID: Date: Thu, 7 Dec 2023 08:45:20 +0530 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v8 02/12] wifi: ath11k: store cur_regulatory_info for each radio Content-Language: en-US To: Baochen Qiang , CC: References: <20231204081323.5582-1-quic_bqiang@quicinc.com> <20231204081323.5582-3-quic_bqiang@quicinc.com> From: Aditya Kumar Singh In-Reply-To: <20231204081323.5582-3-quic_bqiang@quicinc.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: tSSPW1fEYeRArzcALIrTLXt7nI72VqoI X-Proofpoint-GUID: tSSPW1fEYeRArzcALIrTLXt7nI72VqoI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-06_22,2023-12-06_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 mlxscore=0 priorityscore=1501 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2312070025 On 12/4/23 13:43, Baochen Qiang wrote: > --- a/drivers/net/wireless/ath/ath11k/mac.h > +++ b/drivers/net/wireless/ath/ath11k/mac.h > @@ -159,7 +159,6 @@ struct ath11k_vif *ath11k_mac_get_vif_up(struct ath11k_base *ab); > > struct ath11k *ath11k_mac_get_ar_by_vdev_id(struct ath11k_base *ab, u32 vdev_id); > struct ath11k *ath11k_mac_get_ar_by_pdev_id(struct ath11k_base *ab, u32 pdev_id); > - Irrelevant change w.r.t commit message? > void ath11k_mac_drain_tx(struct ath11k *ar); > void ath11k_mac_peer_cleanup_all(struct ath11k *ar); > int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx); ... > @@ -4749,6 +4749,11 @@ static int ath11k_wmi_tlv_ext_soc_hal_reg_caps_parse(struct ath11k_base *soc, > soc->pdevs[0].pdev_id = 0; > } > > + if (!soc->reg_info_store) > + soc->reg_info_store = kcalloc(soc->num_radios, > + sizeof(*soc->reg_info_store), > + GFP_ATOMIC); What if this memory allocation request fails? Any negative case check should be present? > + > return 0; > } > > @@ -7071,33 +7076,54 @@ static bool ath11k_reg_is_world_alpha(char *alpha) > return false; > } > > -static int ath11k_reg_chan_list_event(struct ath11k_base *ab, > - struct sk_buff *skb, > - enum wmi_reg_chan_list_cmd_type id) > +void ath11k_reg_reset_info(struct cur_regulatory_info *reg_info) > { > - struct cur_regulatory_info *reg_info = NULL; > - struct ieee80211_regdomain *regd = NULL; > - bool intersect = false; > - int ret = 0, pdev_idx, i, j; > - struct ath11k *ar; > + int i, j; > > - reg_info = kzalloc(sizeof(*reg_info), GFP_ATOMIC); > - if (!reg_info) { > - ret = -ENOMEM; > - goto fallback; > - } > + if (reg_info) { > + kfree(reg_info->reg_rules_2ghz_ptr); > > - if (id == WMI_REG_CHAN_LIST_CC_ID) > - ret = ath11k_pull_reg_chan_list_update_ev(ab, skb, reg_info); > - else > - ret = ath11k_pull_reg_chan_list_ext_update_ev(ab, skb, reg_info); > + kfree(reg_info->reg_rules_5ghz_ptr); > > - if (ret) { > - ath11k_warn(ab, "failed to extract regulatory info from received event\n"); > - goto fallback; > + for (i = 0; i < WMI_REG_CURRENT_MAX_AP_TYPE; i++) { > + kfree(reg_info->reg_rules_6ghz_ap_ptr[i]); > + for (j = 0; j < WMI_REG_MAX_CLIENT_TYPE; j++) > + kfree(reg_info->reg_rules_6ghz_client_ptr[i][j]); > + } > + > + memset(reg_info, 0, sizeof(*reg_info)); > } > +} > + > +static > +enum wmi_vdev_type ath11k_reg_get_ar_vdev_type(struct ath11k *ar) > +{ > + struct ath11k_vif *arvif; > + > + /* Currently each struct ath11k maps to one struct ieee80211_hw/wiphy > + * and one struct ieee80211_regdomain, so it could only store one group > + * reg rules. It means muti-interface concurrency in the same ath11k is > + * not support for the regdomain. So get the vdev type of the first entry > + * now. After concurrency support for the regdomain, this should change. > + */ > + arvif = list_first_entry_or_null(&ar->arvifs, struct ath11k_vif, list); > + if (arvif) > + return arvif->vdev_type; > + > + return WMI_VDEV_TYPE_UNSPEC; > +} > + > +int ath11k_reg_handle_chan_list(struct ath11k_base *ab, > + struct cur_regulatory_info *reg_info, > + enum ieee80211_ap_reg_power power_type) > +{ > + struct ieee80211_regdomain *regd; > + bool intersect = false; > + int pdev_idx; > + struct ath11k *ar; > + enum wmi_vdev_type vdev_type; > > - ath11k_dbg(ab, ATH11K_DBG_WMI, "event reg chan list id %d", id); > + ath11k_dbg(ab, ATH11K_DBG_WMI, "event reg handle chan list"); I believe this debug was helpful in the sense it showed which type of event came. Can't we still print this somehow? Or may be somewhere else?