All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	qemu-trivial@nongnu.org, "Thomas Huth" <thuth@redhat.com>
Cc: qemu-devel@nongnu.org,
	Dmitry Fleytman <dmitry.fleytman@gmail.com>,
	Jason Wang <jasowang@redhat.com>,
	Beniamino Galvani <b.galvani@gmail.com>,
	"open list:Allwinner-a10" <qemu-arm@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v3 33/41] hw/net: Use the BYTE-based definitions
Date: Mon, 16 Apr 2018 07:23:33 +0200	[thread overview]
Message-ID: <f11c4eac-fcbf-0aa3-06bf-570ff57144c4@weilnetz.de> (raw)
In-Reply-To: <20180415234307.28132-34-f4bug@amsat.org>

Am 16.04.2018 um 01:42 schrieb Philippe Mathieu-Daudé:
> 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é <f4bug@amsat.org>
> ---
>  include/hw/net/allwinner_emac.h | 5 +++--
>  hw/net/e1000e.c                 | 7 ++++---
>  hw/net/e1000x_common.c          | 3 ++-
>  hw/net/eepro100.c               | 7 +++----
>  4 files changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/include/hw/net/allwinner_emac.h b/include/hw/net/allwinner_emac.h
> index 4cc8aab7ec..4b53b6485c 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 * K_BYTE)
> +#define RX_FIFO_SIZE        (32 * K_BYTE)
>  
>  #define NUM_TX_FIFOS        2
>  #define RX_HDR_SIZE         8
> diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
> index 16a9417a85..101efe7c83 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 * K_BYTE)
> +#define E1000E_FLASH_SIZE   (128 * K_BYTE)
>  #define E1000E_IO_SIZE      (32)
> -#define E1000E_MSIX_SIZE    (16 * 1024)
> +#define E1000E_MSIX_SIZE    (16 * K_BYTE)
>  
>  #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..58c8db77e9 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 * K_BYTE;
>  
>      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..a02e2b55e8 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
> @@ -104,9 +103,9 @@
>  /* Use 64 word EEPROM. TODO: could be a runtime option. */
>  #define EEPROM_SIZE     64
>  
> -#define PCI_MEM_SIZE            (4 * KiB)
> +#define PCI_MEM_SIZE            (4 * K_BYTE)
>  #define PCI_IO_SIZE             64
> -#define PCI_FLASH_SIZE          (128 * KiB)
> +#define PCI_FLASH_SIZE          (128 * K_BYTE)
>  
>  #define BITS(n, m) (((0xffffffffU << (31 - n)) >> (31 - n + m)) << m)


Technically this is fine, therefore

Reviewed-by: Stefan Weil <sw@weilnetz.de>

Practically I'd prefer replacing all K_BYTE by KiB, because that is the
standard name with a precise definition:
https://en.wikipedia.org/wiki/Kibibyte.

Stefan

  reply	other threads:[~2018-04-16  5:23 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-15 23:42 [Qemu-devel] [PATCH v3 00/41] hw: Use the BYTE-based definitions when useful Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 01/41] hw: Clean "hw/devices.h" includes Philippe Mathieu-Daudé
2018-04-16  4:53   ` Thomas Huth
2018-04-16 10:06     ` Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 02/41] hw: Do not include "sysemu/block-backend.h" if it is not necessary Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 03/41] hw/block/nvme: Include the "qemu/cutils.h" in the source file Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 04/41] hw/misc/mips_itu: Sort includes Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 05/41] hw/mips/r4k: Constify params_size Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 06/41] cutils: Extract byte-based definitions into a new header: "qemu/units.h" Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 07/41] hw/ivshmem: Use the BYTE-based definitions Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 08/41] hw/ipack: " Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 09/41] hw/scsi: " Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 10/41] hw/smbios: " Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 11/41] hw/xen: " Philippe Mathieu-Daudé
2018-04-15 23:42   ` Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 12/41] hw/tpm: " Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 13/41] hw/block: " Philippe Mathieu-Daudé
2018-04-15 23:42 ` [PATCH v3 14/41] hw/display: " Philippe Mathieu-Daudé
2018-04-16 20:58   ` [Qemu-devel] [Xen-devel] " Alistair Francis
2018-04-16 20:58     ` Alistair Francis
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 15/41] hw/misc: " Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 16/41] hw/riscv: " Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 17/41] hw/m68k: " Philippe Mathieu-Daudé
2018-04-16  4:58   ` Thomas Huth
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 18/41] hw/sparc: " Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 19/41] hw/s390x: " Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 20/41] hw/hppa: " Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 21/41] hw/xtensa: " Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 22/41] hw/alpha: " Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 23/41] hw/tricore: " Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 24/41] hw/microblaze: " Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 25/41] hw/nios2: " Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 26/41] hw/cris: " Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 27/41] hw/lm32: " Philippe Mathieu-Daudé
2018-04-16  6:40   ` Michael Walle
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 28/41] hw/sh4: " Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 29/41] hw/mips: " Philippe Mathieu-Daudé
2018-04-16 20:56   ` Alistair Francis
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 30/41] hw/arm: " Philippe Mathieu-Daudé
2018-04-15 23:42 ` [Qemu-devel] [PATCH v3 33/41] hw/net: " Philippe Mathieu-Daudé
2018-04-16  5:23   ` Stefan Weil [this message]
2018-04-17 16:09     ` Philippe Mathieu-Daudé
2018-04-15 23:43 ` [Qemu-devel] [PATCH v3 34/41] hw/usb: " Philippe Mathieu-Daudé
2018-04-16  8:03   ` Gerd Hoffmann
2018-04-15 23:43 ` [Qemu-devel] [PATCH v3 35/41] hw/sd: " Philippe Mathieu-Daudé
2018-04-15 23:43 ` [Qemu-devel] [PATCH v3 36/41] hw/vfio: " Philippe Mathieu-Daudé
2018-04-15 23:43 ` [Qemu-devel] [PATCH v3 37/41] hw/virtio: " Philippe Mathieu-Daudé
2018-04-15 23:43 ` [Qemu-devel] [PATCH v3 38/41] hw/rdma: " Philippe Mathieu-Daudé
2018-04-16  4:23   ` Marcel Apfelbaum
2018-04-21 17:55   ` Yuval Shaia
2018-04-15 23:43 ` [Qemu-devel] [PATCH v3 39/41] hw/nvdimm: " Philippe Mathieu-Daudé
2018-04-15 23:43 ` [Qemu-devel] [PATCH v3 40/41] hw/loader: " Philippe Mathieu-Daudé
2018-04-15 23:43 ` [Qemu-devel] [PATCH v3 41/41] cutils: Do not include "qemu/units.h" directly Philippe Mathieu-Daudé
2018-04-16  9:53   ` Marcel Apfelbaum
     [not found] ` <20180415234307.28132-33-f4bug@amsat.org>
2018-04-16  9:52   ` [Qemu-devel] [PATCH v3 32/41] hw/i386: Use the BYTE-based definitions Marcel Apfelbaum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f11c4eac-fcbf-0aa3-06bf-570ff57144c4@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=b.galvani@gmail.com \
    --cc=dmitry.fleytman@gmail.com \
    --cc=f4bug@amsat.org \
    --cc=jasowang@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.