[2/6] net/nfp: fix the set IPv4 flow action

Message ID 20230221064930.3399-3-chaoyong.he@corigine.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series fix the set flow actions |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chaoyong He Feb. 21, 2023, 6:49 a.m. UTC
  The former logic of set IPv4 source/destination address flow action don't
consider the mask filed of control message passed to the firmware.
This caused the firmware skip the set action logic, and the offloaded
packets don't have the right IPv4 address as expected.

Fixes: ab80975b0a14 ("net/nfp: support IPv4 source flow action")
Fixes: f85c1e05bff3 ("net/nfp: support IPv4 destination flow action")
Cc: stable@dpdk.org

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
 drivers/net/nfp/nfp_flow.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c
index f373171d7e..39493ce98d 100644
--- a/drivers/net/nfp/nfp_flow.c
+++ b/drivers/net/nfp/nfp_flow.c
@@ -2132,10 +2132,13 @@  nfp_flow_action_set_ip(char *act_data,
 	set_ip->reserved     = 0;
 
 	set_ipv4 = (const struct rte_flow_action_set_ipv4 *)action->conf;
-	if (ip_src_flag)
+	if (ip_src_flag) {
 		set_ip->ipv4_src = set_ipv4->ipv4_addr;
-	else
+		set_ip->ipv4_src_mask = RTE_BE32(0xffffffff);
+	} else {
 		set_ip->ipv4_dst = set_ipv4->ipv4_addr;
+		set_ip->ipv4_dst_mask = RTE_BE32(0xffffffff);
+	}
 }
 
 static void