From nobody Sat Nov 23 19:03:51 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731618117; cv=none; d=zohomail.com; s=zohoarc; b=mJY7eewMMoO9e1Ty9gdoB824TDjfEgfkReV+bXaM6wZubNF6aDNRGHDfhKBgzCLSZiEYerCmGc5RpNdwhLuRvc5sFYfTtwHjpPuN9Msi4Sw8ksDwZQbLGhLn+Y8CY3IE9LSmu0WaCDoWDubiAThUaTozTIrwWyRLs3RsOd0KYxE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731618117; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wG+1NC98eSptDZUHUCzND7zjX1Tqst1VgWsS8j/5siQ=; b=PopByHi1q6ITTyHi2ETOzkBl4Xbv/mnDlcrBC47GYXiVjVo015I6YcOTCBBKR0274YaxHKd0av4T4i2Ntl4m114z0SYpns6bprYAOLJNT5T8gqjos0fq/Osx9LcYloWSKuVfdds2PDdx8e3BWLw1Z7Xt+en1EkPd3+BOznbyTZs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731618117503615.0524410735753; Thu, 14 Nov 2024 13:01:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBgxv-0000ZU-7w; Thu, 14 Nov 2024 16:01:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tBgxZ-0000Nn-8C for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:01:01 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBgxX-0007zZ-IJ for qemu-devel@nongnu.org; Thu, 14 Nov 2024 16:01:00 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-37d447de11dso18963f8f.1 for ; Thu, 14 Nov 2024 13:00:58 -0800 (PST) Received: from localhost.localdomain ([176.187.209.228]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821adbbca7sm2492439f8f.47.2024.11.14.13.00.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Nov 2024 13:00:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731618054; x=1732222854; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wG+1NC98eSptDZUHUCzND7zjX1Tqst1VgWsS8j/5siQ=; b=PLHF8DTFh4adtJPQ+/g9H9pbrTPsO8PfRFaNY6YPGJMBGyVsFqplpj5TfPGC9pFS7S CsR1SJERx0U33ypYV7nAgco0w2rlUCUJTkiIMGjhp08Yf3oePBBZp2lc3Nj7k+JDGgCH jkTtZ3CI7BFThD4kyF/H/dhxBw0jzsORCcP7xDHJUKt2630PTD14jq7zTB9eMY/3RxbF /l7FjwLpvQjsbd9qJ7pBSIALS7UWmC3SRnrqYjAr11QKgrKR3jaidxJy73QiK8S4AR8U y0lnbfp4sAQMvdsgtsgnq5zYxBeK/3rVP4H1lWRm9tsOVISIwNiBC7ehCPtc2BnaDl0N YYIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731618054; x=1732222854; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wG+1NC98eSptDZUHUCzND7zjX1Tqst1VgWsS8j/5siQ=; b=w0XnlEeIQN2FLAoTVCaDFf67TjfAVhXdvYioNaDc2asmycfNqwWhtkIMnkx2Pb3v5v IV59MRZ0s2CjzoRZyDHIp2Kq7rLesHX8m2Uqg8muT6yb8OWeykiLh14Q6khaYtDQCHsZ l8yUDmAnf4XPtc3GJkMIyNMdoo2inFYEsJaDUHXv7zbUvjhH0Ryhq3X2nW9ZoJLjaVvh XiFkoep4jYWys8L5VInS1O+neMWcm3iNTb3f7K7ARxyIlbcp7DQG+C1EySYaYgZC6LeS 3oeLBtID8Ngc+JkBVU6GrNfb0qGNHmAqjeChBJ1L58ZxSiiXj8OSENBwxBcqHxAiJx1D 0qrw== X-Gm-Message-State: AOJu0YwoSDYx4OCdTBbajn+x1TtFmzexdf/Mx1TpaRzA8ZmawtkrPmEs vPtwNzL7KbRuHZ8dOQWlgQvJZnrqlTSx7Y5eGU00say+c7NufvHg/NmYNMCanSyhL8C5db8iRsQ E X-Google-Smtp-Source: AGHT+IGqSaGX9Gi7Y8t8eoIxlOllx0jqc/rAVgGASv43On4vQnTlMvmlMrnZwp+rKE7Wkboo5wRKFA== X-Received: by 2002:a5d:6d01:0:b0:37d:4d80:34ae with SMTP id ffacd0b85a97d-38225901fe2mr147742f8f.4.1731618053653; Thu, 14 Nov 2024 13:00:53 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , qemu-arm@nongnu.org, Richard Henderson , Thomas Huth , Anton Johansson , Bernhard Beschow , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Peter Maydell , Jason Wang , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Edgar E . Iglesias" Subject: [PATCH RESEND v2 05/19] hw/net/xilinx_ethlite: Correct maximum RX buffer size Date: Thu, 14 Nov 2024 21:59:56 +0100 Message-ID: <20241114210010.34502-6-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114210010.34502-1-philmd@linaro.org> References: <20241114210010.34502-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731618119319116600 The current max RX bufsize is set to 0x800. This is invalid, since it contains the MMIO registers region. Add the correct definition (valid for both TX & RX, see datasheet p. 20, Table 11 "XPS Ethernet Lite MAC Memory Map") and use it. Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/net/xilinx_ethlite.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 0f59811c78..0df962cd22 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -3,6 +3,9 @@ * * Copyright (c) 2009 Edgar E. Iglesias. * + * DS580: https://docs.amd.com/v/u/en-US/xps_ethernetlite + * LogiCORE IP XPS Ethernet Lite Media Access Controller + * * Permission is hereby granted, free of charge, to any person obtaining a= copy * of this software and associated documentation files (the "Software"), t= o deal * in the Software without restriction, including without limitation the r= ights @@ -33,6 +36,7 @@ #include "trace.h" =20 #define R_TX_BUF0 0 +#define BUFSZ_MAX 0x07e4 #define R_TX_LEN0 (0x07f4 / 4) #define R_TX_GIE0 (0x07f8 / 4) #define R_TX_CTRL0 (0x07fc / 4) @@ -195,7 +199,7 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t= *buf, size_t size) return -1; } =20 - if (size > (R_MAX - R_RX_BUF0 - rxbase) * 4) { + if (size >=3D BUFSZ_MAX) { trace_ethlite_pkt_size_too_big(size); return -1; } --=20 2.45.2