Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp616807imu; Tue, 11 Dec 2018 04:58:16 -0800 (PST) X-Google-Smtp-Source: AFSGD/WGv8DaLlejN82eonUPXy59zdq112drxfVY5kr7PjHaokp3rTgPqNgoUWnNUsHIXuEGOeZ0 X-Received: by 2002:a62:81c1:: with SMTP id t184mr16688532pfd.40.1544533096215; Tue, 11 Dec 2018 04:58:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544533096; cv=none; d=google.com; s=arc-20160816; b=euvMJuqrIXYD0WEFh4DAKSBkZ7mgX1Vcy2vpRWVo443h/l9RJRrDzAmqNuBuhsGVi7 kNLDgrRWwq4uL2CxLNESzAwrLIuXRj9kfYNon8AbSmcN2uBevMwSQLT8X1N80EGO+X2z CriQ9dUA6wNzTY3BEbn1KQYIo0hZA2q/1ze2O86Jc73eE+wWYNWCSFxmpL8POUQdFhmz J/HzmCxZZe0QzzWaG2DcObL/QJltX7c5HfryAB3bWLXs0I5YRvJz2ghU2dvXpdHaKj+C HFchVGVvUN1QAKnooXq2mD7uSjIbb9GJzv+zraN1qbdNwd7oUcZUyrFWbPQg52xW0bce S04A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=B5OxVxVCV5CgTbspOHE6zw8Koc7T4ZCxbFbcoeMSHX0=; b=B7+h7E7YDQjtN8WOXzOgz0Sy+Vgm20faHuCcaDEBT147ouGnBMmkn1VVCP1fj3kZ9E tGwSGQyCh3CGlI293qhLRZZwlcxKLLmJvlgZ78jk/acxS73piDw/51gkYLBDQcPvIKVo dyw/g2DA/mDI+P5uisVvtiQJlXlGnstY9hiz0/llU5Ru8l3CHpvkYZiW76TZ8vobcWzB 17hs+Do7nx3+f6f2/KWxn0AjA44vYbW026i2x+PIdX4036PnZZzCwr9bF8P/86zIU487 kQmWNuMfYjU6RGXac2Od9W+HSBy2Cgs/nFzGBVi4F38zJf5xHaXrI54eMSOChTcqFlDx BhGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=kYZO8us5; 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 o124si13008475pfb.256.2018.12.11.04.57.51; Tue, 11 Dec 2018 04:58:16 -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=@semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=kYZO8us5; 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 S1726509AbeLKM5D (ORCPT + 99 others); Tue, 11 Dec 2018 07:57:03 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:44908 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726230AbeLKM5D (ORCPT ); Tue, 11 Dec 2018 07:57:03 -0500 Received: by mail-lf1-f67.google.com with SMTP id z13so10665433lfe.11 for ; Tue, 11 Dec 2018 04:57:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=B5OxVxVCV5CgTbspOHE6zw8Koc7T4ZCxbFbcoeMSHX0=; b=kYZO8us5Gx4VJmd5uQFfW6enIIeXVvyDTOxvIevbfhqal1l6vawCccOwwmgCWtp0De oOQUmmTk41oxs8YlYAnbv7FQL4m4ZbE456flWc70ElgqdYzY/SnFf80IcnM4wk3kgIQ1 YWDvBFRtzsqVLytytpsR7VSTQhHZbnI8ytbDmHd1RShTElZg3p3n4XAZsSey5fXXHApX 3s5RIGSeZ/XqZGYmOW3hlWYe23AX6F9xC3VeyfZuIeNFYcls8BhCq7O64iJ+5+gmhlqr 4RlIP/7Ct+ETgifO4dKFNCnMzGmBEdFtGQo4MiNajsiHzYxZMrZ4bZTNZNW1B9H1ejRi 9mUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=B5OxVxVCV5CgTbspOHE6zw8Koc7T4ZCxbFbcoeMSHX0=; b=UKKOOdg+8aa4IctBhOYqAAfHOKCq5O2dbDEk3hiIPNs9EtMsN1+JwFu8iSKBun9iRv ief+3GqDKQ5lm4yMZ9iBV36xArWTuD3qitQqJq2rE2SBVi4C3u+ikB2rRaW4z1k97WSR XwqSTj/eU0NAsNawGy3NHkXslZSybnZTi/GGftfOxCt/8jVAAqUwj+f0xaWuAynQaa9O dd4E6u2dK7FaTLAMeshfA7OmG6dU+aGa5Wezahvns+LOPz7PMHqp9IJTHKElBl9n9AUc tGys3A3XGHlR0QDjJyenemyKYkn7+nkHK+QMJMhoO0h1dN/WCwLXQAKZsfZfseIA9tYR 7pPQ== X-Gm-Message-State: AA+aEWYJNi5+/uI58/WYUItAh9X0fkLbM7qpe4+SYAl9jrpRKRc5gMVL kbpmkENtpQuXYNGvNrE7k2Sw6JthrVQ= X-Received: by 2002:a19:c014:: with SMTP id q20mr8698803lff.16.1544533020958; Tue, 11 Dec 2018 04:57:00 -0800 (PST) Received: from gilgamesh.semihalf.com (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id g4-v6sm2736636lji.17.2018.12.11.04.56.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Dec 2018 04:57:00 -0800 (PST) From: Marcin Wojtas To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org Cc: davem@davemloft.net, linux@armlinux.org.uk, maxime.chevallier@bootlin.com, thomas.petazzoni@bootlin.com, gregory.clement@bootlin.com, antoine.tenart@bootlin.com, stefanc@marvell.com, nadavh@marvell.com, jaz@semihalf.com, Marcin Wojtas Subject: [PATCH net] net: mvneta: fix operation for 64K PAGE_SIZE Date: Tue, 11 Dec 2018 13:56:49 +0100 Message-Id: <1544533009-12425-1-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Recent changes in the mvneta driver reworked allocation and handling of the ingress buffers to use entire pages. Apart from that in SW BM scenario the HW must be informed via PRXDQS about the biggest possible incoming buffer that can be propagated by RX descriptors. The BufferSize field was filled according to the MTU-dependent pkt_size value. Later change to PAGE_SIZE broke RX operation when usin 64K pages, as the field is simply too small. This patch conditionally limits the value passed to the BufferSize of the PRXDQS register, depending on the PAGE_SIZE used. On the occasion remove now unused frag_size field of the mvneta_port structure. Fixes: 562e2f467e71 ("net: mvneta: Improve the buffer allocation method for SWBM") Signed-off-by: Marcin Wojtas --- drivers/net/ethernet/marvell/mvneta.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index e5397c8..61b2349 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -408,7 +408,6 @@ struct mvneta_port { struct mvneta_pcpu_stats __percpu *stats; int pkt_size; - unsigned int frag_size; void __iomem *base; struct mvneta_rx_queue *rxqs; struct mvneta_tx_queue *txqs; @@ -2905,7 +2904,9 @@ static void mvneta_rxq_hw_init(struct mvneta_port *pp, if (!pp->bm_priv) { /* Set Offset */ mvneta_rxq_offset_set(pp, rxq, 0); - mvneta_rxq_buf_size_set(pp, rxq, pp->frag_size); + mvneta_rxq_buf_size_set(pp, rxq, PAGE_SIZE < SZ_64K ? + PAGE_SIZE : + MVNETA_RX_BUF_SIZE(pp->pkt_size)); mvneta_rxq_bm_disable(pp, rxq); mvneta_rxq_fill(pp, rxq, rxq->size); } else { @@ -3760,7 +3761,6 @@ static int mvneta_open(struct net_device *dev) int ret; pp->pkt_size = MVNETA_RX_PKT_SIZE(pp->dev->mtu); - pp->frag_size = PAGE_SIZE; ret = mvneta_setup_rxqs(pp); if (ret) -- 2.7.4