net/nfp: fix the incorrect vni of VXLAN encap action

Message ID 20230208092350.26226-1-chaoyong.he@corigine.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/nfp: fix the incorrect vni of VXLAN encap action |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Chaoyong He Feb. 8, 2023, 9:23 a.m. UTC
  The helper function which send the tunnel configuration to
firmware requires the vni with CPU endian.
The original VXLAN encap logic wrongly invoke it with the
big-endian value.

Fixes: 724662b4ce5b ("net/nfp: support IPv4 VXLAN encap flow action")
Fixes: c3b7254093c2 ("net/nfp: support IPv6 VXLAN encap 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 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
  

Comments

Ferruh Yigit Feb. 15, 2023, 2:01 p.m. UTC | #1
On 2/8/2023 9:23 AM, Chaoyong He wrote:
> The helper function which send the tunnel configuration to
> firmware requires the vni with CPU endian.
> The original VXLAN encap logic wrongly invoke it with the
> big-endian value.
> 
> Fixes: 724662b4ce5b ("net/nfp: support IPv4 VXLAN encap flow action")
> Fixes: c3b7254093c2 ("net/nfp: support IPv6 VXLAN encap flow action")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>

Applied to dpdk-next-net/main, thanks.
  

Patch

diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c
index ff2e21c817..33361ee19c 100644
--- a/drivers/net/nfp/nfp_flow.c
+++ b/drivers/net/nfp/nfp_flow.c
@@ -2686,6 +2686,7 @@  nfp_flow_action_vxlan_encap_v4(struct nfp_app_fw_flower *app_fw_flower,
 		struct nfp_fl_rule_metadata *nfp_flow_meta,
 		struct nfp_fl_tun *tun)
 {
+	uint64_t tun_id;
 	struct nfp_fl_act_pre_tun *pre_tun;
 	struct nfp_fl_act_set_tun *set_tun;
 	const struct rte_flow_item_eth *eth;
@@ -2704,7 +2705,8 @@  nfp_flow_action_vxlan_encap_v4(struct nfp_app_fw_flower *app_fw_flower,
 
 	set_tun = (struct nfp_fl_act_set_tun *)(act_data + act_pre_size);
 	memset(set_tun, 0, act_set_size);
-	nfp_flow_set_tun_process(set_tun, NFP_FL_TUN_VXLAN, vxlan->hdr.vx_vni,
+	tun_id = rte_be_to_cpu_32(vxlan->hdr.vx_vni);
+	nfp_flow_set_tun_process(set_tun, NFP_FL_TUN_VXLAN, tun_id,
 			ipv4->hdr.time_to_live, ipv4->hdr.type_of_service);
 	set_tun->tun_flags = vxlan->hdr.vx_flags;
 
@@ -2721,6 +2723,7 @@  nfp_flow_action_vxlan_encap_v6(struct nfp_app_fw_flower *app_fw_flower,
 		struct nfp_fl_rule_metadata *nfp_flow_meta,
 		struct nfp_fl_tun *tun)
 {
+	uint64_t tun_id;
 	struct nfp_fl_act_pre_tun *pre_tun;
 	struct nfp_fl_act_set_tun *set_tun;
 	const struct rte_flow_item_eth *eth;
@@ -2739,7 +2742,8 @@  nfp_flow_action_vxlan_encap_v6(struct nfp_app_fw_flower *app_fw_flower,
 
 	set_tun = (struct nfp_fl_act_set_tun *)(act_data + act_pre_size);
 	memset(set_tun, 0, act_set_size);
-	nfp_flow_set_tun_process(set_tun, NFP_FL_TUN_VXLAN, vxlan->hdr.vx_vni,
+	tun_id = rte_be_to_cpu_32(vxlan->hdr.vx_vni);
+	nfp_flow_set_tun_process(set_tun, NFP_FL_TUN_VXLAN, tun_id,
 			ipv6->hdr.hop_limits,
 			(ipv6->hdr.vtc_flow >> RTE_IPV6_HDR_TC_SHIFT) & 0xff);
 	set_tun->tun_flags = vxlan->hdr.vx_flags;