qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] DEFINE_NIC_PROPERTIES in net.h
@ 2013-03-04  0:53 Phani Vadrevu
  2013-03-04  1:27 ` Peter Maydell
  2013-03-04  7:52 ` Markus Armbruster
  0 siblings, 2 replies; 3+ messages in thread
From: Phani Vadrevu @ 2013-03-04  0:53 UTC (permalink / raw)
  To: qemu-devel

Hi list,
        I am trying to write a device emulator for a Broadcom card. As
reference, I am looking at e1000.c code of 1.2.2 version. In that
code, there is this line: DEFINE_NIC_PROPERTIES( E1000State, conf);

Is there a definite structure for the state object that is passed to
DEFINE_NIC_PROPERTIES? What does this function do? All I need is some
basic functioning code, so if this is not essential, I can ignore it.

Thanks,
Phani

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] DEFINE_NIC_PROPERTIES in net.h
  2013-03-04  0:53 [Qemu-devel] DEFINE_NIC_PROPERTIES in net.h Phani Vadrevu
@ 2013-03-04  1:27 ` Peter Maydell
  2013-03-04  7:52 ` Markus Armbruster
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2013-03-04  1:27 UTC (permalink / raw)
  To: Phani Vadrevu; +Cc: qemu-devel

On 4 March 2013 08:53, Phani Vadrevu <pvadrevu@gmail.com> wrote:
> Hi list,
>         I am trying to write a device emulator for a Broadcom card. As
> reference, I am looking at e1000.c code of 1.2.2 version.

Just a recommendation -- don't write new devices against old versions
of QEMU. There's been a lot of evolution in the best ways of writing
device models recently and you really need to be developing against
upstream git master.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] DEFINE_NIC_PROPERTIES in net.h
  2013-03-04  0:53 [Qemu-devel] DEFINE_NIC_PROPERTIES in net.h Phani Vadrevu
  2013-03-04  1:27 ` Peter Maydell
@ 2013-03-04  7:52 ` Markus Armbruster
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Armbruster @ 2013-03-04  7:52 UTC (permalink / raw)
  To: Phani Vadrevu; +Cc: qemu-devel

Phani Vadrevu <pvadrevu@gmail.com> writes:

> Hi list,
>         I am trying to write a device emulator for a Broadcom card. As
> reference, I am looking at e1000.c code of 1.2.2 version. In that
> code, there is this line: DEFINE_NIC_PROPERTIES( E1000State, conf);
>
> Is there a definite structure for the state object that is passed to
> DEFINE_NIC_PROPERTIES? What does this function do? All I need is some
> basic functioning code, so if this is not essential, I can ignore it.

Seconding Peter's advice to develop against current QEMU.

DEFINE_NIC_PROPERTIES() is still around, in include/net/net.h:

    typedef struct NICConf {
        MACAddr macaddr;
        NICPeers peers;
        int32_t bootindex;
        int32_t queues;
    } NICConf;

    #define DEFINE_NIC_PROPERTIES(_state, _conf)                            \
        DEFINE_PROP_MACADDR("mac",   _state, _conf.macaddr),                \
        DEFINE_PROP_VLAN("vlan",     _state, _conf.peers),                   \
        DEFINE_PROP_NETDEV("netdev", _state, _conf.peers),                   \
        DEFINE_PROP_INT32("bootindex", _state, _conf.bootindex, -1)

It's used like this (example taken from hw/e1000.c):

    static Property e1000_properties[] = {
        DEFINE_NIC_PROPERTIES(E1000State, conf),
        DEFINE_PROP_END_OF_LIST(),
    };

If you drilled down into the macros, you'd realize that this refers to
E1000State member conf, which is of type NICConf.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-04  9:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-04  0:53 [Qemu-devel] DEFINE_NIC_PROPERTIES in net.h Phani Vadrevu
2013-03-04  1:27 ` Peter Maydell
2013-03-04  7:52 ` Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).