qcacld-3.0: Add NAN TX checksum offload INI entry

Currently there is a single INI item tcp_udp_checksumoffload to enable
or disable this feature for all the adapters. In some cases, we want to
be able to enable this feature selectively for NAN mode.

Add nan_tcp_udp_checksumoffload ini item to enable or disable checksum
offload feature specifically for NAN mode. If
nan_tcp_udp_checksumoffload is 'true' and tcp_udp_checksumoffload is
false, hardware checksum offload will be enabled only for the NAN
adapter and not for other adapters.

CRs-Fixed: 2698342
Change-Id: I56319095e6229d77ddb5c790d0af9c6ba0267611
This commit is contained in:
Mohit Khanna 2020-05-21 17:03:46 -07:00 • committed by nshrivas
commit 0bb3f018bf
4 changed files with 72 additions and 17 deletions

View file

@ -403,6 +403,8 @@ static void cds_cdp_cfg_attach(struct wlan_objmgr_psoc *psoc)
cdp_cfg.enable_rxthread = hdd_ctx->enable_rxthread;
cdp_cfg.ip_tcp_udp_checksum_offload =
cfg_get(psoc, CFG_DP_TCP_UDP_CKSUM_OFFLOAD);
cdp_cfg.nan_ip_tcp_udp_checksum_offload =
cfg_get(psoc, CFG_DP_NAN_TCP_UDP_CKSUM_OFFLOAD);
cdp_cfg.ce_classify_enabled =
cfg_get(psoc, CFG_DP_CE_CLASSIFY_ENABLE);
cdp_cfg.tso_enable = cfg_get(psoc, CFG_DP_TSO);

View file

@ -3247,6 +3247,16 @@ static inline void hdd_set_sg_flags(struct hdd_context *hdd_ctx,
struct net_device *wlan_dev){}
#endif
/**
* hdd_set_netdev_flags() - set netdev flags for adapter as per ini config
* @adapter: hdd adapter context
*
* This function sets netdev feature flags for the adapter.
*
* Return: none
*/
void hdd_set_netdev_flags(struct hdd_adapter *adapter);
#ifdef FEATURE_TSO
/**
* hdd_set_tso_flags() - enable TSO flags in the network device

View file

@ -6871,6 +6871,62 @@ QDF_STATUS hdd_stop_all_adapters(struct hdd_context *hdd_ctx)
return QDF_STATUS_SUCCESS;
}
void hdd_set_netdev_flags(struct hdd_adapter *adapter)
{
bool enable_csum = false;
enum QDF_OPMODE device_mode;
struct hdd_context *hdd_ctx;
ol_txrx_soc_handle soc;
uint64_t temp;
if (!adapter || !adapter->dev) {
hdd_err("invalid input!");
return;
}
hdd_ctx = adapter->hdd_ctx;
device_mode = adapter->device_mode;
soc = cds_get_context(QDF_MODULE_ID_SOC);
/* Determine device_mode specific configuration */
switch (device_mode) {
case QDF_NDI_MODE:
case QDF_NAN_DISC_MODE:
if (cdp_cfg_get(soc,
cfg_dp_enable_nan_ip_tcp_udp_checksum_offload))
enable_csum = true;
break;
default:
if (cdp_cfg_get(soc,
cfg_dp_enable_ip_tcp_udp_checksum_offload))
enable_csum = true;
}
/* Set netdev flags */
/*
* In case of USB tethering, LRO is disabled. If SSR happened
* during that time, then as part of SSR init, do not enable
* the LRO again. Keep the LRO state same as before SSR.
*/
if (cdp_cfg_get(soc, cfg_dp_lro_enable) &&
!(qdf_atomic_read(&hdd_ctx->vendor_disable_lro_flag)))
adapter->dev->features |= NETIF_F_LRO;
if (enable_csum)
adapter->dev->features |=
(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
if (cdp_cfg_get(soc, cfg_dp_tso_enable) && enable_csum)
adapter->dev->features |=
(NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG);
adapter->dev->features |= NETIF_F_RXCSUM;
temp = (uint64_t)adapter->dev->features;
hdd_debug("adapter mode %u dev feature 0x%llx", device_mode, temp);
}
static void hdd_reset_scan_operation(struct hdd_context *hdd_ctx,
struct hdd_adapter *adapter)
{
@ -16332,6 +16388,9 @@ static int hdd_update_dp_config(struct hdd_context *hdd_ctx)
params.flow_steering_enable =
cfg_get(hdd_ctx->psoc, CFG_DP_FLOW_STEERING_ENABLED);
params.napi_enable = hdd_ctx->napi_enable;
params.nan_tcp_udp_checksumoffload =
cfg_get(hdd_ctx->psoc,
CFG_DP_NAN_TCP_UDP_CKSUM_OFFLOAD);
params.tcp_udp_checksumoffload =
cfg_get(hdd_ctx->psoc,
CFG_DP_TCP_UDP_CKSUM_OFFLOAD);

View file

@ -450,7 +450,6 @@ int hdd_init_nan_data_mode(struct hdd_adapter *adapter)
{
struct net_device *wlan_dev = adapter->dev;
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
void *soc;
QDF_STATUS status;
int32_t ret_val;
mac_handle_t mac_handle;
@ -507,22 +506,7 @@ int hdd_init_nan_data_mode(struct hdd_adapter *adapter)
if (0 != ret_val)
hdd_err("WMI_PDEV_PARAM_BURST_ENABLE set failed %d", ret_val);
soc = cds_get_context(QDF_MODULE_ID_SOC);
/*
* In case of USB tethering, LRO is disabled. If SSR happened
* during that time, then as part of SSR init, do not enable
* the LRO again. Keep the LRO state same as before SSR.
*/
if (cdp_cfg_get(soc, cfg_dp_lro_enable) &&
!(qdf_atomic_read(&hdd_ctx->vendor_disable_lro_flag)))
adapter->dev->features |= NETIF_F_LRO;
if (cdp_cfg_get(soc, cfg_dp_enable_ip_tcp_udp_checksum_offload))
adapter->dev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
adapter->dev->features |= NETIF_F_RXCSUM;
hdd_set_tso_flags(hdd_ctx, adapter->dev);
hdd_set_netdev_flags(adapter);
update_ndi_state(adapter, NAN_DATA_NDI_CREATING_STATE);
return ret_val;