qcacmn: Add variable to store magic pattern

Add variable to store magic pattern and APIs to set
magic cookie in a packet.

Change-Id: I4e010c2e2571398e4f7423162162cf0d2206d18b
CRs-Fixed: 2016682
This commit is contained in:
Himanshu Agarwal
2017-03-08 21:13:51 +05:30
committed by Sandeep Puligilla
parent a4832c70e0
commit 974d0a5275
2 changed files with 37 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2014, 2016 The Linux Foundation. All rights reserved.
* Copyright (c) 2013-2014, 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -87,6 +87,7 @@ typedef struct _HTC_RX_PACKET_INFO {
} HTC_RX_PACKET_INFO;
#define HTC_RX_FLAGS_INDICATE_MORE_PKTS (1 << 0) /* more packets on this endpoint are being fetched */
#define HTC_PACKET_MAGIC_COOKIE 0xdeadbeef
/* wrapper around endpoint-specific packets */
typedef struct _HTC_PACKET {
@@ -124,6 +125,7 @@ typedef struct _HTC_PACKET {
can pass the network buffer corresponding to the HTC packet
lower layers may optimized the transfer knowing this is
a network buffer */
uint32_t magic_cookie;
} HTC_PACKET;
#define COMPLETE_HTC_PACKET(p, status) \
@@ -278,4 +280,32 @@ static inline HTC_PACKET *htc_packet_dequeue_tail(HTC_PACKET_QUEUE *queue)
#define HTC_PACKET_QUEUE_ITERATE_END ITERATE_END
/**
* htc_packet_set_magic_cookie() - set magic cookie in htc packet
* htc_pkt - pointer to htc packet
* value - value to set in magic cookie
*
* This API sets the magic cookie passed in htc packet.
*
* Return : None
*/
static inline void htc_packet_set_magic_cookie(HTC_PACKET *htc_pkt,
uint32_t value)
{
htc_pkt->magic_cookie = value;
}
/**
* htc_packet_set_magic_cookie() - get magic cookie in htc packet
* htc_pkt - pointer to htc packet
*
* This API returns the magic cookie in htc packet.
*
* Return : magic cookie
*/
static inline uint32_t htc_packet_get_magic_cookie(HTC_PACKET *htc_pkt)
{
return htc_pkt->magic_cookie;
}
#endif /*HTC_PACKET_H_ */

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
* Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -629,10 +629,12 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
pEndpoint->UL_PipeID, false);
}
htc_packet_set_magic_cookie(pPacket, HTC_PACKET_MAGIC_COOKIE);
status = hif_send_head(target->hif_dev,
pEndpoint->UL_PipeID, pEndpoint->Id,
HTC_HDR_LENGTH + pPacket->ActualLength,
netbuf, data_attr);
#if DEBUG_BUNDLE
qdf_print(" Send single EP%d buffer size:0x%x, total:0x%x.\n",
pEndpoint->Id,
@@ -660,6 +662,7 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
/* reclaim credits */
pEndpoint->TxCredits +=
pPacket->PktInfo.AsTx.CreditsUsed;
htc_packet_set_magic_cookie(pPacket, 0);
/* put it back into the callers queue */
HTC_PACKET_ENQUEUE_TO_HEAD(pPktQueue, pPacket);
if (!pEndpoint->async_update) {