On 8 August 2017 at 07:21, Roi Dayan <[email protected]> wrote:
> From: Paul Blakey <[email protected]>
>
> Implement support for offloading ovs action set using
> tc header rewrite action.
>
> Signed-off-by: Paul Blakey <[email protected]>
> Reviewed-by: Roi Dayan <[email protected]>
> ---
<snip>
> @@ -274,6 +346,48 @@ netdev_tc_flow_dump_destroy(struct netdev_flow_dump
> *dump)
> return 0;
> }
>
> +static void
> +parse_flower_rewrite_to_netlink_action(struct ofpbuf *buf,
> + struct tc_flower *flower)
> +{
> + char *mask = (char *) &flower->rewrite.mask;
> + char *data = (char *) &flower->rewrite.key;
> +
> + for (int type = 0; type < ARRAY_SIZE(set_flower_map); type++) {
> + char *put = NULL;
> + size_t nested = 0;
> + int len = ovs_flow_key_attr_lens[type].len;
> +
> + if (len <= 0) {
> + continue;
> + }
> +
> + for (int j = 0; j < ARRAY_SIZE(set_flower_map[type]); j++) {
> + struct netlink_field *f = &set_flower_map[type][j];
> +
> + if (!f->size) {
> + break;
> + }
Seems like maybe there's similar feedback here to the previous patch
wrt sparsely populated array set_flower_map[].
> +
> + if (!is_all_zeros(mask + f->flower_offset, f->size)) {
> + if (!put) {
> + nested = nl_msg_start_nested(buf,
> + OVS_ACTION_ATTR_SET_MASKED);
> + put = nl_msg_put_unspec_zero(buf, type, len * 2);
Do we ever have multiple of these attributes in a single nested
OVS_ACTION_ATTR_SET_MASKED? If so, won't the following memcpys avoid
putting the netlink header for the subsequent sets?
> + }
> +
> + memcpy(put + f->offset, data + f->flower_offset, f->size);
> + memcpy(put + len + f->offset,
> + mask + f->flower_offset, f->size);
Could we these combine with the nl_msg_put_unspec() above?
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev