hyperv/hn: Don't abuse hn_{tx,rx}_ring_inuse.

Just in case, the # of TX/RX rings is changed upon synthetic parts
re-attach.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8520
This commit is contained in:
Sepherosa Ziehau 2016-11-21 05:54:31 +00:00
parent 7960e6ba99
commit a7ba764844

View File

@ -504,7 +504,7 @@ hn_set_lro_lenlim(struct hn_softc *sc, int lenlim)
{
int i;
for (i = 0; i < sc->hn_rx_ring_inuse; ++i)
for (i = 0; i < sc->hn_rx_ring_cnt; ++i)
sc->hn_rx_ring[i].hn_lro.lro_length_lim = lenlim;
}
#endif
@ -2554,7 +2554,7 @@ hn_lro_ackcnt_sysctl(SYSCTL_HANDLER_ARGS)
*/
--ackcnt;
HN_LOCK(sc);
for (i = 0; i < sc->hn_rx_ring_inuse; ++i)
for (i = 0; i < sc->hn_rx_ring_cnt; ++i)
sc->hn_rx_ring[i].hn_lro.lro_ackcnt_lim = ackcnt;
HN_UNLOCK(sc);
return 0;
@ -2578,7 +2578,7 @@ hn_trust_hcsum_sysctl(SYSCTL_HANDLER_ARGS)
return error;
HN_LOCK(sc);
for (i = 0; i < sc->hn_rx_ring_inuse; ++i) {
for (i = 0; i < sc->hn_rx_ring_cnt; ++i) {
struct hn_rx_ring *rxr = &sc->hn_rx_ring[i];
if (on)
@ -2646,7 +2646,7 @@ hn_rx_stat_u64_sysctl(SYSCTL_HANDLER_ARGS)
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 += *((uint64_t *)((uint8_t *)rxr + ofs));
}
@ -2656,7 +2656,7 @@ hn_rx_stat_u64_sysctl(SYSCTL_HANDLER_ARGS)
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];
*((uint64_t *)((uint8_t *)rxr + ofs)) = 0;
}
@ -2674,7 +2674,7 @@ hn_rx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS)
u_long 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));
}
@ -2684,7 +2684,7 @@ hn_rx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS)
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;
}
@ -2700,7 +2700,7 @@ hn_tx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS)
u_long stat;
stat = 0;
for (i = 0; i < sc->hn_tx_ring_inuse; ++i) {
for (i = 0; i < sc->hn_tx_ring_cnt; ++i) {
txr = &sc->hn_tx_ring[i];
stat += *((u_long *)((uint8_t *)txr + ofs));
}
@ -2710,7 +2710,7 @@ hn_tx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS)
return error;
/* Zero out this stat. */
for (i = 0; i < sc->hn_tx_ring_inuse; ++i) {
for (i = 0; i < sc->hn_tx_ring_cnt; ++i) {
txr = &sc->hn_tx_ring[i];
*((u_long *)((uint8_t *)txr + ofs)) = 0;
}
@ -2732,7 +2732,7 @@ hn_tx_conf_int_sysctl(SYSCTL_HANDLER_ARGS)
return error;
HN_LOCK(sc);
for (i = 0; i < sc->hn_tx_ring_inuse; ++i) {
for (i = 0; i < sc->hn_tx_ring_cnt; ++i) {
txr = &sc->hn_tx_ring[i];
*((int *)((uint8_t *)txr + ofs)) = conf;
}
@ -3603,7 +3603,7 @@ hn_set_chim_size(struct hn_softc *sc, int chim_size)
{
int i;
for (i = 0; i < sc->hn_tx_ring_inuse; ++i)
for (i = 0; i < sc->hn_tx_ring_cnt; ++i)
sc->hn_tx_ring[i].hn_chim_size = chim_size;
}