rmnet_map.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef _RMNET_MAP_H_
  13. #define _RMNET_MAP_H_
  14. struct rmnet_map_control_command {
  15. u8 command_name;
  16. u8 cmd_type:2;
  17. u8 reserved:6;
  18. u16 reserved2;
  19. u32 transaction_id;
  20. union {
  21. struct {
  22. u16 ip_family:2;
  23. u16 reserved:14;
  24. u16 flow_control_seq_num;
  25. u32 qos_id;
  26. } flow_control;
  27. u8 data[0];
  28. };
  29. } __aligned(1);
  30. enum rmnet_map_results {
  31. RMNET_MAP_SUCCESS,
  32. RMNET_MAP_CONSUMED,
  33. RMNET_MAP_GENERAL_FAILURE,
  34. RMNET_MAP_NOT_ENABLED,
  35. RMNET_MAP_FAILED_AGGREGATION,
  36. RMNET_MAP_FAILED_MUX
  37. };
  38. enum rmnet_map_commands {
  39. RMNET_MAP_COMMAND_NONE,
  40. RMNET_MAP_COMMAND_FLOW_DISABLE,
  41. RMNET_MAP_COMMAND_FLOW_ENABLE,
  42. /* These should always be the last 2 elements */
  43. RMNET_MAP_COMMAND_UNKNOWN,
  44. RMNET_MAP_COMMAND_ENUM_LENGTH
  45. };
  46. struct rmnet_map_header {
  47. u8 pad_len:6;
  48. u8 reserved_bit:1;
  49. u8 cd_bit:1;
  50. u8 mux_id;
  51. u16 pkt_len;
  52. } __aligned(1);
  53. #define RMNET_MAP_GET_MUX_ID(Y) (((struct rmnet_map_header *) \
  54. (Y)->data)->mux_id)
  55. #define RMNET_MAP_GET_CD_BIT(Y) (((struct rmnet_map_header *) \
  56. (Y)->data)->cd_bit)
  57. #define RMNET_MAP_GET_PAD(Y) (((struct rmnet_map_header *) \
  58. (Y)->data)->pad_len)
  59. #define RMNET_MAP_GET_CMD_START(Y) ((struct rmnet_map_control_command *) \
  60. ((Y)->data + \
  61. sizeof(struct rmnet_map_header)))
  62. #define RMNET_MAP_GET_LENGTH(Y) (ntohs(((struct rmnet_map_header *) \
  63. (Y)->data)->pkt_len))
  64. #define RMNET_MAP_COMMAND_REQUEST 0
  65. #define RMNET_MAP_COMMAND_ACK 1
  66. #define RMNET_MAP_COMMAND_UNSUPPORTED 2
  67. #define RMNET_MAP_COMMAND_INVALID 3
  68. #define RMNET_MAP_NO_PAD_BYTES 0
  69. #define RMNET_MAP_ADD_PAD_BYTES 1
  70. u8 rmnet_map_demultiplex(struct sk_buff *skb);
  71. struct sk_buff *rmnet_map_deaggregate(struct sk_buff *skb);
  72. struct rmnet_map_header *rmnet_map_add_map_header(struct sk_buff *skb,
  73. int hdrlen, int pad);
  74. rx_handler_result_t rmnet_map_command(struct sk_buff *skb,
  75. struct rmnet_port *port);
  76. #endif /* _RMNET_MAP_H_ */