diff options
author | Ethan Jackson <ethan@nicira.com> | 2011-03-22 16:57:43 -0700 |
---|---|---|
committer | Ethan Jackson <ethan@nicira.com> | 2011-03-23 13:16:38 -0700 |
commit | a58727fb4007caf91d6eb615a123f161e4f4b9af (patch) | |
tree | c1c1751c71c8fc7c8bef110d54e6695ed697410c /ofproto | |
parent | 40f78b38e745019e08b3cfe06ddf205f0cc4b970 (diff) |
cfm: cfm_run() return ccm instead of packet.
It doesn't really make sense for the CFM code to be composing
packets. Its caller is better placed to compose the appropriate
L2 header. This commit pulls that logic out of the CFM library.
Diffstat (limited to 'ofproto')
-rw-r--r-- | ofproto/ofproto.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 72ec8dd9..e0715b9b 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -991,7 +991,6 @@ ofproto_iface_set_cfm(struct ofproto *ofproto, uint32_t port_no, ofport->cfm->mpid = cfm->mpid; ofport->cfm->interval = cfm->interval; - memcpy(ofport->cfm->eth_src, cfm->eth_src, ETH_ADDR_LEN); memcpy(ofport->cfm->maid, cfm->maid, CCM_MAID_LEN); cfm_update_remote_mps(ofport->cfm, remote_mps, n_remote_mps); @@ -1729,10 +1728,18 @@ static void ofport_run(struct ofproto *ofproto, struct ofport *ofport) { if (ofport->cfm) { - struct ofpbuf *packet = cfm_run(ofport->cfm); - if (packet) { - ofproto_send_packet(ofproto, ofport->odp_port, 0, packet); - ofpbuf_delete(packet); + cfm_run(ofport->cfm); + + if (cfm_should_send_ccm(ofport->cfm)) { + struct ofpbuf packet; + struct ccm *ccm; + + ofpbuf_init(&packet, 0); + ccm = compose_packet(&packet, eth_addr_ccm, ofport->opp.hw_addr, + ETH_TYPE_CFM, sizeof *ccm); + cfm_compose_ccm(ofport->cfm, ccm); + ofproto_send_packet(ofproto, ofport->odp_port, 0, &packet); + ofpbuf_uninit(&packet); } } } |