[1/6] net/nfp: fix the set MAC flow action

Message ID 20230221064930.3399-2-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 MAC 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 MAC address as expected.

Fixes: 4f6983154570 ("net/nfp: support MAC source flow action")
Fixes: eecc7ca3088a ("net/nfp: support MAC 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 | 5 +++++
 1 file changed, 5 insertions(+)
  

Patch

diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c
index 0c38925701..f373171d7e 100644
--- a/drivers/net/nfp/nfp_flow.c
+++ b/drivers/net/nfp/nfp_flow.c
@@ -2066,6 +2066,7 @@  nfp_flow_action_set_mac(char *act_data,
 		bool mac_src_flag,
 		bool mac_set_flag)
 {
+	uint8_t i;
 	size_t act_size;
 	struct nfp_fl_act_set_eth *set_eth;
 	const struct rte_flow_action_set_mac *set_mac;
@@ -2084,9 +2085,13 @@  nfp_flow_action_set_mac(char *act_data,
 	if (mac_src_flag) {
 		rte_memcpy(&set_eth->eth_addr[RTE_ETHER_ADDR_LEN],
 				set_mac->mac_addr, RTE_ETHER_ADDR_LEN);
+		for (i = 0; i < RTE_ETHER_ADDR_LEN; i++)
+			set_eth->eth_addr_mask[RTE_ETHER_ADDR_LEN + i] = 0xff;
 	} else {
 		rte_memcpy(&set_eth->eth_addr[0],
 				set_mac->mac_addr, RTE_ETHER_ADDR_LEN);
+		for (i = 0; i < RTE_ETHER_ADDR_LEN; i++)
+			set_eth->eth_addr_mask[i] = 0xff;
 	}
 }