iwlwifi 11n_disable=1 – Why does this work briefly?

OS = Ubuntu 18.04 LTS
PC = Lenovo Ideapad Y500 (released 2012)
Wireless card = Intel Centrino Wireless N2230

I just installed Ubuntu 18.04 LTS on an old Lenovo Ideapad (notebook) model Y500. It works OK, but for WiFi to work, I have to provide these commands in a Terminal:

sudo modprobe -r iwlwifi
sudo modprobe iwlwifi 11n_disable=1

This works, but only for a little while. If the computer goes to sleep (or is rebooted), I have to give these commands again.

  1. I have no clue what these commands do.

  2. Whatever these fixes, I would like to make permanent.

  3. When this works, WiFi speed is horrible (about 20 Mbps), but wired ethernet speed is wonderful (about 930 Mbps – I have fiber internet).

I have no clue what Ubuntu sees as my WiFi card. If this were Windows, I could look at the Device Manager and see what Windows thought it is (which can be wrong). With Linux, I’m too stupid to figure out what the OS thinks the card is.

Is it possible that Ubuntu is misidentifying my wireless card? If yes, can I fix this (and improve speed) by using a different driver?

Answer

My problem was terrible upload speeds on just some WiFi networks, on Ubuntu 19.04. Neither 11n_disable=1 nor 11n_disable=8, the two settings I’ve seen recommended, worked for me; the former improved upload speeds but cut download speeds in half, and the latter did nothing. I experimented and found that 11n_disable=2 boosted my upload speed by 700%, but at the price of decreasing my download speed by 12%. That’s a reasonable tradeoff when otherwise the upload speed is unusable, but I didn’t want to take the decreased download speed on WiFi networks whose upload speed was fine without changing the setting. So I wrote a script to check with WiFi network I’m using and adjust the setting accordingly. I published it on my blog (https://blog.kamens.us/2019/08/03/mitigating-wifi-upload-speed-issues-on-lenovo-ideapad-s340-running-linux/) with more details in case it might be useful to others, but I know Stack Exchange doesn’t like answers to depend on links, so I’ve included it below. It needs to be installed in /etc/NetworkManager/dispatcher.d owned by root and mode 0755.

#!/bin/bash -e

WHOAMI=$(basename $0)
IFACE="$1"; shift
ACTION="$1"; shift

log() {
    level="$1"; shift

    logger -p daemon.$level -t "$WHOAMI" $@
}

if [ "$ACTION" != "up" ]; then
    log debug ignoring action $ACTION
    exit 0
fi

state=$(cat /sys/module/iwlwifi/parameters/11n_disable)

log notice previous 11n_disable state is $state

if [ "$CONNECTION_ID" = "bad-wifi-network-name" ]; then
    want_state=2
else
    want_state=0
fi

if [ "$state" != "$want_state" ]; then
    log notice reloading iwlwifi with 11n_disable=$want_state
    if ! rmmod iwlmvm iwlwifi; then
        log err rmmod iwlmvm iwlwifi failed
        exit 1
    fi
    if ! modprobe iwlwifi 11n_disable=$want_state; then
        log err modprobe iwlwifi 11n_disable=$want_state failed
        exit 1
    fi
    if ! modprobe iwlmvm; then
        log err modprobe iwlmvm failed
        exit 1
    fi
    log notice finished reloading iwlwifi with 11n_disable=$want_state
else
    log notice 11n_disable is correct, taking no action
fi

Attribution
Source : Link , Question Author : SoonerLater , Answer Author : Jonathan Kamens

Leave a Comment