[dpdk-dev,v3] i40evf: fix crash when setup tx queues on vf port

Message ID 1438131297-22750-1-git-send-email-jingjing.wu@intel.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Jingjing Wu July 29, 2015, 12:54 a.m. UTC
  This patch fixes the issue:
Testpmd crashed with Segmentation fault when setup tx queues on vf
Steps for reproduce:
  - create one vf device from i40e driver
  - bind vf device to igb_uio and start testpmd

With debugging tools, we saw the struct i40e_vf is cleared after
memcpy(&dev->data->dev_conf, dev_conf, sizeof(dev->data->dev_conf)) in
rte_eth_dev_configure, which should not happen, and the pointer to
i40e_vf isn't in the range of i40e_adapter.

The root cause is the dev_private_size in i40e virtual function driver struct
rte_i40evf_pmd was set incorrectly.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
v2 changes:
  rework the patch's title and commit log.
V3 changes:
  fix name in Signed-off-by.

 drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Thomas Monjalon July 29, 2015, 10:33 p.m. UTC | #1
> This patch fixes the issue:
> Testpmd crashed with Segmentation fault when setup tx queues on vf
> Steps for reproduce:
>   - create one vf device from i40e driver
>   - bind vf device to igb_uio and start testpmd
> 
> With debugging tools, we saw the struct i40e_vf is cleared after
> memcpy(&dev->data->dev_conf, dev_conf, sizeof(dev->data->dev_conf)) in
> rte_eth_dev_configure, which should not happen, and the pointer to
> i40e_vf isn't in the range of i40e_adapter.
> 
> The root cause is the dev_private_size in i40e virtual function driver struct
> rte_i40evf_pmd was set incorrectly.
> 
> Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>

Applied, thanks

Does it mean that Tx with i40evf never worked before?
  
Jingjing Wu July 30, 2015, 12:41 a.m. UTC | #2
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Thursday, July 30, 2015 6:33 AM
> To: Wu, Jingjing
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3] i40evf: fix crash when setup tx queues
> on vf port
> 
> > This patch fixes the issue:
> > Testpmd crashed with Segmentation fault when setup tx queues on vf
> > Steps for reproduce:
> >   - create one vf device from i40e driver
> >   - bind vf device to igb_uio and start testpmd
> >
> > With debugging tools, we saw the struct i40e_vf is cleared after
> > memcpy(&dev->data->dev_conf, dev_conf, sizeof(dev->data->dev_conf))
> in
> > rte_eth_dev_configure, which should not happen, and the pointer to
> > i40e_vf isn't in the range of i40e_adapter.
> >
> > The root cause is the dev_private_size in i40e virtual function driver
> > struct rte_i40evf_pmd was set incorrectly.
> >
> > Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
> 
> Applied, thanks
> 
> Does it mean that Tx with i40evf never worked before?

Actually we didn't face crash with previous version, i40vf tx works before, what makes me surprised. Maybe just lucky.
  

Patch

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index f3470e6..b694400 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1248,7 +1248,7 @@  static struct eth_driver rte_i40evf_pmd = {
 	},
 	.eth_dev_init = i40evf_dev_init,
 	.eth_dev_uninit = i40evf_dev_uninit,
-	.dev_private_size = sizeof(struct i40e_vf),
+	.dev_private_size = sizeof(struct i40e_adapter),
 };
 
 /*