diff mbox series

[net,7/8] i40e: Fix add TC filter for IPv6

Message ID 20210218232504.2422834-8-anthony.l.nguyen@intel.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series Intel Wired LAN Driver Updates 2021-02-18 | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers fail 5 blamed authors not CCed: anjali.singhai@intel.com jingjing.wu@intel.com kiran.patil@intel.com jeffrey.t.kirsher@intel.com amritha.nambiar@intel.com; 7 maintainers not CCed: anjali.singhai@intel.com intel-wired-lan@lists.osuosl.org jesse.brandeburg@intel.com jingjing.wu@intel.com kiran.patil@intel.com jeffrey.t.kirsher@intel.com amritha.nambiar@intel.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 4 this patch: 4
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes fail Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 17 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 4 this patch: 4
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Tony Nguyen Feb. 18, 2021, 11:25 p.m. UTC
From: Mateusz Palczewski <mateusz.palczewski@intel.com>

Fix insufficient distinction between IPv4 and IPv6 addresses
when creating a filter.
IPv4 and IPv6 are kept in the same memory area. If IPv6 is added,
then it's caught by IPv4 check, which leads to err -95.

Fixes: 2f4b411a3d67("i40e: Enable cloud filters via tc-flower")
Signed-off-by: Grzegorz Szczurek <grzegorzx.szczurek@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Reviewed-by: Jaroslaw Gawin <jaroslawx.gawin@intel.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Jakub Kicinski Feb. 19, 2021, 5:31 p.m. UTC | #1
On Thu, 18 Feb 2021 15:25:03 -0800 Tony Nguyen wrote:
> From: Mateusz Palczewski <mateusz.palczewski@intel.com>
> 
> Fix insufficient distinction between IPv4 and IPv6 addresses
> when creating a filter.
> IPv4 and IPv6 are kept in the same memory area. If IPv6 is added,
> then it's caught by IPv4 check, which leads to err -95.
> 
> Fixes: 2f4b411a3d67("i40e: Enable cloud filters via tc-flower")

Small issue with the fixes tag here - missing space after hash.

Dave said he can't take any patches until Linus gets power back and
pulls so since we're waiting perhaps you could fix and repost?

The patches look good to me.
Tony Nguyen Feb. 19, 2021, 6:06 p.m. UTC | #2
On Fri, 2021-02-19 at 09:31 -0800, Jakub Kicinski wrote:
> On Thu, 18 Feb 2021 15:25:03 -0800 Tony Nguyen wrote:
> > From: Mateusz Palczewski <mateusz.palczewski@intel.com>
> > 
> > Fix insufficient distinction between IPv4 and IPv6 addresses
> > when creating a filter.
> > IPv4 and IPv6 are kept in the same memory area. If IPv6 is added,
> > then it's caught by IPv4 check, which leads to err -95.
> > 
> > Fixes: 2f4b411a3d67("i40e: Enable cloud filters via tc-flower")
> 
> Small issue with the fixes tag here - missing space after hash.
> 
> Dave said he can't take any patches until Linus gets power back and
> pulls so since we're waiting perhaps you could fix and repost?
> 
> The patches look good to me.

Thanks for the review Jakub. Sure, I'll fix and repost.

- Tony
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 2e22ab5a0f9a..3e4a4d6f0419 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -7731,7 +7731,8 @@  int i40e_add_del_cloud_filter_big_buf(struct i40e_vsi *vsi,
 		return -EOPNOTSUPP;
 
 	/* adding filter using src_port/src_ip is not supported at this stage */
-	if (filter->src_port || filter->src_ipv4 ||
+	if (filter->src_port ||
+	    (filter->src_ipv4 && filter->n_proto != ETH_P_IPV6) ||
 	    !ipv6_addr_any(&filter->ip.v6.src_ip6))
 		return -EOPNOTSUPP;
 
@@ -7760,7 +7761,7 @@  int i40e_add_del_cloud_filter_big_buf(struct i40e_vsi *vsi,
 			cpu_to_le16(I40E_AQC_ADD_CLOUD_FILTER_MAC_VLAN_PORT);
 		}
 
-	} else if (filter->dst_ipv4 ||
+	} else if ((filter->dst_ipv4 && filter->n_proto != ETH_P_IPV6) ||
 		   !ipv6_addr_any(&filter->ip.v6.dst_ip6)) {
 		cld_filter.element.flags =
 				cpu_to_le16(I40E_AQC_ADD_CLOUD_FILTER_IP_PORT);