Skip to content

Commit 9395da4

Browse files
Subash Abhinov Kasiviswanathandavem330
authored andcommitted
net: qualcomm: rmnet: Move common struct definitions to include
Create if_rmnet.h and move the rmnet MAP packet structs to this common include file. To account for portablity, add little and big endian bitfield definitions similar to the ip & tcp headers. The definitions in the headers can now be re-used by the upcoming ipa driver series as well as qmi_wwan. Signed-off-by: Subash Abhinov Kasiviswanathan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 16fa1cf commit 9395da4

File tree

2 files changed

+56
-24
lines changed

2 files changed

+56
-24
lines changed

drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#ifndef _RMNET_MAP_H_
1414
#define _RMNET_MAP_H_
15+
#include <linux/if_rmnet.h>
1516

1617
struct rmnet_map_control_command {
1718
u8 command_name;
@@ -39,30 +40,6 @@ enum rmnet_map_commands {
3940
RMNET_MAP_COMMAND_ENUM_LENGTH
4041
};
4142

42-
struct rmnet_map_header {
43-
u8 pad_len:6;
44-
u8 reserved_bit:1;
45-
u8 cd_bit:1;
46-
u8 mux_id;
47-
__be16 pkt_len;
48-
} __aligned(1);
49-
50-
struct rmnet_map_dl_csum_trailer {
51-
u8 reserved1;
52-
u8 valid:1;
53-
u8 reserved2:7;
54-
u16 csum_start_offset;
55-
u16 csum_length;
56-
__be16 csum_value;
57-
} __aligned(1);
58-
59-
struct rmnet_map_ul_csum_header {
60-
__be16 csum_start_offset;
61-
u16 csum_insert_offset:14;
62-
u16 udp_ip4_ind:1;
63-
u16 csum_enabled:1;
64-
} __aligned(1);
65-
6643
#define RMNET_MAP_GET_MUX_ID(Y) (((struct rmnet_map_header *) \
6744
(Y)->data)->mux_id)
6845
#define RMNET_MAP_GET_CD_BIT(Y) (((struct rmnet_map_header *) \

include/linux/if_rmnet.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only
2+
* Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
3+
*/
4+
5+
#ifndef _LINUX_IF_RMNET_H_
6+
#define _LINUX_IF_RMNET_H_
7+
8+
struct rmnet_map_header {
9+
#if defined(__LITTLE_ENDIAN_BITFIELD)
10+
u8 pad_len:6;
11+
u8 reserved_bit:1;
12+
u8 cd_bit:1;
13+
#elif defined (__BIG_ENDIAN_BITFIELD)
14+
u8 cd_bit:1;
15+
u8 reserved_bit:1;
16+
u8 pad_len:6;
17+
#else
18+
#error "Please fix <asm/byteorder.h>"
19+
#endif
20+
u8 mux_id;
21+
__be16 pkt_len;
22+
} __aligned(1);
23+
24+
struct rmnet_map_dl_csum_trailer {
25+
u8 reserved1;
26+
#if defined(__LITTLE_ENDIAN_BITFIELD)
27+
u8 valid:1;
28+
u8 reserved2:7;
29+
#elif defined (__BIG_ENDIAN_BITFIELD)
30+
u8 reserved2:7;
31+
u8 valid:1;
32+
#else
33+
#error "Please fix <asm/byteorder.h>"
34+
#endif
35+
u16 csum_start_offset;
36+
u16 csum_length;
37+
__be16 csum_value;
38+
} __aligned(1);
39+
40+
struct rmnet_map_ul_csum_header {
41+
__be16 csum_start_offset;
42+
#if defined(__LITTLE_ENDIAN_BITFIELD)
43+
u16 csum_insert_offset:14;
44+
u16 udp_ip4_ind:1;
45+
u16 csum_enabled:1;
46+
#elif defined (__BIG_ENDIAN_BITFIELD)
47+
u16 csum_enabled:1;
48+
u16 udp_ip4_ind:1;
49+
u16 csum_insert_offset:14;
50+
#else
51+
#error "Please fix <asm/byteorder.h>"
52+
#endif
53+
} __aligned(1);
54+
55+
#endif /* !(_LINUX_IF_RMNET_H_) */

0 commit comments

Comments
 (0)