From nobody Sat Nov 23 21:31:08 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=1731435260; cv=none; d=zohomail.com; s=zohoarc; b=ccK3PUh7LfGN9klw06XPDAJ/BbzigBt2XamaFa1RLQav19jgP+nZmG0xpgQ16zIae4Yvb7A7RfISiBsx70o0oh61t2O+cpE5uHoCCsnloLm7ZxshlbLdzzkCdwSOA+CWgGog/x3h9AsprTc9ikun3eU7/6tDphq1LpIo42n+lc8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731435260; 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=gI2r50YagKyW5wjp5nKAHhdiWka7DOBUV8IxoWF7VBw=; b=RDTioqZug9T5l2IUhLYa3WiO/qdBMclW7wtlgc8XC9DbdumbuVQScc+rwGSg0nqgftZdMdmg2wRgQyPLdNPlwFbGaKXkvXn7pqAc8+5Ndc/q/L4Z7i8nbsmDZK+R3HLureXMqVSK2MbymT+FAC0UOPGtraODsqE7iVbRAdSUZg0= 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 1731435259888287.5384921440609; Tue, 12 Nov 2024 10:14:19 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAvND-0005uu-Ui; Tue, 12 Nov 2024 13:12:20 -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 1tAvMm-0005Iq-U1 for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:54 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAvMl-0001y5-Jj for qemu-devel@nongnu.org; Tue, 12 Nov 2024 13:11:52 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4314f38d274so75421105e9.1 for ; Tue, 12 Nov 2024 10:11:51 -0800 (PST) Received: from localhost.localdomain (cnf78-h01-176-184-27-250.dsl.sta.abo.bbox.fr. [176.184.27.250]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381eda0517csm15935048f8f.96.2024.11.12.10.11.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 10:11:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731435110; x=1732039910; 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=gI2r50YagKyW5wjp5nKAHhdiWka7DOBUV8IxoWF7VBw=; b=Q5FxZrwrzHcyZsvR2yYfhrNXbeVXyvPScvRu6n9M18XyWEcosFy+Q6REs1W4+0VglH Lu/qS1luLeN9BRD7xm7jaqkf+PDF1jrTU3cwN5vq5Nk5xU+S3hzww1rBJMT5uJ1M+sGl LMyoL0sT8ibwyapp9tg8lRy4aGJvwN5dgU0rL5ToAYLsWnUY/p8KV+RMqwwSHcjDMef7 IWk3/1ED/BaSCTyBbYOyYkODyXEMrEo8ukqaXkK4t/m/mjLSPlGWVKoWxnJzirqRNzQi ceOknAOr6UOWReD1y8fF8k5xFHufvIQaIxc7jzjJ/5wRUay+fel2twTDhXbrtFb58G02 YL+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731435110; x=1732039910; 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=gI2r50YagKyW5wjp5nKAHhdiWka7DOBUV8IxoWF7VBw=; b=GHmsQmhD5J2tgGYPuR4vjaxab+8NsXZhHX8oxgXanLgTN+k3diu1A0JIiWcK1xh8ct fcZIcs+ika0LD4T1lfPD/yV+x1F7KHKfOxsQGTfkKGHKdP+XT1y2ye1WOgPyabc3XISF /1qwifA3fbc3g9JpLlAnC2bnGdJH/KhAxSpDMznuJkPywZlJvCDbqJmCDGVFtvEyoSiA Hyw0fFQ2lbNnkXFGWkL3INAStW4/74ZeD6YORUpL2k8P39BNaY3+ycXv8+x5o/c0S2GC kTJB8FY8qNXJomGWu+8ncRKMXOVdXgUQZPcwCnnxfc8ExzyGmb2GQ6L7GHJxCZDaUedv FN7g== X-Gm-Message-State: AOJu0YxLfPwGNz35Bwb6PnNlvVIrUhtB5Ztf2KWLfEBSWaH8u0d10v9i gUTEAZV2dqNIFX+ivt4ajFZl0li0xLEN1Asp79gQhDpO3ZcaLz2Rf43rClG1+VWnxQIkn2qE/IW u X-Google-Smtp-Source: AGHT+IE2DEwwyKjYwPpSKfqMMUyKv2JpripMiiiLbqBcnHO0uOc/QmnUwfSLHMA/F+LMcwCvaB7I3w== X-Received: by 2002:a05:600c:5494:b0:426:59fe:ac27 with SMTP id 5b1f17b1804b1-432bbf6ba6emr171715275e9.26.1731435109702; Tue, 12 Nov 2024 10:11:49 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , Richard Henderson , Peter Maydell , Anton Johansson , Jason Wang , qemu-arm@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Thomas Huth , Alistair Francis , Paolo Bonzini , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 10/20] hw/net/xilinx_ethlite: Introduce rxbuf_ptr() helper Date: Tue, 12 Nov 2024 19:10:34 +0100 Message-ID: <20241112181044.92193-11-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241112181044.92193-1-philmd@linaro.org> References: <20241112181044.92193-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::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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: 1731435261567116600 rxbuf_ptr() points to the beginning of a (RAM) RX buffer within the device state. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- hw/net/xilinx_ethlite.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index d4882f43f7..fdbf25fd91 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -99,6 +99,13 @@ static void *txbuf_ptr(XlnxXpsEthLite *s, unsigned port_= index) return &s->regs[rxbase + R_TX_BUF0]; } =20 +static void *rxbuf_ptr(XlnxXpsEthLite *s, unsigned port_index) +{ + unsigned int rxbase =3D port_index * (0x800 / 4); + + return &s->regs[rxbase + R_RX_BUF0]; +} + static uint64_t eth_read(void *opaque, hwaddr addr, unsigned int size) { @@ -220,7 +227,7 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t= *buf, size_t size) trace_ethlite_pkt_size_too_big(size); return -1; } - memcpy(&s->regs[rxbase + R_RX_BUF0], buf, size); + memcpy(rxbuf_ptr(s, port_index), buf, size); =20 s->regs[rxbase + R_RX_CTRL0] |=3D CTRL_S; if (s->regs[R_RX_CTRL0] & CTRL_I) { --=20 2.45.2