These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / net / wireless / ti / wlcore / cmd.c
index 68919f8..f01d24b 100644 (file)
@@ -2003,12 +2003,15 @@ int wl12xx_start_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                      wlvif->bss_type == BSS_TYPE_IBSS)))
                return -EINVAL;
 
-       ret = wl12xx_cmd_role_enable(wl,
-                                    wl12xx_wlvif_to_vif(wlvif)->addr,
-                                    WL1271_ROLE_DEVICE,
-                                    &wlvif->dev_role_id);
-       if (ret < 0)
-               goto out;
+       /* the dev role is already started for p2p mgmt interfaces */
+       if (!wlcore_is_p2p_mgmt(wlvif)) {
+               ret = wl12xx_cmd_role_enable(wl,
+                                            wl12xx_wlvif_to_vif(wlvif)->addr,
+                                            WL1271_ROLE_DEVICE,
+                                            &wlvif->dev_role_id);
+               if (ret < 0)
+                       goto out;
+       }
 
        ret = wl12xx_cmd_role_start_dev(wl, wlvif, band, channel);
        if (ret < 0)
@@ -2023,7 +2026,8 @@ int wl12xx_start_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif,
 out_stop:
        wl12xx_cmd_role_stop_dev(wl, wlvif);
 out_disable:
-       wl12xx_cmd_role_disable(wl, &wlvif->dev_role_id);
+       if (!wlcore_is_p2p_mgmt(wlvif))
+               wl12xx_cmd_role_disable(wl, &wlvif->dev_role_id);
 out:
        return ret;
 }
@@ -2052,10 +2056,42 @@ int wl12xx_stop_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif)
        if (ret < 0)
                goto out;
 
-       ret = wl12xx_cmd_role_disable(wl, &wlvif->dev_role_id);
-       if (ret < 0)
-               goto out;
+       if (!wlcore_is_p2p_mgmt(wlvif)) {
+               ret = wl12xx_cmd_role_disable(wl, &wlvif->dev_role_id);
+               if (ret < 0)
+                       goto out;
+       }
 
 out:
        return ret;
 }
+
+int wlcore_cmd_generic_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif,
+                          u8 feature, u8 enable, u8 value)
+{
+       struct wlcore_cmd_generic_cfg *cmd;
+       int ret;
+
+       wl1271_debug(DEBUG_CMD,
+                    "cmd generic cfg (role %d feature %d enable %d value %d)",
+                    wlvif->role_id, feature, enable, value);
+
+       cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+       if (!cmd)
+               return -ENOMEM;
+
+       cmd->role_id = wlvif->role_id;
+       cmd->feature = feature;
+       cmd->enable = enable;
+       cmd->value = value;
+
+       ret = wl1271_cmd_send(wl, CMD_GENERIC_CFG, cmd, sizeof(*cmd), 0);
+       if (ret < 0) {
+               wl1271_error("failed to send generic cfg command");
+               goto out_free;
+       }
+out_free:
+       kfree(cmd);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(wlcore_cmd_generic_cfg);