Skip to contentSkip to conversation

Add support for rmnet driver

PATCH Superseded Subash Abhinov Kasiviswanathan 4 participants 9 messages Aug 19, 2017 – Aug 21, 2017

Subsystems (4)

v6 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

v6 cover Add support for rmnet driver

This patch adds support for the rmnet driver which is required to support recent chipsets using Qualcomm Technologies, Inc. modems. The data from hardware follows the multiplexing and aggregation protocol (MAP).

This driver can be used to register onto any physical network device in IP mode. Physical transports include USB, HSIC, PCIe and IP accelerator.

rmnet driver helps to decode these packets and queue them to network stack (and encode and transmit it to the physical device).

--
v1: Same as the RFC patch with some minor fixes for issues reported by kbuild test robot.

v1->v2: Change datatypes and remove config IOCTL as mentioned by David. Also fix checkpatch issues and remove some unused code.

v2->v3: Move location to drivers/net and rename to rmnet. Change the userspace - netlink communication from custom netlink to rtnl_link_ops. Refactor some code. Use a fixed config for ingress and egress.

v3->v4: Move location to drivers/net/ethernet/qualcomm/. Fix comments from Stephen and Jiri -
Split the ether and arp type changes into seperate patches. Remove debug and custom logging and switch to standard netdevice log. Remove module parameters. Refactor and change some code style issues.

v4->v5: Rename some structs and variables. Move the initializer before the for loop start. Put the arp type in correct sequence.

v5->v6: Fix comments from Dan -
Use the upper link API. As a result, remove all the refcounting logic. Device refcount is explicitly held on real_dev on rx_handler registration only. Modifiy the flow control struct. Remove the unused ethernet mode handling.

Subash Abhinov Kasiviswanathan (3):
net: ether: Add support for multiplexing and aggregation type
net: arp: Add support for raw IP device
drivers: net: ethernet: qualcomm: rmnet: Initial implementation

 Documentation/networking/rmnet.txt                 |  82 ++++
 drivers/net/ethernet/qualcomm/Kconfig              |   2 +
 drivers/net/ethernet/qualcomm/Makefile             |   2 +
 drivers/net/ethernet/qualcomm/rmnet/Kconfig        |  12 +
 drivers/net/ethernet/qualcomm/rmnet/Makefile       |  14 +
 drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c | 412 +++++++++++++++++++++
 drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h |  57 +++
 .../net/ethernet/qualcomm/rmnet/rmnet_handlers.c   | 276 ++++++++++++++
 .../net/ethernet/qualcomm/rmnet/rmnet_handlers.h   |  26 ++
 drivers/net/ethernet/qualcomm/rmnet/rmnet_main.c   |  37 ++
 drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h    |  88 +++++
 .../ethernet/qualcomm/rmnet/rmnet_map_command.c    | 116 ++++++
 .../net/ethernet/qualcomm/rmnet/rmnet_map_data.c   | 105 ++++++
 .../net/ethernet/qualcomm/rmnet/rmnet_private.h    |  45 +++
 drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c    | 268 ++++++++++++++
 drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h    |  33 ++
 include/uapi/linux/if_arp.h                        |   1 +
 include/uapi/linux/if_ether.h                      |   4 +-
 18 files changed, 1579 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/networking/rmnet.txt
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/Kconfig
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/Makefile
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.h
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_main.c
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_private.h
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h
Signature · 1 line
1.9.1
#1 lore raw

PATCH v6 1/3 net: ether: Add support for multiplexing and aggregation type

Define the multiplexing and aggregation (MAP) ether type 0xDA1A. This is needed for receiving data in the MAP protocol like RMNET. This is not an officially registered ID.

---
 include/uapi/linux/if_ether.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/uapi/linux/if_ether.h +3 -1
index 5bc9bfd..e80b03f 100644
@@ -104,7 +104,9 @@
 #define ETH_P_QINQ3	0x9300		/* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
 #define ETH_P_EDSA	0xDADA		/* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
 #define ETH_P_AF_IUCV   0xFBFB		/* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */
-
+#define ETH_P_MAP       0xDA1A          /* Multiplexing and Aggregation Protocol
+					 *  NOT AN OFFICIALLY REGISTERED ID ]
+					 */
 #define ETH_P_802_3_MIN	0x0600		/* If the value in the ethernet type is less than this value
 					 * then the frame is Ethernet II. Else it is 802.3 */
 
Signature · 1 line
1.9.1
#2 lore raw

Re: [PATCH net-next 1/3 v6] net: ether: Add support for multiplexing and aggregation type

Quoted 14 lines · Subash Abhinov Kasiviswanathan

Define the multiplexing and aggregation (MAP) ether type 0xDA1A. This is needed for receiving data in the MAP protocol like RMNET. This is not an officially registered ID.

---
  include/uapi/linux/if_ether.h | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
include/uapi/linux/if_ether.h +0 -0
index 5bc9bfd..e80b03f 100644

include/uapi/linux/if_ether.h line 108

Quoted 6 lines
include/uapi/linux/if_ether.h +2 -1
@@ -104,7 +104,9 @@
  #define ETH_P_QINQ3	0x9300		/* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
  #define ETH_P_EDSA	0xDADA		/* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
  #define ETH_P_AF_IUCV   0xFBFB		/* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */
-
+#define ETH_P_MAP       0xDA1A          /* Multiplexing and Aggregation Protocol
+					 *  NOT AN OFFICIALLY REGISTERED ID ]

You cant just arbitrarly assign yourself an ethertype.
The IEEE may never issue you one - and if they do, it will likely not be the one you want i.e above.

If there is a way for you to make this a config option that is not hardcoded to some default value then that would be the best approach to take.

cheers,
jamal

maintainer
#3 lore raw

Re: [PATCH net-next 1/3 v6] net: ether: Add support for multiplexing and aggregation type

From: Jamal Hadi Salim <[email protected]>
Date: Sun, 20 Aug 2017 14:18:03 -0400

Quoted 29 lines · Subash Abhinov Kasiviswanathan
Quoted 14 lines

Define the multiplexing and aggregation (MAP) ether type 0xDA1A. This is needed for receiving data in the MAP protocol like RMNET. This is not an officially registered ID.
Signed-off-by: Subash Abhinov Kasiviswanathan <[email protected]>

---
  include/uapi/linux/if_ether.h | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
include/uapi/linux/if_ether.h +0 -0
index 5bc9bfd..e80b03f 100644

include/uapi/linux/if_ether.h line 111

Quoted 9 lines
include/uapi/linux/if_ether.h +2 -1
@@ -104,7 +104,9 @@
  #define ETH_P_QINQ3 0x9300 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY
  #REGISTERED ID ] */
  #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY
  #REGISTERED ID ] */
  #define ETH_P_AF_IUCV 0xFBFB /* IBM af_iucv [ NOT AN OFFICIALLY
  #REGISTERED ID ] */
-
+#define ETH_P_MAP 0xDA1A /* Multiplexing and Aggregation Protocol
+ * NOT AN OFFICIALLY REGISTERED ID ]

You cant just arbitrarly assign yourself an ethertype. The IEEE may never issue you one - and if they do, it will likely not be the one you want i.e above.

Quoted 3 lines

If there is a way for you to make this a config option that is not hardcoded to some default value then that would be the best approach to take.

This may be a kind of a different situation, these ethertypes exist only internally in the kernel and never on the wire.

It's just controlling the demux on ethernet receive.

We have several IDs like this, and thus this addition is consistent with existing practice.

#4 lore raw

Re: [PATCH net-next 1/3 v6] net: ether: Add support for multiplexing and aggregation type

Quoted 11 lines · David Miller
Quoted 10 lines
Quoted 2 lines

+#define ETH_P_MAP 0xDA1A /* Multiplexing and Aggregation Protocol
+ * NOT AN OFFICIALLY REGISTERED ID ]

You cant just arbitrarly assign yourself an ethertype. The IEEE may never issue you one - and if they do, it will likely not be the one you want i.e above.

If there is a way for you to make this a config option that is not hardcoded to some default value then that would be the best approach to take.

Quoted 7 lines

This may be a kind of a different situation, these ethertypes exist only internally in the kernel and never on the wire.

It's just controlling the demux on ethernet receive.

We have several IDs like this, and thus this addition is consistent with existing practice.

Ok, so if the IEEE issued this ID to someone there will be no conflict then?
I checked - all the ether types listed in the header file as "NOT AN OFFICIALLY REGISTERED ID" are not currently assigned by IEEE.

cheers,
jamal

#5 lore raw

RE: [PATCH net-next 1/3 v6] net: ether: Add support for multiplexing and aggregation type

In reply to David Miller

From: David Miller

Quoted 37 lines

Sent: 20 August 2017 23:12
From: Jamal Hadi Salim <[email protected]>
Date: Sun, 20 Aug 2017 14:18:03 -0400

Quoted 29 lines · Subash Abhinov Kasiviswanathan
Quoted 14 lines

Define the multiplexing and aggregation (MAP) ether type 0xDA1A. This is needed for receiving data in the MAP protocol like RMNET. This is not an officially registered ID.
Signed-off-by: Subash Abhinov Kasiviswanathan <[email protected]>

---
  include/uapi/linux/if_ether.h | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
include/uapi/linux/if_ether.h +0 -0
index 5bc9bfd..e80b03f 100644

include/uapi/linux/if_ether.h line 111

Quoted 9 lines
include/uapi/linux/if_ether.h +2 -1
@@ -104,7 +104,9 @@
  #define ETH_P_QINQ3 0x9300 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY
  #REGISTERED ID ] */
  #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY
  #REGISTERED ID ] */
  #define ETH_P_AF_IUCV 0xFBFB /* IBM af_iucv [ NOT AN OFFICIALLY
  #REGISTERED ID ] */
-
+#define ETH_P_MAP 0xDA1A /* Multiplexing and Aggregation Protocol
+ * NOT AN OFFICIALLY REGISTERED ID ]

You cant just arbitrarly assign yourself an ethertype. The IEEE may never issue you one - and if they do, it will likely not be the one you want i.e above.

Quoted 3 lines

If there is a way for you to make this a config option that is not hardcoded to some default value then that would be the best approach to take.

Quoted 7 lines

This may be a kind of a different situation, these ethertypes exist only internally in the kernel and never on the wire.

It's just controlling the demux on ethernet receive.

We have several IDs like this, and thus this addition is consistent with existing practice.

Are they ever put into ethernet packets?
If not then use values below 1500.

David

#6 lore raw

PATCH v6 2/3 net: arp: Add support for raw IP device

In reply to Subash Abhinov Kasiviswanathan

Define the raw IP type. This is needed for raw IP net devices like rmnet.

---
 include/uapi/linux/if_arp.h | 1 +
 1 file changed, 1 insertion(+)
include/uapi/linux/if_arp.h +1 -0
index cf73510..a2a6356 100644
@@ -59,6 +59,7 @@
 #define ARPHRD_LAPB	516		/* LAPB				*/
 #define ARPHRD_DDCMP    517		/* Digital's DDCMP protocol     */
 #define ARPHRD_RAWHDLC	518		/* Raw HDLC			*/
+#define ARPHRD_RAWIP    519		/* Raw IP                       */
 
 #define ARPHRD_TUNNEL	768		/* IPIP tunnel			*/
 #define ARPHRD_TUNNEL6	769		/* IP6IP6 tunnel       		*/
Signature · 1 line
1.9.1
#7 lore raw

PATCH v6 3/3 drivers: net: ethernet: qualcomm: rmnet: Initial implementation

In reply to Subash Abhinov Kasiviswanathan

RmNet driver provides a transport agnostic MAP (multiplexing and aggregation protocol) support in embedded module. Module provides virtual network devices which can be attached to any IP-mode physical device. This will be used to provide all MAP functionality on future hardware in a single consistent location.

---
 Documentation/networking/rmnet.txt                 |  82 ++++
 drivers/net/ethernet/qualcomm/Kconfig              |   2 +
 drivers/net/ethernet/qualcomm/Makefile             |   2 +
 drivers/net/ethernet/qualcomm/rmnet/Kconfig        |  12 +
 drivers/net/ethernet/qualcomm/rmnet/Makefile       |  14 +
 drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c | 412 +++++++++++++++++++++
 drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h |  57 +++
 .../net/ethernet/qualcomm/rmnet/rmnet_handlers.c   | 276 ++++++++++++++
 .../net/ethernet/qualcomm/rmnet/rmnet_handlers.h   |  26 ++
 drivers/net/ethernet/qualcomm/rmnet/rmnet_main.c   |  37 ++
 drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h    |  88 +++++
 .../ethernet/qualcomm/rmnet/rmnet_map_command.c    | 116 ++++++
 .../net/ethernet/qualcomm/rmnet/rmnet_map_data.c   | 105 ++++++
 .../net/ethernet/qualcomm/rmnet/rmnet_private.h    |  45 +++
 drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c    | 268 ++++++++++++++
 drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h    |  33 ++
 16 files changed, 1575 insertions(+)
 create mode 100644 Documentation/networking/rmnet.txt
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/Kconfig
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/Makefile
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.h
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_main.c
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_private.h
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
 create mode 100644 drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h
Documentation/networking/rmnet.txt new file +82 -0
new file mode 100644
index 0000000..6b341ea
@@ -0,0 +1,82 @@
+1. Introduction
+
+rmnet driver is used for supporting the Multiplexing and aggregation
+Protocol (MAP). This protocol is used by all recent chipsets using Qualcomm
+Technologies, Inc. modems.
+
+This driver can be used to register onto any physical network device in
+IP mode. Physical transports include USB, HSIC, PCIe and IP accelerator.
+
+Multiplexing allows for creation of logical netdevices (rmnet devices) to
+handle multiple private data networks (PDN) like a default internet, tethering,
+multimedia messaging service (MMS) or IP media subsystem (IMS). Hardware sends
+packets with MAP headers to rmnet. Based on the multiplexer id, rmnet
+routes to the appropriate PDN after removing the MAP header.
+
+Aggregation is required to achieve high data rates. This involves hardware
+sending aggregated bunch of MAP frames. rmnet driver will de-aggregate
+these MAP frames and send them to appropriate PDN's.
+
+2. Packet format
+
+a. MAP packet (data / control)
+
+MAP header has the same endianness of the IP packet.
+
+Packet format -
+
+Bit             0             1           2-7      8 - 15           16 - 31
+Function   Command / Data   Reserved     Pad   Multiplexer ID    Payload length
+Bit            32 - x
+Function     Raw  Bytes
+
+Command (1)/ Data (0) bit value is to indicate if the packet is a MAP command
+or data packet. Control packet is used for transport level flow control. Data
+packets are standard IP packets.
+
+Reserved bits are usually zeroed out and to be ignored by receiver.
+
+Padding is number of bytes to be added for 4 byte alignment if required by
+hardware.
+
+Multiplexer ID is to indicate the PDN on which data has to be sent.
+
+Payload length includes the padding length but does not include MAP header
+length.
+
+b. MAP packet (command specific)
+
+Bit             0             1           2-7      8 - 15           16 - 31
+Function   Command         Reserved     Pad   Multiplexer ID    Payload length
+Bit          32 - 39        40 - 45    46 - 47       48 - 63
+Function   Command name    Reserved   Command Type   Reserved
+Bit          64 - 95
+Function   Transaction ID
+Bit          96 - 127
+Function   Command data
+
+Command 1 indicates disabling flow while 2 is enabling flow
+
+Command types -
+0 for MAP command request
+1 is to acknowledge the receipt of a command
+2 is for unsupported commands
+3 is for error during processing of commands
+
+c. Aggregation
+
+Aggregation is multiple MAP packets (can be data or command) delivered to
+rmnet in a single linear skb. rmnet will process the individual
+packets and either ACK the MAP command or deliver the IP packet to the
+network stack as needed
+
+MAP header|IP Packet|Optional padding|MAP header|IP Packet|Optional padding....
+MAP header|IP Packet|Optional padding|MAP header|Command Packet|Optional pad...
+
+3. Userspace configuration
+
+rmnet userspace configuration is done through netlink library librmnetctl
+and command line utility rmnetcli. Utility is hosted in codeaurora forum git.
+The driver uses rtnl_link_ops for communication.
+
+https://source.codeaurora.org/quic/la/platform/vendor/qcom-opensource/dataservices/tree/rmnetctl
drivers/net/ethernet/qualcomm/Kconfig +2 -0
index 877675a..f520071 100644
@@ -59,4 +59,6 @@ config QCOM_EMAC
 	  low power, Receive-Side Scaling (RSS), and IEEE 1588-2008
 	  Precision Clock Synchronization Protocol.
 
+source "drivers/net/ethernet/qualcomm/rmnet/Kconfig"
+
 endif # NET_VENDOR_QUALCOMM
drivers/net/ethernet/qualcomm/Makefile +2 -0
index 92fa7c4..c4f38bd 100644
@@ -9,3 +9,5 @@ obj-$(CONFIG_QCA7000_UART) += qcauart.o
 qcauart-objs := qca_uart.o
 
 obj-y += emac/
+
+obj-$(CONFIG_RMNET) += rmnet/
\ No newline at end of file
drivers/net/ethernet/qualcomm/rmnet/Kconfig new file +12 -0
new file mode 100644
index 0000000..4948f14
@@ -0,0 +1,12 @@
+#
+# RMNET MAP driver
+#
+
+menuconfig RMNET
+	depends on NETDEVICES
+	bool "RmNet MAP driver"
+	default n
+	---help---
+	  If you say Y here, then the rmnet module will be statically
+	  compiled into the kernel. The rmnet module provides MAP
+	  functionality for embedded and bridged traffic.
drivers/net/ethernet/qualcomm/rmnet/Makefile new file +14 -0
new file mode 100644
index 0000000..2b6c9cf
@@ -0,0 +1,14 @@
+#
+# Makefile for the RMNET module
+#
+
+rmnet-y		 := rmnet_main.o
+rmnet-y		 += rmnet_config.o
+rmnet-y		 += rmnet_vnd.o
+rmnet-y		 += rmnet_handlers.o
+rmnet-y		 += rmnet_map_data.o
+rmnet-y		 += rmnet_map_command.o
+rmnet-y		 += rmnet_stats.o
+obj-$(CONFIG_RMNET) += rmnet.o
+
+CFLAGS_rmnet_main.o := -I$(src)
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c new file +412 -0

412 lines not on this page · raw message

drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h new file +57 -0

57 lines not on this page · raw message

drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c new file +276 -0

276 lines not on this page · raw message

drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.h new file +26 -0
new file mode 100644
index 0000000..f2638cf
@@ -0,0 +1,26 @@
+/* Copyright (c) 2013, 2016-2017 The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * RMNET Data ingress/egress handler
+ *
+ */
+
+#ifndef _RMNET_HANDLERS_H_
+#define _RMNET_HANDLERS_H_
+
+#include "rmnet_config.h"
+
+void rmnet_egress_handler(struct sk_buff *skb,
+			  struct rmnet_endpoint *ep);
+
+rx_handler_result_t rmnet_rx_handler(struct sk_buff **pskb);
+
+#endif /* _RMNET_HANDLERS_H_ */
drivers/net/ethernet/qualcomm/rmnet/rmnet_main.c new file +37 -0
new file mode 100644
index 0000000..80c3920
@@ -0,0 +1,37 @@
+/* Copyright (c) 2013-2014, 2016-2017 The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ *
+ * RMNET Data generic framework
+ *
+ */
+
+#include <linux/module.h>
+#include "rmnet_private.h"
+#include "rmnet_config.h"
+#include "rmnet_vnd.h"
+
+/* Startup/Shutdown */
+
+static int __init rmnet_init(void)
+{
+	rmnet_config_init();
+	return 0;
+}
+
+static void __exit rmnet_exit(void)
+{
+	rmnet_config_exit();
+}
+
+module_init(rmnet_init)
+module_exit(rmnet_exit)
+MODULE_LICENSE("GPL v2");
drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h new file +88 -0

88 lines not on this page · raw message

drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c new file +116 -0

116 lines not on this page · raw message

drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c new file +105 -0

105 lines not on this page · raw message

drivers/net/ethernet/qualcomm/rmnet/rmnet_private.h new file +45 -0

45 lines not on this page · raw message

drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c new file +268 -0

268 lines not on this page · raw message

drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h new file +33 -0
new file mode 100644
index 0000000..7de5839
@@ -0,0 +1,33 @@
+/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * RMNET Data Virtual Network Device APIs
+ *
+ */
+
+#ifndef _RMNET_VND_H_
+#define _RMNET_VND_H_
+
+int rmnet_vnd_do_flow_control(struct rmnet_real_dev_info *rdinfo,
+			      struct net_device *dev, int enable);
+struct rmnet_endpoint *rmnet_vnd_get_endpoint(struct net_device *dev);
+int rmnet_vnd_free_dev(struct net_device *real_dev, int id);
+int rmnet_vnd_remove_ref_dev(struct net_device *real_dev, int id);
+int rmnet_vnd_rx_fixup(struct sk_buff *skb, struct net_device *dev);
+int rmnet_vnd_tx_fixup(struct sk_buff *skb, struct net_device *dev);
+int rmnet_vnd_get_mux(struct net_device *real_dev,
+		      struct net_device *rmnet_dev);
+struct net_device *rmnet_vnd_get_by_id(struct net_device *real_dev, int id);
+void rmnet_vnd_setup(struct net_device *dev);
+int rmnet_vnd_newlink(struct net_device *real_dev, int id,
+		      struct net_device *new_device);
+int rmnet_vnd_is_rmnet(struct net_device *dev);
+#endif /* _RMNET_VND_H_ */
Signature · 1 line
1.9.1
maintainer
#8 lore raw

Re: [PATCH net-next 3/3 v6] drivers: net: ethernet: qualcomm: rmnet: Initial implementation

From: Subash Abhinov Kasiviswanathan <[email protected]>
Date: Fri, 18 Aug 2017 23:35:31 -0600

drivers/net/ethernet/qualcomm/Makefile obj-$(CONFIG_QCA7000_UART) += qcauart.o · line 13

Quoted 11 lines
drivers/net/ethernet/qualcomm/Makefile +2 -0
index 92fa7c4..c4f38bd 100644
@@ -9,3 +9,5 @@ obj-$(CONFIG_QCA7000_UART) += qcauart.o
 qcauart-objs := qca_uart.o
 
 obj-y += emac/
+
+obj-$(CONFIG_RMNET) += rmnet/
\ No newline at end of file

Missing final newline in this file.

Quoted 5 lines
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c new file +0 -0
new file mode 100644
index 0000000..5338bab

...

drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c line 34

Quoted 3 lines
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c new file +3 -0
+static inline int
+rmnet_is_real_dev_registered(const struct net_device *real_dev)
+{

Do not declare functions as inline in foo.c files, let the compiler decide.

drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c line 43

Quoted 3 lines
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c new file +3 -0
+static inline struct rmnet_real_dev_info*
+__rmnet_get_real_dev_info(const struct net_device *real_dev)
+{

Likewise.

Quoted 5 lines
drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c new file +0 -0
new file mode 100644
index 0000000..f34fe9e

...

drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c

Quoted 2 lines
drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c new file +2 -0
+static inline void rmnet_set_skb_proto(struct sk_buff *skb)
+{

Likewise.

Quoted 3 lines
drivers/net/ethernet/qualcomm/rmnet/rmnet_main.c new file +0 -0
new file mode 100644
index 0000000..80c3920

...

Quoted 6 lines
drivers/net/ethernet/qualcomm/rmnet/rmnet_main.c new file +6 -0
+/* Startup/Shutdown */
+
+static int __init rmnet_init(void)
+{
+	rmnet_config_init();
+	return 0;

drivers/net/ethernet/qualcomm/rmnet/rmnet_main.c line 37

Quoted 10 lines
drivers/net/ethernet/qualcomm/rmnet/rmnet_main.c new file +10 -0
+}
+
+static void __exit rmnet_exit(void)
+{
+	rmnet_config_exit();
+}
+
+module_init(rmnet_init)
+module_exit(rmnet_exit)
+MODULE_LICENSE("GPL v2");

Unless you intend to do something different here, having a completely separate foo.c file just to invoke functions in another file at module init and exit time is wasteful. Just do the module_init()/module_exit() where the rmnet_config_{init,exit}() functions are.