Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ethernet: ionic: Fix DMA mapping tests

Change error values of `ionic_tx_map_single()` and `ionic_tx_map_frag()`
from 0 to `DMA_MAPPING_ERROR` to prevent collision with 0 as a valid
address.

This also fixes the use of `dma_mapping_error()` to test against 0 in
`ionic_xdp_post_frame()`

Fixes: 0f3154e6bcb3 ("ionic: Add Tx and Rx handling")
Fixes: 56e41ee12d2d ("ionic: better dma-map error handling")
Fixes: ac8813c0ab7d ("ionic: convert Rx queue buffers to use page_pool")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Reviewed-by: Brett Creeley <brett.creeley@amd.com>
Link: https://patch.msgid.link/20250619094538.283723-2-fourier.thomas@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Thomas Fourier and committed by
Jakub Kicinski
d5e3241c f5990207

+6 -6
+6 -6
drivers/net/ethernet/pensando/ionic/ionic_txrx.c
··· 321 321 len, DMA_TO_DEVICE); 322 322 } else /* XDP_REDIRECT */ { 323 323 dma_addr = ionic_tx_map_single(q, frame->data, len); 324 - if (!dma_addr) 324 + if (dma_addr == DMA_MAPPING_ERROR) 325 325 return -EIO; 326 326 } 327 327 ··· 357 357 } else { 358 358 dma_addr = ionic_tx_map_frag(q, frag, 0, 359 359 skb_frag_size(frag)); 360 - if (dma_mapping_error(q->dev, dma_addr)) { 360 + if (dma_addr == DMA_MAPPING_ERROR) { 361 361 ionic_tx_desc_unmap_bufs(q, desc_info); 362 362 return -EIO; 363 363 } ··· 1083 1083 net_warn_ratelimited("%s: DMA single map failed on %s!\n", 1084 1084 dev_name(dev), q->name); 1085 1085 q_to_tx_stats(q)->dma_map_err++; 1086 - return 0; 1086 + return DMA_MAPPING_ERROR; 1087 1087 } 1088 1088 return dma_addr; 1089 1089 } ··· 1100 1100 net_warn_ratelimited("%s: DMA frag map failed on %s!\n", 1101 1101 dev_name(dev), q->name); 1102 1102 q_to_tx_stats(q)->dma_map_err++; 1103 - return 0; 1103 + return DMA_MAPPING_ERROR; 1104 1104 } 1105 1105 return dma_addr; 1106 1106 } ··· 1116 1116 int frag_idx; 1117 1117 1118 1118 dma_addr = ionic_tx_map_single(q, skb->data, skb_headlen(skb)); 1119 - if (!dma_addr) 1119 + if (dma_addr == DMA_MAPPING_ERROR) 1120 1120 return -EIO; 1121 1121 buf_info->dma_addr = dma_addr; 1122 1122 buf_info->len = skb_headlen(skb); ··· 1126 1126 nfrags = skb_shinfo(skb)->nr_frags; 1127 1127 for (frag_idx = 0; frag_idx < nfrags; frag_idx++, frag++) { 1128 1128 dma_addr = ionic_tx_map_frag(q, frag, 0, skb_frag_size(frag)); 1129 - if (!dma_addr) 1129 + if (dma_addr == DMA_MAPPING_ERROR) 1130 1130 goto dma_fail; 1131 1131 buf_info->dma_addr = dma_addr; 1132 1132 buf_info->len = skb_frag_size(frag);