qdf_net_if.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Copyright (c) 2018,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. * This file provides OS dependent network interface related APIs
  21. */
  22. #include "qdf_net_if.h"
  23. #include "qdf_types.h"
  24. #include "qdf_module.h"
  25. #include "qdf_util.h"
  26. #include <linux/netdevice.h>
  27. QDF_STATUS
  28. qdf_net_if_create_dummy_if(struct qdf_net_if *nif)
  29. {
  30. int ret;
  31. if (!nif)
  32. return QDF_STATUS_E_INVAL;
  33. ret = init_dummy_netdev((struct net_device *)nif);
  34. return qdf_status_from_os_return(ret);
  35. }
  36. qdf_export_symbol(qdf_net_if_create_dummy_if);
  37. /**
  38. * qdf_net_if_get_devname() - Retrieve netdevice name
  39. * @nif: Abstraction of netdevice
  40. *
  41. * Return: netdevice name
  42. */
  43. char *qdf_net_if_get_devname(struct qdf_net_if *nif)
  44. {
  45. if (!nif)
  46. return NULL;
  47. return (((struct net_device *)nif)->name);
  48. }
  49. qdf_export_symbol(qdf_net_if_get_devname);
  50. /**
  51. * qdf_net_if_get_dev_by_name() - Find a network device by its name
  52. * @nif_name: network device name
  53. *
  54. * This function retrieves the network device by its name
  55. *
  56. * Return: qdf network device
  57. */
  58. struct qdf_net_if *qdf_net_if_get_dev_by_name(char *nif_name)
  59. {
  60. return __qdf_net_if_get_dev_by_name(nif_name);
  61. }
  62. qdf_export_symbol(qdf_net_if_get_dev_by_name);
  63. /**
  64. * qdf_net_if_release_dev() - Release reference to network device
  65. * @nif: network device
  66. *
  67. * This function releases reference to the network device
  68. *
  69. * Return: QDF_STATUS_SUCCESS on success
  70. */
  71. QDF_STATUS
  72. qdf_net_if_release_dev(struct qdf_net_if *nif)
  73. {
  74. return __qdf_net_if_release_dev(nif);
  75. }
  76. qdf_export_symbol(qdf_net_if_release_dev);