qdf_nbuf_frag.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. * DOC: qdf_nbuf_frag.h
  20. * This file defines the nbuf frag abstraction.
  21. */
  22. #ifndef _QDF_NBUF_FRAG_H
  23. #define _QDF_NBUF_FRAG_H
  24. #include <i_qdf_trace.h>
  25. #include <i_qdf_nbuf_frag.h>
  26. /*
  27. * typedef qdf_frag_t - Platform independent frag address abstraction
  28. */
  29. typedef __qdf_frag_t qdf_frag_t;
  30. /**
  31. * Maximum number of frags an SKB can hold
  32. */
  33. #define QDF_NBUF_MAX_FRAGS __QDF_NBUF_MAX_FRAGS
  34. /**
  35. * qdf_mem_map_page() - Map Page
  36. * @osdev: qdf_device_t
  37. * @buf: Virtual page address to be mapped
  38. * @dir: qdf_dma_dir_t
  39. * @nbytes: Size of memory to be mapped
  40. * @paddr: Corresponding mapped physical address
  41. *
  42. * Return: QDF_STATUS
  43. */
  44. static inline QDF_STATUS qdf_mem_map_page(qdf_device_t osdev, qdf_frag_t buf,
  45. qdf_dma_dir_t dir, size_t nbytes,
  46. qdf_dma_addr_t *phy_addr)
  47. {
  48. return __qdf_mem_map_page(osdev, buf, dir, nbytes, phy_addr);
  49. }
  50. /**
  51. * qdf_mem_unmap_page() - Unmap Page
  52. * @osdev: qdf_device_t
  53. * @paddr: Physical memory to be unmapped
  54. * @nbytes: Size of memory to be unmapped
  55. * @dir: qdf_dma_dir_t
  56. */
  57. static inline void qdf_mem_unmap_page(qdf_device_t osdev, qdf_dma_addr_t paddr,
  58. size_t nbytes, qdf_dma_dir_t dir)
  59. {
  60. __qdf_mem_unmap_page(osdev, paddr, nbytes, dir);
  61. }
  62. /**
  63. * qdf_frag_free() - Free allocated frag memory
  64. * @vaddr: Frag address to be freed.
  65. */
  66. static inline void qdf_frag_free(qdf_frag_t vaddr)
  67. {
  68. __qdf_frag_free(vaddr);
  69. }
  70. /**
  71. * qdf_frag_alloc() - Allocate frag memory
  72. * @fragsz: Size of frag memory to be allocated
  73. *
  74. * Return: Allcated frag address
  75. */
  76. static inline qdf_frag_t qdf_frag_alloc(unsigned int fragsz)
  77. {
  78. return __qdf_frag_alloc(fragsz);
  79. }
  80. #endif /* _QDF_NBUF_FRAG_H */