[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221122155759.426568-1-alexandr.lobakin@intel.com>
Date: Tue, 22 Nov 2022 16:57:59 +0100
From: Alexander Lobakin <alexandr.lobakin@...el.com>
To: Leon Romanovsky <leon@...nel.org>
Cc: Alexander Lobakin <alexandr.lobakin@...el.com>,
Tirthendu Sarkar <tirthendu.sarkar@...el.com>,
tirtha@...il.com, netdev@...r.kernel.org,
intel-wired-lan@...ts.osuosl.org, magnus.karlsson@...el.com
Subject: Re: [PATCH intel-next v4] i40e: allow toggling loopback mode via ndo_set_features callback
From: Leon Romanovsky <leon@...nel.org>
Date: Tue, 22 Nov 2022 13:07:28 +0200
> On Fri, Nov 18, 2022 at 02:33:06PM +0530, Tirthendu Sarkar wrote:
> > Add support for NETIF_F_LOOPBACK. This feature can be set via:
> > $ ethtool -K eth0 loopback <on|off>
> >
> > This sets the MAC Tx->Rx loopback.
> >
> > This feature is used for the xsk selftests, and might have other uses
> > too.
[...]
> > @@ -12960,6 +12983,9 @@ static int i40e_set_features(struct net_device *netdev,
> > if (need_reset)
> > i40e_do_reset(pf, I40E_PF_RESET_FLAG, true);
> >
> > + if ((features ^ netdev->features) & NETIF_F_LOOPBACK)
> > + return i40e_set_loopback(vsi, !!(features & NETIF_F_LOOPBACK));
>
> Don't you need to disable loopback if NETIF_F_LOOPBACK was cleared?
0 ^ 1 == 1 -> call i40e_set_loopback()
!!(0) == 0 -> disable
>
> > +
> > return 0;
> > }
> >
> > @@ -13722,7 +13748,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
> > if (!(pf->flags & I40E_FLAG_MFP_ENABLED))
> > hw_features |= NETIF_F_NTUPLE | NETIF_F_HW_TC;
> >
> > - netdev->hw_features |= hw_features;
> > + netdev->hw_features |= hw_features | NETIF_F_LOOPBACK;
> >
Reviewed-by: Alexander Lobakin <alexandr.lobakin@...el.com>
Thanks,
Olek
Powered by blists - more mailing lists