[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] DEFINE_NIC_PROPERTIES in net.h
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] DEFINE_NIC_PROPERTIES in net.h |
Date: |
Mon, 04 Mar 2013 08:52:13 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) |
Phani Vadrevu <address@hidden> 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.