X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=ofproto%2Fofproto-dpif-monitor.c;h=054840016b2bd9c87479e5b13c13b7c8942c1078;hb=1b43cf9e68f4dd0dab4f9d3fa9dd80aeb642c139;hp=252a5d8b7036267c382ba9b858c3770c7f4c7116;hpb=0477baa93b44dc9221e61eddf92545c5d7c477d7;p=cascardo%2Fovs.git diff --git a/ofproto/ofproto-dpif-monitor.c b/ofproto/ofproto-dpif-monitor.c index 252a5d8b7..054840016 100644 --- a/ofproto/ofproto-dpif-monitor.c +++ b/ofproto/ofproto-dpif-monitor.c @@ -53,7 +53,7 @@ struct mport { struct cfm *cfm; /* Reference to cfm. */ struct bfd *bfd; /* Reference to bfd. */ struct lldp *lldp; /* Reference to lldp. */ - uint8_t hw_addr[OFP_ETH_ALEN]; /* Hardware address. */ + struct eth_addr hw_addr; /* Hardware address. */ }; /* Entry of the 'send_soon' list. Contains the pointer to the @@ -88,12 +88,13 @@ static void monitor_run(void); static void monitor_mport_run(struct mport *, struct dp_packet *); static void mport_register(const struct ofport_dpif *, struct bfd *, - struct cfm *, struct lldp *, uint8_t[ETH_ADDR_LEN]) + struct cfm *, struct lldp *, + const struct eth_addr *) OVS_REQUIRES(monitor_mutex); static void mport_unregister(const struct ofport_dpif *) OVS_REQUIRES(monitor_mutex); static void mport_update(struct mport *, struct bfd *, struct cfm *, - struct lldp *, uint8_t[ETH_ADDR_LEN]) + struct lldp *, const struct eth_addr *) OVS_REQUIRES(monitor_mutex); static struct mport *mport_find(const struct ofport_dpif *) OVS_REQUIRES(monitor_mutex); @@ -118,7 +119,8 @@ mport_find(const struct ofport_dpif *ofport) OVS_REQUIRES(monitor_mutex) * if it doesn't exist. Otherwise, just updates its fields. */ static void mport_register(const struct ofport_dpif *ofport, struct bfd *bfd, - struct cfm *cfm, struct lldp *lldp, uint8_t *hw_addr) + struct cfm *cfm, struct lldp *lldp, + const struct eth_addr *hw_addr) OVS_REQUIRES(monitor_mutex) { struct mport *mport = mport_find(ofport); @@ -150,7 +152,7 @@ mport_unregister(const struct ofport_dpif *ofport) /* Updates the fields of an existing mport struct. */ static void mport_update(struct mport *mport, struct bfd *bfd, struct cfm *cfm, - struct lldp *lldp, uint8_t hw_addr[ETH_ADDR_LEN]) + struct lldp *lldp, const struct eth_addr *hw_addr) OVS_REQUIRES(monitor_mutex) { ovs_assert(mport); @@ -167,8 +169,8 @@ mport_update(struct mport *mport, struct bfd *bfd, struct cfm *cfm, lldp_unref(mport->lldp); mport->lldp = lldp_ref(lldp); } - if (hw_addr && memcmp(mport->hw_addr, hw_addr, ETH_ADDR_LEN)) { - memcpy(mport->hw_addr, hw_addr, ETH_ADDR_LEN); + if (hw_addr && !eth_addr_equals(mport->hw_addr, *hw_addr)) { + mport->hw_addr = *hw_addr; } /* If bfd/cfm/lldp is added or reconfigured, move the mport on top of the heap * so that the monitor thread can run the mport next time it wakes up. */ @@ -316,7 +318,7 @@ void ofproto_dpif_monitor_port_update(const struct ofport_dpif *ofport, struct bfd *bfd, struct cfm *cfm, struct lldp *lldp, - uint8_t hw_addr[ETH_ADDR_LEN]) + const struct eth_addr *hw_addr) { ovs_mutex_lock(&monitor_mutex); if (!cfm && !bfd && !lldp) {