#1:
When a switch gets a packet that doesn't correspond to an entry in the flow
tables, it will generally buffer it and associate this buffer with an opaque
buffer identifier. It will then send a packet_in message to the controller
that includes the buffer ID and *part* of the packet data itself (usually not
all of it).
However, if the switch runs out of buffer space, it is supposed to send a
buffer ID of all-bits-on (UNIT32_MAX) along with *all* of the packet data.
The code you posted checks to see which of these cases is being handled. If
buffer_id == UINT32_MAX, then the controller didn't buffer the packet. So it
should have sent the entire payload. The second if statement checks to make
sure this is actually the case.
If you remove this code, it will continue to operate the same unless the switch
decides not to buffer packets (because it ran out of buffers or for some other
reason).
#2:
send_openflow_command() sends any OpenFlow command (anything that starts with
an OpenFlow header). send_openflow_packet(), on the other hand, is a shortcut
specifically for sending ofp_packet_out messages.
#3:
You are mistaken about OFPT_PACKET_OUT -- it does not modify the flow table.
OFPT_FLOW_MOD does.
OFPT_PACKET_OUT is used to immediately send some piece of data (that has either
already been buffered in the switch or that the controller provides).
Hope that clears things up.
-- Murphy
On Dec 30, 2011, at 8:10 PM, 王健 wrote:
Hi all:
I'm a new comer of NOX, and want to know the mechanism of NOX, so i
see the codes of hub.cc at the beginning. There are some questions that
perplex me for a long time which i list as follows.
1) if (buffer_id == UINT32_MAX) {
size_t data_len = pi.get_buffer()-size();
size_t total_len = pi.total_len;
if (total_len == data_len) {
send_openflow_packe t(pi.datapath_id, *pi.get_buffer(),
OFPP_FLOOD, pi.in_port, true);
} else {
/* Control path didn't buffer the packet and didn't send us
* the whole thing--what gives? */
lg.dbg(total_len=%zu data_len=%zu\n, total_len, data_len);
}tion
There codes are in src/nox/coreapps/hub/hub.cc file. what is the function
of them?do they effect the function of hub.cc if remove ?
2) what is the differe nce between int send_openflow_command() and int
send_openflow_packet() which defined in src/nox/component.hh. I know both
are used for interacting with OF switch.
3)The type of controller/switch message contains OFPT_PACKET_OUT and
OFPT_FLOW_MOD. I think both of them are used to add/delete/modify flow table
entry in OF switch, am i right? I don't know what is the difference even if
refer to openflow-spec-1.0.0
would you like to tell me? Thank you very much, look forward to hear from
you~
Best Wishes
nbs
p;
Wang Jian
nbsp; Saturday,
December 31, 2011
___
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev
___
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev