From owner-freebsd-arm@FreeBSD.ORG Fri Jun 14 08:33:54 2013 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 44D8D710; Fri, 14 Jun 2013 08:33:54 +0000 (UTC) (envelope-from Daan@vitsch.nl) Received: from Prakkezator.VEHosting.nl (Prakkezator6.VEHosting.nl [IPv6:2001:1af8:2100:b020::142]) by mx1.freebsd.org (Postfix) with ESMTP id A3EE51BFA; Fri, 14 Jun 2013 08:33:53 +0000 (UTC) Received: from [192.168.72.13] (124-54.bbned.dsl.internl.net [92.254.54.124]) (authenticated bits=0) by Prakkezator.VEHosting.nl (8.14.2/8.14.2) with ESMTP id r5E8XpLF049264; Fri, 14 Jun 2013 10:33:52 +0200 (CEST) (envelope-from Daan@vitsch.nl) From: Daan Vreeken Organization: Daan - Vitsch Electronics To: Guillaume Bibaut Subject: Re: arm/179532: wireless networking on ARM Date: Fri, 14 Jun 2013 10:33:51 +0200 User-Agent: KMail/1.9.10 References: <201306130940.r5d9eifx089862@oldred.freebsd.org> <1371196987-2949510516.e283d0d65b@bliksem.vehosting.nl> <201306141002.54857.Daan@vitsch.nl> In-Reply-To: <201306141002.54857.Daan@vitsch.nl> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_vVtuRrItZym7Bc8" Message-Id: <201306141033.51933.Daan@vitsch.nl> x-ve-auth-version: mi-1.1.7 2011-02-21 - Copyright (c) 2008, 2011 - Daan Vreeken - VEHosting x-ve-auth: authenticated as 'pa4dan' on Prakkezator.VEHosting.nl Cc: freebsd-arm@freebsd.org, freebsd-gnats-submit@freebsd.org X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 08:33:54 -0000 --Boundary-00=_vVtuRrItZym7Bc8 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi again, On Friday 14 June 2013 10:02:54 Daan Vreeken wrote: > Hi Guillaume, > > On Thursday 13 June 2013 11:40:44 Guillaume Bibaut wrote: > > >Number: 179532 > > >Category: arm > > >Synopsis: wireless networking on ARM ... > > >Description: > > > > FreeBSD is crashing when wpa_supplicant is called upon boot on the Genesi > > Efika MX smartbook. ... > I think we might have hit this same bug at work and have a local patch that > fixes it. I'll see if I can dust it off and post a patch here. I believe it > was only a 3-line patch to if_run.c See the attachments. These patches fix two bugs: o A crash in if_run when using VNET in the kernel. o The correctness of the information passed to the radiotap code in if_run. I think the last patch may fix the crash you are seeing with if_run and wpa_supplicant. If you only want to test that part, you just have to patch if_run.c with the file 'if_run_2013_01_19_radiotap_fix_only.diff' . In case the attachments get mangled in the email, you can also download these files from : http://www.vitsch.nl/pub_diffs/ The following files should be attached to this email : if_run_2013_01_19_radiotap_fix_only.diff if_run_2013_01_19_vnet_fix.diff if_run_2013_01_19_vnet_plus_radiotap_fix.diff All patches are: Sponsored by: Vitsch Electronics Regards, -- Ing. Daan Vreeken Vitsch Electronics http://Vitsch.nl/ http://VitschVPN.nl/ tel: +31-(0)40-7113051 KvK nr: 17174380 -- Machines en netwerken op afstand beheren? Vitsch VPN oplossing! Kijk voor meer informatie op: http://www.VitschVPN.nl/ --Boundary-00=_vVtuRrItZym7Bc8 Content-Type: text/x-diff; charset="iso-8859-1"; name="if_run_2013_01_19_radiotap_fix_only.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="if_run_2013_01_19_radiotap_fix_only.diff" --- if_run.c.fix2_vnet_plus_radiotap 2013-06-14 10:15:34.890774314 +0200 +++ if_run.c.fix1_vnet 2013-06-14 10:12:49.786774072 +0200 @@ -2536,10 +2536,13 @@ m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = len; - /* - * DAAN: fill-in tap header BEFORE calling ieee80211_input*() so the - * user will see the actual data that belongs to THIS packet.. - */ + if (ni != NULL) { + (void)ieee80211_input(ni, m, rssi, nf); + ieee80211_free_node(ni); + } else { + (void)ieee80211_input_all(ic, m, rssi, nf); + } + if (__predict_false(ieee80211_radiotap_active(ic))) { struct run_rx_radiotap_header *tap = &sc->sc_rxtap; @@ -2576,13 +2579,6 @@ break; } } - - if (ni != NULL) { - (void)ieee80211_input(ni, m, rssi, nf); - ieee80211_free_node(ni); - } else { - (void)ieee80211_input_all(ic, m, rssi, nf); - } } static void --Boundary-00=_vVtuRrItZym7Bc8 Content-Type: text/x-diff; charset="iso 8859-15"; name="if_run_2013_01_19_vnet_fix.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="if_run_2013_01_19_vnet_fix.diff" Index: if_run.c =================================================================== --- if_run.c (revision 251736) +++ if_run.c (working copy) @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -606,9 +607,12 @@ RUN_UNLOCK(sc); + CURVNET_SET(vnet0); + ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); if (ifp == NULL) { device_printf(sc->sc_dev, "can not if_alloc()\n"); + CURVNET_RESTORE(); goto detach; } ic = ifp->if_l2com; @@ -702,6 +706,8 @@ if (bootverbose) ieee80211_announce(ic); + CURVNET_RESTORE(); + return (0); detach: @@ -739,8 +745,10 @@ usb_callout_drain(&sc->ratectl_ch); ieee80211_draintask(ic, &sc->cmdq_task); ieee80211_draintask(ic, &sc->ratectl_task); + CURVNET_SET(ifp->if_vnet); ieee80211_ifdetach(ic); if_free(ifp); + CURVNET_RESTORE(); } mtx_destroy(&sc->sc_mtx); --Boundary-00=_vVtuRrItZym7Bc8 Content-Type: text/x-diff; charset="iso 8859-15"; name="if_run_2013_01_19_vnet_plus_radiotap_fix.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="if_run_2013_01_19_vnet_plus_radiotap_fix.diff" Index: if_run.c =================================================================== --- if_run.c (revision 251736) +++ if_run.c (working copy) @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -606,9 +607,12 @@ RUN_UNLOCK(sc); + CURVNET_SET(vnet0); + ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); if (ifp == NULL) { device_printf(sc->sc_dev, "can not if_alloc()\n"); + CURVNET_RESTORE(); goto detach; } ic = ifp->if_l2com; @@ -702,6 +706,8 @@ if (bootverbose) ieee80211_announce(ic); + CURVNET_RESTORE(); + return (0); detach: @@ -739,8 +745,10 @@ usb_callout_drain(&sc->ratectl_ch); ieee80211_draintask(ic, &sc->cmdq_task); ieee80211_draintask(ic, &sc->ratectl_task); + CURVNET_SET(ifp->if_vnet); ieee80211_ifdetach(ic); if_free(ifp); + CURVNET_RESTORE(); } mtx_destroy(&sc->sc_mtx); @@ -2528,13 +2536,10 @@ m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = len; - if (ni != NULL) { - (void)ieee80211_input(ni, m, rssi, nf); - ieee80211_free_node(ni); - } else { - (void)ieee80211_input_all(ic, m, rssi, nf); - } - + /* + * DAAN: fill-in tap header BEFORE calling ieee80211_input*() so the + * user will see the actual data that belongs to THIS packet.. + */ if (__predict_false(ieee80211_radiotap_active(ic))) { struct run_rx_radiotap_header *tap = &sc->sc_rxtap; @@ -2571,6 +2576,13 @@ break; } } + + if (ni != NULL) { + (void)ieee80211_input(ni, m, rssi, nf); + ieee80211_free_node(ni); + } else { + (void)ieee80211_input_all(ic, m, rssi, nf); + } } static void --Boundary-00=_vVtuRrItZym7Bc8--