net: thunder: change q_len's type to handle max ring size

"Linux Kernel Mailing List" <[email protected]>
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/88c991a91729b402bbfbf247fdba16ac21c369ab
Commit:     88c991a91729b402bbfbf247fdba16ac21c369ab
Parent:     e0c42c8e3e94f6c478f8c96814d4a2d19d2204b2
Refname:    refs/heads/master
Author:     Dean Nelson <[email protected]>
AuthorDate: Thu Feb 8 14:21:05 2018 -0500
Committer:  David S. Miller <[email protected]>
CommitDate: Thu Feb 8 15:34:23 2018 -0500

    net: thunder: change q_len's type to handle max ring size
    
    The Cavium thunder nicvf driver supports rx/tx rings of up to 65536 entries per.
    The number of entires are stored in the q_len member of struct q_desc_mem. The
    problem is that q_len being a u16, results in 65536 becoming 0.
    
    In getting pointers to descriptors in the rings, the driver uses q_len minus 1
    as a mask after incrementing the pointer, in order to go back to the beginning
    and not go past the end of the ring.
    
    With the q_len set to 0 the mask is no longer correct and the driver does go
    beyond the end of the ring, causing various ills. Usually the first thing that
    shows up is a "NETDEV WATCHDOG: enP2p1s0f1 (nicvf): transmit queue 7 timed out"
    warning.
    
    This patch remedies the problem by changing q_len to a u32.
    
    Signed-off-by: Dean Nelson <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
---
 drivers/net/ethernet/cavium/thunder/nicvf_queues.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.h b/drivers/net/ethernet/cavium/thunder/nicvf_queues.h
index 7d1e4e2aaad0..ce1eed7a6d63 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.h
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.h
@@ -213,7 +213,7 @@ struct rx_tx_queue_stats {
 struct q_desc_mem {
 	dma_addr_t	dma;
 	u64		size;
-	u16		q_len;
+	u32		q_len;
 	dma_addr_t	phys_base;
 	void		*base;
 	void		*unalign_base;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.