DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wu, Jingjing" <jingjing.wu@intel.com>
To: "Xia, Chenbo" <chenbo.xia@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"thomas@monjalon.net" <thomas@monjalon.net>,
	"david.marchand@redhat.com" <david.marchand@redhat.com>
Cc: "stephen@networkplumber.org" <stephen@networkplumber.org>,
	"Liang, Cunming" <cunming.liang@intel.com>,
	"Lu, Xiuchun" <xiuchun.lu@intel.com>,
	"Li, Miao" <miao.li@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2 5/8] emu/iavf: add resource management and internal logic of iavf
Date: Tue, 29 Dec 2020 06:05:02 +0000	[thread overview]
Message-ID: <BN6PR11MB4052B2E2CAC3555D7ED6E2D2E3D80@BN6PR11MB4052.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20201219062806.56477-6-chenbo.xia@intel.com>

> +static ssize_t iavf_emu_bar0_rw(struct rte_vfio_user_reg_info *reg, char
> *buf,
> +	size_t count, loff_t pos, bool iswrite) {
> +	struct iavf_emudev *dev = (struct iavf_emudev *)reg->priv;
> +	char *reg_pos;
> +
> +	if (!reg->base) {
> +		EMU_IAVF_LOG(ERR, "BAR 0 does not exist\n");
> +		return -EFAULT;
> +	}
> +
> +	if (pos + count > reg->info->size) {
> +		EMU_IAVF_LOG(ERR, "Access exceeds BAR 0 size\n");
> +		return -EINVAL;
> +	}
> +
> +	reg_pos = (char *)reg->base + pos;
> +
> +	if (!iswrite) {
> +		rte_memcpy(buf, reg_pos, count);
> +	} else {
> +		int tmp;
> +		uint32_t val;
> +		int idx = -1;
> +
> +		if (count != 4)
> +			return -EINVAL;
> +
> +		val = *(uint32_t *)buf;
> +		/* Only handle interrupt enable/disable for now */
> +		if (pos == IAVF_VFINT_DYN_CTL01) {
> +			tmp = val & IAVF_VFINT_DYN_CTL01_INTENA_MASK;
> +			idx = 0;
> +		} else if ((pos >= IAVF_VFINT_DYN_CTLN1(0)) && pos <=
> +
> 	IAVF_VFINT_DYN_CTLN1(RTE_IAVF_EMU_MAX_INTR - 1)) {
> +			tmp = val & IAVF_VFINT_DYN_CTLN1_INTENA_MASK;
> +			idx = pos - IAVF_VFINT_DYN_CTLN1(0);
> +			if (idx % 4)
> +				return -EINVAL;
> +			idx = idx / 4;
Should be idx = idx / 4 + 1; ?

> +		}
> +
> +		if (idx != -1 &&
> +			tmp != dev->intr->info[idx].enable && dev->ready) {
> +			dev->ops->update_status(dev->edev);
> +			dev->intr->info[idx].enable = tmp;
dev->intr->info[idx].enable need to be set before update_status callback is called.

> +		}
> +
> +		rte_memcpy(reg_pos, buf, count);
> +	}
> +
> +	return count;
> +}

  reply	other threads:[~2020-12-29  6:05 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18  7:47 [dpdk-dev] [PATCH 0/8] Introduce emudev library and iavf emudev driver Chenbo Xia
2020-12-18  7:47 ` [dpdk-dev] [PATCH 1/8] lib: introduce emudev library Chenbo Xia
2020-12-18  7:47 ` [dpdk-dev] [PATCH 2/8] doc: add emudev library guide Chenbo Xia
2020-12-18  7:47 ` [dpdk-dev] [PATCH 3/8] emu: introduce emulated iavf driver Chenbo Xia
2020-12-18  7:47 ` [dpdk-dev] [PATCH 4/8] emu/iavf: add vfio-user device register and unregister Chenbo Xia
2021-01-07  7:18   ` Xing, Beilei
2021-01-07  8:41     ` Xia, Chenbo
2020-12-18  7:47 ` [dpdk-dev] [PATCH 5/8] emu/iavf: add resource management and internal logic of iavf Chenbo Xia
2020-12-18  7:47 ` [dpdk-dev] [PATCH 6/8] emu/iavf: add emudev operations to fit in emudev framework Chenbo Xia
2020-12-18  7:47 ` [dpdk-dev] [PATCH 7/8] test/emudev: introduce functional test Chenbo Xia
2020-12-18  7:47 ` [dpdk-dev] [PATCH 8/8] doc: update release notes for iavf emudev driver Chenbo Xia
2020-12-18  9:53 ` [dpdk-dev] [PATCH 0/8] Introduce emudev library and " David Marchand
2020-12-19  6:11   ` Xia, Chenbo
2020-12-21  9:52     ` Maxime Coquelin
2020-12-21 12:01       ` Maxime Coquelin
2020-12-22  3:09         ` Xia, Chenbo
2020-12-22  8:48           ` Maxime Coquelin
2020-12-23  5:28             ` Xia, Chenbo
2020-12-19  6:27 ` [dpdk-dev] [PATCH v2 " Chenbo Xia
2020-12-19  6:27   ` [dpdk-dev] [PATCH v2 1/8] lib: introduce emudev library Chenbo Xia
2020-12-19  6:28   ` [dpdk-dev] [PATCH v2 2/8] doc: add emudev library guide Chenbo Xia
2020-12-19  6:28   ` [dpdk-dev] [PATCH v2 3/8] emu: introduce emulated iavf driver Chenbo Xia
2020-12-19  6:28   ` [dpdk-dev] [PATCH v2 4/8] emu/iavf: add vfio-user device register and unregister Chenbo Xia
2021-01-04  6:45     ` Wu, Jingjing
2021-01-05  1:26       ` Xia, Chenbo
2021-01-05 13:41     ` Wu, Jingjing
2021-01-06  7:41       ` Xia, Chenbo
2020-12-19  6:28   ` [dpdk-dev] [PATCH v2 5/8] emu/iavf: add resource management and internal logic of iavf Chenbo Xia
2020-12-29  6:05     ` Wu, Jingjing [this message]
2020-12-30  1:59       ` Xia, Chenbo
2020-12-19  6:28   ` [dpdk-dev] [PATCH v2 6/8] emu/iavf: add emudev operations to fit in emudev framework Chenbo Xia
2020-12-19  6:28   ` [dpdk-dev] [PATCH v2 7/8] test/emudev: introduce functional test Chenbo Xia
2020-12-19  6:28   ` [dpdk-dev] [PATCH v2 8/8] doc: update release notes for iavf emudev driver Chenbo Xia
2021-01-13 16:52   ` [dpdk-dev] [PATCH v2 0/8] Introduce emudev library and " Thomas Monjalon
2021-01-14  1:35     ` Xia, Chenbo
2021-01-14  6:25   ` [dpdk-dev] [PATCH v3 " Chenbo Xia
2021-01-14  6:25     ` [dpdk-dev] [PATCH v3 1/8] lib: introduce emudev library Chenbo Xia
2021-01-14  6:25     ` [dpdk-dev] [PATCH v3 2/8] doc: add emudev library guide Chenbo Xia
2021-01-14  6:25     ` [dpdk-dev] [PATCH v3 3/8] emu: introduce emulated iavf driver Chenbo Xia
2021-01-14  6:25     ` [dpdk-dev] [PATCH v3 4/8] emu/iavf: add vfio-user device register and unregister Chenbo Xia
2021-01-14  6:25     ` [dpdk-dev] [PATCH v3 5/8] emu/iavf: add resource management and internal logic of iavf Chenbo Xia
2021-01-14  6:25     ` [dpdk-dev] [PATCH v3 6/8] emu/iavf: add emudev operations to fit in emudev framework Chenbo Xia
2021-01-14  6:25     ` [dpdk-dev] [PATCH v3 7/8] test/emudev: introduce functional test Chenbo Xia
2021-01-14  6:25     ` [dpdk-dev] [PATCH v3 8/8] doc: update release notes for iavf emudev driver Chenbo Xia
2024-02-12 22:49     ` [dpdk-dev] [PATCH v3 0/8] Introduce emudev library and " Stephen Hemminger
2023-06-14 19:47 ` [dpdk-dev] [PATCH " Stephen Hemminger

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=BN6PR11MB4052B2E2CAC3555D7ED6E2D2E3D80@BN6PR11MB4052.namprd11.prod.outlook.com \
    --to=jingjing.wu@intel.com \
    --cc=chenbo.xia@intel.com \
    --cc=cunming.liang@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=miao.li@intel.com \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    --cc=xiuchun.lu@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).