hyperv/hn: Bring in shims from stable/10
This eases future MFCs to stable/10. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7871
This commit is contained in:
parent
170f6a6944
commit
fd9a262eae
@ -318,8 +318,12 @@ static int hn_lro_ackcnt_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
#endif
|
||||
static int hn_trust_hcsum_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
static int hn_chim_size_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
static int hn_rx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
#if __FreeBSD_version < 1100095
|
||||
static int hn_rx_stat_int_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
#else
|
||||
static int hn_rx_stat_u64_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
#endif
|
||||
static int hn_rx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
static int hn_tx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
static int hn_tx_conf_int_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
static int hn_ndis_version_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
@ -1866,32 +1870,33 @@ hn_chim_size_sysctl(SYSCTL_HANDLER_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if __FreeBSD_version < 1100095
|
||||
static int
|
||||
hn_rx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS)
|
||||
hn_rx_stat_int_sysctl(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
struct hn_softc *sc = arg1;
|
||||
int ofs = arg2, i, error;
|
||||
struct hn_rx_ring *rxr;
|
||||
u_long stat;
|
||||
uint64_t stat;
|
||||
|
||||
stat = 0;
|
||||
for (i = 0; i < sc->hn_rx_ring_inuse; ++i) {
|
||||
for (i = 0; i < sc->hn_rx_ring_cnt; ++i) {
|
||||
rxr = &sc->hn_rx_ring[i];
|
||||
stat += *((u_long *)((uint8_t *)rxr + ofs));
|
||||
stat += *((int *)((uint8_t *)rxr + ofs));
|
||||
}
|
||||
|
||||
error = sysctl_handle_long(oidp, &stat, 0, req);
|
||||
error = sysctl_handle_64(oidp, &stat, 0, req);
|
||||
if (error || req->newptr == NULL)
|
||||
return error;
|
||||
|
||||
/* Zero out this stat. */
|
||||
for (i = 0; i < sc->hn_rx_ring_inuse; ++i) {
|
||||
for (i = 0; i < sc->hn_rx_ring_cnt; ++i) {
|
||||
rxr = &sc->hn_rx_ring[i];
|
||||
*((u_long *)((uint8_t *)rxr + ofs)) = 0;
|
||||
*((int *)((uint8_t *)rxr + ofs)) = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
static int
|
||||
hn_rx_stat_u64_sysctl(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
@ -1918,6 +1923,34 @@ hn_rx_stat_u64_sysctl(SYSCTL_HANDLER_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int
|
||||
hn_rx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
struct hn_softc *sc = arg1;
|
||||
int ofs = arg2, i, error;
|
||||
struct hn_rx_ring *rxr;
|
||||
u_long stat;
|
||||
|
||||
stat = 0;
|
||||
for (i = 0; i < sc->hn_rx_ring_inuse; ++i) {
|
||||
rxr = &sc->hn_rx_ring[i];
|
||||
stat += *((u_long *)((uint8_t *)rxr + ofs));
|
||||
}
|
||||
|
||||
error = sysctl_handle_long(oidp, &stat, 0, req);
|
||||
if (error || req->newptr == NULL)
|
||||
return error;
|
||||
|
||||
/* Zero out this stat. */
|
||||
for (i = 0; i < sc->hn_rx_ring_inuse; ++i) {
|
||||
rxr = &sc->hn_rx_ring[i];
|
||||
*((u_long *)((uint8_t *)rxr + ofs)) = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
hn_tx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
@ -2168,11 +2201,21 @@ hn_create_rx_data(struct hn_softc *sc, int ring_cnt)
|
||||
SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "lro_queued",
|
||||
CTLTYPE_U64 | CTLFLAG_RW | CTLFLAG_MPSAFE, sc,
|
||||
__offsetof(struct hn_rx_ring, hn_lro.lro_queued),
|
||||
hn_rx_stat_u64_sysctl, "LU", "LRO queued");
|
||||
#if __FreeBSD_version < 1100095
|
||||
hn_rx_stat_int_sysctl,
|
||||
#else
|
||||
hn_rx_stat_u64_sysctl,
|
||||
#endif
|
||||
"LU", "LRO queued");
|
||||
SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "lro_flushed",
|
||||
CTLTYPE_U64 | CTLFLAG_RW | CTLFLAG_MPSAFE, sc,
|
||||
__offsetof(struct hn_rx_ring, hn_lro.lro_flushed),
|
||||
hn_rx_stat_u64_sysctl, "LU", "LRO flushed");
|
||||
#if __FreeBSD_version < 1100095
|
||||
hn_rx_stat_int_sysctl,
|
||||
#else
|
||||
hn_rx_stat_u64_sysctl,
|
||||
#endif
|
||||
"LU", "LRO flushed");
|
||||
SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "lro_tried",
|
||||
CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_MPSAFE, sc,
|
||||
__offsetof(struct hn_rx_ring, hn_lro_tried),
|
||||
|
Loading…
Reference in New Issue
Block a user