[dpdk-dev,1/2] net/ixgbe: fix mailbox interrupt handler

Message ID 1514406150-17517-1-git-send-email-qi.z.zhang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Helin Zhang
Headers

Checks

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

Commit Message

Qi Zhang Dec. 27, 2017, 8:22 p.m. UTC
  Mailbox interrupt handler only take care of PF reset notification, for
other message ixgbe_read_mbx should not be called since it get chance
to break the foreground VF to PF communication.
This can be simply repeated by
testpmd>rx_vlan rm all 0

Fixes: 77234603fba0 ("net/ixgbe: support VF mailbox interrupt for link up/down")
Cc: stable@dpdk.org

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
  

Comments

Wei Dai Dec. 28, 2017, 4:38 a.m. UTC | #1
According to step 7 & 8 in Table 7-74 PF-to-VF Messaging Flow in 82599 datasheet,
The calling of ixgbe_read_mbx( ) can be replaced by following lines to avoid touching ->mbx.v2p_mailbox,
IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_ACK);

> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Thursday, December 28, 2017 4:22 AM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org; Dai, Wei <wei.dai@intel.com>; Wang, Liang-min
> <liang-min.wang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>;
> stable@dpdk.org
> Subject: [PATCH 1/2] net/ixgbe: fix mailbox interrupt handler
> 
> Mailbox interrupt handler only take care of PF reset notification, for other
> message ixgbe_read_mbx should not be called since it get chance to break
> the foreground VF to PF communication.
> This can be simply repeated by
> testpmd>rx_vlan rm all 0
> 
> Fixes: 77234603fba0 ("net/ixgbe: support VF mailbox interrupt for link
> up/down")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
>  drivers/net/ixgbe/ixgbe_ethdev.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> b/drivers/net/ixgbe/ixgbe_ethdev.c
> index ff19a56..02121f4 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -8165,13 +8165,17 @@ static void ixgbevf_mbx_process(struct
> rte_eth_dev *dev)
>  	struct ixgbe_hw *hw =
> IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>  	u32 in_msg = 0;
> 
> -	if (ixgbe_read_mbx(hw, &in_msg, 1, 0))
> -		return;
> +	/* peek the message first */
> +	in_msg = IXGBE_READ_REG(hw, IXGBE_VFMBMEM);
> 
>  	/* PF reset VF event */
> -	if (in_msg == IXGBE_PF_CONTROL_MSG)
> +	if (in_msg == IXGBE_PF_CONTROL_MSG) {
> +		/* dummy mbx read to ack pf */
> +		if (ixgbe_read_mbx(hw, &in_msg, 1, 0))
> +			return;
>  		_rte_eth_dev_callback_process(dev,
> RTE_ETH_EVENT_INTR_RESET,
>  					      NULL, NULL);
> +	}
>  }
> 
>  static int
> --
> 2.7.4
  
Qi Zhang Jan. 11, 2018, 8:07 a.m. UTC | #2
> -----Original Message-----
> From: Dai, Wei
> Sent: Thursday, December 28, 2017 12:39 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org; Wang, Liang-min <liang-min.wang@intel.com>;
> stable@dpdk.org
> Subject: RE: [PATCH 1/2] net/ixgbe: fix mailbox interrupt handler
> 
> According to step 7 & 8 in Table 7-74 PF-to-VF Messaging Flow in 82599
> datasheet, The calling of ixgbe_read_mbx( ) can be replaced by following lines
> to avoid touching ->mbx.v2p_mailbox, IXGBE_WRITE_REG(hw,
> IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_ACK);

Thanks for the suggestion.

I think the patch try to keep things unchanged when a PF reset happen, but it is not going to cover the case that PF reset interrupt and a foreground VF to PF request happen simultaneously which is an knowing issue
Your suggestion may help on that, but it is not a complete fix. I think it will be better to have a separate patch that focus on it.

Regards
Qi
> 
> > -----Original Message-----
> > From: Zhang, Qi Z
> > Sent: Thursday, December 28, 2017 4:22 AM
> > To: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> > Cc: dev@dpdk.org; Dai, Wei <wei.dai@intel.com>; Wang, Liang-min
> > <liang-min.wang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>;
> > stable@dpdk.org
> > Subject: [PATCH 1/2] net/ixgbe: fix mailbox interrupt handler
> >
> > Mailbox interrupt handler only take care of PF reset notification, for
> > other message ixgbe_read_mbx should not be called since it get chance
> > to break the foreground VF to PF communication.
> > This can be simply repeated by
> > testpmd>rx_vlan rm all 0
> >
> > Fixes: 77234603fba0 ("net/ixgbe: support VF mailbox interrupt for link
> > up/down")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> > ---
> >  drivers/net/ixgbe/ixgbe_ethdev.c | 10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > index ff19a56..02121f4 100644
> > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > @@ -8165,13 +8165,17 @@ static void ixgbevf_mbx_process(struct
> > rte_eth_dev *dev)
> >  	struct ixgbe_hw *hw =
> > IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> >  	u32 in_msg = 0;
> >
> > -	if (ixgbe_read_mbx(hw, &in_msg, 1, 0))
> > -		return;
> > +	/* peek the message first */
> > +	in_msg = IXGBE_READ_REG(hw, IXGBE_VFMBMEM);
> >
> >  	/* PF reset VF event */
> > -	if (in_msg == IXGBE_PF_CONTROL_MSG)
> > +	if (in_msg == IXGBE_PF_CONTROL_MSG) {
> > +		/* dummy mbx read to ack pf */
> > +		if (ixgbe_read_mbx(hw, &in_msg, 1, 0))
> > +			return;
> >  		_rte_eth_dev_callback_process(dev,
> > RTE_ETH_EVENT_INTR_RESET,
> >  					      NULL, NULL);
> > +	}
> >  }
> >
> >  static int
> > --
> > 2.7.4
  
Wei Dai Jan. 12, 2018, 2:29 a.m. UTC | #3
> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Thursday, January 11, 2018 4:08 PM
> To: Dai, Wei <wei.dai@intel.com>; Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org; Wang, Liang-min <liang-min.wang@intel.com>;
> stable@dpdk.org
> Subject: RE: [PATCH 1/2] net/ixgbe: fix mailbox interrupt handler
> 
> 
> 
> > -----Original Message-----
> > From: Dai, Wei
> > Sent: Thursday, December 28, 2017 12:39 PM
> > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Lu, Wenzhuo
> > <wenzhuo.lu@intel.com>
> > Cc: dev@dpdk.org; Wang, Liang-min <liang-min.wang@intel.com>;
> > stable@dpdk.org
> > Subject: RE: [PATCH 1/2] net/ixgbe: fix mailbox interrupt handler
> >
> > According to step 7 & 8 in Table 7-74 PF-to-VF Messaging Flow in 82599
> > datasheet, The calling of ixgbe_read_mbx( ) can be replaced by
> > following lines to avoid touching ->mbx.v2p_mailbox,
> > IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_ACK);
> 
> Thanks for the suggestion.
> 
> I think the patch try to keep things unchanged when a PF reset happen, but it
> is not going to cover the case that PF reset interrupt and a foreground VF to
> PF request happen simultaneously which is an knowing issue Your suggestion
> may help on that, but it is not a complete fix. I think it will be better to have
> a separate patch that focus on it.
Agree with you.
> 
> Regards
> Qi
> >
> > > -----Original Message-----
> > > From: Zhang, Qi Z
> > > Sent: Thursday, December 28, 2017 4:22 AM
> > > To: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> > > Cc: dev@dpdk.org; Dai, Wei <wei.dai@intel.com>; Wang, Liang-min
> > > <liang-min.wang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>;
> > > stable@dpdk.org
> > > Subject: [PATCH 1/2] net/ixgbe: fix mailbox interrupt handler
> > >
> > > Mailbox interrupt handler only take care of PF reset notification,
> > > for other message ixgbe_read_mbx should not be called since it get
> > > chance to break the foreground VF to PF communication.
> > > This can be simply repeated by
> > > testpmd>rx_vlan rm all 0
> > >
> > > Fixes: 77234603fba0 ("net/ixgbe: support VF mailbox interrupt for
> > > link
> > > up/down")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Wei Dai <wei.dai@intel.com>

> > > ---
> > >  drivers/net/ixgbe/ixgbe_ethdev.c | 10 +++++++---
> > >  1 file changed, 7 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > > index ff19a56..02121f4 100644
> > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > > @@ -8165,13 +8165,17 @@ static void ixgbevf_mbx_process(struct
> > > rte_eth_dev *dev)
> > >  	struct ixgbe_hw *hw =
> > > IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > >  	u32 in_msg = 0;
> > >
> > > -	if (ixgbe_read_mbx(hw, &in_msg, 1, 0))
> > > -		return;
> > > +	/* peek the message first */
> > > +	in_msg = IXGBE_READ_REG(hw, IXGBE_VFMBMEM);
> > >
> > >  	/* PF reset VF event */
> > > -	if (in_msg == IXGBE_PF_CONTROL_MSG)
> > > +	if (in_msg == IXGBE_PF_CONTROL_MSG) {
> > > +		/* dummy mbx read to ack pf */
> > > +		if (ixgbe_read_mbx(hw, &in_msg, 1, 0))
> > > +			return;
> > >  		_rte_eth_dev_callback_process(dev,
> > > RTE_ETH_EVENT_INTR_RESET,
> > >  					      NULL, NULL);
> > > +	}
> > >  }
> > >
> > >  static int
> > > --
> > > 2.7.4
  
Wei Dai Jan. 12, 2018, 2:30 a.m. UTC | #4
> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Thursday, December 28, 2017 4:22 AM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org; Dai, Wei <wei.dai@intel.com>; Wang, Liang-min
> <liang-min.wang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>;
> stable@dpdk.org
> Subject: [PATCH 1/2] net/ixgbe: fix mailbox interrupt handler
> 
> Mailbox interrupt handler only take care of PF reset notification, for other
> message ixgbe_read_mbx should not be called since it get chance to break
> the foreground VF to PF communication.
> This can be simply repeated by
> testpmd>rx_vlan rm all 0
> 
> Fixes: 77234603fba0 ("net/ixgbe: support VF mailbox interrupt for link
> up/down")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Wei Dai <wei.dai@intel.com>

> ---
>  drivers/net/ixgbe/ixgbe_ethdev.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> b/drivers/net/ixgbe/ixgbe_ethdev.c
> index ff19a56..02121f4 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -8165,13 +8165,17 @@ static void ixgbevf_mbx_process(struct
> rte_eth_dev *dev)
>  	struct ixgbe_hw *hw =
> IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>  	u32 in_msg = 0;
> 
> -	if (ixgbe_read_mbx(hw, &in_msg, 1, 0))
> -		return;
> +	/* peek the message first */
> +	in_msg = IXGBE_READ_REG(hw, IXGBE_VFMBMEM);
> 
>  	/* PF reset VF event */
> -	if (in_msg == IXGBE_PF_CONTROL_MSG)
> +	if (in_msg == IXGBE_PF_CONTROL_MSG) {
> +		/* dummy mbx read to ack pf */
> +		if (ixgbe_read_mbx(hw, &in_msg, 1, 0))
> +			return;
>  		_rte_eth_dev_callback_process(dev,
> RTE_ETH_EVENT_INTR_RESET,
>  					      NULL, NULL);
> +	}
>  }
> 
>  static int
> --
> 2.7.4
  
Zhang, Helin Jan. 13, 2018, 6:27 a.m. UTC | #5
Hi Qi

Could you help to rebase on the latest dpdk-next-net-intel? It cannot be applied now. Thanks!

Regards,
Helin

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qi Zhang
> Sent: Thursday, December 28, 2017 4:22 AM
> To: Lu, Wenzhuo
> Cc: dev@dpdk.org; Dai, Wei; Wang, Liang-min; Zhang, Qi Z; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH 1/2] net/ixgbe: fix mailbox interrupt handler
> 
> Mailbox interrupt handler only take care of PF reset notification, for other
> message ixgbe_read_mbx should not be called since it get chance to break the
> foreground VF to PF communication.
> This can be simply repeated by
> testpmd>rx_vlan rm all 0
> 
> Fixes: 77234603fba0 ("net/ixgbe: support VF mailbox interrupt for link
> up/down")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
>  drivers/net/ixgbe/ixgbe_ethdev.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> b/drivers/net/ixgbe/ixgbe_ethdev.c
> index ff19a56..02121f4 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -8165,13 +8165,17 @@ static void ixgbevf_mbx_process(struct
> rte_eth_dev *dev)
>  	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
>  	u32 in_msg = 0;
> 
> -	if (ixgbe_read_mbx(hw, &in_msg, 1, 0))
> -		return;
> +	/* peek the message first */
> +	in_msg = IXGBE_READ_REG(hw, IXGBE_VFMBMEM);
> 
>  	/* PF reset VF event */
> -	if (in_msg == IXGBE_PF_CONTROL_MSG)
> +	if (in_msg == IXGBE_PF_CONTROL_MSG) {
> +		/* dummy mbx read to ack pf */
> +		if (ixgbe_read_mbx(hw, &in_msg, 1, 0))
> +			return;
>  		_rte_eth_dev_callback_process(dev,
> RTE_ETH_EVENT_INTR_RESET,
>  					      NULL, NULL);
> +	}
>  }
> 
>  static int
> --
> 2.7.4
  
Zhang, Helin Jan. 13, 2018, 4:13 p.m. UTC | #6
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qi Zhang
> Sent: Thursday, December 28, 2017 4:22 AM
> To: Lu, Wenzhuo
> Cc: dev@dpdk.org; Dai, Wei; Wang, Liang-min; Zhang, Qi Z; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH 1/2] net/ixgbe: fix mailbox interrupt handler
> 
> Mailbox interrupt handler only take care of PF reset notification, for other
> message ixgbe_read_mbx should not be called since it get chance to break the
> foreground VF to PF communication.
> This can be simply repeated by
> testpmd>rx_vlan rm all 0
> 
> Fixes: 77234603fba0 ("net/ixgbe: support VF mailbox interrupt for link
> up/down")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Applied to dpdk-next-net-intel, with minor commit log changes. Thanks!

/Helin
  

Patch

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index ff19a56..02121f4 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -8165,13 +8165,17 @@  static void ixgbevf_mbx_process(struct rte_eth_dev *dev)
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	u32 in_msg = 0;
 
-	if (ixgbe_read_mbx(hw, &in_msg, 1, 0))
-		return;
+	/* peek the message first */
+	in_msg = IXGBE_READ_REG(hw, IXGBE_VFMBMEM);
 
 	/* PF reset VF event */
-	if (in_msg == IXGBE_PF_CONTROL_MSG)
+	if (in_msg == IXGBE_PF_CONTROL_MSG) {
+		/* dummy mbx read to ack pf */
+		if (ixgbe_read_mbx(hw, &in_msg, 1, 0))
+			return;
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET,
 					      NULL, NULL);
+	}
 }
 
 static int