qcacld-3.0: add support to customize dscp-to-up map table

Add support to customize DSCP-to-UP map table and send the
customized map values to FW to update its corresponding
map table.

Change-Id: Ibe9704a90468c898dd2e60fdf83a271152f654ce
CRs-Fixed: 2616247
This commit is contained in:
Vevek Venkatesan
2020-01-28 13:08:51 +05:30
committed by nshrivas
parent 3ea423bf7e
commit 656edfa1f8
10 changed files with 259 additions and 16 deletions

3
Kbuild
View File

@@ -3140,6 +3140,9 @@ ccflags-$(CONFIG_WMI_SEND_RECV_QMI) += -DWLAN_FEATURE_WMI_SEND_RECV_QMI
cppflags-$(CONFIG_WDI3_STATS_UPDATE) += -DWDI3_STATS_UPDATE cppflags-$(CONFIG_WDI3_STATS_UPDATE) += -DWDI3_STATS_UPDATE
cppflags-$(CONFIG_WLAN_CUSTOM_DSCP_UP_MAP) += -DWLAN_CUSTOM_DSCP_UP_MAP
cppflags-$(CONFIG_WLAN_SEND_DSCP_UP_MAP_TO_FW) += -DWLAN_SEND_DSCP_UP_MAP_TO_FW
KBUILD_CPPFLAGS += $(cppflags-y) KBUILD_CPPFLAGS += $(cppflags-y)
# Currently, for versions of gcc which support it, the kernel Makefile # Currently, for versions of gcc which support it, the kernel Makefile

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019 The Linux Foundation. All rights reserved. * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -76,6 +76,7 @@ struct wlan_fwol_callbacks {
* @get_elna_bypass: get eLNA bypass * @get_elna_bypass: get eLNA bypass
* @reg_evt_handler: register event handler * @reg_evt_handler: register event handler
* @unreg_evt_handler: unregister event handler * @unreg_evt_handler: unregister event handler
* @send_dscp_up_map_to_fw: send dscp-to-up map values to FW
*/ */
struct wlan_fwol_tx_ops { struct wlan_fwol_tx_ops {
#ifdef WLAN_FEATURE_ELNA #ifdef WLAN_FEATURE_ELNA
@@ -88,6 +89,11 @@ struct wlan_fwol_tx_ops {
void *arg); void *arg);
QDF_STATUS (*unreg_evt_handler)(struct wlan_objmgr_psoc *psoc, QDF_STATUS (*unreg_evt_handler)(struct wlan_objmgr_psoc *psoc,
void *arg); void *arg);
#ifdef WLAN_SEND_DSCP_UP_MAP_TO_FW
QDF_STATUS (*send_dscp_up_map_to_fw)(
struct wlan_objmgr_psoc *psoc,
uint32_t *dscp_to_up_map);
#endif
}; };
/** /**

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -543,6 +543,27 @@ QDF_STATUS ucfg_fwol_get_elna_bypass(struct wlan_objmgr_vdev *vdev,
struct get_elna_bypass_response *response), struct get_elna_bypass_response *response),
void *context); void *context);
#endif /* WLAN_FEATURE_ELNA */ #endif /* WLAN_FEATURE_ELNA */
#ifdef WLAN_SEND_DSCP_UP_MAP_TO_FW
/**
* ucfg_fwol_send_dscp_up_map_to_fw() - send dscp_up map to FW
* @vdev: vdev handle
* @dscp_to_up_map: DSCP to UP map array
*
* Return: QDF_STATUS_SUCCESS on success
*/
QDF_STATUS ucfg_fwol_send_dscp_up_map_to_fw(
struct wlan_objmgr_vdev *vdev,
uint32_t *dscp_to_up_map);
#else
static inline
QDF_STATUS ucfg_fwol_send_dscp_up_map_to_fw(
struct wlan_objmgr_vdev *vdev,
uint32_t *dscp_to_up_map)
{
return QDF_STATUS_SUCCESS;
}
#endif
#else #else
static inline QDF_STATUS ucfg_fwol_psoc_open(struct wlan_objmgr_psoc *psoc) static inline QDF_STATUS ucfg_fwol_psoc_open(struct wlan_objmgr_psoc *psoc)
{ {

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -896,3 +896,34 @@ QDF_STATUS ucfg_fwol_get_elna_bypass(struct wlan_objmgr_vdev *vdev,
return status; return status;
} }
#endif /* WLAN_FEATURE_ELNA */ #endif /* WLAN_FEATURE_ELNA */
#ifdef WLAN_SEND_DSCP_UP_MAP_TO_FW
QDF_STATUS ucfg_fwol_send_dscp_up_map_to_fw(struct wlan_objmgr_vdev *vdev,
uint32_t *dscp_to_up_map)
{
QDF_STATUS status;
struct wlan_objmgr_psoc *psoc;
struct wlan_fwol_psoc_obj *fwol_obj;
struct wlan_fwol_tx_ops *tx_ops;
psoc = wlan_vdev_get_psoc(vdev);
if (!psoc) {
fwol_err("NULL pointer for psoc");
return QDF_STATUS_E_INVAL;
}
fwol_obj = fwol_get_psoc_obj(psoc);
if (!fwol_obj) {
fwol_err("Failed to get FWOL Obj");
return QDF_STATUS_E_INVAL;
}
tx_ops = &fwol_obj->tx_ops;
if (tx_ops && tx_ops->send_dscp_up_map_to_fw)
status = tx_ops->send_dscp_up_map_to_fw(psoc, dscp_to_up_map);
else
status = QDF_STATUS_E_IO;
return status;
}
#endif /* WLAN_SEND_DSCP_UP_MAP_TO_FW */

View File

@@ -201,6 +201,45 @@ target_if_fwol_register_elna_tx_ops(struct wlan_fwol_tx_ops *tx_ops)
} }
#endif /* WLAN_FEATURE_ELNA */ #endif /* WLAN_FEATURE_ELNA */
#ifdef WLAN_SEND_DSCP_UP_MAP_TO_FW
/**
* target_if_fwol_send_dscp_up_map_to_fw() - send dscp up map to FW
* @psoc: pointer to PSOC object
* @dscp_to_up_map: DSCP to UP map array
*
* Return: QDF_STATUS_SUCCESS on success
*/
static QDF_STATUS
target_if_fwol_send_dscp_up_map_to_fw(struct wlan_objmgr_psoc *psoc,
uint32_t *dscp_to_up_map)
{
QDF_STATUS status;
wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle) {
target_if_err("Invalid wmi_handle");
return QDF_STATUS_E_INVAL;
}
status = wmi_unified_send_dscp_tip_map_cmd(wmi_handle, dscp_to_up_map);
if (status)
target_if_err("Failed to send dscp_up_map_to_fw %d", status);
return status;
}
static void
target_if_fwol_register_dscp_up_tx_ops(struct wlan_fwol_tx_ops *tx_ops)
{
tx_ops->send_dscp_up_map_to_fw = target_if_fwol_send_dscp_up_map_to_fw;
}
#else
static void
target_if_fwol_register_dscp_up_tx_ops(struct wlan_fwol_tx_ops *tx_ops)
{
}
#endif
QDF_STATUS target_if_fwol_register_event_handler(struct wlan_objmgr_psoc *psoc, QDF_STATUS target_if_fwol_register_event_handler(struct wlan_objmgr_psoc *psoc,
void *arg) void *arg)
{ {
@@ -221,6 +260,7 @@ target_if_fwol_unregister_event_handler(struct wlan_objmgr_psoc *psoc,
QDF_STATUS target_if_fwol_register_tx_ops(struct wlan_fwol_tx_ops *tx_ops) QDF_STATUS target_if_fwol_register_tx_ops(struct wlan_fwol_tx_ops *tx_ops)
{ {
target_if_fwol_register_elna_tx_ops(tx_ops); target_if_fwol_register_elna_tx_ops(tx_ops);
target_if_fwol_register_dscp_up_tx_ops(tx_ops);
tx_ops->reg_evt_handler = target_if_fwol_register_event_handler; tx_ops->reg_evt_handler = target_if_fwol_register_event_handler;
tx_ops->unreg_evt_handler = target_if_fwol_unregister_event_handler; tx_ops->unreg_evt_handler = target_if_fwol_unregister_event_handler;

View File

@@ -615,6 +615,12 @@ ifeq ($(CONFIG_HELIUMPLUS), y)
CONFIG_PKTLOG_LEGACY := y CONFIG_PKTLOG_LEGACY := y
endif endif
#Customize DSCP_to-UP map based on RFC8325
ifeq ($(CONFIG_HELIUMPLUS), y)
CONFIG_WLAN_CUSTOM_DSCP_UP_MAP := y
CONFIG_WLAN_SEND_DSCP_UP_MAP_TO_FW := y
endif
ifeq ($(CONFIG_ROME_IF), sdio) ifeq ($(CONFIG_ROME_IF), sdio)
CONFIG_PKTLOG_LEGACY := y CONFIG_PKTLOG_LEGACY := y
endif endif

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011-2012,2016-2019 The Linux Foundation. All rights reserved. * Copyright (c) 2011-2012,2016-2020 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -204,6 +204,17 @@ extern const uint8_t hdd_linux_up_to_ac_map[];
*/ */
int hdd_wmmps_helper(struct hdd_adapter *adapter, uint8_t *ptr); int hdd_wmmps_helper(struct hdd_adapter *adapter, uint8_t *ptr);
/**
* hdd_send_dscp_up_map_to_fw() - send dscp to up map to FW
* @adapter : [in] pointer to Adapter context
*
* This function will send the WMM DSCP configuration of an
* adapter to FW.
*
* Return: QDF_STATUS enumeration
*/
QDF_STATUS hdd_send_dscp_up_map_to_fw(struct hdd_adapter *adapter);
/** /**
* hdd_wmm_init() - initialize the WMM DSCP configuation * hdd_wmm_init() - initialize the WMM DSCP configuation
* @adapter : [in] pointer to Adapter context * @adapter : [in] pointer to Adapter context

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2019 The Linux Foundation. All rights reserved. * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -47,6 +47,7 @@
#include <linux/semaphore.h> #include <linux/semaphore.h>
#include <linux/ipv6.h> #include <linux/ipv6.h>
#include "osif_sync.h" #include "osif_sync.h"
#include "os_if_fwol.h"
#include <wlan_hdd_tx_rx.h> #include <wlan_hdd_tx_rx.h>
#include <wlan_hdd_wmm.h> #include <wlan_hdd_wmm.h>
#include <wlan_hdd_ether.h> #include <wlan_hdd_ether.h>
@@ -55,8 +56,10 @@
#include <cds_sched.h> #include <cds_sched.h>
#include "sme_api.h" #include "sme_api.h"
#include "wlan_mlme_ucfg_api.h" #include "wlan_mlme_ucfg_api.h"
#include "cfg_ucfg_api.h"
#define HDD_WMM_UP_TO_AC_MAP_SIZE 8 #define HDD_WMM_UP_TO_AC_MAP_SIZE 8
#define DSCP(x) x
const uint8_t hdd_wmm_up_to_ac_map[] = { const uint8_t hdd_wmm_up_to_ac_map[] = {
SME_AC_BE, SME_AC_BE,
@@ -1456,6 +1459,92 @@ static void hdd_wmm_do_implicit_qos(struct work_struct *work)
osif_vdev_sync_op_stop(vdev_sync); osif_vdev_sync_op_stop(vdev_sync);
} }
QDF_STATUS hdd_send_dscp_up_map_to_fw(struct hdd_adapter *adapter)
{
uint32_t *dscp_to_up_map = adapter->dscp_to_up_map;
struct wlan_objmgr_vdev *vdev = adapter->vdev;
int ret;
if (vdev) {
/* Send DSCP to TID map table to FW */
ret = os_if_fwol_send_dscp_up_map_to_fw(vdev, dscp_to_up_map);
if (ret && ret != -EOPNOTSUPP)
return QDF_STATUS_E_FAILURE;
}
return QDF_STATUS_SUCCESS;
}
/**
* hdd_fill_dscp_to_up_map() - Fill up dscp_to_up_map table with default values
* @dscp_to_up_map: Array of DSCP-to-UP map
*
* This function will fill up the DSCP-to-UP map table with default values.
*
* Return: QDF_STATUS enumeration
*/
static inline void hdd_fill_dscp_to_up_map(
enum sme_qos_wmmuptype *dscp_to_up_map)
{
uint8_t dscp;
/*
* DSCP to User Priority Lookup Table
* By default use the 3 Precedence bits of DSCP as the User Priority
*
* In case of changing the default map values, need to take care of
* hdd_custom_dscp_up_map as well.
*/
for (dscp = 0; dscp <= WLAN_MAX_DSCP; dscp++)
dscp_to_up_map[dscp] = dscp >> 3;
/* Special case for Expedited Forwarding (DSCP 46) in default mapping */
dscp_to_up_map[DSCP(46)] = SME_QOS_WMM_UP_VO;
}
#ifdef WLAN_CUSTOM_DSCP_UP_MAP
/**
* hdd_custom_dscp_up_map() - Customize dscp_to_up_map based on RFC8325
* @dscp_to_up_map: Array of DSCP-to-UP map
*
* This function will customize the DSCP-to-UP map table based on RFC8325..
*
* Return: QDF_STATUS enumeration
*/
static inline QDF_STATUS hdd_custom_dscp_up_map(
enum sme_qos_wmmuptype *dscp_to_up_map)
{
/*
* Customizing few of DSCP to UP mapping based on RFC8325,
* those are different from default hdd_fill_dscp_to_up_map values.
* So, below changes are always relative to hdd_fill_dscp_to_up_map.
*/
dscp_to_up_map[DSCP(10)] = SME_QOS_WMM_UP_BE;
dscp_to_up_map[DSCP(12)] = SME_QOS_WMM_UP_BE;
dscp_to_up_map[DSCP(14)] = SME_QOS_WMM_UP_BE;
dscp_to_up_map[DSCP(16)] = SME_QOS_WMM_UP_BE;
dscp_to_up_map[DSCP(18)] = SME_QOS_WMM_UP_EE;
dscp_to_up_map[DSCP(20)] = SME_QOS_WMM_UP_EE;
dscp_to_up_map[DSCP(22)] = SME_QOS_WMM_UP_EE;
dscp_to_up_map[DSCP(24)] = SME_QOS_WMM_UP_CL;
dscp_to_up_map[DSCP(26)] = SME_QOS_WMM_UP_CL;
dscp_to_up_map[DSCP(28)] = SME_QOS_WMM_UP_CL;
dscp_to_up_map[DSCP(30)] = SME_QOS_WMM_UP_CL;
dscp_to_up_map[DSCP(44)] = SME_QOS_WMM_UP_VO;
return QDF_STATUS_SUCCESS;
}
#else
static inline QDF_STATUS hdd_custom_dscp_up_map(
enum sme_qos_wmmuptype *dscp_to_up_map)
{
return QDF_STATUS_E_NOSUPPORT;
}
#endif /* WLAN_CUSTOM_DSCP_UP_MAP */
/** /**
* hdd_wmm_init() - initialize the WMM DSCP configuation * hdd_wmm_init() - initialize the WMM DSCP configuation
* @adapter : [in] pointer to Adapter context * @adapter : [in] pointer to Adapter context
@@ -1469,20 +1558,24 @@ static void hdd_wmm_do_implicit_qos(struct work_struct *work)
QDF_STATUS hdd_wmm_init(struct hdd_adapter *adapter) QDF_STATUS hdd_wmm_init(struct hdd_adapter *adapter)
{ {
enum sme_qos_wmmuptype *dscp_to_up_map = adapter->dscp_to_up_map; enum sme_qos_wmmuptype *dscp_to_up_map = adapter->dscp_to_up_map;
uint8_t dscp; struct wlan_objmgr_psoc *psoc = adapter->hdd_ctx->psoc;
QDF_STATUS status = QDF_STATUS_SUCCESS;
hdd_enter(); hdd_enter();
/* DSCP to User Priority Lookup Table if (!psoc) {
* By default use the 3 Precedence bits of DSCP as the User Priority hdd_err("Invalid psoc handle");
*/ return QDF_STATUS_E_FAILURE;
for (dscp = 0; dscp <= WLAN_MAX_DSCP; dscp++) }
dscp_to_up_map[dscp] = dscp >> 3;
/* Special case for Expedited Forwarding (DSCP 46) */ hdd_fill_dscp_to_up_map(dscp_to_up_map);
dscp_to_up_map[46] = SME_QOS_WMM_UP_VO;
return QDF_STATUS_SUCCESS; if (hdd_custom_dscp_up_map(dscp_to_up_map) == QDF_STATUS_SUCCESS) {
/* Send DSCP to TID map table to FW */
status = hdd_send_dscp_up_map_to_fw(adapter);
}
return status;
} }
/** /**

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019 The Linux Foundation. All rights reserved. * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -64,4 +64,22 @@ static inline int os_if_fwol_get_elna_bypass(struct wlan_objmgr_vdev *vdev,
} }
#endif /* WLAN_FEATURE_ELNA */ #endif /* WLAN_FEATURE_ELNA */
#ifdef WLAN_SEND_DSCP_UP_MAP_TO_FW
/**
* os_if_fwol_send_dscp_up_map_to_fw() - Send DSCP to UP map to FW
* @vdev: Pointer to vdev
* @dscp_to_up_map: Array of DSCP to UP map values
*
* Return: 0 on success; error number otherwise
*/
int os_if_fwol_send_dscp_up_map_to_fw(struct wlan_objmgr_vdev *vdev,
uint32_t *dscp_to_up_map);
#else
static inline int os_if_fwol_send_dscp_up_map_to_fw(
struct wlan_objmgr_vdev *vdev, uint32_t *dscp_to_up_map)
{
return -EOPNOTSUPP;
}
#endif /* WLAN_SEND_DSCP_UP_MAP_TO_FW */
#endif /* __OS_IF_FWOL_H__ */ #endif /* __OS_IF_FWOL_H__ */

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019 The Linux Foundation. All rights reserved. * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -131,3 +131,17 @@ end:
return ret; return ret;
} }
#endif /* #ifdef WLAN_FEATURE_ELNA */ #endif /* #ifdef WLAN_FEATURE_ELNA */
#ifdef WLAN_SEND_DSCP_UP_MAP_TO_FW
int os_if_fwol_send_dscp_up_map_to_fw(struct wlan_objmgr_vdev *vdev,
uint32_t *dscp_to_up_map)
{
QDF_STATUS status;
status = ucfg_fwol_send_dscp_up_map_to_fw(vdev, dscp_to_up_map);
if (!QDF_IS_STATUS_SUCCESS(status))
osif_err("Failed to send dscp_up_map to FW, %d", status);
return qdf_status_to_os_return(status);
}
#endif