From 5872c8c1c29045339e7a2b50aff44f6f21e4475f Mon Sep 17 00:00:00 2001 From: Deepak Dhamdhere Date: Thu, 2 Jun 2016 15:51:47 -0700 Subject: [PATCH] qcacld-3.0: Fix __hdd_hard_start_xmit API for NAN Data Interface qcacld-2.0 to qcacld-3.0 propagation Make changes in __hdd_hard_start_xmit API registered with OS to enable data path for NAN Data Interface. Change-Id: I1d54c79da127b1dac7ea8c8e0e855e043571ad77 CRs-Fixed: 962367 --- core/hdd/inc/wlan_hdd_tx_rx.h | 6 +++--- core/hdd/src/wlan_hdd_assoc.c | 2 +- core/hdd/src/wlan_hdd_ioctl.c | 2 +- core/hdd/src/wlan_hdd_nan_datapath.c | 24 ++++++++++++++++++------ core/hdd/src/wlan_hdd_nan_datapath.h | 3 +++ core/hdd/src/wlan_hdd_tx_rx.c | 24 ++++++++++++++++++++---- 6 files changed, 46 insertions(+), 15 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_tx_rx.h b/core/hdd/inc/wlan_hdd_tx_rx.h index d2fd6b5d9c95..0b04a522a098 100644 --- a/core/hdd/inc/wlan_hdd_tx_rx.h +++ b/core/hdd/inc/wlan_hdd_tx_rx.h @@ -66,9 +66,9 @@ QDF_STATUS hdd_rx_mul_packet_cbk(void *cds_context, qdf_nbuf_t rx_buf_list, uint8_t staId); #endif /* IPA_OFFLOAD */ -QDF_STATUS hdd_ibss_get_sta_id(hdd_station_ctx_t *pHddStaCtx, - struct qdf_mac_addr *pMacAddress, - uint8_t *staId); +QDF_STATUS hdd_get_peer_sta_id(hdd_station_ctx_t *sta_ctx, + struct qdf_mac_addr *peer_mac_addr, + uint8_t *sta_id); #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL void hdd_tx_resume_cb(void *adapter_context, bool tx_resume); diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index 4db478d079fe..39bb930d4580 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -1668,7 +1668,7 @@ static QDF_STATUS hdd_roam_set_key_complete_handler(hdd_adapter_t *pAdapter, pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; } else { - qdf_status = hdd_ibss_get_sta_id( + qdf_status = hdd_get_peer_sta_id( pHddStaCtx, &pRoamInfo->peerMac, &staId); diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index 1f0fcc54c67f..fae04076035a 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -5150,7 +5150,7 @@ static int drv_cmd_get_ibss_peer_info(hdd_adapter_t *adapter, } /* Get station index for the peer mac address and sanitize it */ - hdd_ibss_get_sta_id(pHddStaCtx, &peerMacAddr, &staIdx); + hdd_get_peer_sta_id(pHddStaCtx, &peerMacAddr, &staIdx); if (staIdx > MAX_IBSS_PEERS) { hdd_err("Invalid StaIdx %d returned", staIdx); diff --git a/core/hdd/src/wlan_hdd_nan_datapath.c b/core/hdd/src/wlan_hdd_nan_datapath.c index 0278f19aeb83..0361fb944f40 100644 --- a/core/hdd/src/wlan_hdd_nan_datapath.c +++ b/core/hdd/src/wlan_hdd_nan_datapath.c @@ -115,8 +115,9 @@ static int hdd_close_ndi(hdd_adapter_t *adapter) hdd_err(FL("Interface is not in NDI mode")); return -EINVAL; } - netif_tx_disable(adapter->dev); - netif_carrier_off(adapter->dev); + wlan_hdd_netif_queue_control(adapter, + WLAN_NETIF_TX_DISABLE_N_CARRIER, + WLAN_CONTROL_PATH); #ifdef WLAN_OPEN_SOURCE cancel_work_sync(&adapter->ipv4NotifierWorkQueue); @@ -443,7 +444,7 @@ static int hdd_ndp_initiator_req_handler(hdd_context_t *hdd_ctx, { hdd_adapter_t *adapter; char *iface_name; - struct ndp_initiator_req req; + struct ndp_initiator_req req = {0}; QDF_STATUS status; uint32_t ndp_qos_cfg; tHalHandle hal = hdd_ctx->hHal; @@ -700,6 +701,9 @@ static void hdd_ndp_iface_create_rsp_handler(hdd_adapter_t *adapter, hdd_err(FL("NDI interface successfully created")); ndp_ctx->ndp_create_transaction_id = 0; ndp_ctx->state = NAN_DATA_NDI_CREATED_STATE; + wlan_hdd_netif_queue_control(adapter, + WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, + WLAN_CONTROL_PATH); } else { hdd_err(FL("NDI interface creation failed with reason %d"), ndi_rsp->reason); @@ -745,7 +749,9 @@ static void hdd_ndp_iface_delete_rsp_handler(hdd_adapter_t *adapter, else hdd_err(FL("NDI BSS stop failed with reason %d"), ndi_rsp->reason); - + wlan_hdd_netif_queue_control(adapter, + WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, + WLAN_CONTROL_PATH); complete(&adapter->disconnect_comp_var); return; } @@ -955,6 +961,7 @@ static void hdd_ndp_new_peer_ind_handler(hdd_adapter_t *adapter, tCsrRoamInfo roam_info = {0}; struct nan_datapath_ctx *ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(adapter); hdd_station_ctx_t *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); + struct qdf_mac_addr bc_mac_addr = QDF_MAC_ADDR_BROADCAST_INITIALIZER; ENTER(); @@ -972,16 +979,21 @@ static void hdd_ndp_new_peer_ind_handler(hdd_adapter_t *adapter, /* this function is called for each new peer */ ndp_ctx->active_ndp_peers++; + hdd_roam_register_sta(adapter, &roam_info, new_peer_ind->sta_id, &new_peer_ind->peer_mac_addr, &tmp_bss_descp); hdd_ctx->sta_to_adapter[new_peer_ind->sta_id] = adapter; /* perform following steps for first new peer ind */ if (ndp_ctx->active_ndp_peers == 1) { + hdd_ctx->sta_to_adapter[NDP_BROADCAST_STAID] = adapter; + hdd_save_peer(sta_ctx, new_peer_ind->sta_id, &bc_mac_addr); + hdd_roam_register_sta(adapter, &roam_info, NDP_BROADCAST_STAID, + &bc_mac_addr, &tmp_bss_descp); hddLog(LOG1, FL("Set ctx connection state to connected")); sta_ctx->conn_info.connState = eConnectionState_NdiConnected; hdd_wmm_connect(adapter, &roam_info, eCSR_BSS_TYPE_NDI); - netif_carrier_on(adapter->dev); - netif_tx_start_all_queues(adapter->dev); + wlan_hdd_netif_queue_control(adapter, + WLAN_WAKE_ALL_NETIF_QUEUE, WLAN_CONTROL_PATH); } EXIT(); } diff --git a/core/hdd/src/wlan_hdd_nan_datapath.h b/core/hdd/src/wlan_hdd_nan_datapath.h index 93c6b7f7868e..46bb81692200 100644 --- a/core/hdd/src/wlan_hdd_nan_datapath.h +++ b/core/hdd/src/wlan_hdd_nan_datapath.h @@ -40,6 +40,9 @@ struct wireless_dev; #define NDP_APP_INFO_LEN 255 #define NDP_QOS_INFO_LEN 255 +#define HDD_MAX_NUM_NDP_STA (MAX_IBSS_PEERS) +#define NDP_BROADCAST_STAID (0) + #ifdef WLAN_FEATURE_NAN_DATAPATH #define WLAN_HDD_IS_NDI(adapter) ((adapter)->device_mode == QDF_NDI_MODE) diff --git a/core/hdd/src/wlan_hdd_tx_rx.c b/core/hdd/src/wlan_hdd_tx_rx.c index efb6a1ba3736..723be01dc6da 100644 --- a/core/hdd/src/wlan_hdd_tx_rx.c +++ b/core/hdd/src/wlan_hdd_tx_rx.c @@ -57,6 +57,8 @@ #include "cdp_txrx_peer_ops.h" #include "ol_txrx.h" +#include "wlan_hdd_nan_datapath.h" + const uint8_t hdd_wmm_ac_to_highest_up[] = { SME_QOS_WMM_UP_RESV, SME_QOS_WMM_UP_EE, @@ -339,8 +341,8 @@ int hdd_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) (struct qdf_mac_addr *) skb->data; if (QDF_STATUS_SUCCESS != - hdd_ibss_get_sta_id(&pAdapter->sessionCtx.station, - pDestMacAddress, &STAId)) + hdd_get_peer_sta_id(&pAdapter->sessionCtx.station, + pDestMacAddress, &STAId)) STAId = HDD_WLAN_INVALID_STA_ID; if ((STAId == HDD_WLAN_INVALID_STA_ID) && @@ -356,6 +358,20 @@ int hdd_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) __func__); goto drop_pkt; } + } else if (QDF_NDI_MODE == pAdapter->device_mode) { + struct qdf_mac_addr *dest_mac_addr = + (struct qdf_mac_addr *)skb->data; + if (hdd_get_peer_sta_id(&pAdapter->sessionCtx.station, + dest_mac_addr, &STAId) != + QDF_STATUS_SUCCESS) { + QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_WARN, + FL("Can't find peer: %pM, dropping packet"), + dest_mac_addr); + ++pAdapter->stats.tx_dropped; + ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped; + kfree_skb(skb); + return NETDEV_TX_OK; + } } else { if (QDF_OCB_MODE != pAdapter->device_mode && eConnectionState_Associated != @@ -557,7 +573,7 @@ drop_pkt_accounting: } /** - * hdd_ibss_get_sta_id() - Get the StationID using the Peer Mac address + * hdd_get_peer_sta_id() - Get the StationID using the Peer Mac address * @pHddStaCtx: pointer to HDD Station Context * @pMacAddress: pointer to Peer Mac address * @staID: pointer to returned Station Index @@ -565,7 +581,7 @@ drop_pkt_accounting: * Return: QDF_STATUS_SUCCESS/QDF_STATUS_E_FAILURE */ -QDF_STATUS hdd_ibss_get_sta_id(hdd_station_ctx_t *pHddStaCtx, +QDF_STATUS hdd_get_peer_sta_id(hdd_station_ctx_t *pHddStaCtx, struct qdf_mac_addr *pMacAddress, uint8_t *staId) { uint8_t idx;