Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27a53253 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: f_gsi: Add ethernet as extended protocol for rmnet and dpl"

parents e1142c88 853f6e9e
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -568,6 +568,7 @@ config USB_CONFIGFS_F_CCID
config USB_CONFIGFS_F_GSI
config USB_CONFIGFS_F_GSI
	bool "USB GSI function"
	bool "USB GSI function"
	select USB_F_GSI
	select USB_F_GSI
	select USB_U_ETHER
	depends on USB_CONFIGFS
	depends on USB_CONFIGFS
	help
	help
	  Generic function driver to support h/w acceleration to IPA over GSI.
	  Generic function driver to support h/w acceleration to IPA over GSI.
+174 −67

File changed.

Preview size limit exceeded, changes collapsed.

+32 −7
Original line number Original line Diff line number Diff line
@@ -27,9 +27,14 @@
#include <linux/ipa_usb.h>
#include <linux/ipa_usb.h>
#include <linux/ipc_logging.h>
#include <linux/ipc_logging.h>


#include "u_ether.h"

#define GSI_RMNET_CTRL_NAME "rmnet_ctrl"
#define GSI_RMNET_CTRL_NAME "rmnet_ctrl"
#define GSI_MBIM_CTRL_NAME "android_mbim"
#define GSI_MBIM_CTRL_NAME "android_mbim"
#define GSI_DPL_CTRL_NAME "dpl_ctrl"
#define GSI_DPL_CTRL_NAME "dpl_ctrl"
#define ETHER_RMNET_CTRL_NAME "rmnet_ctrl0"
#define ETHER_DPL_CTRL_NAME "dpl_ctrl0"

#define GSI_CTRL_NAME_LEN (sizeof(GSI_MBIM_CTRL_NAME)+2)
#define GSI_CTRL_NAME_LEN (sizeof(GSI_MBIM_CTRL_NAME)+2)
#define GSI_MAX_CTRL_PKT_SIZE 4096
#define GSI_MAX_CTRL_PKT_SIZE 4096
#define GSI_CTRL_DTR (1 << 0)
#define GSI_CTRL_DTR (1 << 0)
@@ -114,6 +119,21 @@ enum rndis_class_id {
	RNDIS_ID_MAX,
	RNDIS_ID_MAX,
};
};


enum usb_prot_id {
	/* accelerated: redefined from ipa_usb.h, do not change order */
	USB_PROT_RNDIS_IPA,
	USB_PROT_ECM_IPA,
	USB_PROT_RMNET_IPA,
	USB_PROT_MBIM_IPA,
	USB_PROT_DIAG_IPA,

	/* non-accelerated */
	USB_PROT_RMNET_ETHER,
	USB_PROT_DPL_ETHER,

	USB_PROT_MAX,
};

#define MAXQUEUELEN 128
#define MAXQUEUELEN 128
struct event_queue {
struct event_queue {
	u8 event[MAXQUEUELEN];
	u8 event[MAXQUEUELEN];
@@ -228,6 +248,7 @@ struct gsi_data_port {
	enum connection_state sm_state;
	enum connection_state sm_state;
	struct event_queue evt_q;
	struct event_queue evt_q;
	wait_queue_head_t wait_for_ipa_ready;
	wait_queue_head_t wait_for_ipa_ready;
	struct gether gether_port;


	/* Track these for debugfs */
	/* Track these for debugfs */
	struct ipa_usb_xdci_chan_params ipa_in_channel_params;
	struct ipa_usb_xdci_chan_params ipa_in_channel_params;
@@ -237,7 +258,7 @@ struct gsi_data_port {


struct f_gsi {
struct f_gsi {
	struct usb_function function;
	struct usb_function function;
	enum ipa_usb_teth_prot prot_id;
	enum usb_prot_id prot_id;
	int ctrl_id;
	int ctrl_id;
	int data_id;
	int data_id;
	u32 vendorID;
	u32 vendorID;
@@ -285,21 +306,25 @@ static inline struct gsi_opts *to_gsi_opts(struct config_item *item)
			    func_inst.group);
			    func_inst.group);
}
}


static enum ipa_usb_teth_prot name_to_prot_id(const char *name)
static enum usb_prot_id name_to_prot_id(const char *name)
{
{
	if (!name)
	if (!name)
		goto error;
		goto error;


	if (!strncasecmp(name, "rndis", MAX_INST_NAME_LEN))
	if (!strncasecmp(name, "rndis", MAX_INST_NAME_LEN))
		return IPA_USB_RNDIS;
		return USB_PROT_RNDIS_IPA;
	if (!strncasecmp(name, "ecm", MAX_INST_NAME_LEN))
	if (!strncasecmp(name, "ecm", MAX_INST_NAME_LEN))
		return IPA_USB_ECM;
		return USB_PROT_ECM_IPA;
	if (!strncasecmp(name, "rmnet", MAX_INST_NAME_LEN))
	if (!strncasecmp(name, "rmnet", MAX_INST_NAME_LEN))
		return IPA_USB_RMNET;
		return USB_PROT_RMNET_IPA;
	if (!strncasecmp(name, "mbim", MAX_INST_NAME_LEN))
	if (!strncasecmp(name, "mbim", MAX_INST_NAME_LEN))
		return IPA_USB_MBIM;
		return USB_PROT_MBIM_IPA;
	if (!strncasecmp(name, "dpl", MAX_INST_NAME_LEN))
	if (!strncasecmp(name, "dpl", MAX_INST_NAME_LEN))
		return IPA_USB_DIAG;
		return USB_PROT_DIAG_IPA;
	if (!strncasecmp(name, "rmnet.ether", MAX_INST_NAME_LEN))
		return USB_PROT_RMNET_ETHER;
	if (!strncasecmp(name, "dpl.ether", MAX_INST_NAME_LEN))
		return USB_PROT_DPL_ETHER;


error:
error:
	return -EINVAL;
	return -EINVAL;