#include "vmbus_private.h"
/* Internal routines */
-static int VmbusChannelCreateGpadlHeader(
+static int create_gpadl_header(
void *kbuffer, /* must be phys and virt contiguous */
u32 size, /* page-size multiple */
struct vmbus_channel_msginfo **msginfo,
u32 *messagecount);
-static void DumpVmbusChannel(struct vmbus_channel *channel);
-static void VmbusChannelSetEvent(struct vmbus_channel *channel);
+static void dump_vmbus_channel(struct vmbus_channel *channel);
+static void vmbus_setevent(struct vmbus_channel *channel);
#if 0
#endif
/*
- * VmbusChannelSetEvent - Trigger an event notification on the specified
+ * vmbus_setevent- Trigger an event notification on the specified
* channel.
*/
-static void VmbusChannelSetEvent(struct vmbus_channel *channel)
+static void vmbus_setevent(struct vmbus_channel *channel)
{
struct hv_monitor_page *monitorpage;
#endif
/*
- * VmbusChannelGetDebugInfo -Retrieve various channel debug info
+ * vmbus_get_debug_info -Retrieve various channel debug info
*/
-void VmbusChannelGetDebugInfo(struct vmbus_channel *channel,
+void vmbus_get_debug_info(struct vmbus_channel *channel,
struct vmbus_channel_debug_info *debuginfo)
{
struct hv_monitor_page *monitorpage;
}
/*
- * VmbusChannelOpen - Open the specified channel.
+ * vmbus_open - Open the specified channel.
*/
-int VmbusChannelOpen(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
+int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
u32 recv_ringbuffer_size, void *userdata, u32 userdatalen,
void (*onchannelcallback)(void *context), void *context)
{
newchannel->RingBufferGpadlHandle = 0;
- ret = VmbusChannelEstablishGpadl(newchannel,
+ ret = vmbus_establish_gpadl(newchannel,
newchannel->Outbound.RingBuffer,
send_ringbuffer_size +
recv_ringbuffer_size,
}
/*
- * DumpGpadlBody - Dump the gpadl body message to the console for
+ * dump_gpadl_body - Dump the gpadl body message to the console for
* debugging purposes.
*/
-static void DumpGpadlBody(struct vmbus_channel_gpadl_body *gpadl, u32 len)
+static void dump_gpadl_body(struct vmbus_channel_gpadl_body *gpadl, u32 len)
{
int i;
int pfncount;
}
/*
- * DumpGpadlHeader - Dump the gpadl header message to the console for
+ * dump_gpadl_header - Dump the gpadl header message to the console for
* debugging purposes.
*/
-static void DumpGpadlHeader(struct vmbus_channel_gpadl_header *gpadl)
+static void dump_gpadl_header(struct vmbus_channel_gpadl_header *gpadl)
{
int i, j;
int pagecount;
}
/*
- * VmbusChannelCreateGpadlHeader - Creates a gpadl for the specified buffer
+ * create_gpadl_header - Creates a gpadl for the specified buffer
*/
-static int VmbusChannelCreateGpadlHeader(void *kbuffer, u32 size,
+static int create_gpadl_header(void *kbuffer, u32 size,
struct vmbus_channel_msginfo **msginfo,
u32 *messagecount)
{
}
/*
- * VmbusChannelEstablishGpadl - Estabish a GPADL for the specified buffer
+ * vmbus_establish_gpadl - Estabish a GPADL for the specified buffer
*
* @channel: a channel
* @kbuffer: from kmalloc
* @size: page-size multiple
* @gpadl_handle: some funky thing
*/
-int VmbusChannelEstablishGpadl(struct vmbus_channel *channel, void *kbuffer,
+int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
u32 size, u32 *gpadl_handle)
{
struct vmbus_channel_gpadl_header *gpadlmsg;
next_gpadl_handle = atomic_read(&gVmbusConnection.NextGpadlHandle);
atomic_inc(&gVmbusConnection.NextGpadlHandle);
- ret = VmbusChannelCreateGpadlHeader(kbuffer, size, &msginfo, &msgcount);
+ ret = create_gpadl_header(kbuffer, size, &msginfo, &msgcount);
if (ret)
return ret;
gpadlmsg->ChildRelId = channel->OfferMsg.ChildRelId;
gpadlmsg->Gpadl = next_gpadl_handle;
- DumpGpadlHeader(gpadlmsg);
+ dump_gpadl_header(gpadlmsg);
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
list_add_tail(&msginfo->MsgListEntry,
submsginfo->MessageSize -
sizeof(*submsginfo));
- DumpGpadlBody(gpadl_body, submsginfo->MessageSize -
+ dump_gpadl_body(gpadl_body, submsginfo->MessageSize -
sizeof(*submsginfo));
ret = VmbusPostMessage(gpadl_body,
submsginfo->MessageSize -
}
/*
- * VmbusChannelTeardownGpadl -Teardown the specified GPADL handle
+ * vmbus_teardown_gpadl -Teardown the specified GPADL handle
*/
-int VmbusChannelTeardownGpadl(struct vmbus_channel *channel, u32 gpadl_handle)
+int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
{
struct vmbus_channel_gpadl_teardown *msg;
struct vmbus_channel_msginfo *info;
}
/*
- * VmbusChannelClose - Close the specified channel
+ * vmbus_close - Close the specified channel
*/
-void VmbusChannelClose(struct vmbus_channel *channel)
+void vmbus_close(struct vmbus_channel *channel)
{
struct vmbus_channel_close_channel *msg;
struct vmbus_channel_msginfo *info;
/* Tear down the gpadl for the channel's ring buffer */
if (channel->RingBufferGpadlHandle)
- VmbusChannelTeardownGpadl(channel,
+ vmbus_teardown_gpadl(channel,
channel->RingBufferGpadlHandle);
/* TODO: Send a msg to release the childRelId */
}
/**
- * VmbusChannelSendPacket() - Send the specified buffer on the given channel
+ * vmbus_sendpacket() - Send the specified buffer on the given channel
* @channel: Pointer to vmbus_channel structure.
* @buffer: Pointer to the buffer you want to receive the data into.
* @bufferlen: Maximum size of what the the buffer will hold
*
* Mainly used by Hyper-V drivers.
*/
-int VmbusChannelSendPacket(struct vmbus_channel *channel, const void *buffer,
+int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer,
u32 bufferlen, u64 requestid,
enum vmbus_packet_type type, u32 flags)
{
DPRINT_DBG(VMBUS, "channel %p buffer %p len %d",
channel, buffer, bufferlen);
- DumpVmbusChannel(channel);
+ dump_vmbus_channel(channel);
/* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */
/* TODO: We should determine if this is optional */
if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound))
- VmbusChannelSetEvent(channel);
+ vmbus_setevent(channel);
return ret;
}
-EXPORT_SYMBOL(VmbusChannelSendPacket);
+EXPORT_SYMBOL(vmbus_sendpacket);
/*
- * VmbusChannelSendPacketPageBuffer - Send a range of single-page buffer
+ * vmbus_sendpacket_pagebuffer - Send a range of single-page buffer
* packets using a GPADL Direct packet type.
*/
-int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *channel,
+int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
struct hv_page_buffer pagebuffers[],
u32 pagecount, void *buffer, u32 bufferlen,
u64 requestid)
if (pagecount > MAX_PAGE_BUFFER_COUNT)
return -EINVAL;
- DumpVmbusChannel(channel);
+ dump_vmbus_channel(channel);
/*
* Adjust the size down since vmbus_channel_packet_page_buffer is the
/* TODO: We should determine if this is optional */
if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound))
- VmbusChannelSetEvent(channel);
+ vmbus_setevent(channel);
return ret;
}
/*
- * VmbusChannelSendPacketMultiPageBuffer - Send a multi-page buffer packet
+ * vmbus_sendpacket_multipagebuffer - Send a multi-page buffer packet
* using a GPADL Direct packet type.
*/
-int VmbusChannelSendPacketMultiPageBuffer(struct vmbus_channel *channel,
+int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,
struct hv_multipage_buffer *multi_pagebuffer,
void *buffer, u32 bufferlen, u64 requestid)
{
u32 pfncount = NUM_PAGES_SPANNED(multi_pagebuffer->Offset,
multi_pagebuffer->Length);
- DumpVmbusChannel(channel);
+ dump_vmbus_channel(channel);
DPRINT_DBG(VMBUS, "data buffer - offset %u len %u pfn count %u",
multi_pagebuffer->Offset,
/* TODO: We should determine if this is optional */
if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound))
- VmbusChannelSetEvent(channel);
+ vmbus_setevent(channel);
return ret;
}
/**
- * VmbusChannelRecvPacket() - Retrieve the user packet on the specified channel
+ * vmbus_recvpacket() - Retrieve the user packet on the specified channel
* @channel: Pointer to vmbus_channel structure.
* @buffer: Pointer to the buffer you want to receive the data into.
* @bufferlen: Maximum size of what the the buffer will hold
*
* Mainly used by Hyper-V drivers.
*/
-int VmbusChannelRecvPacket(struct vmbus_channel *channel, void *buffer,
+int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer,
u32 bufferlen, u32 *buffer_actual_len, u64 *requestid)
{
struct vmpacket_descriptor desc;
return 0;
}
-EXPORT_SYMBOL(VmbusChannelRecvPacket);
+EXPORT_SYMBOL(vmbus_recvpacket);
/*
- * VmbusChannelRecvPacketRaw - Retrieve the raw packet on the specified channel
+ * vmbus_recvpacket_raw - Retrieve the raw packet on the specified channel
*/
-int VmbusChannelRecvPacketRaw(struct vmbus_channel *channel, void *buffer,
+int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer,
u32 bufferlen, u32 *buffer_actual_len,
u64 *requestid)
{
}
/*
- * VmbusChannelOnChannelEvent - Channel event callback
+ * vmbus_onchannel_event - Channel event callback
*/
-void VmbusChannelOnChannelEvent(struct vmbus_channel *channel)
+void vmbus_onchannel_event(struct vmbus_channel *channel)
{
- DumpVmbusChannel(channel);
+ dump_vmbus_channel(channel);
/* ASSERT(Channel->OnChannelCallback); */
channel->OnChannelCallback(channel->ChannelCallbackContext);
}
/*
- * VmbusChannelOnTimer - Timer event callback
+ * vmbus_ontimer - Timer event callback
*/
-void VmbusChannelOnTimer(unsigned long data)
+void vmbus_ontimer(unsigned long data)
{
struct vmbus_channel *channel = (struct vmbus_channel *)data;
}
/*
- * DumpVmbusChannel - Dump vmbus channel info to the console
+ * dump_vmbus_channel- Dump vmbus channel info to the console
*/
-static void DumpVmbusChannel(struct vmbus_channel *channel)
+static void dump_vmbus_channel(struct vmbus_channel *channel)
{
DPRINT_DBG(VMBUS, "Channel (%d)", channel->OfferMsg.ChildRelId);
DumpRingInfo(&channel->Outbound, "Outbound ");
} __attribute__((packed));
-extern int VmbusChannelOpen(struct vmbus_channel *channel,
- u32 SendRingBufferSize,
- u32 RecvRingBufferSize,
- void *UserData,
- u32 UserDataLen,
- void(*OnChannelCallback)(void *context),
- void *Context);
-
-extern void VmbusChannelClose(struct vmbus_channel *channel);
-
-extern int VmbusChannelSendPacket(struct vmbus_channel *channel,
- const void *Buffer,
- u32 BufferLen,
- u64 RequestId,
- enum vmbus_packet_type Type,
- u32 Flags);
-
-extern int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *channel,
- struct hv_page_buffer PageBuffers[],
- u32 PageCount,
- void *Buffer,
- u32 BufferLen,
- u64 RequestId);
-
-extern int VmbusChannelSendPacketMultiPageBuffer(struct vmbus_channel *channel,
+extern int vmbus_open(struct vmbus_channel *channel,
+ u32 send_ringbuffersize,
+ u32 recv_ringbuffersize,
+ void *userdata,
+ u32 userdatalen,
+ void(*onchannel_callback)(void *context),
+ void *context);
+
+extern void vmbus_close(struct vmbus_channel *channel);
+
+extern int vmbus_sendpacket(struct vmbus_channel *channel,
+ const void *buffer,
+ u32 bufferLen,
+ u64 requestid,
+ enum vmbus_packet_type type,
+ u32 flags);
+
+extern int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
+ struct hv_page_buffer pagebuffers[],
+ u32 pagecount,
+ void *buffer,
+ u32 bufferlen,
+ u64 requestid);
+
+extern int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,
struct hv_multipage_buffer *mpb,
- void *Buffer,
- u32 BufferLen,
- u64 RequestId);
+ void *buffer,
+ u32 bufferlen,
+ u64 requestid);
-extern int VmbusChannelEstablishGpadl(struct vmbus_channel *channel,
- void *Kbuffer,
- u32 Size,
- u32 *GpadlHandle);
+extern int vmbus_establish_gpadl(struct vmbus_channel *channel,
+ void *kbuffer,
+ u32 size,
+ u32 *gpadl_handle);
-extern int VmbusChannelTeardownGpadl(struct vmbus_channel *channel,
- u32 GpadlHandle);
+extern int vmbus_teardown_gpadl(struct vmbus_channel *channel,
+ u32 gpadl_handle);
-extern int VmbusChannelRecvPacket(struct vmbus_channel *channel,
- void *Buffer,
- u32 BufferLen,
- u32 *BufferActualLen,
- u64 *RequestId);
+extern int vmbus_recvpacket(struct vmbus_channel *channel,
+ void *buffer,
+ u32 bufferlen,
+ u32 *buffer_actual_len,
+ u64 *requestid);
-extern int VmbusChannelRecvPacketRaw(struct vmbus_channel *channel,
- void *Buffer,
- u32 BufferLen,
- u32 *BufferActualLen,
- u64 *RequestId);
+extern int vmbus_recvpacket_raw(struct vmbus_channel *channel,
+ void *buffer,
+ u32 bufferlen,
+ u32 *buffer_actual_len,
+ u64 *requestid);
-extern void VmbusChannelOnChannelEvent(struct vmbus_channel *channel);
+extern void vmbus_onchannel_event(struct vmbus_channel *channel);
-extern void VmbusChannelGetDebugInfo(struct vmbus_channel *channel,
+extern void vmbus_get_debug_info(struct vmbus_channel *channel,
struct vmbus_channel_debug_info *debug);
-extern void VmbusChannelOnTimer(unsigned long data);
+extern void vmbus_ontimer(unsigned long data);
#endif /* _CHANNEL_H_ */
void (*ChannelCallback)(void *context),
void *Context)
{
- return VmbusChannelOpen(device->context, SendBufferSize,
+ return vmbus_open(device->context, SendBufferSize,
RecvRingBufferSize, UserData, UserDataLen,
ChannelCallback, Context);
}
static void IVmbusChannelClose(struct hv_device *device)
{
- VmbusChannelClose(device->context);
+ vmbus_close(device->context);
}
static int IVmbusChannelSendPacket(struct hv_device *device, const void *Buffer,
u32 BufferLen, u64 RequestId, u32 Type,
u32 Flags)
{
- return VmbusChannelSendPacket(device->context, Buffer, BufferLen,
+ return vmbus_sendpacket(device->context, Buffer, BufferLen,
RequestId, Type, Flags);
}
u32 PageCount, void *Buffer,
u32 BufferLen, u64 RequestId)
{
- return VmbusChannelSendPacketPageBuffer(device->context, PageBuffers,
+ return vmbus_sendpacket_pagebuffer(device->context, PageBuffers,
PageCount, Buffer, BufferLen,
RequestId);
}
struct hv_multipage_buffer *MultiPageBuffer,
void *Buffer, u32 BufferLen, u64 RequestId)
{
- return VmbusChannelSendPacketMultiPageBuffer(device->context,
+ return vmbus_sendpacket_multipagebuffer(device->context,
MultiPageBuffer, Buffer,
BufferLen, RequestId);
}
u32 BufferLen, u32 *BufferActualLen,
u64 *RequestId)
{
- return VmbusChannelRecvPacket(device->context, Buffer, BufferLen,
+ return vmbus_recvpacket(device->context, Buffer, BufferLen,
BufferActualLen, RequestId);
}
u32 BufferLen, u32 *BufferActualLen,
u64 *RequestId)
{
- return VmbusChannelRecvPacketRaw(device->context, Buffer, BufferLen,
+ return vmbus_recvpacket_raw(device->context, Buffer, BufferLen,
BufferActualLen, RequestId);
}
static int IVmbusChannelEstablishGpadl(struct hv_device *device, void *Buffer,
u32 BufferLen, u32 *GpadlHandle)
{
- return VmbusChannelEstablishGpadl(device->context, Buffer, BufferLen,
+ return vmbus_establish_gpadl(device->context, Buffer, BufferLen,
GpadlHandle);
}
static int IVmbusChannelTeardownGpadl(struct hv_device *device, u32 GpadlHandle)
{
- return VmbusChannelTeardownGpadl(device->context, GpadlHandle);
+ return vmbus_teardown_gpadl(device->context, GpadlHandle);
}
if (!device->context)
return;
- VmbusChannelGetDebugInfo(device->context, &debugInfo);
+ vmbus_get_debug_info(device->context, &debugInfo);
info->ChannelId = debugInfo.RelId;
info->ChannelState = debugInfo.State;
buflen = PAGE_SIZE;
buf = kmalloc(buflen, GFP_ATOMIC);
- VmbusChannelRecvPacket(channel, buf, buflen, &recvlen, &requestid);
+ vmbus_recvpacket(channel, buf, buflen, &recvlen, &requestid);
if (recvlen > 0) {
DPRINT_DBG(VMBUS, "shutdown packet: len=%d, requestid=%lld",
icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION
| ICMSGHDRFLAG_RESPONSE;
- VmbusChannelSendPacket(channel, buf,
+ vmbus_sendpacket(channel, buf,
recvlen, requestid,
VmbusPacketTypeDataInBand, 0);
}
buflen = PAGE_SIZE;
buf = kmalloc(buflen, GFP_ATOMIC);
- VmbusChannelRecvPacket(channel, buf, buflen, &recvlen, &requestid);
+ vmbus_recvpacket(channel, buf, buflen, &recvlen, &requestid);
if (recvlen > 0) {
DPRINT_DBG(VMBUS, "timesync packet: recvlen=%d, requestid=%lld",
icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION
| ICMSGHDRFLAG_RESPONSE;
- VmbusChannelSendPacket(channel, buf,
+ vmbus_sendpacket(channel, buf,
recvlen, requestid,
VmbusPacketTypeDataInBand, 0);
}
buflen = PAGE_SIZE;
buf = kmalloc(buflen, GFP_ATOMIC);
- VmbusChannelRecvPacket(channel, buf, buflen, &recvlen, &requestid);
+ vmbus_recvpacket(channel, buf, buflen, &recvlen, &requestid);
if (recvlen > 0) {
DPRINT_DBG(VMBUS, "heartbeat packet: len=%d, requestid=%lld",
icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION
| ICMSGHDRFLAG_RESPONSE;
- VmbusChannelSendPacket(channel, buf,
+ vmbus_sendpacket(channel, buf,
recvlen, requestid,
VmbusPacketTypeDataInBand, 0);
}