ol_txrx.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. #ifndef _OL_TXRX__H_
  27. #define _OL_TXRX__H_
  28. #include <cdf_nbuf.h> /* cdf_nbuf_t */
  29. #include <ol_txrx_types.h> /* ol_txrx_vdev_t, etc. */
  30. #include <ol_ctrl_api.h> /* ol_pdev_handle */
  31. #include "cds_sched.h"
  32. void ol_txrx_peer_unref_delete(struct ol_txrx_peer_t *peer);
  33. #ifndef OL_TX_AVG_FRM_BYTES
  34. #define OL_TX_AVG_FRM_BYTES 1000
  35. #endif
  36. /**
  37. * ol_txrx_get_vdev_from_vdev_id() - get vdev from vdev_id
  38. * @vdev_id: vdev_id
  39. *
  40. * Return: vdev handle
  41. * NULL if not found.
  42. */
  43. static inline ol_txrx_vdev_handle ol_txrx_get_vdev_from_vdev_id(uint8_t vdev_id)
  44. {
  45. ol_txrx_pdev_handle pdev = cds_get_context(CDF_MODULE_ID_TXRX);
  46. ol_txrx_vdev_handle vdev = NULL;
  47. if (cdf_unlikely(!pdev)) {
  48. return NULL;
  49. }
  50. TAILQ_FOREACH(vdev, &pdev->vdev_list, vdev_list_elem) {
  51. if (vdev->vdev_id == vdev_id)
  52. break;
  53. }
  54. return vdev;
  55. }
  56. #endif /* _OL_TXRX__H_ */