qcacld-2.0: fix compatible issue for timestamping feature
Use do_div() for 64 bit division, because '/' can't be used for 64
bit division on arm32 platform.
In arm32 platform the pointer value is 32bit, so change the directly
assignment operation to memcpy.
Change-Id: I19a1db8adbc1fe7acaee0ec824f670b67284f628
CRs-Fixed: 2155143
diff --git a/CORE/HDD/src/wlan_hdd_tsf.c b/CORE/HDD/src/wlan_hdd_tsf.c
index 4049f2b..7544b98 100644
--- a/CORE/HDD/src/wlan_hdd_tsf.c
+++ b/CORE/HDD/src/wlan_hdd_tsf.c
@@ -271,9 +271,6 @@
*/
#define WLAN_HDD_CAPTURE_TSF_INTERVAL_SEC 10
#define WLAN_HDD_CAPTURE_TSF_INIT_INTERVAL_MS 100
-#define NORMAL_INTERVAL_TARGET \
- ((int64_t)((int64_t)WLAN_HDD_CAPTURE_TSF_INTERVAL_SEC * \
- NSEC_PER_SEC / HOST_TO_TARGET_TIME_RATIO))
#define OVERFLOW_INDICATOR32 (((int64_t)0x1) << 32)
#define MAX_UINT64 ((uint64_t)0xffffffffffffffff)
#define MASK_UINT32 0xffffffff
@@ -550,6 +547,7 @@
int32_t ret = -EINVAL;
int64_t delta32_target;
bool in_cap_state;
+ int64_t normal_interval_target_value;
in_cap_state = hdd_tsf_is_in_cap(adapter);
@@ -564,11 +562,15 @@
delta32_target = (int64_t)((target_time & MASK_UINT32) -
(adapter->last_target_time & MASK_UINT32));
+ normal_interval_target_value =
+ (int64_t)WLAN_HDD_CAPTURE_TSF_INTERVAL_SEC * NSEC_PER_SEC;
+ do_div(normal_interval_target_value, HOST_TO_TARGET_TIME_RATIO);
+
if (delta32_target <
- (NORMAL_INTERVAL_TARGET - OVERFLOW_INDICATOR32))
+ (normal_interval_target_value - OVERFLOW_INDICATOR32))
delta32_target += OVERFLOW_INDICATOR32;
else if (delta32_target >
- (OVERFLOW_INDICATOR32 - NORMAL_INTERVAL_TARGET))
+ (OVERFLOW_INDICATOR32 - normal_interval_target_value))
delta32_target -= OVERFLOW_INDICATOR32;
ret = hdd_64bit_plus(adapter->last_host_time,
@@ -892,8 +894,13 @@
int hdd_tx_timestamp(adf_nbuf_t netbuf, uint64_t target_time)
{
- struct sock *sk =
- (netbuf->sk ? netbuf->sk : (struct sock *)netbuf->tstamp.tv64);
+ struct sock *sk = NULL;
+
+ if (netbuf->sk != NULL)
+ sk = netbuf->sk;
+ else
+ memcpy((void *)(&sk), (void *)(&netbuf->tstamp.tv64),
+ sizeof(sk));
if (!sk)
return -EINVAL;
@@ -1050,7 +1057,8 @@
* be set to NULL in skb_orphan().
*/
if (HDD_TSF_IS_TX_SET(hdd_ctx))
- nbuf->tstamp.tv64 = (s64)nbuf->sk;
+ memcpy((void *)(&nbuf->tstamp.tv64), (void *)(&nbuf->sk),
+ sizeof(nbuf->sk));
}
#else
static inline void hdd_update_tsf(hdd_adapter_t *adapter, uint64_t tsf)