Netdev List
 help / color / mirror / Atom feed
From: Tariq Toukan <tariqt@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>
Subject: Re: [PATCH net V2] net/mlx4: Fix the check in attaching steering rules
Date: Thu, 25 May 2017 17:23:41 +0300	[thread overview]
Message-ID: <841efc7a-96f3-ebd6-eccf-53cfbd759474@mellanox.com> (raw)
In-Reply-To: <1495718470-10215-1-git-send-email-tariqt@mellanox.com>


On 25/05/2017 4:21 PM, Tariq Toukan wrote:
> From: Talat Batheesh <talatb@mellanox.com>
>
> Our previous patch (cited below) introduced a regression
> for RAW Eth QPs.
>
> Fix it by checking if the QP number provided by user-space
> exists, hence allowing steering rules to be added for valid
> QPs only.
>
> Fixes: 89c557687a32 ("net/mlx4_en: Avoid adding steering rules with ...")
> Reported-by: Or Gerlitz <gerlitz.or@gmail.com>
> Signed-off-by: Talat Batheesh <talatb@mellanox.com>
> Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
> Acked-by: Or Gerlitz <ogerlitz@mellanox.com>
> Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
> ---
> v2:
> * Removed unnecessary EXPORT_SYMBOL_GPL.

My bad, this doesn't work.
Please ignore patch.

>
>   drivers/net/ethernet/mellanox/mlx4/en_ethtool.c |  3 +--
>   drivers/net/ethernet/mellanox/mlx4/qp.c         | 13 +++++++++++++
>   include/linux/mlx4/qp.h                         |  1 +
>   3 files changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
> index ae5fdc2df654..00a7cd3dcc2e 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
> @@ -1562,8 +1562,7 @@ static int mlx4_en_flow_replace(struct net_device *dev,
>   		qpn = priv->drop_qp.qpn;
>   	else if (cmd->fs.ring_cookie & EN_ETHTOOL_QP_ATTACH) {
>   		qpn = cmd->fs.ring_cookie & (EN_ETHTOOL_QP_ATTACH - 1);
> -		if (qpn < priv->rss_map.base_qpn ||
> -		    qpn >= priv->rss_map.base_qpn + priv->rx_ring_num) {
> +		if (!mlx4_qp_lookup(priv->mdev->dev, qpn)) {
>   			en_warn(priv, "rxnfc: QP (0x%x) doesn't exist\n", qpn);
>   			return -EINVAL;
>   		}
> diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
> index 2d6abd4662b1..ad92d2311478 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/qp.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
> @@ -384,6 +384,19 @@ static void mlx4_qp_free_icm(struct mlx4_dev *dev, int qpn)
>   		__mlx4_qp_free_icm(dev, qpn);
>   }
>   
> +struct mlx4_qp *mlx4_qp_lookup(struct mlx4_dev *dev, u32 qpn)
> +{
> +	struct mlx4_qp_table *qp_table = &mlx4_priv(dev)->qp_table;
> +	struct mlx4_qp *qp;
> +
> +	spin_lock(&qp_table->lock);
> +
> +	qp = __mlx4_qp_lookup(dev, qpn);
> +
> +	spin_unlock(&qp_table->lock);
> +	return qp;
> +}
> +
>   int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp, gfp_t gfp)
>   {
>   	struct mlx4_priv *priv = mlx4_priv(dev);
> diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
> index b4ee8f62ce8d..8e2828d48d7f 100644
> --- a/include/linux/mlx4/qp.h
> +++ b/include/linux/mlx4/qp.h
> @@ -470,6 +470,7 @@ struct mlx4_update_qp_params {
>   	u16	rate_val;
>   };
>   
> +struct mlx4_qp *mlx4_qp_lookup(struct mlx4_dev *dev, u32 qpn);
>   int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn,
>   		   enum mlx4_update_qp_attr attr,
>   		   struct mlx4_update_qp_params *params);

      reply	other threads:[~2017-05-25 14:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-25 13:21 [PATCH net V2] net/mlx4: Fix the check in attaching steering rules Tariq Toukan
2017-05-25 14:23 ` Tariq Toukan [this message]

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=841efc7a-96f3-ebd6-eccf-53cfbd759474@mellanox.com \
    --to=tariqt@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox