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

Commit 81317c66 authored by Pavankumar Kondeti's avatar Pavankumar Kondeti Committed by Gerrit - the friendly Code Review server
Browse files

USB: gadget: u_bam: track dl packets pending for the host



Add a counter to track dl packets pending for the host. This counter
along with tx_skb_q.qlen tells how many dl packets are pending with
USB at any point and helpful in debugging data stall issues. This
counter value can be read from /sys/kernel/debug/usb_rmnet/status
file.

Change-Id: I9c0104611be6881e431ade9251f72876c32cfab4
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent 6c644c0f
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -169,6 +169,7 @@ struct bam_ch_info {
	unsigned int		max_num_pkts_pending_with_bam;
	unsigned int		max_bytes_pending_with_bam;
	unsigned int		delayed_bam_mux_write_done;
	unsigned int		pending_pkts_for_host;
};

struct gbam_port {
@@ -441,6 +442,7 @@ static void gbam_write_data_tohost(struct gbam_port *port)
			break;
		}
		d->to_host++;
		d->pending_pkts_for_host++;
	}
	spin_unlock_irqrestore(&port->port_lock_dl, flags);
}
@@ -668,6 +670,7 @@ static void gbam_epin_complete(struct usb_ep *ep, struct usb_request *req)
	spin_lock(&port->port_lock_dl);
	d = &port->data_ch;
	list_add_tail(&req->list, &d->tx_idle);
	d->pending_pkts_for_host--;
	spin_unlock(&port->port_lock_dl);

	queue_work(gbam_wq, &d->write_tohost_w);
@@ -1905,6 +1908,7 @@ static ssize_t gbam_read_stats(struct file *file, char __user *ubuf,
				"dpkts_to_modem:  %lu\n"
				"dpkts_pwith_bam: %u\n"
				"dbytes_pwith_bam: %u\n"
				"dpkts_pfor_host: %u\n"
				"to_usbhost_dcnt:  %u\n"
				"tomodem__dcnt:  %u\n"
				"rx_flow_control_disable_count: %u\n"
@@ -1921,6 +1925,7 @@ static ssize_t gbam_read_stats(struct file *file, char __user *ubuf,
				d->to_host, d->to_modem,
				d->pending_pkts_with_bam,
				d->pending_bytes_with_bam,
				d->pending_pkts_for_host,
				d->tohost_drp_cnt, d->tomodem_drp_cnt,
				d->rx_flow_control_disable,
				d->rx_flow_control_enable,
@@ -1973,6 +1978,7 @@ static ssize_t gbam_reset_stats(struct file *file, const char __user *buf,
		d->max_num_pkts_pending_with_bam = 0;
		d->max_bytes_pending_with_bam = 0;
		d->delayed_bam_mux_write_done = 0;
		d->pending_pkts_for_host = 0;

		spin_unlock(&port->port_lock_dl);
		spin_unlock_irqrestore(&port->port_lock_ul, flags);
@@ -2173,6 +2179,7 @@ int gbam_connect(struct grmnet *gr, u8 port_num,
		d->max_num_pkts_pending_with_bam = 0;
		d->max_bytes_pending_with_bam = 0;
		d->delayed_bam_mux_write_done = 0;
		d->pending_pkts_for_host = 0;
	}

	spin_unlock(&port->port_lock_dl);