2011-05-09 21:43:58

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 000/206] Staging: hv: Cleanup hv drivers

This patch-set deals with some of the architectural isues in all of
the Hyper-V drivers. Specifically:

1) Fixes a number of locking issues in the block driver.

2) Eliminates all the indirection through the hv_driver
abstraction.

3) Simplifies the code across the board eliminating
unnecessary code and data structure layering. Prior to
this restructuring there were about 11,000 lines of code
in the hv directory. After this cleanup, there are about
8500 lines of code.

4) I have dealt with style and naming issues across all the drivers.

5) All the header files have been cleaned up and consolidated:
1) A single header file include/linux/hyperv.h. This file
is to be included in all the drivers that attach to the
vmbus.

2) A single header file that has all the defines for building
the vmbus driver.
3) Consolidate header files for each device class -
disk and net.


Regads,

K. Y


2011-05-09 21:44:44

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 001/206] Staging: hv: Get rid of blkvsc_mutex

The blkvsc_mutex is unnecessary as the state it is protecting
(blkdev->users) is already protected by the spin lock.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index db44cf6..cfef1c0 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -27,7 +27,6 @@
#include <linux/major.h>
#include <linux/delay.h>
#include <linux/hdreg.h>
-#include <linux/mutex.h>
#include <linux/slab.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
@@ -113,8 +112,6 @@ struct block_device_context {
int users;
};

-static DEFINE_MUTEX(blkvsc_mutex);
-
static const char *g_blk_driver_name = "blkvsc";

/* {32412632-86cb-44a2-9b5c-50d1417354f5} */
@@ -620,7 +617,6 @@ static int blkvsc_release(struct gendisk *disk, fmode_t mode)
{
struct block_device_context *blkdev = disk->private_data;

- mutex_lock(&blkvsc_mutex);
spin_lock(&blkdev->lock);
if (blkdev->users == 1) {
spin_unlock(&blkdev->lock);
@@ -631,7 +627,6 @@ static int blkvsc_release(struct gendisk *disk, fmode_t mode)
blkdev->users--;

spin_unlock(&blkdev->lock);
- mutex_unlock(&blkvsc_mutex);
return 0;
}

--
1.7.4.1

2011-05-09 21:44:49

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 002/206] Staging: hv: Cleanup spin lock usage

This spin lock is potentially acquired from interrupt context.
Ensure that the interrupts are blocked whenever the lock is held.
The current code was not consistent with regards to blocking
interrupts - the same lock would be acquired without blocking
interrupts in some instance while the interrupts would be blocked
in other instances. Fix this potential deadlock problem.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index cfef1c0..74d51bb 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -249,12 +249,13 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
static int blkvsc_open(struct block_device *bdev, fmode_t mode)
{
struct block_device_context *blkdev = bdev->bd_disk->private_data;
+ unsigned long flags;

- spin_lock(&blkdev->lock);
+ spin_lock_irqsave(&blkdev->lock, flags);

blkdev->users++;

- spin_unlock(&blkdev->lock);
+ spin_unlock_irqrestore(&blkdev->lock, flags);

return 0;
}
@@ -616,17 +617,18 @@ static void blkvsc_shutdown(struct hv_device *dev)
static int blkvsc_release(struct gendisk *disk, fmode_t mode)
{
struct block_device_context *blkdev = disk->private_data;
+ unsigned long flags;

- spin_lock(&blkdev->lock);
+ spin_lock_irqsave(&blkdev->lock, flags);
if (blkdev->users == 1) {
- spin_unlock(&blkdev->lock);
+ spin_unlock_irqrestore(&blkdev->lock, flags);
blkvsc_do_operation(blkdev, DO_FLUSH);
- spin_lock(&blkdev->lock);
+ spin_lock_irqsave(&blkdev->lock, flags);
}

blkdev->users--;

- spin_unlock(&blkdev->lock);
+ spin_unlock_irqrestore(&blkdev->lock, flags);
return 0;
}

--
1.7.4.1

2011-05-09 21:44:46

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 003/206] Staging: hv: Fix some locking issues

Additional lock related cleanup. Properly serialize access to
state even for command related operations.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 31 +++++++++++++++----------------
1 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 74d51bb..8a577bc 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -331,10 +331,14 @@ static void blkvsc_cmd_completion(struct hv_storvsc_request *request)
(struct block_device_context *)blkvsc_req->dev;
struct scsi_sense_hdr sense_hdr;
struct vmscsi_request *vm_srb;
+ unsigned long flags;


vm_srb = &blkvsc_req->request.vstor_packet.vm_srb;
+
+ spin_lock_irqsave(&blkdev->lock, flags);
blkdev->num_outstanding_reqs--;
+ spin_unlock_irqrestore(&blkdev->lock, flags);

if (vm_srb->scsi_status)
if (scsi_normalize_sense(blkvsc_req->sense_buffer,
@@ -354,6 +358,7 @@ static int blkvsc_do_operation(struct block_device_context *blkdev,
unsigned char device_type;
struct scsi_sense_hdr sense_hdr;
struct vmscsi_request *vm_srb;
+ unsigned long flags;

int ret = 0;

@@ -407,7 +412,9 @@ static int blkvsc_do_operation(struct block_device_context *blkdev,
goto cleanup;
}

+ spin_lock_irqsave(&blkdev->lock, flags);
blkvsc_submit_request(blkvsc_req, blkvsc_cmd_completion);
+ spin_unlock_irqrestore(&blkdev->lock, flags);

wait_for_completion_interruptible(&blkvsc_req->request.wait_event);

@@ -555,6 +562,8 @@ static int blkvsc_remove(struct hv_device *dev)

blk_stop_queue(blkdev->gd->queue);

+ blkvsc_cancel_pending_reqs(blkdev);
+
spin_unlock_irqrestore(&blkdev->lock, flags);

while (blkdev->num_outstanding_reqs) {
@@ -563,13 +572,8 @@ static int blkvsc_remove(struct hv_device *dev)
udelay(100);
}

- blkvsc_do_operation(blkdev, DO_FLUSH);
-
- spin_lock_irqsave(&blkdev->lock, flags);

- blkvsc_cancel_pending_reqs(blkdev);
-
- spin_unlock_irqrestore(&blkdev->lock, flags);
+ blkvsc_do_operation(blkdev, DO_FLUSH);

blk_cleanup_queue(blkdev->gd->queue);

@@ -597,6 +601,8 @@ static void blkvsc_shutdown(struct hv_device *dev)

blk_stop_queue(blkdev->gd->queue);

+ blkvsc_cancel_pending_reqs(blkdev);
+
spin_unlock_irqrestore(&blkdev->lock, flags);

while (blkdev->num_outstanding_reqs) {
@@ -605,13 +611,9 @@ static void blkvsc_shutdown(struct hv_device *dev)
udelay(100);
}

- blkvsc_do_operation(blkdev, DO_FLUSH);

- spin_lock_irqsave(&blkdev->lock, flags);
-
- blkvsc_cancel_pending_reqs(blkdev);
+ blkvsc_do_operation(blkdev, DO_FLUSH);

- spin_unlock_irqrestore(&blkdev->lock, flags);
}

static int blkvsc_release(struct gendisk *disk, fmode_t mode)
@@ -619,16 +621,14 @@ static int blkvsc_release(struct gendisk *disk, fmode_t mode)
struct block_device_context *blkdev = disk->private_data;
unsigned long flags;

- spin_lock_irqsave(&blkdev->lock, flags);
if (blkdev->users == 1) {
- spin_unlock_irqrestore(&blkdev->lock, flags);
blkvsc_do_operation(blkdev, DO_FLUSH);
- spin_lock_irqsave(&blkdev->lock, flags);
}

+ spin_lock_irqsave(&blkdev->lock, flags);
blkdev->users--;
-
spin_unlock_irqrestore(&blkdev->lock, flags);
+
return 0;
}

@@ -943,7 +943,6 @@ static int blkvsc_probe(struct hv_device *dev)
struct storvsc_major_info major_info;
int ret = 0;

-
blkdev = kzalloc(sizeof(struct block_device_context), GFP_KERNEL);
if (!blkdev) {
ret = -ENOMEM;
--
1.7.4.1

2011-05-09 22:01:36

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 004/206] Staging: hv: Rename driver name variable

Rename the variable g_blk_driver_name.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 8a577bc..b54130b 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -112,7 +112,7 @@ struct block_device_context {
int users;
};

-static const char *g_blk_driver_name = "blkvsc";
+static const char *drv_name = "blkvsc";

/* {32412632-86cb-44a2-9b5c-50d1417354f5} */
static const struct hv_guid g_blk_device_type = {
@@ -177,7 +177,7 @@ static int blk_vsc_initialize(struct hv_driver *driver)

/* Make sure we are at least 2 pages since 1 page is used for control */

- driver->name = g_blk_driver_name;
+ driver->name = drv_name;
memcpy(&driver->dev_type, &g_blk_device_type, sizeof(struct hv_guid));


--
1.7.4.1

2011-05-09 21:44:51

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 005/206] Staging: hv: Rename the device type variable

Rename the variable g_blk_device_type.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index b54130b..51d1265 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -115,7 +115,7 @@ struct block_device_context {
static const char *drv_name = "blkvsc";

/* {32412632-86cb-44a2-9b5c-50d1417354f5} */
-static const struct hv_guid g_blk_device_type = {
+static const struct hv_guid dev_type = {
.data = {
0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44,
0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5
@@ -178,7 +178,7 @@ static int blk_vsc_initialize(struct hv_driver *driver)
/* Make sure we are at least 2 pages since 1 page is used for control */

driver->name = drv_name;
- memcpy(&driver->dev_type, &g_blk_device_type, sizeof(struct hv_guid));
+ memcpy(&driver->dev_type, &dev_type, sizeof(struct hv_guid));


/*
--
1.7.4.1

2011-05-09 21:44:55

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 006/206] Staging: hv: Change the name of struct storvsc_driver_object

Rename the struct storvsc_driver_object.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 14 +++++++-------
drivers/staging/hv/storvsc.c | 2 +-
drivers/staging/hv/storvsc_api.h | 8 ++++----
drivers/staging/hv/storvsc_drv.c | 14 +++++++-------
4 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 51d1265..a80e7c1 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -170,7 +170,7 @@ static int blk_vsc_on_device_add(struct hv_device *device,

static int blk_vsc_initialize(struct hv_driver *driver)
{
- struct storvsc_driver_object *stor_driver;
+ struct storvsc_driver *stor_driver;
int ret = 0;

stor_driver = hvdr_to_stordr(driver);
@@ -211,7 +211,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
{
struct block_device_context *blkdev = blkvsc_req->dev;
struct hv_device *device_ctx = blkdev->device_ctx;
- struct storvsc_driver_object *storvsc_drv_obj =
+ struct storvsc_driver *storvsc_drv_obj =
drv_to_stordrv(device_ctx->device.driver);
struct hv_storvsc_request *storvsc_req;
struct vmscsi_request *vm_srb;
@@ -544,7 +544,7 @@ out:
*/
static int blkvsc_remove(struct hv_device *dev)
{
- struct storvsc_driver_object *storvsc_drv_obj =
+ struct storvsc_driver *storvsc_drv_obj =
drv_to_stordrv(dev->device.driver);
struct block_device_context *blkdev = dev_get_drvdata(&dev->device);
unsigned long flags;
@@ -852,7 +852,7 @@ static void blkvsc_request(struct request_queue *queue)


/* The one and only one */
-static struct storvsc_driver_object g_blkvsc_drv;
+static struct storvsc_driver g_blkvsc_drv;

static const struct block_device_operations block_ops = {
.owner = THIS_MODULE,
@@ -867,7 +867,7 @@ static const struct block_device_operations block_ops = {
*/
static int blkvsc_drv_init(void)
{
- struct storvsc_driver_object *storvsc_drv_obj = &g_blkvsc_drv;
+ struct storvsc_driver *storvsc_drv_obj = &g_blkvsc_drv;
struct hv_driver *drv = &g_blkvsc_drv.base;
int ret;

@@ -897,7 +897,7 @@ static int blkvsc_drv_exit_cb(struct device *dev, void *data)

static void blkvsc_drv_exit(void)
{
- struct storvsc_driver_object *storvsc_drv_obj = &g_blkvsc_drv;
+ struct storvsc_driver *storvsc_drv_obj = &g_blkvsc_drv;
struct hv_driver *drv = &g_blkvsc_drv.base;
struct device *current_dev;
int ret;
@@ -935,7 +935,7 @@ static void blkvsc_drv_exit(void)
*/
static int blkvsc_probe(struct hv_device *dev)
{
- struct storvsc_driver_object *storvsc_drv_obj =
+ struct storvsc_driver *storvsc_drv_obj =
drv_to_stordrv(dev->device.driver);

struct block_device_context *blkdev = NULL;
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index d53aa97..6be504b 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -411,7 +411,7 @@ static void stor_vsc_on_channel_callback(void *context)
static int stor_vsc_connect_to_vsp(struct hv_device *device)
{
struct vmstorage_channel_properties props;
- struct storvsc_driver_object *stor_driver;
+ struct storvsc_driver *stor_driver;
int ret;

stor_driver = drv_to_stordrv(device->device.driver);
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index b60a058..4ebf50a 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -73,7 +73,7 @@ struct hv_storvsc_request {


/* Represents the block vsc driver */
-struct storvsc_driver_object {
+struct storvsc_driver {
struct hv_driver base;

/* Set by caller (in bytes) */
@@ -149,13 +149,13 @@ static inline void put_stor_device(struct hv_device *device)
atomic_dec(&stor_device->ref_count);
}

-static inline struct storvsc_driver_object *hvdr_to_stordr(struct hv_driver *d)
+static inline struct storvsc_driver *hvdr_to_stordr(struct hv_driver *d)
{
- return container_of(d, struct storvsc_driver_object, base);
+ return container_of(d, struct storvsc_driver, base);
}

static inline
-struct storvsc_driver_object *drv_to_stordrv(struct device_driver *d)
+struct storvsc_driver *drv_to_stordrv(struct device_driver *d)
{
struct hv_driver *hvdrv = drv_to_hv_drv(d);
return hvdr_to_stordr(hvdrv);
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index e449481..1fce10e 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -77,7 +77,7 @@ struct storvsc_cmd_request {
*/
static int stor_vsc_initialize(struct hv_driver *driver)
{
- struct storvsc_driver_object *stor_driver;
+ struct storvsc_driver *stor_driver;

stor_driver = hvdr_to_stordr(driver);

@@ -152,7 +152,7 @@ module_param(storvsc_ringbuffer_size, int, S_IRUGO);
MODULE_PARM_DESC(storvsc_ringbuffer_size, "Ring buffer size (bytes)");

/* The one and only one */
-static struct storvsc_driver_object g_storvsc_drv;
+static struct storvsc_driver g_storvsc_drv;

/* Scsi driver */
static struct scsi_host_template scsi_driver = {
@@ -189,7 +189,7 @@ static struct scsi_host_template scsi_driver = {
static int storvsc_drv_init(void)
{
int ret;
- struct storvsc_driver_object *storvsc_drv_obj = &g_storvsc_drv;
+ struct storvsc_driver *storvsc_drv_obj = &g_storvsc_drv;
struct hv_driver *drv = &g_storvsc_drv.base;

storvsc_drv_obj->ring_buffer_size = storvsc_ringbuffer_size;
@@ -286,7 +286,7 @@ static int storvsc_drv_exit_cb(struct device *dev, void *data)

static void storvsc_drv_exit(void)
{
- struct storvsc_driver_object *storvsc_drv_obj = &g_storvsc_drv;
+ struct storvsc_driver *storvsc_drv_obj = &g_storvsc_drv;
struct hv_driver *drv = &g_storvsc_drv.base;
struct device *current_dev = NULL;
int ret;
@@ -323,7 +323,7 @@ static void storvsc_drv_exit(void)
static int storvsc_probe(struct hv_device *device)
{
int ret;
- struct storvsc_driver_object *storvsc_drv_obj =
+ struct storvsc_driver *storvsc_drv_obj =
drv_to_stordrv(device->device.driver);
struct Scsi_Host *host;
struct host_device_context *host_device_ctx;
@@ -400,7 +400,7 @@ static int storvsc_probe(struct hv_device *device)
*/
static int storvsc_remove(struct hv_device *dev)
{
- struct storvsc_driver_object *storvsc_drv_obj =
+ struct storvsc_driver *storvsc_drv_obj =
drv_to_stordrv(dev->device.driver);
struct Scsi_Host *host = dev_get_drvdata(&dev->device);
struct host_device_context *host_device_ctx =
@@ -686,7 +686,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
struct host_device_context *host_device_ctx =
(struct host_device_context *)scmnd->device->host->hostdata;
struct hv_device *device_ctx = host_device_ctx->device_ctx;
- struct storvsc_driver_object *storvsc_drv_obj =
+ struct storvsc_driver *storvsc_drv_obj =
drv_to_stordrv(device_ctx->device.driver);
struct hv_storvsc_request *request;
struct storvsc_cmd_request *cmd_request;
--
1.7.4.1

2011-05-09 21:44:53

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 007/206] Staging: hv: Change the name of blkvsc driver variable

Rename the variable g_blkvsc_drv.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index a80e7c1..a0e08de 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -852,7 +852,7 @@ static void blkvsc_request(struct request_queue *queue)


/* The one and only one */
-static struct storvsc_driver g_blkvsc_drv;
+static struct storvsc_driver blkvsc_drv;

static const struct block_device_operations block_ops = {
.owner = THIS_MODULE,
@@ -867,8 +867,8 @@ static const struct block_device_operations block_ops = {
*/
static int blkvsc_drv_init(void)
{
- struct storvsc_driver *storvsc_drv_obj = &g_blkvsc_drv;
- struct hv_driver *drv = &g_blkvsc_drv.base;
+ struct storvsc_driver *storvsc_drv_obj = &blkvsc_drv;
+ struct hv_driver *drv = &blkvsc_drv.base;
int ret;

storvsc_drv_obj->ring_buffer_size = blkvsc_ringbuffer_size;
@@ -897,8 +897,8 @@ static int blkvsc_drv_exit_cb(struct device *dev, void *data)

static void blkvsc_drv_exit(void)
{
- struct storvsc_driver *storvsc_drv_obj = &g_blkvsc_drv;
- struct hv_driver *drv = &g_blkvsc_drv.base;
+ struct storvsc_driver *storvsc_drv_obj = &blkvsc_drv;
+ struct hv_driver *drv = &blkvsc_drv.base;
struct device *current_dev;
int ret;

--
1.7.4.1

2011-05-10 08:49:46

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 008/206] Staging: hv: Rename variables of type struct storvsc_driver *

Rename the variables pointing to variables of type struct storvsc_driver *.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index a0e08de..391666e 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -211,7 +211,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
{
struct block_device_context *blkdev = blkvsc_req->dev;
struct hv_device *device_ctx = blkdev->device_ctx;
- struct storvsc_driver *storvsc_drv_obj =
+ struct storvsc_driver *storvsc_drv =
drv_to_stordrv(device_ctx->device.driver);
struct hv_storvsc_request *storvsc_req;
struct vmscsi_request *vm_srb;
@@ -237,7 +237,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,

storvsc_req->sense_buffer = blkvsc_req->sense_buffer;

- ret = storvsc_drv_obj->on_io_request(blkdev->device_ctx,
+ ret = storvsc_drv->on_io_request(blkdev->device_ctx,
&blkvsc_req->request);
if (ret == 0)
blkdev->num_outstanding_reqs++;
@@ -544,7 +544,7 @@ out:
*/
static int blkvsc_remove(struct hv_device *dev)
{
- struct storvsc_driver *storvsc_drv_obj =
+ struct storvsc_driver *storvsc_drv =
drv_to_stordrv(dev->device.driver);
struct block_device_context *blkdev = dev_get_drvdata(&dev->device);
unsigned long flags;
@@ -553,7 +553,7 @@ static int blkvsc_remove(struct hv_device *dev)
* Call to the vsc driver to let it know that the device is being
* removed
*/
- storvsc_drv_obj->base.dev_rm(dev);
+ storvsc_drv->base.dev_rm(dev);

/* Get to a known state */
spin_lock_irqsave(&blkdev->lock, flags);
@@ -867,16 +867,16 @@ static const struct block_device_operations block_ops = {
*/
static int blkvsc_drv_init(void)
{
- struct storvsc_driver *storvsc_drv_obj = &blkvsc_drv;
+ struct storvsc_driver *storvsc_drv = &blkvsc_drv;
struct hv_driver *drv = &blkvsc_drv.base;
int ret;

- storvsc_drv_obj->ring_buffer_size = blkvsc_ringbuffer_size;
+ storvsc_drv->ring_buffer_size = blkvsc_ringbuffer_size;

/* Callback to client driver to complete the initialization */
- blk_vsc_initialize(&storvsc_drv_obj->base);
+ blk_vsc_initialize(&storvsc_drv->base);

- drv->driver.name = storvsc_drv_obj->base.name;
+ drv->driver.name = storvsc_drv->base.name;

drv->probe = blkvsc_probe;
drv->remove = blkvsc_remove;
@@ -897,7 +897,7 @@ static int blkvsc_drv_exit_cb(struct device *dev, void *data)

static void blkvsc_drv_exit(void)
{
- struct storvsc_driver *storvsc_drv_obj = &blkvsc_drv;
+ struct storvsc_driver *storvsc_drv = &blkvsc_drv;
struct hv_driver *drv = &blkvsc_drv.base;
struct device *current_dev;
int ret;
@@ -922,8 +922,8 @@ static void blkvsc_drv_exit(void)
device_unregister(current_dev);
}

- if (storvsc_drv_obj->base.cleanup)
- storvsc_drv_obj->base.cleanup(&storvsc_drv_obj->base);
+ if (storvsc_drv->base.cleanup)
+ storvsc_drv->base.cleanup(&storvsc_drv->base);

vmbus_child_driver_unregister(&drv->driver);

@@ -935,7 +935,7 @@ static void blkvsc_drv_exit(void)
*/
static int blkvsc_probe(struct hv_device *dev)
{
- struct storvsc_driver *storvsc_drv_obj =
+ struct storvsc_driver *storvsc_drv =
drv_to_stordrv(dev->device.driver);

struct block_device_context *blkdev = NULL;
@@ -965,7 +965,7 @@ static int blkvsc_probe(struct hv_device *dev)


/* Call to the vsc driver to add the device */
- ret = storvsc_drv_obj->base.dev_add(dev, &device_info);
+ ret = storvsc_drv->base.dev_add(dev, &device_info);
if (ret != 0)
goto cleanup;

@@ -1035,7 +1035,7 @@ static int blkvsc_probe(struct hv_device *dev)
return ret;

remove:
- storvsc_drv_obj->base.dev_rm(dev);
+ storvsc_drv->base.dev_rm(dev);

cleanup:
if (blkdev) {
--
1.7.4.1

2011-05-10 08:33:09

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 009/206] Staging: hv: Rename the function blk_vsc_on_device_add

Rename the function blk_vsc_on_device_add.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 391666e..0005e33 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -139,7 +139,7 @@ MODULE_PARM_DESC(ring_size, "Ring buffer size (in bytes)");
*/
static int blkvsc_probe(struct hv_device *dev);

-static int blk_vsc_on_device_add(struct hv_device *device,
+static int blkvsc_device_add(struct hv_device *device,
void *additional_info)
{
struct storvsc_device_info *device_info;
@@ -197,7 +197,7 @@ static int blk_vsc_initialize(struct hv_driver *driver)
stor_driver->max_outstanding_req_per_channel);

/* Setup the dispatch table */
- stor_driver->base.dev_add = blk_vsc_on_device_add;
+ stor_driver->base.dev_add = blkvsc_device_add;
stor_driver->base.dev_rm = stor_vsc_on_device_remove;
stor_driver->base.cleanup = stor_vsc_on_cleanup;
stor_driver->on_io_request = stor_vsc_on_io_request;
--
1.7.4.1

2011-05-10 08:51:05

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 010/206] Staging: hv: Get rid of the indirection for invoking device_add

Get rid of the indirection for invoking device_add.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 0005e33..434c2a9 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -197,7 +197,6 @@ static int blk_vsc_initialize(struct hv_driver *driver)
stor_driver->max_outstanding_req_per_channel);

/* Setup the dispatch table */
- stor_driver->base.dev_add = blkvsc_device_add;
stor_driver->base.dev_rm = stor_vsc_on_device_remove;
stor_driver->base.cleanup = stor_vsc_on_cleanup;
stor_driver->on_io_request = stor_vsc_on_io_request;
@@ -964,8 +963,7 @@ static int blkvsc_probe(struct hv_device *dev)
}


- /* Call to the vsc driver to add the device */
- ret = storvsc_drv->base.dev_add(dev, &device_info);
+ ret = blkvsc_device_add(dev, &device_info);
if (ret != 0)
goto cleanup;

--
1.7.4.1

2011-05-09 22:13:14

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 011/206] Staging: hv: Rename the function stor_vsc_device_add

The subject says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 2 +-
drivers/staging/hv/storvsc.c | 2 +-
drivers/staging/hv/storvsc_api.h | 2 +-
drivers/staging/hv/storvsc_drv.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 434c2a9..908c169 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -147,7 +147,7 @@ static int blkvsc_device_add(struct hv_device *device,

device_info = (struct storvsc_device_info *)additional_info;

- ret = stor_vsc_on_device_add(device, additional_info);
+ ret = storvsc_dev_add(device, additional_info);
if (ret != 0)
return ret;

diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 6be504b..503c6bf 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -442,7 +442,7 @@ static int stor_vsc_connect_to_vsp(struct hv_device *device)
* stor_vsc_on_device_add - Callback when the device belonging to this driver
* is added
*/
-int stor_vsc_on_device_add(struct hv_device *device,
+int storvsc_dev_add(struct hv_device *device,
void *additional_info)
{
struct storvsc_device *stor_device;
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 4ebf50a..0200154 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -163,7 +163,7 @@ struct storvsc_driver *drv_to_stordrv(struct device_driver *d)

/* Interface */

-int stor_vsc_on_device_add(struct hv_device *device,
+int storvsc_dev_add(struct hv_device *device,
void *additional_info);
int stor_vsc_on_device_remove(struct hv_device *device);

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 1fce10e..5168eb7 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -113,7 +113,7 @@ static int stor_vsc_initialize(struct hv_driver *driver)
STORVSC_MAX_IO_REQUESTS);

/* Setup the dispatch table */
- stor_driver->base.dev_add = stor_vsc_on_device_add;
+ stor_driver->base.dev_add = storvsc_dev_add;
stor_driver->base.dev_rm = stor_vsc_on_device_remove;
stor_driver->base.cleanup = stor_vsc_on_cleanup;

--
1.7.4.1

2011-05-10 09:56:22

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 012/206] Staging: hv: Rename the function stor_vsc_on_device_remove

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 2 +-
drivers/staging/hv/storvsc.c | 2 +-
drivers/staging/hv/storvsc_api.h | 2 +-
drivers/staging/hv/storvsc_drv.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 908c169..830f257 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -197,7 +197,7 @@ static int blk_vsc_initialize(struct hv_driver *driver)
stor_driver->max_outstanding_req_per_channel);

/* Setup the dispatch table */
- stor_driver->base.dev_rm = stor_vsc_on_device_remove;
+ stor_driver->base.dev_rm = storvsc_dev_remove;
stor_driver->base.cleanup = stor_vsc_on_cleanup;
stor_driver->on_io_request = stor_vsc_on_io_request;

diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 503c6bf..976f382 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -483,7 +483,7 @@ cleanup:
/*
* stor_vsc_on_device_remove - Callback when the our device is being removed
*/
-int stor_vsc_on_device_remove(struct hv_device *device)
+int storvsc_dev_remove(struct hv_device *device)
{
struct storvsc_device *stor_device;

diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 0200154..b3207a0 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -165,7 +165,7 @@ struct storvsc_driver *drv_to_stordrv(struct device_driver *d)

int storvsc_dev_add(struct hv_device *device,
void *additional_info);
-int stor_vsc_on_device_remove(struct hv_device *device);
+int storvsc_dev_remove(struct hv_device *device);

int stor_vsc_on_io_request(struct hv_device *device,
struct hv_storvsc_request *request);
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 5168eb7..903ecbe 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -114,7 +114,7 @@ static int stor_vsc_initialize(struct hv_driver *driver)

/* Setup the dispatch table */
stor_driver->base.dev_add = storvsc_dev_add;
- stor_driver->base.dev_rm = stor_vsc_on_device_remove;
+ stor_driver->base.dev_rm = storvsc_dev_remove;
stor_driver->base.cleanup = stor_vsc_on_cleanup;

stor_driver->on_io_request = stor_vsc_on_io_request;
--
1.7.4.1

2011-05-09 22:13:17

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 013/206] Staging: hv: Get rid of the indirection for removing stor device

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 10 ++--------
1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 830f257..8b8d960 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -197,7 +197,6 @@ static int blk_vsc_initialize(struct hv_driver *driver)
stor_driver->max_outstanding_req_per_channel);

/* Setup the dispatch table */
- stor_driver->base.dev_rm = storvsc_dev_remove;
stor_driver->base.cleanup = stor_vsc_on_cleanup;
stor_driver->on_io_request = stor_vsc_on_io_request;

@@ -543,8 +542,6 @@ out:
*/
static int blkvsc_remove(struct hv_device *dev)
{
- struct storvsc_driver *storvsc_drv =
- drv_to_stordrv(dev->device.driver);
struct block_device_context *blkdev = dev_get_drvdata(&dev->device);
unsigned long flags;

@@ -552,7 +549,7 @@ static int blkvsc_remove(struct hv_device *dev)
* Call to the vsc driver to let it know that the device is being
* removed
*/
- storvsc_drv->base.dev_rm(dev);
+ storvsc_dev_remove(dev);

/* Get to a known state */
spin_lock_irqsave(&blkdev->lock, flags);
@@ -934,9 +931,6 @@ static void blkvsc_drv_exit(void)
*/
static int blkvsc_probe(struct hv_device *dev)
{
- struct storvsc_driver *storvsc_drv =
- drv_to_stordrv(dev->device.driver);
-
struct block_device_context *blkdev = NULL;
struct storvsc_device_info device_info;
struct storvsc_major_info major_info;
@@ -1033,7 +1027,7 @@ static int blkvsc_probe(struct hv_device *dev)
return ret;

remove:
- storvsc_drv->base.dev_rm(dev);
+ storvsc_dev_remove(dev);

cleanup:
if (blkdev) {
--
1.7.4.1

2011-05-09 22:13:13

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 014/206] Staging: hv: Rename the function stor_vsc_on_cleanup

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 5 ++---
drivers/staging/hv/storvsc.c | 2 +-
drivers/staging/hv/storvsc_api.h | 2 +-
drivers/staging/hv/storvsc_drv.c | 2 +-
4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 8b8d960..1d0b6ed 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -17,8 +17,7 @@
* Authors:
* Haiyang Zhang <[email protected]>
* Hank Janssen <[email protected]>
- *
- * 4/3/2011: K. Y. Srinivasan - Significant restructuring and cleanup.
+ * K. Y. Srinivasan <[email protected]>
*/
#include <linux/init.h>
#include <linux/module.h>
@@ -197,7 +196,7 @@ static int blk_vsc_initialize(struct hv_driver *driver)
stor_driver->max_outstanding_req_per_channel);

/* Setup the dispatch table */
- stor_driver->base.cleanup = stor_vsc_on_cleanup;
+ stor_driver->base.cleanup = storvsc_cleanup;
stor_driver->on_io_request = stor_vsc_on_io_request;

return ret;
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 976f382..2e276b4 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -663,7 +663,7 @@ int stor_vsc_get_major_info(struct storvsc_device_info *device_info,
/*
* stor_vsc_on_cleanup - Perform any cleanup when the driver is removed
*/
-void stor_vsc_on_cleanup(struct hv_driver *driver)
+void storvsc_cleanup(struct hv_driver *driver)
{
}

diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index b3207a0..3168161 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -169,7 +169,7 @@ int storvsc_dev_remove(struct hv_device *device);

int stor_vsc_on_io_request(struct hv_device *device,
struct hv_storvsc_request *request);
-void stor_vsc_on_cleanup(struct hv_driver *driver);
+void storvsc_cleanup(struct hv_driver *driver);

int stor_vsc_get_major_info(struct storvsc_device_info *device_info,
struct storvsc_major_info *major_info);
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 903ecbe..86f2bab 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -115,7 +115,7 @@ static int stor_vsc_initialize(struct hv_driver *driver)
/* Setup the dispatch table */
stor_driver->base.dev_add = storvsc_dev_add;
stor_driver->base.dev_rm = storvsc_dev_remove;
- stor_driver->base.cleanup = stor_vsc_on_cleanup;
+ stor_driver->base.cleanup = storvsc_cleanup;

stor_driver->on_io_request = stor_vsc_on_io_request;

--
1.7.4.1

2011-05-09 22:13:11

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 015/206] Staging: hv: Get rid of the indirection for invoking cleanup function

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 1d0b6ed..ec00a16 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -196,7 +196,6 @@ static int blk_vsc_initialize(struct hv_driver *driver)
stor_driver->max_outstanding_req_per_channel);

/* Setup the dispatch table */
- stor_driver->base.cleanup = storvsc_cleanup;
stor_driver->on_io_request = stor_vsc_on_io_request;

return ret;
@@ -917,8 +916,7 @@ static void blkvsc_drv_exit(void)
device_unregister(current_dev);
}

- if (storvsc_drv->base.cleanup)
- storvsc_drv->base.cleanup(&storvsc_drv->base);
+ storvsc_cleanup(&storvsc_drv->base);

vmbus_child_driver_unregister(&drv->driver);

--
1.7.4.1

2011-05-09 22:12:47

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 016/206] Staging: hv: Rename the function stor_vsc_on_io_request

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 2 +-
drivers/staging/hv/storvsc.c | 2 +-
drivers/staging/hv/storvsc_api.h | 2 +-
drivers/staging/hv/storvsc_drv.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index ec00a16..bfec15c 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -196,7 +196,7 @@ static int blk_vsc_initialize(struct hv_driver *driver)
stor_driver->max_outstanding_req_per_channel);

/* Setup the dispatch table */
- stor_driver->on_io_request = stor_vsc_on_io_request;
+ stor_driver->on_io_request = storvsc_do_io;

return ret;
}
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 2e276b4..867eba1 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -520,7 +520,7 @@ int storvsc_dev_remove(struct hv_device *device)
/*
* stor_vsc_on_io_request - Callback to initiate an I/O request
*/
-int stor_vsc_on_io_request(struct hv_device *device,
+int storvsc_do_io(struct hv_device *device,
struct hv_storvsc_request *request)
{
struct storvsc_device *stor_device;
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 3168161..f8c724b 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -167,7 +167,7 @@ int storvsc_dev_add(struct hv_device *device,
void *additional_info);
int storvsc_dev_remove(struct hv_device *device);

-int stor_vsc_on_io_request(struct hv_device *device,
+int storvsc_do_io(struct hv_device *device,
struct hv_storvsc_request *request);
void storvsc_cleanup(struct hv_driver *driver);

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 86f2bab..799231c 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -117,7 +117,7 @@ static int stor_vsc_initialize(struct hv_driver *driver)
stor_driver->base.dev_rm = storvsc_dev_remove;
stor_driver->base.cleanup = storvsc_cleanup;

- stor_driver->on_io_request = stor_vsc_on_io_request;
+ stor_driver->on_io_request = storvsc_do_io;

return 0;
}
--
1.7.4.1

2011-05-09 22:12:46

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 017/206] Staging: hv: Get rid of the indirection for invoking io request

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index bfec15c..9de7df7a 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -195,8 +195,6 @@ static int blk_vsc_initialize(struct hv_driver *driver)
DPRINT_INFO(BLKVSC, "max io outstd %u",
stor_driver->max_outstanding_req_per_channel);

- /* Setup the dispatch table */
- stor_driver->on_io_request = storvsc_do_io;

return ret;
}
@@ -206,9 +204,6 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
void (*request_completion)(struct hv_storvsc_request *))
{
struct block_device_context *blkdev = blkvsc_req->dev;
- struct hv_device *device_ctx = blkdev->device_ctx;
- struct storvsc_driver *storvsc_drv =
- drv_to_stordrv(device_ctx->device.driver);
struct hv_storvsc_request *storvsc_req;
struct vmscsi_request *vm_srb;
int ret;
@@ -233,7 +228,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,

storvsc_req->sense_buffer = blkvsc_req->sense_buffer;

- ret = storvsc_drv->on_io_request(blkdev->device_ctx,
+ ret = storvsc_do_io(blkdev->device_ctx,
&blkvsc_req->request);
if (ret == 0)
blkdev->num_outstanding_reqs++;
--
1.7.4.1

2011-05-09 22:11:47

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 018/206] Staging: hv: Statically initialize pointers for probe etc

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 9de7df7a..bca36b5 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -841,7 +841,11 @@ static void blkvsc_request(struct request_queue *queue)


/* The one and only one */
-static struct storvsc_driver blkvsc_drv;
+static struct storvsc_driver blkvsc_drv = {
+ .base.probe = blkvsc_probe,
+ .base.remove = blkvsc_remove,
+ .base.shutdown = blkvsc_shutdown,
+};

static const struct block_device_operations block_ops = {
.owner = THIS_MODULE,
@@ -867,10 +871,6 @@ static int blkvsc_drv_init(void)

drv->driver.name = storvsc_drv->base.name;

- drv->probe = blkvsc_probe;
- drv->remove = blkvsc_remove;
- drv->shutdown = blkvsc_shutdown;
-
/* The driver belongs to vmbus */
ret = vmbus_child_driver_register(&drv->driver);

--
1.7.4.1

2011-05-09 22:11:49

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 019/206] Staging: hv: Get rid of the calls to storvsc_cleanup

The storvsc_cleanup() is an empty function; get rid of it.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 3 ---
drivers/staging/hv/storvsc.c | 7 -------
drivers/staging/hv/storvsc_api.h | 1 -
drivers/staging/hv/storvsc_drv.c | 1 -
4 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index bca36b5..2e69af0 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -886,7 +886,6 @@ static int blkvsc_drv_exit_cb(struct device *dev, void *data)

static void blkvsc_drv_exit(void)
{
- struct storvsc_driver *storvsc_drv = &blkvsc_drv;
struct hv_driver *drv = &blkvsc_drv.base;
struct device *current_dev;
int ret;
@@ -911,8 +910,6 @@ static void blkvsc_drv_exit(void)
device_unregister(current_dev);
}

- storvsc_cleanup(&storvsc_drv->base);
-
vmbus_child_driver_unregister(&drv->driver);

return;
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 867eba1..7074520 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -660,10 +660,3 @@ int stor_vsc_get_major_info(struct storvsc_device_info *device_info,
return -ENODEV;
}

-/*
- * stor_vsc_on_cleanup - Perform any cleanup when the driver is removed
- */
-void storvsc_cleanup(struct hv_driver *driver)
-{
-}
-
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index f8c724b..84ee5a9 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -169,7 +169,6 @@ int storvsc_dev_remove(struct hv_device *device);

int storvsc_do_io(struct hv_device *device,
struct hv_storvsc_request *request);
-void storvsc_cleanup(struct hv_driver *driver);

int stor_vsc_get_major_info(struct storvsc_device_info *device_info,
struct storvsc_major_info *major_info);
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 799231c..c54a5fe 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -115,7 +115,6 @@ static int stor_vsc_initialize(struct hv_driver *driver)
/* Setup the dispatch table */
stor_driver->base.dev_add = storvsc_dev_add;
stor_driver->base.dev_rm = storvsc_dev_remove;
- stor_driver->base.cleanup = storvsc_cleanup;

stor_driver->on_io_request = storvsc_do_io;

--
1.7.4.1

2011-05-09 22:11:46

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 020/206] Staging: hv: Rename the function stor_vsc_get_major_info()

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 2 +-
drivers/staging/hv/storvsc.c | 2 +-
drivers/staging/hv/storvsc_api.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 2e69af0..457d0bb 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -958,7 +958,7 @@ static int blkvsc_probe(struct hv_device *dev)

dev_set_drvdata(&dev->device, blkdev);

- ret = stor_vsc_get_major_info(&device_info, &major_info);
+ ret = storvsc_get_major_info(&device_info, &major_info);

if (ret)
goto cleanup;
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 7074520..8ee1ad0 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -615,7 +615,7 @@ int storvsc_do_io(struct hv_device *device,
*
*/

-int stor_vsc_get_major_info(struct storvsc_device_info *device_info,
+int storvsc_get_major_info(struct storvsc_device_info *device_info,
struct storvsc_major_info *major_info)
{
static bool ide0_registered;
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 84ee5a9..32228c0 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -170,7 +170,7 @@ int storvsc_dev_remove(struct hv_device *device);
int storvsc_do_io(struct hv_device *device,
struct hv_storvsc_request *request);

-int stor_vsc_get_major_info(struct storvsc_device_info *device_info,
+int storvsc_get_major_info(struct storvsc_device_info *device_info,
struct storvsc_major_info *major_info);

#endif /* _STORVSC_API_H_ */
--
1.7.4.1

2011-05-09 22:11:44

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 021/206] Staging: hv: Introduce a function to wait to drain outgoing I/O

Rather than busy loop waiting to drain I/O, introduce a function
that does not burn CPU cycles waiting.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc.c | 6 +++++-
drivers/staging/hv/storvsc_api.h | 12 ++++++++++++
2 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 8ee1ad0..36458b8 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -47,6 +47,7 @@ static inline struct storvsc_device *alloc_stor_device(struct hv_device *device)
/* (ie get_stor_device() and must_get_stor_device()) to proceed. */
atomic_cmpxchg(&stor_device->ref_count, 0, 2);

+ init_waitqueue_head(&stor_device->waiting_to_drain);
stor_device->device = device;
device->ext = stor_device;

@@ -332,7 +333,10 @@ static void stor_vsc_on_io_completion(struct hv_device *device,

request->on_io_completion(request);

- atomic_dec(&stor_device->num_outstanding_req);
+ if (atomic_dec_and_test(&stor_device->num_outstanding_req) &&
+ stor_device->drain_notify)
+ wake_up(&stor_device->waiting_to_drain);
+

put_stor_device(device);
}
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 32228c0..1887940 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -26,6 +26,7 @@
#define _STORVSC_API_H_

#include <linux/kernel.h>
+#include <linux/wait.h>
#include "vstorage.h"
#include "vmbus_api.h"
#include "vmbus.h"
@@ -108,8 +109,11 @@ struct storvsc_device {
/* 0 indicates the device is being destroyed */
atomic_t ref_count;

+ bool drain_notify;
atomic_t num_outstanding_req;

+ wait_queue_head_t waiting_to_drain;
+
/*
* Each unique Port/Path/Target represents 1 channel ie scsi
* controller. In reality, the pathid, targetid is always 0
@@ -161,6 +165,14 @@ struct storvsc_driver *drv_to_stordrv(struct device_driver *d)
return hvdr_to_stordr(hvdrv);
}

+static inline void storvsc_wait_to_drain(struct storvsc_device *dev)
+{
+ dev->drain_notify = true;
+ wait_event(dev->waiting_to_drain,
+ atomic_read(&dev->num_outstanding_req) == 0);
+ dev->drain_notify = false;
+}
+
/* Interface */

int storvsc_dev_add(struct hv_device *device,
--
1.7.4.1

2011-05-09 22:09:44

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 022/206] Staging: hv: Use the newly introduced I/O drain synch method

Use the newly introduced I/O drain synch method.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 36458b8..8e529d5 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -501,11 +501,8 @@ int storvsc_dev_remove(struct hv_device *device)
* only allow inbound traffic (responses) to proceed so that
* outstanding requests can be completed.
*/
- while (atomic_read(&stor_device->num_outstanding_req)) {
- DPRINT_INFO(STORVSC, "waiting for %d requests to complete...",
- atomic_read(&stor_device->num_outstanding_req));
- udelay(100);
- }
+
+ storvsc_wait_to_drain(stor_device);

DPRINT_INFO(STORVSC, "removing storage device (%p)...",
device->ext);
--
1.7.4.1

2011-05-09 22:11:11

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 023/206] Staging: hv: Cleanup blkvsc_remove()

The function storvsc_dev_remove() already deals with draining of
the outstanding I/O. Cleanup blkvsc_remove() keeping this in mind.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 18 ++++++------------
1 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 457d0bb..217676a 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -538,11 +538,6 @@ static int blkvsc_remove(struct hv_device *dev)
struct block_device_context *blkdev = dev_get_drvdata(&dev->device);
unsigned long flags;

- /*
- * Call to the vsc driver to let it know that the device is being
- * removed
- */
- storvsc_dev_remove(dev);

/* Get to a known state */
spin_lock_irqsave(&blkdev->lock, flags);
@@ -555,17 +550,16 @@ static int blkvsc_remove(struct hv_device *dev)

spin_unlock_irqrestore(&blkdev->lock, flags);

- while (blkdev->num_outstanding_reqs) {
- DPRINT_INFO(STORVSC, "waiting for %d requests to complete...",
- blkdev->num_outstanding_reqs);
- udelay(100);
- }
-
-
blkvsc_do_operation(blkdev, DO_FLUSH);

blk_cleanup_queue(blkdev->gd->queue);

+ /*
+ * Call to the vsc driver to let it know that the device is being
+ * removed
+ */
+ storvsc_dev_remove(dev);
+
del_gendisk(blkdev->gd);

kmem_cache_destroy(blkdev->request_pool);
--
1.7.4.1

2011-05-09 22:11:08

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 024/206] Staging: hv: Cleanup blkvsc_shutdown()

Use the newly introduced function to wait for draining I/Os to
cleanup blkvsc_shutdown().

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 217676a..7fb0cf1 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -588,15 +588,13 @@ static void blkvsc_shutdown(struct hv_device *dev)

spin_unlock_irqrestore(&blkdev->lock, flags);

- while (blkdev->num_outstanding_reqs) {
- DPRINT_INFO(STORVSC, "waiting for %d requests to complete...",
- blkdev->num_outstanding_reqs);
- udelay(100);
- }
-
-
blkvsc_do_operation(blkdev, DO_FLUSH);

+ /*
+ * Now wait for all outgoing I/O to be drained.
+ */
+ storvsc_wait_to_drain((struct storvsc_device *)dev->ext);
+
}

static int blkvsc_release(struct gendisk *disk, fmode_t mode)
--
1.7.4.1

2011-05-09 22:09:43

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 025/206] Staging: hv: Rename stor_vsc_channel_init()

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 8e529d5..50ac806 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -105,7 +105,7 @@ static inline struct storvsc_device *final_release_stor_device(
return stor_device;
}

-static int stor_vsc_channel_init(struct hv_device *device)
+static int storvsc_channel_init(struct hv_device *device)
{
struct storvsc_device *stor_device;
struct hv_storvsc_request *request;
@@ -437,7 +437,7 @@ static int stor_vsc_connect_to_vsp(struct hv_device *device)
return -1;
}

- ret = stor_vsc_channel_init(device);
+ ret = storvsc_channel_init(device);

return ret;
}
--
1.7.4.1

2011-05-09 22:09:41

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 026/206] Staging: hv: Rename stor_vsc_on_io_completion

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 50ac806..ecc62e1 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -277,7 +277,7 @@ cleanup:
return ret;
}

-static void stor_vsc_on_io_completion(struct hv_device *device,
+static void storvsc_on_io_completion(struct hv_device *device,
struct vstor_packet *vstor_packet,
struct hv_storvsc_request *request)
{
@@ -348,7 +348,7 @@ static void stor_vsc_on_receive(struct hv_device *device,
switch (vstor_packet->operation) {
case VSTOR_OPERATION_COMPLETE_IO:
DPRINT_DBG(STORVSC, "IO_COMPLETE_OPERATION");
- stor_vsc_on_io_completion(device, vstor_packet, request);
+ storvsc_on_io_completion(device, vstor_packet, request);
break;
case VSTOR_OPERATION_REMOVE_DEVICE:
DPRINT_INFO(STORVSC, "REMOVE_DEVICE_OPERATION");
--
1.7.4.1

2011-05-09 22:09:40

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 027/206] Staging: hv: Rename stor_vsc_on_receive

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index ecc62e1..ab9da5c 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -341,7 +341,7 @@ static void storvsc_on_io_completion(struct hv_device *device,
put_stor_device(device);
}

-static void stor_vsc_on_receive(struct hv_device *device,
+static void storvsc_on_receive(struct hv_device *device,
struct vstor_packet *vstor_packet,
struct hv_storvsc_request *request)
{
@@ -399,7 +399,7 @@ static void stor_vsc_on_channel_callback(void *context)
sizeof(struct vstor_packet));
complete(&request->wait_event);
} else {
- stor_vsc_on_receive(device,
+ storvsc_on_receive(device,
(struct vstor_packet *)packet,
request);
}
--
1.7.4.1

2011-05-09 22:08:37

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 028/206] Staging: hv: Rename stor_vsc_on_channel_callback

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index ab9da5c..b2ffbb7 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -362,7 +362,7 @@ static void storvsc_on_receive(struct hv_device *device,
}
}

-static void stor_vsc_on_channel_callback(void *context)
+static void storvsc_on_channel_callback(void *context)
{
struct hv_device *device = (struct hv_device *)context;
struct storvsc_device *stor_device;
@@ -427,7 +427,7 @@ static int stor_vsc_connect_to_vsp(struct hv_device *device)
stor_driver->ring_buffer_size,
(void *)&props,
sizeof(struct vmstorage_channel_properties),
- stor_vsc_on_channel_callback, device);
+ storvsc_on_channel_callback, device);

DPRINT_DBG(STORVSC, "storage props: path id %d, tgt id %d, max xfer %d",
props.path_id, props.target_id, props.max_transfer_bytes);
--
1.7.4.1

2011-05-09 22:08:39

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 029/206] Staging: hv: Rename stor_vsc_connect_to_vsp

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index b2ffbb7..234ce8b 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -412,7 +412,7 @@ static void storvsc_on_channel_callback(void *context)
return;
}

-static int stor_vsc_connect_to_vsp(struct hv_device *device)
+static int storvsc_connect_to_vsp(struct hv_device *device)
{
struct vmstorage_channel_properties props;
struct storvsc_driver *stor_driver;
@@ -471,7 +471,7 @@ int storvsc_dev_add(struct hv_device *device,

stor_device->port_number = device_info->port_number;
/* Send it back up */
- ret = stor_vsc_connect_to_vsp(device);
+ ret = storvsc_connect_to_vsp(device);

device_info->path_id = stor_device->path_id;
device_info->target_id = stor_device->target_id;
--
1.7.4.1

2011-05-09 22:09:39

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 030/206] Staging: hv: Get rid of/change some dated comments

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc.c | 12 +-----------
1 files changed, 1 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 234ce8b..5d5aec3 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -17,8 +17,8 @@
* Authors:
* Haiyang Zhang <[email protected]>
* Hank Janssen <[email protected]>
+ * K. Y. Srinivasan <[email protected]>
*
- * 4/3/2011: K. Y. Srinivasan - Significant restructuring and cleanup.
*/
#include <linux/kernel.h>
#include <linux/sched.h>
@@ -442,10 +442,6 @@ static int storvsc_connect_to_vsp(struct hv_device *device)
return ret;
}

-/*
- * stor_vsc_on_device_add - Callback when the device belonging to this driver
- * is added
- */
int storvsc_dev_add(struct hv_device *device,
void *additional_info)
{
@@ -484,9 +480,6 @@ cleanup:
return ret;
}

-/*
- * stor_vsc_on_device_remove - Callback when the our device is being removed
- */
int storvsc_dev_remove(struct hv_device *device)
{
struct storvsc_device *stor_device;
@@ -518,9 +511,6 @@ int storvsc_dev_remove(struct hv_device *device)
return 0;
}

-/*
- * stor_vsc_on_io_request - Callback to initiate an I/O request
- */
int storvsc_do_io(struct hv_device *device,
struct hv_storvsc_request *request)
{
--
1.7.4.1

2011-05-09 22:08:34

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 031/206] Staging: hv: Get rid of some unnecessary DPRINTS

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc.c | 116 ++++++------------------------------------
1 files changed, 16 insertions(+), 100 deletions(-)

diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 5d5aec3..41361f5 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -113,11 +113,8 @@ static int storvsc_channel_init(struct hv_device *device)
int ret, t;

stor_device = get_stor_device(device);
- if (!stor_device) {
- DPRINT_ERR(STORVSC, "unable to get stor device..."
- "device being destroyed?");
+ if (!stor_device)
return -1;
- }

request = &stor_device->init_request;
vstor_packet = &request->vstor_packet;
@@ -138,11 +135,8 @@ static int storvsc_channel_init(struct hv_device *device)
(unsigned long)request,
VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
- if (ret != 0) {
- DPRINT_ERR(STORVSC,
- "unable to send BEGIN_INITIALIZATION_OPERATION");
+ if (ret != 0)
goto cleanup;
- }

t = wait_for_completion_timeout(&request->wait_event, HZ);
if (t == 0) {
@@ -151,12 +145,8 @@ static int storvsc_channel_init(struct hv_device *device)
}

if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO ||
- vstor_packet->status != 0) {
- DPRINT_ERR(STORVSC, "BEGIN_INITIALIZATION_OPERATION failed "
- "(op %d status 0x%x)",
- vstor_packet->operation, vstor_packet->status);
+ vstor_packet->status != 0)
goto cleanup;
- }

DPRINT_INFO(STORVSC, "QUERY_PROTOCOL_VERSION_OPERATION...");

@@ -173,11 +163,8 @@ static int storvsc_channel_init(struct hv_device *device)
(unsigned long)request,
VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
- if (ret != 0) {
- DPRINT_ERR(STORVSC,
- "unable to send BEGIN_INITIALIZATION_OPERATION");
+ if (ret != 0)
goto cleanup;
- }

t = wait_for_completion_timeout(&request->wait_event, HZ);
if (t == 0) {
@@ -187,12 +174,8 @@ static int storvsc_channel_init(struct hv_device *device)

/* TODO: Check returned version */
if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO ||
- vstor_packet->status != 0) {
- DPRINT_ERR(STORVSC, "QUERY_PROTOCOL_VERSION_OPERATION failed "
- "(op %d status 0x%x)",
- vstor_packet->operation, vstor_packet->status);
+ vstor_packet->status != 0)
goto cleanup;
- }

/* Query channel properties */
DPRINT_INFO(STORVSC, "QUERY_PROPERTIES_OPERATION...");
@@ -209,11 +192,8 @@ static int storvsc_channel_init(struct hv_device *device)
VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);

- if (ret != 0) {
- DPRINT_ERR(STORVSC,
- "unable to send QUERY_PROPERTIES_OPERATION");
+ if (ret != 0)
goto cleanup;
- }

t = wait_for_completion_timeout(&request->wait_event, HZ);
if (t == 0) {
@@ -223,21 +203,13 @@ static int storvsc_channel_init(struct hv_device *device)

/* TODO: Check returned version */
if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO ||
- vstor_packet->status != 0) {
- DPRINT_ERR(STORVSC, "QUERY_PROPERTIES_OPERATION failed "
- "(op %d status 0x%x)",
- vstor_packet->operation, vstor_packet->status);
+ vstor_packet->status != 0)
goto cleanup;
- }

stor_device->path_id = vstor_packet->storage_channel_properties.path_id;
stor_device->target_id
= vstor_packet->storage_channel_properties.target_id;

- DPRINT_DBG(STORVSC, "channel flag 0x%x, max xfer len 0x%x",
- vstor_packet->storage_channel_properties.flags,
- vstor_packet->storage_channel_properties.max_transfer_bytes);
-
DPRINT_INFO(STORVSC, "END_INITIALIZATION_OPERATION...");

memset(vstor_packet, 0, sizeof(struct vstor_packet));
@@ -250,11 +222,8 @@ static int storvsc_channel_init(struct hv_device *device)
VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);

- if (ret != 0) {
- DPRINT_ERR(STORVSC,
- "unable to send END_INITIALIZATION_OPERATION");
+ if (ret != 0)
goto cleanup;
- }

t = wait_for_completion_timeout(&request->wait_event, HZ);
if (t == 0) {
@@ -263,12 +232,8 @@ static int storvsc_channel_init(struct hv_device *device)
}

if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO ||
- vstor_packet->status != 0) {
- DPRINT_ERR(STORVSC, "END_INITIALIZATION_OPERATION failed "
- "(op %d status 0x%x)",
- vstor_packet->operation, vstor_packet->status);
+ vstor_packet->status != 0)
goto cleanup;
- }

DPRINT_INFO(STORVSC, "**** storage channel up and running!! ****");

@@ -285,15 +250,8 @@ static void storvsc_on_io_completion(struct hv_device *device,
struct vstor_packet *stor_pkt;

stor_device = must_get_stor_device(device);
- if (!stor_device) {
- DPRINT_ERR(STORVSC, "unable to get stor device..."
- "device being destroyed?");
+ if (!stor_device)
return;
- }
-
- DPRINT_DBG(STORVSC, "IO_COMPLETE_OPERATION - request %p "
- "completed bytes xfer %u", request,
- vstor_packet->vm_srb.data_transfer_length);

stor_pkt = &request->vstor_packet;

@@ -305,7 +263,7 @@ static void storvsc_on_io_completion(struct hv_device *device,
vstor_packet->vm_srb.sense_info_length;

if (vstor_packet->vm_srb.scsi_status != 0 ||
- vstor_packet->vm_srb.srb_status != 1) {
+ vstor_packet->vm_srb.srb_status != 1){
DPRINT_WARN(STORVSC,
"cmd 0x%x scsi status 0x%x srb status 0x%x\n",
stor_pkt->vm_srb.cdb[0],
@@ -347,7 +305,6 @@ static void storvsc_on_receive(struct hv_device *device,
{
switch (vstor_packet->operation) {
case VSTOR_OPERATION_COMPLETE_IO:
- DPRINT_DBG(STORVSC, "IO_COMPLETE_OPERATION");
storvsc_on_io_completion(device, vstor_packet, request);
break;
case VSTOR_OPERATION_REMOVE_DEVICE:
@@ -374,20 +331,14 @@ static void storvsc_on_channel_callback(void *context)


stor_device = must_get_stor_device(device);
- if (!stor_device) {
- DPRINT_ERR(STORVSC, "unable to get stor device..."
- "device being destroyed?");
+ if (!stor_device)
return;
- }

do {
ret = vmbus_recvpacket(device->channel, packet,
ALIGN(sizeof(struct vstor_packet), 8),
&bytes_recvd, &request_id);
if (ret == 0 && bytes_recvd > 0) {
- DPRINT_DBG(STORVSC, "receive %d bytes - tid %llx",
- bytes_recvd, request_id);
-

request = (struct hv_storvsc_request *)
(unsigned long)request_id;
@@ -429,13 +380,8 @@ static int storvsc_connect_to_vsp(struct hv_device *device)
sizeof(struct vmstorage_channel_properties),
storvsc_on_channel_callback, device);

- DPRINT_DBG(STORVSC, "storage props: path id %d, tgt id %d, max xfer %d",
- props.path_id, props.target_id, props.max_transfer_bytes);
-
- if (ret != 0) {
- DPRINT_ERR(STORVSC, "unable to open channel: %d", ret);
+ if (ret != 0)
return -1;
- }

ret = storvsc_channel_init(device);

@@ -472,10 +418,6 @@ int storvsc_dev_add(struct hv_device *device,
device_info->path_id = stor_device->path_id;
device_info->target_id = stor_device->target_id;

- DPRINT_DBG(STORVSC, "assigned port %u, path %u target %u\n",
- stor_device->port_number, stor_device->path_id,
- stor_device->target_id);
-
cleanup:
return ret;
}
@@ -497,13 +439,8 @@ int storvsc_dev_remove(struct hv_device *device)

storvsc_wait_to_drain(stor_device);

- DPRINT_INFO(STORVSC, "removing storage device (%p)...",
- device->ext);
-
stor_device = final_release_stor_device(device);

- DPRINT_INFO(STORVSC, "storage device (%p) safe to remove", stor_device);
-
/* Close the channel */
vmbus_close(device->channel);

@@ -521,17 +458,8 @@ int storvsc_do_io(struct hv_device *device,
vstor_packet = &request->vstor_packet;
stor_device = get_stor_device(device);

- DPRINT_DBG(STORVSC, "enter - Device %p, DeviceExt %p, Request %p, "
- , device, stor_device, request);
-
- DPRINT_DBG(STORVSC, "req %p len %d",
- request, request->data_buffer.len);
-
- if (!stor_device) {
- DPRINT_ERR(STORVSC, "unable to get stor device..."
- "device being destroyed?");
+ if (!stor_device)
return -2;
- }


request->device = device;
@@ -550,16 +478,6 @@ int storvsc_do_io(struct hv_device *device,

vstor_packet->operation = VSTOR_OPERATION_EXECUTE_SRB;

- DPRINT_DBG(STORVSC, "srb - len %d port %d, path %d, target %d, "
- "lun %d senselen %d cdblen %d",
- vstor_packet->vm_srb.length,
- vstor_packet->vm_srb.port_number,
- vstor_packet->vm_srb.path_id,
- vstor_packet->vm_srb.target_id,
- vstor_packet->vm_srb.lun,
- vstor_packet->vm_srb.sense_info_length,
- vstor_packet->vm_srb.cdb_length);
-
if (request->data_buffer.len) {
ret = vmbus_sendpacket_multipagebuffer(device->channel,
&request->data_buffer,
@@ -574,10 +492,8 @@ int storvsc_do_io(struct hv_device *device,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
}

- if (ret != 0) {
- DPRINT_DBG(STORVSC, "Unable to send packet %p ret %d",
- vstor_packet, ret);
- }
+ if (ret != 0)
+ return ret;

atomic_inc(&stor_device->num_outstanding_req);

--
1.7.4.1

2011-05-09 22:08:35

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 032/206] Staging: hv: Rename g_driver_name

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index c54a5fe..d19df02 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -40,7 +40,7 @@
#include "channel.h"


-static const char *g_driver_name = "storvsc";
+static const char *driver_name = "storvsc";

/* {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} */
static const struct hv_guid gStorVscDeviceType = {
@@ -91,7 +91,7 @@ static int stor_vsc_initialize(struct hv_driver *driver)

/* Make sure we are at least 2 pages since 1 page is used for control */

- driver->name = g_driver_name;
+ driver->name = driver_name;
memcpy(&driver->dev_type, &gStorVscDeviceType,
sizeof(struct hv_guid));

--
1.7.4.1

2011-05-09 22:08:33

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 033/206] Staging: hv: Rename struct host_device_context

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index d19df02..2411f53 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -17,6 +17,7 @@
* Authors:
* Haiyang Zhang <[email protected]>
* Hank Janssen <[email protected]>
+ * K. Y. Srinivasan <[email protected]>
*/
#include <linux/init.h>
#include <linux/slab.h>
@@ -50,7 +51,7 @@ static const struct hv_guid gStorVscDeviceType = {
}
};

-struct host_device_context {
+struct hv_host_device {
/* must be 1st field
* FIXME this is a bug */
/* point back to our device context */
@@ -325,14 +326,14 @@ static int storvsc_probe(struct hv_device *device)
struct storvsc_driver *storvsc_drv_obj =
drv_to_stordrv(device->device.driver);
struct Scsi_Host *host;
- struct host_device_context *host_device_ctx;
+ struct hv_host_device *host_device_ctx;
struct storvsc_device_info device_info;

if (!storvsc_drv_obj->base.dev_add)
return -1;

host = scsi_host_alloc(&scsi_driver,
- sizeof(struct host_device_context));
+ sizeof(struct hv_host_device));
if (!host) {
DPRINT_ERR(STORVSC_DRV, "unable to allocate scsi host object");
return -ENOMEM;
@@ -340,8 +341,8 @@ static int storvsc_probe(struct hv_device *device)

dev_set_drvdata(&device->device, host);

- host_device_ctx = (struct host_device_context *)host->hostdata;
- memset(host_device_ctx, 0, sizeof(struct host_device_context));
+ host_device_ctx = (struct hv_host_device *)host->hostdata;
+ memset(host_device_ctx, 0, sizeof(struct hv_host_device));

host_device_ctx->port = host->host_no;
host_device_ctx->device_ctx = device;
@@ -402,8 +403,8 @@ static int storvsc_remove(struct hv_device *dev)
struct storvsc_driver *storvsc_drv_obj =
drv_to_stordrv(dev->device.driver);
struct Scsi_Host *host = dev_get_drvdata(&dev->device);
- struct host_device_context *host_device_ctx =
- (struct host_device_context *)host->hostdata;
+ struct hv_host_device *host_device_ctx =
+ (struct hv_host_device *)host->hostdata;

/*
* Call to the vsc driver to let it know that the device is being
@@ -432,8 +433,8 @@ static void storvsc_commmand_completion(struct hv_storvsc_request *request)
struct storvsc_cmd_request *cmd_request =
(struct storvsc_cmd_request *)request->context;
struct scsi_cmnd *scmnd = cmd_request->cmd;
- struct host_device_context *host_device_ctx =
- (struct host_device_context *)scmnd->device->host->hostdata;
+ struct hv_host_device *host_device_ctx =
+ (struct hv_host_device *)scmnd->device->host->hostdata;
void (*scsi_done_fn)(struct scsi_cmnd *);
struct scsi_sense_hdr sense_hdr;
struct vmscsi_request *vm_srb;
@@ -682,8 +683,8 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
void (*done)(struct scsi_cmnd *))
{
int ret;
- struct host_device_context *host_device_ctx =
- (struct host_device_context *)scmnd->device->host->hostdata;
+ struct hv_host_device *host_device_ctx =
+ (struct hv_host_device *)scmnd->device->host->hostdata;
struct hv_device *device_ctx = host_device_ctx->device_ctx;
struct storvsc_driver *storvsc_drv_obj =
drv_to_stordrv(device_ctx->device.driver);
@@ -915,8 +916,8 @@ static int storvsc_device_configure(struct scsi_device *sdevice)
static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
{
int ret;
- struct host_device_context *host_device_ctx =
- (struct host_device_context *)scmnd->device->host->hostdata;
+ struct hv_host_device *host_device_ctx =
+ (struct hv_host_device *)scmnd->device->host->hostdata;
struct hv_device *device_ctx = host_device_ctx->device_ctx;

DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host resetting...",
--
1.7.4.1

2011-05-09 22:07:43

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 034/206] Staging: hv: Rename variables pointing to struct hv_host_device

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 50 +++++++++++++++++++-------------------
1 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 2411f53..2e2e004 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -326,7 +326,7 @@ static int storvsc_probe(struct hv_device *device)
struct storvsc_driver *storvsc_drv_obj =
drv_to_stordrv(device->device.driver);
struct Scsi_Host *host;
- struct hv_host_device *host_device_ctx;
+ struct hv_host_device *host_dev;
struct storvsc_device_info device_info;

if (!storvsc_drv_obj->base.dev_add)
@@ -341,18 +341,18 @@ static int storvsc_probe(struct hv_device *device)

dev_set_drvdata(&device->device, host);

- host_device_ctx = (struct hv_host_device *)host->hostdata;
- memset(host_device_ctx, 0, sizeof(struct hv_host_device));
+ host_dev = (struct hv_host_device *)host->hostdata;
+ memset(host_dev, 0, sizeof(struct hv_host_device));

- host_device_ctx->port = host->host_no;
- host_device_ctx->device_ctx = device;
+ host_dev->port = host->host_no;
+ host_dev->device_ctx = device;

- host_device_ctx->request_pool =
+ host_dev->request_pool =
kmem_cache_create(dev_name(&device->device),
sizeof(struct storvsc_cmd_request), 0,
SLAB_HWCACHE_ALIGN, NULL);

- if (!host_device_ctx->request_pool) {
+ if (!host_dev->request_pool) {
scsi_host_put(host);
return -ENOMEM;
}
@@ -363,14 +363,14 @@ static int storvsc_probe(struct hv_device *device)

if (ret != 0) {
DPRINT_ERR(STORVSC_DRV, "unable to add scsi vsc device");
- kmem_cache_destroy(host_device_ctx->request_pool);
+ kmem_cache_destroy(host_dev->request_pool);
scsi_host_put(host);
return -1;
}

/* host_device_ctx->port = device_info.PortNumber; */
- host_device_ctx->path = device_info.path_id;
- host_device_ctx->target = device_info.target_id;
+ host_dev->path = device_info.path_id;
+ host_dev->target = device_info.target_id;

/* max # of devices per target */
host->max_lun = STORVSC_MAX_LUNS_PER_TARGET;
@@ -386,7 +386,7 @@ static int storvsc_probe(struct hv_device *device)

storvsc_drv_obj->base.dev_rm(device);

- kmem_cache_destroy(host_device_ctx->request_pool);
+ kmem_cache_destroy(host_dev->request_pool);
scsi_host_put(host);
return -1;
}
@@ -403,7 +403,7 @@ static int storvsc_remove(struct hv_device *dev)
struct storvsc_driver *storvsc_drv_obj =
drv_to_stordrv(dev->device.driver);
struct Scsi_Host *host = dev_get_drvdata(&dev->device);
- struct hv_host_device *host_device_ctx =
+ struct hv_host_device *host_dev =
(struct hv_host_device *)host->hostdata;

/*
@@ -412,9 +412,9 @@ static int storvsc_remove(struct hv_device *dev)
*/
storvsc_drv_obj->base.dev_rm(dev);

- if (host_device_ctx->request_pool) {
- kmem_cache_destroy(host_device_ctx->request_pool);
- host_device_ctx->request_pool = NULL;
+ if (host_dev->request_pool) {
+ kmem_cache_destroy(host_dev->request_pool);
+ host_dev->request_pool = NULL;
}

DPRINT_INFO(STORVSC, "removing host adapter (%p)...", host);
@@ -433,7 +433,7 @@ static void storvsc_commmand_completion(struct hv_storvsc_request *request)
struct storvsc_cmd_request *cmd_request =
(struct storvsc_cmd_request *)request->context;
struct scsi_cmnd *scmnd = cmd_request->cmd;
- struct hv_host_device *host_device_ctx =
+ struct hv_host_device *host_dev =
(struct hv_host_device *)scmnd->device->host->hostdata;
void (*scsi_done_fn)(struct scsi_cmnd *);
struct scsi_sense_hdr sense_hdr;
@@ -479,7 +479,7 @@ static void storvsc_commmand_completion(struct hv_storvsc_request *request)
/* !!DO NOT MODIFY the scmnd after this call */
scsi_done_fn(scmnd);

- kmem_cache_free(host_device_ctx->request_pool, cmd_request);
+ kmem_cache_free(host_dev->request_pool, cmd_request);
}

static int do_bounce_buffer(struct scatterlist *sgl, unsigned int sg_count)
@@ -683,9 +683,9 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
void (*done)(struct scsi_cmnd *))
{
int ret;
- struct hv_host_device *host_device_ctx =
+ struct hv_host_device *host_dev =
(struct hv_host_device *)scmnd->device->host->hostdata;
- struct hv_device *device_ctx = host_device_ctx->device_ctx;
+ struct hv_device *device_ctx = host_dev->device_ctx;
struct storvsc_driver *storvsc_drv_obj =
drv_to_stordrv(device_ctx->device.driver);
struct hv_storvsc_request *request;
@@ -721,7 +721,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,

request_size = sizeof(struct storvsc_cmd_request);

- cmd_request = kmem_cache_zalloc(host_device_ctx->request_pool,
+ cmd_request = kmem_cache_zalloc(host_dev->request_pool,
GFP_ATOMIC);
if (!cmd_request) {
DPRINT_ERR(STORVSC_DRV, "scmnd (%p) - unable to allocate "
@@ -759,7 +759,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
request->context = cmd_request;/* scmnd; */

/* request->PortId = scmnd->device->channel; */
- vm_srb->port_number = host_device_ctx->port;
+ vm_srb->port_number = host_dev->port;
vm_srb->path_id = scmnd->device->channel;
vm_srb->target_id = scmnd->device->id;
vm_srb->lun = scmnd->device->lun;
@@ -792,7 +792,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,

scmnd->scsi_done = NULL;
scmnd->host_scribble = NULL;
- kmem_cache_free(host_device_ctx->request_pool,
+ kmem_cache_free(host_dev->request_pool,
cmd_request);

return SCSI_MLQUEUE_HOST_BUSY;
@@ -851,7 +851,7 @@ retry_request:
cmd_request->bounce_sgl_count);
}

- kmem_cache_free(host_device_ctx->request_pool, cmd_request);
+ kmem_cache_free(host_dev->request_pool, cmd_request);

scmnd->scsi_done = NULL;
scmnd->host_scribble = NULL;
@@ -916,9 +916,9 @@ static int storvsc_device_configure(struct scsi_device *sdevice)
static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
{
int ret;
- struct hv_host_device *host_device_ctx =
+ struct hv_host_device *host_dev =
(struct hv_host_device *)scmnd->device->host->hostdata;
- struct hv_device *device_ctx = host_device_ctx->device_ctx;
+ struct hv_device *device_ctx = host_dev->device_ctx;

DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host resetting...",
scmnd->device, device_ctx);
--
1.7.4.1

2011-05-09 22:07:45

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 035/206] Staging: hv: Rename the struct hv_device * element of struct hv_host_device

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 2e2e004..c183220 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -55,7 +55,7 @@ struct hv_host_device {
/* must be 1st field
* FIXME this is a bug */
/* point back to our device context */
- struct hv_device *device_ctx;
+ struct hv_device *dev;
struct kmem_cache *request_pool;
unsigned int port;
unsigned char path;
@@ -345,7 +345,7 @@ static int storvsc_probe(struct hv_device *device)
memset(host_dev, 0, sizeof(struct hv_host_device));

host_dev->port = host->host_no;
- host_dev->device_ctx = device;
+ host_dev->dev = device;

host_dev->request_pool =
kmem_cache_create(dev_name(&device->device),
@@ -685,7 +685,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
int ret;
struct hv_host_device *host_dev =
(struct hv_host_device *)scmnd->device->host->hostdata;
- struct hv_device *device_ctx = host_dev->device_ctx;
+ struct hv_device *device_ctx = host_dev->dev;
struct storvsc_driver *storvsc_drv_obj =
drv_to_stordrv(device_ctx->device.driver);
struct hv_storvsc_request *request;
@@ -918,7 +918,7 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
int ret;
struct hv_host_device *host_dev =
(struct hv_host_device *)scmnd->device->host->hostdata;
- struct hv_device *device_ctx = host_dev->device_ctx;
+ struct hv_device *device_ctx = host_dev->dev;

DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host resetting...",
scmnd->device, device_ctx);
--
1.7.4.1

2011-05-09 22:07:42

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 036/206] Staging: hv: Rename variables pointing to struct hv_device

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index c183220..c654172 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -368,7 +368,6 @@ static int storvsc_probe(struct hv_device *device)
return -1;
}

- /* host_device_ctx->port = device_info.PortNumber; */
host_dev->path = device_info.path_id;
host_dev->target = device_info.target_id;

@@ -685,9 +684,9 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
int ret;
struct hv_host_device *host_dev =
(struct hv_host_device *)scmnd->device->host->hostdata;
- struct hv_device *device_ctx = host_dev->dev;
+ struct hv_device *dev = host_dev->dev;
struct storvsc_driver *storvsc_drv_obj =
- drv_to_stordrv(device_ctx->device.driver);
+ drv_to_stordrv(dev->device.driver);
struct hv_storvsc_request *request;
struct storvsc_cmd_request *cmd_request;
unsigned int request_size = 0;
@@ -831,7 +830,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,

retry_request:
/* Invokes the vsc to start an IO */
- ret = storvsc_drv_obj->on_io_request(device_ctx,
+ ret = storvsc_drv_obj->on_io_request(dev,
&cmd_request->request);
if (ret == -1) {
/* no more space */
@@ -918,18 +917,18 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
int ret;
struct hv_host_device *host_dev =
(struct hv_host_device *)scmnd->device->host->hostdata;
- struct hv_device *device_ctx = host_dev->dev;
+ struct hv_device *dev = host_dev->dev;

DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host resetting...",
- scmnd->device, device_ctx);
+ scmnd->device, dev);

/* Invokes the vsc to reset the host/bus */
- ret = stor_vsc_on_host_reset(device_ctx);
+ ret = stor_vsc_on_host_reset(dev);
if (ret != 0)
return ret;

DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host reseted",
- scmnd->device, device_ctx);
+ scmnd->device, dev);

return ret;
}
--
1.7.4.1

2011-05-09 22:04:54

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 037/206] Staging: hv: Get rid of some dated comments

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index c654172..2f252ea 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -52,9 +52,6 @@ static const struct hv_guid gStorVscDeviceType = {
};

struct hv_host_device {
- /* must be 1st field
- * FIXME this is a bug */
- /* point back to our device context */
struct hv_device *dev;
struct kmem_cache *request_pool;
unsigned int port;
--
1.7.4.1

2011-05-09 22:04:50

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 038/206] Staging: hv: Get rid of some DPRINTS

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 65 +++----------------------------------
1 files changed, 6 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 2f252ea..52d8974 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -79,13 +79,6 @@ static int stor_vsc_initialize(struct hv_driver *driver)

stor_driver = hvdr_to_stordr(driver);

- DPRINT_DBG(STORVSC,
- "sizeof(struct hv_storvsc_request)=%zd "
- "sizeof(struct vstor_packet)=%zd, "
- "sizeof(struct vmscsi_request)=%zd",
- sizeof(struct hv_storvsc_request),
- sizeof(struct vstor_packet),
- sizeof(struct vmscsi_request));

/* Make sure we are at least 2 pages since 1 page is used for control */

@@ -199,14 +192,8 @@ static int storvsc_drv_init(void)
storvsc_drv_obj->max_outstanding_req_per_channel);

if (storvsc_drv_obj->max_outstanding_req_per_channel <
- STORVSC_MAX_IO_REQUESTS) {
- DPRINT_ERR(STORVSC_DRV,
- "The number of outstanding io requests (%d) "
- "is larger than that supported (%d) internally.",
- STORVSC_MAX_IO_REQUESTS,
- storvsc_drv_obj->max_outstanding_req_per_channel);
+ STORVSC_MAX_IO_REQUESTS)
return -1;
- }

drv->driver.name = storvsc_drv_obj->base.name;

@@ -230,11 +217,8 @@ static int stor_vsc_on_host_reset(struct hv_device *device)
DPRINT_INFO(STORVSC, "resetting host adapter...");

stor_device = get_stor_device(device);
- if (!stor_device) {
- DPRINT_ERR(STORVSC, "unable to get stor device..."
- "device being destroyed?");
+ if (!stor_device)
return -1;
- }

request = &stor_device->reset_request;
vstor_packet = &request->vstor_packet;
@@ -250,11 +234,8 @@ static int stor_vsc_on_host_reset(struct hv_device *device)
(unsigned long)&stor_device->reset_request,
VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
- if (ret != 0) {
- DPRINT_ERR(STORVSC, "Unable to send reset packet %p ret %d",
- vstor_packet, ret);
+ if (ret != 0)
goto cleanup;
- }

t = wait_for_completion_timeout(&request->wait_event, HZ);
if (t == 0) {
@@ -296,9 +277,6 @@ static void storvsc_drv_exit(void)
(void *) &current_dev,
storvsc_drv_exit_cb);

- if (ret)
- DPRINT_WARN(STORVSC_DRV,
- "driver_for_each_device returned %d", ret);

if (current_dev == NULL)
break;
@@ -331,10 +309,8 @@ static int storvsc_probe(struct hv_device *device)

host = scsi_host_alloc(&scsi_driver,
sizeof(struct hv_host_device));
- if (!host) {
- DPRINT_ERR(STORVSC_DRV, "unable to allocate scsi host object");
+ if (!host)
return -ENOMEM;
- }

dev_set_drvdata(&device->device, host);

@@ -359,7 +335,6 @@ static int storvsc_probe(struct hv_device *device)
ret = storvsc_drv_obj->base.dev_add(device, (void *)&device_info);

if (ret != 0) {
- DPRINT_ERR(STORVSC_DRV, "unable to add scsi vsc device");
kmem_cache_destroy(host_dev->request_pool);
scsi_host_put(host);
return -1;
@@ -378,7 +353,6 @@ static int storvsc_probe(struct hv_device *device)
/* Register the HBA and start the scsi bus scan */
ret = scsi_add_host(host, &device->device);
if (ret != 0) {
- DPRINT_ERR(STORVSC_DRV, "unable to add scsi host device");

storvsc_drv_obj->base.dev_rm(device);

@@ -692,11 +666,6 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
unsigned int sg_count = 0;
struct vmscsi_request *vm_srb;

- DPRINT_DBG(STORVSC_DRV, "scmnd %p dir %d, use_sg %d buf %p len %d "
- "queue depth %d tagged %d", scmnd, scmnd->sc_data_direction,
- scsi_sg_count(scmnd), scsi_sglist(scmnd),
- scsi_bufflen(scmnd), scmnd->device->queue_depth,
- scmnd->device->tagged_supported);

/* If retrying, no need to prep the cmd */
if (scmnd->host_scribble) {
@@ -720,8 +689,6 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
cmd_request = kmem_cache_zalloc(host_dev->request_pool,
GFP_ATOMIC);
if (!cmd_request) {
- DPRINT_ERR(STORVSC_DRV, "scmnd (%p) - unable to allocate "
- "storvsc_cmd_request...marking queue busy", scmnd);
scmnd->scsi_done = NULL;
return SCSI_MLQUEUE_DEVICE_BUSY;
}
@@ -736,7 +703,6 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
request = &cmd_request->request;
vm_srb = &request->vstor_packet.vm_srb;

- DPRINT_DBG(STORVSC_DRV, "req %p size %d", request, request_size);

/* Build the SRB */
switch (scmnd->sc_data_direction) {
@@ -775,17 +741,10 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,

/* check if we need to bounce the sgl */
if (do_bounce_buffer(sgl, scsi_sg_count(scmnd)) != -1) {
- DPRINT_INFO(STORVSC_DRV,
- "need to bounce buffer for this scmnd %p",
- scmnd);
cmd_request->bounce_sgl =
create_bounce_buffer(sgl, scsi_sg_count(scmnd),
scsi_bufflen(scmnd));
if (!cmd_request->bounce_sgl) {
- DPRINT_ERR(STORVSC_DRV,
- "unable to create bounce buffer for "
- "this scmnd %p", scmnd);
-
scmnd->scsi_done = NULL;
scmnd->host_scribble = NULL;
kmem_cache_free(host_dev->request_pool,
@@ -811,12 +770,10 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,

request->data_buffer.offset = sgl[0].offset;

- for (i = 0; i < sg_count; i++) {
- DPRINT_DBG(STORVSC_DRV, "sgl[%d] len %d offset %d\n",
- i, sgl[i].length, sgl[i].offset);
+ for (i = 0; i < sg_count; i++)
request->data_buffer.pfn_array[i] =
page_to_pfn(sg_page((&sgl[i])));
- }
+
} else if (scsi_sglist(scmnd)) {
/* ASSERT(scsi_bufflen(scmnd) <= PAGE_SIZE); */
request->data_buffer.offset =
@@ -831,9 +788,6 @@ retry_request:
&cmd_request->request);
if (ret == -1) {
/* no more space */
- DPRINT_ERR(STORVSC_DRV,
- "scmnd (%p) - queue FULL...marking queue busy",
- scmnd);

if (cmd_request->bounce_sgl_count) {
/*
@@ -872,8 +826,6 @@ static int storvsc_merge_bvec(struct request_queue *q,
*/
static int storvsc_device_alloc(struct scsi_device *sdevice)
{
- DPRINT_DBG(STORVSC_DRV, "sdev (%p) - setting device flag to %d",
- sdevice, BLIST_SPARSELUN);
/*
* This enables luns to be located sparsely. Otherwise, we may not
* discovered them.
@@ -884,11 +836,6 @@ static int storvsc_device_alloc(struct scsi_device *sdevice)

static int storvsc_device_configure(struct scsi_device *sdevice)
{
- DPRINT_INFO(STORVSC_DRV, "sdev (%p) - curr queue depth %d", sdevice,
- sdevice->queue_depth);
-
- DPRINT_INFO(STORVSC_DRV, "sdev (%p) - setting queue depth to %d",
- sdevice, STORVSC_MAX_IO_REQUESTS);
scsi_adjust_queue_depth(sdevice, MSG_SIMPLE_TAG,
STORVSC_MAX_IO_REQUESTS);

--
1.7.4.1

2011-05-09 22:04:55

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 039/206] Staging: hv: Get rid of the forward declaration for storvsc_device_alloc()

Get rid of the forward declaration by moving the code around.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 24 ++++++++++--------------
1 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 52d8974..2bd9c09 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -112,10 +112,19 @@ static int stor_vsc_initialize(struct hv_driver *driver)
return 0;
}

+static int storvsc_device_alloc(struct scsi_device *sdevice)
+{
+ /*
+ * This enables luns to be located sparsely. Otherwise, we may not
+ * discovered them.
+ */
+ sdevice->sdev_bflags |= BLIST_SPARSELUN | BLIST_LARGELUN;
+ return 0;
+}
+
/* Static decl */
static int storvsc_probe(struct hv_device *dev);
static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd);
-static int storvsc_device_alloc(struct scsi_device *);
static int storvsc_device_configure(struct scsi_device *);
static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd);
static int storvsc_remove(struct hv_device *dev);
@@ -821,19 +830,6 @@ static int storvsc_merge_bvec(struct request_queue *q,
return bvec->bv_len;
}

-/*
- * storvsc_device_configure - Configure the specified scsi device
- */
-static int storvsc_device_alloc(struct scsi_device *sdevice)
-{
- /*
- * This enables luns to be located sparsely. Otherwise, we may not
- * discovered them.
- */
- sdevice->sdev_bflags |= BLIST_SPARSELUN | BLIST_LARGELUN;
- return 0;
-}
-
static int storvsc_device_configure(struct scsi_device *sdevice)
{
scsi_adjust_queue_depth(sdevice, MSG_SIMPLE_TAG,
--
1.7.4.1

2011-05-09 22:04:53

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 040/206] Staging: hv: Move the function storvsc_merge_bvec() to earlier in the file

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 2bd9c09..44dbaae 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -122,6 +122,13 @@ static int storvsc_device_alloc(struct scsi_device *sdevice)
return 0;
}

+static int storvsc_merge_bvec(struct request_queue *q,
+ struct bvec_merge_data *bmd, struct bio_vec *bvec)
+{
+ /* checking done by caller. */
+ return bvec->bv_len;
+}
+
/* Static decl */
static int storvsc_probe(struct hv_device *dev);
static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd);
@@ -823,13 +830,6 @@ retry_request:

static DEF_SCSI_QCMD(storvsc_queuecommand)

-static int storvsc_merge_bvec(struct request_queue *q,
- struct bvec_merge_data *bmd, struct bio_vec *bvec)
-{
- /* checking done by caller. */
- return bvec->bv_len;
-}
-
static int storvsc_device_configure(struct scsi_device *sdevice)
{
scsi_adjust_queue_depth(sdevice, MSG_SIMPLE_TAG,
--
1.7.4.1

2011-05-09 22:04:51

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 041/206] Staging: hv: Get rid of the forward declaration for storvsc_device_configure()

Get rid of the forward declaration by moving the code around.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 39 ++++++++++++++++++-------------------
1 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 44dbaae..4196d6a 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -129,10 +129,28 @@ static int storvsc_merge_bvec(struct request_queue *q,
return bvec->bv_len;
}

+static int storvsc_device_configure(struct scsi_device *sdevice)
+{
+ scsi_adjust_queue_depth(sdevice, MSG_SIMPLE_TAG,
+ STORVSC_MAX_IO_REQUESTS);
+
+ DPRINT_INFO(STORVSC_DRV, "sdev (%p) - setting max segment size to %ld",
+ sdevice, PAGE_SIZE);
+ blk_queue_max_segment_size(sdevice->request_queue, PAGE_SIZE);
+
+ DPRINT_INFO(STORVSC_DRV, "sdev (%p) - adding merge bio vec routine",
+ sdevice);
+ blk_queue_merge_bvec(sdevice->request_queue, storvsc_merge_bvec);
+
+ blk_queue_bounce_limit(sdevice->request_queue, BLK_BOUNCE_ANY);
+ /* sdevice->timeout = (2000 * HZ);//(75 * HZ); */
+
+ return 0;
+}
+
/* Static decl */
static int storvsc_probe(struct hv_device *dev);
static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd);
-static int storvsc_device_configure(struct scsi_device *);
static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd);
static int storvsc_remove(struct hv_device *dev);

@@ -830,25 +848,6 @@ retry_request:

static DEF_SCSI_QCMD(storvsc_queuecommand)

-static int storvsc_device_configure(struct scsi_device *sdevice)
-{
- scsi_adjust_queue_depth(sdevice, MSG_SIMPLE_TAG,
- STORVSC_MAX_IO_REQUESTS);
-
- DPRINT_INFO(STORVSC_DRV, "sdev (%p) - setting max segment size to %ld",
- sdevice, PAGE_SIZE);
- blk_queue_max_segment_size(sdevice->request_queue, PAGE_SIZE);
-
- DPRINT_INFO(STORVSC_DRV, "sdev (%p) - adding merge bio vec routine",
- sdevice);
- blk_queue_merge_bvec(sdevice->request_queue, storvsc_merge_bvec);
-
- blk_queue_bounce_limit(sdevice->request_queue, BLK_BOUNCE_ANY);
- /* sdevice->timeout = (2000 * HZ);//(75 * HZ); */
-
- return 0;
-}
-
/*
* storvsc_host_reset_handler - Reset the scsi HBA
*/
--
1.7.4.1

2011-05-09 22:04:45

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 042/206] Staging: hv: Get rid of the forwrd declaration of destroy_bounce_buffer

Get rid of the forward declaration by moving the code around.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 32 +++++++++++++++-----------------
1 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 4196d6a..bf5b138 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -148,6 +148,21 @@ static int storvsc_device_configure(struct scsi_device *sdevice)
return 0;
}

+static void destroy_bounce_buffer(struct scatterlist *sgl,
+ unsigned int sg_count)
+{
+ int i;
+ struct page *page_buf;
+
+ for (i = 0; i < sg_count; i++) {
+ page_buf = sg_page((&sgl[i]));
+ if (page_buf != NULL)
+ __free_page(page_buf);
+ }
+
+ kfree(sgl);
+}
+
/* Static decl */
static int storvsc_probe(struct hv_device *dev);
static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd);
@@ -157,8 +172,6 @@ static int storvsc_remove(struct hv_device *dev);
static struct scatterlist *create_bounce_buffer(struct scatterlist *sgl,
unsigned int sg_count,
unsigned int len);
-static void destroy_bounce_buffer(struct scatterlist *sgl,
- unsigned int sg_count);
static int do_bounce_buffer(struct scatterlist *sgl, unsigned int sg_count);
static unsigned int copy_from_bounce_buffer(struct scatterlist *orig_sgl,
struct scatterlist *bounce_sgl,
@@ -542,21 +555,6 @@ cleanup:
return NULL;
}

-static void destroy_bounce_buffer(struct scatterlist *sgl,
- unsigned int sg_count)
-{
- int i;
- struct page *page_buf;
-
- for (i = 0; i < sg_count; i++) {
- page_buf = sg_page((&sgl[i]));
- if (page_buf != NULL)
- __free_page(page_buf);
- }
-
- kfree(sgl);
-}
-
/* Assume the bounce_sgl has enough room ie using the create_bounce_buffer() */
static unsigned int copy_to_bounce_buffer(struct scatterlist *orig_sgl,
struct scatterlist *bounce_sgl,
--
1.7.4.1

2011-05-09 22:04:49

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 043/206] Staging: hv: Get rid of the forward declaration for do_bounce_buffer()

Get rid of the forward declaration by moving the code around.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 55 ++++++++++++++++++-------------------
1 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index bf5b138..9380866 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -163,6 +163,33 @@ static void destroy_bounce_buffer(struct scatterlist *sgl,
kfree(sgl);
}

+static int do_bounce_buffer(struct scatterlist *sgl, unsigned int sg_count)
+{
+ int i;
+
+ /* No need to check */
+ if (sg_count < 2)
+ return -1;
+
+ /* We have at least 2 sg entries */
+ for (i = 0; i < sg_count; i++) {
+ if (i == 0) {
+ /* make sure 1st one does not have hole */
+ if (sgl[i].offset + sgl[i].length != PAGE_SIZE)
+ return i;
+ } else if (i == sg_count - 1) {
+ /* make sure last one does not have hole */
+ if (sgl[i].offset != 0)
+ return i;
+ } else {
+ /* make sure no hole in the middle */
+ if (sgl[i].length != PAGE_SIZE || sgl[i].offset != 0)
+ return i;
+ }
+ }
+ return -1;
+}
+
/* Static decl */
static int storvsc_probe(struct hv_device *dev);
static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd);
@@ -172,7 +199,6 @@ static int storvsc_remove(struct hv_device *dev);
static struct scatterlist *create_bounce_buffer(struct scatterlist *sgl,
unsigned int sg_count,
unsigned int len);
-static int do_bounce_buffer(struct scatterlist *sgl, unsigned int sg_count);
static unsigned int copy_from_bounce_buffer(struct scatterlist *orig_sgl,
struct scatterlist *bounce_sgl,
unsigned int orig_sgl_count);
@@ -499,33 +525,6 @@ static void storvsc_commmand_completion(struct hv_storvsc_request *request)
kmem_cache_free(host_dev->request_pool, cmd_request);
}

-static int do_bounce_buffer(struct scatterlist *sgl, unsigned int sg_count)
-{
- int i;
-
- /* No need to check */
- if (sg_count < 2)
- return -1;
-
- /* We have at least 2 sg entries */
- for (i = 0; i < sg_count; i++) {
- if (i == 0) {
- /* make sure 1st one does not have hole */
- if (sgl[i].offset + sgl[i].length != PAGE_SIZE)
- return i;
- } else if (i == sg_count - 1) {
- /* make sure last one does not have hole */
- if (sgl[i].offset != 0)
- return i;
- } else {
- /* make sure no hole in the middle */
- if (sgl[i].length != PAGE_SIZE || sgl[i].offset != 0)
- return i;
- }
- }
- return -1;
-}
-
static struct scatterlist *create_bounce_buffer(struct scatterlist *sgl,
unsigned int sg_count,
unsigned int len)
--
1.7.4.1

2011-05-09 22:03:15

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 044/206] Staging: hv: Get rid of the forward declaration for create_bounce_buffer()

Get rid of the forward declaration by moving the code around.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 61 ++++++++++++++++++--------------------
1 files changed, 29 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 9380866..551c48c 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -190,15 +190,41 @@ static int do_bounce_buffer(struct scatterlist *sgl, unsigned int sg_count)
return -1;
}

+static struct scatterlist *create_bounce_buffer(struct scatterlist *sgl,
+ unsigned int sg_count,
+ unsigned int len)
+{
+ int i;
+ int num_pages;
+ struct scatterlist *bounce_sgl;
+ struct page *page_buf;
+
+ num_pages = ALIGN(len, PAGE_SIZE) >> PAGE_SHIFT;
+
+ bounce_sgl = kcalloc(num_pages, sizeof(struct scatterlist), GFP_ATOMIC);
+ if (!bounce_sgl)
+ return NULL;
+
+ for (i = 0; i < num_pages; i++) {
+ page_buf = alloc_page(GFP_ATOMIC);
+ if (!page_buf)
+ goto cleanup;
+ sg_set_page(&bounce_sgl[i], page_buf, 0, 0);
+ }
+
+ return bounce_sgl;
+
+cleanup:
+ destroy_bounce_buffer(bounce_sgl, num_pages);
+ return NULL;
+}
+
/* Static decl */
static int storvsc_probe(struct hv_device *dev);
static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd);
static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd);
static int storvsc_remove(struct hv_device *dev);

-static struct scatterlist *create_bounce_buffer(struct scatterlist *sgl,
- unsigned int sg_count,
- unsigned int len);
static unsigned int copy_from_bounce_buffer(struct scatterlist *orig_sgl,
struct scatterlist *bounce_sgl,
unsigned int orig_sgl_count);
@@ -525,35 +551,6 @@ static void storvsc_commmand_completion(struct hv_storvsc_request *request)
kmem_cache_free(host_dev->request_pool, cmd_request);
}

-static struct scatterlist *create_bounce_buffer(struct scatterlist *sgl,
- unsigned int sg_count,
- unsigned int len)
-{
- int i;
- int num_pages;
- struct scatterlist *bounce_sgl;
- struct page *page_buf;
-
- num_pages = ALIGN(len, PAGE_SIZE) >> PAGE_SHIFT;
-
- bounce_sgl = kcalloc(num_pages, sizeof(struct scatterlist), GFP_ATOMIC);
- if (!bounce_sgl)
- return NULL;
-
- for (i = 0; i < num_pages; i++) {
- page_buf = alloc_page(GFP_ATOMIC);
- if (!page_buf)
- goto cleanup;
- sg_set_page(&bounce_sgl[i], page_buf, 0, 0);
- }
-
- return bounce_sgl;
-
-cleanup:
- destroy_bounce_buffer(bounce_sgl, num_pages);
- return NULL;
-}
-
/* Assume the bounce_sgl has enough room ie using the create_bounce_buffer() */
static unsigned int copy_to_bounce_buffer(struct scatterlist *orig_sgl,
struct scatterlist *bounce_sgl,
--
1.7.4.1

2011-05-09 22:04:47

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 045/206] Staging: hv: Get rid of the forward declaration of copy_from_bounce_buffer()

Get rid of the forward declaration by moving the code around.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 129 +++++++++++++++++++-------------------
1 files changed, 65 insertions(+), 64 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 551c48c..4e3e9ca 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -219,15 +219,77 @@ cleanup:
return NULL;
}

+
+/* Assume the original sgl has enough room */
+static unsigned int copy_from_bounce_buffer(struct scatterlist *orig_sgl,
+ struct scatterlist *bounce_sgl,
+ unsigned int orig_sgl_count)
+{
+ int i;
+ int j = 0;
+ unsigned long src, dest;
+ unsigned int srclen, destlen, copylen;
+ unsigned int total_copied = 0;
+ unsigned long bounce_addr = 0;
+ unsigned long dest_addr = 0;
+ unsigned long flags;
+
+ local_irq_save(flags);
+
+ for (i = 0; i < orig_sgl_count; i++) {
+ dest_addr = (unsigned long)kmap_atomic(sg_page((&orig_sgl[i])),
+ KM_IRQ0) + orig_sgl[i].offset;
+ dest = dest_addr;
+ destlen = orig_sgl[i].length;
+
+ if (bounce_addr == 0)
+ bounce_addr =
+ (unsigned long)kmap_atomic(sg_page((&bounce_sgl[j])),
+ KM_IRQ0);
+
+ while (destlen) {
+ src = bounce_addr + bounce_sgl[j].offset;
+ srclen = bounce_sgl[j].length - bounce_sgl[j].offset;
+
+ copylen = min(srclen, destlen);
+ memcpy((void *)dest, (void *)src, copylen);
+
+ total_copied += copylen;
+ bounce_sgl[j].offset += copylen;
+ destlen -= copylen;
+ dest += copylen;
+
+ if (bounce_sgl[j].offset == bounce_sgl[j].length) {
+ /* full */
+ kunmap_atomic((void *)bounce_addr, KM_IRQ0);
+ j++;
+
+ /* if we need to use another bounce buffer */
+ if (destlen || i != orig_sgl_count - 1)
+ bounce_addr =
+ (unsigned long)kmap_atomic(
+ sg_page((&bounce_sgl[j])), KM_IRQ0);
+ } else if (destlen == 0 && i == orig_sgl_count - 1) {
+ /* unmap the last bounce that is < PAGE_SIZE */
+ kunmap_atomic((void *)bounce_addr, KM_IRQ0);
+ }
+ }
+
+ kunmap_atomic((void *)(dest_addr - orig_sgl[i].offset),
+ KM_IRQ0);
+ }
+
+ local_irq_restore(flags);
+
+ return total_copied;
+}
+
/* Static decl */
static int storvsc_probe(struct hv_device *dev);
static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd);
static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd);
static int storvsc_remove(struct hv_device *dev);

-static unsigned int copy_from_bounce_buffer(struct scatterlist *orig_sgl,
- struct scatterlist *bounce_sgl,
- unsigned int orig_sgl_count);
static unsigned int copy_to_bounce_buffer(struct scatterlist *orig_sgl,
struct scatterlist *bounce_sgl,
unsigned int orig_sgl_count);
@@ -613,67 +675,6 @@ static unsigned int copy_to_bounce_buffer(struct scatterlist *orig_sgl,
return total_copied;
}

-/* Assume the original sgl has enough room */
-static unsigned int copy_from_bounce_buffer(struct scatterlist *orig_sgl,
- struct scatterlist *bounce_sgl,
- unsigned int orig_sgl_count)
-{
- int i;
- int j = 0;
- unsigned long src, dest;
- unsigned int srclen, destlen, copylen;
- unsigned int total_copied = 0;
- unsigned long bounce_addr = 0;
- unsigned long dest_addr = 0;
- unsigned long flags;
-
- local_irq_save(flags);
-
- for (i = 0; i < orig_sgl_count; i++) {
- dest_addr = (unsigned long)kmap_atomic(sg_page((&orig_sgl[i])),
- KM_IRQ0) + orig_sgl[i].offset;
- dest = dest_addr;
- destlen = orig_sgl[i].length;
- /* ASSERT(orig_sgl[i].offset + orig_sgl[i].length <= PAGE_SIZE); */
-
- if (bounce_addr == 0)
- bounce_addr = (unsigned long)kmap_atomic(sg_page((&bounce_sgl[j])), KM_IRQ0);
-
- while (destlen) {
- src = bounce_addr + bounce_sgl[j].offset;
- srclen = bounce_sgl[j].length - bounce_sgl[j].offset;
-
- copylen = min(srclen, destlen);
- memcpy((void *)dest, (void *)src, copylen);
-
- total_copied += copylen;
- bounce_sgl[j].offset += copylen;
- destlen -= copylen;
- dest += copylen;
-
- if (bounce_sgl[j].offset == bounce_sgl[j].length) {
- /* full */
- kunmap_atomic((void *)bounce_addr, KM_IRQ0);
- j++;
-
- /* if we need to use another bounce buffer */
- if (destlen || i != orig_sgl_count - 1)
- bounce_addr = (unsigned long)kmap_atomic(sg_page((&bounce_sgl[j])), KM_IRQ0);
- } else if (destlen == 0 && i == orig_sgl_count - 1) {
- /* unmap the last bounce that is < PAGE_SIZE */
- kunmap_atomic((void *)bounce_addr, KM_IRQ0);
- }
- }
-
- kunmap_atomic((void *)(dest_addr - orig_sgl[i].offset),
- KM_IRQ0);
- }
-
- local_irq_restore(flags);
-
- return total_copied;
-}
-
/*
* storvsc_queuecommand - Initiate command processing
*/
--
1.7.4.1

2011-05-09 22:03:16

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 046/206] Staging: hv: Get rid of the forward declaration for copy_to_bounce_buffer()

Get rid of the forward declaration by moving the code around.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 132 +++++++++++++++++++-------------------
1 files changed, 66 insertions(+), 66 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 4e3e9ca..807ba89 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -284,16 +284,78 @@ static unsigned int copy_from_bounce_buffer(struct scatterlist *orig_sgl,
return total_copied;
}

+
+/* Assume the bounce_sgl has enough room ie using the create_bounce_buffer() */
+static unsigned int copy_to_bounce_buffer(struct scatterlist *orig_sgl,
+ struct scatterlist *bounce_sgl,
+ unsigned int orig_sgl_count)
+{
+ int i;
+ int j = 0;
+ unsigned long src, dest;
+ unsigned int srclen, destlen, copylen;
+ unsigned int total_copied = 0;
+ unsigned long bounce_addr = 0;
+ unsigned long src_addr = 0;
+ unsigned long flags;
+
+ local_irq_save(flags);
+
+ for (i = 0; i < orig_sgl_count; i++) {
+ src_addr = (unsigned long)kmap_atomic(sg_page((&orig_sgl[i])),
+ KM_IRQ0) + orig_sgl[i].offset;
+ src = src_addr;
+ srclen = orig_sgl[i].length;
+
+ if (bounce_addr == 0)
+ bounce_addr =
+ (unsigned long)kmap_atomic(sg_page((&bounce_sgl[j])),
+ KM_IRQ0);
+
+ while (srclen) {
+ /* assume bounce offset always == 0 */
+ dest = bounce_addr + bounce_sgl[j].length;
+ destlen = PAGE_SIZE - bounce_sgl[j].length;
+
+ copylen = min(srclen, destlen);
+ memcpy((void *)dest, (void *)src, copylen);
+
+ total_copied += copylen;
+ bounce_sgl[j].length += copylen;
+ srclen -= copylen;
+ src += copylen;
+
+ if (bounce_sgl[j].length == PAGE_SIZE) {
+ /* full..move to next entry */
+ kunmap_atomic((void *)bounce_addr, KM_IRQ0);
+ j++;
+
+ /* if we need to use another bounce buffer */
+ if (srclen || i != orig_sgl_count - 1)
+ bounce_addr =
+ (unsigned long)kmap_atomic(
+ sg_page((&bounce_sgl[j])), KM_IRQ0);
+
+ } else if (srclen == 0 && i == orig_sgl_count - 1) {
+ /* unmap the last bounce that is < PAGE_SIZE */
+ kunmap_atomic((void *)bounce_addr, KM_IRQ0);
+ }
+ }
+
+ kunmap_atomic((void *)(src_addr - orig_sgl[i].offset), KM_IRQ0);
+ }
+
+ local_irq_restore(flags);
+
+ return total_copied;
+}
+
/* Static decl */
static int storvsc_probe(struct hv_device *dev);
static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd);
static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd);
static int storvsc_remove(struct hv_device *dev);

-static unsigned int copy_to_bounce_buffer(struct scatterlist *orig_sgl,
- struct scatterlist *bounce_sgl,
- unsigned int orig_sgl_count);
-
static int storvsc_get_chs(struct scsi_device *sdev, struct block_device *bdev,
sector_t capacity, int *info);

@@ -613,68 +675,6 @@ static void storvsc_commmand_completion(struct hv_storvsc_request *request)
kmem_cache_free(host_dev->request_pool, cmd_request);
}

-/* Assume the bounce_sgl has enough room ie using the create_bounce_buffer() */
-static unsigned int copy_to_bounce_buffer(struct scatterlist *orig_sgl,
- struct scatterlist *bounce_sgl,
- unsigned int orig_sgl_count)
-{
- int i;
- int j = 0;
- unsigned long src, dest;
- unsigned int srclen, destlen, copylen;
- unsigned int total_copied = 0;
- unsigned long bounce_addr = 0;
- unsigned long src_addr = 0;
- unsigned long flags;
-
- local_irq_save(flags);
-
- for (i = 0; i < orig_sgl_count; i++) {
- src_addr = (unsigned long)kmap_atomic(sg_page((&orig_sgl[i])),
- KM_IRQ0) + orig_sgl[i].offset;
- src = src_addr;
- srclen = orig_sgl[i].length;
-
- /* ASSERT(orig_sgl[i].offset + orig_sgl[i].length <= PAGE_SIZE); */
-
- if (bounce_addr == 0)
- bounce_addr = (unsigned long)kmap_atomic(sg_page((&bounce_sgl[j])), KM_IRQ0);
-
- while (srclen) {
- /* assume bounce offset always == 0 */
- dest = bounce_addr + bounce_sgl[j].length;
- destlen = PAGE_SIZE - bounce_sgl[j].length;
-
- copylen = min(srclen, destlen);
- memcpy((void *)dest, (void *)src, copylen);
-
- total_copied += copylen;
- bounce_sgl[j].length += copylen;
- srclen -= copylen;
- src += copylen;
-
- if (bounce_sgl[j].length == PAGE_SIZE) {
- /* full..move to next entry */
- kunmap_atomic((void *)bounce_addr, KM_IRQ0);
- j++;
-
- /* if we need to use another bounce buffer */
- if (srclen || i != orig_sgl_count - 1)
- bounce_addr = (unsigned long)kmap_atomic(sg_page((&bounce_sgl[j])), KM_IRQ0);
- } else if (srclen == 0 && i == orig_sgl_count - 1) {
- /* unmap the last bounce that is < PAGE_SIZE */
- kunmap_atomic((void *)bounce_addr, KM_IRQ0);
- }
- }
-
- kunmap_atomic((void *)(src_addr - orig_sgl[i].offset), KM_IRQ0);
- }
-
- local_irq_restore(flags);
-
- return total_copied;
-}
-
/*
* storvsc_queuecommand - Initiate command processing
*/
--
1.7.4.1

2011-05-09 22:03:14

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 047/206] Staging: hv: Get rid of the forward declaration of storvsc_remove()

Get rid of the forward declaration by moving the code around.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 62 +++++++++++++++++++-------------------
1 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 807ba89..6f23f52 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -350,11 +350,41 @@ static unsigned int copy_to_bounce_buffer(struct scatterlist *orig_sgl,
return total_copied;
}

+
+/*
+ * storvsc_remove - Callback when our device is removed
+ */
+static int storvsc_remove(struct hv_device *dev)
+{
+ struct storvsc_driver *storvsc_drv_obj =
+ drv_to_stordrv(dev->device.driver);
+ struct Scsi_Host *host = dev_get_drvdata(&dev->device);
+ struct hv_host_device *host_dev =
+ (struct hv_host_device *)host->hostdata;
+
+ /*
+ * Call to the vsc driver to let it know that the device is being
+ * removed
+ */
+ storvsc_drv_obj->base.dev_rm(dev);
+
+ if (host_dev->request_pool) {
+ kmem_cache_destroy(host_dev->request_pool);
+ host_dev->request_pool = NULL;
+ }
+
+ DPRINT_INFO(STORVSC, "removing host adapter (%p)...", host);
+ scsi_remove_host(host);
+
+ DPRINT_INFO(STORVSC, "releasing host adapter (%p)...", host);
+ scsi_host_put(host);
+ return 0;
+}
+
/* Static decl */
static int storvsc_probe(struct hv_device *dev);
static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd);
static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd);
-static int storvsc_remove(struct hv_device *dev);

static int storvsc_get_chs(struct scsi_device *sdev, struct block_device *bdev,
sector_t capacity, int *info);
@@ -589,36 +619,6 @@ static int storvsc_probe(struct hv_device *device)
}

/*
- * storvsc_remove - Callback when our device is removed
- */
-static int storvsc_remove(struct hv_device *dev)
-{
- struct storvsc_driver *storvsc_drv_obj =
- drv_to_stordrv(dev->device.driver);
- struct Scsi_Host *host = dev_get_drvdata(&dev->device);
- struct hv_host_device *host_dev =
- (struct hv_host_device *)host->hostdata;
-
- /*
- * Call to the vsc driver to let it know that the device is being
- * removed
- */
- storvsc_drv_obj->base.dev_rm(dev);
-
- if (host_dev->request_pool) {
- kmem_cache_destroy(host_dev->request_pool);
- host_dev->request_pool = NULL;
- }
-
- DPRINT_INFO(STORVSC, "removing host adapter (%p)...", host);
- scsi_remove_host(host);
-
- DPRINT_INFO(STORVSC, "releasing host adapter (%p)...", host);
- scsi_host_put(host);
- return 0;
-}
-
-/*
* storvsc_commmand_completion - Command completion processing
*/
static void storvsc_commmand_completion(struct hv_storvsc_request *request)
--
1.7.4.1

2011-05-09 22:03:12

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 048/206] Staging: hv: Get rid of the forward declaration of storvsc_get_chs()

Get rid of the forward declaration by moving the code around.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 164 ++++++++++++++++++-------------------
1 files changed, 80 insertions(+), 84 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 6f23f52..4c08328 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -381,15 +381,91 @@ static int storvsc_remove(struct hv_device *dev)
return 0;
}

+
+static int storvsc_get_chs(struct scsi_device *sdev, struct block_device * bdev,
+ sector_t capacity, int *info)
+{
+ sector_t total_sectors = capacity;
+ sector_t cylinder_times_heads = 0;
+ sector_t temp = 0;
+
+ int sectors_per_track = 0;
+ int heads = 0;
+ int cylinders = 0;
+ int rem = 0;
+
+ if (total_sectors > (65535 * 16 * 255))
+ total_sectors = (65535 * 16 * 255);
+
+ if (total_sectors >= (65535 * 16 * 63)) {
+ sectors_per_track = 255;
+ heads = 16;
+
+ cylinder_times_heads = total_sectors;
+ /* sector_div stores the quotient in cylinder_times_heads */
+ rem = sector_div(cylinder_times_heads, sectors_per_track);
+ } else {
+ sectors_per_track = 17;
+
+ cylinder_times_heads = total_sectors;
+ /* sector_div stores the quotient in cylinder_times_heads */
+ rem = sector_div(cylinder_times_heads, sectors_per_track);
+
+ temp = cylinder_times_heads + 1023;
+ /* sector_div stores the quotient in temp */
+ rem = sector_div(temp, 1024);
+
+ heads = temp;
+
+ if (heads < 4)
+ heads = 4;
+
+ if (cylinder_times_heads >= (heads * 1024) || (heads > 16)) {
+ sectors_per_track = 31;
+ heads = 16;
+
+ cylinder_times_heads = total_sectors;
+ /*
+ * sector_div stores the quotient in
+ * cylinder_times_heads
+ */
+ rem = sector_div(cylinder_times_heads,
+ sectors_per_track);
+ }
+
+ if (cylinder_times_heads >= (heads * 1024)) {
+ sectors_per_track = 63;
+ heads = 16;
+
+ cylinder_times_heads = total_sectors;
+ /*
+ * sector_div stores the quotient in
+ * cylinder_times_heads
+ */
+ rem = sector_div(cylinder_times_heads,
+ sectors_per_track);
+ }
+ }
+
+ temp = cylinder_times_heads;
+ /* sector_div stores the quotient in temp */
+ rem = sector_div(temp, heads);
+ cylinders = temp;
+
+ info[0] = heads;
+ info[1] = sectors_per_track;
+ info[2] = cylinders;
+
+ DPRINT_INFO(STORVSC_DRV, "CHS (%d, %d, %d)", cylinders, heads,
+ sectors_per_track);
+
+ return 0;
+}
/* Static decl */
static int storvsc_probe(struct hv_device *dev);
static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd);
static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd);

-static int storvsc_get_chs(struct scsi_device *sdev, struct block_device *bdev,
- sector_t capacity, int *info);
-
-
static int storvsc_ringbuffer_size = STORVSC_RING_BUFFER_SIZE;
module_param(storvsc_ringbuffer_size, int, S_IRUGO);
MODULE_PARM_DESC(storvsc_ringbuffer_size, "Ring buffer size (bytes)");
@@ -867,86 +943,6 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
return ret;
}

-static int storvsc_get_chs(struct scsi_device *sdev, struct block_device * bdev,
- sector_t capacity, int *info)
-{
- sector_t total_sectors = capacity;
- sector_t cylinder_times_heads = 0;
- sector_t temp = 0;
-
- int sectors_per_track = 0;
- int heads = 0;
- int cylinders = 0;
- int rem = 0;
-
- if (total_sectors > (65535 * 16 * 255))
- total_sectors = (65535 * 16 * 255);
-
- if (total_sectors >= (65535 * 16 * 63)) {
- sectors_per_track = 255;
- heads = 16;
-
- cylinder_times_heads = total_sectors;
- /* sector_div stores the quotient in cylinder_times_heads */
- rem = sector_div(cylinder_times_heads, sectors_per_track);
- } else {
- sectors_per_track = 17;
-
- cylinder_times_heads = total_sectors;
- /* sector_div stores the quotient in cylinder_times_heads */
- rem = sector_div(cylinder_times_heads, sectors_per_track);
-
- temp = cylinder_times_heads + 1023;
- /* sector_div stores the quotient in temp */
- rem = sector_div(temp, 1024);
-
- heads = temp;
-
- if (heads < 4)
- heads = 4;
-
- if (cylinder_times_heads >= (heads * 1024) || (heads > 16)) {
- sectors_per_track = 31;
- heads = 16;
-
- cylinder_times_heads = total_sectors;
- /*
- * sector_div stores the quotient in
- * cylinder_times_heads
- */
- rem = sector_div(cylinder_times_heads,
- sectors_per_track);
- }
-
- if (cylinder_times_heads >= (heads * 1024)) {
- sectors_per_track = 63;
- heads = 16;
-
- cylinder_times_heads = total_sectors;
- /*
- * sector_div stores the quotient in
- * cylinder_times_heads
- */
- rem = sector_div(cylinder_times_heads,
- sectors_per_track);
- }
- }
-
- temp = cylinder_times_heads;
- /* sector_div stores the quotient in temp */
- rem = sector_div(temp, heads);
- cylinders = temp;
-
- info[0] = heads;
- info[1] = sectors_per_track;
- info[2] = cylinders;
-
- DPRINT_INFO(STORVSC_DRV, "CHS (%d, %d, %d)", cylinders, heads,
- sectors_per_track);
-
- return 0;
-}
-
static int __init storvsc_init(void)
{
int ret;
--
1.7.4.1

2011-05-09 22:01:35

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 049/206] Staging: hv: Staging: hv: Rename the function stor_vsc_on_host_reset()

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 4c08328..d8ce28e 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -536,7 +536,7 @@ static int storvsc_drv_init(void)
}


-static int stor_vsc_on_host_reset(struct hv_device *device)
+static int storvsc_host_reset(struct hv_device *device)
{
struct storvsc_device *stor_device;
struct hv_storvsc_request *request;
@@ -933,7 +933,7 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
scmnd->device, dev);

/* Invokes the vsc to reset the host/bus */
- ret = stor_vsc_on_host_reset(dev);
+ ret = storvsc_host_reset(dev);
if (ret != 0)
return ret;

--
1.7.4.1

2011-05-09 22:03:09

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 050/206] Staging: hv: Rename stor_vsc_initialize()

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index d8ce28e..28b8569 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -71,9 +71,9 @@ struct storvsc_cmd_request {


/*
- * stor_vsc_initialize - Main entry point
+ * storvsc_initialize - Main entry point
*/
-static int stor_vsc_initialize(struct hv_driver *driver)
+static int storvsc_initialize(struct hv_driver *driver)
{
struct storvsc_driver *stor_driver;

@@ -514,7 +514,7 @@ static int storvsc_drv_init(void)
storvsc_drv_obj->ring_buffer_size = storvsc_ringbuffer_size;

/* Callback to client driver to complete the initialization */
- stor_vsc_initialize(&storvsc_drv_obj->base);
+ storvsc_initialize(&storvsc_drv_obj->base);

DPRINT_INFO(STORVSC_DRV,
"max outstanding reqs %u",
--
1.7.4.1

2011-05-09 22:01:39

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 051/206] Staging: hv: Move the definition of storvsc_host_reset() to earlier in the file

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 99 +++++++++++++++++++-------------------
1 files changed, 50 insertions(+), 49 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 28b8569..3b2917e 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -461,6 +461,56 @@ static int storvsc_get_chs(struct scsi_device *sdev, struct block_device * bdev,

return 0;
}
+
+static int storvsc_host_reset(struct hv_device *device)
+{
+ struct storvsc_device *stor_device;
+ struct hv_storvsc_request *request;
+ struct vstor_packet *vstor_packet;
+ int ret, t;
+
+ DPRINT_INFO(STORVSC, "resetting host adapter...");
+
+ stor_device = get_stor_device(device);
+ if (!stor_device)
+ return -1;
+
+ request = &stor_device->reset_request;
+ vstor_packet = &request->vstor_packet;
+
+ init_completion(&request->wait_event);
+
+ vstor_packet->operation = VSTOR_OPERATION_RESET_BUS;
+ vstor_packet->flags = REQUEST_COMPLETION_FLAG;
+ vstor_packet->vm_srb.path_id = stor_device->path_id;
+
+ ret = vmbus_sendpacket(device->channel, vstor_packet,
+ sizeof(struct vstor_packet),
+ (unsigned long)&stor_device->reset_request,
+ VM_PKT_DATA_INBAND,
+ VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
+ if (ret != 0)
+ goto cleanup;
+
+ t = wait_for_completion_timeout(&request->wait_event, HZ);
+ if (t == 0) {
+ ret = -ETIMEDOUT;
+ goto cleanup;
+ }
+
+ DPRINT_INFO(STORVSC, "host adapter reset completed");
+
+ /*
+ * At this point, all outstanding requests in the adapter
+ * should have been flushed out and return to us
+ */
+
+cleanup:
+ put_stor_device(device);
+ return ret;
+}
+
+
/* Static decl */
static int storvsc_probe(struct hv_device *dev);
static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd);
@@ -535,55 +585,6 @@ static int storvsc_drv_init(void)
return ret;
}

-
-static int storvsc_host_reset(struct hv_device *device)
-{
- struct storvsc_device *stor_device;
- struct hv_storvsc_request *request;
- struct vstor_packet *vstor_packet;
- int ret, t;
-
- DPRINT_INFO(STORVSC, "resetting host adapter...");
-
- stor_device = get_stor_device(device);
- if (!stor_device)
- return -1;
-
- request = &stor_device->reset_request;
- vstor_packet = &request->vstor_packet;
-
- init_completion(&request->wait_event);
-
- vstor_packet->operation = VSTOR_OPERATION_RESET_BUS;
- vstor_packet->flags = REQUEST_COMPLETION_FLAG;
- vstor_packet->vm_srb.path_id = stor_device->path_id;
-
- ret = vmbus_sendpacket(device->channel, vstor_packet,
- sizeof(struct vstor_packet),
- (unsigned long)&stor_device->reset_request,
- VM_PKT_DATA_INBAND,
- VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
- if (ret != 0)
- goto cleanup;
-
- t = wait_for_completion_timeout(&request->wait_event, HZ);
- if (t == 0) {
- ret = -ETIMEDOUT;
- goto cleanup;
- }
-
- DPRINT_INFO(STORVSC, "host adapter reset completed");
-
- /*
- * At this point, all outstanding requests in the adapter
- * should have been flushed out and return to us
- */
-
-cleanup:
- put_stor_device(device);
- return ret;
-}
-
static int storvsc_drv_exit_cb(struct device *dev, void *data)
{
struct device **curr = (struct device **)data;
--
1.7.4.1

2011-05-09 22:03:08

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 052/206] Staging: hv: Get rid of the forward declaration for storvsc_host_reset_handler()

Get rid of the forward declaration by moving the code around.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 49 ++++++++++++++++++-------------------
1 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 3b2917e..462aaa5 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -511,10 +511,33 @@ cleanup:
}


+/*
+ * storvsc_host_reset_handler - Reset the scsi HBA
+ */
+static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
+{
+ int ret;
+ struct hv_host_device *host_dev =
+ (struct hv_host_device *)scmnd->device->host->hostdata;
+ struct hv_device *dev = host_dev->dev;
+
+ DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host resetting...",
+ scmnd->device, dev);
+
+ /* Invokes the vsc to reset the host/bus */
+ ret = storvsc_host_reset(dev);
+ if (ret != 0)
+ return ret;
+
+ DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host reseted",
+ scmnd->device, dev);
+
+ return ret;
+}
+
/* Static decl */
static int storvsc_probe(struct hv_device *dev);
static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd);
-static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd);

static int storvsc_ringbuffer_size = STORVSC_RING_BUFFER_SIZE;
module_param(storvsc_ringbuffer_size, int, S_IRUGO);
@@ -920,30 +943,6 @@ retry_request:

static DEF_SCSI_QCMD(storvsc_queuecommand)

-/*
- * storvsc_host_reset_handler - Reset the scsi HBA
- */
-static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
-{
- int ret;
- struct hv_host_device *host_dev =
- (struct hv_host_device *)scmnd->device->host->hostdata;
- struct hv_device *dev = host_dev->dev;
-
- DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host resetting...",
- scmnd->device, dev);
-
- /* Invokes the vsc to reset the host/bus */
- ret = storvsc_host_reset(dev);
- if (ret != 0)
- return ret;
-
- DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host reseted",
- scmnd->device, dev);
-
- return ret;
-}
-
static int __init storvsc_init(void)
{
int ret;
--
1.7.4.1

2011-05-09 22:03:06

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 053/206] Staging: hv: Move the definition of storvsc_ringbuffer_size to earlier in the file

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 462aaa5..6bb35c4 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -40,6 +40,7 @@
#include "vstorage.h"
#include "channel.h"

+static int storvsc_ringbuffer_size = STORVSC_RING_BUFFER_SIZE;

static const char *driver_name = "storvsc";

@@ -539,7 +540,6 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
static int storvsc_probe(struct hv_device *dev);
static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd);

-static int storvsc_ringbuffer_size = STORVSC_RING_BUFFER_SIZE;
module_param(storvsc_ringbuffer_size, int, S_IRUGO);
MODULE_PARM_DESC(storvsc_ringbuffer_size, "Ring buffer size (bytes)");

--
1.7.4.1

2011-05-09 22:01:38

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 054/206] Staging: hv: Move module parameters to earlier in the file

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 6bb35c4..0d9ce56 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -42,6 +42,9 @@

static int storvsc_ringbuffer_size = STORVSC_RING_BUFFER_SIZE;

+module_param(storvsc_ringbuffer_size, int, S_IRUGO);
+MODULE_PARM_DESC(storvsc_ringbuffer_size, "Ring buffer size (bytes)");
+
static const char *driver_name = "storvsc";

/* {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} */
@@ -540,9 +543,6 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
static int storvsc_probe(struct hv_device *dev);
static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd);

-module_param(storvsc_ringbuffer_size, int, S_IRUGO);
-MODULE_PARM_DESC(storvsc_ringbuffer_size, "Ring buffer size (bytes)");
-
/* The one and only one */
static struct storvsc_driver g_storvsc_drv;

--
1.7.4.1

2011-05-09 22:01:34

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 055/206] Staging: hv: Move the function storvsc_commmand_completion() to earlier in the file

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 115 +++++++++++++++++++-------------------
1 files changed, 58 insertions(+), 57 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 0d9ce56..d10e533 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -539,6 +539,64 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
return ret;
}

+
+/*
+ * storvsc_commmand_completion - Command completion processing
+ */
+static void storvsc_commmand_completion(struct hv_storvsc_request *request)
+{
+ struct storvsc_cmd_request *cmd_request =
+ (struct storvsc_cmd_request *)request->context;
+ struct scsi_cmnd *scmnd = cmd_request->cmd;
+ struct hv_host_device *host_dev =
+ (struct hv_host_device *)scmnd->device->host->hostdata;
+ void (*scsi_done_fn)(struct scsi_cmnd *);
+ struct scsi_sense_hdr sense_hdr;
+ struct vmscsi_request *vm_srb;
+
+ /* ASSERT(request == &cmd_request->request); */
+ /* ASSERT(scmnd); */
+ /* ASSERT((unsigned long)scmnd->host_scribble == */
+ /* (unsigned long)cmd_request); */
+ /* ASSERT(scmnd->scsi_done); */
+
+ if (cmd_request->bounce_sgl_count) {
+ /* using bounce buffer */
+ /* printk("copy_from_bounce_buffer\n"); */
+
+ /* FIXME: We can optimize on writes by just skipping this */
+ copy_from_bounce_buffer(scsi_sglist(scmnd),
+ cmd_request->bounce_sgl,
+ scsi_sg_count(scmnd));
+ destroy_bounce_buffer(cmd_request->bounce_sgl,
+ cmd_request->bounce_sgl_count);
+ }
+
+ vm_srb = &request->vstor_packet.vm_srb;
+ scmnd->result = vm_srb->scsi_status;
+
+ if (scmnd->result) {
+ if (scsi_normalize_sense(scmnd->sense_buffer,
+ SCSI_SENSE_BUFFERSIZE, &sense_hdr))
+ scsi_print_sense_hdr("storvsc", &sense_hdr);
+ }
+
+ /* ASSERT(request->BytesXfer <= request->data_buffer.Length); */
+ scsi_set_resid(scmnd,
+ request->data_buffer.len -
+ vm_srb->data_transfer_length);
+
+ scsi_done_fn = scmnd->scsi_done;
+
+ scmnd->host_scribble = NULL;
+ scmnd->scsi_done = NULL;
+
+ /* !!DO NOT MODIFY the scmnd after this call */
+ scsi_done_fn(scmnd);
+
+ kmem_cache_free(host_dev->request_pool, cmd_request);
+}
+
/* Static decl */
static int storvsc_probe(struct hv_device *dev);
static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd);
@@ -719,63 +777,6 @@ static int storvsc_probe(struct hv_device *device)
}

/*
- * storvsc_commmand_completion - Command completion processing
- */
-static void storvsc_commmand_completion(struct hv_storvsc_request *request)
-{
- struct storvsc_cmd_request *cmd_request =
- (struct storvsc_cmd_request *)request->context;
- struct scsi_cmnd *scmnd = cmd_request->cmd;
- struct hv_host_device *host_dev =
- (struct hv_host_device *)scmnd->device->host->hostdata;
- void (*scsi_done_fn)(struct scsi_cmnd *);
- struct scsi_sense_hdr sense_hdr;
- struct vmscsi_request *vm_srb;
-
- /* ASSERT(request == &cmd_request->request); */
- /* ASSERT(scmnd); */
- /* ASSERT((unsigned long)scmnd->host_scribble == */
- /* (unsigned long)cmd_request); */
- /* ASSERT(scmnd->scsi_done); */
-
- if (cmd_request->bounce_sgl_count) {
- /* using bounce buffer */
- /* printk("copy_from_bounce_buffer\n"); */
-
- /* FIXME: We can optimize on writes by just skipping this */
- copy_from_bounce_buffer(scsi_sglist(scmnd),
- cmd_request->bounce_sgl,
- scsi_sg_count(scmnd));
- destroy_bounce_buffer(cmd_request->bounce_sgl,
- cmd_request->bounce_sgl_count);
- }
-
- vm_srb = &request->vstor_packet.vm_srb;
- scmnd->result = vm_srb->scsi_status;
-
- if (scmnd->result) {
- if (scsi_normalize_sense(scmnd->sense_buffer,
- SCSI_SENSE_BUFFERSIZE, &sense_hdr))
- scsi_print_sense_hdr("storvsc", &sense_hdr);
- }
-
- /* ASSERT(request->BytesXfer <= request->data_buffer.Length); */
- scsi_set_resid(scmnd,
- request->data_buffer.len -
- vm_srb->data_transfer_length);
-
- scsi_done_fn = scmnd->scsi_done;
-
- scmnd->host_scribble = NULL;
- scmnd->scsi_done = NULL;
-
- /* !!DO NOT MODIFY the scmnd after this call */
- scsi_done_fn(scmnd);
-
- kmem_cache_free(host_dev->request_pool, cmd_request);
-}
-
-/*
* storvsc_queuecommand - Initiate command processing
*/
static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
--
1.7.4.1

2011-05-09 21:59:37

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 056/206] Staging: hv: Get rid of the forward declaration of storvsc_queuecommand()

Get rid of the forward declaration by moving the code around.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 338 +++++++++++++++++++-------------------
1 files changed, 169 insertions(+), 169 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index d10e533..4d4226a 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -597,9 +597,177 @@ static void storvsc_commmand_completion(struct hv_storvsc_request *request)
kmem_cache_free(host_dev->request_pool, cmd_request);
}

+
+/*
+ * storvsc_queuecommand - Initiate command processing
+ */
+static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
+ void (*done)(struct scsi_cmnd *))
+{
+ int ret;
+ struct hv_host_device *host_dev =
+ (struct hv_host_device *)scmnd->device->host->hostdata;
+ struct hv_device *dev = host_dev->dev;
+ struct storvsc_driver *storvsc_drv_obj =
+ drv_to_stordrv(dev->device.driver);
+ struct hv_storvsc_request *request;
+ struct storvsc_cmd_request *cmd_request;
+ unsigned int request_size = 0;
+ int i;
+ struct scatterlist *sgl;
+ unsigned int sg_count = 0;
+ struct vmscsi_request *vm_srb;
+
+
+ /* If retrying, no need to prep the cmd */
+ if (scmnd->host_scribble) {
+ /* ASSERT(scmnd->scsi_done != NULL); */
+
+ cmd_request =
+ (struct storvsc_cmd_request *)scmnd->host_scribble;
+ DPRINT_INFO(STORVSC_DRV, "retrying scmnd %p cmd_request %p",
+ scmnd, cmd_request);
+
+ goto retry_request;
+ }
+
+ /* ASSERT(scmnd->scsi_done == NULL); */
+ /* ASSERT(scmnd->host_scribble == NULL); */
+
+ scmnd->scsi_done = done;
+
+ request_size = sizeof(struct storvsc_cmd_request);
+
+ cmd_request = kmem_cache_zalloc(host_dev->request_pool,
+ GFP_ATOMIC);
+ if (!cmd_request) {
+ scmnd->scsi_done = NULL;
+ return SCSI_MLQUEUE_DEVICE_BUSY;
+ }
+
+ /* Setup the cmd request */
+ cmd_request->bounce_sgl_count = 0;
+ cmd_request->bounce_sgl = NULL;
+ cmd_request->cmd = scmnd;
+
+ scmnd->host_scribble = (unsigned char *)cmd_request;
+
+ request = &cmd_request->request;
+ vm_srb = &request->vstor_packet.vm_srb;
+
+
+ /* Build the SRB */
+ switch (scmnd->sc_data_direction) {
+ case DMA_TO_DEVICE:
+ vm_srb->data_in = WRITE_TYPE;
+ break;
+ case DMA_FROM_DEVICE:
+ vm_srb->data_in = READ_TYPE;
+ break;
+ default:
+ vm_srb->data_in = UNKNOWN_TYPE;
+ break;
+ }
+
+ request->on_io_completion = storvsc_commmand_completion;
+ request->context = cmd_request;/* scmnd; */
+
+ /* request->PortId = scmnd->device->channel; */
+ vm_srb->port_number = host_dev->port;
+ vm_srb->path_id = scmnd->device->channel;
+ vm_srb->target_id = scmnd->device->id;
+ vm_srb->lun = scmnd->device->lun;
+
+ /* ASSERT(scmnd->cmd_len <= 16); */
+ vm_srb->cdb_length = scmnd->cmd_len;
+
+ memcpy(vm_srb->cdb, scmnd->cmnd, vm_srb->cdb_length);
+
+ request->sense_buffer = scmnd->sense_buffer;
+
+
+ request->data_buffer.len = scsi_bufflen(scmnd);
+ if (scsi_sg_count(scmnd)) {
+ sgl = (struct scatterlist *)scsi_sglist(scmnd);
+ sg_count = scsi_sg_count(scmnd);
+
+ /* check if we need to bounce the sgl */
+ if (do_bounce_buffer(sgl, scsi_sg_count(scmnd)) != -1) {
+ cmd_request->bounce_sgl =
+ create_bounce_buffer(sgl, scsi_sg_count(scmnd),
+ scsi_bufflen(scmnd));
+ if (!cmd_request->bounce_sgl) {
+ scmnd->scsi_done = NULL;
+ scmnd->host_scribble = NULL;
+ kmem_cache_free(host_dev->request_pool,
+ cmd_request);
+
+ return SCSI_MLQUEUE_HOST_BUSY;
+ }
+
+ cmd_request->bounce_sgl_count =
+ ALIGN(scsi_bufflen(scmnd), PAGE_SIZE) >>
+ PAGE_SHIFT;
+
+ /*
+ * FIXME: We can optimize on reads by just skipping
+ * this
+ */
+ copy_to_bounce_buffer(sgl, cmd_request->bounce_sgl,
+ scsi_sg_count(scmnd));
+
+ sgl = cmd_request->bounce_sgl;
+ sg_count = cmd_request->bounce_sgl_count;
+ }
+
+ request->data_buffer.offset = sgl[0].offset;
+
+ for (i = 0; i < sg_count; i++)
+ request->data_buffer.pfn_array[i] =
+ page_to_pfn(sg_page((&sgl[i])));
+
+ } else if (scsi_sglist(scmnd)) {
+ /* ASSERT(scsi_bufflen(scmnd) <= PAGE_SIZE); */
+ request->data_buffer.offset =
+ virt_to_phys(scsi_sglist(scmnd)) & (PAGE_SIZE-1);
+ request->data_buffer.pfn_array[0] =
+ virt_to_phys(scsi_sglist(scmnd)) >> PAGE_SHIFT;
+ }
+
+retry_request:
+ /* Invokes the vsc to start an IO */
+ ret = storvsc_drv_obj->on_io_request(dev,
+ &cmd_request->request);
+ if (ret == -1) {
+ /* no more space */
+
+ if (cmd_request->bounce_sgl_count) {
+ /*
+ * FIXME: We can optimize on writes by just skipping
+ * this
+ */
+ copy_from_bounce_buffer(scsi_sglist(scmnd),
+ cmd_request->bounce_sgl,
+ scsi_sg_count(scmnd));
+ destroy_bounce_buffer(cmd_request->bounce_sgl,
+ cmd_request->bounce_sgl_count);
+ }
+
+ kmem_cache_free(host_dev->request_pool, cmd_request);
+
+ scmnd->scsi_done = NULL;
+ scmnd->host_scribble = NULL;
+
+ ret = SCSI_MLQUEUE_DEVICE_BUSY;
+ }
+
+ return ret;
+}
+
+static DEF_SCSI_QCMD(storvsc_queuecommand)
+
/* Static decl */
static int storvsc_probe(struct hv_device *dev);
-static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd);

/* The one and only one */
static struct storvsc_driver g_storvsc_drv;
@@ -776,174 +944,6 @@ static int storvsc_probe(struct hv_device *device)
return ret;
}

-/*
- * storvsc_queuecommand - Initiate command processing
- */
-static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
- void (*done)(struct scsi_cmnd *))
-{
- int ret;
- struct hv_host_device *host_dev =
- (struct hv_host_device *)scmnd->device->host->hostdata;
- struct hv_device *dev = host_dev->dev;
- struct storvsc_driver *storvsc_drv_obj =
- drv_to_stordrv(dev->device.driver);
- struct hv_storvsc_request *request;
- struct storvsc_cmd_request *cmd_request;
- unsigned int request_size = 0;
- int i;
- struct scatterlist *sgl;
- unsigned int sg_count = 0;
- struct vmscsi_request *vm_srb;
-
-
- /* If retrying, no need to prep the cmd */
- if (scmnd->host_scribble) {
- /* ASSERT(scmnd->scsi_done != NULL); */
-
- cmd_request =
- (struct storvsc_cmd_request *)scmnd->host_scribble;
- DPRINT_INFO(STORVSC_DRV, "retrying scmnd %p cmd_request %p",
- scmnd, cmd_request);
-
- goto retry_request;
- }
-
- /* ASSERT(scmnd->scsi_done == NULL); */
- /* ASSERT(scmnd->host_scribble == NULL); */
-
- scmnd->scsi_done = done;
-
- request_size = sizeof(struct storvsc_cmd_request);
-
- cmd_request = kmem_cache_zalloc(host_dev->request_pool,
- GFP_ATOMIC);
- if (!cmd_request) {
- scmnd->scsi_done = NULL;
- return SCSI_MLQUEUE_DEVICE_BUSY;
- }
-
- /* Setup the cmd request */
- cmd_request->bounce_sgl_count = 0;
- cmd_request->bounce_sgl = NULL;
- cmd_request->cmd = scmnd;
-
- scmnd->host_scribble = (unsigned char *)cmd_request;
-
- request = &cmd_request->request;
- vm_srb = &request->vstor_packet.vm_srb;
-
-
- /* Build the SRB */
- switch (scmnd->sc_data_direction) {
- case DMA_TO_DEVICE:
- vm_srb->data_in = WRITE_TYPE;
- break;
- case DMA_FROM_DEVICE:
- vm_srb->data_in = READ_TYPE;
- break;
- default:
- vm_srb->data_in = UNKNOWN_TYPE;
- break;
- }
-
- request->on_io_completion = storvsc_commmand_completion;
- request->context = cmd_request;/* scmnd; */
-
- /* request->PortId = scmnd->device->channel; */
- vm_srb->port_number = host_dev->port;
- vm_srb->path_id = scmnd->device->channel;
- vm_srb->target_id = scmnd->device->id;
- vm_srb->lun = scmnd->device->lun;
-
- /* ASSERT(scmnd->cmd_len <= 16); */
- vm_srb->cdb_length = scmnd->cmd_len;
-
- memcpy(vm_srb->cdb, scmnd->cmnd, vm_srb->cdb_length);
-
- request->sense_buffer = scmnd->sense_buffer;
-
-
- request->data_buffer.len = scsi_bufflen(scmnd);
- if (scsi_sg_count(scmnd)) {
- sgl = (struct scatterlist *)scsi_sglist(scmnd);
- sg_count = scsi_sg_count(scmnd);
-
- /* check if we need to bounce the sgl */
- if (do_bounce_buffer(sgl, scsi_sg_count(scmnd)) != -1) {
- cmd_request->bounce_sgl =
- create_bounce_buffer(sgl, scsi_sg_count(scmnd),
- scsi_bufflen(scmnd));
- if (!cmd_request->bounce_sgl) {
- scmnd->scsi_done = NULL;
- scmnd->host_scribble = NULL;
- kmem_cache_free(host_dev->request_pool,
- cmd_request);
-
- return SCSI_MLQUEUE_HOST_BUSY;
- }
-
- cmd_request->bounce_sgl_count =
- ALIGN(scsi_bufflen(scmnd), PAGE_SIZE) >>
- PAGE_SHIFT;
-
- /*
- * FIXME: We can optimize on reads by just skipping
- * this
- */
- copy_to_bounce_buffer(sgl, cmd_request->bounce_sgl,
- scsi_sg_count(scmnd));
-
- sgl = cmd_request->bounce_sgl;
- sg_count = cmd_request->bounce_sgl_count;
- }
-
- request->data_buffer.offset = sgl[0].offset;
-
- for (i = 0; i < sg_count; i++)
- request->data_buffer.pfn_array[i] =
- page_to_pfn(sg_page((&sgl[i])));
-
- } else if (scsi_sglist(scmnd)) {
- /* ASSERT(scsi_bufflen(scmnd) <= PAGE_SIZE); */
- request->data_buffer.offset =
- virt_to_phys(scsi_sglist(scmnd)) & (PAGE_SIZE-1);
- request->data_buffer.pfn_array[0] =
- virt_to_phys(scsi_sglist(scmnd)) >> PAGE_SHIFT;
- }
-
-retry_request:
- /* Invokes the vsc to start an IO */
- ret = storvsc_drv_obj->on_io_request(dev,
- &cmd_request->request);
- if (ret == -1) {
- /* no more space */
-
- if (cmd_request->bounce_sgl_count) {
- /*
- * FIXME: We can optimize on writes by just skipping
- * this
- */
- copy_from_bounce_buffer(scsi_sglist(scmnd),
- cmd_request->bounce_sgl,
- scsi_sg_count(scmnd));
- destroy_bounce_buffer(cmd_request->bounce_sgl,
- cmd_request->bounce_sgl_count);
- }
-
- kmem_cache_free(host_dev->request_pool, cmd_request);
-
- scmnd->scsi_done = NULL;
- scmnd->host_scribble = NULL;
-
- ret = SCSI_MLQUEUE_DEVICE_BUSY;
- }
-
- return ret;
-}
-
-static DEF_SCSI_QCMD(storvsc_queuecommand)
-
static int __init storvsc_init(void)
{
int ret;
--
1.7.4.1

2011-05-09 22:01:30

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 057/206] Staging: hv: Get rid of the forward declaration of storvsc_probe()

Get rid of the forward declaration by moving the code around.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 143 +++++++++++++++++++-------------------
1 files changed, 71 insertions(+), 72 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 4d4226a..37bc4dd 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -766,8 +766,6 @@ retry_request:

static DEF_SCSI_QCMD(storvsc_queuecommand)

-/* Static decl */
-static int storvsc_probe(struct hv_device *dev);

/* The one and only one */
static struct storvsc_driver g_storvsc_drv;
@@ -802,78 +800,9 @@ static struct scsi_host_template scsi_driver = {


/*
- * storvsc_drv_init - StorVsc driver initialization.
- */
-static int storvsc_drv_init(void)
-{
- int ret;
- struct storvsc_driver *storvsc_drv_obj = &g_storvsc_drv;
- struct hv_driver *drv = &g_storvsc_drv.base;
-
- storvsc_drv_obj->ring_buffer_size = storvsc_ringbuffer_size;
-
- /* Callback to client driver to complete the initialization */
- storvsc_initialize(&storvsc_drv_obj->base);
-
- DPRINT_INFO(STORVSC_DRV,
- "max outstanding reqs %u",
- storvsc_drv_obj->max_outstanding_req_per_channel);
-
- if (storvsc_drv_obj->max_outstanding_req_per_channel <
- STORVSC_MAX_IO_REQUESTS)
- return -1;
-
- drv->driver.name = storvsc_drv_obj->base.name;
-
- drv->probe = storvsc_probe;
- drv->remove = storvsc_remove;
-
- /* The driver belongs to vmbus */
- ret = vmbus_child_driver_register(&drv->driver);
-
- return ret;
-}
-
-static int storvsc_drv_exit_cb(struct device *dev, void *data)
-{
- struct device **curr = (struct device **)data;
- *curr = dev;
- return 1; /* stop iterating */
-}
-
-static void storvsc_drv_exit(void)
-{
- struct storvsc_driver *storvsc_drv_obj = &g_storvsc_drv;
- struct hv_driver *drv = &g_storvsc_drv.base;
- struct device *current_dev = NULL;
- int ret;
-
- while (1) {
- current_dev = NULL;
-
- /* Get the device */
- ret = driver_for_each_device(&drv->driver, NULL,
- (void *) &current_dev,
- storvsc_drv_exit_cb);
-
-
- if (current_dev == NULL)
- break;
-
- /* Initiate removal from the top-down */
- device_unregister(current_dev);
- }
-
- if (storvsc_drv_obj->base.cleanup)
- storvsc_drv_obj->base.cleanup(&storvsc_drv_obj->base);
-
- vmbus_child_driver_unregister(&drv->driver);
- return;
-}
-
-/*
* storvsc_probe - Add a new device for this driver
*/
+
static int storvsc_probe(struct hv_device *device)
{
int ret;
@@ -944,6 +873,76 @@ static int storvsc_probe(struct hv_device *device)
return ret;
}

+/*
+ * storvsc_drv_init - StorVsc driver initialization.
+ */
+static int storvsc_drv_init(void)
+{
+ int ret;
+ struct storvsc_driver *storvsc_drv_obj = &g_storvsc_drv;
+ struct hv_driver *drv = &g_storvsc_drv.base;
+
+ storvsc_drv_obj->ring_buffer_size = storvsc_ringbuffer_size;
+
+ /* Callback to client driver to complete the initialization */
+ storvsc_initialize(&storvsc_drv_obj->base);
+
+ DPRINT_INFO(STORVSC_DRV,
+ "max outstanding reqs %u",
+ storvsc_drv_obj->max_outstanding_req_per_channel);
+
+ if (storvsc_drv_obj->max_outstanding_req_per_channel <
+ STORVSC_MAX_IO_REQUESTS)
+ return -1;
+
+ drv->driver.name = storvsc_drv_obj->base.name;
+
+ drv->probe = storvsc_probe;
+ drv->remove = storvsc_remove;
+
+ /* The driver belongs to vmbus */
+ ret = vmbus_child_driver_register(&drv->driver);
+
+ return ret;
+}
+
+static int storvsc_drv_exit_cb(struct device *dev, void *data)
+{
+ struct device **curr = (struct device **)data;
+ *curr = dev;
+ return 1; /* stop iterating */
+}
+
+static void storvsc_drv_exit(void)
+{
+ struct storvsc_driver *storvsc_drv_obj = &g_storvsc_drv;
+ struct hv_driver *drv = &g_storvsc_drv.base;
+ struct device *current_dev = NULL;
+ int ret;
+
+ while (1) {
+ current_dev = NULL;
+
+ /* Get the device */
+ ret = driver_for_each_device(&drv->driver, NULL,
+ (void *) &current_dev,
+ storvsc_drv_exit_cb);
+
+
+ if (current_dev == NULL)
+ break;
+
+ /* Initiate removal from the top-down */
+ device_unregister(current_dev);
+ }
+
+ if (storvsc_drv_obj->base.cleanup)
+ storvsc_drv_obj->base.cleanup(&storvsc_drv_obj->base);
+
+ vmbus_child_driver_unregister(&drv->driver);
+ return;
+}
+
static int __init storvsc_init(void)
{
int ret;
--
1.7.4.1

2011-05-09 22:01:31

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 058/206] Staging: hv: Rename the driver variable

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 37bc4dd..d246678 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -768,7 +768,7 @@ static DEF_SCSI_QCMD(storvsc_queuecommand)


/* The one and only one */
-static struct storvsc_driver g_storvsc_drv;
+static struct storvsc_driver storvsc_drv;

/* Scsi driver */
static struct scsi_host_template scsi_driver = {
@@ -879,8 +879,8 @@ static int storvsc_probe(struct hv_device *device)
static int storvsc_drv_init(void)
{
int ret;
- struct storvsc_driver *storvsc_drv_obj = &g_storvsc_drv;
- struct hv_driver *drv = &g_storvsc_drv.base;
+ struct storvsc_driver *storvsc_drv_obj = &storvsc_drv;
+ struct hv_driver *drv = &storvsc_drv.base;

storvsc_drv_obj->ring_buffer_size = storvsc_ringbuffer_size;

@@ -915,8 +915,8 @@ static int storvsc_drv_exit_cb(struct device *dev, void *data)

static void storvsc_drv_exit(void)
{
- struct storvsc_driver *storvsc_drv_obj = &g_storvsc_drv;
- struct hv_driver *drv = &g_storvsc_drv.base;
+ struct storvsc_driver *storvsc_drv_obj = &storvsc_drv;
+ struct hv_driver *drv = &storvsc_drv.base;
struct device *current_dev = NULL;
int ret;

--
1.7.4.1

2011-05-09 22:01:29

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 059/206] Staging: hv: Move the declaration of the driver variable

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index d246678..570d563 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -767,9 +767,6 @@ retry_request:
static DEF_SCSI_QCMD(storvsc_queuecommand)


-/* The one and only one */
-static struct storvsc_driver storvsc_drv;
-
/* Scsi driver */
static struct scsi_host_template scsi_driver = {
.module = THIS_MODULE,
@@ -873,6 +870,11 @@ static int storvsc_probe(struct hv_device *device)
return ret;
}

+/* The one and only one */
+
+static struct storvsc_driver storvsc_drv;
+
+
/*
* storvsc_drv_init - StorVsc driver initialization.
*/
--
1.7.4.1

2011-05-09 21:58:17

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 060/206] Staging: hv: Statically initialize probe/remove elements of the driver

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 570d563..89a0b05 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -872,7 +872,10 @@ static int storvsc_probe(struct hv_device *device)

/* The one and only one */

-static struct storvsc_driver storvsc_drv;
+static struct storvsc_driver storvsc_drv = {
+ .base.probe = storvsc_probe,
+ .base.remove = storvsc_remove,
+};


/*
@@ -899,8 +902,6 @@ static int storvsc_drv_init(void)

drv->driver.name = storvsc_drv_obj->base.name;

- drv->probe = storvsc_probe;
- drv->remove = storvsc_remove;

/* The driver belongs to vmbus */
ret = vmbus_child_driver_register(&drv->driver);
--
1.7.4.1

2011-05-09 21:59:29

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 061/206] Staging: hv: Get rid of unnecessary comments/dead code

Get rid of unnecessary comments/dead code.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 17 -----------------
1 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 89a0b05..650e11f 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -147,7 +147,6 @@ static int storvsc_device_configure(struct scsi_device *sdevice)
blk_queue_merge_bvec(sdevice->request_queue, storvsc_merge_bvec);

blk_queue_bounce_limit(sdevice->request_queue, BLK_BOUNCE_ANY);
- /* sdevice->timeout = (2000 * HZ);//(75 * HZ); */

return 0;
}
@@ -554,15 +553,7 @@ static void storvsc_commmand_completion(struct hv_storvsc_request *request)
struct scsi_sense_hdr sense_hdr;
struct vmscsi_request *vm_srb;

- /* ASSERT(request == &cmd_request->request); */
- /* ASSERT(scmnd); */
- /* ASSERT((unsigned long)scmnd->host_scribble == */
- /* (unsigned long)cmd_request); */
- /* ASSERT(scmnd->scsi_done); */
-
if (cmd_request->bounce_sgl_count) {
- /* using bounce buffer */
- /* printk("copy_from_bounce_buffer\n"); */

/* FIXME: We can optimize on writes by just skipping this */
copy_from_bounce_buffer(scsi_sglist(scmnd),
@@ -581,7 +572,6 @@ static void storvsc_commmand_completion(struct hv_storvsc_request *request)
scsi_print_sense_hdr("storvsc", &sense_hdr);
}

- /* ASSERT(request->BytesXfer <= request->data_buffer.Length); */
scsi_set_resid(scmnd,
request->data_buffer.len -
vm_srb->data_transfer_length);
@@ -621,7 +611,6 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,

/* If retrying, no need to prep the cmd */
if (scmnd->host_scribble) {
- /* ASSERT(scmnd->scsi_done != NULL); */

cmd_request =
(struct storvsc_cmd_request *)scmnd->host_scribble;
@@ -631,9 +620,6 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
goto retry_request;
}

- /* ASSERT(scmnd->scsi_done == NULL); */
- /* ASSERT(scmnd->host_scribble == NULL); */
-
scmnd->scsi_done = done;

request_size = sizeof(struct storvsc_cmd_request);
@@ -672,13 +658,11 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
request->on_io_completion = storvsc_commmand_completion;
request->context = cmd_request;/* scmnd; */

- /* request->PortId = scmnd->device->channel; */
vm_srb->port_number = host_dev->port;
vm_srb->path_id = scmnd->device->channel;
vm_srb->target_id = scmnd->device->id;
vm_srb->lun = scmnd->device->lun;

- /* ASSERT(scmnd->cmd_len <= 16); */
vm_srb->cdb_length = scmnd->cmd_len;

memcpy(vm_srb->cdb, scmnd->cmnd, vm_srb->cdb_length);
@@ -727,7 +711,6 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
page_to_pfn(sg_page((&sgl[i])));

} else if (scsi_sglist(scmnd)) {
- /* ASSERT(scsi_bufflen(scmnd) <= PAGE_SIZE); */
request->data_buffer.offset =
virt_to_phys(scsi_sglist(scmnd)) & (PAGE_SIZE-1);
request->data_buffer.pfn_array[0] =
--
1.7.4.1

2011-05-09 22:01:10

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 062/206] Staging: hv: Get rid of the indirection in invoking storvsc_dev_remove()

Get rid of the indirection in invoking storvsc_dev_remove()

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 650e11f..233aa4c 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -359,8 +359,6 @@ static unsigned int copy_to_bounce_buffer(struct scatterlist *orig_sgl,
*/
static int storvsc_remove(struct hv_device *dev)
{
- struct storvsc_driver *storvsc_drv_obj =
- drv_to_stordrv(dev->device.driver);
struct Scsi_Host *host = dev_get_drvdata(&dev->device);
struct hv_host_device *host_dev =
(struct hv_host_device *)host->hostdata;
@@ -369,7 +367,7 @@ static int storvsc_remove(struct hv_device *dev)
* Call to the vsc driver to let it know that the device is being
* removed
*/
- storvsc_drv_obj->base.dev_rm(dev);
+ storvsc_dev_remove(dev);

if (host_dev->request_pool) {
kmem_cache_destroy(host_dev->request_pool);
@@ -842,7 +840,7 @@ static int storvsc_probe(struct hv_device *device)
ret = scsi_add_host(host, &device->device);
if (ret != 0) {

- storvsc_drv_obj->base.dev_rm(device);
+ storvsc_dev_remove(device);

kmem_cache_destroy(host_dev->request_pool);
scsi_host_put(host);
--
1.7.4.1

2011-05-09 21:59:35

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 063/206] Staging: hv: Get rid of the indirection in invoking storvsc_dev_add()

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 233aa4c..599b5d2 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -784,15 +784,10 @@ static struct scsi_host_template scsi_driver = {
static int storvsc_probe(struct hv_device *device)
{
int ret;
- struct storvsc_driver *storvsc_drv_obj =
- drv_to_stordrv(device->device.driver);
struct Scsi_Host *host;
struct hv_host_device *host_dev;
struct storvsc_device_info device_info;

- if (!storvsc_drv_obj->base.dev_add)
- return -1;
-
host = scsi_host_alloc(&scsi_driver,
sizeof(struct hv_host_device));
if (!host)
@@ -818,7 +813,7 @@ static int storvsc_probe(struct hv_device *device)

device_info.port_number = host->host_no;
/* Call to the vsc driver to add the device */
- ret = storvsc_drv_obj->base.dev_add(device, (void *)&device_info);
+ ret = storvsc_dev_add(device, (void *)&device_info);

if (ret != 0) {
kmem_cache_destroy(host_dev->request_pool);
--
1.7.4.1

2011-05-09 21:59:33

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 064/206] Staging: hv: Get rid of the indirection in invoking storvsc_do_io()

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 599b5d2..6300b79 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -596,8 +596,6 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
struct hv_host_device *host_dev =
(struct hv_host_device *)scmnd->device->host->hostdata;
struct hv_device *dev = host_dev->dev;
- struct storvsc_driver *storvsc_drv_obj =
- drv_to_stordrv(dev->device.driver);
struct hv_storvsc_request *request;
struct storvsc_cmd_request *cmd_request;
unsigned int request_size = 0;
@@ -717,8 +715,8 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,

retry_request:
/* Invokes the vsc to start an IO */
- ret = storvsc_drv_obj->on_io_request(dev,
- &cmd_request->request);
+ ret = storvsc_do_io(dev, &cmd_request->request);
+
if (ret == -1) {
/* no more space */

--
1.7.4.1

2011-05-09 21:59:34

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 065/206] Staging: hv: Get rid of the code initializing the dispatch table

Now that we have eliminated the indirection, we can get rid of
the code to initialize the dispatch table.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 6300b79..caa1f36 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -107,11 +107,6 @@ static int storvsc_initialize(struct hv_driver *driver)
stor_driver->max_outstanding_req_per_channel,
STORVSC_MAX_IO_REQUESTS);

- /* Setup the dispatch table */
- stor_driver->base.dev_add = storvsc_dev_add;
- stor_driver->base.dev_rm = storvsc_dev_remove;
-
- stor_driver->on_io_request = storvsc_do_io;

return 0;
}
--
1.7.4.1

2011-05-09 21:59:32

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 066/206] Staging: hv: Simplify the code for getting the drive parameters

We are making up the drive parameters; simplify the code.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 84 +++++++-------------------------------
1 files changed, 15 insertions(+), 69 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index caa1f36..5624d26 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -381,79 +381,25 @@ static int storvsc_remove(struct hv_device *dev)
static int storvsc_get_chs(struct scsi_device *sdev, struct block_device * bdev,
sector_t capacity, int *info)
{
- sector_t total_sectors = capacity;
- sector_t cylinder_times_heads = 0;
- sector_t temp = 0;
+ sector_t nsect = capacity;
+ sector_t cylinders = nsect;
+ int heads, sectors_pt;

- int sectors_per_track = 0;
- int heads = 0;
- int cylinders = 0;
- int rem = 0;
-
- if (total_sectors > (65535 * 16 * 255))
- total_sectors = (65535 * 16 * 255);
-
- if (total_sectors >= (65535 * 16 * 63)) {
- sectors_per_track = 255;
- heads = 16;
-
- cylinder_times_heads = total_sectors;
- /* sector_div stores the quotient in cylinder_times_heads */
- rem = sector_div(cylinder_times_heads, sectors_per_track);
- } else {
- sectors_per_track = 17;
-
- cylinder_times_heads = total_sectors;
- /* sector_div stores the quotient in cylinder_times_heads */
- rem = sector_div(cylinder_times_heads, sectors_per_track);
-
- temp = cylinder_times_heads + 1023;
- /* sector_div stores the quotient in temp */
- rem = sector_div(temp, 1024);
-
- heads = temp;
-
- if (heads < 4)
- heads = 4;
-
- if (cylinder_times_heads >= (heads * 1024) || (heads > 16)) {
- sectors_per_track = 31;
- heads = 16;
-
- cylinder_times_heads = total_sectors;
- /*
- * sector_div stores the quotient in
- * cylinder_times_heads
- */
- rem = sector_div(cylinder_times_heads,
- sectors_per_track);
- }
-
- if (cylinder_times_heads >= (heads * 1024)) {
- sectors_per_track = 63;
- heads = 16;
-
- cylinder_times_heads = total_sectors;
- /*
- * sector_div stores the quotient in
- * cylinder_times_heads
- */
- rem = sector_div(cylinder_times_heads,
- sectors_per_track);
- }
- }
-
- temp = cylinder_times_heads;
- /* sector_div stores the quotient in temp */
- rem = sector_div(temp, heads);
- cylinders = temp;
+ /*
+ * We are making up these values; let us keep it simple.
+ */
+ heads = 0xff;
+ sectors_pt = 0x3f; /* Sectors per track */
+ sector_div(cylinders, heads * sectors_pt);
+ if ((sector_t)(cylinders + 1) * heads * sectors_pt < nsect)
+ cylinders = 0xffff;

info[0] = heads;
- info[1] = sectors_per_track;
- info[2] = cylinders;
+ info[1] = sectors_pt;
+ info[2] = (int)cylinders;

- DPRINT_INFO(STORVSC_DRV, "CHS (%d, %d, %d)", cylinders, heads,
- sectors_per_track);
+ DPRINT_INFO(STORVSC_DRV, "CHS (%d, %d, %d)", (int)cylinders, heads,
+ sectors_pt);

return 0;
}
--
1.7.4.1

2011-05-09 21:59:30

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 067/206] Staging: hv: Make the function netvsc_device_add() non static

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/netvsc.c | 2 +-
drivers/staging/hv/netvsc_api.h | 1 +
2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c
index 27c7449..7cd3f0b 100644
--- a/drivers/staging/hv/netvsc.c
+++ b/drivers/staging/hv/netvsc.c
@@ -1097,7 +1097,7 @@ out:
* netvsc_device_add - Callback when the device belonging to this
* driver is added
*/
-static int netvsc_device_add(struct hv_device *device, void *additional_info)
+int netvsc_device_add(struct hv_device *device, void *additional_info)
{
int ret = 0;
int i;
diff --git a/drivers/staging/hv/netvsc_api.h b/drivers/staging/hv/netvsc_api.h
index 48b512b..d09d6eb 100644
--- a/drivers/staging/hv/netvsc_api.h
+++ b/drivers/staging/hv/netvsc_api.h
@@ -117,6 +117,7 @@ struct netvsc_device_info {
};

/* Interface */
+int netvsc_device_add(struct hv_device *device, void *additional_info);
int netvsc_initialize(struct hv_driver *drv);
int rndis_filter_open(struct hv_device *dev);
int rndis_filter_close(struct hv_device *dev);
--
1.7.4.1

2011-05-09 21:58:19

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 068/206] Staging: hv: Make netvsc_device_remove non static

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/netvsc.c | 2 +-
drivers/staging/hv/netvsc_api.h | 1 +
2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c
index 7cd3f0b..8790f0f 100644
--- a/drivers/staging/hv/netvsc.c
+++ b/drivers/staging/hv/netvsc.c
@@ -580,7 +580,7 @@ static void netvsc_disconnect_vsp(struct netvsc_device *net_device)
/*
* netvsc_device_remove - Callback when the root bus device is removed
*/
-static int netvsc_device_remove(struct hv_device *device)
+int netvsc_device_remove(struct hv_device *device)
{
struct netvsc_device *net_device;
struct hv_netvsc_packet *netvsc_packet, *pos;
diff --git a/drivers/staging/hv/netvsc_api.h b/drivers/staging/hv/netvsc_api.h
index d09d6eb..d8d77c0 100644
--- a/drivers/staging/hv/netvsc_api.h
+++ b/drivers/staging/hv/netvsc_api.h
@@ -118,6 +118,7 @@ struct netvsc_device_info {

/* Interface */
int netvsc_device_add(struct hv_device *device, void *additional_info);
+int netvsc_device_remove(struct hv_device *device);
int netvsc_initialize(struct hv_driver *drv);
int rndis_filter_open(struct hv_device *dev);
int rndis_filter_close(struct hv_device *dev);
--
1.7.4.1

2011-05-09 21:58:16

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 069/206] Staging: hv: Get rid of netvsc_cleanup()

netvsc_cleanup() is an empty function; get rid of it.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/netvsc.c | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c
index 8790f0f..34828c4 100644
--- a/drivers/staging/hv/netvsc.c
+++ b/drivers/staging/hv/netvsc.c
@@ -622,13 +622,6 @@ int netvsc_device_remove(struct hv_device *device)
return 0;
}

-/*
- * netvsc_cleanup - Perform any cleanup when the driver is removed
- */
-static void netvsc_cleanup(struct hv_driver *drv)
-{
-}
-
static void netvsc_send_completion(struct hv_device *device,
struct vmpacket_descriptor *packet)
{
@@ -1194,7 +1187,6 @@ int netvsc_initialize(struct hv_driver *drv)
/* Setup the dispatch table */
driver->base.dev_add = netvsc_device_add;
driver->base.dev_rm = netvsc_device_remove;
- driver->base.cleanup = netvsc_cleanup;

driver->send = netvsc_send;

--
1.7.4.1

2011-05-09 21:58:13

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 070/206] Staging: hv: Make rndis_filte_device_add() non static

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/netvsc_api.h | 3 +++
drivers/staging/hv/rndis_filter.c | 5 +----
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/netvsc_api.h b/drivers/staging/hv/netvsc_api.h
index d8d77c0..64625e3 100644
--- a/drivers/staging/hv/netvsc_api.h
+++ b/drivers/staging/hv/netvsc_api.h
@@ -122,5 +122,8 @@ int netvsc_device_remove(struct hv_device *device);
int netvsc_initialize(struct hv_driver *drv);
int rndis_filter_open(struct hv_device *dev);
int rndis_filter_close(struct hv_device *dev);
+int rndis_filte_device_add(struct hv_device *dev,
+ void *additional_info);
+

#endif /* _NETVSC_API_H_ */
diff --git a/drivers/staging/hv/rndis_filter.c b/drivers/staging/hv/rndis_filter.c
index 6305050..09118b8 100644
--- a/drivers/staging/hv/rndis_filter.c
+++ b/drivers/staging/hv/rndis_filter.c
@@ -84,9 +84,6 @@ struct rndis_filter_packet {
};


-static int rndis_filte_device_add(struct hv_device *dev,
- void *additional_info);
-
static int rndis_filter_device_remove(struct hv_device *dev);

static void rndis_filter_cleanup(struct hv_driver *drv);
@@ -746,7 +743,7 @@ static int rndis_filter_close_device(struct rndis_device *dev)
return ret;
}

-static int rndis_filte_device_add(struct hv_device *dev,
+int rndis_filte_device_add(struct hv_device *dev,
void *additional_info)
{
int ret;
--
1.7.4.1

2011-05-09 21:58:14

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 071/206] Staging: hv: Make rndis_filter_device_remove() non static

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/netvsc_api.h | 1 +
drivers/staging/hv/rndis_filter.c | 4 +---
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/hv/netvsc_api.h b/drivers/staging/hv/netvsc_api.h
index 64625e3..b385c9d 100644
--- a/drivers/staging/hv/netvsc_api.h
+++ b/drivers/staging/hv/netvsc_api.h
@@ -124,6 +124,7 @@ int rndis_filter_open(struct hv_device *dev);
int rndis_filter_close(struct hv_device *dev);
int rndis_filte_device_add(struct hv_device *dev,
void *additional_info);
+int rndis_filter_device_remove(struct hv_device *dev);


#endif /* _NETVSC_API_H_ */
diff --git a/drivers/staging/hv/rndis_filter.c b/drivers/staging/hv/rndis_filter.c
index 09118b8..455d440 100644
--- a/drivers/staging/hv/rndis_filter.c
+++ b/drivers/staging/hv/rndis_filter.c
@@ -84,8 +84,6 @@ struct rndis_filter_packet {
};


-static int rndis_filter_device_remove(struct hv_device *dev);
-
static void rndis_filter_cleanup(struct hv_driver *drv);

static int rndis_filter_send(struct hv_device *dev,
@@ -803,7 +801,7 @@ int rndis_filte_device_add(struct hv_device *dev,
return ret;
}

-static int rndis_filter_device_remove(struct hv_device *dev)
+int rndis_filter_device_remove(struct hv_device *dev)
{
struct netvsc_device *net_dev = dev->ext;
struct rndis_device *rndis_dev = net_dev->extension;
--
1.7.4.1

2011-05-09 21:58:10

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 072/206] Staging: hv: Get rid of rndis_filter_cleanup()

rndis_filter_cleanup() is an empty function; get rid of it.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/rndis_filter.c | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/hv/rndis_filter.c b/drivers/staging/hv/rndis_filter.c
index 455d440..b0c888e 100644
--- a/drivers/staging/hv/rndis_filter.c
+++ b/drivers/staging/hv/rndis_filter.c
@@ -84,8 +84,6 @@ struct rndis_filter_packet {
};


-static void rndis_filter_cleanup(struct hv_driver *drv);
-
static int rndis_filter_send(struct hv_device *dev,
struct hv_netvsc_packet *pkt);

@@ -621,7 +619,6 @@ int rndis_filter_init(struct netvsc_driver *drv)
/* Override */
drv->base.dev_add = rndis_filte_device_add;
drv->base.dev_rm = rndis_filter_device_remove;
- drv->base.cleanup = rndis_filter_cleanup;
drv->send = rndis_filter_send;
drv->recv_cb = rndis_filter_receive;

@@ -818,9 +815,6 @@ int rndis_filter_device_remove(struct hv_device *dev)
return 0;
}

-static void rndis_filter_cleanup(struct hv_driver *drv)
-{
-}

int rndis_filter_open(struct hv_device *dev)
{
--
1.7.4.1

2011-05-09 21:57:44

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 073/206] Staging: hv: Get rid of the indirection to invoke rndis_filte_device_add()

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/netvsc_drv.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
index f4c6000..d962308 100644
--- a/drivers/staging/hv/netvsc_drv.c
+++ b/drivers/staging/hv/netvsc_drv.c
@@ -349,9 +349,6 @@ static int netvsc_probe(struct hv_device *dev)
struct netvsc_device_info device_info;
int ret;

- if (!net_drv_obj->base.dev_add)
- return -1;
-
net = alloc_etherdev(sizeof(struct net_device_context));
if (!net)
return -1;
@@ -366,7 +363,7 @@ static int netvsc_probe(struct hv_device *dev)
INIT_WORK(&net_device_ctx->work, netvsc_send_garp);

/* Notify the netvsc driver of the new device */
- ret = net_drv_obj->base.dev_add(dev, &device_info);
+ ret = rndis_filte_device_add(dev, &device_info);
if (ret != 0) {
free_netdev(net);
dev_set_drvdata(&dev->device, NULL);
--
1.7.4.1

2011-05-09 21:56:52

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 074/206] Staging: hv: Get rid of the indirection to invoke netvsc_device_add()

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/rndis_filter.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/hv/rndis_filter.c b/drivers/staging/hv/rndis_filter.c
index b0c888e..299b14e 100644
--- a/drivers/staging/hv/rndis_filter.c
+++ b/drivers/staging/hv/rndis_filter.c
@@ -755,7 +755,7 @@ int rndis_filte_device_add(struct hv_device *dev,
* NOTE! Once the channel is created, we may get a receive callback
* (RndisFilterOnReceive()) before this call is completed
*/
- ret = rndis_filter.inner_drv.base.dev_add(dev, additional_info);
+ ret = netvsc_device_add(dev, additional_info);
if (ret != 0) {
kfree(rndisDevice);
return ret;
--
1.7.4.1

2011-05-09 21:57:45

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 075/206] Staging: hv: Get rid of the indirection in invoking rndis_filter_device_remove()

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/netvsc_drv.c | 11 ++---------
1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
index d962308..3fc39cd 100644
--- a/drivers/staging/hv/netvsc_drv.c
+++ b/drivers/staging/hv/netvsc_drv.c
@@ -342,8 +342,6 @@ static void netvsc_send_garp(struct work_struct *w)

static int netvsc_probe(struct hv_device *dev)
{
- struct netvsc_driver *net_drv_obj =
- drv_to_netvscdrv(dev->device.driver);
struct net_device *net = NULL;
struct net_device_context *net_device_ctx;
struct netvsc_device_info device_info;
@@ -398,7 +396,7 @@ static int netvsc_probe(struct hv_device *dev)
ret = register_netdev(net);
if (ret != 0) {
/* Remove the device and release the resource */
- net_drv_obj->base.dev_rm(dev);
+ rndis_filter_device_remove(dev);
free_netdev(net);
}

@@ -407,8 +405,6 @@ static int netvsc_probe(struct hv_device *dev)

static int netvsc_remove(struct hv_device *dev)
{
- struct netvsc_driver *net_drv_obj =
- drv_to_netvscdrv(dev->device.driver);
struct net_device *net = dev_get_drvdata(&dev->device);
int ret;

@@ -417,9 +413,6 @@ static int netvsc_remove(struct hv_device *dev)
return 0;
}

- if (!net_drv_obj->base.dev_rm)
- return -1;
-
/* Stop outbound asap */
netif_stop_queue(net);
/* netif_carrier_off(net); */
@@ -430,7 +423,7 @@ static int netvsc_remove(struct hv_device *dev)
* Call to the vsc driver to let it know that the device is being
* removed
*/
- ret = net_drv_obj->base.dev_rm(dev);
+ ret = rndis_filter_device_remove(dev);
if (ret != 0) {
/* TODO: */
netdev_err(net, "unable to remove vsc device (ret %d)\n", ret);
--
1.7.4.1

2011-05-09 21:57:33

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 076/206] Staging: hv: Get rid of the indirection in invoking netvsc_device_remove()

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/rndis_filter.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/rndis_filter.c b/drivers/staging/hv/rndis_filter.c
index 299b14e..f9c18fa 100644
--- a/drivers/staging/hv/rndis_filter.c
+++ b/drivers/staging/hv/rndis_filter.c
@@ -809,8 +809,7 @@ int rndis_filter_device_remove(struct hv_device *dev)
kfree(rndis_dev);
net_dev->extension = NULL;

- /* Pass control to inner driver to remove the device */
- rndis_filter.inner_drv.base.dev_rm(dev);
+ netvsc_device_remove(dev);

return 0;
}
--
1.7.4.1

2011-05-09 21:54:15

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 077/206] Staging: hv: Get rid of call to cleanup()

cleanup() is an empty function; get rid of it.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/netvsc_drv.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
index 3fc39cd..0e81a93 100644
--- a/drivers/staging/hv/netvsc_drv.c
+++ b/drivers/staging/hv/netvsc_drv.c
@@ -444,7 +444,6 @@ static int netvsc_drv_exit_cb(struct device *dev, void *data)

static void netvsc_drv_exit(void)
{
- struct netvsc_driver *netvsc_drv_obj = &g_netvsc_drv;
struct hv_driver *drv = &g_netvsc_drv.base;
struct device *current_dev;
int ret;
@@ -466,9 +465,6 @@ static void netvsc_drv_exit(void)
device_unregister(current_dev);
}

- if (netvsc_drv_obj->base.cleanup)
- netvsc_drv_obj->base.cleanup(&netvsc_drv_obj->base);
-
vmbus_child_driver_unregister(&drv->driver);

return;
--
1.7.4.1

2011-05-09 21:55:25

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 078/206] Staging: hv: Get rid of unnecessary code in netvsc.c

Now that we had gotten rid of the indirection; get rid of some
unnecessary code.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/netvsc.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c
index 34828c4..832f62e 100644
--- a/drivers/staging/hv/netvsc.c
+++ b/drivers/staging/hv/netvsc.c
@@ -1184,9 +1184,6 @@ int netvsc_initialize(struct hv_driver *drv)
drv->name = driver_name;
memcpy(&drv->dev_type, &netvsc_device_type, sizeof(struct hv_guid));

- /* Setup the dispatch table */
- driver->base.dev_add = netvsc_device_add;
- driver->base.dev_rm = netvsc_device_remove;

driver->send = netvsc_send;

--
1.7.4.1

2011-05-09 21:56:52

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 079/206] Staging: hv: Get rid of some unnecessary code in rndis_filter.c

Now that we have gotten rid of the indirection; get rid
of some unnecessary code.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/rndis_filter.c | 7 -------
1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/hv/rndis_filter.c b/drivers/staging/hv/rndis_filter.c
index f9c18fa..ee74cd1 100644
--- a/drivers/staging/hv/rndis_filter.c
+++ b/drivers/staging/hv/rndis_filter.c
@@ -606,19 +606,12 @@ int rndis_filter_init(struct netvsc_driver *drv)
rndisDriver->OnLinkStatusChanged = Driver->OnLinkStatusChanged;*/

/* Save the original dispatch handlers before we override it */
- rndis_filter.inner_drv.base.dev_add = drv->base.dev_add;
- rndis_filter.inner_drv.base.dev_rm =
- drv->base.dev_rm;
- rndis_filter.inner_drv.base.cleanup = drv->base.cleanup;
-
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.dev_add = rndis_filte_device_add;
- drv->base.dev_rm = rndis_filter_device_remove;
drv->send = rndis_filter_send;
drv->recv_cb = rndis_filter_receive;

--
1.7.4.1

2011-05-09 21:56:27

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 080/206] Staging: hv: Get rid of the indirection to invoke mousevsc_on_device_add()

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index d49a51e..43f5158 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -836,9 +836,6 @@ static int mousevsc_probe(struct hv_device *dev)
{
int ret = 0;

- struct mousevsc_drv_obj *mousevsc_drv_obj =
- drv_to_mousedrv(dev->device.driver);
-
struct input_device_context *input_dev_ctx;

input_dev_ctx = kmalloc(sizeof(struct input_device_context),
@@ -847,7 +844,7 @@ static int mousevsc_probe(struct hv_device *dev)
dev_set_drvdata(&dev->device, input_dev_ctx);

/* Call to the vsc driver to add the device */
- ret = mousevsc_drv_obj->base.dev_add(dev, NULL);
+ ret = mousevsc_on_device_add(dev, NULL);

if (ret != 0) {
DPRINT_ERR(INPUTVSC_DRV, "unable to add input vsc device");
--
1.7.4.1

2011-05-09 21:55:24

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 081/206] Staging: hv: Get rid of the indirection to invoke mousevsc_on_device_remove

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index 43f5158..b7016e2 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -859,9 +859,6 @@ static int mousevsc_remove(struct hv_device *dev)
{
int ret = 0;

- struct mousevsc_drv_obj *mousevsc_drv_obj =
- drv_to_mousedrv(dev->device.driver);
-
struct input_device_context *input_dev_ctx;

input_dev_ctx = kmalloc(sizeof(struct input_device_context),
@@ -874,14 +871,11 @@ static int mousevsc_remove(struct hv_device *dev)
input_dev_ctx->connected = 0;
}

- if (!mousevsc_drv_obj->base.dev_rm)
- return -1;
-
/*
* Call to the vsc driver to let it know that the device
* is being removed
*/
- ret = mousevsc_drv_obj->base.dev_rm(dev);
+ ret = mousevsc_on_device_remove(dev);

if (ret != 0) {
DPRINT_ERR(INPUTVSC_DRV,
--
1.7.4.1

2011-05-09 21:56:50

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 082/206] Staging: hv: Get rid of the mouse cleanup() function

mousevsc_on_cleanup() is an empty function; get rid of it.


Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index b7016e2..41bfa3f 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -782,9 +782,6 @@ static int mousevsc_on_device_remove(struct hv_device *device)
return ret;
}

-static void mousevsc_on_cleanup(struct hv_driver *drv)
-{
-}

/*
* Data types
@@ -994,7 +991,6 @@ static int mouse_vsc_initialize(struct hv_driver *driver)
/* Setup the dispatch table */
input_drv->base.dev_add = mousevsc_on_device_add;
input_drv->base.dev_rm = mousevsc_on_device_remove;
- input_drv->base.cleanup = mousevsc_on_cleanup;

return ret;
}
--
1.7.4.1

2011-05-09 21:54:13

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 083/206] Staging: hv: Cleanup mouse_vsc_initialize()

Now that we have gotten rid of the indirection, cleanup
mouse_vsc_initialize().

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 10 +---------
1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index 41bfa3f..523c428 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -980,19 +980,11 @@ static void mousevsc_drv_exit(void)

static int mouse_vsc_initialize(struct hv_driver *driver)
{
- struct mousevsc_drv_obj *input_drv =
- (struct mousevsc_drv_obj *)driver;
- int ret = 0;
-
driver->name = driver_name;
memcpy(&driver->dev_type, &mouse_guid,
sizeof(struct hv_guid));

- /* Setup the dispatch table */
- input_drv->base.dev_add = mousevsc_on_device_add;
- input_drv->base.dev_rm = mousevsc_on_device_remove;
-
- return ret;
+ return 0;
}


--
1.7.4.1

2011-05-09 21:56:25

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 084/206] Staging: hv: Get rid of dev_add from struct hv_driver

Now that we have gotten rid of the indirection, get rid of the
unnecessary state struct hv_driver.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/vmbus_api.h | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/hv/vmbus_api.h b/drivers/staging/hv/vmbus_api.h
index 50fbeb5..b1a7e88 100644
--- a/drivers/staging/hv/vmbus_api.h
+++ b/drivers/staging/hv/vmbus_api.h
@@ -96,7 +96,6 @@ struct hv_driver {

struct device_driver driver;

- int (*dev_add)(struct hv_device *device, void *data);
int (*dev_rm)(struct hv_device *device);
void (*cleanup)(struct hv_driver *driver);

--
1.7.4.1

2011-05-09 21:53:35

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 085/206] Staging: hv: Get rid of dev_rm from struct hv_driver

Now that we have gotten rid of the indirection for invoking dev_rm,
get rid of this.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/vmbus_api.h | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/hv/vmbus_api.h b/drivers/staging/hv/vmbus_api.h
index b1a7e88..568ff09 100644
--- a/drivers/staging/hv/vmbus_api.h
+++ b/drivers/staging/hv/vmbus_api.h
@@ -96,7 +96,6 @@ struct hv_driver {

struct device_driver driver;

- int (*dev_rm)(struct hv_device *device);
void (*cleanup)(struct hv_driver *driver);

int (*probe)(struct hv_device *);
--
1.7.4.1

2011-05-09 21:56:09

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 086/206] Staging: hv: Cleanup calls to cleanup in storvsc_drv.c

cleanup() is an empty function; get rid of calls to this.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 5624d26..0d7e43b 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -833,7 +833,6 @@ static int storvsc_drv_exit_cb(struct device *dev, void *data)

static void storvsc_drv_exit(void)
{
- struct storvsc_driver *storvsc_drv_obj = &storvsc_drv;
struct hv_driver *drv = &storvsc_drv.base;
struct device *current_dev = NULL;
int ret;
@@ -854,9 +853,6 @@ static void storvsc_drv_exit(void)
device_unregister(current_dev);
}

- if (storvsc_drv_obj->base.cleanup)
- storvsc_drv_obj->base.cleanup(&storvsc_drv_obj->base);
-
vmbus_child_driver_unregister(&drv->driver);
return;
}
--
1.7.4.1

2011-05-10 08:31:12

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 087/206] Staging: hv: Cleanup calls to cleanup() in hv_mouse.c

Cleanup calls to cleanup() in hv_mouse.c as this is an empty function.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index 523c428..b708663 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -947,7 +947,6 @@ static int mousevsc_drv_exit_cb(struct device *dev, void *data)

static void mousevsc_drv_exit(void)
{
- struct mousevsc_drv_obj *mousevsc_drv_obj = &g_mousevsc_drv;
struct hv_driver *drv = &g_mousevsc_drv.base;
int ret;

@@ -970,9 +969,6 @@ static void mousevsc_drv_exit(void)
device_unregister(current_dev);
}

- if (mousevsc_drv_obj->base.cleanup)
- mousevsc_drv_obj->base.cleanup(&mousevsc_drv_obj->base);
-
vmbus_child_driver_unregister(&drv->driver);

return;
--
1.7.4.1

2011-05-09 21:55:55

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 088/206] Staging: hv: Get rid of cleanup from struct hv_driver

Now that we have removed calls to this empty function, get rid of the
unnecessary state in struct hv_driver.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/vmbus_api.h | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/vmbus_api.h b/drivers/staging/hv/vmbus_api.h
index 568ff09..5845436 100644
--- a/drivers/staging/hv/vmbus_api.h
+++ b/drivers/staging/hv/vmbus_api.h
@@ -96,8 +96,6 @@ struct hv_driver {

struct device_driver driver;

- void (*cleanup)(struct hv_driver *driver);
-
int (*probe)(struct hv_device *);
int (*remove)(struct hv_device *);
void (*shutdown)(struct hv_device *);
--
1.7.4.1

2011-05-09 21:52:06

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 089/206] Staging: hv: Rename the variable g_netvsc_drv

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/netvsc_drv.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
index 0e81a93..25883ca 100644
--- a/drivers/staging/hv/netvsc_drv.c
+++ b/drivers/staging/hv/netvsc_drv.c
@@ -61,7 +61,7 @@ module_param(ring_size, int, S_IRUGO);
MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)");

/* The one and only one */
-static struct netvsc_driver g_netvsc_drv;
+static struct netvsc_driver 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
@@ -444,7 +444,7 @@ static int netvsc_drv_exit_cb(struct device *dev, void *data)

static void netvsc_drv_exit(void)
{
- struct hv_driver *drv = &g_netvsc_drv.base;
+ struct hv_driver *drv = &netvsc_drv.base;
struct device *current_dev;
int ret;

@@ -472,8 +472,8 @@ static void netvsc_drv_exit(void)

static int netvsc_drv_init(int (*drv_init)(struct hv_driver *drv))
{
- struct netvsc_driver *net_drv_obj = &g_netvsc_drv;
- struct hv_driver *drv = &g_netvsc_drv.base;
+ struct netvsc_driver *net_drv_obj = &netvsc_drv;
+ struct hv_driver *drv = &netvsc_drv.base;
int ret;

net_drv_obj->ring_buf_size = ring_size * PAGE_SIZE;
--
1.7.4.1

2011-05-09 21:51:38

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 090/206] Staging: hv: Move the declaration of the variable netvsc_drv

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/netvsc_drv.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
index 25883ca..566865f 100644
--- a/drivers/staging/hv/netvsc_drv.c
+++ b/drivers/staging/hv/netvsc_drv.c
@@ -60,9 +60,6 @@ static int ring_size = 128;
module_param(ring_size, int, S_IRUGO);
MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)");

-/* The one and only one */
-static struct netvsc_driver 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() */
@@ -442,6 +439,9 @@ static int netvsc_drv_exit_cb(struct device *dev, void *data)
return 1;
}

+/* The one and only one */
+static struct netvsc_driver netvsc_drv;
+
static void netvsc_drv_exit(void)
{
struct hv_driver *drv = &netvsc_drv.base;
--
1.7.4.1

2011-05-09 21:54:17

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 091/206] Staging: hv: Statically initialize probe/remove

Statically initialize probe/remove.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/netvsc_drv.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
index 566865f..c5e7b93 100644
--- a/drivers/staging/hv/netvsc_drv.c
+++ b/drivers/staging/hv/netvsc_drv.c
@@ -440,7 +440,10 @@ static int netvsc_drv_exit_cb(struct device *dev, void *data)
}

/* The one and only one */
-static struct netvsc_driver netvsc_drv;
+static struct netvsc_driver netvsc_drv = {
+ .base.probe = netvsc_probe,
+ .base.remove = netvsc_remove,
+};

static void netvsc_drv_exit(void)
{
@@ -485,9 +488,6 @@ static int netvsc_drv_init(int (*drv_init)(struct hv_driver *drv))

drv->driver.name = net_drv_obj->base.name;

- drv->probe = netvsc_probe;
- drv->remove = netvsc_remove;
-
/* The driver belongs to vmbus */
ret = vmbus_child_driver_register(&drv->driver);

--
1.7.4.1

2011-05-09 21:54:20

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 092/206] Staging: hv: Rename the variable g_mousevsc_drv

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index b708663..cc3c1d4 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -794,7 +794,7 @@ struct input_device_context {
};


-static struct mousevsc_drv_obj g_mousevsc_drv;
+static struct mousevsc_drv_obj mousevsc_drv;

static void deviceinfo_callback(struct hv_device *dev, struct hv_input_dev_info *info)
{
@@ -947,7 +947,7 @@ static int mousevsc_drv_exit_cb(struct device *dev, void *data)

static void mousevsc_drv_exit(void)
{
- struct hv_driver *drv = &g_mousevsc_drv.base;
+ struct hv_driver *drv = &mousevsc_drv.base;
int ret;

struct device *current_dev = NULL;
@@ -986,8 +986,8 @@ static int mouse_vsc_initialize(struct hv_driver *driver)

static int __init mousevsc_init(void)
{
- struct mousevsc_drv_obj *input_drv_obj = &g_mousevsc_drv;
- struct hv_driver *drv = &g_mousevsc_drv.base;
+ struct mousevsc_drv_obj *input_drv_obj = &mousevsc_drv;
+ struct hv_driver *drv = &mousevsc_drv.base;

DPRINT_INFO(INPUTVSC_DRV, "Hyper-V Mouse driver initializing.");

--
1.7.4.1

2011-05-10 08:51:07

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 093/206] Staging: hv: Move the declaration of the variable mousevsc_drv

Move the declaration of the variable mousevsc_drv.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index cc3c1d4..c5e50b4 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -794,8 +794,6 @@ struct input_device_context {
};


-static struct mousevsc_drv_obj mousevsc_drv;
-
static void deviceinfo_callback(struct hv_device *dev, struct hv_input_dev_info *info)
{
struct input_device_context *input_device_ctx =
@@ -945,6 +943,8 @@ static int mousevsc_drv_exit_cb(struct device *dev, void *data)
return 1;
}

+static struct mousevsc_drv_obj mousevsc_drv;
+
static void mousevsc_drv_exit(void)
{
struct hv_driver *drv = &mousevsc_drv.base;
--
1.7.4.1

2011-05-09 21:53:19

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 094/206] Staging: hv: Statically initialize probe/remove

Statically initialize probe/remove.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index c5e50b4..4475534 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -943,7 +943,10 @@ static int mousevsc_drv_exit_cb(struct device *dev, void *data)
return 1;
}

-static struct mousevsc_drv_obj mousevsc_drv;
+static struct mousevsc_drv_obj mousevsc_drv = {
+ .base.probe = mousevsc_probe,
+ .base.remove = mousevsc_remove,
+};

static void mousevsc_drv_exit(void)
{
@@ -996,9 +999,6 @@ static int __init mousevsc_init(void)

drv->driver.name = input_drv_obj->base.name;

- drv->probe = mousevsc_probe;
- drv->remove = mousevsc_remove;
-
/* The driver belongs to vmbus */
vmbus_child_driver_register(&drv->driver);

--
1.7.4.1

2011-05-09 21:54:19

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 095/206] Staging: hv: Rename the function ringbuffer_init

Rename the function ringbuffer_init to not pollute the
namespace.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/channel.c | 7 +++++--
drivers/staging/hv/ring_buffer.c | 4 ++--
drivers/staging/hv/ring_buffer.h | 3 ++-
3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index b53be58..43e54b5 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -201,13 +201,16 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
newchannel->ringbuffer_pagecount = (send_ringbuffer_size +
recv_ringbuffer_size) >> PAGE_SHIFT;

- ret = ringbuffer_init(&newchannel->outbound, out, send_ringbuffer_size);
+ ret = hv_ringbuffer_init(
+ &newchannel->outbound, out, send_ringbuffer_size);
+
if (ret != 0) {
err = ret;
goto errorout;
}

- ret = ringbuffer_init(&newchannel->inbound, in, recv_ringbuffer_size);
+ ret = hv_ringbuffer_init(
+ &newchannel->inbound, in, recv_ringbuffer_size);
if (ret != 0) {
err = ret;
goto errorout;
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 66e1b3f..9653ab5 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -299,13 +299,13 @@ u32 get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *rbi)
/*++

Name:
- ringbuffer_init()
+ hv_ringbuffer_init()

Description:
Initialize the ring buffer

--*/
-int ringbuffer_init(struct hv_ring_buffer_info *ring_info,
+int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
void *buffer, u32 buflen)
{
if (sizeof(struct hv_ring_buffer) != PAGE_SIZE)
diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h
index 7bf20d6..3c66dc0 100644
--- a/drivers/staging/hv/ring_buffer.h
+++ b/drivers/staging/hv/ring_buffer.h
@@ -18,6 +18,7 @@
* Authors:
* Haiyang Zhang <[email protected]>
* Hank Janssen <[email protected]>
+ * K. Y. Srinivasan <[email protected]>
*
*/

@@ -75,7 +76,7 @@ struct hv_ring_buffer_debug_info {
/* Interface */


-int ringbuffer_init(struct hv_ring_buffer_info *ring_info, void *buffer,
+int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info, void *buffer,
u32 buflen);

void ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info);
--
1.7.4.1

2011-05-09 21:44:57

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 096/206] Staging: hv: Rename ringbuffer_cleanup

Rename ringbuffer_cleanup.


Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/channel.c | 8 ++++----
drivers/staging/hv/ring_buffer.c | 4 ++--
drivers/staging/hv/ring_buffer.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 43e54b5..44b81e8 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -292,8 +292,8 @@ Cleanup:
return err;

errorout:
- ringbuffer_cleanup(&newchannel->outbound);
- ringbuffer_cleanup(&newchannel->inbound);
+ hv_ringbuffer_cleanup(&newchannel->outbound);
+ hv_ringbuffer_cleanup(&newchannel->inbound);
free_pages((unsigned long)out,
get_order(send_ringbuffer_size + recv_ringbuffer_size));
kfree(openInfo);
@@ -651,8 +651,8 @@ void vmbus_close(struct vmbus_channel *channel)
/* TODO: Send a msg to release the childRelId */

/* Cleanup the ring buffers for this channel */
- ringbuffer_cleanup(&channel->outbound);
- ringbuffer_cleanup(&channel->inbound);
+ hv_ringbuffer_cleanup(&channel->outbound);
+ hv_ringbuffer_cleanup(&channel->inbound);

free_pages((unsigned long)channel->ringbuffer_pages,
get_order(channel->ringbuffer_pagecount * PAGE_SIZE));
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 9653ab5..9bab40c 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -328,13 +328,13 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
/*++

Name:
- ringbuffer_cleanup()
+ hv_ringbuffer_cleanup()

Description:
Cleanup the ring buffer

--*/
-void ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info)
+void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info)
{
}

diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h
index 3c66dc0..66d9a2d 100644
--- a/drivers/staging/hv/ring_buffer.h
+++ b/drivers/staging/hv/ring_buffer.h
@@ -79,7 +79,7 @@ struct hv_ring_buffer_debug_info {
int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info, void *buffer,
u32 buflen);

-void ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info);
+void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info);

int ringbuffer_write(struct hv_ring_buffer_info *ring_info,
struct scatterlist *sglist,
--
1.7.4.1

2011-05-09 21:53:57

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 097/206] Staging: hv: Rename ringbuffer_write

Rename ringbuffer_write.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/channel.c | 6 +++---
drivers/staging/hv/ring_buffer.c | 4 ++--
drivers/staging/hv/ring_buffer.h | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 44b81e8..859771c 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -718,7 +718,7 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer,
sg_set_buf(&bufferlist[2], &aligned_data,
packetlen_aligned - packetlen);

- ret = ringbuffer_write(&channel->outbound, bufferlist, 3);
+ ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3);

/* TODO: We should determine if this is optional */
if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound))
@@ -783,7 +783,7 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
sg_set_buf(&bufferlist[2], &aligned_data,
packetlen_aligned - packetlen);

- ret = ringbuffer_write(&channel->outbound, bufferlist, 3);
+ ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3);

/* TODO: We should determine if this is optional */
if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound))
@@ -848,7 +848,7 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,
sg_set_buf(&bufferlist[2], &aligned_data,
packetlen_aligned - packetlen);

- ret = ringbuffer_write(&channel->outbound, bufferlist, 3);
+ ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3);

/* TODO: We should determine if this is optional */
if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound))
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 9bab40c..483678c 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -341,13 +341,13 @@ void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info)
/*++

Name:
- ringbuffer_write()
+ hv_ringbuffer_write()

Description:
Write to the ring buffer

--*/
-int ringbuffer_write(struct hv_ring_buffer_info *outring_info,
+int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
struct scatterlist *sglist, u32 sgcount)
{
int i = 0;
diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h
index 66d9a2d..5c17288 100644
--- a/drivers/staging/hv/ring_buffer.h
+++ b/drivers/staging/hv/ring_buffer.h
@@ -81,7 +81,7 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info, void *buffer,

void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info);

-int ringbuffer_write(struct hv_ring_buffer_info *ring_info,
+int hv_ringbuffer_write(struct hv_ring_buffer_info *ring_info,
struct scatterlist *sglist,
u32 sgcount);

--
1.7.4.1

2011-05-09 21:53:37

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 098/206] Staging: hv: Rename ringbuffer_peek

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/channel.c | 4 ++--
drivers/staging/hv/ring_buffer.c | 4 ++--
drivers/staging/hv/ring_buffer.h | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 859771c..d625517 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -885,7 +885,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer,

spin_lock_irqsave(&channel->inbound_lock, flags);

- ret = ringbuffer_peek(&channel->inbound, &desc,
+ ret = hv_ringbuffer_peek(&channel->inbound, &desc,
sizeof(struct vmpacket_descriptor));
if (ret != 0) {
spin_unlock_irqrestore(&channel->inbound_lock, flags);
@@ -938,7 +938,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer,

spin_lock_irqsave(&channel->inbound_lock, flags);

- ret = ringbuffer_peek(&channel->inbound, &desc,
+ ret = hv_ringbuffer_peek(&channel->inbound, &desc,
sizeof(struct vmpacket_descriptor));
if (ret != 0) {
spin_unlock_irqrestore(&channel->inbound_lock, flags);
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 483678c..bf04397 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -418,13 +418,13 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
/*++

Name:
- ringbuffer_peek()
+ hv_ringbuffer_peek()

Description:
Read without advancing the read index

--*/
-int ringbuffer_peek(struct hv_ring_buffer_info *Inring_info,
+int hv_ringbuffer_peek(struct hv_ring_buffer_info *Inring_info,
void *Buffer, u32 buflen)
{
u32 bytes_avail_towrite;
diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h
index 5c17288..c684d97 100644
--- a/drivers/staging/hv/ring_buffer.h
+++ b/drivers/staging/hv/ring_buffer.h
@@ -85,7 +85,7 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *ring_info,
struct scatterlist *sglist,
u32 sgcount);

-int ringbuffer_peek(struct hv_ring_buffer_info *ring_info, void *buffer,
+int hv_ringbuffer_peek(struct hv_ring_buffer_info *ring_info, void *buffer,
u32 buflen);

int ringbuffer_read(struct hv_ring_buffer_info *ring_info,
--
1.7.4.1

2011-05-09 21:44:58

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 099/206] Staging: hv: Rename ringbuffer_read

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/channel.c | 4 ++--
drivers/staging/hv/ring_buffer.c | 4 ++--
drivers/staging/hv/ring_buffer.h | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index d625517..9f8bed2 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -911,7 +911,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer,
*requestid = desc.trans_id;

/* Copy over the packet to the user buffer */
- ret = ringbuffer_read(&channel->inbound, buffer, userlen,
+ ret = hv_ringbuffer_read(&channel->inbound, buffer, userlen,
(desc.offset8 << 3));

spin_unlock_irqrestore(&channel->inbound_lock, flags);
@@ -964,7 +964,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer,
*requestid = desc.trans_id;

/* Copy over the entire packet to the user buffer */
- ret = ringbuffer_read(&channel->inbound, buffer, packetlen, 0);
+ ret = hv_ringbuffer_read(&channel->inbound, buffer, packetlen, 0);

spin_unlock_irqrestore(&channel->inbound_lock, flags);
return 0;
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index bf04397..2a05059 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -468,13 +468,13 @@ int hv_ringbuffer_peek(struct hv_ring_buffer_info *Inring_info,
/*++

Name:
- ringbuffer_read()
+ hv_ringbuffer_read()

Description:
Read and advance the read index

--*/
-int ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
+int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
u32 buflen, u32 offset)
{
u32 bytes_avail_towrite;
diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h
index c684d97..0ebf3be 100644
--- a/drivers/staging/hv/ring_buffer.h
+++ b/drivers/staging/hv/ring_buffer.h
@@ -88,7 +88,7 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *ring_info,
int hv_ringbuffer_peek(struct hv_ring_buffer_info *ring_info, void *buffer,
u32 buflen);

-int ringbuffer_read(struct hv_ring_buffer_info *ring_info,
+int hv_ringbuffer_read(struct hv_ring_buffer_info *ring_info,
void *buffer,
u32 buflen,
u32 offset);
--
1.7.4.1

2011-05-09 21:50:08

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 100/206] Staging: hv: Rename get_ringbuffer_interrupt_mask

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/channel.c | 6 +++---
drivers/staging/hv/ring_buffer.c | 4 ++--
drivers/staging/hv/ring_buffer.h | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 9f8bed2..3274b29 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -721,7 +721,7 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer,
ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3);

/* TODO: We should determine if this is optional */
- if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound))
+ if (ret == 0 && !hv_get_ringbuffer_interrupt_mask(&channel->outbound))
vmbus_setevent(channel);

return ret;
@@ -786,7 +786,7 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3);

/* TODO: We should determine if this is optional */
- if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound))
+ if (ret == 0 && !hv_get_ringbuffer_interrupt_mask(&channel->outbound))
vmbus_setevent(channel);

return ret;
@@ -851,7 +851,7 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,
ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3);

/* TODO: We should determine if this is optional */
- if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound))
+ if (ret == 0 && !hv_get_ringbuffer_interrupt_mask(&channel->outbound))
vmbus_setevent(channel);

return ret;
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 2a05059..013b7a5 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -285,13 +285,13 @@ void ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
/*++

Name:
- get_ringbuffer_interrupt_mask()
+ hv_get_ringbuffer_interrupt_mask()

Description:
Get the interrupt mask for the specified ring buffer

--*/
-u32 get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *rbi)
+u32 hv_get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *rbi)
{
return rbi->ring_buffer->interrupt_mask;
}
diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h
index 0ebf3be..6454105 100644
--- a/drivers/staging/hv/ring_buffer.h
+++ b/drivers/staging/hv/ring_buffer.h
@@ -93,7 +93,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *ring_info,
u32 buflen,
u32 offset);

-u32 get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *ring_info);
+u32 hv_get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *ring_info);

void dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix);

--
1.7.4.1

2011-05-09 21:52:05

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 101/206] Staging: hv: Rename dump_ring_info

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/channel.c | 4 ++--
drivers/staging/hv/ring_buffer.c | 4 ++--
drivers/staging/hv/ring_buffer.h | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 3274b29..be4e004 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -1001,6 +1001,6 @@ void vmbus_ontimer(unsigned long data)
static void dump_vmbus_channel(struct vmbus_channel *channel)
{
DPRINT_DBG(VMBUS, "Channel (%d)", channel->offermsg.child_relid);
- dump_ring_info(&channel->outbound, "Outbound ");
- dump_ring_info(&channel->inbound, "Inbound ");
+ hv_dump_ring_info(&channel->outbound, "Outbound ");
+ hv_dump_ring_info(&channel->inbound, "Inbound ");
}
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 013b7a5..abf0091 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -203,13 +203,13 @@ get_ring_bufferindices(struct hv_ring_buffer_info *ring_info)
/*++

Name:
- dump_ring_info()
+ hv_dump_ring_info()

Description:
Dump out to console the ring buffer info

--*/
-void dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix)
+void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix)
{
u32 bytes_avail_towrite;
u32 bytes_avail_toread;
diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h
index 6454105..61470a3 100644
--- a/drivers/staging/hv/ring_buffer.h
+++ b/drivers/staging/hv/ring_buffer.h
@@ -95,7 +95,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *ring_info,

u32 hv_get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *ring_info);

-void dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix);
+void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix);

void ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
struct hv_ring_buffer_debug_info *debug_info);
--
1.7.4.1

2011-05-09 21:52:04

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 102/206] Staging: hv: Rename ringbuffer_get_debuginfo

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/channel.c | 4 ++--
drivers/staging/hv/ring_buffer.c | 4 ++--
drivers/staging/hv/ring_buffer.h | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index be4e004..5fcf9d3 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -162,8 +162,8 @@ void vmbus_get_debug_info(struct vmbus_channel *channel,
monitorpage->parameter[monitor_group]
[monitor_offset].connectionid.u.id;

- ringbuffer_get_debuginfo(&channel->inbound, &debuginfo->inbound);
- ringbuffer_get_debuginfo(&channel->outbound, &debuginfo->outbound);
+ hv_ringbuffer_get_debuginfo(&channel->inbound, &debuginfo->inbound);
+ hv_ringbuffer_get_debuginfo(&channel->outbound, &debuginfo->outbound);
}

/*
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index abf0091..7fbadb1 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -253,13 +253,13 @@ copyfrom_ringbuffer(
/*++

Name:
- ringbuffer_get_debuginfo()
+ hv_ringbuffer_get_debuginfo()

Description:
Get various debug metrics for the specified ring buffer

--*/
-void ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
+void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
struct hv_ring_buffer_debug_info *debug_info)
{
u32 bytes_avail_towrite;
diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h
index 61470a3..1bc0b8a 100644
--- a/drivers/staging/hv/ring_buffer.h
+++ b/drivers/staging/hv/ring_buffer.h
@@ -97,7 +97,7 @@ u32 hv_get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *ring_info);

void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix);

-void ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
+void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
struct hv_ring_buffer_debug_info *debug_info);

#endif /* _RING_BUFFER_H_ */
--
1.7.4.1

2011-05-09 21:52:01

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 103/206] Staging: hv: Rename all static functions in ring_buffer.c

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/ring_buffer.c | 88 +++++++++++++++++++-------------------
1 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 7fbadb1..f4707f8 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -38,7 +38,7 @@
/*++

Name:
- get_ringbuffer_availbytes()
+ hv_get_ringbuffer_availbytes()

Description:
Get number of bytes available to read and to write to
@@ -46,7 +46,7 @@ Description:

--*/
static inline void
-get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
+hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
u32 *read, u32 *write)
{
u32 read_loc, write_loc;
@@ -62,14 +62,14 @@ get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
/*++

Name:
- get_next_write_location()
+ hv_get_next_write_location()

Description:
Get the next write location for the specified ring buffer

--*/
static inline u32
-get_next_write_location(struct hv_ring_buffer_info *ring_info)
+hv_get_next_write_location(struct hv_ring_buffer_info *ring_info)
{
u32 next = ring_info->ring_buffer->write_index;

@@ -81,14 +81,14 @@ get_next_write_location(struct hv_ring_buffer_info *ring_info)
/*++

Name:
- set_next_write_location()
+ hv_set_next_write_location()

Description:
Set the next write location for the specified ring buffer

--*/
static inline void
-set_next_write_location(struct hv_ring_buffer_info *ring_info,
+hv_set_next_write_location(struct hv_ring_buffer_info *ring_info,
u32 next_write_location)
{
ring_info->ring_buffer->write_index = next_write_location;
@@ -97,14 +97,14 @@ set_next_write_location(struct hv_ring_buffer_info *ring_info,
/*++

Name:
- get_next_read_location()
+ hv_get_next_read_location()

Description:
Get the next read location for the specified ring buffer

--*/
static inline u32
-get_next_read_location(struct hv_ring_buffer_info *ring_info)
+hv_get_next_read_location(struct hv_ring_buffer_info *ring_info)
{
u32 next = ring_info->ring_buffer->read_index;

@@ -116,7 +116,7 @@ get_next_read_location(struct hv_ring_buffer_info *ring_info)
/*++

Name:
- get_next_readlocation_withoffset()
+ hv_get_next_readlocation_withoffset()

Description:
Get the next read location + offset for the specified ring buffer.
@@ -124,7 +124,7 @@ Description:

--*/
static inline u32
-get_next_readlocation_withoffset(struct hv_ring_buffer_info *ring_info,
+hv_get_next_readlocation_withoffset(struct hv_ring_buffer_info *ring_info,
u32 offset)
{
u32 next = ring_info->ring_buffer->read_index;
@@ -139,14 +139,14 @@ get_next_readlocation_withoffset(struct hv_ring_buffer_info *ring_info,
/*++

Name:
- set_next_read_location()
+ hv_set_next_read_location()

Description:
Set the next read location for the specified ring buffer

--*/
static inline void
-set_next_read_location(struct hv_ring_buffer_info *ring_info,
+hv_set_next_read_location(struct hv_ring_buffer_info *ring_info,
u32 next_read_location)
{
ring_info->ring_buffer->read_index = next_read_location;
@@ -156,14 +156,14 @@ set_next_read_location(struct hv_ring_buffer_info *ring_info,
/*++

Name:
- get_ring_buffer()
+ hv_get_ring_buffer()

Description:
Get the start of the ring buffer

--*/
static inline void *
-get_ring_buffer(struct hv_ring_buffer_info *ring_info)
+hv_get_ring_buffer(struct hv_ring_buffer_info *ring_info)
{
return (void *)ring_info->ring_buffer->buffer;
}
@@ -172,14 +172,14 @@ get_ring_buffer(struct hv_ring_buffer_info *ring_info)
/*++

Name:
- get_ring_buffersize()
+ hv_get_ring_buffersize()

Description:
Get the size of the ring buffer

--*/
static inline u32
-get_ring_buffersize(struct hv_ring_buffer_info *ring_info)
+hv_get_ring_buffersize(struct hv_ring_buffer_info *ring_info)
{
return ring_info->ring_datasize;
}
@@ -187,14 +187,14 @@ get_ring_buffersize(struct hv_ring_buffer_info *ring_info)
/*++

Name:
- get_ring_bufferindices()
+ hv_get_ring_bufferindices()

Description:
Get the read and write indices as u64 of the specified ring buffer

--*/
static inline u64
-get_ring_bufferindices(struct hv_ring_buffer_info *ring_info)
+hv_get_ring_bufferindices(struct hv_ring_buffer_info *ring_info)
{
return (u64)ring_info->ring_buffer->write_index << 32;
}
@@ -214,7 +214,7 @@ void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix)
u32 bytes_avail_towrite;
u32 bytes_avail_toread;

- get_ringbuffer_availbytes(ring_info,
+ hv_get_ringbuffer_availbytes(ring_info,
&bytes_avail_toread,
&bytes_avail_towrite);

@@ -235,14 +235,14 @@ void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix)
/* Internal routines */

static u32
-copyto_ringbuffer(
+hv_copyto_ringbuffer(
struct hv_ring_buffer_info *ring_info,
u32 start_write_offset,
void *src,
u32 srclen);

static u32
-copyfrom_ringbuffer(
+hv_copyfrom_ringbuffer(
struct hv_ring_buffer_info *ring_info,
void *dest,
u32 destlen,
@@ -266,7 +266,7 @@ void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
u32 bytes_avail_toread;

if (ring_info->ring_buffer) {
- get_ringbuffer_availbytes(ring_info,
+ hv_get_ringbuffer_availbytes(ring_info,
&bytes_avail_toread,
&bytes_avail_towrite);

@@ -369,7 +369,7 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,

spin_lock_irqsave(&outring_info->ring_lock, flags);

- get_ringbuffer_availbytes(outring_info,
+ hv_get_ringbuffer_availbytes(outring_info,
&bytes_avail_toread,
&bytes_avail_towrite);

@@ -384,20 +384,20 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
}

/* Write to the ring buffer */
- next_write_location = get_next_write_location(outring_info);
+ next_write_location = hv_get_next_write_location(outring_info);

for_each_sg(sglist, sg, sgcount, i)
{
- next_write_location = copyto_ringbuffer(outring_info,
+ next_write_location = hv_copyto_ringbuffer(outring_info,
next_write_location,
sg_virt(sg),
sg->length);
}

/* Set previous packet start */
- prev_indices = get_ring_bufferindices(outring_info);
+ prev_indices = hv_get_ring_bufferindices(outring_info);

- next_write_location = copyto_ringbuffer(outring_info,
+ next_write_location = hv_copyto_ringbuffer(outring_info,
next_write_location,
&prev_indices,
sizeof(u64));
@@ -406,7 +406,7 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
mb();

/* Now, update the write location */
- set_next_write_location(outring_info, next_write_location);
+ hv_set_next_write_location(outring_info, next_write_location);

/* Dumpring_info(Outring_info, "AFTER "); */

@@ -434,7 +434,7 @@ int hv_ringbuffer_peek(struct hv_ring_buffer_info *Inring_info,

spin_lock_irqsave(&Inring_info->ring_lock, flags);

- get_ringbuffer_availbytes(Inring_info,
+ hv_get_ringbuffer_availbytes(Inring_info,
&bytes_avail_toread,
&bytes_avail_towrite);

@@ -452,9 +452,9 @@ int hv_ringbuffer_peek(struct hv_ring_buffer_info *Inring_info,
}

/* Convert to byte offset */
- next_read_location = get_next_read_location(Inring_info);
+ next_read_location = hv_get_next_read_location(Inring_info);

- next_read_location = copyfrom_ringbuffer(Inring_info,
+ next_read_location = hv_copyfrom_ringbuffer(Inring_info,
Buffer,
buflen,
next_read_location);
@@ -488,7 +488,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,

spin_lock_irqsave(&inring_info->ring_lock, flags);

- get_ringbuffer_availbytes(inring_info,
+ hv_get_ringbuffer_availbytes(inring_info,
&bytes_avail_toread,
&bytes_avail_towrite);

@@ -502,14 +502,14 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
}

next_read_location =
- get_next_readlocation_withoffset(inring_info, offset);
+ hv_get_next_readlocation_withoffset(inring_info, offset);

- next_read_location = copyfrom_ringbuffer(inring_info,
+ next_read_location = hv_copyfrom_ringbuffer(inring_info,
buffer,
buflen,
next_read_location);

- next_read_location = copyfrom_ringbuffer(inring_info,
+ next_read_location = hv_copyfrom_ringbuffer(inring_info,
&prev_indices,
sizeof(u64),
next_read_location);
@@ -520,7 +520,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
mb();

/* Update the read index */
- set_next_read_location(inring_info, next_read_location);
+ hv_set_next_read_location(inring_info, next_read_location);

/* Dumpring_info(Inring_info, "AFTER "); */

@@ -533,7 +533,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
/*++

Name:
- copyto_ringbuffer()
+ hv_copyto_ringbuffer()

Description:
Helper routine to copy from source to ring buffer.
@@ -541,14 +541,14 @@ Description:

--*/
static u32
-copyto_ringbuffer(
+hv_copyto_ringbuffer(
struct hv_ring_buffer_info *ring_info,
u32 start_write_offset,
void *src,
u32 srclen)
{
- void *ring_buffer = get_ring_buffer(ring_info);
- u32 ring_buffer_size = get_ring_buffersize(ring_info);
+ void *ring_buffer = hv_get_ring_buffer(ring_info);
+ u32 ring_buffer_size = hv_get_ring_buffersize(ring_info);
u32 frag_len;

/* wrap-around detected! */
@@ -569,7 +569,7 @@ copyto_ringbuffer(
/*++

Name:
- copyfrom_ringbuffer()
+ hv_copyfrom_ringbuffer()

Description:
Helper routine to copy to source from ring buffer.
@@ -577,14 +577,14 @@ Description:

--*/
static u32
-copyfrom_ringbuffer(
+hv_copyfrom_ringbuffer(
struct hv_ring_buffer_info *ring_info,
void *dest,
u32 destlen,
u32 start_read_offset)
{
- void *ring_buffer = get_ring_buffer(ring_info);
- u32 ring_buffer_size = get_ring_buffersize(ring_info);
+ void *ring_buffer = hv_get_ring_buffer(ring_info);
+ u32 ring_buffer_size = hv_get_ring_buffersize(ring_info);

u32 frag_len;

--
1.7.4.1

2011-05-09 21:51:39

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 104/206] Staging: hv: Cleanup comments in ring_buffer.c

Cleanup comments in ring_buffer.c

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/ring_buffer.c | 323 +++++++++++++++-----------------------
1 files changed, 129 insertions(+), 194 deletions(-)

diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index f4707f8..8544516 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -18,6 +18,7 @@
* Authors:
* Haiyang Zhang <[email protected]>
* Hank Janssen <[email protected]>
+ * K. Y. Srinivasan <[email protected]>
*
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -35,16 +36,13 @@
#define BYTES_AVAIL_TO_WRITE(r, w, z) ((w) >= (r)) ? ((z) - ((w) - (r))) : ((r) - (w))


-/*++
-
-Name:
- hv_get_ringbuffer_availbytes()
-
-Description:
- Get number of bytes available to read and to write to
- for the specified ring buffer
-
---*/
+/*
+ *
+ * hv_get_ringbuffer_availbytes()
+ *
+ * Get number of bytes available to read and to write to
+ * for the specified ring buffer
+ */
static inline void
hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
u32 *read, u32 *write)
@@ -59,34 +57,26 @@ hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
*read = rbi->ring_datasize - *write;
}

-/*++
-
-Name:
- hv_get_next_write_location()
-
-Description:
- Get the next write location for the specified ring buffer
-
---*/
+/*
+ * hv_get_next_write_location()
+ *
+ * Get the next write location for the specified ring buffer
+ *
+ */
static inline u32
hv_get_next_write_location(struct hv_ring_buffer_info *ring_info)
{
u32 next = ring_info->ring_buffer->write_index;

- /* ASSERT(next < ring_info->RingDataSize); */
-
return next;
}

-/*++
-
-Name:
- hv_set_next_write_location()
-
-Description:
- Set the next write location for the specified ring buffer
-
---*/
+/*
+ * hv_set_next_write_location()
+ *
+ * Set the next write location for the specified ring buffer
+ *
+ */
static inline void
hv_set_next_write_location(struct hv_ring_buffer_info *ring_info,
u32 next_write_location)
@@ -94,57 +84,44 @@ hv_set_next_write_location(struct hv_ring_buffer_info *ring_info,
ring_info->ring_buffer->write_index = next_write_location;
}

-/*++
-
-Name:
- hv_get_next_read_location()
-
-Description:
- Get the next read location for the specified ring buffer
-
---*/
+/*
+ * hv_get_next_read_location()
+ *
+ * Get the next read location for the specified ring buffer
+ */
static inline u32
hv_get_next_read_location(struct hv_ring_buffer_info *ring_info)
{
u32 next = ring_info->ring_buffer->read_index;

- /* ASSERT(next < ring_info->RingDataSize); */
-
return next;
}

-/*++
-
-Name:
- hv_get_next_readlocation_withoffset()
-
-Description:
- Get the next read location + offset for the specified ring buffer.
- This allows the caller to skip
-
---*/
+/*
+ * hv_get_next_readlocation_withoffset()
+ *
+ * Get the next read location + offset for the specified ring buffer.
+ * This allows the caller to skip
+ */
static inline u32
hv_get_next_readlocation_withoffset(struct hv_ring_buffer_info *ring_info,
u32 offset)
{
u32 next = ring_info->ring_buffer->read_index;

- /* ASSERT(next < ring_info->RingDataSize); */
next += offset;
next %= ring_info->ring_datasize;

return next;
}

-/*++
-
-Name:
- hv_set_next_read_location()
-
-Description:
- Set the next read location for the specified ring buffer
-
---*/
+/*
+ *
+ * hv_set_next_read_location()
+ *
+ * Set the next read location for the specified ring buffer
+ *
+ */
static inline void
hv_set_next_read_location(struct hv_ring_buffer_info *ring_info,
u32 next_read_location)
@@ -153,15 +130,12 @@ hv_set_next_read_location(struct hv_ring_buffer_info *ring_info,
}


-/*++
-
-Name:
- hv_get_ring_buffer()
-
-Description:
- Get the start of the ring buffer
-
---*/
+/*
+ *
+ * hv_get_ring_buffer()
+ *
+ * Get the start of the ring buffer
+ */
static inline void *
hv_get_ring_buffer(struct hv_ring_buffer_info *ring_info)
{
@@ -169,30 +143,25 @@ hv_get_ring_buffer(struct hv_ring_buffer_info *ring_info)
}


-/*++
-
-Name:
- hv_get_ring_buffersize()
-
-Description:
- Get the size of the ring buffer
-
---*/
+/*
+ *
+ * hv_get_ring_buffersize()
+ *
+ * Get the size of the ring buffer
+ */
static inline u32
hv_get_ring_buffersize(struct hv_ring_buffer_info *ring_info)
{
return ring_info->ring_datasize;
}

-/*++
-
-Name:
- hv_get_ring_bufferindices()
-
-Description:
- Get the read and write indices as u64 of the specified ring buffer
-
---*/
+/*
+ *
+ * hv_get_ring_bufferindices()
+ *
+ * Get the read and write indices as u64 of the specified ring buffer
+ *
+ */
static inline u64
hv_get_ring_bufferindices(struct hv_ring_buffer_info *ring_info)
{
@@ -200,15 +169,13 @@ hv_get_ring_bufferindices(struct hv_ring_buffer_info *ring_info)
}


-/*++
-
-Name:
- hv_dump_ring_info()
-
-Description:
- Dump out to console the ring buffer info
-
---*/
+/*
+ *
+ * hv_dump_ring_info()
+ *
+ * Dump out to console the ring buffer info
+ *
+ */
void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix)
{
u32 bytes_avail_towrite;
@@ -232,7 +199,6 @@ void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix)
}


-/* Internal routines */

static u32
hv_copyto_ringbuffer(
@@ -250,15 +216,13 @@ hv_copyfrom_ringbuffer(



-/*++
-
-Name:
- hv_ringbuffer_get_debuginfo()
-
-Description:
- Get various debug metrics for the specified ring buffer
-
---*/
+/*
+ *
+ * hv_ringbuffer_get_debuginfo()
+ *
+ * Get various debug metrics for the specified ring buffer
+ *
+ */
void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
struct hv_ring_buffer_debug_info *debug_info)
{
@@ -282,29 +246,25 @@ void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
}


-/*++
-
-Name:
- hv_get_ringbuffer_interrupt_mask()
-
-Description:
- Get the interrupt mask for the specified ring buffer
-
---*/
+/*
+ *
+ * hv_get_ringbuffer_interrupt_mask()
+ *
+ * Get the interrupt mask for the specified ring buffer
+ *
+ */
u32 hv_get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *rbi)
{
return rbi->ring_buffer->interrupt_mask;
}

-/*++
-
-Name:
- hv_ringbuffer_init()
-
-Description:
- Initialize the ring buffer
-
---*/
+/*
+ *
+ * hv_ringbuffer_init()
+ *
+ *Initialize the ring buffer
+ *
+ */
int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
void *buffer, u32 buflen)
{
@@ -325,28 +285,24 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
return 0;
}

-/*++
-
-Name:
- hv_ringbuffer_cleanup()
-
-Description:
- Cleanup the ring buffer
-
---*/
+/*
+ *
+ * hv_ringbuffer_cleanup()
+ *
+ * Cleanup the ring buffer
+ *
+ */
void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info)
{
}

-/*++
-
-Name:
- hv_ringbuffer_write()
-
-Description:
- Write to the ring buffer
-
---*/
+/*
+ *
+ * hv_ringbuffer_write()
+ *
+ * Write to the ring buffer
+ *
+ */
int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
struct scatterlist *sglist, u32 sgcount)
{
@@ -373,7 +329,6 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
&bytes_avail_toread,
&bytes_avail_towrite);

- /* Dumpring_info(Outring_info, "BEFORE "); */

/* If there is only room for the packet, assume it is full. */
/* Otherwise, the next time around, we think the ring buffer */
@@ -408,22 +363,19 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
/* Now, update the write location */
hv_set_next_write_location(outring_info, next_write_location);

- /* Dumpring_info(Outring_info, "AFTER "); */

spin_unlock_irqrestore(&outring_info->ring_lock, flags);
return 0;
}


-/*++
-
-Name:
- hv_ringbuffer_peek()
-
-Description:
- Read without advancing the read index
-
---*/
+/*
+ *
+ * hv_ringbuffer_peek()
+ *
+ * Read without advancing the read index
+ *
+ */
int hv_ringbuffer_peek(struct hv_ring_buffer_info *Inring_info,
void *Buffer, u32 buflen)
{
@@ -440,11 +392,6 @@ int hv_ringbuffer_peek(struct hv_ring_buffer_info *Inring_info,

/* Make sure there is something to read */
if (bytes_avail_toread < buflen) {
- /* DPRINT_DBG(VMBUS,
- "got callback but not enough to read "
- "<avail to read %d read size %d>!!",
- bytes_avail_toread,
- BufferLen); */

spin_unlock_irqrestore(&Inring_info->ring_lock, flags);

@@ -465,15 +412,13 @@ int hv_ringbuffer_peek(struct hv_ring_buffer_info *Inring_info,
}


-/*++
-
-Name:
- hv_ringbuffer_read()
-
-Description:
- Read and advance the read index
-
---*/
+/*
+ *
+ * hv_ringbuffer_read()
+ *
+ * Read and advance the read index
+ *
+ */
int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
u32 buflen, u32 offset)
{
@@ -492,8 +437,6 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
&bytes_avail_toread,
&bytes_avail_towrite);

- /* Dumpring_info(Inring_info, "BEFORE "); */
-
/* Make sure there is something to read */
if (bytes_avail_toread < buflen) {
spin_unlock_irqrestore(&inring_info->ring_lock, flags);
@@ -522,24 +465,20 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
/* Update the read index */
hv_set_next_read_location(inring_info, next_read_location);

- /* Dumpring_info(Inring_info, "AFTER "); */
-
spin_unlock_irqrestore(&inring_info->ring_lock, flags);

return 0;
}


-/*++
-
-Name:
- hv_copyto_ringbuffer()
-
-Description:
- Helper routine to copy from source to ring buffer.
- Assume there is enough room. Handles wrap-around in dest case only!!
-
---*/
+/*
+ *
+ * hv_copyto_ringbuffer()
+ *
+ * Helper routine to copy from source to ring buffer.
+ * Assume there is enough room. Handles wrap-around in dest case only!!
+ *
+ */
static u32
hv_copyto_ringbuffer(
struct hv_ring_buffer_info *ring_info,
@@ -566,16 +505,14 @@ hv_copyto_ringbuffer(
}


-/*++
-
-Name:
- hv_copyfrom_ringbuffer()
-
-Description:
- Helper routine to copy to source from ring buffer.
- Assume there is enough room. Handles wrap-around in src case only!!
-
---*/
+/*
+ *
+ * hv_copyfrom_ringbuffer()
+ *
+ * Helper routine to copy to source from ring buffer.
+ * Assume there is enough room. Handles wrap-around in src case only!!
+ *
+ */
static u32
hv_copyfrom_ringbuffer(
struct hv_ring_buffer_info *ring_info,
@@ -605,5 +542,3 @@ hv_copyfrom_ringbuffer(
return start_read_offset;
}

-
-/* eof */
--
1.7.4.1

2011-05-09 21:44:59

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 105/206] Staging: hv: Get rid of the forward declaration of hv_copyfrom_ringbuffer

Get rid of the forward declaration by moving code around.


Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/ring_buffer.c | 83 +++++++++++++++++---------------------
1 files changed, 37 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 8544516..56521fd 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -199,6 +199,43 @@ void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix)
}


+/*
+ *
+ * hv_copyfrom_ringbuffer()
+ *
+ * Helper routine to copy to source from ring buffer.
+ * Assume there is enough room. Handles wrap-around in src case only!!
+ *
+ */
+static u32 hv_copyfrom_ringbuffer(
+ struct hv_ring_buffer_info *ring_info,
+ void *dest,
+ u32 destlen,
+ u32 start_read_offset)
+{
+ void *ring_buffer = hv_get_ring_buffer(ring_info);
+ u32 ring_buffer_size = hv_get_ring_buffersize(ring_info);
+
+ u32 frag_len;
+
+ /* wrap-around detected at the src */
+ if (destlen > ring_buffer_size - start_read_offset) {
+ frag_len = ring_buffer_size - start_read_offset;
+
+ memcpy(dest, ring_buffer + start_read_offset, frag_len);
+ memcpy(dest + frag_len, ring_buffer, destlen - frag_len);
+ } else
+
+ memcpy(dest, ring_buffer + start_read_offset, destlen);
+
+
+ start_read_offset += destlen;
+ start_read_offset %= ring_buffer_size;
+
+ return start_read_offset;
+}
+
+

static u32
hv_copyto_ringbuffer(
@@ -207,14 +244,6 @@ hv_copyto_ringbuffer(
void *src,
u32 srclen);

-static u32
-hv_copyfrom_ringbuffer(
- struct hv_ring_buffer_info *ring_info,
- void *dest,
- u32 destlen,
- u32 start_read_offset);
-
-

/*
*
@@ -504,41 +533,3 @@ hv_copyto_ringbuffer(
return start_write_offset;
}

-
-/*
- *
- * hv_copyfrom_ringbuffer()
- *
- * Helper routine to copy to source from ring buffer.
- * Assume there is enough room. Handles wrap-around in src case only!!
- *
- */
-static u32
-hv_copyfrom_ringbuffer(
- struct hv_ring_buffer_info *ring_info,
- void *dest,
- u32 destlen,
- u32 start_read_offset)
-{
- void *ring_buffer = hv_get_ring_buffer(ring_info);
- u32 ring_buffer_size = hv_get_ring_buffersize(ring_info);
-
- u32 frag_len;
-
- /* wrap-around detected at the src */
- if (destlen > ring_buffer_size - start_read_offset) {
- frag_len = ring_buffer_size - start_read_offset;
-
- memcpy(dest, ring_buffer + start_read_offset, frag_len);
- memcpy(dest + frag_len, ring_buffer, destlen - frag_len);
- } else
-
- memcpy(dest, ring_buffer + start_read_offset, destlen);
-
-
- start_read_offset += destlen;
- start_read_offset %= ring_buffer_size;
-
- return start_read_offset;
-}
-
--
1.7.4.1

2011-05-09 21:50:06

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 106/206] Staging: hv: Get rid of the forward declaration of hv_copyto_ringbuffer()

Get rid of the forward declaration by moving the code around.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/ring_buffer.c | 66 +++++++++++++++----------------------
1 files changed, 27 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 56521fd..2a461ddee 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -236,14 +236,37 @@ static u32 hv_copyfrom_ringbuffer(
}


-
-static u32
-hv_copyto_ringbuffer(
+/*
+ *
+ * hv_copyto_ringbuffer()
+ *
+ * Helper routine to copy from source to ring buffer.
+ * Assume there is enough room. Handles wrap-around in dest case only!!
+ *
+ */
+static u32 hv_copyto_ringbuffer(
struct hv_ring_buffer_info *ring_info,
u32 start_write_offset,
void *src,
- u32 srclen);
+ u32 srclen)
+{
+ void *ring_buffer = hv_get_ring_buffer(ring_info);
+ u32 ring_buffer_size = hv_get_ring_buffersize(ring_info);
+ u32 frag_len;
+
+ /* wrap-around detected! */
+ if (srclen > ring_buffer_size - start_write_offset) {
+ frag_len = ring_buffer_size - start_write_offset;
+ memcpy(ring_buffer + start_write_offset, src, frag_len);
+ memcpy(ring_buffer, src + frag_len, srclen - frag_len);
+ } else
+ memcpy(ring_buffer + start_write_offset, src, srclen);

+ start_write_offset += srclen;
+ start_write_offset %= ring_buffer_size;
+
+ return start_write_offset;
+}

/*
*
@@ -498,38 +521,3 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,

return 0;
}
-
-
-/*
- *
- * hv_copyto_ringbuffer()
- *
- * Helper routine to copy from source to ring buffer.
- * Assume there is enough room. Handles wrap-around in dest case only!!
- *
- */
-static u32
-hv_copyto_ringbuffer(
- struct hv_ring_buffer_info *ring_info,
- u32 start_write_offset,
- void *src,
- u32 srclen)
-{
- void *ring_buffer = hv_get_ring_buffer(ring_info);
- u32 ring_buffer_size = hv_get_ring_buffersize(ring_info);
- u32 frag_len;
-
- /* wrap-around detected! */
- if (srclen > ring_buffer_size - start_write_offset) {
- frag_len = ring_buffer_size - start_write_offset;
- memcpy(ring_buffer + start_write_offset, src, frag_len);
- memcpy(ring_buffer, src + frag_len, srclen - frag_len);
- } else
- memcpy(ring_buffer + start_write_offset, src, srclen);
-
- start_write_offset += srclen;
- start_write_offset %= ring_buffer_size;
-
- return start_write_offset;
-}
-
--
1.7.4.1

2011-05-09 21:48:37

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 107/206] Staging: hv: Get rid of the volatile qualifier for a variable in ring_buffer.c

Access to this variable is already serialized via a spin lock. Get
rid of the unnecessary volatile qualifier.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/ring_buffer.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 2a461ddee..badf52a 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -364,7 +364,7 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
u32 totalbytes_towrite = 0;

struct scatterlist *sg;
- volatile u32 next_write_location;
+ u32 next_write_location;
u64 prev_indices = 0;
unsigned long flags;

--
1.7.4.1

2011-05-09 21:48:33

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 108/206] Staging: hv: Cleanup ring_buffer.h

Access to these variables is already serialized via a spin lock. Get
rid of the unnecessary volatile qualifier.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/ring_buffer.h | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h
index 1bc0b8a..089c536 100644
--- a/drivers/staging/hv/ring_buffer.h
+++ b/drivers/staging/hv/ring_buffer.h
@@ -30,12 +30,12 @@

struct hv_ring_buffer {
/* Offset in bytes from the start of ring data below */
- volatile u32 write_index;
+ u32 write_index;

/* Offset in bytes from the start of ring data below */
- volatile u32 read_index;
+ u32 read_index;

- volatile u32 interrupt_mask;
+ u32 interrupt_mask;

/* Pad it to PAGE_SIZE so that data starts on page boundary */
u8 reserved[4084];
@@ -45,7 +45,6 @@ struct hv_ring_buffer {
* vmbus connection also uses this data structure and its data starts
* here, we commented out this field.
*/
- /* volatile u32 InterruptMask; */

/*
* Ring data starts here + RingDataStartOffset
--
1.7.4.1

2011-05-09 21:50:12

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 109/206] Staging: hv: Rename the variable gSupportedDeviceClasses

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/channel_mgmt.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c
index 1929ab3..71b79c6 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -42,7 +42,7 @@ struct vmbus_channel_message_table_entry {
#define MAX_NUM_DEVICE_CLASSES_SUPPORTED 8

static const struct hv_guid
- gSupportedDeviceClasses[MAX_NUM_DEVICE_CLASSES_SUPPORTED] = {
+ supported_device_classes[MAX_NUM_DEVICE_CLASSES_SUPPORTED] = {
/* {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} */
/* Storage - SCSI */
{
@@ -459,7 +459,8 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr)
offer = (struct vmbus_channel_offer_channel *)hdr;
for (i = 0; i < MAX_NUM_DEVICE_CLASSES_SUPPORTED; i++) {
if (memcmp(&offer->offer.if_type,
- &gSupportedDeviceClasses[i], sizeof(struct hv_guid)) == 0) {
+ &supported_device_classes[i],
+ sizeof(struct hv_guid)) == 0) {
fsupported = 1;
break;
}
--
1.7.4.1

2011-05-09 21:50:10

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 110/206] Staging: hv: Rename the variable messageHandler

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/channel_mgmt.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c
index 71b79c6..bc6e235 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -35,7 +35,7 @@

struct vmbus_channel_message_table_entry {
enum vmbus_channel_message_type messageType;
- void (*messageHandler)(struct vmbus_channel_message_header *msg);
+ void (*message_handler)(struct vmbus_channel_message_header *msg);
};

#define MAX_MSG_TYPES 4
@@ -740,8 +740,8 @@ void vmbus_onmessage(void *context)
return;
}

- if (gChannelMessageTable[hdr->msgtype].messageHandler)
- gChannelMessageTable[hdr->msgtype].messageHandler(hdr);
+ if (gChannelMessageTable[hdr->msgtype].message_handler)
+ gChannelMessageTable[hdr->msgtype].message_handler(hdr);
else
pr_err("Unhandled channel message type %d\n", hdr->msgtype);
}
--
1.7.4.1

2011-05-09 21:50:01

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 111/206] Staging: hv: Rename the variable messageType

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/channel_mgmt.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c
index bc6e235..a8be565 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -34,7 +34,7 @@
#include "utils.h"

struct vmbus_channel_message_table_entry {
- enum vmbus_channel_message_type messageType;
+ enum vmbus_channel_message_type message_type;
void (*message_handler)(struct vmbus_channel_message_header *msg);
};

--
1.7.4.1

2011-05-09 21:50:04

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 112/206] Staging: hv: Rename the variable gChannelMessageTable

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/channel_mgmt.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c
index a8be565..95eef92 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -698,7 +698,7 @@ static void vmbus_onversion_response(

/* Channel message dispatch table */
static struct vmbus_channel_message_table_entry
- gChannelMessageTable[CHANNELMSG_COUNT] = {
+ channel_message_table[CHANNELMSG_COUNT] = {
{CHANNELMSG_INVALID, NULL},
{CHANNELMSG_OFFERCHANNEL, vmbus_onoffer},
{CHANNELMSG_RESCIND_CHANNELOFFER, vmbus_onoffer_rescind},
@@ -740,8 +740,8 @@ void vmbus_onmessage(void *context)
return;
}

- if (gChannelMessageTable[hdr->msgtype].message_handler)
- gChannelMessageTable[hdr->msgtype].message_handler(hdr);
+ if (channel_message_table[hdr->msgtype].message_handler)
+ channel_message_table[hdr->msgtype].message_handler(hdr);
else
pr_err("Unhandled channel message type %d\n", hdr->msgtype);
}
--
1.7.4.1

2011-05-09 21:47:57

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 113/206] Staging: hv: Use completion abstraction to synchronize in vmbus_channel_msginfo

Use completion abstraction to synchronize in vmbus_channel_msginfo.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/channel.c | 31 ++++++++++++-------------------
drivers/staging/hv/channel_mgmt.c | 31 ++++++++++++++-----------------
drivers/staging/hv/channel_mgmt.h | 4 ++--
drivers/staging/hv/connection.c | 9 ++++-----
4 files changed, 32 insertions(+), 43 deletions(-)

diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 5fcf9d3..1b50cb7 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -177,7 +177,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
struct vmbus_channel_msginfo *openInfo = NULL;
void *in, *out;
unsigned long flags;
- int ret, err = 0;
+ int ret, t, err = 0;

/* Aligned to page size */
/* ASSERT(!(SendRingBufferSize & (PAGE_SIZE - 1))); */
@@ -240,7 +240,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
goto errorout;
}

- init_waitqueue_head(&openInfo->waitevent);
+ init_completion(&openInfo->waitevent);

openMsg = (struct vmbus_channel_open_channel *)openInfo->msg;
openMsg->header.msgtype = CHANNELMSG_OPENCHANNEL;
@@ -270,11 +270,8 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
if (ret != 0)
goto Cleanup;

- openInfo->wait_condition = 0;
- wait_event_timeout(openInfo->waitevent,
- openInfo->wait_condition,
- msecs_to_jiffies(1000));
- if (openInfo->wait_condition == 0) {
+ t = wait_for_completion_timeout(&openInfo->waitevent, HZ);
+ if (t == 0) {
err = -ETIMEDOUT;
goto errorout;
}
@@ -495,6 +492,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
u32 next_gpadl_handle;
unsigned long flags;
int ret = 0;
+ int t;

next_gpadl_handle = atomic_read(&vmbus_connection.next_gpadl_handle);
atomic_inc(&vmbus_connection.next_gpadl_handle);
@@ -503,7 +501,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
if (ret)
return ret;

- init_waitqueue_head(&msginfo->waitevent);
+ init_completion(&msginfo->waitevent);

gpadlmsg = (struct vmbus_channel_gpadl_header *)msginfo->msg;
gpadlmsg->header.msgtype = CHANNELMSG_GPADL_HEADER;
@@ -518,7 +516,6 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,

spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);

- msginfo->wait_condition = 0;
ret = vmbus_post_msg(gpadlmsg, msginfo->msgsize -
sizeof(*msginfo));
if (ret != 0)
@@ -546,10 +543,8 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,

}
}
- wait_event_timeout(msginfo->waitevent,
- msginfo->wait_condition,
- msecs_to_jiffies(1000));
- BUG_ON(msginfo->wait_condition == 0);
+ t = wait_for_completion_timeout(&msginfo->waitevent, HZ);
+ BUG_ON(t == 0);


/* At this point, we received the gpadl created msg */
@@ -573,7 +568,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
struct vmbus_channel_gpadl_teardown *msg;
struct vmbus_channel_msginfo *info;
unsigned long flags;
- int ret;
+ int ret, t;

/* ASSERT(gpadl_handle != 0); */

@@ -582,7 +577,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
if (!info)
return -ENOMEM;

- init_waitqueue_head(&info->waitevent);
+ init_completion(&info->waitevent);

msg = (struct vmbus_channel_gpadl_teardown *)info->msg;

@@ -594,14 +589,12 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
list_add_tail(&info->msglistentry,
&vmbus_connection.chn_msg_list);
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
- info->wait_condition = 0;
ret = vmbus_post_msg(msg,
sizeof(struct vmbus_channel_gpadl_teardown));

BUG_ON(ret != 0);
- wait_event_timeout(info->waitevent,
- info->wait_condition, msecs_to_jiffies(1000));
- BUG_ON(info->wait_condition == 0);
+ t = wait_for_completion_timeout(&info->waitevent, HZ);
+ BUG_ON(t == 0);

/* Received a torndown response */
spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c
index 95eef92..33cb5d5 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -556,9 +556,9 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr)
openmsg->openid == result->openid) {
memcpy(&msginfo->response.open_result,
result,
- sizeof(struct vmbus_channel_open_result));
- msginfo->wait_condition = 1;
- wake_up(&msginfo->waitevent);
+ sizeof(
+ struct vmbus_channel_open_result));
+ complete(&msginfo->waitevent);
break;
}
}
@@ -603,9 +603,9 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr)
(gpadlcreated->gpadl == gpadlheader->gpadl)) {
memcpy(&msginfo->response.gpadl_created,
gpadlcreated,
- sizeof(struct vmbus_channel_gpadl_created));
- msginfo->wait_condition = 1;
- wake_up(&msginfo->waitevent);
+ sizeof(
+ struct vmbus_channel_gpadl_created));
+ complete(&msginfo->waitevent);
break;
}
}
@@ -648,9 +648,9 @@ static void vmbus_ongpadl_torndown(
if (gpadl_torndown->gpadl == gpadl_teardown->gpadl) {
memcpy(&msginfo->response.gpadl_torndown,
gpadl_torndown,
- sizeof(struct vmbus_channel_gpadl_torndown));
- msginfo->wait_condition = 1;
- wake_up(&msginfo->waitevent);
+ sizeof(
+ struct vmbus_channel_gpadl_torndown));
+ complete(&msginfo->waitevent);
break;
}
}
@@ -689,8 +689,7 @@ static void vmbus_onversion_response(
memcpy(&msginfo->response.version_response,
version_response,
sizeof(struct vmbus_channel_version_response));
- msginfo->wait_condition = 1;
- wake_up(&msginfo->waitevent);
+ complete(&msginfo->waitevent);
}
}
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
@@ -753,7 +752,7 @@ int vmbus_request_offers(void)
{
struct vmbus_channel_message_header *msg;
struct vmbus_channel_msginfo *msginfo;
- int ret;
+ int ret, t;

msginfo = kmalloc(sizeof(*msginfo) +
sizeof(struct vmbus_channel_message_header),
@@ -761,7 +760,7 @@ int vmbus_request_offers(void)
if (!msginfo)
return -ENOMEM;

- init_waitqueue_head(&msginfo->waitevent);
+ init_completion(&msginfo->waitevent);

msg = (struct vmbus_channel_message_header *)msginfo->msg;

@@ -776,10 +775,8 @@ int vmbus_request_offers(void)
goto cleanup;
}

- msginfo->wait_condition = 0;
- wait_event_timeout(msginfo->waitevent, msginfo->wait_condition,
- msecs_to_jiffies(1000));
- if (msginfo->wait_condition == 0) {
+ t = wait_for_completion_timeout(&msginfo->waitevent, HZ);
+ if (t == 0) {
ret = -ETIMEDOUT;
goto cleanup;
}
diff --git a/drivers/staging/hv/channel_mgmt.h b/drivers/staging/hv/channel_mgmt.h
index 3b2c393..f895d0a 100644
--- a/drivers/staging/hv/channel_mgmt.h
+++ b/drivers/staging/hv/channel_mgmt.h
@@ -28,6 +28,7 @@
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/workqueue.h>
+#include <linux/completion.h>
#include "ring_buffer.h"
#include "vmbus_channel_interface.h"
#include "vmbus_packet_format.h"
@@ -290,8 +291,7 @@ struct vmbus_channel_msginfo {
struct list_head submsglist;

/* Synchronize the request/response if needed */
- int wait_condition;
- wait_queue_head_t waitevent;
+ struct completion waitevent;
union {
struct vmbus_channel_version_supported version_supported;
struct vmbus_channel_open_result open_result;
diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c
index 4f411a9..92add38 100644
--- a/drivers/staging/hv/connection.c
+++ b/drivers/staging/hv/connection.c
@@ -44,6 +44,7 @@ struct vmbus_connection vmbus_connection = {
int vmbus_connect(void)
{
int ret = 0;
+ int t;
struct vmbus_channel_msginfo *msginfo = NULL;
struct vmbus_channel_initiate_contact *msg;
unsigned long flags;
@@ -101,7 +102,7 @@ int vmbus_connect(void)
goto Cleanup;
}

- init_waitqueue_head(&msginfo->waitevent);
+ init_completion(&msginfo->waitevent);

msg = (struct vmbus_channel_initiate_contact *)msginfo->msg;

@@ -134,10 +135,8 @@ int vmbus_connect(void)
}

/* Wait for the connection response */
- msginfo->wait_condition = 0;
- wait_event_timeout(msginfo->waitevent, msginfo->wait_condition,
- msecs_to_jiffies(1000));
- if (msginfo->wait_condition == 0) {
+ t = wait_for_completion_timeout(&msginfo->waitevent, HZ);
+ if (t == 0) {
spin_lock_irqsave(&vmbus_connection.channelmsg_lock,
flags);
list_del(&msginfo->msglistentry);
--
1.7.4.1

2011-05-09 21:47:29

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 114/206] Staging: hv: Get rid of some unnecessary state from struct vmbus_msginfo

This state is not used anywhere; get rid of it.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/vmbus_private.h | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/vmbus_private.h b/drivers/staging/hv/vmbus_private.h
index 6f0d8df..bea331e 100644
--- a/drivers/staging/hv/vmbus_private.h
+++ b/drivers/staging/hv/vmbus_private.h
@@ -91,10 +91,6 @@ struct vmbus_msginfo {
/* Bookkeeping stuff */
struct list_head msglist_entry;

- /* Synchronize the request/response if needed */
- int wait_condition;
- wait_queue_head_t wait_event;
-
/* The message itself */
unsigned char msg[0];
};
--
1.7.4.1

2011-05-09 21:49:49

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 115/206] Staging: hv: Use completion abstraction in struct netvsc_device

Use completion abstraction in struct netvsc_device instead of
struct wait_queue_head_t to synchronize.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/netvsc.c | 32 +++++++++++++-------------------
drivers/staging/hv/netvsc.h | 3 +--
2 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c
index 832f62e..4eb4482 100644
--- a/drivers/staging/hv/netvsc.c
+++ b/drivers/staging/hv/netvsc.c
@@ -213,6 +213,7 @@ static int netvsc_destroy_recv_buf(struct netvsc_device *net_device)
static int netvsc_init_recv_buf(struct hv_device *device)
{
int ret = 0;
+ int t;
struct netvsc_device *net_device;
struct nvsp_message *init_packet;

@@ -260,7 +261,6 @@ static int netvsc_init_recv_buf(struct hv_device *device)
send_recv_buf.id = NETVSC_RECEIVE_BUFFER_ID;

/* Send the gpadl notification request */
- net_device->wait_condition = 0;
ret = vmbus_sendpacket(device->channel, init_packet,
sizeof(struct nvsp_message),
(unsigned long)init_packet,
@@ -272,10 +272,8 @@ static int netvsc_init_recv_buf(struct hv_device *device)
goto cleanup;
}

- wait_event_timeout(net_device->channel_init_wait,
- net_device->wait_condition,
- msecs_to_jiffies(1000));
- BUG_ON(net_device->wait_condition == 0);
+ t = wait_for_completion_timeout(&net_device->channel_init_wait, HZ);
+ BUG_ON(t == 0);


/* Check the response */
@@ -394,6 +392,7 @@ static int netvsc_destroy_send_buf(struct netvsc_device *net_device)
static int netvsc_init_send_buf(struct hv_device *device)
{
int ret = 0;
+ int t;
struct netvsc_device *net_device;
struct nvsp_message *init_packet;

@@ -443,7 +442,6 @@ static int netvsc_init_send_buf(struct hv_device *device)
NETVSC_SEND_BUFFER_ID;

/* Send the gpadl notification request */
- net_device->wait_condition = 0;
ret = vmbus_sendpacket(device->channel, init_packet,
sizeof(struct nvsp_message),
(unsigned long)init_packet,
@@ -455,10 +453,9 @@ static int netvsc_init_send_buf(struct hv_device *device)
goto cleanup;
}

- wait_event_timeout(net_device->channel_init_wait,
- net_device->wait_condition,
- msecs_to_jiffies(1000));
- BUG_ON(net_device->wait_condition == 0);
+ t = wait_for_completion_timeout(&net_device->channel_init_wait, HZ);
+
+ BUG_ON(t == 0);

/* Check the response */
if (init_packet->msg.v1_msg.
@@ -487,7 +484,7 @@ exit:

static int netvsc_connect_vsp(struct hv_device *device)
{
- int ret;
+ int ret, t;
struct netvsc_device *net_device;
struct nvsp_message *init_packet;
int ndis_version;
@@ -509,7 +506,6 @@ static int netvsc_connect_vsp(struct hv_device *device)
NVSP_MAX_PROTOCOL_VERSION;

/* Send the init request */
- net_device->wait_condition = 0;
ret = vmbus_sendpacket(device->channel, init_packet,
sizeof(struct nvsp_message),
(unsigned long)init_packet,
@@ -519,10 +515,9 @@ static int netvsc_connect_vsp(struct hv_device *device)
if (ret != 0)
goto cleanup;

- wait_event_timeout(net_device->channel_init_wait,
- net_device->wait_condition,
- msecs_to_jiffies(1000));
- if (net_device->wait_condition == 0) {
+ t = wait_for_completion_timeout(&net_device->channel_init_wait, HZ);
+
+ if (t == 0) {
ret = -ETIMEDOUT;
goto cleanup;
}
@@ -647,8 +642,7 @@ static void netvsc_send_completion(struct hv_device *device,
/* Copy the response back */
memcpy(&net_device->channel_init_pkt, nvsp_packet,
sizeof(struct nvsp_message));
- net_device->wait_condition = 1;
- wake_up(&net_device->channel_init_wait);
+ complete(&net_device->channel_init_wait);
} else if (nvsp_packet->hdr.msg_type ==
NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE) {
/* Get the send context */
@@ -1123,7 +1117,7 @@ int netvsc_device_add(struct hv_device *device, void *additional_info)
list_add_tail(&packet->list_ent,
&net_device->recv_pkt_list);
}
- init_waitqueue_head(&net_device->channel_init_wait);
+ init_completion(&net_device->channel_init_wait);

/* Open the channel */
ret = vmbus_open(device->channel, net_driver->ring_buf_size,
diff --git a/drivers/staging/hv/netvsc.h b/drivers/staging/hv/netvsc.h
index 45d24b9..9ebea3b 100644
--- a/drivers/staging/hv/netvsc.h
+++ b/drivers/staging/hv/netvsc.h
@@ -318,8 +318,7 @@ struct netvsc_device {
struct nvsp_1_receive_buffer_section *recv_section;

/* Used for NetVSP initialization protocol */
- int wait_condition;
- wait_queue_head_t channel_init_wait;
+ struct completion channel_init_wait;
struct nvsp_message channel_init_pkt;

struct nvsp_message revoke_packet;
--
1.7.4.1

2011-05-09 21:49:37

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 116/206] Staging: hv: Use the completion abstraction in struct rndis_request

Use the completion abstraction in struct rndis_request to synchronize.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/rndis_filter.c | 33 ++++++++++++++-------------------
1 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/hv/rndis_filter.c b/drivers/staging/hv/rndis_filter.c
index ee74cd1..2037836 100644
--- a/drivers/staging/hv/rndis_filter.c
+++ b/drivers/staging/hv/rndis_filter.c
@@ -59,8 +59,7 @@ struct rndis_device {

struct rndis_request {
struct list_head list_ent;
- int wait_condition;
- wait_queue_head_t wait_event;
+ struct completion wait_event;

/*
* FIXME: We assumed a fixed size response here. If we do ever need to
@@ -125,7 +124,7 @@ static struct rndis_request *get_rndis_request(struct rndis_device *dev,
if (!request)
return NULL;

- init_waitqueue_head(&request->wait_event);
+ init_completion(&request->wait_event);

rndis_msg = &request->request_msg;
rndis_msg->ndis_msg_type = msg_type;
@@ -305,8 +304,7 @@ static void rndis_filter_receive_response(struct rndis_device *dev,
}
}

- request->wait_condition = 1;
- wake_up(&request->wait_event);
+ complete(&request->wait_event);
} else {
dev_err(&dev->net_dev->dev->device,
"no rndis request found for this response "
@@ -465,6 +463,7 @@ static int rndis_filter_query_device(struct rndis_device *dev, u32 oid,
struct rndis_query_request *query;
struct rndis_query_complete *query_complete;
int ret = 0;
+ int t;

if (!result)
return -EINVAL;
@@ -484,14 +483,12 @@ static int rndis_filter_query_device(struct rndis_device *dev, u32 oid,
query->info_buflen = 0;
query->dev_vc_handle = 0;

- request->wait_condition = 0;
ret = rndis_filter_send_request(dev, request);
if (ret != 0)
goto Cleanup;

- wait_event_timeout(request->wait_event, request->wait_condition,
- msecs_to_jiffies(1000));
- if (request->wait_condition == 0) {
+ t = wait_for_completion_timeout(&request->wait_event, HZ);
+ if (t == 0) {
ret = -ETIMEDOUT;
goto Cleanup;
}
@@ -543,7 +540,7 @@ static int rndis_filter_set_packet_filter(struct rndis_device *dev,
struct rndis_set_request *set;
struct rndis_set_complete *set_complete;
u32 status;
- int ret;
+ int ret, t;

request = get_rndis_request(dev, REMOTE_NDIS_SET_MSG,
RNDIS_MESSAGE_SIZE(struct rndis_set_request) +
@@ -562,14 +559,13 @@ static int rndis_filter_set_packet_filter(struct rndis_device *dev,
memcpy((void *)(unsigned long)set + sizeof(struct rndis_set_request),
&new_filter, sizeof(u32));

- request->wait_condition = 0;
ret = rndis_filter_send_request(dev, request);
if (ret != 0)
goto Cleanup;

- wait_event_timeout(request->wait_event, request->wait_condition,
- msecs_to_jiffies(2000));
- if (request->wait_condition == 0) {
+ t = wait_for_completion_timeout(&request->wait_event, HZ);
+
+ if (t == 0) {
ret = -1;
dev_err(&dev->net_dev->dev->device,
"timeout before we got a set response...\n");
@@ -624,7 +620,7 @@ static int rndis_filter_init_device(struct rndis_device *dev)
struct rndis_initialize_request *init;
struct rndis_initialize_complete *init_complete;
u32 status;
- int ret;
+ int ret, t;

request = get_rndis_request(dev, REMOTE_NDIS_INITIALIZE_MSG,
RNDIS_MESSAGE_SIZE(struct rndis_initialize_request));
@@ -642,7 +638,6 @@ static int rndis_filter_init_device(struct rndis_device *dev)

dev->state = RNDIS_DEV_INITIALIZING;

- request->wait_condition = 0;
ret = rndis_filter_send_request(dev, request);
if (ret != 0) {
dev->state = RNDIS_DEV_UNINITIALIZED;
@@ -650,9 +645,9 @@ static int rndis_filter_init_device(struct rndis_device *dev)
}


- wait_event_timeout(request->wait_event, request->wait_condition,
- msecs_to_jiffies(1000));
- if (request->wait_condition == 0) {
+ t = wait_for_completion_timeout(&request->wait_event, HZ);
+
+ if (t == 0) {
ret = -ETIMEDOUT;
goto Cleanup;
}
--
1.7.4.1

2011-05-09 21:48:39

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 117/206] Staging: hv: Get rid of some dead code in channel.c

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/channel.c | 71 ------------------------------------------
1 files changed, 0 insertions(+), 71 deletions(-)

diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 1b50cb7..a2a190e 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -42,37 +42,6 @@ static int create_gpadl_header(
static void dump_vmbus_channel(struct vmbus_channel *channel);
static void vmbus_setevent(struct vmbus_channel *channel);

-
-#if 0
-static void DumpMonitorPage(struct hv_monitor_page *MonitorPage)
-{
- int i = 0;
- int j = 0;
-
- DPRINT_DBG(VMBUS, "monitorPage - %p, trigger state - %d",
- MonitorPage, MonitorPage->trigger_state);
-
- for (i = 0; i < 4; i++)
- DPRINT_DBG(VMBUS, "trigger group (%d) - %llx", i,
- MonitorPage->trigger_group[i].as_uint64);
-
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 32; j++) {
- DPRINT_DBG(VMBUS, "latency (%d)(%d) - %llx", i, j,
- MonitorPage->latency[i][j]);
- }
- }
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 32; j++) {
- DPRINT_DBG(VMBUS, "param-conn id (%d)(%d) - %d", i, j,
- MonitorPage->parameter[i][j].connectionid.asu32);
- DPRINT_DBG(VMBUS, "param-flag (%d)(%d) - %d", i, j,
- MonitorPage->parameter[i][j].flag_number);
- }
- }
-}
-#endif
-
/*
* vmbus_setevent- Trigger an event notification on the specified
* channel.
@@ -99,28 +68,6 @@ static void vmbus_setevent(struct vmbus_channel *channel)
}
}

-#if 0
-static void VmbusChannelClearEvent(struct vmbus_channel *channel)
-{
- struct hv_monitor_page *monitorPage;
-
- if (Channel->offermsg.monitor_allocated) {
- /* Each u32 represents 32 channels */
- sync_clear_bit(Channel->offermsg.child_relid & 31,
- (unsigned long *)vmbus_connection.send_int_page +
- (Channel->offermsg.child_relid >> 5));
-
- monitorPage = (struct hv_monitor_page *)
- vmbus_connection.monitor_pages;
- monitorPage++; /* Get the child to parent monitor page */
-
- sync_clear_bit(Channel->monitor_bit,
- (unsigned long *)&monitorPage->trigger_group
- [Channel->monitor_grp].Pending);
- }
-}
-
-#endif
/*
* vmbus_get_debug_info -Retrieve various channel debug info
*/
@@ -179,10 +126,6 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
unsigned long flags;
int ret, t, err = 0;

- /* Aligned to page size */
- /* ASSERT(!(SendRingBufferSize & (PAGE_SIZE - 1))); */
- /* ASSERT(!(RecvRingBufferSize & (PAGE_SIZE - 1))); */
-
newchannel->onchannel_callback = onchannelcallback;
newchannel->channel_callback_context = context;

@@ -193,7 +136,6 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
if (!out)
return -ENOMEM;

- /* ASSERT(((unsigned long)out & (PAGE_SIZE-1)) == 0); */

in = (void *)((unsigned long)out + send_ringbuffer_size);

@@ -361,9 +303,6 @@ static int create_gpadl_header(void *kbuffer, u32 size,

int pfnsum, pfncount, pfnleft, pfncurr, pfnsize;

- /* ASSERT((kbuffer & (PAGE_SIZE-1)) == 0); */
- /* ASSERT((Size & (PAGE_SIZE-1)) == 0); */
-
pagecount = size >> PAGE_SHIFT;
pfn = virt_to_phys(kbuffer) >> PAGE_SHIFT;

@@ -695,8 +634,6 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer,

dump_vmbus_channel(channel);

- /* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */
-
/* Setup the descriptor */
desc.type = type; /* VmbusPacketTypeDataInBand; */
desc.flags = flags; /* VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; */
@@ -754,8 +691,6 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
packetlen = descsize + bufferlen;
packetlen_aligned = ALIGN(packetlen, sizeof(u64));

- /* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */
-
/* Setup the descriptor */
desc.type = VM_PKT_DATA_USING_GPA_DIRECT;
desc.flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED;
@@ -819,7 +754,6 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,
packetlen = descsize + bufferlen;
packetlen_aligned = ALIGN(packetlen, sizeof(u64));

- /* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */

/* Setup the descriptor */
desc.type = VM_PKT_DATA_USING_GPA_DIRECT;
@@ -885,11 +819,8 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer,
return 0;
}

- /* VmbusChannelClearEvent(Channel); */
-
packetlen = desc.len8 << 3;
userlen = packetlen - (desc.offset8 << 3);
- /* ASSERT(userLen > 0); */

*buffer_actual_len = userlen;

@@ -938,7 +869,6 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer,
return 0;
}

- /* VmbusChannelClearEvent(Channel); */

packetlen = desc.len8 << 3;
userlen = packetlen - (desc.offset8 << 3);
@@ -970,7 +900,6 @@ EXPORT_SYMBOL_GPL(vmbus_recvpacket_raw);
void vmbus_onchannel_event(struct vmbus_channel *channel)
{
dump_vmbus_channel(channel);
- /* ASSERT(Channel->OnChannelCallback); */

channel->onchannel_callback(channel->channel_callback_context);

--
1.7.4.1

2011-05-09 21:48:36

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 118/206] Staging: hv: Change Cleanup to cleanup

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/connection.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c
index 92add38..3632bcc 100644
--- a/drivers/staging/hv/connection.c
+++ b/drivers/staging/hv/connection.c
@@ -58,7 +58,7 @@ int vmbus_connect(void)
vmbus_connection.work_queue = create_workqueue("hv_vmbus_con");
if (!vmbus_connection.work_queue) {
ret = -1;
- goto Cleanup;
+ goto cleanup;
}

INIT_LIST_HEAD(&vmbus_connection.chn_msg_list);
@@ -75,7 +75,7 @@ int vmbus_connect(void)
(void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, 0);
if (vmbus_connection.int_page == NULL) {
ret = -1;
- goto Cleanup;
+ goto cleanup;
}

vmbus_connection.recv_int_page = vmbus_connection.int_page;
@@ -91,7 +91,7 @@ int vmbus_connect(void)
(void *)__get_free_pages((GFP_KERNEL|__GFP_ZERO), 1);
if (vmbus_connection.monitor_pages == NULL) {
ret = -1;
- goto Cleanup;
+ goto cleanup;
}

msginfo = kzalloc(sizeof(*msginfo) +
@@ -99,7 +99,7 @@ int vmbus_connect(void)
GFP_KERNEL);
if (msginfo == NULL) {
ret = -ENOMEM;
- goto Cleanup;
+ goto cleanup;
}

init_completion(&msginfo->waitevent);
@@ -131,7 +131,7 @@ int vmbus_connect(void)
list_del(&msginfo->msglistentry);
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock,
flags);
- goto Cleanup;
+ goto cleanup;
}

/* Wait for the connection response */
@@ -143,7 +143,7 @@ int vmbus_connect(void)
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock,
flags);
ret = -ETIMEDOUT;
- goto Cleanup;
+ goto cleanup;
}

spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
@@ -158,13 +158,13 @@ int vmbus_connect(void)
"Version %d not supported by Hyper-V\n",
VMBUS_REVISION_NUMBER);
ret = -1;
- goto Cleanup;
+ goto cleanup;
}

kfree(msginfo);
return 0;

-Cleanup:
+cleanup:
vmbus_connection.conn_state = DISCONNECTED;

if (vmbus_connection.work_queue)
@@ -207,7 +207,7 @@ int vmbus_disconnect(void)
ret = vmbus_post_msg(msg,
sizeof(struct vmbus_channel_message_header));
if (ret != 0)
- goto Cleanup;
+ goto cleanup;

free_pages((unsigned long)vmbus_connection.int_page, 0);
free_pages((unsigned long)vmbus_connection.monitor_pages, 1);
@@ -219,7 +219,7 @@ int vmbus_disconnect(void)

pr_info("hv_vmbus disconnected\n");

-Cleanup:
+cleanup:
kfree(msg);
return ret;
}
--
1.7.4.1

2011-05-09 21:45:52

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 119/206] Staging: hv: Get rid of some dead code in connection.c

Get rid some commented code and dated comments.T

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/connection.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c
index 3632bcc..dd62585 100644
--- a/drivers/staging/hv/connection.c
+++ b/drivers/staging/hv/connection.c
@@ -263,11 +263,6 @@ static void process_chn_event(u32 relid)

if (channel) {
vmbus_onchannel_event(channel);
- /*
- * WorkQueueQueueWorkItem(channel->dataWorkQueue,
- * vmbus_onchannel_event,
- * (void*)channel);
- */
} else {
pr_err("channel not found for relid - %u\n", relid);
}
@@ -295,7 +290,10 @@ void vmbus_on_event(unsigned long data)
relid = (dword << 5) + bit;

if (relid == 0) {
- /* special case - vmbus channel protocol msg */
+ /*
+ * Special case - vmbus
+ * channel protocol msg
+ */
continue;
}
process_chn_event(relid);
--
1.7.4.1

2011-05-09 21:48:34

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 120/206] Staging: hv: Get rid of some dead code from hv.c

Get rid of some commented code.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv.c | 31 -------------------------------
1 files changed, 0 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/hv/hv.c b/drivers/staging/hv/hv.c
index e6312bd..e0c2861 100644
--- a/drivers/staging/hv/hv.c
+++ b/drivers/staging/hv/hv.c
@@ -82,34 +82,7 @@ static int query_hypervisor_info(void)
op = HVCPUID_VENDOR_MAXFUNCTION;
cpuid(op, &eax, &ebx, &ecx, &edx);

-/* DPRINT_INFO(VMBUS, "Vendor ID: %c%c%c%c%c%c%c%c%c%c%c%c",
- (ebx & 0xFF),
- ((ebx >> 8) & 0xFF),
- ((ebx >> 16) & 0xFF),
- ((ebx >> 24) & 0xFF),
- (ecx & 0xFF),
- ((ecx >> 8) & 0xFF),
- ((ecx >> 16) & 0xFF),
- ((ecx >> 24) & 0xFF),
- (edx & 0xFF),
- ((edx >> 8) & 0xFF),
- ((edx >> 16) & 0xFF),
- ((edx >> 24) & 0xFF));
-*/
max_leaf = eax;
-/* eax = 0;
- ebx = 0;
- ecx = 0;
- edx = 0;
- op = HVCPUID_INTERFACE;
- cpuid(op, &eax, &ebx, &ecx, &edx);
-
- DPRINT_INFO(VMBUS, "Interface ID: %c%c%c%c",
- (eax & 0xFF),
- ((eax >> 8) & 0xFF),
- ((eax >> 16) & 0xFF),
- ((eax >> 24) & 0xFF));
-*/

if (max_leaf >= HVCPUID_VERSION) {
eax = 0;
@@ -399,10 +372,6 @@ void hv_synic_init(void *irqarg)

wrmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64);

- /* Setup the interception SINT. */
- /* wrmsrl((HV_X64_MSR_SINT0 + HV_SYNIC_INTERCEPTION_SINT_INDEX), */
- /* interceptionSint.as_uint64); */
-
/* Setup the shared SINT. */
rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, shared_sint.as_uint64);

--
1.7.4.1

2011-05-09 21:47:30

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 121/206] Staging: hv: Change Cleanup to cleanup

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/hv/hv.c b/drivers/staging/hv/hv.c
index e0c2861..2efac38 100644
--- a/drivers/staging/hv/hv.c
+++ b/drivers/staging/hv/hv.c
@@ -161,7 +161,7 @@ int hv_init(void)
sizeof(void *) * MAX_NUM_CPUS);

if (!query_hypervisor_presence())
- goto Cleanup;
+ goto cleanup;

max_leaf = query_hypervisor_info();
/* HvQueryHypervisorFeatures(maxLeaf); */
@@ -172,7 +172,7 @@ int hv_init(void)
rdmsrl(HV_X64_MSR_GUEST_OS_ID, hv_context.guestid);

if (hv_context.guestid != 0)
- goto Cleanup;
+ goto cleanup;

/* Write our OS info */
wrmsrl(HV_X64_MSR_GUEST_OS_ID, HV_LINUX_GUEST_ID);
@@ -188,7 +188,7 @@ int hv_init(void)
virtaddr = __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL_EXEC);

if (!virtaddr)
- goto Cleanup;
+ goto cleanup;

hypercall_msr.enable = 1;

@@ -200,7 +200,7 @@ int hv_init(void)
rdmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);

if (!hypercall_msr.enable)
- goto Cleanup;
+ goto cleanup;

hv_context.hypercall_page = virtaddr;

@@ -209,7 +209,7 @@ int hv_init(void)
kmalloc(sizeof(struct hv_input_signal_event_buffer),
GFP_KERNEL);
if (!hv_context.signal_event_buffer)
- goto Cleanup;
+ goto cleanup;

hv_context.signal_event_param =
(struct hv_input_signal_event *)
@@ -224,7 +224,7 @@ int hv_init(void)

return ret;

-Cleanup:
+cleanup:
if (virtaddr) {
if (hypercall_msr.enable) {
hypercall_msr.as_uint64 = 0;
@@ -345,7 +345,7 @@ void hv_synic_init(void *irqarg)

if (hv_context.synic_message_page[cpu] == NULL) {
pr_err("Unable to allocate SYNIC message page\n");
- goto Cleanup;
+ goto cleanup;
}

hv_context.synic_event_page[cpu] =
@@ -353,7 +353,7 @@ void hv_synic_init(void *irqarg)

if (hv_context.synic_event_page[cpu] == NULL) {
pr_err("Unable to allocate SYNIC event page\n");
- goto Cleanup;
+ goto cleanup;
}

/* Setup the Synic's message page */
@@ -391,7 +391,7 @@ void hv_synic_init(void *irqarg)
hv_context.synic_initialized = true;
return;

-Cleanup:
+cleanup:
if (hv_context.synic_event_page[cpu])
free_page((unsigned long)hv_context.synic_event_page[cpu]);

--
1.7.4.1

2011-05-09 21:48:16

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 122/206] Staging: hv: Get rid of unnecessary state from struct storvsc_driver

This is unused state; get rid of it.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_api.h | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 1887940..055902b 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -83,9 +83,6 @@ struct storvsc_driver {
/* Maximum # of requests in flight per channel/device */
u32 max_outstanding_req_per_channel;

- /* Specific to this driver */
- int (*on_io_request)(struct hv_device *device,
- struct hv_storvsc_request *request);
};

struct storvsc_device_info {
--
1.7.4.1

2011-05-09 21:46:08

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 123/206] Staging: hv: Get rid unnecessary DPRINT

Get rid unnecessary DPRINT.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 7fb0cf1..8ff9a58 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -192,10 +192,6 @@ static int blk_vsc_initialize(struct hv_driver *driver)
sizeof(struct vstor_packet) + sizeof(u64),
sizeof(u64)));

- DPRINT_INFO(BLKVSC, "max io outstd %u",
- stor_driver->max_outstanding_req_per_channel);
-
-
return ret;
}

--
1.7.4.1

2011-05-09 21:46:12

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 124/206] Staging: hv: Get rid of unnecessary code/comments

Get rid of unnecessary code/comments.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 15 ---------------
1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 8ff9a58..77b081c 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -174,24 +174,9 @@ static int blk_vsc_initialize(struct hv_driver *driver)

stor_driver = hvdr_to_stordr(driver);

- /* Make sure we are at least 2 pages since 1 page is used for control */
-
driver->name = drv_name;
memcpy(&driver->dev_type, &dev_type, sizeof(struct hv_guid));

-
- /*
- * Divide the ring buffer data size (which is 1 page less than the ring
- * buffer size since that page is reserved for the ring buffer indices)
- * by the max request size (which is
- * vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64)
- */
- stor_driver->max_outstanding_req_per_channel =
- ((stor_driver->ring_buffer_size - PAGE_SIZE) /
- ALIGN(MAX_MULTIPAGE_BUFFER_PACKET +
- sizeof(struct vstor_packet) + sizeof(u64),
- sizeof(u64)));
-
return ret;
}

--
1.7.4.1

2011-05-09 21:46:07

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 125/206] Staging: hv: Assign the name directly

Assign the driver name directly.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 77b081c..e0d34c1 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -842,7 +842,7 @@ static int blkvsc_drv_init(void)
/* Callback to client driver to complete the initialization */
blk_vsc_initialize(&storvsc_drv->base);

- drv->driver.name = storvsc_drv->base.name;
+ drv->driver.name = drv_name;

/* The driver belongs to vmbus */
ret = vmbus_child_driver_register(&drv->driver);
--
1.7.4.1

2011-05-09 21:46:05

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 126/206] Staging: hv: Move the assignment of driver name

In preperation to eliminating blk_vsc_initialize(), move the assignment
of driver name.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index e0d34c1..1e6ef6f 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -174,7 +174,6 @@ static int blk_vsc_initialize(struct hv_driver *driver)

stor_driver = hvdr_to_stordr(driver);

- driver->name = drv_name;
memcpy(&driver->dev_type, &dev_type, sizeof(struct hv_guid));

return ret;
@@ -842,6 +841,7 @@ static int blkvsc_drv_init(void)
/* Callback to client driver to complete the initialization */
blk_vsc_initialize(&storvsc_drv->base);

+ drv->name = drv_name;
drv->driver.name = drv_name;

/* The driver belongs to vmbus */
--
1.7.4.1

2011-05-09 21:46:10

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 127/206] Staging: hv: Inline the copying of dev_type guid

In preperation to eliminating blk_vsc_initialize(), move the copying of
dev_type field.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 1e6ef6f..7e25707 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -174,8 +174,6 @@ static int blk_vsc_initialize(struct hv_driver *driver)

stor_driver = hvdr_to_stordr(driver);

- memcpy(&driver->dev_type, &dev_type, sizeof(struct hv_guid));
-
return ret;
}

@@ -841,6 +839,7 @@ static int blkvsc_drv_init(void)
/* Callback to client driver to complete the initialization */
blk_vsc_initialize(&storvsc_drv->base);

+ memcpy(&drv->dev_type, &dev_type, sizeof(struct hv_guid));
drv->name = drv_name;
drv->driver.name = drv_name;

--
1.7.4.1

2011-05-09 21:46:11

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 128/206] Staging: hv: Now get rid of the empty function

Now, get rid of the empty function.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 15 ---------------
1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 7e25707..f8a3bce 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -166,18 +166,6 @@ static int blkvsc_device_add(struct hv_device *device,
return ret;
}

-
-static int blk_vsc_initialize(struct hv_driver *driver)
-{
- struct storvsc_driver *stor_driver;
- int ret = 0;
-
- stor_driver = hvdr_to_stordr(driver);
-
- return ret;
-}
-
-
static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
void (*request_completion)(struct hv_storvsc_request *))
{
@@ -836,9 +824,6 @@ static int blkvsc_drv_init(void)

storvsc_drv->ring_buffer_size = blkvsc_ringbuffer_size;

- /* Callback to client driver to complete the initialization */
- blk_vsc_initialize(&storvsc_drv->base);
-
memcpy(&drv->dev_type, &dev_type, sizeof(struct hv_guid));
drv->name = drv_name;
drv->driver.name = drv_name;
--
1.7.4.1

2011-05-10 08:33:03

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 129/206] Staging: hv: Move the sector size check into blkvsc_drv_init

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index f8a3bce..ed1439f 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -822,6 +822,8 @@ static int blkvsc_drv_init(void)
struct hv_driver *drv = &blkvsc_drv.base;
int ret;

+ BUILD_BUG_ON(sizeof(sector_t) != 8);
+
storvsc_drv->ring_buffer_size = blkvsc_ringbuffer_size;

memcpy(&drv->dev_type, &dev_type, sizeof(struct hv_guid));
@@ -1046,8 +1048,6 @@ static int __init blkvsc_init(void)
{
int ret;

- BUILD_BUG_ON(sizeof(sector_t) != 8);
-
ret = blkvsc_drv_init();

return ret;
--
1.7.4.1

2011-05-10 08:49:41

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 130/206] Staging: hv: Make blkvsc_drv_init the module init function

Now, get rid of the redundant function and make
blkvsc_drv_init the module init function.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 11 +----------
1 files changed, 1 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index ed1439f..eebaaee 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -1044,15 +1044,6 @@ static void blkvsc_request_completion(struct hv_storvsc_request *request)
spin_unlock_irqrestore(&blkdev->lock, flags);
}

-static int __init blkvsc_init(void)
-{
- int ret;
-
- ret = blkvsc_drv_init();
-
- return ret;
-}
-
static void __exit blkvsc_exit(void)
{
blkvsc_drv_exit();
@@ -1061,5 +1052,5 @@ static void __exit blkvsc_exit(void)
MODULE_LICENSE("GPL");
MODULE_VERSION(HV_DRV_VERSION);
MODULE_DESCRIPTION("Microsoft Hyper-V virtual block driver");
-module_init(blkvsc_init);
+module_init(blkvsc_drv_init);
module_exit(blkvsc_exit);
--
1.7.4.1

2011-05-10 09:37:33

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 131/206] Staging: hv: Get rid of some unnecessary DPRINTs

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 0d7e43b..07db877 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -103,10 +103,6 @@ static int storvsc_initialize(struct hv_driver *driver)
sizeof(struct vstor_packet) + sizeof(u64),
sizeof(u64)));

- DPRINT_INFO(STORVSC, "max io %u, currently %u\n",
- stor_driver->max_outstanding_req_per_channel,
- STORVSC_MAX_IO_REQUESTS);
-

return 0;
}
@@ -807,10 +803,6 @@ static int storvsc_drv_init(void)
/* Callback to client driver to complete the initialization */
storvsc_initialize(&storvsc_drv_obj->base);

- DPRINT_INFO(STORVSC_DRV,
- "max outstanding reqs %u",
- storvsc_drv_obj->max_outstanding_req_per_channel);
-
if (storvsc_drv_obj->max_outstanding_req_per_channel <
STORVSC_MAX_IO_REQUESTS)
return -1;
--
1.7.4.1

2011-05-10 08:38:32

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 132/206] Staging: hv: Compute max_outstanding_req_per_channel where it is needed

Compute max_outstanding_req_per_channel where it is needed.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 30 +++++++++++++++---------------
1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 07db877..7d8b8f9 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -90,20 +90,6 @@ static int storvsc_initialize(struct hv_driver *driver)
memcpy(&driver->dev_type, &gStorVscDeviceType,
sizeof(struct hv_guid));

-
- /*
- * Divide the ring buffer data size (which is 1 page less
- * than the ring buffer size since that page is reserved for
- * the ring buffer indices) by the max request size (which is
- * vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64)
- */
- stor_driver->max_outstanding_req_per_channel =
- ((stor_driver->ring_buffer_size - PAGE_SIZE) /
- ALIGN(MAX_MULTIPAGE_BUFFER_PACKET +
- sizeof(struct vstor_packet) + sizeof(u64),
- sizeof(u64)));
-
-
return 0;
}

@@ -797,13 +783,27 @@ static int storvsc_drv_init(void)
int ret;
struct storvsc_driver *storvsc_drv_obj = &storvsc_drv;
struct hv_driver *drv = &storvsc_drv.base;
+ u32 max_outstanding_req_per_channel;
+
+ /*
+ * Divide the ring buffer data size (which is 1 page less
+ * than the ring buffer size since that page is reserved for
+ * the ring buffer indices) by the max request size (which is
+ * vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64)
+ */
+
+ max_outstanding_req_per_channel =
+ ((storvsc_ringbuffer_size - PAGE_SIZE) /
+ ALIGN(MAX_MULTIPAGE_BUFFER_PACKET +
+ sizeof(struct vstor_packet) + sizeof(u64),
+ sizeof(u64)));

storvsc_drv_obj->ring_buffer_size = storvsc_ringbuffer_size;

/* Callback to client driver to complete the initialization */
storvsc_initialize(&storvsc_drv_obj->base);

- if (storvsc_drv_obj->max_outstanding_req_per_channel <
+ if (max_outstanding_req_per_channel <
STORVSC_MAX_IO_REQUESTS)
return -1;

--
1.7.4.1

2011-05-10 08:41:42

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 133/206] Staging: hv: Get rid of max_outstanding_req_per_channel from struct storvsc_driver

Now, Get rid of max_outstanding_req_per_channel from struct storvsc_driver.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_api.h | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 055902b..99d878a 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -79,10 +79,6 @@ struct storvsc_driver {

/* Set by caller (in bytes) */
u32 ring_buffer_size;
-
- /* Maximum # of requests in flight per channel/device */
- u32 max_outstanding_req_per_channel;
-
};

struct storvsc_device_info {
--
1.7.4.1

2011-05-10 09:54:16

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 134/206] Staging: hv: Add ring_buffer_size to struct storvsc_device_info

Add ring_buffer_size to struct storvsc_device_info

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_api.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 99d878a..fac607c 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -82,6 +82,7 @@ struct storvsc_driver {
};

struct storvsc_device_info {
+ u32 ring_buffer_size;
unsigned int port_number;
unsigned char path_id;
unsigned char target_id;
--
1.7.4.1

2011-05-10 09:55:18

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 135/206] Staging: hv: Use the rinbuffer size info in struct storvsc_device_info

Use the rinbuffer size info in struct storvsc_device_info.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 5 ++---
drivers/staging/hv/storvsc.c | 10 ++++------
drivers/staging/hv/storvsc_drv.c | 1 +
3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index eebaaee..c04aaa3 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -146,6 +146,8 @@ static int blkvsc_device_add(struct hv_device *device,

device_info = (struct storvsc_device_info *)additional_info;

+ device_info->ring_buffer_size = blkvsc_ringbuffer_size;
+
ret = storvsc_dev_add(device, additional_info);
if (ret != 0)
return ret;
@@ -818,14 +820,11 @@ static const struct block_device_operations block_ops = {
*/
static int blkvsc_drv_init(void)
{
- struct storvsc_driver *storvsc_drv = &blkvsc_drv;
struct hv_driver *drv = &blkvsc_drv.base;
int ret;

BUILD_BUG_ON(sizeof(sector_t) != 8);

- storvsc_drv->ring_buffer_size = blkvsc_ringbuffer_size;
-
memcpy(&drv->dev_type, &dev_type, sizeof(struct hv_guid));
drv->name = drv_name;
drv->driver.name = drv_name;
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 41361f5..8d7a490 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -363,19 +363,17 @@ static void storvsc_on_channel_callback(void *context)
return;
}

-static int storvsc_connect_to_vsp(struct hv_device *device)
+static int storvsc_connect_to_vsp(struct hv_device *device, u32 ring_size)
{
struct vmstorage_channel_properties props;
- struct storvsc_driver *stor_driver;
int ret;

- stor_driver = drv_to_stordrv(device->device.driver);
memset(&props, 0, sizeof(struct vmstorage_channel_properties));

/* Open the channel */
ret = vmbus_open(device->channel,
- stor_driver->ring_buffer_size,
- stor_driver->ring_buffer_size,
+ ring_size,
+ ring_size,
(void *)&props,
sizeof(struct vmstorage_channel_properties),
storvsc_on_channel_callback, device);
@@ -413,7 +411,7 @@ int storvsc_dev_add(struct hv_device *device,

stor_device->port_number = device_info->port_number;
/* Send it back up */
- ret = storvsc_connect_to_vsp(device);
+ ret = storvsc_connect_to_vsp(device, device_info->ring_buffer_size);

device_info->path_id = stor_device->path_id;
device_info->target_id = stor_device->target_id;
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 7d8b8f9..1fb0521 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -733,6 +733,7 @@ static int storvsc_probe(struct hv_device *device)
}

device_info.port_number = host->host_no;
+ device_info.ring_buffer_size = storvsc_ringbuffer_size;
/* Call to the vsc driver to add the device */
ret = storvsc_dev_add(device, (void *)&device_info);

--
1.7.4.1

2011-05-10 08:51:08

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 136/206] Staging: hv: Get rid of the unnecessary assignment of ring size

Now, get rid of the unnecessary assignment of ring size.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 1fb0521..f37c836 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -799,8 +799,6 @@ static int storvsc_drv_init(void)
sizeof(struct vstor_packet) + sizeof(u64),
sizeof(u64)));

- storvsc_drv_obj->ring_buffer_size = storvsc_ringbuffer_size;
-
/* Callback to client driver to complete the initialization */
storvsc_initialize(&storvsc_drv_obj->base);

--
1.7.4.1

2011-05-10 09:20:49

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 137/206] Staging: hv: Get rid of the ring size state from struct storvsc_driver

Now, get rid of the ring size state from struct storvsc_driver.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_api.h | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index fac607c..d2917eb 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -76,9 +76,6 @@ struct hv_storvsc_request {
/* Represents the block vsc driver */
struct storvsc_driver {
struct hv_driver base;
-
- /* Set by caller (in bytes) */
- u32 ring_buffer_size;
};

struct storvsc_device_info {
--
1.7.4.1

2011-05-10 09:21:14

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 138/206] Staging: hv: Directly assign the driver name

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index f37c836..e342bcc 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -806,7 +806,7 @@ static int storvsc_drv_init(void)
STORVSC_MAX_IO_REQUESTS)
return -1;

- drv->driver.name = storvsc_drv_obj->base.name;
+ drv->driver.name = driver_name;


/* The driver belongs to vmbus */
--
1.7.4.1

2011-05-10 08:38:37

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 139/206] Staging: hv: Move the assignment of name to the hv_driver

In preperation to eliminate the function storvsc_initialize()
move the name assignment.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index e342bcc..9447130 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -86,7 +86,6 @@ static int storvsc_initialize(struct hv_driver *driver)

/* Make sure we are at least 2 pages since 1 page is used for control */

- driver->name = driver_name;
memcpy(&driver->dev_type, &gStorVscDeviceType,
sizeof(struct hv_guid));

@@ -806,6 +805,7 @@ static int storvsc_drv_init(void)
STORVSC_MAX_IO_REQUESTS)
return -1;

+ drv->name = driver_name;
drv->driver.name = driver_name;


--
1.7.4.1

2011-05-10 08:51:03

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 140/206] Staging: hv: Inline the copying of the dev_type information

In preperation to eliminate the function storvsc_initialize()
move the copying of dev_type info.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 9447130..3be4f1a 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -83,12 +83,6 @@ static int storvsc_initialize(struct hv_driver *driver)

stor_driver = hvdr_to_stordr(driver);

-
- /* Make sure we are at least 2 pages since 1 page is used for control */
-
- memcpy(&driver->dev_type, &gStorVscDeviceType,
- sizeof(struct hv_guid));
-
return 0;
}

@@ -801,6 +795,9 @@ static int storvsc_drv_init(void)
/* Callback to client driver to complete the initialization */
storvsc_initialize(&storvsc_drv_obj->base);

+ memcpy(&drv->dev_type, &gStorVscDeviceType,
+ sizeof(struct hv_guid));
+
if (max_outstanding_req_per_channel <
STORVSC_MAX_IO_REQUESTS)
return -1;
--
1.7.4.1

2011-05-10 09:54:10

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 141/206] Staging: hv: Now get rid of an empty function

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 16 ----------------
1 files changed, 0 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 3be4f1a..de6984f 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -74,18 +74,6 @@ struct storvsc_cmd_request {
};


-/*
- * storvsc_initialize - Main entry point
- */
-static int storvsc_initialize(struct hv_driver *driver)
-{
- struct storvsc_driver *stor_driver;
-
- stor_driver = hvdr_to_stordr(driver);
-
- return 0;
-}
-
static int storvsc_device_alloc(struct scsi_device *sdevice)
{
/*
@@ -775,7 +763,6 @@ static struct storvsc_driver storvsc_drv = {
static int storvsc_drv_init(void)
{
int ret;
- struct storvsc_driver *storvsc_drv_obj = &storvsc_drv;
struct hv_driver *drv = &storvsc_drv.base;
u32 max_outstanding_req_per_channel;

@@ -792,9 +779,6 @@ static int storvsc_drv_init(void)
sizeof(struct vstor_packet) + sizeof(u64),
sizeof(u64)));

- /* Callback to client driver to complete the initialization */
- storvsc_initialize(&storvsc_drv_obj->base);
-
memcpy(&drv->dev_type, &gStorVscDeviceType,
sizeof(struct hv_guid));

--
1.7.4.1

2011-05-10 08:38:29

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 142/206] Staging: hv: Get rid of some unused functions

Now get rid of unused functions.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_api.h | 12 ------------
1 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index d2917eb..4db913f 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -144,18 +144,6 @@ static inline void put_stor_device(struct hv_device *device)
atomic_dec(&stor_device->ref_count);
}

-static inline struct storvsc_driver *hvdr_to_stordr(struct hv_driver *d)
-{
- return container_of(d, struct storvsc_driver, base);
-}
-
-static inline
-struct storvsc_driver *drv_to_stordrv(struct device_driver *d)
-{
- struct hv_driver *hvdrv = drv_to_hv_drv(d);
- return hvdr_to_stordr(hvdrv);
-}
-
static inline void storvsc_wait_to_drain(struct storvsc_device *dev)
{
dev->drain_notify = true;
--
1.7.4.1

2011-05-10 08:49:44

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 143/206] Staging: hv: Make storvsc_drv an instance of hv_driver

In preparation for eliminating struct storvsc_driver,
make the variable storvsc_drv an instance of struct hv_driver.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index de6984f..907d855 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -751,9 +751,9 @@ static int storvsc_probe(struct hv_device *device)

/* The one and only one */

-static struct storvsc_driver storvsc_drv = {
- .base.probe = storvsc_probe,
- .base.remove = storvsc_remove,
+static struct hv_driver storvsc_drv = {
+ .probe = storvsc_probe,
+ .remove = storvsc_remove,
};


@@ -763,7 +763,7 @@ static struct storvsc_driver storvsc_drv = {
static int storvsc_drv_init(void)
{
int ret;
- struct hv_driver *drv = &storvsc_drv.base;
+ struct hv_driver *drv = &storvsc_drv;
u32 max_outstanding_req_per_channel;

/*
@@ -805,7 +805,7 @@ static int storvsc_drv_exit_cb(struct device *dev, void *data)

static void storvsc_drv_exit(void)
{
- struct hv_driver *drv = &storvsc_drv.base;
+ struct hv_driver *drv = &storvsc_drv;
struct device *current_dev = NULL;
int ret;

--
1.7.4.1

2011-05-10 08:38:35

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 144/206] Staging: hv: Make blkvsc_drv an instance of struct hv_driver

Make blkvsc_drv an instance of struct hv_driver.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index c04aaa3..10da9bb 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -801,10 +801,10 @@ static void blkvsc_request(struct request_queue *queue)


/* The one and only one */
-static struct storvsc_driver blkvsc_drv = {
- .base.probe = blkvsc_probe,
- .base.remove = blkvsc_remove,
- .base.shutdown = blkvsc_shutdown,
+static struct hv_driver blkvsc_drv = {
+ .probe = blkvsc_probe,
+ .remove = blkvsc_remove,
+ .shutdown = blkvsc_shutdown,
};

static const struct block_device_operations block_ops = {
@@ -820,7 +820,7 @@ static const struct block_device_operations block_ops = {
*/
static int blkvsc_drv_init(void)
{
- struct hv_driver *drv = &blkvsc_drv.base;
+ struct hv_driver *drv = &blkvsc_drv;
int ret;

BUILD_BUG_ON(sizeof(sector_t) != 8);
@@ -844,7 +844,7 @@ static int blkvsc_drv_exit_cb(struct device *dev, void *data)

static void blkvsc_drv_exit(void)
{
- struct hv_driver *drv = &blkvsc_drv.base;
+ struct hv_driver *drv = &blkvsc_drv;
struct device *current_dev;
int ret;

--
1.7.4.1

2011-05-10 08:47:26

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 145/206] Staging: hv: Get rid of struct storvsc_driver

Now get rid of struct storvsc_driver as it is not needed.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_api.h | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 4db913f..b163515 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -73,11 +73,6 @@ struct hv_storvsc_request {
};


-/* Represents the block vsc driver */
-struct storvsc_driver {
- struct hv_driver base;
-};
-
struct storvsc_device_info {
u32 ring_buffer_size;
unsigned int port_number;
--
1.7.4.1

2011-05-10 08:44:07

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 146/206] Staging: hv: Directly assign the driver name

Directly assign the driver name.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index 4475534..5f30e39 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -997,7 +997,7 @@ static int __init mousevsc_init(void)
/* Callback to client driver to complete the initialization */
mouse_vsc_initialize(&input_drv_obj->base);

- drv->driver.name = input_drv_obj->base.name;
+ drv->driver.name = driver_name;

/* The driver belongs to vmbus */
vmbus_child_driver_register(&drv->driver);
--
1.7.4.1

2011-05-10 08:41:46

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 147/206] Staging: hv: Move the assignment of name variable

In preparation to eliminate mouse_vsc_initialize,
move the assignment of driver name.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index 5f30e39..b4c087f 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -979,7 +979,6 @@ static void mousevsc_drv_exit(void)

static int mouse_vsc_initialize(struct hv_driver *driver)
{
- driver->name = driver_name;
memcpy(&driver->dev_type, &mouse_guid,
sizeof(struct hv_guid));

@@ -998,6 +997,7 @@ static int __init mousevsc_init(void)
mouse_vsc_initialize(&input_drv_obj->base);

drv->driver.name = driver_name;
+ drv->name = driver_name;

/* The driver belongs to vmbus */
vmbus_child_driver_register(&drv->driver);
--
1.7.4.1

2011-05-10 08:44:11

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 148/206] Staging: hv: Move the code to copy dev_type information

In preparation to eliminate mouse_vsc_initialize,
move the code that copies the dev_type info.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index b4c087f..85b95d8 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -979,8 +979,6 @@ static void mousevsc_drv_exit(void)

static int mouse_vsc_initialize(struct hv_driver *driver)
{
- memcpy(&driver->dev_type, &mouse_guid,
- sizeof(struct hv_guid));

return 0;
}
@@ -995,6 +993,8 @@ static int __init mousevsc_init(void)

/* Callback to client driver to complete the initialization */
mouse_vsc_initialize(&input_drv_obj->base);
+ memcpy(&drv->dev_type, &mouse_guid,
+ sizeof(struct hv_guid));

drv->driver.name = driver_name;
drv->name = driver_name;
--
1.7.4.1

2011-05-10 08:44:08

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 149/206] Staging: hv: Get rid of an empty function

Now, get rid of the empty function.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 10 ----------
1 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index 85b95d8..6dc2761 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -977,22 +977,12 @@ static void mousevsc_drv_exit(void)
return;
}

-static int mouse_vsc_initialize(struct hv_driver *driver)
-{
-
- return 0;
-}
-
-
static int __init mousevsc_init(void)
{
- struct mousevsc_drv_obj *input_drv_obj = &mousevsc_drv;
struct hv_driver *drv = &mousevsc_drv.base;

DPRINT_INFO(INPUTVSC_DRV, "Hyper-V Mouse driver initializing.");

- /* Callback to client driver to complete the initialization */
- mouse_vsc_initialize(&input_drv_obj->base);
memcpy(&drv->dev_type, &mouse_guid,
sizeof(struct hv_guid));

--
1.7.4.1

2011-05-10 08:47:29

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 150/206] Staging: hv: Make mousevsc_drv an instance of struct hv_driver

In preparation to eliminate struct mousevsc_drv_obj,
make struct mousevsc_drv an instance of struct
hv_driver.


Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index 6dc2761..0eca451 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -428,14 +428,14 @@ Cleanup:
static void mousevsc_on_receive_input_report(struct mousevsc_dev *input_device,
struct synthhid_input_report *input_report)
{
- struct mousevsc_drv_obj *input_drv;
+ struct hv_driver *input_drv;

if (!input_device->init_complete) {
pr_info("Initialization incomplete...ignoring input_report msg");
return;
}

- input_drv = drv_to_mousedrv(input_device->device->device.driver);
+ input_drv = drv_to_hv_drv(input_device->device->device.driver);

inputreport_callback(input_device->device,
input_report->buffer,
@@ -680,7 +680,7 @@ static int mousevsc_on_device_add(struct hv_device *device,
{
int ret = 0;
struct mousevsc_dev *input_dev;
- struct mousevsc_drv_obj *input_drv;
+ struct hv_driver *input_drv;
struct hv_input_dev_info dev_info;

input_dev = alloc_input_device(device);
@@ -720,7 +720,7 @@ static int mousevsc_on_device_add(struct hv_device *device,
return ret;
}

- input_drv = drv_to_mousedrv(input_dev->device->device.driver);
+ input_drv = drv_to_hv_drv(input_dev->device->device.driver);

dev_info.vendor = input_dev->hid_dev_info.vendor;
dev_info.product = input_dev->hid_dev_info.product;
@@ -943,14 +943,14 @@ static int mousevsc_drv_exit_cb(struct device *dev, void *data)
return 1;
}

-static struct mousevsc_drv_obj mousevsc_drv = {
- .base.probe = mousevsc_probe,
- .base.remove = mousevsc_remove,
+static struct hv_driver mousevsc_drv = {
+ .probe = mousevsc_probe,
+ .remove = mousevsc_remove,
};

static void mousevsc_drv_exit(void)
{
- struct hv_driver *drv = &mousevsc_drv.base;
+ struct hv_driver *drv = &mousevsc_drv;
int ret;

struct device *current_dev = NULL;
@@ -979,7 +979,7 @@ static void mousevsc_drv_exit(void)

static int __init mousevsc_init(void)
{
- struct hv_driver *drv = &mousevsc_drv.base;
+ struct hv_driver *drv = &mousevsc_drv;

DPRINT_INFO(INPUTVSC_DRV, "Hyper-V Mouse driver initializing.");

--
1.7.4.1

2011-05-10 08:41:48

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 151/206] Staging: hv: Get rid of some unused code

Now, get rid of struct mousevsc_drv_obj.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 14 --------------
1 files changed, 0 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index 0eca451..af4db64 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -45,20 +45,6 @@ struct hv_input_dev_info {
char name[128];
};

-/* Represents the input vsc driver */
-/* FIXME - can be removed entirely */
-struct mousevsc_drv_obj {
- struct hv_driver base;
-};
-
-
-static inline
-struct mousevsc_drv_obj *drv_to_mousedrv(struct device_driver *d)
-{
- struct hv_driver *hvdrv = drv_to_hv_drv(d);
- return container_of(hvdrv, struct mousevsc_drv_obj, base);
-}
-
/* The maximum size of a synthetic input message. */
#define SYNTHHID_MAX_INPUT_REPORT_SIZE 16

--
1.7.4.1

2011-05-10 08:33:04

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 152/206] Staging: hv: Create a common header for all hyperv drivers to include

Create a common header for all hyperv drivers to include.
Free at last ...

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
include/linux/hyperv.h | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
create mode 100644 include/linux/hyperv.h

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
new file mode 100644
index 0000000..ce27244
--- /dev/null
+++ b/include/linux/hyperv.h
@@ -0,0 +1,23 @@
+/*
+ *
+ * Copyright (c) 2011, Microsoft Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * Authors:
+ * Haiyang Zhang <[email protected]>
+ * Hank Janssen <[email protected]>
+ * K. Y. Srinivasan <[email protected]>
+ *
+ */
--
1.7.4.1

2011-05-10 08:51:02

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 153/206] Staging: hv:Include the contents of channel.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
include/linux/hyperv.h | 89 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 89 insertions(+), 0 deletions(-)

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index ce27244..d13d72a 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -21,3 +21,92 @@
* K. Y. Srinivasan <[email protected]>
*
*/
+
+#ifndef _HYPERV_H
+#define _HYPERV_H
+
+#include "channel_mgmt.h"
+
+/* The format must be the same as struct vmdata_gpa_direct */
+struct vmbus_channel_packet_page_buffer {
+ u16 type;
+ u16 dataoffset8;
+ u16 length8;
+ u16 flags;
+ u64 transactionid;
+ u32 reserved;
+ u32 rangecount;
+ struct hv_page_buffer range[MAX_PAGE_BUFFER_COUNT];
+} __packed;
+
+/* The format must be the same as struct vmdata_gpa_direct */
+struct vmbus_channel_packet_multipage_buffer {
+ u16 type;
+ u16 dataoffset8;
+ u16 length8;
+ u16 flags;
+ u64 transactionid;
+ u32 reserved;
+ u32 rangecount; /* Always 1 in this case */
+ struct hv_multipage_buffer range;
+} __packed;
+
+
+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);
+
+extern int vmbus_establish_gpadl(struct vmbus_channel *channel,
+ void *kbuffer,
+ u32 size,
+ u32 *gpadl_handle);
+
+extern int vmbus_teardown_gpadl(struct vmbus_channel *channel,
+ u32 gpadl_handle);
+
+extern int vmbus_recvpacket(struct vmbus_channel *channel,
+ void *buffer,
+ u32 bufferlen,
+ u32 *buffer_actual_len,
+ u64 *requestid);
+
+extern int vmbus_recvpacket_raw(struct vmbus_channel *channel,
+ void *buffer,
+ u32 bufferlen,
+ u32 *buffer_actual_len,
+ u64 *requestid);
+
+extern void vmbus_onchannel_event(struct vmbus_channel *channel);
+
+extern void vmbus_get_debug_info(struct vmbus_channel *channel,
+ struct vmbus_channel_debug_info *debug);
+
+extern void vmbus_ontimer(unsigned long data);
+
+#endif /* _HYPERV_H_ */
--
1.7.4.1

2011-05-10 08:37:08

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 154/206] Staging: hv: Include the contents of channel_mgmt.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
include/linux/hyperv.h | 292 +++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 291 insertions(+), 1 deletions(-)

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index d13d72a..932aafa 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -25,7 +25,297 @@
#ifndef _HYPERV_H
#define _HYPERV_H

-#include "channel_mgmt.h"
+
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/workqueue.h>
+#include <linux/completion.h>
+#include "ring_buffer.h"
+#include "vmbus_channel_interface.h"
+#include "vmbus_packet_format.h"
+
+/* Version 1 messages */
+enum vmbus_channel_message_type {
+ CHANNELMSG_INVALID = 0,
+ CHANNELMSG_OFFERCHANNEL = 1,
+ CHANNELMSG_RESCIND_CHANNELOFFER = 2,
+ CHANNELMSG_REQUESTOFFERS = 3,
+ CHANNELMSG_ALLOFFERS_DELIVERED = 4,
+ CHANNELMSG_OPENCHANNEL = 5,
+ CHANNELMSG_OPENCHANNEL_RESULT = 6,
+ CHANNELMSG_CLOSECHANNEL = 7,
+ CHANNELMSG_GPADL_HEADER = 8,
+ CHANNELMSG_GPADL_BODY = 9,
+ CHANNELMSG_GPADL_CREATED = 10,
+ CHANNELMSG_GPADL_TEARDOWN = 11,
+ CHANNELMSG_GPADL_TORNDOWN = 12,
+ CHANNELMSG_RELID_RELEASED = 13,
+ CHANNELMSG_INITIATE_CONTACT = 14,
+ CHANNELMSG_VERSION_RESPONSE = 15,
+ CHANNELMSG_UNLOAD = 16,
+#ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
+ CHANNELMSG_VIEWRANGE_ADD = 17,
+ CHANNELMSG_VIEWRANGE_REMOVE = 18,
+#endif
+ CHANNELMSG_COUNT
+};
+
+struct vmbus_channel_message_header {
+ enum vmbus_channel_message_type msgtype;
+ u32 padding;
+} __packed;
+
+/* Query VMBus Version parameters */
+struct vmbus_channel_query_vmbus_version {
+ struct vmbus_channel_message_header header;
+ u32 version;
+} __packed;
+
+/* VMBus Version Supported parameters */
+struct vmbus_channel_version_supported {
+ struct vmbus_channel_message_header header;
+ bool version_supported;
+} __packed;
+
+/* Offer Channel parameters */
+struct vmbus_channel_offer_channel {
+ struct vmbus_channel_message_header header;
+ struct vmbus_channel_offer offer;
+ u32 child_relid;
+ u8 monitorid;
+ bool monitor_allocated;
+} __packed;
+
+/* Rescind Offer parameters */
+struct vmbus_channel_rescind_offer {
+ struct vmbus_channel_message_header header;
+ u32 child_relid;
+} __packed;
+
+/*
+ * Request Offer -- no parameters, SynIC message contains the partition ID
+ * Set Snoop -- no parameters, SynIC message contains the partition ID
+ * Clear Snoop -- no parameters, SynIC message contains the partition ID
+ * All Offers Delivered -- no parameters, SynIC message contains the partition
+ * ID
+ * Flush Client -- no parameters, SynIC message contains the partition ID
+ */
+
+/* Open Channel parameters */
+struct vmbus_channel_open_channel {
+ struct vmbus_channel_message_header header;
+
+ /* Identifies the specific VMBus channel that is being opened. */
+ u32 child_relid;
+
+ /* ID making a particular open request at a channel offer unique. */
+ u32 openid;
+
+ /* GPADL for the channel's ring buffer. */
+ u32 ringbuffer_gpadlhandle;
+
+ /* GPADL for the channel's server context save area. */
+ u32 server_contextarea_gpadlhandle;
+
+ /*
+ * The upstream ring buffer begins at offset zero in the memory
+ * described by RingBufferGpadlHandle. The downstream ring buffer
+ * follows it at this offset (in pages).
+ */
+ u32 downstream_ringbuffer_pageoffset;
+
+ /* User-specific data to be passed along to the server endpoint. */
+ unsigned char userdata[MAX_USER_DEFINED_BYTES];
+} __packed;
+
+/* Open Channel Result parameters */
+struct vmbus_channel_open_result {
+ struct vmbus_channel_message_header header;
+ u32 child_relid;
+ u32 openid;
+ u32 status;
+} __packed;
+
+/* Close channel parameters; */
+struct vmbus_channel_close_channel {
+ struct vmbus_channel_message_header header;
+ u32 child_relid;
+} __packed;
+
+/* Channel Message GPADL */
+#define GPADL_TYPE_RING_BUFFER 1
+#define GPADL_TYPE_SERVER_SAVE_AREA 2
+#define GPADL_TYPE_TRANSACTION 8
+
+/*
+ * The number of PFNs in a GPADL message is defined by the number of
+ * pages that would be spanned by ByteCount and ByteOffset. If the
+ * implied number of PFNs won't fit in this packet, there will be a
+ * follow-up packet that contains more.
+ */
+struct vmbus_channel_gpadl_header {
+ struct vmbus_channel_message_header header;
+ u32 child_relid;
+ u32 gpadl;
+ u16 range_buflen;
+ u16 rangecount;
+ struct gpa_range range[0];
+} __packed;
+
+/* This is the followup packet that contains more PFNs. */
+struct vmbus_channel_gpadl_body {
+ struct vmbus_channel_message_header header;
+ u32 msgnumber;
+ u32 gpadl;
+ u64 pfn[0];
+} __packed;
+
+struct vmbus_channel_gpadl_created {
+ struct vmbus_channel_message_header header;
+ u32 child_relid;
+ u32 gpadl;
+ u32 creation_status;
+} __packed;
+
+struct vmbus_channel_gpadl_teardown {
+ struct vmbus_channel_message_header header;
+ u32 child_relid;
+ u32 gpadl;
+} __packed;
+
+struct vmbus_channel_gpadl_torndown {
+ struct vmbus_channel_message_header header;
+ u32 gpadl;
+} __packed;
+
+#ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
+struct vmbus_channel_view_range_add {
+ struct vmbus_channel_message_header header;
+ PHYSICAL_ADDRESS viewrange_base;
+ u64 viewrange_length;
+ u32 child_relid;
+} __packed;
+
+struct vmbus_channel_view_range_remove {
+ struct vmbus_channel_message_header header;
+ PHYSICAL_ADDRESS viewrange_base;
+ u32 child_relid;
+} __packed;
+#endif
+
+struct vmbus_channel_relid_released {
+ struct vmbus_channel_message_header header;
+ u32 child_relid;
+} __packed;
+
+struct vmbus_channel_initiate_contact {
+ struct vmbus_channel_message_header header;
+ u32 vmbus_version_requested;
+ u32 padding2;
+ u64 interrupt_page;
+ u64 monitor_page1;
+ u64 monitor_page2;
+} __packed;
+
+struct vmbus_channel_version_response {
+ struct vmbus_channel_message_header header;
+ bool version_supported;
+} __packed;
+
+enum vmbus_channel_state {
+ CHANNEL_OFFER_STATE,
+ CHANNEL_OPENING_STATE,
+ CHANNEL_OPEN_STATE,
+};
+
+struct vmbus_channel {
+ struct list_head listentry;
+
+ struct hv_device *device_obj;
+
+ struct timer_list poll_timer; /* SA-111 workaround */
+ struct work_struct work;
+
+ enum vmbus_channel_state state;
+
+ struct vmbus_channel_offer_channel offermsg;
+ /*
+ * These are based on the OfferMsg.MonitorId.
+ * Save it here for easy access.
+ */
+ u8 monitor_grp;
+ u8 monitor_bit;
+
+ u32 ringbuffer_gpadlhandle;
+
+ /* Allocated memory for ring buffer */
+ void *ringbuffer_pages;
+ u32 ringbuffer_pagecount;
+ struct hv_ring_buffer_info outbound; /* send to parent */
+ struct hv_ring_buffer_info inbound; /* receive from parent */
+ spinlock_t inbound_lock;
+ struct workqueue_struct *controlwq;
+
+ /* Channel callback are invoked in this workqueue context */
+ /* HANDLE dataWorkQueue; */
+
+ void (*onchannel_callback)(void *context);
+ void *channel_callback_context;
+};
+
+struct vmbus_channel_debug_info {
+ u32 relid;
+ enum vmbus_channel_state state;
+ struct hv_guid interfacetype;
+ struct hv_guid interface_instance;
+ u32 monitorid;
+ u32 servermonitor_pending;
+ u32 servermonitor_latency;
+ u32 servermonitor_connectionid;
+ u32 clientmonitor_pending;
+ u32 clientmonitor_latency;
+ u32 clientmonitor_connectionid;
+
+ struct hv_ring_buffer_debug_info inbound;
+ struct hv_ring_buffer_debug_info outbound;
+};
+
+/*
+ * Represents each channel msg on the vmbus connection This is a
+ * variable-size data structure depending on the msg type itself
+ */
+struct vmbus_channel_msginfo {
+ /* Bookkeeping stuff */
+ struct list_head msglistentry;
+
+ /* So far, this is only used to handle gpadl body message */
+ struct list_head submsglist;
+
+ /* Synchronize the request/response if needed */
+ struct completion waitevent;
+ union {
+ struct vmbus_channel_version_supported version_supported;
+ struct vmbus_channel_open_result open_result;
+ struct vmbus_channel_gpadl_torndown gpadl_torndown;
+ struct vmbus_channel_gpadl_created gpadl_created;
+ struct vmbus_channel_version_response version_response;
+ } response;
+
+ u32 msgsize;
+ /*
+ * The channel message that goes out on the "wire".
+ * It will contain at minimum the VMBUS_CHANNEL_MESSAGE_HEADER header
+ */
+ unsigned char msg[0];
+};
+
+
+void free_channel(struct vmbus_channel *channel);
+
+void vmbus_onmessage(void *context);
+
+int vmbus_request_offers(void);
+

/* The format must be the same as struct vmdata_gpa_direct */
struct vmbus_channel_packet_page_buffer {
--
1.7.4.1

2011-05-10 08:47:28

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 155/206] Staging: hv: Include the contents of ring_buffer.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
include/linux/hyperv.h | 45 ++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 932aafa..d0eec1d 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -30,7 +30,50 @@
#include <linux/timer.h>
#include <linux/workqueue.h>
#include <linux/completion.h>
-#include "ring_buffer.h"
+#include <linux/scatterlist.h>
+
+struct hv_ring_buffer {
+ /* Offset in bytes from the start of ring data below */
+ u32 write_index;
+
+ /* Offset in bytes from the start of ring data below */
+ u32 read_index;
+
+ u32 interrupt_mask;
+
+ /* Pad it to PAGE_SIZE so that data starts on page boundary */
+ u8 reserved[4084];
+
+ /* NOTE:
+ * The interrupt_mask field is used only for channels but since our
+ * vmbus connection also uses this data structure and its data starts
+ * here, we commented out this field.
+ */
+
+ /*
+ * Ring data starts here + RingDataStartOffset
+ * !!! DO NOT place any fields below this !!!
+ */
+ u8 buffer[0];
+} __packed;
+
+struct hv_ring_buffer_info {
+ struct hv_ring_buffer *ring_buffer;
+ u32 ring_size; /* Include the shared header */
+ spinlock_t ring_lock;
+
+ u32 ring_datasize; /* < ring_size */
+ u32 ring_data_startoffset;
+};
+
+struct hv_ring_buffer_debug_info {
+ u32 current_interrupt_mask;
+ u32 current_read_index;
+ u32 current_write_index;
+ u32 bytes_avail_toread;
+ u32 bytes_avail_towrite;
+};
+
#include "vmbus_channel_interface.h"
#include "vmbus_packet_format.h"

--
1.7.4.1

2011-05-10 08:44:15

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 156/206] Staging: hv: Include the contents of vmbus_channel_interface.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
include/linux/hyperv.h | 64 +++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 63 insertions(+), 1 deletions(-)

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index d0eec1d..4872ba8 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -74,7 +74,69 @@ struct hv_ring_buffer_debug_info {
u32 bytes_avail_towrite;
};

-#include "vmbus_channel_interface.h"
+
+/*
+ * A revision number of vmbus that is used for ensuring both ends on a
+ * partition are using compatible versions.
+ */
+#define VMBUS_REVISION_NUMBER 13
+
+/* Make maximum size of pipe payload of 16K */
+#define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384)
+
+/* Define PipeMode values. */
+#define VMBUS_PIPE_TYPE_BYTE 0x00000000
+#define VMBUS_PIPE_TYPE_MESSAGE 0x00000004
+
+/* The size of the user defined data buffer for non-pipe offers. */
+#define MAX_USER_DEFINED_BYTES 120
+
+/* The size of the user defined data buffer for pipe offers. */
+#define MAX_PIPE_USER_DEFINED_BYTES 116
+
+/*
+ * At the center of the Channel Management library is the Channel Offer. This
+ * struct contains the fundamental information about an offer.
+ */
+struct vmbus_channel_offer {
+ struct hv_guid if_type;
+ struct hv_guid if_instance;
+ u64 int_latency; /* in 100ns units */
+ u32 if_revision;
+ u32 server_ctx_size; /* in bytes */
+ u16 chn_flags;
+ u16 mmio_megabytes; /* in bytes * 1024 * 1024 */
+
+ union {
+ /* Non-pipes: The user has MAX_USER_DEFINED_BYTES bytes. */
+ struct {
+ unsigned char user_def[MAX_USER_DEFINED_BYTES];
+ } std;
+
+ /*
+ * Pipes:
+ * The following sructure is an integrated pipe protocol, which
+ * is implemented on top of standard user-defined data. Pipe
+ * clients have MAX_PIPE_USER_DEFINED_BYTES left for their own
+ * use.
+ */
+ struct {
+ u32 pipe_mode;
+ unsigned char user_def[MAX_PIPE_USER_DEFINED_BYTES];
+ } pipe;
+ } u;
+ u32 padding;
+} __packed;
+
+/* Server Flags */
+#define VMBUS_CHANNEL_ENUMERATE_DEVICE_INTERFACE 1
+#define VMBUS_CHANNEL_SERVER_SUPPORTS_TRANSFER_PAGES 2
+#define VMBUS_CHANNEL_SERVER_SUPPORTS_GPADLS 4
+#define VMBUS_CHANNEL_NAMED_PIPE_MODE 0x10
+#define VMBUS_CHANNEL_LOOPBACK_OFFER 0x100
+#define VMBUS_CHANNEL_PARENT_OFFER 0x200
+#define VMBUS_CHANNEL_REQUEST_MONITORED_NOTIFICATION 0x400
+
#include "vmbus_packet_format.h"

/* Version 1 messages */
--
1.7.4.1

2011-05-10 08:47:31

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 157/206] Staging: hv: Include the contents of vmbus_packet_format.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
include/linux/hyperv.h | 134 +++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 133 insertions(+), 1 deletions(-)

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 4872ba8..37fe93e 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -137,7 +137,139 @@ struct vmbus_channel_offer {
#define VMBUS_CHANNEL_PARENT_OFFER 0x200
#define VMBUS_CHANNEL_REQUEST_MONITORED_NOTIFICATION 0x400

-#include "vmbus_packet_format.h"
+struct vmpacket_descriptor {
+ u16 type;
+ u16 offset8;
+ u16 len8;
+ u16 flags;
+ u64 trans_id;
+} __packed;
+
+struct vmpacket_header {
+ u32 prev_pkt_start_offset;
+ struct vmpacket_descriptor descriptor;
+} __packed;
+
+struct vmtransfer_page_range {
+ u32 byte_count;
+ u32 byte_offset;
+} __packed;
+
+struct vmtransfer_page_packet_header {
+ struct vmpacket_descriptor d;
+ u16 xfer_pageset_id;
+ bool sender_owns_set;
+ u8 reserved;
+ u32 range_cnt;
+ struct vmtransfer_page_range ranges[1];
+} __packed;
+
+struct vmgpadl_packet_header {
+ struct vmpacket_descriptor d;
+ u32 gpadl;
+ u32 reserved;
+} __packed;
+
+struct vmadd_remove_transfer_page_set {
+ struct vmpacket_descriptor d;
+ u32 gpadl;
+ u16 xfer_pageset_id;
+ u16 reserved;
+} __packed;
+
+/*
+ * This structure defines a range in guest physical space that can be made to
+ * look virtually contiguous.
+ */
+struct gpa_range {
+ u32 byte_count;
+ u32 byte_offset;
+ u64 pfn_array[0];
+};
+
+/*
+ * This is the format for an Establish Gpadl packet, which contains a handle by
+ * which this GPADL will be known and a set of GPA ranges associated with it.
+ * This can be converted to a MDL by the guest OS. If there are multiple GPA
+ * ranges, then the resulting MDL will be "chained," representing multiple VA
+ * ranges.
+ */
+struct vmestablish_gpadl {
+ struct vmpacket_descriptor d;
+ u32 gpadl;
+ u32 range_cnt;
+ struct gpa_range range[1];
+} __packed;
+
+/*
+ * This is the format for a Teardown Gpadl packet, which indicates that the
+ * GPADL handle in the Establish Gpadl packet will never be referenced again.
+ */
+struct vmteardown_gpadl {
+ struct vmpacket_descriptor d;
+ u32 gpadl;
+ u32 reserved; /* for alignment to a 8-byte boundary */
+} __packed;
+
+/*
+ * This is the format for a GPA-Direct packet, which contains a set of GPA
+ * ranges, in addition to commands and/or data.
+ */
+struct vmdata_gpa_direct {
+ struct vmpacket_descriptor d;
+ u32 reserved;
+ u32 range_cnt;
+ struct gpa_range range[1];
+} __packed;
+
+/* This is the format for a Additional Data Packet. */
+struct vmadditional_data {
+ struct vmpacket_descriptor d;
+ u64 total_bytes;
+ u32 offset;
+ u32 byte_cnt;
+ unsigned char data[1];
+} __packed;
+
+union vmpacket_largest_possible_header {
+ struct vmpacket_descriptor simple_hdr;
+ struct vmtransfer_page_packet_header xfer_page_hdr;
+ struct vmgpadl_packet_header gpadl_hdr;
+ struct vmadd_remove_transfer_page_set add_rm_xfer_page_hdr;
+ struct vmestablish_gpadl establish_gpadl_hdr;
+ struct vmteardown_gpadl teardown_gpadl_hdr;
+ struct vmdata_gpa_direct data_gpa_direct_hdr;
+};
+
+#define VMPACKET_DATA_START_ADDRESS(__packet) \
+ (void *)(((unsigned char *)__packet) + \
+ ((struct vmpacket_descriptor)__packet)->offset8 * 8)
+
+#define VMPACKET_DATA_LENGTH(__packet) \
+ ((((struct vmpacket_descriptor)__packet)->len8 - \
+ ((struct vmpacket_descriptor)__packet)->offset8) * 8)
+
+#define VMPACKET_TRANSFER_MODE(__packet) \
+ (((struct IMPACT)__packet)->type)
+
+enum vmbus_packet_type {
+ VM_PKT_INVALID = 0x0,
+ VM_PKT_SYNCH = 0x1,
+ VM_PKT_ADD_XFER_PAGESET = 0x2,
+ VM_PKT_RM_XFER_PAGESET = 0x3,
+ VM_PKT_ESTABLISH_GPADL = 0x4,
+ VM_PKT_TEARDOWN_GPADL = 0x5,
+ VM_PKT_DATA_INBAND = 0x6,
+ VM_PKT_DATA_USING_XFER_PAGES = 0x7,
+ VM_PKT_DATA_USING_GPADL = 0x8,
+ VM_PKT_DATA_USING_GPA_DIRECT = 0x9,
+ VM_PKT_CANCEL_REQUEST = 0xa,
+ VM_PKT_COMP = 0xb,
+ VM_PKT_DATA_USING_ADDITIONAL_PKT = 0xc,
+ VM_PKT_ADDITIONAL_DATA = 0xd
+};
+
+#define VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED 1

/* Version 1 messages */
enum vmbus_channel_message_type {
--
1.7.4.1

2011-05-10 08:49:38

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 158/206] Staging: hv: Include the contents of logging.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
include/linux/hyperv.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 37fe93e..2e72a47 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -636,4 +636,74 @@ extern void vmbus_get_debug_info(struct vmbus_channel *channel,

extern void vmbus_ontimer(unsigned long data);

+
+#define LOWORD(dw) ((unsigned short)(dw))
+#define HIWORD(dw) ((unsigned short)(((unsigned int) (dw) >> 16) & 0xFFFF))
+
+
+
+#define VMBUS 0x0001
+#define STORVSC 0x0002
+#define NETVSC 0x0004
+#define INPUTVSC 0x0008
+#define BLKVSC 0x0010
+#define VMBUS_DRV 0x0100
+#define STORVSC_DRV 0x0200
+#define NETVSC_DRV 0x0400
+#define INPUTVSC_DRV 0x0800
+#define BLKVSC_DRV 0x1000
+
+#define ALL_MODULES (VMBUS |\
+ STORVSC |\
+ NETVSC |\
+ INPUTVSC |\
+ BLKVSC |\
+ VMBUS_DRV |\
+ STORVSC_DRV |\
+ NETVSC_DRV |\
+ INPUTVSC_DRV|\
+ BLKVSC_DRV)
+
+/* Logging Level */
+#define ERROR_LVL 3
+#define WARNING_LVL 4
+#define INFO_LVL 6
+#define DEBUG_LVL 7
+#define DEBUG_LVL_ENTEREXIT 8
+#define DEBUG_RING_LVL 9
+
+extern unsigned int vmbus_loglevel;
+
+#define DPRINT(mod, lvl, fmt, args...) do {\
+ if ((mod & (HIWORD(vmbus_loglevel))) && \
+ (lvl <= LOWORD(vmbus_loglevel))) \
+ printk(KERN_DEBUG #mod": %s() " fmt "\n", __func__, ## args);\
+ } while (0)
+
+#define DPRINT_DBG(mod, fmt, args...) do {\
+ if ((mod & (HIWORD(vmbus_loglevel))) && \
+ (DEBUG_LVL <= LOWORD(vmbus_loglevel))) \
+ printk(KERN_DEBUG #mod": %s() " fmt "\n", __func__, ## args);\
+ } while (0)
+
+#define DPRINT_INFO(mod, fmt, args...) do {\
+ if ((mod & (HIWORD(vmbus_loglevel))) && \
+ (INFO_LVL <= LOWORD(vmbus_loglevel))) \
+ printk(KERN_INFO #mod": " fmt "\n", ## args);\
+ } while (0)
+
+#define DPRINT_WARN(mod, fmt, args...) do {\
+ if ((mod & (HIWORD(vmbus_loglevel))) && \
+ (WARNING_LVL <= LOWORD(vmbus_loglevel))) \
+ printk(KERN_WARNING #mod": WARNING! " fmt "\n", ## args);\
+ } while (0)
+
+#define DPRINT_ERR(mod, fmt, args...) do {\
+ if ((mod & (HIWORD(vmbus_loglevel))) && \
+ (ERROR_LVL <= LOWORD(vmbus_loglevel))) \
+ printk(KERN_ERR #mod": %s() ERROR!! " fmt "\n", \
+ __func__, ## args);\
+ } while (0)
+
+
#endif /* _HYPERV_H_ */
--
1.7.4.1

2011-05-10 08:41:43

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 159/206] Staging: hv: Include the contents of version_info.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
include/linux/hyperv.h | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 2e72a47..fc05036 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -706,4 +706,24 @@ extern unsigned int vmbus_loglevel;
} while (0)


+/*
+ * We use the same version numbering for all Hyper-V modules.
+ *
+ * Definition of versioning is as follows;
+ *
+ * Major Number Changes for these scenarios;
+ * 1. When a new version of Windows Hyper-V
+ * is released.
+ * 2. A Major change has occurred in the
+ * Linux IC's.
+ * (For example the merge for the first time
+ * into the kernel) Every time the Major Number
+ * changes, the Revision number is reset to 0.
+ * Minor Number Changes when new functionality is added
+ * to the Linux IC's that is not a bug fix.
+ *
+ * 3.1 - Added completed hv_utils driver. Shutdown/Heartbeat/Timesync
+ */
+#define HV_DRV_VERSION "3.1"
+
#endif /* _HYPERV_H_ */
--
1.7.4.1

2011-05-10 08:49:39

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 160/206] Staging: hv: Add the contents of vmbus_api.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
include/linux/hyperv.h | 95 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 95 insertions(+), 0 deletions(-)

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index fc05036..3707fcb 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -32,6 +32,36 @@
#include <linux/completion.h>
#include <linux/scatterlist.h>

+#define MAX_PAGE_BUFFER_COUNT 16
+#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */
+
+#pragma pack(push, 1)
+
+/* Single-page buffer */
+struct hv_page_buffer {
+ u32 len;
+ u32 offset;
+ u64 pfn;
+};
+
+/* Multiple-page buffer */
+struct hv_multipage_buffer {
+ /* Length and Offset determines the # of pfns in the array */
+ u32 len;
+ u32 offset;
+ u64 pfn_array[MAX_MULTIPAGE_BUFFER_COUNT];
+};
+
+/* 0x18 includes the proprietary packet header */
+#define MAX_PAGE_BUFFER_PACKET (0x18 + \
+ (sizeof(struct hv_page_buffer) * \
+ MAX_PAGE_BUFFER_COUNT))
+#define MAX_MULTIPAGE_BUFFER_PACKET (0x18 + \
+ sizeof(struct hv_multipage_buffer))
+
+
+#pragma pack(pop)
+
struct hv_ring_buffer {
/* Offset in bytes from the start of ring data below */
u32 write_index;
@@ -726,4 +756,69 @@ extern unsigned int vmbus_loglevel;
*/
#define HV_DRV_VERSION "3.1"

+
+#include <linux/device.h>
+#include <linux/workqueue.h>
+
+
+struct hv_driver;
+struct hv_device;
+
+struct hv_dev_port_info {
+ u32 int_mask;
+ u32 read_idx;
+ u32 write_idx;
+ u32 bytes_avail_toread;
+ u32 bytes_avail_towrite;
+};
+
+struct hv_device_info {
+ u32 chn_id;
+ u32 chn_state;
+ struct hv_guid chn_type;
+ struct hv_guid chn_instance;
+
+ u32 monitor_id;
+ u32 server_monitor_pending;
+ u32 server_monitor_latency;
+ u32 server_monitor_conn_id;
+ u32 client_monitor_pending;
+ u32 client_monitor_latency;
+ u32 client_monitor_conn_id;
+
+ struct hv_dev_port_info inbound;
+ struct hv_dev_port_info outbound;
+};
+
+/* Base driver object */
+struct hv_driver {
+ const char *name;
+
+ /* the device type supported by this driver */
+ struct hv_guid dev_type;
+
+ struct device_driver driver;
+
+ int (*probe)(struct hv_device *);
+ int (*remove)(struct hv_device *);
+ void (*shutdown)(struct hv_device *);
+
+};
+
+/* Base device object */
+struct hv_device {
+ /* the device type id of this device */
+ struct hv_guid dev_type;
+
+ /* the device instance id of this device */
+ struct hv_guid dev_instance;
+
+ struct device device;
+
+ struct vmbus_channel *channel;
+
+ /* Device extension; */
+ void *ext;
+};
+
#endif /* _HYPERV_H_ */
--
1.7.4.1

2011-05-10 09:55:17

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 161/206] Staging: hv: Include the contents of vmbus.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
include/linux/hyperv.h | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 3707fcb..2751b10 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -821,4 +821,26 @@ struct hv_device {
void *ext;
};

+#include <linux/device.h>
+
+
+
+
+static inline struct hv_device *device_to_hv_device(struct device *d)
+{
+ return container_of(d, struct hv_device, device);
+}
+
+static inline struct hv_driver *drv_to_hv_drv(struct device_driver *d)
+{
+ return container_of(d, struct hv_driver, driver);
+}
+
+
+int vmbus_child_driver_register(struct device_driver *drv);
+void vmbus_child_driver_unregister(struct device_driver *drv);
+
+extern struct completion hv_channel_ready;
+
+
#endif /* _HYPERV_H_ */
--
1.7.4.1

2011-05-10 09:54:15

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 162/206] Staging: hv: Cleanup the newly created header file

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
include/linux/hyperv.h | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 2751b10..f91e3a4 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -31,6 +31,7 @@
#include <linux/workqueue.h>
#include <linux/completion.h>
#include <linux/scatterlist.h>
+#include <linux/device.h>

#define MAX_PAGE_BUFFER_COUNT 16
#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */
@@ -757,8 +758,6 @@ extern unsigned int vmbus_loglevel;
#define HV_DRV_VERSION "3.1"


-#include <linux/device.h>
-#include <linux/workqueue.h>


struct hv_driver;
@@ -821,11 +820,6 @@ struct hv_device {
void *ext;
};

-#include <linux/device.h>
-
-
-
-
static inline struct hv_device *device_to_hv_device(struct device *d)
{
return container_of(d, struct hv_device, device);
--
1.7.4.1

2011-05-10 08:31:16

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 163/206] Staging: hv: Include asm/hyperv.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
include/linux/hyperv.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index f91e3a4..92369b9 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -32,6 +32,7 @@
#include <linux/completion.h>
#include <linux/scatterlist.h>
#include <linux/device.h>
+#include <asm/hyperv.h>

#define MAX_PAGE_BUFFER_COUNT 16
#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */
--
1.7.4.1

2011-05-10 09:56:21

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 164/206] Staging: hv: Add the definition hv_guid

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
include/linux/hyperv.h | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 92369b9..81f8742 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -34,6 +34,10 @@
#include <linux/device.h>
#include <asm/hyperv.h>

+struct hv_guid {
+ unsigned char data[16];
+};
+
#define MAX_PAGE_BUFFER_COUNT 16
#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */

--
1.7.4.1

2011-05-10 08:47:24

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 165/206] Staging: hv: Add a new header file to include all header files private to vmbus core

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hyperv_vmbus.h | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
create mode 100644 drivers/staging/hv/hyperv_vmbus.h

diff --git a/drivers/staging/hv/hyperv_vmbus.h b/drivers/staging/hv/hyperv_vmbus.h
new file mode 100644
index 0000000..ce27244
--- /dev/null
+++ b/drivers/staging/hv/hyperv_vmbus.h
@@ -0,0 +1,23 @@
+/*
+ *
+ * Copyright (c) 2011, Microsoft Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * Authors:
+ * Haiyang Zhang <[email protected]>
+ * Hank Janssen <[email protected]>
+ * K. Y. Srinivasan <[email protected]>
+ *
+ */
--
1.7.4.1

2011-05-10 08:51:10

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 166/206] Staging: hv: Include a subset of the contents of hv_api.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hyperv_vmbus.h | 372 +++++++++++++++++++++++++++++++++++++
1 files changed, 372 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/hv/hyperv_vmbus.h b/drivers/staging/hv/hyperv_vmbus.h
index ce27244..5df7c82 100644
--- a/drivers/staging/hv/hyperv_vmbus.h
+++ b/drivers/staging/hv/hyperv_vmbus.h
@@ -21,3 +21,375 @@
* K. Y. Srinivasan <[email protected]>
*
*/
+
+#ifndef _HYPERV_VMBUS_H
+#define _HYPERV_VMBUS_H
+
+#include <linux/hyperv.h>
+
+/*
+ * The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent
+ * is set by CPUID(HVCPUID_VERSION_FEATURES).
+ */
+enum hv_cpuid_function {
+ HVCPUID_VERSION_FEATURES = 0x00000001,
+ HVCPUID_VENDOR_MAXFUNCTION = 0x40000000,
+ HVCPUID_INTERFACE = 0x40000001,
+
+ /*
+ * The remaining functions depend on the value of
+ * HVCPUID_INTERFACE
+ */
+ HVCPUID_VERSION = 0x40000002,
+ HVCPUID_FEATURES = 0x40000003,
+ HVCPUID_ENLIGHTENMENT_INFO = 0x40000004,
+ HVCPUID_IMPLEMENTATION_LIMITS = 0x40000005,
+};
+
+/* Define version of the synthetic interrupt controller. */
+#define HV_SYNIC_VERSION (1)
+
+/* Define the expected SynIC version. */
+#define HV_SYNIC_VERSION_1 (0x1)
+
+/* Define synthetic interrupt controller message constants. */
+#define HV_MESSAGE_SIZE (256)
+#define HV_MESSAGE_PAYLOAD_BYTE_COUNT (240)
+#define HV_MESSAGE_PAYLOAD_QWORD_COUNT (30)
+#define HV_ANY_VP (0xFFFFFFFF)
+
+/* Define synthetic interrupt controller flag constants. */
+#define HV_EVENT_FLAGS_COUNT (256 * 8)
+#define HV_EVENT_FLAGS_BYTE_COUNT (256)
+#define HV_EVENT_FLAGS_DWORD_COUNT (256 / sizeof(u32))
+
+/* Define hypervisor message types. */
+enum hv_message_type {
+ HVMSG_NONE = 0x00000000,
+
+ /* Memory access messages. */
+ HVMSG_UNMAPPED_GPA = 0x80000000,
+ HVMSG_GPA_INTERCEPT = 0x80000001,
+
+ /* Timer notification messages. */
+ HVMSG_TIMER_EXPIRED = 0x80000010,
+
+ /* Error messages. */
+ HVMSG_INVALID_VP_REGISTER_VALUE = 0x80000020,
+ HVMSG_UNRECOVERABLE_EXCEPTION = 0x80000021,
+ HVMSG_UNSUPPORTED_FEATURE = 0x80000022,
+
+ /* Trace buffer complete messages. */
+ HVMSG_EVENTLOG_BUFFERCOMPLETE = 0x80000040,
+
+ /* Platform-specific processor intercept messages. */
+ HVMSG_X64_IOPORT_INTERCEPT = 0x80010000,
+ HVMSG_X64_MSR_INTERCEPT = 0x80010001,
+ HVMSG_X64_CPUID_INTERCEPT = 0x80010002,
+ HVMSG_X64_EXCEPTION_INTERCEPT = 0x80010003,
+ HVMSG_X64_APIC_EOI = 0x80010004,
+ HVMSG_X64_LEGACY_FP_ERROR = 0x80010005
+};
+
+/* Define the number of synthetic interrupt sources. */
+#define HV_SYNIC_SINT_COUNT (16)
+#define HV_SYNIC_STIMER_COUNT (4)
+
+/* Define invalid partition identifier. */
+#define HV_PARTITION_ID_INVALID ((u64)0x0)
+
+/* Define connection identifier type. */
+union hv_connection_id {
+ u32 asu32;
+ struct {
+ u32 id:24;
+ u32 reserved:8;
+ } u;
+};
+
+/* Define port identifier type. */
+union hv_port_id {
+ u32 asu32;
+ struct {
+ u32 id:24;
+ u32 reserved:8;
+ } u ;
+};
+
+/* Define port type. */
+enum hv_port_type {
+ HVPORT_MSG = 1,
+ HVPORT_EVENT = 2,
+ HVPORT_MONITOR = 3
+};
+
+/* Define port information structure. */
+struct hv_port_info {
+ enum hv_port_type port_type;
+ u32 padding;
+ union {
+ struct {
+ u32 target_sint;
+ u32 target_vp;
+ u64 rsvdz;
+ } message_port_info;
+ struct {
+ u32 target_sint;
+ u32 target_vp;
+ u16 base_flag_bumber;
+ u16 flag_count;
+ u32 rsvdz;
+ } event_port_info;
+ struct {
+ u64 monitor_address;
+ u64 rsvdz;
+ } monitor_port_info;
+ };
+};
+
+struct hv_connection_info {
+ enum hv_port_type port_type;
+ u32 padding;
+ union {
+ struct {
+ u64 rsvdz;
+ } message_connection_info;
+ struct {
+ u64 rsvdz;
+ } event_connection_info;
+ struct {
+ u64 monitor_address;
+ } monitor_connection_info;
+ };
+};
+
+/* Define synthetic interrupt controller message flags. */
+union hv_message_flags {
+ u8 asu8;
+ struct {
+ u8 msg_pending:1;
+ u8 reserved:7;
+ };
+};
+
+/* Define synthetic interrupt controller message header. */
+struct hv_message_header {
+ enum hv_message_type message_type;
+ u8 payload_size;
+ union hv_message_flags message_flags;
+ u8 reserved[2];
+ union {
+ u64 sender;
+ union hv_port_id port;
+ };
+};
+
+/* Define timer message payload structure. */
+struct hv_timer_message_payload {
+ u32 timer_index;
+ u32 reserved;
+ u64 expiration_time; /* When the timer expired */
+ u64 delivery_time; /* When the message was delivered */
+};
+
+/* Define synthetic interrupt controller message format. */
+struct hv_message {
+ struct hv_message_header header;
+ union {
+ u64 payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT];
+ } u ;
+};
+
+/* Define the number of message buffers associated with each port. */
+#define HV_PORT_MESSAGE_BUFFER_COUNT (16)
+
+/* Define the synthetic interrupt message page layout. */
+struct hv_message_page {
+ struct hv_message sint_message[HV_SYNIC_SINT_COUNT];
+};
+
+/* Define the synthetic interrupt controller event flags format. */
+union hv_synic_event_flags {
+ u8 flags8[HV_EVENT_FLAGS_BYTE_COUNT];
+ u32 flags32[HV_EVENT_FLAGS_DWORD_COUNT];
+};
+
+/* Define the synthetic interrupt flags page layout. */
+struct hv_synic_event_flags_page {
+ union hv_synic_event_flags sintevent_flags[HV_SYNIC_SINT_COUNT];
+};
+
+/* Define SynIC control register. */
+union hv_synic_scontrol {
+ u64 as_uint64;
+ struct {
+ u64 enable:1;
+ u64 reserved:63;
+ };
+};
+
+/* Define synthetic interrupt source. */
+union hv_synic_sint {
+ u64 as_uint64;
+ struct {
+ u64 vector:8;
+ u64 reserved1:8;
+ u64 masked:1;
+ u64 auto_eoi:1;
+ u64 reserved2:46;
+ };
+};
+
+/* Define the format of the SIMP register */
+union hv_synic_simp {
+ u64 as_uint64;
+ struct {
+ u64 simp_enabled:1;
+ u64 preserved:11;
+ u64 base_simp_gpa:52;
+ };
+};
+
+/* Define the format of the SIEFP register */
+union hv_synic_siefp {
+ u64 as_uint64;
+ struct {
+ u64 siefp_enabled:1;
+ u64 preserved:11;
+ u64 base_siefp_gpa:52;
+ };
+};
+
+/* Definitions for the monitored notification facility */
+union hv_monitor_trigger_group {
+ u64 as_uint64;
+ struct {
+ u32 pending;
+ u32 armed;
+ };
+};
+
+struct hv_monitor_parameter {
+ union hv_connection_id connectionid;
+ u16 flagnumber;
+ u16 rsvdz;
+};
+
+union hv_monitor_trigger_state {
+ u32 asu32;
+
+ struct {
+ u32 group_enable:4;
+ u32 rsvdz:28;
+ };
+};
+
+/* struct hv_monitor_page Layout */
+/* ------------------------------------------------------ */
+/* | 0 | TriggerState (4 bytes) | Rsvd1 (4 bytes) | */
+/* | 8 | TriggerGroup[0] | */
+/* | 10 | TriggerGroup[1] | */
+/* | 18 | TriggerGroup[2] | */
+/* | 20 | TriggerGroup[3] | */
+/* | 28 | Rsvd2[0] | */
+/* | 30 | Rsvd2[1] | */
+/* | 38 | Rsvd2[2] | */
+/* | 40 | NextCheckTime[0][0] | NextCheckTime[0][1] | */
+/* | ... | */
+/* | 240 | Latency[0][0..3] | */
+/* | 340 | Rsvz3[0] | */
+/* | 440 | Parameter[0][0] | */
+/* | 448 | Parameter[0][1] | */
+/* | ... | */
+/* | 840 | Rsvd4[0] | */
+/* ------------------------------------------------------ */
+struct hv_monitor_page {
+ union hv_monitor_trigger_state trigger_state;
+ u32 rsvdz1;
+
+ union hv_monitor_trigger_group trigger_group[4];
+ u64 rsvdz2[3];
+
+ s32 next_checktime[4][32];
+
+ u16 latency[4][32];
+ u64 rsvdz3[32];
+
+ struct hv_monitor_parameter parameter[4][32];
+
+ u8 rsvdz4[1984];
+};
+
+/* Declare the various hypercall operations. */
+enum hv_call_code {
+ HVCALL_POST_MESSAGE = 0x005c,
+ HVCALL_SIGNAL_EVENT = 0x005d,
+};
+
+/* Definition of the hv_post_message hypercall input structure. */
+struct hv_input_post_message {
+ union hv_connection_id connectionid;
+ u32 reserved;
+ enum hv_message_type message_type;
+ u32 payload_size;
+ u64 payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT];
+};
+
+/* Definition of the hv_signal_event hypercall input structure. */
+struct hv_input_signal_event {
+ union hv_connection_id connectionid;
+ u16 flag_number;
+ u16 rsvdz;
+};
+
+/*
+ * Versioning definitions used for guests reporting themselves to the
+ * hypervisor, and visa versa.
+ */
+
+/* Version info reported by guest OS's */
+enum hv_guest_os_vendor {
+ HVGUESTOS_VENDOR_MICROSOFT = 0x0001
+};
+
+enum hv_guest_os_microsoft_ids {
+ HVGUESTOS_MICROSOFT_UNDEFINED = 0x00,
+ HVGUESTOS_MICROSOFT_MSDOS = 0x01,
+ HVGUESTOS_MICROSOFT_WINDOWS3X = 0x02,
+ HVGUESTOS_MICROSOFT_WINDOWS9X = 0x03,
+ HVGUESTOS_MICROSOFT_WINDOWSNT = 0x04,
+ HVGUESTOS_MICROSOFT_WINDOWSCE = 0x05
+};
+
+/*
+ * Declare the MSR used to identify the guest OS.
+ */
+#define HV_X64_MSR_GUEST_OS_ID 0x40000000
+
+union hv_x64_msr_guest_os_id_contents {
+ u64 as_uint64;
+ struct {
+ u64 build_number:16;
+ u64 service_version:8; /* Service Pack, etc. */
+ u64 minor_version:8;
+ u64 major_version:8;
+ u64 os_id:8; /* enum hv_guest_os_microsoft_ids (if Vendor=MS) */
+ u64 vendor_id:16; /* enum hv_guest_os_vendor */
+ };
+};
+
+/*
+ * Declare the MSR used to setup pages used to communicate with the hypervisor.
+ */
+#define HV_X64_MSR_HYPERCALL 0x40000001
+
+union hv_x64_msr_hypercall_contents {
+ u64 as_uint64;
+ struct {
+ u64 enable:1;
+ u64 reserved:11;
+ u64 guest_physical_address:52;
+ };
+};
+
+#endif /* _HYPERV_VMBUS_H */
--
1.7.4.1

2011-05-10 09:54:13

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 167/206] Staging: hv: Add the contents of hv_api.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hyperv_vmbus.h | 113 +++++++++++++++++++++++++++++++++++++
1 files changed, 113 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/hv/hyperv_vmbus.h b/drivers/staging/hv/hyperv_vmbus.h
index 5df7c82..ea06691 100644
--- a/drivers/staging/hv/hyperv_vmbus.h
+++ b/drivers/staging/hv/hyperv_vmbus.h
@@ -392,4 +392,117 @@ union hv_x64_msr_hypercall_contents {
};
};

+
+#include "hv_api.h"
+
+enum {
+ VMBUS_MESSAGE_CONNECTION_ID = 1,
+ VMBUS_MESSAGE_PORT_ID = 1,
+ VMBUS_EVENT_CONNECTION_ID = 2,
+ VMBUS_EVENT_PORT_ID = 2,
+ VMBUS_MONITOR_CONNECTION_ID = 3,
+ VMBUS_MONITOR_PORT_ID = 3,
+ VMBUS_MESSAGE_SINT = 2,
+};
+
+/* #defines */
+
+#define HV_PRESENT_BIT 0x80000000
+
+#define HV_LINUX_GUEST_ID_LO 0x00000000
+#define HV_LINUX_GUEST_ID_HI 0xB16B00B5
+#define HV_LINUX_GUEST_ID (((u64)HV_LINUX_GUEST_ID_HI << 32) | \
+ HV_LINUX_GUEST_ID_LO)
+
+#define HV_CPU_POWER_MANAGEMENT (1 << 0)
+#define HV_RECOMMENDATIONS_MAX 4
+
+#define HV_X64_MAX 5
+#define HV_CAPS_MAX 8
+
+
+#define HV_HYPERCALL_PARAM_ALIGN sizeof(u64)
+
+
+/* Service definitions */
+
+#define HV_SERVICE_PARENT_PORT (0)
+#define HV_SERVICE_PARENT_CONNECTION (0)
+
+#define HV_SERVICE_CONNECT_RESPONSE_SUCCESS (0)
+#define HV_SERVICE_CONNECT_RESPONSE_INVALID_PARAMETER (1)
+#define HV_SERVICE_CONNECT_RESPONSE_UNKNOWN_SERVICE (2)
+#define HV_SERVICE_CONNECT_RESPONSE_CONNECTION_REJECTED (3)
+
+#define HV_SERVICE_CONNECT_REQUEST_MESSAGE_ID (1)
+#define HV_SERVICE_CONNECT_RESPONSE_MESSAGE_ID (2)
+#define HV_SERVICE_DISCONNECT_REQUEST_MESSAGE_ID (3)
+#define HV_SERVICE_DISCONNECT_RESPONSE_MESSAGE_ID (4)
+#define HV_SERVICE_MAX_MESSAGE_ID (4)
+
+#define HV_SERVICE_PROTOCOL_VERSION (0x0010)
+#define HV_CONNECT_PAYLOAD_BYTE_COUNT 64
+
+/* #define VMBUS_REVISION_NUMBER 6 */
+
+/* Our local vmbus's port and connection id. Anything >0 is fine */
+/* #define VMBUS_PORT_ID 11 */
+
+/* 628180B8-308D-4c5e-B7DB-1BEB62E62EF4 */
+static const struct hv_guid VMBUS_SERVICE_ID = {
+ .data = {
+ 0xb8, 0x80, 0x81, 0x62, 0x8d, 0x30, 0x5e, 0x4c,
+ 0xb7, 0xdb, 0x1b, 0xeb, 0x62, 0xe6, 0x2e, 0xf4
+ },
+};
+
+#define MAX_NUM_CPUS 32
+
+
+struct hv_input_signal_event_buffer {
+ u64 align8;
+ struct hv_input_signal_event event;
+};
+
+struct hv_context {
+ /* We only support running on top of Hyper-V
+ * So at this point this really can only contain the Hyper-V ID
+ */
+ u64 guestid;
+
+ void *hypercall_page;
+
+ bool synic_initialized;
+
+ /*
+ * This is used as an input param to HvCallSignalEvent hypercall. The
+ * input param is immutable in our usage and must be dynamic mem (vs
+ * stack or global). */
+ struct hv_input_signal_event_buffer *signal_event_buffer;
+ /* 8-bytes aligned of the buffer above */
+ struct hv_input_signal_event *signal_event_param;
+
+ void *synic_message_page[MAX_NUM_CPUS];
+ void *synic_event_page[MAX_NUM_CPUS];
+};
+
+extern struct hv_context hv_context;
+
+
+/* Hv Interface */
+
+extern int hv_init(void);
+
+extern void hv_cleanup(void);
+
+extern u16 hv_post_message(union hv_connection_id connection_id,
+ enum hv_message_type message_type,
+ void *payload, size_t payload_size);
+
+extern u16 hv_signal_event(void);
+
+extern void hv_synic_init(void *irqarg);
+
+extern void hv_synic_cleanup(void *arg);
+
#endif /* _HYPERV_VMBUS_H */
--
1.7.4.1

2011-05-10 09:54:11

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 168/206] Staging: hv: Add the ringbuffer interfaces

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hyperv_vmbus.h | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/hv/hyperv_vmbus.h b/drivers/staging/hv/hyperv_vmbus.h
index ea06691..bd943fe 100644
--- a/drivers/staging/hv/hyperv_vmbus.h
+++ b/drivers/staging/hv/hyperv_vmbus.h
@@ -505,4 +505,32 @@ extern void hv_synic_init(void *irqarg);

extern void hv_synic_cleanup(void *arg);

+
+/* Interface */
+
+
+int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info, void *buffer,
+ u32 buflen);
+
+void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info);
+
+int hv_ringbuffer_write(struct hv_ring_buffer_info *ring_info,
+ struct scatterlist *sglist,
+ u32 sgcount);
+
+int hv_ringbuffer_peek(struct hv_ring_buffer_info *ring_info, void *buffer,
+ u32 buflen);
+
+int hv_ringbuffer_read(struct hv_ring_buffer_info *ring_info,
+ void *buffer,
+ u32 buflen,
+ u32 offset);
+
+u32 hv_get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *ring_info);
+
+void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix);
+
+void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
+ struct hv_ring_buffer_debug_info *debug_info);
+
#endif /* _HYPERV_VMBUS_H */
--
1.7.4.1

2011-05-10 09:55:20

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 169/206] Staging: hv: Include the contents of vmbus_private.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hyperv_vmbus.h | 93 +++++++++++++++++++++++++++++++++++++
1 files changed, 93 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/hv/hyperv_vmbus.h b/drivers/staging/hv/hyperv_vmbus.h
index bd943fe..8ccae84 100644
--- a/drivers/staging/hv/hyperv_vmbus.h
+++ b/drivers/staging/hv/hyperv_vmbus.h
@@ -533,4 +533,97 @@ void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix);
void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
struct hv_ring_buffer_debug_info *debug_info);

+
+#include <asm/sync_bitops.h>
+
+
+/*
+ * Maximum channels is determined by the size of the interrupt page
+ * which is PAGE_SIZE. 1/2 of PAGE_SIZE is for send endpoint interrupt
+ * and the other is receive endpoint interrupt
+ */
+#define MAX_NUM_CHANNELS ((PAGE_SIZE >> 1) << 3) /* 16348 channels */
+
+/* The value here must be in multiple of 32 */
+/* TODO: Need to make this configurable */
+#define MAX_NUM_CHANNELS_SUPPORTED 256
+
+
+enum vmbus_connect_state {
+ DISCONNECTED,
+ CONNECTING,
+ CONNECTED,
+ DISCONNECTING
+};
+
+#define MAX_SIZE_CHANNEL_MESSAGE HV_MESSAGE_PAYLOAD_BYTE_COUNT
+
+struct vmbus_connection {
+ enum vmbus_connect_state conn_state;
+
+ atomic_t next_gpadl_handle;
+
+ /*
+ * Represents channel interrupts. Each bit position represents a
+ * channel. When a channel sends an interrupt via VMBUS, it finds its
+ * bit in the sendInterruptPage, set it and calls Hv to generate a port
+ * event. The other end receives the port event and parse the
+ * recvInterruptPage to see which bit is set
+ */
+ void *int_page;
+ void *send_int_page;
+ void *recv_int_page;
+
+ /*
+ * 2 pages - 1st page for parent->child notification and 2nd
+ * is child->parent notification
+ */
+ void *monitor_pages;
+ struct list_head chn_msg_list;
+ spinlock_t channelmsg_lock;
+
+ /* List of channels */
+ struct list_head chn_list;
+ spinlock_t channel_lock;
+
+ struct workqueue_struct *work_queue;
+};
+
+
+struct vmbus_msginfo {
+ /* Bookkeeping stuff */
+ struct list_head msglist_entry;
+
+ /* The message itself */
+ unsigned char msg[0];
+};
+
+
+extern struct vmbus_connection vmbus_connection;
+
+/* General vmbus interface */
+
+struct hv_device *vmbus_child_device_create(struct hv_guid *type,
+ struct hv_guid *instance,
+ struct vmbus_channel *channel);
+
+int vmbus_child_device_register(struct hv_device *child_device_obj);
+void vmbus_child_device_unregister(struct hv_device *device_obj);
+
+struct vmbus_channel *relid2channel(u32 relid);
+
+
+/* Connection interface */
+
+int vmbus_connect(void);
+
+int vmbus_disconnect(void);
+
+int vmbus_post_msg(void *buffer, size_t buflen);
+
+int vmbus_set_event(u32 child_relid);
+
+void vmbus_on_event(unsigned long data);
+
+
#endif /* _HYPERV_VMBUS_H */
--
1.7.4.1

2011-05-10 08:33:11

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 170/206] Staging: hv: Cleanup the newly created header file

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hyperv_vmbus.h | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/hyperv_vmbus.h b/drivers/staging/hv/hyperv_vmbus.h
index 8ccae84..104dc8f 100644
--- a/drivers/staging/hv/hyperv_vmbus.h
+++ b/drivers/staging/hv/hyperv_vmbus.h
@@ -26,6 +26,7 @@
#define _HYPERV_VMBUS_H

#include <linux/hyperv.h>
+#include <asm/sync_bitops.h>

/*
* The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent
@@ -393,8 +394,6 @@ union hv_x64_msr_hypercall_contents {
};


-#include "hv_api.h"
-
enum {
VMBUS_MESSAGE_CONNECTION_ID = 1,
VMBUS_MESSAGE_PORT_ID = 1,
@@ -534,8 +533,6 @@ void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
struct hv_ring_buffer_debug_info *debug_info);


-#include <asm/sync_bitops.h>
-

/*
* Maximum channels is determined by the size of the interrupt page
--
1.7.4.1

2011-05-10 08:33:18

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 171/206] Staging: hv: Create a header file that has all the definitions needed to build Hyper-V storage drivers

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hyperv_storage.h | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
create mode 100644 drivers/staging/hv/hyperv_storage.h

diff --git a/drivers/staging/hv/hyperv_storage.h b/drivers/staging/hv/hyperv_storage.h
new file mode 100644
index 0000000..ce27244
--- /dev/null
+++ b/drivers/staging/hv/hyperv_storage.h
@@ -0,0 +1,23 @@
+/*
+ *
+ * Copyright (c) 2011, Microsoft Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * Authors:
+ * Haiyang Zhang <[email protected]>
+ * Hank Janssen <[email protected]>
+ * K. Y. Srinivasan <[email protected]>
+ *
+ */
--
1.7.4.1

2011-05-10 08:33:14

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 172/206] Staging: hv: Include the contents of vstorage.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hyperv_storage.h | 178 +++++++++++++++++++++++++++++++++++
1 files changed, 178 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/hv/hyperv_storage.h b/drivers/staging/hv/hyperv_storage.h
index ce27244..4324493 100644
--- a/drivers/staging/hv/hyperv_storage.h
+++ b/drivers/staging/hv/hyperv_storage.h
@@ -21,3 +21,181 @@
* K. Y. Srinivasan <[email protected]>
*
*/
+
+/*
+ * vstorage.w revision number. This is used in the case
+ * of a version match, to alert the user that structure sizes may
+ * to alert the user that structure sizes may be mismatched even though the
+ * protocol versions match.
+ */
+
+#ifndef _HYPERV_STORAGE_H
+#define _HYPERV_STORAGE_H
+
+#define REVISION_STRING(REVISION_) #REVISION_
+#define FILL_VMSTOR_REVISION(RESULT_LVALUE_) \
+ do { \
+ char *revision_string \
+ = REVISION_STRING($Rev : 6 $) + 6; \
+ RESULT_LVALUE_ = 0; \
+ while (*revision_string >= '0' \
+ && *revision_string <= '9') { \
+ RESULT_LVALUE_ *= 10; \
+ RESULT_LVALUE_ += *revision_string - '0'; \
+ revision_string++; \
+ } \
+ } while (0)
+
+/* Major/minor macros. Minor version is in LSB, meaning that earlier flat */
+/* version numbers will be interpreted as "0.x" (i.e., 1 becomes 0.1). */
+#define VMSTOR_PROTOCOL_MAJOR(VERSION_) (((VERSION_) >> 8) & 0xff)
+#define VMSTOR_PROTOCOL_MINOR(VERSION_) (((VERSION_)) & 0xff)
+#define VMSTOR_PROTOCOL_VERSION(MAJOR_, MINOR_) ((((MAJOR_) & 0xff) << 8) | \
+ (((MINOR_) & 0xff)))
+#define VMSTOR_INVALID_PROTOCOL_VERSION (-1)
+
+/* Version history: */
+/* V1 Beta 0.1 */
+/* V1 RC < 2008/1/31 1.0 */
+/* V1 RC > 2008/1/31 2.0 */
+#define VMSTOR_PROTOCOL_VERSION_CURRENT VMSTOR_PROTOCOL_VERSION(2, 0)
+
+
+
+
+/* This will get replaced with the max transfer length that is possible on */
+/* the host adapter. */
+/* The max transfer length will be published when we offer a vmbus channel. */
+#define MAX_TRANSFER_LENGTH 0x40000
+#define DEFAULT_PACKET_SIZE (sizeof(struct vmdata_gpa_direct) + \
+ sizeof(struct vstor_packet) + \
+ sizesizeof(u64) * (MAX_TRANSFER_LENGTH / PAGE_SIZE)))
+
+
+/* Packet structure describing virtual storage requests. */
+enum vstor_packet_operation {
+ VSTOR_OPERATION_COMPLETE_IO = 1,
+ VSTOR_OPERATION_REMOVE_DEVICE = 2,
+ VSTOR_OPERATION_EXECUTE_SRB = 3,
+ VSTOR_OPERATION_RESET_LUN = 4,
+ VSTOR_OPERATION_RESET_ADAPTER = 5,
+ VSTOR_OPERATION_RESET_BUS = 6,
+ VSTOR_OPERATION_BEGIN_INITIALIZATION = 7,
+ VSTOR_OPERATION_END_INITIALIZATION = 8,
+ VSTOR_OPERATION_QUERY_PROTOCOL_VERSION = 9,
+ VSTOR_OPERATION_QUERY_PROPERTIES = 10,
+ VSTOR_OPERATION_MAXIMUM = 10
+};
+
+/*
+ * Platform neutral description of a scsi request -
+ * this remains the same across the write regardless of 32/64 bit
+ * note: it's patterned off the SCSI_PASS_THROUGH structure
+ */
+#define CDB16GENERIC_LENGTH 0x10
+
+#ifndef SENSE_BUFFER_SIZE
+#define SENSE_BUFFER_SIZE 0x12
+#endif
+
+#define MAX_DATA_BUF_LEN_WITH_PADDING 0x14
+
+struct vmscsi_request {
+ unsigned short length;
+ unsigned char srb_status;
+ unsigned char scsi_status;
+
+ unsigned char port_number;
+ unsigned char path_id;
+ unsigned char target_id;
+ unsigned char lun;
+
+ unsigned char cdb_length;
+ unsigned char sense_info_length;
+ unsigned char data_in;
+ unsigned char reserved;
+
+ unsigned int data_transfer_length;
+
+ union {
+ unsigned char cdb[CDB16GENERIC_LENGTH];
+ unsigned char sense_data[SENSE_BUFFER_SIZE];
+ unsigned char reserved_array[MAX_DATA_BUF_LEN_WITH_PADDING];
+ };
+} __attribute((packed));
+
+
+/*
+ * This structure is sent during the intialization phase to get the different
+ * properties of the channel.
+ */
+struct vmstorage_channel_properties {
+ unsigned short protocol_version;
+ unsigned char path_id;
+ unsigned char target_id;
+
+ /* Note: port number is only really known on the client side */
+ unsigned int port_number;
+ unsigned int flags;
+ unsigned int max_transfer_bytes;
+
+ /* This id is unique for each channel and will correspond with */
+ /* vendor specific data in the inquirydata */
+ unsigned long long unique_id;
+} __packed;
+
+/* This structure is sent during the storage protocol negotiations. */
+struct vmstorage_protocol_version {
+ /* Major (MSW) and minor (LSW) version numbers. */
+ unsigned short major_minor;
+
+ /*
+ * Revision number is auto-incremented whenever this file is changed
+ * (See FILL_VMSTOR_REVISION macro above). Mismatch does not
+ * definitely indicate incompatibility--but it does indicate mismatched
+ * builds.
+ */
+ unsigned short revision;
+} __packed;
+
+/* Channel Property Flags */
+#define STORAGE_CHANNEL_REMOVABLE_FLAG 0x1
+#define STORAGE_CHANNEL_EMULATED_IDE_FLAG 0x2
+
+struct vstor_packet {
+ /* Requested operation type */
+ enum vstor_packet_operation operation;
+
+ /* Flags - see below for values */
+ unsigned int flags;
+
+ /* Status of the request returned from the server side. */
+ unsigned int status;
+
+ /* Data payload area */
+ union {
+ /*
+ * Structure used to forward SCSI commands from the
+ * client to the server.
+ */
+ struct vmscsi_request vm_srb;
+
+ /* Structure used to query channel properties. */
+ struct vmstorage_channel_properties storage_channel_properties;
+
+ /* Used during version negotiations. */
+ struct vmstorage_protocol_version version;
+ };
+} __packed;
+
+/* Packet flags */
+/*
+ * This flag indicates that the server should send back a completion for this
+ * packet.
+ */
+#define REQUEST_COMPLETION_FLAG 0x1
+
+/* This is the set of flags that the vsc can set in any packets it sends */
+#define VSC_LEGAL_FLAGS (REQUEST_COMPLETION_FLAG)
+
+#endif /* _HYPERV_STORAGE_H */
--
1.7.4.1

2011-05-10 08:33:08

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 173/206] Staging: hv: Include the contents of storvsc_api.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hyperv_storage.h | 138 ++++++++++++++++++++++++++++++++++-
1 files changed, 136 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/hyperv_storage.h b/drivers/staging/hv/hyperv_storage.h
index 4324493..93fac7c 100644
--- a/drivers/staging/hv/hyperv_storage.h
+++ b/drivers/staging/hv/hyperv_storage.h
@@ -22,6 +22,9 @@
*
*/

+#ifndef _HYPERV_STORAGE_H
+#define _HYPERV_STORAGE_H
+
/*
* vstorage.w revision number. This is used in the case
* of a version match, to alert the user that structure sizes may
@@ -29,8 +32,11 @@
* protocol versions match.
*/

-#ifndef _HYPERV_STORAGE_H
-#define _HYPERV_STORAGE_H
+#include <linux/kernel.h>
+#include <linux/atomic.h>
+#include <linux/completion.h>
+#include <linux/wait.h>
+

#define REVISION_STRING(REVISION_) #REVISION_
#define FILL_VMSTOR_REVISION(RESULT_LVALUE_) \
@@ -198,4 +204,132 @@ struct vstor_packet {
/* This is the set of flags that the vsc can set in any packets it sends */
#define VSC_LEGAL_FLAGS (REQUEST_COMPLETION_FLAG)

+/* Defines */
+#define STORVSC_RING_BUFFER_SIZE (20*PAGE_SIZE)
+#define BLKVSC_RING_BUFFER_SIZE (20*PAGE_SIZE)
+
+#define STORVSC_MAX_IO_REQUESTS 128
+
+/*
+ * In Hyper-V, each port/path/target maps to 1 scsi host adapter. In
+ * reality, the path/target is not used (ie always set to 0) so our
+ * scsi host adapter essentially has 1 bus with 1 target that contains
+ * up to 256 luns.
+ */
+#define STORVSC_MAX_LUNS_PER_TARGET 64
+#define STORVSC_MAX_TARGETS 1
+#define STORVSC_MAX_CHANNELS 1
+
+struct hv_storvsc_request;
+
+/* Matches Windows-end */
+enum storvsc_request_type {
+ WRITE_TYPE,
+ READ_TYPE,
+ UNKNOWN_TYPE,
+};
+
+
+struct hv_storvsc_request {
+ struct hv_storvsc_request *request;
+ struct hv_device *device;
+
+ /* Synchronize the request/response if needed */
+ struct completion wait_event;
+
+ unsigned char *sense_buffer;
+ void *context;
+ void (*on_io_completion)(struct hv_storvsc_request *request);
+ struct hv_multipage_buffer data_buffer;
+
+ struct vstor_packet vstor_packet;
+};
+
+
+struct storvsc_device_info {
+ u32 ring_buffer_size;
+ unsigned int port_number;
+ unsigned char path_id;
+ unsigned char target_id;
+};
+
+struct storvsc_major_info {
+ int major;
+ int index;
+ bool do_register;
+ char *devname;
+ char *diskname;
+};
+
+/* A storvsc device is a device object that contains a vmbus channel */
+struct storvsc_device {
+ struct hv_device *device;
+
+ /* 0 indicates the device is being destroyed */
+ atomic_t ref_count;
+
+ bool drain_notify;
+ atomic_t num_outstanding_req;
+
+ wait_queue_head_t waiting_to_drain;
+
+ /*
+ * Each unique Port/Path/Target represents 1 channel ie scsi
+ * controller. In reality, the pathid, targetid is always 0
+ * and the port is set by us
+ */
+ unsigned int port_number;
+ unsigned char path_id;
+ unsigned char target_id;
+
+ /* Used for vsc/vsp channel reset process */
+ struct hv_storvsc_request init_request;
+ struct hv_storvsc_request reset_request;
+};
+
+
+/* Get the stordevice object iff exists and its refcount > 1 */
+static inline struct storvsc_device *get_stor_device(struct hv_device *device)
+{
+ struct storvsc_device *stor_device;
+
+ stor_device = (struct storvsc_device *)device->ext;
+ if (stor_device && atomic_read(&stor_device->ref_count) > 1)
+ atomic_inc(&stor_device->ref_count);
+ else
+ stor_device = NULL;
+
+ return stor_device;
+}
+
+
+static inline void put_stor_device(struct hv_device *device)
+{
+ struct storvsc_device *stor_device;
+
+ stor_device = (struct storvsc_device *)device->ext;
+
+ atomic_dec(&stor_device->ref_count);
+}
+
+static inline void storvsc_wait_to_drain(struct storvsc_device *dev)
+{
+ dev->drain_notify = true;
+ wait_event(dev->waiting_to_drain,
+ atomic_read(&dev->num_outstanding_req) == 0);
+ dev->drain_notify = false;
+}
+
+/* Interface */
+
+int storvsc_dev_add(struct hv_device *device,
+ void *additional_info);
+int storvsc_dev_remove(struct hv_device *device);
+
+int storvsc_do_io(struct hv_device *device,
+ struct hv_storvsc_request *request);
+
+int storvsc_get_major_info(struct storvsc_device_info *device_info,
+ struct storvsc_major_info *major_info);
+
#endif /* _HYPERV_STORAGE_H */
--
1.7.4.1

2011-05-10 08:33:06

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 174/206] Staging: hv: Create a single header file for hyper-v network drivers

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hyperv_net.h | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
create mode 100644 drivers/staging/hv/hyperv_net.h

diff --git a/drivers/staging/hv/hyperv_net.h b/drivers/staging/hv/hyperv_net.h
new file mode 100644
index 0000000..ce27244
--- /dev/null
+++ b/drivers/staging/hv/hyperv_net.h
@@ -0,0 +1,23 @@
+/*
+ *
+ * Copyright (c) 2011, Microsoft Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * Authors:
+ * Haiyang Zhang <[email protected]>
+ * Hank Janssen <[email protected]>
+ * K. Y. Srinivasan <[email protected]>
+ *
+ */
--
1.7.4.1

2011-05-10 08:32:59

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 175/206] Staging: hv: Include the contents of netvsc_api.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hyperv_net.h | 107 +++++++++++++++++++++++++++++++++++++++
1 files changed, 107 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/hv/hyperv_net.h b/drivers/staging/hv/hyperv_net.h
index ce27244..2a00730 100644
--- a/drivers/staging/hv/hyperv_net.h
+++ b/drivers/staging/hv/hyperv_net.h
@@ -21,3 +21,110 @@
* K. Y. Srinivasan <[email protected]>
*
*/
+
+#ifndef _HYPERV_NET_H
+#define _HYPERV_NET_H
+
+#include <linux/list.h>
+
+
+/* Fwd declaration */
+struct hv_netvsc_packet;
+
+/* Represent the xfer page packet which contains 1 or more netvsc packet */
+struct xferpage_packet {
+ struct list_head list_ent;
+
+ /* # of netvsc packets this xfer packet contains */
+ u32 count;
+};
+
+/* The number of pages which are enough to cover jumbo frame buffer. */
+#define NETVSC_PACKET_MAXPAGE 4
+
+/*
+ * Represent netvsc packet which contains 1 RNDIS and 1 ethernet frame
+ * within the RNDIS
+ */
+struct hv_netvsc_packet {
+ /* Bookkeeping stuff */
+ struct list_head list_ent;
+
+ 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 *xfer_page_pkt;
+
+ union {
+ struct {
+ u64 recv_completion_tid;
+ void *recv_completion_ctx;
+ void (*recv_completion)(void *context);
+ } recv;
+ struct {
+ u64 send_completion_tid;
+ void *send_completion_ctx;
+ void (*send_completion)(void *context);
+ } send;
+ } completion;
+
+ /* This points to the memory after page_buf */
+ void *extension;
+
+ u32 total_data_buflen;
+ /* Points to the send/receive buffer where the ethernet frame is */
+ 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;
+
+ 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 (*recv_cb)(struct hv_device *dev,
+ struct hv_netvsc_packet *packet);
+ void (*link_status_change)(struct hv_device *dev, u32 status);
+
+ /* Specific to this driver */
+ int (*send)(struct hv_device *dev, struct hv_netvsc_packet *packet);
+
+ void *ctx;
+};
+
+static inline
+struct netvsc_driver *drv_to_netvscdrv(struct device_driver *d)
+{
+ struct hv_driver *hvdrv = drv_to_hv_drv(d);
+ return container_of(hvdrv, struct netvsc_driver, base);
+}
+
+struct netvsc_device_info {
+ unsigned char mac_adr[6];
+ bool link_state; /* 0 - link up, 1 - link down */
+};
+
+/* Interface */
+int netvsc_device_add(struct hv_device *device, void *additional_info);
+int netvsc_device_remove(struct hv_device *device);
+int netvsc_initialize(struct hv_driver *drv);
+int rndis_filter_open(struct hv_device *dev);
+int rndis_filter_close(struct hv_device *dev);
+int rndis_filte_device_add(struct hv_device *dev,
+ void *additional_info);
+int rndis_filter_device_remove(struct hv_device *dev);
+
+
+#endif /* _HYPERV_NET_H */
--
1.7.4.1

2011-05-10 08:33:00

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 176/206] Staging: hv: Include the contents of netvsc.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hyperv_net.h | 297 +++++++++++++++++++++++++++++++++++++++
1 files changed, 297 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/hv/hyperv_net.h b/drivers/staging/hv/hyperv_net.h
index 2a00730..37d6bab 100644
--- a/drivers/staging/hv/hyperv_net.h
+++ b/drivers/staging/hv/hyperv_net.h
@@ -127,4 +127,301 @@ int rndis_filte_device_add(struct hv_device *dev,
int rndis_filter_device_remove(struct hv_device *dev);


+#define NVSP_INVALID_PROTOCOL_VERSION ((u32)0xFFFFFFFF)
+
+#define NVSP_PROTOCOL_VERSION_1 2
+#define NVSP_MIN_PROTOCOL_VERSION NVSP_PROTOCOL_VERSION_1
+#define NVSP_MAX_PROTOCOL_VERSION NVSP_PROTOCOL_VERSION_1
+
+enum {
+ NVSP_MSG_TYPE_NONE = 0,
+
+ /* Init Messages */
+ NVSP_MSG_TYPE_INIT = 1,
+ NVSP_MSG_TYPE_INIT_COMPLETE = 2,
+
+ NVSP_VERSION_MSG_START = 100,
+
+ /* Version 1 Messages */
+ NVSP_MSG1_TYPE_SEND_NDIS_VER = NVSP_VERSION_MSG_START,
+
+ NVSP_MSG1_TYPE_SEND_RECV_BUF,
+ NVSP_MSG1_TYPE_SEND_RECV_BUF_COMPLETE,
+ NVSP_MSG1_TYPE_REVOKE_RECV_BUF,
+
+ NVSP_MSG1_TYPE_SEND_SEND_BUF,
+ NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE,
+ NVSP_MSG1_TYPE_REVOKE_SEND_BUF,
+
+ NVSP_MSG1_TYPE_SEND_RNDIS_PKT,
+ NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE,
+
+ /*
+ * This should be set to the number of messages for the version with
+ * the maximum number of messages.
+ */
+ NVSP_NUM_MSG_PER_VERSION = 9,
+};
+
+enum {
+ NVSP_STAT_NONE = 0,
+ NVSP_STAT_SUCCESS,
+ NVSP_STAT_FAIL,
+ NVSP_STAT_PROTOCOL_TOO_NEW,
+ NVSP_STAT_PROTOCOL_TOO_OLD,
+ NVSP_STAT_INVALID_RNDIS_PKT,
+ NVSP_STAT_BUSY,
+ NVSP_STAT_MAX,
+};
+
+struct nvsp_message_header {
+ u32 msg_type;
+};
+
+/* Init Messages */
+
+/*
+ * This message is used by the VSC to initialize the channel after the channels
+ * has been opened. This message should never include anything other then
+ * versioning (i.e. this message will be the same for ever).
+ */
+struct nvsp_message_init {
+ u32 min_protocol_ver;
+ u32 max_protocol_ver;
+} __packed;
+
+/*
+ * This message is used by the VSP to complete the initialization of the
+ * channel. This message should never include anything other then versioning
+ * (i.e. this message will be the same for ever).
+ */
+struct nvsp_message_init_complete {
+ u32 negotiated_protocol_ver;
+ u32 max_mdl_chain_len;
+ u32 status;
+} __packed;
+
+union nvsp_message_init_uber {
+ struct nvsp_message_init init;
+ struct nvsp_message_init_complete init_complete;
+} __packed;
+
+/* Version 1 Messages */
+
+/*
+ * This message is used by the VSC to send the NDIS version to the VSP. The VSP
+ * can use this information when handling OIDs sent by the VSC.
+ */
+struct nvsp_1_message_send_ndis_version {
+ u32 ndis_major_ver;
+ u32 ndis_minor_ver;
+} __packed;
+
+/*
+ * This message is used by the VSC to send a receive buffer to the VSP. The VSP
+ * can then use the receive buffer to send data to the VSC.
+ */
+struct nvsp_1_message_send_receive_buffer {
+ u32 gpadl_handle;
+ u16 id;
+} __packed;
+
+struct nvsp_1_receive_buffer_section {
+ u32 offset;
+ u32 sub_alloc_size;
+ u32 num_sub_allocs;
+ u32 end_offset;
+} __packed;
+
+/*
+ * This message is used by the VSP to acknowledge a receive buffer send by the
+ * VSC. This message must be sent by the VSP before the VSP uses the receive
+ * buffer.
+ */
+struct nvsp_1_message_send_receive_buffer_complete {
+ u32 status;
+ u32 num_sections;
+
+ /*
+ * The receive buffer is split into two parts, a large suballocation
+ * section and a small suballocation section. These sections are then
+ * suballocated by a certain size.
+ */
+
+ /*
+ * For example, the following break up of the receive buffer has 6
+ * large suballocations and 10 small suballocations.
+ */
+
+ /*
+ * | Large Section | | Small Section |
+ * ------------------------------------------------------------
+ * | | | | | | | | | | | | | | | | | |
+ * | |
+ * LargeOffset SmallOffset
+ */
+
+ struct nvsp_1_receive_buffer_section sections[1];
+} __packed;
+
+/*
+ * This message is sent by the VSC to revoke the receive buffer. After the VSP
+ * completes this transaction, the vsp should never use the receive buffer
+ * again.
+ */
+struct nvsp_1_message_revoke_receive_buffer {
+ u16 id;
+};
+
+/*
+ * This message is used by the VSC to send a send buffer to the VSP. The VSC
+ * can then use the send buffer to send data to the VSP.
+ */
+struct nvsp_1_message_send_send_buffer {
+ u32 gpadl_handle;
+ u16 id;
+} __packed;
+
+/*
+ * This message is used by the VSP to acknowledge a send buffer sent by the
+ * VSC. This message must be sent by the VSP before the VSP uses the sent
+ * buffer.
+ */
+struct nvsp_1_message_send_send_buffer_complete {
+ u32 status;
+
+ /*
+ * The VSC gets to choose the size of the send buffer and the VSP gets
+ * to choose the sections size of the buffer. This was done to enable
+ * dynamic reconfigurations when the cost of GPA-direct buffers
+ * decreases.
+ */
+ u32 section_size;
+} __packed;
+
+/*
+ * This message is sent by the VSC to revoke the send buffer. After the VSP
+ * completes this transaction, the vsp should never use the send buffer again.
+ */
+struct nvsp_1_message_revoke_send_buffer {
+ u16 id;
+};
+
+/*
+ * This message is used by both the VSP and the VSC to send a RNDIS message to
+ * the opposite channel endpoint.
+ */
+struct nvsp_1_message_send_rndis_packet {
+ /*
+ * This field is specified by RNIDS. They assume there's two different
+ * channels of communication. However, the Network VSP only has one.
+ * Therefore, the channel travels with the RNDIS packet.
+ */
+ u32 channel_type;
+
+ /*
+ * This field is used to send part or all of the data through a send
+ * buffer. This values specifies an index into the send buffer. If the
+ * index is 0xFFFFFFFF, then the send buffer is not being used and all
+ * of the data was sent through other VMBus mechanisms.
+ */
+ u32 send_buf_section_index;
+ u32 send_buf_section_size;
+} __packed;
+
+/*
+ * This message is used by both the VSP and the VSC to complete a RNDIS message
+ * to the opposite channel endpoint. At this point, the initiator of this
+ * message cannot use any resources associated with the original RNDIS packet.
+ */
+struct nvsp_1_message_send_rndis_packet_complete {
+ u32 status;
+};
+
+union nvsp_1_message_uber {
+ struct nvsp_1_message_send_ndis_version send_ndis_ver;
+
+ struct nvsp_1_message_send_receive_buffer send_recv_buf;
+ struct nvsp_1_message_send_receive_buffer_complete
+ send_recv_buf_complete;
+ struct nvsp_1_message_revoke_receive_buffer revoke_recv_buf;
+
+ struct nvsp_1_message_send_send_buffer send_send_buf;
+ struct nvsp_1_message_send_send_buffer_complete send_send_buf_complete;
+ struct nvsp_1_message_revoke_send_buffer revoke_send_buf;
+
+ struct nvsp_1_message_send_rndis_packet send_rndis_pkt;
+ struct nvsp_1_message_send_rndis_packet_complete
+ send_rndis_pkt_complete;
+} __packed;
+
+union nvsp_all_messages {
+ union nvsp_message_init_uber init_msg;
+ union nvsp_1_message_uber v1_msg;
+} __packed;
+
+/* ALL Messages */
+struct nvsp_message {
+ struct nvsp_message_header hdr;
+ union nvsp_all_messages msg;
+} __packed;
+
+
+
+
+/* #define NVSC_MIN_PROTOCOL_VERSION 1 */
+/* #define NVSC_MAX_PROTOCOL_VERSION 1 */
+
+#define NETVSC_SEND_BUFFER_SIZE (64*1024) /* 64K */
+#define NETVSC_SEND_BUFFER_ID 0xface
+
+
+#define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024) /* 1MB */
+
+#define NETVSC_RECEIVE_BUFFER_ID 0xcafe
+
+#define NETVSC_RECEIVE_SG_COUNT 1
+
+/* Preallocated receive packets */
+#define NETVSC_RECEIVE_PACKETLIST_COUNT 256
+
+#define NETVSC_PACKET_SIZE 2048
+
+/* Per netvsc channel-specific */
+struct netvsc_device {
+ struct hv_device *dev;
+
+ atomic_t refcnt;
+ atomic_t num_outstanding_sends;
+ /*
+ * List of free preallocated hv_netvsc_packet to represent receive
+ * packet
+ */
+ struct list_head recv_pkt_list;
+ spinlock_t recv_pkt_list_lock;
+
+ /* Send buffer allocated by us but manages by NetVSP */
+ void *send_buf;
+ u32 send_buf_size;
+ u32 send_buf_gpadl_handle;
+ u32 send_section_size;
+
+ /* Receive buffer allocated by us but manages by NetVSP */
+ void *recv_buf;
+ u32 recv_buf_size;
+ u32 recv_buf_gpadl_handle;
+ u32 recv_section_cnt;
+ struct nvsp_1_receive_buffer_section *recv_section;
+
+ /* Used for NetVSP initialization protocol */
+ struct completion channel_init_wait;
+ struct nvsp_message channel_init_pkt;
+
+ struct nvsp_message revoke_packet;
+ /* unsigned char HwMacAddr[HW_MACADDR_LEN]; */
+
+ /* Holds rndis device info */
+ void *extension;
+};
+
#endif /* _HYPERV_NET_H */
--
1.7.4.1

2011-05-10 09:56:23

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 177/206] Staging: hv: Include the contents of rndis.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hyperv_net.h | 627 +++++++++++++++++++++++++++++++++++++++
1 files changed, 627 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/hv/hyperv_net.h b/drivers/staging/hv/hyperv_net.h
index 37d6bab..c1557ac 100644
--- a/drivers/staging/hv/hyperv_net.h
+++ b/drivers/staging/hv/hyperv_net.h
@@ -424,4 +424,631 @@ struct netvsc_device {
void *extension;
};

+
+/* Status codes */
+
+
+#ifndef STATUS_SUCCESS
+#define STATUS_SUCCESS (0x00000000L)
+#endif
+
+#ifndef STATUS_UNSUCCESSFUL
+#define STATUS_UNSUCCESSFUL (0xC0000001L)
+#endif
+
+#ifndef STATUS_PENDING
+#define STATUS_PENDING (0x00000103L)
+#endif
+
+#ifndef STATUS_INSUFFICIENT_RESOURCES
+#define STATUS_INSUFFICIENT_RESOURCES (0xC000009AL)
+#endif
+
+#ifndef STATUS_BUFFER_OVERFLOW
+#define STATUS_BUFFER_OVERFLOW (0x80000005L)
+#endif
+
+#ifndef STATUS_NOT_SUPPORTED
+#define STATUS_NOT_SUPPORTED (0xC00000BBL)
+#endif
+
+#define RNDIS_STATUS_SUCCESS (STATUS_SUCCESS)
+#define RNDIS_STATUS_PENDING (STATUS_PENDING)
+#define RNDIS_STATUS_NOT_RECOGNIZED (0x00010001L)
+#define RNDIS_STATUS_NOT_COPIED (0x00010002L)
+#define RNDIS_STATUS_NOT_ACCEPTED (0x00010003L)
+#define RNDIS_STATUS_CALL_ACTIVE (0x00010007L)
+
+#define RNDIS_STATUS_ONLINE (0x40010003L)
+#define RNDIS_STATUS_RESET_START (0x40010004L)
+#define RNDIS_STATUS_RESET_END (0x40010005L)
+#define RNDIS_STATUS_RING_STATUS (0x40010006L)
+#define RNDIS_STATUS_CLOSED (0x40010007L)
+#define RNDIS_STATUS_WAN_LINE_UP (0x40010008L)
+#define RNDIS_STATUS_WAN_LINE_DOWN (0x40010009L)
+#define RNDIS_STATUS_WAN_FRAGMENT (0x4001000AL)
+#define RNDIS_STATUS_MEDIA_CONNECT (0x4001000BL)
+#define RNDIS_STATUS_MEDIA_DISCONNECT (0x4001000CL)
+#define RNDIS_STATUS_HARDWARE_LINE_UP (0x4001000DL)
+#define RNDIS_STATUS_HARDWARE_LINE_DOWN (0x4001000EL)
+#define RNDIS_STATUS_INTERFACE_UP (0x4001000FL)
+#define RNDIS_STATUS_INTERFACE_DOWN (0x40010010L)
+#define RNDIS_STATUS_MEDIA_BUSY (0x40010011L)
+#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION (0x40010012L)
+#define RNDIS_STATUS_WW_INDICATION RDIA_SPECIFIC_INDICATION
+#define RNDIS_STATUS_LINK_SPEED_CHANGE (0x40010013L)
+
+#define RNDIS_STATUS_NOT_RESETTABLE (0x80010001L)
+#define RNDIS_STATUS_SOFT_ERRORS (0x80010003L)
+#define RNDIS_STATUS_HARD_ERRORS (0x80010004L)
+#define RNDIS_STATUS_BUFFER_OVERFLOW (STATUS_BUFFER_OVERFLOW)
+
+#define RNDIS_STATUS_FAILURE (STATUS_UNSUCCESSFUL)
+#define RNDIS_STATUS_RESOURCES (STATUS_INSUFFICIENT_RESOURCES)
+#define RNDIS_STATUS_CLOSING (0xC0010002L)
+#define RNDIS_STATUS_BAD_VERSION (0xC0010004L)
+#define RNDIS_STATUS_BAD_CHARACTERISTICS (0xC0010005L)
+#define RNDIS_STATUS_ADAPTER_NOT_FOUND (0xC0010006L)
+#define RNDIS_STATUS_OPEN_FAILED (0xC0010007L)
+#define RNDIS_STATUS_DEVICE_FAILED (0xC0010008L)
+#define RNDIS_STATUS_MULTICAST_FULL (0xC0010009L)
+#define RNDIS_STATUS_MULTICAST_EXISTS (0xC001000AL)
+#define RNDIS_STATUS_MULTICAST_NOT_FOUND (0xC001000BL)
+#define RNDIS_STATUS_REQUEST_ABORTED (0xC001000CL)
+#define RNDIS_STATUS_RESET_IN_PROGRESS (0xC001000DL)
+#define RNDIS_STATUS_CLOSING_INDICATING (0xC001000EL)
+#define RNDIS_STATUS_NOT_SUPPORTED (STATUS_NOT_SUPPORTED)
+#define RNDIS_STATUS_INVALID_PACKET (0xC001000FL)
+#define RNDIS_STATUS_OPEN_LIST_FULL (0xC0010010L)
+#define RNDIS_STATUS_ADAPTER_NOT_READY (0xC0010011L)
+#define RNDIS_STATUS_ADAPTER_NOT_OPEN (0xC0010012L)
+#define RNDIS_STATUS_NOT_INDICATING (0xC0010013L)
+#define RNDIS_STATUS_INVALID_LENGTH (0xC0010014L)
+#define RNDIS_STATUS_INVALID_DATA (0xC0010015L)
+#define RNDIS_STATUS_BUFFER_TOO_SHORT (0xC0010016L)
+#define RNDIS_STATUS_INVALID_OID (0xC0010017L)
+#define RNDIS_STATUS_ADAPTER_REMOVED (0xC0010018L)
+#define RNDIS_STATUS_UNSUPPORTED_MEDIA (0xC0010019L)
+#define RNDIS_STATUS_GROUP_ADDRESS_IN_USE (0xC001001AL)
+#define RNDIS_STATUS_FILE_NOT_FOUND (0xC001001BL)
+#define RNDIS_STATUS_ERROR_READING_FILE (0xC001001CL)
+#define RNDIS_STATUS_ALREADY_MAPPED (0xC001001DL)
+#define RNDIS_STATUS_RESOURCE_CONFLICT (0xC001001EL)
+#define RNDIS_STATUS_NO_CABLE (0xC001001FL)
+
+#define RNDIS_STATUS_INVALID_SAP (0xC0010020L)
+#define RNDIS_STATUS_SAP_IN_USE (0xC0010021L)
+#define RNDIS_STATUS_INVALID_ADDRESS (0xC0010022L)
+#define RNDIS_STATUS_VC_NOT_ACTIVATED (0xC0010023L)
+#define RNDIS_STATUS_DEST_OUT_OF_ORDER (0xC0010024L)
+#define RNDIS_STATUS_VC_NOT_AVAILABLE (0xC0010025L)
+#define RNDIS_STATUS_CELLRATE_NOT_AVAILABLE (0xC0010026L)
+#define RNDIS_STATUS_INCOMPATABLE_QOS (0xC0010027L)
+#define RNDIS_STATUS_AAL_PARAMS_UNSUPPORTED (0xC0010028L)
+#define RNDIS_STATUS_NO_ROUTE_TO_DESTINATION (0xC0010029L)
+
+#define RNDIS_STATUS_TOKEN_RING_OPEN_ERROR (0xC0011000L)
+
+/* Object Identifiers used by NdisRequest Query/Set Information */
+/* General Objects */
+#define RNDIS_OID_GEN_SUPPORTED_LIST 0x00010101
+#define RNDIS_OID_GEN_HARDWARE_STATUS 0x00010102
+#define RNDIS_OID_GEN_MEDIA_SUPPORTED 0x00010103
+#define RNDIS_OID_GEN_MEDIA_IN_USE 0x00010104
+#define RNDIS_OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105
+#define RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
+#define RNDIS_OID_GEN_LINK_SPEED 0x00010107
+#define RNDIS_OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108
+#define RNDIS_OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109
+#define RNDIS_OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
+#define RNDIS_OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
+#define RNDIS_OID_GEN_VENDOR_ID 0x0001010C
+#define RNDIS_OID_GEN_VENDOR_DESCRIPTION 0x0001010D
+#define RNDIS_OID_GEN_CURRENT_PACKET_FILTER 0x0001010E
+#define RNDIS_OID_GEN_CURRENT_LOOKAHEAD 0x0001010F
+#define RNDIS_OID_GEN_DRIVER_VERSION 0x00010110
+#define RNDIS_OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
+#define RNDIS_OID_GEN_PROTOCOL_OPTIONS 0x00010112
+#define RNDIS_OID_GEN_MAC_OPTIONS 0x00010113
+#define RNDIS_OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
+#define RNDIS_OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
+#define RNDIS_OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
+#define RNDIS_OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118
+#define RNDIS_OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119
+#define RNDIS_OID_GEN_MACHINE_NAME 0x0001021A
+#define RNDIS_OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B
+
+#define RNDIS_OID_GEN_XMIT_OK 0x00020101
+#define RNDIS_OID_GEN_RCV_OK 0x00020102
+#define RNDIS_OID_GEN_XMIT_ERROR 0x00020103
+#define RNDIS_OID_GEN_RCV_ERROR 0x00020104
+#define RNDIS_OID_GEN_RCV_NO_BUFFER 0x00020105
+
+#define RNDIS_OID_GEN_DIRECTED_BYTES_XMIT 0x00020201
+#define RNDIS_OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202
+#define RNDIS_OID_GEN_MULTICAST_BYTES_XMIT 0x00020203
+#define RNDIS_OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204
+#define RNDIS_OID_GEN_BROADCAST_BYTES_XMIT 0x00020205
+#define RNDIS_OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206
+#define RNDIS_OID_GEN_DIRECTED_BYTES_RCV 0x00020207
+#define RNDIS_OID_GEN_DIRECTED_FRAMES_RCV 0x00020208
+#define RNDIS_OID_GEN_MULTICAST_BYTES_RCV 0x00020209
+#define RNDIS_OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A
+#define RNDIS_OID_GEN_BROADCAST_BYTES_RCV 0x0002020B
+#define RNDIS_OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C
+
+#define RNDIS_OID_GEN_RCV_CRC_ERROR 0x0002020D
+#define RNDIS_OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E
+
+#define RNDIS_OID_GEN_GET_TIME_CAPS 0x0002020F
+#define RNDIS_OID_GEN_GET_NETCARD_TIME 0x00020210
+
+/* These are connection-oriented general OIDs. */
+/* These replace the above OIDs for connection-oriented media. */
+#define RNDIS_OID_GEN_CO_SUPPORTED_LIST 0x00010101
+#define RNDIS_OID_GEN_CO_HARDWARE_STATUS 0x00010102
+#define RNDIS_OID_GEN_CO_MEDIA_SUPPORTED 0x00010103
+#define RNDIS_OID_GEN_CO_MEDIA_IN_USE 0x00010104
+#define RNDIS_OID_GEN_CO_LINK_SPEED 0x00010105
+#define RNDIS_OID_GEN_CO_VENDOR_ID 0x00010106
+#define RNDIS_OID_GEN_CO_VENDOR_DESCRIPTION 0x00010107
+#define RNDIS_OID_GEN_CO_DRIVER_VERSION 0x00010108
+#define RNDIS_OID_GEN_CO_PROTOCOL_OPTIONS 0x00010109
+#define RNDIS_OID_GEN_CO_MAC_OPTIONS 0x0001010A
+#define RNDIS_OID_GEN_CO_MEDIA_CONNECT_STATUS 0x0001010B
+#define RNDIS_OID_GEN_CO_VENDOR_DRIVER_VERSION 0x0001010C
+#define RNDIS_OID_GEN_CO_MINIMUM_LINK_SPEED 0x0001010D
+
+#define RNDIS_OID_GEN_CO_GET_TIME_CAPS 0x00010201
+#define RNDIS_OID_GEN_CO_GET_NETCARD_TIME 0x00010202
+
+/* These are connection-oriented statistics OIDs. */
+#define RNDIS_OID_GEN_CO_XMIT_PDUS_OK 0x00020101
+#define RNDIS_OID_GEN_CO_RCV_PDUS_OK 0x00020102
+#define RNDIS_OID_GEN_CO_XMIT_PDUS_ERROR 0x00020103
+#define RNDIS_OID_GEN_CO_RCV_PDUS_ERROR 0x00020104
+#define RNDIS_OID_GEN_CO_RCV_PDUS_NO_BUFFER 0x00020105
+
+
+#define RNDIS_OID_GEN_CO_RCV_CRC_ERROR 0x00020201
+#define RNDIS_OID_GEN_CO_TRANSMIT_QUEUE_LENGTH 0x00020202
+#define RNDIS_OID_GEN_CO_BYTES_XMIT 0x00020203
+#define RNDIS_OID_GEN_CO_BYTES_RCV 0x00020204
+#define RNDIS_OID_GEN_CO_BYTES_XMIT_OUTSTANDING 0x00020205
+#define RNDIS_OID_GEN_CO_NETCARD_LOAD 0x00020206
+
+/* These are objects for Connection-oriented media call-managers. */
+#define RNDIS_OID_CO_ADD_PVC 0xFF000001
+#define RNDIS_OID_CO_DELETE_PVC 0xFF000002
+#define RNDIS_OID_CO_GET_CALL_INFORMATION 0xFF000003
+#define RNDIS_OID_CO_ADD_ADDRESS 0xFF000004
+#define RNDIS_OID_CO_DELETE_ADDRESS 0xFF000005
+#define RNDIS_OID_CO_GET_ADDRESSES 0xFF000006
+#define RNDIS_OID_CO_ADDRESS_CHANGE 0xFF000007
+#define RNDIS_OID_CO_SIGNALING_ENABLED 0xFF000008
+#define RNDIS_OID_CO_SIGNALING_DISABLED 0xFF000009
+
+/* 802.3 Objects (Ethernet) */
+#define RNDIS_OID_802_3_PERMANENT_ADDRESS 0x01010101
+#define RNDIS_OID_802_3_CURRENT_ADDRESS 0x01010102
+#define RNDIS_OID_802_3_MULTICAST_LIST 0x01010103
+#define RNDIS_OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
+#define RNDIS_OID_802_3_MAC_OPTIONS 0x01010105
+
+#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001
+
+#define RNDIS_OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101
+#define RNDIS_OID_802_3_XMIT_ONE_COLLISION 0x01020102
+#define RNDIS_OID_802_3_XMIT_MORE_COLLISIONS 0x01020103
+
+#define RNDIS_OID_802_3_XMIT_DEFERRED 0x01020201
+#define RNDIS_OID_802_3_XMIT_MAX_COLLISIONS 0x01020202
+#define RNDIS_OID_802_3_RCV_OVERRUN 0x01020203
+#define RNDIS_OID_802_3_XMIT_UNDERRUN 0x01020204
+#define RNDIS_OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205
+#define RNDIS_OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
+#define RNDIS_OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
+
+/* Remote NDIS message types */
+#define REMOTE_NDIS_PACKET_MSG 0x00000001
+#define REMOTE_NDIS_INITIALIZE_MSG 0x00000002
+#define REMOTE_NDIS_HALT_MSG 0x00000003
+#define REMOTE_NDIS_QUERY_MSG 0x00000004
+#define REMOTE_NDIS_SET_MSG 0x00000005
+#define REMOTE_NDIS_RESET_MSG 0x00000006
+#define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007
+#define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008
+
+#define REMOTE_CONDIS_MP_CREATE_VC_MSG 0x00008001
+#define REMOTE_CONDIS_MP_DELETE_VC_MSG 0x00008002
+#define REMOTE_CONDIS_MP_ACTIVATE_VC_MSG 0x00008005
+#define REMOTE_CONDIS_MP_DEACTIVATE_VC_MSG 0x00008006
+#define REMOTE_CONDIS_INDICATE_STATUS_MSG 0x00008007
+
+/* Remote NDIS message completion types */
+#define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002
+#define REMOTE_NDIS_QUERY_CMPLT 0x80000004
+#define REMOTE_NDIS_SET_CMPLT 0x80000005
+#define REMOTE_NDIS_RESET_CMPLT 0x80000006
+#define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008
+
+#define REMOTE_CONDIS_MP_CREATE_VC_CMPLT 0x80008001
+#define REMOTE_CONDIS_MP_DELETE_VC_CMPLT 0x80008002
+#define REMOTE_CONDIS_MP_ACTIVATE_VC_CMPLT 0x80008005
+#define REMOTE_CONDIS_MP_DEACTIVATE_VC_CMPLT 0x80008006
+
+/*
+ * Reserved message type for private communication between lower-layer host
+ * driver and remote device, if necessary.
+ */
+#define REMOTE_NDIS_BUS_MSG 0xff000001
+
+/* Defines for DeviceFlags in struct rndis_initialize_complete */
+#define RNDIS_DF_CONNECTIONLESS 0x00000001
+#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002
+#define RNDIS_DF_RAW_DATA 0x00000004
+
+/* Remote NDIS medium types. */
+#define RNDIS_MEDIUM_802_3 0x00000000
+#define RNDIS_MEDIUM_802_5 0x00000001
+#define RNDIS_MEDIUM_FDDI 0x00000002
+#define RNDIS_MEDIUM_WAN 0x00000003
+#define RNDIS_MEDIUM_LOCAL_TALK 0x00000004
+#define RNDIS_MEDIUM_ARCNET_RAW 0x00000006
+#define RNDIS_MEDIUM_ARCNET_878_2 0x00000007
+#define RNDIS_MEDIUM_ATM 0x00000008
+#define RNDIS_MEDIUM_WIRELESS_WAN 0x00000009
+#define RNDIS_MEDIUM_IRDA 0x0000000a
+#define RNDIS_MEDIUM_CO_WAN 0x0000000b
+/* Not a real medium, defined as an upper-bound */
+#define RNDIS_MEDIUM_MAX 0x0000000d
+
+
+/* Remote NDIS medium connection states. */
+#define RNDIS_MEDIA_STATE_CONNECTED 0x00000000
+#define RNDIS_MEDIA_STATE_DISCONNECTED 0x00000001
+
+/* Remote NDIS version numbers */
+#define RNDIS_MAJOR_VERSION 0x00000001
+#define RNDIS_MINOR_VERSION 0x00000000
+
+
+/* NdisInitialize message */
+struct rndis_initialize_request {
+ u32 req_id;
+ u32 major_ver;
+ u32 minor_ver;
+ u32 max_xfer_size;
+};
+
+/* Response to NdisInitialize */
+struct rndis_initialize_complete {
+ u32 req_id;
+ u32 status;
+ u32 major_ver;
+ u32 minor_ver;
+ u32 dev_flags;
+ u32 medium;
+ u32 max_pkt_per_msg;
+ u32 max_xfer_size;
+ u32 pkt_alignment_factor;
+ u32 af_list_offset;
+ u32 af_list_size;
+};
+
+/* Call manager devices only: Information about an address family */
+/* supported by the device is appended to the response to NdisInitialize. */
+struct rndis_co_address_family {
+ u32 address_family;
+ u32 major_ver;
+ u32 minor_ver;
+};
+
+/* NdisHalt message */
+struct rndis_halt_request {
+ u32 req_id;
+};
+
+/* NdisQueryRequest message */
+struct rndis_query_request {
+ u32 req_id;
+ u32 oid;
+ u32 info_buflen;
+ u32 info_buf_offset;
+ u32 dev_vc_handle;
+};
+
+/* Response to NdisQueryRequest */
+struct rndis_query_complete {
+ u32 req_id;
+ u32 status;
+ u32 info_buflen;
+ u32 info_buf_offset;
+};
+
+/* NdisSetRequest message */
+struct rndis_set_request {
+ u32 req_id;
+ u32 oid;
+ u32 info_buflen;
+ u32 info_buf_offset;
+ u32 dev_vc_handle;
+};
+
+/* Response to NdisSetRequest */
+struct rndis_set_complete {
+ u32 req_id;
+ u32 status;
+};
+
+/* NdisReset message */
+struct rndis_reset_request {
+ u32 reserved;
+};
+
+/* Response to NdisReset */
+struct rndis_reset_complete {
+ u32 status;
+ u32 addressing_reset;
+};
+
+/* NdisMIndicateStatus message */
+struct rndis_indicate_status {
+ u32 status;
+ u32 status_buflen;
+ u32 status_buf_offset;
+};
+
+/* Diagnostic information passed as the status buffer in */
+/* struct rndis_indicate_status messages signifying error conditions. */
+struct rndis_diagnostic_info {
+ u32 diag_status;
+ u32 error_offset;
+};
+
+/* NdisKeepAlive message */
+struct rndis_keepalive_request {
+ u32 req_id;
+};
+
+/* Response to NdisKeepAlive */
+struct rndis_keepalive_complete {
+ u32 req_id;
+ u32 status;
+};
+
+/*
+ * Data message. All Offset fields contain byte offsets from the beginning of
+ * struct rndis_packet. All Length fields are in bytes. VcHandle is set
+ * to 0 for connectionless data, otherwise it contains the VC handle.
+ */
+struct rndis_packet {
+ u32 data_offset;
+ u32 data_len;
+ u32 oob_data_offset;
+ u32 oob_data_len;
+ u32 num_oob_data_elements;
+ u32 per_pkt_info_offset;
+ u32 per_pkt_info_len;
+ u32 vc_handle;
+ u32 reserved;
+};
+
+/* Optional Out of Band data associated with a Data message. */
+struct rndis_oobd {
+ u32 size;
+ u32 type;
+ u32 class_info_offset;
+};
+
+/* Packet extension field contents associated with a Data message. */
+struct rndis_per_packet_info {
+ u32 size;
+ u32 type;
+ u32 per_pkt_info_offset;
+};
+
+/* Format of Information buffer passed in a SetRequest for the OID */
+/* OID_GEN_RNDIS_CONFIG_PARAMETER. */
+struct rndis_config_parameter_info {
+ u32 parameter_name_offset;
+ u32 parameter_name_length;
+ u32 parameter_type;
+ u32 parameter_value_offset;
+ u32 parameter_value_length;
+};
+
+/* Values for ParameterType in struct rndis_config_parameter_info */
+#define RNDIS_CONFIG_PARAM_TYPE_INTEGER 0
+#define RNDIS_CONFIG_PARAM_TYPE_STRING 2
+
+/* CONDIS Miniport messages for connection oriented devices */
+/* that do not implement a call manager. */
+
+/* CoNdisMiniportCreateVc message */
+struct rcondis_mp_create_vc {
+ u32 req_id;
+ u32 ndis_vc_handle;
+};
+
+/* Response to CoNdisMiniportCreateVc */
+struct rcondis_mp_create_vc_complete {
+ u32 req_id;
+ u32 dev_vc_handle;
+ u32 status;
+};
+
+/* CoNdisMiniportDeleteVc message */
+struct rcondis_mp_delete_vc {
+ u32 req_id;
+ u32 dev_vc_handle;
+};
+
+/* Response to CoNdisMiniportDeleteVc */
+struct rcondis_mp_delete_vc_complete {
+ u32 req_id;
+ u32 status;
+};
+
+/* CoNdisMiniportQueryRequest message */
+struct rcondis_mp_query_request {
+ u32 req_id;
+ u32 request_type;
+ u32 oid;
+ u32 dev_vc_handle;
+ u32 info_buflen;
+ u32 info_buf_offset;
+};
+
+/* CoNdisMiniportSetRequest message */
+struct rcondis_mp_set_request {
+ u32 req_id;
+ u32 request_type;
+ u32 oid;
+ u32 dev_vc_handle;
+ u32 info_buflen;
+ u32 info_buf_offset;
+};
+
+/* CoNdisIndicateStatus message */
+struct rcondis_indicate_status {
+ u32 ndis_vc_handle;
+ u32 status;
+ u32 status_buflen;
+ u32 status_buf_offset;
+};
+
+/* CONDIS Call/VC parameters */
+struct rcondis_specific_parameters {
+ u32 parameter_type;
+ u32 parameter_length;
+ u32 parameter_lffset;
+};
+
+struct rcondis_media_parameters {
+ u32 flags;
+ u32 reserved1;
+ u32 reserved2;
+ struct rcondis_specific_parameters media_specific;
+};
+
+struct rndis_flowspec {
+ u32 token_rate;
+ u32 token_bucket_size;
+ u32 peak_bandwidth;
+ u32 latency;
+ u32 delay_variation;
+ u32 service_type;
+ u32 max_sdu_size;
+ u32 minimum_policed_size;
+};
+
+struct rcondis_call_manager_parameters {
+ struct rndis_flowspec transmit;
+ struct rndis_flowspec receive;
+ struct rcondis_specific_parameters call_mgr_specific;
+};
+
+/* CoNdisMiniportActivateVc message */
+struct rcondis_mp_activate_vc_request {
+ u32 req_id;
+ u32 flags;
+ u32 dev_vc_handle;
+ u32 media_params_offset;
+ u32 media_params_length;
+ u32 call_mgr_params_offset;
+ u32 call_mgr_params_length;
+};
+
+/* Response to CoNdisMiniportActivateVc */
+struct rcondis_mp_activate_vc_complete {
+ u32 req_id;
+ u32 status;
+};
+
+/* CoNdisMiniportDeactivateVc message */
+struct rcondis_mp_deactivate_vc_request {
+ u32 req_id;
+ u32 flags;
+ u32 dev_vc_handle;
+};
+
+/* Response to CoNdisMiniportDeactivateVc */
+struct rcondis_mp_deactivate_vc_complete {
+ u32 req_id;
+ u32 status;
+};
+
+
+/* union with all of the RNDIS messages */
+union rndis_message_container {
+ struct rndis_packet pkt;
+ struct rndis_initialize_request init_req;
+ struct rndis_halt_request halt_req;
+ struct rndis_query_request query_req;
+ struct rndis_set_request set_req;
+ struct rndis_reset_request reset_req;
+ struct rndis_keepalive_request keep_alive_req;
+ struct rndis_indicate_status indicate_status;
+ struct rndis_initialize_complete init_complete;
+ struct rndis_query_complete query_complete;
+ struct rndis_set_complete set_complete;
+ struct rndis_reset_complete reset_complete;
+ struct rndis_keepalive_complete keep_alive_complete;
+ struct rcondis_mp_create_vc co_miniport_create_vc;
+ struct rcondis_mp_delete_vc co_miniport_delete_vc;
+ struct rcondis_indicate_status co_indicate_status;
+ struct rcondis_mp_activate_vc_request co_miniport_activate_vc;
+ struct rcondis_mp_deactivate_vc_request co_miniport_deactivate_vc;
+ struct rcondis_mp_create_vc_complete co_miniport_create_vc_complete;
+ struct rcondis_mp_delete_vc_complete co_miniport_delete_vc_complete;
+ struct rcondis_mp_activate_vc_complete co_miniport_activate_vc_complete;
+ struct rcondis_mp_deactivate_vc_complete
+ co_miniport_deactivate_vc_complete;
+};
+
+/* Remote NDIS message format */
+struct rndis_message {
+ u32 ndis_msg_type;
+
+ /* Total length of this message, from the beginning */
+ /* of the sruct rndis_message, in bytes. */
+ u32 msg_len;
+
+ /* Actual message */
+ union rndis_message_container msg;
+};
+
+/* Handy macros */
+
+/* get the size of an RNDIS message. Pass in the message type, */
+/* struct rndis_set_request, struct rndis_packet for example */
+#define RNDIS_MESSAGE_SIZE(msg) \
+ (sizeof(msg) + (sizeof(struct rndis_message) - \
+ sizeof(union rndis_message_container)))
+
+/* get pointer to info buffer with message pointer */
+#define MESSAGE_TO_INFO_BUFFER(msg) \
+ (((unsigned char *)(msg)) + msg->info_buf_offset)
+
+/* get pointer to status buffer with message pointer */
+#define MESSAGE_TO_STATUS_BUFFER(msg) \
+ (((unsigned char *)(msg)) + msg->status_buf_offset)
+
+/* get pointer to OOBD buffer with message pointer */
+#define MESSAGE_TO_OOBD_BUFFER(msg) \
+ (((unsigned char *)(msg)) + msg->oob_data_offset)
+
+/* get pointer to data buffer with message pointer */
+#define MESSAGE_TO_DATA_BUFFER(msg) \
+ (((unsigned char *)(msg)) + msg->per_pkt_info_offset)
+
+/* get pointer to contained message from NDIS_MESSAGE pointer */
+#define RNDIS_MESSAGE_PTR_TO_MESSAGE_PTR(rndis_msg) \
+ ((void *) &rndis_msg->msg)
+
+/* get pointer to contained message from NDIS_MESSAGE pointer */
+#define RNDIS_MESSAGE_RAW_PTR_TO_MESSAGE_PTR(rndis_msg) \
+ ((void *) rndis_msg)
+
#endif /* _HYPERV_NET_H */
--
1.7.4.1

2011-05-10 08:31:19

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 178/206] Staging: hv: Include the contents of rndis_filter.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hyperv_net.h | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/hv/hyperv_net.h b/drivers/staging/hv/hyperv_net.h
index c1557ac..1eaac1a 100644
--- a/drivers/staging/hv/hyperv_net.h
+++ b/drivers/staging/hv/hyperv_net.h
@@ -1051,4 +1051,29 @@ struct rndis_message {
#define RNDIS_MESSAGE_RAW_PTR_TO_MESSAGE_PTR(rndis_msg) \
((void *) rndis_msg)

+
+#define __struct_bcount(x)
+
+
+#define RNDIS_HEADER_SIZE (sizeof(struct rndis_message) - \
+ sizeof(union rndis_message_container))
+
+#define NDIS_PACKET_TYPE_DIRECTED 0x00000001
+#define NDIS_PACKET_TYPE_MULTICAST 0x00000002
+#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
+#define NDIS_PACKET_TYPE_BROADCAST 0x00000008
+#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
+#define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
+#define NDIS_PACKET_TYPE_SMT 0x00000040
+#define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
+#define NDIS_PACKET_TYPE_GROUP 0x00000100
+#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00000200
+#define NDIS_PACKET_TYPE_FUNCTIONAL 0x00000400
+#define NDIS_PACKET_TYPE_MAC_FRAME 0x00000800
+
+
+/* Interface */
+
+extern int rndis_filter_init(struct netvsc_driver *driver);
+
#endif /* _HYPERV_NET_H */
--
1.7.4.1

2011-05-10 08:37:03

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 179/206] Staging: hv: Include the contents of utils.h

The subject line says it all.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
include/linux/hyperv.h | 98 +++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 97 insertions(+), 1 deletions(-)

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 81f8742..e6bf39f 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -842,4 +842,100 @@ void vmbus_child_driver_unregister(struct device_driver *drv);
extern struct completion hv_channel_ready;


-#endif /* _HYPERV_H_ */
+/*
+ * Common header for Hyper-V ICs
+ */
+#define ICMSGTYPE_NEGOTIATE 0
+#define ICMSGTYPE_HEARTBEAT 1
+#define ICMSGTYPE_KVPEXCHANGE 2
+#define ICMSGTYPE_SHUTDOWN 3
+#define ICMSGTYPE_TIMESYNC 4
+#define ICMSGTYPE_VSS 5
+
+#define ICMSGHDRFLAG_TRANSACTION 1
+#define ICMSGHDRFLAG_REQUEST 2
+#define ICMSGHDRFLAG_RESPONSE 4
+
+#define HV_S_OK 0x00000000
+#define HV_E_FAIL 0x80004005
+#define HV_ERROR_NOT_SUPPORTED 0x80070032
+#define HV_ERROR_MACHINE_LOCKED 0x800704F7
+
+struct vmbuspipe_hdr {
+ u32 flags;
+ u32 msgsize;
+} __packed;
+
+struct ic_version {
+ u16 major;
+ u16 minor;
+} __packed;
+
+struct icmsg_hdr {
+ struct ic_version icverframe;
+ u16 icmsgtype;
+ struct ic_version icvermsg;
+ u16 icmsgsize;
+ u32 status;
+ u8 ictransaction_id;
+ u8 icflags;
+ u8 reserved[2];
+} __packed;
+
+struct icmsg_negotiate {
+ u16 icframe_vercnt;
+ u16 icmsg_vercnt;
+ u32 reserved;
+ struct ic_version icversion_data[1]; /* any size array */
+} __packed;
+
+struct shutdown_msg_data {
+ u32 reason_code;
+ u32 timeout_seconds;
+ u32 flags;
+ u8 display_message[2048];
+} __packed;
+
+struct heartbeat_msg_data {
+ u64 seq_num;
+ u32 reserved[8];
+} __packed;
+
+/* Time Sync IC defs */
+#define ICTIMESYNCFLAG_PROBE 0
+#define ICTIMESYNCFLAG_SYNC 1
+#define ICTIMESYNCFLAG_SAMPLE 2
+
+#ifdef __x86_64__
+#define WLTIMEDELTA 116444736000000000L /* in 100ns unit */
+#else
+#define WLTIMEDELTA 116444736000000000LL
+#endif
+
+struct ictimesync_data {
+ u64 parenttime;
+ u64 childtime;
+ u64 roundtriptime;
+ u8 flags;
+} __packed;
+
+/* Index for each IC struct in array hv_cb_utils[] */
+#define HV_SHUTDOWN_MSG 0
+#define HV_TIMESYNC_MSG 1
+#define HV_HEARTBEAT_MSG 2
+#define HV_KVP_MSG 3
+
+struct hyperv_service_callback {
+ u8 msg_type;
+ char *log_msg;
+ unsigned char data[16];
+ struct vmbus_channel *channel;
+ void (*callback) (void *context);
+};
+
+extern void prep_negotiate_resp(struct icmsg_hdr *,
+ struct icmsg_negotiate *, u8 *);
+extern void chn_cb_negotiate(void *);
+extern struct hyperv_service_callback hv_cb_utils[];
+
+#endif /* _HYPERV_H */
--
1.7.4.1

2011-05-10 08:37:05

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 180/206] Staging: hv: Include the newly created header files in blkvsc_drv.c

Include the newly created header files in blkvsc_drv.c.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/blkvsc_drv.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 10da9bb..efc63f1 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -31,12 +31,9 @@
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_dbg.h>
-#include "hv_api.h"
-#include "logging.h"
-#include "version_info.h"
-#include "vmbus.h"
-#include "storvsc_api.h"

+#include <linux/hyperv.h>
+#include "hyperv_storage.h"

#define BLKVSC_MINORS 64

--
1.7.4.1

2011-05-10 08:33:16

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 181/206] Staging: hv: Include the newly created header files in storvsc.c

Include the newly created header files in storvsc.c.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 8d7a490..3bc174e 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -27,13 +27,9 @@
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/delay.h>
-#include "hv_api.h"
-#include "logging.h"
-#include "storvsc_api.h"
-#include "vmbus_packet_format.h"
-#include "vstorage.h"
-#include "channel.h"

+#include <linux/hyperv.h>
+#include "hyperv_storage.h"

static inline struct storvsc_device *alloc_stor_device(struct hv_device *device)
{
--
1.7.4.1

2011-05-10 08:47:33

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 182/206] Staging: hv: Include the newly created header files in storvsc_drv.c

Include the newly created header files in storvsc_drv.c.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_drv.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 907d855..9a1d791 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -32,13 +32,10 @@
#include <scsi/scsi_eh.h>
#include <scsi/scsi_devinfo.h>
#include <scsi/scsi_dbg.h>
-#include "hv_api.h"
-#include "logging.h"
-#include "version_info.h"
-#include "vmbus.h"
-#include "storvsc_api.h"
-#include "vstorage.h"
-#include "channel.h"
+
+#include <linux/hyperv.h>
+#include "hyperv_storage.h"
+

static int storvsc_ringbuffer_size = STORVSC_RING_BUFFER_SIZE;

--
1.7.4.1

2011-05-10 08:49:43

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 183/206] Staging: hv: Include the new header files in the network driver

Include the new header files in the network driver.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/netvsc.c | 7 ++-----
drivers/staging/hv/netvsc_drv.c | 8 +++-----
drivers/staging/hv/rndis_filter.c | 8 ++++----
3 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c
index 4eb4482..e489a32 100644
--- a/drivers/staging/hv/netvsc.c
+++ b/drivers/staging/hv/netvsc.c
@@ -27,12 +27,9 @@
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/slab.h>
-#include "hv_api.h"
-#include "logging.h"
-#include "netvsc.h"
-#include "rndis_filter.h"
-#include "channel.h"

+#include <linux/hyperv.h>
+#include "hyperv_net.h"

/* Globals */
static const char *driver_name = "netvsc";
diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
index c5e7b93..aac6748 100644
--- a/drivers/staging/hv/netvsc_drv.c
+++ b/drivers/staging/hv/netvsc_drv.c
@@ -38,11 +38,9 @@
#include <net/route.h>
#include <net/sock.h>
#include <net/pkt_sched.h>
-#include "hv_api.h"
-#include "logging.h"
-#include "version_info.h"
-#include "vmbus.h"
-#include "netvsc_api.h"
+
+#include <linux/hyperv.h>
+#include "hyperv_net.h"

struct net_device_context {
/* point back to our device context */
diff --git a/drivers/staging/hv/rndis_filter.c b/drivers/staging/hv/rndis_filter.c
index 2037836..727b810 100644
--- a/drivers/staging/hv/rndis_filter.c
+++ b/drivers/staging/hv/rndis_filter.c
@@ -26,10 +26,10 @@
#include <linux/io.h>
#include <linux/if_ether.h>
#include <linux/netdevice.h>
-#include "logging.h"
-#include "hv_api.h"
-#include "netvsc_api.h"
-#include "rndis_filter.h"
+
+#include <linux/hyperv.h>
+#include "hyperv_net.h"
+

/* Data types */
struct rndis_filter_driver_object {
--
1.7.4.1

2011-05-10 09:55:15

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 184/206] Staging: hv: Include the new header files in vmbus driver

Include the new header files in vmbus driver.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/channel.c | 6 +++---
drivers/staging/hv/channel_mgmt.c | 7 +++----
drivers/staging/hv/connection.c | 5 ++---
drivers/staging/hv/hv.c | 6 +++---
drivers/staging/hv/ring_buffer.c | 4 ++--
drivers/staging/hv/vmbus_drv.c | 8 ++------
6 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index a2a190e..b9b082c 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -26,9 +26,9 @@
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/module.h>
-#include "hv_api.h"
-#include "logging.h"
-#include "vmbus_private.h"
+
+#include <linux/hyperv.h>
+#include "hyperv_vmbus.h"

#define NUM_PAGES_SPANNED(addr, len) \
((PAGE_ALIGN(addr + len) >> PAGE_SHIFT) - (addr >> PAGE_SHIFT))
diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c
index 33cb5d5..0e4e05a 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -28,10 +28,9 @@
#include <linux/list.h>
#include <linux/module.h>
#include <linux/completion.h>
-#include "hv_api.h"
-#include "logging.h"
-#include "vmbus_private.h"
-#include "utils.h"
+
+#include <linux/hyperv.h>
+#include "hyperv_vmbus.h"

struct vmbus_channel_message_table_entry {
enum vmbus_channel_message_type message_type;
diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c
index dd62585..445db48 100644
--- a/drivers/staging/hv/connection.c
+++ b/drivers/staging/hv/connection.c
@@ -28,10 +28,9 @@
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
-#include "hv_api.h"
-#include "logging.h"
-#include "vmbus_private.h"

+#include <linux/hyperv.h>
+#include "hyperv_vmbus.h"

struct vmbus_connection vmbus_connection = {
.conn_state = DISCONNECTED,
diff --git a/drivers/staging/hv/hv.c b/drivers/staging/hv/hv.c
index 2efac38..037424b6 100644
--- a/drivers/staging/hv/hv.c
+++ b/drivers/staging/hv/hv.c
@@ -25,9 +25,9 @@
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
-#include "hv_api.h"
-#include "logging.h"
-#include "vmbus_private.h"
+
+#include <linux/hyperv.h>
+#include "hyperv_vmbus.h"

/* The one and only */
struct hv_context hv_context = {
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index badf52a..ec262c1 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -25,9 +25,9 @@

#include <linux/kernel.h>
#include <linux/mm.h>
-#include "logging.h"
-#include "ring_buffer.h"

+#include <linux/hyperv.h>
+#include "hyperv_vmbus.h"

/* #defines */

diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 5dcd87a..5a049ab 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -34,13 +34,9 @@
#include <linux/acpi.h>
#include <acpi/acpi_bus.h>
#include <linux/completion.h>
-#include "version_info.h"
-#include "hv_api.h"
-#include "logging.h"
-#include "vmbus.h"
-#include "channel.h"
-#include "vmbus_private.h"

+#include <linux/hyperv.h>
+#include "hyperv_vmbus.h"

static struct pci_dev *hv_pci_dev;

--
1.7.4.1

2011-05-10 08:38:39

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 185/206] Staging: hv: Include the newly created header file in the util driver

Include the newly created header file in the util driver.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv_kvp.c | 11 +----------
drivers/staging/hv/hv_util.c | 11 +----------
2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/hv/hv_kvp.c b/drivers/staging/hv/hv_kvp.c
index c71a148..94166e8 100644
--- a/drivers/staging/hv/hv_kvp.c
+++ b/drivers/staging/hv/hv_kvp.c
@@ -27,16 +27,7 @@
#include <linux/connector.h>
#include <linux/workqueue.h>

-#include "logging.h"
-#include "hv_api.h"
-#include "vmbus.h"
-#include "vmbus_packet_format.h"
-#include "vmbus_channel_interface.h"
-#include "version_info.h"
-#include "channel.h"
-#include "vmbus_private.h"
-#include "vmbus_api.h"
-#include "utils.h"
+#include <linux/hyperv.h>
#include "hv_kvp.h"


diff --git a/drivers/staging/hv/hv_util.c b/drivers/staging/hv/hv_util.c
index ea76dda..14672b7 100644
--- a/drivers/staging/hv/hv_util.c
+++ b/drivers/staging/hv/hv_util.c
@@ -29,16 +29,7 @@
#include <linux/dmi.h>
#include <linux/pci.h>

-#include "logging.h"
-#include "hv_api.h"
-#include "vmbus.h"
-#include "vmbus_packet_format.h"
-#include "vmbus_channel_interface.h"
-#include "version_info.h"
-#include "channel.h"
-#include "vmbus_private.h"
-#include "vmbus_api.h"
-#include "utils.h"
+#include <linux/hyperv.h>
#include "hv_kvp.h"

static u8 *shut_txf_buf;
--
1.7.4.1

2011-05-10 08:44:12

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 186/206] Staging: hv: Include the newly created header file in the mouse driver

Include the newly created header file in the mouse driver.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index af4db64..430030c 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -26,14 +26,7 @@
#include <linux/dmi.h>
#include <linux/delay.h>

-#include "hv_api.h"
-#include "logging.h"
-#include "version_info.h"
-#include "vmbus.h"
-#include "vmbus_api.h"
-#include "channel.h"
-#include "vmbus_packet_format.h"
-
+#include <linux/hyperv.h>

/*
* Data types
--
1.7.4.1

2011-05-10 09:37:32

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 187/206] Staging: hv: Get rid of channel.h

Now, get rid of channel.h.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/channel.h | 112 ------------------------------------------
1 files changed, 0 insertions(+), 112 deletions(-)
delete mode 100644 drivers/staging/hv/channel.h

diff --git a/drivers/staging/hv/channel.h b/drivers/staging/hv/channel.h
deleted file mode 100644
index de4f867..0000000
--- a/drivers/staging/hv/channel.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *
- * Copyright (c) 2009, Microsoft Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Authors:
- * Haiyang Zhang <[email protected]>
- * Hank Janssen <[email protected]>
- *
- */
-
-
-#ifndef _CHANNEL_H_
-#define _CHANNEL_H_
-
-#include "channel_mgmt.h"
-
-/* The format must be the same as struct vmdata_gpa_direct */
-struct vmbus_channel_packet_page_buffer {
- u16 type;
- u16 dataoffset8;
- u16 length8;
- u16 flags;
- u64 transactionid;
- u32 reserved;
- u32 rangecount;
- struct hv_page_buffer range[MAX_PAGE_BUFFER_COUNT];
-} __packed;
-
-/* The format must be the same as struct vmdata_gpa_direct */
-struct vmbus_channel_packet_multipage_buffer {
- u16 type;
- u16 dataoffset8;
- u16 length8;
- u16 flags;
- u64 transactionid;
- u32 reserved;
- u32 rangecount; /* Always 1 in this case */
- struct hv_multipage_buffer range;
-} __packed;
-
-
-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);
-
-extern int vmbus_establish_gpadl(struct vmbus_channel *channel,
- void *kbuffer,
- u32 size,
- u32 *gpadl_handle);
-
-extern int vmbus_teardown_gpadl(struct vmbus_channel *channel,
- u32 gpadl_handle);
-
-extern int vmbus_recvpacket(struct vmbus_channel *channel,
- void *buffer,
- u32 bufferlen,
- u32 *buffer_actual_len,
- u64 *requestid);
-
-extern int vmbus_recvpacket_raw(struct vmbus_channel *channel,
- void *buffer,
- u32 bufferlen,
- u32 *buffer_actual_len,
- u64 *requestid);
-
-extern void vmbus_onchannel_event(struct vmbus_channel *channel);
-
-extern void vmbus_get_debug_info(struct vmbus_channel *channel,
- struct vmbus_channel_debug_info *debug);
-
-extern void vmbus_ontimer(unsigned long data);
-
-#endif /* _CHANNEL_H_ */
--
1.7.4.1

2011-05-10 08:44:05

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 188/206] Staging: hv: Get rid of channel_mgmt.h

Now, get rid of channel_mgmt.h

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/channel_mgmt.h | 318 -------------------------------------
1 files changed, 0 insertions(+), 318 deletions(-)
delete mode 100644 drivers/staging/hv/channel_mgmt.h

diff --git a/drivers/staging/hv/channel_mgmt.h b/drivers/staging/hv/channel_mgmt.h
deleted file mode 100644
index f895d0a..0000000
--- a/drivers/staging/hv/channel_mgmt.h
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- *
- * Copyright (c) 2009, Microsoft Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Authors:
- * Haiyang Zhang <[email protected]>
- * Hank Janssen <[email protected]>
- *
- */
-
-
-#ifndef _CHANNEL_MGMT_H_
-#define _CHANNEL_MGMT_H_
-
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/workqueue.h>
-#include <linux/completion.h>
-#include "ring_buffer.h"
-#include "vmbus_channel_interface.h"
-#include "vmbus_packet_format.h"
-
-/* Version 1 messages */
-enum vmbus_channel_message_type {
- CHANNELMSG_INVALID = 0,
- CHANNELMSG_OFFERCHANNEL = 1,
- CHANNELMSG_RESCIND_CHANNELOFFER = 2,
- CHANNELMSG_REQUESTOFFERS = 3,
- CHANNELMSG_ALLOFFERS_DELIVERED = 4,
- CHANNELMSG_OPENCHANNEL = 5,
- CHANNELMSG_OPENCHANNEL_RESULT = 6,
- CHANNELMSG_CLOSECHANNEL = 7,
- CHANNELMSG_GPADL_HEADER = 8,
- CHANNELMSG_GPADL_BODY = 9,
- CHANNELMSG_GPADL_CREATED = 10,
- CHANNELMSG_GPADL_TEARDOWN = 11,
- CHANNELMSG_GPADL_TORNDOWN = 12,
- CHANNELMSG_RELID_RELEASED = 13,
- CHANNELMSG_INITIATE_CONTACT = 14,
- CHANNELMSG_VERSION_RESPONSE = 15,
- CHANNELMSG_UNLOAD = 16,
-#ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
- CHANNELMSG_VIEWRANGE_ADD = 17,
- CHANNELMSG_VIEWRANGE_REMOVE = 18,
-#endif
- CHANNELMSG_COUNT
-};
-
-struct vmbus_channel_message_header {
- enum vmbus_channel_message_type msgtype;
- u32 padding;
-} __packed;
-
-/* Query VMBus Version parameters */
-struct vmbus_channel_query_vmbus_version {
- struct vmbus_channel_message_header header;
- u32 version;
-} __packed;
-
-/* VMBus Version Supported parameters */
-struct vmbus_channel_version_supported {
- struct vmbus_channel_message_header header;
- bool version_supported;
-} __packed;
-
-/* Offer Channel parameters */
-struct vmbus_channel_offer_channel {
- struct vmbus_channel_message_header header;
- struct vmbus_channel_offer offer;
- u32 child_relid;
- u8 monitorid;
- bool monitor_allocated;
-} __packed;
-
-/* Rescind Offer parameters */
-struct vmbus_channel_rescind_offer {
- struct vmbus_channel_message_header header;
- u32 child_relid;
-} __packed;
-
-/*
- * Request Offer -- no parameters, SynIC message contains the partition ID
- * Set Snoop -- no parameters, SynIC message contains the partition ID
- * Clear Snoop -- no parameters, SynIC message contains the partition ID
- * All Offers Delivered -- no parameters, SynIC message contains the partition
- * ID
- * Flush Client -- no parameters, SynIC message contains the partition ID
- */
-
-/* Open Channel parameters */
-struct vmbus_channel_open_channel {
- struct vmbus_channel_message_header header;
-
- /* Identifies the specific VMBus channel that is being opened. */
- u32 child_relid;
-
- /* ID making a particular open request at a channel offer unique. */
- u32 openid;
-
- /* GPADL for the channel's ring buffer. */
- u32 ringbuffer_gpadlhandle;
-
- /* GPADL for the channel's server context save area. */
- u32 server_contextarea_gpadlhandle;
-
- /*
- * The upstream ring buffer begins at offset zero in the memory
- * described by RingBufferGpadlHandle. The downstream ring buffer
- * follows it at this offset (in pages).
- */
- u32 downstream_ringbuffer_pageoffset;
-
- /* User-specific data to be passed along to the server endpoint. */
- unsigned char userdata[MAX_USER_DEFINED_BYTES];
-} __packed;
-
-/* Open Channel Result parameters */
-struct vmbus_channel_open_result {
- struct vmbus_channel_message_header header;
- u32 child_relid;
- u32 openid;
- u32 status;
-} __packed;
-
-/* Close channel parameters; */
-struct vmbus_channel_close_channel {
- struct vmbus_channel_message_header header;
- u32 child_relid;
-} __packed;
-
-/* Channel Message GPADL */
-#define GPADL_TYPE_RING_BUFFER 1
-#define GPADL_TYPE_SERVER_SAVE_AREA 2
-#define GPADL_TYPE_TRANSACTION 8
-
-/*
- * The number of PFNs in a GPADL message is defined by the number of
- * pages that would be spanned by ByteCount and ByteOffset. If the
- * implied number of PFNs won't fit in this packet, there will be a
- * follow-up packet that contains more.
- */
-struct vmbus_channel_gpadl_header {
- struct vmbus_channel_message_header header;
- u32 child_relid;
- u32 gpadl;
- u16 range_buflen;
- u16 rangecount;
- struct gpa_range range[0];
-} __packed;
-
-/* This is the followup packet that contains more PFNs. */
-struct vmbus_channel_gpadl_body {
- struct vmbus_channel_message_header header;
- u32 msgnumber;
- u32 gpadl;
- u64 pfn[0];
-} __packed;
-
-struct vmbus_channel_gpadl_created {
- struct vmbus_channel_message_header header;
- u32 child_relid;
- u32 gpadl;
- u32 creation_status;
-} __packed;
-
-struct vmbus_channel_gpadl_teardown {
- struct vmbus_channel_message_header header;
- u32 child_relid;
- u32 gpadl;
-} __packed;
-
-struct vmbus_channel_gpadl_torndown {
- struct vmbus_channel_message_header header;
- u32 gpadl;
-} __packed;
-
-#ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
-struct vmbus_channel_view_range_add {
- struct vmbus_channel_message_header header;
- PHYSICAL_ADDRESS viewrange_base;
- u64 viewrange_length;
- u32 child_relid;
-} __packed;
-
-struct vmbus_channel_view_range_remove {
- struct vmbus_channel_message_header header;
- PHYSICAL_ADDRESS viewrange_base;
- u32 child_relid;
-} __packed;
-#endif
-
-struct vmbus_channel_relid_released {
- struct vmbus_channel_message_header header;
- u32 child_relid;
-} __packed;
-
-struct vmbus_channel_initiate_contact {
- struct vmbus_channel_message_header header;
- u32 vmbus_version_requested;
- u32 padding2;
- u64 interrupt_page;
- u64 monitor_page1;
- u64 monitor_page2;
-} __packed;
-
-struct vmbus_channel_version_response {
- struct vmbus_channel_message_header header;
- bool version_supported;
-} __packed;
-
-enum vmbus_channel_state {
- CHANNEL_OFFER_STATE,
- CHANNEL_OPENING_STATE,
- CHANNEL_OPEN_STATE,
-};
-
-struct vmbus_channel {
- struct list_head listentry;
-
- struct hv_device *device_obj;
-
- struct timer_list poll_timer; /* SA-111 workaround */
- struct work_struct work;
-
- enum vmbus_channel_state state;
-
- struct vmbus_channel_offer_channel offermsg;
- /*
- * These are based on the OfferMsg.MonitorId.
- * Save it here for easy access.
- */
- u8 monitor_grp;
- u8 monitor_bit;
-
- u32 ringbuffer_gpadlhandle;
-
- /* Allocated memory for ring buffer */
- void *ringbuffer_pages;
- u32 ringbuffer_pagecount;
- struct hv_ring_buffer_info outbound; /* send to parent */
- struct hv_ring_buffer_info inbound; /* receive from parent */
- spinlock_t inbound_lock;
- struct workqueue_struct *controlwq;
-
- /* Channel callback are invoked in this workqueue context */
- /* HANDLE dataWorkQueue; */
-
- void (*onchannel_callback)(void *context);
- void *channel_callback_context;
-};
-
-struct vmbus_channel_debug_info {
- u32 relid;
- enum vmbus_channel_state state;
- struct hv_guid interfacetype;
- struct hv_guid interface_instance;
- u32 monitorid;
- u32 servermonitor_pending;
- u32 servermonitor_latency;
- u32 servermonitor_connectionid;
- u32 clientmonitor_pending;
- u32 clientmonitor_latency;
- u32 clientmonitor_connectionid;
-
- struct hv_ring_buffer_debug_info inbound;
- struct hv_ring_buffer_debug_info outbound;
-};
-
-/*
- * Represents each channel msg on the vmbus connection This is a
- * variable-size data structure depending on the msg type itself
- */
-struct vmbus_channel_msginfo {
- /* Bookkeeping stuff */
- struct list_head msglistentry;
-
- /* So far, this is only used to handle gpadl body message */
- struct list_head submsglist;
-
- /* Synchronize the request/response if needed */
- struct completion waitevent;
- union {
- struct vmbus_channel_version_supported version_supported;
- struct vmbus_channel_open_result open_result;
- struct vmbus_channel_gpadl_torndown gpadl_torndown;
- struct vmbus_channel_gpadl_created gpadl_created;
- struct vmbus_channel_version_response version_response;
- } response;
-
- u32 msgsize;
- /*
- * The channel message that goes out on the "wire".
- * It will contain at minimum the VMBUS_CHANNEL_MESSAGE_HEADER header
- */
- unsigned char msg[0];
-};
-
-
-void free_channel(struct vmbus_channel *channel);
-
-void vmbus_onmessage(void *context);
-
-int vmbus_request_offers(void);
-
-#endif /* _CHANNEL_MGMT_H_ */
--
1.7.4.1

2011-05-10 09:20:53

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 189/206] Staging: hv: Get rid of hv_api.h

Now, get rid of hv_api.h.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv_api.h | 910 -------------------------------------------
1 files changed, 0 insertions(+), 910 deletions(-)
delete mode 100644 drivers/staging/hv/hv_api.h

diff --git a/drivers/staging/hv/hv_api.h b/drivers/staging/hv/hv_api.h
deleted file mode 100644
index 43a7228..0000000
--- a/drivers/staging/hv/hv_api.h
+++ /dev/null
@@ -1,910 +0,0 @@
-/*
- *
- * Copyright (c) 2009, Microsoft Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Authors:
- * Haiyang Zhang <[email protected]>
- * Hank Janssen <[email protected]>
- *
- */
-#ifndef __HV_API_H
-#define __HV_API_H
-
-struct hv_guid {
- unsigned char data[16];
-};
-
-
-
-/* Status codes for hypervisor operations. */
-
-/*
- * HV_STATUS_SUCCESS
- * The specified hypercall succeeded
- */
-#define HV_STATUS_SUCCESS ((u16)0x0000)
-
-/*
- * HV_STATUS_INVALID_HYPERCALL_CODE
- * The hypervisor does not support the operation because the specified
- * hypercall code is not supported.
- */
-#define HV_STATUS_INVALID_HYPERCALL_CODE ((u16)0x0002)
-
-/*
- * HV_STATUS_INVALID_HYPERCALL_INPUT
- * The hypervisor does not support the operation because the encoding for the
- * hypercall input register is not supported.
- */
-#define HV_STATUS_INVALID_HYPERCALL_INPUT ((u16)0x0003)
-
-/*
- * HV_STATUS_INVALID_ALIGNMENT
- * The hypervisor could not perform the operation because a parameter has an
- * invalid alignment.
- */
-#define HV_STATUS_INVALID_ALIGNMENT ((u16)0x0004)
-
-/*
- * HV_STATUS_INVALID_PARAMETER
- * The hypervisor could not perform the operation because an invalid parameter
- * was specified.
- */
-#define HV_STATUS_INVALID_PARAMETER ((u16)0x0005)
-
-/*
- * HV_STATUS_ACCESS_DENIED
- * Access to the specified object was denied.
- */
-#define HV_STATUS_ACCESS_DENIED ((u16)0x0006)
-
-/*
- * HV_STATUS_INVALID_PARTITION_STATE
- * The hypervisor could not perform the operation because the partition is
- * entering or in an invalid state.
- */
-#define HV_STATUS_INVALID_PARTITION_STATE ((u16)0x0007)
-
-/*
- * HV_STATUS_OPERATION_DENIED
- * The operation is not allowed in the current state.
- */
-#define HV_STATUS_OPERATION_DENIED ((u16)0x0008)
-
-/*
- * HV_STATUS_UNKNOWN_PROPERTY
- * The hypervisor does not recognize the specified partition property.
- */
-#define HV_STATUS_UNKNOWN_PROPERTY ((u16)0x0009)
-
-/*
- * HV_STATUS_PROPERTY_VALUE_OUT_OF_RANGE
- * The specified value of a partition property is out of range or violates an
- * invariant.
- */
-#define HV_STATUS_PROPERTY_VALUE_OUT_OF_RANGE ((u16)0x000A)
-
-/*
- * HV_STATUS_INSUFFICIENT_MEMORY
- * There is not enough memory in the hypervisor pool to complete the operation.
- */
-#define HV_STATUS_INSUFFICIENT_MEMORY ((u16)0x000B)
-
-/*
- * HV_STATUS_PARTITION_TOO_DEEP
- * The maximum partition depth has been exceeded for the partition hierarchy.
- */
-#define HV_STATUS_PARTITION_TOO_DEEP ((u16)0x000C)
-
-/*
- * HV_STATUS_INVALID_PARTITION_ID
- * A partition with the specified partition Id does not exist.
- */
-#define HV_STATUS_INVALID_PARTITION_ID ((u16)0x000D)
-
-/*
- * HV_STATUS_INVALID_VP_INDEX
- * The hypervisor could not perform the operation because the specified VP
- * index is invalid.
- */
-#define HV_STATUS_INVALID_VP_INDEX ((u16)0x000E)
-
-/*
- * HV_STATUS_NOT_FOUND
- * The iteration is complete; no addition items in the iteration could be
- * found.
- */
-#define HV_STATUS_NOT_FOUND ((u16)0x0010)
-
-/*
- * HV_STATUS_INVALID_PORT_ID
- * The hypervisor could not perform the operation because the specified port
- * identifier is invalid.
- */
-#define HV_STATUS_INVALID_PORT_ID ((u16)0x0011)
-
-/*
- * HV_STATUS_INVALID_CONNECTION_ID
- * The hypervisor could not perform the operation because the specified
- * connection identifier is invalid.
- */
-#define HV_STATUS_INVALID_CONNECTION_ID ((u16)0x0012)
-
-/*
- * HV_STATUS_INSUFFICIENT_BUFFERS
- * You did not supply enough message buffers to send a message.
- */
-#define HV_STATUS_INSUFFICIENT_BUFFERS ((u16)0x0013)
-
-/*
- * HV_STATUS_NOT_ACKNOWLEDGED
- * The previous virtual interrupt has not been acknowledged.
- */
-#define HV_STATUS_NOT_ACKNOWLEDGED ((u16)0x0014)
-
-/*
- * HV_STATUS_INVALID_VP_STATE
- * A virtual processor is not in the correct state for the performance of the
- * indicated operation.
- */
-#define HV_STATUS_INVALID_VP_STATE ((u16)0x0015)
-
-/*
- * HV_STATUS_ACKNOWLEDGED
- * The previous virtual interrupt has already been acknowledged.
- */
-#define HV_STATUS_ACKNOWLEDGED ((u16)0x0016)
-
-/*
- * HV_STATUS_INVALID_SAVE_RESTORE_STATE
- * The indicated partition is not in a valid state for saving or restoring.
- */
-#define HV_STATUS_INVALID_SAVE_RESTORE_STATE ((u16)0x0017)
-
-/*
- * HV_STATUS_INVALID_SYNIC_STATE
- * The hypervisor could not complete the operation because a required feature
- * of the synthetic interrupt controller (SynIC) was disabled.
- */
-#define HV_STATUS_INVALID_SYNIC_STATE ((u16)0x0018)
-
-/*
- * HV_STATUS_OBJECT_IN_USE
- * The hypervisor could not perform the operation because the object or value
- * was either already in use or being used for a purpose that would not permit
- * completing the operation.
- */
-#define HV_STATUS_OBJECT_IN_USE ((u16)0x0019)
-
-/*
- * HV_STATUS_INVALID_PROXIMITY_DOMAIN_INFO
- * The proximity domain information is invalid.
- */
-#define HV_STATUS_INVALID_PROXIMITY_DOMAIN_INFO ((u16)0x001A)
-
-/*
- * HV_STATUS_NO_DATA
- * An attempt to retrieve debugging data failed because none was available.
- */
-#define HV_STATUS_NO_DATA ((u16)0x001B)
-
-/*
- * HV_STATUS_INACTIVE
- * The physical connection being used for debuggging has not recorded any
- * receive activity since the last operation.
- */
-#define HV_STATUS_INACTIVE ((u16)0x001C)
-
-/*
- * HV_STATUS_NO_RESOURCES
- * There are not enough resources to complete the operation.
- */
-#define HV_STATUS_NO_RESOURCES ((u16)0x001D)
-
-/*
- * HV_STATUS_FEATURE_UNAVAILABLE
- * A hypervisor feature is not available to the user.
- */
-#define HV_STATUS_FEATURE_UNAVAILABLE ((u16)0x001E)
-
-/*
- * HV_STATUS_UNSUCCESSFUL
- * {Operation Failed} The requested operation was unsuccessful.
- */
-#define HV_STATUS_UNSUCCESSFUL ((u16)0x1001)
-
-/*
- * HV_STATUS_INSUFFICIENT_BUFFER
- * The specified buffer was too small to contain all of the requested data.
- */
-#define HV_STATUS_INSUFFICIENT_BUFFER ((u16)0x1002)
-
-/*
- * HV_STATUS_GPA_NOT_PRESENT
- * The guest physical address is not currently associated with a system
- * physical address.
- */
-#define HV_STATUS_GPA_NOT_PRESENT ((u16)0x1003)
-
-/*
- * HV_STATUS_GUEST_PAGE_FAULT
- * The operation would have resulted in a page fault in the guest.
- */
-#define HV_STATUS_GUEST_PAGE_FAULT ((u16)0x1004)
-
-/*
- * HV_STATUS_RUNDOWN_DISABLED
- * The operation cannot proceed as the rundown object was marked disabled.
- */
-#define HV_STATUS_RUNDOWN_DISABLED ((u16)0x1005)
-
-/*
- * HV_STATUS_KEY_ALREADY_EXISTS
- * The entry cannot be added as another entry with the same key already exists.
- */
-#define HV_STATUS_KEY_ALREADY_EXISTS ((u16)0x1006)
-
-/*
- * HV_STATUS_GPA_INTERCEPT
- * The operation resulted an intercept on a region of guest physical memory.
- */
-#define HV_STATUS_GPA_INTERCEPT ((u16)0x1007)
-
-/*
- * HV_STATUS_GUEST_GENERAL_PROTECTION_FAULT
- * The operation would have resulted in a general protection fault in the
- * guest.
- */
-#define HV_STATUS_GUEST_GENERAL_PROTECTION_FAULT ((u16)0x1008)
-
-/*
- * HV_STATUS_GUEST_STACK_FAULT
- * The operation would have resulted in a stack fault in the guest.
- */
-#define HV_STATUS_GUEST_STACK_FAULT ((u16)0x1009)
-
-/*
- * HV_STATUS_GUEST_INVALID_OPCODE_FAULT
- * The operation would have resulted in an invalid opcode fault in the guest.
- */
-#define HV_STATUS_GUEST_INVALID_OPCODE_FAULT ((u16)0x100A)
-
-/*
- * HV_STATUS_FINALIZE_INCOMPLETE
- * The partition is not completely finalized.
- */
-#define HV_STATUS_FINALIZE_INCOMPLETE ((u16)0x100B)
-
-/*
- * HV_STATUS_GUEST_MACHINE_CHECK_ABORT
- * The operation would have resulted in an machine check abort in the guest.
- */
-#define HV_STATUS_GUEST_MACHINE_CHECK_ABORT ((u16)0x100C)
-
-/*
- * HV_STATUS_ILLEGAL_OVERLAY_ACCESS
- * An illegal access was attempted to an overlay page.
- */
-#define HV_STATUS_ILLEGAL_OVERLAY_ACCESS ((u16)0x100D)
-
-/*
- * HV_STATUS_INSUFFICIENT_SYSTEM_VA
- * There is not enough system VA space available to satisfy the request,
- */
-#define HV_STATUS_INSUFFICIENT_SYSTEM_VA ((u16)0x100E)
-
-/*
- * HV_STATUS_VIRTUAL_ADDRESS_NOT_MAPPED
- * The passed virtual address was not mapped in the hypervisor address space.
- */
-#define HV_STATUS_VIRTUAL_ADDRESS_NOT_MAPPED ((u16)0x100F)
-
-/*
- * HV_STATUS_NOT_IMPLEMENTED
- * The requested operation is not implemented in this version of the
- * hypervisor.
- */
-#define HV_STATUS_NOT_IMPLEMENTED ((u16)0x1010)
-
-/*
- * HV_STATUS_VMX_INSTRUCTION_FAILED
- * The requested VMX instruction failed to complete successfully.
- */
-#define HV_STATUS_VMX_INSTRUCTION_FAILED ((u16)0x1011)
-
-/*
- * HV_STATUS_VMX_INSTRUCTION_FAILED_WITH_STATUS
- * The requested VMX instruction failed to complete successfully indicating
- * status.
- */
-#define HV_STATUS_VMX_INSTRUCTION_FAILED_WITH_STATUS ((u16)0x1012)
-
-/*
- * HV_STATUS_MSR_ACCESS_FAILED
- * The requested access to the model specific register failed.
- */
-#define HV_STATUS_MSR_ACCESS_FAILED ((u16)0x1013)
-
-/*
- * HV_STATUS_CR_ACCESS_FAILED
- * The requested access to the control register failed.
- */
-#define HV_STATUS_CR_ACCESS_FAILED ((u16)0x1014)
-
-/*
- * HV_STATUS_TIMEOUT
- * The specified timeout expired before the operation completed.
- */
-#define HV_STATUS_TIMEOUT ((u16)0x1016)
-
-/*
- * HV_STATUS_MSR_INTERCEPT
- * The requested access to the model specific register generated an intercept.
- */
-#define HV_STATUS_MSR_INTERCEPT ((u16)0x1017)
-
-/*
- * HV_STATUS_CPUID_INTERCEPT
- * The CPUID instruction generated an intercept.
- */
-#define HV_STATUS_CPUID_INTERCEPT ((u16)0x1018)
-
-/*
- * HV_STATUS_REPEAT_INSTRUCTION
- * The current instruction should be repeated and the instruction pointer not
- * advanced.
- */
-#define HV_STATUS_REPEAT_INSTRUCTION ((u16)0x1019)
-
-/*
- * HV_STATUS_PAGE_PROTECTION_VIOLATION
- * The current instruction should be repeated and the instruction pointer not
- * advanced.
- */
-#define HV_STATUS_PAGE_PROTECTION_VIOLATION ((u16)0x101A)
-
-/*
- * HV_STATUS_PAGE_TABLE_INVALID
- * The current instruction should be repeated and the instruction pointer not
- * advanced.
- */
-#define HV_STATUS_PAGE_TABLE_INVALID ((u16)0x101B)
-
-/*
- * HV_STATUS_PAGE_NOT_PRESENT
- * The current instruction should be repeated and the instruction pointer not
- * advanced.
- */
-#define HV_STATUS_PAGE_NOT_PRESENT ((u16)0x101C)
-
-/*
- * HV_STATUS_IO_INTERCEPT
- * The requested access to the I/O port generated an intercept.
- */
-#define HV_STATUS_IO_INTERCEPT ((u16)0x101D)
-
-/*
- * HV_STATUS_NOTHING_TO_DO
- * There is nothing to do.
- */
-#define HV_STATUS_NOTHING_TO_DO ((u16)0x101E)
-
-/*
- * HV_STATUS_THREAD_TERMINATING
- * The requested thread is terminating.
- */
-#define HV_STATUS_THREAD_TERMINATING ((u16)0x101F)
-
-/*
- * HV_STATUS_SECTION_ALREADY_CONSTRUCTED
- * The specified section was already constructed.
- */
-#define HV_STATUS_SECTION_ALREADY_CONSTRUCTED ((u16)0x1020)
-
-/* HV_STATUS_SECTION_NOT_ALREADY_CONSTRUCTED
- * The specified section was not already constructed.
- */
-#define HV_STATUS_SECTION_NOT_ALREADY_CONSTRUCTED ((u16)0x1021)
-
-/*
- * HV_STATUS_PAGE_ALREADY_COMMITTED
- * The specified virtual address was already backed by physical memory.
- */
-#define HV_STATUS_PAGE_ALREADY_COMMITTED ((u16)0x1022)
-
-/*
- * HV_STATUS_PAGE_NOT_ALREADY_COMMITTED
- * The specified virtual address was not already backed by physical memory.
- */
-#define HV_STATUS_PAGE_NOT_ALREADY_COMMITTED ((u16)0x1023)
-
-/*
- * HV_STATUS_COMMITTED_PAGES_REMAIN
- * Committed pages remain in the section.
- */
-#define HV_STATUS_COMMITTED_PAGES_REMAIN ((u16)0x1024)
-
-/*
- * HV_STATUS_NO_REMAINING_COMMITTED_PAGES
- * No additional committed pages beyond the specified page exist in the
- * section.
- */
-#define HV_STATUS_NO_REMAINING_COMMITTED_PAGES ((u16)0x1025)
-
-/*
- * HV_STATUS_INSUFFICIENT_COMPARTMENT_VA
- * The VA space of the compartment is exhausted.
- */
-#define HV_STATUS_INSUFFICIENT_COMPARTMENT_VA ((u16)0x1026)
-
-/*
- * HV_STATUS_DEREF_SPA_LIST_FULL
- * The SPA dereference list is full, and there are additional entries to be
- * added to it.
- */
-#define HV_STATUS_DEREF_SPA_LIST_FULL ((u16)0x1027)
-
-/*
- * HV_STATUS_GPA_OUT_OF_RANGE
- * The supplied GPA is out of range.
- */
-#define HV_STATUS_GPA_OUT_OF_RANGE ((u16)0x1027)
-
-/*
- * HV_STATUS_NONVOLATILE_XMM_STALE
- * The XMM register that was being accessed is stale.
- */
-#define HV_STATUS_NONVOLATILE_XMM_STALE ((u16)0x1028)
-
-/* HV_STATUS_UNSUPPORTED_PROCESSOR
- * The hypervisor does not support the processors in this system.
- */
-#define HV_STATUS_UNSUPPORTED_PROCESSOR ((u16)0x1029)
-
-/*
- * HV_STATUS_INSUFFICIENT_CROM_SPACE
- * Insufficient space existed for copying over the CROM contents.
- */
-#define HV_STATUS_INSUFFICIENT_CROM_SPACE ((u16)0x2000)
-
-/*
- * HV_STATUS_BAD_CROM_FORMAT
- * The contents of the CROM failed validation attempts.
- */
-#define HV_STATUS_BAD_CROM_FORMAT ((u16)0x2001)
-
-/*
- * HV_STATUS_UNSUPPORTED_CROM_FORMAT
- * The contents of the CROM contain contents the parser doesn't support.
- */
-#define HV_STATUS_UNSUPPORTED_CROM_FORMAT ((u16)0x2002)
-
-/*
- * HV_STATUS_UNSUPPORTED_CONTROLLER
- * The register format of the OHCI controller specified for debugging is not
- * supported.
- */
-#define HV_STATUS_UNSUPPORTED_CONTROLLER ((u16)0x2003)
-
-/*
- * HV_STATUS_CROM_TOO_LARGE
- * The CROM contents were to large to copy over.
- */
-#define HV_STATUS_CROM_TOO_LARGE ((u16)0x2004)
-
-/*
- * HV_STATUS_CONTROLLER_IN_USE
- * The OHCI controller specified for debugging cannot be used as it is already
- * in use.
- */
-#define HV_STATUS_CONTROLLER_IN_USE ((u16)0x2005)
-
-
-/*
- * The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent
- * is set by CPUID(HVCPUID_VERSION_FEATURES).
- */
-enum hv_cpuid_function {
- HVCPUID_VERSION_FEATURES = 0x00000001,
- HVCPUID_VENDOR_MAXFUNCTION = 0x40000000,
- HVCPUID_INTERFACE = 0x40000001,
-
- /*
- * The remaining functions depend on the value of
- * HVCPUID_INTERFACE
- */
- HVCPUID_VERSION = 0x40000002,
- HVCPUID_FEATURES = 0x40000003,
- HVCPUID_ENLIGHTENMENT_INFO = 0x40000004,
- HVCPUID_IMPLEMENTATION_LIMITS = 0x40000005,
-};
-
-/* Define the virtual APIC registers */
-#define HV_X64_MSR_EOI (0x40000070)
-#define HV_X64_MSR_ICR (0x40000071)
-#define HV_X64_MSR_TPR (0x40000072)
-#define HV_X64_MSR_APIC_ASSIST_PAGE (0x40000073)
-
-/* Define version of the synthetic interrupt controller. */
-#define HV_SYNIC_VERSION (1)
-
-/* Define synthetic interrupt controller model specific registers. */
-#define HV_X64_MSR_SCONTROL (0x40000080)
-#define HV_X64_MSR_SVERSION (0x40000081)
-#define HV_X64_MSR_SIEFP (0x40000082)
-#define HV_X64_MSR_SIMP (0x40000083)
-#define HV_X64_MSR_EOM (0x40000084)
-#define HV_X64_MSR_SINT0 (0x40000090)
-#define HV_X64_MSR_SINT1 (0x40000091)
-#define HV_X64_MSR_SINT2 (0x40000092)
-#define HV_X64_MSR_SINT3 (0x40000093)
-#define HV_X64_MSR_SINT4 (0x40000094)
-#define HV_X64_MSR_SINT5 (0x40000095)
-#define HV_X64_MSR_SINT6 (0x40000096)
-#define HV_X64_MSR_SINT7 (0x40000097)
-#define HV_X64_MSR_SINT8 (0x40000098)
-#define HV_X64_MSR_SINT9 (0x40000099)
-#define HV_X64_MSR_SINT10 (0x4000009A)
-#define HV_X64_MSR_SINT11 (0x4000009B)
-#define HV_X64_MSR_SINT12 (0x4000009C)
-#define HV_X64_MSR_SINT13 (0x4000009D)
-#define HV_X64_MSR_SINT14 (0x4000009E)
-#define HV_X64_MSR_SINT15 (0x4000009F)
-
-/* Define the expected SynIC version. */
-#define HV_SYNIC_VERSION_1 (0x1)
-
-/* Define synthetic interrupt controller message constants. */
-#define HV_MESSAGE_SIZE (256)
-#define HV_MESSAGE_PAYLOAD_BYTE_COUNT (240)
-#define HV_MESSAGE_PAYLOAD_QWORD_COUNT (30)
-#define HV_ANY_VP (0xFFFFFFFF)
-
-/* Define synthetic interrupt controller flag constants. */
-#define HV_EVENT_FLAGS_COUNT (256 * 8)
-#define HV_EVENT_FLAGS_BYTE_COUNT (256)
-#define HV_EVENT_FLAGS_DWORD_COUNT (256 / sizeof(u32))
-
-/* Define hypervisor message types. */
-enum hv_message_type {
- HVMSG_NONE = 0x00000000,
-
- /* Memory access messages. */
- HVMSG_UNMAPPED_GPA = 0x80000000,
- HVMSG_GPA_INTERCEPT = 0x80000001,
-
- /* Timer notification messages. */
- HVMSG_TIMER_EXPIRED = 0x80000010,
-
- /* Error messages. */
- HVMSG_INVALID_VP_REGISTER_VALUE = 0x80000020,
- HVMSG_UNRECOVERABLE_EXCEPTION = 0x80000021,
- HVMSG_UNSUPPORTED_FEATURE = 0x80000022,
-
- /* Trace buffer complete messages. */
- HVMSG_EVENTLOG_BUFFERCOMPLETE = 0x80000040,
-
- /* Platform-specific processor intercept messages. */
- HVMSG_X64_IOPORT_INTERCEPT = 0x80010000,
- HVMSG_X64_MSR_INTERCEPT = 0x80010001,
- HVMSG_X64_CPUID_INTERCEPT = 0x80010002,
- HVMSG_X64_EXCEPTION_INTERCEPT = 0x80010003,
- HVMSG_X64_APIC_EOI = 0x80010004,
- HVMSG_X64_LEGACY_FP_ERROR = 0x80010005
-};
-
-/* Define the number of synthetic interrupt sources. */
-#define HV_SYNIC_SINT_COUNT (16)
-#define HV_SYNIC_STIMER_COUNT (4)
-
-/* Define invalid partition identifier. */
-#define HV_PARTITION_ID_INVALID ((u64)0x0)
-
-/* Define connection identifier type. */
-union hv_connection_id {
- u32 asu32;
- struct {
- u32 id:24;
- u32 reserved:8;
- } u;
-};
-
-/* Define port identifier type. */
-union hv_port_id {
- u32 asu32;
- struct {
- u32 id:24;
- u32 reserved:8;
- } u ;
-};
-
-/* Define port type. */
-enum hv_port_type {
- HVPORT_MSG = 1,
- HVPORT_EVENT = 2,
- HVPORT_MONITOR = 3
-};
-
-/* Define port information structure. */
-struct hv_port_info {
- enum hv_port_type port_type;
- u32 padding;
- union {
- struct {
- u32 target_sint;
- u32 target_vp;
- u64 rsvdz;
- } message_port_info;
- struct {
- u32 target_sint;
- u32 target_vp;
- u16 base_flag_bumber;
- u16 flag_count;
- u32 rsvdz;
- } event_port_info;
- struct {
- u64 monitor_address;
- u64 rsvdz;
- } monitor_port_info;
- };
-};
-
-struct hv_connection_info {
- enum hv_port_type port_type;
- u32 padding;
- union {
- struct {
- u64 rsvdz;
- } message_connection_info;
- struct {
- u64 rsvdz;
- } event_connection_info;
- struct {
- u64 monitor_address;
- } monitor_connection_info;
- };
-};
-
-/* Define synthetic interrupt controller message flags. */
-union hv_message_flags {
- u8 asu8;
- struct {
- u8 msg_pending:1;
- u8 reserved:7;
- };
-};
-
-/* Define synthetic interrupt controller message header. */
-struct hv_message_header {
- enum hv_message_type message_type;
- u8 payload_size;
- union hv_message_flags message_flags;
- u8 reserved[2];
- union {
- u64 sender;
- union hv_port_id port;
- };
-};
-
-/* Define timer message payload structure. */
-struct hv_timer_message_payload {
- u32 timer_index;
- u32 reserved;
- u64 expiration_time; /* When the timer expired */
- u64 delivery_time; /* When the message was delivered */
-};
-
-/* Define synthetic interrupt controller message format. */
-struct hv_message {
- struct hv_message_header header;
- union {
- u64 payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT];
- } u ;
-};
-
-/* Define the number of message buffers associated with each port. */
-#define HV_PORT_MESSAGE_BUFFER_COUNT (16)
-
-/* Define the synthetic interrupt message page layout. */
-struct hv_message_page {
- struct hv_message sint_message[HV_SYNIC_SINT_COUNT];
-};
-
-/* Define the synthetic interrupt controller event flags format. */
-union hv_synic_event_flags {
- u8 flags8[HV_EVENT_FLAGS_BYTE_COUNT];
- u32 flags32[HV_EVENT_FLAGS_DWORD_COUNT];
-};
-
-/* Define the synthetic interrupt flags page layout. */
-struct hv_synic_event_flags_page {
- union hv_synic_event_flags sintevent_flags[HV_SYNIC_SINT_COUNT];
-};
-
-/* Define SynIC control register. */
-union hv_synic_scontrol {
- u64 as_uint64;
- struct {
- u64 enable:1;
- u64 reserved:63;
- };
-};
-
-/* Define synthetic interrupt source. */
-union hv_synic_sint {
- u64 as_uint64;
- struct {
- u64 vector:8;
- u64 reserved1:8;
- u64 masked:1;
- u64 auto_eoi:1;
- u64 reserved2:46;
- };
-};
-
-/* Define the format of the SIMP register */
-union hv_synic_simp {
- u64 as_uint64;
- struct {
- u64 simp_enabled:1;
- u64 preserved:11;
- u64 base_simp_gpa:52;
- };
-};
-
-/* Define the format of the SIEFP register */
-union hv_synic_siefp {
- u64 as_uint64;
- struct {
- u64 siefp_enabled:1;
- u64 preserved:11;
- u64 base_siefp_gpa:52;
- };
-};
-
-/* Definitions for the monitored notification facility */
-union hv_monitor_trigger_group {
- u64 as_uint64;
- struct {
- u32 pending;
- u32 armed;
- };
-};
-
-struct hv_monitor_parameter {
- union hv_connection_id connectionid;
- u16 flagnumber;
- u16 rsvdz;
-};
-
-union hv_monitor_trigger_state {
- u32 asu32;
-
- struct {
- u32 group_enable:4;
- u32 rsvdz:28;
- };
-};
-
-/* struct hv_monitor_page Layout */
-/* ------------------------------------------------------ */
-/* | 0 | TriggerState (4 bytes) | Rsvd1 (4 bytes) | */
-/* | 8 | TriggerGroup[0] | */
-/* | 10 | TriggerGroup[1] | */
-/* | 18 | TriggerGroup[2] | */
-/* | 20 | TriggerGroup[3] | */
-/* | 28 | Rsvd2[0] | */
-/* | 30 | Rsvd2[1] | */
-/* | 38 | Rsvd2[2] | */
-/* | 40 | NextCheckTime[0][0] | NextCheckTime[0][1] | */
-/* | ... | */
-/* | 240 | Latency[0][0..3] | */
-/* | 340 | Rsvz3[0] | */
-/* | 440 | Parameter[0][0] | */
-/* | 448 | Parameter[0][1] | */
-/* | ... | */
-/* | 840 | Rsvd4[0] | */
-/* ------------------------------------------------------ */
-struct hv_monitor_page {
- union hv_monitor_trigger_state trigger_state;
- u32 rsvdz1;
-
- union hv_monitor_trigger_group trigger_group[4];
- u64 rsvdz2[3];
-
- s32 next_checktime[4][32];
-
- u16 latency[4][32];
- u64 rsvdz3[32];
-
- struct hv_monitor_parameter parameter[4][32];
-
- u8 rsvdz4[1984];
-};
-
-/* Declare the various hypercall operations. */
-enum hv_call_code {
- HVCALL_POST_MESSAGE = 0x005c,
- HVCALL_SIGNAL_EVENT = 0x005d,
-};
-
-/* Definition of the hv_post_message hypercall input structure. */
-struct hv_input_post_message {
- union hv_connection_id connectionid;
- u32 reserved;
- enum hv_message_type message_type;
- u32 payload_size;
- u64 payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT];
-};
-
-/* Definition of the hv_signal_event hypercall input structure. */
-struct hv_input_signal_event {
- union hv_connection_id connectionid;
- u16 flag_number;
- u16 rsvdz;
-};
-
-/*
- * Versioning definitions used for guests reporting themselves to the
- * hypervisor, and visa versa.
- */
-
-/* Version info reported by guest OS's */
-enum hv_guest_os_vendor {
- HVGUESTOS_VENDOR_MICROSOFT = 0x0001
-};
-
-enum hv_guest_os_microsoft_ids {
- HVGUESTOS_MICROSOFT_UNDEFINED = 0x00,
- HVGUESTOS_MICROSOFT_MSDOS = 0x01,
- HVGUESTOS_MICROSOFT_WINDOWS3X = 0x02,
- HVGUESTOS_MICROSOFT_WINDOWS9X = 0x03,
- HVGUESTOS_MICROSOFT_WINDOWSNT = 0x04,
- HVGUESTOS_MICROSOFT_WINDOWSCE = 0x05
-};
-
-/*
- * Declare the MSR used to identify the guest OS.
- */
-#define HV_X64_MSR_GUEST_OS_ID 0x40000000
-
-union hv_x64_msr_guest_os_id_contents {
- u64 as_uint64;
- struct {
- u64 build_number:16;
- u64 service_version:8; /* Service Pack, etc. */
- u64 minor_version:8;
- u64 major_version:8;
- u64 os_id:8; /* enum hv_guest_os_microsoft_ids (if Vendor=MS) */
- u64 vendor_id:16; /* enum hv_guest_os_vendor */
- };
-};
-
-/*
- * Declare the MSR used to setup pages used to communicate with the hypervisor.
- */
-#define HV_X64_MSR_HYPERCALL 0x40000001
-
-union hv_x64_msr_hypercall_contents {
- u64 as_uint64;
- struct {
- u64 enable:1;
- u64 reserved:11;
- u64 guest_physical_address:52;
- };
-};
-
-#endif
--
1.7.4.1

2011-05-10 08:31:09

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 190/206] Staging: hv: Get rid of hv.h

Now, get rid of hv.h

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/hv.h | 140 -----------------------------------------------
1 files changed, 0 insertions(+), 140 deletions(-)
delete mode 100644 drivers/staging/hv/hv.h

diff --git a/drivers/staging/hv/hv.h b/drivers/staging/hv/hv.h
deleted file mode 100644
index 829aff8..0000000
--- a/drivers/staging/hv/hv.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- *
- * Copyright (c) 2009, Microsoft Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Authors:
- * Haiyang Zhang <[email protected]>
- * Hank Janssen <[email protected]>
- *
- */
-
-
-#ifndef __HV_H__
-#define __HV_H__
-
-#include "hv_api.h"
-
-enum {
- VMBUS_MESSAGE_CONNECTION_ID = 1,
- VMBUS_MESSAGE_PORT_ID = 1,
- VMBUS_EVENT_CONNECTION_ID = 2,
- VMBUS_EVENT_PORT_ID = 2,
- VMBUS_MONITOR_CONNECTION_ID = 3,
- VMBUS_MONITOR_PORT_ID = 3,
- VMBUS_MESSAGE_SINT = 2,
-};
-
-/* #defines */
-
-#define HV_PRESENT_BIT 0x80000000
-
-#define HV_LINUX_GUEST_ID_LO 0x00000000
-#define HV_LINUX_GUEST_ID_HI 0xB16B00B5
-#define HV_LINUX_GUEST_ID (((u64)HV_LINUX_GUEST_ID_HI << 32) | \
- HV_LINUX_GUEST_ID_LO)
-
-#define HV_CPU_POWER_MANAGEMENT (1 << 0)
-#define HV_RECOMMENDATIONS_MAX 4
-
-#define HV_X64_MAX 5
-#define HV_CAPS_MAX 8
-
-
-#define HV_HYPERCALL_PARAM_ALIGN sizeof(u64)
-
-
-/* Service definitions */
-
-#define HV_SERVICE_PARENT_PORT (0)
-#define HV_SERVICE_PARENT_CONNECTION (0)
-
-#define HV_SERVICE_CONNECT_RESPONSE_SUCCESS (0)
-#define HV_SERVICE_CONNECT_RESPONSE_INVALID_PARAMETER (1)
-#define HV_SERVICE_CONNECT_RESPONSE_UNKNOWN_SERVICE (2)
-#define HV_SERVICE_CONNECT_RESPONSE_CONNECTION_REJECTED (3)
-
-#define HV_SERVICE_CONNECT_REQUEST_MESSAGE_ID (1)
-#define HV_SERVICE_CONNECT_RESPONSE_MESSAGE_ID (2)
-#define HV_SERVICE_DISCONNECT_REQUEST_MESSAGE_ID (3)
-#define HV_SERVICE_DISCONNECT_RESPONSE_MESSAGE_ID (4)
-#define HV_SERVICE_MAX_MESSAGE_ID (4)
-
-#define HV_SERVICE_PROTOCOL_VERSION (0x0010)
-#define HV_CONNECT_PAYLOAD_BYTE_COUNT 64
-
-/* #define VMBUS_REVISION_NUMBER 6 */
-
-/* Our local vmbus's port and connection id. Anything >0 is fine */
-/* #define VMBUS_PORT_ID 11 */
-
-/* 628180B8-308D-4c5e-B7DB-1BEB62E62EF4 */
-static const struct hv_guid VMBUS_SERVICE_ID = {
- .data = {
- 0xb8, 0x80, 0x81, 0x62, 0x8d, 0x30, 0x5e, 0x4c,
- 0xb7, 0xdb, 0x1b, 0xeb, 0x62, 0xe6, 0x2e, 0xf4
- },
-};
-
-#define MAX_NUM_CPUS 32
-
-
-struct hv_input_signal_event_buffer {
- u64 align8;
- struct hv_input_signal_event event;
-};
-
-struct hv_context {
- /* We only support running on top of Hyper-V
- * So at this point this really can only contain the Hyper-V ID
- */
- u64 guestid;
-
- void *hypercall_page;
-
- bool synic_initialized;
-
- /*
- * This is used as an input param to HvCallSignalEvent hypercall. The
- * input param is immutable in our usage and must be dynamic mem (vs
- * stack or global). */
- struct hv_input_signal_event_buffer *signal_event_buffer;
- /* 8-bytes aligned of the buffer above */
- struct hv_input_signal_event *signal_event_param;
-
- void *synic_message_page[MAX_NUM_CPUS];
- void *synic_event_page[MAX_NUM_CPUS];
-};
-
-extern struct hv_context hv_context;
-
-
-/* Hv Interface */
-
-extern int hv_init(void);
-
-extern void hv_cleanup(void);
-
-extern u16 hv_post_message(union hv_connection_id connection_id,
- enum hv_message_type message_type,
- void *payload, size_t payload_size);
-
-extern u16 hv_signal_event(void);
-
-extern void hv_synic_init(void *irqarg);
-
-extern void hv_synic_cleanup(void *arg);
-
-#endif /* __HV_H__ */
--
1.7.4.1

2011-05-10 08:33:12

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 191/206] Staging: hv: Get rid of logging.h

Now, get rid of logging.h

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/logging.h | 98 ------------------------------------------
1 files changed, 0 insertions(+), 98 deletions(-)
delete mode 100644 drivers/staging/hv/logging.h

diff --git a/drivers/staging/hv/logging.h b/drivers/staging/hv/logging.h
deleted file mode 100644
index 1799951..0000000
--- a/drivers/staging/hv/logging.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- *
- * Copyright (c) 2009, Microsoft Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Authors:
- * Haiyang Zhang <[email protected]>
- * Hank Janssen <[email protected]>
- *
- */
-
-
-#ifndef _LOGGING_H_
-#define _LOGGING_H_
-
-#define LOWORD(dw) ((unsigned short)(dw))
-#define HIWORD(dw) ((unsigned short)(((unsigned int) (dw) >> 16) & 0xFFFF))
-
-/* #include <linux/init.h> */
-/* #include <linux/module.h> */
-
-
-#define VMBUS 0x0001
-#define STORVSC 0x0002
-#define NETVSC 0x0004
-#define INPUTVSC 0x0008
-#define BLKVSC 0x0010
-#define VMBUS_DRV 0x0100
-#define STORVSC_DRV 0x0200
-#define NETVSC_DRV 0x0400
-#define INPUTVSC_DRV 0x0800
-#define BLKVSC_DRV 0x1000
-
-#define ALL_MODULES (VMBUS |\
- STORVSC |\
- NETVSC |\
- INPUTVSC |\
- BLKVSC |\
- VMBUS_DRV |\
- STORVSC_DRV |\
- NETVSC_DRV |\
- INPUTVSC_DRV|\
- BLKVSC_DRV)
-
-/* Logging Level */
-#define ERROR_LVL 3
-#define WARNING_LVL 4
-#define INFO_LVL 6
-#define DEBUG_LVL 7
-#define DEBUG_LVL_ENTEREXIT 8
-#define DEBUG_RING_LVL 9
-
-extern unsigned int vmbus_loglevel;
-
-#define DPRINT(mod, lvl, fmt, args...) do {\
- if ((mod & (HIWORD(vmbus_loglevel))) && \
- (lvl <= LOWORD(vmbus_loglevel))) \
- printk(KERN_DEBUG #mod": %s() " fmt "\n", __func__, ## args);\
- } while (0)
-
-#define DPRINT_DBG(mod, fmt, args...) do {\
- if ((mod & (HIWORD(vmbus_loglevel))) && \
- (DEBUG_LVL <= LOWORD(vmbus_loglevel))) \
- printk(KERN_DEBUG #mod": %s() " fmt "\n", __func__, ## args);\
- } while (0)
-
-#define DPRINT_INFO(mod, fmt, args...) do {\
- if ((mod & (HIWORD(vmbus_loglevel))) && \
- (INFO_LVL <= LOWORD(vmbus_loglevel))) \
- printk(KERN_INFO #mod": " fmt "\n", ## args);\
- } while (0)
-
-#define DPRINT_WARN(mod, fmt, args...) do {\
- if ((mod & (HIWORD(vmbus_loglevel))) && \
- (WARNING_LVL <= LOWORD(vmbus_loglevel))) \
- printk(KERN_WARNING #mod": WARNING! " fmt "\n", ## args);\
- } while (0)
-
-#define DPRINT_ERR(mod, fmt, args...) do {\
- if ((mod & (HIWORD(vmbus_loglevel))) && \
- (ERROR_LVL <= LOWORD(vmbus_loglevel))) \
- printk(KERN_ERR #mod": %s() ERROR!! " fmt "\n", \
- __func__, ## args);\
- } while (0)
-
-#endif /* _LOGGING_H_ */
--
1.7.4.1

2011-05-10 09:54:56

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 192/206] Staging: hv: Get rid of netvsc_api.h

Now, get rid of netvsc_api.h

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/netvsc_api.h | 130 ---------------------------------------
1 files changed, 0 insertions(+), 130 deletions(-)
delete mode 100644 drivers/staging/hv/netvsc_api.h

diff --git a/drivers/staging/hv/netvsc_api.h b/drivers/staging/hv/netvsc_api.h
deleted file mode 100644
index b385c9d..0000000
--- a/drivers/staging/hv/netvsc_api.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- *
- * Copyright (c) 2009, Microsoft Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Authors:
- * Haiyang Zhang <[email protected]>
- * Hank Janssen <[email protected]>
- *
- */
-
-
-#ifndef _NETVSC_API_H_
-#define _NETVSC_API_H_
-
-#include "vmbus_api.h"
-#include "vmbus.h"
-
-/* Fwd declaration */
-struct hv_netvsc_packet;
-
-/* Represent the xfer page packet which contains 1 or more netvsc packet */
-struct xferpage_packet {
- struct list_head list_ent;
-
- /* # of netvsc packets this xfer packet contains */
- u32 count;
-};
-
-/* The number of pages which are enough to cover jumbo frame buffer. */
-#define NETVSC_PACKET_MAXPAGE 4
-
-/*
- * Represent netvsc packet which contains 1 RNDIS and 1 ethernet frame
- * within the RNDIS
- */
-struct hv_netvsc_packet {
- /* Bookkeeping stuff */
- struct list_head list_ent;
-
- 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 *xfer_page_pkt;
-
- union {
- struct{
- u64 recv_completion_tid;
- void *recv_completion_ctx;
- void (*recv_completion)(void *context);
- } recv;
- struct{
- u64 send_completion_tid;
- void *send_completion_ctx;
- void (*send_completion)(void *context);
- } send;
- } completion;
-
- /* This points to the memory after page_buf */
- void *extension;
-
- u32 total_data_buflen;
- /* Points to the send/receive buffer where the ethernet frame is */
- 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;
-
- 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 (*recv_cb)(struct hv_device *dev,
- struct hv_netvsc_packet *packet);
- void (*link_status_change)(struct hv_device *dev, u32 status);
-
- /* Specific to this driver */
- int (*send)(struct hv_device *dev, struct hv_netvsc_packet *packet);
-
- void *ctx;
-};
-
-static inline
-struct netvsc_driver *drv_to_netvscdrv(struct device_driver *d)
-{
- struct hv_driver *hvdrv = drv_to_hv_drv(d);
- return container_of(hvdrv, struct netvsc_driver, base);
-}
-
-struct netvsc_device_info {
- unsigned char mac_adr[6];
- bool link_state; /* 0 - link up, 1 - link down */
-};
-
-/* Interface */
-int netvsc_device_add(struct hv_device *device, void *additional_info);
-int netvsc_device_remove(struct hv_device *device);
-int netvsc_initialize(struct hv_driver *drv);
-int rndis_filter_open(struct hv_device *dev);
-int rndis_filter_close(struct hv_device *dev);
-int rndis_filte_device_add(struct hv_device *dev,
- void *additional_info);
-int rndis_filter_device_remove(struct hv_device *dev);
-
-
-#endif /* _NETVSC_API_H_ */
--
1.7.4.1

2011-05-10 08:38:34

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 193/206] Staging: hv: Get rid of netvsc.h

Now get rid of netvsc.h

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/netvsc.h | 331 -------------------------------------------
1 files changed, 0 insertions(+), 331 deletions(-)
delete mode 100644 drivers/staging/hv/netvsc.h

diff --git a/drivers/staging/hv/netvsc.h b/drivers/staging/hv/netvsc.h
deleted file mode 100644
index 9ebea3b..0000000
--- a/drivers/staging/hv/netvsc.h
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- *
- * Copyright (c) 2009, Microsoft Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Authors:
- * Haiyang Zhang <[email protected]>
- * Hank Janssen <[email protected]>
- *
- */
-
-
-#ifndef _NETVSC_H_
-#define _NETVSC_H_
-
-#include <linux/list.h>
-#include "vmbus_packet_format.h"
-#include "vmbus_channel_interface.h"
-#include "netvsc_api.h"
-
-
-#define NVSP_INVALID_PROTOCOL_VERSION ((u32)0xFFFFFFFF)
-
-#define NVSP_PROTOCOL_VERSION_1 2
-#define NVSP_MIN_PROTOCOL_VERSION NVSP_PROTOCOL_VERSION_1
-#define NVSP_MAX_PROTOCOL_VERSION NVSP_PROTOCOL_VERSION_1
-
-enum {
- NVSP_MSG_TYPE_NONE = 0,
-
- /* Init Messages */
- NVSP_MSG_TYPE_INIT = 1,
- NVSP_MSG_TYPE_INIT_COMPLETE = 2,
-
- NVSP_VERSION_MSG_START = 100,
-
- /* Version 1 Messages */
- NVSP_MSG1_TYPE_SEND_NDIS_VER = NVSP_VERSION_MSG_START,
-
- NVSP_MSG1_TYPE_SEND_RECV_BUF,
- NVSP_MSG1_TYPE_SEND_RECV_BUF_COMPLETE,
- NVSP_MSG1_TYPE_REVOKE_RECV_BUF,
-
- NVSP_MSG1_TYPE_SEND_SEND_BUF,
- NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE,
- NVSP_MSG1_TYPE_REVOKE_SEND_BUF,
-
- NVSP_MSG1_TYPE_SEND_RNDIS_PKT,
- NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE,
-
- /*
- * This should be set to the number of messages for the version with
- * the maximum number of messages.
- */
- NVSP_NUM_MSG_PER_VERSION = 9,
-};
-
-enum {
- NVSP_STAT_NONE = 0,
- NVSP_STAT_SUCCESS,
- NVSP_STAT_FAIL,
- NVSP_STAT_PROTOCOL_TOO_NEW,
- NVSP_STAT_PROTOCOL_TOO_OLD,
- NVSP_STAT_INVALID_RNDIS_PKT,
- NVSP_STAT_BUSY,
- NVSP_STAT_MAX,
-};
-
-struct nvsp_message_header {
- u32 msg_type;
-};
-
-/* Init Messages */
-
-/*
- * This message is used by the VSC to initialize the channel after the channels
- * has been opened. This message should never include anything other then
- * versioning (i.e. this message will be the same for ever).
- */
-struct nvsp_message_init {
- u32 min_protocol_ver;
- u32 max_protocol_ver;
-} __packed;
-
-/*
- * This message is used by the VSP to complete the initialization of the
- * channel. This message should never include anything other then versioning
- * (i.e. this message will be the same for ever).
- */
-struct nvsp_message_init_complete {
- u32 negotiated_protocol_ver;
- u32 max_mdl_chain_len;
- u32 status;
-} __packed;
-
-union nvsp_message_init_uber {
- struct nvsp_message_init init;
- struct nvsp_message_init_complete init_complete;
-} __packed;
-
-/* Version 1 Messages */
-
-/*
- * This message is used by the VSC to send the NDIS version to the VSP. The VSP
- * can use this information when handling OIDs sent by the VSC.
- */
-struct nvsp_1_message_send_ndis_version {
- u32 ndis_major_ver;
- u32 ndis_minor_ver;
-} __packed;
-
-/*
- * This message is used by the VSC to send a receive buffer to the VSP. The VSP
- * can then use the receive buffer to send data to the VSC.
- */
-struct nvsp_1_message_send_receive_buffer {
- u32 gpadl_handle;
- u16 id;
-} __packed;
-
-struct nvsp_1_receive_buffer_section {
- u32 offset;
- u32 sub_alloc_size;
- u32 num_sub_allocs;
- u32 end_offset;
-} __packed;
-
-/*
- * This message is used by the VSP to acknowledge a receive buffer send by the
- * VSC. This message must be sent by the VSP before the VSP uses the receive
- * buffer.
- */
-struct nvsp_1_message_send_receive_buffer_complete {
- u32 status;
- u32 num_sections;
-
- /*
- * The receive buffer is split into two parts, a large suballocation
- * section and a small suballocation section. These sections are then
- * suballocated by a certain size.
- */
-
- /*
- * For example, the following break up of the receive buffer has 6
- * large suballocations and 10 small suballocations.
- */
-
- /*
- * | Large Section | | Small Section |
- * ------------------------------------------------------------
- * | | | | | | | | | | | | | | | | | |
- * | |
- * LargeOffset SmallOffset
- */
-
- struct nvsp_1_receive_buffer_section sections[1];
-} __packed;
-
-/*
- * This message is sent by the VSC to revoke the receive buffer. After the VSP
- * completes this transaction, the vsp should never use the receive buffer
- * again.
- */
-struct nvsp_1_message_revoke_receive_buffer {
- u16 id;
-};
-
-/*
- * This message is used by the VSC to send a send buffer to the VSP. The VSC
- * can then use the send buffer to send data to the VSP.
- */
-struct nvsp_1_message_send_send_buffer {
- u32 gpadl_handle;
- u16 id;
-} __packed;
-
-/*
- * This message is used by the VSP to acknowledge a send buffer sent by the
- * VSC. This message must be sent by the VSP before the VSP uses the sent
- * buffer.
- */
-struct nvsp_1_message_send_send_buffer_complete {
- u32 status;
-
- /*
- * The VSC gets to choose the size of the send buffer and the VSP gets
- * to choose the sections size of the buffer. This was done to enable
- * dynamic reconfigurations when the cost of GPA-direct buffers
- * decreases.
- */
- u32 section_size;
-} __packed;
-
-/*
- * This message is sent by the VSC to revoke the send buffer. After the VSP
- * completes this transaction, the vsp should never use the send buffer again.
- */
-struct nvsp_1_message_revoke_send_buffer {
- u16 id;
-};
-
-/*
- * This message is used by both the VSP and the VSC to send a RNDIS message to
- * the opposite channel endpoint.
- */
-struct nvsp_1_message_send_rndis_packet {
- /*
- * This field is specified by RNIDS. They assume there's two different
- * channels of communication. However, the Network VSP only has one.
- * Therefore, the channel travels with the RNDIS packet.
- */
- u32 channel_type;
-
- /*
- * This field is used to send part or all of the data through a send
- * buffer. This values specifies an index into the send buffer. If the
- * index is 0xFFFFFFFF, then the send buffer is not being used and all
- * of the data was sent through other VMBus mechanisms.
- */
- u32 send_buf_section_index;
- u32 send_buf_section_size;
-} __packed;
-
-/*
- * This message is used by both the VSP and the VSC to complete a RNDIS message
- * to the opposite channel endpoint. At this point, the initiator of this
- * message cannot use any resources associated with the original RNDIS packet.
- */
-struct nvsp_1_message_send_rndis_packet_complete {
- u32 status;
-};
-
-union nvsp_1_message_uber {
- struct nvsp_1_message_send_ndis_version send_ndis_ver;
-
- struct nvsp_1_message_send_receive_buffer send_recv_buf;
- struct nvsp_1_message_send_receive_buffer_complete
- send_recv_buf_complete;
- struct nvsp_1_message_revoke_receive_buffer revoke_recv_buf;
-
- struct nvsp_1_message_send_send_buffer send_send_buf;
- struct nvsp_1_message_send_send_buffer_complete send_send_buf_complete;
- struct nvsp_1_message_revoke_send_buffer revoke_send_buf;
-
- struct nvsp_1_message_send_rndis_packet send_rndis_pkt;
- struct nvsp_1_message_send_rndis_packet_complete
- send_rndis_pkt_complete;
-} __packed;
-
-union nvsp_all_messages {
- union nvsp_message_init_uber init_msg;
- union nvsp_1_message_uber v1_msg;
-} __packed;
-
-/* ALL Messages */
-struct nvsp_message {
- struct nvsp_message_header hdr;
- union nvsp_all_messages msg;
-} __packed;
-
-
-
-
-/* #define NVSC_MIN_PROTOCOL_VERSION 1 */
-/* #define NVSC_MAX_PROTOCOL_VERSION 1 */
-
-#define NETVSC_SEND_BUFFER_SIZE (64*1024) /* 64K */
-#define NETVSC_SEND_BUFFER_ID 0xface
-
-
-#define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024) /* 1MB */
-
-#define NETVSC_RECEIVE_BUFFER_ID 0xcafe
-
-#define NETVSC_RECEIVE_SG_COUNT 1
-
-/* Preallocated receive packets */
-#define NETVSC_RECEIVE_PACKETLIST_COUNT 256
-
-#define NETVSC_PACKET_SIZE 2048
-
-/* Per netvsc channel-specific */
-struct netvsc_device {
- struct hv_device *dev;
-
- atomic_t refcnt;
- atomic_t num_outstanding_sends;
- /*
- * List of free preallocated hv_netvsc_packet to represent receive
- * packet
- */
- struct list_head recv_pkt_list;
- spinlock_t recv_pkt_list_lock;
-
- /* Send buffer allocated by us but manages by NetVSP */
- void *send_buf;
- u32 send_buf_size;
- u32 send_buf_gpadl_handle;
- u32 send_section_size;
-
- /* Receive buffer allocated by us but manages by NetVSP */
- void *recv_buf;
- u32 recv_buf_size;
- u32 recv_buf_gpadl_handle;
- u32 recv_section_cnt;
- struct nvsp_1_receive_buffer_section *recv_section;
-
- /* Used for NetVSP initialization protocol */
- struct completion channel_init_wait;
- struct nvsp_message channel_init_pkt;
-
- struct nvsp_message revoke_packet;
- /* unsigned char HwMacAddr[HW_MACADDR_LEN]; */
-
- /* Holds rndis device info */
- void *extension;
-};
-
-#endif /* _NETVSC_H_ */
--
1.7.4.1

2011-05-10 08:38:38

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 194/206] Staging: hv: Get rid of ring_buffer.h

Now get rid of ring_buffer.h.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/ring_buffer.h | 102 --------------------------------------
1 files changed, 0 insertions(+), 102 deletions(-)
delete mode 100644 drivers/staging/hv/ring_buffer.h

diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h
deleted file mode 100644
index 089c536..0000000
--- a/drivers/staging/hv/ring_buffer.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- *
- * Copyright (c) 2009, Microsoft Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Authors:
- * Haiyang Zhang <[email protected]>
- * Hank Janssen <[email protected]>
- * K. Y. Srinivasan <[email protected]>
- *
- */
-
-
-#ifndef _RING_BUFFER_H_
-#define _RING_BUFFER_H_
-
-#include <linux/scatterlist.h>
-
-struct hv_ring_buffer {
- /* Offset in bytes from the start of ring data below */
- u32 write_index;
-
- /* Offset in bytes from the start of ring data below */
- u32 read_index;
-
- u32 interrupt_mask;
-
- /* Pad it to PAGE_SIZE so that data starts on page boundary */
- u8 reserved[4084];
-
- /* NOTE:
- * The interrupt_mask field is used only for channels but since our
- * vmbus connection also uses this data structure and its data starts
- * here, we commented out this field.
- */
-
- /*
- * Ring data starts here + RingDataStartOffset
- * !!! DO NOT place any fields below this !!!
- */
- u8 buffer[0];
-} __packed;
-
-struct hv_ring_buffer_info {
- struct hv_ring_buffer *ring_buffer;
- u32 ring_size; /* Include the shared header */
- spinlock_t ring_lock;
-
- u32 ring_datasize; /* < ring_size */
- u32 ring_data_startoffset;
-};
-
-struct hv_ring_buffer_debug_info {
- u32 current_interrupt_mask;
- u32 current_read_index;
- u32 current_write_index;
- u32 bytes_avail_toread;
- u32 bytes_avail_towrite;
-};
-
-
-
-/* Interface */
-
-
-int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info, void *buffer,
- u32 buflen);
-
-void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info);
-
-int hv_ringbuffer_write(struct hv_ring_buffer_info *ring_info,
- struct scatterlist *sglist,
- u32 sgcount);
-
-int hv_ringbuffer_peek(struct hv_ring_buffer_info *ring_info, void *buffer,
- u32 buflen);
-
-int hv_ringbuffer_read(struct hv_ring_buffer_info *ring_info,
- void *buffer,
- u32 buflen,
- u32 offset);
-
-u32 hv_get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *ring_info);
-
-void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix);
-
-void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
- struct hv_ring_buffer_debug_info *debug_info);
-
-#endif /* _RING_BUFFER_H_ */
--
1.7.4.1

2011-05-10 08:47:25

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 195/206] Staging: hv: Get rid of rndis_filter.h

Now, get rid of rndis_filter.h.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/rndis_filter.h | 55 -------------------------------------
1 files changed, 0 insertions(+), 55 deletions(-)
delete mode 100644 drivers/staging/hv/rndis_filter.h

diff --git a/drivers/staging/hv/rndis_filter.h b/drivers/staging/hv/rndis_filter.h
deleted file mode 100644
index 4da18f3..0000000
--- a/drivers/staging/hv/rndis_filter.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *
- * Copyright (c) 2009, Microsoft Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Authors:
- * Haiyang Zhang <[email protected]>
- * Hank Janssen <[email protected]>
- *
- */
-
-
-#ifndef _RNDISFILTER_H_
-#define _RNDISFILTER_H_
-
-#define __struct_bcount(x)
-
-#include "netvsc.h"
-
-#include "rndis.h"
-
-#define RNDIS_HEADER_SIZE (sizeof(struct rndis_message) - \
- sizeof(union rndis_message_container))
-
-#define NDIS_PACKET_TYPE_DIRECTED 0x00000001
-#define NDIS_PACKET_TYPE_MULTICAST 0x00000002
-#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
-#define NDIS_PACKET_TYPE_BROADCAST 0x00000008
-#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
-#define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
-#define NDIS_PACKET_TYPE_SMT 0x00000040
-#define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
-#define NDIS_PACKET_TYPE_GROUP 0x00000100
-#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00000200
-#define NDIS_PACKET_TYPE_FUNCTIONAL 0x00000400
-#define NDIS_PACKET_TYPE_MAC_FRAME 0x00000800
-
-
-/* Interface */
-
-extern int rndis_filter_init(struct netvsc_driver *driver);
-
-#endif /* _RNDISFILTER_H_ */
--
1.7.4.1

2011-05-10 08:41:45

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 196/206] Staging: hv: Get rid of rndis.h

Now, get rid of rndis.h.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/rndis.h | 653 --------------------------------------------
1 files changed, 0 insertions(+), 653 deletions(-)
delete mode 100644 drivers/staging/hv/rndis.h

diff --git a/drivers/staging/hv/rndis.h b/drivers/staging/hv/rndis.h
deleted file mode 100644
index 014de04..0000000
--- a/drivers/staging/hv/rndis.h
+++ /dev/null
@@ -1,653 +0,0 @@
-/*
- *
- * Copyright (c) 2009, Microsoft Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Authors:
- * Haiyang Zhang <[email protected]>
- * Hank Janssen <[email protected]>
- *
- */
-
-#ifndef _RNDIS_H_
-#define _RNDIS_H_
-
-/* Status codes */
-
-
-#ifndef STATUS_SUCCESS
-#define STATUS_SUCCESS (0x00000000L)
-#endif
-
-#ifndef STATUS_UNSUCCESSFUL
-#define STATUS_UNSUCCESSFUL (0xC0000001L)
-#endif
-
-#ifndef STATUS_PENDING
-#define STATUS_PENDING (0x00000103L)
-#endif
-
-#ifndef STATUS_INSUFFICIENT_RESOURCES
-#define STATUS_INSUFFICIENT_RESOURCES (0xC000009AL)
-#endif
-
-#ifndef STATUS_BUFFER_OVERFLOW
-#define STATUS_BUFFER_OVERFLOW (0x80000005L)
-#endif
-
-#ifndef STATUS_NOT_SUPPORTED
-#define STATUS_NOT_SUPPORTED (0xC00000BBL)
-#endif
-
-#define RNDIS_STATUS_SUCCESS (STATUS_SUCCESS)
-#define RNDIS_STATUS_PENDING (STATUS_PENDING)
-#define RNDIS_STATUS_NOT_RECOGNIZED (0x00010001L)
-#define RNDIS_STATUS_NOT_COPIED (0x00010002L)
-#define RNDIS_STATUS_NOT_ACCEPTED (0x00010003L)
-#define RNDIS_STATUS_CALL_ACTIVE (0x00010007L)
-
-#define RNDIS_STATUS_ONLINE (0x40010003L)
-#define RNDIS_STATUS_RESET_START (0x40010004L)
-#define RNDIS_STATUS_RESET_END (0x40010005L)
-#define RNDIS_STATUS_RING_STATUS (0x40010006L)
-#define RNDIS_STATUS_CLOSED (0x40010007L)
-#define RNDIS_STATUS_WAN_LINE_UP (0x40010008L)
-#define RNDIS_STATUS_WAN_LINE_DOWN (0x40010009L)
-#define RNDIS_STATUS_WAN_FRAGMENT (0x4001000AL)
-#define RNDIS_STATUS_MEDIA_CONNECT (0x4001000BL)
-#define RNDIS_STATUS_MEDIA_DISCONNECT (0x4001000CL)
-#define RNDIS_STATUS_HARDWARE_LINE_UP (0x4001000DL)
-#define RNDIS_STATUS_HARDWARE_LINE_DOWN (0x4001000EL)
-#define RNDIS_STATUS_INTERFACE_UP (0x4001000FL)
-#define RNDIS_STATUS_INTERFACE_DOWN (0x40010010L)
-#define RNDIS_STATUS_MEDIA_BUSY (0x40010011L)
-#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION (0x40010012L)
-#define RNDIS_STATUS_WW_INDICATION RDIA_SPECIFIC_INDICATION
-#define RNDIS_STATUS_LINK_SPEED_CHANGE (0x40010013L)
-
-#define RNDIS_STATUS_NOT_RESETTABLE (0x80010001L)
-#define RNDIS_STATUS_SOFT_ERRORS (0x80010003L)
-#define RNDIS_STATUS_HARD_ERRORS (0x80010004L)
-#define RNDIS_STATUS_BUFFER_OVERFLOW (STATUS_BUFFER_OVERFLOW)
-
-#define RNDIS_STATUS_FAILURE (STATUS_UNSUCCESSFUL)
-#define RNDIS_STATUS_RESOURCES (STATUS_INSUFFICIENT_RESOURCES)
-#define RNDIS_STATUS_CLOSING (0xC0010002L)
-#define RNDIS_STATUS_BAD_VERSION (0xC0010004L)
-#define RNDIS_STATUS_BAD_CHARACTERISTICS (0xC0010005L)
-#define RNDIS_STATUS_ADAPTER_NOT_FOUND (0xC0010006L)
-#define RNDIS_STATUS_OPEN_FAILED (0xC0010007L)
-#define RNDIS_STATUS_DEVICE_FAILED (0xC0010008L)
-#define RNDIS_STATUS_MULTICAST_FULL (0xC0010009L)
-#define RNDIS_STATUS_MULTICAST_EXISTS (0xC001000AL)
-#define RNDIS_STATUS_MULTICAST_NOT_FOUND (0xC001000BL)
-#define RNDIS_STATUS_REQUEST_ABORTED (0xC001000CL)
-#define RNDIS_STATUS_RESET_IN_PROGRESS (0xC001000DL)
-#define RNDIS_STATUS_CLOSING_INDICATING (0xC001000EL)
-#define RNDIS_STATUS_NOT_SUPPORTED (STATUS_NOT_SUPPORTED)
-#define RNDIS_STATUS_INVALID_PACKET (0xC001000FL)
-#define RNDIS_STATUS_OPEN_LIST_FULL (0xC0010010L)
-#define RNDIS_STATUS_ADAPTER_NOT_READY (0xC0010011L)
-#define RNDIS_STATUS_ADAPTER_NOT_OPEN (0xC0010012L)
-#define RNDIS_STATUS_NOT_INDICATING (0xC0010013L)
-#define RNDIS_STATUS_INVALID_LENGTH (0xC0010014L)
-#define RNDIS_STATUS_INVALID_DATA (0xC0010015L)
-#define RNDIS_STATUS_BUFFER_TOO_SHORT (0xC0010016L)
-#define RNDIS_STATUS_INVALID_OID (0xC0010017L)
-#define RNDIS_STATUS_ADAPTER_REMOVED (0xC0010018L)
-#define RNDIS_STATUS_UNSUPPORTED_MEDIA (0xC0010019L)
-#define RNDIS_STATUS_GROUP_ADDRESS_IN_USE (0xC001001AL)
-#define RNDIS_STATUS_FILE_NOT_FOUND (0xC001001BL)
-#define RNDIS_STATUS_ERROR_READING_FILE (0xC001001CL)
-#define RNDIS_STATUS_ALREADY_MAPPED (0xC001001DL)
-#define RNDIS_STATUS_RESOURCE_CONFLICT (0xC001001EL)
-#define RNDIS_STATUS_NO_CABLE (0xC001001FL)
-
-#define RNDIS_STATUS_INVALID_SAP (0xC0010020L)
-#define RNDIS_STATUS_SAP_IN_USE (0xC0010021L)
-#define RNDIS_STATUS_INVALID_ADDRESS (0xC0010022L)
-#define RNDIS_STATUS_VC_NOT_ACTIVATED (0xC0010023L)
-#define RNDIS_STATUS_DEST_OUT_OF_ORDER (0xC0010024L)
-#define RNDIS_STATUS_VC_NOT_AVAILABLE (0xC0010025L)
-#define RNDIS_STATUS_CELLRATE_NOT_AVAILABLE (0xC0010026L)
-#define RNDIS_STATUS_INCOMPATABLE_QOS (0xC0010027L)
-#define RNDIS_STATUS_AAL_PARAMS_UNSUPPORTED (0xC0010028L)
-#define RNDIS_STATUS_NO_ROUTE_TO_DESTINATION (0xC0010029L)
-
-#define RNDIS_STATUS_TOKEN_RING_OPEN_ERROR (0xC0011000L)
-
-/* Object Identifiers used by NdisRequest Query/Set Information */
-/* General Objects */
-#define RNDIS_OID_GEN_SUPPORTED_LIST 0x00010101
-#define RNDIS_OID_GEN_HARDWARE_STATUS 0x00010102
-#define RNDIS_OID_GEN_MEDIA_SUPPORTED 0x00010103
-#define RNDIS_OID_GEN_MEDIA_IN_USE 0x00010104
-#define RNDIS_OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105
-#define RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
-#define RNDIS_OID_GEN_LINK_SPEED 0x00010107
-#define RNDIS_OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108
-#define RNDIS_OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109
-#define RNDIS_OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
-#define RNDIS_OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
-#define RNDIS_OID_GEN_VENDOR_ID 0x0001010C
-#define RNDIS_OID_GEN_VENDOR_DESCRIPTION 0x0001010D
-#define RNDIS_OID_GEN_CURRENT_PACKET_FILTER 0x0001010E
-#define RNDIS_OID_GEN_CURRENT_LOOKAHEAD 0x0001010F
-#define RNDIS_OID_GEN_DRIVER_VERSION 0x00010110
-#define RNDIS_OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
-#define RNDIS_OID_GEN_PROTOCOL_OPTIONS 0x00010112
-#define RNDIS_OID_GEN_MAC_OPTIONS 0x00010113
-#define RNDIS_OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
-#define RNDIS_OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
-#define RNDIS_OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
-#define RNDIS_OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118
-#define RNDIS_OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119
-#define RNDIS_OID_GEN_MACHINE_NAME 0x0001021A
-#define RNDIS_OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B
-
-#define RNDIS_OID_GEN_XMIT_OK 0x00020101
-#define RNDIS_OID_GEN_RCV_OK 0x00020102
-#define RNDIS_OID_GEN_XMIT_ERROR 0x00020103
-#define RNDIS_OID_GEN_RCV_ERROR 0x00020104
-#define RNDIS_OID_GEN_RCV_NO_BUFFER 0x00020105
-
-#define RNDIS_OID_GEN_DIRECTED_BYTES_XMIT 0x00020201
-#define RNDIS_OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202
-#define RNDIS_OID_GEN_MULTICAST_BYTES_XMIT 0x00020203
-#define RNDIS_OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204
-#define RNDIS_OID_GEN_BROADCAST_BYTES_XMIT 0x00020205
-#define RNDIS_OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206
-#define RNDIS_OID_GEN_DIRECTED_BYTES_RCV 0x00020207
-#define RNDIS_OID_GEN_DIRECTED_FRAMES_RCV 0x00020208
-#define RNDIS_OID_GEN_MULTICAST_BYTES_RCV 0x00020209
-#define RNDIS_OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A
-#define RNDIS_OID_GEN_BROADCAST_BYTES_RCV 0x0002020B
-#define RNDIS_OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C
-
-#define RNDIS_OID_GEN_RCV_CRC_ERROR 0x0002020D
-#define RNDIS_OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E
-
-#define RNDIS_OID_GEN_GET_TIME_CAPS 0x0002020F
-#define RNDIS_OID_GEN_GET_NETCARD_TIME 0x00020210
-
-/* These are connection-oriented general OIDs. */
-/* These replace the above OIDs for connection-oriented media. */
-#define RNDIS_OID_GEN_CO_SUPPORTED_LIST 0x00010101
-#define RNDIS_OID_GEN_CO_HARDWARE_STATUS 0x00010102
-#define RNDIS_OID_GEN_CO_MEDIA_SUPPORTED 0x00010103
-#define RNDIS_OID_GEN_CO_MEDIA_IN_USE 0x00010104
-#define RNDIS_OID_GEN_CO_LINK_SPEED 0x00010105
-#define RNDIS_OID_GEN_CO_VENDOR_ID 0x00010106
-#define RNDIS_OID_GEN_CO_VENDOR_DESCRIPTION 0x00010107
-#define RNDIS_OID_GEN_CO_DRIVER_VERSION 0x00010108
-#define RNDIS_OID_GEN_CO_PROTOCOL_OPTIONS 0x00010109
-#define RNDIS_OID_GEN_CO_MAC_OPTIONS 0x0001010A
-#define RNDIS_OID_GEN_CO_MEDIA_CONNECT_STATUS 0x0001010B
-#define RNDIS_OID_GEN_CO_VENDOR_DRIVER_VERSION 0x0001010C
-#define RNDIS_OID_GEN_CO_MINIMUM_LINK_SPEED 0x0001010D
-
-#define RNDIS_OID_GEN_CO_GET_TIME_CAPS 0x00010201
-#define RNDIS_OID_GEN_CO_GET_NETCARD_TIME 0x00010202
-
-/* These are connection-oriented statistics OIDs. */
-#define RNDIS_OID_GEN_CO_XMIT_PDUS_OK 0x00020101
-#define RNDIS_OID_GEN_CO_RCV_PDUS_OK 0x00020102
-#define RNDIS_OID_GEN_CO_XMIT_PDUS_ERROR 0x00020103
-#define RNDIS_OID_GEN_CO_RCV_PDUS_ERROR 0x00020104
-#define RNDIS_OID_GEN_CO_RCV_PDUS_NO_BUFFER 0x00020105
-
-
-#define RNDIS_OID_GEN_CO_RCV_CRC_ERROR 0x00020201
-#define RNDIS_OID_GEN_CO_TRANSMIT_QUEUE_LENGTH 0x00020202
-#define RNDIS_OID_GEN_CO_BYTES_XMIT 0x00020203
-#define RNDIS_OID_GEN_CO_BYTES_RCV 0x00020204
-#define RNDIS_OID_GEN_CO_BYTES_XMIT_OUTSTANDING 0x00020205
-#define RNDIS_OID_GEN_CO_NETCARD_LOAD 0x00020206
-
-/* These are objects for Connection-oriented media call-managers. */
-#define RNDIS_OID_CO_ADD_PVC 0xFF000001
-#define RNDIS_OID_CO_DELETE_PVC 0xFF000002
-#define RNDIS_OID_CO_GET_CALL_INFORMATION 0xFF000003
-#define RNDIS_OID_CO_ADD_ADDRESS 0xFF000004
-#define RNDIS_OID_CO_DELETE_ADDRESS 0xFF000005
-#define RNDIS_OID_CO_GET_ADDRESSES 0xFF000006
-#define RNDIS_OID_CO_ADDRESS_CHANGE 0xFF000007
-#define RNDIS_OID_CO_SIGNALING_ENABLED 0xFF000008
-#define RNDIS_OID_CO_SIGNALING_DISABLED 0xFF000009
-
-/* 802.3 Objects (Ethernet) */
-#define RNDIS_OID_802_3_PERMANENT_ADDRESS 0x01010101
-#define RNDIS_OID_802_3_CURRENT_ADDRESS 0x01010102
-#define RNDIS_OID_802_3_MULTICAST_LIST 0x01010103
-#define RNDIS_OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
-#define RNDIS_OID_802_3_MAC_OPTIONS 0x01010105
-
-#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001
-
-#define RNDIS_OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101
-#define RNDIS_OID_802_3_XMIT_ONE_COLLISION 0x01020102
-#define RNDIS_OID_802_3_XMIT_MORE_COLLISIONS 0x01020103
-
-#define RNDIS_OID_802_3_XMIT_DEFERRED 0x01020201
-#define RNDIS_OID_802_3_XMIT_MAX_COLLISIONS 0x01020202
-#define RNDIS_OID_802_3_RCV_OVERRUN 0x01020203
-#define RNDIS_OID_802_3_XMIT_UNDERRUN 0x01020204
-#define RNDIS_OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205
-#define RNDIS_OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
-#define RNDIS_OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
-
-/* Remote NDIS message types */
-#define REMOTE_NDIS_PACKET_MSG 0x00000001
-#define REMOTE_NDIS_INITIALIZE_MSG 0x00000002
-#define REMOTE_NDIS_HALT_MSG 0x00000003
-#define REMOTE_NDIS_QUERY_MSG 0x00000004
-#define REMOTE_NDIS_SET_MSG 0x00000005
-#define REMOTE_NDIS_RESET_MSG 0x00000006
-#define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007
-#define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008
-
-#define REMOTE_CONDIS_MP_CREATE_VC_MSG 0x00008001
-#define REMOTE_CONDIS_MP_DELETE_VC_MSG 0x00008002
-#define REMOTE_CONDIS_MP_ACTIVATE_VC_MSG 0x00008005
-#define REMOTE_CONDIS_MP_DEACTIVATE_VC_MSG 0x00008006
-#define REMOTE_CONDIS_INDICATE_STATUS_MSG 0x00008007
-
-/* Remote NDIS message completion types */
-#define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002
-#define REMOTE_NDIS_QUERY_CMPLT 0x80000004
-#define REMOTE_NDIS_SET_CMPLT 0x80000005
-#define REMOTE_NDIS_RESET_CMPLT 0x80000006
-#define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008
-
-#define REMOTE_CONDIS_MP_CREATE_VC_CMPLT 0x80008001
-#define REMOTE_CONDIS_MP_DELETE_VC_CMPLT 0x80008002
-#define REMOTE_CONDIS_MP_ACTIVATE_VC_CMPLT 0x80008005
-#define REMOTE_CONDIS_MP_DEACTIVATE_VC_CMPLT 0x80008006
-
-/*
- * Reserved message type for private communication between lower-layer host
- * driver and remote device, if necessary.
- */
-#define REMOTE_NDIS_BUS_MSG 0xff000001
-
-/* Defines for DeviceFlags in struct rndis_initialize_complete */
-#define RNDIS_DF_CONNECTIONLESS 0x00000001
-#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002
-#define RNDIS_DF_RAW_DATA 0x00000004
-
-/* Remote NDIS medium types. */
-#define RNDIS_MEDIUM_802_3 0x00000000
-#define RNDIS_MEDIUM_802_5 0x00000001
-#define RNDIS_MEDIUM_FDDI 0x00000002
-#define RNDIS_MEDIUM_WAN 0x00000003
-#define RNDIS_MEDIUM_LOCAL_TALK 0x00000004
-#define RNDIS_MEDIUM_ARCNET_RAW 0x00000006
-#define RNDIS_MEDIUM_ARCNET_878_2 0x00000007
-#define RNDIS_MEDIUM_ATM 0x00000008
-#define RNDIS_MEDIUM_WIRELESS_WAN 0x00000009
-#define RNDIS_MEDIUM_IRDA 0x0000000a
-#define RNDIS_MEDIUM_CO_WAN 0x0000000b
-/* Not a real medium, defined as an upper-bound */
-#define RNDIS_MEDIUM_MAX 0x0000000d
-
-
-/* Remote NDIS medium connection states. */
-#define RNDIS_MEDIA_STATE_CONNECTED 0x00000000
-#define RNDIS_MEDIA_STATE_DISCONNECTED 0x00000001
-
-/* Remote NDIS version numbers */
-#define RNDIS_MAJOR_VERSION 0x00000001
-#define RNDIS_MINOR_VERSION 0x00000000
-
-
-/* NdisInitialize message */
-struct rndis_initialize_request {
- u32 req_id;
- u32 major_ver;
- u32 minor_ver;
- u32 max_xfer_size;
-};
-
-/* Response to NdisInitialize */
-struct rndis_initialize_complete {
- u32 req_id;
- u32 status;
- u32 major_ver;
- u32 minor_ver;
- u32 dev_flags;
- u32 medium;
- u32 max_pkt_per_msg;
- u32 max_xfer_size;
- u32 pkt_alignment_factor;
- u32 af_list_offset;
- u32 af_list_size;
-};
-
-/* Call manager devices only: Information about an address family */
-/* supported by the device is appended to the response to NdisInitialize. */
-struct rndis_co_address_family {
- u32 address_family;
- u32 major_ver;
- u32 minor_ver;
-};
-
-/* NdisHalt message */
-struct rndis_halt_request {
- u32 req_id;
-};
-
-/* NdisQueryRequest message */
-struct rndis_query_request {
- u32 req_id;
- u32 oid;
- u32 info_buflen;
- u32 info_buf_offset;
- u32 dev_vc_handle;
-};
-
-/* Response to NdisQueryRequest */
-struct rndis_query_complete {
- u32 req_id;
- u32 status;
- u32 info_buflen;
- u32 info_buf_offset;
-};
-
-/* NdisSetRequest message */
-struct rndis_set_request {
- u32 req_id;
- u32 oid;
- u32 info_buflen;
- u32 info_buf_offset;
- u32 dev_vc_handle;
-};
-
-/* Response to NdisSetRequest */
-struct rndis_set_complete {
- u32 req_id;
- u32 status;
-};
-
-/* NdisReset message */
-struct rndis_reset_request {
- u32 reserved;
-};
-
-/* Response to NdisReset */
-struct rndis_reset_complete {
- u32 status;
- u32 addressing_reset;
-};
-
-/* NdisMIndicateStatus message */
-struct rndis_indicate_status {
- u32 status;
- u32 status_buflen;
- u32 status_buf_offset;
-};
-
-/* Diagnostic information passed as the status buffer in */
-/* struct rndis_indicate_status messages signifying error conditions. */
-struct rndis_diagnostic_info {
- u32 diag_status;
- u32 error_offset;
-};
-
-/* NdisKeepAlive message */
-struct rndis_keepalive_request {
- u32 req_id;
-};
-
-/* Response to NdisKeepAlive */
-struct rndis_keepalive_complete {
- u32 req_id;
- u32 status;
-};
-
-/*
- * Data message. All Offset fields contain byte offsets from the beginning of
- * struct rndis_packet. All Length fields are in bytes. VcHandle is set
- * to 0 for connectionless data, otherwise it contains the VC handle.
- */
-struct rndis_packet {
- u32 data_offset;
- u32 data_len;
- u32 oob_data_offset;
- u32 oob_data_len;
- u32 num_oob_data_elements;
- u32 per_pkt_info_offset;
- u32 per_pkt_info_len;
- u32 vc_handle;
- u32 reserved;
-};
-
-/* Optional Out of Band data associated with a Data message. */
-struct rndis_oobd {
- u32 size;
- u32 type;
- u32 class_info_offset;
-};
-
-/* Packet extension field contents associated with a Data message. */
-struct rndis_per_packet_info {
- u32 size;
- u32 type;
- u32 per_pkt_info_offset;
-};
-
-/* Format of Information buffer passed in a SetRequest for the OID */
-/* OID_GEN_RNDIS_CONFIG_PARAMETER. */
-struct rndis_config_parameter_info {
- u32 parameter_name_offset;
- u32 parameter_name_length;
- u32 parameter_type;
- u32 parameter_value_offset;
- u32 parameter_value_length;
-};
-
-/* Values for ParameterType in struct rndis_config_parameter_info */
-#define RNDIS_CONFIG_PARAM_TYPE_INTEGER 0
-#define RNDIS_CONFIG_PARAM_TYPE_STRING 2
-
-/* CONDIS Miniport messages for connection oriented devices */
-/* that do not implement a call manager. */
-
-/* CoNdisMiniportCreateVc message */
-struct rcondis_mp_create_vc {
- u32 req_id;
- u32 ndis_vc_handle;
-};
-
-/* Response to CoNdisMiniportCreateVc */
-struct rcondis_mp_create_vc_complete {
- u32 req_id;
- u32 dev_vc_handle;
- u32 status;
-};
-
-/* CoNdisMiniportDeleteVc message */
-struct rcondis_mp_delete_vc {
- u32 req_id;
- u32 dev_vc_handle;
-};
-
-/* Response to CoNdisMiniportDeleteVc */
-struct rcondis_mp_delete_vc_complete {
- u32 req_id;
- u32 status;
-};
-
-/* CoNdisMiniportQueryRequest message */
-struct rcondis_mp_query_request {
- u32 req_id;
- u32 request_type;
- u32 oid;
- u32 dev_vc_handle;
- u32 info_buflen;
- u32 info_buf_offset;
-};
-
-/* CoNdisMiniportSetRequest message */
-struct rcondis_mp_set_request {
- u32 req_id;
- u32 request_type;
- u32 oid;
- u32 dev_vc_handle;
- u32 info_buflen;
- u32 info_buf_offset;
-};
-
-/* CoNdisIndicateStatus message */
-struct rcondis_indicate_status {
- u32 ndis_vc_handle;
- u32 status;
- u32 status_buflen;
- u32 status_buf_offset;
-};
-
-/* CONDIS Call/VC parameters */
-struct rcondis_specific_parameters {
- u32 parameter_type;
- u32 parameter_length;
- u32 parameter_lffset;
-};
-
-struct rcondis_media_parameters {
- u32 flags;
- u32 reserved1;
- u32 reserved2;
- struct rcondis_specific_parameters media_specific;
-};
-
-struct rndis_flowspec {
- u32 token_rate;
- u32 token_bucket_size;
- u32 peak_bandwidth;
- u32 latency;
- u32 delay_variation;
- u32 service_type;
- u32 max_sdu_size;
- u32 minimum_policed_size;
-};
-
-struct rcondis_call_manager_parameters {
- struct rndis_flowspec transmit;
- struct rndis_flowspec receive;
- struct rcondis_specific_parameters call_mgr_specific;
-};
-
-/* CoNdisMiniportActivateVc message */
-struct rcondis_mp_activate_vc_request {
- u32 req_id;
- u32 flags;
- u32 dev_vc_handle;
- u32 media_params_offset;
- u32 media_params_length;
- u32 call_mgr_params_offset;
- u32 call_mgr_params_length;
-};
-
-/* Response to CoNdisMiniportActivateVc */
-struct rcondis_mp_activate_vc_complete {
- u32 req_id;
- u32 status;
-};
-
-/* CoNdisMiniportDeactivateVc message */
-struct rcondis_mp_deactivate_vc_request {
- u32 req_id;
- u32 flags;
- u32 dev_vc_handle;
-};
-
-/* Response to CoNdisMiniportDeactivateVc */
-struct rcondis_mp_deactivate_vc_complete {
- u32 req_id;
- u32 status;
-};
-
-
-/* union with all of the RNDIS messages */
-union rndis_message_container {
- struct rndis_packet pkt;
- struct rndis_initialize_request init_req;
- struct rndis_halt_request halt_req;
- struct rndis_query_request query_req;
- struct rndis_set_request set_req;
- struct rndis_reset_request reset_req;
- struct rndis_keepalive_request keep_alive_req;
- struct rndis_indicate_status indicate_status;
- struct rndis_initialize_complete init_complete;
- struct rndis_query_complete query_complete;
- struct rndis_set_complete set_complete;
- struct rndis_reset_complete reset_complete;
- struct rndis_keepalive_complete keep_alive_complete;
- struct rcondis_mp_create_vc co_miniport_create_vc;
- struct rcondis_mp_delete_vc co_miniport_delete_vc;
- struct rcondis_indicate_status co_indicate_status;
- struct rcondis_mp_activate_vc_request co_miniport_activate_vc;
- struct rcondis_mp_deactivate_vc_request co_miniport_deactivate_vc;
- struct rcondis_mp_create_vc_complete co_miniport_create_vc_complete;
- struct rcondis_mp_delete_vc_complete co_miniport_delete_vc_complete;
- struct rcondis_mp_activate_vc_complete co_miniport_activate_vc_complete;
- struct rcondis_mp_deactivate_vc_complete
- co_miniport_deactivate_vc_complete;
-};
-
-/* Remote NDIS message format */
-struct rndis_message {
- u32 ndis_msg_type;
-
- /* Total length of this message, from the beginning */
- /* of the sruct rndis_message, in bytes. */
- u32 msg_len;
-
- /* Actual message */
- union rndis_message_container msg;
-};
-
-/* Handy macros */
-
-/* get the size of an RNDIS message. Pass in the message type, */
-/* struct rndis_set_request, struct rndis_packet for example */
-#define RNDIS_MESSAGE_SIZE(msg) \
- (sizeof(msg) + (sizeof(struct rndis_message) - \
- sizeof(union rndis_message_container)))
-
-/* get pointer to info buffer with message pointer */
-#define MESSAGE_TO_INFO_BUFFER(msg) \
- (((unsigned char *)(msg)) + msg->info_buf_offset)
-
-/* get pointer to status buffer with message pointer */
-#define MESSAGE_TO_STATUS_BUFFER(msg) \
- (((unsigned char *)(msg)) + msg->status_buf_offset)
-
-/* get pointer to OOBD buffer with message pointer */
-#define MESSAGE_TO_OOBD_BUFFER(msg) \
- (((unsigned char *)(msg)) + msg->oob_data_offset)
-
-/* get pointer to data buffer with message pointer */
-#define MESSAGE_TO_DATA_BUFFER(msg) \
- (((unsigned char *)(msg)) + msg->per_pkt_info_offset)
-
-/* get pointer to contained message from NDIS_MESSAGE pointer */
-#define RNDIS_MESSAGE_PTR_TO_MESSAGE_PTR(rndis_msg) \
- ((void *) &rndis_msg->msg)
-
-/* get pointer to contained message from NDIS_MESSAGE pointer */
-#define RNDIS_MESSAGE_RAW_PTR_TO_MESSAGE_PTR(rndis_msg) \
- ((void *) rndis_msg)
-
-#endif /* _RNDIS_H_ */
--
1.7.4.1

2011-05-10 08:41:38

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 197/206] Staging: hv: Get rid of storvsc_api.h

Now, get rid of storvsc_api.h.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/storvsc_api.h | 162 --------------------------------------
1 files changed, 0 insertions(+), 162 deletions(-)
delete mode 100644 drivers/staging/hv/storvsc_api.h

diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
deleted file mode 100644
index b163515..0000000
--- a/drivers/staging/hv/storvsc_api.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- *
- * Copyright (c) 2009, Microsoft Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Authors:
- * Haiyang Zhang <[email protected]>
- * Hank Janssen <[email protected]>
- *
- */
-
-
-#ifndef _STORVSC_API_H_
-#define _STORVSC_API_H_
-
-#include <linux/kernel.h>
-#include <linux/wait.h>
-#include "vstorage.h"
-#include "vmbus_api.h"
-#include "vmbus.h"
-
-/* Defines */
-#define STORVSC_RING_BUFFER_SIZE (20*PAGE_SIZE)
-#define BLKVSC_RING_BUFFER_SIZE (20*PAGE_SIZE)
-
-#define STORVSC_MAX_IO_REQUESTS 128
-
-/*
- * In Hyper-V, each port/path/target maps to 1 scsi host adapter. In
- * reality, the path/target is not used (ie always set to 0) so our
- * scsi host adapter essentially has 1 bus with 1 target that contains
- * up to 256 luns.
- */
-#define STORVSC_MAX_LUNS_PER_TARGET 64
-#define STORVSC_MAX_TARGETS 1
-#define STORVSC_MAX_CHANNELS 1
-
-struct hv_storvsc_request;
-
-/* Matches Windows-end */
-enum storvsc_request_type{
- WRITE_TYPE,
- READ_TYPE,
- UNKNOWN_TYPE,
-};
-
-
-struct hv_storvsc_request {
- struct hv_storvsc_request *request;
- struct hv_device *device;
-
- /* Synchronize the request/response if needed */
- struct completion wait_event;
-
- unsigned char *sense_buffer;
- void *context;
- void (*on_io_completion)(struct hv_storvsc_request *request);
- struct hv_multipage_buffer data_buffer;
-
- struct vstor_packet vstor_packet;
-};
-
-
-struct storvsc_device_info {
- u32 ring_buffer_size;
- unsigned int port_number;
- unsigned char path_id;
- unsigned char target_id;
-};
-
-struct storvsc_major_info {
- int major;
- int index;
- bool do_register;
- char *devname;
- char *diskname;
-};
-
-/* A storvsc device is a device object that contains a vmbus channel */
-struct storvsc_device {
- struct hv_device *device;
-
- /* 0 indicates the device is being destroyed */
- atomic_t ref_count;
-
- bool drain_notify;
- atomic_t num_outstanding_req;
-
- wait_queue_head_t waiting_to_drain;
-
- /*
- * Each unique Port/Path/Target represents 1 channel ie scsi
- * controller. In reality, the pathid, targetid is always 0
- * and the port is set by us
- */
- unsigned int port_number;
- unsigned char path_id;
- unsigned char target_id;
-
- /* Used for vsc/vsp channel reset process */
- struct hv_storvsc_request init_request;
- struct hv_storvsc_request reset_request;
-};
-
-
-/* Get the stordevice object iff exists and its refcount > 1 */
-static inline struct storvsc_device *get_stor_device(struct hv_device *device)
-{
- struct storvsc_device *stor_device;
-
- stor_device = (struct storvsc_device *)device->ext;
- if (stor_device && atomic_read(&stor_device->ref_count) > 1)
- atomic_inc(&stor_device->ref_count);
- else
- stor_device = NULL;
-
- return stor_device;
-}
-
-
-static inline void put_stor_device(struct hv_device *device)
-{
- struct storvsc_device *stor_device;
-
- stor_device = (struct storvsc_device *)device->ext;
-
- atomic_dec(&stor_device->ref_count);
-}
-
-static inline void storvsc_wait_to_drain(struct storvsc_device *dev)
-{
- dev->drain_notify = true;
- wait_event(dev->waiting_to_drain,
- atomic_read(&dev->num_outstanding_req) == 0);
- dev->drain_notify = false;
-}
-
-/* Interface */
-
-int storvsc_dev_add(struct hv_device *device,
- void *additional_info);
-int storvsc_dev_remove(struct hv_device *device);
-
-int storvsc_do_io(struct hv_device *device,
- struct hv_storvsc_request *request);
-
-int storvsc_get_major_info(struct storvsc_device_info *device_info,
- struct storvsc_major_info *major_info);
-
-#endif /* _STORVSC_API_H_ */
--
1.7.4.1

2011-05-10 08:31:14

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 198/206] Staging: hv: Get rid of utils.h

Now, get rid of utils.h.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/utils.h | 120 --------------------------------------------
1 files changed, 0 insertions(+), 120 deletions(-)
delete mode 100644 drivers/staging/hv/utils.h

diff --git a/drivers/staging/hv/utils.h b/drivers/staging/hv/utils.h
deleted file mode 100644
index acebbbf..0000000
--- a/drivers/staging/hv/utils.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2009, Microsoft Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Authors:
- * Haiyang Zhang <[email protected]>
- * Hank Janssen <[email protected]>
- */
-#ifndef __HV_UTILS_H_
-#define __HV_UTILS_H_
-
-/*
- * Common header for Hyper-V ICs
- */
-#define ICMSGTYPE_NEGOTIATE 0
-#define ICMSGTYPE_HEARTBEAT 1
-#define ICMSGTYPE_KVPEXCHANGE 2
-#define ICMSGTYPE_SHUTDOWN 3
-#define ICMSGTYPE_TIMESYNC 4
-#define ICMSGTYPE_VSS 5
-
-#define ICMSGHDRFLAG_TRANSACTION 1
-#define ICMSGHDRFLAG_REQUEST 2
-#define ICMSGHDRFLAG_RESPONSE 4
-
-#define HV_S_OK 0x00000000
-#define HV_E_FAIL 0x80004005
-#define HV_ERROR_NOT_SUPPORTED 0x80070032
-#define HV_ERROR_MACHINE_LOCKED 0x800704F7
-
-struct vmbuspipe_hdr {
- u32 flags;
- u32 msgsize;
-} __packed;
-
-struct ic_version {
- u16 major;
- u16 minor;
-} __packed;
-
-struct icmsg_hdr {
- struct ic_version icverframe;
- u16 icmsgtype;
- struct ic_version icvermsg;
- u16 icmsgsize;
- u32 status;
- u8 ictransaction_id;
- u8 icflags;
- u8 reserved[2];
-} __packed;
-
-struct icmsg_negotiate {
- u16 icframe_vercnt;
- u16 icmsg_vercnt;
- u32 reserved;
- struct ic_version icversion_data[1]; /* any size array */
-} __packed;
-
-struct shutdown_msg_data {
- u32 reason_code;
- u32 timeout_seconds;
- u32 flags;
- u8 display_message[2048];
-} __packed;
-
-struct heartbeat_msg_data {
- u64 seq_num;
- u32 reserved[8];
-} __packed;
-
-/* Time Sync IC defs */
-#define ICTIMESYNCFLAG_PROBE 0
-#define ICTIMESYNCFLAG_SYNC 1
-#define ICTIMESYNCFLAG_SAMPLE 2
-
-#ifdef __x86_64__
-#define WLTIMEDELTA 116444736000000000L /* in 100ns unit */
-#else
-#define WLTIMEDELTA 116444736000000000LL
-#endif
-
-struct ictimesync_data{
- u64 parenttime;
- u64 childtime;
- u64 roundtriptime;
- u8 flags;
-} __packed;
-
-/* Index for each IC struct in array hv_cb_utils[] */
-#define HV_SHUTDOWN_MSG 0
-#define HV_TIMESYNC_MSG 1
-#define HV_HEARTBEAT_MSG 2
-#define HV_KVP_MSG 3
-
-struct hyperv_service_callback {
- u8 msg_type;
- char *log_msg;
- unsigned char data[16];
- struct vmbus_channel *channel;
- void (*callback) (void *context);
-};
-
-extern void prep_negotiate_resp(struct icmsg_hdr *,
- struct icmsg_negotiate *, u8 *);
-extern void chn_cb_negotiate(void *);
-extern struct hyperv_service_callback hv_cb_utils[];
-
-#endif /* __HV_UTILS_H_ */
--
1.7.4.1

2011-05-10 08:41:40

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 199/206] Staging: hv: Get rid of version_info.h

Now, get rid of version_info.h.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/version_info.h | 48 -------------------------------------
1 files changed, 0 insertions(+), 48 deletions(-)
delete mode 100644 drivers/staging/hv/version_info.h

diff --git a/drivers/staging/hv/version_info.h b/drivers/staging/hv/version_info.h
deleted file mode 100644
index 35178f2..0000000
--- a/drivers/staging/hv/version_info.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * Copyright (c) 2009, Microsoft Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Authors:
- * Haiyang Zhang <[email protected]>
- * Hank Janssen <[email protected]>
- *
- */
-
-#ifndef __HV_VERSION_INFO
-#define __HV_VERSION_INFO
-
-/*
- * We use the same version numbering for all Hyper-V modules.
- *
- * Definition of versioning is as follows;
- *
- * Major Number Changes for these scenarios;
- * 1. When a new version of Windows Hyper-V
- * is released.
- * 2. A Major change has occurred in the
- * Linux IC's.
- * (For example the merge for the first time
- * into the kernel) Every time the Major Number
- * changes, the Revision number is reset to 0.
- * Minor Number Changes when new functionality is added
- * to the Linux IC's that is not a bug fix.
- *
- * 3.1 - Added completed hv_utils driver. Shutdown/Heartbeat/Timesync
- */
-#define HV_DRV_VERSION "3.1"
-
-
-#endif
--
1.7.4.1

2011-05-10 08:44:09

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 200/206] Staging: hv: Get rid of vmbus_api.h

Now, get rid of vmbus_api.h.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/vmbus_api.h | 121 ----------------------------------------
1 files changed, 0 insertions(+), 121 deletions(-)
delete mode 100644 drivers/staging/hv/vmbus_api.h

diff --git a/drivers/staging/hv/vmbus_api.h b/drivers/staging/hv/vmbus_api.h
deleted file mode 100644
index 5845436..0000000
--- a/drivers/staging/hv/vmbus_api.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *
- * Copyright (c) 2009, Microsoft Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Authors:
- * Haiyang Zhang <[email protected]>
- * Hank Janssen <[email protected]>
- *
- */
-
-
-#ifndef _VMBUS_API_H_
-#define _VMBUS_API_H_
-
-#include <linux/device.h>
-#include <linux/workqueue.h>
-
-#define MAX_PAGE_BUFFER_COUNT 16
-#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */
-
-#pragma pack(push, 1)
-
-/* Single-page buffer */
-struct hv_page_buffer {
- u32 len;
- u32 offset;
- u64 pfn;
-};
-
-/* Multiple-page buffer */
-struct hv_multipage_buffer {
- /* Length and Offset determines the # of pfns in the array */
- u32 len;
- u32 offset;
- u64 pfn_array[MAX_MULTIPAGE_BUFFER_COUNT];
-};
-
-/* 0x18 includes the proprietary packet header */
-#define MAX_PAGE_BUFFER_PACKET (0x18 + \
- (sizeof(struct hv_page_buffer) * \
- MAX_PAGE_BUFFER_COUNT))
-#define MAX_MULTIPAGE_BUFFER_PACKET (0x18 + \
- sizeof(struct hv_multipage_buffer))
-
-
-#pragma pack(pop)
-
-struct hv_driver;
-struct hv_device;
-
-struct hv_dev_port_info {
- u32 int_mask;
- u32 read_idx;
- u32 write_idx;
- u32 bytes_avail_toread;
- u32 bytes_avail_towrite;
-};
-
-struct hv_device_info {
- u32 chn_id;
- u32 chn_state;
- struct hv_guid chn_type;
- struct hv_guid chn_instance;
-
- u32 monitor_id;
- u32 server_monitor_pending;
- u32 server_monitor_latency;
- u32 server_monitor_conn_id;
- u32 client_monitor_pending;
- u32 client_monitor_latency;
- u32 client_monitor_conn_id;
-
- struct hv_dev_port_info inbound;
- struct hv_dev_port_info outbound;
-};
-
-/* Base driver object */
-struct hv_driver {
- const char *name;
-
- /* the device type supported by this driver */
- struct hv_guid dev_type;
-
- struct device_driver driver;
-
- int (*probe)(struct hv_device *);
- int (*remove)(struct hv_device *);
- void (*shutdown)(struct hv_device *);
-
-};
-
-/* Base device object */
-struct hv_device {
- /* the device type id of this device */
- struct hv_guid dev_type;
-
- /* the device instance id of this device */
- struct hv_guid dev_instance;
-
- struct device device;
-
- struct vmbus_channel *channel;
-
- /* Device extension; */
- void *ext;
-};
-
-#endif /* _VMBUS_API_H_ */
--
1.7.4.1

2011-05-10 08:30:53

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 201/206] Staging: hv: Get rid of vmbus_channel_interface.h

Now, get rid of vmbus_channel_interface.h.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/vmbus_channel_interface.h | 89 --------------------------
1 files changed, 0 insertions(+), 89 deletions(-)
delete mode 100644 drivers/staging/hv/vmbus_channel_interface.h

diff --git a/drivers/staging/hv/vmbus_channel_interface.h b/drivers/staging/hv/vmbus_channel_interface.h
deleted file mode 100644
index 20ae258..0000000
--- a/drivers/staging/hv/vmbus_channel_interface.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *
- * Copyright (c) 2009, Microsoft Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Authors:
- * Haiyang Zhang <[email protected]>
- * Hank Janssen <[email protected]>
- *
- */
-
-#ifndef __VMBUSCHANNELINTERFACE_H
-#define __VMBUSCHANNELINTERFACE_H
-
-/*
- * A revision number of vmbus that is used for ensuring both ends on a
- * partition are using compatible versions.
- */
-#define VMBUS_REVISION_NUMBER 13
-
-/* Make maximum size of pipe payload of 16K */
-#define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384)
-
-/* Define PipeMode values. */
-#define VMBUS_PIPE_TYPE_BYTE 0x00000000
-#define VMBUS_PIPE_TYPE_MESSAGE 0x00000004
-
-/* The size of the user defined data buffer for non-pipe offers. */
-#define MAX_USER_DEFINED_BYTES 120
-
-/* The size of the user defined data buffer for pipe offers. */
-#define MAX_PIPE_USER_DEFINED_BYTES 116
-
-/*
- * At the center of the Channel Management library is the Channel Offer. This
- * struct contains the fundamental information about an offer.
- */
-struct vmbus_channel_offer {
- struct hv_guid if_type;
- struct hv_guid if_instance;
- u64 int_latency; /* in 100ns units */
- u32 if_revision;
- u32 server_ctx_size; /* in bytes */
- u16 chn_flags;
- u16 mmio_megabytes; /* in bytes * 1024 * 1024 */
-
- union {
- /* Non-pipes: The user has MAX_USER_DEFINED_BYTES bytes. */
- struct {
- unsigned char user_def[MAX_USER_DEFINED_BYTES];
- } std;
-
- /*
- * Pipes:
- * The following sructure is an integrated pipe protocol, which
- * is implemented on top of standard user-defined data. Pipe
- * clients have MAX_PIPE_USER_DEFINED_BYTES left for their own
- * use.
- */
- struct {
- u32 pipe_mode;
- unsigned char user_def[MAX_PIPE_USER_DEFINED_BYTES];
- } pipe;
- } u;
- u32 padding;
-} __packed;
-
-/* Server Flags */
-#define VMBUS_CHANNEL_ENUMERATE_DEVICE_INTERFACE 1
-#define VMBUS_CHANNEL_SERVER_SUPPORTS_TRANSFER_PAGES 2
-#define VMBUS_CHANNEL_SERVER_SUPPORTS_GPADLS 4
-#define VMBUS_CHANNEL_NAMED_PIPE_MODE 0x10
-#define VMBUS_CHANNEL_LOOPBACK_OFFER 0x100
-#define VMBUS_CHANNEL_PARENT_OFFER 0x200
-#define VMBUS_CHANNEL_REQUEST_MONITORED_NOTIFICATION 0x400
-
-#endif
--
1.7.4.1

2011-05-10 08:44:14

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 202/206] Staging: hv: Get rid of vmbus.h

Now, get rid of vmbus.h.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/vmbus.h | 51 --------------------------------------------
1 files changed, 0 insertions(+), 51 deletions(-)
delete mode 100644 drivers/staging/hv/vmbus.h

diff --git a/drivers/staging/hv/vmbus.h b/drivers/staging/hv/vmbus.h
deleted file mode 100644
index 73087f2..0000000
--- a/drivers/staging/hv/vmbus.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- * Copyright (c) 2009, Microsoft Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Authors:
- * Haiyang Zhang <[email protected]>
- * Hank Janssen <[email protected]>
- *
- */
-
-
-#ifndef _VMBUS_H_
-#define _VMBUS_H_
-
-#include <linux/device.h>
-#include "vmbus_api.h"
-
-
-
-
-static inline struct hv_device *device_to_hv_device(struct device *d)
-{
- return container_of(d, struct hv_device, device);
-}
-
-static inline struct hv_driver *drv_to_hv_drv(struct device_driver *d)
-{
- return container_of(d, struct hv_driver, driver);
-}
-
-
-/* Vmbus interface */
-int vmbus_child_driver_register(struct device_driver *drv);
-void vmbus_child_driver_unregister(struct device_driver *drv);
-
-extern struct completion hv_channel_ready;
-
-#endif /* _VMBUS_H_ */
--
1.7.4.1

2011-05-10 08:44:13

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 203/206] Staging: hv: Get rid of vmbus_packet_format.h

Now, get rid of vmbus_packet_format.h.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/vmbus_packet_format.h | 161 ------------------------------
1 files changed, 0 insertions(+), 161 deletions(-)
delete mode 100644 drivers/staging/hv/vmbus_packet_format.h

diff --git a/drivers/staging/hv/vmbus_packet_format.h b/drivers/staging/hv/vmbus_packet_format.h
deleted file mode 100644
index c0b2c2b..0000000
--- a/drivers/staging/hv/vmbus_packet_format.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- *
- * Copyright (c) 2009, Microsoft Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Authors:
- * Haiyang Zhang <[email protected]>
- * Hank Janssen <[email protected]>
- *
- */
-
-#ifndef _VMBUSPACKETFORMAT_H_
-#define _VMBUSPACKETFORMAT_H_
-
-struct vmpacket_descriptor {
- u16 type;
- u16 offset8;
- u16 len8;
- u16 flags;
- u64 trans_id;
-} __packed;
-
-struct vmpacket_header {
- u32 prev_pkt_start_offset;
- struct vmpacket_descriptor descriptor;
-} __packed;
-
-struct vmtransfer_page_range {
- u32 byte_count;
- u32 byte_offset;
-} __packed;
-
-struct vmtransfer_page_packet_header {
- struct vmpacket_descriptor d;
- u16 xfer_pageset_id;
- bool sender_owns_set;
- u8 reserved;
- u32 range_cnt;
- struct vmtransfer_page_range ranges[1];
-} __packed;
-
-struct vmgpadl_packet_header {
- struct vmpacket_descriptor d;
- u32 gpadl;
- u32 reserved;
-} __packed;
-
-struct vmadd_remove_transfer_page_set {
- struct vmpacket_descriptor d;
- u32 gpadl;
- u16 xfer_pageset_id;
- u16 reserved;
-} __packed;
-
-/*
- * This structure defines a range in guest physical space that can be made to
- * look virtually contiguous.
- */
-struct gpa_range {
- u32 byte_count;
- u32 byte_offset;
- u64 pfn_array[0];
-};
-
-/*
- * This is the format for an Establish Gpadl packet, which contains a handle by
- * which this GPADL will be known and a set of GPA ranges associated with it.
- * This can be converted to a MDL by the guest OS. If there are multiple GPA
- * ranges, then the resulting MDL will be "chained," representing multiple VA
- * ranges.
- */
-struct vmestablish_gpadl {
- struct vmpacket_descriptor d;
- u32 gpadl;
- u32 range_cnt;
- struct gpa_range range[1];
-} __packed;
-
-/*
- * This is the format for a Teardown Gpadl packet, which indicates that the
- * GPADL handle in the Establish Gpadl packet will never be referenced again.
- */
-struct vmteardown_gpadl {
- struct vmpacket_descriptor d;
- u32 gpadl;
- u32 reserved; /* for alignment to a 8-byte boundary */
-} __packed;
-
-/*
- * This is the format for a GPA-Direct packet, which contains a set of GPA
- * ranges, in addition to commands and/or data.
- */
-struct vmdata_gpa_direct {
- struct vmpacket_descriptor d;
- u32 reserved;
- u32 range_cnt;
- struct gpa_range range[1];
-} __packed;
-
-/* This is the format for a Additional Data Packet. */
-struct vmadditional_data {
- struct vmpacket_descriptor d;
- u64 total_bytes;
- u32 offset;
- u32 byte_cnt;
- unsigned char data[1];
-} __packed;
-
-union vmpacket_largest_possible_header {
- struct vmpacket_descriptor simple_hdr;
- struct vmtransfer_page_packet_header xfer_page_hdr;
- struct vmgpadl_packet_header gpadl_hdr;
- struct vmadd_remove_transfer_page_set add_rm_xfer_page_hdr;
- struct vmestablish_gpadl establish_gpadl_hdr;
- struct vmteardown_gpadl teardown_gpadl_hdr;
- struct vmdata_gpa_direct data_gpa_direct_hdr;
-};
-
-#define VMPACKET_DATA_START_ADDRESS(__packet) \
- (void *)(((unsigned char *)__packet) + \
- ((struct vmpacket_descriptor)__packet)->offset8 * 8)
-
-#define VMPACKET_DATA_LENGTH(__packet) \
- ((((struct vmpacket_descriptor)__packet)->len8 - \
- ((struct vmpacket_descriptor)__packet)->offset8) * 8)
-
-#define VMPACKET_TRANSFER_MODE(__packet) \
- (((struct IMPACT)__packet)->type)
-
-enum vmbus_packet_type {
- VM_PKT_INVALID = 0x0,
- VM_PKT_SYNCH = 0x1,
- VM_PKT_ADD_XFER_PAGESET = 0x2,
- VM_PKT_RM_XFER_PAGESET = 0x3,
- VM_PKT_ESTABLISH_GPADL = 0x4,
- VM_PKT_TEARDOWN_GPADL = 0x5,
- VM_PKT_DATA_INBAND = 0x6,
- VM_PKT_DATA_USING_XFER_PAGES = 0x7,
- VM_PKT_DATA_USING_GPADL = 0x8,
- VM_PKT_DATA_USING_GPA_DIRECT = 0x9,
- VM_PKT_CANCEL_REQUEST = 0xa,
- VM_PKT_COMP = 0xb,
- VM_PKT_DATA_USING_ADDITIONAL_PKT = 0xc,
- VM_PKT_ADDITIONAL_DATA = 0xd
-};
-
-#define VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED 1
-
-#endif
--
1.7.4.1

2011-05-10 08:37:07

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 204/206] Staging: hv: Get rid of vmbus_private.h

Now, get rid of vmbus_private.h.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/vmbus_private.h | 130 ------------------------------------
1 files changed, 0 insertions(+), 130 deletions(-)
delete mode 100644 drivers/staging/hv/vmbus_private.h

diff --git a/drivers/staging/hv/vmbus_private.h b/drivers/staging/hv/vmbus_private.h
deleted file mode 100644
index bea331e..0000000
--- a/drivers/staging/hv/vmbus_private.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- *
- * Copyright (c) 2009, Microsoft Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Authors:
- * Haiyang Zhang <[email protected]>
- * Hank Janssen <[email protected]>
- *
- */
-
-
-#ifndef _VMBUS_PRIVATE_H_
-#define _VMBUS_PRIVATE_H_
-
-#include "hv.h"
-#include "vmbus_api.h"
-#include "channel.h"
-#include "channel_mgmt.h"
-#include "ring_buffer.h"
-#include <linux/list.h>
-#include <asm/sync_bitops.h>
-
-
-/*
- * Maximum channels is determined by the size of the interrupt page
- * which is PAGE_SIZE. 1/2 of PAGE_SIZE is for send endpoint interrupt
- * and the other is receive endpoint interrupt
- */
-#define MAX_NUM_CHANNELS ((PAGE_SIZE >> 1) << 3) /* 16348 channels */
-
-/* The value here must be in multiple of 32 */
-/* TODO: Need to make this configurable */
-#define MAX_NUM_CHANNELS_SUPPORTED 256
-
-
-enum vmbus_connect_state {
- DISCONNECTED,
- CONNECTING,
- CONNECTED,
- DISCONNECTING
-};
-
-#define MAX_SIZE_CHANNEL_MESSAGE HV_MESSAGE_PAYLOAD_BYTE_COUNT
-
-struct vmbus_connection {
- enum vmbus_connect_state conn_state;
-
- atomic_t next_gpadl_handle;
-
- /*
- * Represents channel interrupts. Each bit position represents a
- * channel. When a channel sends an interrupt via VMBUS, it finds its
- * bit in the sendInterruptPage, set it and calls Hv to generate a port
- * event. The other end receives the port event and parse the
- * recvInterruptPage to see which bit is set
- */
- void *int_page;
- void *send_int_page;
- void *recv_int_page;
-
- /*
- * 2 pages - 1st page for parent->child notification and 2nd
- * is child->parent notification
- */
- void *monitor_pages;
- struct list_head chn_msg_list;
- spinlock_t channelmsg_lock;
-
- /* List of channels */
- struct list_head chn_list;
- spinlock_t channel_lock;
-
- struct workqueue_struct *work_queue;
-};
-
-
-struct vmbus_msginfo {
- /* Bookkeeping stuff */
- struct list_head msglist_entry;
-
- /* The message itself */
- unsigned char msg[0];
-};
-
-
-extern struct vmbus_connection vmbus_connection;
-
-/* General vmbus interface */
-
-struct hv_device *vmbus_child_device_create(struct hv_guid *type,
- struct hv_guid *instance,
- struct vmbus_channel *channel);
-
-int vmbus_child_device_register(struct hv_device *child_device_obj);
-void vmbus_child_device_unregister(struct hv_device *device_obj);
-
-/* static void */
-/* VmbusChildDeviceDestroy( */
-/* struct hv_device *); */
-
-struct vmbus_channel *relid2channel(u32 relid);
-
-
-/* Connection interface */
-
-int vmbus_connect(void);
-
-int vmbus_disconnect(void);
-
-int vmbus_post_msg(void *buffer, size_t buflen);
-
-int vmbus_set_event(u32 child_relid);
-
-void vmbus_on_event(unsigned long data);
-
-
-#endif /* _VMBUS_PRIVATE_H_ */
--
1.7.4.1

2011-05-10 08:38:31

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 205/206] Staging: hv: Get rid of vstorage.h

Now, get rid of vstorage.h.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/vstorage.h | 197 -----------------------------------------
1 files changed, 0 insertions(+), 197 deletions(-)
delete mode 100644 drivers/staging/hv/vstorage.h

diff --git a/drivers/staging/hv/vstorage.h b/drivers/staging/hv/vstorage.h
deleted file mode 100644
index 83060cd..0000000
--- a/drivers/staging/hv/vstorage.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- *
- * Copyright (c) 2009, Microsoft Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Authors:
- * Haiyang Zhang <[email protected]>
- * Hank Janssen <[email protected]>
- *
- */
-
-/* vstorage.w revision number. This is used in the case of a version match, */
-/* to alert the user that structure sizes may be mismatched even though the */
-/* protocol versions match. */
-
-#ifndef _VSTORAGE_H_
-#define _VSTORAGE_H_
-
-#define REVISION_STRING(REVISION_) #REVISION_
-#define FILL_VMSTOR_REVISION(RESULT_LVALUE_) \
- do { \
- char *revision_string \
- = REVISION_STRING($Rev : 6 $) + 6; \
- RESULT_LVALUE_ = 0; \
- while (*revision_string >= '0' \
- && *revision_string <= '9') { \
- RESULT_LVALUE_ *= 10; \
- RESULT_LVALUE_ += *revision_string - '0'; \
- revision_string++; \
- } \
- } while (0)
-
-/* Major/minor macros. Minor version is in LSB, meaning that earlier flat */
-/* version numbers will be interpreted as "0.x" (i.e., 1 becomes 0.1). */
-#define VMSTOR_PROTOCOL_MAJOR(VERSION_) (((VERSION_) >> 8) & 0xff)
-#define VMSTOR_PROTOCOL_MINOR(VERSION_) (((VERSION_)) & 0xff)
-#define VMSTOR_PROTOCOL_VERSION(MAJOR_, MINOR_) ((((MAJOR_) & 0xff) << 8) | \
- (((MINOR_) & 0xff)))
-#define VMSTOR_INVALID_PROTOCOL_VERSION (-1)
-
-/* Version history: */
-/* V1 Beta 0.1 */
-/* V1 RC < 2008/1/31 1.0 */
-/* V1 RC > 2008/1/31 2.0 */
-#define VMSTOR_PROTOCOL_VERSION_CURRENT VMSTOR_PROTOCOL_VERSION(2, 0)
-
-
-
-
-/* This will get replaced with the max transfer length that is possible on */
-/* the host adapter. */
-/* The max transfer length will be published when we offer a vmbus channel. */
-#define MAX_TRANSFER_LENGTH 0x40000
-#define DEFAULT_PACKET_SIZE (sizeof(struct vmdata_gpa_direct) + \
- sizeof(struct vstor_packet) + \
- sizesizeof(u64) * (MAX_TRANSFER_LENGTH / PAGE_SIZE)))
-
-
-/* Packet structure describing virtual storage requests. */
-enum vstor_packet_operation {
- VSTOR_OPERATION_COMPLETE_IO = 1,
- VSTOR_OPERATION_REMOVE_DEVICE = 2,
- VSTOR_OPERATION_EXECUTE_SRB = 3,
- VSTOR_OPERATION_RESET_LUN = 4,
- VSTOR_OPERATION_RESET_ADAPTER = 5,
- VSTOR_OPERATION_RESET_BUS = 6,
- VSTOR_OPERATION_BEGIN_INITIALIZATION = 7,
- VSTOR_OPERATION_END_INITIALIZATION = 8,
- VSTOR_OPERATION_QUERY_PROTOCOL_VERSION = 9,
- VSTOR_OPERATION_QUERY_PROPERTIES = 10,
- VSTOR_OPERATION_MAXIMUM = 10
-};
-
-/*
- * Platform neutral description of a scsi request -
- * this remains the same across the write regardless of 32/64 bit
- * note: it's patterned off the SCSI_PASS_THROUGH structure
- */
-#define CDB16GENERIC_LENGTH 0x10
-
-#ifndef SENSE_BUFFER_SIZE
-#define SENSE_BUFFER_SIZE 0x12
-#endif
-
-#define MAX_DATA_BUF_LEN_WITH_PADDING 0x14
-
-struct vmscsi_request {
- unsigned short length;
- unsigned char srb_status;
- unsigned char scsi_status;
-
- unsigned char port_number;
- unsigned char path_id;
- unsigned char target_id;
- unsigned char lun;
-
- unsigned char cdb_length;
- unsigned char sense_info_length;
- unsigned char data_in;
- unsigned char reserved;
-
- unsigned int data_transfer_length;
-
- union {
- unsigned char cdb[CDB16GENERIC_LENGTH];
- unsigned char sense_data[SENSE_BUFFER_SIZE];
- unsigned char reserved_array[MAX_DATA_BUF_LEN_WITH_PADDING];
- };
-} __attribute((packed));
-
-
-/*
- * This structure is sent during the intialization phase to get the different
- * properties of the channel.
- */
-struct vmstorage_channel_properties {
- unsigned short protocol_version;
- unsigned char path_id;
- unsigned char target_id;
-
- /* Note: port number is only really known on the client side */
- unsigned int port_number;
- unsigned int flags;
- unsigned int max_transfer_bytes;
-
- /* This id is unique for each channel and will correspond with */
- /* vendor specific data in the inquirydata */
- unsigned long long unique_id;
-} __packed;
-
-/* This structure is sent during the storage protocol negotiations. */
-struct vmstorage_protocol_version {
- /* Major (MSW) and minor (LSW) version numbers. */
- unsigned short major_minor;
-
- /*
- * Revision number is auto-incremented whenever this file is changed
- * (See FILL_VMSTOR_REVISION macro above). Mismatch does not
- * definitely indicate incompatibility--but it does indicate mismatched
- * builds.
- */
- unsigned short revision;
-} __packed;
-
-/* Channel Property Flags */
-#define STORAGE_CHANNEL_REMOVABLE_FLAG 0x1
-#define STORAGE_CHANNEL_EMULATED_IDE_FLAG 0x2
-
-struct vstor_packet {
- /* Requested operation type */
- enum vstor_packet_operation operation;
-
- /* Flags - see below for values */
- unsigned int flags;
-
- /* Status of the request returned from the server side. */
- unsigned int status;
-
- /* Data payload area */
- union {
- /*
- * Structure used to forward SCSI commands from the
- * client to the server.
- */
- struct vmscsi_request vm_srb;
-
- /* Structure used to query channel properties. */
- struct vmstorage_channel_properties storage_channel_properties;
-
- /* Used during version negotiations. */
- struct vmstorage_protocol_version version;
- };
-} __packed;
-
-/* Packet flags */
-/*
- * This flag indicates that the server should send back a completion for this
- * packet.
- */
-#define REQUEST_COMPLETION_FLAG 0x1
-
-/* This is the set of flags that the vsc can set in any packets it sends */
-#define VSC_LEGAL_FLAGS (REQUEST_COMPLETION_FLAG)
-
-#endif /* _VSTORAGE_H_ */
--
1.7.4.1

2011-05-10 08:38:27

by KY Srinivasan

[permalink] [raw]
Subject: [PATCH 206/206] Staging: hv: Get rid of the function count_hv_channel()

Get rid of the function count_hv_channel()
by inlining the code.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
drivers/staging/hv/channel_mgmt.c | 28 ++++++++++++----------------
1 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c
index 0e4e05a..ef43b00 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -28,10 +28,12 @@
#include <linux/list.h>
#include <linux/module.h>
#include <linux/completion.h>
+#include <linux/atomic.h>

#include <linux/hyperv.h>
#include "hyperv_vmbus.h"

+static atomic_t num_channels;
struct vmbus_channel_message_table_entry {
enum vmbus_channel_message_type message_type;
void (*message_handler)(struct vmbus_channel_message_header *msg);
@@ -316,21 +318,6 @@ void free_channel(struct vmbus_channel *channel)
DECLARE_COMPLETION(hv_channel_ready);

/*
- * Count initialized channels, and ensure all channels are ready when hv_vmbus
- * module loading completes.
- */
-static void count_hv_channel(void)
-{
- static int counter;
- unsigned long flags;
-
- spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
- if (++counter == MAX_MSG_TYPES)
- complete(&hv_channel_ready);
- spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
-}
-
-/*
* vmbus_process_rescind_offer -
* Rescind the offer by initiating a device removal
*/
@@ -433,7 +420,16 @@ static void vmbus_process_offer(struct work_struct *work)

pr_info("%s\n", hv_cb_utils[cnt].log_msg);

- count_hv_channel();
+ /*
+ * Count initialized channels, and ensure
+ * all channels are ready when hv_vmbus
+ * module loading completes.
+ */
+
+ atomic_inc(&num_channels);
+ if (atomic_read(&num_channels)
+ == MAX_MSG_TYPES)
+ complete(&hv_channel_ready);
}
}
}
--
1.7.4.1

2011-05-09 22:53:33

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH 077/206] Staging: hv: Get rid of call to cleanup()

On Mon, May 09, 2011 at 02:55:59PM -0700, K. Y. Srinivasan wrote:
> cleanup() is an empty function; get rid of it.
>
> Signed-off-by: K. Y. Srinivasan <[email protected]>
> Signed-off-by: Haiyang Zhang <[email protected]>
> Signed-off-by: Abhishek Kane <[email protected]>
> Signed-off-by: Hank Janssen <[email protected]>
> ---
> drivers/staging/hv/netvsc_drv.c | 4 ----

Just picking a random patch out of this series (which, I only received
the first 132, not all 206).

You need to specify a better changelog entry as you didn't say what code
you are changing in the Subject:.

How about:
Staging: hv: netvsc_drv: Get rid of call to cleanup()

Otherwise I would think (and I did) that you got rid of a global
function called cleanup() in all of the hv code.

Care to fix the names of your patches?

Note, I wouldn't recommend sending that many patches to lkml, it's not
needed, just stick to the [email protected] list as I really
doubt anyone else cares about this code at the moment.

thanks,

greg k-h

2011-05-09 23:53:37

by KY Srinivasan

[permalink] [raw]
Subject: RE: [PATCH 077/206] Staging: hv: Get rid of call to cleanup()



> -----Original Message-----
> From: Greg KH [mailto:[email protected]]
> Sent: Monday, May 09, 2011 6:53 PM
> To: KY Srinivasan
> Cc: [email protected]; [email protected];
> [email protected]; [email protected]; Haiyang Zhang;
> Abhishek Kane (Mindtree Consulting PVT LTD); Hank Janssen
> Subject: Re: [PATCH 077/206] Staging: hv: Get rid of call to cleanup()
>
> On Mon, May 09, 2011 at 02:55:59PM -0700, K. Y. Srinivasan wrote:
> > cleanup() is an empty function; get rid of it.
> >
> > Signed-off-by: K. Y. Srinivasan <[email protected]>
> > Signed-off-by: Haiyang Zhang <[email protected]>
> > Signed-off-by: Abhishek Kane <[email protected]>
> > Signed-off-by: Hank Janssen <[email protected]>
> > ---
> > drivers/staging/hv/netvsc_drv.c | 4 ----
>
> Just picking a random patch out of this series (which, I only received
> the first 132, not all 206).
>
> You need to specify a better changelog entry as you didn't say what code
> you are changing in the Subject:.
>
> How about:
> Staging: hv: netvsc_drv: Get rid of call to cleanup()
>
> Otherwise I would think (and I did) that you got rid of a global
> function called cleanup() in all of the hv code.
>
> Care to fix the names of your patches?

Good point; I will fix up the names.
>
> Note, I wouldn't recommend sending that many patches to lkml, it's not
> needed, just stick to the [email protected] list as I really
> doubt anyone else cares about this code at the moment.

Agreed; I will do that. Shall I go ahead and fix the names and send the patches
just to you or do you want me to send them to the devel list as well.

Regards,

K. Y
>
> thanks,
>
> greg k-h

2011-05-10 00:21:12

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH 077/206] Staging: hv: Get rid of call to cleanup()

On Mon, May 09, 2011 at 11:53:35PM +0000, KY Srinivasan wrote:
> > Note, I wouldn't recommend sending that many patches to lkml, it's not
> > needed, just stick to the [email protected] list as I really
> > doubt anyone else cares about this code at the moment.
>
> Agreed; I will do that. Shall I go ahead and fix the names and send the patches
> just to you or do you want me to send them to the devel list as well.

As they have all failed to show up to the list, it can't hurt to send
them all again there as well as to me.

thanks,

greg k-h

2011-05-10 07:01:40

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 017/206] Staging: hv: Get rid of the indirection for invoking io request

> - ret = storvsc_drv->on_io_request(blkdev->device_ctx,
> + ret = storvsc_do_io(blkdev->device_ctx,
> &blkvsc_req->request);

ret = storvsc_do_io(blkdev->device_ctx, &blkvsc_req->request);

2011-05-10 07:06:50

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 115/206] Staging: hv: Use completion abstraction in struct netvsc_device

> - net_device->wait_condition = 0;
> ret = vmbus_sendpacket(device->channel, init_packet,
> sizeof(struct nvsp_message),
> (unsigned long)init_packet,
> @@ -272,10 +272,8 @@ static int netvsc_init_recv_buf(struct hv_device *device)
> goto cleanup;
> }
>
> - wait_event_timeout(net_device->channel_init_wait,
> - net_device->wait_condition,
> - msecs_to_jiffies(1000));
> - BUG_ON(net_device->wait_condition == 0);
> + t = wait_for_completion_timeout(&net_device->channel_init_wait, HZ);
> + BUG_ON(t == 0);

I don't think you want a BUG_ON here, but rather fail the
initialization.

Also I think you really should add synchronous versions of
vmbus_sendpacket*, to the vmbus core so that all the synchronous waiting
can be consolidated into a few helpers instead of needing to opencode
it everywhere.

2011-05-10 08:49:17

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 129/206] Staging: hv: Move the sector size check into blkvsc_drv_init

On Mon, May 09, 2011 at 02:56:51PM -0700, K. Y. Srinivasan wrote:
> The subject line says it all.

Is there any good reason to not support a 32-bit sector_t?

2011-05-10 10:08:32

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH 005/206] Staging: hv: Rename the device type variable

On 05/09/11 22:54, K. Y. Srinivasan wrote:
> Rename the variable g_blk_device_type.
Why?

A few of these renames could do with a bit more detail on what is wrong
with the old names.
>
> Signed-off-by: K. Y. Srinivasan <[email protected]>
> Signed-off-by: Haiyang Zhang <[email protected]>
> Signed-off-by: Abhishek Kane <[email protected]>
> Signed-off-by: Hank Janssen <[email protected]>
> ---
> drivers/staging/hv/blkvsc_drv.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
> index b54130b..51d1265 100644
> --- a/drivers/staging/hv/blkvsc_drv.c
> +++ b/drivers/staging/hv/blkvsc_drv.c
> @@ -115,7 +115,7 @@ struct block_device_context {
> static const char *drv_name = "blkvsc";
>
> /* {32412632-86cb-44a2-9b5c-50d1417354f5} */
> -static const struct hv_guid g_blk_device_type = {
> +static const struct hv_guid dev_type = {
> .data = {
> 0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44,
> 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5
> @@ -178,7 +178,7 @@ static int blk_vsc_initialize(struct hv_driver *driver)
> /* Make sure we are at least 2 pages since 1 page is used for control */
>
> driver->name = drv_name;
> - memcpy(&driver->dev_type, &g_blk_device_type, sizeof(struct hv_guid));
> + memcpy(&driver->dev_type, &dev_type, sizeof(struct hv_guid));
>
>
> /*

2011-05-10 12:13:22

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH 005/206] Staging: hv: Rename the device type variable

On Tue, May 10, 2011 at 11:11:03AM +0100, Jonathan Cameron wrote:
> On 05/09/11 22:54, K. Y. Srinivasan wrote:
> > Rename the variable g_blk_device_type.
> Why?

Because "g_blk_device_type" is in Hungarian notation, which isn't needed
in the kernel.

thanks,

greg k-h

2011-05-10 12:41:23

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH 005/206] Staging: hv: Rename the device type variable

On 05/10/11 13:13, Greg KH wrote:
> On Tue, May 10, 2011 at 11:11:03AM +0100, Jonathan Cameron wrote:
>> On 05/09/11 22:54, K. Y. Srinivasan wrote:
>>> Rename the variable g_blk_device_type.
>> Why?
>
> Because "g_blk_device_type" is in Hungarian notation, which isn't needed
> in the kernel.
>
Fair enough, I'd misunderstood what g_blk referred to. Sorry for the noise.

2011-05-10 12:52:10

by KY Srinivasan

[permalink] [raw]
Subject: RE: [PATCH 115/206] Staging: hv: Use completion abstraction in struct netvsc_device



> -----Original Message-----
> From: Christoph Hellwig [mailto:[email protected]]
> Sent: Tuesday, May 10, 2011 3:07 AM
> To: KY Srinivasan
> Cc: [email protected]; [email protected];
> [email protected]; [email protected]; Haiyang Zhang;
> Abhishek Kane (Mindtree Consulting PVT LTD); Hank Janssen
> Subject: Re: [PATCH 115/206] Staging: hv: Use completion abstraction in struct
> netvsc_device
>
> > - net_device->wait_condition = 0;
> > ret = vmbus_sendpacket(device->channel, init_packet,
> > sizeof(struct nvsp_message),
> > (unsigned long)init_packet,
> > @@ -272,10 +272,8 @@ static int netvsc_init_recv_buf(struct hv_device
> *device)
> > goto cleanup;
> > }
> >
> > - wait_event_timeout(net_device->channel_init_wait,
> > - net_device->wait_condition,
> > - msecs_to_jiffies(1000));
> > - BUG_ON(net_device->wait_condition == 0);
> > + t = wait_for_completion_timeout(&net_device->channel_init_wait, HZ);
> > + BUG_ON(t == 0);
>
> I don't think you want a BUG_ON here, but rather fail the
> initialization.

This is existing code and all I did was change the synchronization
primitive used. Back in Feb. when this was done (prior to then), the
wait was indefinite and one of the comments that was
longstanding was that the wait had to be bounded and so these
timed waits were introduced. When this was done,
in some cases, there was no easy way to roll-back state if we did not
get the response within our expected window of time. This is one
such instance where the guest is handing over the receive buffers
(guest physical addresses) to the host. There was a discussion on this very
topic on this mailing list and the consensus was to leave the BUG_ON()
call in cases where we could not reasonably recover.

>
> Also I think you really should add synchronous versions of
> vmbus_sendpacket*, to the vmbus core so that all the synchronous waiting
> can be consolidated into a few helpers instead of needing to opencode
> it everywhere.

True; but having a non-blocking interface at the lowest level gives you
the most flexibility. In addition to this non-blocking interface, we
may want to look at potentially a blocking interface. In the current
code, the blocking primitive that is embedded in a higher level
abstraction is used for a variety of situations including the initial
handshake which is what can be addressed with a synchronous API
at the lowest level.

Regards,

K. Y