net: Add a network device specific self-announcement ability
Some network devices have a capability to do self announcements (ex: virtio-net). Add infrastructure that would allow devices to expose this ability. Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
7659505c16
commit
44b416ad62
|
@ -60,6 +60,7 @@ typedef int (SetVnetLE)(NetClientState *, bool);
|
||||||
typedef int (SetVnetBE)(NetClientState *, bool);
|
typedef int (SetVnetBE)(NetClientState *, bool);
|
||||||
typedef struct SocketReadState SocketReadState;
|
typedef struct SocketReadState SocketReadState;
|
||||||
typedef void (SocketReadStateFinalize)(SocketReadState *rs);
|
typedef void (SocketReadStateFinalize)(SocketReadState *rs);
|
||||||
|
typedef void (NetAnnounce)(NetClientState *);
|
||||||
|
|
||||||
typedef struct NetClientInfo {
|
typedef struct NetClientInfo {
|
||||||
NetClientDriver type;
|
NetClientDriver type;
|
||||||
|
@ -80,6 +81,7 @@ typedef struct NetClientInfo {
|
||||||
SetVnetHdrLen *set_vnet_hdr_len;
|
SetVnetHdrLen *set_vnet_hdr_len;
|
||||||
SetVnetLE *set_vnet_le;
|
SetVnetLE *set_vnet_le;
|
||||||
SetVnetBE *set_vnet_be;
|
SetVnetBE *set_vnet_be;
|
||||||
|
NetAnnounce *announce;
|
||||||
} NetClientInfo;
|
} NetClientInfo;
|
||||||
|
|
||||||
struct NetClientState {
|
struct NetClientState {
|
||||||
|
|
|
@ -102,6 +102,11 @@ static void qemu_announce_self_iter(NICState *nic, void *opaque)
|
||||||
len = announce_self_create(buf, nic->conf->macaddr.a);
|
len = announce_self_create(buf, nic->conf->macaddr.a);
|
||||||
|
|
||||||
qemu_send_packet_raw(qemu_get_queue(nic), buf, len);
|
qemu_send_packet_raw(qemu_get_queue(nic), buf, len);
|
||||||
|
|
||||||
|
/* if the NIC provides it's own announcement support, use it as well */
|
||||||
|
if (nic->ncs->info->announce) {
|
||||||
|
nic->ncs->info->announce(nic->ncs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
static void qemu_announce_self_once(void *opaque)
|
static void qemu_announce_self_once(void *opaque)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue