[dpdk-dev] net/failsafe: fix Rx burst infinite loop

Message ID 1516789157-9234-1-git-send-email-matan@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

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

Commit Message

Matan Azrad Jan. 24, 2018, 10:19 a.m. UTC
  In case of plugged out device, the fail-safe PMD uses failsafe_rx_burst
function for packet receiving.

This function iterates over the present sub-devices until it
receives a traffic from one of them or they are all cannot receive
packets.

The corrupted code didn't advance the sub-device pointer when the
sub-device was not present and caused to infinite loop.

Advance the sub-device pointer also in plugged-out sub-device case.

Fixes: 8052bbd9d548 ("net/failsafe: improve Rx sub-devices iteration")

Signed-off-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/failsafe/failsafe_rxtx.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Gaëtan Rivet Jan. 24, 2018, 10:31 a.m. UTC | #1
On Wed, Jan 24, 2018 at 10:19:17AM +0000, Matan Azrad wrote:
> In case of plugged out device, the fail-safe PMD uses failsafe_rx_burst
> function for packet receiving.
> 
> This function iterates over the present sub-devices until it
> receives a traffic from one of them or they are all cannot receive
> packets.
> 
> The corrupted code didn't advance the sub-device pointer when the
> sub-device was not present and caused to infinite loop.
> 
> Advance the sub-device pointer also in plugged-out sub-device case.
> 
> Fixes: 8052bbd9d548 ("net/failsafe: improve Rx sub-devices iteration")
> 
> Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
> ---
>  drivers/net/failsafe/failsafe_rxtx.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/failsafe/failsafe_rxtx.c b/drivers/net/failsafe/failsafe_rxtx.c
> index 1654494..aeee076 100644
> --- a/drivers/net/failsafe/failsafe_rxtx.c
> +++ b/drivers/net/failsafe/failsafe_rxtx.c
> @@ -104,6 +104,7 @@
>  	do {
>  		if (fs_rx_unsafe(sdev)) {
>  			nb_rx = 0;
> +			sdev = sdev->next;
>  			continue;
>  		}
>  		sub_rxq = ETH(sdev)->data->rx_queues[rxq->qid];
> -- 
> 1.8.3.1
>
  
Ferruh Yigit Jan. 24, 2018, 5:28 p.m. UTC | #2
On 1/24/2018 10:31 AM, Gaëtan Rivet wrote:
> On Wed, Jan 24, 2018 at 10:19:17AM +0000, Matan Azrad wrote:
>> In case of plugged out device, the fail-safe PMD uses failsafe_rx_burst
>> function for packet receiving.
>>
>> This function iterates over the present sub-devices until it
>> receives a traffic from one of them or they are all cannot receive
>> packets.
>>
>> The corrupted code didn't advance the sub-device pointer when the
>> sub-device was not present and caused to infinite loop.
>>
>> Advance the sub-device pointer also in plugged-out sub-device case.
>>
>> Fixes: 8052bbd9d548 ("net/failsafe: improve Rx sub-devices iteration")
>>
>> Signed-off-by: Matan Azrad <matan@mellanox.com>
> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/drivers/net/failsafe/failsafe_rxtx.c b/drivers/net/failsafe/failsafe_rxtx.c
index 1654494..aeee076 100644
--- a/drivers/net/failsafe/failsafe_rxtx.c
+++ b/drivers/net/failsafe/failsafe_rxtx.c
@@ -104,6 +104,7 @@ 
 	do {
 		if (fs_rx_unsafe(sdev)) {
 			nb_rx = 0;
+			sdev = sdev->next;
 			continue;
 		}
 		sub_rxq = ETH(sdev)->data->rx_queues[rxq->qid];