All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabien Chouteau <chouteau@adacore.com>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, agraf@suse.de
Subject: Re: [Qemu-devel] [PATCH 2/2] Add Enhanced Three-Speed Ethernet Controller (eTSEC)
Date: Mon, 15 Jul 2013 16:23:32 +0200	[thread overview]
Message-ID: <51E405E4.7080406@adacore.com> (raw)
In-Reply-To: <CAEgOgz6FvZPB2ZTin3gxAPbvkNwTbQN-dXiOQfzN3LLAy46urQ@mail.gmail.com>

On 07/15/2013 04:00 AM, Peter Crosthwaite wrote:
> Hi Fabien,
> 

Hi Peter,

> On Thu, Jul 11, 2013 at 3:10 AM, Fabien Chouteau <chouteau@adacore.com> wrote:
>> +#ifdef DEBUG_REGISTER
>> +    printf("Write 0x%08x @ 0x" TARGET_FMT_plx" val:0x%08x->0x%08x : %s (%s)\n",
>> +           (unsigned int)value, addr, before, reg->value, reg->name, reg->desc);
> 
> Last I knew, printf was a bad idea for error messages due to monitor
> interference issue and nographic mode. But qemu_log or fprintf(stderr,
> are both better alternatives.
> 

Fixed.

>> +static int etsec_can_receive(NetClientState *nc)
>> +{
>> +    /* Yes we always can\ */
>> +    return 1;
> 
> As a general rule this is a bad idea. Multiple ethernet controllers in
> QEMU have tried this and had issues (particularly with the UBOOT
> bootloader) with mass packet droppage. But You have access to the
> information needed (the if conditions in rx_ring_write) to implement
> this it seems.
> 

Fixed.

>> +static int etsec_init(SysBusDevice *dev)
>> +{
>> +    eTSEC *etsec = FROM_SYSBUS(typeof(*etsec), dev);
> 
> Define and use QOM cast macros instead, FROM_FOO macros are deprecated.
> 

Something like:

#define TYPE_ETSEC_COMMON "eTSEC"
#define ETSEC_COMMON(obj) \
     OBJECT_CHECK(eTSEC, (obj), TYPE_ETSEC_COMMON)


static int etsec_init(SysBusDevice *dev)
{
    eTSEC *etsec = ETSEC_COMMON(dev);

?


>> +
>> +    memory_region_init_io(&etsec->io_area, OBJECT(etsec), &etsec_ops, etsec,
>> +                          "eTSEC", 0x1000);
> 
> Constant size memory_region_init_io should be migrated to the Object::Init fm.
> 

What is Object::Init()? Do you have an example?

>> +static void etsec_class_init(ObjectClass *klass, void *data)
>> +{
>> +    DeviceClass *dc = DEVICE_CLASS(klass);
>> +    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
>> +
>> +    k->init = etsec_init;
> 
> SysBusDevice::init in depracated. Please use Device::realize instead.
> 

Fixed.

>> +#define ACC_RW      1           /* Read/Write */
>> +#define ACC_RO      2           /* Read Only */
>> +#define ACC_WO      3           /* Write Only */
>> +#define ACC_w1c     4           /* Write 1 to clear */
> 
> ACC_W1C. Would it be cleaner with an enum instead?
> 
Fixed.

>> +#ifdef HEX_DUMP
>> +
>> +static void hex_dump(FILE *f, const uint8_t *buf, int size)
> 
> can you just use qemu_hexdump?
> 
> check util/hexdump.c
> 

Didn't know there was one. Fixed.

Thanks for the review.

-- 
Fabien Chouteau

  reply	other threads:[~2013-07-15 14:23 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10 17:10 [Qemu-devel] [PATCH 0/2] Enhanced Three Speed Ethernet Controller (eTSEC) Fabien Chouteau
2013-07-10 17:10 ` [Qemu-devel] [PATCH 1/2] Add be16_to_cpupu function Fabien Chouteau
2013-07-10 17:25   ` Peter Maydell
2013-07-12  9:57     ` Fabien Chouteau
2013-07-10 17:10 ` [Qemu-devel] [PATCH 2/2] Add Enhanced Three-Speed Ethernet Controller (eTSEC) Fabien Chouteau
     [not found]   ` <201307110955092430409@cn.fujitsu.com>
2013-07-15  1:25     ` [Qemu-devel] Fw: [PATCH 2/2] Add Enhanced Three-Speed EthernetController (eTSEC) Yao Xingtao
2013-07-15 10:19       ` Fabien Chouteau
2013-07-15  2:00   ` [Qemu-devel] [PATCH 2/2] Add Enhanced Three-Speed Ethernet Controller (eTSEC) Peter Crosthwaite
2013-07-15 14:23     ` Fabien Chouteau [this message]
2013-07-16  1:06       ` Peter Crosthwaite
2013-07-16  8:35         ` Fabien Chouteau
2013-07-16  2:06   ` [Qemu-devel] [Qemu-ppc] " Scott Wood
2013-07-16 15:28     ` Fabien Chouteau
2013-07-16 15:37       ` Alexander Graf
2013-07-16 16:15         ` Fabien Chouteau
2013-07-16 16:54           ` Scott Wood
2013-07-17  8:24             ` Fabien Chouteau
2013-07-17  8:29               ` Alexander Graf
2013-07-17 10:27                 ` Fabien Chouteau
2013-07-16 17:50       ` Scott Wood
2013-07-17 10:17         ` Fabien Chouteau
2013-07-17 10:22           ` Alexander Graf
2013-07-17 10:43             ` Fabien Chouteau
2013-07-17 21:02           ` Scott Wood
2013-07-18  9:27             ` Fabien Chouteau
2013-07-18 20:37               ` Scott Wood
2013-07-19  9:22                 ` Fabien Chouteau
2013-07-19 17:19                   ` Scott Wood
2013-07-22  9:00                     ` Fabien Chouteau

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=51E405E4.7080406@adacore.com \
    --to=chouteau@adacore.com \
    --cc=agraf@suse.de \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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.