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

Commit f6fb2128 authored by Lena Salman's avatar Lena Salman
Browse files

usb: tty: Add more buffer space and make the buffer use direct



Due to stall in high throughput in DUN+SoftAP mode, we
needed to improve the way we transfer the buffers.
Here we enlarge the buffer space so we have more space
to buffer the high throughput data and switch to direct
buffer use, excluding the need and the overhead
of a work queue.

CRs-fixed: 681446
Change-Id: I77e03d8317803b0ddbb98f1575e5b0e73b1e20b4
Signed-off-by: default avatarLena Salman <esalman@codeaurora.org>
parent 66dc4fbd
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include <linux/module.h>
#include <linux/ratelimit.h>

#define TTY_MAX_BUF 131072
/**
 *	tty_buffer_free_all		-	free buffers used by a tty
 *	@tty: tty to free from
@@ -61,7 +62,7 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, size_t size)
{
	struct tty_buffer *p;

	if (port->buf.memory_used + size > 65536)
	if (port->buf.memory_used + size > TTY_MAX_BUF)
		return NULL;
	p = kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC);
	if (p == NULL)
+2 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <linux/uaccess.h>
#include <linux/fs.h>
#include <linux/usb/composite.h>
#include <linux/tty.h>

#include "usb_gadget_xport.h"

@@ -1268,6 +1269,7 @@ static void gser_ioctl_set_transport(struct f_gser *gser,
	if (transport == GSERIAL_SET_XPORT_TYPE_TTY) {
		new_transport = USB_GADGET_XPORT_TTY;
		pr_debug("%s: Switching modem transport to TTY.", __func__);
		gser->port.flags |= ASYNC_LOW_LATENCY;
	} else if (transport == GSERIAL_SET_XPORT_TYPE_SMD) {
		new_transport = USB_GADGET_XPORT_SMD;
		pr_debug("%s: Switching modem transport to SMD.", __func__);
+9 −0
Original line number Diff line number Diff line
@@ -880,6 +880,11 @@ static int gs_open(struct tty_struct *tty, struct file *file)
	if (port->port_usb) {
		struct gserial	*gser = port->port_usb;

		if (gser->flags & ASYNC_LOW_LATENCY) {
			pr_debug("%s: Setting to low latency", __func__);
			tty->port->low_latency = 1;
		}

		pr_debug("gs_open: start ttyGS%d\n", port->port_num);
		gs_start_io(port);

@@ -1505,6 +1510,10 @@ int gserial_connect(struct gserial *gser, u8 port_num)
	 */
	if (port->port.count) {
		pr_debug("gserial_connect: start ttyGS%d\n", port->port_num);
		if (gser->flags & ASYNC_LOW_LATENCY) {
			pr_debug("%s: Setting to low latency", __func__);
			gser->ioport->port.tty->port->low_latency = 1;
		}
		gs_start_io(port);
		if (gser->connect)
			gser->connect(gser);
+2 −0
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@ struct gserial {
	struct usb_ep			*in;
	struct usb_ep			*out;

	unsigned long			flags;

	/* REVISIT avoid this CDC-ACM support harder ... */
	struct usb_cdc_line_coding port_line_coding;	/* 9600-8-N-1 etc */
	u16				serial_state;