ad63dd61963626dd87520630fb3290c59a21c88d
[openwrt/staging/ldir.git] /
1 From 5ea0e1312bcfebc06b5f91d1bb82b823d6395125 Mon Sep 17 00:00:00 2001
2 From: Lorenzo Bianconi <lorenzo@kernel.org>
3 Date: Wed, 19 Jul 2023 12:29:49 +0200
4 Subject: [PATCH 095/250] net: ethernet: mtk_ppe: add MTK_FOE_ENTRY_V{1,2}_SIZE
5 macros
6
7 Introduce MTK_FOE_ENTRY_V{1,2}_SIZE macros in order to make more
8 explicit foe_entry size for different chipset revisions.
9
10 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
11 Reviewed-by: Simon Horman <simon.horman@corigine.com>
12 Signed-off-by: David S. Miller <davem@davemloft.net>
13 ---
14 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 10 +++++-----
15 drivers/net/ethernet/mediatek/mtk_ppe.h | 3 +++
16 2 files changed, 8 insertions(+), 5 deletions(-)
17
18 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
19 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
20 @@ -4714,7 +4714,7 @@ static const struct mtk_soc_data mt7621_
21 .required_pctl = false,
22 .offload_version = 1,
23 .hash_offset = 2,
24 - .foe_entry_size = sizeof(struct mtk_foe_entry) - 16,
25 + .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE,
26 .txrx = {
27 .txd_size = sizeof(struct mtk_tx_dma),
28 .rxd_size = sizeof(struct mtk_rx_dma),
29 @@ -4735,7 +4735,7 @@ static const struct mtk_soc_data mt7622_
30 .offload_version = 2,
31 .hash_offset = 2,
32 .has_accounting = true,
33 - .foe_entry_size = sizeof(struct mtk_foe_entry) - 16,
34 + .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE,
35 .txrx = {
36 .txd_size = sizeof(struct mtk_tx_dma),
37 .rxd_size = sizeof(struct mtk_rx_dma),
38 @@ -4754,7 +4754,7 @@ static const struct mtk_soc_data mt7623_
39 .required_pctl = true,
40 .offload_version = 1,
41 .hash_offset = 2,
42 - .foe_entry_size = sizeof(struct mtk_foe_entry) - 16,
43 + .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE,
44 .txrx = {
45 .txd_size = sizeof(struct mtk_tx_dma),
46 .rxd_size = sizeof(struct mtk_rx_dma),
47 @@ -4792,8 +4792,8 @@ static const struct mtk_soc_data mt7981_
48 .required_pctl = false,
49 .offload_version = 2,
50 .hash_offset = 4,
51 - .foe_entry_size = sizeof(struct mtk_foe_entry),
52 .has_accounting = true,
53 + .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE,
54 .txrx = {
55 .txd_size = sizeof(struct mtk_tx_dma_v2),
56 .rxd_size = sizeof(struct mtk_rx_dma_v2),
57 @@ -4813,8 +4813,8 @@ static const struct mtk_soc_data mt7986_
58 .required_pctl = false,
59 .offload_version = 2,
60 .hash_offset = 4,
61 - .foe_entry_size = sizeof(struct mtk_foe_entry),
62 .has_accounting = true,
63 + .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE,
64 .txrx = {
65 .txd_size = sizeof(struct mtk_tx_dma_v2),
66 .rxd_size = sizeof(struct mtk_rx_dma_v2),
67 --- a/drivers/net/ethernet/mediatek/mtk_ppe.h
68 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.h
69 @@ -216,6 +216,9 @@ struct mtk_foe_ipv6_6rd {
70 struct mtk_foe_mac_info l2;
71 };
72
73 +#define MTK_FOE_ENTRY_V1_SIZE 80
74 +#define MTK_FOE_ENTRY_V2_SIZE 96
75 +
76 struct mtk_foe_entry {
77 u32 ib1;
78