abperiasamy / rtl8812AU_8821AU_linux

rtl8812AU_8821AU linux kernel driver for AC1200 (801.11ac) Wireless Dual-Band USB Adapter
GNU General Public License v2.0
1.22k stars 434 forks source link

Build for OpenWRT #22

Open mrtnjcl opened 10 years ago

mrtnjcl commented 10 years ago

Hello,

i tried to build this driver for OpenWRT, the module builds and i'm able to load it; however, i get this error in dmesg

[10428.560000] ------------[ cut here ]------------
[10428.560000] WARNING: at /mnt/dl/slave/ar71xx/build/build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/compat-wireless-2014-05-22/net/wireless/core.c:549 wiphy_register+0x150/0x5c4 [cfg80211]()
[10428.560000] Modules linked in: 8821au(+) ath9k ath9k_common pppoe ppp_async iptable_nat ath9k_hw ath pppox ppp_generic nf_nat_ipv4 nf_conntrack_ipv4 mac80211 ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_state xt_nat xt_multiport xt_mark xt_mac xt_limit xt_conntrack xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_CT slhc nf_nat_irc nf_nat_ftp nf_nat nf_defrag_ipv4 nf_conntrack_irc nf_conntrack_ftp lib80211_crypt_wep lib80211_crypt_tkip lib80211_crypt_ccmp lib80211 iptable_raw iptable_mangle iptable_filter ipt_REJECT ip_tables crc_ccitt compat uhci_hcd ledtrig_usbdev ip6t_REJECT ip6table_raw ip6table_mangle ip6table_filter ip6_tables x_tables nf_conntrack_ipv6 nf_conntrack nf_defrag_ipv6 bcma ipv6 eeprom_93cx6 ssb arc4 crypto_blkcipher ohci_hcd ehci_platform ehci_hcd gpio_button_hotplug usbcore nls_base usb_common [last unloaded: b43]
[10428.560000] CPU: 0 PID: 1433 Comm: insmod Tainted: G        W    3.10.44 #1
[10428.560000] Stack : 00000000 00000000 00000000 00000000 80392eba 0000003f 8188a328 80ae8494
[10428.560000]    802e7a9c 803393db 00000599 80392664 8188a328 80ae8494 80ae8488 80ae8408
[10428.560000]    81947c20 80078fb8 00000003 800769c4 80d6ace8 80ae8494 802e935c 80a65b1c
[10428.560000]    00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[10428.560000]    00000000 00000000 00000000 00000000 00000000 00000000 00000000 80a65aa8
[10428.560000]    ...
[10428.560000] Call Trace:
[10428.560000] [<8006e278>] show_stack+0x48/0x70
[10428.560000] [<80076b34>] warn_slowpath_common+0x78/0xa8
[10428.560000] [<80076bec>] warn_slowpath_null+0x18/0x24
[10428.560000] [<80d40898>] wiphy_register+0x150/0x5c4 [cfg80211]
[10428.560000] [<80645c5c>] rtw_wdev_alloc+0xfc/0x1d8 [8821au]
[10428.560000] [<806332dc>] rtw_usb_if1_init+0xd0/0x7b8 [8821au]
[10428.560000] [<80633668>] rtw_usb_if1_init+0x45c/0x7b8 [8821au]
[10428.560000] 
[10428.560000] ---[ end trace 2f9e217b8128a086 ]---
[10428.560000] ------------[ cut here ]------------
[10428.560000] WARNING: at /mnt/dl/slave/ar71xx/build/build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/compat-wireless-2014-05-22/net/wireless/core.c:608 wiphy_register+0x580/0x5c4 [cfg80211]()
[10428.560000] Modules linked in: 8821au(+) ath9k ath9k_common pppoe ppp_async iptable_nat ath9k_hw ath pppox ppp_generic nf_nat_ipv4 nf_conntrack_ipv4 mac80211 ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_state xt_nat xt_multiport xt_mark xt_mac xt_limit xt_conntrack xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_CT slhc nf_nat_irc nf_nat_ftp nf_nat nf_defrag_ipv4 nf_conntrack_irc nf_conntrack_ftp lib80211_crypt_wep lib80211_crypt_tkip lib80211_crypt_ccmp lib80211 iptable_raw iptable_mangle iptable_filter ipt_REJECT ip_tables crc_ccitt compat uhci_hcd ledtrig_usbdev ip6t_REJECT ip6table_raw ip6table_mangle ip6table_filter ip6_tables x_tables nf_conntrack_ipv6 nf_conntrack nf_defrag_ipv6 bcma ipv6 eeprom_93cx6 ssb arc4 crypto_blkcipher ohci_hcd ehci_platform ehci_hcd gpio_button_hotplug usbcore nls_base usb_common [last unloaded: b43]
[10428.560000] CPU: 0 PID: 1433 Comm: insmod Tainted: G        W    3.10.44 #1
[10428.560000] Stack : 00000000 00000000 00000000 00000000 80392eba 0000003f 8188a328 80ae8494
[10428.560000]    802e7a9c 803393db 00000599 80392664 8188a328 80ae8494 80ae8488 80ae8408
[10428.560000]    81947c20 80078fb8 00000003 800769c4 80d6ace8 80ae8494 802e935c 80a65b1c
[10428.560000]    00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[10428.560000]    00000000 00000000 00000000 00000000 00000000 00000000 00000000 80a65aa8
[10428.560000]    ...
[10428.560000] Call Trace:
[10428.560000] [<8006e278>] show_stack+0x48/0x70
[10428.560000] [<80076b34>] warn_slowpath_common+0x78/0xa8
[10428.560000] [<80076bec>] warn_slowpath_null+0x18/0x24
[10428.560000] [<80d40cc8>] wiphy_register+0x580/0x5c4 [cfg80211]
[10428.560000] [<80645c5c>] rtw_wdev_alloc+0xfc/0x1d8 [8821au]
[10428.560000] [<806332dc>] rtw_usb_if1_init+0xd0/0x7b8 [8821au]
[10428.560000] [<80633668>] rtw_usb_if1_init+0x45c/0x7b8 [8821au]
[10428.560000] 
[10428.560000] ---[ end trace 2f9e217b8128a087 ]---

the warnings in question seems to be emitted from the following parts of core.c

u16 ifmodes = wiphy->interface_modes;
....
WARN_ON(!ifmodes);    // <<<< THE FIRST WARNING
    ifmodes &= ((1 << NUM_NL80211_IFTYPES) - 1) & ~1;
    if (WARN_ON(ifmodes != wiphy->interface_modes))
        wiphy->interface_modes = ifmodes;

and

    /* sanity check supported bands/channels */
    for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
        sband = wiphy->bands[band];
        if (!sband)
            continue;

        sband->band = band;
        if (WARN_ON(!sband->n_channels))
            return -EINVAL;
        /*
         * on 60gHz band, there are no legacy rates, so
         * n_bitrates is 0
         */
        if (WARN_ON(band != IEEE80211_BAND_60GHZ &&
                !sband->n_bitrates))
            return -EINVAL;

        /*
         * Since cfg80211_disable_40mhz_24ghz is global, we can
         * modify the sband's ht data even if the driver uses a
         * global structure for that.
         */
        if (cfg80211_disable_40mhz_24ghz &&
            band == IEEE80211_BAND_2GHZ &&
            sband->ht_cap.ht_supported) {
            sband->ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
            sband->ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40;
        }

        /*
         * Since we use a u32 for rate bitmaps in
         * ieee80211_get_response_rate, we cannot
         * have more than 32 legacy rates.
         */
        if (WARN_ON(sband->n_bitrates > 32))
            return -EINVAL;

        for (i = 0; i < sband->n_channels; i++) {
            sband->channels[i].orig_flags =
                sband->channels[i].flags;
            sband->channels[i].orig_mag = INT_MAX;
            sband->channels[i].orig_mpwr =
                sband->channels[i].max_power;
            sband->channels[i].band = band;
        }

        have_band = true;
    }

    if (!have_band) {
        WARN_ON(1);  //<<<<< the second warning, have_band must be false then.
        return -EINVAL;
    }

the call ret = wiphy_register(wiphy); from ioctl_cfg80211.c returns an error and bails out.

uname -a:
Linux OpenWrt 3.10.44 #1 Wed Jul 9 19:59:15 UTC 2014 mips GNU/Linux
pseudosavant commented 9 years ago

@martinjacala Did you ever get this to work for OpenWRT? I'm trying to do the same thing.

cancian commented 8 years ago

I have found this Makefile for the rtl8812au, but I'm still trying to figure out how to use it. https://gist.github.com/Ins1ghtLabs/c346f7ed4f257d1b4a2d

ghost commented 8 years ago

Has anyone had any success in using it for OpenWrt?