From patchwork Mon Apr 8 10:51:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 786904 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp1277719wrw; Mon, 8 Apr 2024 03:53:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVtW3bRaShEdBUWTSA9beqzzAFRMwkRY9gI6iabFlmI9BpLDLHg6CAr7mE146eglC9bUucHJ51/dd+twx8iTL9B X-Google-Smtp-Source: AGHT+IFFfuQJWTzW4sJ2jdxVujSSva1CnrtRaTLDShF6JKwW4J4zodnuFL3xZygcFUDOnksIznUU X-Received: by 2002:a05:620a:45a4:b0:78d:6191:caae with SMTP id bp36-20020a05620a45a400b0078d6191caaemr4783123qkb.53.1712573593385; Mon, 08 Apr 2024 03:53:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712573593; cv=none; d=google.com; s=arc-20160816; b=D4VCnNbyMsf70jEQtQrN8d7y4Zlgg7KKoCbP4E6bUh/ZKS75MuoEKqQBFQqxIOcKTI A9GCd0uTlbasyg6d1GcTSit4qn2tB/G/kKS1sBs8Gv7ndgucedK1Gb0S6c38rHOxcj+r xUAMtftmEEpZwKChbJyv2SStg3ZcgohCpf1UiCKNLCU8P8JpYNmeMOcRXXU6YMKQwZd+ KnPYwEoRQ7DupRnUw2SApDZ0V1/rohNKjtgoHGfhLagiNZXhlhWViXhTbk8WTTDMf8Yh 9/dONTYdXq6vP/t3/7SG9Og5gG5Jc3UAMqw8X/QThx+zrL4mUu2mSubo8EIW0JLqO1l7 Jq4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MNFkEWahBP6+0XNPWOMbRiFKrOw7mESIctQanLUg3j4=; fh=CAGssEFmw6LP010SIsD0fdm4FJghmjrwGLNmpcJ91r4=; b=TF4mzZ13Z5sSFD/TeSGdcoyBMEi6qVxlK6o/ZJWaakAyWXfXhEvI3PCOGO5ExfXaIv tPm7d89r4583Joo55rf9uc7flgn6QeOvHDUkN/iDmJBOzJqgfUtaTDGDr3OaQoqBzpm2 w4eWl1o55cfwcGPUMjAF75XSQpg9yAkHTgKJLE+55YNXQWvNOvVC2rYvPgFjlgeNDiHw C24ccb3EeMsR8rb+DmKX/DILh+G81u+stIz8LvW5zO+ciuXBZGL/FZRsJ+PUucc3c3uN iOL2CwesJPl1FZvmn3/behwOKrucSFt+KrnzC7jMfhSEAwjNdWi7q7ZC4w7P06y7S2g+ AW9Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v7sk+vPQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id dt10-20020a05620a478a00b0078d5d0b8472si4606853qkb.700.2024.04.08.03.53.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 08 Apr 2024 03:53:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v7sk+vPQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtmbf-0002ra-BW; Mon, 08 Apr 2024 06:52:07 -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 1rtmba-0002qP-Jw for qemu-devel@nongnu.org; Mon, 08 Apr 2024 06:52:05 -0400 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rtmbY-0007r0-Dr for qemu-devel@nongnu.org; Mon, 08 Apr 2024 06:52:01 -0400 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2d6fc3adaacso54378891fa.2 for ; Mon, 08 Apr 2024 03:51:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712573518; x=1713178318; 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=MNFkEWahBP6+0XNPWOMbRiFKrOw7mESIctQanLUg3j4=; b=v7sk+vPQQqcBIBr9wBaYl8id6gWxDAMt2HxYjO7j0vHBY2ynPyXJsSLHr+bnvW1hsa 8xARVyNmH+c7KvYRgXFA+JSPVyCd4MXX0sJNJL6FpMek/zO9z3IM9xjDvilFX3kCVewp lT1bYwWI4M6uYzZAhdYYMySXBCtDg+1Q6/fyk+BodgVMDxAIRU+oQr12oE+6U7/0hiFa WEuJTacypyO8zYkgLvqcAO01uksNE0uHfjpwv/I/jJxhJj941zwSfrCxtc7/hDwuVSzM vErmfb3QlBLQmqW2OcRE4I0aNVeSc24lbNnrUWKA5IFVVZdfRG2HCtXhsMurz1hEx2c/ 7xRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712573518; x=1713178318; 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=MNFkEWahBP6+0XNPWOMbRiFKrOw7mESIctQanLUg3j4=; b=ejIAC/6JzpeVQW/bHGWuIrGK96Dj1DZyaiCJHNxQ/GP7yMBxG12BsKuWUNH+q7RKNJ xHRtWBCL+nneh5jtrvFMA6GlbXqyvsSDU0yjFfSB8BYSm7zoW2Bz40KD8r1lJb9DcID0 nm0f/SD+tPCK8YvYXUhZb0HFpa3l7WzhXNOsR0iH191nkCqiKlAQhJRgaj2QHdVSh1Hx WN2ZgMN70Rp+Shk4YkMsfXzRt7lXS4bHEQ+5g1D25iNNNZo+sMUXC0UPu68qrIFGenx7 +8YOxJYaqdhVRtXB+QeYjq1TIovwwasb+CQ9GsJguFqYKh7xiQJBZOn9DXX98OMHNf1j Popw== X-Gm-Message-State: AOJu0Yy33A85AjLg5uTMKAjB/z/cChGWy7OwTHUac8lgKniFkvNNYkkn MwrUrEYvZkBNdHic8W8VOM+QwugZFymmjN+ot2aAIjnIzVGarf1U9zPXcgxcCGdMdg8j0BwKQY8 H X-Received: by 2002:a05:6512:554:b0:513:da61:9b46 with SMTP id h20-20020a056512055400b00513da619b46mr5192172lfl.53.1712573518197; Mon, 08 Apr 2024 03:51:58 -0700 (PDT) Received: from m1x-phil.lan ([176.176.144.67]) by smtp.gmail.com with ESMTPSA id y13-20020a5d4acd000000b00343eac2acc4sm8044440wrs.111.2024.04.08.03.51.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 08 Apr 2024 03:51:57 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jason Wang , Alexander Bulekov , qemu-arm@nongnu.org, Chuhong Yuan , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.0? 1/2] hw/net/lan9118: Replace magic '2048' value by 'PKT_SIZE' definition Date: Mon, 8 Apr 2024 12:51:48 +0200 Message-ID: <20240408105149.59258-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240408105149.59258-1-philmd@linaro.org> References: <20240408105149.59258-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::235; envelope-from=philmd@linaro.org; helo=mail-lj1-x235.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell --- 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 47ff25b441..7be0430ac5 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -150,6 +150,8 @@ do { printf("lan9118: " fmt , ## __VA_ARGS__); } while (0) #define GPT_TIMER_EN 0x20000000 +#define PKT_SIZE 2048 + enum tx_state { TX_IDLE, TX_B, @@ -166,7 +168,7 @@ typedef struct { int32_t pad; int32_t fifo_used; int32_t len; - uint8_t data[2048]; + uint8_t data[PKT_SIZE]; } LAN9118Packet; static const VMStateDescription vmstate_lan9118_packet = { @@ -182,7 +184,7 @@ static const VMStateDescription vmstate_lan9118_packet = { VMSTATE_INT32(pad, LAN9118Packet), VMSTATE_INT32(fifo_used, LAN9118Packet), VMSTATE_INT32(len, LAN9118Packet), - VMSTATE_UINT8_ARRAY(data, LAN9118Packet, 2048), + VMSTATE_UINT8_ARRAY(data, LAN9118Packet, PKT_SIZE), VMSTATE_END_OF_LIST() } }; @@ -544,7 +546,7 @@ static ssize_t lan9118_receive(NetClientState *nc, const uint8_t *buf, return -1; } - if (size >= 2048 || size < 14) { + if (size >= PKT_SIZE || size < 14) { return -1; }