Re: svn commit: r269127 - head/sys/dev/usb/wlan
On 07/27/14 22:15, Adrian Chadd wrote: Ok. So, which one of those is showing up as 0? Hi, I think it is the last one. I cannot test this again until later this year, because I don't have access to the AP which is causing this :-( Is it possible you can add a function to the net80211 stack, which gets the rate from the ni in a safe manner? --HPS ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r269127 - head/sys/dev/usb/wlan
On 28 July 2014 13:50, Hans Petter Selasky h...@selasky.org wrote: On 07/27/14 22:15, Adrian Chadd wrote: Ok. So, which one of those is showing up as 0? Hi, I think it is the last one. I cannot test this again until later this year, because I don't have access to the AP which is causing this :-( Is it possible you can add a function to the net80211 stack, which gets the rate from the ni in a safe manner? The whole rate control thing from net80211 has to be upgraded. Drivers shouldn't be using ni-ni_txrate for anything other than informational purposes, yet .. well, that's not the case. -a ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r269127 - head/sys/dev/usb/wlan
On 07/28/14 22:52, Adrian Chadd wrote: The whole rate control thing from net80211 has to be upgraded. Drivers shouldn't be using ni-ni_txrate for anything other than informational purposes, yet .. well, that's not the case. Hi, Should the rate be extracted from the NET80211 header instead, and if yes, how? --HPS ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r269127 - head/sys/dev/usb/wlan
On 28 July 2014 14:05, Hans Petter Selasky h...@selasky.org wrote: On 07/28/14 22:52, Adrian Chadd wrote: The whole rate control thing from net80211 has to be upgraded. Drivers shouldn't be using ni-ni_txrate for anything other than informational purposes, yet .. well, that's not the case. Hi, Should the rate be extracted from the NET80211 header instead, and if yes, how? It's a little more complicated than that. The problem is that in an SMP world, ni_txrate can change at any point due to decisions made in other threads. So for control lookups, it can't just be some thing in the struct, it has to be something serialised behind locks. Ideally the ratectl API stuff will be extended to return a list of rates to use and _that_ function can do the sanity checking and locking and such. It's just unfortunate that the ni_txrate stuff was used in a lot of wifi drivers. :( -a ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r269127 - head/sys/dev/usb/wlan
On 07/27/14 02:10, Adrian Chadd wrote: On 26 July 2014 12:13, Hans Petter Selasky h...@selasky.org wrote: On 07/26/14 20:36, Adrian Chadd wrote: Hi, We should likely review how the PLCP bits are being used and why it's getting a rate of 0 in the first place. So, why's it getting a rate of 0 passed into the transmit path? Hi Adrian, Here is the backtrace of the panic: Fatal trap 18: integer divide fault while in kernel mode cpuid = 2; apic id = 02 instruction pointer = 0x20:0x807826cf stack pointer = 0x28:0xff8000305090 frame pointer = 0x28:0xff80003050a0 code segment= base 0x0, limit 0xf, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags= interrupt enabled, resume, IOPL = 0 current process = 15 (usbus0) trap number = 18 panic: integer divide fault cpuid = 2 KDB: stack backtrace: #0 0x809257e6 at kdb_backtrace+0x66 #1 0x808eb3ae at panic+0x1ce #2 0x80cd2c30 at trap_fatal+0x290 #3 0x80cd3480 at trap+0x250 #4 0x80cbc783 at calltrap+0x8 #5 0x80783d90 at ural_start+0x1d0 #6 0x809aa2ea at if_transmit+0xea #7 0x809ef7b2 at ieee80211_start+0x542 #8 0x809aa2ea at if_transmit+0xea #9 0x809ae8b3 at ether_output_frame+0x33 #10 0x809aee30 at ether_output+0x530 #11 0x80a186b4 at ip_output+0xd74 #12 0x80a87d2a at tcp_output+0xfea #13 0x80a8 at tcp_do_segment+0xc02 #14 0x80a85219 at tcp_input+0xa29 #15 0x80a155fa at ip_input+0xaa #16 0x809b7808 at netisr_dispatch_src+0x218 #17 0x809ae3fd at ether_demux+0x14d Hm, so at some point that rate was not assigned to something. Can you trace the ural_start path to see where it's supposed to be calculating the rate? Rate comes from this: tp = vap-iv_txparms[ieee80211_chan2mode(ni-ni_chan)]; if (IEEE80211_IS_MULTICAST(wh-i_addr1)) rate = tp-mcastrate; else if (tp-ucastrate != IEEE80211_FIXED_RATE_NONE) rate = tp-ucastrate; else rate = ni-ni_txrate; --HPS ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r269127 - head/sys/dev/usb/wlan
Hi, Ok. So, which one of those is showing up as 0? Maybe refactor out the rate lookup code and if it's zero, log an error and reset it to either 2 (for 11ng) or 12 (11a.) '2' isn't valid for 11a - the minimum rate is 6mb. -a On 27 July 2014 13:11, Hans Petter Selasky h...@selasky.org wrote: On 07/27/14 02:10, Adrian Chadd wrote: On 26 July 2014 12:13, Hans Petter Selasky h...@selasky.org wrote: On 07/26/14 20:36, Adrian Chadd wrote: Hi, We should likely review how the PLCP bits are being used and why it's getting a rate of 0 in the first place. So, why's it getting a rate of 0 passed into the transmit path? Hi Adrian, Here is the backtrace of the panic: Fatal trap 18: integer divide fault while in kernel mode cpuid = 2; apic id = 02 instruction pointer = 0x20:0x807826cf stack pointer = 0x28:0xff8000305090 frame pointer = 0x28:0xff80003050a0 code segment= base 0x0, limit 0xf, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags= interrupt enabled, resume, IOPL = 0 current process = 15 (usbus0) trap number = 18 panic: integer divide fault cpuid = 2 KDB: stack backtrace: #0 0x809257e6 at kdb_backtrace+0x66 #1 0x808eb3ae at panic+0x1ce #2 0x80cd2c30 at trap_fatal+0x290 #3 0x80cd3480 at trap+0x250 #4 0x80cbc783 at calltrap+0x8 #5 0x80783d90 at ural_start+0x1d0 #6 0x809aa2ea at if_transmit+0xea #7 0x809ef7b2 at ieee80211_start+0x542 #8 0x809aa2ea at if_transmit+0xea #9 0x809ae8b3 at ether_output_frame+0x33 #10 0x809aee30 at ether_output+0x530 #11 0x80a186b4 at ip_output+0xd74 #12 0x80a87d2a at tcp_output+0xfea #13 0x80a8 at tcp_do_segment+0xc02 #14 0x80a85219 at tcp_input+0xa29 #15 0x80a155fa at ip_input+0xaa #16 0x809b7808 at netisr_dispatch_src+0x218 #17 0x809ae3fd at ether_demux+0x14d Hm, so at some point that rate was not assigned to something. Can you trace the ural_start path to see where it's supposed to be calculating the rate? Rate comes from this: tp = vap-iv_txparms[ieee80211_chan2mode(ni-ni_chan)]; if (IEEE80211_IS_MULTICAST(wh-i_addr1)) rate = tp-mcastrate; else if (tp-ucastrate != IEEE80211_FIXED_RATE_NONE) rate = tp-ucastrate; else rate = ni-ni_txrate; --HPS ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r269127 - head/sys/dev/usb/wlan
Author: hselasky Date: Sat Jul 26 16:06:01 2014 New Revision: 269127 URL: http://svnweb.freebsd.org/changeset/base/269127 Log: Fix for division by zero. MFC after:3 days Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_ural.c head/sys/dev/usb/wlan/if_zyd.c head/sys/dev/usb/wlan/if_zydreg.h Modified: head/sys/dev/usb/wlan/if_rum.c == --- head/sys/dev/usb/wlan/if_rum.c Sat Jul 26 15:46:41 2014 (r269126) +++ head/sys/dev/usb/wlan/if_rum.c Sat Jul 26 16:06:01 2014 (r269127) @@ -1035,6 +1035,8 @@ rum_setup_tx_desc(struct rum_softc *sc, desc-plcp_length_hi = plcp_length 6; desc-plcp_length_lo = plcp_length 0x3f; } else { + if (rate == 0) + rate = 2; /* avoid division by zero */ plcp_length = (16 * len + rate - 1) / rate; if (rate == 22) { remainder = (16 * len) % 22; Modified: head/sys/dev/usb/wlan/if_ural.c == --- head/sys/dev/usb/wlan/if_ural.c Sat Jul 26 15:46:41 2014 (r269126) +++ head/sys/dev/usb/wlan/if_ural.c Sat Jul 26 16:06:01 2014 (r269127) @@ -1038,6 +1038,8 @@ ural_setup_tx_desc(struct ural_softc *sc desc-plcp_length_hi = plcp_length 6; desc-plcp_length_lo = plcp_length 0x3f; } else { + if (rate == 0) + rate = 2; /* avoid division by zero */ plcp_length = (16 * len + rate - 1) / rate; if (rate == 22) { remainder = (16 * len) % 22; Modified: head/sys/dev/usb/wlan/if_zyd.c == --- head/sys/dev/usb/wlan/if_zyd.c Sat Jul 26 15:46:41 2014 (r269126) +++ head/sys/dev/usb/wlan/if_zyd.c Sat Jul 26 16:06:01 2014 (r269127) @@ -2480,7 +2480,7 @@ zyd_tx_start(struct zyd_softc *sc, struc const struct ieee80211_txparam *tp; struct ieee80211_key *k; int rate, totlen; - static uint8_t ratediv[] = ZYD_TX_RATEDIV; + static const uint8_t ratediv[] = ZYD_TX_RATEDIV; uint8_t phy; uint16_t pktlen; uint32_t bits; Modified: head/sys/dev/usb/wlan/if_zydreg.h == --- head/sys/dev/usb/wlan/if_zydreg.h Sat Jul 26 15:46:41 2014 (r269126) +++ head/sys/dev/usb/wlan/if_zydreg.h Sat Jul 26 16:06:01 2014 (r269127) @@ -970,7 +970,7 @@ #defineZYD_TX_RATEDIV \ { \ - 0x1, 0x2, 0xb, 0xb, 0x0, 0x0, 0x0, 0x0, 0x30, 0x18, 0xc, 0x6, \ + 0x1, 0x2, 0xb, 0xb, 0x1, 0x1, 0x1, 0x1, 0x30, 0x18, 0xc, 0x6, \ 0x36, 0x24, 0x12, 0x9 \ } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r269127 - head/sys/dev/usb/wlan
Hi, We should likely review how the PLCP bits are being used and why it's getting a rate of 0 in the first place. So, why's it getting a rate of 0 passed into the transmit path? -a On 26 July 2014 09:06, Hans Petter Selasky hsela...@freebsd.org wrote: Author: hselasky Date: Sat Jul 26 16:06:01 2014 New Revision: 269127 URL: http://svnweb.freebsd.org/changeset/base/269127 Log: Fix for division by zero. MFC after:3 days Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_ural.c head/sys/dev/usb/wlan/if_zyd.c head/sys/dev/usb/wlan/if_zydreg.h Modified: head/sys/dev/usb/wlan/if_rum.c == --- head/sys/dev/usb/wlan/if_rum.c Sat Jul 26 15:46:41 2014 (r269126) +++ head/sys/dev/usb/wlan/if_rum.c Sat Jul 26 16:06:01 2014 (r269127) @@ -1035,6 +1035,8 @@ rum_setup_tx_desc(struct rum_softc *sc, desc-plcp_length_hi = plcp_length 6; desc-plcp_length_lo = plcp_length 0x3f; } else { + if (rate == 0) + rate = 2; /* avoid division by zero */ plcp_length = (16 * len + rate - 1) / rate; if (rate == 22) { remainder = (16 * len) % 22; Modified: head/sys/dev/usb/wlan/if_ural.c == --- head/sys/dev/usb/wlan/if_ural.c Sat Jul 26 15:46:41 2014 (r269126) +++ head/sys/dev/usb/wlan/if_ural.c Sat Jul 26 16:06:01 2014 (r269127) @@ -1038,6 +1038,8 @@ ural_setup_tx_desc(struct ural_softc *sc desc-plcp_length_hi = plcp_length 6; desc-plcp_length_lo = plcp_length 0x3f; } else { + if (rate == 0) + rate = 2; /* avoid division by zero */ plcp_length = (16 * len + rate - 1) / rate; if (rate == 22) { remainder = (16 * len) % 22; Modified: head/sys/dev/usb/wlan/if_zyd.c == --- head/sys/dev/usb/wlan/if_zyd.c Sat Jul 26 15:46:41 2014 (r269126) +++ head/sys/dev/usb/wlan/if_zyd.c Sat Jul 26 16:06:01 2014 (r269127) @@ -2480,7 +2480,7 @@ zyd_tx_start(struct zyd_softc *sc, struc const struct ieee80211_txparam *tp; struct ieee80211_key *k; int rate, totlen; - static uint8_t ratediv[] = ZYD_TX_RATEDIV; + static const uint8_t ratediv[] = ZYD_TX_RATEDIV; uint8_t phy; uint16_t pktlen; uint32_t bits; Modified: head/sys/dev/usb/wlan/if_zydreg.h == --- head/sys/dev/usb/wlan/if_zydreg.h Sat Jul 26 15:46:41 2014 (r269126) +++ head/sys/dev/usb/wlan/if_zydreg.h Sat Jul 26 16:06:01 2014 (r269127) @@ -970,7 +970,7 @@ #defineZYD_TX_RATEDIV \ { \ - 0x1, 0x2, 0xb, 0xb, 0x0, 0x0, 0x0, 0x0, 0x30, 0x18, 0xc, 0x6, \ + 0x1, 0x2, 0xb, 0xb, 0x1, 0x1, 0x1, 0x1, 0x30, 0x18, 0xc, 0x6, \ 0x36, 0x24, 0x12, 0x9 \ } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r269127 - head/sys/dev/usb/wlan
On 07/26/14 20:36, Adrian Chadd wrote: Hi, We should likely review how the PLCP bits are being used and why it's getting a rate of 0 in the first place. So, why's it getting a rate of 0 passed into the transmit path? Hi Adrian, Here is the backtrace of the panic: Fatal trap 18: integer divide fault while in kernel mode cpuid = 2; apic id = 02 instruction pointer = 0x20:0x807826cf stack pointer = 0x28:0xff8000305090 frame pointer = 0x28:0xff80003050a0 code segment= base 0x0, limit 0xf, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags= interrupt enabled, resume, IOPL = 0 current process = 15 (usbus0) trap number = 18 panic: integer divide fault cpuid = 2 KDB: stack backtrace: #0 0x809257e6 at kdb_backtrace+0x66 #1 0x808eb3ae at panic+0x1ce #2 0x80cd2c30 at trap_fatal+0x290 #3 0x80cd3480 at trap+0x250 #4 0x80cbc783 at calltrap+0x8 #5 0x80783d90 at ural_start+0x1d0 #6 0x809aa2ea at if_transmit+0xea #7 0x809ef7b2 at ieee80211_start+0x542 #8 0x809aa2ea at if_transmit+0xea #9 0x809ae8b3 at ether_output_frame+0x33 #10 0x809aee30 at ether_output+0x530 #11 0x80a186b4 at ip_output+0xd74 #12 0x80a87d2a at tcp_output+0xfea #13 0x80a8 at tcp_do_segment+0xc02 #14 0x80a85219 at tcp_input+0xa29 #15 0x80a155fa at ip_input+0xaa #16 0x809b7808 at netisr_dispatch_src+0x218 #17 0x809ae3fd at ether_demux+0x14d #0 doadump (textdump=value optimized out) at pcpu.h:235 235 pcpu.h: No such file or directory. in pcpu.h (kgdb) #0 doadump (textdump=value optimized out) at pcpu.h:235 #1 0x808eae86 in kern_reboot (howto=260) at /usr/img/freebsd.9/sys/kern/kern_shutdown.c:454 #2 0x808eb387 in panic (fmt=0x1 Address 0x1 out of bounds) at /usr/img/freebsd.9/sys/kern/kern_shutdown.c:642 #3 0x80cd2c30 in trap_fatal (frame=0x12, eva=value optimized out) at /usr/img/freebsd.9/sys/amd64/amd64/trap.c:878 #4 0x80cd3480 in trap (frame=0xff8000304fe0) at /usr/img/freebsd.9/sys/amd64/amd64/trap.c:598 #5 0x80cbc783 in calltrap () at /usr/img/freebsd.9/sys/amd64/amd64/exception.S:232 #6 0x807826cf in ural_setup_tx_desc (sc=value optimized out, desc=0xfe0002c2a500, flags=value optimized out, len=value optimized out, rate=0) at /usr/img/freebsd.9/sys/dev/usb/wlan/if_ural.c:1040 #7 0x80783d90 in ural_start (ifp=0xfe0005a64800) at /usr/img/freebsd.9/sys/dev/usb/wlan/if_ural.c:1335 #8 0x809aa2ea in if_transmit (ifp=0xfe0005a64800, m=value optimized out) at /usr/img/freebsd.9/sys/net/if.c:3395 #9 0x809ef7b2 in ieee80211_start (ifp=0xfe00054f2800) at /usr/img/freebsd.9/sys/net80211/ieee80211_output.c:365 #10 0x809aa2ea in if_transmit (ifp=0xfe00054f2800, m=value optimized out) at /usr/img/freebsd.9/sys/net/if.c:3395 #11 0x809ae8b3 in ether_output_frame (ifp=0xfe00054f2800, m=0xfe014400a200) at /usr/img/freebsd.9/sys/net/if_ethersubr.c:447 #12 0x809aee30 in ether_output (ifp=0xfe00054f2800, m=0xfe014400a200, dst=value optimized out, ro=value optimized out) at /usr/img/freebsd.9/sys/net/if_ethersubr.c:418 #13 0x80a186b4 in ip_output (m=0xfe014400a200, opt=value optimized out, ro=0xff8000305480, flags=value optimized out, imo=0x0, inp=0xfe0005911498) at /usr/img/freebsd.9/sys/netinet/ip_output.c:631 #14 0x80a87d2a in tcp_output (tp=0xfe0005908b70) at /usr/img/freebsd.9/sys/netinet/tcp_output.c:1281 #15 0x80a8 in tcp_do_segment (m=0xfe0005701700, th=0xfe0144913338, so=0xfe01449132a8, tp=0xfe0005908b70, drop_hdrlen=52, tlen=1424, iptos=0 '\0', ti_locked=1) at /usr/img/freebsd.9/sys/netinet/tcp_input.c:1860 #16 0x80a85219 in tcp_input (m=0xfe0005701700, off0=value optimized out) at /usr/img/freebsd.9/sys/netinet/tcp_input.c:1410 #17 0x80a155fa in ip_input (m=0xfe0005701700) at /usr/img/freebsd.9/sys/netinet/ip_input.c:760 #18 0x809b7808 in netisr_dispatch_src (proto=1, source=value optimized out, m=value optimized out) at /usr/img/freebsd.9/sys/net/netisr.c:1013 #19 0x809ae3fd in ether_demux (ifp=0xfe00054f2800, m=0xfe0005701700) at /usr/img/freebsd.9/sys/net/if_ethersubr.c:943 #20 0x809ae6de in ether_nh_input (m=value optimized out) at /usr/img/freebsd.9/sys/net/if_ethersubr.c:762 #21 0x809b7808 in netisr_dispatch_src (proto=9, source=value optimized out, m=value optimized out) at /usr/img/freebsd.9/sys/net/netisr.c:1013 #22 0x809fdf7d in sta_input (ni=0xff8001f5d000, m=0xfe0005701700, rssi=73, nf=-95) at /usr/img/freebsd.9/sys/net80211/ieee80211_sta.c:827
Re: svn commit: r269127 - head/sys/dev/usb/wlan
On 26 July 2014 12:13, Hans Petter Selasky h...@selasky.org wrote: On 07/26/14 20:36, Adrian Chadd wrote: Hi, We should likely review how the PLCP bits are being used and why it's getting a rate of 0 in the first place. So, why's it getting a rate of 0 passed into the transmit path? Hi Adrian, Here is the backtrace of the panic: Fatal trap 18: integer divide fault while in kernel mode cpuid = 2; apic id = 02 instruction pointer = 0x20:0x807826cf stack pointer = 0x28:0xff8000305090 frame pointer = 0x28:0xff80003050a0 code segment= base 0x0, limit 0xf, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags= interrupt enabled, resume, IOPL = 0 current process = 15 (usbus0) trap number = 18 panic: integer divide fault cpuid = 2 KDB: stack backtrace: #0 0x809257e6 at kdb_backtrace+0x66 #1 0x808eb3ae at panic+0x1ce #2 0x80cd2c30 at trap_fatal+0x290 #3 0x80cd3480 at trap+0x250 #4 0x80cbc783 at calltrap+0x8 #5 0x80783d90 at ural_start+0x1d0 #6 0x809aa2ea at if_transmit+0xea #7 0x809ef7b2 at ieee80211_start+0x542 #8 0x809aa2ea at if_transmit+0xea #9 0x809ae8b3 at ether_output_frame+0x33 #10 0x809aee30 at ether_output+0x530 #11 0x80a186b4 at ip_output+0xd74 #12 0x80a87d2a at tcp_output+0xfea #13 0x80a8 at tcp_do_segment+0xc02 #14 0x80a85219 at tcp_input+0xa29 #15 0x80a155fa at ip_input+0xaa #16 0x809b7808 at netisr_dispatch_src+0x218 #17 0x809ae3fd at ether_demux+0x14d Hm, so at some point that rate was not assigned to something. Can you trace the ural_start path to see where it's supposed to be calculating the rate? -a ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org