summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f11c753)
send_len is not directly part of the OpenFlow packet_in message, at least
given that it is partially redundant with packet_len. send_len is, rather,
a request to the connmgr that expresses how many bytes the action requested
be sent to the controller, but the connmgr cannot always honor it.
Signed-off-by: Ben Pfaff <blp@nicira.com>
enum ofputil_protocol protocol,
enum nx_packet_in_format packet_in_format)
{
enum ofputil_protocol protocol,
enum nx_packet_in_format packet_in_format)
{
- size_t send_len = MIN(pin->send_len, pin->packet_len);
struct ofpbuf *packet;
/* Add OFPT_PACKET_IN. */
struct ofpbuf *packet;
/* Add OFPT_PACKET_IN. */
/* The final argument is just an estimate of the space required. */
packet = ofpraw_alloc_xid(packet_in_raw, packet_in_version,
htonl(0), (sizeof(struct flow_metadata) * 2
/* The final argument is just an estimate of the space required. */
packet = ofpraw_alloc_xid(packet_in_raw, packet_in_version,
htonl(0), (sizeof(struct flow_metadata) * 2
+ + 2 + pin->packet_len));
ofpbuf_put_zeros(packet, packet_in_size);
oxm_put_match(packet, &match);
ofpbuf_put_zeros(packet, 2);
ofpbuf_put_zeros(packet, packet_in_size);
oxm_put_match(packet, &match);
ofpbuf_put_zeros(packet, 2);
- ofpbuf_put(packet, pin->packet, send_len);
+ ofpbuf_put(packet, pin->packet, pin->packet_len);
opi = packet->l3;
opi->pi.buffer_id = htonl(pin->buffer_id);
opi = packet->l3;
opi->pi.buffer_id = htonl(pin->buffer_id);
struct ofp10_packet_in *opi;
packet = ofpraw_alloc_xid(OFPRAW_OFPT10_PACKET_IN, OFP10_VERSION,
struct ofp10_packet_in *opi;
packet = ofpraw_alloc_xid(OFPRAW_OFPT10_PACKET_IN, OFP10_VERSION,
+ htonl(0), pin->packet_len);
opi = ofpbuf_put_zeros(packet, offsetof(struct ofp10_packet_in, data));
opi->total_len = htons(pin->total_len);
opi->in_port = htons(ofp_to_u16(pin->fmd.in_port));
opi->reason = pin->reason;
opi->buffer_id = htonl(pin->buffer_id);
opi = ofpbuf_put_zeros(packet, offsetof(struct ofp10_packet_in, data));
opi->total_len = htons(pin->total_len);
opi->in_port = htons(ofp_to_u16(pin->fmd.in_port));
opi->reason = pin->reason;
opi->buffer_id = htonl(pin->buffer_id);
- ofpbuf_put(packet, pin->packet, send_len);
+ ofpbuf_put(packet, pin->packet, pin->packet_len);
} else if (packet_in_format == NXPIF_NXM) {
struct nx_packet_in *npi;
struct match match;
} else if (packet_in_format == NXPIF_NXM) {
struct nx_packet_in *npi;
struct match match;
/* The final argument is just an estimate of the space required. */
packet = ofpraw_alloc_xid(OFPRAW_NXT_PACKET_IN, OFP10_VERSION,
htonl(0), (sizeof(struct flow_metadata) * 2
/* The final argument is just an estimate of the space required. */
packet = ofpraw_alloc_xid(OFPRAW_NXT_PACKET_IN, OFP10_VERSION,
htonl(0), (sizeof(struct flow_metadata) * 2
+ + 2 + pin->packet_len));
ofpbuf_put_zeros(packet, sizeof *npi);
match_len = nx_put_match(packet, &match, 0, 0);
ofpbuf_put_zeros(packet, 2);
ofpbuf_put_zeros(packet, sizeof *npi);
match_len = nx_put_match(packet, &match, 0, 0);
ofpbuf_put_zeros(packet, 2);
- ofpbuf_put(packet, pin->packet, send_len);
+ ofpbuf_put(packet, pin->packet, pin->packet_len);
npi = packet->l3;
npi->buffer_id = htonl(pin->buffer_id);
npi = packet->l3;
npi->buffer_id = htonl(pin->buffer_id);
ovs_be64 cookie;
uint32_t buffer_id;
ovs_be64 cookie;
uint32_t buffer_id;
uint16_t total_len; /* Full length of frame. */
struct flow_metadata fmd; /* Metadata at creation time. */
uint16_t total_len; /* Full length of frame. */
struct flow_metadata fmd; /* Metadata at creation time. */
pin.up.total_len = pin.up.packet_len;
if (pin.up.reason == OFPR_ACTION) {
pin.up.total_len = pin.up.packet_len;
if (pin.up.reason == OFPR_ACTION) {
- controller_max_len = pin.up.send_len; /* max_len */
+ controller_max_len = pin.send_len; /* max_len */
} else {
controller_max_len = ofconn->miss_send_len;
}
} else {
controller_max_len = ofconn->miss_send_len;
}
/* Figure out how much of the packet to send.
* If not buffered, send the entire packet. Otherwise, depending on
* the reason of packet-in, send what requested by the controller. */
/* Figure out how much of the packet to send.
* If not buffered, send the entire packet. Otherwise, depending on
* the reason of packet-in, send what requested by the controller. */
- if (pin.up.buffer_id == UINT32_MAX) {
- pin.up.send_len = pin.up.packet_len;
- } else {
- pin.up.send_len = MIN(pin.up.packet_len, controller_max_len);
+ if (pin.up.buffer_id != UINT32_MAX
+ && controller_max_len < pin.up.packet_len) {
+ pin.up.packet_len = controller_max_len;
}
/* Make OFPT_PACKET_IN and hand over to packet scheduler. It might
}
/* Make OFPT_PACKET_IN and hand over to packet scheduler. It might
struct ofputil_packet_in up;
struct list list_node; /* For queuing. */
uint16_t controller_id; /* Controller ID to send to. */
struct ofputil_packet_in up;
struct list list_node; /* For queuing. */
uint16_t controller_id; /* Controller ID to send to. */
+ int send_len; /* Length that the action requested sending. */
pin.up.packet = b.data;
pin.up.packet_len = b.size;
pin.up.reason = OFPR_NO_MATCH;
pin.up.packet = b.data;
pin.up.packet_len = b.size;
pin.up.reason = OFPR_NO_MATCH;
- pin.up.send_len = b.size;
pin.up.fmd.in_port = OFPP_LOCAL;
pin.up.fmd.in_port = OFPP_LOCAL;
connmgr_send_packet_in(fo->connmgr, &pin);
ofpbuf_uninit(&b);
connmgr_send_packet_in(fo->connmgr, &pin);
ofpbuf_uninit(&b);
pin->up.reason = OFPR_NO_MATCH;
pin->up.table_id = 0;
pin->up.cookie = 0;
pin->up.reason = OFPR_NO_MATCH;
pin->up.table_id = 0;
pin->up.cookie = 0;
- pin->up.send_len = 0; /* Not used for flow table misses. */
flow_get_metadata(&miss->flow, &pin->up.fmd);
flow_get_metadata(&miss->flow, &pin->up.fmd);
- pin->controller_id = 0;
+ pin->send_len = 0; /* Not used for flow table misses. */
ofproto_dpif_send_packet_in(miss->ofproto, pin);
}
}
ofproto_dpif_send_packet_in(miss->ofproto, pin);
}
}
pin->up.table_id = ctx->table_id;
pin->up.cookie = ctx->rule ? rule_dpif_get_flow_cookie(ctx->rule) : 0;
pin->up.table_id = ctx->table_id;
pin->up.cookie = ctx->rule ? rule_dpif_get_flow_cookie(ctx->rule) : 0;
- pin->up.send_len = len;
flow_get_metadata(&ctx->xin->flow, &pin->up.fmd);
pin->controller_id = controller_id;
flow_get_metadata(&ctx->xin->flow, &pin->up.fmd);
pin->controller_id = controller_id;
ofproto_dpif_send_packet_in(ctx->xbridge->ofproto, pin);
ofpbuf_delete(packet);
}
ofproto_dpif_send_packet_in(ctx->xbridge->ofproto, pin);
ofpbuf_delete(packet);
}