diff --git a/htc/htc_packet.h b/htc/htc_packet.h index 7d13b40ae5..bb23dcbf3c 100644 --- a/htc/htc_packet.h +++ b/htc/htc_packet.h @@ -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_ */ diff --git a/htc/htc_send.c b/htc/htc_send.c index dd1ff328b3..64c38ae767 100644 --- a/htc/htc_send.c +++ b/htc/htc_send.c @@ -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, @@ -658,8 +660,9 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target, pEndpoint->ul_outstanding_cnt--; HTC_PACKET_REMOVE(&pEndpoint->TxLookupQueue, pPacket); /* reclaim credits */ - pEndpoint->TxCredits += - pPacket->PktInfo.AsTx.CreditsUsed; + 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) {