Received: by 10.223.176.5 with SMTP id f5csp228506wra; Thu, 8 Feb 2018 20:30:57 -0800 (PST) X-Google-Smtp-Source: AH8x227j1Zb5/+Za+W7zpMf0AyQaDvx2vO7E20jQFgyAYksp0KaFAyIe06DqfHr5lzfPnxdE8gVR X-Received: by 10.98.201.89 with SMTP id k86mr1456823pfg.105.1518150657439; Thu, 08 Feb 2018 20:30:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518150657; cv=none; d=google.com; s=arc-20160816; b=gxYPbiUlgd919V0Mhlkg3zsw1lGsMXZmtuRCgq6dfZc/n1/Qhr5YOzQwgMwOuF/Nax 7d4puc3vtzzdhk4O9Vd40FpeLnYFFwE4aFrtq6eMLK4ngCICs0ozp5gguUC62YclG/LC ugoBMTTtGIHy2HWQ+fJtpg937aZ2ej08jVhz8AkfxWQPzUwnzRqvlfXPyVWPIjjIDFFH oZglDyD0mjmXBl1RL2q7995O/F13cdLZNQKWsGtVuYufFDnjfE0twCkf896j/5ZNG1QT fy+3ZeIrb7Rrfn1csDzRsfE+XUza+Ta4R2zFuoKTMg8Xw8mhUvI1TqbexeteuDR0tQu+ TjHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=M1QYVGCvj/XTTIxpbvaiX5pTB1SowuVcvmx8jZvQuQo=; b=mFXAtHxAekVUz9GI1u8YtuxQ7RlUXklfnOzpbvgQiyaRPUfRgkxTXtgKO1vvVORo3T kttNyJEC97Wn7PT1qA/WxKcvS7WAlh8LpSHzrYWm2Wbb/q4nryW0X2vK9IPdTOafxtOe 73LXAGGI4sCz8z1iAN7ab6hb+Ejf6VPM7EGMrOV6y48Pp4Pr+LzlxliRe9Xlq+vlNhQi EHNxMSC5Ushm9vPbx6OcwLsW+b7kkP7nn2KuKVL1znzKgegZzYJ2AVQ4OGrsiJSzMVfk m4lE3ZsvYZOfLTtgk7TXP+zIGObzU6itV1ThJw3uuU4akp28/qOl1i1p8CIJOOG71QQq hR7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oC99HrsR; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ay8-v6si992344plb.614.2018.02.08.20.30.42; Thu, 08 Feb 2018 20:30:57 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oC99HrsR; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752541AbeBIE34 (ORCPT + 99 others); Thu, 8 Feb 2018 23:29:56 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:35076 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752154AbeBIE3y (ORCPT ); Thu, 8 Feb 2018 23:29:54 -0500 Received: by mail-wr0-f196.google.com with SMTP id w50so6905337wrc.2; Thu, 08 Feb 2018 20:29:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=M1QYVGCvj/XTTIxpbvaiX5pTB1SowuVcvmx8jZvQuQo=; b=oC99HrsR6MI9bK89bleiPEP6dXIRuVXLA1grDiXQmF0obqKjfU3WmHJ1EKssGUlJJR mRSSElpaCfOf17xgCmEHeYB2iMXgWR0v+E4sWB/WTFh3vCxyV0IAU8xv4ZWa1J/7mVsS AJgJQw8CpFAnWG6vQwC/Wjl0LmxgmICVdPc8/LF60Ipt2gELqqnlGrLLbGXtBQkOBa1W TICR37T+zBzEnMmMPnc8loz3VqiI71ny5pys+jG/noBke+uNDRPXEgcsVbBEzcaUGZNx lz7Y+knPh9IpIJeRbeHtjsJSpBrDPCtIva+Znt+gXx0pj+XaPT2vF3CubVa1K75RiRq6 yt3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=M1QYVGCvj/XTTIxpbvaiX5pTB1SowuVcvmx8jZvQuQo=; b=JdQXR1N76QJkh+LStjF/JlFRQqPrV16AELNB6KITPR8rSWSL84CU1oEZ0SPmqIYjxF WEfcWOUEOhi5fPHComOw9UL+4O+XdN7MSzupa87TJJuDiyptuv/mdEVvc/XNJ7jgnjFH x/s1olpCpxUbjQwhc6sbzv42E93/okI6YzEyvDXaiWPdk2z0Z4n15RRddZ5rwt8gvXJF wg+IXCzGSGSG//VMcgv03+ShSdvJKuW9uCeaSMGh/K75AlqRnHS2S3NHPOuQNVFqwSuT 7z8MPdqjI8UEIgw5a8p6Oi1Qc8585ObyHMeu1WED9YJMHg9ut+CACjXchZTLHJnnLb58 hdGA== X-Gm-Message-State: APf1xPCy8ZiwFLx97DMKKEDdmLtI6nVW7u2CVgqkTeoTVcQGJor7wVb/ b9mEacU0cvbnAkrjJ0BrZJ373OC1XND+9u4UEEs= X-Received: by 10.223.188.2 with SMTP id s2mr342903wrg.29.1518150593192; Thu, 08 Feb 2018 20:29:53 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.153.143 with HTTP; Thu, 8 Feb 2018 20:29:52 -0800 (PST) In-Reply-To: <41824374-cdea-a3ef-0109-20565dbba43e@redhat.com> References: <151811766130.10712.18293368656209944798.email-sent-by-dnelson@aqua> <20180208.153453.774785043965984772.davem@davemloft.net> <41824374-cdea-a3ef-0109-20565dbba43e@redhat.com> From: Sunil Kovvuri Date: Fri, 9 Feb 2018 09:59:52 +0530 Message-ID: Subject: Re: net: thunder: change q_len's type to handle max ring size To: Dean Nelson Cc: David Miller , Vadim.Lomovtsev@cavium.com, Robert Richter , Linux Netdev List , LKML , Sunil Goutham , LAKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 9, 2018 at 3:27 AM, Dean Nelson wrote: > 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 for fixing this and i think the current patch is fine. Thanks, Sunil. > > Thanks, > Dean > > > > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel