Skip to contentSkip to conversation

net/mlx5: fix MAC address initialization

PATCH Applied Dariusz Sosnowski 2 participants 2 messages Nov 8, 2024 – Nov 11, 2024 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix MAC address initialization

Offending patch added code which broke compilation on GCC 15, where MAC address was initialized with a string, causing the following errors:

../drivers/net/mlx5/mlx5_flow.c:
In function ‘mlx5_legacy_dmac_flow_create’:
../drivers/net/mlx5/mlx5_flow.c:8568:44:
error: initializer-string for array of ‘unsigned char’ is too long
[-Werror=unterminated-string-initialization]
8568 | .hdr.dst_addr.addr_bytes =
"\xff\xff\xff\xff\xff\xff",

      |

^~~~~~~~~~~~~~~~~~~~~~~~~~

../drivers/net/mlx5/mlx5_flow.c: In function ‘mlx5_legacy_dmac_vlan_flow_create’:
../drivers/net/mlx5/mlx5_flow.c:8583:44:
error: initializer-string for array of ‘unsigned char’ is too long
[-Werror=unterminated-string-initialization]
8583 | .hdr.dst_addr.addr_bytes =
"\xff\xff\xff\xff\xff\xff",

      |

^~~~~~~~~~~~~~~~~~~~~~~~~~

This patch fixes this issue by converting it to array initialization.

Fixes cf99567fe566 ("net/mlx5: add legacy unicast flow rules management")
---
 drivers/net/mlx5/mlx5_flow.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_flow.c +2 -2
index 9c43201e05..f8cfa661ec 100644
@@ -8565,7 +8565,7 @@ mlx5_legacy_dmac_flow_create(struct rte_eth_dev *dev, const struct rte_ether_add
 		.hdr.dst_addr = *addr,
 	};
 	struct rte_flow_item_eth unicast_mask = {
-		.hdr.dst_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
+		.hdr.dst_addr.addr_bytes = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
 	};
 
 	return mlx5_ctrl_flow(dev, &unicast, &unicast_mask);
@@ -8580,7 +8580,7 @@ mlx5_legacy_dmac_vlan_flow_create(struct rte_eth_dev *dev,
 		.hdr.dst_addr = *addr,
 	};
 	struct rte_flow_item_eth unicast_mask = {
-		.hdr.dst_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
+		.hdr.dst_addr.addr_bytes = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
 	};
 	struct rte_flow_item_vlan vlan_spec = {
 		.hdr.vlan_tci = rte_cpu_to_be_16(vid),
Signature · 1 line
2.39.5
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 21 lines · Dariusz Sosnowski

Offending patch added code which broke compilation on GCC 15, where MAC address was initialized with a string, causing the following errors:

../drivers/net/mlx5/mlx5_flow.c:
In function ‘mlx5_legacy_dmac_flow_create’:
../drivers/net/mlx5/mlx5_flow.c:8568:44:
error: initializer-string for array of ‘unsigned char’ is too long
[-Werror=unterminated-string-initialization]
8568 | .hdr.dst_addr.addr_bytes =
"\xff\xff\xff\xff\xff\xff",

      |

^~~~~~~~~~~~~~~~~~~~~~~~~~

../drivers/net/mlx5/mlx5_flow.c: In function ‘mlx5_legacy_dmac_vlan_flow_create’:
../drivers/net/mlx5/mlx5_flow.c:8583:44:
error: initializer-string for array of ‘unsigned char’ is too long
[-Werror=unterminated-string-initialization]
8583 | .hdr.dst_addr.addr_bytes =
"\xff\xff\xff\xff\xff\xff",

Quoted 9 lines
      |

^~~~~~~~~~~~~~~~~~~~~~~~~~

This patch fixes this issue by converting it to array initialization.

Fixes cf99567fe566 ("net/mlx5: add legacy unicast flow rules management")

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