Phani Vadrevu <pvadr...@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.

Reply via email to