From: Huawei Xie <huawei.xie@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 09/14] other APIs
Date: Mon, 20 Oct 2014 12:38:21 +0800 [thread overview]
Message-ID: <1413779906-28113-10-git-send-email-huawei.xie@intel.com> (raw)
In-Reply-To: <1413779906-28113-1-git-send-email-huawei.xie@intel.com>
other vhost APIs
rte_vhost_driver_register: register vhost driver
rte_vhost_driver_callback_register: register new_device/destroy_device callback
rte_vhost_driver_session_start: start vhost session loop
rte_vhost_feature_disable: disable merge-able feature
rte_vhost_enable_guest_notification: disable guest notification
Signed-off-by: Huawei Xie <huawei.xie@intel.com>
---
examples/vhost/main.c | 29 ++++++++++-------------------
1 file changed, 10 insertions(+), 19 deletions(-)
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index aaac88b..e0bd452 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -175,6 +175,7 @@ uint32_t num_devices = 0;
* disabled on default.
*/
static uint32_t zero_copy;
+static int mergeable;
/* number of descriptors to apply*/
static uint32_t num_rx_descriptor = RTE_TEST_RX_DESC_DEFAULT_ZCP;
@@ -218,10 +219,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";
-
-/* This can be set by the user so it is made available here. */
-extern uint64_t VHOST_FEATURES;
-
/* Default configuration for rx and tx thresholds etc. */
static struct rte_eth_rxconf rx_conf_default = {
.rx_thresh = {
@@ -674,11 +671,11 @@ us_vhost_parse_args(int argc, char **argv)
us_vhost_usage(prgname);
return -1;
} else {
+ mergeable = !!ret;
if (ret) {
vmdq_conf_default.rxmode.jumbo_frame = 1;
vmdq_conf_default.rxmode.max_rx_pkt_len
= JUMBO_FRAME_MAX_SIZE;
- VHOST_FEATURES = (1ULL << VIRTIO_NET_F_MRG_RXBUF);
}
}
}
@@ -2275,16 +2272,6 @@ init_data_ll (void)
}
/*
- * Set virtqueue flags so that we do not receive interrupts.
- */
-static void
-set_irq_status (struct virtio_net *dev)
-{
- dev->virtqueue[VIRTIO_RXQ]->used->flags = VRING_USED_F_NO_NOTIFY;
- dev->virtqueue[VIRTIO_TXQ]->used->flags = VRING_USED_F_NO_NOTIFY;
-}
-
-/*
* Remove a device from the specific data core linked list and from the main linked list. Synchonization
* occurs through the use of the lcore dev_removal_flag. Device is made volatile here to avoid re-ordering
* of dev->remove=1 which can cause an infinite loop in the rte_pause loop.
@@ -2735,7 +2722,8 @@ new_device (struct virtio_net *dev)
memset(&dev_statistics[dev->device_fh], 0, sizeof(struct device_statistics));
/* Disable notifications. */
- set_irq_status(dev);
+ rte_vhost_enable_guest_notification(dev, VIRTIO_RXQ, 0);
+ rte_vhost_enable_guest_notification(dev, VIRTIO_TXQ, 0);
lcore_info[vdev->coreid].lcore_ll->device_num++;
dev->flags |= VIRTIO_DEV_RUNNING;
@@ -3040,15 +3028,18 @@ MAIN(int argc, char *argv[])
lcore_id);
}
+ if (mergeable == 0)
+ rte_vhost_feature_disable(1ULL << VIRTIO_NET_F_MRG_RXBUF);
+
/* Register CUSE device to handle IOCTLs. */
- ret = register_cuse_device((char*)&dev_basename, dev_index, get_virtio_net_callbacks());
+ ret = rte_vhost_driver_register((char *)&dev_basename);
if (ret != 0)
rte_exit(EXIT_FAILURE,"CUSE device setup failure.\n");
- init_virtio_net(&virtio_net_device_ops);
+ rte_vhost_driver_callback_register(&virtio_net_device_ops);
/* Start CUSE session. */
- start_cuse_session_loop();
+ rte_vhost_driver_session_start();
return 0;
}
--
1.8.1.4
next prev parent reply other threads:[~2014-10-20 4:31 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-20 4:38 [dpdk-dev] [PATCH 00/14] new vhost example Huawei Xie
2014-10-20 4:38 ` [dpdk-dev] [PATCH 01/14] copy old " Huawei Xie
2014-10-20 4:38 ` [dpdk-dev] [PATCH 02/14] remove virtio_dev_rx, virtio_dev_merge_rx, copy_from_mbuf_to_ring, virtio_dev_tx, virtio_dev_merge_tx Huawei Xie
2014-10-20 4:38 ` [dpdk-dev] [PATCH 03/14] add bak two hpa region functions Huawei Xie
2014-10-20 4:38 ` [dpdk-dev] [PATCH 04/14] dev->vdev Huawei Xie
2014-10-20 4:38 ` [dpdk-dev] [PATCH 05/14] hpa region Huawei Xie
2014-10-20 4:38 ` [dpdk-dev] [PATCH 06/14] enqueue_burst, dequeue_burst, mac learning Huawei Xie
2014-10-20 4:38 ` [dpdk-dev] [PATCH 07/14] patch virtio_tx_route Huawei Xie
2014-10-20 4:38 ` [dpdk-dev] [PATCH 08/14] remove gpa_to_vva, base_index Huawei Xie
2014-10-23 9:43 ` Thomas Monjalon
2014-10-20 4:38 ` Huawei Xie [this message]
2014-10-23 9:44 ` [dpdk-dev] [PATCH 09/14] other APIs Thomas Monjalon
2014-10-20 4:38 ` [dpdk-dev] [PATCH 10/14] vmdq_rx_q Huawei Xie
2014-10-23 9:45 ` Thomas Monjalon
2014-10-20 4:38 ` [dpdk-dev] [PATCH 11/14] minor fixes Huawei Xie
2014-10-20 4:38 ` [dpdk-dev] [PATCH 12/14] add branch hint Huawei Xie
2014-10-20 4:38 ` [dpdk-dev] [PATCH 13/14] INC_VEC Huawei Xie
2014-10-20 4:38 ` [dpdk-dev] [PATCH 14/14] Makefile Huawei Xie
2014-10-23 9:48 ` Thomas Monjalon
2014-10-20 5:21 ` [dpdk-dev] [PATCH 00/14] new vhost example Ouyang, Changchun
2014-10-23 11:10 ` Thomas Monjalon
2014-10-23 16:17 ` Xie, Huawei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1413779906-28113-10-git-send-email-huawei.xie@intel.com \
--to=huawei.xie@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).