|
@@ -735,6 +735,50 @@ int hdd_ndi_open(const char *iface_name, bool is_add_virtual_iface)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0))
|
|
|
+int hdd_ndi_set_mode(const char *iface_name)
|
|
|
+{
|
|
|
+ struct hdd_adapter *adapter;
|
|
|
+ struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
|
|
|
+ struct qdf_mac_addr random_ndi_mac;
|
|
|
+ uint8_t *ndi_mac_addr = NULL;
|
|
|
+
|
|
|
+ hdd_enter();
|
|
|
+ if (!hdd_ctx)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ adapter = hdd_get_adapter_by_iface_name(hdd_ctx, iface_name);
|
|
|
+ if (!adapter) {
|
|
|
+ hdd_err("adapter is null");
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_nan_get_ndi_mac_randomize(hdd_ctx->psoc)) {
|
|
|
+ if (hdd_get_random_nan_mac_addr(hdd_ctx, &random_ndi_mac)) {
|
|
|
+ hdd_err("get random mac address failed");
|
|
|
+ return -EFAULT;
|
|
|
+ }
|
|
|
+ ndi_mac_addr = &random_ndi_mac.bytes[0];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!ndi_mac_addr) {
|
|
|
+ hdd_err("ndi mac address is null");
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+
|
|
|
+ hdd_update_dynamic_mac(hdd_ctx, &adapter->mac_addr,
|
|
|
+ (struct qdf_mac_addr *)ndi_mac_addr);
|
|
|
+ qdf_mem_copy(&adapter->mac_addr, ndi_mac_addr, ETH_ALEN);
|
|
|
+ qdf_mem_copy(adapter->dev->dev_addr, ndi_mac_addr, ETH_ALEN);
|
|
|
+
|
|
|
+ adapter->device_mode = QDF_NDI_MODE;
|
|
|
+ hdd_debug("Created NDI with device mode:%d and iface_name:%s",
|
|
|
+ adapter->device_mode, iface_name);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
int hdd_ndi_start(const char *iface_name, uint16_t transaction_id)
|
|
|
{
|
|
|
int ret;
|
|
@@ -791,27 +835,6 @@ err_handler:
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-struct wireless_dev *hdd_add_ndi_intf(struct hdd_context *hdd_ctx,
|
|
|
- const char *name)
|
|
|
-{
|
|
|
- int ret;
|
|
|
- struct hdd_adapter *adapter;
|
|
|
-
|
|
|
- hdd_debug("change mode to NDI");
|
|
|
-
|
|
|
- ret = hdd_ndi_open(name, true);
|
|
|
- if (ret) {
|
|
|
- hdd_err("ndi_open failed");
|
|
|
- return ERR_PTR(-EINVAL);
|
|
|
- }
|
|
|
- adapter = hdd_get_adapter_by_iface_name(hdd_ctx, name);
|
|
|
- if (!adapter) {
|
|
|
- hdd_err("adapter is null");
|
|
|
- return ERR_PTR(-EINVAL);
|
|
|
- }
|
|
|
- return adapter->dev->ieee80211_ptr;
|
|
|
-}
|
|
|
-
|
|
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0))
|
|
|
static int hdd_delete_ndi_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
|
|
|
{
|