summaryrefslogtreecommitdiff
path: root/sys/dev/pv/hyperv.c
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2016-08-05 18:05:45 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2016-08-05 18:05:45 +0000
commit048eeeea4355d96d76baa42b68fe9dc43dd50777 (patch)
tree3ed96f7d2f6fda15c16e3a6187fc76998db701e2 /sys/dev/pv/hyperv.c
parent037232ae422ad2e42ace830d4ff83a7ec3b89621 (diff)
Remove incorrect optimization: ring data portion size is not power of 2
Diffstat (limited to 'sys/dev/pv/hyperv.c')
-rw-r--r--sys/dev/pv/hyperv.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/pv/hyperv.c b/sys/dev/pv/hyperv.c
index ddd21e3aceb..b7970a092f1 100644
--- a/sys/dev/pv/hyperv.c
+++ b/sys/dev/pv/hyperv.c
@@ -1226,7 +1226,7 @@ hv_ring_put(struct hv_ring_data *wrd, uint8_t *data, uint32_t datalen)
memcpy(&wrd->rd_ring->buffer[wrd->rd_prod], data, left);
memcpy(&wrd->rd_ring->buffer[0], data + left, datalen - left);
wrd->rd_prod += datalen;
- wrd->rd_prod &= wrd->rd_data_size - 1;
+ wrd->rd_prod %= wrd->rd_data_size;
}
static inline void
@@ -1239,7 +1239,7 @@ hv_ring_get(struct hv_ring_data *rrd, uint8_t *data, uint32_t datalen,
memcpy(data + left, &rrd->rd_ring->buffer[0], datalen - left);
if (!peek) {
rrd->rd_cons += datalen;
- rrd->rd_cons &= rrd->rd_data_size - 1;
+ rrd->rd_cons %= rrd->rd_data_size;
}
}
@@ -1418,7 +1418,7 @@ hv_ring_read(struct hv_ring_data *rrd, void *data, uint32_t datalen,
if (offset) {
rrd->rd_cons += offset;
- rrd->rd_cons &= rrd->rd_data_size - 1;
+ rrd->rd_cons %= rrd->rd_data_size;
}
hv_ring_get(rrd, (uint8_t *)data, datalen, 0);