[dpdk-dev,v2] net/virtio: fix fail to configure rxq interrupt

Message ID 1501487804-50970-1-git-send-email-jiayu.hu@intel.com (mailing list archive)
State Accepted, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Hu, Jiayu July 31, 2017, 7:56 a.m. UTC
  When use rte_eth_dev_configure() to enable rx queue interrupt for virtio
devices, virtio_init_device() isn't called to set up the interrupt
environment, which causes rx queue interrupt setup failed. This patch is
to fix this issue.

Fixes: 26b683b4f7d0 ("net/virtio: setup Rx queue interrupts")
Cc: stable@dpdk.org

Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
---
changes in v2:
- fix QEMU crash issue.

 drivers/net/virtio/virtio_ethdev.c | 7 +++++++
 1 file changed, 7 insertions(+)
  

Comments

Maxime Coquelin July 31, 2017, 5:01 p.m. UTC | #1
On 07/31/2017 09:56 AM, Jiayu Hu wrote:
> When use rte_eth_dev_configure() to enable rx queue interrupt for virtio
> devices, virtio_init_device() isn't called to set up the interrupt
> environment, which causes rx queue interrupt setup failed. This patch is
> to fix this issue.
> 
> Fixes: 26b683b4f7d0 ("net/virtio: setup Rx queue interrupts")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
> ---
> changes in v2:
> - fix QEMU crash issue.
> 
>   drivers/net/virtio/virtio_ethdev.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index 00a3122..e320811 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1659,9 +1659,16 @@ virtio_dev_configure(struct rte_eth_dev *dev)
>   {
>   	const struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
>   	struct virtio_hw *hw = dev->data->dev_private;
> +	int ret;
>   
>   	PMD_INIT_LOG(DEBUG, "configure");
>   
> +	if (dev->data->dev_conf.intr_conf.rxq) {
> +		ret = virtio_init_device(dev, hw->req_guest_features);
> +		if (ret < 0)
> +			return ret;
> +	}
> +
>   	/* Virtio does L4 checksum but not L3! */
>   	if (rxmode->hw_ip_checksum) {
>   		PMD_DRV_LOG(NOTICE,
> 

Looking at v1's discussions, it seems to be the right fix.
I haven't tried it myself, but it looks good to me:
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  
Thomas Monjalon July 31, 2017, 5:17 p.m. UTC | #2
31/07/2017 19:01, Maxime Coquelin:
> On 07/31/2017 09:56 AM, Jiayu Hu wrote:
> > When use rte_eth_dev_configure() to enable rx queue interrupt for virtio
> > devices, virtio_init_device() isn't called to set up the interrupt
> > environment, which causes rx queue interrupt setup failed. This patch is
> > to fix this issue.
> > 
> > Fixes: 26b683b4f7d0 ("net/virtio: setup Rx queue interrupts")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
> 
> Looking at v1's discussions, it seems to be the right fix.
> I haven't tried it myself, but it looks good to me:
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Applied, thanks
  

Patch

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 00a3122..e320811 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1659,9 +1659,16 @@  virtio_dev_configure(struct rte_eth_dev *dev)
 {
 	const struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
 	struct virtio_hw *hw = dev->data->dev_private;
+	int ret;
 
 	PMD_INIT_LOG(DEBUG, "configure");
 
+	if (dev->data->dev_conf.intr_conf.rxq) {
+		ret = virtio_init_device(dev, hw->req_guest_features);
+		if (ret < 0)
+			return ret;
+	}
+
 	/* Virtio does L4 checksum but not L3! */
 	if (rxmode->hw_ip_checksum) {
 		PMD_DRV_LOG(NOTICE,