[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/23] hw/net/e1000e_core: Use definition to avoid dynamic stack
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 09/23] hw/net/e1000e_core: Use definition to avoid dynamic stack allocation |
Date: |
Wed, 5 May 2021 23:10:33 +0200 |
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é <philmd@redhat.com>
---
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 b75f2ab8fc1..4b1d4521a50 100644
--- a/hw/net/e1000e_core.c
+++ b/hw/net/e1000e_core.c
@@ -1621,15 +1621,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;
--
2.26.3
- Re: [PATCH 07/23] hw/block/nvme: Use definition to avoid dynamic stack allocation, (continued)
- Re: [PATCH 07/23] hw/block/nvme: Use definition to avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- Re: [PATCH 07/23] hw/block/nvme: Use definition to avoid dynamic stack allocation, Eric Blake, 2021/05/05
- Re: [PATCH 07/23] hw/block/nvme: Use definition to avoid dynamic stack allocation, Warner Losh, 2021/05/05
- Re: [PATCH 07/23] hw/block/nvme: Use definition to avoid dynamic stack allocation, Keith Busch, 2021/05/05
- Re: [PATCH 07/23] hw/block/nvme: Use definition to avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/06
- Re: [PATCH 07/23] hw/block/nvme: Use definition to avoid dynamic stack allocation, Richard Henderson, 2021/05/07
- Re: [PATCH 07/23] hw/block/nvme: Use definition to avoid dynamic stack allocation, Klaus Jensen, 2021/05/06
- Re: [PATCH 07/23] hw/block/nvme: Use definition to avoid dynamic stack allocation, Richard Henderson, 2021/05/07
- [PATCH 08/23] hw/block/nvme: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 09/23] hw/net/e1000e_core: Use definition to avoid dynamic stack allocation,
Philippe Mathieu-Daudé <=
- [PATCH 10/23] hw/ppc/pnv: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 11/23] hw/intc/xics: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 12/23] hw/i386/multiboot: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05