rmnet_ctl.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
  3. *
  4. * RMNET_CTL header
  5. *
  6. */
  7. #ifndef _RMNET_CTL_H_
  8. #define _RMNET_CTL_H_
  9. #include <linux/skbuff.h>
  10. enum rmnet_ctl_log_lvl {
  11. RMNET_CTL_LOG_CRIT,
  12. RMNET_CTL_LOG_ERR,
  13. RMNET_CTL_LOG_INFO,
  14. RMNET_CTL_LOG_DEBUG,
  15. };
  16. #define rmnet_ctl_log_err(msg, rc, data, len) \
  17. rmnet_ctl_log(RMNET_CTL_LOG_ERR, msg, rc, data, len)
  18. #define rmnet_ctl_log_info(msg, data, len) \
  19. rmnet_ctl_log(RMNET_CTL_LOG_INFO, msg, 0, data, len)
  20. #define rmnet_ctl_log_debug(msg, data, len) \
  21. rmnet_ctl_log(RMNET_CTL_LOG_DEBUG, msg, 0, data, len)
  22. struct rmnet_ctl_client_hooks {
  23. void (*ctl_dl_client_hook)(struct sk_buff *skb);
  24. };
  25. #ifdef CONFIG_RMNET_CTL
  26. void *rmnet_ctl_register_client(struct rmnet_ctl_client_hooks *hook);
  27. int rmnet_ctl_unregister_client(void *handle);
  28. int rmnet_ctl_send_client(void *handle, struct sk_buff *skb);
  29. void rmnet_ctl_log(enum rmnet_ctl_log_lvl lvl, const char *msg,
  30. int rc, const void *data, unsigned int len);
  31. #else
  32. static inline void *rmnet_ctl_register_client(
  33. struct rmnet_ctl_client_hooks *hook)
  34. {
  35. return NULL;
  36. }
  37. static inline int rmnet_ctl_unregister_client(void *handle)
  38. {
  39. return -EINVAL;
  40. }
  41. static inline int rmnet_ctl_send_client(void *handle, struct sk_buff *skb)
  42. {
  43. return -EINVAL;
  44. }
  45. static inline void rmnet_ctl_log(enum rmnet_ctl_log_lvl lvl, const char *msg,
  46. int rc, const void *data, unsigned int len)
  47. {
  48. }
  49. #endif /* CONFIG_RMNET_CTL */
  50. #endif /* _RMNET_CTL_H_ */