From 07415b8eb1852d7e9ee593bc6c208ec157b31c19 Mon Sep 17 00:00:00 2001 From: Liangwei Dong Date: Mon, 22 Nov 2021 16:54:44 +0800 Subject: [PATCH] qcacld-3.0: optimization of p2p miracast connecting time Add new parameter 128/129 for miracast command to enable/disable p2p connection time optimization. The command needs to be issued before p2p negotiation/invitation/connecting, the driver will do some necessary configuration to reduce the p2p connecting time. At present, disabling IMPS is the only configuration to achieve it. Change-Id: I518b0027290d0254313031fe23315b718565e04b CRs-Fixed: 3031461 --- core/hdd/src/wlan_hdd_ioctl.c | 44 ++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index 9f3b4a5081dc..4abc434093c1 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -80,11 +81,20 @@ #define WLAN_PRIV_DATA_MAX_LEN 8192 /* - * Driver miracast parameters 0-Disabled + * Driver miracast parameters: + * 0-Disabled * 1-Source, 2-Sink + * 128: miracast connecting time optimization enabled. At present host + * will disable imps to reduce connection time for p2p. + * 129: miracast connecting time optimization disabled */ -#define WLAN_HDD_DRIVER_MIRACAST_CFG_MIN_VAL 0 -#define WLAN_HDD_DRIVER_MIRACAST_CFG_MAX_VAL 2 +enum miracast_param { + MIRACAST_DISABLED, + MIRACAST_SOURCE, + MIRACAST_SINK, + MIRACAST_CONN_OPT_ENABLED = 128, + MIRACAST_CONN_OPT_DISABLED = 129, +}; /* * When ever we need to print IBSSPEERINFOALL for more than 16 STA @@ -4866,12 +4876,34 @@ static int drv_cmd_miracast(struct hdd_adapter *adapter, ret = -EINVAL; goto exit; } - if ((filter_type < WLAN_HDD_DRIVER_MIRACAST_CFG_MIN_VAL) || - (filter_type > WLAN_HDD_DRIVER_MIRACAST_CFG_MAX_VAL)) { - hdd_err("Accepted Values are 0 to 2. 0-Disabled, 1-Source, 2-Sink"); + hdd_debug("filter_type %d", filter_type); + + switch (filter_type) { + case MIRACAST_DISABLED: + case MIRACAST_SOURCE: + case MIRACAST_SINK: + break; + case MIRACAST_CONN_OPT_ENABLED: + case MIRACAST_CONN_OPT_DISABLED: + { + bool is_imps_enabled = true; + + ucfg_mlme_is_imps_enabled(hdd_ctx->psoc, + &is_imps_enabled); + if (!is_imps_enabled) + return 0; + hdd_set_idle_ps_config( + hdd_ctx, + filter_type == + MIRACAST_CONN_OPT_ENABLED ? false : true); + return 0; + } + default: + hdd_err("accepted Values: 0-Disabled, 1-Source, 2-Sink, 128,129"); ret = -EINVAL; goto exit; } + /* Filtertype value should be either 0-Disabled, 1-Source, 2-sink */ hdd_ctx->miracast_value = filter_type;