]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: qualcomm: rmnet: Move common struct definitions to include
authorSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Wed, 22 May 2019 20:21:07 +0000 (14:21 -0600)
committerDavid S. Miller <davem@davemloft.net>
Thu, 23 May 2019 16:48:07 +0000 (09:48 -0700)
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 <subashab@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
include/linux/if_rmnet.h [new file with mode: 0644]

index 884f1f52dcc25e88713a28978bb9bdaa4bc3a320..991d7e28573695a67d60811b61c5d69565f2a475 100644 (file)
@@ -12,6 +12,7 @@
 
 #ifndef _RMNET_MAP_H_
 #define _RMNET_MAP_H_
+#include <linux/if_rmnet.h>
 
 struct rmnet_map_control_command {
        u8  command_name;
@@ -39,30 +40,6 @@ enum rmnet_map_commands {
        RMNET_MAP_COMMAND_ENUM_LENGTH
 };
 
-struct rmnet_map_header {
-       u8  pad_len:6;
-       u8  reserved_bit:1;
-       u8  cd_bit:1;
-       u8  mux_id;
-       __be16 pkt_len;
-}  __aligned(1);
-
-struct rmnet_map_dl_csum_trailer {
-       u8  reserved1;
-       u8  valid:1;
-       u8  reserved2:7;
-       u16 csum_start_offset;
-       u16 csum_length;
-       __be16 csum_value;
-} __aligned(1);
-
-struct rmnet_map_ul_csum_header {
-       __be16 csum_start_offset;
-       u16 csum_insert_offset:14;
-       u16 udp_ip4_ind:1;
-       u16 csum_enabled:1;
-} __aligned(1);
-
 #define RMNET_MAP_GET_MUX_ID(Y) (((struct rmnet_map_header *) \
                                 (Y)->data)->mux_id)
 #define RMNET_MAP_GET_CD_BIT(Y) (((struct rmnet_map_header *) \
diff --git a/include/linux/if_rmnet.h b/include/linux/if_rmnet.h
new file mode 100644 (file)
index 0000000..b4f5403
--- /dev/null
@@ -0,0 +1,55 @@
+/* SPDX-License-Identifier: GPL-2.0-only
+ * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
+ */
+
+#ifndef _LINUX_IF_RMNET_H_
+#define _LINUX_IF_RMNET_H_
+
+struct rmnet_map_header {
+#if defined(__LITTLE_ENDIAN_BITFIELD)
+       u8  pad_len:6;
+       u8  reserved_bit:1;
+       u8  cd_bit:1;
+#elif defined (__BIG_ENDIAN_BITFIELD)
+       u8  cd_bit:1;
+       u8  reserved_bit:1;
+       u8  pad_len:6;
+#else
+#error "Please fix <asm/byteorder.h>"
+#endif
+       u8  mux_id;
+       __be16 pkt_len;
+}  __aligned(1);
+
+struct rmnet_map_dl_csum_trailer {
+       u8  reserved1;
+#if defined(__LITTLE_ENDIAN_BITFIELD)
+       u8  valid:1;
+       u8  reserved2:7;
+#elif defined (__BIG_ENDIAN_BITFIELD)
+       u8  reserved2:7;
+       u8  valid:1;
+#else
+#error "Please fix <asm/byteorder.h>"
+#endif
+       u16 csum_start_offset;
+       u16 csum_length;
+       __be16 csum_value;
+} __aligned(1);
+
+struct rmnet_map_ul_csum_header {
+       __be16 csum_start_offset;
+#if defined(__LITTLE_ENDIAN_BITFIELD)
+       u16 csum_insert_offset:14;
+       u16 udp_ip4_ind:1;
+       u16 csum_enabled:1;
+#elif defined (__BIG_ENDIAN_BITFIELD)
+       u16 csum_enabled:1;
+       u16 udp_ip4_ind:1;
+       u16 csum_insert_offset:14;
+#else
+#error "Please fix <asm/byteorder.h>"
+#endif
+} __aligned(1);
+
+#endif /* !(_LINUX_IF_RMNET_H_) */