* fields in 'wc' that were used to make the determination.
*/
bool
-lldp_should_process_flow(const struct flow *flow)
+lldp_should_process_flow(struct lldp *lldp, const struct flow *flow)
{
- return (flow->dl_type == htons(ETH_TYPE_LLDP));
+ return (flow->dl_type == htons(ETH_TYPE_LLDP) && lldp->enabled);
}
ret = timer_expired(&cfg->tx_timer);
ovs_mutex_unlock(&mutex);
+ /* LLDP must be enabled */
+ ret &= cfg->enabled;
+
return ret;
}
{
long long int retval;
- if (!lldp) {
+ if (!lldp || !lldp->enabled) {
return LLONG_MAX;
}
/* Configures the LLDP stack.
*/
bool
-lldp_configure(struct lldp *lldp) OVS_EXCLUDED(mutex)
+lldp_configure(struct lldp *lldp, const struct smap *cfg) OVS_EXCLUDED(mutex)
{
if (lldp) {
+ if (cfg && smap_get_bool(cfg, "enable", false)) {
+ lldp->enabled = true;
+ } else {
+ lldp->enabled = false;
+ }
+
ovs_mutex_lock(&mutex);
timer_set_expired(&lldp->tx_timer);
timer_set_duration(&lldp->tx_timer, LLDP_DEFAULT_TRANSMIT_INTERVAL_MS);
struct hmap mappings_by_aux; /* "struct" indexed by aux */
struct ovs_list active_mapping_queue;
struct ovs_refcount ref_cnt;
+ bool enabled; /* LLDP enabled on port */
};
/* Configuration specific to Auto Attach.
long long int lldp_wake_time(const struct lldp *lldp);
void lldp_run(struct lldpd *cfg);
bool lldp_should_send_packet(struct lldp *cfg);
-bool lldp_should_process_flow(const struct flow *flow);
-bool lldp_configure(struct lldp *lldp);
+bool lldp_should_process_flow(struct lldp *lldp, const struct flow *flow);
+bool lldp_configure(struct lldp *lldp, const struct smap *cfg);
void lldp_process_packet(struct lldp *cfg, const struct dp_packet *);
void lldp_put_packet(struct lldp *lldp, struct dp_packet *packet,
uint8_t eth_src[ETH_ADDR_LEN]);
: rstp_process_packet(xport, packet);
}
return SLOW_STP;
- } else if (xport->lldp && lldp_should_process_flow(flow)) {
+ } else if (xport->lldp && lldp_should_process_flow(xport->lldp, flow)) {
if (packet) {
lldp_process_packet(xport->lldp, packet);
}
ofport->lldp = lldp_create(ofport->up.netdev, ofport_->mtu, cfg);
}
- if (lldp_configure(ofport->lldp)) {
- error = 0;
- goto out;
+ if (!lldp_configure(ofport->lldp, cfg)) {
+ error = EINVAL;
}
-
- error = EINVAL;
}
- lldp_unref(ofport->lldp);
- ofport->lldp = NULL;
-out:
+ if (error) {
+ lldp_unref(ofport->lldp);
+ ofport->lldp = NULL;
+ }
+
ofproto_dpif_monitor_port_update(ofport,
ofport->bfd,
ofport->cfm,