Actually ieee80211_set_antenna() returns -EOPNOTSUPP in case the device is "started". That is confusing. Return -EBUSY instead. That makes clear that the device must be stopped beforehand. Given an active wifi device: $ iw phy0 set antenna 0x3 command failed: Operation not supported (-95) expected output: command failed: Device or resource busy (-16) drv_set_antenna() later on will check if the driver supports it. Fixes: 15d967532148 ("mac80211: Add antenna configuration") Signed-off-by: Christoph Rudorff --- I was confused that none of my wifi devices can set_antenna. Given a fresh inserted usb wifi device: $ iw phy0 set antenna 0x3 command failed: Operation not supported (-95) $ rfkill block wlan $ iw phy0 set antenna 0x3 Oh, wonder, it works! expected output: $ iw phy0 set antenna 0x3 command failed: Device or resource busy (-16) So fix the return value of ieee80211_set_antenna() and later on drv_set_antenna() checks if the driver supports it. This is a good candidate for backport. The patch is just a one liner. --- Changes in v2: - accelerated commit messages - Link to v1: https://patch.msgid.link/20261016-fix-set-antenna-v1-1-e071d66f7f89@rudorff.com To: Johannes Berg To: "John W. Linville" To: Bruno Randolf Cc: linux-wireless@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- net/mac80211/cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index a1753335eb9d..87a9ead7c638 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -4920,7 +4920,7 @@ static int ieee80211_set_antenna(struct wiphy *wiphy, int radio_idx, int ret; if (local->started) - return -EOPNOTSUPP; + return -EBUSY; ret = drv_set_antenna(local, tx_ant, rx_ant); if (ret) --- base-commit: 79a907609d53d5cd645b42c11550d295d43abf99 change-id: 20261016-fix-set-antenna-50205dc86cb6 Best regards, -- Christoph Rudorff