mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
odp-util: Convert flow serialization parameters to a struct.
Serializing between userspace flows and netlink attributes currently requires several additional parameters besides the flows themselves. This will continue to grow in the future as well. This converts the function arguments to a parameters struct, which makes the code easier to read and allowing irrelevant arguments to be omitted. Signed-off-by: Jesse Gross <jesse@nicira.com> Signed-off-by: Andy Zhou <azhou@nicira.com>
This commit is contained in:
@@ -1815,22 +1815,27 @@ dp_netdev_flow_to_dpif_flow(const struct dp_netdev_flow *netdev_flow,
|
||||
struct flow_wildcards wc;
|
||||
struct dp_netdev_actions *actions;
|
||||
size_t offset;
|
||||
struct odp_flow_key_parms odp_parms = {
|
||||
.flow = &netdev_flow->flow,
|
||||
.mask = &wc.masks,
|
||||
.recirc = true,
|
||||
.max_mpls_depth = SIZE_MAX,
|
||||
};
|
||||
|
||||
miniflow_expand(&netdev_flow->cr.mask->mf, &wc.masks);
|
||||
|
||||
/* Key */
|
||||
offset = key_buf->size;
|
||||
flow->key = ofpbuf_tail(key_buf);
|
||||
odp_flow_key_from_flow(key_buf, &netdev_flow->flow, &wc.masks,
|
||||
netdev_flow->flow.in_port.odp_port, true);
|
||||
odp_parms.odp_in_port = netdev_flow->flow.in_port.odp_port;
|
||||
odp_flow_key_from_flow(&odp_parms, key_buf);
|
||||
flow->key_len = key_buf->size - offset;
|
||||
|
||||
/* Mask */
|
||||
offset = mask_buf->size;
|
||||
flow->mask = ofpbuf_tail(mask_buf);
|
||||
odp_flow_key_from_mask(mask_buf, &wc.masks, &netdev_flow->flow,
|
||||
odp_to_u32(wc.masks.in_port.odp_port),
|
||||
SIZE_MAX, true);
|
||||
odp_parms.odp_in_port = wc.masks.in_port.odp_port;
|
||||
odp_flow_key_from_mask(&odp_parms, mask_buf);
|
||||
flow->mask_len = mask_buf->size - offset;
|
||||
|
||||
/* Actions */
|
||||
@@ -3008,10 +3013,15 @@ dp_netdev_upcall(struct dp_netdev_pmd_thread *pmd, struct dp_packet *packet_,
|
||||
struct ds ds = DS_EMPTY_INITIALIZER;
|
||||
char *packet_str;
|
||||
struct ofpbuf key;
|
||||
struct odp_flow_key_parms odp_parms = {
|
||||
.flow = flow,
|
||||
.mask = &wc->masks,
|
||||
.odp_in_port = flow->in_port.odp_port,
|
||||
.recirc = true,
|
||||
};
|
||||
|
||||
ofpbuf_init(&key, 0);
|
||||
odp_flow_key_from_flow(&key, flow, &wc->masks, flow->in_port.odp_port,
|
||||
true);
|
||||
odp_flow_key_from_flow(&odp_parms, &key);
|
||||
packet_str = ofp_packet_to_string(dp_packet_data(packet_),
|
||||
dp_packet_size(packet_));
|
||||
|
||||
|
Reference in New Issue
Block a user