Commit Graph

232 Commits

Author SHA1 Message Date
Donald Sharp
6b46851168 zebra: Replace nexthop_group with pointer in route entry
In the route_entry we are keeping a non pointer based
nexthop group, switch the code to use a pointer for all
operations here and ensure we create and delete the memory.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-25 11:13:36 -04:00
Mark Stapp
f26730e17e zebra: handle config write for dataplane values
Add the (single) dataplane config value to the output of
config write, 'show run' - missed this during dplane development.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-09-25 14:05:50 -04:00
Mark Stapp
478566d68b zebra: avoid using zebra datastructs in evpn dataplane path
Some netlink-facing code used for evpn/vxlan programming was
being run in the dataplane pthread, but accessing zebra core
datastructs. Move some additional data into the dataplane
context, and use it in the netlink path instead.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-09-05 12:58:58 -04:00
Mark Stapp
0bbd4ff442 zebra: move EVPN VTEP programming to dataplane
Move VTEP install/uninstall to the zebra dataplane. Remove
synch kernel-facing apis and helper functions.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-09-04 10:30:17 -04:00
Donald Sharp
c9042b2890
Merge pull request #4877 from mjstapp/dplane_neighs
zebra: move evpn neighbors to dataplane
2019-09-04 10:23:31 -04:00
Donald Sharp
dec2a1469f
Merge pull request #4812 from pogojotz/fix-destination-multi-use
zebra: Do not use connection dest for bcast
2019-08-26 09:25:17 -04:00
Mark Stapp
931fa60c09 zebra: Use dataplane for evpn neighbor changes
Move neighbor programming to the dataplane; remove
old apis; remove some ifdef'd use of direct netlink
code points, using neutral values outside of the netlink-
specific files.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-08-23 14:10:41 -04:00
Mark Stapp
f2412b2d19 zebra: begin evpn neighbor install via dataplane
Initial work to move evpn neighbor programming to the dataplane
subsystem.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-08-23 10:09:38 -04:00
Donald Sharp
ad4c7e8d4e
Merge pull request #4778 from mjstapp/dplane_macs
zebra: use dataplane for evpn macs
2019-08-21 20:26:29 -04:00
Juergen Werner
0f3af7386e zebra: Do not use connection dest for bcast
The `destination` field of the connection structure was used to store
the broadcast address, if the connection was not p2p. This multipurpose
is not very evident and the benefits over calculating the bcast address
on the fly minimal.

Signed-off-by: Juergen Werner <juergen@opensourcerouting.org>
2019-08-18 18:54:46 +02:00
Mark Stapp
0eca319cc0 zebra: make the dplane pthread name consistent
Make the dplane pthread's name consistent (lower-case)
with other pthreads.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-08-12 09:50:43 -04:00
Mark Stapp
4280d91ce8 zebra: update dplane stats output
Update the stats displayed by 'show zebra dplane' - some
counters had been added but not displayed. Also include
the new counters for evpn macs.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-08-02 14:54:16 -04:00
Mark Stapp
036d93c047 zebra: use dataplane for vxlan remote mac programming
Move vxlan remote MAC install and uninstall to the async
dataplane.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-08-02 14:54:16 -04:00
Mark Stapp
7597ac7b4d zebra: initial dplane support for MAC updates
Initial data struct and api changes to support EVPN MAC
updates via the dataplane subsystem (no handlers yet).

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-07-26 14:17:31 -04:00
Mark Stapp
3fe4ccc437 zebra: rename internal dplane api
Rename an internal dplane api - it said "route", but it is
actually general-purpose.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-07-25 16:47:07 -04:00
Mark Stapp
7c7ef4a8c8 zebra: consolidate dataplane interface name and ifindex attrs
Move interface name and index to shared data struct, and remove
operation-specific values.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-07-25 14:01:22 -04:00
Donald Sharp
a36898e755
Revert "Ospf missing interface handling 2" 2019-06-23 19:46:39 -04:00
Donald Sharp
a12bb225a6
Merge pull request #3775 from pguibert6WIND/ospf_missing_interface_handling_2
Ospf missing interface handling 2
2019-06-22 13:35:45 -04:00
David Lamparter
c1344b54a8 zebra: use MTYPE_STATIC
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-06-21 08:54:25 +02:00
David Lamparter
2618a52ed3 *: config.h or zebra.h is the first #include
This is mostly relevant for Solaris, where config.h sets up some #define
that affect overall header behaviour, so it needs to be before anything
else.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-06-13 13:35:33 +02:00
Philippe Guibert
a41c4e1b1f *: change interface structure, from vrf_id to vrf
Field vrf_id is replaced by the pointer of the struct vrf *.
For that all other code referencing to (interface)->vrf_id is replaced.
This work should not change the behaviour.
It is just a continuation work toward having an interface API handling
vrf pointer only.

some new generic functions are created in vrf:
vrf_to_id, vrf_to_name,

a zebra function is also created:
zvrf_info_lookup

an ospf function is also created:
ospf_lookup_by_vrf

it is to be noted that now that interface has a vrf pointer, some more
optimisations could be thought through all the rest of the code. as
example, many structure store the vrf_id. those structures could get
the exact vrf structure if inherited from an interface vrf context.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12 14:10:28 +02:00
Mark Stapp
6a91ae9860 zebra: add setters for distance, instance
Add a few more 'setters' for dplane context objects.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-05-29 11:47:58 -04:00
Mark Stapp
188a00e014 zebra: generate updates from notifications
If an async notification changes a route that's current,
generate an update to keep the kernel in sync.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-05-28 13:41:37 -04:00
Mark Stapp
104e3ad95e zebra: mpls lsp async notifications
Add LSP notification event type; add a handler for LSP notifs;
dispatch to that handler.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-05-28 08:35:01 -04:00
Mark Stapp
3ab54059be zebra: add dplane context lsp setters
Add some setters for dataplane context LSP data to support
LSP async notifications.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-05-28 08:34:43 -04:00
Mark Stapp
9651af6181 zebra: add 'set' api for dplane context provider
Add a setter for the 'source provider' attribute in dplane
contexts.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-05-28 08:29:00 -04:00
Mark Stapp
0024a559c8 zebra: add source plugin info to dplane context
Some updates may be the result of a plugin's actions - such
as an async notification. Add accessor so that we can
identify that an update was generated by a plugin.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-05-28 08:28:49 -04:00
Mark Stapp
593e4eb1e8 zebra: add dplane context accessors
Add several accessors for data items needed to produce a
notification context.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-05-28 08:24:57 -04:00
Mark Stapp
54818e3b01 zebra: begin dataplane notifications
Add dataplane route notification type; add handler for zebra
routes.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-05-28 08:22:27 -04:00
Mark Stapp
1dd4ea8a1a zebra: add a start callback for dplane plugins
Add a callback called at start time, once the dplane pthread
and thread_master are available. The callback is optional.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-05-28 08:16:22 -04:00
Donald Sharp
d8e479a355 zebra: ctx is dereferenced in every path
No need to check for non-null ctx at this point in the
function as that it has already been derefed.

Signed-off-by: donald Sharp ,sahrpd@cumulusnetworks.com>
2019-05-11 08:39:54 -04:00
Donald Sharp
eb6967279c zebra: Memory allocations do not fail
If a memory allocation fails then we *know* we assert
and core the program.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-03 05:05:19 -04:00
Mark Stapp
b7b7bf31da zebra: replace strncpy with strlcpy in dplane
The dataplane module picked up a couple of strncpys; replace
them.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-05-02 09:52:48 -04:00
Mark Stapp
6416880328 zebra: Use dplane for interface addresses (netlink)
Start using the dataplane for interface-address programming,
on netlink platforms. Other platforms just stubbed at this
point.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-04-22 13:49:27 -04:00
Mark Stapp
a4a4802a9b zebra: add interface-address info for dataplane
Add data and accessor apis for interface-address information.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-04-22 13:49:27 -04:00
Mark Stapp
cf363e1bd8 zebra: dataplane notifications for system route changes
Add notifications from zebra to the dataplane subsystem when
kernel or connected routes change.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-04-10 16:07:01 -04:00
Mark Stapp
9677961ea5 zebra: support skip-kernel for dataplane updates
Support the skip-kernel flag for dataplane updates.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-03-13 11:19:51 -04:00
Mark Stapp
81793ac145 zebra: use const in dplane pw nhlfe accessors
Use const in the accessors for pseudowire nhlfe data; pull
that through the kernel-facing apis that use that data.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-03-07 15:06:36 -05:00
Mark Stapp
09cd307c62 zebra: dplane pseudowires including nexthop info
Add nexthop info to the data that the zebra dataplane captures
when programming pseudowires.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-03-07 15:06:36 -05:00
Mark Stapp
16d697870b zebra: rename pseudowire destination api
In prep for adding nexthop info for pws, rename the accessor
for the pw destination. Add a nexthop-group to the pw
data in the dataplane module.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-03-07 15:06:01 -05:00
Quentin Young
76f0146890 *: do not check XMALLOC / XCALLOC for null ret
They never return NULL

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-25 23:00:44 +00:00
Quentin Young
5b94ec5024 *: remove unnecessary semicolon from switches
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-25 23:00:16 +00:00
Quentin Young
9f2d035447 *: remove useless return variables
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-25 23:00:16 +00:00
Donald Sharp
4634d02cfd
Merge pull request #3684 from mjstapp/dplane_pw
zebra: async dataplane for pseudowires
2019-02-05 18:41:12 -05:00
Donald Sharp
2561d12e5d zebra: Remove struct zebra_t
This structure is unused anymore and does not belong in zserv.h

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-31 09:20:46 -05:00
Donald Sharp
3801e7646c zebra: Move the master thread handler to the zrouter structure
The master thread handler is really part of the zrouter structure.
So let's move it over to that.  Eventually zserv.h will only be
used for zapi messages.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-31 09:20:46 -05:00
Mark Stapp
9bd9717bb2 zebra: add handler for pw install errors
Add handler for async error results from the dataplane for
pseudowire installation attempts.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-01-25 10:45:57 -05:00
Mark Stapp
c10a646df4 zebra: handle pw updates in async dplane
Add kernel 'provider' support for pseudowire updates.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-01-25 10:45:57 -05:00
Mark Stapp
97d8d05a81 zebra: convert PW updates to async dataplane
Add accessors for pw attributes; init pw attributes;
replace 'hook' calls for pw install/uninstall with dplane
apis.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-01-25 10:45:57 -05:00
Mark Stapp
d613b8e1ed zebra: start pseudowire support
Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-01-25 10:45:57 -05:00
Donald Sharp
1485bbe755 zebra: Add code to track sequence number from zebra_router
The sequence number used should be unique and increase by 1
for netlink commands.  This will allow the code to match
up batched commands to actual requests, so that we can signal
the failure correctly back.

So start the movement and tracking of sequence numbers as
an atomic uint32_t in zebra_router.  Modify the dataplane
code to start tracking contexts from this value.

In future commits we will move more of the sequencing
data into using this value.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-24 08:02:39 -05:00
Mark Stapp
16c628de99 zebra: infra for LSP updates using dplane
Adding infra to zebra dplane to support LSP updates. Add
kernel api for LSP updates that uses a dataplane context; add
stub apis for netlink, bsd, and 'null' kernel paths. Add
version of netlink mpls update code that takes a dplane
context struct instead of a zebra lsp struct.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-01-22 12:02:20 -05:00
Mark Stapp
0f461727ab zebra: reorg dataplane context to support lsp info
Move route info to a separate struct and use a union in the
dplane context to hold either route or lsp info. Add
accessors for LSP info.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-01-22 12:02:20 -05:00
Mark Stapp
6fb51ccbf5 zebra: Fix uninitialized value warning in dplane code
Fix a gcc-8 warning (at least) about a possible uninitialized
value in the zebra_dplane code.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-01-11 13:38:41 -05:00
Mark Stapp
1ff8a24869 zebra: return dataplane provider plugin handle
When a dataplane provider/plugin registers, return the new
handle/object - that's needed to use some provider apis
later on.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-01-11 08:23:39 -05:00
Mark Stapp
4c206c8f74 zebra: pass lists of results from dataplane to zebra
Pass lists of results back to zebra from the dataplane subsystem
(and pthread). This helps reduce the lock/unlock cycles when
zebra is busy. Also remove a couple of typedefs that made their
way into the dataplane header file - those violate the FRR style
guidelines.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-01-10 13:24:13 -05:00
Mark Stapp
62b8bb7a17 zebra: separate netlink socket for dataplane
Use a separate netlink socket for the dataplane's updates, to
avoid races between the dataplane pthread and the zebra main
pthread. Revise zebra shutdown so that the dataplane netlink
socket is cleaned-up later, after all shutdown-time dataplane
work has been done.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-11-21 10:38:08 -05:00
Mark Stapp
ad6aad4d0b zebra: dplane lock and thread_master apis
Improve, simplify dataplane provider locking apis. Add accessor
for dataplane pthread's thread_master, for use by providers who
need to use the thread/event apis.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-11-21 10:38:08 -05:00
Mark Stapp
c9d17fe85e zebra: improve dataplane shutdown checks
Update the dataplane shutdown checks to include the providers.
Also revise the typedef for provider structs to make const
work.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-11-21 10:38:08 -05:00
Mark Stapp
68b375e059 zebra: revise dplane dequeue api
Change the dataplane context dequeue api used by zebra to make the
purpose a bit clearer.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-11-21 10:38:08 -05:00
Mark Stapp
14b0bc8e88 zebra: add initial error handling to dplane loop
Capture error work during dataplane provider processing.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-11-21 10:38:08 -05:00
Mark Stapp
e5a60d8259 zebra: reorg dataplane pthread start
Move dataplane pthread start later in the zebra startup; make
the 'test' dplane provider conditional

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-11-21 10:38:08 -05:00
Mark Stapp
c831033fff zebra: dataplane provider enhancements
Limit the number of updates processed from the incoming queue;
add more stats. Fill out apis for dataplane providers; convert
route update processing to provider model; move dataplane
status enum

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-11-21 10:37:54 -05:00
Mark Stapp
675440ad5a zebra: fix get_old_instance api
One of the dplane context accessors was returning the wrong value;
correct it.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-11-21 10:25:57 -05:00
Mark Stapp
d8c16a9519 zebra: introduce dedicated dataplane pthread
Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-11-21 10:25:57 -05:00
Quentin Young
0545c37384 *: only use 32-bit atomics
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-11-19 18:44:35 +00:00
Mark Stapp
e07e954966 zebra: temporary workaround for a clang issue with atomics
Current clang has an issue with the pointer/target argument
to at least one atomic/intrinsic. A variable with '_Atomic'
generates a compile-time error. Use a cast as a workaround
here to allow use of clang for now.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-30 15:31:47 -04:00
Mark Stapp
8b962e7759 zebra: rebase dataplane, align with master
Rebase and pick up dataplane changes on master, including
renamed structs and enums.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:57:04 -04:00
Mark Stapp
91f1681258 zebra: limit queued route updates
Impose a configurable limit on the number of route updates
that can be queued towards the dataplane subsystem.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:57:04 -04:00
Mark Stapp
2577906481 zebra: revise struct names to resolve review comments
Use standard type naming and remove use of typedef to resolve
some review comments.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:57:04 -04:00
Mark Stapp
4dfd7a021d zebra: support zebra shutdown and cleanup
Dplane support for zebra's route cleanup during shutdown (clean
shutdown via SIGINT, anyway.) The dplane has the opportunity to
process incoming updates, and then triggers final cleanup
in zebra's main thread.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:57:04 -04:00
Mark Stapp
f183e380fa zebra: add handy res2str utility
Add a 2str utility for dplane result codes; use it in
a debug or two.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:57:04 -04:00
Mark Stapp
1d11b21f33 zebra: add dplane show commands
Add first pass at show commands for the zebra dplane. Add some stats
counters to show. Start prep for correct shutdown processing, and for
multiple providers.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:57:04 -04:00
Mark Stapp
01ce7cbac1 zebra: update routing socket path
Update route-socket path for route updates using the async
dplane module.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:56:52 -04:00
Mark Stapp
18c3797425 zebra: add shutdown callback for dplane providers
Support fini or shutdown callback for dplane modules, to give
them an opportunity to cleanup.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:34:30 -04:00
Mark Stapp
1bcea841b1 zebra: netlink fuzzing path correction
Correct use of netlink_parse_info() in the netlink fuzzing path.
Also clarify a couple of comments about pthreads.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:34:30 -04:00
Mark Stapp
5709131cec zebra: resolve style issues in dplane commit
Resolve (most) style issues in the initial zebra dataplane
commit branch.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:34:30 -04:00
Mark Stapp
b8e0423d91 zebra: start sketching dataplane provider api
Initial WIP api to add providers into the zebra dataplane system,
with some simple ordering/prioritization.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:34:30 -04:00
Mark Stapp
ae2992851b zebra: capture old data for route delete
Need to capture 'old' values in conversion from re to dplane
context.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:34:30 -04:00
Mark Stapp
655d681a44 zebra: update dplane route api return type
Use the dp_req_result enum type for the route update apis.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:34:30 -04:00
Mark Stapp
7cdb1a8445 zebra: start dataplane layer work
Reduce or eliminate use of global zebra_ns structs in
a couple of netlink/kernel code paths, so that those paths
can potentially be made asynch eventually.

Slide netlink_talk_info into place to remove dependency on core
zebra structs; add accessors for dplane context block

Start init of route context from zebra core re and rn structs;
start queueing and event handling for incoming route updates.

Expose netlink apis that don't rely on zebra core structs;
add parallel route-update code path using the dplane ctx;
simplest possible event loop to process queued route'
updates.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:34:30 -04:00
Mark Stapp
ea1c14f680 zebra: Create zebra_dplane.c and .h
Add first sketchy 'dplane' files.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-19 18:29:55 -04:00