瀏覽代碼

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
Himanshu Agarwal 8 年之前
父節點
當前提交
974d0a5275
共有 2 個文件被更改,包括 37 次插入4 次删除
  1. 31 1
      htc/htc_packet.h
  2. 6 3
      htc/htc_send.c

+ 31 - 1
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.
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
  *
@@ -87,6 +87,7 @@ typedef struct _HTC_RX_PACKET_INFO {
 } 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_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 */
 /* wrapper around endpoint-specific packets */
 typedef struct _HTC_PACKET {
 typedef struct _HTC_PACKET {
@@ -124,6 +125,7 @@ typedef struct _HTC_PACKET {
 				can pass the network buffer corresponding to the HTC packet
 				can pass the network buffer corresponding to the HTC packet
 				lower layers may optimized the transfer knowing this is
 				lower layers may optimized the transfer knowing this is
 				a network buffer */
 				a network buffer */
+	uint32_t magic_cookie;
 } HTC_PACKET;
 } HTC_PACKET;
 
 
 #define COMPLETE_HTC_PACKET(p, status)	     \
 #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
 #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_ */
 #endif /*HTC_PACKET_H_ */

+ 6 - 3
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.
  * 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);
 					pEndpoint->UL_PipeID, false);
 		}
 		}
 
 
+		htc_packet_set_magic_cookie(pPacket, HTC_PACKET_MAGIC_COOKIE);
 		status = hif_send_head(target->hif_dev,
 		status = hif_send_head(target->hif_dev,
 				       pEndpoint->UL_PipeID, pEndpoint->Id,
 				       pEndpoint->UL_PipeID, pEndpoint->Id,
 				       HTC_HDR_LENGTH + pPacket->ActualLength,
 				       HTC_HDR_LENGTH + pPacket->ActualLength,
 				       netbuf, data_attr);
 				       netbuf, data_attr);
+
 #if DEBUG_BUNDLE
 #if DEBUG_BUNDLE
 		qdf_print(" Send single EP%d buffer size:0x%x, total:0x%x.\n",
 		qdf_print(" Send single EP%d buffer size:0x%x, total:0x%x.\n",
 			  pEndpoint->Id,
 			  pEndpoint->Id,
@@ -658,8 +660,9 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
 			pEndpoint->ul_outstanding_cnt--;
 			pEndpoint->ul_outstanding_cnt--;
 			HTC_PACKET_REMOVE(&pEndpoint->TxLookupQueue, pPacket);
 			HTC_PACKET_REMOVE(&pEndpoint->TxLookupQueue, pPacket);
 			/* reclaim credits */
 			/* 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 */
 			/* put it back into the callers queue */
 			HTC_PACKET_ENQUEUE_TO_HEAD(pPktQueue, pPacket);
 			HTC_PACKET_ENQUEUE_TO_HEAD(pPktQueue, pPacket);
 			if (!pEndpoint->async_update) {
 			if (!pEndpoint->async_update) {