diff mbox

[dpdk-dev,08/14] remove gpa_to_vva, base_index

Message ID 1413779906-28113-9-git-send-email-huawei.xie@intel.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Huawei Xie Oct. 20, 2014, 4:38 a.m. UTC
remove gpa_to_vva macro and base_index parameter. 

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
---
 examples/vhost/main.c | 42 +-----------------------------------------
 1 file changed, 1 insertion(+), 41 deletions(-)

Comments

Thomas Monjalon Oct. 23, 2014, 9:43 a.m. UTC | #1
2014-10-20 12:38, Huawei Xie:
> remove gpa_to_vva macro and base_index parameter. 

gpa_to_vva function should be removed in patch 2
base_index should be removed when implementing registration (next patch)
diff mbox

Patch

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index bbfdef6..aaac88b 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -218,8 +218,6 @@  static uint32_t burst_rx_retry_num = BURST_RX_RETRIES;
 /* Character device basename. Can be set by user. */
 static char dev_basename[MAX_BASENAME_SZ] = "vhost-net";
 
-/* Charater device index. Can be set by user. */
-static uint32_t dev_index = 0;
 
 /* This can be set by the user so it is made available here. */
 extern uint64_t VHOST_FEATURES;
@@ -560,7 +558,7 @@  us_vhost_usage(const char *prgname)
 	RTE_LOG(INFO, VHOST_CONFIG, "%s [EAL options] -- -p PORTMASK\n"
 	"		--vm2vm [0|1|2]\n"
 	"		--rx_retry [0|1] --mergeable [0|1] --stats [0-N]\n"
-	"		--dev-basename <name> --dev-index [0-N]\n"
+	"		--dev-basename <name>\n"
 	"		--nb-devices ND\n"
 	"		-p PORTMASK: Set mask for ports to be used by application\n"
 	"		--vm2vm [0|1|2]: disable/software(default)/hardware vm2vm comms\n"
@@ -570,7 +568,6 @@  us_vhost_usage(const char *prgname)
 	"		--mergeable [0|1]: disable(default)/enable RX mergeable buffers\n"
 	"		--stats [0-N]: 0: Disable stats, N: Time in seconds to print stats\n"
 	"		--dev-basename: The basename to be used for the character device.\n"
-	"		--dev-index [0-N]: Defaults to zero if not used. Index is appended to basename.\n"
 	"		--zero-copy [0|1]: disable(default)/enable rx/tx "
 			"zero copy\n"
 	"		--rx-desc-num [0-N]: the number of descriptors on rx, "
@@ -598,7 +595,6 @@  us_vhost_parse_args(int argc, char **argv)
 		{"mergeable", required_argument, NULL, 0},
 		{"stats", required_argument, NULL, 0},
 		{"dev-basename", required_argument, NULL, 0},
-		{"dev-index", required_argument, NULL, 0},
 		{"zero-copy", required_argument, NULL, 0},
 		{"rx-desc-num", required_argument, NULL, 0},
 		{"tx-desc-num", required_argument, NULL, 0},
@@ -708,17 +704,6 @@  us_vhost_parse_args(int argc, char **argv)
 				}
 			}
 
-			/* Set character device index. */
-			if (!strncmp(long_option[option_index].name, "dev-index", MAX_LONG_OPT_SZ)) {
-				ret = parse_num_opt(optarg, INT32_MAX);
-				if (ret == -1) {
-					RTE_LOG(INFO, VHOST_CONFIG, "Invalid argument for character device index [0..N]\n");
-					us_vhost_usage(prgname);
-					return -1;
-				} else
-					dev_index = ret;
-			}
-
 			/* Enable/disable rx/tx zero copy. */
 			if (!strncmp(long_option[option_index].name,
 				"zero-copy", MAX_LONG_OPT_SZ)) {
@@ -867,31 +852,6 @@  static unsigned check_ports_num(unsigned nb_ports)
 #endif
 
 /*
- * Function to convert guest physical addresses to vhost virtual addresses. This
- * is used to convert virtio buffer addresses.
- */
-static inline uint64_t __attribute__((always_inline))
-gpa_to_vva(struct virtio_net *dev, uint64_t guest_pa)
-{
-	struct virtio_memory_regions *region;
-	uint32_t regionidx;
-	uint64_t vhost_va = 0;
-
-	for (regionidx = 0; regionidx < dev->mem->nregions; regionidx++) {
-		region = &dev->mem->regions[regionidx];
-		if ((guest_pa >= region->guest_phys_address) &&
-			(guest_pa <= region->guest_phys_address_end)) {
-			vhost_va = region->address_offset + guest_pa;
-			break;
-		}
-	}
-	LOG_DEBUG(VHOST_DATA, "(%"PRIu64") GPA %p| VVA %p\n",
-		dev->device_fh, (void*)(uintptr_t)guest_pa, (void*)(uintptr_t)vhost_va);
-
-	return vhost_va;
-}
-
-/*
  * Function to convert guest physical addresses to vhost physical addresses.
  * This is used to convert virtio buffer addresses.
  */