diff options
| author | Chandrasekaran, Manishekar <cmshekar@qti.qualcomm.com> | 2015-03-12 17:33:54 +0530 |
|---|---|---|
| committer | AnjaneeDevi Kapparapu <c_akappa@qti.qualcomm.com> | 2015-03-30 15:41:38 +0530 |
| commit | b0479563333d06797a42bbfe2bf53a218f032b54 (patch) | |
| tree | 1a4b86163b79e6d6e4ad8da951b394c3c63edeef | |
| parent | beaaa7deca3622cb37c333fd80698d6423bdd7e2 (diff) | |
qcacld: Add support for host based EAPOL events
This change adds new DIAG (EVENT_WLAN_EAPOL)
event within our existing DIAG framework. This
event will be generated whenever EAPOL is
handled within the Host
CRs-Fixed: 806820
Change-Id: Ia93648301fbdc9f2bd662ab8d5070281d1130b16
| -rw-r--r-- | CORE/HDD/inc/wlan_hdd_tx_rx.h | 23 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_softap_tx_rx.c | 3 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_tx_rx.c | 135 | ||||
| -rw-r--r-- | CORE/VOSS/inc/event_defs.h | 3 | ||||
| -rw-r--r-- | CORE/VOSS/inc/vos_diag_core_event.h | 16 |
5 files changed, 179 insertions, 1 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_tx_rx.h b/CORE/HDD/inc/wlan_hdd_tx_rx.h index 7f65dc9851e4..f1bea0bf15fa 100644 --- a/CORE/HDD/inc/wlan_hdd_tx_rx.h +++ b/CORE/HDD/inc/wlan_hdd_tx_rx.h @@ -312,4 +312,27 @@ void hdd_tx_resume_cb(void *adapter_context, ===========================================================================*/ void hdd_tx_resume_timer_expired_handler(void *adapter_context); #endif /* QCA_LL_TX_FLOW_CT */ + +#ifdef FEATURE_WLAN_DIAG_SUPPORT +/** + * wlan_hdd_log_eapol() - Function to check and extract EAPOL params + * @skb: skb data + * @event_type: One of enum wifi_connectivity_events to indicate Tx/Rx + * + * This function parses the input skb data to get the EAPOL params,if the + * packet is EAPOL and store it in the pointer passed as input + * + * Return: None + * + */ +void wlan_hdd_log_eapol(struct sk_buff *skb, + uint8_t event_type); +#else +static inline void wlan_hdd_log_eapol(struct sk_buff *skb, + uint8_t event_type) +{ + +} +#endif /* FEATURE_WLAN_DIAG_SUPPORT */ + #endif // end #if !defined( WLAN_HDD_TX_RX_H ) diff --git a/CORE/HDD/src/wlan_hdd_softap_tx_rx.c b/CORE/HDD/src/wlan_hdd_softap_tx_rx.c index 061ceac4ef1f..2886659ba691 100644 --- a/CORE/HDD/src/wlan_hdd_softap_tx_rx.c +++ b/CORE/HDD/src/wlan_hdd_softap_tx_rx.c @@ -374,6 +374,7 @@ int hdd_softap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) } #endif + wlan_hdd_log_eapol(skb, WIFI_EVENT_DRIVER_EAPOL_FRAME_TRANSMIT_REQUESTED); #ifdef QCA_PKT_PROTO_TRACE if ((hddCtxt->cfg_ini->gEnableDebugLog & VOS_PKT_TRAC_TYPE_EAPOL) || @@ -1103,6 +1104,8 @@ VOS_STATUS hdd_softap_rx_packet_cbk(v_VOID_t *vosContext, ++pAdapter->stats.rx_packets; pAdapter->stats.rx_bytes += skb->len; + wlan_hdd_log_eapol(skb, WIFI_EVENT_DRIVER_EAPOL_FRAME_RECEIVED); + #ifdef QCA_PKT_PROTO_TRACE if ((pHddCtx->cfg_ini->gEnableDebugLog & VOS_PKT_TRAC_TYPE_EAPOL) || (pHddCtx->cfg_ini->gEnableDebugLog & VOS_PKT_TRAC_TYPE_DHCP)) diff --git a/CORE/HDD/src/wlan_hdd_tx_rx.c b/CORE/HDD/src/wlan_hdd_tx_rx.c index b6b2abe6262b..65677bc6bd3e 100644 --- a/CORE/HDD/src/wlan_hdd_tx_rx.c +++ b/CORE/HDD/src/wlan_hdd_tx_rx.c @@ -90,6 +90,15 @@ static struct sk_buff* hdd_mon_tx_fetch_pkt(hdd_adapter_t* pAdapter); Type declarations -------------------------------------------------------------------------*/ +#ifdef FEATURE_WLAN_DIAG_SUPPORT +#define HDD_EAPOL_ETHER_TYPE (0x888E) +#define HDD_EAPOL_ETHER_TYPE_OFFSET (12) +#define HDD_EAPOL_PACKET_TYPE_OFFSET (15) +#define HDD_EAPOL_KEY_INFO_OFFSET (19) +#define HDD_EAPOL_DEST_MAC_OFFSET (0) +#define HDD_EAPOL_SRC_MAC_OFFSET (6) +#endif /* FEATURE_WLAN_DIAG_SUPPORT */ + /*--------------------------------------------------------------------------- Function definitions and documentation -------------------------------------------------------------------------*/ @@ -940,6 +949,8 @@ int hdd_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) skb->queue_mapping = hddLinuxUpToAcMap[up]; } + wlan_hdd_log_eapol(skb, WIFI_EVENT_DRIVER_EAPOL_FRAME_TRANSMIT_REQUESTED); + #ifdef QCA_PKT_PROTO_TRACE if ((hddCtxt->cfg_ini->gEnableDebugLog & VOS_PKT_TRAC_TYPE_EAPOL) || (hddCtxt->cfg_ini->gEnableDebugLog & VOS_PKT_TRAC_TYPE_DHCP)) @@ -1808,6 +1819,8 @@ VOS_STATUS hdd_rx_packet_cbk(v_VOID_t *vosContext, #ifdef FEATURE_WLAN_TDLS #endif + wlan_hdd_log_eapol(skb, WIFI_EVENT_DRIVER_EAPOL_FRAME_RECEIVED); + #ifdef QCA_PKT_PROTO_TRACE if ((pHddCtx->cfg_ini->gEnableDebugLog & VOS_PKT_TRAC_TYPE_EAPOL) || (pHddCtx->cfg_ini->gEnableDebugLog & VOS_PKT_TRAC_TYPE_DHCP)) @@ -1896,3 +1909,125 @@ VOS_STATUS hdd_rx_mul_packet_cbk(v_VOID_t *vosContext, } #endif /* IPA_OFFLOAD */ +#ifdef FEATURE_WLAN_DIAG_SUPPORT + +/** + * wlan_hdd_is_eapol() - Function to check if frame is EAPOL or not + * @skb: skb data + * + * This function checks if the frame is an EAPOL frame or not + * + * Return: true (1) if packet is EAPOL + * + */ +static bool wlan_hdd_is_eapol(struct sk_buff *skb) +{ + uint16_t ether_type=0; + + if (!skb) { + hddLog(VOS_TRACE_LEVEL_ERROR, FL("skb is NULL")); + return false; + } + + ether_type = (uint16_t)(*(uint16_t *) + (skb->data + HDD_EAPOL_ETHER_TYPE_OFFSET)); + + if (VOS_SWAP_U16(ether_type) == HDD_EAPOL_ETHER_TYPE) { + return true; + } else { + /* No error msg handled since this will happen often */ + return false; + } +} + +/** + * wlan_hdd_get_eapol_params() - Function to extract EAPOL params + * @skb: sbb data + * @eapol_params: Pointer to hold the parsed EAPOL params + * @event_type: Event type to indicate Tx/Rx + * + * This function parses the input skb data to get the EAPOL params,if the + * packet is EAPOL and store it in the pointer passed as input + * + * Return: 0 on success and negative value in failure + * + */ +static int wlan_hdd_get_eapol_params(struct sk_buff *skb, + struct vos_event_wlan_eapol *eapol_params, + uint8_t event_type) +{ + bool ret; + uint8_t packet_type=0; + + ret = wlan_hdd_is_eapol(skb); + + if (!ret) + return -1; + + packet_type = (uint8_t)(*(uint8_t *) + (skb->data + HDD_EAPOL_PACKET_TYPE_OFFSET)); + + eapol_params->eapol_packet_type = packet_type; + eapol_params->eapol_key_info = (uint16_t)(*(uint16_t *) + (skb->data + HDD_EAPOL_KEY_INFO_OFFSET)); + eapol_params->event_sub_type = event_type; + eapol_params->eapol_rate = 0;/* As of now, zero */ + + vos_mem_copy(eapol_params->dest_addr, + (skb->data + HDD_EAPOL_DEST_MAC_OFFSET), + sizeof(eapol_params->dest_addr)); + vos_mem_copy(eapol_params->src_addr, + (skb->data + HDD_EAPOL_SRC_MAC_OFFSET), + sizeof(eapol_params->src_addr)); + return 0; +} +/** + * wlan_hdd_event_eapol_log() - Function to log EAPOL events + * @eapol_params: Structure containing EAPOL params + * + * This function logs the parsed EAPOL params + * + * Return: None + * + */ +static void wlan_hdd_event_eapol_log(struct vos_event_wlan_eapol eapol_params) +{ + WLAN_VOS_DIAG_EVENT_DEF(wlan_diag_event, struct vos_event_wlan_eapol); + + wlan_diag_event.event_sub_type = eapol_params.event_sub_type; + wlan_diag_event.eapol_packet_type = eapol_params.eapol_packet_type; + wlan_diag_event.eapol_key_info = eapol_params.eapol_key_info; + wlan_diag_event.eapol_rate = eapol_params.eapol_rate; + vos_mem_copy(wlan_diag_event.dest_addr, + eapol_params.dest_addr, + sizeof (wlan_diag_event.dest_addr)); + vos_mem_copy(wlan_diag_event.src_addr, + eapol_params.src_addr, + sizeof (wlan_diag_event.src_addr)); + + WLAN_VOS_DIAG_EVENT_REPORT(&wlan_diag_event, EVENT_WLAN_EAPOL); +} + +/** + * wlan_hdd_log_eapol() - Function to check and extract EAPOL params + * @skb: skb data + * @event_type: One of enum wifi_connectivity_events to indicate Tx/Rx + * + * This function parses the input skb data to get the EAPOL params,if the + * packet is EAPOL and store it in the pointer passed as input + * + * Return: None + * + */ +void wlan_hdd_log_eapol(struct sk_buff *skb, + uint8_t event_type) +{ + int ret; + struct vos_event_wlan_eapol eapol_params; + + ret = wlan_hdd_get_eapol_params(skb, &eapol_params, event_type); + if (!ret) { + wlan_hdd_event_eapol_log(eapol_params); + } +} +#endif /* FEATURE_WLAN_DIAG_SUPPORT */ diff --git a/CORE/VOSS/inc/event_defs.h b/CORE/VOSS/inc/event_defs.h index be029188d049..f87f2ba46433 100644 --- a/CORE/VOSS/inc/event_defs.h +++ b/CORE/VOSS/inc/event_defs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 The Linux Foundation. All rights reserved. + * Copyright (c) 2012, 2015 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -1901,6 +1901,7 @@ typedef enum EVENT_FDPCH_CONFIG_ACTION = 0x766, EVENT_SNS_DRV_MOTION_DETECT_SIG = 0x767, EVENT_SNS_DRV_OPMODE_CHANGE = 0x768, + EVENT_WLAN_EAPOL = 0xA8D,/* 18 bytes payload */ EVENT_NEXT_UNUSED_EVENT, EVENT_RSVD_START = 0x0800, diff --git a/CORE/VOSS/inc/vos_diag_core_event.h b/CORE/VOSS/inc/vos_diag_core_event.h index 5fa0526fb0bb..99eb5edf9ad8 100644 --- a/CORE/VOSS/inc/vos_diag_core_event.h +++ b/CORE/VOSS/inc/vos_diag_core_event.h @@ -244,11 +244,27 @@ typedef struct v_U8_t mode; } vos_event_wlan_btc_type; +/*------------------------------------------------------------------------- + Event ID: EVENT_WLAN_EAPOL + ------------------------------------------------------------------------*/ +struct vos_event_wlan_eapol +{ + uint8_t event_sub_type; + uint8_t eapol_packet_type; + uint16_t eapol_key_info; + uint16_t eapol_rate; + uint8_t dest_addr[6]; + uint8_t src_addr[6]; +}; /*------------------------------------------------------------------------- Function declarations and documenation ------------------------------------------------------------------------*/ +enum wifi_connectivity_events { + WIFI_EVENT_DRIVER_EAPOL_FRAME_TRANSMIT_REQUESTED, + WIFI_EVENT_DRIVER_EAPOL_FRAME_RECEIVED, +}; #ifdef __cplusplus } |
