cdp_txrx_wds.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Copyright (c) 2016-2017, 2019 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. /**
  20. * DOC: cdp_txrx_wds.h
  21. * Define the host data path WDS API functions
  22. * called by the host control SW and the OS interface module
  23. */
  24. #ifndef _CDP_TXRX_WDS_H_
  25. #define _CDP_TXRX_WDS_H_
  26. #include "cdp_txrx_handle.h"
  27. /**
  28. * cdp_set_wds_rx_policy() - set the wds rx filter policy of the device
  29. * @soc: psoc object
  30. * @vdev_id: id of the data virtual device object
  31. * @val: the wds rx policy bitmask
  32. *
  33. * This flag sets the wds rx policy on the vdev. Rx frames not compliant
  34. * with the policy will be dropped.
  35. *
  36. * Return: QDF_STATUS
  37. */
  38. static inline QDF_STATUS
  39. cdp_set_wds_rx_policy(ol_txrx_soc_handle soc,
  40. uint8_t vdev_id,
  41. u_int32_t val)
  42. {
  43. if (!soc || !soc->ops || !soc->ops->wds_ops) {
  44. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  45. "%s invalid instance", __func__);
  46. return QDF_STATUS_E_FAILURE;
  47. }
  48. if (soc->ops->wds_ops->txrx_set_wds_rx_policy)
  49. soc->ops->wds_ops->txrx_set_wds_rx_policy(soc, vdev_id, val);
  50. return QDF_STATUS_SUCCESS;
  51. }
  52. /**
  53. * cdp_set_wds_tx_policy_update() - set the wds tx filter policy of the device
  54. * @soc: psoc object
  55. * @vdev_id: id of the data virtual device object
  56. * @peer_mac: peer mac address
  57. * @wds_tx_ucast: the wds unicast tx policy bitmask
  58. * @wds_tx_mcast: the wds multicast tx policy bitmask
  59. *
  60. * This flag sets the wds xx policy on the vdev. Tx frames not compliant
  61. * with the policy will be dropped.
  62. *
  63. * Return: QDF_STATUS
  64. */
  65. static inline QDF_STATUS
  66. cdp_set_wds_tx_policy_update(ol_txrx_soc_handle soc,
  67. uint8_t vdev_id, uint8_t *peer_mac,
  68. int wds_tx_ucast, int wds_tx_mcast)
  69. {
  70. if (!soc || !soc->ops || !soc->ops->wds_ops) {
  71. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  72. "%s invalid instance", __func__);
  73. return QDF_STATUS_E_FAILURE;
  74. }
  75. if (soc->ops->wds_ops->txrx_wds_peer_tx_policy_update)
  76. soc->ops->wds_ops->txrx_wds_peer_tx_policy_update(
  77. soc, vdev_id, peer_mac, wds_tx_ucast,
  78. wds_tx_mcast);
  79. return QDF_STATUS_SUCCESS;
  80. }
  81. /**
  82. * cdp_vdev_set_wds() - Set/unset wds_enable flag in vdev
  83. * @soc: data path soc handle
  84. * @vdev_id: id of data path vap handle
  85. * @val: value to be set in wds_en flag
  86. *
  87. * This flag enables WDS source port learning feature on a vdev
  88. *
  89. * Return: 1 on success
  90. */
  91. static inline int
  92. cdp_vdev_set_wds(ol_txrx_soc_handle soc, uint8_t vdev_id, uint32_t val)
  93. {
  94. if (soc->ops->wds_ops->vdev_set_wds)
  95. return soc->ops->wds_ops->vdev_set_wds(soc, vdev_id, val);
  96. return 0;
  97. }
  98. #endif