Эх сурвалжийг харах

qcacmn: Store the DMA address in the TSO meta data

Store the DMA address in the TSO meta data as opposed to
storing the higher and lower bits separately. The DMA address
can be convering to higher and lower 32 bit addresses if needed
by the hardware at a later point.

Change-Id: Iff706ca980ee86400952e8b3087a619f4a2728e1
CRs-Fixed: 1024169
Dhanashri Atre 8 жил өмнө
parent
commit
5cfd37e211

+ 13 - 0
qdf/inc/qdf_nbuf.h

@@ -1203,6 +1203,19 @@ static inline void qdf_nbuf_reset_num_frags(qdf_nbuf_t buf)
 	__qdf_nbuf_reset_num_frags(buf);
 }
 
+/**
+ * qdf_dmaaddr_to_32s - return high and low parts of dma_addr
+ *
+ * Returns the high and low 32-bits of the DMA addr in the provided ptrs
+ *
+ * Return: N/A
+ */
+static inline void qdf_dmaaddr_to_32s(qdf_dma_addr_t dmaaddr,
+				      uint32_t *lo, uint32_t *hi)
+{
+	return __qdf_dmaaddr_to_32s(dmaaddr, lo, hi);
+}
+
 /**
  * qdf_nbuf_is_tso() - is the network buffer a jumbo packet?
  * @buf: Network buffer

+ 2 - 3
qdf/inc/qdf_types.h

@@ -416,10 +416,9 @@ struct qdf_mac_addr {
  * given jumbo TSO network buffer
  */
 struct qdf_tso_frag_t {
-	uint32_t paddr_low_32;
-	uint32_t paddr_upper_16:16,
-		 length:16;
+	uint16_t length;
 	unsigned char *vaddr;
+	qdf_dma_addr_t paddr;
 };
 
 #define FRAG_NUM_MAX 6

+ 3 - 0
qdf/linux/src/i_qdf_nbuf.h

@@ -995,6 +995,9 @@ __qdf_nbuf_set_protocol(struct sk_buff *skb, uint16_t protocol)
 #define __qdf_nbuf_get_tx_htt2_frm(skb)	\
 	QDF_NBUF_CB_TX_HL_HTT2_FRM(skb)
 
+void __qdf_dmaaddr_to_32s(qdf_dma_addr_t dmaaddr,
+				      uint32_t *lo, uint32_t *hi);
+
 uint32_t __qdf_nbuf_get_tso_info(qdf_device_t osdev, struct sk_buff *skb,
 	struct qdf_tso_info_t *tso_info);
 

+ 3 - 24
qdf/linux/src/qdf_nbuf.c

@@ -1153,7 +1153,7 @@ EXPORT_SYMBOL(__qdf_nbuf_get_tso_cmn_seg_info);
  *
  * Return: N/A
  */
-static inline void qdf_dmaaddr_to_32s(qdf_dma_addr_t dmaaddr,
+void __qdf_dmaaddr_to_32s(qdf_dma_addr_t dmaaddr,
 				      uint32_t *lo, uint32_t *hi)
 {
 	if (sizeof(dmaaddr) > sizeof(uint32_t)) {
@@ -1164,8 +1164,6 @@ static inline void qdf_dmaaddr_to_32s(qdf_dma_addr_t dmaaddr,
 		*hi = 0;
 	}
 }
-EXPORT_SYMBOL(qdf_dmaaddr_to_32s);
-
 
 /**
  * __qdf_nbuf_get_tso_info() - function to divide a TSO nbuf
@@ -1189,7 +1187,6 @@ uint32_t __qdf_nbuf_get_tso_info(qdf_device_t osdev, struct sk_buff *skb,
 	/* segment specific */
 	char *tso_frag_vaddr;
 	qdf_dma_addr_t tso_frag_paddr = 0;
-	uint32_t       tso_frag_paddr_lo, tso_frag_paddr_hi;
 	uint32_t num_seg = 0;
 	struct qdf_tso_seg_elem_t *curr_seg;
 	const struct skb_frag_struct *frag = NULL;
@@ -1221,8 +1218,6 @@ uint32_t __qdf_nbuf_get_tso_info(qdf_device_t osdev, struct sk_buff *skb,
 	tso_frag_len = min(skb_frag_len, tso_seg_size);
 	tso_frag_paddr = dma_map_single(osdev->dev,
 		 tso_frag_vaddr, tso_frag_len, DMA_TO_DEVICE);
-	qdf_dmaaddr_to_32s(tso_frag_paddr, &tso_frag_paddr_lo,
-						 &tso_frag_paddr_hi);
 
 	num_seg = tso_info->num_segs;
 	tso_info->num_segs = 0;
@@ -1273,15 +1268,11 @@ uint32_t __qdf_nbuf_get_tso_info(qdf_device_t osdev, struct sk_buff *skb,
 		tso_info->total_len = curr_seg->seg.tso_frags[0].length;
 		{
 			qdf_dma_addr_t mapped;
-			uint32_t       lo, hi;
 
 			mapped = dma_map_single(osdev->dev,
 				tso_cmn_info.eit_hdr,
 				tso_cmn_info.eit_hdr_len, DMA_TO_DEVICE);
-			qdf_dmaaddr_to_32s(mapped, &lo, &hi);
-			curr_seg->seg.tso_frags[0].paddr_low_32 = lo;
-			curr_seg->seg.tso_frags[0].paddr_upper_16 =
-							 (hi & 0xffff);
+			curr_seg->seg.tso_frags[0].paddr = mapped;
 		}
 		curr_seg->seg.tso_flags.ip_len = tso_cmn_info.ip_tcp_hdr_len;
 		curr_seg->seg.num_frags++;
@@ -1298,10 +1289,7 @@ uint32_t __qdf_nbuf_get_tso_info(qdf_device_t osdev, struct sk_buff *skb,
 
 			/* increment the TCP sequence number */
 			tso_cmn_info.tcp_seq_num += tso_frag_len;
-			curr_seg->seg.tso_frags[i].paddr_upper_16 =
-				(tso_frag_paddr_hi & 0xffff);
-			curr_seg->seg.tso_frags[i].paddr_low_32 =
-				 tso_frag_paddr_lo;
+			curr_seg->seg.tso_frags[i].paddr = tso_frag_paddr;
 
 			/* if there is no more data left in the skb */
 			if (!skb_proc)
@@ -1330,18 +1318,12 @@ uint32_t __qdf_nbuf_get_tso_info(qdf_device_t osdev, struct sk_buff *skb,
 							 frag, foffset,
 							 tso_frag_len,
 							 DMA_TO_DEVICE);
-					qdf_dmaaddr_to_32s(tso_frag_paddr,
-							&tso_frag_paddr_lo,
-							&tso_frag_paddr_hi);
 				} else {
 					tso_frag_paddr =
 						 dma_map_single(osdev->dev,
 							 tso_frag_vaddr,
 							 tso_frag_len,
 							 DMA_TO_DEVICE);
-					qdf_dmaaddr_to_32s(tso_frag_paddr,
-							&tso_frag_paddr_lo,
-							&tso_frag_paddr_hi);
 				}
 			} else { /* the next fragment is not contiguous */
 				tso_frag_len = min(skb_frag_len, tso_seg_size);
@@ -1352,9 +1334,6 @@ uint32_t __qdf_nbuf_get_tso_info(qdf_device_t osdev, struct sk_buff *skb,
 				tso_frag_paddr = skb_frag_dma_map(osdev->dev,
 					 frag, 0, tso_frag_len,
 					 DMA_TO_DEVICE);
-				qdf_dmaaddr_to_32s(tso_frag_paddr,
-						 &tso_frag_paddr_lo,
-						 &tso_frag_paddr_hi);
 				foffset += tso_frag_len;
 				from_frag_table = 1;
 				j++;