diff options
author | David S. Miller <davem@davemloft.net> | 2011-01-24 21:17:06 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-24 21:17:06 (GMT) |
commit | e92427b289d252cfbd4cb5282d92f4ce1a5bb1fb (patch) | |
tree | 6d30e5e7b7f8e9aaa51d43b7128ac56860fa03bb /drivers/staging/hv/netvsc_drv.c | |
parent | c506653d35249bb4738bb139c24362e1ae724bc1 (diff) | |
parent | ec30f343d61391ab23705e50a525da1d55395780 (diff) | |
download | linux-fsl-qoriq-e92427b289d252cfbd4cb5282d92f4ce1a5bb1fb.tar.xz |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'drivers/staging/hv/netvsc_drv.c')
-rw-r--r-- | drivers/staging/hv/netvsc_drv.c | 83 |
1 files changed, 43 insertions, 40 deletions
diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c index 1415352..0147b40 100644 --- a/drivers/staging/hv/netvsc_drv.c +++ b/drivers/staging/hv/netvsc_drv.c @@ -66,6 +66,9 @@ MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)"); /* The one and only one */ static struct netvsc_driver_context g_netvsc_drv; +/* no-op so the netdev core doesn't return -EINVAL when modifying the the + * multicast address list in SIOCADDMULTI. hv is setup to get all multicast + * when it calls RndisFilterOnOpen() */ static void netvsc_set_multicast_list(struct net_device *net) { } @@ -78,7 +81,7 @@ static int netvsc_open(struct net_device *net) if (netif_carrier_ok(net)) { /* Open up the device */ - ret = RndisFilterOnOpen(device_obj); + ret = rndis_filter_open(device_obj); if (ret != 0) { DPRINT_ERR(NETVSC_DRV, "unable to open device (ret %d).", ret); @@ -101,7 +104,7 @@ static int netvsc_close(struct net_device *net) netif_stop_queue(net); - ret = RndisFilterOnClose(device_obj); + ret = rndis_filter_close(device_obj); if (ret != 0) DPRINT_ERR(NETVSC_DRV, "unable to close device (ret %d).", ret); @@ -112,7 +115,7 @@ static void netvsc_xmit_completion(void *context) { 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); @@ -151,7 +154,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) /* 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"); @@ -161,40 +164,40 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) 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; @@ -260,7 +263,7 @@ static int netvsc_recv_callback(struct hv_device *device_obj, } /* 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; @@ -273,17 +276,17 @@ static int netvsc_recv_callback(struct hv_device *device_obj, * 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); @@ -346,7 +349,7 @@ static int netvsc_probe(struct device *device) 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)); @@ -363,7 +366,7 @@ static int netvsc_probe(struct device *device) 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); @@ -382,10 +385,10 @@ static int netvsc_probe(struct device *device) * 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; @@ -398,7 +401,7 @@ static int netvsc_probe(struct device *device) 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); } @@ -422,7 +425,7 @@ static int netvsc_remove(struct device *device) return 0; } - if (!net_drv_obj->Base.OnDeviceRemove) + if (!net_drv_obj->base.OnDeviceRemove) return -1; /* Stop outbound asap */ @@ -435,7 +438,7 @@ static int netvsc_remove(struct device *device) * 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); @@ -481,8 +484,8 @@ static void netvsc_drv_exit(void) 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); @@ -495,15 +498,15 @@ static int netvsc_drv_init(int (*drv_init)(struct hv_driver *drv)) 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; @@ -536,7 +539,7 @@ static int __init netvsc_init(void) if (!dmi_check_system(hv_netvsc_dmi_table)) return -ENODEV; - return netvsc_drv_init(NetVscInitialize); + return netvsc_drv_init(netvsc_initialize); } static void __exit netvsc_exit(void) |