[ovs-dev] Why updating ports upon ofproto_port_add?
Min Chen
ustcer.tonychan at gmail.com
Sat Mar 31 08:37:41 UTC 2012
Hi all,
I am reading source code of Open vSwitch 1.4.0. I have a question on
updating ports immediately upon ofproto_port_add
I searched this mailing list and I found Ben's
comment<http://openvswitch.org/pipermail/dev/2011-May/008561.html>on
updating ports after port_add. Ben wrote "I don't see a reason to
defer
this." But what dose update_port do?
ofproto.c
1103 int
1104 ofproto_port_add(struct ofproto *ofproto, struct netdev *netdev,
1105 uint16_t *ofp_portp)
1106 {
1107 uint16_t ofp_port;
1108 int error;
1109
1110 error = ofproto->ofproto_class->port_add(ofproto, netdev,
&ofp_port);
1111 if (!error) {
1112 update_port(ofproto, netdev_get_name(netdev));
1113 }
1114 if (ofp_portp) {
1115 *ofp_portp = error ? OFPP_NONE : ofp_port;
1116 }
1117 return error;
1118 }
Since netdev is opened before calling ofproto_port_add, why it's opened
again in update_port:
ofproto.c
1492 netdev = (!ofproto_port_query_by_name(ofproto, name, &ofproto_port)
1493 ? ofport_open(&ofproto_port, &opp)
1494 : NULL);
There are comments inside this update_port. But still I can't figure out
what this function does. Can anyone explain a bit to me? Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20120331/d47a4e1a/attachment-0003.html>
More information about the dev
mailing list