net/i40e: fix disabling flex payload selection rule
authorJingjing Wu <jingjing.wu@intel.com>
Thu, 12 May 2016 08:11:40 +0000 (16:11 +0800)
committerBruce Richardson <bruce.richardson@intel.com>
Wed, 15 Jun 2016 15:13:55 +0000 (17:13 +0200)
When setting up the flexible paylaod selection rules, the value
NONUSE_FLX_PIT_DEST_OFF (== 63) is meant to disable the rule.
However, since the MK_FLX_PIT macro always added on an additional
offset of I40E_FLX_OFFSET_IN_FIELD_VECTOR (== 50) to the value passed
the functionality to disable the rule was broken.
This patch fixes this by checking for the disable value and not adding
the offset in that case.

Fixes: d8b90c4eabe9 ("i40e: take flow director flexible payload configuration")

Reported-by: Michael Habibi <mikehabibi@gmail.com>
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Zhe Tao <zhe.tao@intel.com>
drivers/net/i40e/i40e_fdir.c

index 8aa41e5..efbcd18 100644 (file)
@@ -94,7 +94,9 @@
                I40E_PRTQF_FLX_PIT_SOURCE_OFF_MASK) | \
        (((fsize) << I40E_PRTQF_FLX_PIT_FSIZE_SHIFT) & \
                        I40E_PRTQF_FLX_PIT_FSIZE_MASK) | \
-       ((((dst_offset) + I40E_FLX_OFFSET_IN_FIELD_VECTOR) << \
+       ((((dst_offset) == NONUSE_FLX_PIT_DEST_OFF ? \
+                       NONUSE_FLX_PIT_DEST_OFF : \
+                       ((dst_offset) + I40E_FLX_OFFSET_IN_FIELD_VECTOR)) << \
                        I40E_PRTQF_FLX_PIT_DEST_OFF_SHIFT) & \
                        I40E_PRTQF_FLX_PIT_DEST_OFF_MASK))