"zhun...@gmail.com" <zhun...@gmail.com> writes: > Hello,recently I study qemu source code ,and I have some questions ,can you > help me ? > >> 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. >> 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. >> 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.