Commit Graph

280 Commits

Author SHA1 Message Date
Donald Sharp
82463eb1a9 zebra: On shutdown, ensure dg_update_list is emptied
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-11-21 12:41:18 -05:00
Donald Sharp
318a8c98b4 zebra: Cleanup dplane provider owned ctx's on shutdown
On shutdown go through and ensure that any contexts the
dplane provider holds are freed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-11-21 12:41:18 -05:00
Donald Sharp
65b65f47c8 zebra: On shutdown, cleanup dplane providers
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-11-21 12:39:07 -05:00
Mark Stapp
4fabe90c7f lib,*: add vrf id to pbr rule results zapi message
The iprule/pbr rule object has a vrf id, and zebra uses
that internally, but the vrf id isn't returned to clients
who install rules and are waiting for results. Include the
vrf_id sent by the client in the zapi result notification
message; update the existing clients so they decode the id.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-10-05 16:22:40 -04:00
Mark Stapp
7b8a4249ea lib,zebra: add tx queuelen to interface struct
Add the txqlen attribute to the common interface struct. Capture
the value in zebra, and distribute it through the interface lib
module's zapi messaging.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-09-01 10:06:10 -04:00
Donald Sharp
6349e49645 zebra: Fix crashes in interface change
Upon some internal testing some crashes were found.  This fixes
the several crashes and normalizes the code to be closer in
it's execution pre and post changes to use the data plane.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-17 09:43:06 -04:00
G. Paul Ziemba
1c900cea90 zebra: zebra_dplane.[ch]: use pbr common struct in ctx
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2023-08-07 06:24:53 -07:00
G. Paul Ziemba
657882c430 pbrd: add vlan filters pcp/vlan-id/vlan-flags; ip-protocol any (zebra dplane)
Subset: zebra dataplane

    Add new vlan filter fields. No kernel dataplane
    implementation yet (linux does not support).

    Changes by:
	Josh Werner <joshuawerner@mitre.org>
	Eli Baum <ebaum@mitre.org>
	G. Paul Ziemba <paulz@labn.net>

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2023-07-19 08:15:15 -07:00
Carmine Scarpitta
745a0fcbb2 zebra: Abstract dplane_ctx_route_init to init route without copying
The function `dplane_ctx_route_init` initializes a dplane route context
from the route object passed as an argument. Let's abstract this
function to allow initializing the dplane route context without actually
copying a route object.

This allows us to use this function for initializing a dplane route
context when we don't have any route to copy in it.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-07-07 10:59:28 +02:00
Donald Sharp
a014450441 zebra: Add code to get/set interface to pass up from dplane
1) Add a bunch of get/set functions and associated data
structure in zebra_dplane to allow the setting and retrieval
of interface netlink data up into the master pthread.

2) Add a bit of code to breakup startup into stages.  This is
because FRR currently has a mix of dplane and non dplane interactions
and the code needs to be paused before continuing on.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-07-05 13:03:14 -04:00
Donald Sharp
cd7324dfa6 zebra: Remove unused dplane_intf_delete
There is no need for this functionality and it is
not used.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-07-05 11:49:36 -04:00
G. Paul Ziemba
9e5c9e6d65 zebra: bugfix dplane priority sorting
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2023-06-09 06:58:20 -07:00
Donald Sharp
d7c9666e06 zebra: Fix paths that have already de-refed ctx
There is no path in some functions where the ctx
has not already been de-refed.  As such no need
to test for it's existence.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-22 10:52:54 -04:00
Donald Sharp
995d810d08 zebra: Fix dp_out_queued counter to actually reflect real life
The prov->dp_out_queued counter was never being decremented
when a ctx was pulled off of the list.  Let's change it to
accurately reflect real life.

Broken:
janelle.pinkbelly.org# show zebra dplane providers detailed
Zebra dataplane providers:
Kernel (1): in: 330872, q: 0, q_max: 100, out: 330872, q: 330872, q_max: 330872
janelle.pinkbelly.org#

Fixed:
sharpd@janelle:/tmp/topotests$ vtysh -c "show zebra dplane providers detailed"
Zebra dataplane providers:
Kernel (1): in: 221495, q: 0, q_max: 100, out: 221495, q: 0, q_max: 100
sharpd@janelle:/tmp/topotests$

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-12 11:34:56 -04:00
Donald Sharp
3e7b3ed1dc zebra: dplane_gre_set could return while leaking ctx
Prevent this function from leaking the ctx memory.
Also properly record that something has gone wrong.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-05 19:11:02 -04:00
Donald Sharp
6636fc44c8 zebra: Dplane ctx allocation cannot fail
Having tests for memory allocation success makes no sense
given what happens when frr fails to allocate memory.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-05 19:10:59 -04:00
Donald Sharp
6f99cfcd89 zebra: ctx has to be non NULL at this point
Remove the pointer check for ctx.  At this point in the
function it has to be non null since we deref'ed it.
Additionally the alloc function that creates it cannot
fail.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-04-21 08:54:51 -04:00
Mark Stapp
52ccf12c30
Merge pull request #13249 from Pdoijode/connected-route-install-fix
zebra: Mark connected route as installed after interface flap event
2023-04-12 11:03:47 -04:00
Pooja Jagadeesh Doijode
e25a0b138a zebra: Install directly connected route after interface flap
Issue:
After vlan flap, zebra was not marking the selected/best route as installed.

As a result, when a static route was configured with nexthop as directly
connected interface's(vlan) IP, the static route was not being installed
in the kernel since its nexthop was unresolved. The nexthop was marked
unresolved because zebra failed to mark the best route as installed after
interface flap.

This was happening because, in dplane_route_update_internal() if the old and
new context type, and nexthop group id are the same, then zebra doesn't send
down a route replace request to kernel. But, the installed (ROUTE_ENTRY_INSTALLED)
flag is set when zebra receives a response from kernel. Since the
request to kernel was being skipped for the route entry, installed flag
was not being set

Fix:
In dplane_route_update_internal() if the old and new context type, and
nexthop group id are the same, then before returning, installed flag will
be set on the route-entry if it's not set already.

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2023-04-10 16:03:23 -07:00
Mark Stapp
38a2e2cb26 zebra: fix race during shutdown
During shutdown, the main pthread stops the dplane pthread
before exiting. Don't try to clean up any events scheduled
to the dplane pthread at that point - just let the thread
exit and clean up.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-04-04 16:37:38 -04:00
Donald Sharp
cd9d053741 *: Convert struct event_master to struct event_loop
Let's find a better name for it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
e16d030c65 *: Convert THREAD_XXX macros to EVENT_XXX macros
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
2453d15dbf *: Convert struct thread_master to struct event_master and it's ilk
Convert the `struct thread_master` to `struct event_master`
across the code base.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
332beb64b8 *: Convert thread_cancelXXX to event_cancelXXX
Modify the code base so that thread_cancel becomes event_cancel

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
907a2395f4 *: Convert thread_add_XXX functions to event_add_XXX
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
e6685141aa *: Rename struct thread to struct event
Effectively a massive search and replace of
`struct thread` to `struct event`.  Using the
term `thread` gives people the thought that
this event system is a pthread when it is not

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
8383d53e43
Merge pull request #12780 from opensourcerouting/spdx-license-id
*: convert to SPDX License identifiers
2023-02-17 09:43:05 -05:00
Stephen Worley
0e44c00d48 zebra: add VNI info to flood entry
When we are installing the flood entry for a vtep in SVD,
ensure VNI is set on the ctx object so that it gets
sent to the kernel and set appropriately with src_vni.

Signed-off-by: Stephen Worley <sworley@nvidia.com>
2023-02-13 18:12:05 -05:00
Sharath Ramamurthy
b95ce8fadb zebra: single vxlan device dataplace vni update changes
dplane_mac_info and dplane_neigh_info is modified to be vni aware.
dplane_rem_mac_add/del dplane_mac_init is modified to be vni aware.

During dplane context update (mac and neigh), we use the vni information
and if set, corresponding netlink attribute NDA_SRC_VNI is set and passed to the
dplane.

Signed-off-by: Sharath Ramamurthy <sramamurthy@nvidia.com>
2023-02-13 18:12:04 -05:00
David Lamparter
acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
Mark Stapp
6d5014b657 zebra: fix SA warning, don't lock plugin list
Locking around the list of providers/plugins is not
helpful - these only change at init time. Clear some SA
warnings by removing the locking.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-01-25 08:38:47 -05:00
Mark Stapp
ac96497ccc zebra: use typesafe lib lists in zebra dplane
Replace some of the old queue/DLIST macros with typesafe
dlists.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-01-23 08:55:44 -05:00
anlan_cs
64a29a00f7 zebra: cosmetic changes for debug
Just remove redundant white spaces in debug information.

Before:
```
2023/01/11 05:04:48 ZEBRA: [W8V7C-6W4DS] init neigh ctx NEIGH_INSTALL: ifp vlan100, mac  9a:68:e9:73:74:88, ip 88.88.88.88
2023/01/11 05:04:48 ZEBRA: [NH6N7-54CD1] Tx RTM_NEWNEIGH family ipv4 IF vlan100(8) Neigh 88.88.88.88 MAC  9a:68:e9:73:74:88 flags 0x10 state 0x40 ext_flags 0x0
```

After:
```
2023/01/11 05:17:26 ZEBRA: [W8V7C-6W4DS] init neigh ctx NEIGH_INSTALL: ifp vlan100, mac 9a:68:e9:73:74:88, ip 88.88.88.88
2023/01/11 05:17:26 ZEBRA: [NH6N7-54CD1] Tx RTM_NEWNEIGH family ipv4 IF vlan100(8) Neigh 88.88.88.88 MAC 9a:68:e9:73:74:88 flags 0x10 state 0x40 ext_flags 0x0
```

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2023-01-11 18:16:40 +08:00
Donald Sharp
a0e1173678 zebra: Read from the dplane_fpm_nl a route update
Read from the fpm dplane a route update that will
include status about whether or not the asic was
successfull in offloading the route.

Have this data passed up to zebra for processing and disseminate
this data as appropriate.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-13 15:34:05 -05:00
Donald Sharp
45f0a10bef zebra: Add ctx to netlink message parsing
Add the initial step of passing in a dplane context
to reading route netlink messages.  This code
will be run in two contexts:

a) The normal pthread for reading netlink messages from
the kernel
b) The dplane_fpm_nl pthread.

The goal of this commit is too just allow a) to work
b) will be filled in in the future.  Effectively
everything should still be working as it should
pre this change.  We will just possibly allow
the passing of the context around( but not used )

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-12 10:44:57 -05:00
Donald Sharp
f935122ebd zebra: Rearrange dplane_ctx_route_init
In order for a future commit to abstract the dplane_ctx_route_init
so that the kernel can use it, let's move some stuff around
and add a dplane_ctx_route_init_basic that can be used by multiple
different paths

Signed-off-by: Donald Sharp <sharpd@nvidia.com>

create a dplane_ctx_route_init_basic so it can be used

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-12 10:44:57 -05:00
Donald Sharp
10388e99c4 zebra: Add dplane_ctx_get|set_flags
Zebra needs the ability to pass this data around.
Add it to the dplanes ability to pass.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>

zebra: Add a dplane_ctx_set_flags

The dplane_ctx_set_flags call is missing, we will need it.  Add it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-12 10:44:57 -05:00
Donald Sharp
c7f0429e81 zebra: Remove goto's that do not do anything special
If we have this semantics:

int ret = FAILURE;

if (foo)
    goto done;

....

done:
    return ret;

This pattern does us no favors and makes it harder to figure out what is going
on.  Let's remove.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-12 10:44:57 -05:00
Donald Sharp
1cc380679e zebra: Actually free all memory associated ctx->u.iptable.interface_name_list
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-09 08:38:50 -05:00
Siger Yang
c317d3f246
zebra: traffic control state management
This allows Zebra to manage QDISC, TCLASS, TFILTER in kernel and do cleaning
jobs when it starts up.

Signed-off-by: Siger Yang <siger.yang@outlook.com>
2022-11-22 22:35:35 +08:00
Quentin Young
7205c3bb19
Merge pull request #11832 from sigeryang/master
zebra: trim unused tc dplane result values
2022-08-19 10:16:56 -04:00
Siger Yang
366eb2d086
zebra: trim unused tc dplane result values
Signed-off-by: Siger Yang <siger.yang@outlook.com>
2022-08-18 23:35:41 +08:00
Donald Sharp
c8e1ce6278
Merge pull request #11824 from sigeryang/master
zebra: fix deadcodes in tc dplane & netlink
2022-08-17 09:59:37 -04:00
Siger Yang
ec195c6603
zebra: use default NS directly in tc dplane
Signed-off-by: Siger Yang <siger.yang@outlook.com>
2022-08-17 19:10:01 +08:00
Stephen Worley
d30d63f4f7
Merge pull request #11694 from sigeryang/master
zebra: add basic traffic control API
2022-08-16 11:21:04 -04:00
Donald Sharp
50a38e23fd zebra: Remove unused assignment in zebra_dplane.c
Coverity spotted 3 places where `int ret = XXX` was
being used and FRR was immediately assigning a different
value.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-15 11:20:59 -04:00
Siger Yang
449a30edf6
zebra: add tc netlink and dplane ops
This commit implements necessary netlink encoders for traffic control
including QDISC, TCLASS and TFILTER, and adds basic dplane operations.

Co-authored-by: Stephen Worley <sworley@nvidia.com>
Signed-off-by: Siger Yang <siger.yang@outlook.com>
2022-08-11 02:32:43 +08:00
Donald Sharp
39ffa8e8e8 zebra: Add a mpls enable interface node command
Allow individual interfaces to turn on/off the mpls subsystem
for it in linux.

sharpd@eva:~/frr9$ sudo sysctl -a | grep enp39s0 | grep mpls
net.mpls.conf.enp39s0.input = 0
sharpd@eva:~/frr9$ vtysh -c "conf" -c "int enp39s0" -c "mpls enable"
sharpd@eva:~/frr9$ sudo sysctl -a | grep enp39s0 | grep mpls
net.mpls.conf.enp39s0.input = 1
sharpd@eva:~/frr9$ vtysh -c "conf" -c "int enp39s0" -c "no mpls enable"
sharpd@eva:~/frr9$ sudo sysctl -a | grep enp39s0 | grep mpls
net.mpls.conf.enp39s0.input = 0
sharpd@eva:~/frr9$

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-08 09:15:22 -04:00
Donald Sharp
146bcb9b92 zebra: Convert thread_cancel to THREAD_OFF
Just convert all uses of thread_cancel to THREAD_OFF

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21 08:30:50 -04:00
Anuradha Karuppiah
9898473fb4 zebra: pass PBR expanded actions to the dataplane
These attributes are needed for dpdk dataplane programming

Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
2022-06-27 07:56:55 -04:00