hwbm.h 898 B

1234567891011121314151617181920212223242526272829
  1. #ifndef _HWBM_H
  2. #define _HWBM_H
  3. struct hwbm_pool {
  4. /* Capacity of the pool */
  5. int size;
  6. /* Size of the buffers managed */
  7. int frag_size;
  8. /* Number of buffers currently used by this pool */
  9. int buf_num;
  10. /* constructor called during alocation */
  11. int (*construct)(struct hwbm_pool *bm_pool, void *buf);
  12. /* protect acces to the buffer counter*/
  13. spinlock_t lock;
  14. /* private data */
  15. void *priv;
  16. };
  17. #ifdef CONFIG_HWBM
  18. void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf);
  19. int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp);
  20. int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp);
  21. #else
  22. void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}
  23. int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp) { return 0; }
  24. int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp)
  25. { return 0; }
  26. #endif /* CONFIG_HWBM */
  27. #endif /* _HWBM_H */