From owner-svn-src-all@freebsd.org Tue Apr 26 06:27:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB1E8B1D331; Tue, 26 Apr 2016 06:27:28 +0000 (UTC) (envelope-from andriyvos@gmail.com) Received: from mail-lf0-f67.google.com (mail-lf0-f67.google.com [209.85.215.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6C3DA186F; Tue, 26 Apr 2016 06:27:27 +0000 (UTC) (envelope-from andriyvos@gmail.com) Received: by mail-lf0-f67.google.com with SMTP id p64so758837lfg.0; Mon, 25 Apr 2016 23:27:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=4kWN1lS7ihjAQSFlbtJzeC1XtI9ATejUTbSJuAD7xRI=; b=RbmxfdEQ14i8j7g5YDEPlJA+hOuLiSLSGYYEawxsrQ7mBsqliHI2w06+J2F0Du/xtm uJ2Ys2nuzHN3buAS8NEmc9genhHWB8wjKaBl6WzbQNS0GUq8YLRKnKNBT8lb+cyB6o3R MD0ssfIoIqYyuMp1/XsVl1Q812CeRbFr3FKWYB2RVCQIYskRXCQ9qyf5N6DY5aHuEex6 o2LpI9/U9akGEOXoQo4K+qDiyrE/PbMENB7yZweG0gAsy50OTw0Z0KVp7d4q1kdCboha 9biaclZqJ1X0y5ULUBF5zPOO5FPfTyaWOx54W9Wwhc4fmqQTDpfpppHsoQlqG+yDo7rJ BLSg== X-Gm-Message-State: AOPr4FU1KPzZy/W0LB8tIsqLpmiVWOOfTylgetFKDc2LONCDNpnxgI7a+by5FApGD8VpUQ== X-Received: by 10.25.212.82 with SMTP id l79mr428525lfg.72.1461652040517; Mon, 25 Apr 2016 23:27:20 -0700 (PDT) Received: from localhost (host-176-37-109-22.la.net.ua. [176.37.109.22]) by smtp.gmail.com with ESMTPSA id xg1sm5044258lbb.10.2016.04.25.23.27.19 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 25 Apr 2016 23:27:19 -0700 (PDT) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "Adrian Chadd" , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r298612 - head/sys/dev/iwm References: <201604260440.u3Q4exZD045896@repo.freebsd.org> Date: Tue, 26 Apr 2016 09:27:12 +0300 MIME-Version: 1.0 Content-Transfer-Encoding: Quoted-Printable From: "Andriy Voskoboinyk" Message-ID: In-Reply-To: <201604260440.u3Q4exZD045896@repo.freebsd.org> User-Agent: Opera Mail/12.16 (FreeBSD) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 06:27:29 -0000 Tue, 26 Apr 2016 07:40:59 +0300 =D0=B1=D1=83=D0=BB=D0=BE =D0=BD=D0=B0=D0= =BF=D0=B8=D1=81=D0=B0=D0=BD=D0=BE Adrian Chadd = : > Author: adrian > Date: Tue Apr 26 04:40:59 2016 > New Revision: 298612 > URL: https://svnweb.freebsd.org/changeset/base/298612 > > Log: > [iwm] implement suspend/resume through ieee80211_{suspend,resume}_al= l > This allows wifi to associate correctly after a suspend/resume cycle.= > Yes, I'm using this now day to day. > Tested: > * Intel 7260AC, STA mode > > Modified: > head/sys/dev/iwm/if_iwm.c > head/sys/dev/iwm/if_iwmvar.h > > Modified: head/sys/dev/iwm/if_iwm.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- head/sys/dev/iwm/if_iwm.c Tue Apr 26 03:24:28 2016 (r298611) > +++ head/sys/dev/iwm/if_iwm.c Tue Apr 26 04:40:59 2016 (r298612) > @@ -4934,6 +4934,8 @@ iwm_init_task(void *arg1) > static int > iwm_resume(device_t dev) > { > + struct iwm_softc *sc =3D device_get_softc(dev); > + int do_reinit =3D 0; > uint16_t reg; > /* Clear device-specific "PCI retry timeout" register (41h). */ > @@ -4941,17 +4943,33 @@ iwm_resume(device_t dev) > pci_write_config(dev, 0x40, reg & ~0xff00, sizeof(reg)); > iwm_init_task(device_get_softc(dev)); > + IWM_LOCK(sc); > + if (sc->sc_flags & IWM_FLAG_DORESUME) { > + sc->sc_flags &=3D ~IWM_FLAG_DORESUME; > + do_reinit =3D 1; If no vap was running, then nothing will be started (because of IEEE80211_FEXT_RESUME flag). > + } > + IWM_UNLOCK(sc); > + > + if (do_reinit) > + ieee80211_resume_all(&sc->sc_ic); AFAIK, suspend_all() / resume_all() should work without any additional logic (except (?) device-specific PCI registers (41h) pre-setup on resume). > + > return 0; > } > static int > iwm_suspend(device_t dev) > { > + int do_stop =3D 0; > struct iwm_softc *sc =3D device_get_softc(dev); > - if (sc->sc_ic.ic_nrunning > 0) { > + do_stop =3D !! (sc->sc_ic.ic_nrunning > 0); > + > + ieee80211_suspend_all(&sc->sc_ic); > + > + if (do_stop) { > IWM_LOCK(sc); > iwm_stop(sc); Is it really needed? (iwm_stop() will be already executed when the last = vap will be stopped + suspend_resume() waits for ic_parent method). > + sc->sc_flags |=3D IWM_FLAG_DORESUME; > IWM_UNLOCK(sc); > } > > Modified: head/sys/dev/iwm/if_iwmvar.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- head/sys/dev/iwm/if_iwmvar.h Tue Apr 26 03:24:28 2016 (r298611) > +++ head/sys/dev/iwm/if_iwmvar.h Tue Apr 26 04:40:59 2016 (r298612) > @@ -405,6 +405,7 @@ struct iwm_softc { > #define IWM_FLAG_STOPPED (1 << 2) > #define IWM_FLAG_RFKILL (1 << 3) > #define IWM_FLAG_BUSY (1 << 4) > +#define IWM_FLAG_DORESUME (1 << 5) > struct intr_config_hook sc_preinit_hook; > struct callout sc_watchdog_to;