[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170523141024.GO17751@mtr-leonro.local>
Date: Tue, 23 May 2017 17:10:24 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Tariq Toukan <tariqt@...lanox.com>
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
Eran Ben Elisha <eranbe@...lanox.com>,
Or Gerlitz <ogerlitz@...lanox.com>,
Talat Batheesh <talatb@...lanox.com>
Subject: Re: [PATCH net] net/mlx4: Fix the check in attaching steering rules
On Tue, May 23, 2017 at 04:15:13PM +0300, Leon Romanovsky wrote:
> On Tue, May 23, 2017 at 03:50:07PM +0300, Tariq Toukan wrote:
> > From: Talat Batheesh <talatb@...lanox.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@...il.com>
> > Signed-off-by: Talat Batheesh <talatb@...lanox.com>
> > Signed-off-by: Tariq Toukan <tariqt@...lanox.com>
> > ---
> > drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 3 +--
> > drivers/net/ethernet/mellanox/mlx4/qp.c | 14 ++++++++++++++
> > include/linux/mlx4/qp.h | 1 +
> > 3 files changed, 16 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..1eff2fe32a8b 100644
> > --- a/drivers/net/ethernet/mellanox/mlx4/qp.c
> > +++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
> > @@ -384,6 +384,20 @@ 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;
> > +}
> > +EXPORT_SYMBOL_GPL(mlx4_qp_lookup);
>
> Tariq,
>
> Why do you need this export and header fils? You are using this function in one place only.
>
Let's keep it as you proposed for better separation of en vs. core modules.
Reviewed-by: Leon Romanovsky <leonro@...lanox.com>
Thanks
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists