[ovs-dev] [async-msgs 05/13] ofp-util: Add struct ofputil_packet_out, helper functions, and use it all.
Ethan Jackson
ethan at nicira.com
Mon Feb 6 21:59:05 UTC 2012
>
> (Only meaningful if buffer_id == -1.) */
> + /* Followed by:
> + * - Exactly 'actions_len' bytes (possibly 0 bytes, and always a
> multiple
> + * of 8) containing actions.
> + * - If 'buffer_id' != -1, packet data to fill out the remainder of
> the
> + * message length.
> + */
>
I think you mean "If 'buffer_id' == -1".
> + if (po->in_port >= OFPP_MAX && po->in_port != OFPP_NONE) {
> + VLOG_WARN_RL(&bad_ofmsg_rl, "packet-out has bad input port
> %#"PRIx16,
> + po->in_port);
> + return OFPERR_NXBRC_BAD_IN_PORT;
> + }
>
OFPP_LOCAL is also a valid input port.
> + if (po.in_port >= OFPP_MAX && po.in_port != OFPP_LOCAL
> + && po.in_port != OFPP_NONE) {
> return OFPERR_NXBRC_BAD_IN_PORT;
> }
>
This check is now redundant since ofptuil_decode_packet_out() does the same
validation.
Otherwise looks good,
Ethan
>
> /* Send out packet. */
> - flow_extract(&payload, 0, 0, in_port, &flow);
> - error = p->ofproto_class->packet_out(p, &payload, &flow,
> - ofp_actions, n_ofp_actions);
> - ofpbuf_delete(buffer);
> + flow_extract(payload, 0, 0, po.in_port, &flow);
> + error = p->ofproto_class->packet_out(p, payload, &flow,
> + po.actions, po.n_actions);
> + ofpbuf_delete(payload);
>
> return error;
> }
> @@ -2932,7 +2921,7 @@ handle_openflow__(struct ofconn *ofconn, const
> struct ofpbuf *msg)
> return handle_set_config(ofconn, msg->data);
>
> case OFPUTIL_OFPT_PACKET_OUT:
> - return handle_packet_out(ofconn, oh);
> + return handle_packet_out(ofconn, msg->data);
>
> case OFPUTIL_OFPT_PORT_MOD:
> return handle_port_mod(ofconn, oh);
> diff --git a/tests/ofp-print.at b/tests/ofp-print.at
> index 85562b6..cfa8d83 100644
> --- a/tests/ofp-print.at
> +++ b/tests/ofp-print.at
> @@ -315,7 +315,7 @@ b9 7c c0 a8 00 02 c0 a8 00 01 00 00 2b 60 00 00 \
> 00 00 6a 4f 2b 58 50 14 00 00 6d 75 00 00 00 00 \
> 00 00 00 00 \
> "], [0], [dnl
> -OFPT_PACKET_OUT (xid=0x0): in_port=1 actions_len=8 actions=output:3
> buffer=0x00000114
> +OFPT_PACKET_OUT (xid=0x0): in_port=1 actions=output:3 buffer=0x00000114
> ])
> AT_CLEANUP
>
> --
> 1.7.2.5
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20120206/ae3e1391/attachment-0003.html>
More information about the dev
mailing list