Received: by 10.223.176.5 with SMTP id f5csp2354287wra; Thu, 8 Feb 2018 12:36:40 -0800 (PST) X-Google-Smtp-Source: AH8x224Ra7yeJmlyodDr0lKIMazHJN495ZNBU6YZ4KAXGkXAM3G66S5ur/JM1NGAgiYwRtmZBql9 X-Received: by 10.98.163.15 with SMTP id s15mr292161pfe.67.1518122200076; Thu, 08 Feb 2018 12:36:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518122200; cv=none; d=google.com; s=arc-20160816; b=ZwlZOZSFTdppHdDe2ISo5P8ngkLfrmjmp03/1CpXIN0fqrgu4AY+sJp4Yj1l5IisRK r05CoUdVZOixBnzswqfmf3gVCBRoIGdzwfre/SMKds1GYzDFOnFYiaWAZ/vC6i5m0GAs ie2U3LSxZv+5AKtkFUapN0BGjOlmUnvvfuY7RdCJA6Ad8LAbrGGsxakq2Kz8itibNbwF lmfRYg9vWMbxhd+TtQazwrtThKco1eWKWg/EThKprwy8F/3TCXKiUNdtWwGdmS6iuaAs nq95cyDhHAW6c4klZvvOy6D03eaRnVa/x/YhGunePsivTwlgEHpfbIN6l5WKcVCoOsMX ujkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date :arc-authentication-results; bh=UQ+r942JqaTxLuT6+DIGwb7awYGjR+MmGO3IKghqvyo=; b=p1GkXHp+RROoq+pWkeyiBJguLJp2AOQ2LkjcVUiW8/UIhTGbHsWnqlZaKyTEdGWoiZ KgEM5sVlG/I63nCrEPQyqUabC8O1R3GMLmu8B5JILv3EYPrr1jKVZEKaFCEDjrOJgztx fAXaaBj01/luMEifjt7imqrZwk196HlhBLNdCdYR6xfM8G3olvBFyEEouUaHvJ2URcVW TIJ5/w5fs/nHsfuVY0/z7g8367QGHMb78PEJMisDG8Xfp3OSGS51Ck0LxDtUzD76sz7h +MDR875mmtSZdoHp3rrWPdL05PmbTs1qe9hl24bRDUQa9XDSc4azVw6/2b2/5Wyfr3wX aLnQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m24si474573pfj.265.2018.02.08.12.36.24; Thu, 08 Feb 2018 12:36:40 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752318AbeBHUe4 (ORCPT + 99 others); Thu, 8 Feb 2018 15:34:56 -0500 Received: from shards.monkeyblade.net ([184.105.139.130]:49234 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751094AbeBHUez (ORCPT ); Thu, 8 Feb 2018 15:34:55 -0500 Received: from localhost (67.110.78.66.ptr.us.xo.net [67.110.78.66]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 9F8D111D69852; Thu, 8 Feb 2018 12:34:54 -0800 (PST) Date: Thu, 08 Feb 2018 15:34:53 -0500 (EST) Message-Id: <20180208.153453.774785043965984772.davem@davemloft.net> To: dnelson@redhat.com Cc: rric@kernel.org, sgoutham@cavium.com, netdev@vger.kernel.org, Vadim.Lomovtsev@cavium.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: net: thunder: change q_len's type to handle max ring size From: David Miller In-Reply-To: <151811766130.10712.18293368656209944798.email-sent-by-dnelson@aqua> References: <151811766130.10712.18293368656209944798.email-sent-by-dnelson@aqua> X-Mailer: Mew version 6.7 on Emacs 25.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 08 Feb 2018 12:34:55 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dean Nelson Date: > 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 Applied, thanks. Another way to solve this could have been to encode that length as "length - 1"