aboutsummaryrefslogtreecommitdiff
path: root/net.h
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-10-21 15:25:26 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-27 12:28:38 -0500
commited16ab5afae7f5b1be58764d0e1eae20ce48d9ad (patch)
tree019408b4c2286cab3f6720394666b64f9cde2fb2 /net.h
parent851bec091d70b839f07a5e0615c2e17c8cd12b58 (diff)
qdev/net: common nic property bits
Add a new type for properties common to all nics. Add helper functions and macros to deal with it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'net.h')
-rw-r--r--net.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/net.h b/net.h
index 6a24f5580d..f2d10f0c91 100644
--- a/net.h
+++ b/net.h
@@ -11,6 +11,19 @@ struct MACAddr {
uint8_t a[6];
};
+/* qdev nic properties */
+
+typedef struct NICConf {
+ MACAddr macaddr;
+ VLANState *vlan;
+ VLANClientState *peer;
+} NICConf;
+
+#define DEFINE_NIC_PROPERTIES(_state, _conf) \
+ DEFINE_PROP_MACADDR("mac", _state, _conf.macaddr), \
+ DEFINE_PROP_VLAN("vlan", _state, _conf.vlan), \
+ DEFINE_PROP_NETDEV("netdev", _state, _conf.peer)
+
/* VLANs support */
typedef int (NetCanReceive)(VLANClientState *);
@@ -158,5 +171,6 @@ VLANClientState *qdev_get_vlan_client(DeviceState *dev,
NetReceiveIOV *receive_iov,
NetCleanup *cleanup,
void *opaque);
+void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd);
#endif