From: Jiri Pirko <redacted>
This is RFC, unfinished. I came across some issues in the process so I would
like to share those and restart the fib offload discussion in order to make it
really usable.
So the goal of this patchset is to allow driver to propagate all prefixes
configured in kernel down HW. This is necessary for routing to work
as expected. If we don't do that HW might forward prefixes known to kernel
incorrectly. Take an example when default route is set in switch HW and there
is an IP address set on a management (non-switch) port.
Currently, only fibs related to the switch port netdev are offloaded using
switchdev ops. This model is not extendable so the first patch introduces
a replacement: notifier to propagate fib additions and removals to whoever
interested. The second patch makes mlxsw to adopt this new way, registering
one notifier block for each mlxsw (asic) instance.
Using switchdev ops, "abort" is called by switchdev core whenever there is
an error during fib add offload. This leads to removal of all offloaded fibs on
system by fib_trie code.
Now the new notifier assumes the driver takes care of the abort action.
Here's why:
1) The fact that one HW cannot offload fib does not mean that the others can't
do it. So let only one entity to abort and leave the rest to work happily.
2) The driver knows what to in order to properly abort. For example, currently
abort is broken for mlxsw as for Spectrum there is a need to set 0.0.0.0/0
trap in RALUE register.
Issues:
1) RTNH_F_OFFLOAD is originally set in switchdev core. There the assumption is
that only one offload device exists. But for fib notifier, we assume
multiple offload devices. When should the offload flag be set and by who?
I think that it would make sense to have a per-fib reference counter
for this:
0 means RTNH_F_OFFLOAD is not set, no device offloads this entry
n means RTNH_F_OFFLOAD is set and the fib entry is offloaded by n devices
2) Unabort? Would be nice. Currently when add_failure->abort happens,
user's only option is to reboot the machine. I would like to make this
nicer for the fib notifier implementation. Perhaps to provide some button in
devlink which would tell driver to try to offload entries again? Not sure.
3) Policies. Not directly connected to this patchset but this issues
we have been discussing couple of times and I still believe that
the current state is not good.
Software-only forwarding now happens in case of abort and makes the ASIC
ports to act like dummy separate NICs. In case of Spectrum, the bandwidth
of CPU port is something around 4Gbit. For 32x100Gbit ports this is
simply not possible to handle. In case of abort, the system is broken
as it really could not forward packets at a speed not even close
to the expected.
Here the policies come to the picture, allowing the user to set the
system to behave according his expectations. For example rather
fail to add the route than to abort to software forward.
This policy could be per-ASIC, configurable by devlink.
Thoughts please?
Jiri Pirko (2):
fib: introduce fib notification infrastructure
mlxsw: spectrum_router: Use FIB notifications instead of switchdev
calls
drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 8 +-
.../net/ethernet/mellanox/mlxsw/spectrum_router.c | 257 ++++++++++-----------
.../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 9 -
include/net/ip_fib.h | 19 ++
net/ipv4/fib_trie.c | 43 ++++
5 files changed, 181 insertions(+), 155 deletions(-)
--
2.5.5
From: Jiri Pirko <redacted>
This allows to pass information about added/deleted fib entries to
whoever is interested. This is done in a very similar way as devinet
notifies address additions/removals.
Signed-off-by: Jiri Pirko <redacted>
---
include/net/ip_fib.h | 19 +++++++++++++++++++
net/ipv4/fib_trie.c | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
From: Jiri Pirko <redacted>
Until now, in order to offload a FIB entry to HW we use switchdev op.
However that has limits. Mainly in case we need to make the HW aware of
all route prefixes configured in kernel. HW needs to know those in order
to properly trap appropriate packets and pass the to kernel to do
the forwarding.
Signed-off-by: Jiri Pirko <redacted>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 8 +-
.../net/ethernet/mellanox/mlxsw/spectrum_router.c | 257 ++++++++++-----------
.../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 9 -
3 files changed, 119 insertions(+), 155 deletions(-)
@@ -1637,45 +1594,34 @@ static int mlxsw_sp_fib_entry_del(struct mlxsw_sp *mlxsw_sp,MLXSW_REG_RALUE_OP_WRITE_DELETE);}-structmlxsw_sp_router_fib4_add_info{-structswitchdev_trans_itemtritem;-structmlxsw_sp*mlxsw_sp;-structmlxsw_sp_fib_entry*fib_entry;-};--staticvoidmlxsw_sp_router_fib4_add_info_destroy(voidconst*data)-{-conststructmlxsw_sp_router_fib4_add_info*info=data;-structmlxsw_sp_fib_entry*fib_entry=info->fib_entry;-structmlxsw_sp*mlxsw_sp=info->mlxsw_sp;-structmlxsw_sp_vr*vr=fib_entry->vr;--mlxsw_sp_fib_entry_destroy(fib_entry);-mlxsw_sp_vr_put(mlxsw_sp,vr);-kfree(info);-}-staticintmlxsw_sp_router_fib4_entry_init(structmlxsw_sp*mlxsw_sp,-conststructswitchdev_obj_ipv4_fib*fib4,+conststructfib_notifier_info*fn_info,structmlxsw_sp_fib_entry*fib_entry){-structfib_info*fi=fib4->fi;+structfib_info*fi=fn_info->fi;-if(fib4->type==RTN_LOCAL||fib4->type==RTN_BROADCAST){+if(fn_info->type==RTN_LOCAL||fn_info->type==RTN_BROADCAST){fib_entry->type=MLXSW_SP_FIB_ENTRY_TYPE_TRAP;return0;}-if(fib4->type!=RTN_UNICAST)+if(fn_info->type!=RTN_UNICAST)return-EINVAL;if(fi->fib_scope!=RT_SCOPE_UNIVERSE){structmlxsw_sp_rif*r;-fib_entry->type=MLXSW_SP_FIB_ENTRY_TYPE_LOCAL;r=mlxsw_sp_rif_find_by_dev(mlxsw_sp,fi->fib_dev);-if(!r)-return-EINVAL;+if(!r){+/* In case router interface is not found, that means+*thefibentrywasaddedtosomedeviceunrelated+*tous.Settrapandpassthepacketsfor+*thisprefixtokernel.+*/+fib_entry->type=MLXSW_SP_FIB_ENTRY_TYPE_TRAP;+return0;+}+fib_entry->type=MLXSW_SP_FIB_ENTRY_TYPE_LOCAL;fib_entry->rif=r->rif;return0;}
@@ -1694,29 +1640,29 @@ mlxsw_sp_router_fib4_entry_fini(struct mlxsw_sp *mlxsw_sp,staticstructmlxsw_sp_fib_entry*mlxsw_sp_fib_entry_get(structmlxsw_sp*mlxsw_sp,-conststructswitchdev_obj_ipv4_fib*fib4)+conststructfib_notifier_info*fn_info){structmlxsw_sp_fib_entry*fib_entry;-structfib_info*fi=fib4->fi;+structfib_info*fi=fn_info->fi;structmlxsw_sp_vr*vr;interr;-vr=mlxsw_sp_vr_get(mlxsw_sp,fib4->dst_len,fib4->tb_id,+vr=mlxsw_sp_vr_get(mlxsw_sp,fn_info->dst_len,fn_info->tb_id,MLXSW_SP_L3_PROTO_IPV4);if(IS_ERR(vr))returnERR_CAST(vr);-fib_entry=mlxsw_sp_fib_entry_lookup(vr->fib,&fib4->dst,-sizeof(fib4->dst),-fib4->dst_len,fi->fib_dev);+fib_entry=mlxsw_sp_fib_entry_lookup(vr->fib,&fn_info->dst,+sizeof(fn_info->dst),+fn_info->dst_len,fi->fib_dev);if(fib_entry){/* Already exists, just take a reference */fib_entry->ref_count++;returnfib_entry;}-fib_entry=mlxsw_sp_fib_entry_create(vr->fib,&fib4->dst,-sizeof(fib4->dst),-fib4->dst_len,fi->fib_dev);+fib_entry=mlxsw_sp_fib_entry_create(vr->fib,&fn_info->dst,+sizeof(fn_info->dst),+fn_info->dst_len,fi->fib_dev);if(!fib_entry){err=-ENOMEM;gotoerr_fib_entry_create;
@@ -1765,60 +1711,29 @@ void mlxsw_sp_fib_entry_put(struct mlxsw_sp *mlxsw_sp,mlxsw_sp_vr_put(mlxsw_sp,vr);}-staticint-mlxsw_sp_router_fib4_add_prepare(structmlxsw_sp_port*mlxsw_sp_port,-conststructswitchdev_obj_ipv4_fib*fib4,-structswitchdev_trans*trans)+staticintmlxsw_sp_router_fib4_add(structmlxsw_sp*mlxsw_sp,+structfib_notifier_info*fn_info){-structmlxsw_sp*mlxsw_sp=mlxsw_sp_port->mlxsw_sp;-structmlxsw_sp_router_fib4_add_info*info;structmlxsw_sp_fib_entry*fib_entry;+structmlxsw_sp_vr*vr;interr;-fib_entry=mlxsw_sp_fib_entry_get(mlxsw_sp,fib4);-if(IS_ERR(fib_entry))+fib_entry=mlxsw_sp_fib_entry_get(mlxsw_sp,fn_info);+if(IS_ERR(fib_entry)){+dev_warn(mlxsw_sp->bus_info->dev,"Failed to get FIB4 entry being added.\n");returnPTR_ERR(fib_entry);--info=kmalloc(sizeof(*info),GFP_KERNEL);-if(!info){-err=-ENOMEM;-gotoerr_alloc_info;}-info->mlxsw_sp=mlxsw_sp;-info->fib_entry=fib_entry;-switchdev_trans_item_enqueue(trans,info,-mlxsw_sp_router_fib4_add_info_destroy,-&info->tritem);-return0;--err_alloc_info:-mlxsw_sp_fib_entry_put(mlxsw_sp,fib_entry);-returnerr;-}--staticint-mlxsw_sp_router_fib4_add_commit(structmlxsw_sp_port*mlxsw_sp_port,-conststructswitchdev_obj_ipv4_fib*fib4,-structswitchdev_trans*trans)-{-structmlxsw_sp*mlxsw_sp=mlxsw_sp_port->mlxsw_sp;-structmlxsw_sp_router_fib4_add_info*info;-structmlxsw_sp_fib_entry*fib_entry;-structmlxsw_sp_vr*vr;-interr;--info=switchdev_trans_item_dequeue(trans);-fib_entry=info->fib_entry;-kfree(info);if(fib_entry->ref_count!=1)return0;vr=fib_entry->vr;err=mlxsw_sp_fib_entry_insert(vr->fib,fib_entry);-if(err)+if(err){+dev_warn(mlxsw_sp->bus_info->dev,"Failed to insert FIB4 entry being added.\n");gotoerr_fib_entry_insert;-err=mlxsw_sp_fib_entry_update(mlxsw_sp_port->mlxsw_sp,fib_entry);+}+err=mlxsw_sp_fib_entry_update(mlxsw_sp,fib_entry);if(err)gotoerr_fib_entry_add;return0;
@@ -1830,24 +1745,12 @@ err_fib_entry_insert:returnerr;}-intmlxsw_sp_router_fib4_add(structmlxsw_sp_port*mlxsw_sp_port,-conststructswitchdev_obj_ipv4_fib*fib4,-structswitchdev_trans*trans)+staticintmlxsw_sp_router_fib4_del(structmlxsw_sp*mlxsw_sp,+structfib_notifier_info*fn_info){-if(switchdev_trans_ph_prepare(trans))-returnmlxsw_sp_router_fib4_add_prepare(mlxsw_sp_port,-fib4,trans);-returnmlxsw_sp_router_fib4_add_commit(mlxsw_sp_port,-fib4,trans);-}--intmlxsw_sp_router_fib4_del(structmlxsw_sp_port*mlxsw_sp_port,-conststructswitchdev_obj_ipv4_fib*fib4)-{-structmlxsw_sp*mlxsw_sp=mlxsw_sp_port->mlxsw_sp;structmlxsw_sp_fib_entry*fib_entry;-fib_entry=mlxsw_sp_fib_entry_find(mlxsw_sp,fib4);+fib_entry=mlxsw_sp_fib_entry_find(mlxsw_sp,fn_info);if(!fib_entry){dev_warn(mlxsw_sp->bus_info->dev,"Failed to find FIB4 entry being removed.\n");return-ENOENT;
@@ -1861,3 +1764,77 @@ int mlxsw_sp_router_fib4_del(struct mlxsw_sp_port *mlxsw_sp_port,mlxsw_sp_fib_entry_put(mlxsw_sp,fib_entry);return0;}++staticvoidmlxsw_sp_router_fib4_abort(structmlxsw_sp*mlxsw_sp)+{+/* TODO: remove all ralue entries from the asic and set trap+*topasseverythingtokernel+*/+}++staticint__mlxsw_sp_router_init(structmlxsw_sp*mlxsw_sp)+{+charrgcr_pl[MLXSW_REG_RGCR_LEN];++mlxsw_reg_rgcr_pack(rgcr_pl,true);+mlxsw_reg_rgcr_max_router_interfaces_set(rgcr_pl,MLXSW_SP_RIF_MAX);+returnmlxsw_reg_write(mlxsw_sp->core,MLXSW_REG(rgcr),rgcr_pl);+}++staticvoid__mlxsw_sp_router_fini(structmlxsw_sp*mlxsw_sp)+{+charrgcr_pl[MLXSW_REG_RGCR_LEN];++mlxsw_reg_rgcr_pack(rgcr_pl,false);+mlxsw_reg_write(mlxsw_sp->core,MLXSW_REG(rgcr),rgcr_pl);+}++staticintmlxsw_sp_router_fib_event(structnotifier_block*nb,+unsignedlongevent,void*ptr)+{+structmlxsw_sp*mlxsw_sp=container_of(nb,structmlxsw_sp,fib_nb);+structfib_notifier_info*fn_info=ptr;+interr;++switch(event){+caseFIB_EVENT_TYPE_ADD:+err=mlxsw_sp_router_fib4_add(mlxsw_sp,fn_info);+if(err)+mlxsw_sp_router_fib4_abort(mlxsw_sp);+break;+caseFIB_EVENT_TYPE_DEL:+mlxsw_sp_router_fib4_del(mlxsw_sp,fn_info);+break;+}+returnNOTIFY_DONE;+}++intmlxsw_sp_router_init(structmlxsw_sp*mlxsw_sp)+{+interr;++INIT_LIST_HEAD(&mlxsw_sp->router.nexthop_neighs_list);+INIT_LIST_HEAD(&mlxsw_sp->router.nexthop_group_list);+err=__mlxsw_sp_router_init(mlxsw_sp);+if(err)+returnerr;+mlxsw_sp_lpm_init(mlxsw_sp);+mlxsw_sp_vrs_init(mlxsw_sp);+err=mlxsw_sp_neigh_init(mlxsw_sp);+if(err)+gotoerr_neigh_init;+mlxsw_sp->fib_nb.notifier_call=mlxsw_sp_router_fib_event;+register_fib_notifier(&mlxsw_sp->fib_nb);+return0;++err_neigh_init:+__mlxsw_sp_router_fini(mlxsw_sp);+returnerr;+}++voidmlxsw_sp_router_fini(structmlxsw_sp*mlxsw_sp)+{+unregister_fib_notifier(&mlxsw_sp->fib_nb);+mlxsw_sp_neigh_fini(mlxsw_sp);+__mlxsw_sp_router_fini(mlxsw_sp);+}
From: David Ahern <hidden> Date: 2016-09-06 14:32:20
On 9/6/16 6:01 AM, Jiri Pirko wrote:
From: Jiri Pirko <redacted>
This allows to pass information about added/deleted fib entries to
whoever is interested. This is done in a very similar way as devinet
notifies address additions/removals.
Signed-off-by: Jiri Pirko <redacted>
---
include/net/ip_fib.h | 19 +++++++++++++++++++
net/ipv4/fib_trie.c | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
The notifier infrastructure should be generalized for use with IPv4 and IPv6. While the data will be family based, the infra can be generic.
Tue, Sep 06, 2016 at 04:32:12PM CEST, dsa@cumulusnetworks.com wrote:
On 9/6/16 6:01 AM, Jiri Pirko wrote:
quoted
From: Jiri Pirko <redacted>
This allows to pass information about added/deleted fib entries to
whoever is interested. This is done in a very similar way as devinet
notifies address additions/removals.
Signed-off-by: Jiri Pirko <redacted>
---
include/net/ip_fib.h | 19 +++++++++++++++++++
net/ipv4/fib_trie.c | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
The notifier infrastructure should be generalized for use with IPv4 and IPv6. While the data will be family based, the infra can be generic.
Yeah, that I thought about as well. Thing is, ipv6 notifier has to be
atomic. That is the reason we have:
inetaddr_chain and register_inetaddr_notifier (blocking notifier)
inet6addr_chain and register_inet6addr_notifier (atomic notifier)
From: David Ahern <hidden> Date: 2016-09-06 15:11:14
On 9/6/16 8:44 AM, Jiri Pirko wrote:
Tue, Sep 06, 2016 at 04:32:12PM CEST, dsa@cumulusnetworks.com wrote:
quoted
On 9/6/16 6:01 AM, Jiri Pirko wrote:
quoted
From: Jiri Pirko <redacted>
This allows to pass information about added/deleted fib entries to
whoever is interested. This is done in a very similar way as devinet
notifies address additions/removals.
Signed-off-by: Jiri Pirko <redacted>
---
include/net/ip_fib.h | 19 +++++++++++++++++++
net/ipv4/fib_trie.c | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
The notifier infrastructure should be generalized for use with IPv4 and IPv6. While the data will be family based, the infra can be generic.
Yeah, that I thought about as well. Thing is, ipv6 notifier has to be
atomic. That is the reason we have:
inetaddr_chain and register_inetaddr_notifier (blocking notifier)
inet6addr_chain and register_inet6addr_notifier (atomic notifier)
Why is IPv6 atomic? Looking at code paths for adding addresses seems like all of the locks are dropped before the notifier is called and adding and deleting ipv6 addresses does not show a hit with this WARN_ON:
From: David Ahern <hidden> Date: 2016-09-06 15:13:38
On 9/6/16 6:01 AM, Jiri Pirko wrote:
From: Jiri Pirko <redacted>
This allows to pass information about added/deleted fib entries to
whoever is interested. This is done in a very similar way as devinet
notifies address additions/removals.
Signed-off-by: Jiri Pirko <redacted>
---
include/net/ip_fib.h | 19 +++++++++++++++++++
net/ipv4/fib_trie.c | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
Do you intend for this set of notifiers to work with policy routing (FIB rules) as well?
Tue, Sep 06, 2016 at 05:11:11PM CEST, dsa@cumulusnetworks.com wrote:
On 9/6/16 8:44 AM, Jiri Pirko wrote:
quoted
Tue, Sep 06, 2016 at 04:32:12PM CEST, dsa@cumulusnetworks.com wrote:
quoted
On 9/6/16 6:01 AM, Jiri Pirko wrote:
quoted
From: Jiri Pirko <redacted>
This allows to pass information about added/deleted fib entries to
whoever is interested. This is done in a very similar way as devinet
notifies address additions/removals.
Signed-off-by: Jiri Pirko <redacted>
---
include/net/ip_fib.h | 19 +++++++++++++++++++
net/ipv4/fib_trie.c | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
The notifier infrastructure should be generalized for use with IPv4 and IPv6. While the data will be family based, the infra can be generic.
Yeah, that I thought about as well. Thing is, ipv6 notifier has to be
atomic. That is the reason we have:
inetaddr_chain and register_inetaddr_notifier (blocking notifier)
inet6addr_chain and register_inet6addr_notifier (atomic notifier)
Why is IPv6 atomic? Looking at code paths for adding addresses seems like all of the locks are dropped before the notifier is called and adding and deleting ipv6 addresses does not show a hit with this WARN_ON:
Maybe historic reasons. Would be good to unite the notifiers then. I'll
look at it.
From: Hannes Frederic Sowa <hidden> Date: 2016-09-06 16:14:44
On Tue, Sep 6, 2016, at 17:49, Jiri Pirko wrote:
Tue, Sep 06, 2016 at 05:11:11PM CEST, dsa@cumulusnetworks.com wrote:
quoted
On 9/6/16 8:44 AM, Jiri Pirko wrote:
quoted
Tue, Sep 06, 2016 at 04:32:12PM CEST, dsa@cumulusnetworks.com wrote:
quoted
On 9/6/16 6:01 AM, Jiri Pirko wrote:
quoted
From: Jiri Pirko <redacted>
This allows to pass information about added/deleted fib entries to
whoever is interested. This is done in a very similar way as devinet
notifies address additions/removals.
Signed-off-by: Jiri Pirko <redacted>
---
include/net/ip_fib.h | 19 +++++++++++++++++++
net/ipv4/fib_trie.c | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
The notifier infrastructure should be generalized for use with IPv4 and IPv6. While the data will be family based, the infra can be generic.
Yeah, that I thought about as well. Thing is, ipv6 notifier has to be
atomic. That is the reason we have:
inetaddr_chain and register_inetaddr_notifier (blocking notifier)
inet6addr_chain and register_inet6addr_notifier (atomic notifier)
Why is IPv6 atomic? Looking at code paths for adding addresses seems like all of the locks are dropped before the notifier is called and adding and deleting ipv6 addresses does not show a hit with this WARN_ON:
Maybe historic reasons. Would be good to unite the notifiers then. I'll
look at it.
We add IPs and routes from bottom half layer because of neighbour
discovery router advertisements. They need to run in atomic context
without sleeping.
Bye,
Hannes
Tue, Sep 06, 2016 at 05:13:36PM CEST, dsa@cumulusnetworks.com wrote:
On 9/6/16 6:01 AM, Jiri Pirko wrote:
quoted
From: Jiri Pirko <redacted>
This allows to pass information about added/deleted fib entries to
whoever is interested. This is done in a very similar way as devinet
notifies address additions/removals.
Signed-off-by: Jiri Pirko <redacted>
---
include/net/ip_fib.h | 19 +++++++++++++++++++
net/ipv4/fib_trie.c | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
Do you intend for this set of notifiers to work with policy routing (FIB rules) as well?
Yes, plan is to put the notifier calls before notify_rule_change. Would
probably make sense to have this in one notifier, only several event
types. Not sure.
From: Andy Gospodarek <andy@greyhouse.net> Date: 2016-09-15 14:41:41
On Tue, Sep 6, 2016 at 8:01 AM, Jiri Pirko
[off-list ref] wrote:
From: Jiri Pirko <redacted>
This allows to pass information about added/deleted fib entries to
whoever is interested. This is done in a very similar way as devinet
notifies address additions/removals.
(Sorry for the delayed response here...)
I had tried a slightly different approach, but this one also seems
reasonable and possibly better -- especially if this can be made more
generic and shared between ipv4 and ipv6 despite their inherent
differences.
What I did differently was make a more ipv4-specific change to start
with that did this:
+#define RTNH_F_MODIFIED (1 << 7) /* used for
internal kernel tracking */
+
+#define RTNH_F_COMPARE_MASK (RTNH_F_DEAD | \
+ RTNH_F_LINKDOWN | \
+ RTNH_F_MODIFIED) /* used as mask for
route comparisons */
Then in various cases where the route was modified (fib_sync_up, etc),
I added this:
+ nexthop_nh->nh_flags |= RTNH_F_MODIFIED;
Checking for the modified flag was then done in fib_table_update().
This new function was a rewrite of fib_table_flush() and checks for
RTNH_F_MODIFIED were done there before calling switchdev infra and
then announce new routes if routes changed.
The main issue I see right now is that neither userspace nor switchdev
are notified when a route flag changes. This needs to be resolved.
I think this RFC is along the proper path to provide notification, but
I'm not sure that notification will happen when flags change (most
notably the LNKDOWN flag) and there are some other corner cases that
could probably be covered as well.
I need to forward-port my patch from where it was to the latest
net-next and see if these cases I was concerned about were still an
issue. I'm happy to do that and see if we can put this all together
to fix a few of the outstanding issues.
Thu, Sep 15, 2016 at 04:41:20PM CEST, andy@greyhouse.net wrote:
On Tue, Sep 6, 2016 at 8:01 AM, Jiri Pirko
[off-list ref] wrote:
quoted
From: Jiri Pirko <redacted>
This allows to pass information about added/deleted fib entries to
whoever is interested. This is done in a very similar way as devinet
notifies address additions/removals.
(Sorry for the delayed response here...)
I had tried a slightly different approach, but this one also seems
reasonable and possibly better -- especially if this can be made more
generic and shared between ipv4 and ipv6 despite their inherent
differences.
What I did differently was make a more ipv4-specific change to start
with that did this:
+#define RTNH_F_MODIFIED (1 << 7) /* used for
internal kernel tracking */
+
+#define RTNH_F_COMPARE_MASK (RTNH_F_DEAD | \
+ RTNH_F_LINKDOWN | \
+ RTNH_F_MODIFIED) /* used as mask for
route comparisons */
Then in various cases where the route was modified (fib_sync_up, etc),
I added this:
+ nexthop_nh->nh_flags |= RTNH_F_MODIFIED;
Checking for the modified flag was then done in fib_table_update().
This new function was a rewrite of fib_table_flush() and checks for
RTNH_F_MODIFIED were done there before calling switchdev infra and
then announce new routes if routes changed.
The main issue I see right now is that neither userspace nor switchdev
are notified when a route flag changes. This needs to be resolved.
I think this RFC is along the proper path to provide notification, but
I'm not sure that notification will happen when flags change (most
notably the LNKDOWN flag) and there are some other corner cases that
could probably be covered as well.
I need to forward-port my patch from where it was to the latest
net-next and see if these cases I was concerned about were still an
issue. I'm happy to do that and see if we can put this all together
to fix a few of the outstanding issues.
I believe that "modify" can be easily another fib event. Drivers can
react accordingly. I'm close to sending v1 (hopefully tomorrow). I
believe you can base your patchset on top of mine which saves you lot of
time.
From: Andy Gospodarek <andy@greyhouse.net> Date: 2016-09-15 14:48:02
On Thu, Sep 15, 2016 at 10:45 AM, Jiri Pirko [off-list ref] wrote:
Thu, Sep 15, 2016 at 04:41:20PM CEST, andy@greyhouse.net wrote:
quoted
On Tue, Sep 6, 2016 at 8:01 AM, Jiri Pirko
[off-list ref] wrote:
quoted
From: Jiri Pirko <redacted>
This allows to pass information about added/deleted fib entries to
whoever is interested. This is done in a very similar way as devinet
notifies address additions/removals.
(Sorry for the delayed response here...)
I had tried a slightly different approach, but this one also seems
reasonable and possibly better -- especially if this can be made more
generic and shared between ipv4 and ipv6 despite their inherent
differences.
What I did differently was make a more ipv4-specific change to start
with that did this:
+#define RTNH_F_MODIFIED (1 << 7) /* used for
internal kernel tracking */
+
+#define RTNH_F_COMPARE_MASK (RTNH_F_DEAD | \
+ RTNH_F_LINKDOWN | \
+ RTNH_F_MODIFIED) /* used as mask for
route comparisons */
Then in various cases where the route was modified (fib_sync_up, etc),
I added this:
+ nexthop_nh->nh_flags |= RTNH_F_MODIFIED;
Checking for the modified flag was then done in fib_table_update().
This new function was a rewrite of fib_table_flush() and checks for
RTNH_F_MODIFIED were done there before calling switchdev infra and
then announce new routes if routes changed.
The main issue I see right now is that neither userspace nor switchdev
are notified when a route flag changes. This needs to be resolved.
I think this RFC is along the proper path to provide notification, but
I'm not sure that notification will happen when flags change (most
notably the LNKDOWN flag) and there are some other corner cases that
could probably be covered as well.
I need to forward-port my patch from where it was to the latest
net-next and see if these cases I was concerned about were still an
issue. I'm happy to do that and see if we can put this all together
to fix a few of the outstanding issues.
I believe that "modify" can be easily another fib event. Drivers can
react accordingly. I'm close to sending v1 (hopefully tomorrow). I
believe you can base your patchset on top of mine which saves you lot of
time.
Sounds good -- looking forward to it. If you add this email on the
cc-list rather than the other one, I'll see it more quickly this time.
:-)
From: Jiri Pirko <redacted>
This is RFC, unfinished. I came across some issues in the process so I would
like to share those and restart the fib offload discussion in order to make it
really usable.
So the goal of this patchset is to allow driver to propagate all prefixes
configured in kernel down HW. This is necessary for routing to work
as expected. If we don't do that HW might forward prefixes known to kernel
incorrectly. Take an example when default route is set in switch HW and there
is an IP address set on a management (non-switch) port.
Currently, only fibs related to the switch port netdev are offloaded using
switchdev ops. This model is not extendable so the first patch introduces
a replacement: notifier to propagate fib additions and removals to whoever
interested. The second patch makes mlxsw to adopt this new way, registering
one notifier block for each mlxsw (asic) instance.
Instead of introducing another specialization of a notifier_block
implementation, could we somehow have a kernel-based netlink listener
which receives the same kind of event information from rtmsg_fib()?
The reason is that having such a facility would hook directly onto
existing rtmsg_* calls that exist throughout the stack, and that seems
to scale better.
--
Florian
From: Jiri Pirko <redacted>
This is RFC, unfinished. I came across some issues in the process so I would
like to share those and restart the fib offload discussion in order to make it
really usable.
So the goal of this patchset is to allow driver to propagate all prefixes
configured in kernel down HW. This is necessary for routing to work
as expected. If we don't do that HW might forward prefixes known to kernel
incorrectly. Take an example when default route is set in switch HW and there
is an IP address set on a management (non-switch) port.
Currently, only fibs related to the switch port netdev are offloaded using
switchdev ops. This model is not extendable so the first patch introduces
a replacement: notifier to propagate fib additions and removals to whoever
interested. The second patch makes mlxsw to adopt this new way, registering
one notifier block for each mlxsw (asic) instance.
Instead of introducing another specialization of a notifier_block
implementation, could we somehow have a kernel-based netlink listener
which receives the same kind of event information from rtmsg_fib()?
The reason is that having such a facility would hook directly onto
existing rtmsg_* calls that exist throughout the stack, and that seems
to scale better.
I was thinking along the same lines. Instead of proliferating notifier blocks
through-out the stack for switchdev offload, putting existing events to use would be nice.
But the problem though is drivers having to parse the netlink msg again. also, the intent
here is to do the offload first ..before the route is added to the kernel (though i don't see that in
the current series). existing netlink rmsg_fib events are generated after the route is added to the kernel.
Jiri, instead of the notifier, do you see a problem with always calling the existing switchdev
offload api for every route for every asic instance ?. the first device where the route fits wins.
it seems similar to driver registering for notifier and looking at every route ...
am i missing something ?
and the policies you mention could help around selecting the asic instance (FCFS or mirror).
you will need to abstract out the asic instance for switchdev api to call on, but I thought you
already have that in some form in your devlink infrastructure.
From: Jiri Pirko <redacted>
This allows to pass information about added/deleted fib entries to
whoever is interested. This is done in a very similar way as devinet
notifies address additions/removals.
Signed-off-by: Jiri Pirko <redacted>
---
include/net/ip_fib.h | 19 +++++++++++++++++++
net/ipv4/fib_trie.c | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
It appears that this is in addition to the existing switchdev_fib_ipv4_add call right above this.
Is the intent to do both ?. i don't see a need to do both.
and switchdev_fib_ipv4_add offloads before the route is added to the kernel.
But the notifier seems to fire after the route is added to the kernel.
Mon, Sep 19, 2016 at 01:23:47AM CEST, roopa@cumulusnetworks.com wrote:
On 9/6/16, 5:01 AM, Jiri Pirko wrote:
quoted
From: Jiri Pirko <redacted>
This allows to pass information about added/deleted fib entries to
whoever is interested. This is done in a very similar way as devinet
notifies address additions/removals.
Signed-off-by: Jiri Pirko <redacted>
---
include/net/ip_fib.h | 19 +++++++++++++++++++
net/ipv4/fib_trie.c | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
It appears that this is in addition to the existing switchdev_fib_ipv4_add call right above this.
Is the intent to do both ?. i don't see a need to do both.
I already have patchset improved that it removes the switchdev fib code.
Have to do some more testing, will send it soon.
and switchdev_fib_ipv4_add offloads before the route is added to the kernel.
But the notifier seems to fire after the route is added to the kernel.
Yeah, I wanted to align it with rtmsg_fib calls. Also I think it makes
sense to have slowpath ready before offload.
Sun, Sep 18, 2016 at 10:00:44PM CEST, f.fainelli@gmail.com wrote:
Le 06/09/2016 à 05:01, Jiri Pirko a écrit :
quoted
From: Jiri Pirko <redacted>
This is RFC, unfinished. I came across some issues in the process so I would
like to share those and restart the fib offload discussion in order to make it
really usable.
So the goal of this patchset is to allow driver to propagate all prefixes
configured in kernel down HW. This is necessary for routing to work
as expected. If we don't do that HW might forward prefixes known to kernel
incorrectly. Take an example when default route is set in switch HW and there
is an IP address set on a management (non-switch) port.
Currently, only fibs related to the switch port netdev are offloaded using
switchdev ops. This model is not extendable so the first patch introduces
a replacement: notifier to propagate fib additions and removals to whoever
interested. The second patch makes mlxsw to adopt this new way, registering
one notifier block for each mlxsw (asic) instance.
Instead of introducing another specialization of a notifier_block
implementation, could we somehow have a kernel-based netlink listener
which receives the same kind of event information from rtmsg_fib()?
rtmsg_fib destination is userspace. The message format is netlink. I
don't think it is wise to pass netlink messages inside kernel when we
can pass nice structures. Lower overhead. This is how it is done in the
rest of kernel. Not sure how your comment is related specifically to
this patch.
The reason is that having such a facility would hook directly onto
existing rtmsg_* calls that exist throughout the stack, and that seems
to scale better.
--
Florian
Mon, Sep 19, 2016 at 01:16:17AM CEST, roopa@cumulusnetworks.com wrote:
On 9/18/16, 1:00 PM, Florian Fainelli wrote:
quoted
Le 06/09/2016 à 05:01, Jiri Pirko a écrit :
quoted
From: Jiri Pirko <redacted>
This is RFC, unfinished. I came across some issues in the process so I would
like to share those and restart the fib offload discussion in order to make it
really usable.
So the goal of this patchset is to allow driver to propagate all prefixes
configured in kernel down HW. This is necessary for routing to work
as expected. If we don't do that HW might forward prefixes known to kernel
incorrectly. Take an example when default route is set in switch HW and there
is an IP address set on a management (non-switch) port.
Currently, only fibs related to the switch port netdev are offloaded using
switchdev ops. This model is not extendable so the first patch introduces
a replacement: notifier to propagate fib additions and removals to whoever
interested. The second patch makes mlxsw to adopt this new way, registering
one notifier block for each mlxsw (asic) instance.
Instead of introducing another specialization of a notifier_block
implementation, could we somehow have a kernel-based netlink listener
which receives the same kind of event information from rtmsg_fib()?
The reason is that having such a facility would hook directly onto
existing rtmsg_* calls that exist throughout the stack, and that seems
to scale better.
I was thinking along the same lines. Instead of proliferating notifier blocks
through-out the stack for switchdev offload, putting existing events to use would be nice.
But the problem though is drivers having to parse the netlink msg again. also, the intent
here is to do the offload first ..before the route is added to the kernel (though i don't see that in
the current series). existing netlink rmsg_fib events are generated after the route is added to the kernel.
Jiri, instead of the notifier, do you see a problem with always calling the existing switchdev
offload api for every route for every asic instance ?. the first device where the route fits wins.
There is not list of asic instances. Therefore the notifier fits much better here.
it seems similar to driver registering for notifier and looking at every route ...
am i missing something ?
and the policies you mention could help around selecting the asic instance (FCFS or mirror).
you will need to abstract out the asic instance for switchdev api to call on, but I thought you
already have that in some form in your devlink infrastructure.
switchdev asic instances and devlink instances are orthogonal.
Mon, Sep 19, 2016 at 01:23:47AM CEST, roopa@cumulusnetworks.com wrote:
quoted
On 9/6/16, 5:01 AM, Jiri Pirko wrote:
quoted
From: Jiri Pirko <redacted>
This allows to pass information about added/deleted fib entries to
whoever is interested. This is done in a very similar way as devinet
notifies address additions/removals.
Signed-off-by: Jiri Pirko <redacted>
---
It appears that this is in addition to the existing switchdev_fib_ipv4_add call right above this.
Is the intent to do both ?. i don't see a need to do both.
I already have patchset improved that it removes the switchdev fib code.
Have to do some more testing, will send it soon.
ok, ack.
quoted
and switchdev_fib_ipv4_add offloads before the route is added to the kernel.
But the notifier seems to fire after the route is added to the kernel.
Yeah, I wanted to align it with rtmsg_fib calls. Also I think it makes
sense to have slowpath ready before offload.
ok, ..but..that changes existing behavior though. and if the hw route add fails...,
you may have inconsistent state between hw and sw.
Mon, Sep 19, 2016 at 01:16:17AM CEST, roopa@cumulusnetworks.com wrote:
quoted
On 9/18/16, 1:00 PM, Florian Fainelli wrote:
quoted
Le 06/09/2016 à 05:01, Jiri Pirko a écrit :
quoted
From: Jiri Pirko <redacted>
This is RFC, unfinished. I came across some issues in the process so I would
like to share those and restart the fib offload discussion in order to make it
really usable.
So the goal of this patchset is to allow driver to propagate all prefixes
configured in kernel down HW. This is necessary for routing to work
as expected. If we don't do that HW might forward prefixes known to kernel
incorrectly. Take an example when default route is set in switch HW and there
is an IP address set on a management (non-switch) port.
Currently, only fibs related to the switch port netdev are offloaded using
switchdev ops. This model is not extendable so the first patch introduces
a replacement: notifier to propagate fib additions and removals to whoever
interested. The second patch makes mlxsw to adopt this new way, registering
one notifier block for each mlxsw (asic) instance.
Instead of introducing another specialization of a notifier_block
implementation, could we somehow have a kernel-based netlink listener
which receives the same kind of event information from rtmsg_fib()?
The reason is that having such a facility would hook directly onto
existing rtmsg_* calls that exist throughout the stack, and that seems
to scale better.
I was thinking along the same lines. Instead of proliferating notifier blocks
through-out the stack for switchdev offload, putting existing events to use would be nice.
But the problem though is drivers having to parse the netlink msg again. also, the intent
here is to do the offload first ..before the route is added to the kernel (though i don't see that in
the current series). existing netlink rmsg_fib events are generated after the route is added to the kernel.
Jiri, instead of the notifier, do you see a problem with always calling the existing switchdev
offload api for every route for every asic instance ?. the first device where the route fits wins.
There is not list of asic instances. Therefore the notifier fits much better here.
quoted
it seems similar to driver registering for notifier and looking at every route ...
am i missing something ?
and the policies you mention could help around selecting the asic instance (FCFS or mirror).
you will need to abstract out the asic instance for switchdev api to call on, but I thought you
already have that in some form in your devlink infrastructure.
switchdev asic instances and devlink instances are orthogonal.
maybe it is not today...but the requirement for devlink was to provide a way to communicate
to the switch driver
- global switch attributes or
- things that cannot go via switch ports (exactly the problem you are trying to solve for routes here)
so, maybe an instance of switch asic modeled via devlink will help here and possibly all/other switchdev
offload hooks ?
Mon, Sep 19, 2016 at 04:53:07PM CEST, roopa@cumulusnetworks.com wrote:
On 9/18/16, 11:06 PM, Jiri Pirko wrote:
quoted
Mon, Sep 19, 2016 at 01:23:47AM CEST, roopa@cumulusnetworks.com wrote:
quoted
On 9/6/16, 5:01 AM, Jiri Pirko wrote:
quoted
From: Jiri Pirko <redacted>
This allows to pass information about added/deleted fib entries to
whoever is interested. This is done in a very similar way as devinet
notifies address additions/removals.
Signed-off-by: Jiri Pirko <redacted>
---
It appears that this is in addition to the existing switchdev_fib_ipv4_add call right above this.
Is the intent to do both ?. i don't see a need to do both.
I already have patchset improved that it removes the switchdev fib code.
Have to do some more testing, will send it soon.
ok, ack.
quoted
quoted
and switchdev_fib_ipv4_add offloads before the route is added to the kernel.
But the notifier seems to fire after the route is added to the kernel.
Yeah, I wanted to align it with rtmsg_fib calls. Also I think it makes
sense to have slowpath ready before offload.
ok, ..but..that changes existing behavior though. and if the hw route add fails...,
you may have inconsistent state between hw and sw.
If the hw route add fails, driver will be responsible for abort,
cleanining up hw and set appropriate traps to get packets to cpu
processing.
Mon, Sep 19, 2016 at 04:59:22PM CEST, roopa@cumulusnetworks.com wrote:
On 9/18/16, 11:14 PM, Jiri Pirko wrote:
quoted
Mon, Sep 19, 2016 at 01:16:17AM CEST, roopa@cumulusnetworks.com wrote:
quoted
On 9/18/16, 1:00 PM, Florian Fainelli wrote:
quoted
Le 06/09/2016 à 05:01, Jiri Pirko a écrit :
quoted
From: Jiri Pirko <redacted>
This is RFC, unfinished. I came across some issues in the process so I would
like to share those and restart the fib offload discussion in order to make it
really usable.
So the goal of this patchset is to allow driver to propagate all prefixes
configured in kernel down HW. This is necessary for routing to work
as expected. If we don't do that HW might forward prefixes known to kernel
incorrectly. Take an example when default route is set in switch HW and there
is an IP address set on a management (non-switch) port.
Currently, only fibs related to the switch port netdev are offloaded using
switchdev ops. This model is not extendable so the first patch introduces
a replacement: notifier to propagate fib additions and removals to whoever
interested. The second patch makes mlxsw to adopt this new way, registering
one notifier block for each mlxsw (asic) instance.
Instead of introducing another specialization of a notifier_block
implementation, could we somehow have a kernel-based netlink listener
which receives the same kind of event information from rtmsg_fib()?
The reason is that having such a facility would hook directly onto
existing rtmsg_* calls that exist throughout the stack, and that seems
to scale better.
I was thinking along the same lines. Instead of proliferating notifier blocks
through-out the stack for switchdev offload, putting existing events to use would be nice.
But the problem though is drivers having to parse the netlink msg again. also, the intent
here is to do the offload first ..before the route is added to the kernel (though i don't see that in
the current series). existing netlink rmsg_fib events are generated after the route is added to the kernel.
Jiri, instead of the notifier, do you see a problem with always calling the existing switchdev
offload api for every route for every asic instance ?. the first device where the route fits wins.
There is not list of asic instances. Therefore the notifier fits much better here.
quoted
it seems similar to driver registering for notifier and looking at every route ...
am i missing something ?
and the policies you mention could help around selecting the asic instance (FCFS or mirror).
you will need to abstract out the asic instance for switchdev api to call on, but I thought you
already have that in some form in your devlink infrastructure.
switchdev asic instances and devlink instances are orthogonal.
maybe it is not today...but the requirement for devlink was to provide a way to communicate
to the switch driver
- global switch attributes or
- things that cannot go via switch ports (exactly the problem you are trying to solve for routes here)
Devlink is a general beast, not switch specific one. I see no need to
use fib->devlink->driver route inside kernel. Devlink is for userspace
facing.
so, maybe an instance of switch asic modeled via devlink will help here and possibly all/other switchdev
offload hooks ?
Maybe, but in case of fibs, the notifier just fits great. I see no need
for anything else.
Sun, Sep 18, 2016 at 10:00:44PM CEST, f.fainelli@gmail.com wrote:
quoted
Le 06/09/2016 à 05:01, Jiri Pirko a écrit :
quoted
From: Jiri Pirko <redacted>
This is RFC, unfinished. I came across some issues in the process so I would
like to share those and restart the fib offload discussion in order to make it
really usable.
So the goal of this patchset is to allow driver to propagate all prefixes
configured in kernel down HW. This is necessary for routing to work
as expected. If we don't do that HW might forward prefixes known to kernel
incorrectly. Take an example when default route is set in switch HW and there
is an IP address set on a management (non-switch) port.
Currently, only fibs related to the switch port netdev are offloaded using
switchdev ops. This model is not extendable so the first patch introduces
a replacement: notifier to propagate fib additions and removals to whoever
interested. The second patch makes mlxsw to adopt this new way, registering
one notifier block for each mlxsw (asic) instance.
Instead of introducing another specialization of a notifier_block
implementation, could we somehow have a kernel-based netlink listener
which receives the same kind of event information from rtmsg_fib()?
rtmsg_fib destination is userspace. The message format is netlink. I
don't think it is wise to pass netlink messages inside kernel when we
can pass nice structures.
True, which does not mean you cannot have a small piece of kernel code
that listens for netlink events and unmarshalls what you want to have
your drivers operate on a structure-based message. The point I am
getting it is that rtmsg_* exists all over the place, and with close to
zero modification in the networking stack you can get the notification
you want if you hook a netlink listener in kernel space. Just like the
notifier you are proposing, the interface drivers could work with can be
structure (and not netlink message) based. An argument could be made
that with the notifier approach and hooking where necessary you have
finer control of message delivery, especially for managing overhead and
potential subscribers to these messages (it is easier to compile out the
notifier code for what you are interested in).
Lower overhead. This is how it is done in the
rest of kernel. Not sure how your comment is related specifically to
this patch.
This is not directly related to your patch, it just made me think about
it as I was considering adding a notifier for other purposes (turns out
we may be able to do differently, without one).
--
Florian
Mon, Sep 19, 2016 at 04:59:22PM CEST, roopa@cumulusnetworks.com wrote:
quoted
On 9/18/16, 11:14 PM, Jiri Pirko wrote:
quoted
Mon, Sep 19, 2016 at 01:16:17AM CEST, roopa@cumulusnetworks.com wrote:
quoted
On 9/18/16, 1:00 PM, Florian Fainelli wrote:
quoted
Le 06/09/2016 à 05:01, Jiri Pirko a écrit :
quoted
From: Jiri Pirko <redacted>
This is RFC, unfinished. I came across some issues in the process so I would
like to share those and restart the fib offload discussion in order to make it
really usable.
So the goal of this patchset is to allow driver to propagate all prefixes
configured in kernel down HW. This is necessary for routing to work
as expected. If we don't do that HW might forward prefixes known to kernel
incorrectly. Take an example when default route is set in switch HW and there
is an IP address set on a management (non-switch) port.
Currently, only fibs related to the switch port netdev are offloaded using
switchdev ops. This model is not extendable so the first patch introduces
a replacement: notifier to propagate fib additions and removals to whoever
interested. The second patch makes mlxsw to adopt this new way, registering
one notifier block for each mlxsw (asic) instance.
Instead of introducing another specialization of a notifier_block
implementation, could we somehow have a kernel-based netlink listener
which receives the same kind of event information from rtmsg_fib()?
The reason is that having such a facility would hook directly onto
existing rtmsg_* calls that exist throughout the stack, and that seems
to scale better.
I was thinking along the same lines. Instead of proliferating notifier blocks
through-out the stack for switchdev offload, putting existing events to use would be nice.
But the problem though is drivers having to parse the netlink msg again. also, the intent
here is to do the offload first ..before the route is added to the kernel (though i don't see that in
the current series). existing netlink rmsg_fib events are generated after the route is added to the kernel.
Jiri, instead of the notifier, do you see a problem with always calling the existing switchdev
offload api for every route for every asic instance ?. the first device where the route fits wins.
There is not list of asic instances. Therefore the notifier fits much better here.
quoted
it seems similar to driver registering for notifier and looking at every route ...
am i missing something ?
and the policies you mention could help around selecting the asic instance (FCFS or mirror).
you will need to abstract out the asic instance for switchdev api to call on, but I thought you
already have that in some form in your devlink infrastructure.
switchdev asic instances and devlink instances are orthogonal.
maybe it is not today...but the requirement for devlink was to provide a way to communicate
to the switch driver
- global switch attributes or
- things that cannot go via switch ports (exactly the problem you are trying to solve for routes here)
Devlink is a general beast, not switch specific one. I see no need to
use fib->devlink->driver route inside kernel. Devlink is for userspace
facing.
yes, sure. it has a dev abstraction and an api. devlink discussion started a few years ago in the context
of switch asics for the very same reason that it will help direct the offload call to the
switch device driver when you cant apply the settings on a per port basis.
You have kept the abstraction and api generic ..which is a great thing.
But that can't be the reason for it to not support its original intent...if there is a way.
quoted
so, maybe an instance of switch asic modeled via devlink will help here and possibly all/other switchdev
offload hooks ?
Maybe, but in case of fibs, the notifier just fits great. I see no need
for anything else.
I think its better to stick with 'offload api or notifier' whichever we pick ..
to be consistent with other switchdev offload areas. That was the original intent of
introducing the switchdev api layer. If we are now replacing the switchdev api with notifiers,
assuming 'notifiers are the best way' to offload routes, lets keep it consistent with
other switchdev offload areas too.
I know you already have them for links...and that is good..because links already have notifiers.
we will need the same thing for acls. Having notifiers for acls too seems like an overkill.
we will then have to extend this to multicast and mpls routes too. will all these be notifiers too ?
Do you see any scale problems with using notifiers ?. as you know these ascis can scale to
32k-128k routes.
lets discuss more at netdev1.2..if your patches are not in by then.
thanks,
Roopa
Tue, Sep 20, 2016 at 07:49:47AM CEST, roopa@cumulusnetworks.com wrote:
On 9/19/16, 8:15 AM, Jiri Pirko wrote:
quoted
Mon, Sep 19, 2016 at 04:59:22PM CEST, roopa@cumulusnetworks.com wrote:
quoted
On 9/18/16, 11:14 PM, Jiri Pirko wrote:
quoted
Mon, Sep 19, 2016 at 01:16:17AM CEST, roopa@cumulusnetworks.com wrote:
quoted
On 9/18/16, 1:00 PM, Florian Fainelli wrote:
quoted
Le 06/09/2016 à 05:01, Jiri Pirko a écrit :
quoted
From: Jiri Pirko <redacted>
This is RFC, unfinished. I came across some issues in the process so I would
like to share those and restart the fib offload discussion in order to make it
really usable.
So the goal of this patchset is to allow driver to propagate all prefixes
configured in kernel down HW. This is necessary for routing to work
as expected. If we don't do that HW might forward prefixes known to kernel
incorrectly. Take an example when default route is set in switch HW and there
is an IP address set on a management (non-switch) port.
Currently, only fibs related to the switch port netdev are offloaded using
switchdev ops. This model is not extendable so the first patch introduces
a replacement: notifier to propagate fib additions and removals to whoever
interested. The second patch makes mlxsw to adopt this new way, registering
one notifier block for each mlxsw (asic) instance.
Instead of introducing another specialization of a notifier_block
implementation, could we somehow have a kernel-based netlink listener
which receives the same kind of event information from rtmsg_fib()?
The reason is that having such a facility would hook directly onto
existing rtmsg_* calls that exist throughout the stack, and that seems
to scale better.
I was thinking along the same lines. Instead of proliferating notifier blocks
through-out the stack for switchdev offload, putting existing events to use would be nice.
But the problem though is drivers having to parse the netlink msg again. also, the intent
here is to do the offload first ..before the route is added to the kernel (though i don't see that in
the current series). existing netlink rmsg_fib events are generated after the route is added to the kernel.
Jiri, instead of the notifier, do you see a problem with always calling the existing switchdev
offload api for every route for every asic instance ?. the first device where the route fits wins.
There is not list of asic instances. Therefore the notifier fits much better here.
quoted
it seems similar to driver registering for notifier and looking at every route ...
am i missing something ?
and the policies you mention could help around selecting the asic instance (FCFS or mirror).
you will need to abstract out the asic instance for switchdev api to call on, but I thought you
already have that in some form in your devlink infrastructure.
switchdev asic instances and devlink instances are orthogonal.
maybe it is not today...but the requirement for devlink was to provide a way to communicate
to the switch driver
- global switch attributes or
- things that cannot go via switch ports (exactly the problem you are trying to solve for routes here)
Devlink is a general beast, not switch specific one. I see no need to
use fib->devlink->driver route inside kernel. Devlink is for userspace
facing.
yes, sure. it has a dev abstraction and an api. devlink discussion started a few years ago in the context
of switch asics for the very same reason that it will help direct the offload call to the
switch device driver when you cant apply the settings on a per port basis.
You have kept the abstraction and api generic ..which is a great thing.
But that can't be the reason for it to not support its original intent...if there is a way.
quoted
quoted
so, maybe an instance of switch asic modeled via devlink will help here and possibly all/other switchdev
offload hooks ?
Maybe, but in case of fibs, the notifier just fits great. I see no need
for anything else.
I think its better to stick with 'offload api or notifier' whichever we pick ..
to be consistent with other switchdev offload areas. That was the original intent of
introducing the switchdev api layer. If we are now replacing the switchdev api with notifiers,
I strongly disagree. Make it uniform is not desirable. For some things,
direct ndo/sdo make sense and is better. For some other things, notifier
fits better. For example when I was implementing LAG offload,
I also chose a notifier.
assuming 'notifiers are the best way' to offload routes, lets keep it consistent with
other switchdev offload areas too.
I know you already have them for links...and that is good..because links already have notifiers.
we will need the same thing for acls. Having notifiers for acls too seems like an overkill.
Acls will reuse the tc ndo infra. No notifiers required there.
we will then have to extend this to multicast and mpls routes too. will all these be notifiers too ?
I believe so.
Do you see any scale problems with using notifiers ?. as you know these ascis can scale to
32k-128k routes.
I don't see any problem there. What do you think might be wrong?
lets discuss more at netdev1.2..if your patches are not in by then.
thanks,
Roopa
On Mon, Sep 19, 2016 at 11:02 PM, Jiri Pirko [off-list ref] wrote:
Tue, Sep 20, 2016 at 07:49:47AM CEST, roopa@cumulusnetworks.com wrote:
[snip]
quoted
Do you see any scale problems with using notifiers ?. as you know these ascis can scale to
32k-128k routes.
I don't see any problem there. What do you think might be wrong?
we had seen some overheads with link notifiers in older kernels with
large number of links flaps.
But that could have been due to rtnl lock. don't have any more data
than that. so, ignore that.
I don't see anything obvious from perf perspective....rtnl is already
held. but, thought i did just ask.