[dpdk-dev,1/2] ixgbe: fix the wrong address of device data pointer

Message ID 1458801431-25886-2-git-send-email-wenzhuo.lu@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Wenzhuo Lu March 24, 2016, 6:37 a.m. UTC
  There's an issue reported. In the scenario DPDK PF + DPDK VF,
if the VF port is closed, PF port cannot receive packets.
I found at that time the promicuous mode is disabled on the PF
port. But it should be enabled.
When VF port is closed, it will send a message to its PF port to
reset it. During this, PF port will also reset its own
promicuous mode. Which promiscuous mode should be set depends on
the parameter stored in the device data. In the function
set_rx_mode, the pointer of device data points to the wrong
address. So, the promiscuous mode is wrong.

Fixes: 00e30184daa0("ixgbe: add PF support")
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Reported-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/ixgbe/ixgbe_pf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Jingjing Wu March 24, 2016, 6:48 a.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Thursday, March 24, 2016 2:37 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo
> Subject: [dpdk-dev] [PATCH 1/2] ixgbe: fix the wrong address of device data
> pointer
> 
> There's an issue reported. In the scenario DPDK PF + DPDK VF, if the VF port
> is closed, PF port cannot receive packets.
> I found at that time the promicuous mode is disabled on the PF port. But it
> should be enabled.
> When VF port is closed, it will send a message to its PF port to reset it. During
> this, PF port will also reset its own promicuous mode. Which promiscuous
> mode should be set depends on the parameter stored in the device data. In
> the function set_rx_mode, the pointer of device data points to the wrong
> address. So, the promiscuous mode is wrong.
> 
> Fixes: 00e30184daa0("ixgbe: add PF support")
> Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> Reported-by: Bernard Iremonger <bernard.iremonger@intel.com>
> ---
>  drivers/net/ixgbe/ixgbe_pf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
> index b854c72..0f8ad55 100644
> --- a/drivers/net/ixgbe/ixgbe_pf.c
> +++ b/drivers/net/ixgbe/ixgbe_pf.c
> @@ -313,7 +313,7 @@ static void
>  set_rx_mode(struct rte_eth_dev *dev)
>  {
>  	struct rte_eth_dev_data *dev_data =
> -		(struct rte_eth_dev_data*)dev->data->dev_private;
> +		(struct rte_eth_dev_data *)dev->data;
Cast is unnecessary here.

/Jingjing
>  	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
>  	u32 fctrl, vmolr = IXGBE_VMOLR_BAM | IXGBE_VMOLR_AUPE;
>  	uint16_t vfn = dev_num_vf(dev);
> --
> 1.9.3
  
Wenzhuo Lu March 24, 2016, 6:53 a.m. UTC | #2
Hi Jingjing,

> >  set_rx_mode(struct rte_eth_dev *dev)
> >  {
> >  	struct rte_eth_dev_data *dev_data =
> > -		(struct rte_eth_dev_data*)dev->data->dev_private;
> > +		(struct rte_eth_dev_data *)dev->data;
> Cast is unnecessary here.
O, didn't notice that. Will send a V2. Thanks.

> 
> /Jingjing
  

Patch

diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index b854c72..0f8ad55 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -313,7 +313,7 @@  static void
 set_rx_mode(struct rte_eth_dev *dev)
 {
 	struct rte_eth_dev_data *dev_data =
-		(struct rte_eth_dev_data*)dev->data->dev_private;
+		(struct rte_eth_dev_data *)dev->data;
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	u32 fctrl, vmolr = IXGBE_VMOLR_BAM | IXGBE_VMOLR_AUPE;
 	uint16_t vfn = dev_num_vf(dev);