From owner-freebsd-wireless@freebsd.org Mon Nov 13 16:59:24 2017 Return-Path: Delivered-To: freebsd-wireless@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 014EEDBF360 for ; Mon, 13 Nov 2017 16:59:24 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wr0-x22f.google.com (mail-wr0-x22f.google.com [IPv6:2a00:1450:400c:c0c::22f]) (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 89A1A750D0 for ; Mon, 13 Nov 2017 16:59:23 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wr0-x22f.google.com with SMTP id k61so15019414wrc.4 for ; Mon, 13 Nov 2017 08:59:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=u/WhS//Lw4zyUzi4oZCIBbP5W2pjgNseRATrAVFHnjM=; b=gDGboosVoqv4pbgmL5I19NE3c1RIhOrZizp/doprM51rJzDSQWUr/bedlgY0vyvT+z 9h10e8IA+enSfdLx9ZjOk+2CbrRKfbbeQnDCJhW7CuAbLmzXQh0E2MtNnOQT+FJ9BKpd OU9yLmOquH4eeEsPwQgR6t2fO199/+EYyNUrc/vCa48dUByFizrfJQhZwB8ACv4/cdin pSFWzZJ3hfF3a2xafdKuzPBGGXJ6DQYORA5TZwbvAm0g2lRaVQOtGm+4BoCUeKfIIzFd ajaMFJLHIH3PrW2yy2Nsd83Hbug5lSCrM6/AXuZc0vyaNrZO9qlUQxTgyfVyDbwSLoY/ FvkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=u/WhS//Lw4zyUzi4oZCIBbP5W2pjgNseRATrAVFHnjM=; b=rv11bHJ7dCrZf+NHxR414kvej56AGw71p2WpWNkJ6ilWntHWH0EVyFZLWZrTpIcMKu Ob2lpMywC7BMG1UQQAMoe7cgPMd37dxJGoxkit3iPfm9V8Sbo+H5zPNTsU7uCx6r5C6V YcO09Gx758+xAppRIkMaOHUDesP7RSRBnaTBe5QwyZA0tkmrDAW6C7EWVdxmcGrFsExn X2hJtS0sSARwdNbug1N3IVGfCuHXtHb1CwQWrhWSd3B+UuvBTHOTYOuIJxLRcVXy/RWL 8tOd9JX/OtkbIfTs1EpzRAmtogFn4usj4bPIFhWAgVTlYcjTqyL+IIVUIvzBgEQq+1uN fqMg== X-Gm-Message-State: AJaThX4bHyJmO7UseciGfQjtZKIoJFyKLjUjUb5YdJGUkXwF4xBfGGBu R/FwSevwwagl1fgiUM0Bl+RgEX1lFtTGD7URUQD5ng== X-Google-Smtp-Source: AGs4zMbZ5sjDdDTvXjYKrFrxCYB/OKD5lmRBwjMOUZwOjfTtK0o1SnP6Y/4ZojTibjx+iohGREp9Jv7wlIVNSceT4a4= X-Received: by 10.223.179.194 with SMTP id x2mr8102671wrd.266.1510592361622; Mon, 13 Nov 2017 08:59:21 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.46.209 with HTTP; Mon, 13 Nov 2017 08:59:20 -0800 (PST) In-Reply-To: References: From: Adrian Chadd Date: Mon, 13 Nov 2017 08:59:20 -0800 Message-ID: Subject: Re: ieee80211 scan function starting point To: Farhan Khan Cc: "freebsd-wireless@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Nov 2017 16:59:24 -0000 hi! So, the scan portion works a couple ways. Firstly, the interface moves to mode IEEE80211_S_SCAN . That's when it's looking for networks to connect to. Secondly, it marks a FEXT or a normal flag SCAN, which says "i'm doing scanning as well as normal receive." Think of this for example like doing a background scan whilst doing traffic. The routines in ieee80211_scan.c and ieee80211_scan_sw.c and ieee80211_scan_sta.c take care of starting the scan, changing channels if needed, etc. There are two paths here. ieee80211_scan_sw.c implements the net80211 controlled scanner. This schedules channel changes, background scanning, etc. Most drivers do this. Drivers that implement scanning in the driver/firmware instead tie into the scan routines and will start their own scans. rsu, iwm, iwn do this - they send a scan command to the firmware. It doesn't require normal traffic to be stopped; the firmware takes care of scheduling when to do scanning and when to do data! Then there's two paths into populating the scan cache. One - the device (eg almost everything) just pass up received beacons in scan mode. ieee80211_input_sta() will filter out the relevant beacon frames. Look at sta_recv_mgmt(), SUBTYPE_BEACON, it'll eventually end up at ieee80211_add_scan() . Two - intelligent devices can populate the scan cache directly. I think if_ndis does this (via a call to ieee80211_add_scan()). Everything else so far returns beacon frames as RX frames when scanning. So, that's why I said "do monitor mode first." Ideally you'd like to get monitor mode RX working first. Once you get beacons showing up in an 802.11 tcpdump you know you're ready for doing STA mode (and transmit!). -adrian On 13 November 2017 at 08:40, Farhan Khan wrote: > Hi all, > > I am trying to get the "ifconfig wlan0 list scan" command to display local > access points. I am fairly certain I have the "up" part working (loading > firmware, turning it on) but the scan portion does not yet. > > I am trying to identify what functions I might have missed with dtrace, but > I do not know where to start off and the probes are too rapid to identify > where it starts when I run the "ifconfig" command. I am fairly certain it > originates in ieee80211 and kicks that off to the driver, but I cannot > easily identify where. > > Does anyone know where? Thank you. > > Farhan > _______________________________________________ > freebsd-wireless@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-wireless > To unsubscribe, send any mail to "freebsd-wireless-unsubscribe@freebsd.org"