i_qdf_net_if.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright (c) 2019-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_net_if
  20. * QCA driver framework (QDF) network interface management APIs
  21. */
  22. #if !defined(__I_QDF_NET_IF_H)
  23. #define __I_QDF_NET_IF_H
  24. /* Include Files */
  25. #include <qdf_types.h>
  26. #include <qdf_util.h>
  27. #include <linux/netdevice.h>
  28. struct qdf_net_if;
  29. /**
  30. * __qdf_net_if_create_dummy_if() - create dummy interface
  31. * @nif: interface handle
  32. *
  33. * This function will create a dummy network interface
  34. *
  35. * Return: QDF_STATUS_SUCCESS on success
  36. */
  37. static inline QDF_STATUS
  38. __qdf_net_if_create_dummy_if(struct qdf_net_if *nif)
  39. {
  40. int ret;
  41. ret = init_dummy_netdev((struct net_device *)nif);
  42. return qdf_status_from_os_return(ret);
  43. }
  44. /**
  45. * qdf_net_if_get_dev_by_name() - Find a network device by its name
  46. * @nif_name: network device name
  47. *
  48. * This function retrieves the network device by its name
  49. *
  50. * Return: qdf network device
  51. */
  52. static inline struct qdf_net_if *
  53. __qdf_net_if_get_dev_by_name(char *nif_name)
  54. {
  55. if (!nif_name)
  56. return NULL;
  57. return ((struct qdf_net_if *)dev_get_by_name(&init_net, nif_name));
  58. }
  59. /**
  60. * qdf_net_if_release_dev() - Release reference to network device
  61. * @nif: network device
  62. *
  63. * This function releases reference to the network device
  64. *
  65. * Return: QDF_STATUS_SUCCESS on success
  66. */
  67. static inline QDF_STATUS
  68. __qdf_net_if_release_dev(struct qdf_net_if *nif)
  69. {
  70. if (!nif)
  71. return QDF_STATUS_E_INVAL;
  72. dev_put((struct net_device *)nif);
  73. return QDF_STATUS_SUCCESS;
  74. }
  75. #endif /*__I_QDF_NET_IF_H */