mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 22:35:15 +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:
41
lib/dpctl.c
41
lib/dpctl.c
@@ -933,10 +933,10 @@ dpctl_put_flow(int argc, const char *argv[], enum dpif_flow_put_flags flags,
|
||||
FOR_EACH_CORE_ON_NUMA (iter, dump) {
|
||||
if (ovs_numa_core_is_pinned(iter->core_id)) {
|
||||
error = dpif_flow_put(dpif, flags,
|
||||
ofpbuf_data(&key), ofpbuf_size(&key),
|
||||
ofpbuf_size(&mask) == 0 ? NULL : ofpbuf_data(&mask),
|
||||
ofpbuf_size(&mask), ofpbuf_data(&actions),
|
||||
ofpbuf_size(&actions), ufid_present ? &ufid : NULL,
|
||||
key.data, key.size,
|
||||
mask.size == 0 ? NULL : mask.data,
|
||||
mask.size, actions.data,
|
||||
actions.size, ufid_present ? &ufid : NULL,
|
||||
iter->core_id, dpctl_p->print_statistics ? &stats : NULL);
|
||||
}
|
||||
}
|
||||
@@ -946,10 +946,10 @@ dpctl_put_flow(int argc, const char *argv[], enum dpif_flow_put_flags flags,
|
||||
}
|
||||
} else {
|
||||
error = dpif_flow_put(dpif, flags,
|
||||
ofpbuf_data(&key), ofpbuf_size(&key),
|
||||
ofpbuf_size(&mask) == 0 ? NULL : ofpbuf_data(&mask),
|
||||
ofpbuf_size(&mask), ofpbuf_data(&actions),
|
||||
ofpbuf_size(&actions), ufid_present ? &ufid : NULL,
|
||||
key.data, key.size,
|
||||
mask.size == 0 ? NULL : mask.data,
|
||||
mask.size, actions.data,
|
||||
actions.size, ufid_present ? &ufid : NULL,
|
||||
PMD_ID_NULL, dpctl_p->print_statistics ? &stats : NULL);
|
||||
}
|
||||
if (error) {
|
||||
@@ -1123,8 +1123,8 @@ dpctl_del_flow(int argc, const char *argv[], struct dpctl_params *dpctl_p)
|
||||
|
||||
FOR_EACH_CORE_ON_NUMA (iter, dump) {
|
||||
if (ovs_numa_core_is_pinned(iter->core_id)) {
|
||||
error = dpif_flow_del(dpif, ofpbuf_data(&key),
|
||||
ofpbuf_size(&key), ufid_present ? &ufid : NULL,
|
||||
error = dpif_flow_del(dpif, key.data,
|
||||
key.size, ufid_present ? &ufid : NULL,
|
||||
iter->core_id, dpctl_p->print_statistics ? &stats : NULL);
|
||||
}
|
||||
}
|
||||
@@ -1133,7 +1133,7 @@ dpctl_del_flow(int argc, const char *argv[], struct dpctl_params *dpctl_p)
|
||||
error = EINVAL;
|
||||
}
|
||||
} else {
|
||||
error = dpif_flow_del(dpif, ofpbuf_data(&key), ofpbuf_size(&key),
|
||||
error = dpif_flow_del(dpif, key.data, key.size,
|
||||
ufid_present ? &ufid : NULL, PMD_ID_NULL,
|
||||
dpctl_p->print_statistics ? &stats : NULL);
|
||||
}
|
||||
@@ -1246,7 +1246,7 @@ dpctl_parse_actions(int argc, const char *argv[], struct dpctl_params* dpctl_p)
|
||||
}
|
||||
|
||||
ds_init(&s);
|
||||
format_odp_actions(&s, ofpbuf_data(&actions), ofpbuf_size(&actions));
|
||||
format_odp_actions(&s, actions.data, actions.size);
|
||||
dpctl_print(dpctl_p, "%s\n", ds_cstr(&s));
|
||||
ds_destroy(&s);
|
||||
|
||||
@@ -1390,12 +1390,11 @@ dpctl_normalize_actions(int argc, const char *argv[],
|
||||
}
|
||||
|
||||
ds_clear(&s);
|
||||
odp_flow_format(ofpbuf_data(&keybuf), ofpbuf_size(&keybuf), NULL, 0, NULL,
|
||||
odp_flow_format(keybuf.data, keybuf.size, NULL, 0, NULL,
|
||||
&s, dpctl_p->verbosity);
|
||||
dpctl_print(dpctl_p, "input flow: %s\n", ds_cstr(&s));
|
||||
|
||||
error = odp_flow_key_to_flow(ofpbuf_data(&keybuf), ofpbuf_size(&keybuf),
|
||||
&flow);
|
||||
error = odp_flow_key_to_flow(keybuf.data, keybuf.size, &flow);
|
||||
if (error) {
|
||||
dpctl_error(dpctl_p, error, "odp_flow_key_to_flow");
|
||||
goto out_freekeybuf;
|
||||
@@ -1411,14 +1410,12 @@ dpctl_normalize_actions(int argc, const char *argv[],
|
||||
|
||||
if (dpctl_p->verbosity) {
|
||||
ds_clear(&s);
|
||||
format_odp_actions(&s, ofpbuf_data(&odp_actions),
|
||||
ofpbuf_size(&odp_actions));
|
||||
format_odp_actions(&s, odp_actions.data, odp_actions.size);
|
||||
dpctl_print(dpctl_p, "input actions: %s\n", ds_cstr(&s));
|
||||
}
|
||||
|
||||
hmap_init(&actions_per_flow);
|
||||
NL_ATTR_FOR_EACH (a, left, ofpbuf_data(&odp_actions),
|
||||
ofpbuf_size(&odp_actions)) {
|
||||
NL_ATTR_FOR_EACH (a, left, odp_actions.data, odp_actions.size) {
|
||||
const struct ovs_action_push_vlan *push;
|
||||
switch(nl_attr_type(a)) {
|
||||
case OVS_ACTION_ATTR_POP_VLAN:
|
||||
@@ -1451,8 +1448,7 @@ dpctl_normalize_actions(int argc, const char *argv[],
|
||||
for (i = 0; i < n_afs; i++) {
|
||||
struct actions_for_flow *af = afs[i];
|
||||
|
||||
sort_output_actions(ofpbuf_data(&af->actions),
|
||||
ofpbuf_size(&af->actions));
|
||||
sort_output_actions(af->actions.data, af->actions.size);
|
||||
|
||||
if (af->flow.vlan_tci != htons(0)) {
|
||||
dpctl_print(dpctl_p, "vlan(vid=%"PRIu16",pcp=%d): ",
|
||||
@@ -1472,8 +1468,7 @@ dpctl_normalize_actions(int argc, const char *argv[],
|
||||
}
|
||||
|
||||
ds_clear(&s);
|
||||
format_odp_actions(&s, ofpbuf_data(&af->actions),
|
||||
ofpbuf_size(&af->actions));
|
||||
format_odp_actions(&s, af->actions.data, af->actions.size);
|
||||
dpctl_print(dpctl_p, ds_cstr(&s));
|
||||
|
||||
ofpbuf_uninit(&af->actions);
|
||||
|
Reference in New Issue
Block a user