All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: Jianfeng Tan <jianfeng.tan@intel.com>
Cc: dev@dpdk.org, stephen@networkplumber.org
Subject: Re: [PATCH v2 3/9] net/virtio: add PCI ops for queue/irq binding
Date: Fri, 30 Dec 2016 13:46:00 +0800	[thread overview]
Message-ID: <20161230054600.GG21789@yliu-dev.sh.intel.com> (raw)
In-Reply-To: <1482996643-113253-4-git-send-email-jianfeng.tan@intel.com>

On Thu, Dec 29, 2016 at 07:30:37AM +0000, Jianfeng Tan wrote:
> Add handler in virtio_pci_ops to set queue/irq bind.
> 
> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
> ---
>  drivers/net/virtio/virtio_pci.c | 29 +++++++++++++++++++++++++++++
>  drivers/net/virtio/virtio_pci.h |  5 +++++
>  2 files changed, 34 insertions(+)
> 
> diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
> index 9b47165..4e706cf 100644
> --- a/drivers/net/virtio/virtio_pci.c
> +++ b/drivers/net/virtio/virtio_pci.c
> @@ -217,6 +217,18 @@ legacy_set_config_irq(struct virtio_hw *hw, uint16_t vec)
>  }
>  
>  static uint16_t
> +legacy_set_queue_irq(struct virtio_hw *hw, struct virtqueue *vq, uint16_t vec)
> +{
> +	uint16_t dst;
> +
> +	rte_eal_pci_ioport_write(&hw->io, &vq->vq_queue_index, 2,
> +			 VIRTIO_PCI_QUEUE_SEL);
> +	rte_eal_pci_ioport_write(&hw->io, &vec, 2, VIRTIO_MSI_QUEUE_VECTOR);
> +	rte_eal_pci_ioport_read(&hw->io, &dst, 2, VIRTIO_MSI_QUEUE_VECTOR);
> +	return dst;
> +}
> +
> +static uint16_t
>  legacy_get_queue_num(struct virtio_hw *hw, uint16_t queue_id)
>  {
>  	uint16_t dst;
> @@ -310,6 +322,7 @@ static const struct virtio_pci_ops legacy_ops = {
>  	.set_features	= legacy_set_features,
>  	.get_isr	= legacy_get_isr,
>  	.set_config_irq	= legacy_set_config_irq,
> +	.set_queue_irq = legacy_set_queue_irq,

Please keep the vertical alignment here.

>  	.get_queue_num	= legacy_get_queue_num,
>  	.setup_queue	= legacy_setup_queue,
>  	.del_queue	= legacy_del_queue,
> @@ -449,6 +462,15 @@ modern_set_config_irq(struct virtio_hw *hw, uint16_t vec)
>  }
>  
>  static uint16_t
> +modern_set_queue_irq(struct virtio_hw *hw, struct virtqueue *vq, uint16_t vec)
> +{
> +	PMD_INIT_LOG(INFO, "vq: %u, vec: %u", vq->vq_queue_index, vec);

Such debug info should not exist only in one callback. It should be
in the caller of this callback, before invoke it.

> +	io_write16(vq->vq_queue_index, &hw->common_cfg->queue_select);
> +	io_write16(vec, &hw->common_cfg->queue_msix_vector);
> +	return io_read16(&hw->common_cfg->queue_msix_vector);
> +}
> +
> +static uint16_t
>  modern_get_queue_num(struct virtio_hw *hw, uint16_t queue_id)
>  {
>  	io_write16(queue_id, &hw->common_cfg->queue_select);
> @@ -526,6 +548,7 @@ static const struct virtio_pci_ops modern_ops = {
>  	.set_features	= modern_set_features,
>  	.get_isr	= modern_get_isr,
>  	.set_config_irq	= modern_set_config_irq,
> +	.set_queue_irq = modern_set_queue_irq,

Ditto.

>  	.get_queue_num	= modern_get_queue_num,
>  	.setup_queue	= modern_setup_queue,
>  	.del_queue	= modern_del_queue,
> @@ -605,6 +628,12 @@ vtpci_irq_config(struct virtio_hw *hw, uint16_t vec)
>  	return hw->vtpci_ops->set_config_irq(hw, vec);
>  }
>  
> +uint16_t
> +vtpci_irq_queue(struct virtqueue *vq, uint16_t vec)
> +{
> +	return vq->hw->vtpci_ops->set_queue_irq(vq->hw, vq, vec);
> +}

No need to introduce a wrapper for a vtpci_ops, instead, just invoke
it directly.

	--yliu

  reply	other threads:[~2016-12-30  5:44 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-04  0:18 [PATCH 0/5] Interrupt mode for virtio PMD Jianfeng Tan
2016-12-04  0:18 ` [PATCH 1/5] net/virtio: add Rx descriptor check Jianfeng Tan
2016-12-04  0:18 ` [PATCH 2/5] net/virtio: setup Rx fastpath interrupts Jianfeng Tan
2016-12-04  0:18 ` [PATCH 3/5] net/virtio: remove Rx queue interrupts when stopping Jianfeng Tan
2016-12-04  0:18 ` [PATCH 4/5] net/virtio: add Rx queue intr enable/disable functions Jianfeng Tan
2016-12-04  0:18 ` [PATCH 5/5] examples/l3fwd: add parse-ptype option Jianfeng Tan
2016-12-08  6:59   ` Yuanhan Liu
2016-12-08  7:40     ` Tan, Jianfeng
2016-12-29  7:30 ` [PATCH v2 0/9] rxq interrupt mode for virtio PMD Jianfeng Tan
2016-12-29  7:30   ` [PATCH v2 1/9] net/virtio: fix rewriting LSC flag Jianfeng Tan
2016-12-29  7:30   ` [PATCH v2 2/9] net/virtio: add Rx descriptor check Jianfeng Tan
2016-12-29  7:30   ` [PATCH v2 3/9] net/virtio: add PCI ops for queue/irq binding Jianfeng Tan
2016-12-30  5:46     ` Yuanhan Liu [this message]
2016-12-29  7:30   ` [PATCH v2 4/9] net/virtio: add Rx queue intr enable/disable functions Jianfeng Tan
2016-12-30  5:59     ` Yuanhan Liu
2016-12-29  7:30   ` [PATCH v2 5/9] net/virtio: setup rxq interrupts Jianfeng Tan
2016-12-30  6:27     ` Yuanhan Liu
2017-01-04  6:56       ` Tan, Jianfeng
2017-01-04  7:22         ` Yuanhan Liu
2017-01-04  7:30           ` Tan, Jianfeng
2016-12-29  7:30   ` [PATCH v2 6/9] net/virtio: unbind intr/eventfd when stop device Jianfeng Tan
2016-12-29  7:30   ` [PATCH v2 7/9] net/virtio: unmapping queue/irq when close device Jianfeng Tan
2016-12-30  6:30     ` Yuanhan Liu
2016-12-29  7:30   ` [PATCH v2 8/9] examples/l3fwd: add parse-ptype option Jianfeng Tan
2016-12-30  6:39     ` Yuanhan Liu
2016-12-30  7:30       ` Tan, Jianfeng
2017-01-03  6:59         ` Yuanhan Liu
2016-12-29  7:30   ` [PATCH v2 9/9] examples/l3fwd-power: fix not stop and close device Jianfeng Tan
2016-12-30  6:44     ` Yuanhan Liu
2016-12-30  6:56       ` Tan, Jianfeng
2016-12-29  7:42   ` [PATCH v2 0/9] rxq interrupt mode for virtio PMD Tan, Jianfeng
2016-12-30  5:41     ` Yuanhan Liu
2016-12-30  6:57   ` Yuanhan Liu
2017-01-16 14:46 ` [PATCH v3 00/10] " Jianfeng Tan
2017-01-16 14:46   ` [PATCH v3 01/10] net/virtio: fix rewriting LSC flag Jianfeng Tan
2017-01-16 14:46   ` [PATCH v3 02/10] net/virtio: clean up wrapper of set_config_irq Jianfeng Tan
2017-01-16 14:46   ` [PATCH v3 03/10] net/virtio: add Rx descriptor check Jianfeng Tan
2017-01-16 19:16     ` Stephen Hemminger
2017-01-17  4:09       ` Yuanhan Liu
2017-01-16 14:46   ` [PATCH v3 04/10] net/virtio: add PCI ops for queue/irq binding Jianfeng Tan
2017-01-16 14:46   ` [PATCH v3 05/10] net/virtio: add Rx queue intr enable/disable functions Jianfeng Tan
2017-01-17  2:30     ` Jason Wang
2017-01-16 14:46   ` [PATCH v3 06/10] net/virtio: setup rxq interrupts Jianfeng Tan
2017-01-16 14:46   ` [PATCH v3 07/10] net/virtio: unbind intr/eventfd when stop device Jianfeng Tan
2017-01-16 14:47   ` [PATCH v3 08/10] net/virtio: unmapping queue/irq when close device Jianfeng Tan
2017-01-16 14:47   ` [PATCH v3 09/10] examples/l3fwd-power: add parse-ptype option Jianfeng Tan
2017-01-17  5:16     ` Yuanhan Liu
2017-01-17  5:23       ` Tan, Jianfeng
2017-01-16 14:47   ` [PATCH v3 10/10] examples/l3fwd-power: fix not stop and close device Jianfeng Tan
2017-01-17  2:14   ` [PATCH v3 00/10] rxq interrupt mode for virtio PMD Yao, Lei A
2017-01-17  7:10 ` [PATCH v4 " Jianfeng Tan
2017-01-17  7:10   ` [PATCH v4 01/10] net/virtio: fix rewriting LSC flag Jianfeng Tan
2017-01-17  7:10   ` [PATCH v4 02/10] net/virtio: clean up wrapper of set_config_irq Jianfeng Tan
2017-01-17  7:10   ` [PATCH v4 03/10] net/virtio: add Rx descriptor check Jianfeng Tan
2017-01-17  7:10   ` [PATCH v4 04/10] net/virtio: add PCI ops for queue/irq binding Jianfeng Tan
2017-01-17  7:10   ` [PATCH v4 05/10] net/virtio: add Rx queue intr enable/disable functions Jianfeng Tan
2017-01-17  7:10   ` [PATCH v4 06/10] net/virtio: setup rxq interrupts Jianfeng Tan
2017-01-17  7:10   ` [PATCH v4 07/10] net/virtio: unbind intr/eventfd when stop device Jianfeng Tan
2017-01-17  7:10   ` [PATCH v4 08/10] net/virtio: unmapping queue/irq when close device Jianfeng Tan
2017-01-17  7:10   ` [PATCH v4 09/10] examples/l3fwd-power: add parse-ptype option Jianfeng Tan
2017-01-17  7:10   ` [PATCH v4 10/10] examples/l3fwd-power: fix not stop and close device Jianfeng Tan
2017-01-17  8:28   ` [PATCH v4 00/10] rxq interrupt mode for virtio PMD Yuanhan Liu
2017-01-17  8:00 ` [PATCH v5 06/10] net/virtio: setup rxq interrupts Jianfeng Tan

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=20161230054600.GG21789@yliu-dev.sh.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=dev@dpdk.org \
    --cc=jianfeng.tan@intel.com \
    --cc=stephen@networkplumber.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.