[PATCH 1/8] octeontx2-pf: map skb data as device writeable

From: Bharat Bhushan
Date: Mon May 13 2024 - 01:47:29 EST


Crypto hardware need write permission when doing inline
in-place encrypt or decrypt operation on skb-data. So map
this memory as device read-write.

Signed-off-by: Bharat Bhushan <bbhushan2@xxxxxxxxxxx>
---
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
index a16e9f244117..847052b57d9b 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
@@ -98,7 +98,7 @@ static dma_addr_t otx2_dma_map_skb_frag(struct otx2_nic *pfvf,
offset = skb_frag_off(frag);
*len = skb_frag_size(frag);
}
- return otx2_dma_map_page(pfvf, page, offset, *len, DMA_TO_DEVICE);
+ return otx2_dma_map_page(pfvf, page, offset, *len, DMA_BIDIRECTIONAL);
}

static void otx2_dma_unmap_skb_frags(struct otx2_nic *pfvf, struct sg_list *sg)
@@ -107,7 +107,7 @@ static void otx2_dma_unmap_skb_frags(struct otx2_nic *pfvf, struct sg_list *sg)

for (seg = 0; seg < sg->num_segs; seg++) {
otx2_dma_unmap_page(pfvf, sg->dma_addr[seg],
- sg->size[seg], DMA_TO_DEVICE);
+ sg->size[seg], DMA_BIDIRECTIONAL);
}
sg->num_segs = 0;
}
--
2.34.1