All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@idosch.org>
To: Jiri Pirko <jiri@resnulli.us>
Cc: netdev@vger.kernel.org, davem@davemloft.net, yotamg@mellanox.com,
	arkadis@mellanox.com, idosch@mellanox.com, eladr@mellanox.com,
	nogahf@mellanox.com, ogerlitz@mellanox.com
Subject: Re: [patch net 2/2] mlxsw: spectrum_router: Correctly dump neighbour activity
Date: Fri, 11 Nov 2016 14:54:05 +0200	[thread overview]
Message-ID: <20161111125405.x56ipwlaoln4b4fe@splinter> (raw)
In-Reply-To: <1478859642-2918-3-git-send-email-jiri@resnulli.us>

On Fri, Nov 11, 2016 at 11:20:42AM +0100, Jiri Pirko wrote:
> From: Arkadi Sharshevsky <arkadis@mellanox.com>
> 
> During neighbour activity check the device's table is dumped by multiple
> query requests. The query session should end when the response carries
> less records than requested or when a given record is not full. Current
> code only stops the dumping process if the number of returned records is
> zero, which can result in infinite loop in case of activity.
> 
> Fix this by stopping the dumping process according to the above logic.
> 
> Fixes: c723c735fa6b ("mlxsw: spectrum_router: Periodically update the kernel's neigh table")
> Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  .../net/ethernet/mellanox/mlxsw/spectrum_router.c  | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> index 040737e..d437457 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> @@ -800,6 +800,26 @@ static void mlxsw_sp_router_neigh_rec_process(struct mlxsw_sp *mlxsw_sp,
>  	}
>  }
>  
> +static bool mlxsw_sp_router_rauhtd_is_full(char *rauhtd_pl)
> +{
> +	u8 num_rec, last_rec_index, num_entries;
> +
> +	num_rec = mlxsw_reg_rauhtd_num_rec_get(rauhtd_pl);
> +	last_rec_index = num_rec - 1;
> +
> +	if (num_rec < MLXSW_REG_RAUHTD_REC_MAX_NUM)
> +		return false;
> +	if (mlxsw_reg_rauhtd_rec_type_get(rauhtd_pl, last_rec_index) ==
> +	    MLXSW_REG_RAUHTD_TYPE_IPV6)
> +		return true;
> +
> +	num_entries = mlxsw_reg_rauhtd_ipv4_rec_num_entries_get(rauhtd_pl,
> +								last_rec_index);
> +	if (++num_entries ==  MLXSW_REG_RAUHTD_IPV4_ENT_PER_REC)

Jiri, I just noticed we have an extra space after the '=='. Can you
please remove it in v2? Sorry for not spotting this earlier.

> +		return true;
> +	return false;
> +}
> +
>  static int mlxsw_sp_router_neighs_update_rauhtd(struct mlxsw_sp *mlxsw_sp)
>  {
>  	char *rauhtd_pl;
> @@ -826,7 +846,7 @@ static int mlxsw_sp_router_neighs_update_rauhtd(struct mlxsw_sp *mlxsw_sp)
>  		for (i = 0; i < num_rec; i++)
>  			mlxsw_sp_router_neigh_rec_process(mlxsw_sp, rauhtd_pl,
>  							  i);
> -	} while (num_rec);
> +	} while (mlxsw_sp_router_rauhtd_is_full(rauhtd_pl));
>  	rtnl_unlock();
>  
>  	kfree(rauhtd_pl);
> -- 
> 2.7.4
> 

  reply	other threads:[~2016-11-11 13:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-11 10:20 [patch net 0/2] mlxsw: Couple of fixes Jiri Pirko
2016-11-11 10:20 ` [patch net 1/2] mlxsw: spectrum: Fix refcount bug on span entries Jiri Pirko
2016-11-11 12:49   ` Ido Schimmel
2016-11-11 13:15     ` Jiri Pirko
2016-11-11 10:20 ` [patch net 2/2] mlxsw: spectrum_router: Correctly dump neighbour activity Jiri Pirko
2016-11-11 12:54   ` Ido Schimmel [this message]
2016-11-11 13:13     ` Jiri Pirko
2016-11-13 17:48 ` [patch net 0/2] mlxsw: Couple of fixes David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161111125405.x56ipwlaoln4b4fe@splinter \
    --to=idosch@idosch.org \
    --cc=arkadis@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=eladr@mellanox.com \
    --cc=idosch@mellanox.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=nogahf@mellanox.com \
    --cc=ogerlitz@mellanox.com \
    --cc=yotamg@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.