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

Commit af7cf1a4 authored by Nadine Toledano's avatar Nadine Toledano Committed by Ido Shayevitz
Browse files

usb: gadget: mbim: Enable wMTU parameter value to be runtime configurable



Adding option to configure the mtu parameter from user space according
the use requirements. The default value is set to 1500.

CRs-Fixed: 503003
Change-Id: I52a483d62e72cf4cce0309754b1fe8e73130c75d
Signed-off-by: default avatarNadine Toledano <nadinet@codeaurora.org>
parent 86155e46
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
@@ -1244,8 +1244,33 @@ static ssize_t mbim_transports_store(struct device *dev,
static DEVICE_ATTR(mbim_transports, S_IRUGO | S_IWUSR, mbim_transports_show,
				mbim_transports_store);

static ssize_t wMTU_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	return snprintf(buf, PAGE_SIZE, "%d\n", ext_mbb_desc.wMTU);
}

static ssize_t wMTU_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t size)
{
	int value;
	if (sscanf(buf, "%d", &value) == 1) {
		if (value < 0 || value > USHRT_MAX)
			pr_err("illegal MTU %d, enter unsigned 16 bits\n",
				value);
		else
			ext_mbb_desc.wMTU = cpu_to_le16(value);
		return size;
	}
	return -EINVAL;
}

static DEVICE_ATTR(wMTU, S_IRUGO | S_IWUSR, wMTU_show,
				wMTU_store);

static struct device_attribute *mbim_function_attributes[] = {
	&dev_attr_mbim_transports,
	&dev_attr_wMTU,
	NULL
};

+1 −1
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ static struct usb_cdc_ext_mbb_desc ext_mbb_desc = {

	.bcdMbbExtendedVersion =	cpu_to_le16(0x0100),
	.bMaxOutstandingCmdMsges =	64,
	.wMTU =	1500,
	.wMTU =	cpu_to_le16(1500),
};

/* the default data interface has no endpoints ... */