From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 3AEC32C18 for ; Fri, 5 May 2017 15:57:26 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 882BB7F7A6; Fri, 5 May 2017 13:57:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 882BB7F7A6 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jfreiman@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 882BB7F7A6 Received: from virtlab417.ml3.eng.bos.redhat.com (virtlab417.ml3.eng.bos.redhat.com [10.19.176.175]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E08182798; Fri, 5 May 2017 13:57:25 +0000 (UTC) From: Jens Freimann To: yuanhan.liu@linux.intel.com Cc: dev@dpdk.org Date: Fri, 5 May 2017 09:57:14 -0400 Message-Id: <1493992642-52756-4-git-send-email-jfreiman@redhat.com> In-Reply-To: <1493992642-52756-1-git-send-email-jfreiman@redhat.com> References: <1493992642-52756-1-git-send-email-jfreiman@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 05 May 2017 13:57:25 +0000 (UTC) Subject: [dpdk-dev] [RFC PATCH 03/11] net/virtio-user: add option to enable 1.1 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 13:57:26 -0000 From: Yuanhan Liu Signed-off-by: Yuanhan Liu --- drivers/net/virtio/virtio_user/virtio_user_dev.c | 9 ++++++++- drivers/net/virtio/virtio_user/virtio_user_dev.h | 3 ++- drivers/net/virtio/virtio_user_ethdev.c | 14 +++++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 450404b..3ff6a05 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -337,7 +337,8 @@ int virtio_user_stop_device(struct virtio_user_dev *dev) int virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues, - int cq, int queue_size, const char *mac, char **ifname) + int cq, int queue_size, const char *mac, char **ifname, + int version_1_1) { snprintf(dev->path, PATH_MAX, "%s", path); dev->max_queue_pairs = queues; @@ -365,6 +366,12 @@ int virtio_user_stop_device(struct virtio_user_dev *dev) PMD_INIT_LOG(ERR, "get_features failed: %s", strerror(errno)); return -1; } + + if (version_1_1) + dev->features |= (1ull << VIRTIO_F_VERSION_1_1); + else + dev->features &= ~(1ull << VIRTIO_F_VERSION_1_1); + if (dev->mac_specified) dev->device_features |= (1ull << VIRTIO_NET_F_MAC); diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h b/drivers/net/virtio/virtio_user/virtio_user_dev.h index 8361b6b..76fa17f 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.h +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h @@ -71,7 +71,8 @@ struct virtio_user_dev { int virtio_user_start_device(struct virtio_user_dev *dev); int virtio_user_stop_device(struct virtio_user_dev *dev); int virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues, - int cq, int queue_size, const char *mac, char **ifname); + int cq, int queue_size, const char *mac, char **ifname, + int version_1_1); void virtio_user_dev_uninit(struct virtio_user_dev *dev); void virtio_user_handle_cq(struct virtio_user_dev *dev, uint16_t queue_idx); #endif diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 1894310..141c761 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -300,6 +300,8 @@ VIRTIO_USER_ARG_QUEUE_SIZE, #define VIRTIO_USER_ARG_INTERFACE_NAME "iface" VIRTIO_USER_ARG_INTERFACE_NAME, +#define VIRTIO_USER_ARG_VERSION_1_1 "version_1_1" + VIRTIO_USER_ARG_VERSION_1_1, NULL }; @@ -404,6 +406,7 @@ char *ifname = NULL; char *mac_addr = NULL; int ret = -1; + uint64_t version_1_1 = 0; kvlist = rte_kvargs_parse(rte_vdev_device_args(dev), valid_args); if (!kvlist) { @@ -478,6 +481,15 @@ cq = 1; } + if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_VERSION_1_1) == 1) { + if (rte_kvargs_process(kvlist, VIRTIO_USER_ARG_VERSION_1_1, + &get_integer_arg, &version_1_1) < 0) { + PMD_INIT_LOG(ERR, "error to parse %s", + VIRTIO_USER_ARG_VERSION_1_1); + goto end; + } + } + if (queues > 1 && cq == 0) { PMD_INIT_LOG(ERR, "multi-q requires ctrl-q"); goto end; @@ -499,7 +511,7 @@ hw = eth_dev->data->dev_private; if (virtio_user_dev_init(hw->virtio_user_dev, path, queues, cq, - queue_size, mac_addr, &ifname) < 0) { + queue_size, mac_addr, &ifname, version_1_1) < 0) { PMD_INIT_LOG(ERR, "virtio_user_dev_init fails"); virtio_user_eth_dev_free(eth_dev); goto end; -- 1.8.3.1