mirror of
https://github.com/openvswitch/ovs
synced 2025-09-01 06:45:17 +00:00
ofpbuf: Simplify ofpbuf API.
ofpbuf was complicated due to its wide usage across all layers of OVS, Now we have introduced independent dp_packet which can be used for datapath packet, we can simplify ofpbuf. Following patch removes DPDK mbuf and access API of ofpbuf members. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -364,12 +364,12 @@ lswitch_process_packet(struct lswitch *sw, const struct ofpbuf *msg)
|
||||
|
||||
switch (type) {
|
||||
case OFPTYPE_ECHO_REQUEST:
|
||||
process_echo_request(sw, ofpbuf_data(msg));
|
||||
process_echo_request(sw, msg->data);
|
||||
break;
|
||||
|
||||
case OFPTYPE_FEATURES_REPLY:
|
||||
if (sw->state == S_FEATURES_REPLY) {
|
||||
if (!process_switch_features(sw, ofpbuf_data(msg))) {
|
||||
if (!process_switch_features(sw, msg->data)) {
|
||||
sw->state = S_SWITCHING;
|
||||
} else {
|
||||
rconn_disconnect(sw->rconn);
|
||||
@@ -378,7 +378,7 @@ lswitch_process_packet(struct lswitch *sw, const struct ofpbuf *msg)
|
||||
break;
|
||||
|
||||
case OFPTYPE_PACKET_IN:
|
||||
process_packet_in(sw, ofpbuf_data(msg));
|
||||
process_packet_in(sw, msg->data);
|
||||
break;
|
||||
|
||||
case OFPTYPE_FLOW_REMOVED:
|
||||
@@ -451,7 +451,7 @@ lswitch_process_packet(struct lswitch *sw, const struct ofpbuf *msg)
|
||||
case OFPTYPE_BUNDLE_ADD_MESSAGE:
|
||||
default:
|
||||
if (VLOG_IS_DBG_ENABLED()) {
|
||||
char *s = ofp_to_string(ofpbuf_data(msg), ofpbuf_size(msg), 2);
|
||||
char *s = ofp_to_string(msg->data, msg->size, 2);
|
||||
VLOG_DBG_RL(&rl, "%016llx: OpenFlow packet ignored: %s",
|
||||
sw->datapath_id, s);
|
||||
free(s);
|
||||
@@ -656,8 +656,8 @@ process_packet_in(struct lswitch *sw, const struct ofp_header *oh)
|
||||
po.packet_len = 0;
|
||||
}
|
||||
po.in_port = pi.fmd.in_port;
|
||||
po.ofpacts = ofpbuf_data(&ofpacts);
|
||||
po.ofpacts_len = ofpbuf_size(&ofpacts);
|
||||
po.ofpacts = ofpacts.data;
|
||||
po.ofpacts_len = ofpacts.size;
|
||||
|
||||
/* Send the packet, and possibly the whole flow, to the output port. */
|
||||
if (sw->max_idle >= 0 && (!sw->ml || out_port != OFPP_FLOOD)) {
|
||||
@@ -675,8 +675,8 @@ process_packet_in(struct lswitch *sw, const struct ofp_header *oh)
|
||||
fm.idle_timeout = sw->max_idle;
|
||||
fm.buffer_id = pi.buffer_id;
|
||||
fm.out_port = OFPP_NONE;
|
||||
fm.ofpacts = ofpbuf_data(&ofpacts);
|
||||
fm.ofpacts_len = ofpbuf_size(&ofpacts);
|
||||
fm.ofpacts = ofpacts.data;
|
||||
fm.ofpacts_len = ofpacts.size;
|
||||
buffer = ofputil_encode_flow_mod(&fm, sw->protocol);
|
||||
|
||||
queue_tx(sw, buffer);
|
||||
|
Reference in New Issue
Block a user