[4/6] mem: add function for setting internal dma mask
Checks
Commit Message
A device with addressing limitations will invoke this function
for setting a dma mask. It has no effect if there is another
dma mask already set and more restrictive than this one.
Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
---
lib/librte_eal/common/eal_common_memory.c | 15 +++++++++++++++
lib/librte_eal/common/include/rte_memory.h | 3 +++
2 files changed, 18 insertions(+)
@@ -109,6 +109,21 @@
}
}
+/* set global dma mask based on device dma mask */
+void
+rte_eal_set_dma_mask(uint8_t maskbits) {
+
+ /* If no dma mask yet this is the new one */
+ if (!internal_config.dma_mask) {
+ internal_config.dma_mask = maskbits;
+ return;
+ }
+
+ /* Set dma mask just if more restrictive than current one */
+ if (internal_config.dma_mask > maskbits)
+ internal_config.dma_mask = maskbits;
+}
+
/* return the number of memory channels */
unsigned rte_memory_get_nchannel(void)
{
@@ -209,6 +209,9 @@ struct rte_memseg {
*/
unsigned rte_memory_get_nrank(void);
+/* set global dma mask based on a specific device dma mask */
+void rte_eal_set_dma_mask(uint8_t maskbits);
+
/**
* Drivers based on uio will not load unless physical
* addresses are obtainable. It is only possible to get