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

Commit 664895bc authored by Mohammed Javid's avatar Mohammed Javid Committed by Gerrit - the friendly Code Review server
Browse files

ks8851: Changes to handle intermittent data stall



Due to updating the tx queue value to be 18k at every irq,
and using rx work queue in threaded irq context, the irq
for rx was raised in midway of data read, which lead to
wrong reading of packets and hence data stall.

Change-Id: I6d10952832ad1de351c0fc3579ca1b045a45d284
Acked-by: default avatarRishav LNU <rna@qti.qualcomm.com>
Signed-off-by: default avatarMohammed Javid <mjavid@codeaurora.org>
parent eb61a053
Loading
Loading
Loading
Loading
+17 −6
Original line number Diff line number Diff line
@@ -300,6 +300,21 @@ static void ks8851_rdreg(struct ks8851_net *ks, unsigned op,
		memcpy(rxb, trx, rxl);
}

/**
 * ks8851_rdreg16 - read 16 bit register from device
 * @ks: The chip information
 * @reg: The register address
 *
 * Read a 16bit register from the chip, returning the result
*/
static unsigned ks8851_rdreg16(struct ks8851_net *ks, unsigned reg)
{
	__le16 rx = 0;

	ks8851_rdreg(ks, MK_OP(reg & 2 ? 0xC : 0x3, reg), (u8 *)&rx, 2);
	return le16_to_cpu(rx);
}

/**
 * ks8851_rdreg8 - read 8 bit register from device
 * @ks: The chip information
@@ -696,7 +711,6 @@ static irqreturn_t ks8851_irq(int irq, void *_ks)
	struct ks8851_net *ks = _ks;
	unsigned status;
	unsigned handled = 0;
	int ret = 0;
	mutex_lock(&ks->lock);

	status = ks8851_32bitrdreg16(ks, KS_ISR);
@@ -725,8 +739,7 @@ static irqreturn_t ks8851_irq(int irq, void *_ks)

		/* update our idea of how much tx space is available to the
		 * system */
		ks->tx_space = KSZ8851_TX_SPACE;

		ks->tx_space = ks8851_rdreg16(ks, KS_TXMIR);
		netif_dbg(ks, intr, ks->netdev,
			  "%s: txspace %d\n", __func__, ks->tx_space);
		/* TX FIFO is empty */
@@ -749,9 +762,7 @@ static irqreturn_t ks8851_irq(int irq, void *_ks)
		 * packet read-out, however we're masking the interrupt
		 * from the device so do not bother masking just the RX
		 * from the device. */
		ret = queue_work(ks8851_rx_wq, &ks->rx_work);
		if (ret != 0)
			handled |= IRQ_RXI;
		ks8851_rx_pkts3(ks);
	}

	/* if something stopped the rx process, probably due to wanting