Message ID | 20190109160843.14832-4-sergey.matyukevich.os@quantenna.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Kalle Valo |
Headers | show |
Series | qtnfmac: fixes and minor enhancements | expand |
Hi Sergey, url: https://github.com/0day-ci/linux/commits/Sergey-Matyukevich/qtnfmac-fixes-and-minor-enhancements/20190111-030606 base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master smatch warnings: drivers/net/wireless/quantenna/qtnfmac/cfg80211.c:142 qtnf_change_virtual_intf() error: we previously assumed 'params' could be null (see line 135) drivers/net/wireless/quantenna/qtnfmac/cfg80211.c:232 qtnf_add_virtual_intf() error: we previously assumed 'params' could be null (see line 229) # https://github.com/0day-ci/linux/commit/6bf96047ef769f18b29bbfae576d829462da53f3 git remote add linux-review https://github.com/0day-ci/linux git remote update linux-review git checkout 6bf96047ef769f18b29bbfae576d829462da53f3 vim +/params +142 drivers/net/wireless/quantenna/qtnfmac/cfg80211.c 01efff52 Sergey Matyukevich 2018-01-22 117 01efff52 Sergey Matyukevich 2018-01-22 118 static int 98f44cb0 Igor Mitsyanko 2017-05-11 119 qtnf_change_virtual_intf(struct wiphy *wiphy, 98f44cb0 Igor Mitsyanko 2017-05-11 120 struct net_device *dev, 98f44cb0 Igor Mitsyanko 2017-05-11 121 enum nl80211_iftype type, 98f44cb0 Igor Mitsyanko 2017-05-11 122 struct vif_params *params) 98f44cb0 Igor Mitsyanko 2017-05-11 123 { 98f44cb0 Igor Mitsyanko 2017-05-11 124 struct qtnf_vif *vif = qtnf_netdev_get_priv(dev); 98f44cb0 Igor Mitsyanko 2017-05-11 125 u8 *mac_addr; 98f44cb0 Igor Mitsyanko 2017-05-11 126 int ret; 98f44cb0 Igor Mitsyanko 2017-05-11 127 01efff52 Sergey Matyukevich 2018-01-22 128 ret = qtnf_validate_iface_combinations(wiphy, vif, type); 01efff52 Sergey Matyukevich 2018-01-22 129 if (ret) { 01efff52 Sergey Matyukevich 2018-01-22 130 pr_err("VIF%u.%u combination check: failed to set type %d\n", 01efff52 Sergey Matyukevich 2018-01-22 131 vif->mac->macid, vif->vifid, type); 01efff52 Sergey Matyukevich 2018-01-22 132 return ret; 01efff52 Sergey Matyukevich 2018-01-22 133 } 01efff52 Sergey Matyukevich 2018-01-22 134 98f44cb0 Igor Mitsyanko 2017-05-11 @135 if (params) 98f44cb0 Igor Mitsyanko 2017-05-11 136 mac_addr = params->macaddr; 98f44cb0 Igor Mitsyanko 2017-05-11 137 else 98f44cb0 Igor Mitsyanko 2017-05-11 138 mac_addr = NULL; 98f44cb0 Igor Mitsyanko 2017-05-11 139 98f44cb0 Igor Mitsyanko 2017-05-11 140 qtnf_scan_done(vif->mac, true); 98f44cb0 Igor Mitsyanko 2017-05-11 141 6bf96047 Sergey Matyukevich 2019-01-09 @142 ret = qtnf_cmd_send_change_intf_type(vif, type, params->use_4addr, 6bf96047 Sergey Matyukevich 2019-01-09 143 mac_addr); 98f44cb0 Igor Mitsyanko 2017-05-11 144 if (ret) { c6ed298f Sergey Matyukevich 2018-10-05 145 pr_err("VIF%u.%u: failed to change type to %d\n", c6ed298f Sergey Matyukevich 2018-10-05 146 vif->mac->macid, vif->vifid, type); 98f44cb0 Igor Mitsyanko 2017-05-11 147 return ret; 98f44cb0 Igor Mitsyanko 2017-05-11 148 } 98f44cb0 Igor Mitsyanko 2017-05-11 149 98f44cb0 Igor Mitsyanko 2017-05-11 150 vif->wdev.iftype = type; 98f44cb0 Igor Mitsyanko 2017-05-11 151 return 0; 98f44cb0 Igor Mitsyanko 2017-05-11 152 } 98f44cb0 Igor Mitsyanko 2017-05-11 153 98f44cb0 Igor Mitsyanko 2017-05-11 154 int qtnf_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev) 98f44cb0 Igor Mitsyanko 2017-05-11 155 { 98f44cb0 Igor Mitsyanko 2017-05-11 156 struct net_device *netdev = wdev->netdev; 98f44cb0 Igor Mitsyanko 2017-05-11 157 struct qtnf_vif *vif; 98f44cb0 Igor Mitsyanko 2017-05-11 158 98f44cb0 Igor Mitsyanko 2017-05-11 159 if (WARN_ON(!netdev)) 98f44cb0 Igor Mitsyanko 2017-05-11 160 return -EFAULT; 98f44cb0 Igor Mitsyanko 2017-05-11 161 98f44cb0 Igor Mitsyanko 2017-05-11 162 vif = qtnf_netdev_get_priv(wdev->netdev); 98f44cb0 Igor Mitsyanko 2017-05-11 163 a715b3a0 Sergey Matyukevich 2017-09-18 164 qtnf_scan_done(vif->mac, true); a715b3a0 Sergey Matyukevich 2017-09-18 165 98f44cb0 Igor Mitsyanko 2017-05-11 166 /* Stop data */ 98f44cb0 Igor Mitsyanko 2017-05-11 167 netif_tx_stop_all_queues(netdev); 98f44cb0 Igor Mitsyanko 2017-05-11 168 if (netif_carrier_ok(netdev)) 98f44cb0 Igor Mitsyanko 2017-05-11 169 netif_carrier_off(netdev); 98f44cb0 Igor Mitsyanko 2017-05-11 170 98f44cb0 Igor Mitsyanko 2017-05-11 171 if (netdev->reg_state == NETREG_REGISTERED) 98f44cb0 Igor Mitsyanko 2017-05-11 172 unregister_netdevice(netdev); 98f44cb0 Igor Mitsyanko 2017-05-11 173 87affdde Vasily Ulyanov 2018-01-22 174 if (qtnf_cmd_send_del_intf(vif)) 87affdde Vasily Ulyanov 2018-01-22 175 pr_err("VIF%u.%u: failed to delete VIF\n", vif->mac->macid, 87affdde Vasily Ulyanov 2018-01-22 176 vif->vifid); 87affdde Vasily Ulyanov 2018-01-22 177 98f44cb0 Igor Mitsyanko 2017-05-11 178 vif->netdev->ieee80211_ptr = NULL; 98f44cb0 Igor Mitsyanko 2017-05-11 179 vif->netdev = NULL; 98f44cb0 Igor Mitsyanko 2017-05-11 180 vif->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED; 98f44cb0 Igor Mitsyanko 2017-05-11 181 98f44cb0 Igor Mitsyanko 2017-05-11 182 return 0; 98f44cb0 Igor Mitsyanko 2017-05-11 183 } 98f44cb0 Igor Mitsyanko 2017-05-11 184 98f44cb0 Igor Mitsyanko 2017-05-11 185 static struct wireless_dev *qtnf_add_virtual_intf(struct wiphy *wiphy, 98f44cb0 Igor Mitsyanko 2017-05-11 186 const char *name, 98f44cb0 Igor Mitsyanko 2017-05-11 187 unsigned char name_assign_t, 98f44cb0 Igor Mitsyanko 2017-05-11 188 enum nl80211_iftype type, 98f44cb0 Igor Mitsyanko 2017-05-11 189 struct vif_params *params) 98f44cb0 Igor Mitsyanko 2017-05-11 190 { 98f44cb0 Igor Mitsyanko 2017-05-11 191 struct qtnf_wmac *mac; 98f44cb0 Igor Mitsyanko 2017-05-11 192 struct qtnf_vif *vif; 98f44cb0 Igor Mitsyanko 2017-05-11 193 u8 *mac_addr = NULL; 01efff52 Sergey Matyukevich 2018-01-22 194 int ret; 98f44cb0 Igor Mitsyanko 2017-05-11 195 98f44cb0 Igor Mitsyanko 2017-05-11 196 mac = wiphy_priv(wiphy); 98f44cb0 Igor Mitsyanko 2017-05-11 197 98f44cb0 Igor Mitsyanko 2017-05-11 198 if (!mac) 98f44cb0 Igor Mitsyanko 2017-05-11 199 return ERR_PTR(-EFAULT); 98f44cb0 Igor Mitsyanko 2017-05-11 200 01efff52 Sergey Matyukevich 2018-01-22 201 ret = qtnf_validate_iface_combinations(wiphy, NULL, type); 01efff52 Sergey Matyukevich 2018-01-22 202 if (ret) { 01efff52 Sergey Matyukevich 2018-01-22 203 pr_err("MAC%u invalid combination: failed to add type %d\n", 01efff52 Sergey Matyukevich 2018-01-22 204 mac->macid, type); 01efff52 Sergey Matyukevich 2018-01-22 205 return ERR_PTR(ret); 01efff52 Sergey Matyukevich 2018-01-22 206 } 01efff52 Sergey Matyukevich 2018-01-22 207 98f44cb0 Igor Mitsyanko 2017-05-11 208 switch (type) { 98f44cb0 Igor Mitsyanko 2017-05-11 209 case NL80211_IFTYPE_STATION: 98f44cb0 Igor Mitsyanko 2017-05-11 210 case NL80211_IFTYPE_AP: 98f44cb0 Igor Mitsyanko 2017-05-11 211 vif = qtnf_mac_get_free_vif(mac); 98f44cb0 Igor Mitsyanko 2017-05-11 212 if (!vif) { 98f44cb0 Igor Mitsyanko 2017-05-11 213 pr_err("MAC%u: no free VIF available\n", mac->macid); 98f44cb0 Igor Mitsyanko 2017-05-11 214 return ERR_PTR(-EFAULT); 98f44cb0 Igor Mitsyanko 2017-05-11 215 } 98f44cb0 Igor Mitsyanko 2017-05-11 216 98f44cb0 Igor Mitsyanko 2017-05-11 217 eth_zero_addr(vif->mac_addr); 9a3beeb5 Sergey Matyukevich 2018-05-29 218 eth_zero_addr(vif->bssid); 98f44cb0 Igor Mitsyanko 2017-05-11 219 vif->bss_priority = QTNF_DEF_BSS_PRIORITY; 9a3beeb5 Sergey Matyukevich 2018-05-29 220 memset(&vif->wdev, 0, sizeof(vif->wdev)); 98f44cb0 Igor Mitsyanko 2017-05-11 221 vif->wdev.wiphy = wiphy; 98f44cb0 Igor Mitsyanko 2017-05-11 222 vif->wdev.iftype = type; 98f44cb0 Igor Mitsyanko 2017-05-11 223 break; 98f44cb0 Igor Mitsyanko 2017-05-11 224 default: 98f44cb0 Igor Mitsyanko 2017-05-11 225 pr_err("MAC%u: unsupported IF type %d\n", mac->macid, type); 98f44cb0 Igor Mitsyanko 2017-05-11 226 return ERR_PTR(-ENOTSUPP); 98f44cb0 Igor Mitsyanko 2017-05-11 227 } 98f44cb0 Igor Mitsyanko 2017-05-11 228 98f44cb0 Igor Mitsyanko 2017-05-11 @229 if (params) 98f44cb0 Igor Mitsyanko 2017-05-11 230 mac_addr = params->macaddr; 98f44cb0 Igor Mitsyanko 2017-05-11 231 6bf96047 Sergey Matyukevich 2019-01-09 @232 ret = qtnf_cmd_send_add_intf(vif, type, params->use_4addr, mac_addr); c6ed298f Sergey Matyukevich 2018-10-05 233 if (ret) { c6ed298f Sergey Matyukevich 2018-10-05 234 pr_err("VIF%u.%u: failed to add VIF %pM\n", c6ed298f Sergey Matyukevich 2018-10-05 235 mac->macid, vif->vifid, mac_addr); 98f44cb0 Igor Mitsyanko 2017-05-11 236 goto err_cmd; 98f44cb0 Igor Mitsyanko 2017-05-11 237 } 98f44cb0 Igor Mitsyanko 2017-05-11 238 98f44cb0 Igor Mitsyanko 2017-05-11 239 if (!is_valid_ether_addr(vif->mac_addr)) { 98f44cb0 Igor Mitsyanko 2017-05-11 240 pr_err("VIF%u.%u: FW reported bad MAC: %pM\n", 98f44cb0 Igor Mitsyanko 2017-05-11 241 mac->macid, vif->vifid, vif->mac_addr); c6ed298f Sergey Matyukevich 2018-10-05 242 ret = -EINVAL; 98f44cb0 Igor Mitsyanko 2017-05-11 243 goto err_mac; 98f44cb0 Igor Mitsyanko 2017-05-11 244 } 98f44cb0 Igor Mitsyanko 2017-05-11 245 c6ed298f Sergey Matyukevich 2018-10-05 246 ret = qtnf_core_net_attach(mac, vif, name, name_assign_t); c6ed298f Sergey Matyukevich 2018-10-05 247 if (ret) { 98f44cb0 Igor Mitsyanko 2017-05-11 248 pr_err("VIF%u.%u: failed to attach netdev\n", mac->macid, 98f44cb0 Igor Mitsyanko 2017-05-11 249 vif->vifid); 98f44cb0 Igor Mitsyanko 2017-05-11 250 goto err_net; 98f44cb0 Igor Mitsyanko 2017-05-11 251 } 98f44cb0 Igor Mitsyanko 2017-05-11 252 98f44cb0 Igor Mitsyanko 2017-05-11 253 vif->wdev.netdev = vif->netdev; 98f44cb0 Igor Mitsyanko 2017-05-11 254 return &vif->wdev; 98f44cb0 Igor Mitsyanko 2017-05-11 255 98f44cb0 Igor Mitsyanko 2017-05-11 256 err_net: 98f44cb0 Igor Mitsyanko 2017-05-11 257 vif->netdev = NULL; 98f44cb0 Igor Mitsyanko 2017-05-11 258 err_mac: 98f44cb0 Igor Mitsyanko 2017-05-11 259 qtnf_cmd_send_del_intf(vif); 98f44cb0 Igor Mitsyanko 2017-05-11 260 err_cmd: 98f44cb0 Igor Mitsyanko 2017-05-11 261 vif->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED; 98f44cb0 Igor Mitsyanko 2017-05-11 262 c6ed298f Sergey Matyukevich 2018-10-05 263 return ERR_PTR(ret); 98f44cb0 Igor Mitsyanko 2017-05-11 264 } 98f44cb0 Igor Mitsyanko 2017-05-11 265 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index 51b33ec78fac..9e0ac1744be7 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -139,7 +139,8 @@ qtnf_change_virtual_intf(struct wiphy *wiphy, qtnf_scan_done(vif->mac, true); - ret = qtnf_cmd_send_change_intf_type(vif, type, mac_addr); + ret = qtnf_cmd_send_change_intf_type(vif, type, params->use_4addr, + mac_addr); if (ret) { pr_err("VIF%u.%u: failed to change type to %d\n", vif->mac->macid, vif->vifid, type); @@ -228,7 +229,7 @@ static struct wireless_dev *qtnf_add_virtual_intf(struct wiphy *wiphy, if (params) mac_addr = params->macaddr; - ret = qtnf_cmd_send_add_intf(vif, type, mac_addr); + ret = qtnf_cmd_send_add_intf(vif, type, params->use_4addr, mac_addr); if (ret) { pr_err("VIF%u.%u: failed to add VIF %pM\n", mac->macid, vif->vifid, mac_addr); @@ -1107,7 +1108,8 @@ int qtnf_wiphy_register(struct qtnf_hw_info *hw_info, struct qtnf_wmac *mac) wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD | WIPHY_FLAG_AP_UAPSD | - WIPHY_FLAG_HAS_CHANNEL_SWITCH; + WIPHY_FLAG_HAS_CHANNEL_SWITCH | + WIPHY_FLAG_4ADDR_STATION; wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; if (hw_info->hw_capab & QLINK_HW_CAPAB_DFS_OFFLOAD) diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index c2f085589f54..0748a756cc1c 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -734,6 +734,7 @@ int qtnf_cmd_get_sta_info(struct qtnf_vif *vif, const u8 *sta_mac, static int qtnf_cmd_send_add_change_intf(struct qtnf_vif *vif, enum nl80211_iftype iftype, + int use4addr, u8 *mac_addr, enum qlink_cmd_type cmd_type) { @@ -751,6 +752,7 @@ static int qtnf_cmd_send_add_change_intf(struct qtnf_vif *vif, qtnf_bus_lock(vif->mac->bus); cmd = (struct qlink_cmd_manage_intf *)cmd_skb->data; + cmd->intf_info.use4addr = use4addr; switch (iftype) { case NL80211_IFTYPE_AP: @@ -786,17 +788,19 @@ static int qtnf_cmd_send_add_change_intf(struct qtnf_vif *vif, return ret; } -int qtnf_cmd_send_add_intf(struct qtnf_vif *vif, - enum nl80211_iftype iftype, u8 *mac_addr) +int qtnf_cmd_send_add_intf(struct qtnf_vif *vif, enum nl80211_iftype iftype, + int use4addr, u8 *mac_addr) { - return qtnf_cmd_send_add_change_intf(vif, iftype, mac_addr, + return qtnf_cmd_send_add_change_intf(vif, iftype, use4addr, mac_addr, QLINK_CMD_ADD_INTF); } int qtnf_cmd_send_change_intf_type(struct qtnf_vif *vif, - enum nl80211_iftype iftype, u8 *mac_addr) + enum nl80211_iftype iftype, + int use4addr, + u8 *mac_addr) { - return qtnf_cmd_send_add_change_intf(vif, iftype, mac_addr, + return qtnf_cmd_send_add_change_intf(vif, iftype, use4addr, mac_addr, QLINK_CMD_CHANGE_INTF); } diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.h b/drivers/net/wireless/quantenna/qtnfmac/commands.h index 1ac41156c192..1c25e7905e9a 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.h +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.h @@ -26,9 +26,11 @@ void qtnf_cmd_send_deinit_fw(struct qtnf_bus *bus); int qtnf_cmd_get_hw_info(struct qtnf_bus *bus); int qtnf_cmd_get_mac_info(struct qtnf_wmac *mac); int qtnf_cmd_send_add_intf(struct qtnf_vif *vif, enum nl80211_iftype iftype, - u8 *mac_addr); + int use4addr, u8 *mac_addr); int qtnf_cmd_send_change_intf_type(struct qtnf_vif *vif, - enum nl80211_iftype iftype, u8 *mac_addr); + enum nl80211_iftype iftype, + int use4addr, + u8 *mac_addr); int qtnf_cmd_send_del_intf(struct qtnf_vif *vif); int qtnf_cmd_band_info_get(struct qtnf_wmac *mac, struct ieee80211_supported_band *band); diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.c b/drivers/net/wireless/quantenna/qtnfmac/core.c index 5d18a4a917c9..29258acfa8dc 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.c +++ b/drivers/net/wireless/quantenna/qtnfmac/core.c @@ -195,6 +195,7 @@ static int qtnf_netdev_set_mac_address(struct net_device *ndev, void *addr) qtnf_scan_done(vif->mac, true); ret = qtnf_cmd_send_change_intf_type(vif, vif->wdev.iftype, + vif->wdev.use_4addr, sa->sa_data); if (ret) @@ -545,7 +546,8 @@ static int qtnf_core_mac_attach(struct qtnf_bus *bus, unsigned int macid) goto error; } - ret = qtnf_cmd_send_add_intf(vif, vif->wdev.iftype, vif->mac_addr); + ret = qtnf_cmd_send_add_intf(vif, vif->wdev.iftype, + vif->wdev.use_4addr, vif->mac_addr); if (ret) { pr_err("MAC%u: failed to add VIF\n", macid); goto error; diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink.h b/drivers/net/wireless/quantenna/qtnfmac/qlink.h index f9c7f87afaf8..a78cb9e05068 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink.h @@ -105,7 +105,8 @@ struct qlink_intf_info { __le16 if_type; __le16 vlanid; u8 mac_addr[ETH_ALEN]; - u8 rsvd[2]; + u8 use4addr; + u8 rsvd[1]; } __packed; enum qlink_sta_flags {
Advertise WIPHY_FLAG_4ADDR_STATION capability to wireless core. Send use4addr interface change flag to firmware in change_virtual_intf cfg80211 callback. In order to enable adding wireless station interface to bridge one should turn on 4addr mode using the following command: $ iw dev wlan0 set 4addr on $ brctl addif br0 wlan0 If this commands succeeds, then interface can be added to bridge. Note that when wireless interface is added to bridge, wpa_supplicant should be started with appropriate -b <brname> parameter, e.g: $ wpa_supplicant -Dnl80211 -iwlan0 -c/path/to/wpa_s.conf -b br0 Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com> --- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 8 +++++--- drivers/net/wireless/quantenna/qtnfmac/commands.c | 14 +++++++++----- drivers/net/wireless/quantenna/qtnfmac/commands.h | 6 ++++-- drivers/net/wireless/quantenna/qtnfmac/core.c | 4 +++- drivers/net/wireless/quantenna/qtnfmac/qlink.h | 3 ++- 5 files changed, 23 insertions(+), 12 deletions(-)