diff mbox series

[net,v2] octeontx2-pf: fix FLOW_DIS_IS_FRAGMENT implementation

Message ID 20240412120258.233970-1-ast@fiberby.net (mailing list archive)
State Accepted
Delegated to: Netdev Maintainers
Headers show
Series [net,v2] octeontx2-pf: fix FLOW_DIS_IS_FRAGMENT implementation | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 937 this patch: 937
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 937 this patch: 937
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 23 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-04-13--15-00 (tests: 960)

Commit Message

Asbjørn Sloth Tønnesen April 12, 2024, 12:02 p.m. UTC
Upon reviewing the flower control flags handling in
this driver, I notice that the key wasn't being used,
only the mask.

Ie. `tc flower ... ip_flags nofrag` was hardware
offloaded as `... ip_flags frag`.

Only compile tested, no access to HW.

Fixes: c672e3727989 ("octeontx2-pf: Add support to filter packet based on IP fragment")
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
---

Changelog:

v2:
- Added Reviewed-by from Jacob Keller.

v1: https://lore.kernel.org/all/20240410134303.21560-1-ast@fiberby.net/

 drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Suman Ghosh April 16, 2024, 2:14 p.m. UTC | #1
>Upon reviewing the flower control flags handling in this driver, I notice
>that the key wasn't being used, only the mask.
>
>Ie. `tc flower ... ip_flags nofrag` was hardware offloaded as `... ip_flags
>frag`.
>
>Only compile tested, no access to HW.
>
>Fixes: c672e3727989 ("octeontx2-pf: Add support to filter packet based on
>IP fragment")
>Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
>Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Suman Ghosh <sumang@marvell.com>
>---
>
>Changelog:
>
>v2:
>- Added Reviewed-by from Jacob Keller.
>
>v1: https://urldefense.proofpoint.com/v2/url?u=https-
>3A__lore.kernel.org_all_20240410134303.21560-2D1-2Dast-
>40fiberby.net_&d=DwIDaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=7si3Xn9Ly-
>Se1a655kvEPIYU0nQ9HPeN280sEUv5ROU&m=UfMrVnDU5JBsaVCp2qFOqZRGkDyBtoQy8QCVjrd
>zoiPy4SUhpvrOES3g3YlAhMCa&s=W3SsIVaRWmLwF0VFSRrHLIcA3reHOL1qGNZd-aGrftk&e=
>
> drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
>b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
>index 87bdb93cb066..f4655a8c0705 100644
>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
>@@ -688,22 +688,25 @@ static int otx2_tc_prepare_flow(struct otx2_nic *nic,
>struct otx2_tc_flow *node,
> 	}
>
> 	if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CONTROL)) {
> 		struct flow_match_control match;
>+		u32 val;
>
> 		flow_rule_match_control(rule, &match);
> 		if (match.mask->flags & FLOW_DIS_FIRST_FRAG) {
> 			NL_SET_ERR_MSG_MOD(extack, "HW doesn't support frag
>first/later");
> 			return -EOPNOTSUPP;
> 		}
>
> 		if (match.mask->flags & FLOW_DIS_IS_FRAGMENT) {
>+			val = match.key->flags & FLOW_DIS_IS_FRAGMENT;
> 			if (ntohs(flow_spec->etype) == ETH_P_IP) {
>-				flow_spec->ip_flag = IPV4_FLAG_MORE;
>+				flow_spec->ip_flag = val ? IPV4_FLAG_MORE : 0;
> 				flow_mask->ip_flag = IPV4_FLAG_MORE;
> 				req->features |= BIT_ULL(NPC_IPFRAG_IPV4);
> 			} else if (ntohs(flow_spec->etype) == ETH_P_IPV6) {
>-				flow_spec->next_header = IPPROTO_FRAGMENT;
>+				flow_spec->next_header = val ?
>+							 IPPROTO_FRAGMENT : 0;
> 				flow_mask->next_header = 0xff;
> 				req->features |= BIT_ULL(NPC_IPFRAG_IPV6);
> 			} else {
> 				NL_SET_ERR_MSG_MOD(extack, "flow-type should be either
>IPv4 and IPv6");
>--
>2.43.0
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
index 87bdb93cb066..f4655a8c0705 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
@@ -688,22 +688,25 @@  static int otx2_tc_prepare_flow(struct otx2_nic *nic, struct otx2_tc_flow *node,
 	}
 
 	if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CONTROL)) {
 		struct flow_match_control match;
+		u32 val;
 
 		flow_rule_match_control(rule, &match);
 		if (match.mask->flags & FLOW_DIS_FIRST_FRAG) {
 			NL_SET_ERR_MSG_MOD(extack, "HW doesn't support frag first/later");
 			return -EOPNOTSUPP;
 		}
 
 		if (match.mask->flags & FLOW_DIS_IS_FRAGMENT) {
+			val = match.key->flags & FLOW_DIS_IS_FRAGMENT;
 			if (ntohs(flow_spec->etype) == ETH_P_IP) {
-				flow_spec->ip_flag = IPV4_FLAG_MORE;
+				flow_spec->ip_flag = val ? IPV4_FLAG_MORE : 0;
 				flow_mask->ip_flag = IPV4_FLAG_MORE;
 				req->features |= BIT_ULL(NPC_IPFRAG_IPV4);
 			} else if (ntohs(flow_spec->etype) == ETH_P_IPV6) {
-				flow_spec->next_header = IPPROTO_FRAGMENT;
+				flow_spec->next_header = val ?
+							 IPPROTO_FRAGMENT : 0;
 				flow_mask->next_header = 0xff;
 				req->features |= BIT_ULL(NPC_IPFRAG_IPV6);
 			} else {
 				NL_SET_ERR_MSG_MOD(extack, "flow-type should be either IPv4 and IPv6");