Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5938300rwl; Mon, 9 Jan 2023 01:47:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXtFbtjw83fFS6+7x8AjSh0v7csOtINRhVq9vfvJvaMDzId/5o0PYfexzDwOlUOHHsFN9PVL X-Received: by 2002:aa7:d989:0:b0:495:635:bab0 with SMTP id u9-20020aa7d989000000b004950635bab0mr13324182eds.11.1673257634445; Mon, 09 Jan 2023 01:47:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673257634; cv=none; d=google.com; s=arc-20160816; b=t4QvkQs+5GRmVu7O2iXXhw3JJCWgee71cfwdjnTyrRS1UQA1QxoEd5lkJmiC3htfLZ QItCXXCVoQXsCZRpZcsP5/luJ+GX2oXMVTjpA8YErBpZoGLq1UyoINfNINEs5XWGM1eU hw4cAi6VbjA5eEWzdSltFHinWxkYB4hxqKId6fGkJBeiwjy8L3j/IqWabUv7UKIGwKXt KdoQKVBxMpjmMVtYuQgfRe4yV71z98mk6kOXlgT/UM1/55Fiu12mktKzBPECMks0lC1F r0O4C++hBgRA5HGFFW/xUCTyzHKBWqGUkB7oeGWBfZf0E31wNOAlVLc0DxNygIsSwpbk LlgQ== 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=K4wq11DfWu5N/17+iiCpGthkHxvKT155yOBJf//IEEs=; b=G3Qe7zJ0v/ZIGJodM21ngH23JBLYmnN3xgEj3DimjJKmsfrgL1gAKeaHKwd95/jEZu kHcyV+pjHOE/wAn3VI9nxLT8ZHT2a55G9A4AZhJQtKkE0XqbFUA2n1Vd9Hh/4aADZ/UP vxhyXYF8sXKCEzaXaA3PYVRnuXTmIPRcODE5Rtfqsox/O3ZkpKfnND0HPuYwxcwRjuNj OWqw5VDWD4eWVi6cXF6EffM20LyIcdz32yM3gQDGUMAygWszVq6tacyAJSwTnEBahZoH nlJIle/bxqB8fcWjZLMkaY+ZT2jY5U2MH5UDlCIhBPenRL3p5ZClq9GMn8WjneQFCIOn miug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=LtRwuNgT; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c18-20020a05640227d200b004761d56a66asi8209583ede.271.2023.01.09.01.46.53; Mon, 09 Jan 2023 01:47:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=LtRwuNgT; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233239AbjAIJkr (ORCPT + 65 others); Mon, 9 Jan 2023 04:40:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236757AbjAIJkX (ORCPT ); Mon, 9 Jan 2023 04:40:23 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C121C64D3 for ; Mon, 9 Jan 2023 01:40:19 -0800 (PST) Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3098h8Qv030005; Mon, 9 Jan 2023 09:39:55 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=K4wq11DfWu5N/17+iiCpGthkHxvKT155yOBJf//IEEs=; b=LtRwuNgTsnXAVrz2p+aTujuBM3sgN0T/Wql+RiU8XAoHsOQWLt7V/LONaQP6u2S2vSSF 74r7sM+D/VpS/a21PI0J5Zz3XbQze/HSzjvi6PrOQaqXKfrWEZ6M+K6HNmIGlA3Vmqb8 AI6TJo9Y+XnF+cLZ7CYCUBvyn8rztrKYusA37a6jUzhhCs/tp30h9ap5p58NBgI2w5s9 TwV9Wy+j3nM227Pg+O140/TWzSwccQpQEI+4omERHyiCtx7nOf45pxA8lb7wKFKBoKu/ cqtGOBklfOVKV2Mo0mE5Gn+jfyNYGadv6j/tM3KwnbW0uPYWDwOiKgRmmGxW6cKVtJBj DA== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3my0b92r7g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 09 Jan 2023 09:39:55 +0000 Received: from nasanex01a.na.qualcomm.com (corens_vlan604_snip.qualcomm.com [10.53.140.1]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3099dsoQ024325 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 9 Jan 2023 09:39:54 GMT Received: from [10.253.34.122] (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Mon, 9 Jan 2023 01:39:51 -0800 Message-ID: <4de1f964-b623-2b31-c044-60cc188fc134@quicinc.com> Date: Mon, 9 Jan 2023 17:39:49 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.1 Subject: Re: [PATCH v10 3/5] cfg80211/mac80211: move interface counting for combination check to mac80211 Content-Language: en-US To: Luciano Coelho , CC: , , , , , References: <1394547394-3910-1-git-send-email-luciano.coelho@intel.com> <1394547394-3910-4-git-send-email-luciano.coelho@intel.com> From: Wen Gong In-Reply-To: <1394547394-3910-4-git-send-email-luciano.coelho@intel.com> 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 nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: v1tYP6z3NXpfbBYbV1NHTm6HBd95eYrj X-Proofpoint-ORIG-GUID: v1tYP6z3NXpfbBYbV1NHTm6HBd95eYrj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-09_03,2023-01-06_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxscore=0 clxscore=1011 adultscore=0 impostorscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=802 priorityscore=1501 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301090067 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS autolearn=ham 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 3/11/2014 10:16 PM, Luciano Coelho wrote: > ... > +int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, > + const struct cfg80211_chan_def *chandef, > + enum ieee80211_chanctx_mode chanmode, > + u8 radar_detect) > +{ > + struct ieee80211_local *local = sdata->local; > + struct ieee80211_sub_if_data *sdata_iter; > + enum nl80211_iftype iftype = sdata->wdev.iftype; > + int num[NUM_NL80211_IFTYPES]; > + struct ieee80211_chanctx *ctx; > + int num_different_channels = 1; > + int total = 1; > + > + lockdep_assert_held(&local->chanctx_mtx); > + > + if (WARN_ON(hweight32(radar_detect) > 1)) > + return -EINVAL; > + > + if (WARN_ON(chanmode == IEEE80211_CHANCTX_SHARED && !chandef->chan)) > + return -EINVAL; > + > + if (WARN_ON(iftype >= NUM_NL80211_IFTYPES)) > + return -EINVAL; > + > + /* Always allow software iftypes */ > + if (local->hw.wiphy->software_iftypes & BIT(iftype)) { > + if (radar_detect) > + return -EINVAL; > + return 0; > + } > + > + memset(num, 0, sizeof(num)); > + > + if (iftype != NL80211_IFTYPE_UNSPECIFIED) > + num[iftype] = 1; > + > + list_for_each_entry(ctx, &local->chanctx_list, list) { > + if (ctx->conf.radar_enabled) > + radar_detect |= BIT(ctx->conf.def.width); > + if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE) { > + num_different_channels++; > + continue; > + } > + if ((chanmode == IEEE80211_CHANCTX_SHARED) && > + cfg80211_chandef_compatible(chandef, > + &ctx->conf.def)) > + continue; > + num_different_channels++; > + } > + > + list_for_each_entry_rcu(sdata_iter, &local->interfaces, list) { > + struct wireless_dev *wdev_iter; > + > + wdev_iter = &sdata_iter->wdev; > + > + if (sdata_iter == sdata || > + rcu_access_pointer(sdata_iter->vif.chanctx_conf) == NULL || > + local->hw.wiphy->software_iftypes & BIT(wdev_iter->iftype)) > + continue; > + > + num[wdev_iter->iftype]++; > + total++; > + } > + > + if (total == 1 && !radar_detect) > + return 0; > + should also check with cfg80211_check_combinations() when total == 1 and num_different_channels > 1 ? When MLO is enabled, it could have 2 channels for one ieee80211_sub_if_data. > + return cfg80211_check_combinations(local->hw.wiphy, > + num_different_channels, > + radar_detect, num); > +} > ...