/* ASSERT(driver->OnLinkStatusChanged); */
/* Setup the dispatch table */
- driver->Base.OnDeviceAdd = netvsc_device_add;
- driver->Base.OnDeviceRemove = netvsc_device_remove;
- driver->Base.OnCleanup = netvsc_cleanup;
+ driver->base.OnDeviceAdd = netvsc_device_add;
+ driver->base.OnDeviceRemove = netvsc_device_remove;
+ driver->base.OnCleanup = netvsc_cleanup;
- driver->OnSend = netvsc_send;
+ driver->send = netvsc_send;
rndis_filter_init(driver);
return 0;
NETVSC_RECEIVE_PACKETLIST_COUNT, i);
break;
}
- list_add_tail(&packet->ListEntry,
+ list_add_tail(&packet->list_ent,
&net_device->ReceivePacketList);
}
net_device->ChannelInitEvent = osd_waitevent_create();
}
/* Open the channel */
- ret = vmbus_open(device->channel, net_driver->RingBufferSize,
- net_driver->RingBufferSize, NULL, 0,
+ ret = vmbus_open(device->channel, net_driver->ring_buf_size,
+ net_driver->ring_buf_size, NULL, 0,
netvsc_channel_cb, device);
if (ret != 0) {
list_for_each_entry_safe(packet, pos,
&net_device->ReceivePacketList,
- ListEntry) {
- list_del(&packet->ListEntry);
+ list_ent) {
+ list_del(&packet->list_ent);
kfree(packet);
}
/* Release all resources */
list_for_each_entry_safe(netvsc_packet, pos,
- &net_device->ReceivePacketList, ListEntry) {
- list_del(&netvsc_packet->ListEntry);
+ &net_device->ReceivePacketList, list_ent) {
+ list_del(&netvsc_packet->list_ent);
kfree(netvsc_packet);
}
/* ASSERT(nvscPacket); */
/* Notify the layer above us */
- nvsc_packet->Completion.Send.OnSendCompletion(
- nvsc_packet->Completion.Send.SendCompletionContext);
+ nvsc_packet->completion.send.send_completion(
+ nvsc_packet->completion.send.send_completion_ctx);
atomic_dec(&net_device->NumOutstandingSends);
} else {
}
sendMessage.Header.MessageType = NvspMessage1TypeSendRNDISPacket;
- if (packet->IsDataPacket) {
+ if (packet->is_data_pkt) {
/* 0 is RMC_DATA; */
sendMessage.Messages.Version1Messages.SendRNDISPacket.ChannelType = 0;
} else {
sendMessage.Messages.Version1Messages.SendRNDISPacket.SendBufferSectionIndex = 0xFFFFFFFF;
sendMessage.Messages.Version1Messages.SendRNDISPacket.SendBufferSectionSize = 0;
- if (packet->PageBufferCount) {
+ if (packet->page_buf_cnt) {
ret = vmbus_sendpacket_pagebuffer(device->channel,
- packet->PageBuffers,
- packet->PageBufferCount,
+ packet->page_buf,
+ packet->page_buf_cnt,
&sendMessage,
sizeof(struct nvsp_message),
(unsigned long)packet);
/* Remove the 1st packet to represent the xfer page packet itself */
xferpage_packet = (struct xferpage_packet *)listHead.next;
- list_del(&xferpage_packet->ListEntry);
+ list_del(&xferpage_packet->list_ent);
/* This is how much we can satisfy */
- xferpage_packet->Count = count - 1;
+ xferpage_packet->count = count - 1;
/* ASSERT(xferpagePacket->Count > 0 && xferpagePacket->Count <= */
/* vmxferpagePacket->RangeCount); */
- if (xferpage_packet->Count != vmxferpage_packet->RangeCount) {
+ if (xferpage_packet->count != vmxferpage_packet->RangeCount) {
DPRINT_INFO(NETVSC, "Needed %d netvsc pkts to satisy this xfer "
"page...got %d", vmxferpage_packet->RangeCount,
- xferpage_packet->Count);
+ xferpage_packet->count);
}
/* Each range represents 1 RNDIS pkt that contains 1 ethernet frame */
for (i = 0; i < (count - 1); i++) {
netvsc_packet = (struct hv_netvsc_packet *)listHead.next;
- list_del(&netvsc_packet->ListEntry);
+ list_del(&netvsc_packet->list_ent);
/* Initialize the netvsc packet */
- netvsc_packet->XferPagePacket = xferpage_packet;
- netvsc_packet->Completion.Recv.OnReceiveCompletion =
+ netvsc_packet->xfer_page_pkt = xferpage_packet;
+ netvsc_packet->completion.recv.recv_completion =
netvsc_receive_completion;
- netvsc_packet->Completion.Recv.ReceiveCompletionContext =
+ netvsc_packet->completion.recv.recv_completion_ctx =
netvsc_packet;
- netvsc_packet->Device = device;
+ netvsc_packet->device = device;
/* Save this so that we can send it back */
- netvsc_packet->Completion.Recv.ReceiveCompletionTid =
+ netvsc_packet->completion.recv.recv_completion_tid =
vmxferpage_packet->d.TransactionId;
- netvsc_packet->TotalDataBufferLength =
+ netvsc_packet->total_data_buflen =
vmxferpage_packet->Ranges[i].ByteCount;
- netvsc_packet->PageBufferCount = 1;
+ netvsc_packet->page_buf_cnt = 1;
/* ASSERT(vmxferpagePacket->Ranges[i].ByteOffset + */
/* vmxferpagePacket->Ranges[i].ByteCount < */
/* netDevice->ReceiveBufferSize); */
- netvsc_packet->PageBuffers[0].Length =
+ netvsc_packet->page_buf[0].Length =
vmxferpage_packet->Ranges[i].ByteCount;
start = virt_to_phys((void *)((unsigned long)net_device->
ReceiveBuffer + vmxferpage_packet->Ranges[i].ByteOffset));
- netvsc_packet->PageBuffers[0].Pfn = start >> PAGE_SHIFT;
+ netvsc_packet->page_buf[0].Pfn = start >> PAGE_SHIFT;
end_virtual = (unsigned long)net_device->ReceiveBuffer
+ vmxferpage_packet->Ranges[i].ByteOffset
+ vmxferpage_packet->Ranges[i].ByteCount - 1;
end = virt_to_phys((void *)end_virtual);
/* Calculate the page relative offset */
- netvsc_packet->PageBuffers[0].Offset =
+ netvsc_packet->page_buf[0].Offset =
vmxferpage_packet->Ranges[i].ByteOffset &
(PAGE_SIZE - 1);
if ((end >> PAGE_SHIFT) != (start >> PAGE_SHIFT)) {
/* Handle frame across multiple pages: */
- netvsc_packet->PageBuffers[0].Length =
- (netvsc_packet->PageBuffers[0].Pfn <<
+ netvsc_packet->page_buf[0].Length =
+ (netvsc_packet->page_buf[0].Pfn <<
PAGE_SHIFT)
+ PAGE_SIZE - start;
- bytes_remain = netvsc_packet->TotalDataBufferLength -
- netvsc_packet->PageBuffers[0].Length;
+ bytes_remain = netvsc_packet->total_data_buflen -
+ netvsc_packet->page_buf[0].Length;
for (j = 1; j < NETVSC_PACKET_MAXPAGE; j++) {
- netvsc_packet->PageBuffers[j].Offset = 0;
+ netvsc_packet->page_buf[j].Offset = 0;
if (bytes_remain <= PAGE_SIZE) {
- netvsc_packet->PageBuffers[j].Length =
+ netvsc_packet->page_buf[j].Length =
bytes_remain;
bytes_remain = 0;
} else {
- netvsc_packet->PageBuffers[j].Length =
+ netvsc_packet->page_buf[j].Length =
PAGE_SIZE;
bytes_remain -= PAGE_SIZE;
}
- netvsc_packet->PageBuffers[j].Pfn =
+ netvsc_packet->page_buf[j].Pfn =
virt_to_phys((void *)(end_virtual -
bytes_remain)) >> PAGE_SHIFT;
- netvsc_packet->PageBufferCount++;
+ netvsc_packet->page_buf_cnt++;
if (bytes_remain == 0)
break;
}
"(pfn %llx, offset %u, len %u)", i,
vmxferpage_packet->Ranges[i].ByteOffset,
vmxferpage_packet->Ranges[i].ByteCount,
- netvsc_packet->PageBuffers[0].Pfn,
- netvsc_packet->PageBuffers[0].Offset,
- netvsc_packet->PageBuffers[0].Length);
+ netvsc_packet->page_buf[0].Pfn,
+ netvsc_packet->page_buf[0].Offset,
+ netvsc_packet->page_buf[0].Length);
/* Pass it to the upper layer */
((struct netvsc_driver *)device->Driver)->
- OnReceiveCallback(device, netvsc_packet);
+ recv_cb(device, netvsc_packet);
netvsc_receive_completion(netvsc_packet->
- Completion.Recv.ReceiveCompletionContext);
+ completion.recv.recv_completion_ctx);
}
/* ASSERT(list_empty(&listHead)); */
static void netvsc_receive_completion(void *context)
{
struct hv_netvsc_packet *packet = context;
- struct hv_device *device = (struct hv_device *)packet->Device;
+ struct hv_device *device = (struct hv_device *)packet->device;
struct netvsc_device *net_device;
u64 transaction_id = 0;
bool fsend_receive_comp = false;
spin_lock_irqsave(&net_device->receive_packet_list_lock, flags);
/* ASSERT(packet->XferPagePacket->Count > 0); */
- packet->XferPagePacket->Count--;
+ packet->xfer_page_pkt->count--;
/*
* Last one in the line that represent 1 xfer page packet.
* Return the xfer page packet itself to the freelist
*/
- if (packet->XferPagePacket->Count == 0) {
+ if (packet->xfer_page_pkt->count == 0) {
fsend_receive_comp = true;
- transaction_id = packet->Completion.Recv.ReceiveCompletionTid;
- list_add_tail(&packet->XferPagePacket->ListEntry,
+ transaction_id = packet->completion.recv.recv_completion_tid;
+ list_add_tail(&packet->xfer_page_pkt->list_ent,
&net_device->ReceivePacketList);
}
/* Put the packet back */
- list_add_tail(&packet->ListEntry, &net_device->ReceivePacketList);
+ list_add_tail(&packet->list_ent, &net_device->ReceivePacketList);
spin_unlock_irqrestore(&net_device->receive_packet_list_lock, flags);
/* Send a receive completion for the xfer page packet */
/* Represent the xfer page packet which contains 1 or more netvsc packet */
struct xferpage_packet {
- struct list_head ListEntry;
+ struct list_head list_ent;
/* # of netvsc packets this xfer packet contains */
- u32 Count;
+ u32 count;
};
/* The number of pages which are enough to cover jumbo frame buffer. */
*/
struct hv_netvsc_packet {
/* Bookkeeping stuff */
- struct list_head ListEntry;
+ struct list_head list_ent;
- struct hv_device *Device;
- bool IsDataPacket;
+ struct hv_device *device;
+ bool is_data_pkt;
/*
* Valid only for receives when we break a xfer page packet
* into multiple netvsc packets
*/
- struct xferpage_packet *XferPagePacket;
+ struct xferpage_packet *xfer_page_pkt;
union {
struct{
- u64 ReceiveCompletionTid;
- void *ReceiveCompletionContext;
- void (*OnReceiveCompletion)(void *context);
- } Recv;
+ u64 recv_completion_tid;
+ void *recv_completion_ctx;
+ void (*recv_completion)(void *context);
+ } recv;
struct{
- u64 SendCompletionTid;
- void *SendCompletionContext;
- void (*OnSendCompletion)(void *context);
- } Send;
- } Completion;
+ u64 send_completion_tid;
+ void *send_completion_ctx;
+ void (*send_completion)(void *context);
+ } send;
+ } completion;
- /* This points to the memory after PageBuffers */
- void *Extension;
+ /* This points to the memory after page_buf */
+ void *extension;
- u32 TotalDataBufferLength;
+ u32 total_data_buflen;
/* Points to the send/receive buffer where the ethernet frame is */
- u32 PageBufferCount;
- struct hv_page_buffer PageBuffers[NETVSC_PACKET_MAXPAGE];
+ u32 page_buf_cnt;
+ struct hv_page_buffer page_buf[NETVSC_PACKET_MAXPAGE];
};
/* Represents the net vsc driver */
struct netvsc_driver {
/* Must be the first field */
/* Which is a bug FIXME! */
- struct hv_driver Base;
+ struct hv_driver base;
- u32 RingBufferSize;
- u32 RequestExtSize;
+ u32 ring_buf_size;
+ u32 req_ext_size;
/*
* This is set by the caller to allow us to callback when we
* receive a packet from the "wire"
*/
- int (*OnReceiveCallback)(struct hv_device *dev,
+ int (*recv_cb)(struct hv_device *dev,
struct hv_netvsc_packet *packet);
- void (*OnLinkStatusChanged)(struct hv_device *dev, u32 Status);
+ void (*link_status_change)(struct hv_device *dev, u32 Status);
/* Specific to this driver */
- int (*OnSend)(struct hv_device *dev, struct hv_netvsc_packet *packet);
+ int (*send)(struct hv_device *dev, struct hv_netvsc_packet *packet);
- void *Context;
+ void *ctx;
};
struct netvsc_device_info {
- unsigned char MacAddr[6];
- bool LinkState; /* 0 - link up, 1 - link down */
+ unsigned char mac_adr[6];
+ bool link_state; /* 0 - link up, 1 - link down */
};
/* Interface */
{
struct hv_netvsc_packet *packet = (struct hv_netvsc_packet *)context;
struct sk_buff *skb = (struct sk_buff *)
- (unsigned long)packet->Completion.Send.SendCompletionTid;
+ (unsigned long)packet->completion.send.send_completion_tid;
kfree(packet);
/* Allocate a netvsc packet based on # of frags. */
packet = kzalloc(sizeof(struct hv_netvsc_packet) +
(num_pages * sizeof(struct hv_page_buffer)) +
- net_drv_obj->RequestExtSize, GFP_ATOMIC);
+ net_drv_obj->req_ext_size, GFP_ATOMIC);
if (!packet) {
/* out of memory, silently drop packet */
DPRINT_ERR(NETVSC_DRV, "unable to allocate hv_netvsc_packet");
return NETDEV_TX_OK;
}
- packet->Extension = (void *)(unsigned long)packet +
+ packet->extension = (void *)(unsigned long)packet +
sizeof(struct hv_netvsc_packet) +
(num_pages * sizeof(struct hv_page_buffer));
/* Setup the rndis header */
- packet->PageBufferCount = num_pages;
+ packet->page_buf_cnt = num_pages;
/* TODO: Flush all write buffers/ memory fence ??? */
/* wmb(); */
/* Initialize it from the skb */
- packet->TotalDataBufferLength = skb->len;
+ packet->total_data_buflen = skb->len;
/* Start filling in the page buffers starting after RNDIS buffer. */
- packet->PageBuffers[1].Pfn = virt_to_phys(skb->data) >> PAGE_SHIFT;
- packet->PageBuffers[1].Offset
+ packet->page_buf[1].Pfn = virt_to_phys(skb->data) >> PAGE_SHIFT;
+ packet->page_buf[1].Offset
= (unsigned long)skb->data & (PAGE_SIZE - 1);
- packet->PageBuffers[1].Length = skb_headlen(skb);
+ packet->page_buf[1].Length = skb_headlen(skb);
/* Additional fragments are after SKB data */
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
skb_frag_t *f = &skb_shinfo(skb)->frags[i];
- packet->PageBuffers[i+2].Pfn = page_to_pfn(f->page);
- packet->PageBuffers[i+2].Offset = f->page_offset;
- packet->PageBuffers[i+2].Length = f->size;
+ packet->page_buf[i+2].Pfn = page_to_pfn(f->page);
+ packet->page_buf[i+2].Offset = f->page_offset;
+ packet->page_buf[i+2].Length = f->size;
}
/* Set the completion routine */
- packet->Completion.Send.OnSendCompletion = netvsc_xmit_completion;
- packet->Completion.Send.SendCompletionContext = packet;
- packet->Completion.Send.SendCompletionTid = (unsigned long)skb;
+ packet->completion.send.send_completion = netvsc_xmit_completion;
+ packet->completion.send.send_completion_ctx = packet;
+ packet->completion.send.send_completion_tid = (unsigned long)skb;
- ret = net_drv_obj->OnSend(&net_device_ctx->device_ctx->device_obj,
+ ret = net_drv_obj->send(&net_device_ctx->device_ctx->device_obj,
packet);
if (ret == 0) {
net->stats.tx_bytes += skb->len;
}
/* Allocate a skb - TODO direct I/O to pages? */
- skb = netdev_alloc_skb_ip_align(net, packet->TotalDataBufferLength);
+ skb = netdev_alloc_skb_ip_align(net, packet->total_data_buflen);
if (unlikely(!skb)) {
++net->stats.rx_dropped;
return 0;
* Copy to skb. This copy is needed here since the memory pointed by
* hv_netvsc_packet cannot be deallocated
*/
- for (i = 0; i < packet->PageBufferCount; i++) {
- data = kmap_atomic(pfn_to_page(packet->PageBuffers[i].Pfn),
+ for (i = 0; i < packet->page_buf_cnt; i++) {
+ data = kmap_atomic(pfn_to_page(packet->page_buf[i].Pfn),
KM_IRQ1);
data = (void *)(unsigned long)data +
- packet->PageBuffers[i].Offset;
+ packet->page_buf[i].Offset;
- memcpy(skb_put(skb, packet->PageBuffers[i].Length), data,
- packet->PageBuffers[i].Length);
+ memcpy(skb_put(skb, packet->page_buf[i].Length), data,
+ packet->page_buf[i].Length);
kunmap_atomic((void *)((unsigned long)data -
- packet->PageBuffers[i].Offset), KM_IRQ1);
+ packet->page_buf[i].Offset), KM_IRQ1);
}
local_irq_restore(flags);
struct netvsc_device_info device_info;
int ret;
- if (!net_drv_obj->Base.OnDeviceAdd)
+ if (!net_drv_obj->base.OnDeviceAdd)
return -1;
net = alloc_etherdev(sizeof(struct net_device_context));
dev_set_drvdata(device, net);
/* Notify the netvsc driver of the new device */
- ret = net_drv_obj->Base.OnDeviceAdd(device_obj, &device_info);
+ ret = net_drv_obj->base.OnDeviceAdd(device_obj, &device_info);
if (ret != 0) {
free_netdev(net);
dev_set_drvdata(device, NULL);
* out of sync with the device's link status
*/
if (!netif_carrier_ok(net))
- if (!device_info.LinkState)
+ if (!device_info.link_state)
netif_carrier_on(net);
- memcpy(net->dev_addr, device_info.MacAddr, ETH_ALEN);
+ memcpy(net->dev_addr, device_info.mac_adr, ETH_ALEN);
net->netdev_ops = &device_ops;
ret = register_netdev(net);
if (ret != 0) {
/* Remove the device and release the resource */
- net_drv_obj->Base.OnDeviceRemove(device_obj);
+ net_drv_obj->base.OnDeviceRemove(device_obj);
free_netdev(net);
}
return 0;
}
- if (!net_drv_obj->Base.OnDeviceRemove)
+ if (!net_drv_obj->base.OnDeviceRemove)
return -1;
/* Stop outbound asap */
* Call to the vsc driver to let it know that the device is being
* removed
*/
- ret = net_drv_obj->Base.OnDeviceRemove(device_obj);
+ ret = net_drv_obj->base.OnDeviceRemove(device_obj);
if (ret != 0) {
/* TODO: */
DPRINT_ERR(NETVSC, "unable to remove vsc device (ret %d)", ret);
device_unregister(current_dev);
}
- if (netvsc_drv_obj->Base.OnCleanup)
- netvsc_drv_obj->Base.OnCleanup(&netvsc_drv_obj->Base);
+ if (netvsc_drv_obj->base.OnCleanup)
+ netvsc_drv_obj->base.OnCleanup(&netvsc_drv_obj->base);
vmbus_child_driver_unregister(drv_ctx);
struct driver_context *drv_ctx = &g_netvsc_drv.drv_ctx;
int ret;
- net_drv_obj->RingBufferSize = ring_size * PAGE_SIZE;
- net_drv_obj->OnReceiveCallback = netvsc_recv_callback;
- net_drv_obj->OnLinkStatusChanged = netvsc_linkstatus_callback;
+ net_drv_obj->ring_buf_size = ring_size * PAGE_SIZE;
+ net_drv_obj->recv_cb = netvsc_recv_callback;
+ net_drv_obj->link_status_change = netvsc_linkstatus_callback;
/* Callback to client driver to complete the initialization */
- drv_init(&net_drv_obj->Base);
+ drv_init(&net_drv_obj->base);
- drv_ctx->driver.name = net_drv_obj->Base.name;
- memcpy(&drv_ctx->class_id, &net_drv_obj->Base.deviceType,
+ drv_ctx->driver.name = net_drv_obj->base.name;
+ memcpy(&drv_ctx->class_id, &net_drv_obj->base.deviceType,
sizeof(struct hv_guid));
drv_ctx->probe = netvsc_probe;
/* Setup the packet to send it */
packet = &req->pkt;
- packet->IsDataPacket = false;
- packet->TotalDataBufferLength = req->request_msg.MessageLength;
- packet->PageBufferCount = 1;
+ packet->is_data_pkt = false;
+ packet->total_data_buflen = req->request_msg.MessageLength;
+ packet->page_buf_cnt = 1;
- packet->PageBuffers[0].Pfn = virt_to_phys(&req->request_msg) >>
+ packet->page_buf[0].Pfn = virt_to_phys(&req->request_msg) >>
PAGE_SHIFT;
- packet->PageBuffers[0].Length = req->request_msg.MessageLength;
- packet->PageBuffers[0].Offset =
+ packet->page_buf[0].Length = req->request_msg.MessageLength;
+ packet->page_buf[0].Offset =
(unsigned long)&req->request_msg & (PAGE_SIZE - 1);
- packet->Completion.Send.SendCompletionContext = req;/* packet; */
- packet->Completion.Send.OnSendCompletion =
+ packet->completion.send.send_completion_ctx = req;/* packet; */
+ packet->completion.send.send_completion =
rndis_filter_send_request_completion;
- packet->Completion.Send.SendCompletionTid = (unsigned long)dev;
+ packet->completion.send.send_completion_tid = (unsigned long)dev;
- ret = rndis_filter.inner_drv.OnSend(dev->net_dev->Device, packet);
+ ret = rndis_filter.inner_drv.send(dev->net_dev->Device, packet);
return ret;
}
&resp->Message.IndicateStatus;
if (indicate->Status == RNDIS_STATUS_MEDIA_CONNECT) {
- rndis_filter.inner_drv.OnLinkStatusChanged(
+ rndis_filter.inner_drv.link_status_change(
dev->net_dev->Device, 1);
} else if (indicate->Status == RNDIS_STATUS_MEDIA_DISCONNECT) {
- rndis_filter.inner_drv.OnLinkStatusChanged(
+ rndis_filter.inner_drv.link_status_change(
dev->net_dev->Device, 0);
} else {
/*
/* Remove the rndis header and pass it back up the stack */
data_offset = RNDIS_HEADER_SIZE + rndis_pkt->DataOffset;
- pkt->TotalDataBufferLength -= data_offset;
- pkt->PageBuffers[0].Offset += data_offset;
- pkt->PageBuffers[0].Length -= data_offset;
+ pkt->total_data_buflen -= data_offset;
+ pkt->page_buf[0].Offset += data_offset;
+ pkt->page_buf[0].Length -= data_offset;
- pkt->IsDataPacket = true;
+ pkt->is_data_pkt = true;
- rndis_filter.inner_drv.OnReceiveCallback(dev->net_dev->Device,
+ rndis_filter.inner_drv.recv_cb(dev->net_dev->Device,
pkt);
}
}
rndis_hdr = (struct rndis_message *)kmap_atomic(
- pfn_to_page(pkt->PageBuffers[0].Pfn), KM_IRQ0);
+ pfn_to_page(pkt->page_buf[0].Pfn), KM_IRQ0);
rndis_hdr = (void *)((unsigned long)rndis_hdr +
- pkt->PageBuffers[0].Offset);
+ pkt->page_buf[0].Offset);
/* Make sure we got a valid rndis message */
/*
* range shows 52 bytes
* */
#if 0
- if (pkt->TotalDataBufferLength != rndis_hdr->MessageLength) {
- kunmap_atomic(rndis_hdr - pkt->PageBuffers[0].Offset,
+ if (pkt->total_data_buflen != rndis_hdr->MessageLength) {
+ kunmap_atomic(rndis_hdr - pkt->page_buf[0].Offset,
KM_IRQ0);
DPRINT_ERR(NETVSC, "invalid rndis message? (expected %u "
"bytes got %u)...dropping this message!",
rndis_hdr->MessageLength,
- pkt->TotalDataBufferLength);
+ pkt->total_data_buflen);
return -1;
}
#endif
sizeof(struct rndis_message) :
rndis_hdr->MessageLength);
- kunmap_atomic(rndis_hdr - pkt->PageBuffers[0].Offset, KM_IRQ0);
+ kunmap_atomic(rndis_hdr - pkt->page_buf[0].Offset, KM_IRQ0);
dump_rndis_message(&rndis_msg);
DPRINT_DBG(NETVSC, "sizeof(struct rndis_filter_packet) == %zd",
sizeof(struct rndis_filter_packet));
- drv->RequestExtSize = sizeof(struct rndis_filter_packet);
+ drv->req_ext_size = sizeof(struct rndis_filter_packet);
/* Driver->Context = rndisDriver; */
rndisDriver->OnLinkStatusChanged = Driver->OnLinkStatusChanged;*/
/* Save the original dispatch handlers before we override it */
- rndis_filter.inner_drv.Base.OnDeviceAdd = drv->Base.OnDeviceAdd;
- rndis_filter.inner_drv.Base.OnDeviceRemove =
- drv->Base.OnDeviceRemove;
- rndis_filter.inner_drv.Base.OnCleanup = drv->Base.OnCleanup;
+ rndis_filter.inner_drv.base.OnDeviceAdd = drv->base.OnDeviceAdd;
+ rndis_filter.inner_drv.base.OnDeviceRemove =
+ drv->base.OnDeviceRemove;
+ rndis_filter.inner_drv.base.OnCleanup = drv->base.OnCleanup;
/* ASSERT(Driver->OnSend); */
/* ASSERT(Driver->OnReceiveCallback); */
- rndis_filter.inner_drv.OnSend = drv->OnSend;
- rndis_filter.inner_drv.OnReceiveCallback = drv->OnReceiveCallback;
- rndis_filter.inner_drv.OnLinkStatusChanged =
- drv->OnLinkStatusChanged;
+ rndis_filter.inner_drv.send = drv->send;
+ rndis_filter.inner_drv.recv_cb = drv->recv_cb;
+ rndis_filter.inner_drv.link_status_change =
+ drv->link_status_change;
/* Override */
- drv->Base.OnDeviceAdd = rndis_filte_device_add;
- drv->Base.OnDeviceRemove = rndis_filter_device_remove;
- drv->Base.OnCleanup = rndis_filter_cleanup;
- drv->OnSend = rndis_filter_send;
+ drv->base.OnDeviceAdd = rndis_filte_device_add;
+ drv->base.OnDeviceRemove = rndis_filter_device_remove;
+ drv->base.OnCleanup = rndis_filter_cleanup;
+ drv->send = rndis_filter_send;
/* Driver->QueryLinkStatus = RndisFilterQueryDeviceLinkStatus; */
- drv->OnReceiveCallback = rndis_filter_receive;
+ drv->recv_cb = rndis_filter_receive;
return 0;
}
* NOTE! Once the channel is created, we may get a receive callback
* (RndisFilterOnReceive()) before this call is completed
*/
- ret = rndis_filter.inner_drv.Base.OnDeviceAdd(dev, additional_info);
+ ret = rndis_filter.inner_drv.base.OnDeviceAdd(dev, additional_info);
if (ret != 0) {
kfree(rndisDevice);
return ret;
DPRINT_INFO(NETVSC, "Device 0x%p mac addr %pM",
rndisDevice, rndisDevice->hw_mac_adr);
- memcpy(deviceInfo->MacAddr, rndisDevice->hw_mac_adr, ETH_ALEN);
+ memcpy(deviceInfo->mac_adr, rndisDevice->hw_mac_adr, ETH_ALEN);
rndis_filter_query_device_link_status(rndisDevice);
- deviceInfo->LinkState = rndisDevice->link_stat;
+ deviceInfo->link_state = rndisDevice->link_stat;
DPRINT_INFO(NETVSC, "Device 0x%p link state %s", rndisDevice,
- ((deviceInfo->LinkState) ? ("down") : ("up")));
+ ((deviceInfo->link_state) ? ("down") : ("up")));
return ret;
}
net_dev->Extension = NULL;
/* Pass control to inner driver to remove the device */
- rndis_filter.inner_drv.Base.OnDeviceRemove(dev);
+ rndis_filter.inner_drv.base.OnDeviceRemove(dev);
return 0;
}
u32 rndisMessageSize;
/* Add the rndis header */
- filterPacket = (struct rndis_filter_packet *)pkt->Extension;
+ filterPacket = (struct rndis_filter_packet *)pkt->extension;
/* ASSERT(filterPacket); */
memset(filterPacket, 0, sizeof(struct rndis_filter_packet));
rndisMessageSize = RNDIS_MESSAGE_SIZE(struct rndis_packet);
rndisMessage->NdisMessageType = REMOTE_NDIS_PACKET_MSG;
- rndisMessage->MessageLength = pkt->TotalDataBufferLength +
+ rndisMessage->MessageLength = pkt->total_data_buflen +
rndisMessageSize;
rndisPacket = &rndisMessage->Message.Packet;
rndisPacket->DataOffset = sizeof(struct rndis_packet);
- rndisPacket->DataLength = pkt->TotalDataBufferLength;
+ rndisPacket->DataLength = pkt->total_data_buflen;
- pkt->IsDataPacket = true;
- pkt->PageBuffers[0].Pfn = virt_to_phys(rndisMessage) >> PAGE_SHIFT;
- pkt->PageBuffers[0].Offset =
+ pkt->is_data_pkt = true;
+ pkt->page_buf[0].Pfn = virt_to_phys(rndisMessage) >> PAGE_SHIFT;
+ pkt->page_buf[0].Offset =
(unsigned long)rndisMessage & (PAGE_SIZE-1);
- pkt->PageBuffers[0].Length = rndisMessageSize;
+ pkt->page_buf[0].Length = rndisMessageSize;
/* Save the packet send completion and context */
- filterPacket->completion = pkt->Completion.Send.OnSendCompletion;
+ filterPacket->completion = pkt->completion.send.send_completion;
filterPacket->completion_ctx =
- pkt->Completion.Send.SendCompletionContext;
+ pkt->completion.send.send_completion_ctx;
/* Use ours */
- pkt->Completion.Send.OnSendCompletion = rndis_filter_send_completion;
- pkt->Completion.Send.SendCompletionContext = filterPacket;
+ pkt->completion.send.send_completion = rndis_filter_send_completion;
+ pkt->completion.send.send_completion_ctx = filterPacket;
- ret = rndis_filter.inner_drv.OnSend(dev, pkt);
+ ret = rndis_filter.inner_drv.send(dev, pkt);
if (ret != 0) {
/*
* Reset the completion to originals to allow retries from
* above
*/
- pkt->Completion.Send.OnSendCompletion =
+ pkt->completion.send.send_completion =
filterPacket->completion;
- pkt->Completion.Send.SendCompletionContext =
+ pkt->completion.send.send_completion_ctx =
filterPacket->completion_ctx;
}