From patchwork Mon Jun 11 01:14:55 2018 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: 927474 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="tgJ0OY23"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 413wdV6PQRz9rxs for ; Mon, 11 Jun 2018 11:38:22 +1000 (AEST) Received: from localhost ([::1]:45817 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSBmm-00063U-Dv for incoming@patchwork.ozlabs.org; Sun, 10 Jun 2018 21:38:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43509) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSBSa-00069B-8g for qemu-devel@nongnu.org; Sun, 10 Jun 2018 21:17:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSBSZ-0003dS-2P for qemu-devel@nongnu.org; Sun, 10 Jun 2018 21:17:28 -0400 Received: from mail-qt0-x242.google.com ([2607:f8b0:400d:c0d::242]:37948) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fSBSY-0003dF-UH; Sun, 10 Jun 2018 21:17:26 -0400 Received: by mail-qt0-x242.google.com with SMTP id x34-v6so18853109qtk.5; Sun, 10 Jun 2018 18:17:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+u7eVmCMl/jsq5lX+7UxkK/JlRcPLjDytDNK/TKLkMI=; b=tgJ0OY23sdXG/EV4/RCLhNhQPgkwR4UFH65rFasljy66b1ox0AOkS1a9oLIT+4sjp5 Ik5xvXmyX9T63gfNlR4HCstPozotZvbcIIgXTBtkKsA2VIPnEYOgtDI2MqwTUHT3FmUG hYw86z1e8b+85DD3JijmMJhY7ElyyFVioQuK9WbdabSUOoK6c/OiDIRQ+DNCPkky/MNa iR27i/fOek9xlBylnsb2PUy167B3XyZF5I1W5hq6HUhRoxpheeCwU9OavhzsmLQ9l4uU gWtZVq/za8kuP37JSNr2jvBXcD0YMLSLUQVcivVo0+4gNLlWBgM3qKiadBIVQ7VTxd9B QOuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=+u7eVmCMl/jsq5lX+7UxkK/JlRcPLjDytDNK/TKLkMI=; b=OVzWgKT26DIxk6GtTbV49seE5AOZVFoBGt90dKXDmGfZcUAx0CTyb9FEwWBrYq9OVQ lNkHTLW4iSmPauG32+RO6BhEyPcGxatAdlunNclTgwmkKAWs2Gb0AcG6p5HE3TNV9NVb oZUMDKv13K5xqgIt96nukj0kbhElVc3aHFWKGk0JZsI8aHaSgTuDrhnaHyp6126v/RFO je35+5qrHWJPy82o6Vrmj7Um7IRctb8nOncOBbrupRF6U9x4ZrQMkQW61fEpyHg10PzJ IdJMoRm+f8Z2kq0nA2EYG/BTLCQahwOBLYynGDkXcnM/JNZIMarQ/dWY7ZK6LSzonlXE lUWw== X-Gm-Message-State: APt69E0JceyE6Fj3AJcWlbHjRKSZt5cVokG1QCONQ/lUTrwT+/a+GSxN g0q+YSdKdc4AAqq9p6Ohxfs= X-Google-Smtp-Source: ADUXVKIz2+nJIq5N0Ijdp7hUQuEN8YtKWW7rRLeLt7mr0QJFo7lNLBe84hm9Mczk1ZK5KIxQeTzcjQ== X-Received: by 2002:ac8:2737:: with SMTP id g52-v6mr13874030qtg.168.1528679846284; Sun, 10 Jun 2018 18:17:26 -0700 (PDT) Received: from x1.local ([138.117.48.222]) by smtp.gmail.com with ESMTPSA id o5-v6sm28237223qtm.60.2018.06.10.18.17.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Jun 2018 18:17:25 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Thomas Huth , Stefan Weil Date: Sun, 10 Jun 2018 22:14:55 -0300 Message-Id: <20180611011501.10235-35-f4bug@amsat.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180611011501.10235-1-f4bug@amsat.org> References: <20180611011501.10235-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::242 Subject: [Qemu-devel] [PATCH v4 34/40] hw/net: Use the IEC binary prefix definitions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dmitry Fleytman , qemu-trivial@nongnu.org, Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, Beniamino Galvani , "open list:Allwinner-a10" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" It eases code review, unit is explicit. Patch generated using: $ git grep -E '(1024|2048|4096|8192|(<<|>>).?(10|20|30))' hw/ include/hw/ and modified manually. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Weil Reviewed-by: Stefan Weil --- hw/net/ne2000.h | 5 +++-- include/hw/net/allwinner_emac.h | 5 +++-- hw/net/e1000e.c | 7 ++++--- hw/net/e1000x_common.c | 3 ++- hw/net/eepro100.c | 3 +-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/hw/net/ne2000.h b/hw/net/ne2000.h index adb8021bd1..2cd193e4c6 100644 --- a/hw/net/ne2000.h +++ b/hw/net/ne2000.h @@ -1,11 +1,12 @@ #ifndef HW_NE2000_H #define HW_NE2000_H +#include "qemu/units.h" #include "hw/hw.h" #include "net/net.h" -#define NE2000_PMEM_SIZE (32*1024) -#define NE2000_PMEM_START (16*1024) +#define NE2000_PMEM_SIZE (32 * KiB) +#define NE2000_PMEM_START (16 * KiB) #define NE2000_PMEM_END (NE2000_PMEM_SIZE+NE2000_PMEM_START) #define NE2000_MEM_SIZE NE2000_PMEM_END diff --git a/include/hw/net/allwinner_emac.h b/include/hw/net/allwinner_emac.h index 4cc8aab7ec..905a43deb4 100644 --- a/include/hw/net/allwinner_emac.h +++ b/include/hw/net/allwinner_emac.h @@ -23,6 +23,7 @@ #ifndef ALLWINNER_EMAC_H #define ALLWINNER_EMAC_H +#include "qemu/units.h" #include "net/net.h" #include "qemu/fifo8.h" #include "hw/net/mii.h" @@ -125,8 +126,8 @@ #define EMAC_INT_RX (1 << 8) /* Due to lack of specifications, size of fifos is chosen arbitrarily */ -#define TX_FIFO_SIZE (4 * 1024) -#define RX_FIFO_SIZE (32 * 1024) +#define TX_FIFO_SIZE (4 * KiB) +#define RX_FIFO_SIZE (32 * KiB) #define NUM_TX_FIFOS 2 #define RX_HDR_SIZE 8 diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c index cda8d48333..510ddb3897 100644 --- a/hw/net/e1000e.c +++ b/hw/net/e1000e.c @@ -34,6 +34,7 @@ */ #include "qemu/osdep.h" +#include "qemu/units.h" #include "net/net.h" #include "net/tap.h" #include "qemu/range.h" @@ -81,10 +82,10 @@ typedef struct E1000EState { #define E1000E_IO_IDX 2 #define E1000E_MSIX_IDX 3 -#define E1000E_MMIO_SIZE (128 * 1024) -#define E1000E_FLASH_SIZE (128 * 1024) +#define E1000E_MMIO_SIZE (128 * KiB) +#define E1000E_FLASH_SIZE (128 * KiB) #define E1000E_IO_SIZE (32) -#define E1000E_MSIX_SIZE (16 * 1024) +#define E1000E_MSIX_SIZE (16 * KiB) #define E1000E_MSIX_TABLE (0x0000) #define E1000E_MSIX_PBA (0x2000) diff --git a/hw/net/e1000x_common.c b/hw/net/e1000x_common.c index eb0e097137..09047806f2 100644 --- a/hw/net/e1000x_common.c +++ b/hw/net/e1000x_common.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qemu/units.h" #include "hw/hw.h" #include "hw/pci/pci.h" #include "net/net.h" @@ -111,7 +112,7 @@ bool e1000x_is_oversized(uint32_t *mac, size_t size) static const int maximum_ethernet_vlan_size = 1522; /* this is the size past which hardware will drop packets when setting LPE=1 */ - static const int maximum_ethernet_lpe_size = 16384; + static const int maximum_ethernet_lpe_size = 16 * KiB; if ((size > maximum_ethernet_lpe_size || (size > maximum_ethernet_vlan_size diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index a07a63247e..e761daf551 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -41,6 +41,7 @@ */ #include "qemu/osdep.h" +#include "qemu/units.h" #include "hw/hw.h" #include "hw/pci/pci.h" #include "net/net.h" @@ -60,8 +61,6 @@ * changed to pad short packets itself. */ #define CONFIG_PAD_RECEIVED_FRAMES -#define KiB 1024 - /* Debug EEPRO100 card. */ #if 0 # define DEBUG_EEPRO100