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

Commit bb2db688 authored by Hemant Kumar's avatar Hemant Kumar
Browse files

usb: gadget: Update default class subclass and protocol for rndis



This allows Host to load NDIS 6.0 driver for RNDIS over ethernet.
Design objectives of NDIS 6.0 is to enhance driver performance
and scalability. Observing higher peak tput (308Mbps --> 480Mbps)
for FTP transfer on live network. It resolves the data stall that
is being caused by the sudden transfer abort coming from the NDIS
5.0 Host driver.

Change-Id: I503a5573af71eb1b004c68abb64bb04d7e06f9af
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
parent 8aedd708
Loading
Loading
Loading
Loading
+49 −0
Original line number Diff line number Diff line
@@ -2507,6 +2507,16 @@ static int gsi_bind(struct usb_configuration *c, struct usb_function *f)
					DEFAULT_PKT_ALIGNMENT_FACTOR);
		rndis_set_pkt_alignment_factor(gsi->params,
					DEFAULT_PKT_ALIGNMENT_FACTOR);
		if (gsi->rndis_use_wceis) {
			info.iad_desc->bFunctionClass =
				USB_CLASS_WIRELESS_CONTROLLER;
			info.iad_desc->bFunctionSubClass = 0x01;
			info.iad_desc->bFunctionProtocol = 0x03;
			info.ctrl_desc->bInterfaceClass =
				USB_CLASS_WIRELESS_CONTROLLER;
			info.ctrl_desc->bInterfaceSubClass = 0x1;
			info.ctrl_desc->bInterfaceProtocol = 0x03;
		}
		break;
	case IPA_USB_MBIM:
		info.string_defs = mbim_gsi_string_defs;
@@ -2986,6 +2996,42 @@ static ssize_t gsi_info_show(struct config_item *item, char *page)

CONFIGFS_ATTR_RO(gsi_, info);

static ssize_t gsi_rndis_wceis_show(struct config_item *item, char *page)
{
	struct f_gsi *gsi = to_gsi_opts(item)->gsi;

	return snprintf(page, PAGE_SIZE, "%d\n", gsi->rndis_use_wceis);
}

static ssize_t gsi_rndis_wceis_store(struct config_item *item,
			const char *page, size_t len)
{
	struct f_gsi *gsi = to_gsi_opts(item)->gsi;
	bool val;

	if (kstrtobool(page, &val))
		return -EINVAL;

	gsi->rndis_use_wceis = val;

	return len;
}

CONFIGFS_ATTR(gsi_, rndis_wceis);

static struct configfs_attribute *gsi_rndis_attrs[] = {
	&gsi_attr_info,
	&gsi_attr_rndis_wceis,
	NULL,
};

static struct config_item_type gsi_func_rndis_type = {
	.ct_item_ops	= &gsi_item_ops,
	.ct_attrs	= gsi_rndis_attrs,
	.ct_owner	= THIS_MODULE,
};


static struct configfs_attribute *gsi_attrs[] = {
	&gsi_attr_info,
	NULL,
@@ -3015,6 +3061,9 @@ static int gsi_set_inst_name(struct usb_function_instance *fi,
		return -EINVAL;
	}

	if (ret == IPA_USB_RNDIS)
		config_group_init_type_name(&opts->func_inst.group, "",
					    &gsi_func_rndis_type);
	gsi = gsi_function_init(ret);
	if (IS_ERR(gsi))
		return PTR_ERR(gsi);
+7 −6
Original line number Diff line number Diff line
@@ -237,6 +237,7 @@ struct f_gsi {
	struct rndis_params *params;
	atomic_t connected;
	bool data_interface_up;
	bool rndis_use_wceis;

	const struct usb_endpoint_descriptor *in_ep_desc_backup;
	const struct usb_endpoint_descriptor *out_ep_desc_backup;
@@ -470,9 +471,9 @@ static struct usb_interface_descriptor rndis_gsi_control_intf = {
	/* .bInterfaceNumber = DYNAMIC */
	/* status endpoint is optional; this could be patched later */
	.bNumEndpoints =	1,
	.bInterfaceClass =	USB_CLASS_WIRELESS_CONTROLLER,
	.bInterfaceSubClass =   0x01,
	.bInterfaceProtocol =   0x03,
	.bInterfaceClass =	USB_CLASS_MISC,
	.bInterfaceSubClass =   0x04,
	.bInterfaceProtocol =   0x01, /* RNDIS over Ethernet */
	/* .iInterface = DYNAMIC */
};

@@ -530,9 +531,9 @@ rndis_gsi_iad_descriptor = {
	.bDescriptorType =	USB_DT_INTERFACE_ASSOCIATION,
	.bFirstInterface =	0, /* XXX, hardcoded */
	.bInterfaceCount =	2, /* control + data */
	.bFunctionClass =	USB_CLASS_WIRELESS_CONTROLLER,
	.bFunctionSubClass =	0x01,
	.bFunctionProtocol =	0x03,
	.bFunctionClass =	USB_CLASS_MISC,
	.bFunctionSubClass =	0x04,
	.bFunctionProtocol =	0x01, /* RNDIS over Ethernet */
	/* .iFunction = DYNAMIC */
};