• Bitterblue Smith's avatar
    wifi: rtlwifi: Speed up firmware loading for USB · b06439c6
    Bitterblue Smith authored
    Currently it takes almost 6 seconds to upload the firmware for RTL8192CU
    (and 11 seconds for RTL8192DU). That's because the firmware is uploaded
    one byte at a time.
    
    Also, after plugging the device, the firmware gets uploaded three times
    before a connection to the AP is established.
    
    Maybe this is fine for most users, but when testing changes to the
    driver it's really annoying to wait so long.
    
    Speed up the firmware upload by writing chunks of 64 bytes at a time.
    This way it takes about 110 ms for RTL8192CU (and about 210 ms for
    RTL8192DU).
    
    PCI devices could upload it in chunks of 4 bytes, but I don't have any
    to test and commit 89d32c90 ("rtlwifi: Download firmware as bytes
    rather than as dwords") decided otherwise anyway.
    
    Allocate memory for the firmware image with kmalloc instead of vzalloc
    because this memory is passed directly to usb_control_msg(), which
    can't take memory allocated by vmalloc.
    Signed-off-by: default avatarBitterblue Smith <rtl8821cerfe2@gmail.com>
    Acked-by: default avatarPing-Ke Shih <pkshih@realtek.com>
    Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
    Link: https://msgid.link/d9bd4949-6e92-4f35-8b60-3b45f9ad74ab@gmail.com
    b06439c6
efuse.h 2.45 KB