Message ID | 20230524122121.15012-10-wojciech.drewek@intel.com (mailing list archive) |
---|---|
State | Awaiting Upstream |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | ice: switchdev bridge offload | expand |
On Wed, May 24, 2023 at 02:21:17PM +0200, Wojciech Drewek wrote: > Allow LAG interfaces to be used in bridge offload using > netif_is_lag_master. In this case, search for ice netdev in > the list of LAG's lower devices. Hi Wojciech, As this uses the first lower device found that is an ICE netdev, it is a little unclear to me how this handles the (likely) case of a LAG having more than one lower device, each of which are ICE netdevs belonging to the same eswitch. And the perhaps less likely case where it has more than once lower devices, but they don't all belong to the same ICE eswitch.
> -----Original Message----- > From: Simon Horman <simon.horman@corigine.com> > Sent: niedziela, 4 czerwca 2023 18:07 > To: Drewek, Wojciech <wojciech.drewek@intel.com> > Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; Lobakin, Aleksander <aleksander.lobakin@intel.com>; Ertman, David M > <david.m.ertman@intel.com>; michal.swiatkowski@linux.intel.com; marcin.szycik@linux.intel.com; Chmielewski, Pawel > <pawel.chmielewski@intel.com>; Samudrala, Sridhar <sridhar.samudrala@intel.com>; pmenzel@molgen.mpg.de; > dan.carpenter@linaro.org > Subject: Re: [PATCH iwl-next v4 09/13] ice: Accept LAG netdevs in bridge offloads > > On Wed, May 24, 2023 at 02:21:17PM +0200, Wojciech Drewek wrote: > > Allow LAG interfaces to be used in bridge offload using > > netif_is_lag_master. In this case, search for ice netdev in > > the list of LAG's lower devices. > > Hi Wojciech, > > As this uses the first lower device found that is an ICE netdev, it is a > little unclear to me how this handles the (likely) case of a LAG having > more than one lower device, each of which are ICE netdevs belonging to the > same eswitch. And the perhaps less likely case where it has more than > once lower devices, but they don't all belong to the same ICE eswitch. The only use case here is Active-Backup bond which is send in separate patchset[1]. 6th patch of the series[2] makes sure that that below scenarios will not happen: - non-ice devices - more than 2 devices So the only possible scenario would be 2 PFs of the same nic bonded together. In this patch we want to handle the situation when such bond is added to the bridge. Maybe we should wait with this patch until the LAG series will be accepted? [1] http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=355487&state=* [2] http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20230517230028.321350-7-david.m.ertman@intel.com/
On Mon, Jun 05, 2023 at 05:12:39PM +0000, Drewek, Wojciech wrote: > > > > -----Original Message----- > > From: Simon Horman <simon.horman@corigine.com> > > Sent: niedziela, 4 czerwca 2023 18:07 > > To: Drewek, Wojciech <wojciech.drewek@intel.com> > > Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; Lobakin, Aleksander <aleksander.lobakin@intel.com>; Ertman, David M > > <david.m.ertman@intel.com>; michal.swiatkowski@linux.intel.com; marcin.szycik@linux.intel.com; Chmielewski, Pawel > > <pawel.chmielewski@intel.com>; Samudrala, Sridhar <sridhar.samudrala@intel.com>; pmenzel@molgen.mpg.de; > > dan.carpenter@linaro.org > > Subject: Re: [PATCH iwl-next v4 09/13] ice: Accept LAG netdevs in bridge offloads > > > > On Wed, May 24, 2023 at 02:21:17PM +0200, Wojciech Drewek wrote: > > > Allow LAG interfaces to be used in bridge offload using > > > netif_is_lag_master. In this case, search for ice netdev in > > > the list of LAG's lower devices. > > > > Hi Wojciech, > > > > As this uses the first lower device found that is an ICE netdev, it is a > > little unclear to me how this handles the (likely) case of a LAG having > > more than one lower device, each of which are ICE netdevs belonging to the > > same eswitch. And the perhaps less likely case where it has more than > > once lower devices, but they don't all belong to the same ICE eswitch. > > The only use case here is Active-Backup bond which is send in separate patchset[1]. > 6th patch of the series[2] makes sure that that below scenarios will not happen: > - non-ice devices > - more than 2 devices > So the only possible scenario would be 2 PFs of the same nic bonded together. > In this patch we want to handle the situation when such bond is added to the bridge. Thanks, I think that should cover the bases. Although I haven't reviewed [2] (yet). > Maybe we should wait with this patch until the LAG series will be accepted? Yes, perhaps that is a good idea. > [1] http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=355487&state=* > [2] http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20230517230028.321350-7-david.m.ertman@intel.com/
> -----Original Message----- > From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of > Wojciech Drewek > Sent: Wednesday, May 24, 2023 5:51 PM > To: intel-wired-lan@lists.osuosl.org > Cc: pmenzel@molgen.mpg.de; netdev@vger.kernel.org; > simon.horman@corigine.com; dan.carpenter@linaro.org > Subject: [Intel-wired-lan] [PATCH iwl-next v4 09/13] ice: Accept LAG netdevs > in bridge offloads > > Allow LAG interfaces to be used in bridge offload using netif_is_lag_master. > In this case, search for ice netdev in the list of LAG's lower devices. > > Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com> > --- > v2: braces added in ice_eswitch_br_get_uplnik_from_lag, > use else in ice_eswitch_br_netdev_to_port and > ice_eswitch_br_port_link > --- > .../net/ethernet/intel/ice/ice_eswitch_br.c | 47 +++++++++++++++++-- > 1 file changed, 42 insertions(+), 5 deletions(-) > Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch_br.c b/drivers/net/ethernet/intel/ice/ice_eswitch_br.c index 99cd5ac30f9a..19481decffe4 100644 --- a/drivers/net/ethernet/intel/ice/ice_eswitch_br.c +++ b/drivers/net/ethernet/intel/ice/ice_eswitch_br.c @@ -15,8 +15,23 @@ static const struct rhashtable_params ice_fdb_ht_params = { static bool ice_eswitch_br_is_dev_valid(const struct net_device *dev) { - /* Accept only PF netdev and PRs */ - return ice_is_port_repr_netdev(dev) || netif_is_ice(dev); + /* Accept only PF netdev, PRs and LAG */ + return ice_is_port_repr_netdev(dev) || netif_is_ice(dev) || + netif_is_lag_master(dev); +} + +static struct net_device * +ice_eswitch_br_get_uplnik_from_lag(struct net_device *lag_dev) +{ + struct net_device *lower; + struct list_head *iter; + + netdev_for_each_lower_dev(lag_dev, lower, iter) { + if (netif_is_ice(lower)) + return lower; + } + + return NULL; } static struct ice_esw_br_port * @@ -26,8 +41,19 @@ ice_eswitch_br_netdev_to_port(struct net_device *dev) struct ice_repr *repr = ice_netdev_to_repr(dev); return repr->br_port; - } else if (netif_is_ice(dev)) { - struct ice_pf *pf = ice_netdev_to_pf(dev); + } else if (netif_is_ice(dev) || netif_is_lag_master(dev)) { + struct net_device *ice_dev; + struct ice_pf *pf; + + if (netif_is_lag_master(dev)) + ice_dev = ice_eswitch_br_get_uplnik_from_lag(dev); + else + ice_dev = dev; + + if (!ice_dev) + return NULL; + + pf = ice_netdev_to_pf(ice_dev); return pf->br_port; } @@ -719,7 +745,18 @@ ice_eswitch_br_port_link(struct ice_esw_br_offloads *br_offloads, err = ice_eswitch_br_vf_repr_port_init(bridge, repr); } else { - struct ice_pf *pf = ice_netdev_to_pf(dev); + struct net_device *ice_dev; + struct ice_pf *pf; + + if (netif_is_lag_master(dev)) + ice_dev = ice_eswitch_br_get_uplnik_from_lag(dev); + else + ice_dev = dev; + + if (!ice_dev) + return 0; + + pf = ice_netdev_to_pf(ice_dev); err = ice_eswitch_br_uplink_port_init(bridge, pf); }
Allow LAG interfaces to be used in bridge offload using netif_is_lag_master. In this case, search for ice netdev in the list of LAG's lower devices. Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com> --- v2: braces added in ice_eswitch_br_get_uplnik_from_lag, use else in ice_eswitch_br_netdev_to_port and ice_eswitch_br_port_link --- .../net/ethernet/intel/ice/ice_eswitch_br.c | 47 +++++++++++++++++-- 1 file changed, 42 insertions(+), 5 deletions(-)