qcacmn: Add frag dma unmap handling for SG packets

DMA unmap for scatter gather packets is done using
only frag0 dma address and the entire packet length
which will lead to incorrect behaviors. Add handling
to do dma unmap for all the fragments of SG packets.

Change-Id: I614553d9f96c573f0095c9be38706fd4ac3223ab
CRs-Fixed: 3112424
This commit is contained in:
Yeshwanth Sriram Guntuka
2021-09-30 18:32:30 +05:30
committed by Madan Koyyalamudi
parent 8568210a52
commit 8e11d1a8fb
2 changed files with 107 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -67,6 +67,9 @@ do { \
#define HAL_TX_DESC_GET(desc, block, field) \
HAL_TX_MS(block, field, HAL_SET_FLD(desc, block, field))
#define HAL_TX_DESC_OFFSET_GET(desc, block, field, offset) \
HAL_TX_MS(block, field, HAL_SET_FLD_OFFSET(desc, block, field, offset))
#define HAL_TX_DESC_SUBBLOCK_GET(desc, block, sub, field) \
HAL_TX_MS(sub, field, HAL_SET_FLD(desc, block, sub))
@@ -430,6 +433,32 @@ static inline void hal_tx_ext_desc_set_buffer(void *desc,
((HAL_TX_SM(HAL_TX_MSDU_EXTENSION, BUF0_LEN, length)));
}
/**
* hal_tx_ext_desc_get_frag_info() - Get the frag_num'th frag iova and len
* @desc: Handle to Tx MSDU Extension Descriptor
* @frag_num: fragment number (value can be 0 to 5)
* @iova: fragment dma address
* @len: fragement Length
*
* Return: None
*/
static inline void hal_tx_ext_desc_get_frag_info(void *desc, uint8_t frag_num,
qdf_dma_addr_t *iova,
uint32_t *len)
{
uint64_t iova_hi;
*iova = HAL_TX_DESC_OFFSET_GET(desc, HAL_TX_MSDU_EXTENSION,
BUF0_PTR_31_0, (frag_num << 3));
iova_hi = HAL_TX_DESC_OFFSET_GET(desc, HAL_TX_MSDU_EXTENSION,
BUF0_PTR_39_32, (frag_num << 3));
*iova |= (iova_hi << 32);
*len = HAL_TX_DESC_OFFSET_GET(desc, HAL_TX_MSDU_EXTENSION, BUF0_LEN,
(frag_num << 3));
}
/**
* hal_tx_ext_desc_set_buffer0_param() - Set Buffer 0 Pointer and Length
* @desc: Handle to Tx MSDU Extension Descriptor