net/nfp: fix set IPv6 flow action can't get right address

Message ID 20230609061919.1307911-1-chaoyong.he@corigine.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series net/nfp: fix set IPv6 flow action can't get right address |

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/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-unit-testing fail Testing issues
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-compile-testing fail Testing issues
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/Intel-compilation fail Compilation issues
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Chaoyong He June 9, 2023, 6:19 a.m. UTC
  The former logic of set IPv6 source/destination address flow action
can't get the right IPV6 address, a 32 bit big endian value is
expected while a 8 bit value is provided.
This caused the offloaded packets don't have the right IPv6 address
as expected.

Fixes: 596ae2217214 ("net/nfp: support IPv6 source flow action")
Fixes: 51384f79b264 ("net/nfp: support IPv6 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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ferruh Yigit June 9, 2023, 1:43 p.m. UTC | #1
On 6/9/2023 7:19 AM, Chaoyong He wrote:
> The former logic of set IPv6 source/destination address flow action
> can't get the right IPV6 address, a 32 bit big endian value is
> expected while a 8 bit value is provided.
> This caused the offloaded packets don't have the right IPv6 address
> as expected.
> 
> Fixes: 596ae2217214 ("net/nfp: support IPv6 source flow action")
> Fixes: 51384f79b264 ("net/nfp: support IPv6 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>
> 

Applied to dpdk-next-net/main, thanks.
  
Ferruh Yigit June 9, 2023, 3:31 p.m. UTC | #2
On 6/9/2023 2:43 PM, Ferruh Yigit wrote:
> On 6/9/2023 7:19 AM, Chaoyong He wrote:
>> The former logic of set IPv6 source/destination address flow action
>> can't get the right IPV6 address, a 32 bit big endian value is
>> expected while a 8 bit value is provided.
>> This caused the offloaded packets don't have the right IPv6 address
>> as expected.
>>
>> Fixes: 596ae2217214 ("net/nfp: support IPv6 source flow action")
>> Fixes: 51384f79b264 ("net/nfp: support IPv6 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>
>>
> 
> Applied to dpdk-next-net/main, thanks.
> 

Thomas highlighted the compiler warning from CI [1], dropping patch from
next-net, updated patchwork status.

Can you please check the warning?



[1]
https://mails.dpdk.org/archives/test-report/2023-June/407776.html

```
../drivers/net/nfp/nfp_flow.c: In function 'nfp_flow_action_set_ipv6':
../drivers/net/nfp/nfp_flow.c:2168:3:
  error:
  dereferencing type-punned pointer will break strict-aliasing rules
  [-Werror=strict-aliasing]

   set_ip->ipv6[i].exact = *(const rte_be32_t *)&set_ipv6->ipv6_addr[i * 4];
```
  

Patch

diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c
index 41b722f4d8..0dd0d14f4a 100644
--- a/drivers/net/nfp/nfp_flow.c
+++ b/drivers/net/nfp/nfp_flow.c
@@ -2166,7 +2166,7 @@  nfp_flow_action_set_ipv6(char *act_data,
 	set_ip->reserved = 0;
 
 	for (i = 0; i < 4; i++) {
-		set_ip->ipv6[i].exact = set_ipv6->ipv6_addr[i * 4];
+		set_ip->ipv6[i].exact = *(const rte_be32_t *)&set_ipv6->ipv6_addr[i * 4];
 		set_ip->ipv6[i].mask = RTE_BE32(0xffffffff);
 	}
 }