This patch adds support for lldpd fast start.
The feature is currently disabled by default.
A cli command to enable the feature is in the
works.
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
levent_send_pdu(evutil_socket_t fd, short what, void *arg)
{
struct lldpd_hardware *hardware = arg;
+ int tx_interval;
+
log_debug("event", "trigger sending PDU for port %s",
hardware->h_ifname);
lldpd_send(hardware);
- struct timeval tv = { hardware->h_cfg->g_config.c_tx_interval, 0 };
+ if (hardware->h_tx_fast > 0)
+ hardware->h_tx_fast--;
+
+ if (hardware->h_tx_fast > 0)
+ tx_interval = hardware->h_cfg->g_config.c_tx_fast_interval;
+ else
+ tx_interval = hardware->h_cfg->g_config.c_tx_interval;
+ struct timeval tv = { tx_interval, 0 };
if (event_add(hardware->h_timer, &tv) == -1) {
log_warnx("event", "unable to re-register timer event for port %s",
hardware->h_ifname);
agent_notify(hardware, i, port);
#endif
+ if (!oport) {
+ /* New neighbor, fast start */
+ if (hardware->h_cfg->g_config.c_enable_fast_start &&
+ !hardware->h_tx_fast) {
+ log_debug("decode", "%s: Entering fast start due to "
+ "new neighbor\n", hardware->h_ifname);
+ hardware->h_tx_fast = hardware->h_cfg->g_config.c_tx_fast_init;
+ }
+
+ levent_schedule_pdu(hardware);
+ }
+
return;
}
int smart = 15;
int receiveonly = 0;
int ctl;
+ int enable_fast_start = 0;
/* Non privileged user */
struct passwd *user;
cfg->g_config.c_receiveonly = receiveonly;
cfg->g_config.c_tx_interval = LLDPD_TX_INTERVAL;
cfg->g_config.c_max_neighbors = LLDPD_MAX_NEIGHBORS;
+ cfg->g_config.c_enable_fast_start = enable_fast_start;
+ cfg->g_config.c_tx_fast_init = LLDPD_FAST_INIT;
+ cfg->g_config.c_tx_fast_interval = LLDPD_FAST_TX_INTERVAL;
#ifdef USE_SNMP
cfg->g_snmp = snmp;
cfg->g_snmp_agentx = agentx;
#define LLDPD_TX_MSGDELAY 1
#define LLDPD_MAX_NEIGHBORS 4
#define LLDPD_PID_FILE "/var/run/lldpd.pid"
+#define LLDPD_FAST_TX_INTERVAL 1
+#define LLDPD_FAST_INIT 4
#define USING_AGENTX_SUBAGENT_MODULE 1
#ifdef ENABLE_LLDPMED
int c_noinventory; /* Don't send inventory with LLDP-MED */
#endif
+ int c_enable_fast_start; /* enable fast start */
+ int c_tx_fast_init; /* Num of lldpd lldppdu's for fast start */
+ int c_tx_fast_interval; /* Time intr between sends during fast start */
};
MARSHAL_BEGIN(lldpd_config)
MARSHAL_STR(lldpd_config, c_mgmt_pattern)
u_int16_t h_lport_cksum; /* Checksum on local port to see if there is a change */
struct lldpd_port h_lport; /* Port attached to this hardware port */
TAILQ_HEAD(, lldpd_port) h_rports; /* Remote ports */
+
+ int h_tx_fast; /* current tx fast start count */
};
MARSHAL_BEGIN(lldpd_hardware)
MARSHAL_IGNORE(lldpd_hardware, h_entries.tqe_next)