Received: by 10.223.176.5 with SMTP id f5csp2284814wra; Thu, 8 Feb 2018 11:22:10 -0800 (PST) X-Google-Smtp-Source: AH8x226chtjhthoXSms1zRN/MjAU7EMCuY5b7qHwkViIQnjoAumYdDAZin4y9jokTs1YlRz7cDd3 X-Received: by 2002:a17:902:47c2:: with SMTP id d2-v6mr91481plh.222.1518117730044; Thu, 08 Feb 2018 11:22:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518117730; cv=none; d=google.com; s=arc-20160816; b=bCsa04yPOwvWVGAjGagwgRuSCZ2QNTfdUjFAZueGJn+i+JMpen0kWLlT/7pwVGbeOj B5a2FrjI6LByf2wRrrrGl4T/7rwMzfpEfrY+ggji2FR6feU59d1RuWCO9qeabZZcPY+6 2whxNvqxVsfVnrMXXg9lpcjsMVlut7JfdCEc40oA0nGiH6wCZgUlvQTdroCu2msJMxiG 4SSZYG7DgmpACfOPS0DN3I2J5qPcrGgtNBNFERdqW24eKgxueGmcpGofyp27JS5EHn8G qVnOjoQqUn4dH2mIZamOKa1hIvRnD3sU9tYJLKYP5Z3sV7q6ELTUS+nxF/Y6oyZXacg8 r+CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:message-id:cc:to:from :arc-authentication-results; bh=LxZA4ERpxJsZegZ5/TQYAEFh2H3eSbVgneOJq6cfEpQ=; b=p/2uHuPezilBgFoYoPga87Mj3/bnFfCS5aZQDnMZVWqCaU3IDz5A82ZG4mHR7FmbOa Q0+V0en9lK0T6n+NeakV3T9R8625PFzMMns11AAhW9nMhqyo3N3mK36oZtAgoDkcQmYs kB9DPdkC9xXz0l9kiyUXnFvFF0aU39lOl09bgpEJsvbp/xyVVZ7UgG95OACWi7oa+O3+ nDsw+4in3FJAM3fOvNMUusfjUqM8x+A8R0olJ+BdvvB3Usk0exuHdSw94XPuW/u4P8PH HXC0oX/+1jBNtsdJ6I8L2CckiCgS6WrBrn+d0E1VkZr8/aNvJJYqO2kSIEje96FiMhGW 8P4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z9si404908pfl.34.2018.02.08.11.21.54; Thu, 08 Feb 2018 11:22:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752171AbeBHTVG (ORCPT + 99 others); Thu, 8 Feb 2018 14:21:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:27533 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751544AbeBHTVF (ORCPT ); Thu, 8 Feb 2018 14:21:05 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 378B9356E3; Thu, 8 Feb 2018 19:21:05 +0000 (UTC) Received: from [192.168.1.100] (ovpn-116-96.phx2.redhat.com [10.3.116.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id 41B4B60BF1; Thu, 8 Feb 2018 19:21:02 +0000 (UTC) From: Dean Nelson To: Robert Richter , Sunil Goutham , David Miller Cc: netdev@vger.kernel.org, Vadim Lomovtsev , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Message-Id: <151811766130.10712.18293368656209944798.email-sent-by-dnelson@aqua> Subject: net: thunder: change q_len's type to handle max ring size X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 08 Feb 2018 19:21:05 +0000 (UTC) Date: Thu, 8 Feb 2018 14:21:05 -0500 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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;