From: Tariq Toukan <tar...@mellanox.com> Date: Tue, 23 May 2017 15:50:07 +0300
> 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) ... > +EXPORT_SYMBOL_GPL(mlx4_qp_lookup); > + This phony separation between MLX4_CORE and MLX4_EN is the only reason you need this unreasonable symbol export. I doubt you'll ever use this function anywhere outside of en_ethtool.c so this export is wasted space in the kernel image. Probably compiler could inline it decently as well. So find another way to do this without the symbol export. I don't really want to hear any stories about "clean separation" or whatever. What's happening here is exactly why this separate modules scheme results in ugly unreasonable code, and unnecessary gymnastics and wasted object space just to make routines available in one place from another.