cdp_txrx_wds.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Copyright (c) 2016-2017, 2019 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. * @file cdp_txrx_wds.h
  20. * @brief Define the host data path WDS API functions
  21. * called by the host control SW and the OS interface module
  22. */
  23. #ifndef _CDP_TXRX_WDS_H_
  24. #define _CDP_TXRX_WDS_H_
  25. #include "cdp_txrx_handle.h"
  26. /**
  27. * @brief set the wds rx filter policy of the device
  28. * @details
  29. * This flag sets the wds rx policy on the vdev. Rx frames not compliant
  30. * with the policy will be dropped.
  31. *
  32. * @param vdev_id - id of the data virtual device object
  33. * @param val - the wds rx policy bitmask
  34. * @return - QDF_STATUS
  35. */
  36. static inline QDF_STATUS
  37. cdp_set_wds_rx_policy(ol_txrx_soc_handle soc,
  38. uint8_t vdev_id,
  39. u_int32_t val)
  40. {
  41. if (!soc || !soc->ops || !soc->ops->wds_ops) {
  42. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  43. "%s invalid instance", __func__);
  44. return QDF_STATUS_E_FAILURE;
  45. }
  46. if (soc->ops->wds_ops->txrx_set_wds_rx_policy)
  47. soc->ops->wds_ops->txrx_set_wds_rx_policy(soc, vdev_id, val);
  48. return QDF_STATUS_SUCCESS;
  49. }
  50. /**
  51. * @brief set the wds rx filter policy of the device
  52. * @details
  53. * This flag sets the wds rx policy on the vdev. Rx frames not compliant
  54. * with the policy will be dropped.
  55. *
  56. * @param psoc - psoc object
  57. * @param vdev_id - id of the data virtual device object
  58. * @param peer_mac - peer mac address
  59. * @param val - the wds rx policy bitmask
  60. * @return - QDF_STATUS
  61. */
  62. static inline QDF_STATUS
  63. cdp_set_wds_tx_policy_update(ol_txrx_soc_handle soc,
  64. uint8_t vdev_id, uint8_t *peer_mac,
  65. int wds_tx_ucast, int wds_tx_mcast)
  66. {
  67. if (!soc || !soc->ops || !soc->ops->wds_ops) {
  68. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  69. "%s invalid instance", __func__);
  70. return QDF_STATUS_E_FAILURE;
  71. }
  72. if (soc->ops->wds_ops->txrx_wds_peer_tx_policy_update)
  73. soc->ops->wds_ops->txrx_wds_peer_tx_policy_update(
  74. soc, vdev_id, peer_mac, wds_tx_ucast,
  75. wds_tx_mcast);
  76. return QDF_STATUS_SUCCESS;
  77. }
  78. /**
  79. * cdp_vdev_set_wds() - Set/unset wds_enable flag in vdev
  80. * @soc - data path soc handle
  81. * @vdev_id - id of data path vap handle
  82. * @val - value to be set in wds_en flag
  83. *
  84. * This flag enables WDS source port learning feature on a vdev
  85. *
  86. * return 1 on success
  87. */
  88. static inline int
  89. cdp_vdev_set_wds(ol_txrx_soc_handle soc, uint8_t vdev_id, uint32_t val)
  90. {
  91. if (soc->ops->wds_ops->vdev_set_wds)
  92. return soc->ops->wds_ops->vdev_set_wds(soc, vdev_id, val);
  93. return 0;
  94. }
  95. #endif