From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Pirko Subject: Re: [PATCH net-next] cls_flower: Support multiple masks per priority Date: Mon, 30 Apr 2018 11:44:37 +0200 Message-ID: <20180430094437.GJ23854@nanopsycho.orion> References: <1525076909-8767-1-git-send-email-paulb@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jiri Pirko , Cong Wang , Jamal Hadi Salim , David Miller , netdev@vger.kernel.org, Yevgeny Kliteynik , Roi Dayan , Shahar Klein , Mark Bloch , Or Gerlitz To: Paul Blakey Return-path: Received: from mail-wm0-f49.google.com ([74.125.82.49]:37091 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752623AbeD3Jok (ORCPT ); Mon, 30 Apr 2018 05:44:40 -0400 Received: by mail-wm0-f49.google.com with SMTP id l1so13246070wmb.2 for ; Mon, 30 Apr 2018 02:44:40 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1525076909-8767-1-git-send-email-paulb@mellanox.com> Sender: netdev-owner@vger.kernel.org List-ID: Mon, Apr 30, 2018 at 10:28:29AM CEST, paulb@mellanox.com wrote: >Currently flower doesn't support inserting filters with different masks >on a single priority, even if the actual flows (key + mask) inserted >aren't overlapping, as with the use case of offloading openvswitch >datapath flows. Instead one must go up one level, and assign different >priorities for each mask, which will create a different flower >instances. > >This patch opens flower to support more than one mask per priority, >and a single flower instance. It does so by adding another hash table >on top of the existing one which will store the different masks, >and the filters that share it. > >The user is left with the responsibilty of ensuring non overlapping s/responsibilty/responsibility >flows, otherwise precedence is not guaranteed. > >Signed-off-by: Paul Blakey Looks good to me. One small nit below. Feel free to append my tag to v2: Signed-off-by: Jiri Pirko [...] >@@ -103,15 +113,22 @@ static void fl_mask_update_range(struct fl_flow_mask *mask) > { > const u8 *bytes = (const u8 *) &mask->key; > size_t size = sizeof(mask->key); >- size_t i, first = 0, last = size - 1; >+ size_t i, first = 0, last; > >- for (i = 0; i < sizeof(mask->key); i++) { >+ for (i = 0; i < size; i++) { >+ if (bytes[i]) { >+ first = i; >+ break; >+ } >+ } >+ last = first; >+ for (i = size - 1; i != first; i--) { > if (bytes[i]) { >- if (!first && i) >- first = i; > last = i; >+ break; > } > } >+ Remove this newline. > mask->range.start = rounddown(first, sizeof(long)); > mask->range.end = roundup(last + 1, sizeof(long)); > } [...]