From nobody Sat May 18 03:28:25 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=1712669943; cv=none; d=zohomail.com; s=zohoarc; b=K30b+UUxjSOoB7gsaZk87W3go0paN5Tr5z0BVJ+hwXWVmOam0/Z9gofjpK8A1iu3V/DvK6dNo23/XsHV3quWThd2ldmYckmhFlPYPokUBhSkKQCvdJyYo2ISABCO74FNnmLwvoaCXxIV7V/Usfu/jTOP+hhet2/bLXa1UYnFDMM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712669943; 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=EZB+SBD3c6Tl2ilo7C5/8FmcEWLXBUIeUjZwCbvwe1A=; b=Nwjf9HtuPWsrAv0Idh1YV5WhDsLT7EiJAlMc0yMDwAjY5BxRND9TT4qz4+DufzQORXfd1fl7VlHj7jTeWJWJq4Q3Bql9P3b3D0GKQcPveDPeD2utYxMVdMhoKLIa0dJZNqzhsZtiLGaO+pub28xPlLCtZL9Bj6h3i6IxMJUQqNQ= 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 1712669943857332.4502608108812; Tue, 9 Apr 2024 06:39:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruBfx-0005nn-M7; Tue, 09 Apr 2024 09:38:13 -0400 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 1ruBfw-0005nT-M4 for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:38:12 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruBfv-0008B9-0Q for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:38:12 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-41550858cabso38549225e9.2 for ; Tue, 09 Apr 2024 06:38:10 -0700 (PDT) Received: from m1x-phil.lan ([176.176.160.134]) by smtp.gmail.com with ESMTPSA id s11-20020a05600c45cb00b004162d06768bsm18084976wmo.21.2024.04.09.06.38.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 09 Apr 2024 06:38:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712669889; x=1713274689; 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=EZB+SBD3c6Tl2ilo7C5/8FmcEWLXBUIeUjZwCbvwe1A=; b=RRetPFKy65vGiYnCsjFXIO0bxwFMbkXL39j00xg/mLDey/hfLYhelWEMfz9Efvacib yFuzEi3btgzt7kbQoVKkL2yMs4hp5/4hrmezaEW2RmG7l2/4WfGX1y1/SJmKFvHEVCkD xl82goS4h+Cb6Fso9HdjXxa8ZX5IrX5qjX3LivBzSOIL3jhfvDeiiJPuSfVbk2G/TEnt oZTIbSXiJ2WTU0LVBv9CCt+pEHiQH1sKzV5qnJQp3YxfG1NZh86HK0fhpcA0mc8cBaQe /gDg42BW4ZzUCp6lCtghtEDPtghqYnLaFDtZ4C/lWrAC055erQmgKJQpbb/HMONys0VR lLEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712669889; x=1713274689; 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=EZB+SBD3c6Tl2ilo7C5/8FmcEWLXBUIeUjZwCbvwe1A=; b=nkmQQaXIuyJ7HD1NevmsfyYtff/Od7nFEbQLvxyDHHaB1+4JZ+o5NRB69S+NKLfwS/ x1Gd44vQQRiRtJ7YxJfBUCNhJLnVGG7R9Ik8wceCbysEV7+/AlsQHs4v7xjHBNsIkwUD oVLdudhbhCEKAWWiGGKs/EonMMfRKM4nnhVkV0WHHXvsL3aobfsBaa7+F7alCPkzsK1W Y7TAWWdL6XRju3vS0bSqwNIPIH6FeF4E6PUoKPJ0ipH0maCoj3jP7xhpL8ZRQKDZtH+L oJXDFJU+LGSQMrdIjwOGr3S+Ldmex32TdzOD19m/59ASxywrEY9zgvzBxrb2SDw6AKC+ dQ2g== X-Gm-Message-State: AOJu0YxzhnmRaQXKFyjprREHm75AGIeguwA+ZZwke4cKNvqbF5NFtOuy 4w/b9cq9cA45bB8b4yGTVf6F4IO6ElZNS0Cx+jPCT31fgZFER49Qc1HIyDJGP6o1lRoYHEc1Rmh m X-Google-Smtp-Source: AGHT+IEld16FAPlTMK+v5IReyddCsHOplEcnkGaWwU0kLlZ/pgWOjcNT/RB07WvpZjCkx2CAUAyGNg== X-Received: by 2002:a05:600c:1913:b0:416:2471:e102 with SMTP id j19-20020a05600c191300b004162471e102mr9168921wmq.37.1712669889014; Tue, 09 Apr 2024 06:38:09 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Chuhong Yuan , Jason Wang , Alexander Bulekov , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.0 v2 01/11] hw/net/lan9118: Replace magic '2048' value by MIL_TXFIFO_SIZE definition Date: Tue, 9 Apr 2024 15:37:50 +0200 Message-ID: <20240409133801.23503-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240409133801.23503-1-philmd@linaro.org> References: <20240409133801.23503-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::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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: 1712669945540100005 The magic 2048 is explained in the LAN9211 datasheet (DS00002414A) in chapter 1.4, "10/100 Ethernet MAC": The MAC Interface Layer (MIL), within the MAC, contains a 2K Byte transmit and a 128 Byte receive FIFO which is separate from the TX and RX FIFOs. [...] Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell --- (Not including Peter R-b from v1 due to semantic change) hw/net/lan9118.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index 47ff25b441..8214569a2c 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -150,6 +150,12 @@ do { printf("lan9118: " fmt , ## __VA_ARGS__); } while= (0) =20 #define GPT_TIMER_EN 0x20000000 =20 +/* + * The MAC Interface Layer (MIL), within the MAC, contains a 2K Byte trans= mit + * and a 128 Byte receive FIFO which is separate from the TX and RX FIFOs. + */ +#define MIL_TXFIFO_SIZE 2048 + enum tx_state { TX_IDLE, TX_B, @@ -166,7 +172,7 @@ typedef struct { int32_t pad; int32_t fifo_used; int32_t len; - uint8_t data[2048]; + uint8_t data[MIL_TXFIFO_SIZE]; } LAN9118Packet; =20 static const VMStateDescription vmstate_lan9118_packet =3D { @@ -182,7 +188,7 @@ static const VMStateDescription vmstate_lan9118_packet = =3D { VMSTATE_INT32(pad, LAN9118Packet), VMSTATE_INT32(fifo_used, LAN9118Packet), VMSTATE_INT32(len, LAN9118Packet), - VMSTATE_UINT8_ARRAY(data, LAN9118Packet, 2048), + VMSTATE_UINT8_ARRAY(data, LAN9118Packet, MIL_TXFIFO_SIZE), VMSTATE_END_OF_LIST() } }; @@ -544,7 +550,7 @@ static ssize_t lan9118_receive(NetClientState *nc, cons= t uint8_t *buf, return -1; } =20 - if (size >=3D 2048 || size < 14) { + if (size >=3D MIL_TXFIFO_SIZE || size < 14) { return -1; } =20 --=20 2.41.0 From nobody Sat May 18 03:28:25 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=1712669943; cv=none; d=zohomail.com; s=zohoarc; b=ZGei4oZ03n+7Q8U+sRKC/+AwetMoyVRMQFvz4Av2ZW0FOg394FAUtAdJJxs7dudSDBnkxRar3c/6RzQ0QO2Asg9Hn5aPBvt+njTlYdMonsczuGQh6TNnqgMFWBxN9mtayBF0HoFvmC3XJbfOqKF7qSKrZkoU0l4LuaqZqJMuLBo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712669943; 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=hctFmQvoI+VoJ+wRhi5qSVao9Hd6gz46Zo0ppCYqkkE=; b=Rz5fTHGv3pm0g9LnyfLvK/oBz+BFZzHE7xLHhLWn5sVMpQ+N9rckt/s3skz/Xuly6sH9MtILMzSyl3X/39hr7BhrWu1um4kikM3OHfHdjO1Uk82m1f7Pof7FcKwhkF/62pkS3S8fK3e0jVzf6pJpT2YO9/m5megaRxnhiZ4TyVI= 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 1712669943728472.55208273096; Tue, 9 Apr 2024 06:39:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruBgD-0005up-83; Tue, 09 Apr 2024 09:38:29 -0400 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 1ruBg7-0005rP-QL for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:38:23 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruBg0-0008D5-RH for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:38:18 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-41650ee55ffso16789115e9.0 for ; Tue, 09 Apr 2024 06:38:15 -0700 (PDT) Received: from m1x-phil.lan ([176.176.160.134]) by smtp.gmail.com with ESMTPSA id c9-20020a05600c0a4900b0041638a085d3sm12938995wmq.15.2024.04.09.06.38.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 09 Apr 2024 06:38:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712669894; x=1713274694; 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=hctFmQvoI+VoJ+wRhi5qSVao9Hd6gz46Zo0ppCYqkkE=; b=MkNXaU16aYLZ5Bj4GLd6FHU8wRNJnqyBHEW2sC3PzpKbvENMUjK539nWTSu7rIsXID kFncCFWXfOZr5ifG1aehikXMluVh6R34N5MMCuoBaZDYqgX/lNVi1bGPX6DtJRQHxBbg KIA0YFR8YtonJDEgHleX7vTjUsgQ+r/6kKTVZ6ZL5ZbGwsxT3byIdsOMwja3SfvtIsPc 3M1o3K114bIhIP43eRAyBQ1oHLfk5TDgtI5BxcfwOemMUdPuZ4s3zVh8jyV73wXafzH0 Q89hGgGhH71wZNw+vhPvx/3cg83TyELI2OCqZZYXc2OlfFLVR8ipEWwWTtTbawOfubG2 Ww4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712669894; x=1713274694; 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=hctFmQvoI+VoJ+wRhi5qSVao9Hd6gz46Zo0ppCYqkkE=; b=F2UU/Ysx3Z5hff2xkct8krvhirsfiT8S5Vw00YRcfv4L+gTicqIF2Obq12hWatux5G 0Vmd8kz5NXJETs5gKNMvfKwHmuRDc3JspoHCIlE46BdLyMOy+0jRkD/dbswIyDKlPpHi IRg61BnLsxZpC1VeavEXwtI13DbUYIA9jrHi5bdRoZuZe6TqrE8jdB1eOLGNkU9gHUAe TWQ/A2OPaFslXoq5P8SM1jG6tH5AZ9ufvVABpGETJsGkVpeKfaqrfYxdJG1xIQ4ADAsp 78oI837ocn+Sz+YeTy0zVFIHlR7phFfkknkDZzO5CLwPPFrQvcZmT5cSeO8Q/MuEMNJr N8Kg== X-Gm-Message-State: AOJu0Yy0y++wCn8awGE9yj0+aHydCVW15evAgT59vQ+0vZ+a9X4t1AcR YXDc9hqwy9FnEw6+6heZzYPtpH1v4r55aWx2AtR1vtXnDUzQ36BKzZj/P5hMYz8Z/0cVzWldJfD P X-Google-Smtp-Source: AGHT+IH+S4oDYnnEyo5S1l17ul15PStqKCyEcvvn6rs9W0vus0qfS6lrL56SzCPRMDnA3s03aJN2uQ== X-Received: by 2002:a05:600c:154b:b0:416:9c95:b712 with SMTP id f11-20020a05600c154b00b004169c95b712mr1792936wmg.20.1712669894544; Tue, 09 Apr 2024 06:38:14 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Chuhong Yuan , Jason Wang , Alexander Bulekov , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PATCH-for-9.0 v2 02/11] hw/net/lan9118: Fix overflow in MIL TX FIFO Date: Tue, 9 Apr 2024 15:37:51 +0200 Message-ID: <20240409133801.23503-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240409133801.23503-1-philmd@linaro.org> References: <20240409133801.23503-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::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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: 1712669945553100006 When the MAC Interface Layer (MIL) transmit FIFO is full, truncate the packet, and raise the Transmitter Error (TXE) flag. Broken since model introduction in commit 2a42499017 ("LAN9118 emulation"). When using the reproducer from https://gitlab.com/qemu-project/qemu/-/issues/2267 we get: hw/net/lan9118.c:798:17: runtime error: index 2048 out of bounds for type 'uint8_t[2048]' (aka 'unsigned char[204= 8]') =C2=A0 =C2=A0 #0 0x563ec9a057b1 in tx_fifo_push hw/net/lan9118.c:798:43 =C2=A0 =C2=A0 #1 0x563ec99fbb28 in lan9118_writel hw/net/lan9118.c:1042:9 =C2=A0 =C2=A0 #2 0x563ec99f2de2 in lan9118_16bit_mode_write hw/net/lan9118.= c:1205:9 =C2=A0 =C2=A0 #3 0x563ecbf78013 in memory_region_write_accessor system/memo= ry.c:497:5 =C2=A0 =C2=A0 #4 0x563ecbf776f5 in access_with_adjusted_size system/memory.= c:573:18 =C2=A0 =C2=A0 #5 0x563ecbf75643 in memory_region_dispatch_write system/memo= ry.c:1521:16 =C2=A0 =C2=A0 #6 0x563ecc01bade in flatview_write_continue_step system/phys= mem.c:2713:18 =C2=A0 =C2=A0 #7 0x563ecc01b374 in flatview_write_continue system/physmem.c= :2743:19 =C2=A0 =C2=A0 #8 0x563ecbff1c9b in flatview_write system/physmem.c:2774:12 =C2=A0 =C2=A0 #9 0x563ecbff1768 in address_space_write system/physmem.c:289= 4:18 ... [*] LAN9118 DS00002266B.pdf, Table 5.3.3 "INTERRUPT STATUS REGISTER" Reported-by: Will Lester Reported-by: Chuhong Yuan Suggested-by: Peter Maydell Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2267 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell --- hw/net/lan9118.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index 8214569a2c..91d81b410b 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -799,8 +799,22 @@ static void tx_fifo_push(lan9118_state *s, uint32_t va= l) /* Documentation is somewhat unclear on the ordering of bytes in FIFO words. Empirical results show it to be little-endi= an. */ - /* TODO: FIFO overflow checking. */ while (n--) { + if (s->txp->len =3D=3D MIL_TXFIFO_SIZE) { + /* + * No more space in the FIFO. The datasheet is not + * precise about this case. We choose what is easiest + * to model: the packet is truncated, and TXE is raise= d. + * + * Note, it could be a fragmented packet, but we curre= ntly + * do not handle that (see earlier TX_B case). + */ + qemu_log_mask(LOG_GUEST_ERROR, + "MIL TX FIFO overrun, discarding %u byte= %s\n", + n, n > 1 ? "s" : ""); + s->int_sts |=3D TXE_INT; + break; + } s->txp->data[s->txp->len] =3D val & 0xff; s->txp->len++; val >>=3D 8; --=20 2.41.0 From nobody Sat May 18 03:28:25 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=1712669965; cv=none; d=zohomail.com; s=zohoarc; b=ezuC0tkHzOSz4OHrFaCxuzhkIFQE23TUk0ZcAUAVW6pwXp7ABS69v44giXYklsH0lxpKLEe9NpJJ7Csus6M9Cx7vAjNudcZQObvgq+KOkDSjGWIZb9H3k4HqRX13ESr4DUg9b9wU7s3E59XSl5zE6GMfpIt1G74Efo0Xp6wIHqw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712669965; 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=DYq6emMuo84KXuK6pkPRkrWEaAEwv9PfaiSXDO6YJ5M=; b=UeKOnouTsLAYNhRlA2exA3SMQlEoejf6no6N4zZGD8/d+GjxU6Z/zO/EQHjp9eBdsq3OK+79YUFAJAXp9O2f6WzOKmDyBAG1rebnCHMv7qYR4TiNiYBWG5g67GwxJON7jI1hT229D78exYLiXVVE99NaXf5bzBt0VzvNUfl7Vd0= 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 1712669965028409.0810948272807; Tue, 9 Apr 2024 06:39:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruBgK-00064w-5z; Tue, 09 Apr 2024 09:38:36 -0400 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 1ruBgC-0005uB-5w for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:38:28 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruBg7-0008Dj-Iy for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:38:26 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4169d794358so6526265e9.1 for ; Tue, 09 Apr 2024 06:38:21 -0700 (PDT) Received: from m1x-phil.lan ([176.176.160.134]) by smtp.gmail.com with ESMTPSA id q23-20020adfab17000000b003437799a373sm11657644wrc.83.2024.04.09.06.38.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 09 Apr 2024 06:38:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712669900; x=1713274700; 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=DYq6emMuo84KXuK6pkPRkrWEaAEwv9PfaiSXDO6YJ5M=; b=cxnoEpD6KAKtBEw5QDjDUrmguX7lzbDV0x8vzdsb8XUcaMF+c/PECNPb7qMz3cRse5 tuxwcywIHcy90NfWqp6yOx6VwXG+HWWsEZKBWJS0BNqFrS4xHazn3UXT8pimj86Y0KVC q1m63i4uFPfJn5/HFRi1e4b8BqsfjtHw3sQSHlMu8btsw2AVJTavZnfbKsEQdNPLW3QW KvhKctv52gsS4lJBXwTKIlvz6A/p7fLQSxxlVaaR3s67NrqwtxPvjdOnQ/AGceSYg2PP MyWKWXxGlCtLZ0L7dUcQciD+QH/PaY2EetO2VxruQu06qROX9zJMkf6ArpNpr7EZcJDL wGGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712669900; x=1713274700; 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=DYq6emMuo84KXuK6pkPRkrWEaAEwv9PfaiSXDO6YJ5M=; b=iwSJqAlFIeLsuyfXngx4Yi+p3UELVI0Wbb2VkjKQ2hbP2lheAJZu+HPzi1REF82yIu mbgUsbU+A/WwLNJZSvl6tXlNoJ6+l3Y6d9M88657zQYf/pvTB4SUgr72vax5TTS7Kb6e AbS+uqQbxm21A+5qwfjNGid+ViCP61O2/xF4oSX+Y4bqubsQ39GBxXyySZ8FYuWMKSXP LxDTkip13EXhNbBzynOTuqB0o9DjDPfZPbQsz2DE7i/o3mftLy6FDiBQFG9sR+AIJg1w w8Bl7lTDLzVW2JX4npHVEqXy1dHUncqcf+xR3Al3uBwFkr6ONcuV0o5+ozM28hw1C8+r V2Hg== X-Gm-Message-State: AOJu0Yxdc3nkIgptEP4kJqcC6ypspimYEl1DpPnIeBbfZrlA65NbCmuZ WpBG1hfAj21aPFV9akjzMdq2+ALewbQf7/ce1wcngiMemwR5sDmJgBCHwdDTq07xpfod+NAHOFo L X-Google-Smtp-Source: AGHT+IFJNO3vuW3jY8RQ657X4tebjgJoKiFR1/PXa+vWUhVI1oog2dETBoUsBWazwOm1m14Pi+htyg== X-Received: by 2002:a05:600c:4f0e:b0:416:6e42:ecc5 with SMTP id l14-20020a05600c4f0e00b004166e42ecc5mr4129262wmq.40.1712669899965; Tue, 09 Apr 2024 06:38:19 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Chuhong Yuan , Jason Wang , Alexander Bulekov , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.1 v2 03/11] hw/net/lan9118: Remove duplicated assignment Date: Tue, 9 Apr 2024 15:37:52 +0200 Message-ID: <20240409133801.23503-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240409133801.23503-1-philmd@linaro.org> References: <20240409133801.23503-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::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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=ham 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: 1712669965590100001 s->txp->fifo_used is zeroed in the next 3 lines. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell --- hw/net/lan9118.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index 91d81b410b..d6f0e37eb1 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -438,7 +438,6 @@ static void lan9118_reset(DeviceState *d) s->hw_cfg =3D s->mode_16bit ? 0x00050000 : 0x00050004; s->pmt_ctrl &=3D 0x45; s->gpio_cfg =3D 0; - s->txp->fifo_used =3D 0; s->txp->state =3D TX_IDLE; s->txp->cmd_a =3D 0xffffffffu; s->txp->cmd_b =3D 0xffffffffu; --=20 2.41.0 From nobody Sat May 18 03:28:25 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=1712669982; cv=none; d=zohomail.com; s=zohoarc; b=GJn1RUAFyLvxS56ohA3jrlXo6pWoYLNBzHY7WzSrKVKyOh8+try8eUA/k0rwOW8kXsZIpWOugNBvj6Rg6+9ljf1KIKQ89ZJv7yPdKN3nZzXAw8O3MIeo2PyzTZHgg8bsEjJCVy+U/GbOtFUGYFxMqCjdHW5MEviaIo6+5HGHu3M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712669982; 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=gF6HIIw6B4sYh42vGN4HzBKkT28PHylGD41Sq3YKysg=; b=IOoseXqf27YkiI1QuQypzVWsOARSoEGanRuLXHcZx/z0FpBhUZ0th7491x09dBBc1gPbtxn/L4elsTQjA7xEf3XAAdSDtg1eMx3eTYEgqENXlL+WPRkH3pMLcj1XckBBcz6YpkNVdYJUBwvIsuumGkICQPalpL6Qr2dACh3S4yY= 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 1712669982754320.0194027550202; Tue, 9 Apr 2024 06:39:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruBgt-0006NN-Mx; Tue, 09 Apr 2024 09:39:13 -0400 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 1ruBgH-0005yG-P2 for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:38:34 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruBgC-0008EA-3E for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:38:31 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-416b7f372b3so1963045e9.3 for ; Tue, 09 Apr 2024 06:38:26 -0700 (PDT) Received: from m1x-phil.lan ([176.176.160.134]) by smtp.gmail.com with ESMTPSA id hn3-20020a05600ca38300b004162b578d8bsm16974787wmb.1.2024.04.09.06.38.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 09 Apr 2024 06:38:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712669905; x=1713274705; 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=gF6HIIw6B4sYh42vGN4HzBKkT28PHylGD41Sq3YKysg=; b=S8FpbpF7twbylfVlLu54c/YC69uDLbzg0pP476agLBBvdIKBMmCWTgyXahoachl3Ys 7nZq0VV+H/KjA35lgZISJY+T53ras3swDGGHGCduHrSiXd5IoYetFmm97AqKSvIifvUA 9XuLk2I+8BItERRWPANmPtkBwzxBsMUQDSNNVULKEmQFyeJmHltoxuRJCtjLb3+VxPXk we4D9R1n7KLZcOu7c0E8K8JN33ibFTJ10Qcjhvma4TvNDg0Hni9jsNhpqHFPdBM21rIW lfuMdWKXse2KfXM+5RQObW1S1ARYd1qwjKN9exmcwmFWRmWTEQ4sFDW+JrSep6meEGQf cgOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712669905; x=1713274705; 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=gF6HIIw6B4sYh42vGN4HzBKkT28PHylGD41Sq3YKysg=; b=og6LixhW6y3toAEHn3B68/A2YXcNriHS++uX7WtHqCX25PR/4W1bjXpCdtbMVZvRmg vDS2CXS+9F0JlYCUnSHay6IJy7C9V9P8rUTQK8/85t/dy3n00Fnx5ljbm5lUZXcSOXIR pTTNBmB1j+B68lcejFfCyALaWnByAJnUoyjWeEiZ2EHPG12WaCWdsqcHS1DI1xVp4Ojq xD70kpiJFuVU2Wf/FARsgfX0hUuWwIZoU7gHlfLyv85Gy9liUVezeW5kuj1WBlI7yvVp E1DmXiSY7nVpSU3V/Fa9opDt++94x9cUoStfpsTSSDwbBpTLStQBI+NOAz3i9UAO3Sh6 nyIg== X-Gm-Message-State: AOJu0YyrQk/6L9WlesPFRIYpeo1oV0E+K1WEfByW23lUmHR+PcG1Rai7 pL4b0bC/4nR2rA/7rmt2yNWj0QhPwZgXkA2n40Qh9entulSumJR1/F/Xxv/BfzmzxlNa7di9P1R B X-Google-Smtp-Source: AGHT+IEu4ajUEx8yDVe2Upb/QIFMqZWoqh9Bt5y2VM4vhJrlFpuIF+nDaN+x+Cz8zu+WqYJUx5CeLQ== X-Received: by 2002:a05:600c:4f54:b0:416:6abe:2975 with SMTP id m20-20020a05600c4f5400b004166abe2975mr4221251wmq.15.1712669905261; Tue, 09 Apr 2024 06:38:25 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Chuhong Yuan , Jason Wang , Alexander Bulekov , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.1 v2 04/11] hw/net/lan9118: Replace magic '5' value by TX_FIF_SZ_RESET definition Date: Tue, 9 Apr 2024 15:37:53 +0200 Message-ID: <20240409133801.23503-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240409133801.23503-1-philmd@linaro.org> References: <20240409133801.23503-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::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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: 1712669983735100001 TX_FIF_SZ is described in chapter 5.3.9, "HW_CFG =E2=80=94 HARDWARE CONFIGURATION REGISTER". Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell --- hw/net/lan9118.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index d6f0e37eb1..a6a869de32 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -71,6 +71,8 @@ do { printf("lan9118: " fmt , ## __VA_ARGS__); } while (0) #define CSR_E2P_CMD 0xb0 #define CSR_E2P_DATA 0xb4 =20 +#define TX_FIF_SZ_RESET 5 + #define E2P_CMD_MAC_ADDR_LOADED 0x100 =20 /* IRQ_CFG */ @@ -435,7 +437,7 @@ static void lan9118_reset(DeviceState *d) s->fifo_int =3D 0x48000000; s->rx_cfg =3D 0; s->tx_cfg =3D 0; - s->hw_cfg =3D s->mode_16bit ? 0x00050000 : 0x00050004; + s->hw_cfg =3D (TX_FIF_SZ_RESET << 16) | (s->mode_16bit << 2); s->pmt_ctrl &=3D 0x45; s->gpio_cfg =3D 0; s->txp->state =3D TX_IDLE; --=20 2.41.0 From nobody Sat May 18 03:28:25 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=1712669994; cv=none; d=zohomail.com; s=zohoarc; b=Xw/ER95vnlOtb9B6Azah4mp2eLe4i4Deh6VSDMNzFk764WQvwZYVMVcFZOq7v2ovUB+lEaRZFNOTZHEoE2tMmyf4qvnmof4QCgFzkr/RwLnEWMM0x/a9n/7qrEXMsXbNoZI+T8CQgRRaJRK6SzYoFlzY7hVQRChU34fPVA87HAg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712669994; 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=lbfyIBf/SQJfbeKOCdEpbKAjf0YIAs4J/ih0RuWwHfw=; b=P2KIC7E9VZTFqxqIAgDqh4v03mWouDMhBB7fcSIWH5dEncUQM0NpvHpdCCXEZ6eTTVgzhKuZOJNgicHpl88lvw1NmYS6fS3ZYzR724WyWWQ2oUx9jPKZFFA5F4nq2VXSFsZA+dySOzNTIwWEDZhc6bWJqIQPBKF06Pv5eKuv1Ss= 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 1712669994872775.0817960010553; Tue, 9 Apr 2024 06:39:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruBgo-0006Bv-Nn; Tue, 09 Apr 2024 09:39:09 -0400 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 1ruBgJ-00061e-L8 for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:38:35 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruBgG-0008EZ-JB for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:38:34 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-343f62d8124so2801384f8f.2 for ; Tue, 09 Apr 2024 06:38:32 -0700 (PDT) Received: from m1x-phil.lan ([176.176.160.134]) by smtp.gmail.com with ESMTPSA id k2-20020a5d5242000000b00343c0c24a65sm11460005wrc.89.2024.04.09.06.38.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 09 Apr 2024 06:38:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712669910; x=1713274710; 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=lbfyIBf/SQJfbeKOCdEpbKAjf0YIAs4J/ih0RuWwHfw=; b=A5olmGq+DqVVVxLXaoPRzZOpkl3+bcx6X/tP30ChgWYesXDu5TFuooy0CuRwrNc9jm I3Wed44qyzFmJK+uJlCYRIE14nxvFfK9dOec23W/u5HXaBIYGaeoyZT3zdGqRbfdW1Im wAxIi9Wx6c7qVFP50YAfsUDKRlWXkPYzUvHMb77hFHRspm4e2p+WZbNHEm5SWNK3/u49 LK+Az1IT5t5lBH7Fvnio5HK4pR0n+qduf3Ew0rMRsoKh084WDevMpMarfeiphl4h34FB ZzbwoPfjLhoDAIlS8CaYqcZrtzzdmkS4BJ5faWewFpoD/JVnHRr+kS/P8jgbrrIOOr0G +wXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712669910; x=1713274710; 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=lbfyIBf/SQJfbeKOCdEpbKAjf0YIAs4J/ih0RuWwHfw=; b=gxbqfP5dwwtKcQit8hcoP6mkKfsyVLN2OUmQ0w03cwuUGFITcE5PiawR5t+GNfyhD3 Sjh1dM31HIm50pGxjfEKvxHJoKPSDf5gf7Uo+bdiB+7e+cYhGemlMZOGdgHTAf9+CtJt rgPeFCPp3rP3lpx7A2WFucB+y+s8OFLhnm3nUlzqtlWSHnYz45CIqygE769Jk12tjWC6 GGgZdzNB1ctjyOCOC7iM58uze5KGTL5VNpHKno4Vt/8kusDKhA5IWEfVqlgbF0H3m3bw J1D12uK9KweqN40+D4YNk+jH5mdBk5sLHrN3GQybVCR625OnfrIyvX29OcCYVZ6uK40y xiMA== X-Gm-Message-State: AOJu0Ywt0xsnqG6qLQXctQ8zO63GJDHMac87P1u7y9oEIQKRS2r24w8j 6835bzNqRVC9HyK8LmGBnFVBUSmnemScPmKlEE81a7KaXXVdyStzCmPfFJcELneIAqGlAcwW9Kp n X-Google-Smtp-Source: AGHT+IELHMkr0CokRWJgSz7ychYXKu0gObaub5U19RTlVolwHBUf/EsheTqX+6tZdDi2fRPkLRFoiQ== X-Received: by 2002:a5d:5233:0:b0:341:bfe2:4509 with SMTP id i19-20020a5d5233000000b00341bfe24509mr8216775wra.42.1712669910719; Tue, 09 Apr 2024 06:38:30 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Chuhong Yuan , Jason Wang , Alexander Bulekov , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.1 v2 05/11] hw/net/lan9118: Add definitions for FIFO allocated sizes Date: Tue, 9 Apr 2024 15:37:54 +0200 Message-ID: <20240409133801.23503-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240409133801.23503-1-philmd@linaro.org> References: <20240409133801.23503-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::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.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=ham 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: 1712669995808100001 Add definitions for the TX_FIF_SZ=3D5 case, per TABLE 5-3 "VALID TX/RX FIFO ALLOCATIONS". Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/net/lan9118.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index a6a869de32..00409927fe 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -158,6 +158,17 @@ do { printf("lan9118: " fmt , ## __VA_ARGS__); } while= (0) */ #define MIL_TXFIFO_SIZE 2048 =20 +/* + * TX and RX FIFO space is configurable through the TX FIFO Size (TX_FIF_S= Z) + * field in the hardware configuration (CSR HW_CFG) register. These are the + * default configuration settings for TX_FIF_SZ =3D 5 + * (see TABLE 5-3: VALID TX/RX FIFO ALLOCATIONS). + */ +#define TX_DATA_FIFO_BYTES 4608 /* 1152 words */ +#define TX_STATUS_FIFO_BYTES 512 /* 128 words */ +#define RX_DATA_FIFO_BYTES 10560 /* 2640 words */ +#define RX_STATUS_FIFO_BYTES 704 /* 176 words */ + enum tx_state { TX_IDLE, TX_B, --=20 2.41.0 From nobody Sat May 18 03:28:25 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=1712670008; cv=none; d=zohomail.com; s=zohoarc; b=Dsc+fOETTnIdWPtcioXet9UM+h+/QE13yk0p5c9ZM+vZEBDVYRrWzj/ujZONxLx4RfUlqpzjUmIec268L0VDPdku2amDfeIEIma9j6wUO/JKig2nz2eNSGkDa/phizseIxPaAbiL6/iZqYNsRqySbcV6kl+tjPF1ce53yImbNEQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712670008; 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=7TiWem1ZhFBanlvNYVKtTUilTqsESzuwGclOakf5YZY=; b=F26eHip2wuZXQAXXyievaET267KDSakRCweKJHJq4QQ0qYEcief/9XVdHXxFhveCoaDi+8d3X3XHgsJa8vJso3lsj75YowTyv7am1pTDFx4ZN2esdpcQcWpbOTPssgdV2jAWCT9HlzLLEneQ7VjtgYyIvS0EKudd6rKt/tGYPSQ= 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 1712670008119478.08746714378026; Tue, 9 Apr 2024 06:40:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruBh3-0006pW-N2; Tue, 09 Apr 2024 09:39:21 -0400 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 1ruBgO-00069R-2K for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:38:40 -0400 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 1ruBgL-0008F7-KY for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:38:38 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-41551639550so39139205e9.2 for ; Tue, 09 Apr 2024 06:38:37 -0700 (PDT) Received: from m1x-phil.lan ([176.176.160.134]) by smtp.gmail.com with ESMTPSA id l13-20020a5d668d000000b0034354a99d43sm11483355wru.43.2024.04.09.06.38.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 09 Apr 2024 06:38:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712669916; x=1713274716; 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=7TiWem1ZhFBanlvNYVKtTUilTqsESzuwGclOakf5YZY=; b=nAkfqxAW/T5g4qa2Bse3sU0USrdEIaSGp1zsofwDjAoO18sSR/JDwM2qwGRpFENxc8 Qpuw8DSYRbV/Zw+/vXB77nWZp50XgMtFyzLYBlS2le/PRuGUo6kZvgWEdb9CfIuzXSaL NbJ9QQAf7j/QTyCnqe1oEH6BqBcsAjJqvqyNXGk2DXl4zw6+ClkIxgNHdbV4R0UULCen 2icsg0I1Zcvt198RnDVfh8p61bLQGahRt9H+z2Uzps5nJRBN1nXbwzM09KtUEJTBryS+ aToh6CxCCEMSHcYBonA6iBJ7kynbtxi5OoZU2X7eqphJD87JH3al1z2HxyZ73eTAgxzX l2tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712669916; x=1713274716; 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=7TiWem1ZhFBanlvNYVKtTUilTqsESzuwGclOakf5YZY=; b=NjrueuLXcRkV/TqFNkWo5P+vUaY3GmTqpkcOGpAT4osvhsgYJGXpH09Lvif7tmlnrD vHn4YJKKlvz6ZS970cqymiuAwfRfhQNWod4zlEX7MJuAcEkuDzKE+FrfOmMis+FN8GAl qju0oCVSpq3ojw1oJkpZcVqYznIvnLNFOCQsur9IGamJBYPTeShTCHTP46nNeJkBYfIm +ha8/SEJbXbdScTHB0yFrz0h7/fXI4vdcCn5Rxp+ZY5DJ6FggBB6ABcJ9NzfMOYdE5w5 TQ5+BHS7/tapkm+Wu+bM+azaNzR792WHi4JPEg+gCaE5aBd6u8/d2wFrtTn2JTpTiT8+ 9SsA== X-Gm-Message-State: AOJu0YybXwtBOxACu6SBJWgsldE5XCcv9vJykew3FKF4JlBpjHq/aVeS 4sG+vdC7/Uh2j8JD3oz8aOFgNfAe/DS0tv/F4BVN+mlL/PbN+8W+q1P+7N88Ex04YgVZxfFle/F 2 X-Google-Smtp-Source: AGHT+IHmi+P6WalSbuDs5RPZz+RSQUCcpEkI99bSHFwdHTk199Eu3eQbfb9VoNgS+hTcXQkMr9YNzg== X-Received: by 2002:a05:600c:154d:b0:416:902e:51ac with SMTP id f13-20020a05600c154d00b00416902e51acmr3520404wmg.39.1712669916012; Tue, 09 Apr 2024 06:38:36 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Chuhong Yuan , Jason Wang , Alexander Bulekov , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.1 v2 06/11] hw/net/lan9118: Use TX_DATA_FIFO_BYTES definition Date: Tue, 9 Apr 2024 15:37:55 +0200 Message-ID: <20240409133801.23503-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240409133801.23503-1-philmd@linaro.org> References: <20240409133801.23503-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: 1712670009873100003 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/net/lan9118.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index 00409927fe..ba92681e2e 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -456,7 +456,7 @@ static void lan9118_reset(DeviceState *d) s->txp->cmd_b =3D 0xffffffffu; s->txp->len =3D 0; s->txp->fifo_used =3D 0; - s->tx_fifo_size =3D 4608; + s->tx_fifo_size =3D TX_DATA_FIFO_BYTES; s->tx_status_fifo_used =3D 0; s->rx_status_fifo_size =3D 704; s->rx_fifo_size =3D 2640; --=20 2.41.0 From nobody Sat May 18 03:28:25 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=1712670024; cv=none; d=zohomail.com; s=zohoarc; b=F56F/y9p9f9ocjJYv0ki1ixHfis8XhsRtChVtLnrJvTVGip8mOgRYGXaQhsBUwJ10mmkgzH0UBWHEPLJ+PPxwuJW2V/K2bSo+QweHAM1XGmgi157r8nckJZS2bDOdItPjdVhnZOEW/Zk5TppRLynHdJgSux2zoyGC+5LA5t39vg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712670024; 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=LWebOFnaO2YfqkM2Zqjj72nsNguBU6W//GqzHg4t0x0=; b=R5lhWXZMCt6j36kVjH8w2KJ4b4snKPoLBBzDPLTlJjnjm4eipZf17kupXp8tx/ld+GCgvpHy908vbkLrDX+bswBSny7DA+IXSTaAcP/e6qaMV3FI2ZYO9rckTlybvbc8w/h67S/AFxgwWC8pU57hSvWyyj/D0FOUTTqynk8+m3g= 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 171267002453671.67778136866116; Tue, 9 Apr 2024 06:40:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruBhE-0007Lc-Ao; Tue, 09 Apr 2024 09:39:32 -0400 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 1ruBgX-0006Ah-KT for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:38:54 -0400 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruBgR-0008FV-Sq for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:38:46 -0400 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2d8b194341eso4265381fa.3 for ; Tue, 09 Apr 2024 06:38:43 -0700 (PDT) Received: from m1x-phil.lan ([176.176.160.134]) by smtp.gmail.com with ESMTPSA id t20-20020a05600c199400b0041691379a84sm1446429wmq.1.2024.04.09.06.38.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 09 Apr 2024 06:38:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712669921; x=1713274721; 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=LWebOFnaO2YfqkM2Zqjj72nsNguBU6W//GqzHg4t0x0=; b=Qmf28Bqt9/Lk8VbUT/Uc313cTBuk3nl4lQP5KX8ZeS8GuAWTX2MbYz9C9XPSO4O1fF I77tuA9SO39o+EDBWIOhWNAgMVHe24e+xckBxIjBA4nBXBAYlmuPJpPbwUgmEGKlrzcJ G+UKytPg3lxUkcbdbDaR1r9HLiXABHva30zAQn7oWA0uu3vVuJKMXDKW3HuiOH3Dkk/5 tOhJT8LHescq/62o/EanEkYKghAPApMIjBMe3/1HNW6EDmND9hnM57KbmKRnYQn7QWD8 v2yjfdHMHYzUpfZsH4G4RWuj72D+b6mgKx2JF6CnH4hy9FYjCHG0n2i47lIv93BTa6CV U+4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712669921; x=1713274721; 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=LWebOFnaO2YfqkM2Zqjj72nsNguBU6W//GqzHg4t0x0=; b=RXqqVXEP0dMmbbtPuq8Jyn+AXpxx+65JIORJei8SmnVfT3g8iZjsRBJZDsSGD5fcVi LWhu5w+7pKHjAZxxos/Vr/46XBf7IRHAyEqGH358EsJZU6/baI1dzIXT+Yi/JIp3FIs/ o7FOEt2ELR5xQckYgwryAfOqC+uf/o0qWfKvhiAaEejIe2iS19BFbTcEHZeFJ+rY0ICt DFLZLL7bDdSHVVTfJV9pFmdEgDVpN8D/6mTXKb92KRCn9DnkhcW688z3xoT5vE9f0vKf ApLOvdjbiHCjW6L6x8xdqld/gFJlV3cgZQrT+F8K7pIAbnpDLNVOhqyVpJzBuCkXw2xG E2yQ== X-Gm-Message-State: AOJu0YxxRqzdbGwjcNzMAXsXOIsfFjM5XEPy/QB9vIc1g7xK8GVPOTvr tDSjcJQTnTKsWYEJ5EbeLwlUfJg9MOpUG1bJBb+RpqaVZpjHJwA8oAnZa0Eakg1rkk6RmasAlkH E X-Google-Smtp-Source: AGHT+IH4G2ntijOoEIJR8CTEkeuHXC9H2zW1m+FdRHjMT5LRXs4HGgpqB5a7S0q9RTm5ovblVUgtOQ== X-Received: by 2002:a05:651c:794:b0:2d8:67ee:2a44 with SMTP id g20-20020a05651c079400b002d867ee2a44mr6899106lje.8.1712669921293; Tue, 09 Apr 2024 06:38:41 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Chuhong Yuan , Jason Wang , Alexander Bulekov , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.1 v2 07/11] hw/net/lan9118: Rename tx_fifo_size -> tx_fifo_bytes Date: Tue, 9 Apr 2024 15:37:56 +0200 Message-ID: <20240409133801.23503-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240409133801.23503-1-philmd@linaro.org> References: <20240409133801.23503-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::22e; envelope-from=philmd@linaro.org; helo=mail-lj1-x22e.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: 1712670026223100003 tx_fifo_size is a byte count, rename it to avoid confusion. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/net/lan9118.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index ba92681e2e..a983ce193b 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -251,7 +251,7 @@ struct lan9118_state { int32_t eeprom_writable; uint8_t eeprom[128]; =20 - int32_t tx_fifo_size; + int32_t tx_fifo_bytes; LAN9118Packet *txp; LAN9118Packet tx_packet; =20 @@ -322,7 +322,7 @@ static const VMStateDescription vmstate_lan9118 =3D { VMSTATE_UINT32(phy_int_mask, lan9118_state), VMSTATE_INT32(eeprom_writable, lan9118_state), VMSTATE_UINT8_ARRAY(eeprom, lan9118_state, 128), - VMSTATE_INT32(tx_fifo_size, lan9118_state), + VMSTATE_INT32(tx_fifo_bytes, lan9118_state), /* txp always points at tx_packet so need not be saved */ VMSTATE_STRUCT(tx_packet, lan9118_state, 0, vmstate_lan9118_packet, LAN9118Packet), @@ -456,7 +456,7 @@ static void lan9118_reset(DeviceState *d) s->txp->cmd_b =3D 0xffffffffu; s->txp->len =3D 0; s->txp->fifo_used =3D 0; - s->tx_fifo_size =3D TX_DATA_FIFO_BYTES; + s->tx_fifo_bytes =3D TX_DATA_FIFO_BYTES; s->tx_status_fifo_used =3D 0; s->rx_status_fifo_size =3D 704; s->rx_fifo_size =3D 2640; @@ -757,7 +757,7 @@ static void tx_fifo_push(lan9118_state *s, uint32_t val) { int n; =20 - if (s->txp->fifo_used =3D=3D s->tx_fifo_size) { + if (s->txp->fifo_used =3D=3D s->tx_fifo_bytes) { s->int_sts |=3D TDFO_INT; return; } @@ -1285,7 +1285,7 @@ static uint64_t lan9118_readl(void *opaque, hwaddr of= fset, return (s->rx_status_fifo_used << 16) | (s->rx_fifo_used << 2); case CSR_TX_FIFO_INF: return (s->tx_status_fifo_used << 16) - | (s->tx_fifo_size - s->txp->fifo_used); + | (s->tx_fifo_bytes - s->txp->fifo_used); case CSR_PMT_CTRL: return s->pmt_ctrl; case CSR_GPIO_CFG: --=20 2.41.0 From nobody Sat May 18 03:28:25 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=1712669995; cv=none; d=zohomail.com; s=zohoarc; b=RSV1XHZdH0Q51grjJ59HZhAOUtFcSYMRVikfGZ7sD+J6/mjiQiuj3+OFDQX6uqabIKsso1KjmgSSrFVuXJ4CbunvOZhU3xfcuvkx3C0T61OZeG0mki4q7Ze9z8V3/bVFAfxvdXMNfEtjEnzytKdAuzg7bT+AvRK1GxykDeFXmJA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712669995; 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=oGzPoYfNQCrbv8SBMTgNtn+qUHBJfLjzTK3ZMwrVVa0=; b=YeEkRYT7MKP8zoFPKps9Ifir93POfzJJDEsKIfsr5J9eSgN81gQse+BpFGLQT3KYm/a6RYSrXPkxCbpbSZ1HJlRVCPrpKSmsyk1kMsw7XjJr8MXUig/3da7rml3nGTBOdM2dhpkHWdis0jA0zDT/r14uu6pYsDVKV4G838Z0ViI= 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 1712669995409342.05853277997255; Tue, 9 Apr 2024 06:39:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruBhB-000771-NN; Tue, 09 Apr 2024 09:39:29 -0400 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 1ruBga-0006Bb-8S for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:38:54 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruBgY-0008Fg-Cl for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:38:51 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-345e1c64695so940193f8f.1 for ; Tue, 09 Apr 2024 06:38:49 -0700 (PDT) Received: from m1x-phil.lan ([176.176.160.134]) by smtp.gmail.com with ESMTPSA id y13-20020a5d4acd000000b00343eac2acc4sm10864616wrs.111.2024.04.09.06.38.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 09 Apr 2024 06:38:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712669926; x=1713274726; 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=oGzPoYfNQCrbv8SBMTgNtn+qUHBJfLjzTK3ZMwrVVa0=; b=YLVPHWI9qf0YqvGfy+qWUYDFO34sRgz35Kr5pF9BOGHm0J1/ie3U27Iv+Wg6NTQXmU Zt9CCvlcOG/Lnm1t+h0k2OUElLmhMVMYZwQPhFgx3FUeEmF1t5/IeV+K/WBxU6uwNFqK s57WPDAHjbduBqL0p6mss1NlQthDZfnGN+z5l4uGO7yzx67iR/pl9ksqhYvlg0ynzK8h aj5rDi6uSDmgbxOIt+GsOjWuOQqwVE5KHMfSbocDELpm+NDYA8ycOWFMwWitQefCV8zi hT4IxCEon3qEgB20gmuVtigvFkf11knelYlT2DjnWsU8C1T3OyFGtXYI5Yq26vPhhpTm CIIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712669926; x=1713274726; 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=oGzPoYfNQCrbv8SBMTgNtn+qUHBJfLjzTK3ZMwrVVa0=; b=HNe95lChZkKJiCDJQRNMZyP4YRBOhHRCvD3K356rDaVIuLVDML0XEm+Nw4IYhd3Exi bjjwEskXc43A5YWHbLC7dcpxLoGsINjFaCBuqLynE0OnC2TWB8tjRMuKpnXuZ1FujLvl ioGilqKIRC+EncGTvmMsqvduTs01Fr/Y8u6T4sNL30RDagRaMd9sVV9/TWI/9EotmjnM 4UMWc8lq5L6KhksX2EGYhJGqZ+XiDQ2x/S8Wjseila/925D82y2E1LKFinc9lPhitItC 2TozSK++bQZGwMZpKn0EdLksGUEY8GwccDlMFz+15Ync0q2ZHEYKSxcQHvY0Ey9NMO9O uudQ== X-Gm-Message-State: AOJu0YwnnelMvHvQwuJVgOyeURkAtTYtbHo4OPjjQps8MVDVtxtbgjdz Sp3QxKAonmgVX8aXKUi9DGL1WKBn7l5FEfIr1IyR/UGbv78U5fL3InzqsHc795fvZU+KjpeHXoq T X-Google-Smtp-Source: AGHT+IETTIhcSQI8zV4cGPaMOo8NFq+qsrkkC9zgOGClodeEguSGylF62XY8LCwXvLt//E5O7GFuVA== X-Received: by 2002:adf:f7cb:0:b0:343:ba58:97c4 with SMTP id a11-20020adff7cb000000b00343ba5897c4mr7607183wrq.10.1712669926663; Tue, 09 Apr 2024 06:38:46 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Chuhong Yuan , Jason Wang , Alexander Bulekov , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.1 v2 08/11] hw/net/lan9118: Use RX_STATUS_FIFO_BYTES definition Date: Tue, 9 Apr 2024 15:37:57 +0200 Message-ID: <20240409133801.23503-9-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240409133801.23503-1-philmd@linaro.org> References: <20240409133801.23503-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::429; envelope-from=philmd@linaro.org; helo=mail-wr1-x429.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=ham 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: 1712669995834100002 rx_status_fifo[] is an array of words, rx_status_fifo_size is a word count. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/net/lan9118.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index a983ce193b..cace22381d 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -262,7 +262,7 @@ struct lan9118_state { int32_t rx_status_fifo_size; int32_t rx_status_fifo_used; int32_t rx_status_fifo_head; - uint32_t rx_status_fifo[896]; + uint32_t rx_status_fifo[RX_STATUS_FIFO_BYTES / 4]; int32_t rx_fifo_size; int32_t rx_fifo_used; int32_t rx_fifo_head; @@ -332,7 +332,9 @@ static const VMStateDescription vmstate_lan9118 =3D { VMSTATE_INT32(rx_status_fifo_size, lan9118_state), VMSTATE_INT32(rx_status_fifo_used, lan9118_state), VMSTATE_INT32(rx_status_fifo_head, lan9118_state), - VMSTATE_UINT32_ARRAY(rx_status_fifo, lan9118_state, 896), + VMSTATE_UINT32_ARRAY(rx_status_fifo, lan9118_state, + RX_STATUS_FIFO_BYTES / 4), + VMSTATE_UNUSED(896 * 4 - RX_STATUS_FIFO_BYTES), VMSTATE_INT32(rx_fifo_size, lan9118_state), VMSTATE_INT32(rx_fifo_used, lan9118_state), VMSTATE_INT32(rx_fifo_head, lan9118_state), @@ -458,10 +460,9 @@ static void lan9118_reset(DeviceState *d) s->txp->fifo_used =3D 0; s->tx_fifo_bytes =3D TX_DATA_FIFO_BYTES; s->tx_status_fifo_used =3D 0; - s->rx_status_fifo_size =3D 704; s->rx_fifo_size =3D 2640; s->rx_fifo_used =3D 0; - s->rx_status_fifo_size =3D 176; + s->rx_status_fifo_size =3D RX_STATUS_FIFO_BYTES / 4; s->rx_status_fifo_used =3D 0; s->rxp_offset =3D 0; s->rxp_size =3D 0; --=20 2.41.0 From nobody Sat May 18 03:28:25 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=1712670053; cv=none; d=zohomail.com; s=zohoarc; b=oBy0wLVdWw/chn0+e/Pg1USHpH/ZONHnSrJiX9Hk5ibeK2Z3AfJ1DTZkFtfJrqvOuxsmSBmZDIhYTWflWRzPoEXa3tEQT2bntggGvxZ9XK1RLqM3B4+BIcvlK8VVhKXLGIsrkb4HJSTM58Gp2IzzeTpBrFa7QARx/mHDh1kYzpc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712670053; 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=REIm1SfLMUgG42n/AOyva4uJWnD7BJmJ3hGw4grtNrQ=; b=fq5xmyQ5Y8fBWoE+5pKqFoqpUlBFgUkANwKM8E5wa92Cv3dzZvreG8Go2T7BglORC/8mlgj3Ghd/1ks3ZqUYh7j2MWt+yQlh8817SJTgXs0lGh96fodE88BAIeY8K+KSTYe6yBX17w3Sf6hmZwhlGpiOP1M4ijb9hChMp8j/mSk= 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 1712670053774597.6282945641225; Tue, 9 Apr 2024 06:40:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruBhE-0007MO-Ay; Tue, 09 Apr 2024 09:39:32 -0400 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 1ruBgd-0006CJ-Ud for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:39:01 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruBgc-0008Gq-04 for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:38:55 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-343c2f5b50fso3735527f8f.2 for ; Tue, 09 Apr 2024 06:38:53 -0700 (PDT) Received: from m1x-phil.lan ([176.176.160.134]) by smtp.gmail.com with ESMTPSA id j1-20020adfb301000000b003464e150e30sm236605wrd.15.2024.04.09.06.38.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 09 Apr 2024 06:38:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712669932; x=1713274732; 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=REIm1SfLMUgG42n/AOyva4uJWnD7BJmJ3hGw4grtNrQ=; b=LSZmv35s7D27V3+dGrZnCHfE9CB5s/cbgVpq5VCM3FIjLogRnulB1NLvrZtcIIwGJh eJM+XFKPxDKbq5MAaQEO0ZDYTxIZOGayb4oY2c55XFTHcddBjq3XoplVkrupSYjbdgBs H+TmTVSv2qO6ifSkFvUskg4L+8eryWlfQ9Q7ugUmZbQjc2qqTsWbEhjrCD0uqyvRQvil CCnUz9o2+VO3g16PfnWXrr18rSrsLFHFN8hDa788XgpEhNMby5Yy9G+lAIZj6PEcPhue MtDxkOTibz42wArgsv/0sXAz7XIMcKVGjQdVfUIDpJNtn6gOaWlSNM4bdGTnWUn8FMUO t4cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712669932; x=1713274732; 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=REIm1SfLMUgG42n/AOyva4uJWnD7BJmJ3hGw4grtNrQ=; b=SpYjdaaB4n/U3px1Prq+yvRg8hqytId8co433g9EVpbNq5qqwvayJ8maG98nSfKsEt 6uOt9JHbtHvqT/Jzxzjs/dlsJH4FxOT2449YmWYF33QdViGnUYKsIPsXD6dHmLrZsrJf t/xyuNCrO1D4KW6B89krbgvSgOo9c8OCyPG4Tc5Lml4GhK1zLqmPBhl5cmDFCcMHv2P2 D5ugS0wVxLreOl1xeez8CbZTfZQqQ32bmJWwEJ4956nxrHJ54CGLXvI+UOt54xAQUZ0Y 0IErE9fEonQaC9sbFQxXS/k7bZZSJy0RwF6gijtg4A/7D90c80Z29vZ5x2LYn651aEQr WdSQ== X-Gm-Message-State: AOJu0YwIoNnBRM5ayn+tgmCiKfnchYmDSCieXvad1sacSgZdA4B0cU2J 2b6c6ui6nQ8du3vbRU3JfaC/F8nWUnHJ2CoCMgjYVy0wp5bB8b/mk4zH1Ppy0RUF37ox6z9Nrhb u X-Google-Smtp-Source: AGHT+IHi8laSSIRUoQSHm4FD2sdjylQ5LL7q86l9s0xiAn9IQNCqQk/PleCS3bDLIwpbLTpVP1wAgQ== X-Received: by 2002:a05:6000:1864:b0:33e:48f9:169d with SMTP id d4-20020a056000186400b0033e48f9169dmr11866184wri.31.1712669932225; Tue, 09 Apr 2024 06:38:52 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Chuhong Yuan , Jason Wang , Alexander Bulekov , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PATCH-for-9.1 v2 09/11] hw/net/lan9118: Rename rx_status_fifo_size -> rx_status_fifo_wordcount Date: Tue, 9 Apr 2024 15:37:58 +0200 Message-ID: <20240409133801.23503-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240409133801.23503-1-philmd@linaro.org> References: <20240409133801.23503-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::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.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=ham 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: 1712670054345100001 rx_status_fifo_size is a word count, rename it to avoid confusion. Suggested-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/net/lan9118.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index cace22381d..663776f575 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -259,7 +259,7 @@ struct lan9118_state { int32_t tx_status_fifo_head; uint32_t tx_status_fifo[512]; =20 - int32_t rx_status_fifo_size; + int32_t rx_status_fifo_wordcount; int32_t rx_status_fifo_used; int32_t rx_status_fifo_head; uint32_t rx_status_fifo[RX_STATUS_FIFO_BYTES / 4]; @@ -329,7 +329,7 @@ static const VMStateDescription vmstate_lan9118 =3D { VMSTATE_INT32(tx_status_fifo_used, lan9118_state), VMSTATE_INT32(tx_status_fifo_head, lan9118_state), VMSTATE_UINT32_ARRAY(tx_status_fifo, lan9118_state, 512), - VMSTATE_INT32(rx_status_fifo_size, lan9118_state), + VMSTATE_INT32(rx_status_fifo_wordcount, lan9118_state), VMSTATE_INT32(rx_status_fifo_used, lan9118_state), VMSTATE_INT32(rx_status_fifo_head, lan9118_state), VMSTATE_UINT32_ARRAY(rx_status_fifo, lan9118_state, @@ -462,7 +462,7 @@ static void lan9118_reset(DeviceState *d) s->tx_status_fifo_used =3D 0; s->rx_fifo_size =3D 2640; s->rx_fifo_used =3D 0; - s->rx_status_fifo_size =3D RX_STATUS_FIFO_BYTES / 4; + s->rx_status_fifo_wordcount =3D RX_STATUS_FIFO_BYTES / 4; s->rx_status_fifo_used =3D 0; s->rxp_offset =3D 0; s->rxp_size =3D 0; @@ -568,7 +568,7 @@ static ssize_t lan9118_receive(NetClientState *nc, cons= t uint8_t *buf, } =20 /* TODO: Implement FIFO overflow notification. */ - if (s->rx_status_fifo_used =3D=3D s->rx_status_fifo_size) { + if (s->rx_status_fifo_used =3D=3D s->rx_status_fifo_wordcount) { return -1; } =20 @@ -609,8 +609,8 @@ static ssize_t lan9118_receive(NetClientState *nc, cons= t uint8_t *buf, rx_fifo_push(s, crc); } n =3D s->rx_status_fifo_head + s->rx_status_fifo_used; - if (n >=3D s->rx_status_fifo_size) { - n -=3D s->rx_status_fifo_size; + if (n >=3D s->rx_status_fifo_wordcount) { + n -=3D s->rx_status_fifo_wordcount; } s->rx_packet_size[s->rx_packet_size_tail] =3D fifo_len; s->rx_packet_size_tail =3D (s->rx_packet_size_tail + 1023) & 1023; @@ -732,8 +732,8 @@ static uint32_t rx_status_fifo_pop(lan9118_state *s) if (s->rx_status_fifo_used !=3D 0) { s->rx_status_fifo_used--; s->rx_status_fifo_head++; - if (s->rx_status_fifo_head >=3D s->rx_status_fifo_size) { - s->rx_status_fifo_head -=3D s->rx_status_fifo_size; + if (s->rx_status_fifo_head >=3D s->rx_status_fifo_wordcount) { + s->rx_status_fifo_head -=3D s->rx_status_fifo_wordcount; } /* ??? What value should be returned when the FIFO is empty? */ DPRINTF("RX status pop 0x%08x\n", val); --=20 2.41.0 From nobody Sat May 18 03:28:25 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=1712669999; cv=none; d=zohomail.com; s=zohoarc; b=X0GiG1Odpov23xTc+aOqy9VPyQltdhb5uHZfLRjeMPpD4nqm9S1vFeSpIVO7mDc1rIMJMhZe5LWrne5cleqQOBngRdUPGRBjQrAsoKboip7y/W5HIgOK7ebwGoCxxFVxrrVGVUa3s8zuVtgUdV1ACbLsiT6BAAAMU65LodWjqug= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712669999; 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=BUMgonNV5vOyAHp4tN1LAQ2kYLBDrcDQNXezZFX8ne0=; b=nipUGN3LDzHedMZ9sQaNc4t5Qu1+ew+cAzbce11dY5rK9mF3//qv5kBSswb6EJm9ekf6RIyP1J7UwAbuJ8Pn0kw/iLljpFHGbctJ3v4RpnDAq/feIWTHJhq5PCrRLrwVhQkbFWUn7XYF4tAJ1fOUAL3qqwZJKRU/X/Qo2LIpRbA= 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 1712669999987688.6949922887924; Tue, 9 Apr 2024 06:39:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruBhF-0007ZE-J1; Tue, 09 Apr 2024 09:39:33 -0400 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 1ruBgr-0006Y4-EJ for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:39:11 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruBgk-0008HD-Fh for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:39:04 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-41649860cecso17808135e9.0 for ; Tue, 09 Apr 2024 06:38:59 -0700 (PDT) Received: from m1x-phil.lan ([176.176.160.134]) by smtp.gmail.com with ESMTPSA id l15-20020a05600c4f0f00b004166b960469sm8107944wmq.38.2024.04.09.06.38.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 09 Apr 2024 06:38:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712669937; x=1713274737; 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=BUMgonNV5vOyAHp4tN1LAQ2kYLBDrcDQNXezZFX8ne0=; b=p8bOXGQOuKgwte04ATus/EVw/yQ8wfLPYg1GjcnVJd3+GjcPLpnm8AZkogpMZftjSv TaE4sTC3UlO1eGETwZXHrnbAv8EuRkVaWdznE3W7/NZurQ/AxZV6fSvdIIXYvL1WRUO+ cti/K5EMyN9PKd07mBXMRMDXHxOZNkBrc9w/7I08Y/IUN0E+tbPUwpz6c8Lkv1l4erc1 jEowID4GCAUByDorBWzW3tDK1PIMoRBPq+i3OHWA2pTT9QzNieohc0RzENySN2cDgFP0 ZJGx79+kzdd4RGi16AgR2XefcGwwLQII0extAW2wCIJYkQfis/K9IOQrbdgl1T72Btk1 nOkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712669937; x=1713274737; 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=BUMgonNV5vOyAHp4tN1LAQ2kYLBDrcDQNXezZFX8ne0=; b=JdsHfoHVmenzSDtRiFjMNhfPbORx0NG+88TruKVncStrAuMZZtw4riHxE3IywId4Km l7/zzFt8XhoaI+5GQbg0QuWvA5FLurmzyKcaYN2Lpg5Mj5kAfROjwGAfiqV1UGN0IGMm /dfYC55iOUG2i92irbvcVUyvRU/F44iDhZyhYgLwvGwOl13eYR7eWIZVqAn7dSjkim58 hVrdhDki42r7kP2yEPJXnHNHV0UdeCJivRf0ISBh4RH/zUMlzkdnirDTeYnaRPYsyiXy yLeWvUkMU5bSeXsWVU3UpLF2j3TIryUa7HgGBYr9crOPKekHq0ZBsUKvs3ncBov1S6Hk 4Qvg== X-Gm-Message-State: AOJu0YyU7L4Lw8m+lh6dgbgSSn5P2oW5Id1hj+8at4ZrH4PBORhKso8Y gPkd9m5WWXCwPDoDWhEYNOsBU9oRbblKQ3/KlIKtIuTtcddPhc+Kis/+SDmXPU2HoO4PHQKS+y/ h X-Google-Smtp-Source: AGHT+IFoWrIGHt2SW5wE8A9zU9OrOKW5/1vE7Nylo7hN6pKti2TH4DFlSQHg7tnkc/4J51ft3Omnng== X-Received: by 2002:a05:600c:1d81:b0:416:7b2c:df0f with SMTP id p1-20020a05600c1d8100b004167b2cdf0fmr4921965wms.7.1712669937543; Tue, 09 Apr 2024 06:38:57 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Chuhong Yuan , Jason Wang , Alexander Bulekov , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.1 v2 10/11] hw/net/lan9118: Use RX_DATA_FIFO_BYTES definition Date: Tue, 9 Apr 2024 15:37:59 +0200 Message-ID: <20240409133801.23503-11-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240409133801.23503-1-philmd@linaro.org> References: <20240409133801.23503-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::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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=ham 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: 1712670001867100003 rx_fifo[] is an array of words, rx_fifo_size is a word count. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/net/lan9118.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index 663776f575..56cc52d450 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -266,7 +266,7 @@ struct lan9118_state { int32_t rx_fifo_size; int32_t rx_fifo_used; int32_t rx_fifo_head; - uint32_t rx_fifo[3360]; + uint32_t rx_fifo[RX_DATA_FIFO_BYTES / 4]; int32_t rx_packet_size_head; int32_t rx_packet_size_tail; int32_t rx_packet_size[1024]; @@ -338,7 +338,9 @@ static const VMStateDescription vmstate_lan9118 =3D { VMSTATE_INT32(rx_fifo_size, lan9118_state), VMSTATE_INT32(rx_fifo_used, lan9118_state), VMSTATE_INT32(rx_fifo_head, lan9118_state), - VMSTATE_UINT32_ARRAY(rx_fifo, lan9118_state, 3360), + VMSTATE_UINT32_ARRAY(rx_fifo, lan9118_state, + RX_DATA_FIFO_BYTES / 4), + VMSTATE_UNUSED(3360 * 4 - RX_DATA_FIFO_BYTES), VMSTATE_INT32(rx_packet_size_head, lan9118_state), VMSTATE_INT32(rx_packet_size_tail, lan9118_state), VMSTATE_INT32_ARRAY(rx_packet_size, lan9118_state, 1024), @@ -460,7 +462,7 @@ static void lan9118_reset(DeviceState *d) s->txp->fifo_used =3D 0; s->tx_fifo_bytes =3D TX_DATA_FIFO_BYTES; s->tx_status_fifo_used =3D 0; - s->rx_fifo_size =3D 2640; + s->rx_fifo_size =3D RX_DATA_FIFO_BYTES / 4; s->rx_fifo_used =3D 0; s->rx_status_fifo_wordcount =3D RX_STATUS_FIFO_BYTES / 4; s->rx_status_fifo_used =3D 0; --=20 2.41.0 From nobody Sat May 18 03:28:25 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=1712670026; cv=none; d=zohomail.com; s=zohoarc; b=QetAfx/xVPEl7XOykbu5uWRSYKje3tFhnoo0/vD6gNZFdl7Xcmsnq7jFGBcGAxSBLexzeFwbaMfDHDVjXikslIuq9Tfbk6ZfZviKEI3U77as0naNzax+WjEZNbKNMGPBzB6OYWtOvHxHyj2u6c9dB+9GaUft1n5oIOn7yKLgT3I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712670026; 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=C1Zw+CVRCq/SOI5cLQNhCw7GlRbzROScTIFOWQl3mYw=; b=B353zt0G5Y7uEgnePj5mmAwsTwyrqAbTUtdWpJt2oXiPJ/iqvEDsSnXe9hgUklhHBhNg81ADawDTcBLMRxDYPyRMjmkIAMTWFxcQghMnXrLIJz35UvapDoQlGcUSEcw5ppj1GsS09cStUk+wxo/meciE+tgV73wmuwuOUThje1U= 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 1712670026967260.3944055114566; Tue, 9 Apr 2024 06:40:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruBhG-0007f3-6u; Tue, 09 Apr 2024 09:39:34 -0400 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 1ruBgt-0006d6-FZ for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:39:13 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruBgq-0008Jh-Rc for qemu-devel@nongnu.org; Tue, 09 Apr 2024 09:39:10 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-343bccc0b2cso4087158f8f.1 for ; Tue, 09 Apr 2024 06:39:04 -0700 (PDT) Received: from m1x-phil.lan ([176.176.160.134]) by smtp.gmail.com with ESMTPSA id k7-20020a5d5187000000b003434c764f01sm11479350wrv.107.2024.04.09.06.39.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 09 Apr 2024 06:39:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712669943; x=1713274743; 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=C1Zw+CVRCq/SOI5cLQNhCw7GlRbzROScTIFOWQl3mYw=; b=QDLRDwUt9F260+tAmYNolfScg60li8Hg55PKVdG0mGNsqfJdsCZ3EhL2EzRWmqJq2M R1lY3Z9ufDqcdj5Wa+ff64cqsDay+cmmHubcElOvq8UpXVOIAKxrRQ4VLIqR/Yy57F6n +OH+QVZUUDBcmTTjCeM3Rvy+kI9GXfnjOvnIEUonWKCn6Knu2sroQL4bvu3ijZbnfxyz 7uXtkkSVoxX94M/+EMLtWyI7ETpb5JdLxU1CgaVyNLMypuUJ1Li8fnEjFvyjL6uCFLz6 SP9g/kU5AzptsVKOGVyR5vO/CTmLek7e6Z9hkZqJGjr5SuY8A2ukznHdNdy6V5CsRtEC KtLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712669943; x=1713274743; 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=C1Zw+CVRCq/SOI5cLQNhCw7GlRbzROScTIFOWQl3mYw=; b=bF+MTTDY0jvwztw1C9FL3TMCVBFwtzql0uTQIJINiBmmgj358ow+EYzvvKbl6tXNlH n7BfJBsE65l2cIHdQE88C15Ae27GW7yMD9X6GgUc/4s2avHf3j1SZpfzzgHiq6c9ULY9 VzxY0TUXWn8283e6C4lsVHnmsf9SgJWNTYZTzT2by2nl7uCmnukg/R9ihM3iyv3hgWa0 I7ttUCLiGTKDY/lsy5/n1C6AYj8pxzSpk2q/7B1iED2kQzh/Vyf/exzLqIZ/wK9zYz5m wdCpRsa5brmZ26b6Z7q1CC5j5+lV5RVRA7SD43Bo5lMBa0HqUpSp8i46b6vxmcdZAmUW atFw== X-Gm-Message-State: AOJu0YxUe+r3JIP5RDI24qq3DoEVDQTiDGlK87BQYsCzdQOV4s8NRT9h mwNmWx3t3jHHK2BJD3arQitIo2mQUl4tOvEUA4g6kex7CBa9WMqizinLY4a9+wbNdZyUyBQsK3/ N X-Google-Smtp-Source: AGHT+IFqoIUE/M1R/hh7rdUjgXcFj4C4BeV8e717z8yEIhV19KziG+GNdIbdK7dfgdC9rxxwgqrv4Q== X-Received: by 2002:adf:e847:0:b0:343:dd56:b941 with SMTP id d7-20020adfe847000000b00343dd56b941mr8105877wrn.52.1712669942881; Tue, 09 Apr 2024 06:39:02 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Chuhong Yuan , Jason Wang , Alexander Bulekov , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PATCH-for-9.1 v2 11/11] hw/net/lan9118: Rename rx_fifo_size -> rx_fifo_wordcount Date: Tue, 9 Apr 2024 15:38:00 +0200 Message-ID: <20240409133801.23503-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240409133801.23503-1-philmd@linaro.org> References: <20240409133801.23503-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::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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: 1712670028236100007 rx_fifo_size is a word count, rename it to avoid confusion. Suggested-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/net/lan9118.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index 56cc52d450..3db6bae908 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -263,7 +263,7 @@ struct lan9118_state { int32_t rx_status_fifo_used; int32_t rx_status_fifo_head; uint32_t rx_status_fifo[RX_STATUS_FIFO_BYTES / 4]; - int32_t rx_fifo_size; + int32_t rx_fifo_wordcount; int32_t rx_fifo_used; int32_t rx_fifo_head; uint32_t rx_fifo[RX_DATA_FIFO_BYTES / 4]; @@ -335,7 +335,7 @@ static const VMStateDescription vmstate_lan9118 =3D { VMSTATE_UINT32_ARRAY(rx_status_fifo, lan9118_state, RX_STATUS_FIFO_BYTES / 4), VMSTATE_UNUSED(896 * 4 - RX_STATUS_FIFO_BYTES), - VMSTATE_INT32(rx_fifo_size, lan9118_state), + VMSTATE_INT32(rx_fifo_wordcount, lan9118_state), VMSTATE_INT32(rx_fifo_used, lan9118_state), VMSTATE_INT32(rx_fifo_head, lan9118_state), VMSTATE_UINT32_ARRAY(rx_fifo, lan9118_state, @@ -462,7 +462,7 @@ static void lan9118_reset(DeviceState *d) s->txp->fifo_used =3D 0; s->tx_fifo_bytes =3D TX_DATA_FIFO_BYTES; s->tx_status_fifo_used =3D 0; - s->rx_fifo_size =3D RX_DATA_FIFO_BYTES / 4; + s->rx_fifo_wordcount =3D RX_DATA_FIFO_BYTES / 4; s->rx_fifo_used =3D 0; s->rx_status_fifo_wordcount =3D RX_STATUS_FIFO_BYTES / 4; s->rx_status_fifo_used =3D 0; @@ -504,8 +504,9 @@ static void rx_fifo_push(lan9118_state *s, uint32_t val) { int fifo_pos; fifo_pos =3D s->rx_fifo_head + s->rx_fifo_used; - if (fifo_pos >=3D s->rx_fifo_size) - fifo_pos -=3D s->rx_fifo_size; + if (fifo_pos >=3D s->rx_fifo_wordcount) { + fifo_pos -=3D s->rx_fifo_wordcount; + } s->rx_fifo[fifo_pos] =3D val; s->rx_fifo_used++; } @@ -584,7 +585,7 @@ static ssize_t lan9118_receive(NetClientState *nc, cons= t uint8_t *buf, fifo_len =3D (size + n + 3) >> 2; /* Add a word for the CRC. */ fifo_len++; - if (s->rx_fifo_size - s->rx_fifo_used < fifo_len) { + if (s->rx_fifo_wordcount - s->rx_fifo_used < fifo_len) { return -1; } =20 @@ -672,8 +673,8 @@ static uint32_t rx_fifo_pop(lan9118_state *s) } else if (s->rxp_size > 0) { s->rxp_size--; val =3D s->rx_fifo[s->rx_fifo_head++]; - if (s->rx_fifo_head >=3D s->rx_fifo_size) { - s->rx_fifo_head -=3D s->rx_fifo_size; + if (s->rx_fifo_head >=3D s->rx_fifo_wordcount) { + s->rx_fifo_head -=3D s->rx_fifo_wordcount; } s->rx_fifo_used--; } else if (s->rxp_pad > 0) { @@ -1135,8 +1136,8 @@ static void lan9118_writel(void *opaque, hwaddr offse= t, s->rxp_offset =3D 0; } s->rx_fifo_head +=3D s->rxp_size; - if (s->rx_fifo_head >=3D s->rx_fifo_size) { - s->rx_fifo_head -=3D s->rx_fifo_size; + if (s->rx_fifo_head >=3D s->rx_fifo_wordcount) { + s->rx_fifo_head -=3D s->rx_fifo_wordcount; } } break; --=20 2.41.0