From patchwork Thu Sep 22 16:35:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 608262 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp515450pvb; Thu, 22 Sep 2022 11:59:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5hXAWskzv9carIs/WsFat1bkmjjQ7nVaxThRtAqhu4NC22iqwkBb6jr8aw370InY6B/k+8 X-Received: by 2002:ac8:754c:0:b0:35c:caea:3e73 with SMTP id b12-20020ac8754c000000b0035ccaea3e73mr4188207qtr.504.1663873189233; Thu, 22 Sep 2022 11:59:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663873189; cv=none; d=google.com; s=arc-20160816; b=O085Xvay/BCB8cllFcoZMaU6KSYlNLhjmBQDDcicV+IgKAD/Uh+/xuSav4SouBJ+iW jzy+rOm1DNqEIEjwAXFaIWjEkxXyKc3PEpCik++58NA3IXEVPee6+Nv0PbLsKx2eOCOZ DmUeONXz86PJ9Y1ZcqxXxpuDRpdLPJUsqp0HvKzB2I4+Gw/zLWKnDXYUAwCeu9hT2Qyh xoMIGapFWMYJFSx6/8pST8G1aNoZf5JJnNK7gt0R6ls6lTmeUFrjLqqjxNogZB6ErM3x 6oLHmKgtvIs2QyCv03fGHesRZ7YiDoCRjQnR6NLI2ha+ShmMk81opiDOLoJRjWMbxpjx gk+w== 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:to:from :dkim-signature; bh=CiM/H1ZT11GJiU4qYe1Z3GEoKJxYHvPyHuyNl3EOOzE=; b=ymPrQyOre6TiDkGz6XUVpgW2/E+vHyFmVOhZ62fGGdbBo0oharblpk9PwbCoQ4jiyY MbeD+uVwuMLAXAcmaVeE8KfW8bnjpTF8d3jjscmrZ0tAkpF638T5HIbKX2P8akpXunsE bwFCwMQzhV0ST4aM598+rU5P4riuc+zu2Fp697vD6DprlufpD9h1FZlUt4StDPtPVILc 1MupEavGlNQdhugR79zqMzxoAcZsJrI9mouY6ar0cWmDDoeFlp/WEKsbNR9OOyf8yB3w y/uRAPRLpBjHmWP9dpXaGDnBOxUeAVevXszqO7bOS+nrnOMu5myO0QhCGOxtWWqr97Py v8pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ddwaR6VD; 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 10-20020ac8594a000000b0035cf798ddb9si4439623qtz.235.2022.09.22.11.59.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Sep 2022 11:59:49 -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=ddwaR6VD; 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]:46348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obRQK-0000EU-PI for patch@linaro.org; Thu, 22 Sep 2022 14:59:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obPBG-0002Dh-K2 for qemu-devel@nongnu.org; Thu, 22 Sep 2022 12:36:11 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:45700) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obPB9-0005Q7-Q2 for qemu-devel@nongnu.org; Thu, 22 Sep 2022 12:36:03 -0400 Received: by mail-wm1-x32c.google.com with SMTP id d12-20020a05600c3acc00b003b4c12e47f3so1703642wms.4 for ; Thu, 22 Sep 2022 09:35:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date; bh=CiM/H1ZT11GJiU4qYe1Z3GEoKJxYHvPyHuyNl3EOOzE=; b=ddwaR6VDQECPz2gmSi5yAAHXToTFhBHAMy/tPGSSJw26vPzI6km/jielm7QwW++DL2 wQi1+MEY/Lj/FxOSQQ45xr8s8zln+HaperzOee8QXbc31ZrRIYiGIfdc9kmWdSBJe69y 2HwjNzuxkA12fM+MbRAnB9NPIFK8Tz53aab28mCBHzmhy86GUp6Nzg5593NhKCiCxy/n EsSPnEyKv21i1aTLQUz3Y5CRMaEtBXXdjfHKeY6VeOFMSccUj9Rki8JnwOi9+kf/+AwC XMpaHaor/Ls4kkjT7QYSnFtM4ODxhCL09p0RcInw96fPaoNg1ax3aKpwfpJp/a7Rdw+r fOTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date; bh=CiM/H1ZT11GJiU4qYe1Z3GEoKJxYHvPyHuyNl3EOOzE=; b=4jKhjYPbqyiyTllqvwSmlLxafOTxsV9139jPdF3uBfeAFfvREYcEXVtBKsgdu5Yyra GWQ45l0bHVlP7bwkPCGKY7vzR7EVej1VfecsFkM1tY1vVj2PAK6WJx7os4Ffw8Sgxezp eNzoXO+Elq6mKP+fiSQrcR+KJRcx0VE+dKTCrZf0BOwl+uZQahscrpPYQ3kQA2ZMBhak D/pvfNRjFTKsGNVeJehkW08BhsSNtOiYPg8xAhdi1RJh9uUGXip1ve3nL1fHbAEh0KGe Hil/S7WzEMgMNQPZbwKPEu4bdLSDuy1rbVCUv/mJTFjBZElr7tUFa6C6/X6VNtIbMKne UQzQ== X-Gm-Message-State: ACrzQf1ycKfNTVg/yRvFueSxNJNct2P/lt0Jml84cHvEG69rU9PDRtXI 8HgBT0VLnKaJpZs2cdWTcSDF0cV98uCC+g== X-Received: by 2002:a05:600c:3c8a:b0:3b4:eff4:a94f with SMTP id bg10-20020a05600c3c8a00b003b4eff4a94fmr9553825wmb.105.1663864555423; Thu, 22 Sep 2022 09:35:55 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id iw1-20020a05600c54c100b003b3401f1e24sm6452599wmb.28.2022.09.22.09.35.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 09:35:55 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 26/39] hw/net/e1000e_core: Use definition to avoid dynamic stack allocation Date: Thu, 22 Sep 2022 17:35:23 +0100 Message-Id: <20220922163536.1096175-27-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922163536.1096175-1-peter.maydell@linaro.org> References: <20220922163536.1096175-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé The compiler isn't clever enough to figure 'min_buf_size' is a constant, so help it by using a definitions instead. Signed-off-by: Philippe Mathieu-Daudé Acked-by: Jason Wang Reviewed-by: Richard Henderson Signed-off-by: Peter Maydell Message-id: 20220819153931.3147384-6-peter.maydell@linaro.org --- hw/net/e1000e_core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index 208e3e0d798..82aa61fedcd 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -1622,15 +1622,16 @@ e1000e_rx_fix_l4_csum(E1000ECore *core, struct NetRxPkt *pkt) } } +/* Min. octets in an ethernet frame sans FCS */ +#define MIN_BUF_SIZE 60 + ssize_t e1000e_receive_iov(E1000ECore *core, const struct iovec *iov, int iovcnt) { static const int maximum_ethernet_hdr_len = (14 + 4); - /* Min. octets in an ethernet frame sans FCS */ - static const int min_buf_size = 60; uint32_t n = 0; - uint8_t min_buf[min_buf_size]; + uint8_t min_buf[MIN_BUF_SIZE]; struct iovec min_iov; uint8_t *filter_buf; size_t size, orig_size;