/*
* Prototypes.
*/
-static int fpm_process_event(struct thread *t);
+static void fpm_process_event(struct thread *t);
static int fpm_nl_enqueue(struct fpm_nl_ctx *fnc, struct zebra_dplane_ctx *ctx);
-static int fpm_lsp_send(struct thread *t);
-static int fpm_lsp_reset(struct thread *t);
-static int fpm_nhg_send(struct thread *t);
-static int fpm_nhg_reset(struct thread *t);
-static int fpm_rib_send(struct thread *t);
-static int fpm_rib_reset(struct thread *t);
-static int fpm_rmac_send(struct thread *t);
-static int fpm_rmac_reset(struct thread *t);
+static void fpm_lsp_send(struct thread *t);
+static void fpm_lsp_reset(struct thread *t);
+static void fpm_nhg_send(struct thread *t);
+static void fpm_nhg_reset(struct thread *t);
+static void fpm_rib_send(struct thread *t);
+static void fpm_rib_reset(struct thread *t);
+static void fpm_rmac_send(struct thread *t);
+static void fpm_rmac_reset(struct thread *t);
/*
* CLI.
/*
* FPM functions.
*/
-static int fpm_connect(struct thread *t);
+static void fpm_connect(struct thread *t);
static void fpm_reconnect(struct fpm_nl_ctx *fnc)
{
&fnc->t_connect);
}
-static int fpm_read(struct thread *t)
+static void fpm_read(struct thread *t)
{
struct fpm_nl_ctx *fnc = THREAD_ARG(t);
ssize_t rv;
/* Schedule next read. */
thread_add_read(fnc->fthread->master, fpm_read, fnc,
fnc->socket, &fnc->t_read);
- return 0;
+ return;
}
if (rv == 0) {
atomic_fetch_add_explicit(&fnc->counters.connection_closes, 1,
zlog_debug("%s: connection closed", __func__);
FPM_RECONNECT(fnc);
- return 0;
+ return;
}
if (rv == -1) {
atomic_fetch_add_explicit(&fnc->counters.connection_errors, 1,
zlog_warn("%s: connection failure: %s", __func__,
strerror(errno));
FPM_RECONNECT(fnc);
- return 0;
+ return;
}
stream_reset(fnc->ibuf);
thread_add_read(fnc->fthread->master, fpm_read, fnc, fnc->socket,
&fnc->t_read);
-
- return 0;
}
-static int fpm_write(struct thread *t)
+static void fpm_write(struct thread *t)
{
struct fpm_nl_ctx *fnc = THREAD_ARG(t);
socklen_t statuslen;
memory_order_relaxed);
FPM_RECONNECT(fnc);
- return 0;
+ return;
}
fnc->connecting = false;
strerror(errno));
FPM_RECONNECT(fnc);
- return 0;
+ return;
}
/* Account all bytes sent. */
stream_pulldown(fnc->obuf);
thread_add_write(fnc->fthread->master, fpm_write, fnc,
fnc->socket, &fnc->t_write);
- return 0;
+ return;
}
-
- return 0;
}
-static int fpm_connect(struct thread *t)
+static void fpm_connect(struct thread *t)
{
struct fpm_nl_ctx *fnc = THREAD_ARG(t);
struct sockaddr_in *sin = (struct sockaddr_in *)&fnc->addr;
strerror(errno));
thread_add_timer(fnc->fthread->master, fpm_connect, fnc, 3,
&fnc->t_connect);
- return 0;
+ return;
}
set_nonblocking(sock);
strerror(errno));
thread_add_timer(fnc->fthread->master, fpm_connect, fnc, 3,
&fnc->t_connect);
- return 0;
+ return;
}
fnc->connecting = (errno == EINPROGRESS);
if (!fnc->connecting)
thread_add_timer(zrouter.master, fpm_lsp_reset, fnc, 0,
&fnc->t_lspreset);
-
- return 0;
}
/**
nl_buf_len += (size_t)rv;
break;
+ /* Un-handled by FPM at this time. */
case DPLANE_OP_PW_INSTALL:
case DPLANE_OP_PW_UNINSTALL:
case DPLANE_OP_ADDR_INSTALL:
case DPLANE_OP_SYS_ROUTE_DELETE:
case DPLANE_OP_ROUTE_NOTIFY:
case DPLANE_OP_LSP_NOTIFY:
+ case DPLANE_OP_RULE_ADD:
+ case DPLANE_OP_RULE_DELETE:
+ case DPLANE_OP_RULE_UPDATE:
+ case DPLANE_OP_NEIGH_DISCOVER:
+ case DPLANE_OP_BR_PORT_UPDATE:
+ case DPLANE_OP_IPTABLE_ADD:
+ case DPLANE_OP_IPTABLE_DELETE:
+ case DPLANE_OP_IPSET_ADD:
+ case DPLANE_OP_IPSET_DELETE:
+ case DPLANE_OP_IPSET_ENTRY_ADD:
+ case DPLANE_OP_IPSET_ENTRY_DELETE:
+ case DPLANE_OP_NEIGH_IP_INSTALL:
+ case DPLANE_OP_NEIGH_IP_DELETE:
+ case DPLANE_OP_NEIGH_TABLE_UPDATE:
+ case DPLANE_OP_GRE_SET:
+ case DPLANE_OP_INTF_ADDR_ADD:
+ case DPLANE_OP_INTF_ADDR_DEL:
+ case DPLANE_OP_INTF_NETCONFIG:
+ case DPLANE_OP_INTF_INSTALL:
+ case DPLANE_OP_INTF_UPDATE:
+ case DPLANE_OP_INTF_DELETE:
+ case DPLANE_OP_TC_INSTALL:
+ case DPLANE_OP_TC_UPDATE:
+ case DPLANE_OP_TC_DELETE:
case DPLANE_OP_NONE:
break;
- default:
- if (IS_ZEBRA_DEBUG_FPM)
- zlog_debug("%s: unhandled data plane message (%d) %s",
- __func__, dplane_ctx_get_op(ctx),
- dplane_op2str(dplane_ctx_get_op(ctx)));
- break;
}
/* Skip empty enqueues. */
return HASHWALK_CONTINUE;
}
-static int fpm_lsp_send(struct thread *t)
+static void fpm_lsp_send(struct thread *t)
{
struct fpm_nl_ctx *fnc = THREAD_ARG(t);
struct zebra_vrf *zvrf = vrf_info_lookup(VRF_DEFAULT);
thread_add_timer(zrouter.master, fpm_lsp_send, fnc, 0,
&fnc->t_lspwalk);
}
-
- return 0;
}
/*
return HASHWALK_CONTINUE;
}
-static int fpm_nhg_send(struct thread *t)
+static void fpm_nhg_send(struct thread *t)
{
struct fpm_nl_ctx *fnc = THREAD_ARG(t);
struct fpm_nhg_arg fna;
} else /* Otherwise reschedule next hop group again. */
thread_add_timer(zrouter.master, fpm_nhg_send, fnc, 0,
&fnc->t_nhgwalk);
-
- return 0;
}
/**
* Send all RIB installed routes to the connected data plane.
*/
-static int fpm_rib_send(struct thread *t)
+static void fpm_rib_send(struct thread *t)
{
struct fpm_nl_ctx *fnc = THREAD_ARG(t);
rib_dest_t *dest;
thread_add_timer(zrouter.master, fpm_rib_send,
fnc, 1, &fnc->t_ribwalk);
- return 0;
+ return;
}
/* Mark as sent. */
/* Schedule next event: RMAC reset. */
thread_add_event(zrouter.master, fpm_rmac_reset, fnc, 0,
&fnc->t_rmacreset);
-
- return 0;
}
/*
hash_iterate(zl3vni->rmac_table, fpm_enqueue_rmac_table, zl3vni);
}
-static int fpm_rmac_send(struct thread *t)
+static void fpm_rmac_send(struct thread *t)
{
struct fpm_rmac_arg fra;
/* RMAC walk completed. */
if (fra.complete)
WALK_FINISH(fra.fnc, FNE_RMAC_FINISHED);
-
- return 0;
}
/*
UNSET_FLAG(nhe->flags, NEXTHOP_GROUP_FPM);
}
-static int fpm_nhg_reset(struct thread *t)
+static void fpm_nhg_reset(struct thread *t)
{
struct fpm_nl_ctx *fnc = THREAD_ARG(t);
/* Schedule next step: send next hop groups. */
thread_add_event(zrouter.master, fpm_nhg_send, fnc, 0, &fnc->t_nhgwalk);
-
- return 0;
}
/*
UNSET_FLAG(lsp->flags, LSP_FLAG_FPM);
}
-static int fpm_lsp_reset(struct thread *t)
+static void fpm_lsp_reset(struct thread *t)
{
struct fpm_nl_ctx *fnc = THREAD_ARG(t);
struct zebra_vrf *zvrf = vrf_info_lookup(VRF_DEFAULT);
/* Schedule next step: send LSPs */
thread_add_event(zrouter.master, fpm_lsp_send, fnc, 0, &fnc->t_lspwalk);
-
- return 0;
}
/**
* Resets the RIB FPM flags so we send all routes again.
*/
-static int fpm_rib_reset(struct thread *t)
+static void fpm_rib_reset(struct thread *t)
{
struct fpm_nl_ctx *fnc = THREAD_ARG(t);
rib_dest_t *dest;
/* Schedule next step: send RIB routes. */
thread_add_event(zrouter.master, fpm_rib_send, fnc, 0, &fnc->t_ribwalk);
-
- return 0;
}
/*
hash_iterate(zl3vni->rmac_table, fpm_unset_rmac_table, zl3vni);
}
-static int fpm_rmac_reset(struct thread *t)
+static void fpm_rmac_reset(struct thread *t)
{
struct fpm_nl_ctx *fnc = THREAD_ARG(t);
/* Schedule next event: send RMAC entries. */
thread_add_event(zrouter.master, fpm_rmac_send, fnc, 0,
&fnc->t_rmacwalk);
-
- return 0;
}
-static int fpm_process_queue(struct thread *t)
+static void fpm_process_queue(struct thread *t)
{
struct fpm_nl_ctx *fnc = THREAD_ARG(t);
struct zebra_dplane_ctx *ctx;
* the output data in the STREAM_WRITEABLE
* check above, so we can ignore the return
*/
- (void)fpm_nl_enqueue(fnc, ctx);
+ if (fnc->socket != -1)
+ (void)fpm_nl_enqueue(fnc, ctx);
/* Account the processed entries. */
processed_contexts++;
*/
if (dplane_provider_out_ctx_queue_len(fnc->prov) > 0)
dplane_provider_work_ready();
-
- return 0;
}
/**
* Handles external (e.g. CLI, data plane or others) events.
*/
-static int fpm_process_event(struct thread *t)
+static void fpm_process_event(struct thread *t)
{
struct fpm_nl_ctx *fnc = THREAD_ARG(t);
int event = THREAD_VAL(t);
zlog_debug("%s: unhandled event %d", __func__, event);
break;
}
-
- return 0;
}
/*