1 /* 2 * Copyright (c) 2020 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 /** 20 * DOC: qdf_nbuf_frag.h 21 * This file defines the nbuf frag abstraction. 22 */ 23 24 #ifndef _QDF_NBUF_FRAG_H 25 #define _QDF_NBUF_FRAG_H 26 27 #include <i_qdf_trace.h> 28 #include <i_qdf_nbuf_frag.h> 29 30 /* 31 * typedef qdf_frag_t - Platform independent frag address abstraction 32 */ 33 typedef __qdf_frag_t qdf_frag_t; 34 35 /** 36 * Maximum number of frags an SKB can hold 37 */ 38 #define QDF_NBUF_MAX_FRAGS __QDF_NBUF_MAX_FRAGS 39 40 /** 41 * qdf_mem_map_page() - Map Page 42 * @osdev: qdf_device_t 43 * @buf: Virtual page address to be mapped 44 * @dir: qdf_dma_dir_t 45 * @nbytes: Size of memory to be mapped 46 * @paddr: Corresponding mapped physical address 47 * 48 * Return: QDF_STATUS 49 */ 50 static inline QDF_STATUS qdf_mem_map_page(qdf_device_t osdev, qdf_frag_t buf, 51 qdf_dma_dir_t dir, size_t nbytes, 52 qdf_dma_addr_t *phy_addr) 53 { 54 return __qdf_mem_map_page(osdev, buf, dir, nbytes, phy_addr); 55 } 56 57 /** 58 * qdf_mem_unmap_page() - Unmap Page 59 * @osdev: qdf_device_t 60 * @paddr: Physical memory to be unmapped 61 * @nbytes: Size of memory to be unmapped 62 * @dir: qdf_dma_dir_t 63 */ 64 static inline void qdf_mem_unmap_page(qdf_device_t osdev, qdf_dma_addr_t paddr, 65 size_t nbytes, qdf_dma_dir_t dir) 66 { 67 __qdf_mem_unmap_page(osdev, paddr, nbytes, dir); 68 } 69 70 /** 71 * qdf_frag_free() - Free allocated frag memory 72 * @vaddr: Frag address to be freed. 73 */ 74 static inline void qdf_frag_free(qdf_frag_t vaddr) 75 { 76 __qdf_frag_free(vaddr); 77 } 78 79 /** 80 * qdf_frag_alloc() - Allocate frag memory 81 * @fragsz: Size of frag memory to be allocated 82 * 83 * Return: Allcated frag address 84 */ 85 static inline qdf_frag_t qdf_frag_alloc(unsigned int fragsz) 86 { 87 return __qdf_frag_alloc(fragsz); 88 } 89 #endif /* _QDF_NBUF_FRAG_H */ 90