Message ID | 20211019182604.1441387-3-kuba@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Jason Gunthorpe |
Headers | show |
Series | rdma: prepare for const netdev->dev_addr | expand |
On Tue, Oct 19, 2021 at 11:26:03AM -0700, Jakub Kicinski wrote: > Commit 406f42fa0d3c ("net-next: When a bond have a massive amount > of VLANs...") introduced a rbtree for faster Ethernet address look > up. To maintain netdev->dev_addr in this tree we need to make all > the writes to it got through appropriate helpers. > > Signed-off-by: Jakub Kicinski <kuba@kernel.org> > --- > CC: saeedm@nvidia.com > CC: leon@kernel.org > CC: linux-rdma@vger.kernel.org > --- > drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c > index 67571e5040d6..fe76c27835ae 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c > @@ -472,11 +472,13 @@ int mlx5i_dev_init(struct net_device *dev) > { > struct mlx5e_priv *priv = mlx5i_epriv(dev); > struct mlx5i_priv *ipriv = priv->ppriv; > + u8 addr_mod[3]; > > /* Set dev address using underlay QP */ > - dev->dev_addr[1] = (ipriv->qpn >> 16) & 0xff; > - dev->dev_addr[2] = (ipriv->qpn >> 8) & 0xff; > - dev->dev_addr[3] = (ipriv->qpn) & 0xff; > + addr_mod[0] = (ipriv->qpn >> 16) & 0xff; > + addr_mod[1] = (ipriv->qpn >> 8) & 0xff; > + addr_mod[2] = (ipriv->qpn) & 0xff; > + dev_addr_mod(dev, 1, addr_mod, sizeof(addr_mod)); ^^^ It should be 0, no? > > /* Add QPN to net-device mapping to HT */ > mlx5i_pkey_add_qpn(dev, ipriv->qpn); > -- > 2.31.1 >
On Thu, 21 Oct 2021 12:49:53 +0300 Leon Romanovsky wrote: > > - dev->dev_addr[1] = (ipriv->qpn >> 16) & 0xff; ^ the original modifies starting at offset 1 > > - dev->dev_addr[2] = (ipriv->qpn >> 8) & 0xff; > > - dev->dev_addr[3] = (ipriv->qpn) & 0xff; > > + addr_mod[0] = (ipriv->qpn >> 16) & 0xff; > > + addr_mod[1] = (ipriv->qpn >> 8) & 0xff; > > + addr_mod[2] = (ipriv->qpn) & 0xff; > > + dev_addr_mod(dev, 1, addr_mod, sizeof(addr_mod)); > ^^^ It should be 0, no?
On Thu, Oct 21, 2021 at 05:58:23AM -0700, Jakub Kicinski wrote: > On Thu, 21 Oct 2021 12:49:53 +0300 Leon Romanovsky wrote: > > > - dev->dev_addr[1] = (ipriv->qpn >> 16) & 0xff; > > ^ the original modifies starting at offset 1 Ahh, right. > > > > - dev->dev_addr[2] = (ipriv->qpn >> 8) & 0xff; > > > - dev->dev_addr[3] = (ipriv->qpn) & 0xff; > > > + addr_mod[0] = (ipriv->qpn >> 16) & 0xff; > > > + addr_mod[1] = (ipriv->qpn >> 8) & 0xff; > > > + addr_mod[2] = (ipriv->qpn) & 0xff; > > > + dev_addr_mod(dev, 1, addr_mod, sizeof(addr_mod)); > > ^^^ It should be 0, no?
On Tue, Oct 19, 2021 at 11:26:03AM -0700, Jakub Kicinski wrote: > Commit 406f42fa0d3c ("net-next: When a bond have a massive amount > of VLANs...") introduced a rbtree for faster Ethernet address look > up. To maintain netdev->dev_addr in this tree we need to make all > the writes to it got through appropriate helpers. > > Signed-off-by: Jakub Kicinski <kuba@kernel.org> > --- > CC: saeedm@nvidia.com > CC: leon@kernel.org > CC: linux-rdma@vger.kernel.org > --- > drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > Thanks, Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c index 67571e5040d6..fe76c27835ae 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c @@ -472,11 +472,13 @@ int mlx5i_dev_init(struct net_device *dev) { struct mlx5e_priv *priv = mlx5i_epriv(dev); struct mlx5i_priv *ipriv = priv->ppriv; + u8 addr_mod[3]; /* Set dev address using underlay QP */ - dev->dev_addr[1] = (ipriv->qpn >> 16) & 0xff; - dev->dev_addr[2] = (ipriv->qpn >> 8) & 0xff; - dev->dev_addr[3] = (ipriv->qpn) & 0xff; + addr_mod[0] = (ipriv->qpn >> 16) & 0xff; + addr_mod[1] = (ipriv->qpn >> 8) & 0xff; + addr_mod[2] = (ipriv->qpn) & 0xff; + dev_addr_mod(dev, 1, addr_mod, sizeof(addr_mod)); /* Add QPN to net-device mapping to HT */ mlx5i_pkey_add_qpn(dev, ipriv->qpn);
Commit 406f42fa0d3c ("net-next: When a bond have a massive amount of VLANs...") introduced a rbtree for faster Ethernet address look up. To maintain netdev->dev_addr in this tree we need to make all the writes to it got through appropriate helpers. Signed-off-by: Jakub Kicinski <kuba@kernel.org> --- CC: saeedm@nvidia.com CC: leon@kernel.org CC: linux-rdma@vger.kernel.org --- drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)