* [PATCH iwl-next] ice: Accept LAG netdevs in bridge offloads
@ 2023-06-22 7:09 Wojciech Drewek
2023-06-22 7:51 ` Jiri Pirko
0 siblings, 1 reply; 3+ messages in thread
From: Wojciech Drewek @ 2023-06-22 7:09 UTC (permalink / raw)
To: intel-wired-lan
Cc: netdev, david.m.ertman, michal.swiatkowski, marcin.szycik,
simon.horman
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.
Reviewed-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
---
Note for Tony: This patch needs to go with Dave's LAG
patchset:
https://lore.kernel.org/netdev/20230615162932.762756-1-david.m.ertman@intel.com/
---
.../net/ethernet/intel/ice/ice_eswitch_br.c | 47 +++++++++++++++++--
1 file changed, 42 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch_br.c b/drivers/net/ethernet/intel/ice/ice_eswitch_br.c
index 1e57ce7b22d3..81b69ba9e939 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;
}
@@ -712,7 +738,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);
}
--
2.40.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH iwl-next] ice: Accept LAG netdevs in bridge offloads
2023-06-22 7:09 [PATCH iwl-next] ice: Accept LAG netdevs in bridge offloads Wojciech Drewek
@ 2023-06-22 7:51 ` Jiri Pirko
2023-06-22 8:20 ` Drewek, Wojciech
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Pirko @ 2023-06-22 7:51 UTC (permalink / raw)
To: Wojciech Drewek
Cc: intel-wired-lan, netdev, david.m.ertman, michal.swiatkowski,
marcin.szycik, simon.horman
Thu, Jun 22, 2023 at 09:09:56AM CEST, wojciech.drewek@intel.com 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.
>
>Reviewed-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
>Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
>---
>Note for Tony: This patch needs to go with Dave's LAG
>patchset:
>https://lore.kernel.org/netdev/20230615162932.762756-1-david.m.ertman@intel.com/
>---
> .../net/ethernet/intel/ice/ice_eswitch_br.c | 47 +++++++++++++++++--
> 1 file changed, 42 insertions(+), 5 deletions(-)
>
>diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch_br.c b/drivers/net/ethernet/intel/ice/ice_eswitch_br.c
>index 1e57ce7b22d3..81b69ba9e939 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)
s/uplnik/uplink/
>+{
>+ struct net_device *lower;
>+ struct list_head *iter;
>+
>+ netdev_for_each_lower_dev(lag_dev, lower, iter) {
>+ if (netif_is_ice(lower))
>+ return lower;
What if there are 2 ice Nics in the same lag?
>+ }
>+
>+ 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;
> }
>@@ -712,7 +738,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);
> }
>--
>2.40.1
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH iwl-next] ice: Accept LAG netdevs in bridge offloads
2023-06-22 7:51 ` Jiri Pirko
@ 2023-06-22 8:20 ` Drewek, Wojciech
0 siblings, 0 replies; 3+ messages in thread
From: Drewek, Wojciech @ 2023-06-22 8:20 UTC (permalink / raw)
To: Jiri Pirko
Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
Ertman, David M, michal.swiatkowski@linux.intel.com,
marcin.szycik@linux.intel.com, simon.horman@corigine.com
> -----Original Message-----
> From: Jiri Pirko <jiri@resnulli.us>
> Sent: czwartek, 22 czerwca 2023 09:52
> To: Drewek, Wojciech <wojciech.drewek@intel.com>
> Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; Ertman, David M <david.m.ertman@intel.com>;
> michal.swiatkowski@linux.intel.com; marcin.szycik@linux.intel.com; simon.horman@corigine.com
> Subject: Re: [PATCH iwl-next] ice: Accept LAG netdevs in bridge offloads
>
> Thu, Jun 22, 2023 at 09:09:56AM CEST, wojciech.drewek@intel.com 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.
> >
> >Reviewed-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
> >Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
> >---
> >Note for Tony: This patch needs to go with Dave's LAG
> >patchset:
> >https://lore.kernel.org/netdev/20230615162932.762756-1-david.m.ertman@intel.com/
> >---
> > .../net/ethernet/intel/ice/ice_eswitch_br.c | 47 +++++++++++++++++--
> > 1 file changed, 42 insertions(+), 5 deletions(-)
> >
> >diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch_br.c b/drivers/net/ethernet/intel/ice/ice_eswitch_br.c
> >index 1e57ce7b22d3..81b69ba9e939 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)
>
> s/uplnik/uplink/
Will be fixed
>
>
> >+{
> >+ struct net_device *lower;
> >+ struct list_head *iter;
> >+
> >+ netdev_for_each_lower_dev(lag_dev, lower, iter) {
> >+ if (netif_is_ice(lower))
> >+ return lower;
>
> What if there are 2 ice Nics in the same lag?
Dave's LAG patchset [1] makes sure that interfaces have to all be on the same physical NIC.
[1] https://lore.kernel.org/netdev/20230615162932.762756-1-david.m.ertman@intel.com/
>
>
> >+ }
> >+
> >+ 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;
> > }
> >@@ -712,7 +738,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);
> > }
> >--
> >2.40.1
> >
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-22 8:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-22 7:09 [PATCH iwl-next] ice: Accept LAG netdevs in bridge offloads Wojciech Drewek
2023-06-22 7:51 ` Jiri Pirko
2023-06-22 8:20 ` Drewek, Wojciech
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).