aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-10 17:48:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-10 17:48:50 -0400
commit8d10aae2741ec9ffd53c8d214f7ada6d543b3a46 (patch)
tree08e8cc6a787484589e22d1d7c1b58300a763d9ef
parent6664565681a1c0c95607ae2e30070352d9a563d0 (diff)
parent09a34c8404c1d4c5782de319c02e1d742c57875c (diff)
Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
Pull vhost fixes and cleanups from Michael S Tsirkin: "This includes some fixes and cleanups for vhost net and scsi drivers" * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: vhost/test: update test after vhost cleanups vhost: Make local function static vhost: Make vhost a separate module vhost-scsi: Rename struct tcm_vhost_cmd *tv_cmd to *cmd vhost-scsi: Rename struct tcm_vhost_tpg *tv_tpg to *tpg vhost-scsi: Make func indention more consistent vhost-scsi: Rename struct vhost_scsi *s to *vs vhost-scsi: Remove unnecessary forward struct vhost_scsi declaration vhost: Simplify dev->vqs[i] access vhost-net: fix use-after-free in vhost_net_flush
-rw-r--r--drivers/vhost/Kconfig8
-rw-r--r--drivers/vhost/Makefile3
-rw-r--r--drivers/vhost/net.c4
-rw-r--r--drivers/vhost/scsi.c472
-rw-r--r--drivers/vhost/test.c33
-rw-r--r--drivers/vhost/vhost.c86
-rw-r--r--drivers/vhost/vhost.h2
7 files changed, 349 insertions, 259 deletions
diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig
index 8b9226da3f54..017a1e8a8f6f 100644
--- a/drivers/vhost/Kconfig
+++ b/drivers/vhost/Kconfig
@@ -1,6 +1,7 @@
1config VHOST_NET 1config VHOST_NET
2 tristate "Host kernel accelerator for virtio net" 2 tristate "Host kernel accelerator for virtio net"
3 depends on NET && EVENTFD && (TUN || !TUN) && (MACVTAP || !MACVTAP) 3 depends on NET && EVENTFD && (TUN || !TUN) && (MACVTAP || !MACVTAP)
4 select VHOST
4 select VHOST_RING 5 select VHOST_RING
5 ---help--- 6 ---help---
6 This kernel module can be loaded in host kernel to accelerate 7 This kernel module can be loaded in host kernel to accelerate
@@ -13,6 +14,7 @@ config VHOST_NET
13config VHOST_SCSI 14config VHOST_SCSI
14 tristate "VHOST_SCSI TCM fabric driver" 15 tristate "VHOST_SCSI TCM fabric driver"
15 depends on TARGET_CORE && EVENTFD && m 16 depends on TARGET_CORE && EVENTFD && m
17 select VHOST
16 select VHOST_RING 18 select VHOST_RING
17 default n 19 default n
18 ---help--- 20 ---help---
@@ -24,3 +26,9 @@ config VHOST_RING
24 ---help--- 26 ---help---
25 This option is selected by any driver which needs to access 27 This option is selected by any driver which needs to access
26 the host side of a virtio ring. 28 the host side of a virtio ring.
29
30config VHOST
31 tristate
32 ---help---
33 This option is selected by any driver which needs to access
34 the core of vhost.
diff --git a/drivers/vhost/Makefile b/drivers/vhost/Makefile
index 654e9afb11f5..e0441c34db1c 100644
--- a/drivers/vhost/Makefile
+++ b/drivers/vhost/Makefile
@@ -1,7 +1,8 @@
1obj-$(CONFIG_VHOST_NET) += vhost_net.o 1obj-$(CONFIG_VHOST_NET) += vhost_net.o
2vhost_net-y := vhost.o net.o 2vhost_net-y := net.o
3 3
4obj-$(CONFIG_VHOST_SCSI) += vhost_scsi.o 4obj-$(CONFIG_VHOST_SCSI) += vhost_scsi.o
5vhost_scsi-y := scsi.o 5vhost_scsi-y := scsi.o
6 6
7obj-$(CONFIG_VHOST_RING) += vringh.o 7obj-$(CONFIG_VHOST_RING) += vringh.o
8obj-$(CONFIG_VHOST) += vhost.o
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 8ca5ac71b845..027be91db139 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -168,7 +168,7 @@ static void vhost_net_clear_ubuf_info(struct vhost_net *n)
168 } 168 }
169} 169}
170 170
171int vhost_net_set_ubuf_info(struct vhost_net *n) 171static int vhost_net_set_ubuf_info(struct vhost_net *n)
172{ 172{
173 bool zcopy; 173 bool zcopy;
174 int i; 174 int i;
@@ -189,7 +189,7 @@ err:
189 return -ENOMEM; 189 return -ENOMEM;
190} 190}
191 191
192void vhost_net_vq_reset(struct vhost_net *n) 192static void vhost_net_vq_reset(struct vhost_net *n)
193{ 193{
194 int i; 194 int i;
195 195
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 701420297225..4264840ef7dc 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -49,7 +49,6 @@
49#include <linux/llist.h> 49#include <linux/llist.h>
50#include <linux/bitmap.h> 50#include <linux/bitmap.h>
51 51
52#include "vhost.c"
53#include "vhost.h" 52#include "vhost.h"
54 53
55#define TCM_VHOST_VERSION "v0.1" 54#define TCM_VHOST_VERSION "v0.1"
@@ -116,7 +115,6 @@ struct tcm_vhost_nacl {
116 struct se_node_acl se_node_acl; 115 struct se_node_acl se_node_acl;
117}; 116};
118 117
119struct vhost_scsi;
120struct tcm_vhost_tpg { 118struct tcm_vhost_tpg {
121 /* Vhost port target portal group tag for TCM */ 119 /* Vhost port target portal group tag for TCM */
122 u16 tport_tpgt; 120 u16 tport_tpgt;
@@ -218,7 +216,7 @@ static int iov_num_pages(struct iovec *iov)
218 ((unsigned long)iov->iov_base & PAGE_MASK)) >> PAGE_SHIFT; 216 ((unsigned long)iov->iov_base & PAGE_MASK)) >> PAGE_SHIFT;
219} 217}
220 218
221void tcm_vhost_done_inflight(struct kref *kref) 219static void tcm_vhost_done_inflight(struct kref *kref)
222{ 220{
223 struct vhost_scsi_inflight *inflight; 221 struct vhost_scsi_inflight *inflight;
224 222
@@ -329,11 +327,12 @@ static u32 tcm_vhost_get_default_depth(struct se_portal_group *se_tpg)
329 return 1; 327 return 1;
330} 328}
331 329
332static u32 tcm_vhost_get_pr_transport_id(struct se_portal_group *se_tpg, 330static u32
333 struct se_node_acl *se_nacl, 331tcm_vhost_get_pr_transport_id(struct se_portal_group *se_tpg,
334 struct t10_pr_registration *pr_reg, 332 struct se_node_acl *se_nacl,
335 int *format_code, 333 struct t10_pr_registration *pr_reg,
336 unsigned char *buf) 334 int *format_code,
335 unsigned char *buf)
337{ 336{
338 struct tcm_vhost_tpg *tpg = container_of(se_tpg, 337 struct tcm_vhost_tpg *tpg = container_of(se_tpg,
339 struct tcm_vhost_tpg, se_tpg); 338 struct tcm_vhost_tpg, se_tpg);
@@ -359,10 +358,11 @@ static u32 tcm_vhost_get_pr_transport_id(struct se_portal_group *se_tpg,
359 format_code, buf); 358 format_code, buf);
360} 359}
361 360
362static u32 tcm_vhost_get_pr_transport_id_len(struct se_portal_group *se_tpg, 361static u32
363 struct se_node_acl *se_nacl, 362tcm_vhost_get_pr_transport_id_len(struct se_portal_group *se_tpg,
364 struct t10_pr_registration *pr_reg, 363 struct se_node_acl *se_nacl,
365 int *format_code) 364 struct t10_pr_registration *pr_reg,
365 int *format_code)
366{ 366{
367 struct tcm_vhost_tpg *tpg = container_of(se_tpg, 367 struct tcm_vhost_tpg *tpg = container_of(se_tpg,
368 struct tcm_vhost_tpg, se_tpg); 368 struct tcm_vhost_tpg, se_tpg);
@@ -388,10 +388,11 @@ static u32 tcm_vhost_get_pr_transport_id_len(struct se_portal_group *se_tpg,
388 format_code); 388 format_code);
389} 389}
390 390
391static char *tcm_vhost_parse_pr_out_transport_id(struct se_portal_group *se_tpg, 391static char *
392 const char *buf, 392tcm_vhost_parse_pr_out_transport_id(struct se_portal_group *se_tpg,
393 u32 *out_tid_len, 393 const char *buf,
394 char **port_nexus_ptr) 394 u32 *out_tid_len,
395 char **port_nexus_ptr)
395{ 396{
396 struct tcm_vhost_tpg *tpg = container_of(se_tpg, 397 struct tcm_vhost_tpg *tpg = container_of(se_tpg,
397 struct tcm_vhost_tpg, se_tpg); 398 struct tcm_vhost_tpg, se_tpg);
@@ -417,8 +418,8 @@ static char *tcm_vhost_parse_pr_out_transport_id(struct se_portal_group *se_tpg,
417 port_nexus_ptr); 418 port_nexus_ptr);
418} 419}
419 420
420static struct se_node_acl *tcm_vhost_alloc_fabric_acl( 421static struct se_node_acl *
421 struct se_portal_group *se_tpg) 422tcm_vhost_alloc_fabric_acl(struct se_portal_group *se_tpg)
422{ 423{
423 struct tcm_vhost_nacl *nacl; 424 struct tcm_vhost_nacl *nacl;
424 425
@@ -431,8 +432,9 @@ static struct se_node_acl *tcm_vhost_alloc_fabric_acl(
431 return &nacl->se_node_acl; 432 return &nacl->se_node_acl;
432} 433}
433 434
434static void tcm_vhost_release_fabric_acl(struct se_portal_group *se_tpg, 435static void
435 struct se_node_acl *se_nacl) 436tcm_vhost_release_fabric_acl(struct se_portal_group *se_tpg,
437 struct se_node_acl *se_nacl)
436{ 438{
437 struct tcm_vhost_nacl *nacl = container_of(se_nacl, 439 struct tcm_vhost_nacl *nacl = container_of(se_nacl,
438 struct tcm_vhost_nacl, se_node_acl); 440 struct tcm_vhost_nacl, se_node_acl);
@@ -491,28 +493,28 @@ static int tcm_vhost_get_cmd_state(struct se_cmd *se_cmd)
491 return 0; 493 return 0;
492} 494}
493 495
4