cnss_nl.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */
  3. #ifndef _NET_CNSS_GENETLINK_H_
  4. #define _NET_CNSS_GENETLINK_H_
  5. #include <linux/types.h>
  6. #define CLD80211_MAX_COMMANDS 40
  7. #define CLD80211_MAX_NL_DATA 4096
  8. /**
  9. * enum cld80211_attr - Driver/Application embeds the data in nlmsg with the
  10. * help of below attributes
  11. *
  12. * @CLD80211_ATTR_VENDOR_DATA: Embed all other attributes in this nested
  13. * attribute.
  14. * @CLD80211_ATTR_DATA: Embed complete data in this attribute
  15. * @CLD80211_ATTR_META_DATA: Embed meta data for above data. This will help
  16. * wlan driver to peek into request message packet without opening up definition
  17. * of complete request message.
  18. * @CLD80211_ATTR_CMD: cld80211 vendor subcommand in this attribute
  19. * @CLD80211_ATTR_CMD_TAG_DATA: cld80211 vendor subcommand data is present in
  20. * this attribute. It is a nested attribute with sub attributes of specified
  21. * vendor sub command.
  22. * @CLD80211_ATTR_IFINDEX: Embed Intrerface indx in this attribute
  23. *
  24. * Any new message in future can be added as another attribute
  25. */
  26. enum cld80211_attr {
  27. CLD80211_ATTR_VENDOR_DATA = 1,
  28. CLD80211_ATTR_DATA,
  29. CLD80211_ATTR_META_DATA,
  30. CLD80211_ATTR_CMD,
  31. CLD80211_ATTR_CMD_TAG_DATA,
  32. CLD80211_ATTR_IFINDEX,
  33. /* add new attributes above here */
  34. __CLD80211_ATTR_AFTER_LAST,
  35. CLD80211_ATTR_MAX = __CLD80211_ATTR_AFTER_LAST - 1
  36. };
  37. /**
  38. * enum cld80211_multicast_groups - List of multicast groups supported
  39. *
  40. * @CLD80211_MCGRP_SVC_MSGS: WLAN service message will be sent to this group.
  41. * Ex: Status ind messages
  42. * @CLD80211_MCGRP_HOST_LOGS: All logging related messages from driver will be
  43. * sent to this multicast group
  44. * @CLD80211_MCGRP_FW_LOGS: Firmware logging messages will be sent to this group
  45. * @CLD80211_MCGRP_PER_PKT_STATS: Messages related packet stats debugging infra
  46. * will be sent to this group
  47. * @CLD80211_MCGRP_DIAG_EVENTS: Driver/Firmware status logging diag events will
  48. * be sent to this group
  49. * @CLD80211_MCGRP_FATAL_EVENTS: Any fatal message generated in driver/firmware
  50. * will be sent to this group
  51. * @CLD80211_MCGRP_OEM_MSGS: All OEM message will be sent to this group
  52. * Ex: LOWI messages
  53. */
  54. enum cld80211_multicast_groups {
  55. CLD80211_MCGRP_SVC_MSGS,
  56. CLD80211_MCGRP_HOST_LOGS,
  57. CLD80211_MCGRP_FW_LOGS,
  58. CLD80211_MCGRP_PER_PKT_STATS,
  59. CLD80211_MCGRP_DIAG_EVENTS,
  60. CLD80211_MCGRP_FATAL_EVENTS,
  61. CLD80211_MCGRP_OEM_MSGS,
  62. };
  63. /**
  64. * typedef cld80211_cb - Callback to be called when an nlmsg is received with
  65. * the registered cmd_id command from userspace
  66. * @data: Payload of the message to be sent to driver
  67. * @data_len: Length of the payload
  68. * @cb_ctx: callback context to be returned to driver when the callback
  69. * is called
  70. * @pid: process id of the sender
  71. */
  72. typedef void (*cld80211_cb)(const void *data, int data_len,
  73. void *cb_ctx, int pid);
  74. /**
  75. * register_cld_cmd_cb() - Allows cld driver to register for commands with
  76. * callback
  77. * @cmd_id: Command to be registered. Valid range [1, CLD80211_MAX_COMMANDS]
  78. * @cb: Callback to be called when an nlmsg is received with cmd_id command
  79. * from userspace
  80. * @cb_ctx: context provided by driver; Send this as cb_ctx of func()
  81. * to driver
  82. */
  83. int register_cld_cmd_cb(u8 cmd_id, cld80211_cb cb, void *cb_ctx);
  84. /**
  85. * deregister_cld_cmd_cb() - Allows cld driver to de-register the command it
  86. * has already registered
  87. * @cmd_id: Command to be deregistered.
  88. */
  89. int deregister_cld_cmd_cb(u8 cmd_id);
  90. /**
  91. * cld80211_get_genl_family() - Returns current netlink family context
  92. */
  93. struct genl_family *cld80211_get_genl_family(void);
  94. #endif /* _NET_CNSS_GENETLINK_H_ */