Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1562698pxf; Fri, 19 Mar 2021 09:51:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7ZMAmQfuI6b0zSo6v4mcaWlywuRVONPHggshHM9hYj/0ms/qRwvKwSC77y0v6TF/W2n3F X-Received: by 2002:a05:6402:42d1:: with SMTP id i17mr10350445edc.131.1616172686725; Fri, 19 Mar 2021 09:51:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616172686; cv=none; d=google.com; s=arc-20160816; b=oMUIRvxOOebsWljuWdYNdnZ92Kl70f+erwmMI9WN7bfm63IBNb5ABymb9dFa53g+Wu dH744TpDmIJCXQZ9iWCJ29Qn6XJsSQu4UghdhfydcoiObjz1PrSFcUWv0gpuTo451EHm CyXkfvkRN6s+Y9i10gyQ+mJoFDyhhg3gWFGKAB3cV2tSrRqCNlNMKWJn0da8vwIg8xUH 0PkkRLUvt3cY9DOfcYjJiLEXfebbxgkB+akI9CW88hf29nHjqzxBlkcs1zZaF2ipTzi6 kyiNV68Gn4yuI8NNVxS5m5EqQH4AXbjGRIuwdmfQ44nS0iFge5VW4MyYxdEEP5x0rO0Z 9iXA== 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=Su0be2rH9hYJQ3cvOyy8JiqmJDGZuMOWJ6ZV42oiItk=; b=gurttvqoSkIl9T1ISRmhSBT0BwW0PDsRUW48sqeceuq0qCJuotDhcY51GD6LfPc8Uk ez7RZzrWlJBK8eREU+PT+hEPOSVhf8ufKf7kAmViFcQXLS1jR0V/cqSAZML+/8JxaptY 55mMWzCn5I1rhmNMdrDCY5D8rVGnnC4AlsgzoLFFiRRqiQOdMnZj/4f2EjDfOkLx6RT9 4VMrkL/UIdc9IXswBXrrPwHCw/OY+eHCcRrtaZzmYLFmrFjJoANB3RcpshoJtR2I1Tf6 jmTODufK3ZAJfYvtH9jnug7MSLNfwrQmCJ7BJWnW8ySOZUyzbcajqCi5pfxnsUtjv+Yf 8oNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rw02qvBy; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id zj22si4741237ejb.289.2021.03.19.09.50.58; Fri, 19 Mar 2021 09:51:26 -0700 (PDT) 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=@linaro.org header.s=google header.b=Rw02qvBy; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229967AbhCSQuS (ORCPT + 99 others); Fri, 19 Mar 2021 12:50:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229960AbhCSQtu (ORCPT ); Fri, 19 Mar 2021 12:49:50 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6C33C06174A for ; Fri, 19 Mar 2021 09:49:50 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id cl21-20020a17090af695b02900c61ac0f0e9so8712816pjb.1 for ; Fri, 19 Mar 2021 09:49:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Su0be2rH9hYJQ3cvOyy8JiqmJDGZuMOWJ6ZV42oiItk=; b=Rw02qvByspBD4VytfFilcHO99dnfOpAbUYBBKixgsWm3YNFGAWUPCfry+2yLpWU0Fm AS9nqKQt7aXaX4WKh66pUPVcHdH3cdgtmpy81ljhSv0cn5mvklJJhAeyK+A0arsA8uaF 0Lvy5jxuJ9uYJ8PYlsc/APvS0Pke0zupG4TNklcYuZlLD8ZvokUYr1HpwvVD/uBvVtgG ZhMQGwxKIxkxeew0PN978Jzyo+Dup5zFE392cm2Gtb6MOkCWriizOt2x8pBhL+Tg89Lc nVjmPWvlUnp636gv9D1DaKPhzrZdhVfO6LkKu6nhWQfFtrdcmxDcxvgmyASsi0GSAzIr CsEg== 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=Su0be2rH9hYJQ3cvOyy8JiqmJDGZuMOWJ6ZV42oiItk=; b=lZE0n2F1wC9u7ViDNtnSRDSyDsaO53erhQeDGSaFN3FmecqP/kndmfPyG0t9c7VGLR UR70e0DEBPKmCZ21qaBRn8O0plabHlj1kbdRh2MU2+hY4X5Ms6+pDny/G0qtZ2FKLMaq xrgPzRejE4/PrTnoVEt2krpWRE5Vp+Y7N5KfG+8ReHOeC+WdZwCGF+IKNqLo8teLSTcW REsCT/cSZiN/6mzgOrRB4dEYJHGiAnf4kQ5VjQrf77BeBbY6L+SzPRr86lLsfbMkMLHV 6Q75glceWpTyMrJTQSWKg9o6QtNigC/CmldFCs6q3UueXqp8vL3lKJpSoKqVDy3T+St/ CNXg== X-Gm-Message-State: AOAM531xqCsg3E4vxGHU/G9t/tBIUW+sANIYJsSGp3R2K2TkOesuyYW4 CdkwA5h9cE4T+el+7XBti8/Ire5UQ13EB7CSo9bmhw== X-Received: by 2002:a17:902:7287:b029:e5:bd05:4a97 with SMTP id d7-20020a1709027287b02900e5bd054a97mr14884682pll.27.1616172590069; Fri, 19 Mar 2021 09:49:50 -0700 (PDT) MIME-Version: 1.0 References: <20210319161520.3590510-1-bryan.odonoghue@linaro.org> <20210319161520.3590510-3-bryan.odonoghue@linaro.org> In-Reply-To: <20210319161520.3590510-3-bryan.odonoghue@linaro.org> From: Loic Poulain Date: Fri, 19 Mar 2021 17:57:51 +0100 Message-ID: Subject: Re: [PATCH v3 02/12] wcn36xx: Run suspend for the first ieee80211_vif To: "Bryan O'Donoghue" Cc: Kalle Valo , wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org, Shawn Guo , Benjamin Li , Bjorn Andersson Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Fri, 19 Mar 2021 at 17:13, Bryan O'Donoghue wrote: > > A subsequent set of patches will extend out suspend/resume support in this > driver, we cannot set the firmware up for multiple ipv4/ipv6 addresses and > as such we can't iterate through a list of ieee80211_vif. You mean connection can only be maintained (offloaded) in suspend for only one vif? If so maybe what you want to retrieve is the first client-associated vif and not the first vif. > > Constrain the interaction with the firmware to the first ieee80211_vif on > the suspend/resume/wowlan path. > > Signed-off-by: Bryan O'Donoghue > --- > drivers/net/wireless/ath/wcn36xx/main.c | 43 +++++++++++++++++++++++-- > 1 file changed, 40 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c > index b361e40697a6..c0c1ea18864f 100644 > --- a/drivers/net/wireless/ath/wcn36xx/main.c > +++ b/drivers/net/wireless/ath/wcn36xx/main.c > @@ -1088,15 +1088,39 @@ static int wcn36xx_sta_remove(struct ieee80211_hw *hw, > > #ifdef CONFIG_PM > > +struct ieee80211_vif *wcn36xx_get_first_vif(struct wcn36xx *wcn) > +{ > + struct wcn36xx_vif *tmp; > + struct ieee80211_vif *vif = NULL; > + > + list_for_each_entry(tmp, &wcn->vif_list, list) { > + vif = wcn36xx_priv_to_vif(tmp); > + if (vif) > + break; > + } > + return vif; > +} > + > static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) > { > struct wcn36xx *wcn = hw->priv; > - int ret; > + struct ieee80211_vif *vif = NULL; > + struct wcn36xx_vif *vif_priv = NULL; > + int ret = 0; > > wcn36xx_dbg(WCN36XX_DBG_MAC, "mac suspend\n"); > > flush_workqueue(wcn->hal_ind_wq); > - ret = wcn36xx_smd_set_power_params(wcn, true); > + mutex_lock(&wcn->conf_mutex); > + vif = wcn36xx_get_first_vif(wcn); > + if (vif) { > + vif_priv = wcn36xx_vif_to_priv(vif); > + if (!vif_priv->sta_assoc) > + goto out; > + ret = wcn36xx_smd_set_power_params(wcn, true); > + } > +out: > + mutex_unlock(&wcn->conf_mutex); > > return ret; > } > @@ -1104,11 +1128,24 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) > static int wcn36xx_resume(struct ieee80211_hw *hw) > { > struct wcn36xx *wcn = hw->priv; > + struct ieee80211_vif *vif = NULL; > + struct wcn36xx_vif *vif_priv = NULL; > > wcn36xx_dbg(WCN36XX_DBG_MAC, "mac resume\n"); > > flush_workqueue(wcn->hal_ind_wq); > - wcn36xx_smd_set_power_params(wcn, false); > + mutex_lock(&wcn->conf_mutex); > + vif = wcn36xx_get_first_vif(wcn); > + if (vif) { > + vif_priv = wcn36xx_vif_to_priv(vif); > + if (!vif_priv->sta_assoc) > + goto out; > + > + wcn36xx_smd_set_power_params(wcn, false); > + } > +out: > + mutex_unlock(&wcn->conf_mutex); > + > return 0; > } > > -- > 2.30.1 >