diff options
author | Stephen Hemminger <stephen@networkplumber.org> | 2017-02-12 01:02:23 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-02-14 13:20:35 -0500 |
commit | 6e47dd3e2938f41d75045bbcb64aa9df3a463b2a (patch) | |
tree | f38bc54aecf8a392aba00143586ff6105e2c9f8d /include/linux | |
parent | 5529eaf6e79a61e0ca7ade257f31d2ababc7f6c9 (diff) |
vmbus: expose hv_begin/end_read
In order to implement NAPI in netvsc, the driver needs access to
control host interrupt mask.
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/hyperv.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 466374dbc98f..08eb71a22c14 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h | |||
@@ -1513,6 +1513,36 @@ init_cached_read_index(struct vmbus_channel *channel) | |||
1513 | } | 1513 | } |
1514 | 1514 | ||
1515 | /* | 1515 | /* |
1516 | * Mask off host interrupt callback notifications | ||
1517 | */ | ||
1518 | static inline void hv_begin_read(struct hv_ring_buffer_info *rbi) | ||
1519 | { | ||
1520 | rbi->ring_buffer->interrupt_mask = 1; | ||
1521 | |||
1522 | /* make sure mask update is not reordered */ | ||
1523 | virt_mb(); | ||
1524 | } | ||
1525 | |||
1526 | /* | ||
1527 | * Re-enable host callback and return number of outstanding bytes | ||
1528 | */ | ||
1529 | static inline u32 hv_end_read(struct hv_ring_buffer_info *rbi) | ||
1530 | { | ||
1531 | |||
1532 | rbi->ring_buffer->interrupt_mask = 0; | ||
1533 | |||
1534 | /* make sure mask update is not reordered */ | ||
1535 | virt_mb(); | ||
1536 | |||
1537 | /* | ||
1538 | * Now check to see if the ring buffer is still empty. | ||
1539 | * If it is not, we raced and we need to process new | ||
1540 | * incoming messages. | ||
1541 | */ | ||
1542 | return hv_get_bytes_to_read(rbi); | ||
1543 | } | ||
1544 | |||
1545 | /* | ||
1516 | * An API to support in-place processing of incoming VMBUS packets. | 1546 | * An API to support in-place processing of incoming VMBUS packets. |
1517 | */ | 1547 | */ |
1518 | #define VMBUS_PKT_TRAILER 8 | 1548 | #define VMBUS_PKT_TRAILER 8 |