Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F154001280
D7423.id19061.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D7423.id19061.diff
View Options
Index: sys/dev/hyperv/utilities/hv_heartbeat.c
===================================================================
--- sys/dev/hyperv/utilities/hv_heartbeat.c
+++ sys/dev/hyperv/utilities/hv_heartbeat.c
@@ -64,7 +64,7 @@
softc = (hv_util_sc*)context;
buf = softc->receive_buffer;
- recvlen = PAGE_SIZE;
+ recvlen = softc->ic_buflen;
ret = vmbus_chan_recv(channel, buf, &recvlen, &requestid);
KASSERT(ret != ENOBUFS, ("hvheartbeat recvbuf is not large enough"));
/* XXX check recvlen to make sure that it contains enough data */
Index: sys/dev/hyperv/utilities/hv_kvp.c
===================================================================
--- sys/dev/hyperv/utilities/hv_kvp.c
+++ sys/dev/hyperv/utilities/hv_kvp.c
@@ -629,7 +629,7 @@
kvp_buf = sc->util_sc.receive_buffer;
channel = vmbus_get_channel(sc->dev);
- recvlen = 2 * PAGE_SIZE;
+ recvlen = sc->util_sc.ic_buflen;
ret = vmbus_chan_recv(channel, kvp_buf, &recvlen, &requestid);
KASSERT(ret != ENOBUFS, ("hvkvp recvbuf is not large enough"));
/* XXX check recvlen to make sure that it contains enough data */
@@ -696,7 +696,7 @@
/*
* Try reading next buffer
*/
- recvlen = 2 * PAGE_SIZE;
+ recvlen = sc->util_sc.ic_buflen;
ret = vmbus_chan_recv(channel, kvp_buf, &recvlen, &requestid);
KASSERT(ret != ENOBUFS, ("hvkvp recvbuf is not large enough"));
/* XXX check recvlen to make sure that it contains enough data */
Index: sys/dev/hyperv/utilities/hv_shutdown.c
===================================================================
--- sys/dev/hyperv/utilities/hv_shutdown.c
+++ sys/dev/hyperv/utilities/hv_shutdown.c
@@ -68,7 +68,7 @@
softc = (hv_util_sc*)context;
buf = softc->receive_buffer;
- recv_len = PAGE_SIZE;
+ recv_len = softc->ic_buflen;
ret = vmbus_chan_recv(channel, buf, &recv_len, &request_id);
KASSERT(ret != ENOBUFS, ("hvshutdown recvbuf is not large enough"));
/* XXX check recv_len to make sure that it contains enough data */
Index: sys/dev/hyperv/utilities/hv_timesync.c
===================================================================
--- sys/dev/hyperv/utilities/hv_timesync.c
+++ sys/dev/hyperv/utilities/hv_timesync.c
@@ -145,7 +145,7 @@
softc = (hv_timesync_sc*)context;
time_buf = softc->util_sc.receive_buffer;
- recvlen = PAGE_SIZE;
+ recvlen = softc->util_sc.ic_buflen;
ret = vmbus_chan_recv(channel, time_buf, &recvlen, &requestId);
KASSERT(ret != ENOBUFS, ("hvtimesync recvbuf is not large enough"));
/* XXX check recvlen to make sure that it contains enough data */
Index: sys/dev/hyperv/utilities/hv_util.h
===================================================================
--- sys/dev/hyperv/utilities/hv_util.h
+++ sys/dev/hyperv/utilities/hv_util.h
@@ -41,6 +41,7 @@
*/
void (*callback)(struct vmbus_channel *, void *);
uint8_t *receive_buffer;
+ int ic_buflen;
} hv_util_sc;
void hv_negotiate_version(struct hv_vmbus_icmsg_hdr *icmsghdrp, uint8_t *buf);
Index: sys/dev/hyperv/utilities/hv_util.c
===================================================================
--- sys/dev/hyperv/utilities/hv_util.c
+++ sys/dev/hyperv/utilities/hv_util.c
@@ -44,6 +44,8 @@
#include <dev/hyperv/utilities/hv_utilreg.h>
#include "hv_util.h"
+#define VMBUS_IC_BRSIZE (4 * PAGE_SIZE)
+
void
hv_negotiate_version(struct hv_vmbus_icmsg_hdr *icmsghdrp, uint8_t *buf)
{
@@ -75,14 +77,13 @@
int
hv_util_attach(device_t dev)
{
- struct hv_util_sc* softc;
- struct vmbus_channel *chan;
- int ret;
+ struct hv_util_sc *sc = device_get_softc(dev);
+ struct vmbus_channel *chan = vmbus_get_channel(dev);
+ int error;
- softc = device_get_softc(dev);
- softc->receive_buffer =
- malloc(4 * PAGE_SIZE, M_DEVBUF, M_WAITOK | M_ZERO);
- chan = vmbus_get_channel(dev);
+ sc->ic_buflen = VMBUS_IC_BRSIZE;
+ sc->receive_buffer = malloc(VMBUS_IC_BRSIZE, M_DEVBUF,
+ M_WAITOK | M_ZERO);
/*
* These services are not performance critical and do not need
@@ -93,17 +94,13 @@
*/
vmbus_chan_set_readbatch(chan, false);
- ret = vmbus_chan_open(chan, 4 * PAGE_SIZE, 4 * PAGE_SIZE, NULL, 0,
- softc->callback, softc);
-
- if (ret)
- goto error0;
-
+ error = vmbus_chan_open(chan, VMBUS_IC_BRSIZE, VMBUS_IC_BRSIZE, NULL, 0,
+ sc->callback, sc);
+ if (error) {
+ free(sc->receive_buffer, M_DEVBUF);
+ return (error);
+ }
return (0);
-
-error0:
- free(softc->receive_buffer, M_DEVBUF);
- return (ret);
}
int
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 26, 9:07 AM (2 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32177632
Default Alt Text
D7423.id19061.diff (4 KB)
Attached To
Mode
D7423: hyperv/ic: Expose the receive buffer length for callers to use.
Attached
Detach File
Event Timeline
Log In to Comment