[ovs-dev] [PATCH ovs V3 13/25] netdev-tc-offloads: Add flower mask to priority map

Chandran, Sugesh sugesh.chandran at intel.com
Mon Feb 13 23:55:51 UTC 2017



Regards
_Sugesh


> -----Original Message-----
> From: Roi Dayan [mailto:roid at mellanox.com]
> Sent: Wednesday, February 8, 2017 3:29 PM
> To: dev at openvswitch.org
> Cc: Paul Blakey <paulb at mellanox.com>; Or Gerlitz
> <ogerlitz at mellanox.com>; Hadar Hen Zion <hadarh at mellanox.com>; Shahar
> Klein <shahark at mellanox.com>; Mark Bloch <markb at mellanox.com>; Rony
> Efraim <ronye at mellanox.com>; Fastabend, John R
> <john.r.fastabend at intel.com>; Joe Stringer <joe at ovn.org>; Andy
> Gospodarek <andy at greyhouse.net>; Lance Richardson
> <lrichard at redhat.com>; Marcelo Ricardo Leitner <mleitner at redhat.com>;
> Simon Horman <simon.horman at netronome.com>; Jiri Pirko
> <jiri at mellanox.com>; Chandran, Sugesh <sugesh.chandran at intel.com>
> Subject: [PATCH ovs V3 13/25] netdev-tc-offloads: Add flower mask to
> priority map
> 
> From: Paul Blakey <paulb at mellanox.com>
> 
> Flower classifer requires a different priority per mask, so we hash the mask
> and generate a new priority for each new mask used.
> 
> Signed-off-by: Paul Blakey <paulb at mellanox.com>
> Reviewed-by: Roi Dayan <roid at mellanox.com>
> ---
> +};
> +
[Sugesh] May be I am missing something here, cant we generate this priority value from the ufid or ufid hash?
> +static uint16_t
> +get_prio_for_tc_flower(struct tc_flower *flower) {
> +    static struct hmap prios = HMAP_INITIALIZER(&prios);
> +    static struct ovs_mutex prios_lock = OVS_MUTEX_INITIALIZER;
> +    static int last_prio = 0;
> +    size_t key_len = sizeof(struct tc_flower_key);
> +    size_t hash = hash_bytes(&flower->mask, key_len,
> +                             (OVS_FORCE uint32_t) flower->key.eth_type);
> +    struct prio_map_data *data;
> +    struct prio_map_data *new_data;
> +
> +    ovs_mutex_lock(&prios_lock);
> +    HMAP_FOR_EACH_WITH_HASH(data, node, hash, &prios) {
> +        if (!memcmp(&flower->mask, &data->mask, key_len)
> +            && data->protocol == flower->key.eth_type) {
> +            ovs_mutex_unlock(&prios_lock);
> +            return data->prio;
> +        }
> +    }
> +
.....
>  int
>  netdev_tc_flow_flush(struct netdev *netdev)  {
> --
> 2.7.4



More information about the dev mailing list