int i, j;
int count = 0, bytes_remain = 0;
unsigned long flags;
+ struct netvsc_driver *netvsc_drv =
+ drv_to_netvscdrv(device->device.driver);
+
LIST_HEAD(listHead);
net_device = get_inbound_net_device(device);
}
/* Pass it to the upper layer */
- ((struct netvsc_driver *)device->drv)->
- recv_cb(device, netvsc_packet);
+ netvsc_drv->recv_cb(device, netvsc_packet);
netvsc_receive_completion(netvsc_packet->
completion.recv.recv_completion_ctx);
struct netvsc_device *net_device;
struct hv_netvsc_packet *packet, *pos;
struct netvsc_driver *net_driver =
- (struct netvsc_driver *)device->drv;
+ drv_to_netvscdrv(device->device.driver);
net_device = alloc_net_device(device);
if (!net_device) {
*/
int netvsc_initialize(struct hv_driver *drv)
{
- struct netvsc_driver *driver = (struct netvsc_driver *)drv;
+ struct netvsc_driver *driver =
+ drv_to_netvscdrv(&drv->driver);
drv->name = driver_name;
memcpy(&drv->dev_type, &netvsc_device_type, sizeof(struct hv_guid));
static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
{
struct net_device_context *net_device_ctx = netdev_priv(net);
- struct hv_driver *drv =
- drv_to_hv_drv(net_device_ctx->device_ctx->device.driver);
- struct netvsc_driver *net_drv_obj = drv->priv;
+ struct netvsc_driver *net_drv_obj =
+ drv_to_netvscdrv(net_device_ctx->device_ctx->device.driver);
struct hv_netvsc_packet *packet;
int ret;
unsigned int i, num_pages;
static int netvsc_probe(struct device *device)
{
- struct hv_driver *drv =
- drv_to_hv_drv(device->driver);
- struct netvsc_driver *net_drv_obj = drv->priv;
+ struct netvsc_driver *net_drv_obj =
+ drv_to_netvscdrv(device->driver);
struct hv_device *device_obj = device_to_hv_device(device);
struct net_device *net = NULL;
struct net_device_context *net_device_ctx;
static int netvsc_remove(struct device *device)
{
- struct hv_driver *drv =
- drv_to_hv_drv(device->driver);
- struct netvsc_driver *net_drv_obj = drv->priv;
+ struct netvsc_driver *net_drv_obj =
+ drv_to_netvscdrv(device->driver);
struct hv_device *device_obj = device_to_hv_device(device);
struct net_device *net = dev_get_drvdata(&device_obj->device);
int ret;
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;
- drv->priv = net_drv_obj;
/* Callback to client driver to complete the initialization */
drv_init(&net_drv_obj->base);