Skip to contentSkip to conversation

net/mvpp2: fix build with IPv6 address structure

PATCH In review Thomas Monjalon 1 participant 2 messages Oct 18, 2024 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mvpp2: fix build with IPv6 address structure

A structure has been created for IPv6 addresses
replacing the byte arrays of the IPv6 header.

This change was failing the compilation:
mrvl_flow.c:1055:29: error: incompatible type for argument 1 of 'memcmp'

Instead of adapting the memcmp call, a new function is used to compare an IPv6 address with an unspec (zero) address.

Fixes 89b5642d0d45 ("net: use IPv6 address structure for packet headers")
---
 drivers/net/mvpp2/mrvl_flow.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/net/mvpp2/mrvl_flow.c +2 -7
index 098523ada6..9932e28edc 100644
@@ -1031,7 +1031,6 @@ mrvl_parse_ip6(const struct rte_flow_item *item,
 	       struct rte_flow_error *error)
 {
 	const struct rte_flow_item_ipv6 *spec = NULL, *mask = NULL;
-	struct rte_ipv6_hdr zero;
 	uint32_t flow_mask;
 	int ret;
 
@@ -1043,8 +1042,6 @@ mrvl_parse_ip6(const struct rte_flow_item *item,
 	if (ret)
 		return ret;
 
-	memset(&zero, 0, sizeof(zero));
-
 	if (mask->hdr.payload_len ||
 	    mask->hdr.hop_limits) {
 		rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
@@ -1052,15 +1049,13 @@ mrvl_parse_ip6(const struct rte_flow_item *item,
 		return -rte_errno;
 	}
 
-	if (memcmp(mask->hdr.src_addr,
-		   zero.src_addr, sizeof(mask->hdr.src_addr))) {
+	if (!rte_ipv6_addr_is_unspec(&mask->hdr.src_addr)) {
 		ret = mrvl_parse_ip6_sip(spec, mask, flow);
 		if (ret)
 			goto out;
 	}
 
-	if (memcmp(mask->hdr.dst_addr,
-		   zero.dst_addr, sizeof(mask->hdr.dst_addr))) {
+	if (!rte_ipv6_addr_is_unspec(&mask->hdr.dst_addr)) {
 		ret = mrvl_parse_ip6_dip(spec, mask, flow);
 		if (ret)
 			goto out;
Signature · 1 line
2.46.0
#1 lore raw

18/10/2024 22:11, Thomas Monjalon:

Quoted 6 lines

A structure has been created for IPv6 addresses
replacing the byte arrays of the IPv6 header.

This change was failing the compilation:
mrvl_flow.c:1055:29: error: incompatible type for argument 1 of 'memcmp'

Quoted 6 lines

Instead of adapting the memcmp call, a new function is used to compare an IPv6 address with an unspec (zero) address.

Fixes 89b5642d0d45 ("net: use IPv6 address structure for packet headers")

Applied quickly for the release 24.11-rc1