linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Thor Thayer <thor.thayer@linux.intel.com>,
	"David S . Miller" <davem@davemloft.net>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 4.19 64/73] net: stmmac: Fix RX packet size > 8191
Date: Wed, 14 Nov 2018 17:21:58 -0500	[thread overview]
Message-ID: <20181114222207.98701-64-sashal@kernel.org> (raw)
In-Reply-To: <20181114222207.98701-1-sashal@kernel.org>

From: Thor Thayer <thor.thayer@linux.intel.com>

[ Upstream commit 8137b6ef0ce469154e5cf19f8e7fe04d9a72ac5e ]

Ping problems with packets > 8191 as shown:

PING 192.168.1.99 (192.168.1.99) 8150(8178) bytes of data.
8158 bytes from 192.168.1.99: icmp_seq=1 ttl=64 time=0.669 ms
wrong data byte 8144 should be 0xd0 but was 0x0
16    10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
      20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
%< ---------------snip--------------------------------------
8112  b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf
      c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf
8144  0 0 0 0 d0 d1
      ^^^^^^^
Notice the 4 bytes of 0 before the expected byte of d0.

Databook notes that the RX buffer must be a multiple of 4/8/16
bytes [1].

Update the DMA Buffer size define to 8188 instead of 8192. Remove
the -1 from the RX buffer size allocations and use the new
DMA Buffer size directly.

[1] Synopsys DesignWare Cores Ethernet MAC Universal v3.70a
    [section 8.4.2 - Table 8-24]

Tested on SoCFPGA Stratix10 with ping sweep from 100 to 8300 byte packets.

Fixes: 286a83721720 ("stmmac: add CHAINED descriptor mode support (V4)")
Suggested-by: Jose Abreu <jose.abreu@synopsys.com>
Signed-off-by: Thor Thayer <thor.thayer@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/stmicro/stmmac/common.h    | 3 ++-
 drivers/net/ethernet/stmicro/stmmac/descs_com.h | 2 +-
 drivers/net/ethernet/stmicro/stmmac/enh_desc.c  | 2 +-
 drivers/net/ethernet/stmicro/stmmac/ring_mode.c | 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index b1b305f8f414..272b9ca66314 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -365,7 +365,8 @@ struct dma_features {
 
 /* GMAC TX FIFO is 8K, Rx FIFO is 16K */
 #define BUF_SIZE_16KiB 16384
-#define BUF_SIZE_8KiB 8192
+/* RX Buffer size must be < 8191 and multiple of 4/8/16 bytes */
+#define BUF_SIZE_8KiB 8188
 #define BUF_SIZE_4KiB 4096
 #define BUF_SIZE_2KiB 2048
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/descs_com.h b/drivers/net/ethernet/stmicro/stmmac/descs_com.h
index ca9d7e48034c..40d6356a7e73 100644
--- a/drivers/net/ethernet/stmicro/stmmac/descs_com.h
+++ b/drivers/net/ethernet/stmicro/stmmac/descs_com.h
@@ -31,7 +31,7 @@
 /* Enhanced descriptors */
 static inline void ehn_desc_rx_set_on_ring(struct dma_desc *p, int end)
 {
-	p->des1 |= cpu_to_le32(((BUF_SIZE_8KiB - 1)
+	p->des1 |= cpu_to_le32((BUF_SIZE_8KiB
 			<< ERDES1_BUFFER2_SIZE_SHIFT)
 		   & ERDES1_BUFFER2_SIZE_MASK);
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
index 77914c89d749..5ef91a790f9d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
@@ -262,7 +262,7 @@ static void enh_desc_init_rx_desc(struct dma_desc *p, int disable_rx_ic,
 				  int mode, int end)
 {
 	p->des0 |= cpu_to_le32(RDES0_OWN);
-	p->des1 |= cpu_to_le32((BUF_SIZE_8KiB - 1) & ERDES1_BUFFER1_SIZE_MASK);
+	p->des1 |= cpu_to_le32(BUF_SIZE_8KiB & ERDES1_BUFFER1_SIZE_MASK);
 
 	if (mode == STMMAC_CHAIN_MODE)
 		ehn_desc_rx_set_on_chain(p);
diff --git a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
index a7ffc73fffe8..bc83ced94e1b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
+++ b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
@@ -140,7 +140,7 @@ static void clean_desc3(void *priv_ptr, struct dma_desc *p)
 static int set_16kib_bfsize(int mtu)
 {
 	int ret = 0;
-	if (unlikely(mtu >= BUF_SIZE_8KiB))
+	if (unlikely(mtu > BUF_SIZE_8KiB))
 		ret = BUF_SIZE_16KiB;
 	return ret;
 }
-- 
2.17.1


  parent reply	other threads:[~2018-11-14 22:23 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-14 22:20 [PATCH AUTOSEL 4.19 01/73] serial: sh-sci: Fix receive on SCIFA/SCIFB variants with DMA Sasha Levin
2018-11-14 22:20 ` [PATCH AUTOSEL 4.19 02/73] netfilter: ipv6: fix oops when defragmenting locally generated fragments Sasha Levin
2018-11-14 22:20 ` [PATCH AUTOSEL 4.19 03/73] netfilter: bridge: define INT_MIN & INT_MAX in userspace Sasha Levin
2018-11-14 22:20 ` [PATCH AUTOSEL 4.19 04/73] s390/decompressor: add missing FORCE to build targets Sasha Levin
2018-11-14 22:20 ` [PATCH AUTOSEL 4.19 05/73] s390/vdso: " Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 06/73] HID: i2c-hid: Add a small delay after sleep command for Raydium touchpanel Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 07/73] Revert "HID: add NOGET quirk for Eaton Ellipse MAX UPS" Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 08/73] HID: alps: allow incoming reports when only the trackstick is opened Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 09/73] Revert "netfilter: nft_numgen: add map lookups for numgen random operations" Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 10/73] netfilter: ipset: list:set: Decrease refcount synchronously on deletion and replace Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 11/73] netfilter: ipset: actually allow allowable CIDR 0 in hash:net,port,net Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 12/73] netfilter: ipset: fix ip_set_list allocation failure Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 13/73] s390/mm: fix mis-accounting of pgtable_bytes Sasha Levin
2018-11-30 15:11   ` Martin Schwidefsky
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 14/73] s390/mm: Fix ERROR: "__node_distance" undefined! Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 15/73] bpf: fix bpf_prog_get_info_by_fd to return 0 func_lens for unpriv Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 16/73] usbnet: smsc95xx: disable carrier check while suspending Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 17/73] net: dsa: microchip: initialize mutex before use Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 18/73] net: bcmgenet: protect stop from timeout Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 19/73] net: systemport: Protect " Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 20/73] netfilter: ipset: Correct rcu_dereference() call in ip_set_put_comment() Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 21/73] netfilter: xt_IDLETIMER: add sysfs filename checking routine Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 22/73] netfilter: ipset: Fix calling ip_set() macro at dumping Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 23/73] netfilter: nft_compat: ebtables 'nat' table is normal chain type Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 24/73] s390/qeth: fix HiperSockets sniffer Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 25/73] s390/qeth: unregister netdevice only when registered Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 26/73] net: hns3: Fix for out-of-bounds access when setting pfc back pressure Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 27/73] mlxsw: spectrum: Fix IP2ME CPU policer configuration Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 28/73] hwmon: (ibmpowernv) Remove bogus __init annotations Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 29/73] net: phy: realtek: fix RTL8201F sysfs name Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 30/73] ARM: dts: imx6sll: fix typo for fsl,imx6sll-i2c node Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 31/73] ARM: dts: fsl: Fix improperly quoted stdout-path values Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 32/73] ARM: dts: imx6sx-sdb: Fix enet phy regulator Sasha Levin
2018-11-15 10:39   ` Leonard Crestez
2018-11-22 19:34     ` Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 33/73] Revert "drm/exynos/decon5433: implement frame counter" Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 34/73] arm64: dts: renesas: r8a7795: add missing dma-names on hscif2 Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 35/73] arm64: dts: renesas: condor: switch from EtherAVB to GEther Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 36/73] xen/grant-table: Fix incorrect gnttab_dma_free_pages() pr_debug message Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 37/73] clk: fixed-factor: fix of_node_get-put imbalance Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 38/73] mtd: nand: Fix nanddev_pos_next_page() kernel-doc header Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 39/73] lib/raid6: Fix arm64 test build Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 40/73] drm/amd/display: Stop leaking planes Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 41/73] block: Clear kernel memory before copying to user Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 42/73] drm/amd/display: Drop reusing drm connector for MST Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 43/73] drm/amd/amdgpu/dm: Fix dm_dp_create_fake_mst_encoder() Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 44/73] s390/perf: Change CPUM_CF return code in event init function Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 45/73] ceph: quota: fix null pointer dereference in quota check Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 46/73] clk: meson-gxbb: set fclk_div3 as CLK_IS_CRITICAL Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 47/73] clk: meson: axg: mark fdiv2 and fdiv3 as critical Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 48/73] of/device: Really only set bus DMA mask when appropriate Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 49/73] nvme: make sure ns head inherits underlying device limits Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 50/73] i2c: omap: Enable for ARCH_K3 Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 51/73] i2c: qcom-geni: Fix runtime PM mismatch with child devices Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 52/73] sched/core: Take the hotplug lock in sched_init_smp() Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 53/73] perf tools: Fix undefined symbol scnprintf in libperf-jvmti.so Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 54/73] perf tools: Do not zero sample_id_all for group members Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 55/73] ice: Fix dead device link issue with flow control Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 56/73] ice: Fix the bytecount sent to netdev_tx_sent_queue Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 57/73] ice: Change req_speeds to be u16 Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 58/73] i40e: restore NETIF_F_GSO_IPXIP[46] to netdev features Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 59/73] ibmvnic: fix accelerated VLAN handling Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 60/73] qed: Fix memory/entry leak in qed_init_sp_request() Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 61/73] qed: Fix blocking/unlimited SPQ entries leak Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 62/73] qed: Fix SPQ entries not returned to pool in error flows Sasha Levin
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 63/73] qed: Fix potential memory corruption Sasha Levin
2018-11-14 22:21 ` Sasha Levin [this message]
2018-11-14 22:21 ` [PATCH AUTOSEL 4.19 65/73] net: smsc95xx: Fix MTU range Sasha Levin
2018-11-14 22:22 ` [PATCH AUTOSEL 4.19 66/73] ext4: missing !bh check in ext4_xattr_inode_write() Sasha Levin
2018-11-14 22:22 ` [PATCH AUTOSEL 4.19 67/73] net: aquantia: fix potential IOMMU fault after driver unbind Sasha Levin
2018-11-14 22:22 ` [PATCH AUTOSEL 4.19 68/73] net: aquantia: fixed enable unicast on 32 macvlan Sasha Levin
2018-11-14 22:22 ` [PATCH AUTOSEL 4.19 69/73] net: aquantia: invalid checksumm offload implementation Sasha Levin
2018-11-14 22:22 ` [PATCH AUTOSEL 4.19 70/73] net: qualcomm: rmnet: Fix incorrect assignment of real_dev Sasha Levin
2018-11-14 22:22 ` [PATCH AUTOSEL 4.19 71/73] kbuild: deb-pkg: fix too low build version number Sasha Levin
2018-11-14 22:22 ` [PATCH AUTOSEL 4.19 72/73] Revert "scripts/setlocalversion: git: Make -dirty check more robust" Sasha Levin
2018-11-14 22:22 ` [PATCH AUTOSEL 4.19 73/73] net: dsa: mv88e6xxx: Fix clearing of stats counters Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181114222207.98701-64-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=thor.thayer@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).