From: Andrew Rybchenko Date: Wed, 25 Apr 2018 17:18:34 +0000 (+0100) Subject: net/sfc: ignore spec bits not covered by mask X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=c43e0f690413fc7233b735e641f22e8eb47c50c0;p=dpdk.git net/sfc: ignore spec bits not covered by mask mask is a simple bit-mask applied before interpreting the contents of spec and last. Fixes: a9825ccf5bb8 ("net/sfc: support flow API filters") Cc: stable@dpdk.org Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton Reviewed-by: Roman Zhukov --- diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c index 55226f12db..41b5987b2e 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -120,7 +120,6 @@ sfc_flow_parse_init(const struct rte_flow_item *item, const uint8_t *spec; const uint8_t *mask; const uint8_t *last; - uint8_t match; uint8_t supp; unsigned int i; @@ -181,12 +180,11 @@ sfc_flow_parse_init(const struct rte_flow_item *item, return -rte_errno; } - /* Check that mask and spec not asks for more match than supp_mask */ + /* Check that mask does not ask for more match than supp_mask */ for (i = 0; i < size; i++) { - match = spec[i] | mask[i]; supp = ((const uint8_t *)supp_mask)[i]; - if ((match | supp) != supp) { + if (~supp & mask[i]) { rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item, "Item's field is not supported");