cnss_nl.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. *
  23. * Any new message in future can be added as another attribute
  24. */
  25. enum cld80211_attr {
  26. CLD80211_ATTR_VENDOR_DATA = 1,
  27. CLD80211_ATTR_DATA,
  28. CLD80211_ATTR_META_DATA,
  29. CLD80211_ATTR_CMD,
  30. CLD80211_ATTR_CMD_TAG_DATA,
  31. /* add new attributes above here */
  32. __CLD80211_ATTR_AFTER_LAST,
  33. CLD80211_ATTR_MAX = __CLD80211_ATTR_AFTER_LAST - 1
  34. };
  35. /**
  36. * enum cld80211_multicast_groups - List of multicast groups supported
  37. *
  38. * @CLD80211_MCGRP_SVC_MSGS: WLAN service message will be sent to this group.
  39. * Ex: Status ind messages
  40. * @CLD80211_MCGRP_HOST_LOGS: All logging related messages from driver will be
  41. * sent to this multicast group
  42. * @CLD80211_MCGRP_FW_LOGS: Firmware logging messages will be sent to this group
  43. * @CLD80211_MCGRP_PER_PKT_STATS: Messages related packet stats debugging infra
  44. * will be sent to this group
  45. * @CLD80211_MCGRP_DIAG_EVENTS: Driver/Firmware status logging diag events will
  46. * be sent to this group
  47. * @CLD80211_MCGRP_FATAL_EVENTS: Any fatal message generated in driver/firmware
  48. * will be sent to this group
  49. * @CLD80211_MCGRP_OEM_MSGS: All OEM message will be sent to this group
  50. * Ex: LOWI messages
  51. */
  52. enum cld80211_multicast_groups {
  53. CLD80211_MCGRP_SVC_MSGS,
  54. CLD80211_MCGRP_HOST_LOGS,
  55. CLD80211_MCGRP_FW_LOGS,
  56. CLD80211_MCGRP_PER_PKT_STATS,
  57. CLD80211_MCGRP_DIAG_EVENTS,
  58. CLD80211_MCGRP_FATAL_EVENTS,
  59. CLD80211_MCGRP_OEM_MSGS,
  60. };
  61. /**
  62. * typedef cld80211_cb - Callback to be called when an nlmsg is received with
  63. * the registered cmd_id command from userspace
  64. * @data: Payload of the message to be sent to driver
  65. * @data_len: Length of the payload
  66. * @cb_ctx: callback context to be returned to driver when the callback
  67. * is called
  68. * @pid: process id of the sender
  69. */
  70. typedef void (*cld80211_cb)(const void *data, int data_len,
  71. void *cb_ctx, int pid);
  72. /**
  73. * register_cld_cmd_cb() - Allows cld driver to register for commands with
  74. * callback
  75. * @cmd_id: Command to be registered. Valid range [1, CLD80211_MAX_COMMANDS]
  76. * @cb: Callback to be called when an nlmsg is received with cmd_id command
  77. * from userspace
  78. * @cb_ctx: context provided by driver; Send this as cb_ctx of func()
  79. * to driver
  80. */
  81. int register_cld_cmd_cb(u8 cmd_id, cld80211_cb cb, void *cb_ctx);
  82. /**
  83. * deregister_cld_cmd_cb() - Allows cld driver to de-register the command it
  84. * has already registered
  85. * @cmd_id: Command to be deregistered.
  86. */
  87. int deregister_cld_cmd_cb(u8 cmd_id);
  88. /**
  89. * cld80211_get_genl_family() - Returns current netlink family context
  90. */
  91. struct genl_family *cld80211_get_genl_family(void);
  92. #endif /* _NET_CNSS_GENETLINK_H_ */