Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp7873760rwn; Wed, 14 Sep 2022 05:56:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR5WYYh7CmY30RVI19ilgGxE1kjqTYX7PZ6+7qjyYDPBxC1GFNs1KH38qntcISVr7XblXNTA X-Received: by 2002:a17:907:60c9:b0:77f:be6d:d870 with SMTP id hv9-20020a17090760c900b0077fbe6dd870mr6890764ejc.348.1663160187660; Wed, 14 Sep 2022 05:56:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663160187; cv=none; d=google.com; s=arc-20160816; b=sZaNjn+Ru1kuSZ/cW5ZkqR82WaM2NQ+UlUOe3QLo3LZFf3mezpCXueI//3Gmm42k7w 96+imol67O1z4Cr4uz+UE32k81NDCtqfJTD3W6ph2VZSbUJlPGFr+unKaCg4pUVUdeS6 +OyK13kzD/lX6p4RqntPQ4COApT4si6AZzJuWDQ65hOW5w1QIh/puy4qlYAhSRQq9zyP tfOTKOgENfuuszGfj1SFY2TMcGVdNwcM+J+1ZQ7Ijm2sob/7hqDE57UahUt1bRxx46bR qBBgy30a24rRC/t44zqcwVIk+2W2nhd3CIxHGxTv+E5visl792DXZlHTTq+lRMMpTDF6 KHOQ== 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=9MTarLD/Pz82hkgDPc4VnnqjhN28FjyaD0E3mX82COU=; b=CA5EBy8UnZh7VcMAymts5iCN4sgk9FD1ZiEvWNtj0EKAozc15BJQzOgJ3vg7MJ6qTg Z+w6AwX6nyVI8n7zeUJMBdmmuVjKboFePrnTDHQQUHf7LbMXRN75Ts24oFHyhw0xM0tb 5b+ASwHo3nExcseRcrlUYuSUv5qoTm+fhe+y/gK4hu7MmTWBwa0p4jLoUHd8rqb/vhQy 0XR07XWzCDNRf3XKNstsX26SnCcqqYgSK37CDE70pmLcosNABZKAhQ9TG3uTuiKtw7+Q Xh830zoZ12adxjJ4BdSUWUCNHBHlI4cnQRDkvTc4KYzKCFkVjEAqb6q8CkW3Fw8l2ckJ z3hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="K/yaOWTG"; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa30-20020a1709076d1e00b007775a192266si11728272ejc.617.2022.09.14.05.56.05; Wed, 14 Sep 2022 05:56:27 -0700 (PDT) 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=@linaro.org header.s=google header.b="K/yaOWTG"; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229758AbiINMyO (ORCPT + 64 others); Wed, 14 Sep 2022 08:54:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbiINMyN (ORCPT ); Wed, 14 Sep 2022 08:54:13 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 129007757A for ; Wed, 14 Sep 2022 05:54:12 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id l65so14807199pfl.8 for ; Wed, 14 Sep 2022 05:54:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=9MTarLD/Pz82hkgDPc4VnnqjhN28FjyaD0E3mX82COU=; b=K/yaOWTGsX8o27gyE0RR60UFSMA65Kzwajuwdp516iNGY6z1R8XtcZbJdd96vUr4yP neYMOMw+7cc/G1vjcVdKraDInzHbpDgfBp+q1uqaUKWETRLfEBSRjCrf/9jRnWxKJO6e i82f8AyMDeDK7HiOSrIRl5slCmkV9UB+R+UxrmAnIVtnQoUUZqy9+nYVdn4YwEUzbQft STZtvjxXCIcX81KfBTwEEBnj7+AIQxo95yYDRV+4IQ3/+fQCKMT0IbhmY4dde9oIoCJe WO1gly0NYceIRmcWnFUEVHgWtVUxPunSE089xAwD6RRQRBuglqeog/BR8qzjluMEnGjh 6fvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=9MTarLD/Pz82hkgDPc4VnnqjhN28FjyaD0E3mX82COU=; b=5ADu/VAm12DWetpOcbUWo/wAgXE99mZNAcwBTJDVzONb56pTUYWug3G6ChiqzJUFfp L/eWtFksNVItCp9j05D2vmvkMsCvYyIhCbA0CJBMhIbfKAoj6/gyP85zGepcNkYEijN6 K/y8N81v+4NksDg3V7glxAaG+fLcyV5aaKn6a2t0fEm9MjCvdDkeXqpQGdys6sqRdzt0 343+zeBfL1no6qv8RWoG9eVhTa01l6NzqSA/MPPJSGPwm7QAjV58UoJ36tAN6P1pusTx ufaQgEm6z0VKOxoloqmO+Kr9FMvqJueRx8iOy+mdK4hPN2L3t1YwcMQ7DwfmCjjXDVzS jySw== X-Gm-Message-State: ACgBeo3mRAGPWRo08OY6EpQrmKMsOsyiDPG4qv2cvepIYawY09p+SmAo c7sIbcglLfJCR0EVUlaYMnth6hIu2PYWGgrt2EZJzg== X-Received: by 2002:a63:e07:0:b0:429:8604:d9ad with SMTP id d7-20020a630e07000000b004298604d9admr31265919pgl.586.1663160051459; Wed, 14 Sep 2022 05:54:11 -0700 (PDT) MIME-Version: 1.0 References: <20220913174224.1399480-1-bryan.odonoghue@linaro.org> In-Reply-To: <20220913174224.1399480-1-bryan.odonoghue@linaro.org> From: Loic Poulain Date: Wed, 14 Sep 2022 14:53:35 +0200 Message-ID: Subject: Re: [PATCH] wcn36xx: Add RX frame SNR as a source of system entropy To: "Bryan O'Donoghue" Cc: kvalo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, "Jason A . Donenfeld" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Hi Bryan, On Tue, 13 Sept 2022 at 19:42, Bryan O'Donoghue wrote: > > The signal-to-noise-ratio of a received frame is a representation of noise > in a given received frame. > > RSSI - received signal strength indication can appear pretty static > frame-to-frame but noise will "bounce around" more depending on the EM > environment, temperature or placement of obstacles between the transmitter > and receiver. > > Other WiFi drivers offer up the noise component of the FFT as an entropy > source for the random pool i.e. > > Commit: 2aa56cca3571 ("ath9k: Mix the received FFT bins to the random pool") > > I attended Jason's talk on sources of randomness at Plumbers and it occured > to me that SNR is a reasonable candidate to add. > > Cc: Jason A. Donenfeld > Signed-off-by: Bryan O'Donoghue > --- > drivers/net/wireless/ath/wcn36xx/txrx.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.c b/drivers/net/wireless/ath/wcn36xx/txrx.c > index 8da3955995b6e..f3b77d7ffebe4 100644 > --- a/drivers/net/wireless/ath/wcn36xx/txrx.c > +++ b/drivers/net/wireless/ath/wcn36xx/txrx.c > @@ -16,6 +16,7 @@ > > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > > +#include > #include "txrx.h" > > static inline int get_rssi0(struct wcn36xx_rx_bd *bd) > @@ -297,6 +298,8 @@ static void wcn36xx_update_survey(struct wcn36xx *wcn, int rssi, int snr, > wcn->chan_survey[idx].rssi = rssi; > wcn->chan_survey[idx].snr = snr; > spin_unlock(&wcn->survey_lock); > + > + add_device_randomness(&snr, sizeof(int)); We store the SNR in an integer, but isn't it reported as u8 (or s8) by the firmware? So maybe we should just inject the LSByte since the upper ones will always be 0? > } > > int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb) > -- > 2.37.3 >