Skip to contentSkip to conversation

help!

Qemu-devel [email protected] 2 participants 2 messages Sep 28, 2016

lore
Share & tools
lore
#0 lore raw

Hello,recently I study qemu source code ,and I have some questions ,can you help me ?

Quoted 10 lines

1、what is the meaning of queues in structure NICConf ? I think it is the number of queues to a NIC,and I do not where it is. 2、In NICConf init Function,I do not found it initulize the queues of NICConf,relative code is

#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)

3、when new a NIC,I found conf->peers.ncs is a pointer which point a NetClientState array,I want to know what the array stand for?hub ports?

[email protected]

#1 lore raw
Quoted 3 lines · "[email protected]" <[email protected]> writes:

Hello,recently I study qemu source code ,and I have some questions ,can you help me ?

Quoted 1 line

1、what is the meaning of queues in structure NICConf ? I think it is the number of queues to a NIC,and I do not where it is.

NICConf captures some configuration information common to NIC devices. NIC device models typically embed it in their state struct, and use DEFINE_NIC_PROPERTIES() to declare the common qdev properties. For example, e1000.c has E1000State member NICConf conf, and uses DEFINE_NIC_PROPERTIES() in the initializer for its static array of qdev properties e1000_properties[]. This array gets passed to the qdev core, where it makes -device e1000,mac=... and so forth work.

Quoted 7 lines
Quoted 7 lines

2、In NICConf init Function,I do not found it initulize the queues of NICConf,relative code is

#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)

See above.

Quoted 1 line
Quoted 1 line

3、when new a NIC,I found conf->peers.ncs is a pointer which point a NetClientState array,I want to know what the array stand for?hub ports?

Queues. Easy enough to see: qemu_new_nic() uses this array in a counting loop running from 0 to queues - 1.

Note that NICPeers member ncs is an array of pointer to NetClientState, not a pointer to array of NetClientState.