|
@@ -0,0 +1,49 @@
|
|
|
+From fcf14c2c5deae8f8c3d25530bab10856f63f8a63 Mon Sep 17 00:00:00 2001
|
|
|
+From: Daniel Golle <[email protected]>
|
|
|
+Date: Sun, 25 Sep 2022 15:18:54 +0100
|
|
|
+Subject: [PATCH 2/2] net: ethernet: mtk_eth_soc: fix usage of foe_entry_size
|
|
|
+To: [email protected],
|
|
|
+ [email protected],
|
|
|
+ Lorenzo Bianconi <[email protected]>
|
|
|
+Cc: Sujuan Chen <[email protected]>,
|
|
|
+ Bo Jiao <[email protected]>,
|
|
|
+ Felix Fietkau <[email protected]>,
|
|
|
+ John Crispin <[email protected]>,
|
|
|
+ Sean Wang <[email protected]>,
|
|
|
+ Mark Lee <[email protected]>,
|
|
|
+ David S. Miller <[email protected]>,
|
|
|
+ Eric Dumazet <[email protected]>,
|
|
|
+ Jakub Kicinski <[email protected]>,
|
|
|
+ Paolo Abeni <[email protected]>,
|
|
|
+ Matthias Brugger <[email protected]>,
|
|
|
+ Chen Minqiang <[email protected]>
|
|
|
+
|
|
|
+As sizeof(hwe->data) can now longer be used as the actual size depends
|
|
|
+on foe_entry_size, in commit 9d8cb4c096ab02
|
|
|
+("net: ethernet: mtk_eth_soc: add foe_entry_size to mtk_eth_soc") the
|
|
|
+use of sizeof(hwe->data) is hence replaced.
|
|
|
+However, replacing it with ppe->eth->soc->foe_entry_size is wrong as
|
|
|
+foe_entry_size represents the size of the whole descriptor and not just
|
|
|
+the 'data' field.
|
|
|
+Fix this by subtracing the size of the only other field in the struct
|
|
|
+'ib1', so we actually end up with the correct size to be copied to the
|
|
|
+data field.
|
|
|
+
|
|
|
+Reported-by: Chen Minqiang <[email protected]>
|
|
|
+Fixes: 9d8cb4c096ab02 ("net: ethernet: mtk_eth_soc: add foe_entry_size to mtk_eth_soc")
|
|
|
+Signed-off-by: Daniel Golle <[email protected]>
|
|
|
+---
|
|
|
+ drivers/net/ethernet/mediatek/mtk_ppe.c | 2 +-
|
|
|
+ 1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
+
|
|
|
+--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
|
|
|
++++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
|
|
|
+@@ -547,7 +547,7 @@ __mtk_foe_entry_commit(struct mtk_ppe *p
|
|
|
+ }
|
|
|
+
|
|
|
+ hwe = mtk_foe_get_entry(ppe, hash);
|
|
|
+- memcpy(&hwe->data, &entry->data, eth->soc->foe_entry_size);
|
|
|
++ memcpy(&hwe->data, &entry->data, eth->soc->foe_entry_size - sizeof(hwe->ib1));
|
|
|
+ wmb();
|
|
|
+ hwe->ib1 = entry->ib1;
|
|
|
+
|