Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4283978pxu; Tue, 1 Dec 2020 00:40:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJyzWNmOkKdYBPVm4ZwrB0Dy04FKrHIlRB2I2d8a92bAR7sygGl2P99yxpmsf0ooaLCF2Pij X-Received: by 2002:a50:cfcf:: with SMTP id i15mr1872001edk.351.1606812000369; Tue, 01 Dec 2020 00:40:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606812000; cv=none; d=google.com; s=arc-20160816; b=ubDssq92TMcT9kfwce9mHqPmt5RylLRib+0a6dyH7eBfEyjy58FHiWauP74ARKMd+d iZCZ4Wipk0LNA8k6o/ZNqHewMeWXrSY94sRNATWEIo4nEI5Axp9PyzhZcjajEDctsQi2 3Iq1rJkm5ihEtQwwioS5r6QYTEuzV5qiVEdTBFFWMoMc1xHhx60vwUe6vBPkOiYkKfrq 6ARSjznYIPJG8I9wF/bonK264Zn9ZjxfZU0a63tkdwBm/cuiTzhqNJ6ydlMM3YPU5M47 X4uIZESfEZeACCOhsg+TrAVhN+3pW/0UtF6E4KI4za+WQ5D6zdhSrFMLVITAOfg96Bg+ oZGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ewo0MJoWoxrhmToV4VddfFK7u8PXDiubdabYxv2STYQ=; b=RxDxEU5ejISnEd29KpHKy3BNiG67+6t92TvINZvIkkzdSKS2TevDWzLftNhIr7u/yU jVq1jscfL69FlvA2PyXxWZbrpQ7nhf6Nmn4M1Rzrhb05ALxsj+NrIjMAuIFyJGWVGl2w ej2w/TM2I73gsghMUIBg/8cywCKO3ZBgctHZu4XzUw3tszOjSynnKlmkB2jXQH/N6tiw sB7B9rX45Y2kv/o2Kc1urMs2HFjb3K2aR248ml70prFGwVtqmuUVJ0Emz/DYK68T9Uc6 p6W1ZifRwGzIAjboTuAU7ZB0jJEzHKoX2Ap/AFZQ3ujx9knLonn8SqdsabpyWRm0fSE0 fT5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=E89xn0hc; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i1si708922eds.174.2020.12.01.00.39.31; Tue, 01 Dec 2020 00:40:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=E89xn0hc; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728869AbgLAIh5 (ORCPT + 99 others); Tue, 1 Dec 2020 03:37:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727253AbgLAIh4 (ORCPT ); Tue, 1 Dec 2020 03:37:56 -0500 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84970C0613CF for ; Tue, 1 Dec 2020 00:37:16 -0800 (PST) Received: by mail-io1-xd44.google.com with SMTP id q137so771678iod.9 for ; Tue, 01 Dec 2020 00:37:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ewo0MJoWoxrhmToV4VddfFK7u8PXDiubdabYxv2STYQ=; b=E89xn0hcvYC1e5TkAKd2ssW76eu4Z3evKSCC7iQZVFERSsOAC9wwV9v75ZV5gtqGNu Fhy+q3dSRsL6GIlsQG2Rklmol3BZZZVWulhzSwYb6GpaFMfCVHqQwOnsizaA4ZFb0vBy UKOCwLgf4/BHNe9urj7LvoHTor+vAU1PkRuMc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ewo0MJoWoxrhmToV4VddfFK7u8PXDiubdabYxv2STYQ=; b=mND8WBew4Il/18HSu+X3lKdJgHzBjCsQlJtIo1Wmsdm95i5cqA0TIW4afKxPZZJsGO ME60MCSx7+AzTUNnUWL1adtlMIEkTHDyuzadLIBRyjDBRD8JUDrV7+P0ZmRo9EoVH7OR DTFl3L6nfev/cKpV8xsMs4bhQ5FoagQ9TnbZXezEZ7Wk3ALY6/M0t+pOYKdIyaGusbka 8YM4lXnUxlEsGPw1acAJ/JgMo+eUdM2qZG3WS3HzZmjUndUBK78whP/UMMqToYPUn6D0 vEPIcWG/VWXRWexAT1v7/AswtG94/t/lx8Pg7ZFXxcvrENT8L1Kf1uJNR1fPXHbNzZYi SHHA== X-Gm-Message-State: AOAM5321tk++YTmUUoYkJKKbp7tdMu4zxvKR2k3zNrElytFJ2t7/kVJ6 oYuqPfHpzxbZgRe0uvmURk7A2xGDMCcIn0qsfFbOjw== X-Received: by 2002:a02:a304:: with SMTP id q4mr1665295jai.97.1606811835944; Tue, 01 Dec 2020 00:37:15 -0800 (PST) MIME-Version: 1.0 References: <20201120085312.4355-1-cjhuang@codeaurora.org> <20201120085312.4355-2-cjhuang@codeaurora.org> <8f0121e9996bad2266a928279e7eb26a@codeaurora.org> In-Reply-To: <8f0121e9996bad2266a928279e7eb26a@codeaurora.org> From: Abhishek Kumar Date: Tue, 1 Dec 2020 00:37:04 -0800 Message-ID: Subject: Re: [PATCH v2 1/3] nl80211: add common API to configure SAR power limitations. To: Carl Huang Cc: Brian Norris , ath10k , linux-wireless , Doug Anderson , Abhishek Kumar Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The V2 patch looks good to me. Regarding Brian's comment > [1] By the way, you aren't checking for duplicates; so users could > pass the same index many times, and it's not clear from the API > definition what should happen. It seems the current implementation is > that you'll just use the last value provided. I don't think we should be adding any logic in the kernel to check for duplicates, but rather userspace should take care of those. As long as the data provided abides by the data policy, the kernel should bother. But I do agree with Brian's other comment that it might be made more clear in comment. If at all a V3 is needed, then we should add that, or else it looks fine. Reviewed-by: Abhishek Kumar Thanks Abhishek On Mon, Nov 30, 2020 at 2:10 AM Carl Huang wrote: > > On 2020-11-21 10:42, Brian Norris wrote: > > On Fri, Nov 20, 2020 at 12:53 AM Carl Huang > > wrote: > >> > >> NL80211_CMD_SET_SAR_SPECS is added to configure SAR from > >> user space. NL80211_ATTR_SAR_SPEC is used to pass the SAR > >> power specification when used with NL80211_CMD_SET_SAR_SPECS. > >> > >> Wireless driver needs to register SAR type, supported frequency > >> ranges to wiphy, so user space can query it. The index in > >> frequency range is used to specify which sub band the power > >> limitation applies to. The SAR type is for compatibility, so later > >> other SAR mechanism can be implemented without breaking the user > >> space SAR applications. > >> > >> Normal process is user space quries the SAR capability, and > >> gets the index of supported frequency ranges and associates the > >> power limitation with this index and sends to kernel. > >> > >> Here is an example of message send to kernel: > >> 8c 00 00 00 08 00 01 00 00 00 00 00 38 00 2b 81 > >> 08 00 01 00 00 00 00 00 2c 00 02 80 14 00 00 80 > >> 08 00 02 00 00 00 00 00 08 00 01 00 38 00 00 00 > >> 14 00 01 80 08 00 02 00 01 00 00 00 08 00 01 00 > >> 48 00 00 00 > >> > >> NL80211_CMD_SET_SAR_SPECS: 0x8c > >> NL80211_ATTR_WIPHY: 0x01(phy idx is 0) > >> NL80211_ATTR_SAR_SPEC: 0x812b (NLA_NESTED) > >> NL80211_SAR_ATTR_TYPE: 0x00 (NL80211_SAR_TYPE_POWER) > >> NL80211_SAR_ATTR_SPECS: 0x8002 (NLA_NESTED) > >> freq range 0 power: 0x38 in 0.25dbm unit (14dbm) > >> freq range 1 power: 0x48 in 0.25dbm unit (18dbm) > >> > >> Signed-off-by: Carl Huang > > > > I think the API is reasonably clear and usable. I'm a little skeptical > > that the complexity related to indexes is absolutely necessary [1], > > but at least you make clear what should happen in the case of missing > > indexes (treated as "max"). But you've addressed my concerns, I think: > > > > Reviewed-by: Brian Norris > > > > I haven't done the most thorough review on the implementation pieces > > (and ath10k), but I at least wanted to put my thoughts out there. > > > > Thanks, > > Brian > > > > [1] By the way, you aren't checking for duplicates; so users could > > pass the same index many times, and it's not clear from the API > > definition what should happen. It seems the current implementation is > > that you'll just use the last value provided. > Thanks for the comments. > It's right the last value is used. > I can describe it more clearly if V3 is needed.