1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
/******************************************************************************
* xc_vif.c
*
* API for manipulating and accessing per-network-interface parameters.
*
* Copyright (c) 2003, K A Fraser.
*/
#include "xc_private.h"
int xc_vif_scheduler_set(int xc_handle,
unsigned int domid,
unsigned int vifid,
xc_vif_sched_params_t *params)
{
network_op_t netop;
netop.cmd = NETWORK_OP_VIFSETPARAMS;
netop.u.vif_setparams.domain = domid;
netop.u.vif_setparams.vif = vifid;
netop.u.vif_setparams.credit_bytes = params->credit_bytes;
netop.u.vif_setparams.credit_usec = params->credit_usec;
return do_network_op(xc_handle, &netop);
}
int xc_vif_scheduler_get(int xc_handle,
unsigned int domid,
unsigned int vifid,
xc_vif_sched_params_t *params)
{
network_op_t netop;
int rc;
netop.cmd = NETWORK_OP_VIFGETINFO;
netop.u.vif_getinfo.domain = domid;
netop.u.vif_getinfo.vif = vifid;
if ( (rc = do_network_op(xc_handle, &netop)) >= 0 )
{
params->credit_bytes = netop.u.vif_getinfo.credit_bytes;
params->credit_usec = netop.u.vif_getinfo.credit_usec;
}
return rc;
}
int xc_vif_stats_get(int xc_handle,
unsigned int domid,
unsigned int vifid,
xc_vif_stats_t *stats)
{
network_op_t netop;
int rc;
netop.cmd = NETWORK_OP_VIFGETINFO;
netop.u.vif_getinfo.domain = domid;
netop.u.vif_getinfo.vif = vifid;
if ( (rc = do_network_op(xc_handle, &netop)) >= 0 )
{
stats->tx_bytes = netop.u.vif_getinfo.total_bytes_sent;
stats->tx_pkts = netop.u.vif_getinfo.total_packets_sent;
stats->rx_bytes = netop.u.vif_getinfo.total_bytes_received;
stats->rx_pkts = netop.u.vif_getinfo.total_packets_received;
}
return rc;
}
|