if_rmnet.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* SPDX-License-Identifier: GPL-2.0-only
  2. * Copyright (c) 2013-2019, 2021 The Linux Foundation. All rights reserved.
  3. */
  4. #ifndef _LINUX_IF_RMNET_H_
  5. #define _LINUX_IF_RMNET_H_
  6. #include <linux/types.h>
  7. struct rmnet_map_header {
  8. u8 flags; /* MAP_CMD_FLAG, MAP_PAD_LEN_MASK */
  9. u8 mux_id;
  10. __be16 pkt_len; /* Length of packet, including pad */
  11. } __aligned(1);
  12. /* rmnet_map_header flags field:
  13. * PAD_LEN: number of pad bytes following packet data
  14. * CMD: 1 = packet contains a MAP command; 0 = packet contains data
  15. * NEXT_HEADER: 1 = packet contains V5 CSUM header 0 = no V5 CSUM header
  16. */
  17. #define MAP_PAD_LEN_MASK GENMASK(5, 0)
  18. #define MAP_NEXT_HEADER_FLAG BIT(6)
  19. #define MAP_CMD_FLAG BIT(7)
  20. struct rmnet_map_dl_csum_trailer {
  21. u8 reserved1;
  22. u8 flags; /* MAP_CSUM_DL_VALID_FLAG */
  23. __be16 csum_start_offset;
  24. __be16 csum_length;
  25. __sum16 csum_value;
  26. } __aligned(1);
  27. /* rmnet_map_dl_csum_trailer flags field:
  28. * VALID: 1 = checksum and length valid; 0 = ignore them
  29. */
  30. #define MAP_CSUM_DL_VALID_FLAG BIT(0)
  31. struct rmnet_map_ul_csum_header {
  32. __be16 csum_start_offset;
  33. __be16 csum_info; /* MAP_CSUM_UL_* */
  34. } __aligned(1);
  35. /* csum_info field:
  36. * OFFSET: where (offset in bytes) to insert computed checksum
  37. * UDP: 1 = UDP checksum (zero checkum means no checksum)
  38. * ENABLED: 1 = checksum computation requested
  39. */
  40. #define MAP_CSUM_UL_OFFSET_MASK GENMASK(13, 0)
  41. #define MAP_CSUM_UL_UDP_FLAG BIT(14)
  42. #define MAP_CSUM_UL_ENABLED_FLAG BIT(15)
  43. /* MAP CSUM headers */
  44. struct rmnet_map_v5_csum_header {
  45. u8 header_info;
  46. u8 csum_info;
  47. __be16 reserved;
  48. } __aligned(1);
  49. /* v5 header_info field
  50. * NEXT_HEADER: represents whether there is any next header
  51. * HEADER_TYPE: represents the type of this header
  52. *
  53. * csum_info field
  54. * CSUM_VALID_OR_REQ:
  55. * 1 = for UL, checksum computation is requested.
  56. * 1 = for DL, validated the checksum and has found it valid
  57. */
  58. #define MAPV5_HDRINFO_NXT_HDR_FLAG BIT(0)
  59. #define MAPV5_HDRINFO_HDR_TYPE_FMASK GENMASK(7, 1)
  60. #define MAPV5_CSUMINFO_VALID_FLAG BIT(7)
  61. #define RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD 2
  62. #endif /* !(_LINUX_IF_RMNET_H_) */