DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wang, Xiao W" <xiao.w.wang@intel.com>
To: "Pei, Andy" <andy.pei@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "Xu, Rosen" <rosen.xu@intel.com>,
	"Ye, Xiaolong" <xiaolong.ye@intel.com>,
	 "Bie, Tiwei" <tiwei.bie@intel.com>,
	"Liang, Cunming" <cunming.liang@intel.com>
Subject: Re: [dpdk-dev] [PATCH 4/4] net/ifcvf: enable mutliqueue support
Date: Thu, 12 Sep 2019 07:41:19 +0000	[thread overview]
Message-ID: <B7F2E978279D1D49A3034B7786DACF407AFB204C@SHSMSX106.ccr.corp.intel.com> (raw)
In-Reply-To: <1567740051-367172-4-git-send-email-andy.pei@intel.com>

Hi Andy,

> -----Original Message-----
> From: Pei, Andy
> Sent: Friday, September 6, 2019 11:21 AM
> To: dev@dpdk.org
> Cc: Xu, Rosen <rosen.xu@intel.com>; Ye, Xiaolong <xiaolong.ye@intel.com>;
> Bie, Tiwei <tiwei.bie@intel.com>; Wang, Xiao W <xiao.w.wang@intel.com>
> Subject: [PATCH 4/4] net/ifcvf: enable mutliqueue support
> 
> Enable mutliqueue support for ifcvf devices by setting the mutliqueue
> configuration space.
> 
> Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
> Signed-off-by: Andy Pei <andy.pei@intel.com>
> ---
>  drivers/net/ifc/base/ifcvf.c |  8 ++++++++
>  drivers/net/ifc/base/ifcvf.h |  5 ++++-
>  drivers/net/ifc/ifcvf_vdpa.c | 31 +++++++++++++++++++++++++++++--
>  3 files changed, 41 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ifc/base/ifcvf.c b/drivers/net/ifc/base/ifcvf.c
> index 6462281..ac09537 100644
> --- a/drivers/net/ifc/base/ifcvf.c
> +++ b/drivers/net/ifc/base/ifcvf.c
> @@ -310,6 +310,14 @@
>  	*(u32 *)(lm_cfg + IFCVF_LM_LOGGING_CTRL) = IFCVF_LM_DISABLE;
>  }
> 
> +void ifcvf_enable_multiqueue(struct ifcvf_hw *hw, u16 nr_queue_pair)
> +{
> +	u8 *mq_cfg;
> +
> +	mq_cfg = hw->mq_cfg;
> +	*(u32 *)mq_cfg = nr_queue_pair;
> +}
> +
>  void
>  ifcvf_notify_queue(struct ifcvf_hw *hw, u16 qid)
>  {
> diff --git a/drivers/net/ifc/base/ifcvf.h b/drivers/net/ifc/base/ifcvf.h
> index a4cb1a4..3eb0bf3 100644
> --- a/drivers/net/ifc/base/ifcvf.h
> +++ b/drivers/net/ifc/base/ifcvf.h
> @@ -12,7 +12,7 @@
>  #define IFCVF_SUBSYS_VENDOR_ID	0x8086
>  #define IFCVF_SUBSYS_DEVICE_ID	0x001A
> 
> -#define IFCVF_MAX_QUEUES		1
> +#define IFCVF_MAX_QUEUES		32

The IFC supports flexible queue resource allocation among VFs, a VF may have
at most 32 queue pair allocated, but the actual number depends on user's
allocation policy. You can just get this number from a register in virtio device
config capability.

BRs,
Xiao

>  #define VIRTIO_F_IOMMU_PLATFORM		33
> 
>  /* Common configuration */
> @@ -153,6 +153,9 @@ struct ifcvf_hw {
>  ifcvf_disable_logging(struct ifcvf_hw *hw);
> 
>  void
> +ifcvf_enable_multiqueue(struct ifcvf_hw *hw, u16 nr_queue_pair);
> +
> +void
>  ifcvf_notify_queue(struct ifcvf_hw *hw, u16 qid);
> 
>  u8
> diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c
> index 8de9ef1..be71f92 100644
> --- a/drivers/net/ifc/ifcvf_vdpa.c
> +++ b/drivers/net/ifc/ifcvf_vdpa.c
> @@ -994,6 +994,31 @@ struct internal_list {
>  }
> 
>  static int
> +ifcvf_set_vring_state(int vid)
> +{
> +	int did, nr_active_vring, nr_queue_pair;
> +	struct internal_list *list;
> +
> +	nr_active_vring = rte_vhost_get_active_vring_num(vid);
> +	if (nr_active_vring == 0) {
> +		DRV_LOG(ERR, "No enabled vring");
> +		return -1;
> +	}
> +	nr_queue_pair = (nr_active_vring + 1) / 2;
> +
> +	did = rte_vhost_get_vdpa_device_id(vid);
> +	list = find_internal_resource_by_did(did);
> +	if (list == NULL) {
> +		DRV_LOG(ERR, "Invalid device id: %d", did);
> +		return -1;
> +	}
> +
> +	ifcvf_enable_multiqueue(&list->internal->hw, nr_queue_pair);
> +
> +	return 0;
> +}
> +
> +static int
>  ifcvf_get_notify_area(int vid, int qid, uint64_t *offset, uint64_t *size)
>  {
>  	int did;
> @@ -1062,7 +1087,9 @@ struct internal_list {
>  		 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_REQ | \
>  		 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD | \
>  		 1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER | \
> -		 1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD)
> +		 1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD | \
> +		 1ULL << VHOST_USER_PROTOCOL_F_MQ)
> +
>  static int
>  ifcvf_get_protocol_features(int did __rte_unused, uint64_t *features)
>  {
> @@ -1076,7 +1103,7 @@ struct internal_list {
>  	.get_protocol_features = ifcvf_get_protocol_features,
>  	.dev_conf = ifcvf_dev_config,
>  	.dev_close = ifcvf_dev_close,
> -	.set_vring_state = NULL,
> +	.set_vring_state = ifcvf_set_vring_state,
>  	.set_features = ifcvf_set_features,
>  	.migration_done = NULL,
>  	.get_vfio_group_fd = ifcvf_get_vfio_group_fd,
> --
> 1.8.3.1


  reply	other threads:[~2019-09-12  7:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06  3:20 [dpdk-dev] [PATCH 1/4] vhost: introduce new API to get the active vring number Andy Pei
2019-09-06  3:20 ` [dpdk-dev] [PATCH 2/4] net/ifcvf: add multiqueue configuration Andy Pei
2019-09-06  3:20 ` [dpdk-dev] [PATCH 3/4] vhost: call vDPA callback at the end of vring enable handler Andy Pei
2019-09-12  7:41   ` Wang, Xiao W
2019-09-17  7:29     ` Pei, Andy
2019-09-06  3:20 ` [dpdk-dev] [PATCH 4/4] net/ifcvf: enable mutliqueue support Andy Pei
2019-09-12  7:41   ` Wang, Xiao W [this message]
2019-09-06 13:25 ` [dpdk-dev] [PATCH 1/4] vhost: introduce new API to get the active vring number Aaron Conole
2019-09-17  9:25   ` Pei, Andy

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=B7F2E978279D1D49A3034B7786DACF407AFB204C@SHSMSX106.ccr.corp.intel.com \
    --to=xiao.w.wang@intel.com \
    --cc=andy.pei@intel.com \
    --cc=cunming.liang@intel.com \
    --cc=dev@dpdk.org \
    --cc=rosen.xu@intel.com \
    --cc=tiwei.bie@intel.com \
    --cc=xiaolong.ye@intel.com \
    /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).