On 14/02/2017 01:55, Chandran, Sugesh wrote:


Regards
_Sugesh


-----Original Message-----
From: Roi Dayan [mailto:[email protected]]
Sent: Wednesday, February 8, 2017 3:29 PM
To: [email protected]
Cc: Paul Blakey <[email protected]>; Or Gerlitz
<[email protected]>; Hadar Hen Zion <[email protected]>; Shahar
Klein <[email protected]>; Mark Bloch <[email protected]>; Rony
Efraim <[email protected]>; Fastabend, John R
<[email protected]>; Joe Stringer <[email protected]>; Andy
Gospodarek <[email protected]>; Lance Richardson
<[email protected]>; Marcelo Ricardo Leitner <[email protected]>;
Simon Horman <[email protected]>; Jiri Pirko
<[email protected]>; Chandran, Sugesh <[email protected]>
Subject: [PATCH ovs V3 13/25] netdev-tc-offloads: Add flower mask to
priority map

From: Paul Blakey <[email protected]>

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 <[email protected]>
Reviewed-by: Roi Dayan <[email protected]>
---
+};
+
[Sugesh] May be I am missing something here, cant we generate this priority 
value from the ufid or ufid hash?

don't think so. we need prio number that flower will accept. e.g. if the protocol is not the same for 2 rules then we cannot use the same prio or flower will reject it.

+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

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to