Skip to content

Commit

Permalink
ofproto-dpif-xlate: Remove unused fitnessp pararameter from xlate_rec…
Browse files Browse the repository at this point in the history
…eive

Some functions pass a non-NULL value as this parameter
but none of those function uses the value xlate_receive()
returns there. So simply remove the parameter all together.

Also remove the now unused key_fitness field of struct flow_miss.

Signed-off-by: Simon Horman <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
horms authored and blp committed Feb 3, 2014
1 parent 29dd5cb commit 836fbda
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 25 deletions.
7 changes: 3 additions & 4 deletions ofproto/ofproto-dpif-upcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ struct flow_miss {
struct ofproto_dpif *ofproto;

struct flow flow;
enum odp_key_fitness key_fitness;
const struct nlattr *key;
size_t key_len;
enum dpif_upcall_type upcall_type;
Expand Down Expand Up @@ -941,7 +940,7 @@ handle_upcalls(struct handler *handler, struct list *upcalls)
int error;

error = xlate_receive(udpif->backer, packet, dupcall->key,
dupcall->key_len, &flow, &miss->key_fitness,
dupcall->key_len, &flow,
&ofproto, &ipfix, &sflow, NULL, &odp_in_port);
if (error) {
if (error == ENODEV) {
Expand Down Expand Up @@ -1300,7 +1299,7 @@ revalidate_ukey(struct udpif *udpif, struct udpif_flow_dump *udump,
}

error = xlate_receive(udpif->backer, NULL, ukey->key, ukey->key_len, &flow,
NULL, &ofproto, NULL, NULL, NULL, &odp_in_port);
&ofproto, NULL, NULL, NULL, &odp_in_port);
if (error) {
goto exit;
}
Expand Down Expand Up @@ -1463,7 +1462,7 @@ revalidate_udumps(struct revalidator *revalidator, struct list *udumps)
struct flow flow;

if (!xlate_receive(udpif->backer, NULL, ops[i].op.u.flow_del.key,
ops[i].op.u.flow_del.key_len, &flow, NULL,
ops[i].op.u.flow_del.key_len, &flow,
&ofproto, NULL, NULL, &netflow, NULL)) {
struct xlate_in xin;

Expand Down
22 changes: 6 additions & 16 deletions ofproto/ofproto-dpif-xlate.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,12 +520,10 @@ xlate_ofport_remove(struct ofport_dpif *ofport)

/* Given a datpath, packet, and flow metadata ('backer', 'packet', and 'key'
* respectively), populates 'flow' with the result of odp_flow_key_to_flow().
* Optionally, if nonnull, populates 'fitnessp' with the fitness of 'flow' as
* returned by odp_flow_key_to_flow(). Also, optionally populates 'ofproto'
* with the ofproto_dpif, 'odp_in_port' with the datapath in_port, that
* 'packet' ingressed, and 'ipfix', 'sflow', and 'netflow' with the appropriate
* handles for those protocols if they're enabled. Caller is responsible for
* unrefing them.
* Optionally populates 'ofproto' with the ofproto_dpif, 'odp_in_port' with
* the datapath in_port, that 'packet' ingressed, and 'ipfix', 'sflow', and
* 'netflow' with the appropriate handles for those protocols if they're
* enabled. Caller is responsible for unrefing them.
*
* If 'ofproto' is nonnull, requires 'flow''s in_port to exist. Otherwise sets
* 'flow''s in_port to OFPP_NONE.
Expand All @@ -545,19 +543,16 @@ xlate_ofport_remove(struct ofport_dpif *ofport)
* or some other positive errno if there are other problems. */
int
xlate_receive(const struct dpif_backer *backer, struct ofpbuf *packet,
const struct nlattr *key, size_t key_len,
struct flow *flow, enum odp_key_fitness *fitnessp,
const struct nlattr *key, size_t key_len, struct flow *flow,
struct ofproto_dpif **ofproto, struct dpif_ipfix **ipfix,
struct dpif_sflow **sflow, struct netflow **netflow,
odp_port_t *odp_in_port)
{
enum odp_key_fitness fitness;
const struct xport *xport;
int error = ENODEV;

ovs_rwlock_rdlock(&xlate_rwlock);
fitness = odp_flow_key_to_flow(key, key_len, flow);
if (fitness == ODP_FIT_ERROR) {
if (odp_flow_key_to_flow(key, key_len, flow) == ODP_FIT_ERROR) {
error = EINVAL;
goto exit;
}
Expand All @@ -583,8 +578,6 @@ xlate_receive(const struct dpif_backer *backer, struct ofpbuf *packet,
* vlan_tci if it is called on 'packet'. */
eth_push_vlan(packet, htons(ETH_TYPE_VLAN), flow->vlan_tci);
}
/* We can't reproduce 'key' from 'flow'. */
fitness = fitness == ODP_FIT_PERFECT ? ODP_FIT_TOO_MUCH : fitness;
}
error = 0;

Expand All @@ -605,9 +598,6 @@ xlate_receive(const struct dpif_backer *backer, struct ofpbuf *packet,
}

exit:
if (fitnessp) {
*fitnessp = fitness;
}
ovs_rwlock_unlock(&xlate_rwlock);
return error;
}
Expand Down
3 changes: 1 addition & 2 deletions ofproto/ofproto-dpif-xlate.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ void xlate_ofport_remove(struct ofport_dpif *) OVS_REQ_WRLOCK(xlate_rwlock);

int xlate_receive(const struct dpif_backer *, struct ofpbuf *packet,
const struct nlattr *key, size_t key_len,
struct flow *, enum odp_key_fitness *,
struct ofproto_dpif **, struct dpif_ipfix **,
struct flow *, struct ofproto_dpif **, struct dpif_ipfix **,
struct dpif_sflow **, struct netflow **,
odp_port_t *odp_in_port)
OVS_EXCLUDED(xlate_rwlock);
Expand Down
5 changes: 2 additions & 3 deletions ofproto/ofproto-dpif.c
Original file line number Diff line number Diff line change
Expand Up @@ -3655,7 +3655,7 @@ parse_flow_and_packet(int argc, const char *argv[],
}

if (xlate_receive(backer, NULL, odp_key.data, odp_key.size, flow,
NULL, ofprotop, NULL, NULL, NULL, NULL)) {
ofprotop, NULL, NULL, NULL, NULL)) {
error = "Invalid datapath flow";
goto exit;
}
Expand Down Expand Up @@ -4040,11 +4040,10 @@ static bool
ofproto_dpif_contains_flow(const struct ofproto_dpif *ofproto,
const struct nlattr *key, size_t key_len)
{
enum odp_key_fitness fitness;
struct ofproto_dpif *ofp;
struct flow flow;

xlate_receive(ofproto->backer, NULL, key, key_len, &flow, &fitness, &ofp,
xlate_receive(ofproto->backer, NULL, key, key_len, &flow, &ofp,
NULL, NULL, NULL, NULL);
return ofp == ofproto;
}
Expand Down

0 comments on commit 836fbda

Please sign in to comment.