mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
dpif: Factor 'type' and 'error' out of individual dpif_op members.
I'd like to change ->dpif_flow_put() and ->dpif_execute() in the dpif provider to take the structures of the same names as parameters, instead of passing them discrete parameters, because this seems like a more sensible way to do things internally than to have two different ways to pass the parameters. It might even simplify code slightly. But ->flow_put() and ->execute() wouldn't want the 'type' (because it's implied by the function being called) or 'error' (because it would be the same as the return value). Although of course they could just ignore those members, it seems slightly cleaner to omit them entirely, as this change allows. Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
24
lib/dpif.c
24
lib/dpif.c
@@ -984,7 +984,7 @@ dpif_execute(struct dpif *dpif,
|
||||
* This function exists because some datapaths can perform batched operations
|
||||
* faster than individual operations. */
|
||||
void
|
||||
dpif_operate(struct dpif *dpif, union dpif_op **ops, size_t n_ops)
|
||||
dpif_operate(struct dpif *dpif, struct dpif_op **ops, size_t n_ops)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@@ -994,25 +994,25 @@ dpif_operate(struct dpif *dpif, union dpif_op **ops, size_t n_ops)
|
||||
}
|
||||
|
||||
for (i = 0; i < n_ops; i++) {
|
||||
union dpif_op *op = ops[i];
|
||||
struct dpif_op *op = ops[i];
|
||||
struct dpif_flow_put *put;
|
||||
struct dpif_execute *execute;
|
||||
|
||||
switch (op->type) {
|
||||
case DPIF_OP_FLOW_PUT:
|
||||
put = &op->flow_put;
|
||||
put->error = dpif_flow_put(dpif, put->flags,
|
||||
put->key, put->key_len,
|
||||
put->actions, put->actions_len,
|
||||
put->stats);
|
||||
put = &op->u.flow_put;
|
||||
op->error = dpif_flow_put(dpif, put->flags,
|
||||
put->key, put->key_len,
|
||||
put->actions, put->actions_len,
|
||||
put->stats);
|
||||
break;
|
||||
|
||||
case DPIF_OP_EXECUTE:
|
||||
execute = &op->execute;
|
||||
execute->error = dpif_execute(dpif, execute->key, execute->key_len,
|
||||
execute->actions,
|
||||
execute->actions_len,
|
||||
execute->packet);
|
||||
execute = &op->u.execute;
|
||||
op->error = dpif_execute(dpif, execute->key, execute->key_len,
|
||||
execute->actions,
|
||||
execute->actions_len,
|
||||
execute->packet);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Reference in New Issue
Block a user