Received: by 10.223.176.5 with SMTP id f5csp2424512wra; Thu, 8 Feb 2018 13:58:38 -0800 (PST) X-Google-Smtp-Source: AH8x226Ztiwg9MWPISr6pjjgjsGOs98mq1TGfuYYj6KmU4zXOqWLPv+XuDLVhb4iE5fdfK+2isl6 X-Received: by 2002:a17:902:8349:: with SMTP id z9-v6mr439817pln.164.1518127117896; Thu, 08 Feb 2018 13:58:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518127117; cv=none; d=google.com; s=arc-20160816; b=zfaeTjhgHCYk4BOv0oQnL8HUo2kghZP47iwDDLnmK4zBRaFiyfjf9Bx3XXqfSEMmsk h2PzGDapTzBl7CdChADpCfjG6BgmiL01KN6GnWzW5Ebve1LIeBZR35oVCO1iHba80jah H4G3tYYJ06SgqMI/dwmYFPkcAOlafiObDveEoRxkllK01yR/ZWmKKtYIXgE7Hy8yceG8 nEodH7UhPhJ7pJMpphnL2xdaLPUjNS0qkM76MBhsrh7BR5+n6AD5wBmPxaZn4SteEM4D mThSfD1jt11uorrPyQvw5yjIozVi/xNlTm2sid+VKFmpQgHC0IoD8wlufzdb6KDsl27+ LoyQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=WSSQHCcYMxWFGaa/68eWhfyc38GHKGkomOVE//uKW54=; b=cEyyFbbk8eSQSPBkeVADDJcgJcW6nOuy9IjiWKwcO/1R8oQIrVTDKM9byTX3O9D9wh j3LFM7zN4UobJFNo49nOAAbSgrROmGNoe+dIiGimqY7WSqQwJVPDZtq97FtQ8wRYu1lA IsCrHc0VXStsqFqerDheO+I8PkfuxHnr1LKL0H2ficdEocGWsic5Fuw0wEa1EdWm5dRX FgqyKbVWj/Aoi1sbwy4620ztRY/DPfp8g9uHxAcz2456rE/yNGlkjfd3XNYGoXFbdKbw 47oeFLIc/1ol0Srot4i+h0+FSKJ1iQCXYkb2ZEVxssbAKlApTnvvZc156GtiqVwNOIrh KIIA== 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 k78si596410pfk.95.2018.02.08.13.58.14; Thu, 08 Feb 2018 13:58:37 -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 S1752494AbeBHV5Y (ORCPT + 99 others); Thu, 8 Feb 2018 16:57:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37864 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752185AbeBHV5X (ORCPT ); Thu, 8 Feb 2018 16:57:23 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF950C0568E2; Thu, 8 Feb 2018 21:57:22 +0000 (UTC) Received: from [10.3.116.96] (ovpn-116-96.phx2.redhat.com [10.3.116.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2466F5C1AB; Thu, 8 Feb 2018 21:57:22 +0000 (UTC) Subject: Re: net: thunder: change q_len's type to handle max ring size To: David Miller 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 References: <151811766130.10712.18293368656209944798.email-sent-by-dnelson@aqua> <20180208.153453.774785043965984772.davem@davemloft.net> From: Dean Nelson Message-ID: <41824374-cdea-a3ef-0109-20565dbba43e@redhat.com> Date: Thu, 8 Feb 2018 15:57:21 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180208.153453.774785043965984772.davem@davemloft.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 08 Feb 2018 21:57:23 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/08/2018 02:34 PM, David Miller wrote: > 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. Thank you! > > Another way to solve this could have been to encode that length > as "length - 1" True. I had pondered that, but felt that since changing q_len's type didn't add any length to the structure and that it was less impactful from a number-of-lines of code changed perspective, I'd opt for this route. Cavium, if you'd prefer this goes the route that Dave just mentioned, please let me know and I can make a new patch against what's been applied? Thanks, Dean