mirror of
https://github.com/openvswitch/ovs
synced 2025-09-01 06:45:17 +00:00
ofp-actions: Waste less memory in learn actions.
Make the immediate data member 'src_imm' of a learn spec allocated at the end of the action for just the right size. This, together with some structure packing saves on average of ~128 bytes for each learn spec in each learn action. Typical learn actions have about 4 specs each, so this amounts to saving about 0.5kb for each learn action. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
@@ -2535,6 +2535,20 @@ mf_write_subfield(const struct mf_subfield *sf, const union mf_subvalue *x,
|
||||
mf_set(field, &value, &mask, match, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
mf_write_subfield_value(const struct mf_subfield *sf, const void *src,
|
||||
struct match *match)
|
||||
{
|
||||
const struct mf_field *field = sf->field;
|
||||
union mf_value value, mask;
|
||||
unsigned int size = DIV_ROUND_UP(sf->n_bits, 8);
|
||||
|
||||
mf_get(field, match, &value, &mask);
|
||||
bitwise_copy(src, size, 0, &value, field->n_bytes, sf->ofs, sf->n_bits);
|
||||
bitwise_one ( &mask, field->n_bytes, sf->ofs, sf->n_bits);
|
||||
mf_set(field, &value, &mask, match, NULL);
|
||||
}
|
||||
|
||||
/* 'v' and 'm' correspond to values of 'field'. This function copies them into
|
||||
* 'match' in the correspond positions. */
|
||||
void
|
||||
|
Reference in New Issue
Block a user