Ubuntu refuses to use 802.11n bitrates with ath9k driver?

So I have an HP Pavilion g7 something-or-other laptop with an AMD APU and this Atheros wireless card in it. The Atheros card handles bluetooth and wifi for the laptop. The laptop came with Windows 7, but I currently dual boot Windows 7 and Ubuntu 15.04 GNOME on it.

I have been unable to get iwconfig to set a bitrate over 54mbps, and when I set my network to only allow N clients, it just sits there with the "Connecting" message for a seemingly infinite amount of time. Like several minutes before I get frustrated and undo it. When I allow both N and G clients, it connects in a matter of seconds, and works fine, but never goes above a 54mbps bitrate.

I was thinking maybe it was some kind of automatic thing that increases the bitrate as needed, but in my access point settings it says my laptop is the only client connected via G. Everything else connects via N just fine, and this laptop works fine via N if I boot into Windows 7. It's just Ubuntu misbehaving.

Here's the output of iwconfig when connected to this network. If I try to set the bitrate with sudo iwconfig rate 300M then it won't do anything.

eth0      no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:"*cough*"  
          Mode:Managed  Frequency:2.462 GHz  Access Point: 12:*cough*:72   
          Bit Rate=54 Mb/s   Tx-Power=15 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=66/70  Signal level=-44 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:181   Missed beacon:0

lo        no wireless extensions.

And here's what the Unifi "Users" page says for anyone wondering. I'm using a Unifi N AP, not the Pro one or the LR one, just the normal $70 from Amazon. I'm cheap :P

The top two wireless clients are on the same network (my laptop is the one with "pavilion"), the network in question. Ignore the 3rd one, it's my sister's Kindle and it's special.

I'm using the ath9k driver for this card. Seems to me only a few other people on earth have had this issue, and it's gone unresolved. What the crap is going on? I'm confused, this driver is supposed to support this card, this card is supposedly even Ubuntu certified. What??

What happens if you set the AP to N only?

All the other clients continue to work fine, while my laptop just sits at the "Connecting" thing in the Ubuntu GNOME WiFi settings menu. The little "waiting" circle just spins, I can't do anything, and it spins as long as you let it, most I've let it sit before getting frustrated was 5 minutes straight.

Important one for that network card is the hardware encryption.

For the ath9k module:
echo "options ath9k nohwcrypt=1" > /etc/modprobe.d/ath9k.conf

But theres a bunch more stuff on there that actually can help alot when it comes to resolving problems. Like the nonfree-firmware:

sudo apt-get install linux-firmware-nonfree

I had actually already done that, and it didn't help :( Didn't break anything, with those options after several reboots everything still works fine, but still operating in 54mbps bitrate mode.

Edit: and I've had linux-firmware-nonfree for a while, I checked it and it's up to date according to apt-get.

Let me know if anybody needs me to paste in additional info/command output or something.

Are there any legacy devices connected to the same AP using the frequency? If so, they'll automagically throttle every other device to the lowest common speed among them.

Quick test, change the SSID, reconnect ONLY your machine, and see if you get full 300... Then change SSID back to what it was before.

After that, make sure you double check and even manually reset the security to WPA2 and AES.

I already know I'm the only one connected via G, the Unifi panel will tell me that. I tried connecting to another N network (a neighbor who's stupid and leaves theirs open) and it still does it, so I don't think it's the AP.

Here are screenshots of my Unifi AP settings. Ignore the IPs in the first one on 192.168.1.0/24, those are the rest of my family's devices and they're all N as well, as you can see. The laptop labeled hampton-pavilion is mine.

None of these changes fix it either :( I had already set my security to WPA2 and AES only earlier today, and it didn't help.

My apologies for the horrifyingly sloppy GIMP skills :P

I read some stuff about N causing some odd kernel panics with ath9k, so it was disabled. However that was quite a few years ago now and if they haven't updated the driver to address the problem, that's kind of shitty. You could try your luck with ndiswrapper but jeez I think thats a shitty way to go. I wish I knew what else to do to help, you've covered the bases I would cover already.

You're not alone though, there's a great deal of people having basically the same problem you're having, and not much of any solid solution to the problem, more a collection of things one could try that might make the situation better.

Is there a way I could, for example, force N to be enabled? Like some option in the ath9k.conf file?

I think Ubuntu knows I have an N capable card, iwconfig says IEEE 802.11bgn

Interesting thing is that when I scan for networks using iw wlan0 scan, I get this for my SSID, which says it only supports bitrates of 18mbps... ???????

EDIT: I failed to read "Extended Supported Rates", which goes to 54mbps. Still weird that the laptop seems to think the AP is G only though...I'm certainly lost here

BSS *cough cough*(on wlan0) -- associated
	TSF: 15872867736 usec (0d, 04:24:32)
	freq: 2462
	beacon interval: 100 TUs
	capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431)
	signal: -45.00 dBm
	last seen: 52 ms ago
	Information elements from Probe Response frame:
	SSID: *cough*
	Supported rates: 1.0* 2.0* 5.5* 11.0* 6.0* 9.0 12.0* 18.0 
	DS Parameter set: channel 11
	ERP: <no flags>
	ERP D4.0: <no flags>
	RSN:	 * Version: 1
		 * Group cipher: CCMP
		 * Pairwise ciphers: CCMP
		 * Authentication suites: PSK
		 * Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000)
	Extended supported rates: 24.0* 36.0 48.0 54.0 
	HT capabilities:
		Capabilities: 0x11cc
			HT20
			SM Power Save disabled
			RX HT40 SGI
			TX STBC
			RX STBC 1-stream
			Max AMSDU length: 3839 bytes
			DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 8 usec (0x06)
		HT RX MCS rate indexes supported: 0-15
		HT TX MCS rate indexes are undefined
	HT operation:
		 * primary channel: 11
		 * secondary channel offset: no secondary
		 * STA channel width: 20 MHz
		 * RIFS: 0
		 * HT protection: non-HT mixed
		 * non-GF present: 1
		 * OBSS non-GF present: 1
		 * dual beacon: 0
		 * dual CTS protection: 0
		 * STBC beacon: 0
		 * L-SIG TXOP Prot: 0
		 * PCO active: 0
		 * PCO phase: 0
	WMM:	 * Parameter version 1
		 * BE: CW 15-63, AIFSN 3
		 * BK: CW 15-1023, AIFSN 7
		 * VI: CW 7-15, AIFSN 1, TXOP 3008 usec
		 * VO: CW 3-7, AIFSN 1, TXOP 1504 usec

Can you go into the network manager and fumble around with any settings to stop it from connecting to the G network ? Its like it knows the N is there and is connecting to the G anyway ...

If you mean Ubuntu's graphical network manager, I tried, there's literally nothing about 802.11 level stuff except BSSID and simple things like that, and MTU. There's nothing like "Force 802.11n speeds" or "Only connect using this standard". If you mean some text configuration file somewhere, you'll have to be more specific lolz, I'm not well versed in Linux's wireless networking stack, I'm only good with Ethernet adapters without a GUI.

The ath9k driver shows support for wireless N, however there's a confirmed bug on the driver page for it that says this issue is affecting multiple users. It's old and there's no solution, so I'm not sure what ever came of it.

EDIT: Pop into /etc/Wireless and poke around for a .dat file in there, let me know if you turn anything up.