diff -urNp -x '*.orig' linux-5.11/drivers/net/wireless/intersil/hostap/hostap_80211_tx.c linux-5.11/drivers/net/wireless/intersil/hostap/hostap_80211_tx.c --- linux-5.11/drivers/net/wireless/intersil/hostap/hostap_80211_tx.c 2021-02-14 23:32:24.000000000 +0100 +++ linux-5.11/drivers/net/wireless/intersil/hostap/hostap_80211_tx.c 2021-02-24 13:30:28.508213152 +0100 @@ -77,6 +77,9 @@ netdev_tx_t hostap_data_start_xmit(struc iface = netdev_priv(dev); local = iface->local; + if (local->iw_mode == IW_MODE_MONITOR) + goto xmit; + if (skb->len < ETH_HLEN) { printk(KERN_DEBUG "%s: hostap_data_start_xmit: short skb " "(len=%d)\n", dev->name, skb->len); @@ -246,6 +249,7 @@ netdev_tx_t hostap_data_start_xmit(struc skb_put_data(skb, &hdr.addr4, ETH_ALEN); } +xmit: iface->stats.tx_packets++; iface->stats.tx_bytes += skb->len; diff -urNp -x '*.orig' linux-5.11/drivers/net/wireless/intersil/hostap/hostap_hw.c linux-5.11/drivers/net/wireless/intersil/hostap/hostap_hw.c --- linux-5.11/drivers/net/wireless/intersil/hostap/hostap_hw.c 2021-02-14 23:32:24.000000000 +0100 +++ linux-5.11/drivers/net/wireless/intersil/hostap/hostap_hw.c 2021-02-24 13:30:28.508213152 +0100 @@ -984,6 +984,35 @@ static u16 hfa384x_allocate_fid(struct n return fid; } +static int prism2_monitor_enable(struct net_device *dev) +{ + if (hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, 5)) { + printk(KERN_DEBUG "Port type setting for monitor mode " + "failed\n"); + return -EOPNOTSUPP; + } + + if (hfa384x_cmd(dev, HFA384X_CMDCODE_TEST | (0x0a << 8), + 0, NULL, NULL)) { + printk(KERN_DEBUG "Could not enter testmode 0x0a\n"); + return -EOPNOTSUPP; + } + + if (hostap_set_word(dev, HFA384X_RID_CNFWEPFLAGS, + HFA384X_WEPFLAGS_PRIVACYINVOKED | + HFA384X_WEPFLAGS_HOSTENCRYPT | + HFA384X_WEPFLAGS_HOSTDECRYPT)) { + printk(KERN_DEBUG "WEP flags setting failed\n"); + return -EOPNOTSUPP; + } + + if (hostap_set_word(dev, HFA384X_RID_PROMISCUOUSMODE, 1)) { + printk(KERN_DEBUG "Could not set promiscuous mode\n"); + return -EOPNOTSUPP; + } + + return 0; +} static int prism2_reset_port(struct net_device *dev) { @@ -1010,6 +1039,10 @@ static int prism2_reset_port(struct net_ "port\n", dev->name); } + if (local->iw_mode == IW_MODE_MONITOR) + /* force mode 0x0a after port 0 reset */ + return prism2_monitor_enable(dev); + /* It looks like at least some STA firmware versions reset * fragmentation threshold back to 2346 after enable command. Restore * the configured value, if it differs from this default. */ @@ -1445,6 +1478,10 @@ static int prism2_hw_enable(struct net_d return 1; } + if (local->iw_mode == IW_MODE_MONITOR) + /* force mode 0x0a after port 0 reset */ + prism2_monitor_enable(dev); + local->hw_ready = 1; local->hw_reset_tries = 0; local->hw_resetting = 0; @@ -3102,6 +3139,7 @@ prism2_init_local_data(struct prism2_hel local->func->hw_config = prism2_hw_config; local->func->hw_reset = prism2_hw_reset; local->func->hw_shutdown = prism2_hw_shutdown; + local->func->monitor_enable = prism2_monitor_enable; local->func->reset_port = prism2_reset_port; local->func->schedule_reset = prism2_schedule_reset; #ifdef PRISM2_DOWNLOAD_SUPPORT diff -urNp -x '*.orig' linux-5.11/drivers/net/wireless/intersil/hostap/hostap_ioctl.c linux-5.11/drivers/net/wireless/intersil/hostap/hostap_ioctl.c --- linux-5.11/drivers/net/wireless/intersil/hostap/hostap_ioctl.c 2021-02-14 23:32:24.000000000 +0100 +++ linux-5.11/drivers/net/wireless/intersil/hostap/hostap_ioctl.c 2021-02-24 13:30:28.508213152 +0100 @@ -1071,33 +1071,7 @@ static int hostap_monitor_mode_enable(lo printk(KERN_DEBUG "Enabling monitor mode\n"); hostap_monitor_set_type(local); - - if (hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, - HFA384X_PORTTYPE_PSEUDO_IBSS)) { - printk(KERN_DEBUG "Port type setting for monitor mode " - "failed\n"); - return -EOPNOTSUPP; - } - - /* Host decrypt is needed to get the IV and ICV fields; - * however, monitor mode seems to remove WEP flag from frame - * control field */ - if (hostap_set_word(dev, HFA384X_RID_CNFWEPFLAGS, - HFA384X_WEPFLAGS_HOSTENCRYPT | - HFA384X_WEPFLAGS_HOSTDECRYPT)) { - printk(KERN_DEBUG "WEP flags setting failed\n"); - return -EOPNOTSUPP; - } - - if (local->func->reset_port(dev) || - local->func->cmd(dev, HFA384X_CMDCODE_TEST | - (HFA384X_TEST_MONITOR << 8), - 0, NULL, NULL)) { - printk(KERN_DEBUG "Setting monitor mode failed\n"); - return -EOPNOTSUPP; - } - - return 0; + return local->func->reset_port(dev); } @@ -1166,7 +1140,7 @@ static int prism2_ioctl_siwmode(struct n local->iw_mode = *mode; if (local->iw_mode == IW_MODE_MONITOR) - hostap_monitor_mode_enable(local); + return hostap_monitor_mode_enable(local); else if (local->iw_mode == IW_MODE_MASTER && !local->host_encrypt && !local->fw_encrypt_ok) { printk(KERN_DEBUG "%s: defaulting to host-based encryption as " diff -urNp -x '*.orig' linux-5.11/drivers/net/wireless/intersil/hostap/hostap_main.c linux-5.11/drivers/net/wireless/intersil/hostap/hostap_main.c --- linux-5.11/drivers/net/wireless/intersil/hostap/hostap_main.c 2021-02-14 23:32:24.000000000 +0100 +++ linux-5.11/drivers/net/wireless/intersil/hostap/hostap_main.c 2021-02-24 13:30:28.508213152 +0100 @@ -318,7 +318,7 @@ u16 hostap_get_porttype(local_info_t *lo if (local->iw_mode == IW_MODE_REPEAT) return HFA384X_PORTTYPE_WDS; if (local->iw_mode == IW_MODE_MONITOR) - return HFA384X_PORTTYPE_PSEUDO_IBSS; + return 5; /*HFA384X_PORTTYPE_PSEUDO_IBSS;*/ return HFA384X_PORTTYPE_HOSTAP; } diff -urNp -x '*.orig' linux-5.11/drivers/net/wireless/intersil/hostap/hostap_pci.c linux-5.11/drivers/net/wireless/intersil/hostap/hostap_pci.c --- linux-5.11/drivers/net/wireless/intersil/hostap/hostap_pci.c 2021-02-14 23:32:24.000000000 +0100 +++ linux-5.11/drivers/net/wireless/intersil/hostap/hostap_pci.c 2021-02-24 13:30:28.508213152 +0100 @@ -47,6 +47,8 @@ static const struct pci_device_id prism2 { 0x1260, 0x3873, PCI_ANY_ID, PCI_ANY_ID }, /* Samsung MagicLAN SWL-2210P */ { 0x167d, 0xa000, PCI_ANY_ID, PCI_ANY_ID }, + /* NETGEAR MA311 */ + { 0x1385, 0x3872, PCI_ANY_ID, PCI_ANY_ID }, { 0 } }; diff -urNp -x '*.orig' linux-5.11/drivers/net/wireless/intersil/hostap/hostap_plx.c linux-5.11/drivers/net/wireless/intersil/hostap/hostap_plx.c --- linux-5.11/drivers/net/wireless/intersil/hostap/hostap_plx.c 2021-02-14 23:32:24.000000000 +0100 +++ linux-5.11/drivers/net/wireless/intersil/hostap/hostap_plx.c 2021-02-24 13:30:28.508213152 +0100 @@ -100,6 +100,7 @@ static struct prism2_plx_manfid { { 0xc250, 0x0002 } /* EMTAC A2424i */, { 0xd601, 0x0002 } /* Z-Com XI300 */, { 0xd601, 0x0005 } /* Zcomax XI-325H 200mW */, + { 0xd601, 0x0010 } /* Zcomax XI-325H 100mW */, { 0, 0} }; diff -urNp -x '*.orig' linux-5.11/drivers/net/wireless/intersil/hostap/hostap_wlan.h linux-5.11/drivers/net/wireless/intersil/hostap/hostap_wlan.h --- linux-5.11/drivers/net/wireless/intersil/hostap/hostap_wlan.h 2021-02-14 23:32:24.000000000 +0100 +++ linux-5.11/drivers/net/wireless/intersil/hostap/hostap_wlan.h 2021-02-24 13:30:28.508213152 +0100 @@ -593,6 +593,7 @@ struct prism2_helper_functions { int (*hw_config)(struct net_device *dev, int initial); void (*hw_reset)(struct net_device *dev); void (*hw_shutdown)(struct net_device *dev, int no_disable); + int (*monitor_enable)(struct net_device *dev); int (*reset_port)(struct net_device *dev); void (*schedule_reset)(local_info_t *local); int (*download)(local_info_t *local,