e09a39e113dbe7b9f083d41704b39dcd67e142bd
[openwrt/openwrt.git] / target / linux / layerscape / patches-4.14 / 707-dpaa-ethernet-support-layerscape.patch
1 From b443452fe13292b12295757f57e04c04834b3fc0 Mon Sep 17 00:00:00 2001
2 From: Yangbo Lu <yangbo.lu@nxp.com>
3 Date: Wed, 22 May 2019 17:49:18 +0800
4 Subject: [PATCH] dpaa-ethernet: support layerscape
5
6 This is an integrated patch of dpaa-ethernet for layerscape
7
8 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
9 Signed-off-by: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>
10 Signed-off-by: Biwen Li <biwen.li@nxp.com>
11 Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
12 Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
13 Signed-off-by: David S. Miller <davem@davemloft.net>
14 Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
15 Signed-off-by: Florinel Iordache <florinel.iordache@nxp.com>
16 Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
17 Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
18 Signed-off-by: Iordache Florinel-R70177 <florinel.iordache@nxp.com>
19 Signed-off-by: Jake Moroni <mail@jakemoroni.com>
20 Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
21 Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
22 Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
23 Signed-off-by: Radu Bulie <radu-andrei.bulie@nxp.com>
24 Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
25 Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
26 Signed-off-by: Vicentiu Galanopulo <vicentiu.galanopulo@nxp.com>
27 Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
28 Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
29 Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
30 Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
31 Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
32 ---
33 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 616 +-
34 drivers/net/ethernet/freescale/dpaa/dpaa_eth.h | 3 +
35 drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c | 41 +-
36 drivers/net/ethernet/freescale/fman/Kconfig | 1 -
37 drivers/net/ethernet/freescale/fman/Makefile | 12 +-
38 drivers/net/ethernet/freescale/fman/fman.c | 38 +-
39 drivers/net/ethernet/freescale/fman/fman.h | 5 +
40 drivers/net/ethernet/freescale/fman/fman_dtsec.c | 46 +
41 drivers/net/ethernet/freescale/fman/fman_dtsec.h | 2 +
42 drivers/net/ethernet/freescale/fman/fman_memac.c | 37 +-
43 drivers/net/ethernet/freescale/fman/fman_memac.h | 2 +
44 drivers/net/ethernet/freescale/fman/fman_port.c | 28 +
45 drivers/net/ethernet/freescale/fman/fman_port.h | 4 +
46 drivers/net/ethernet/freescale/fman/fman_tgec.c | 54 +-
47 drivers/net/ethernet/freescale/fman/fman_tgec.h | 2 +
48 drivers/net/ethernet/freescale/fman/mac.c | 152 +-
49 drivers/net/ethernet/freescale/fman/mac.h | 9 +-
50 drivers/net/ethernet/freescale/sdk_dpaa/Kconfig | 184 +
51 drivers/net/ethernet/freescale/sdk_dpaa/Makefile | 45 +
52 .../net/ethernet/freescale/sdk_dpaa/dpaa_1588.c | 580 ++
53 .../net/ethernet/freescale/sdk_dpaa/dpaa_1588.h | 138 +
54 .../net/ethernet/freescale/sdk_dpaa/dpaa_debugfs.c | 180 +
55 .../net/ethernet/freescale/sdk_dpaa/dpaa_debugfs.h | 43 +
56 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.c | 1223 ++++
57 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.h | 674 ++
58 .../ethernet/freescale/sdk_dpaa/dpaa_eth_base.c | 205 +
59 .../ethernet/freescale/sdk_dpaa/dpaa_eth_base.h | 49 +
60 .../ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c | 2076 ++++++
61 .../ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.h | 241 +
62 .../ethernet/freescale/sdk_dpaa/dpaa_eth_common.c | 1745 +++++
63 .../ethernet/freescale/sdk_dpaa/dpaa_eth_common.h | 226 +
64 .../ethernet/freescale/sdk_dpaa/dpaa_eth_proxy.c | 381 +
65 .../net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c | 1195 +++
66 .../ethernet/freescale/sdk_dpaa/dpaa_eth_sysfs.c | 278 +
67 .../ethernet/freescale/sdk_dpaa/dpaa_eth_trace.h | 144 +
68 .../net/ethernet/freescale/sdk_dpaa/dpaa_ethtool.c | 587 ++
69 drivers/net/ethernet/freescale/sdk_dpaa/mac-api.c | 931 +++
70 drivers/net/ethernet/freescale/sdk_dpaa/mac.c | 490 ++
71 drivers/net/ethernet/freescale/sdk_dpaa/mac.h | 134 +
72 .../net/ethernet/freescale/sdk_dpaa/offline_port.c | 848 +++
73 .../net/ethernet/freescale/sdk_dpaa/offline_port.h | 59 +
74 drivers/net/ethernet/freescale/sdk_fman/Kconfig | 153 +
75 drivers/net/ethernet/freescale/sdk_fman/Makefile | 11 +
76 .../freescale/sdk_fman/Peripherals/FM/HC/Makefile | 15 +
77 .../freescale/sdk_fman/Peripherals/FM/HC/hc.c | 1232 ++++
78 .../freescale/sdk_fman/Peripherals/FM/MAC/Makefile | 28 +
79 .../freescale/sdk_fman/Peripherals/FM/MAC/dtsec.c | 1504 ++++
80 .../freescale/sdk_fman/Peripherals/FM/MAC/dtsec.h | 228 +
81 .../sdk_fman/Peripherals/FM/MAC/dtsec_mii_acc.c | 97 +
82 .../sdk_fman/Peripherals/FM/MAC/dtsec_mii_acc.h | 42 +
83 .../freescale/sdk_fman/Peripherals/FM/MAC/fm_mac.c | 674 ++
84 .../freescale/sdk_fman/Peripherals/FM/MAC/fm_mac.h | 226 +
85 .../sdk_fman/Peripherals/FM/MAC/fman_crc32.c | 119 +
86 .../sdk_fman/Peripherals/FM/MAC/fman_crc32.h | 43 +
87 .../sdk_fman/Peripherals/FM/MAC/fman_dtsec.c | 847 +++
88 .../Peripherals/FM/MAC/fman_dtsec_mii_acc.c | 165 +
89 .../sdk_fman/Peripherals/FM/MAC/fman_memac.c | 532 ++
90 .../Peripherals/FM/MAC/fman_memac_mii_acc.c | 215 +
91 .../sdk_fman/Peripherals/FM/MAC/fman_tgec.c | 367 +
92 .../freescale/sdk_fman/Peripherals/FM/MAC/memac.c | 1166 +++
93 .../freescale/sdk_fman/Peripherals/FM/MAC/memac.h | 110 +
94 .../sdk_fman/Peripherals/FM/MAC/memac_mii_acc.c | 78 +
95 .../sdk_fman/Peripherals/FM/MAC/memac_mii_acc.h | 73 +
96 .../freescale/sdk_fman/Peripherals/FM/MAC/tgec.c | 1017 +++
97 .../freescale/sdk_fman/Peripherals/FM/MAC/tgec.h | 151 +
98 .../sdk_fman/Peripherals/FM/MAC/tgec_mii_acc.c | 139 +
99 .../sdk_fman/Peripherals/FM/MAC/tgec_mii_acc.h | 80 +
100 .../sdk_fman/Peripherals/FM/MACSEC/Makefile | 15 +
101 .../sdk_fman/Peripherals/FM/MACSEC/fm_macsec.c | 237 +
102 .../sdk_fman/Peripherals/FM/MACSEC/fm_macsec.h | 203 +
103 .../Peripherals/FM/MACSEC/fm_macsec_guest.c | 59 +
104 .../Peripherals/FM/MACSEC/fm_macsec_master.c | 1031 +++
105 .../Peripherals/FM/MACSEC/fm_macsec_master.h | 479 ++
106 .../Peripherals/FM/MACSEC/fm_macsec_secy.c | 883 +++
107 .../Peripherals/FM/MACSEC/fm_macsec_secy.h | 144 +
108 .../freescale/sdk_fman/Peripherals/FM/Makefile | 23 +
109 .../freescale/sdk_fman/Peripherals/FM/Pcd/Makefile | 26 +
110 .../freescale/sdk_fman/Peripherals/FM/Pcd/crc64.h | 360 +
111 .../freescale/sdk_fman/Peripherals/FM/Pcd/fm_cc.c | 7582 ++++++++++++++++++++
112 .../freescale/sdk_fman/Peripherals/FM/Pcd/fm_cc.h | 399 +
113 .../freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.c | 3242 +++++++++
114 .../freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.h | 206 +
115 .../sdk_fman/Peripherals/FM/Pcd/fm_manip.c | 5571 ++++++++++++++
116 .../sdk_fman/Peripherals/FM/Pcd/fm_manip.h | 555 ++
117 .../freescale/sdk_fman/Peripherals/FM/Pcd/fm_pcd.c | 2095 ++++++
118 .../freescale/sdk_fman/Peripherals/FM/Pcd/fm_pcd.h | 543 ++
119 .../sdk_fman/Peripherals/FM/Pcd/fm_pcd_ipc.h | 280 +
120 .../sdk_fman/Peripherals/FM/Pcd/fm_plcr.c | 1847 +++++
121 .../sdk_fman/Peripherals/FM/Pcd/fm_plcr.h | 165 +
122 .../freescale/sdk_fman/Peripherals/FM/Pcd/fm_prs.c | 423 ++
123 .../freescale/sdk_fman/Peripherals/FM/Pcd/fm_prs.h | 316 +
124 .../sdk_fman/Peripherals/FM/Pcd/fm_replic.c | 984 +++
125 .../sdk_fman/Peripherals/FM/Pcd/fm_replic.h | 101 +
126 .../sdk_fman/Peripherals/FM/Pcd/fman_kg.c | 890 +++
127 .../sdk_fman/Peripherals/FM/Pcd/fman_prs.c | 129 +
128 .../sdk_fman/Peripherals/FM/Port/Makefile | 15 +
129 .../sdk_fman/Peripherals/FM/Port/fm_port.c | 6437 +++++++++++++++++
130 .../sdk_fman/Peripherals/FM/Port/fm_port.h | 999 +++
131 .../sdk_fman/Peripherals/FM/Port/fm_port_dsar.h | 494 ++
132 .../sdk_fman/Peripherals/FM/Port/fm_port_im.c | 753 ++
133 .../sdk_fman/Peripherals/FM/Port/fman_port.c | 1570 ++++
134 .../freescale/sdk_fman/Peripherals/FM/Rtc/Makefile | 15 +
135 .../freescale/sdk_fman/Peripherals/FM/Rtc/fm_rtc.c | 692 ++
136 .../freescale/sdk_fman/Peripherals/FM/Rtc/fm_rtc.h | 96 +
137 .../sdk_fman/Peripherals/FM/Rtc/fman_rtc.c | 334 +
138 .../freescale/sdk_fman/Peripherals/FM/SP/Makefile | 15 +
139 .../freescale/sdk_fman/Peripherals/FM/SP/fm_sp.c | 757 ++
140 .../freescale/sdk_fman/Peripherals/FM/SP/fm_sp.h | 85 +
141 .../freescale/sdk_fman/Peripherals/FM/SP/fman_sp.c | 197 +
142 .../freescale/sdk_fman/Peripherals/FM/fm.c | 5216 ++++++++++++++
143 .../freescale/sdk_fman/Peripherals/FM/fm.h | 648 ++
144 .../freescale/sdk_fman/Peripherals/FM/fm_ipc.h | 465 ++
145 .../freescale/sdk_fman/Peripherals/FM/fm_muram.c | 174 +
146 .../freescale/sdk_fman/Peripherals/FM/fman.c | 1400 ++++
147 .../sdk_fman/Peripherals/FM/inc/fm_common.h | 1214 ++++
148 .../freescale/sdk_fman/Peripherals/FM/inc/fm_hc.h | 93 +
149 .../sdk_fman/Peripherals/FM/inc/fm_sp_common.h | 117 +
150 .../net/ethernet/freescale/sdk_fman/etc/Makefile | 12 +
151 .../net/ethernet/freescale/sdk_fman/etc/error.c | 95 +
152 drivers/net/ethernet/freescale/sdk_fman/etc/list.c | 71 +
153 .../net/ethernet/freescale/sdk_fman/etc/memcpy.c | 620 ++
154 drivers/net/ethernet/freescale/sdk_fman/etc/mm.c | 1155 +++
155 drivers/net/ethernet/freescale/sdk_fman/etc/mm.h | 105 +
156 .../net/ethernet/freescale/sdk_fman/etc/sprint.c | 81 +
157 .../ethernet/freescale/sdk_fman/fmanv3h_dflags.h | 57 +
158 .../ethernet/freescale/sdk_fman/fmanv3l_dflags.h | 56 +
159 .../sdk_fman/inc/Peripherals/crc_mac_addr_ext.h | 364 +
160 .../freescale/sdk_fman/inc/Peripherals/dpaa_ext.h | 210 +
161 .../freescale/sdk_fman/inc/Peripherals/fm_ext.h | 1731 +++++
162 .../sdk_fman/inc/Peripherals/fm_mac_ext.h | 887 +++
163 .../sdk_fman/inc/Peripherals/fm_macsec_ext.h | 1271 ++++
164 .../sdk_fman/inc/Peripherals/fm_muram_ext.h | 170 +
165 .../sdk_fman/inc/Peripherals/fm_pcd_ext.h | 3974 ++++++++++
166 .../sdk_fman/inc/Peripherals/fm_port_ext.h | 2608 +++++++
167 .../sdk_fman/inc/Peripherals/fm_rtc_ext.h | 619 ++
168 .../sdk_fman/inc/Peripherals/fm_vsp_ext.h | 411 ++
169 .../sdk_fman/inc/Peripherals/mii_acc_ext.h | 76 +
170 .../net/ethernet/freescale/sdk_fman/inc/core_ext.h | 90 +
171 .../freescale/sdk_fman/inc/cores/arm_ext.h | 55 +
172 .../freescale/sdk_fman/inc/cores/e500v2_ext.h | 476 ++
173 .../freescale/sdk_fman/inc/cores/ppc_ext.h | 141 +
174 .../ethernet/freescale/sdk_fman/inc/ddr_std_ext.h | 77 +
175 .../ethernet/freescale/sdk_fman/inc/debug_ext.h | 233 +
176 .../ethernet/freescale/sdk_fman/inc/endian_ext.h | 447 ++
177 .../net/ethernet/freescale/sdk_fman/inc/enet_ext.h | 205 +
178 .../ethernet/freescale/sdk_fman/inc/error_ext.h | 529 ++
179 .../ethernet/freescale/sdk_fman/inc/etc/list_ext.h | 358 +
180 .../ethernet/freescale/sdk_fman/inc/etc/mem_ext.h | 318 +
181 .../freescale/sdk_fman/inc/etc/memcpy_ext.h | 208 +
182 .../ethernet/freescale/sdk_fman/inc/etc/mm_ext.h | 310 +
183 .../freescale/sdk_fman/inc/etc/sprint_ext.h | 118 +
184 .../sdk_fman/inc/flib/common/arch/ppc_access.h | 37 +
185 .../freescale/sdk_fman/inc/flib/common/general.h | 52 +
186 .../freescale/sdk_fman/inc/flib/fman_common.h | 78 +
187 .../freescale/sdk_fman/inc/flib/fsl_enet.h | 273 +
188 .../freescale/sdk_fman/inc/flib/fsl_fman.h | 825 +++
189 .../freescale/sdk_fman/inc/flib/fsl_fman_dtsec.h | 1096 +++
190 .../sdk_fman/inc/flib/fsl_fman_dtsec_mii_acc.h | 107 +
191 .../freescale/sdk_fman/inc/flib/fsl_fman_kg.h | 514 ++
192 .../freescale/sdk_fman/inc/flib/fsl_fman_memac.h | 434 ++
193 .../sdk_fman/inc/flib/fsl_fman_memac_mii_acc.h | 78 +
194 .../freescale/sdk_fman/inc/flib/fsl_fman_port.h | 593 ++
195 .../freescale/sdk_fman/inc/flib/fsl_fman_prs.h | 102 +
196 .../freescale/sdk_fman/inc/flib/fsl_fman_rtc.h | 449 ++
197 .../freescale/sdk_fman/inc/flib/fsl_fman_sp.h | 138 +
198 .../freescale/sdk_fman/inc/flib/fsl_fman_tgec.h | 479 ++
199 .../integrations/FMANV3H/dpaa_integration_ext.h | 291 +
200 .../sdk_fman/inc/integrations/FMANV3H/part_ext.h | 71 +
201 .../integrations/FMANV3H/part_integration_ext.h | 304 +
202 .../integrations/FMANV3L/dpaa_integration_ext.h | 293 +
203 .../sdk_fman/inc/integrations/FMANV3L/part_ext.h | 59 +
204 .../integrations/FMANV3L/part_integration_ext.h | 304 +
205 .../inc/integrations/LS1043/dpaa_integration_ext.h | 291 +
206 .../sdk_fman/inc/integrations/LS1043/part_ext.h | 64 +
207 .../inc/integrations/LS1043/part_integration_ext.h | 185 +
208 .../inc/integrations/P1023/dpaa_integration_ext.h | 213 +
209 .../sdk_fman/inc/integrations/P1023/part_ext.h | 82 +
210 .../inc/integrations/P1023/part_integration_ext.h | 635 ++
211 .../P3040_P4080_P5020/dpaa_integration_ext.h | 276 +
212 .../inc/integrations/P3040_P4080_P5020/part_ext.h | 83 +
213 .../P3040_P4080_P5020/part_integration_ext.h | 336 +
214 .../net/ethernet/freescale/sdk_fman/inc/math_ext.h | 100 +
215 .../net/ethernet/freescale/sdk_fman/inc/ncsw_ext.h | 435 ++
216 .../net/ethernet/freescale/sdk_fman/inc/net_ext.h | 430 ++
217 .../net/ethernet/freescale/sdk_fman/inc/std_ext.h | 48 +
218 .../ethernet/freescale/sdk_fman/inc/stdarg_ext.h | 49 +
219 .../ethernet/freescale/sdk_fman/inc/stdlib_ext.h | 162 +
220 .../ethernet/freescale/sdk_fman/inc/string_ext.h | 56 +
221 .../ethernet/freescale/sdk_fman/inc/types_ext.h | 62 +
222 .../ethernet/freescale/sdk_fman/inc/xx_common.h | 56 +
223 .../net/ethernet/freescale/sdk_fman/inc/xx_ext.h | 791 ++
224 .../ethernet/freescale/sdk_fman/ls1043_dflags.h | 56 +
225 .../net/ethernet/freescale/sdk_fman/ncsw_config.mk | 53 +
226 .../net/ethernet/freescale/sdk_fman/p1023_dflags.h | 65 +
227 .../freescale/sdk_fman/p3040_4080_5020_dflags.h | 62 +
228 .../net/ethernet/freescale/sdk_fman/src/Makefile | 11 +
229 .../freescale/sdk_fman/src/inc/system/sys_ext.h | 118 +
230 .../freescale/sdk_fman/src/inc/system/sys_io_ext.h | 46 +
231 .../freescale/sdk_fman/src/inc/types_linux.h | 208 +
232 .../sdk_fman/src/inc/wrapper/fsl_fman_test.h | 84 +
233 .../sdk_fman/src/inc/wrapper/lnxwrp_exp_sym.h | 130 +
234 .../sdk_fman/src/inc/wrapper/lnxwrp_fm_ext.h | 163 +
235 .../sdk_fman/src/inc/wrapper/lnxwrp_fsl_fman.h | 921 +++
236 .../ethernet/freescale/sdk_fman/src/inc/xx/xx.h | 50 +
237 .../freescale/sdk_fman/src/system/Makefile | 10 +
238 .../freescale/sdk_fman/src/system/sys_io.c | 171 +
239 .../freescale/sdk_fman/src/wrapper/Makefile | 19 +
240 .../freescale/sdk_fman/src/wrapper/fman_test.c | 1665 +++++
241 .../freescale/sdk_fman/src/wrapper/lnxwrp_fm.c | 2910 ++++++++
242 .../freescale/sdk_fman/src/wrapper/lnxwrp_fm.h | 294 +
243 .../sdk_fman/src/wrapper/lnxwrp_fm_port.c | 1512 ++++
244 .../sdk_fman/src/wrapper/lnxwrp_ioctls_fm.c | 4854 +++++++++++++
245 .../sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.c | 1297 ++++
246 .../sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.h | 755 ++
247 .../sdk_fman/src/wrapper/lnxwrp_resources.h | 121 +
248 .../sdk_fman/src/wrapper/lnxwrp_resources_ut.c | 191 +
249 .../sdk_fman/src/wrapper/lnxwrp_resources_ut.h | 144 +
250 .../sdk_fman/src/wrapper/lnxwrp_resources_ut.make | 28 +
251 .../freescale/sdk_fman/src/wrapper/lnxwrp_sysfs.c | 60 +
252 .../freescale/sdk_fman/src/wrapper/lnxwrp_sysfs.h | 60 +
253 .../sdk_fman/src/wrapper/lnxwrp_sysfs_fm.c | 1855 +++++
254 .../sdk_fman/src/wrapper/lnxwrp_sysfs_fm.h | 136 +
255 .../sdk_fman/src/wrapper/lnxwrp_sysfs_fm_port.c | 1268 ++++
256 .../sdk_fman/src/wrapper/lnxwrp_sysfs_fm_port.h | 56 +
257 .../ethernet/freescale/sdk_fman/src/xx/Makefile | 18 +
258 .../freescale/sdk_fman/src/xx/module_strings.c | 46 +
259 .../freescale/sdk_fman/src/xx/xx_arm_linux.c | 905 +++
260 .../ethernet/freescale/sdk_fman/src/xx/xx_linux.c | 918 +++
261 drivers/staging/fsl_qbman/Kconfig | 228 +
262 drivers/staging/fsl_qbman/Makefile | 28 +
263 drivers/staging/fsl_qbman/bman_config.c | 720 ++
264 drivers/staging/fsl_qbman/bman_debugfs.c | 119 +
265 drivers/staging/fsl_qbman/bman_driver.c | 559 ++
266 drivers/staging/fsl_qbman/bman_high.c | 1145 +++
267 drivers/staging/fsl_qbman/bman_low.h | 565 ++
268 drivers/staging/fsl_qbman/bman_private.h | 166 +
269 drivers/staging/fsl_qbman/bman_test.c | 56 +
270 drivers/staging/fsl_qbman/bman_test.h | 44 +
271 drivers/staging/fsl_qbman/bman_test_high.c | 183 +
272 drivers/staging/fsl_qbman/bman_test_thresh.c | 196 +
273 drivers/staging/fsl_qbman/dpa_alloc.c | 706 ++
274 drivers/staging/fsl_qbman/dpa_sys.h | 259 +
275 drivers/staging/fsl_qbman/dpa_sys_arm.h | 95 +
276 drivers/staging/fsl_qbman/dpa_sys_arm64.h | 102 +
277 drivers/staging/fsl_qbman/dpa_sys_ppc32.h | 70 +
278 drivers/staging/fsl_qbman/dpa_sys_ppc64.h | 79 +
279 drivers/staging/fsl_qbman/fsl_usdpaa.c | 2008 ++++++
280 drivers/staging/fsl_qbman/fsl_usdpaa_irq.c | 289 +
281 drivers/staging/fsl_qbman/qbman_driver.c | 88 +
282 drivers/staging/fsl_qbman/qman_config.c | 1224 ++++
283 drivers/staging/fsl_qbman/qman_debugfs.c | 1594 ++++
284 drivers/staging/fsl_qbman/qman_driver.c | 961 +++
285 drivers/staging/fsl_qbman/qman_high.c | 5655 +++++++++++++++
286 drivers/staging/fsl_qbman/qman_low.h | 1445 ++++
287 drivers/staging/fsl_qbman/qman_private.h | 398 +
288 drivers/staging/fsl_qbman/qman_test.c | 57 +
289 drivers/staging/fsl_qbman/qman_test.h | 45 +
290 drivers/staging/fsl_qbman/qman_test_high.c | 216 +
291 drivers/staging/fsl_qbman/qman_test_hotpotato.c | 502 ++
292 drivers/staging/fsl_qbman/qman_utility.c | 129 +
293 include/linux/fsl/svr.h | 97 +
294 include/linux/fsl_bman.h | 532 ++
295 include/linux/fsl_qman.h | 3910 ++++++++++
296 include/linux/fsl_usdpaa.h | 372 +
297 include/linux/netdev_features.h | 2 +
298 include/uapi/linux/fmd/Kbuild | 5 +
299 include/uapi/linux/fmd/Peripherals/Kbuild | 4 +
300 include/uapi/linux/fmd/Peripherals/fm_ioctls.h | 628 ++
301 include/uapi/linux/fmd/Peripherals/fm_pcd_ioctls.h | 3084 ++++++++
302 .../uapi/linux/fmd/Peripherals/fm_port_ioctls.h | 973 +++
303 .../uapi/linux/fmd/Peripherals/fm_test_ioctls.h | 208 +
304 include/uapi/linux/fmd/integrations/Kbuild | 1 +
305 .../linux/fmd/integrations/integration_ioctls.h | 56 +
306 include/uapi/linux/fmd/ioctls.h | 96 +
307 include/uapi/linux/fmd/net_ioctls.h | 430 ++
308 net/sched/sch_generic.c | 7 +
309 276 files changed, 153982 insertions(+), 277 deletions(-)
310 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/Kconfig
311 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/Makefile
312 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_1588.c
313 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_1588.h
314 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_debugfs.c
315 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_debugfs.h
316 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.c
317 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.h
318 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_base.c
319 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_base.h
320 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
321 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.h
322 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.c
323 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.h
324 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_proxy.c
325 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c
326 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sysfs.c
327 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_trace.h
328 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_ethtool.c
329 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/mac-api.c
330 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/mac.c
331 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/mac.h
332 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/offline_port.c
333 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/offline_port.h
334 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Kconfig
335 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Makefile
336 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/HC/Makefile
337 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/HC/hc.c
338 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/Makefile
339 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/dtsec.c
340 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/dtsec.h
341 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/dtsec_mii_acc.c
342 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/dtsec_mii_acc.h
343 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/fm_mac.c
344 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/fm_mac.h
345 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/fman_crc32.c
346 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/fman_crc32.h
347 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/fman_dtsec.c
348 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/fman_dtsec_mii_acc.c
349 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/fman_memac.c
350 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/fman_memac_mii_acc.c
351 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/fman_tgec.c
352 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/memac.c
353 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/memac.h
354 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/memac_mii_acc.c
355 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/memac_mii_acc.h
356 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/tgec.c
357 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/tgec.h
358 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/tgec_mii_acc.c
359 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/tgec_mii_acc.h
360 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MACSEC/Makefile
361 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MACSEC/fm_macsec.c
362 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MACSEC/fm_macsec.h
363 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MACSEC/fm_macsec_guest.c
364 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MACSEC/fm_macsec_master.c
365 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MACSEC/fm_macsec_master.h
366 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MACSEC/fm_macsec_secy.c
367 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MACSEC/fm_macsec_secy.h
368 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Makefile
369 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/Makefile
370 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/crc64.h
371 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_cc.c
372 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_cc.h
373 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.c
374 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.h
375 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_manip.c
376 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_manip.h
377 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_pcd.c
378 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_pcd.h
379 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_pcd_ipc.h
380 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_plcr.c
381 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_plcr.h
382 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_prs.c
383 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_prs.h
384 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_replic.c
385 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_replic.h
386 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fman_kg.c
387 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fman_prs.c
388 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/Makefile
389 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c
390 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.h
391 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port_dsar.h
392 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port_im.c
393 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fman_port.c
394 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Rtc/Makefile
395 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Rtc/fm_rtc.c
396 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Rtc/fm_rtc.h
397 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Rtc/fman_rtc.c
398 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/SP/Makefile
399 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/SP/fm_sp.c
400 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/SP/fm_sp.h
401 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/SP/fman_sp.c
402 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/fm.c
403 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/fm.h
404 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/fm_ipc.h
405 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/fm_muram.c
406 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/fman.c
407 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/inc/fm_common.h
408 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/inc/fm_hc.h
409 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/inc/fm_sp_common.h
410 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/etc/Makefile
411 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/etc/error.c
412 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/etc/list.c
413 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/etc/memcpy.c
414 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/etc/mm.c
415 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/etc/mm.h
416 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/etc/sprint.c
417 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/fmanv3h_dflags.h
418 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/fmanv3l_dflags.h
419 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/crc_mac_addr_ext.h
420 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/dpaa_ext.h
421 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/fm_ext.h
422 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/fm_mac_ext.h
423 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/fm_macsec_ext.h
424 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/fm_muram_ext.h
425 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/fm_pcd_ext.h
426 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/fm_port_ext.h
427 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/fm_rtc_ext.h
428 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/fm_vsp_ext.h
429 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/mii_acc_ext.h
430 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/core_ext.h
431 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/cores/arm_ext.h
432 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/cores/e500v2_ext.h
433 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/cores/ppc_ext.h
434 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/ddr_std_ext.h
435 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/debug_ext.h
436 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/endian_ext.h
437 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/enet_ext.h
438 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/error_ext.h
439 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/etc/list_ext.h
440 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/etc/mem_ext.h
441 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/etc/memcpy_ext.h
442 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/etc/mm_ext.h
443 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/etc/sprint_ext.h
444 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/flib/common/arch/ppc_access.h
445 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/flib/common/general.h
446 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fman_common.h
447 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_enet.h
448 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman.h
449 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_dtsec.h
450 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_dtsec_mii_acc.h
451 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_kg.h
452 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_memac.h
453 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_memac_mii_acc.h
454 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_port.h
455 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_prs.h
456 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_rtc.h
457 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_sp.h
458 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_tgec.h
459 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/FMANV3H/dpaa_integration_ext.h
460 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/FMANV3H/part_ext.h
461 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/FMANV3H/part_integration_ext.h
462 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/FMANV3L/dpaa_integration_ext.h
463 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/FMANV3L/part_ext.h
464 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/FMANV3L/part_integration_ext.h
465 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/LS1043/dpaa_integration_ext.h
466 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/LS1043/part_ext.h
467 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/LS1043/part_integration_ext.h
468 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/P1023/dpaa_integration_ext.h
469 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/P1023/part_ext.h
470 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/P1023/part_integration_ext.h
471 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/P3040_P4080_P5020/dpaa_integration_ext.h
472 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/P3040_P4080_P5020/part_ext.h
473 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/P3040_P4080_P5020/part_integration_ext.h
474 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/math_ext.h
475 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/ncsw_ext.h
476 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/net_ext.h
477 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/std_ext.h
478 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/stdarg_ext.h
479 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/stdlib_ext.h
480 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/string_ext.h
481 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/types_ext.h
482 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/xx_common.h
483 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/xx_ext.h
484 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/ls1043_dflags.h
485 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/ncsw_config.mk
486 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/p1023_dflags.h
487 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/p3040_4080_5020_dflags.h
488 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/Makefile
489 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/inc/system/sys_ext.h
490 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/inc/system/sys_io_ext.h
491 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/inc/types_linux.h
492 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/inc/wrapper/fsl_fman_test.h
493 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/inc/wrapper/lnxwrp_exp_sym.h
494 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/inc/wrapper/lnxwrp_fm_ext.h
495 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/inc/wrapper/lnxwrp_fsl_fman.h
496 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/inc/xx/xx.h
497 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/system/Makefile
498 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/system/sys_io.c
499 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/Makefile
500 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/fman_test.c
501 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_fm.c
502 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_fm.h
503 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_fm_port.c
504 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_ioctls_fm.c
505 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.c
506 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.h
507 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_resources.h
508 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_resources_ut.c
509 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_resources_ut.h
510 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_resources_ut.make
511 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs.c
512 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs.h
513 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs_fm.c
514 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs_fm.h
515 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs_fm_port.c
516 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs_fm_port.h
517 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/xx/Makefile
518 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/xx/module_strings.c
519 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/xx/xx_arm_linux.c
520 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/xx/xx_linux.c
521 create mode 100644 drivers/staging/fsl_qbman/Kconfig
522 create mode 100644 drivers/staging/fsl_qbman/Makefile
523 create mode 100644 drivers/staging/fsl_qbman/bman_config.c
524 create mode 100644 drivers/staging/fsl_qbman/bman_debugfs.c
525 create mode 100644 drivers/staging/fsl_qbman/bman_driver.c
526 create mode 100644 drivers/staging/fsl_qbman/bman_high.c
527 create mode 100644 drivers/staging/fsl_qbman/bman_low.h
528 create mode 100644 drivers/staging/fsl_qbman/bman_private.h
529 create mode 100644 drivers/staging/fsl_qbman/bman_test.c
530 create mode 100644 drivers/staging/fsl_qbman/bman_test.h
531 create mode 100644 drivers/staging/fsl_qbman/bman_test_high.c
532 create mode 100644 drivers/staging/fsl_qbman/bman_test_thresh.c
533 create mode 100644 drivers/staging/fsl_qbman/dpa_alloc.c
534 create mode 100644 drivers/staging/fsl_qbman/dpa_sys.h
535 create mode 100644 drivers/staging/fsl_qbman/dpa_sys_arm.h
536 create mode 100644 drivers/staging/fsl_qbman/dpa_sys_arm64.h
537 create mode 100644 drivers/staging/fsl_qbman/dpa_sys_ppc32.h
538 create mode 100644 drivers/staging/fsl_qbman/dpa_sys_ppc64.h
539 create mode 100644 drivers/staging/fsl_qbman/fsl_usdpaa.c
540 create mode 100644 drivers/staging/fsl_qbman/fsl_usdpaa_irq.c
541 create mode 100644 drivers/staging/fsl_qbman/qbman_driver.c
542 create mode 100644 drivers/staging/fsl_qbman/qman_config.c
543 create mode 100644 drivers/staging/fsl_qbman/qman_debugfs.c
544 create mode 100644 drivers/staging/fsl_qbman/qman_driver.c
545 create mode 100644 drivers/staging/fsl_qbman/qman_high.c
546 create mode 100644 drivers/staging/fsl_qbman/qman_low.h
547 create mode 100644 drivers/staging/fsl_qbman/qman_private.h
548 create mode 100644 drivers/staging/fsl_qbman/qman_test.c
549 create mode 100644 drivers/staging/fsl_qbman/qman_test.h
550 create mode 100644 drivers/staging/fsl_qbman/qman_test_high.c
551 create mode 100644 drivers/staging/fsl_qbman/qman_test_hotpotato.c
552 create mode 100644 drivers/staging/fsl_qbman/qman_utility.c
553 create mode 100644 include/linux/fsl/svr.h
554 create mode 100644 include/linux/fsl_bman.h
555 create mode 100644 include/linux/fsl_qman.h
556 create mode 100644 include/linux/fsl_usdpaa.h
557 create mode 100644 include/uapi/linux/fmd/Kbuild
558 create mode 100644 include/uapi/linux/fmd/Peripherals/Kbuild
559 create mode 100644 include/uapi/linux/fmd/Peripherals/fm_ioctls.h
560 create mode 100644 include/uapi/linux/fmd/Peripherals/fm_pcd_ioctls.h
561 create mode 100644 include/uapi/linux/fmd/Peripherals/fm_port_ioctls.h
562 create mode 100644 include/uapi/linux/fmd/Peripherals/fm_test_ioctls.h
563 create mode 100644 include/uapi/linux/fmd/integrations/Kbuild
564 create mode 100644 include/uapi/linux/fmd/integrations/integration_ioctls.h
565 create mode 100644 include/uapi/linux/fmd/ioctls.h
566 create mode 100644 include/uapi/linux/fmd/net_ioctls.h
567
568 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
569 +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
570 @@ -50,9 +50,13 @@
571 #include <linux/highmem.h>
572 #include <linux/percpu.h>
573 #include <linux/dma-mapping.h>
574 +#include <linux/iommu.h>
575 #include <linux/sort.h>
576 #include <soc/fsl/bman.h>
577 #include <soc/fsl/qman.h>
578 +#if !defined(CONFIG_PPC) && defined(CONFIG_SOC_BUS)
579 +#include <linux/sys_soc.h> /* soc_device_match */
580 +#endif
581
582 #include "fman.h"
583 #include "fman_port.h"
584 @@ -73,6 +77,10 @@ static u16 tx_timeout = 1000;
585 module_param(tx_timeout, ushort, 0444);
586 MODULE_PARM_DESC(tx_timeout, "The Tx timeout in ms");
587
588 +#ifndef CONFIG_PPC
589 +bool dpaa_errata_a010022;
590 +#endif
591 +
592 #define FM_FD_STAT_RX_ERRORS \
593 (FM_FD_ERR_DMA | FM_FD_ERR_PHYSICAL | \
594 FM_FD_ERR_SIZE | FM_FD_ERR_CLS_DISCARD | \
595 @@ -388,34 +396,19 @@ out:
596
597 static struct mac_device *dpaa_mac_dev_get(struct platform_device *pdev)
598 {
599 - struct platform_device *of_dev;
600 struct dpaa_eth_data *eth_data;
601 - struct device *dpaa_dev, *dev;
602 - struct device_node *mac_node;
603 + struct device *dpaa_dev;
604 struct mac_device *mac_dev;
605
606 dpaa_dev = &pdev->dev;
607 eth_data = dpaa_dev->platform_data;
608 - if (!eth_data)
609 + if (!eth_data) {
610 + dev_err(dpaa_dev, "eth_data missing\n");
611 return ERR_PTR(-ENODEV);
612 -
613 - mac_node = eth_data->mac_node;
614 -
615 - of_dev = of_find_device_by_node(mac_node);
616 - if (!of_dev) {
617 - dev_err(dpaa_dev, "of_find_device_by_node(%pOF) failed\n",
618 - mac_node);
619 - of_node_put(mac_node);
620 - return ERR_PTR(-EINVAL);
621 }
622 - of_node_put(mac_node);
623 -
624 - dev = &of_dev->dev;
625 -
626 - mac_dev = dev_get_drvdata(dev);
627 + mac_dev = eth_data->mac_dev;
628 if (!mac_dev) {
629 - dev_err(dpaa_dev, "dev_get_drvdata(%s) failed\n",
630 - dev_name(dev));
631 + dev_err(dpaa_dev, "mac_dev missing\n");
632 return ERR_PTR(-EINVAL);
633 }
634
635 @@ -472,6 +465,16 @@ static void dpaa_set_rx_mode(struct net_
636 err);
637 }
638
639 + if (!!(net_dev->flags & IFF_ALLMULTI) != priv->mac_dev->allmulti) {
640 + priv->mac_dev->allmulti = !priv->mac_dev->allmulti;
641 + err = priv->mac_dev->set_allmulti(priv->mac_dev->fman_mac,
642 + priv->mac_dev->allmulti);
643 + if (err < 0)
644 + netif_err(priv, drv, net_dev,
645 + "mac_dev->set_allmulti() = %d\n",
646 + err);
647 + }
648 +
649 err = priv->mac_dev->set_multi(net_dev, priv->mac_dev);
650 if (err < 0)
651 netif_err(priv, drv, net_dev, "mac_dev->set_multi() = %d\n",
652 @@ -1176,7 +1179,7 @@ static int dpaa_eth_init_tx_port(struct
653 buf_prefix_content.priv_data_size = buf_layout->priv_data_size;
654 buf_prefix_content.pass_prs_result = true;
655 buf_prefix_content.pass_hash_result = true;
656 - buf_prefix_content.pass_time_stamp = false;
657 + buf_prefix_content.pass_time_stamp = true;
658 buf_prefix_content.data_align = DPAA_FD_DATA_ALIGNMENT;
659
660 params.specific_params.non_rx_params.err_fqid = errq->fqid;
661 @@ -1218,7 +1221,7 @@ static int dpaa_eth_init_rx_port(struct
662 buf_prefix_content.priv_data_size = buf_layout->priv_data_size;
663 buf_prefix_content.pass_prs_result = true;
664 buf_prefix_content.pass_hash_result = true;
665 - buf_prefix_content.pass_time_stamp = false;
666 + buf_prefix_content.pass_time_stamp = true;
667 buf_prefix_content.data_align = DPAA_FD_DATA_ALIGNMENT;
668
669 rx_p = &params.specific_params.rx_params;
670 @@ -1500,7 +1503,19 @@ static int dpaa_bp_add_8_bufs(const stru
671 u8 i;
672
673 for (i = 0; i < 8; i++) {
674 +#ifndef CONFIG_PPC
675 + if (dpaa_errata_a010022) {
676 + struct page *page = alloc_page(GFP_KERNEL);
677 +
678 + if (unlikely(!page))
679 + goto release_previous_buffs;
680 + new_buf = page_address(page);
681 + } else {
682 + new_buf = netdev_alloc_frag(dpaa_bp->raw_size);
683 + }
684 +#else
685 new_buf = netdev_alloc_frag(dpaa_bp->raw_size);
686 +#endif
687 if (unlikely(!new_buf)) {
688 dev_err(dev, "netdev_alloc_frag() failed, size %zu\n",
689 dpaa_bp->raw_size);
690 @@ -1600,6 +1615,17 @@ static int dpaa_eth_refill_bpools(struct
691 return 0;
692 }
693
694 +static phys_addr_t dpaa_iova_to_phys(struct device *dev, dma_addr_t addr)
695 +{
696 + struct iommu_domain *domain;
697 +
698 + domain = iommu_get_domain_for_dev(dev);
699 + if (domain)
700 + return iommu_iova_to_phys(domain, addr);
701 + else
702 + return addr;
703 +}
704 +
705 /* Cleanup function for outgoing frame descriptors that were built on Tx path,
706 * either contiguous frames or scatter/gather ones.
707 * Skb freeing is not handled here.
708 @@ -1615,24 +1641,41 @@ static struct sk_buff *dpaa_cleanup_tx_f
709 {
710 const enum dma_data_direction dma_dir = DMA_TO_DEVICE;
711 struct device *dev = priv->net_dev->dev.parent;
712 + struct skb_shared_hwtstamps shhwtstamps;
713 dma_addr_t addr = qm_fd_addr(fd);
714 const struct qm_sg_entry *sgt;
715 struct sk_buff **skbh, *skb;
716 int nr_frags, i;
717 + u64 ns;
718
719 - skbh = (struct sk_buff **)phys_to_virt(addr);
720 + skbh = (struct sk_buff **)phys_to_virt(dpaa_iova_to_phys(dev, addr));
721 skb = *skbh;
722
723 + if (priv->tx_tstamp && skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) {
724 + memset(&shhwtstamps, 0, sizeof(shhwtstamps));
725 +
726 + if (!fman_port_get_tstamp(priv->mac_dev->port[TX], (void *)skbh,
727 + &ns)) {
728 + shhwtstamps.hwtstamp = ns_to_ktime(ns);
729 + skb_tstamp_tx(skb, &shhwtstamps);
730 + } else {
731 + dev_warn(dev, "fman_port_get_tstamp failed!\n");
732 + }
733 + }
734 +
735 if (unlikely(qm_fd_get_format(fd) == qm_fd_sg)) {
736 nr_frags = skb_shinfo(skb)->nr_frags;
737 - dma_unmap_single(dev, addr,
738 - qm_fd_get_offset(fd) + DPAA_SGT_SIZE,
739 - dma_dir);
740
741 /* The sgt buffer has been allocated with netdev_alloc_frag(),
742 * it's from lowmem.
743 */
744 - sgt = phys_to_virt(addr + qm_fd_get_offset(fd));
745 + sgt = phys_to_virt(dpaa_iova_to_phys(dev,
746 + addr +
747 + qm_fd_get_offset(fd)));
748 +
749 + dma_unmap_single(dev, addr,
750 + qm_fd_get_offset(fd) + DPAA_SGT_SIZE,
751 + dma_dir);
752
753 /* sgt[0] is from lowmem, was dma_map_single()-ed */
754 dma_unmap_single(dev, qm_sg_addr(&sgt[0]),
755 @@ -1645,9 +1688,13 @@ static struct sk_buff *dpaa_cleanup_tx_f
756 dma_unmap_page(dev, qm_sg_addr(&sgt[i]),
757 qm_sg_entry_get_len(&sgt[i]), dma_dir);
758 }
759 -
760 - /* Free the page frag that we allocated on Tx */
761 - skb_free_frag(phys_to_virt(addr));
762 +#ifndef CONFIG_PPC
763 + if (dpaa_errata_a010022)
764 + put_page(virt_to_page(sgt));
765 + else
766 +#endif
767 + /* Free the page frag that we allocated on Tx */
768 + skb_free_frag(skbh);
769 } else {
770 dma_unmap_single(dev, addr,
771 skb_tail_pointer(skb) - (u8 *)skbh, dma_dir);
772 @@ -1678,26 +1725,21 @@ static u8 rx_csum_offload(const struct d
773 * accommodate the shared info area of the skb.
774 */
775 static struct sk_buff *contig_fd_to_skb(const struct dpaa_priv *priv,
776 - const struct qm_fd *fd)
777 + const struct qm_fd *fd,
778 + struct dpaa_bp *dpaa_bp,
779 + void *vaddr)
780 {
781 ssize_t fd_off = qm_fd_get_offset(fd);
782 - dma_addr_t addr = qm_fd_addr(fd);
783 - struct dpaa_bp *dpaa_bp;
784 struct sk_buff *skb;
785 - void *vaddr;
786
787 - vaddr = phys_to_virt(addr);
788 WARN_ON(!IS_ALIGNED((unsigned long)vaddr, SMP_CACHE_BYTES));
789
790 - dpaa_bp = dpaa_bpid2pool(fd->bpid);
791 - if (!dpaa_bp)
792 - goto free_buffer;
793 -
794 skb = build_skb(vaddr, dpaa_bp->size +
795 SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
796 if (unlikely(!skb)) {
797 WARN_ONCE(1, "Build skb failure on Rx\n");
798 - goto free_buffer;
799 + skb_free_frag(vaddr);
800 + return NULL;
801 }
802 WARN_ON(fd_off != priv->rx_headroom);
803 skb_reserve(skb, fd_off);
804 @@ -1706,10 +1748,6 @@ static struct sk_buff *contig_fd_to_skb(
805 skb->ip_summed = rx_csum_offload(priv, fd);
806
807 return skb;
808 -
809 -free_buffer:
810 - skb_free_frag(vaddr);
811 - return NULL;
812 }
813
814 /* Build an skb with the data of the first S/G entry in the linear portion and
815 @@ -1718,14 +1756,14 @@ free_buffer:
816 * The page fragment holding the S/G Table is recycled here.
817 */
818 static struct sk_buff *sg_fd_to_skb(const struct dpaa_priv *priv,
819 - const struct qm_fd *fd)
820 + const struct qm_fd *fd,
821 + struct dpaa_bp *dpaa_bp,
822 + void *vaddr)
823 {
824 ssize_t fd_off = qm_fd_get_offset(fd);
825 - dma_addr_t addr = qm_fd_addr(fd);
826 const struct qm_sg_entry *sgt;
827 struct page *page, *head_page;
828 - struct dpaa_bp *dpaa_bp;
829 - void *vaddr, *sg_vaddr;
830 + void *sg_vaddr;
831 int frag_off, frag_len;
832 struct sk_buff *skb;
833 dma_addr_t sg_addr;
834 @@ -1734,29 +1772,33 @@ static struct sk_buff *sg_fd_to_skb(cons
835 int *count_ptr;
836 int i;
837
838 - vaddr = phys_to_virt(addr);
839 WARN_ON(!IS_ALIGNED((unsigned long)vaddr, SMP_CACHE_BYTES));
840
841 /* Iterate through the SGT entries and add data buffers to the skb */
842 sgt = vaddr + fd_off;
843 + skb = NULL;
844 for (i = 0; i < DPAA_SGT_MAX_ENTRIES; i++) {
845 /* Extension bit is not supported */
846 WARN_ON(qm_sg_entry_is_ext(&sgt[i]));
847
848 sg_addr = qm_sg_addr(&sgt[i]);
849 - sg_vaddr = phys_to_virt(sg_addr);
850 - WARN_ON(!IS_ALIGNED((unsigned long)sg_vaddr,
851 - SMP_CACHE_BYTES));
852
853 /* We may use multiple Rx pools */
854 dpaa_bp = dpaa_bpid2pool(sgt[i].bpid);
855 - if (!dpaa_bp)
856 + if (!dpaa_bp) {
857 + pr_info("%s: fail to get dpaa_bp for sg bpid %d\n",
858 + __func__, sgt[i].bpid);
859 goto free_buffers;
860 + }
861 + sg_vaddr = phys_to_virt(dpaa_iova_to_phys(dpaa_bp->dev,
862 + sg_addr));
863 + WARN_ON(!IS_ALIGNED((unsigned long)sg_vaddr,
864 + SMP_CACHE_BYTES));
865
866 count_ptr = this_cpu_ptr(dpaa_bp->percpu_count);
867 dma_unmap_single(dpaa_bp->dev, sg_addr, dpaa_bp->size,
868 DMA_FROM_DEVICE);
869 - if (i == 0) {
870 + if (!skb) {
871 sz = dpaa_bp->size +
872 SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
873 skb = build_skb(sg_vaddr, sz);
874 @@ -1823,10 +1865,11 @@ free_buffers:
875 /* free all the SG entries */
876 for (i = 0; i < DPAA_SGT_MAX_ENTRIES ; i++) {
877 sg_addr = qm_sg_addr(&sgt[i]);
878 - sg_vaddr = phys_to_virt(sg_addr);
879 - skb_free_frag(sg_vaddr);
880 dpaa_bp = dpaa_bpid2pool(sgt[i].bpid);
881 if (dpaa_bp) {
882 + sg_addr = dpaa_iova_to_phys(dpaa_bp->dev, sg_addr);
883 + sg_vaddr = phys_to_virt(sg_addr);
884 + skb_free_frag(sg_vaddr);
885 count_ptr = this_cpu_ptr(dpaa_bp->percpu_count);
886 (*count_ptr)--;
887 }
888 @@ -1909,16 +1952,28 @@ static int skb_to_sg_fd(struct dpaa_priv
889 size_t frag_len;
890 void *sgt_buf;
891
892 - /* get a page frag to store the SGTable */
893 - sz = SKB_DATA_ALIGN(priv->tx_headroom + DPAA_SGT_SIZE);
894 - sgt_buf = netdev_alloc_frag(sz);
895 - if (unlikely(!sgt_buf)) {
896 - netdev_err(net_dev, "netdev_alloc_frag() failed for size %d\n",
897 - sz);
898 - return -ENOMEM;
899 +#ifndef CONFIG_PPC
900 + if (unlikely(dpaa_errata_a010022)) {
901 + struct page *page = alloc_page(GFP_ATOMIC);
902 + if (unlikely(!page))
903 + return -ENOMEM;
904 + sgt_buf = page_address(page);
905 + } else {
906 +#endif
907 + /* get a page frag to store the SGTable */
908 + sz = SKB_DATA_ALIGN(priv->tx_headroom + DPAA_SGT_SIZE);
909 + sgt_buf = netdev_alloc_frag(sz);
910 + if (unlikely(!sgt_buf)) {
911 + netdev_err(net_dev,
912 + "netdev_alloc_frag() failed for size %d\n",
913 + sz);
914 + return -ENOMEM;
915 + }
916 +#ifndef CONFIG_PPC
917 }
918 +#endif
919
920 - /* Enable L3/L4 hardware checksum computation.
921 + /* Enable L3/L4 hardware checksum computation.
922 *
923 * We must do this before dma_map_single(DMA_TO_DEVICE), because we may
924 * need to write into the skb.
925 @@ -2036,6 +2091,121 @@ static inline int dpaa_xmit(struct dpaa_
926 return 0;
927 }
928
929 +#ifndef CONFIG_PPC
930 +/* On LS1043A SoC there is a known erratum ERR010022 that results in split DMA
931 + * transfers in the FMan under certain conditions. This, combined with a fixed
932 + * size FIFO of ongoing DMA transfers that may overflow when a split occurs,
933 + * results in the FMan stalling DMA transfers under high traffic. To avoid the
934 + * problem, one needs to prevent the DMA transfer splits to occur by preparing
935 + * the buffers
936 + */
937 +
938 +#define DPAA_A010022_HEADROOM 256
939 +#define CROSS_4K_BOUND(start, size) \
940 + (((start) + (size)) > (((start) + 0x1000) & ~0xFFF))
941 +
942 +static bool dpaa_errata_a010022_has_dma_issue(struct sk_buff *skb,
943 + struct dpaa_priv *priv)
944 +{
945 + int nr_frags, i = 0;
946 + skb_frag_t *frag;
947 +
948 + /* Transfers that do not start at 16B aligned addresses will be split;
949 + * Transfers that cross a 4K page boundary will also be split
950 + */
951 +
952 + /* Check if the frame data is aligned to 16 bytes */
953 + if ((uintptr_t)skb->data % DPAA_FD_DATA_ALIGNMENT)
954 + return true;
955 +
956 + /* Check if the headroom crosses a boundary */
957 + if (CROSS_4K_BOUND((uintptr_t)skb->head, skb_headroom(skb)))
958 + return true;
959 +
960 + /* Check if the non-paged data crosses a boundary */
961 + if (CROSS_4K_BOUND((uintptr_t)skb->data, skb_headlen(skb)))
962 + return true;
963 +
964 + nr_frags = skb_shinfo(skb)->nr_frags;
965 +
966 + while (i < nr_frags) {
967 + frag = &skb_shinfo(skb)->frags[i];
968 +
969 + /* Check if a paged fragment crosses a boundary from its
970 + * offset to its end.
971 + */
972 + if (CROSS_4K_BOUND((uintptr_t)frag->page_offset, frag->size))
973 + return true;
974 +
975 + i++;
976 + }
977 +
978 + return false;
979 +}
980 +
981 +static struct sk_buff *dpaa_errata_a010022_prevent(struct sk_buff *skb,
982 + struct dpaa_priv *priv)
983 +{
984 + int trans_offset = skb_transport_offset(skb);
985 + int net_offset = skb_network_offset(skb);
986 + int nsize, npage_order, headroom;
987 + struct sk_buff *nskb = NULL;
988 + struct page *npage;
989 + void *npage_addr;
990 +
991 + if (!dpaa_errata_a010022_has_dma_issue(skb, priv))
992 + return skb;
993 +
994 + /* For the new skb we only need the old one's data (both non-paged and
995 + * paged). We can skip the old tailroom.
996 + *
997 + * The headroom also needs to fit our private info (64 bytes) but we
998 + * reserve 256 bytes instead in order to guarantee that the data is
999 + * aligned to 256.
1000 + */
1001 + headroom = DPAA_A010022_HEADROOM;
1002 + nsize = headroom + skb->len +
1003 + SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
1004 +
1005 + /* Reserve enough memory to accommodate Jumbo frames */
1006 + npage_order = (nsize - 1) / PAGE_SIZE;
1007 + npage = alloc_pages(GFP_ATOMIC | __GFP_COMP, npage_order);
1008 + if (unlikely(!npage)) {
1009 + WARN_ONCE(1, "Memory allocation failure\n");
1010 + return NULL;
1011 + }
1012 + npage_addr = page_address(npage);
1013 +
1014 + nskb = build_skb(npage_addr, nsize);
1015 + if (unlikely(!nskb))
1016 + goto err;
1017 +
1018 + /* Code borrowed and adapted from skb_copy() */
1019 + skb_reserve(nskb, headroom);
1020 + skb_put(nskb, skb->len);
1021 + if (skb_copy_bits(skb, 0, nskb->data, skb->len)) {
1022 + WARN_ONCE(1, "skb parsing failure\n");
1023 + goto err;
1024 + }
1025 + copy_skb_header(nskb, skb);
1026 + /* We move the headroom when we align it so we have to reset the
1027 + * network and transport header offsets relative to the new data
1028 + * pointer. The checksum offload relies on these offsets.
1029 + */
1030 + skb_set_network_header(nskb, net_offset);
1031 + skb_set_transport_header(nskb, trans_offset);
1032 +
1033 + dev_kfree_skb(skb);
1034 + return nskb;
1035 +
1036 +err:
1037 + if (nskb)
1038 + dev_kfree_skb(nskb);
1039 + put_page(npage);
1040 + return NULL;
1041 +}
1042 +#endif
1043 +
1044 static netdev_tx_t
1045 dpaa_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
1046 {
1047 @@ -2043,6 +2213,7 @@ dpaa_start_xmit(struct sk_buff *skb, str
1048 bool nonlinear = skb_is_nonlinear(skb);
1049 struct rtnl_link_stats64 *percpu_stats;
1050 struct dpaa_percpu_priv *percpu_priv;
1051 + struct netdev_queue *txq;
1052 struct dpaa_priv *priv;
1053 struct qm_fd fd;
1054 int offset = 0;
1055 @@ -2070,24 +2241,47 @@ dpaa_start_xmit(struct sk_buff *skb, str
1056 /* MAX_SKB_FRAGS is equal or larger than our dpaa_SGT_MAX_ENTRIES;
1057 * make sure we don't feed FMan with more fragments than it supports.
1058 */
1059 - if (nonlinear &&
1060 - likely(skb_shinfo(skb)->nr_frags < DPAA_SGT_MAX_ENTRIES)) {
1061 - /* Just create a S/G fd based on the skb */
1062 - err = skb_to_sg_fd(priv, skb, &fd);
1063 - percpu_priv->tx_frag_skbuffs++;
1064 - } else {
1065 + if (unlikely(nonlinear &&
1066 + (skb_shinfo(skb)->nr_frags >= DPAA_SGT_MAX_ENTRIES))) {
1067 /* If the egress skb contains more fragments than we support
1068 * we have no choice but to linearize it ourselves.
1069 */
1070 - if (unlikely(nonlinear) && __skb_linearize(skb))
1071 + if (__skb_linearize(skb))
1072 goto enomem;
1073
1074 - /* Finally, create a contig FD from this skb */
1075 + nonlinear = skb_is_nonlinear(skb);
1076 + }
1077 +
1078 +#ifndef CONFIG_PPC
1079 + if (unlikely(dpaa_errata_a010022)) {
1080 + skb = dpaa_errata_a010022_prevent(skb, priv);
1081 + if (!skb)
1082 + goto enomem;
1083 + nonlinear = skb_is_nonlinear(skb);
1084 + }
1085 +#endif
1086 +
1087 + if (nonlinear) {
1088 + /* Just create a S/G fd based on the skb */
1089 + err = skb_to_sg_fd(priv, skb, &fd);
1090 + percpu_priv->tx_frag_skbuffs++;
1091 + } else {
1092 + /* Create a contig FD from this skb */
1093 err = skb_to_contig_fd(priv, skb, &fd, &offset);
1094 }
1095 if (unlikely(err < 0))
1096 goto skb_to_fd_failed;
1097
1098 + txq = netdev_get_tx_queue(net_dev, queue_mapping);
1099 +
1100 + /* LLTX requires to do our own update of trans_start */
1101 + txq->trans_start = jiffies;
1102 +
1103 + if (priv->tx_tstamp && skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) {
1104 + fd.cmd |= cpu_to_be32(FM_FD_CMD_UPD);
1105 + skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
1106 + }
1107 +
1108 if (likely(dpaa_xmit(priv, percpu_stats, queue_mapping, &fd) == 0))
1109 return NETDEV_TX_OK;
1110
1111 @@ -2219,14 +2413,8 @@ static enum qman_cb_dqrr_result rx_error
1112 if (dpaa_eth_napi_schedule(percpu_priv, portal))
1113 return qman_cb_dqrr_stop;
1114
1115 - if (dpaa_eth_refill_bpools(priv))
1116 - /* Unable to refill the buffer pool due to insufficient
1117 - * system memory. Just release the frame back into the pool,
1118 - * otherwise we'll soon end up with an empty buffer pool.
1119 - */
1120 - dpaa_fd_release(net_dev, &dq->fd);
1121 - else
1122 - dpaa_rx_error(net_dev, priv, percpu_priv, &dq->fd, fq->fqid);
1123 + dpaa_eth_refill_bpools(priv);
1124 + dpaa_rx_error(net_dev, priv, percpu_priv, &dq->fd, fq->fqid);
1125
1126 return qman_cb_dqrr_consume;
1127 }
1128 @@ -2235,6 +2423,7 @@ static enum qman_cb_dqrr_result rx_defau
1129 struct qman_fq *fq,
1130 const struct qm_dqrr_entry *dq)
1131 {
1132 + struct skb_shared_hwtstamps *shhwtstamps;
1133 struct rtnl_link_stats64 *percpu_stats;
1134 struct dpaa_percpu_priv *percpu_priv;
1135 const struct qm_fd *fd = &dq->fd;
1136 @@ -2248,6 +2437,7 @@ static enum qman_cb_dqrr_result rx_defau
1137 struct sk_buff *skb;
1138 int *count_ptr;
1139 void *vaddr;
1140 + u64 ns;
1141
1142 fd_status = be32_to_cpu(fd->status);
1143 fd_format = qm_fd_get_format(fd);
1144 @@ -2290,12 +2480,12 @@ static enum qman_cb_dqrr_result rx_defau
1145 if (!dpaa_bp)
1146 return qman_cb_dqrr_consume;
1147
1148 - dma_unmap_single(dpaa_bp->dev, addr, dpaa_bp->size, DMA_FROM_DEVICE);
1149 -
1150 /* prefetch the first 64 bytes of the frame or the SGT start */
1151 - vaddr = phys_to_virt(addr);
1152 + vaddr = phys_to_virt(dpaa_iova_to_phys(dpaa_bp->dev, addr));
1153 prefetch(vaddr + qm_fd_get_offset(fd));
1154
1155 + dma_unmap_single(dpaa_bp->dev, addr, dpaa_bp->size, DMA_FROM_DEVICE);
1156 +
1157 /* The only FD types that we may receive are contig and S/G */
1158 WARN_ON((fd_format != qm_fd_contig) && (fd_format != qm_fd_sg));
1159
1160 @@ -2306,12 +2496,22 @@ static enum qman_cb_dqrr_result rx_defau
1161 (*count_ptr)--;
1162
1163 if (likely(fd_format == qm_fd_contig))
1164 - skb = contig_fd_to_skb(priv, fd);
1165 + skb = contig_fd_to_skb(priv, fd, dpaa_bp, vaddr);
1166 else
1167 - skb = sg_fd_to_skb(priv, fd);
1168 + skb = sg_fd_to_skb(priv, fd, dpaa_bp, vaddr);
1169 if (!skb)
1170 return qman_cb_dqrr_consume;
1171
1172 + if (priv->rx_tstamp) {
1173 + shhwtstamps = skb_hwtstamps(skb);
1174 + memset(shhwtstamps, 0, sizeof(*shhwtstamps));
1175 +
1176 + if (!fman_port_get_tstamp(priv->mac_dev->port[RX], vaddr, &ns))
1177 + shhwtstamps->hwtstamp = ns_to_ktime(ns);
1178 + else
1179 + dev_warn(net_dev->dev.parent, "fman_port_get_tstamp failed!\n");
1180 + }
1181 +
1182 skb->protocol = eth_type_trans(skb, net_dev);
1183
1184 if (net_dev->features & NETIF_F_RXHASH && priv->keygen_in_use &&
1185 @@ -2440,6 +2640,44 @@ static void dpaa_eth_napi_disable(struct
1186 }
1187 }
1188
1189 +static void dpaa_adjust_link(struct net_device *net_dev)
1190 +{
1191 + struct mac_device *mac_dev;
1192 + struct dpaa_priv *priv;
1193 +
1194 + priv = netdev_priv(net_dev);
1195 + mac_dev = priv->mac_dev;
1196 + mac_dev->adjust_link(mac_dev);
1197 +}
1198 +
1199 +static int dpaa_phy_init(struct net_device *net_dev)
1200 +{
1201 + struct mac_device *mac_dev;
1202 + struct phy_device *phy_dev;
1203 + struct dpaa_priv *priv;
1204 +
1205 + priv = netdev_priv(net_dev);
1206 + mac_dev = priv->mac_dev;
1207 +
1208 + phy_dev = of_phy_connect(net_dev, mac_dev->phy_node,
1209 + &dpaa_adjust_link, 0,
1210 + mac_dev->phy_if);
1211 + if (!phy_dev) {
1212 + netif_err(priv, ifup, net_dev, "init_phy() failed\n");
1213 + return -ENODEV;
1214 + }
1215 +
1216 + /* Remove any features not supported by the controller */
1217 + phy_dev->supported &= mac_dev->if_support;
1218 + phy_dev->supported |= (SUPPORTED_Pause | SUPPORTED_Asym_Pause);
1219 + phy_dev->advertising = phy_dev->supported;
1220 +
1221 + mac_dev->phy_dev = phy_dev;
1222 + net_dev->phydev = phy_dev;
1223 +
1224 + return 0;
1225 +}
1226 +
1227 static int dpaa_open(struct net_device *net_dev)
1228 {
1229 struct mac_device *mac_dev;
1230 @@ -2450,12 +2688,9 @@ static int dpaa_open(struct net_device *
1231 mac_dev = priv->mac_dev;
1232 dpaa_eth_napi_enable(priv);
1233
1234 - net_dev->phydev = mac_dev->init_phy(net_dev, priv->mac_dev);
1235 - if (!net_dev->phydev) {
1236 - netif_err(priv, ifup, net_dev, "init_phy() failed\n");
1237 - err = -ENODEV;
1238 + err = dpaa_phy_init(net_dev);
1239 + if (err)
1240 goto phy_init_failed;
1241 - }
1242
1243 for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) {
1244 err = fman_port_enable(mac_dev->port[i]);
1245 @@ -2496,11 +2731,58 @@ static int dpaa_eth_stop(struct net_devi
1246 return err;
1247 }
1248
1249 +static int dpaa_ts_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1250 +{
1251 + struct dpaa_priv *priv = netdev_priv(dev);
1252 + struct hwtstamp_config config;
1253 +
1254 + if (copy_from_user(&config, rq->ifr_data, sizeof(config)))
1255 + return -EFAULT;
1256 +
1257 + switch (config.tx_type) {
1258 + case HWTSTAMP_TX_OFF:
1259 + /* Couldn't disable rx/tx timestamping separately.
1260 + * Do nothing here.
1261 + */
1262 + priv->tx_tstamp = false;
1263 + break;
1264 + case HWTSTAMP_TX_ON:
1265 + priv->mac_dev->set_tstamp(priv->mac_dev->fman_mac, true);
1266 + priv->tx_tstamp = true;
1267 + break;
1268 + default:
1269 + return -ERANGE;
1270 + }
1271 +
1272 + if (config.rx_filter == HWTSTAMP_FILTER_NONE) {
1273 + /* Couldn't disable rx/tx timestamping separately.
1274 + * Do nothing here.
1275 + */
1276 + priv->rx_tstamp = false;
1277 + } else {
1278 + priv->mac_dev->set_tstamp(priv->mac_dev->fman_mac, true);
1279 + priv->rx_tstamp = true;
1280 + /* TS is set for all frame types, not only those requested */
1281 + config.rx_filter = HWTSTAMP_FILTER_ALL;
1282 + }
1283 +
1284 + return copy_to_user(rq->ifr_data, &config, sizeof(config)) ?
1285 + -EFAULT : 0;
1286 +}
1287 +
1288 static int dpaa_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd)
1289 {
1290 - if (!net_dev->phydev)
1291 - return -EINVAL;
1292 - return phy_mii_ioctl(net_dev->phydev, rq, cmd);
1293 + int ret = -EINVAL;
1294 +
1295 + if (cmd == SIOCGMIIREG) {
1296 + if (net_dev->phydev)
1297 + return phy_mii_ioctl(net_dev->phydev, rq, cmd);
1298 + }
1299 +
1300 + if (cmd == SIOCSHWTSTAMP)
1301 + return dpaa_ts_ioctl(net_dev, rq, cmd);
1302 +
1303 + return ret;
1304 }
1305
1306 static const struct net_device_ops dpaa_ops = {
1307 @@ -2654,7 +2936,6 @@ static inline u16 dpaa_get_headroom(stru
1308 static int dpaa_eth_probe(struct platform_device *pdev)
1309 {
1310 struct dpaa_bp *dpaa_bps[DPAA_BPS_NUM] = {NULL};
1311 - struct dpaa_percpu_priv *percpu_priv;
1312 struct net_device *net_dev = NULL;
1313 struct dpaa_fq *dpaa_fq, *tmp;
1314 struct dpaa_priv *priv = NULL;
1315 @@ -2663,7 +2944,51 @@ static int dpaa_eth_probe(struct platfor
1316 int err = 0, i, channel;
1317 struct device *dev;
1318
1319 - dev = &pdev->dev;
1320 + err = bman_is_probed();
1321 + if (!err)
1322 + return -EPROBE_DEFER;
1323 + if (err < 0) {
1324 + dev_err(&pdev->dev, "failing probe due to bman probe error\n");
1325 + return -ENODEV;
1326 + }
1327 + err = qman_is_probed();
1328 + if (!err)
1329 + return -EPROBE_DEFER;
1330 + if (err < 0) {
1331 + dev_err(&pdev->dev, "failing probe due to qman probe error\n");
1332 + return -ENODEV;
1333 + }
1334 + err = bman_portals_probed();
1335 + if (!err)
1336 + return -EPROBE_DEFER;
1337 + if (err < 0) {
1338 + dev_err(&pdev->dev,
1339 + "failing probe due to bman portals probe error\n");
1340 + return -ENODEV;
1341 + }
1342 + err = qman_portals_probed();
1343 + if (!err)
1344 + return -EPROBE_DEFER;
1345 + if (err < 0) {
1346 + dev_err(&pdev->dev,
1347 + "failing probe due to qman portals probe error\n");
1348 + return -ENODEV;
1349 + }
1350 +
1351 + mac_dev = dpaa_mac_dev_get(pdev);
1352 + if (IS_ERR(mac_dev)) {
1353 + dev_err(&pdev->dev, "dpaa_mac_dev_get() failed\n");
1354 + err = PTR_ERR(mac_dev);
1355 + goto probe_err;
1356 + }
1357 +
1358 + /* device used for DMA mapping */
1359 + dev = fman_port_get_device(mac_dev->port[RX]);
1360 + err = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(40));
1361 + if (err) {
1362 + dev_err(dev, "dma_coerce_mask_and_coherent() failed\n");
1363 + return err;
1364 + }
1365
1366 /* Allocate this early, so we can store relevant information in
1367 * the private area
1368 @@ -2671,7 +2996,7 @@ static int dpaa_eth_probe(struct platfor
1369 net_dev = alloc_etherdev_mq(sizeof(*priv), DPAA_ETH_TXQ_NUM);
1370 if (!net_dev) {
1371 dev_err(dev, "alloc_etherdev_mq() failed\n");
1372 - goto alloc_etherdev_mq_failed;
1373 + return -ENOMEM;
1374 }
1375
1376 /* Do this here, so we can be verbose early */
1377 @@ -2683,13 +3008,6 @@ static int dpaa_eth_probe(struct platfor
1378
1379 priv->msg_enable = netif_msg_init(debug, DPAA_MSG_DEFAULT);
1380
1381 - mac_dev = dpaa_mac_dev_get(pdev);
1382 - if (IS_ERR(mac_dev)) {
1383 - dev_err(dev, "dpaa_mac_dev_get() failed\n");
1384 - err = PTR_ERR(mac_dev);
1385 - goto mac_probe_failed;
1386 - }
1387 -
1388 /* If fsl_fm_max_frm is set to a higher value than the all-common 1500,
1389 * we choose conservatively and let the user explicitly set a higher
1390 * MTU via ifconfig. Otherwise, the user may end up with different MTUs
1391 @@ -2705,21 +3023,13 @@ static int dpaa_eth_probe(struct platfor
1392 priv->buf_layout[RX].priv_data_size = DPAA_RX_PRIV_DATA_SIZE; /* Rx */
1393 priv->buf_layout[TX].priv_data_size = DPAA_TX_PRIV_DATA_SIZE; /* Tx */
1394
1395 - /* device used for DMA mapping */
1396 - set_dma_ops(dev, get_dma_ops(&pdev->dev));
1397 - err = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(40));
1398 - if (err) {
1399 - dev_err(dev, "dma_coerce_mask_and_coherent() failed\n");
1400 - goto dev_mask_failed;
1401 - }
1402 -
1403 /* bp init */
1404 for (i = 0; i < DPAA_BPS_NUM; i++) {
1405 - int err;
1406 -
1407 dpaa_bps[i] = dpaa_bp_alloc(dev);
1408 - if (IS_ERR(dpaa_bps[i]))
1409 - return PTR_ERR(dpaa_bps[i]);
1410 + if (IS_ERR(dpaa_bps[i])) {
1411 + err = PTR_ERR(dpaa_bps[i]);
1412 + goto free_dpaa_bps;
1413 + }
1414 /* the raw size of the buffers used for reception */
1415 dpaa_bps[i]->raw_size = bpool_buffer_raw_size(i, DPAA_BPS_NUM);
1416 /* avoid runtime computations by keeping the usable size here */
1417 @@ -2727,11 +3037,8 @@ static int dpaa_eth_probe(struct platfor
1418 dpaa_bps[i]->dev = dev;
1419
1420 err = dpaa_bp_alloc_pool(dpaa_bps[i]);
1421 - if (err < 0) {
1422 - dpaa_bps_free(priv);
1423 - priv->dpaa_bps[i] = NULL;
1424 - goto bp_create_failed;
1425 - }
1426 + if (err < 0)
1427 + goto free_dpaa_bps;
1428 priv->dpaa_bps[i] = dpaa_bps[i];
1429 }
1430
1431 @@ -2742,7 +3049,7 @@ static int dpaa_eth_probe(struct platfor
1432 err = dpaa_alloc_all_fqs(dev, &priv->dpaa_fq_list, &port_fqs);
1433 if (err < 0) {
1434 dev_err(dev, "dpaa_alloc_all_fqs() failed\n");
1435 - goto fq_probe_failed;
1436 + goto free_dpaa_bps;
1437 }
1438
1439 priv->mac_dev = mac_dev;
1440 @@ -2751,12 +3058,12 @@ static int dpaa_eth_probe(struct platfor
1441 if (channel < 0) {
1442 dev_err(dev, "dpaa_get_channel() failed\n");
1443 err = channel;
1444 - goto get_channel_failed;
1445 + goto free_dpaa_bps;
1446 }
1447
1448 priv->channel = (u16)channel;
1449
1450 - /* Start a thread that will walk the CPUs with affine portals
1451 + /* Walk the CPUs with affine portals
1452 * and add this pool channel to each's dequeue mask.
1453 */
1454 dpaa_eth_add_channel(priv->channel);
1455 @@ -2771,20 +3078,20 @@ static int dpaa_eth_probe(struct platfor
1456 err = dpaa_eth_cgr_init(priv);
1457 if (err < 0) {
1458 dev_err(dev, "Error initializing CGR\n");
1459 - goto tx_cgr_init_failed;
1460 + goto free_dpaa_bps;
1461 }
1462
1463 err = dpaa_ingress_cgr_init(priv);
1464 if (err < 0) {
1465 dev_err(dev, "Error initializing ingress CGR\n");
1466 - goto rx_cgr_init_failed;
1467 + goto delete_egress_cgr;
1468 }
1469
1470 /* Add the FQs to the interface, and make them active */
1471 list_for_each_entry_safe(dpaa_fq, tmp, &priv->dpaa_fq_list, list) {
1472 err = dpaa_fq_init(dpaa_fq, false);
1473 if (err < 0)
1474 - goto fq_alloc_failed;
1475 + goto free_dpaa_fqs;
1476 }
1477
1478 priv->tx_headroom = dpaa_get_headroom(&priv->buf_layout[TX]);
1479 @@ -2794,7 +3101,7 @@ static int dpaa_eth_probe(struct platfor
1480 err = dpaa_eth_init_ports(mac_dev, dpaa_bps, DPAA_BPS_NUM, &port_fqs,
1481 &priv->buf_layout[0], dev);
1482 if (err)
1483 - goto init_ports_failed;
1484 + goto free_dpaa_fqs;
1485
1486 /* Rx traffic distribution based on keygen hashing defaults to on */
1487 priv->keygen_in_use = true;
1488 @@ -2803,11 +3110,7 @@ static int dpaa_eth_probe(struct platfor
1489 if (!priv->percpu_priv) {
1490 dev_err(dev, "devm_alloc_percpu() failed\n");
1491 err = -ENOMEM;
1492 - goto alloc_percpu_failed;
1493 - }
1494 - for_each_possible_cpu(i) {
1495 - percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
1496 - memset(percpu_priv, 0, sizeof(*percpu_priv));
1497 + goto free_dpaa_fqs;
1498 }
1499
1500 priv->num_tc = 1;
1501 @@ -2816,11 +3119,11 @@ static int dpaa_eth_probe(struct platfor
1502 /* Initialize NAPI */
1503 err = dpaa_napi_add(net_dev);
1504 if (err < 0)
1505 - goto napi_add_failed;
1506 + goto delete_dpaa_napi;
1507
1508 err = dpaa_netdev_init(net_dev, &dpaa_ops, tx_timeout);
1509 if (err < 0)
1510 - goto netdev_init_failed;
1511 + goto delete_dpaa_napi;
1512
1513 dpaa_eth_sysfs_init(&net_dev->dev);
1514
1515 @@ -2829,32 +3132,21 @@ static int dpaa_eth_probe(struct platfor
1516
1517 return 0;
1518
1519 -netdev_init_failed:
1520 -napi_add_failed:
1521 +delete_dpaa_napi:
1522 dpaa_napi_del(net_dev);
1523 -alloc_percpu_failed:
1524 -init_ports_failed:
1525 +free_dpaa_fqs:
1526 dpaa_fq_free(dev, &priv->dpaa_fq_list);
1527 -fq_alloc_failed:
1528 qman_delete_cgr_safe(&priv->ingress_cgr);
1529 qman_release_cgrid(priv->ingress_cgr.cgrid);
1530 -rx_cgr_init_failed:
1531 +delete_egress_cgr:
1532 qman_delete_cgr_safe(&priv->cgr_data.cgr);
1533 qman_release_cgrid(priv->cgr_data.cgr.cgrid);
1534 -tx_cgr_init_failed:
1535 -get_channel_failed:
1536 +free_dpaa_bps:
1537 dpaa_bps_free(priv);
1538 -bp_create_failed:
1539 -fq_probe_failed:
1540 -dev_mask_failed:
1541 -mac_probe_failed:
1542 dev_set_drvdata(dev, NULL);
1543 free_netdev(net_dev);
1544 -alloc_etherdev_mq_failed:
1545 - for (i = 0; i < DPAA_BPS_NUM && dpaa_bps[i]; i++) {
1546 - if (atomic_read(&dpaa_bps[i]->refs) == 0)
1547 - devm_kfree(dev, dpaa_bps[i]);
1548 - }
1549 +probe_err:
1550 +
1551 return err;
1552 }
1553
1554 @@ -2891,6 +3183,23 @@ static int dpaa_remove(struct platform_d
1555 return err;
1556 }
1557
1558 +#ifndef CONFIG_PPC
1559 +static bool __init soc_has_errata_a010022(void)
1560 +{
1561 +#ifdef CONFIG_SOC_BUS
1562 + const struct soc_device_attribute soc_msi_matches[] = {
1563 + { .family = "QorIQ LS1043A",
1564 + .data = NULL },
1565 + { },
1566 + };
1567 +
1568 + if (!soc_device_match(soc_msi_matches))
1569 + return false;
1570 +#endif
1571 + return true; /* cannot identify SoC or errata applies */
1572 +}
1573 +#endif
1574 +
1575 static const struct platform_device_id dpaa_devtype[] = {
1576 {
1577 .name = "dpaa-ethernet",
1578 @@ -2915,6 +3224,10 @@ static int __init dpaa_load(void)
1579
1580 pr_debug("FSL DPAA Ethernet driver\n");
1581
1582 +#ifndef CONFIG_PPC
1583 + /* Detect if the current SoC requires the DMA transfer alignment workaround */
1584 + dpaa_errata_a010022 = soc_has_errata_a010022();
1585 +#endif
1586 /* initialize dpaa_eth mirror values */
1587 dpaa_rx_extra_headroom = fman_get_rx_extra_headroom();
1588 dpaa_max_frm = fman_get_max_frm();
1589 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
1590 +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
1591 @@ -182,6 +182,9 @@ struct dpaa_priv {
1592
1593 struct dpaa_buffer_layout buf_layout[2];
1594 u16 rx_headroom;
1595 +
1596 + bool tx_tstamp; /* Tx timestamping enabled */
1597 + bool rx_tstamp; /* Rx timestamping enabled */
1598 };
1599
1600 /* from dpaa_ethtool.c */
1601 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
1602 +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
1603 @@ -32,6 +32,9 @@
1604 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1605
1606 #include <linux/string.h>
1607 +#include <linux/of_platform.h>
1608 +#include <linux/net_tstamp.h>
1609 +#include <linux/fsl/ptp_qoriq.h>
1610
1611 #include "dpaa_eth.h"
1612 #include "mac.h"
1613 @@ -344,7 +347,7 @@ static void dpaa_get_ethtool_stats(struc
1614
1615 /* gather congestion related counters */
1616 cg_num = 0;
1617 - cg_status = 0;
1618 + cg_status = false;
1619 cg_time = jiffies_to_msecs(priv->cgr_data.congested_jiffies);
1620 if (qman_query_cgr_congested(&priv->cgr_data.cgr, &cg_status) == 0) {
1621 cg_num = priv->cgr_data.cgr_congested_count;
1622 @@ -515,6 +518,41 @@ static int dpaa_set_rxnfc(struct net_dev
1623 return ret;
1624 }
1625
1626 +static int dpaa_get_ts_info(struct net_device *net_dev,
1627 + struct ethtool_ts_info *info)
1628 +{
1629 + struct device *dev = net_dev->dev.parent;
1630 + struct device_node *mac_node = dev->of_node;
1631 + struct device_node *fman_node = NULL, *ptp_node = NULL;
1632 + struct platform_device *ptp_dev = NULL;
1633 + struct qoriq_ptp *ptp = NULL;
1634 +
1635 + info->phc_index = -1;
1636 +
1637 + fman_node = of_get_parent(mac_node);
1638 + if (fman_node)
1639 + ptp_node = of_parse_phandle(fman_node, "ptimer-handle", 0);
1640 +
1641 + if (ptp_node)
1642 + ptp_dev = of_find_device_by_node(ptp_node);
1643 +
1644 + if (ptp_dev)
1645 + ptp = platform_get_drvdata(ptp_dev);
1646 +
1647 + if (ptp)
1648 + info->phc_index = ptp->phc_index;
1649 +
1650 + info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE |
1651 + SOF_TIMESTAMPING_RX_HARDWARE |
1652 + SOF_TIMESTAMPING_RAW_HARDWARE;
1653 + info->tx_types = (1 << HWTSTAMP_TX_OFF) |
1654 + (1 << HWTSTAMP_TX_ON);
1655 + info->rx_filters = (1 << HWTSTAMP_FILTER_NONE) |
1656 + (1 << HWTSTAMP_FILTER_ALL);
1657 +
1658 + return 0;
1659 +}
1660 +
1661 const struct ethtool_ops dpaa_ethtool_ops = {
1662 .get_drvinfo = dpaa_get_drvinfo,
1663 .get_msglevel = dpaa_get_msglevel,
1664 @@ -530,4 +568,5 @@ const struct ethtool_ops dpaa_ethtool_op
1665 .set_link_ksettings = dpaa_set_link_ksettings,
1666 .get_rxnfc = dpaa_get_rxnfc,
1667 .set_rxnfc = dpaa_set_rxnfc,
1668 + .get_ts_info = dpaa_get_ts_info,
1669 };
1670 --- a/drivers/net/ethernet/freescale/fman/Kconfig
1671 +++ b/drivers/net/ethernet/freescale/fman/Kconfig
1672 @@ -2,7 +2,6 @@ config FSL_FMAN
1673 tristate "FMan support"
1674 depends on FSL_SOC || ARCH_LAYERSCAPE || COMPILE_TEST
1675 select GENERIC_ALLOCATOR
1676 - depends on HAS_DMA
1677 select PHYLIB
1678 default n
1679 help
1680 --- a/drivers/net/ethernet/freescale/fman/Makefile
1681 +++ b/drivers/net/ethernet/freescale/fman/Makefile
1682 @@ -1,10 +1,10 @@
1683 # SPDX-License-Identifier: GPL-2.0
1684 subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman
1685
1686 -obj-$(CONFIG_FSL_FMAN) += fsl_fman.o
1687 -obj-$(CONFIG_FSL_FMAN) += fsl_fman_port.o
1688 -obj-$(CONFIG_FSL_FMAN) += fsl_mac.o
1689 +obj-$(CONFIG_FSL_FMAN) += fsl_dpaa_fman.o
1690 +obj-$(CONFIG_FSL_FMAN) += fsl_dpaa_fman_port.o
1691 +obj-$(CONFIG_FSL_FMAN) += fsl_dpaa_mac.o
1692
1693 -fsl_fman-objs := fman_muram.o fman.o fman_sp.o fman_keygen.o
1694 -fsl_fman_port-objs := fman_port.o
1695 -fsl_mac-objs:= mac.o fman_dtsec.o fman_memac.o fman_tgec.o
1696 +fsl_dpaa_fman-objs := fman_muram.o fman.o fman_sp.o fman_keygen.o
1697 +fsl_dpaa_fman_port-objs := fman_port.o
1698 +fsl_dpaa_mac-objs:= mac.o fman_dtsec.o fman_memac.o fman_tgec.o
1699 --- a/drivers/net/ethernet/freescale/fman/fman.c
1700 +++ b/drivers/net/ethernet/freescale/fman/fman.c
1701 @@ -629,6 +629,7 @@ static void set_port_order_restoration(s
1702 iowrite32be(tmp, &fpm_rg->fmfp_prc);
1703 }
1704
1705 +#ifdef CONFIG_PPC
1706 static void set_port_liodn(struct fman *fman, u8 port_id,
1707 u32 liodn_base, u32 liodn_ofst)
1708 {
1709 @@ -646,6 +647,27 @@ static void set_port_liodn(struct fman *
1710 iowrite32be(tmp, &fman->dma_regs->fmdmplr[port_id / 2]);
1711 iowrite32be(liodn_ofst, &fman->bmi_regs->fmbm_spliodn[port_id - 1]);
1712 }
1713 +#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64)
1714 +static void save_restore_port_icids(struct fman *fman, bool save)
1715 +{
1716 + int port_idxes[] = {
1717 + 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc,
1718 + 0xd, 0xe, 0xf, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
1719 + 0x10, 0x11, 0x30, 0x31
1720 + };
1721 + int idx, i;
1722 +
1723 + for (i = 0; i < ARRAY_SIZE(port_idxes); i++) {
1724 + idx = port_idxes[i];
1725 + if (save)
1726 + fman->sp_icids[idx] =
1727 + ioread32be(&fman->bmi_regs->fmbm_spliodn[idx]);
1728 + else
1729 + iowrite32be(fman->sp_icids[idx],
1730 + &fman->bmi_regs->fmbm_spliodn[idx]);
1731 + }
1732 +}
1733 +#endif
1734
1735 static void enable_rams_ecc(struct fman_fpm_regs __iomem *fpm_rg)
1736 {
1737 @@ -1914,7 +1936,10 @@ _return:
1738 static int fman_init(struct fman *fman)
1739 {
1740 struct fman_cfg *cfg = NULL;
1741 - int err = 0, i, count;
1742 + int err = 0, count;
1743 +#ifdef CONFIG_PPC
1744 + int i;
1745 +#endif
1746
1747 if (is_init_done(fman->cfg))
1748 return -EINVAL;
1749 @@ -1934,6 +1959,7 @@ static int fman_init(struct fman *fman)
1750 memset_io((void __iomem *)(fman->base_addr + CGP_OFFSET), 0,
1751 fman->state->fm_port_num_of_cg);
1752
1753 +#ifdef CONFIG_PPC
1754 /* Save LIODN info before FMan reset
1755 * Skipping non-existent port 0 (i = 1)
1756 */
1757 @@ -1953,6 +1979,9 @@ static int fman_init(struct fman *fman)
1758 }
1759 fman->liodn_base[i] = liodn_base;
1760 }
1761 +#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64)
1762 + save_restore_port_icids(fman, true);
1763 +#endif
1764
1765 err = fman_reset(fman);
1766 if (err)
1767 @@ -2181,8 +2210,12 @@ int fman_set_port_params(struct fman *fm
1768 if (err)
1769 goto return_err;
1770
1771 +#ifdef CONFIG_PPC
1772 set_port_liodn(fman, port_id, fman->liodn_base[port_id],
1773 fman->liodn_offset[port_id]);
1774 +#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64)
1775 + save_restore_port_icids(fman, false);
1776 +#endif
1777
1778 if (fman->state->rev_info.major < 6)
1779 set_port_order_restoration(fman->fpm_regs, port_id);
1780 @@ -2800,7 +2833,8 @@ static struct fman *read_dts_node(struct
1781
1782 of_node_put(muram_node);
1783
1784 - err = devm_request_irq(&of_dev->dev, irq, fman_irq, 0, "fman", fman);
1785 + err = devm_request_irq(&of_dev->dev, irq, fman_irq, IRQF_SHARED,
1786 + "fman", fman);
1787 if (err < 0) {
1788 dev_err(&of_dev->dev, "%s: irq %d allocation failed (error = %d)\n",
1789 __func__, irq, err);
1790 --- a/drivers/net/ethernet/freescale/fman/fman.h
1791 +++ b/drivers/net/ethernet/freescale/fman/fman.h
1792 @@ -41,6 +41,7 @@
1793 /* Frame queue Context Override */
1794 #define FM_FD_CMD_FCO 0x80000000
1795 #define FM_FD_CMD_RPD 0x40000000 /* Read Prepended Data */
1796 +#define FM_FD_CMD_UPD 0x20000000 /* Update Prepended Data */
1797 #define FM_FD_CMD_DTC 0x10000000 /* Do L4 Checksum */
1798
1799 /* TX-Port: Unsupported Format */
1800 @@ -345,8 +346,12 @@ struct fman {
1801 unsigned long fifo_offset;
1802 size_t fifo_size;
1803
1804 +#ifdef CONFIG_PPC
1805 u32 liodn_base[64];
1806 u32 liodn_offset[64];
1807 +#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64)
1808 + u32 sp_icids[64];
1809 +#endif
1810
1811 struct fman_dts_params dts_params;
1812 };
1813 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c
1814 +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c
1815 @@ -123,11 +123,13 @@
1816 #define DTSEC_ECNTRL_R100M 0x00000008
1817 #define DTSEC_ECNTRL_QSGMIIM 0x00000001
1818
1819 +#define TCTRL_TTSE 0x00000040
1820 #define TCTRL_GTS 0x00000020
1821
1822 #define RCTRL_PAL_MASK 0x001f0000
1823 #define RCTRL_PAL_SHIFT 16
1824 #define RCTRL_GHTX 0x00000400
1825 +#define RCTRL_RTSE 0x00000040
1826 #define RCTRL_GRS 0x00000020
1827 #define RCTRL_MPROM 0x00000008
1828 #define RCTRL_RSF 0x00000004
1829 @@ -1116,6 +1118,50 @@ int dtsec_add_hash_mac_address(struct fm
1830
1831 return 0;
1832 }
1833 +
1834 +int dtsec_set_allmulti(struct fman_mac *dtsec, bool enable)
1835 +{
1836 + u32 tmp;
1837 + struct dtsec_regs __iomem *regs = dtsec->regs;
1838 +
1839 + if (!is_init_done(dtsec->dtsec_drv_param))
1840 + return -EINVAL;
1841 +
1842 + tmp = ioread32be(&regs->rctrl);
1843 + if (enable)
1844 + tmp |= RCTRL_MPROM;
1845 + else
1846 + tmp &= ~RCTRL_MPROM;
1847 +
1848 + iowrite32be(tmp, &regs->rctrl);
1849 +
1850 + return 0;
1851 +}
1852 +
1853 +int dtsec_set_tstamp(struct fman_mac *dtsec, bool enable)
1854 +{
1855 + struct dtsec_regs __iomem *regs = dtsec->regs;
1856 + u32 rctrl, tctrl;
1857 +
1858 + if (!is_init_done(dtsec->dtsec_drv_param))
1859 + return -EINVAL;
1860 +
1861 + rctrl = ioread32be(&regs->rctrl);
1862 + tctrl = ioread32be(&regs->tctrl);
1863 +
1864 + if (enable) {
1865 + rctrl |= RCTRL_RTSE;
1866 + tctrl |= TCTRL_TTSE;
1867 + } else {
1868 + rctrl &= ~RCTRL_RTSE;
1869 + tctrl &= ~TCTRL_TTSE;
1870 + }
1871 +
1872 + iowrite32be(rctrl, &regs->rctrl);
1873 + iowrite32be(tctrl, &regs->tctrl);
1874 +
1875 + return 0;
1876 +}
1877
1878 int dtsec_del_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr)
1879 {
1880 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.h
1881 +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.h
1882 @@ -55,5 +55,7 @@ int dtsec_set_exception(struct fman_mac
1883 int dtsec_add_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr);
1884 int dtsec_del_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr);
1885 int dtsec_get_version(struct fman_mac *dtsec, u32 *mac_version);
1886 +int dtsec_set_allmulti(struct fman_mac *dtsec, bool enable);
1887 +int dtsec_set_tstamp(struct fman_mac *dtsec, bool enable);
1888
1889 #endif /* __DTSEC_H */
1890 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c
1891 +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c
1892 @@ -350,6 +350,7 @@ struct fman_mac {
1893 struct fman_rev_info fm_rev_info;
1894 bool basex_if;
1895 struct phy_device *pcsphy;
1896 + bool allmulti_enabled;
1897 };
1898
1899 static void add_addr_in_paddr(struct memac_regs __iomem *regs, u8 *adr,
1900 @@ -940,6 +941,34 @@ int memac_add_hash_mac_address(struct fm
1901 return 0;
1902 }
1903
1904 +int memac_set_allmulti(struct fman_mac *memac, bool enable)
1905 +{
1906 + u32 entry;
1907 + struct memac_regs __iomem *regs = memac->regs;
1908 +
1909 + if (!is_init_done(memac->memac_drv_param))
1910 + return -EINVAL;
1911 +
1912 + if (enable) {
1913 + for (entry = 0; entry < HASH_TABLE_SIZE; entry++)
1914 + iowrite32be(entry | HASH_CTRL_MCAST_EN,
1915 + &regs->hashtable_ctrl);
1916 + } else {
1917 + for (entry = 0; entry < HASH_TABLE_SIZE; entry++)
1918 + iowrite32be(entry & ~HASH_CTRL_MCAST_EN,
1919 + &regs->hashtable_ctrl);
1920 + }
1921 +
1922 + memac->allmulti_enabled = enable;
1923 +
1924 + return 0;
1925 +}
1926 +
1927 +int memac_set_tstamp(struct fman_mac *memac, bool enable)
1928 +{
1929 + return 0; /* Always enabled. */
1930 +}
1931 +
1932 int memac_del_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr)
1933 {
1934 struct memac_regs __iomem *regs = memac->regs;
1935 @@ -963,8 +992,12 @@ int memac_del_hash_mac_address(struct fm
1936 break;
1937 }
1938 }
1939 - if (list_empty(&memac->multicast_addr_hash->lsts[hash]))
1940 - iowrite32be(hash & ~HASH_CTRL_MCAST_EN, &regs->hashtable_ctrl);
1941 +
1942 + if (!memac->allmulti_enabled) {
1943 + if (list_empty(&memac->multicast_addr_hash->lsts[hash]))
1944 + iowrite32be(hash & ~HASH_CTRL_MCAST_EN,
1945 + &regs->hashtable_ctrl);
1946 + }
1947
1948 return 0;
1949 }
1950 --- a/drivers/net/ethernet/freescale/fman/fman_memac.h
1951 +++ b/drivers/net/ethernet/freescale/fman/fman_memac.h
1952 @@ -57,5 +57,7 @@ int memac_set_exception(struct fman_mac
1953 enum fman_mac_exceptions exception, bool enable);
1954 int memac_add_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr);
1955 int memac_del_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr);
1956 +int memac_set_allmulti(struct fman_mac *memac, bool enable);
1957 +int memac_set_tstamp(struct fman_mac *memac, bool enable);
1958
1959 #endif /* __MEMAC_H */
1960 --- a/drivers/net/ethernet/freescale/fman/fman_port.c
1961 +++ b/drivers/net/ethernet/freescale/fman/fman_port.c
1962 @@ -1347,8 +1347,10 @@ int fman_port_config(struct fman_port *p
1963 switch (port->port_type) {
1964 case FMAN_PORT_TYPE_RX:
1965 set_rx_dflt_cfg(port, params);
1966 + /* fall through */
1967 case FMAN_PORT_TYPE_TX:
1968 set_tx_dflt_cfg(port, params, &port->dts_params);
1969 + /* fall through */
1970 default:
1971 set_dflt_cfg(port, params);
1972 }
1973 @@ -1728,6 +1730,20 @@ u32 fman_port_get_qman_channel_id(struct
1974 }
1975 EXPORT_SYMBOL(fman_port_get_qman_channel_id);
1976
1977 +/**
1978 + * fman_port_get_device
1979 + * port: Pointer to the FMan port device
1980 + *
1981 + * Get the 'struct device' associated to the specified FMan port device
1982 + *
1983 + * Return: pointer to associated 'struct device'
1984 + */
1985 +struct device *fman_port_get_device(struct fman_port *port)
1986 +{
1987 + return port->dev;
1988 +}
1989 +EXPORT_SYMBOL(fman_port_get_device);
1990 +
1991 int fman_port_get_hash_result_offset(struct fman_port *port, u32 *offset)
1992 {
1993 if (port->buffer_offsets.hash_result_offset == ILLEGAL_BASE)
1994 @@ -1739,6 +1755,18 @@ int fman_port_get_hash_result_offset(str
1995 }
1996 EXPORT_SYMBOL(fman_port_get_hash_result_offset);
1997
1998 +int fman_port_get_tstamp(struct fman_port *port, const void *data, u64 *tstamp)
1999 +{
2000 + if (port->buffer_offsets.time_stamp_offset == ILLEGAL_BASE)
2001 + return -EINVAL;
2002 +
2003 + *tstamp = be64_to_cpu(*(__be64 *)(data +
2004 + port->buffer_offsets.time_stamp_offset));
2005 +
2006 + return 0;
2007 +}
2008 +EXPORT_SYMBOL(fman_port_get_tstamp);
2009 +
2010 static int fman_port_probe(struct platform_device *of_dev)
2011 {
2012 struct fman_port *port;
2013 --- a/drivers/net/ethernet/freescale/fman/fman_port.h
2014 +++ b/drivers/net/ethernet/freescale/fman/fman_port.h
2015 @@ -153,6 +153,10 @@ u32 fman_port_get_qman_channel_id(struct
2016
2017 int fman_port_get_hash_result_offset(struct fman_port *port, u32 *offset);
2018
2019 +int fman_port_get_tstamp(struct fman_port *port, const void *data, u64 *tstamp);
2020 +
2021 struct fman_port *fman_port_bind(struct device *dev);
2022
2023 +struct device *fman_port_get_device(struct fman_port *port);
2024 +
2025 #endif /* __FMAN_PORT_H */
2026 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c
2027 +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c
2028 @@ -44,6 +44,7 @@
2029 #define TGEC_TX_IPG_LENGTH_MASK 0x000003ff
2030
2031 /* Command and Configuration Register (COMMAND_CONFIG) */
2032 +#define CMD_CFG_EN_TIMESTAMP 0x00100000
2033 #define CMD_CFG_NO_LEN_CHK 0x00020000
2034 #define CMD_CFG_PAUSE_IGNORE 0x00000100
2035 #define CMF_CFG_CRC_FWD 0x00000040
2036 @@ -217,6 +218,7 @@ struct fman_mac {
2037 struct tgec_cfg *cfg;
2038 void *fm;
2039 struct fman_rev_info fm_rev_info;
2040 + bool allmulti_enabled;
2041 };
2042
2043 static void set_mac_address(struct tgec_regs __iomem *regs, u8 *adr)
2044 @@ -564,6 +566,49 @@ int tgec_add_hash_mac_address(struct fma
2045 return 0;
2046 }
2047
2048 +int tgec_set_allmulti(struct fman_mac *tgec, bool enable)
2049 +{
2050 + u32 entry;
2051 + struct tgec_regs __iomem *regs = tgec->regs;
2052 +
2053 + if (!is_init_done(tgec->cfg))
2054 + return -EINVAL;
2055 +
2056 + if (enable) {
2057 + for (entry = 0; entry < TGEC_HASH_TABLE_SIZE; entry++)
2058 + iowrite32be(entry | TGEC_HASH_MCAST_EN,
2059 + &regs->hashtable_ctrl);
2060 + } else {
2061 + for (entry = 0; entry < TGEC_HASH_TABLE_SIZE; entry++)
2062 + iowrite32be(entry & ~TGEC_HASH_MCAST_EN,
2063 + &regs->hashtable_ctrl);
2064 + }
2065 +
2066 + tgec->allmulti_enabled = enable;
2067 +
2068 + return 0;
2069 +}
2070 +
2071 +int tgec_set_tstamp(struct fman_mac *tgec, bool enable)
2072 +{
2073 + struct tgec_regs __iomem *regs = tgec->regs;
2074 + u32 tmp;
2075 +
2076 + if (!is_init_done(tgec->cfg))
2077 + return -EINVAL;
2078 +
2079 + tmp = ioread32be(&regs->command_config);
2080 +
2081 + if (enable)
2082 + tmp |= CMD_CFG_EN_TIMESTAMP;
2083 + else
2084 + tmp &= ~CMD_CFG_EN_TIMESTAMP;
2085 +
2086 + iowrite32be(tmp, &regs->command_config);
2087 +
2088 + return 0;
2089 +}
2090 +
2091 int tgec_del_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr)
2092 {
2093 struct tgec_regs __iomem *regs = tgec->regs;
2094 @@ -591,9 +636,12 @@ int tgec_del_hash_mac_address(struct fma
2095 break;
2096 }
2097 }
2098 - if (list_empty(&tgec->multicast_addr_hash->lsts[hash]))
2099 - iowrite32be((hash & ~TGEC_HASH_MCAST_EN),
2100 - &regs->hashtable_ctrl);
2101 +
2102 + if (!tgec->allmulti_enabled) {
2103 + if (list_empty(&tgec->multicast_addr_hash->lsts[hash]))
2104 + iowrite32be((hash & ~TGEC_HASH_MCAST_EN),
2105 + &regs->hashtable_ctrl);
2106 + }
2107
2108 return 0;
2109 }
2110 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.h
2111 +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.h
2112 @@ -51,5 +51,7 @@ int tgec_set_exception(struct fman_mac *
2113 int tgec_add_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr);
2114 int tgec_del_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr);
2115 int tgec_get_version(struct fman_mac *tgec, u32 *mac_version);
2116 +int tgec_set_allmulti(struct fman_mac *tgec, bool enable);
2117 +int tgec_set_tstamp(struct fman_mac *tgec, bool enable);
2118
2119 #endif /* __TGEC_H */
2120 --- a/drivers/net/ethernet/freescale/fman/mac.c
2121 +++ b/drivers/net/ethernet/freescale/fman/mac.c
2122 @@ -57,9 +57,7 @@ struct mac_priv_s {
2123 struct device *dev;
2124 void __iomem *vaddr;
2125 u8 cell_index;
2126 - phy_interface_t phy_if;
2127 struct fman *fman;
2128 - struct device_node *phy_node;
2129 struct device_node *internal_phy_node;
2130 /* List of multicast addresses */
2131 struct list_head mc_addr_list;
2132 @@ -106,7 +104,7 @@ static void set_fman_mac_params(struct m
2133 resource_size(mac_dev->res));
2134 memcpy(&params->addr, mac_dev->addr, sizeof(mac_dev->addr));
2135 params->max_speed = priv->max_speed;
2136 - params->phy_if = priv->phy_if;
2137 + params->phy_if = mac_dev->phy_if;
2138 params->basex_if = false;
2139 params->mac_id = priv->cell_index;
2140 params->fm = (void *)priv->fman;
2141 @@ -419,15 +417,12 @@ void fman_get_pause_cfg(struct mac_devic
2142 }
2143 EXPORT_SYMBOL(fman_get_pause_cfg);
2144
2145 -static void adjust_link_void(struct net_device *net_dev)
2146 +static void adjust_link_void(struct mac_device *mac_dev)
2147 {
2148 }
2149
2150 -static void adjust_link_dtsec(struct net_device *net_dev)
2151 +static void adjust_link_dtsec(struct mac_device *mac_dev)
2152 {
2153 - struct device *dev = net_dev->dev.parent;
2154 - struct dpaa_eth_data *eth_data = dev->platform_data;
2155 - struct mac_device *mac_dev = eth_data->mac_dev;
2156 struct phy_device *phy_dev = mac_dev->phy_dev;
2157 struct fman_mac *fman_mac;
2158 bool rx_pause, tx_pause;
2159 @@ -444,14 +439,12 @@ static void adjust_link_dtsec(struct net
2160 fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause);
2161 err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause);
2162 if (err < 0)
2163 - netdev_err(net_dev, "fman_set_mac_active_pause() = %d\n", err);
2164 + dev_err(mac_dev->priv->dev, "fman_set_mac_active_pause() = %d\n",
2165 + err);
2166 }
2167
2168 -static void adjust_link_memac(struct net_device *net_dev)
2169 +static void adjust_link_memac(struct mac_device *mac_dev)
2170 {
2171 - struct device *dev = net_dev->dev.parent;
2172 - struct dpaa_eth_data *eth_data = dev->platform_data;
2173 - struct mac_device *mac_dev = eth_data->mac_dev;
2174 struct phy_device *phy_dev = mac_dev->phy_dev;
2175 struct fman_mac *fman_mac;
2176 bool rx_pause, tx_pause;
2177 @@ -463,60 +456,12 @@ static void adjust_link_memac(struct net
2178 fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause);
2179 err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause);
2180 if (err < 0)
2181 - netdev_err(net_dev, "fman_set_mac_active_pause() = %d\n", err);
2182 -}
2183 -
2184 -/* Initializes driver's PHY state, and attaches to the PHY.
2185 - * Returns 0 on success.
2186 - */
2187 -static struct phy_device *init_phy(struct net_device *net_dev,
2188 - struct mac_device *mac_dev,
2189 - void (*adj_lnk)(struct net_device *))
2190 -{
2191 - struct phy_device *phy_dev;
2192 - struct mac_priv_s *priv = mac_dev->priv;
2193 -
2194 - phy_dev = of_phy_connect(net_dev, priv->phy_node, adj_lnk, 0,
2195 - priv->phy_if);
2196 - if (!phy_dev) {
2197 - netdev_err(net_dev, "Could not connect to PHY\n");
2198 - return NULL;
2199 - }
2200 -
2201 - /* Remove any features not supported by the controller */
2202 - phy_dev->supported &= mac_dev->if_support;
2203 - /* Enable the symmetric and asymmetric PAUSE frame advertisements,
2204 - * as most of the PHY drivers do not enable them by default.
2205 - */
2206 - phy_dev->supported |= (SUPPORTED_Pause | SUPPORTED_Asym_Pause);
2207 - phy_dev->advertising = phy_dev->supported;
2208 -
2209 - mac_dev->phy_dev = phy_dev;
2210 -
2211 - return phy_dev;
2212 -}
2213 -
2214 -static struct phy_device *dtsec_init_phy(struct net_device *net_dev,
2215 - struct mac_device *mac_dev)
2216 -{
2217 - return init_phy(net_dev, mac_dev, &adjust_link_dtsec);
2218 -}
2219 -
2220 -static struct phy_device *tgec_init_phy(struct net_device *net_dev,
2221 - struct mac_device *mac_dev)
2222 -{
2223 - return init_phy(net_dev, mac_dev, adjust_link_void);
2224 -}
2225 -
2226 -static struct phy_device *memac_init_phy(struct net_device *net_dev,
2227 - struct mac_device *mac_dev)
2228 -{
2229 - return init_phy(net_dev, mac_dev, &adjust_link_memac);
2230 + dev_err(mac_dev->priv->dev, "fman_set_mac_active_pause() = %d\n",
2231 + err);
2232 }
2233
2234 static void setup_dtsec(struct mac_device *mac_dev)
2235 {
2236 - mac_dev->init_phy = dtsec_init_phy;
2237 mac_dev->init = dtsec_initialization;
2238 mac_dev->set_promisc = dtsec_set_promiscuous;
2239 mac_dev->change_addr = dtsec_modify_mac_address;
2240 @@ -525,17 +470,18 @@ static void setup_dtsec(struct mac_devic
2241 mac_dev->set_tx_pause = dtsec_set_tx_pause_frames;
2242 mac_dev->set_rx_pause = dtsec_accept_rx_pause_frames;
2243 mac_dev->set_exception = dtsec_set_exception;
2244 + mac_dev->set_allmulti = dtsec_set_allmulti;
2245 + mac_dev->set_tstamp = dtsec_set_tstamp;
2246 mac_dev->set_multi = set_multi;
2247 mac_dev->start = start;
2248 mac_dev->stop = stop;
2249 -
2250 + mac_dev->adjust_link = adjust_link_dtsec;
2251 mac_dev->priv->enable = dtsec_enable;
2252 mac_dev->priv->disable = dtsec_disable;
2253 }
2254
2255 static void setup_tgec(struct mac_device *mac_dev)
2256 {
2257 - mac_dev->init_phy = tgec_init_phy;
2258 mac_dev->init = tgec_initialization;
2259 mac_dev->set_promisc = tgec_set_promiscuous;
2260 mac_dev->change_addr = tgec_modify_mac_address;
2261 @@ -544,17 +490,18 @@ static void setup_tgec(struct mac_device
2262 mac_dev->set_tx_pause = tgec_set_tx_pause_frames;
2263 mac_dev->set_rx_pause = tgec_accept_rx_pause_frames;
2264 mac_dev->set_exception = tgec_set_exception;
2265 + mac_dev->set_allmulti = tgec_set_allmulti;
2266 + mac_dev->set_tstamp = tgec_set_tstamp;
2267 mac_dev->set_multi = set_multi;
2268 mac_dev->start = start;
2269 mac_dev->stop = stop;
2270 -
2271 + mac_dev->adjust_link = adjust_link_void;
2272 mac_dev->priv->enable = tgec_enable;
2273 mac_dev->priv->disable = tgec_disable;
2274 }
2275
2276 static void setup_memac(struct mac_device *mac_dev)
2277 {
2278 - mac_dev->init_phy = memac_init_phy;
2279 mac_dev->init = memac_initialization;
2280 mac_dev->set_promisc = memac_set_promiscuous;
2281 mac_dev->change_addr = memac_modify_mac_address;
2282 @@ -563,10 +510,12 @@ static void setup_memac(struct mac_devic
2283 mac_dev->set_tx_pause = memac_set_tx_pause_frames;
2284 mac_dev->set_rx_pause = memac_accept_rx_pause_frames;
2285 mac_dev->set_exception = memac_set_exception;
2286 + mac_dev->set_allmulti = memac_set_allmulti;
2287 + mac_dev->set_tstamp = memac_set_tstamp;
2288 mac_dev->set_multi = set_multi;
2289 mac_dev->start = start;
2290 mac_dev->stop = stop;
2291 -
2292 + mac_dev->adjust_link = adjust_link_memac;
2293 mac_dev->priv->enable = memac_enable;
2294 mac_dev->priv->disable = memac_disable;
2295 }
2296 @@ -599,8 +548,7 @@ static const u16 phy2speed[] = {
2297 };
2298
2299 static struct platform_device *dpaa_eth_add_device(int fman_id,
2300 - struct mac_device *mac_dev,
2301 - struct device_node *node)
2302 + struct mac_device *mac_dev)
2303 {
2304 struct platform_device *pdev;
2305 struct dpaa_eth_data data;
2306 @@ -613,19 +561,15 @@ static struct platform_device *dpaa_eth_
2307 data.mac_dev = mac_dev;
2308 data.mac_hw_id = priv->cell_index;
2309 data.fman_hw_id = fman_id;
2310 - data.mac_node = node;
2311
2312 mutex_lock(&eth_lock);
2313 -
2314 pdev = platform_device_alloc("dpaa-ethernet", dpaa_eth_dev_cnt);
2315 if (!pdev) {
2316 ret = -ENOMEM;
2317 goto no_mem;
2318 }
2319
2320 - pdev->dev.of_node = node;
2321 pdev->dev.parent = priv->dev;
2322 - set_dma_ops(&pdev->dev, get_dma_ops(priv->dev));
2323
2324 ret = platform_device_add_data(pdev, &data, sizeof(data));
2325 if (ret)
2326 @@ -676,7 +620,6 @@ static int mac_probe(struct platform_dev
2327 mac_dev = devm_kzalloc(dev, sizeof(*mac_dev), GFP_KERNEL);
2328 if (!mac_dev) {
2329 err = -ENOMEM;
2330 - dev_err(dev, "devm_kzalloc() = %d\n", err);
2331 goto _return;
2332 }
2333 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
2334 @@ -706,9 +649,6 @@ static int mac_probe(struct platform_dev
2335 goto _return;
2336 }
2337
2338 - /* Register mac_dev */
2339 - dev_set_drvdata(dev, mac_dev);
2340 -
2341 INIT_LIST_HEAD(&priv->mc_addr_list);
2342
2343 /* Get the FM node */
2344 @@ -717,7 +657,7 @@ static int mac_probe(struct platform_dev
2345 dev_err(dev, "of_get_parent(%pOF) failed\n",
2346 mac_node);
2347 err = -EINVAL;
2348 - goto _return_dev_set_drvdata;
2349 + goto _return_of_get_parent;
2350 }
2351
2352 of_dev = of_find_device_by_node(dev_node);
2353 @@ -751,7 +691,7 @@ static int mac_probe(struct platform_dev
2354 if (err < 0) {
2355 dev_err(dev, "of_address_to_resource(%pOF) = %d\n",
2356 mac_node, err);
2357 - goto _return_dev_set_drvdata;
2358 + goto _return_of_get_parent;
2359 }
2360
2361 mac_dev->res = __devm_request_region(dev,
2362 @@ -761,7 +701,7 @@ static int mac_probe(struct platform_dev
2363 if (!mac_dev->res) {
2364 dev_err(dev, "__devm_request_mem_region(mac) failed\n");
2365 err = -EBUSY;
2366 - goto _return_dev_set_drvdata;
2367 + goto _return_of_get_parent;
2368 }
2369
2370 priv->vaddr = devm_ioremap(dev, mac_dev->res->start,
2371 @@ -769,16 +709,12 @@ static int mac_probe(struct platform_dev
2372 if (!priv->vaddr) {
2373 dev_err(dev, "devm_ioremap() failed\n");
2374 err = -EIO;
2375 - goto _return_dev_set_drvdata;
2376 + goto _return_of_get_parent;
2377 }
2378
2379 if (!of_device_is_available(mac_node)) {
2380 - devm_iounmap(dev, priv->vaddr);
2381 - __devm_release_region(dev, fman_get_mem_region(priv->fman),
2382 - res.start, res.end + 1 - res.start);
2383 - devm_kfree(dev, mac_dev);
2384 - dev_set_drvdata(dev, NULL);
2385 - return -ENODEV;
2386 + err = -ENODEV;
2387 + goto _return_of_get_parent;
2388 }
2389
2390 /* Get the cell-index */
2391 @@ -786,7 +722,7 @@ static int mac_probe(struct platform_dev
2392 if (err) {
2393 dev_err(dev, "failed to read cell-index for %pOF\n", mac_node);
2394 err = -EINVAL;
2395 - goto _return_dev_set_drvdata;
2396 + goto _return_of_get_parent;
2397 }
2398 priv->cell_index = (u8)val;
2399
2400 @@ -795,7 +731,7 @@ static int mac_probe(struct platform_dev
2401 if (!mac_addr) {
2402 dev_err(dev, "of_get_mac_address(%pOF) failed\n", mac_node);
2403 err = -EINVAL;
2404 - goto _return_dev_set_drvdata;
2405 + goto _return_of_get_parent;
2406 }
2407 memcpy(mac_dev->addr, mac_addr, sizeof(mac_dev->addr));
2408
2409 @@ -805,14 +741,14 @@ static int mac_probe(struct platform_dev
2410 dev_err(dev, "of_count_phandle_with_args(%pOF, fsl,fman-ports) failed\n",
2411 mac_node);
2412 err = nph;
2413 - goto _return_dev_set_drvdata;
2414 + goto _return_of_get_parent;
2415 }
2416
2417 if (nph != ARRAY_SIZE(mac_dev->port)) {
2418 dev_err(dev, "Not supported number of fman-ports handles of mac node %pOF from device tree\n",
2419 mac_node);
2420 err = -EINVAL;
2421 - goto _return_dev_set_drvdata;
2422 + goto _return_of_get_parent;
2423 }
2424
2425 for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) {
2426 @@ -851,13 +787,13 @@ static int mac_probe(struct platform_dev
2427 mac_node);
2428 phy_if = PHY_INTERFACE_MODE_SGMII;
2429 }
2430 - priv->phy_if = phy_if;
2431 + mac_dev->phy_if = phy_if;
2432
2433 - priv->speed = phy2speed[priv->phy_if];
2434 + priv->speed = phy2speed[mac_dev->phy_if];
2435 priv->max_speed = priv->speed;
2436 mac_dev->if_support = DTSEC_SUPPORTED;
2437 /* We don't support half-duplex in SGMII mode */
2438 - if (priv->phy_if == PHY_INTERFACE_MODE_SGMII)
2439 + if (mac_dev->phy_if == PHY_INTERFACE_MODE_SGMII)
2440 mac_dev->if_support &= ~(SUPPORTED_10baseT_Half |
2441 SUPPORTED_100baseT_Half);
2442
2443 @@ -866,30 +802,31 @@ static int mac_probe(struct platform_dev
2444 mac_dev->if_support |= SUPPORTED_1000baseT_Full;
2445
2446 /* The 10G interface only supports one mode */
2447 - if (priv->phy_if == PHY_INTERFACE_MODE_XGMII)
2448 + if (mac_dev->phy_if == PHY_INTERFACE_MODE_XGMII)
2449 mac_dev->if_support = SUPPORTED_10000baseT_Full;
2450
2451 /* Get the rest of the PHY information */
2452 - priv->phy_node = of_parse_phandle(mac_node, "phy-handle", 0);
2453 - if (!priv->phy_node && of_phy_is_fixed_link(mac_node)) {
2454 + mac_dev->phy_node = of_parse_phandle(mac_node, "phy-handle", 0);
2455 + if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) {
2456 struct phy_device *phy;
2457
2458 err = of_phy_register_fixed_link(mac_node);
2459 if (err)
2460 - goto _return_dev_set_drvdata;
2461 + goto _return_of_get_parent;
2462
2463 priv->fixed_link = kzalloc(sizeof(*priv->fixed_link),
2464 GFP_KERNEL);
2465 if (!priv->fixed_link) {
2466 err = -ENOMEM;
2467 - goto _return_dev_set_drvdata;
2468 + goto _return_of_get_parent;
2469 }
2470
2471 - priv->phy_node = of_node_get(mac_node);
2472 - phy = of_phy_find_device(priv->phy_node);
2473 + mac_dev->phy_node = of_node_get(mac_node);
2474 + phy = of_phy_find_device(mac_dev->phy_node);
2475 if (!phy) {
2476 err = -EINVAL;
2477 - goto _return_dev_set_drvdata;
2478 + of_node_put(mac_dev->phy_node);
2479 + goto _return_of_get_parent;
2480 }
2481
2482 priv->fixed_link->link = phy->link;
2483 @@ -904,8 +841,8 @@ static int mac_probe(struct platform_dev
2484 err = mac_dev->init(mac_dev);
2485 if (err < 0) {
2486 dev_err(dev, "mac_dev->init() = %d\n", err);
2487 - of_node_put(priv->phy_node);
2488 - goto _return_dev_set_drvdata;
2489 + of_node_put(mac_dev->phy_node);
2490 + goto _return_of_get_parent;
2491 }
2492
2493 /* pause frame autonegotiation enabled */
2494 @@ -926,7 +863,7 @@ static int mac_probe(struct platform_dev
2495 mac_dev->addr[0], mac_dev->addr[1], mac_dev->addr[2],
2496 mac_dev->addr[3], mac_dev->addr[4], mac_dev->addr[5]);
2497
2498 - priv->eth_dev = dpaa_eth_add_device(fman_id, mac_dev, mac_node);
2499 + priv->eth_dev = dpaa_eth_add_device(fman_id, mac_dev);
2500 if (IS_ERR(priv->eth_dev)) {
2501 dev_err(dev, "failed to add Ethernet platform device for MAC %d\n",
2502 priv->cell_index);
2503 @@ -937,9 +874,8 @@ static int mac_probe(struct platform_dev
2504
2505 _return_of_node_put:
2506 of_node_put(dev_node);
2507 -_return_dev_set_drvdata:
2508 +_return_of_get_parent:
2509 kfree(priv->fixed_link);
2510 - dev_set_drvdata(dev, NULL);
2511 _return:
2512 return err;
2513 }
2514 --- a/drivers/net/ethernet/freescale/fman/mac.h
2515 +++ b/drivers/net/ethernet/freescale/fman/mac.h
2516 @@ -50,6 +50,8 @@ struct mac_device {
2517 struct fman_port *port[2];
2518 u32 if_support;
2519 struct phy_device *phy_dev;
2520 + phy_interface_t phy_if;
2521 + struct device_node *phy_node;
2522
2523 bool autoneg_pause;
2524 bool rx_pause_req;
2525 @@ -57,14 +59,16 @@ struct mac_device {
2526 bool rx_pause_active;
2527 bool tx_pause_active;
2528 bool promisc;
2529 + bool allmulti;
2530
2531 - struct phy_device *(*init_phy)(struct net_device *net_dev,
2532 - struct mac_device *mac_dev);
2533 int (*init)(struct mac_device *mac_dev);
2534 int (*start)(struct mac_device *mac_dev);
2535 int (*stop)(struct mac_device *mac_dev);
2536 + void (*adjust_link)(struct mac_device *mac_dev);
2537 int (*set_promisc)(struct fman_mac *mac_dev, bool enable);
2538 int (*change_addr)(struct fman_mac *mac_dev, enet_addr_t *enet_addr);
2539 + int (*set_allmulti)(struct fman_mac *mac_dev, bool enable);
2540 + int (*set_tstamp)(struct fman_mac *mac_dev, bool enable);
2541 int (*set_multi)(struct net_device *net_dev,
2542 struct mac_device *mac_dev);
2543 int (*set_rx_pause)(struct fman_mac *mac_dev, bool en);
2544 @@ -82,7 +86,6 @@ struct mac_device {
2545 };
2546
2547 struct dpaa_eth_data {
2548 - struct device_node *mac_node;
2549 struct mac_device *mac_dev;
2550 int mac_hw_id;
2551 int fman_hw_id;
2552 --- /dev/null
2553 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/Kconfig
2554 @@ -0,0 +1,184 @@
2555 +menuconfig FSL_SDK_DPAA_ETH
2556 + tristate "DPAA Ethernet"
2557 + depends on (FSL_SOC || ARM64 || ARM) && FSL_SDK_BMAN && FSL_SDK_QMAN && FSL_SDK_FMAN && !FSL_DPAA_ETH
2558 + select PHYLIB
2559 + help
2560 + Data Path Acceleration Architecture Ethernet driver,
2561 + supporting the Freescale QorIQ chips.
2562 + Depends on Freescale Buffer Manager and Queue Manager
2563 + driver and Frame Manager Driver.
2564 +
2565 +if FSL_SDK_DPAA_ETH
2566 +
2567 +config FSL_DPAA_HOOKS
2568 + bool "DPAA Ethernet driver hooks"
2569 +
2570 +config FSL_DPAA_CEETM
2571 + bool "DPAA CEETM QoS"
2572 + depends on NET_SCHED
2573 + default n
2574 + help
2575 + Enable QoS offloading support through the CEETM hardware block.
2576 +
2577 +config FSL_DPAA_CEETM_CCS_THRESHOLD_1G
2578 + hex "CEETM egress congestion threshold on 1G ports"
2579 + depends on FSL_DPAA_CEETM
2580 + range 0x1000 0x10000000
2581 + default "0x00005000"
2582 + help
2583 + The size in bytes of the CEETM egress Class Congestion State threshold on 1G ports.
2584 + The threshold needs to be configured keeping in mind the following factors:
2585 + - A threshold too large will buffer frames for a long time in the TX queues,
2586 + when a small shaping rate is configured. This will cause buffer pool depletion
2587 + or out of memory errors. This in turn will cause frame loss on RX;
2588 + - A threshold too small will cause unnecessary frame loss by entering
2589 + congestion too often.
2590 +
2591 +config FSL_DPAA_CEETM_CCS_THRESHOLD_10G
2592 + hex "CEETM egress congestion threshold on 10G ports"
2593 + depends on FSL_DPAA_CEETM
2594 + range 0x1000 0x20000000
2595 + default "0x00032000"
2596 + help
2597 + The size in bytes of the CEETM egress Class Congestion State threshold on 10G ports.
2598 + See FSL_DPAA_CEETM_CCS_THRESHOLD_1G for details.
2599 +
2600 +config FSL_DPAA_OFFLINE_PORTS
2601 + bool "Offline Ports support"
2602 + depends on FSL_SDK_DPAA_ETH
2603 + default y
2604 + help
2605 + The Offline Parsing / Host Command ports (short: OH ports, of Offline ports) provide
2606 + most of the functionality of the regular, online ports, except they receive their
2607 + frames from a core or an accelerator on the SoC, via QMan frame queues,
2608 + rather than directly from the network.
2609 + Offline ports are configured via PCD (Parse-Classify-Distribute) schemes, just like
2610 + any online FMan port. They deliver the processed frames to frame queues, according
2611 + to the applied PCD configurations.
2612 +
2613 + Choosing this feature will not impact the functionality and/or performance of the system,
2614 + so it is safe to have it.
2615 +
2616 +config FSL_DPAA_ADVANCED_DRIVERS
2617 + bool "Advanced DPAA Ethernet drivers"
2618 + depends on FSL_SDK_DPAA_ETH
2619 + default y
2620 + help
2621 + Besides the standard DPAA Ethernet driver the DPAA Proxy initialization driver
2622 + is needed to support advanced scenarios. Select this to also build the advanced
2623 + drivers.
2624 +
2625 +config FSL_DPAA_ETH_JUMBO_FRAME
2626 + bool "Optimize for jumbo frames"
2627 + default n
2628 + help
2629 + Optimize the DPAA Ethernet driver throughput for large frames
2630 + termination traffic (e.g. 4K and above).
2631 + NOTE: This option can only be used if FSL_FM_MAX_FRAME_SIZE
2632 + is set to 9600 bytes.
2633 + Using this option in combination with small frames increases
2634 + significantly the driver's memory footprint and may even deplete
2635 + the system memory. Also, the skb truesize is altered and messages
2636 + from the stack that warn against this are bypassed.
2637 +
2638 +config FSL_DPAA_TS
2639 + bool "Linux compliant timestamping"
2640 + depends on FSL_SDK_DPAA_ETH
2641 + default n
2642 + help
2643 + Enable Linux API compliant timestamping support.
2644 +
2645 +config FSL_DPAA_1588
2646 + bool "IEEE 1588-compliant timestamping"
2647 + depends on FSL_SDK_DPAA_ETH
2648 + select FSL_DPAA_TS
2649 + default n
2650 + help
2651 + Enable IEEE1588 support code.
2652 +
2653 +config FSL_DPAA_ETH_MAX_BUF_COUNT
2654 + int "Maximum nuber of buffers in private bpool"
2655 + depends on FSL_SDK_DPAA_ETH
2656 + range 64 2048
2657 + default "128"
2658 + help
2659 + The maximum number of buffers to be by default allocated in the DPAA-Ethernet private port's
2660 + buffer pool. One needn't normally modify this, as it has probably been tuned for performance
2661 + already. This cannot be lower than DPAA_ETH_REFILL_THRESHOLD.
2662 +
2663 +config FSL_DPAA_ETH_REFILL_THRESHOLD
2664 + int "Private bpool refill threshold"
2665 + depends on FSL_SDK_DPAA_ETH
2666 + range 32 FSL_DPAA_ETH_MAX_BUF_COUNT
2667 + default "80"
2668 + help
2669 + The DPAA-Ethernet driver will start replenishing buffer pools whose count
2670 + falls below this threshold. This must be related to DPAA_ETH_MAX_BUF_COUNT. One needn't normally
2671 + modify this value unless one has very specific performance reasons.
2672 +
2673 +config FSL_DPAA_CS_THRESHOLD_1G
2674 + hex "Egress congestion threshold on 1G ports"
2675 + depends on FSL_SDK_DPAA_ETH
2676 + range 0x1000 0x10000000
2677 + default "0x06000000"
2678 + help
2679 + The size in bytes of the egress Congestion State notification threshold on 1G ports.
2680 + The 1G dTSECs can quite easily be flooded by cores doing Tx in a tight loop
2681 + (e.g. by sending UDP datagrams at "while(1) speed"),
2682 + and the larger the frame size, the more acute the problem.
2683 + So we have to find a balance between these factors:
2684 + - avoiding the device staying congested for a prolonged time (risking
2685 + the netdev watchdog to fire - see also the tx_timeout module param);
2686 + - affecting performance of protocols such as TCP, which otherwise
2687 + behave well under the congestion notification mechanism;
2688 + - preventing the Tx cores from tightly-looping (as if the congestion
2689 + threshold was too low to be effective);
2690 + - running out of memory if the CS threshold is set too high.
2691 +
2692 +config FSL_DPAA_CS_THRESHOLD_10G
2693 + hex "Egress congestion threshold on 10G ports"
2694 + depends on FSL_SDK_DPAA_ETH
2695 + range 0x1000 0x20000000
2696 + default "0x10000000"
2697 + help
2698 + The size in bytes of the egress Congestion State notification threshold on 10G ports.
2699 +
2700 +config FSL_DPAA_INGRESS_CS_THRESHOLD
2701 + hex "Ingress congestion threshold on FMan ports"
2702 + depends on FSL_SDK_DPAA_ETH
2703 + default "0x10000000"
2704 + help
2705 + The size in bytes of the ingress tail-drop threshold on FMan ports.
2706 + Traffic piling up above this value will be rejected by QMan and discarded by FMan.
2707 +
2708 +config FSL_DPAA_ETH_DEBUGFS
2709 + bool "DPAA Ethernet debugfs interface"
2710 + depends on DEBUG_FS && FSL_SDK_DPAA_ETH
2711 + default y
2712 + help
2713 + This option compiles debugfs code for the DPAA Ethernet driver.
2714 +
2715 +config FSL_DPAA_ETH_DEBUG
2716 + bool "DPAA Ethernet Debug Support"
2717 + depends on FSL_SDK_DPAA_ETH
2718 + default n
2719 + help
2720 + This option compiles debug code for the DPAA Ethernet driver.
2721 +
2722 +config FSL_DPAA_DBG_LOOP
2723 + bool "DPAA Ethernet Debug loopback"
2724 + depends on FSL_DPAA_ETH_DEBUGFS
2725 + default n
2726 + help
2727 + This option allows to divert all received traffic on a certain interface A towards a
2728 + selected interface B. This option is used to benchmark the HW + Ethernet driver in
2729 + isolation from the Linux networking stack. The loops are controlled by debugfs entries,
2730 + one for each interface. By default all loops are disabled (target value is -1). I.e. to
2731 + change the loop setting for interface 4 and divert all received traffic to interface 5
2732 + write Tx interface number in the receive interface debugfs file:
2733 + # cat /sys/kernel/debug/powerpc/fsl_dpa/eth4_loop
2734 + 4->-1
2735 + # echo 5 > /sys/kernel/debug/powerpc/fsl_dpa/eth4_loop
2736 + # cat /sys/kernel/debug/powerpc/fsl_dpa/eth4_loop
2737 + 4->5
2738 +endif # FSL_SDK_DPAA_ETH
2739 --- /dev/null
2740 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/Makefile
2741 @@ -0,0 +1,45 @@
2742 +#
2743 +# Makefile for the Freescale Ethernet controllers
2744 +#
2745 +ccflags-y += -DVERSION=\"\"
2746 +#
2747 +# Include netcomm SW specific definitions
2748 +include $(srctree)/drivers/net/ethernet/freescale/sdk_fman/ncsw_config.mk
2749 +
2750 +ccflags-y += -I$(NET_DPA)
2751 +
2752 +obj-$(CONFIG_FSL_SDK_DPAA_ETH) += fsl_mac.o fsl_dpa.o
2753 +
2754 +fsl_dpa-objs += dpaa_ethtool.o dpaa_eth_sysfs.o dpaa_eth.o dpaa_eth_sg.o dpaa_eth_common.o
2755 +ifeq ($(CONFIG_FSL_DPAA_DBG_LOOP),y)
2756 +fsl_dpa-objs += dpaa_debugfs.o
2757 +endif
2758 +ifeq ($(CONFIG_FSL_DPAA_1588),y)
2759 +fsl_dpa-objs += dpaa_1588.o
2760 +endif
2761 +ifeq ($(CONFIG_FSL_DPAA_CEETM),y)
2762 +ccflags-y += -Idrivers/net/ethernet/freescale/sdk_fman/src/wrapper
2763 +fsl_dpa-objs += dpaa_eth_ceetm.o
2764 +endif
2765 +
2766 +fsl_mac-objs += mac.o mac-api.o
2767 +
2768 +# Advanced drivers
2769 +ifeq ($(CONFIG_FSL_DPAA_ADVANCED_DRIVERS),y)
2770 +obj-$(CONFIG_FSL_SDK_DPAA_ETH) += fsl_advanced.o
2771 +obj-$(CONFIG_FSL_SDK_DPAA_ETH) += fsl_proxy.o
2772 +
2773 +fsl_advanced-objs += dpaa_eth_base.o
2774 +# suport for multiple drivers per kernel module comes in kernel 3.14
2775 +# so we are forced to generate several modules for the advanced drivers
2776 +fsl_proxy-objs += dpaa_eth_proxy.o
2777 +
2778 +ifeq ($(CONFIG_FSL_DPAA_OFFLINE_PORTS),y)
2779 +obj-$(CONFIG_FSL_SDK_DPAA_ETH) += fsl_oh.o
2780 +
2781 +fsl_oh-objs += offline_port.o
2782 +endif
2783 +endif
2784 +
2785 +# Needed by the tracing framework
2786 +CFLAGS_dpaa_eth.o := -I$(src)
2787 --- /dev/null
2788 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_1588.c
2789 @@ -0,0 +1,580 @@
2790 +/* Copyright (C) 2011 Freescale Semiconductor, Inc.
2791 + * Copyright (C) 2009 IXXAT Automation, GmbH
2792 + *
2793 + * DPAA Ethernet Driver -- IEEE 1588 interface functionality
2794 + *
2795 + * This program is free software; you can redistribute it and/or modify
2796 + * it under the terms of the GNU General Public License as published by
2797 + * the Free Software Foundation; either version 2 of the License, or
2798 + * (at your option) any later version.
2799 + *
2800 + * This program is distributed in the hope that it will be useful,
2801 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2802 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2803 + * GNU General Public License for more details.
2804 + *
2805 + * You should have received a copy of the GNU General Public License along
2806 + * with this program; if not, write to the Free Software Foundation, Inc.,
2807 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2808 + *
2809 + */
2810 +#include <linux/io.h>
2811 +#include <linux/device.h>
2812 +#include <linux/fs.h>
2813 +#include <linux/vmalloc.h>
2814 +#include <linux/spinlock.h>
2815 +#include <linux/ip.h>
2816 +#include <linux/ipv6.h>
2817 +#include <linux/udp.h>
2818 +#include <asm/div64.h>
2819 +#include "dpaa_eth.h"
2820 +#include "dpaa_eth_common.h"
2821 +#include "dpaa_1588.h"
2822 +#include "mac.h"
2823 +
2824 +static int dpa_ptp_init_circ(struct dpa_ptp_circ_buf *ptp_buf, u32 size)
2825 +{
2826 + struct circ_buf *circ_buf = &ptp_buf->circ_buf;
2827 +
2828 + circ_buf->buf = vmalloc(sizeof(struct dpa_ptp_data) * size);
2829 + if (!circ_buf->buf)
2830 + return 1;
2831 +
2832 + circ_buf->head = 0;
2833 + circ_buf->tail = 0;
2834 + ptp_buf->size = size;
2835 + spin_lock_init(&ptp_buf->ptp_lock);
2836 +
2837 + return 0;
2838 +}
2839 +
2840 +static void dpa_ptp_reset_circ(struct dpa_ptp_circ_buf *ptp_buf, u32 size)
2841 +{
2842 + struct circ_buf *circ_buf = &ptp_buf->circ_buf;
2843 +
2844 + circ_buf->head = 0;
2845 + circ_buf->tail = 0;
2846 + ptp_buf->size = size;
2847 +}
2848 +
2849 +static int dpa_ptp_insert(struct dpa_ptp_circ_buf *ptp_buf,
2850 + struct dpa_ptp_data *data)
2851 +{
2852 + struct circ_buf *circ_buf = &ptp_buf->circ_buf;
2853 + int size = ptp_buf->size;
2854 + struct dpa_ptp_data *tmp;
2855 + unsigned long flags;
2856 + int head, tail;
2857 +
2858 + spin_lock_irqsave(&ptp_buf->ptp_lock, flags);
2859 +
2860 + head = circ_buf->head;
2861 + tail = circ_buf->tail;
2862 +
2863 + if (CIRC_SPACE(head, tail, size) <= 0)
2864 + circ_buf->tail = (tail + 1) & (size - 1);
2865 +
2866 + tmp = (struct dpa_ptp_data *)(circ_buf->buf) + head;
2867 + memcpy(tmp, data, sizeof(struct dpa_ptp_data));
2868 +
2869 + circ_buf->head = (head + 1) & (size - 1);
2870 +
2871 + spin_unlock_irqrestore(&ptp_buf->ptp_lock, flags);
2872 +
2873 + return 0;
2874 +}
2875 +
2876 +static int dpa_ptp_is_ident_match(struct dpa_ptp_ident *dst,
2877 + struct dpa_ptp_ident *src)
2878 +{
2879 + int ret;
2880 +
2881 + if ((dst->version != src->version) || (dst->msg_type != src->msg_type))
2882 + return 0;
2883 +
2884 + if ((dst->netw_prot == src->netw_prot)
2885 + || src->netw_prot == DPA_PTP_PROT_DONTCARE) {
2886 + if (dst->seq_id != src->seq_id)
2887 + return 0;
2888 +
2889 + ret = memcmp(dst->snd_port_id, src->snd_port_id,
2890 + DPA_PTP_SOURCE_PORT_LENGTH);
2891 + if (ret)
2892 + return 0;
2893 + else
2894 + return 1;
2895 + }
2896 +
2897 + return 0;
2898 +}
2899 +
2900 +static int dpa_ptp_find_and_remove(struct dpa_ptp_circ_buf *ptp_buf,
2901 + struct dpa_ptp_ident *ident,
2902 + struct dpa_ptp_time *ts)
2903 +{
2904 + struct circ_buf *circ_buf = &ptp_buf->circ_buf;
2905 + int size = ptp_buf->size;
2906 + int head, tail, idx;
2907 + unsigned long flags;
2908 + struct dpa_ptp_data *tmp, *tmp2;
2909 + struct dpa_ptp_ident *tmp_ident;
2910 +
2911 + spin_lock_irqsave(&ptp_buf->ptp_lock, flags);
2912 +
2913 + head = circ_buf->head;
2914 + tail = idx = circ_buf->tail;
2915 +
2916 + if (CIRC_CNT(head, tail, size) == 0) {
2917 + spin_unlock_irqrestore(&ptp_buf->ptp_lock, flags);
2918 + return 1;
2919 + }
2920 +
2921 + while (idx != head) {
2922 + tmp = (struct dpa_ptp_data *)(circ_buf->buf) + idx;
2923 + tmp_ident = &tmp->ident;
2924 + if (dpa_ptp_is_ident_match(tmp_ident, ident))
2925 + break;
2926 + idx = (idx + 1) & (size - 1);
2927 + }
2928 +
2929 + if (idx == head) {
2930 + spin_unlock_irqrestore(&ptp_buf->ptp_lock, flags);
2931 + return 1;
2932 + }
2933 +
2934 + ts->sec = tmp->ts.sec;
2935 + ts->nsec = tmp->ts.nsec;
2936 +
2937 + if (idx != tail) {
2938 + if (CIRC_CNT(idx, tail, size) > TS_ACCUMULATION_THRESHOLD) {
2939 + tail = circ_buf->tail =
2940 + (idx - TS_ACCUMULATION_THRESHOLD) & (size - 1);
2941 + }
2942 +
2943 + while (CIRC_CNT(idx, tail, size) > 0) {
2944 + tmp = (struct dpa_ptp_data *)(circ_buf->buf) + idx;
2945 + idx = (idx - 1) & (size - 1);
2946 + tmp2 = (struct dpa_ptp_data *)(circ_buf->buf) + idx;
2947 + *tmp = *tmp2;
2948 + }
2949 + }
2950 + circ_buf->tail = (tail + 1) & (size - 1);
2951 +
2952 + spin_unlock_irqrestore(&ptp_buf->ptp_lock, flags);
2953 +
2954 + return 0;
2955 +}
2956 +
2957 +/* Parse the PTP packets
2958 + *
2959 + * The PTP header can be found in an IPv4 packet, IPv6 patcket or in
2960 + * an IEEE802.3 ethernet frame. This function returns the position of
2961 + * the PTP packet or NULL if no PTP found
2962 + */
2963 +static u8 *dpa_ptp_parse_packet(struct sk_buff *skb, u16 *eth_type)
2964 +{
2965 + u8 *pos = skb->data + ETH_ALEN + ETH_ALEN;
2966 + u8 *ptp_loc = NULL;
2967 + u8 msg_type;
2968 + u32 access_len = ETH_ALEN + ETH_ALEN + DPA_ETYPE_LEN;
2969 + struct iphdr *iph;
2970 + struct udphdr *udph;
2971 + struct ipv6hdr *ipv6h;
2972 +
2973 + /* when we can receive S/G frames we need to check the data we want to
2974 + * access is in the linear skb buffer
2975 + */
2976 + if (!pskb_may_pull(skb, access_len))
2977 + return NULL;
2978 +
2979 + *eth_type = *((u16 *)pos);
2980 +
2981 + /* Check if inner tag is here */
2982 + if (*eth_type == ETH_P_8021Q) {
2983 + access_len += DPA_VLAN_TAG_LEN;
2984 +
2985 + if (!pskb_may_pull(skb, access_len))
2986 + return NULL;
2987 +
2988 + pos += DPA_VLAN_TAG_LEN;
2989 + *eth_type = *((u16 *)pos);
2990 + }
2991 +
2992 + pos += DPA_ETYPE_LEN;
2993 +
2994 + switch (*eth_type) {
2995 + /* Transport of PTP over Ethernet */
2996 + case ETH_P_1588:
2997 + ptp_loc = pos;
2998 +
2999 + if (!pskb_may_pull(skb, access_len + PTP_OFFS_MSG_TYPE + 1))
3000 + return NULL;
3001 +
3002 + msg_type = *((u8 *)(ptp_loc + PTP_OFFS_MSG_TYPE)) & 0xf;
3003 + if ((msg_type == PTP_MSGTYPE_SYNC)
3004 + || (msg_type == PTP_MSGTYPE_DELREQ)
3005 + || (msg_type == PTP_MSGTYPE_PDELREQ)
3006 + || (msg_type == PTP_MSGTYPE_PDELRESP))
3007 + return ptp_loc;
3008 + break;
3009 + /* Transport of PTP over IPv4 */
3010 + case ETH_P_IP:
3011 + iph = (struct iphdr *)pos;
3012 + access_len += sizeof(struct iphdr);
3013 +
3014 + if (!pskb_may_pull(skb, access_len))
3015 + return NULL;
3016 +
3017 + if (ntohs(iph->protocol) != IPPROTO_UDP)
3018 + return NULL;
3019 +
3020 + access_len += iph->ihl * 4 - sizeof(struct iphdr) +
3021 + sizeof(struct udphdr);
3022 +
3023 + if (!pskb_may_pull(skb, access_len))
3024 + return NULL;
3025 +
3026 + pos += iph->ihl * 4;
3027 + udph = (struct udphdr *)pos;
3028 + if (ntohs(udph->dest) != 319)
3029 + return NULL;
3030 + ptp_loc = pos + sizeof(struct udphdr);
3031 + break;
3032 + /* Transport of PTP over IPv6 */
3033 + case ETH_P_IPV6:
3034 + ipv6h = (struct ipv6hdr *)pos;
3035 +
3036 + access_len += sizeof(struct ipv6hdr) + sizeof(struct udphdr);
3037 +
3038 + if (ntohs(ipv6h->nexthdr) != IPPROTO_UDP)
3039 + return NULL;
3040 +
3041 + pos += sizeof(struct ipv6hdr);
3042 + udph = (struct udphdr *)pos;
3043 + if (ntohs(udph->dest) != 319)
3044 + return NULL;
3045 + ptp_loc = pos + sizeof(struct udphdr);
3046 + break;
3047 + default:
3048 + break;
3049 + }
3050 +
3051 + return ptp_loc;
3052 +}
3053 +
3054 +static int dpa_ptp_store_stamp(const struct dpa_priv_s *priv,
3055 + struct sk_buff *skb, void *data, enum port_type rx_tx,
3056 + struct dpa_ptp_data *ptp_data)
3057 +{
3058 + u64 nsec;
3059 + u32 mod;
3060 + u8 *ptp_loc;
3061 + u16 eth_type;
3062 +
3063 + ptp_loc = dpa_ptp_parse_packet(skb, &eth_type);
3064 + if (!ptp_loc)
3065 + return -EINVAL;
3066 +
3067 + switch (eth_type) {
3068 + case ETH_P_IP:
3069 + ptp_data->ident.netw_prot = DPA_PTP_PROT_IPV4;
3070 + break;
3071 + case ETH_P_IPV6:
3072 + ptp_data->ident.netw_prot = DPA_PTP_PROT_IPV6;
3073 + break;
3074 + case ETH_P_1588:
3075 + ptp_data->ident.netw_prot = DPA_PTP_PROT_802_3;
3076 + break;
3077 + default:
3078 + return -EINVAL;
3079 + }
3080 +
3081 + if (!pskb_may_pull(skb, ptp_loc - skb->data + PTP_OFFS_SEQ_ID + 2))
3082 + return -EINVAL;
3083 +
3084 + ptp_data->ident.version = *(ptp_loc + PTP_OFFS_VER_PTP) & 0xf;
3085 + ptp_data->ident.msg_type = *(ptp_loc + PTP_OFFS_MSG_TYPE) & 0xf;
3086 + ptp_data->ident.seq_id = *((u16 *)(ptp_loc + PTP_OFFS_SEQ_ID));
3087 + memcpy(ptp_data->ident.snd_port_id, ptp_loc + PTP_OFFS_SRCPRTID,
3088 + DPA_PTP_SOURCE_PORT_LENGTH);
3089 +
3090 + nsec = dpa_get_timestamp_ns(priv, rx_tx, data);
3091 + mod = do_div(nsec, NANOSEC_PER_SECOND);
3092 + ptp_data->ts.sec = nsec;
3093 + ptp_data->ts.nsec = mod;
3094 +
3095 + return 0;
3096 +}
3097 +
3098 +void dpa_ptp_store_txstamp(const struct dpa_priv_s *priv,
3099 + struct sk_buff *skb, void *data)
3100 +{
3101 + struct dpa_ptp_tsu *tsu = priv->tsu;
3102 + struct dpa_ptp_data ptp_tx_data;
3103 +
3104 + if (dpa_ptp_store_stamp(priv, skb, data, TX, &ptp_tx_data))
3105 + return;
3106 +
3107 + dpa_ptp_insert(&tsu->tx_timestamps, &ptp_tx_data);
3108 +}
3109 +
3110 +void dpa_ptp_store_rxstamp(const struct dpa_priv_s *priv,
3111 + struct sk_buff *skb, void *data)
3112 +{
3113 + struct dpa_ptp_tsu *tsu = priv->tsu;
3114 + struct dpa_ptp_data ptp_rx_data;
3115 +
3116 + if (dpa_ptp_store_stamp(priv, skb, data, RX, &ptp_rx_data))
3117 + return;
3118 +
3119 + dpa_ptp_insert(&tsu->rx_timestamps, &ptp_rx_data);
3120 +}
3121 +
3122 +static uint8_t dpa_get_tx_timestamp(struct dpa_ptp_tsu *ptp_tsu,
3123 + struct dpa_ptp_ident *ident,
3124 + struct dpa_ptp_time *ts)
3125 +{
3126 + struct dpa_ptp_tsu *tsu = ptp_tsu;
3127 + struct dpa_ptp_time tmp;
3128 + int flag;
3129 +
3130 + flag = dpa_ptp_find_and_remove(&tsu->tx_timestamps, ident, &tmp);
3131 + if (!flag) {
3132 + ts->sec = tmp.sec;
3133 + ts->nsec = tmp.nsec;
3134 + return 0;
3135 + }
3136 +
3137 + return -1;
3138 +}
3139 +
3140 +static uint8_t dpa_get_rx_timestamp(struct dpa_ptp_tsu *ptp_tsu,
3141 + struct dpa_ptp_ident *ident,
3142 + struct dpa_ptp_time *ts)
3143 +{
3144 + struct dpa_ptp_tsu *tsu = ptp_tsu;
3145 + struct dpa_ptp_time tmp;
3146 + int flag;
3147 +
3148 + flag = dpa_ptp_find_and_remove(&tsu->rx_timestamps, ident, &tmp);
3149 + if (!flag) {
3150 + ts->sec = tmp.sec;
3151 + ts->nsec = tmp.nsec;
3152 + return 0;
3153 + }
3154 +
3155 + return -1;
3156 +}
3157 +
3158 +static void dpa_set_fiper_alarm(struct dpa_ptp_tsu *tsu,
3159 + struct dpa_ptp_time *cnt_time)
3160 +{
3161 + struct mac_device *mac_dev = tsu->dpa_priv->mac_dev;
3162 + u64 tmp, fiper;
3163 +
3164 + if (mac_dev->fm_rtc_disable)
3165 + mac_dev->fm_rtc_disable(get_fm_handle(tsu->dpa_priv->net_dev));
3166 +
3167 + /* TMR_FIPER1 will pulse every second after ALARM1 expired */
3168 + tmp = (u64)cnt_time->sec * NANOSEC_PER_SECOND + (u64)cnt_time->nsec;
3169 + fiper = NANOSEC_PER_SECOND - DPA_PTP_NOMINAL_FREQ_PERIOD_NS;
3170 + if (mac_dev->fm_rtc_set_alarm)
3171 + mac_dev->fm_rtc_set_alarm(get_fm_handle(tsu->dpa_priv->net_dev),
3172 + 0, tmp);
3173 + if (mac_dev->fm_rtc_set_fiper)
3174 + mac_dev->fm_rtc_set_fiper(get_fm_handle(tsu->dpa_priv->net_dev),
3175 + 0, fiper);
3176 +
3177 + if (mac_dev->fm_rtc_enable)
3178 + mac_dev->fm_rtc_enable(get_fm_handle(tsu->dpa_priv->net_dev));
3179 +}
3180 +
3181 +static void dpa_get_curr_cnt(struct dpa_ptp_tsu *tsu,
3182 + struct dpa_ptp_time *curr_time)
3183 +{
3184 + struct mac_device *mac_dev = tsu->dpa_priv->mac_dev;
3185 + u64 tmp;
3186 + u32 mod;
3187 +
3188 + if (mac_dev->fm_rtc_get_cnt)
3189 + mac_dev->fm_rtc_get_cnt(get_fm_handle(tsu->dpa_priv->net_dev),
3190 + &tmp);
3191 +
3192 + mod = do_div(tmp, NANOSEC_PER_SECOND);
3193 + curr_time->sec = (u32)tmp;
3194 + curr_time->nsec = mod;
3195 +}
3196 +
3197 +static void dpa_set_1588cnt(struct dpa_ptp_tsu *tsu,
3198 + struct dpa_ptp_time *cnt_time)
3199 +{
3200 + struct mac_device *mac_dev = tsu->dpa_priv->mac_dev;
3201 + u64 tmp;
3202 +
3203 + tmp = (u64)cnt_time->sec * NANOSEC_PER_SECOND + (u64)cnt_time->nsec;
3204 +
3205 + if (mac_dev->fm_rtc_set_cnt)
3206 + mac_dev->fm_rtc_set_cnt(get_fm_handle(tsu->dpa_priv->net_dev),
3207 + tmp);
3208 +
3209 + /* Restart fiper two seconds later */
3210 + cnt_time->sec += 2;
3211 + cnt_time->nsec = 0;
3212 + dpa_set_fiper_alarm(tsu, cnt_time);
3213 +}
3214 +
3215 +static void dpa_get_drift(struct dpa_ptp_tsu *tsu, u32 *addend)
3216 +{
3217 + struct mac_device *mac_dev = tsu->dpa_priv->mac_dev;
3218 + u32 drift;
3219 +
3220 + if (mac_dev->fm_rtc_get_drift)
3221 + mac_dev->fm_rtc_get_drift(get_fm_handle(tsu->dpa_priv->net_dev),
3222 + &drift);
3223 +
3224 + *addend = drift;
3225 +}
3226 +
3227 +static void dpa_set_drift(struct dpa_ptp_tsu *tsu, u32 addend)
3228 +{
3229 + struct mac_device *mac_dev = tsu->dpa_priv->mac_dev;
3230 +
3231 + if (mac_dev->fm_rtc_set_drift)
3232 + mac_dev->fm_rtc_set_drift(get_fm_handle(tsu->dpa_priv->net_dev),
3233 + addend);
3234 +}
3235 +
3236 +static void dpa_flush_timestamp(struct dpa_ptp_tsu *tsu)
3237 +{
3238 + dpa_ptp_reset_circ(&tsu->rx_timestamps, DEFAULT_PTP_RX_BUF_SZ);
3239 + dpa_ptp_reset_circ(&tsu->tx_timestamps, DEFAULT_PTP_TX_BUF_SZ);
3240 +}
3241 +
3242 +int dpa_ioctl_1588(struct net_device *dev, struct ifreq *ifr, int cmd)
3243 +{
3244 + struct dpa_priv_s *priv = netdev_priv(dev);
3245 + struct dpa_ptp_tsu *tsu = priv->tsu;
3246 + struct mac_device *mac_dev = priv->mac_dev;
3247 + struct dpa_ptp_data ptp_data;
3248 + struct dpa_ptp_data *ptp_data_user;
3249 + struct dpa_ptp_time act_time;
3250 + u32 addend;
3251 + int retval = 0;
3252 +
3253 + if (!tsu || !tsu->valid)
3254 + return -ENODEV;
3255 +
3256 + switch (cmd) {
3257 + case PTP_ENBL_TXTS_IOCTL:
3258 + tsu->hwts_tx_en_ioctl = 1;
3259 + if (mac_dev->fm_rtc_enable)
3260 + mac_dev->fm_rtc_enable(get_fm_handle(dev));
3261 + if (mac_dev->ptp_enable)
3262 + mac_dev->ptp_enable(mac_dev->get_mac_handle(mac_dev));
3263 + break;
3264 + case PTP_DSBL_TXTS_IOCTL:
3265 + tsu->hwts_tx_en_ioctl = 0;
3266 + if (mac_dev->fm_rtc_disable)
3267 + mac_dev->fm_rtc_disable(get_fm_handle(dev));
3268 + if (mac_dev->ptp_disable)
3269 + mac_dev->ptp_disable(mac_dev->get_mac_handle(mac_dev));
3270 + break;
3271 + case PTP_ENBL_RXTS_IOCTL:
3272 + tsu->hwts_rx_en_ioctl = 1;
3273 + break;
3274 + case PTP_DSBL_RXTS_IOCTL:
3275 + tsu->hwts_rx_en_ioctl = 0;
3276 + break;
3277 + case PTP_GET_RX_TIMESTAMP:
3278 + ptp_data_user = (struct dpa_ptp_data *)ifr->ifr_data;
3279 + if (copy_from_user(&ptp_data.ident,
3280 + &ptp_data_user->ident, sizeof(ptp_data.ident)))
3281 + return -EINVAL;
3282 +
3283 + if (dpa_get_rx_timestamp(tsu, &ptp_data.ident, &ptp_data.ts))
3284 + return -EAGAIN;
3285 +
3286 + if (copy_to_user((void __user *)&ptp_data_user->ts,
3287 + &ptp_data.ts, sizeof(ptp_data.ts)))
3288 + return -EFAULT;
3289 + break;
3290 + case PTP_GET_TX_TIMESTAMP:
3291 + ptp_data_user = (struct dpa_ptp_data *)ifr->ifr_data;
3292 + if (copy_from_user(&ptp_data.ident,
3293 + &ptp_data_user->ident, sizeof(ptp_data.ident)))
3294 + return -EINVAL;
3295 +
3296 + if (dpa_get_tx_timestamp(tsu, &ptp_data.ident, &ptp_data.ts))
3297 + return -EAGAIN;
3298 +
3299 + if (copy_to_user((void __user *)&ptp_data_user->ts,
3300 + &ptp_data.ts, sizeof(ptp_data.ts)))
3301 + return -EFAULT;
3302 + break;
3303 + case PTP_GET_TIME:
3304 + dpa_get_curr_cnt(tsu, &act_time);
3305 + if (copy_to_user(ifr->ifr_data, &act_time, sizeof(act_time)))
3306 + return -EFAULT;
3307 + break;
3308 + case PTP_SET_TIME:
3309 + if (copy_from_user(&act_time, ifr->ifr_data, sizeof(act_time)))
3310 + return -EINVAL;
3311 + dpa_set_1588cnt(tsu, &act_time);
3312 + break;
3313 + case PTP_GET_ADJ:
3314 + dpa_get_drift(tsu, &addend);
3315 + if (copy_to_user(ifr->ifr_data, &addend, sizeof(addend)))
3316 + return -EFAULT;
3317 + break;
3318 + case PTP_SET_ADJ:
3319 + if (copy_from_user(&addend, ifr->ifr_data, sizeof(addend)))
3320 + return -EINVAL;
3321 + dpa_set_drift(tsu, addend);
3322 + break;
3323 + case PTP_SET_FIPER_ALARM:
3324 + if (copy_from_user(&act_time, ifr->ifr_data, sizeof(act_time)))
3325 + return -EINVAL;
3326 + dpa_set_fiper_alarm(tsu, &act_time);
3327 + break;
3328 + case PTP_CLEANUP_TS:
3329 + dpa_flush_timestamp(tsu);
3330 + break;
3331 + default:
3332 + return -EINVAL;
3333 + }
3334 +
3335 + return retval;
3336 +}
3337 +
3338 +int dpa_ptp_init(struct dpa_priv_s *priv)
3339 +{
3340 + struct dpa_ptp_tsu *tsu;
3341 +
3342 + /* Allocate memory for PTP structure */
3343 + tsu = kzalloc(sizeof(struct dpa_ptp_tsu), GFP_KERNEL);
3344 + if (!tsu)
3345 + return -ENOMEM;
3346 +
3347 + tsu->valid = TRUE;
3348 + tsu->dpa_priv = priv;
3349 +
3350 + dpa_ptp_init_circ(&tsu->rx_timestamps, DEFAULT_PTP_RX_BUF_SZ);
3351 + dpa_ptp_init_circ(&tsu->tx_timestamps, DEFAULT_PTP_TX_BUF_SZ);
3352 +
3353 + priv->tsu = tsu;
3354 +
3355 + return 0;
3356 +}
3357 +EXPORT_SYMBOL(dpa_ptp_init);
3358 +
3359 +void dpa_ptp_cleanup(struct dpa_priv_s *priv)
3360 +{
3361 + struct dpa_ptp_tsu *tsu = priv->tsu;
3362 +
3363 + tsu->valid = FALSE;
3364 + vfree(tsu->rx_timestamps.circ_buf.buf);
3365 + vfree(tsu->tx_timestamps.circ_buf.buf);
3366 +
3367 + kfree(tsu);
3368 +}
3369 +EXPORT_SYMBOL(dpa_ptp_cleanup);
3370 --- /dev/null
3371 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_1588.h
3372 @@ -0,0 +1,138 @@
3373 +/* Copyright (C) 2011 Freescale Semiconductor, Inc.
3374 + *
3375 + * This program is free software; you can redistribute it and/or modify
3376 + * it under the terms of the GNU General Public License as published by
3377 + * the Free Software Foundation; either version 2 of the License, or
3378 + * (at your option) any later version.
3379 + *
3380 + * This program is distributed in the hope that it will be useful,
3381 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3382 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3383 + * GNU General Public License for more details.
3384 + *
3385 + * You should have received a copy of the GNU General Public License along
3386 + * with this program; if not, write to the Free Software Foundation, Inc.,
3387 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
3388 + *
3389 + */
3390 +#ifndef __DPAA_1588_H__
3391 +#define __DPAA_1588_H__
3392 +
3393 +#include <linux/netdevice.h>
3394 +#include <linux/etherdevice.h>
3395 +#include <linux/circ_buf.h>
3396 +#include <linux/fsl_qman.h>
3397 +
3398 +#define DEFAULT_PTP_RX_BUF_SZ 256
3399 +#define DEFAULT_PTP_TX_BUF_SZ 256
3400 +
3401 +/* 1588 private ioctl calls */
3402 +#define PTP_ENBL_TXTS_IOCTL SIOCDEVPRIVATE
3403 +#define PTP_DSBL_TXTS_IOCTL (SIOCDEVPRIVATE + 1)
3404 +#define PTP_ENBL_RXTS_IOCTL (SIOCDEVPRIVATE + 2)
3405 +#define PTP_DSBL_RXTS_IOCTL (SIOCDEVPRIVATE + 3)
3406 +#define PTP_GET_TX_TIMESTAMP (SIOCDEVPRIVATE + 4)
3407 +#define PTP_GET_RX_TIMESTAMP (SIOCDEVPRIVATE + 5)
3408 +#define PTP_SET_TIME (SIOCDEVPRIVATE + 6)
3409 +#define PTP_GET_TIME (SIOCDEVPRIVATE + 7)
3410 +#define PTP_SET_FIPER_ALARM (SIOCDEVPRIVATE + 8)
3411 +#define PTP_SET_ADJ (SIOCDEVPRIVATE + 9)
3412 +#define PTP_GET_ADJ (SIOCDEVPRIVATE + 10)
3413 +#define PTP_CLEANUP_TS (SIOCDEVPRIVATE + 11)
3414 +
3415 +/* PTP V2 message type */
3416 +enum {
3417 + PTP_MSGTYPE_SYNC = 0x0,
3418 + PTP_MSGTYPE_DELREQ = 0x1,
3419 + PTP_MSGTYPE_PDELREQ = 0x2,
3420 + PTP_MSGTYPE_PDELRESP = 0x3,
3421 + PTP_MSGTYPE_FLWUP = 0x8,
3422 + PTP_MSGTYPE_DELRESP = 0x9,
3423 + PTP_MSGTYPE_PDELRES_FLWUP = 0xA,
3424 + PTP_MSGTYPE_ANNOUNCE = 0xB,
3425 + PTP_MSGTYPE_SGNLNG = 0xC,
3426 + PTP_MSGTYPE_MNGMNT = 0xD,
3427 +};
3428 +
3429 +/* Byte offset of data in the PTP V2 headers */
3430 +#define PTP_OFFS_MSG_TYPE 0
3431 +#define PTP_OFFS_VER_PTP 1
3432 +#define PTP_OFFS_MSG_LEN 2
3433 +#define PTP_OFFS_DOM_NMB 4
3434 +#define PTP_OFFS_FLAGS 6
3435 +#define PTP_OFFS_CORFIELD 8
3436 +#define PTP_OFFS_SRCPRTID 20
3437 +#define PTP_OFFS_SEQ_ID 30
3438 +#define PTP_OFFS_CTRL 32
3439 +#define PTP_OFFS_LOGMEAN 33
3440 +
3441 +#define PTP_IP_OFFS 14
3442 +#define PTP_UDP_OFFS 34
3443 +#define PTP_HEADER_OFFS 42
3444 +#define PTP_MSG_TYPE_OFFS (PTP_HEADER_OFFS + PTP_OFFS_MSG_TYPE)
3445 +#define PTP_SPORT_ID_OFFS (PTP_HEADER_OFFS + PTP_OFFS_SRCPRTID)
3446 +#define PTP_SEQ_ID_OFFS (PTP_HEADER_OFFS + PTP_OFFS_SEQ_ID)
3447 +#define PTP_CTRL_OFFS (PTP_HEADER_OFFS + PTP_OFFS_CTRL)
3448 +
3449 +/* 1588-2008 network protocol enumeration values */
3450 +#define DPA_PTP_PROT_IPV4 1
3451 +#define DPA_PTP_PROT_IPV6 2
3452 +#define DPA_PTP_PROT_802_3 3
3453 +#define DPA_PTP_PROT_DONTCARE 0xFFFF
3454 +
3455 +#define DPA_PTP_SOURCE_PORT_LENGTH 10
3456 +#define DPA_PTP_HEADER_SZE 34
3457 +#define DPA_ETYPE_LEN 2
3458 +#define DPA_VLAN_TAG_LEN 4
3459 +#define NANOSEC_PER_SECOND 1000000000
3460 +
3461 +/* The threshold between the current found one and the oldest one */
3462 +#define TS_ACCUMULATION_THRESHOLD 50
3463 +
3464 +/* Struct needed to identify a timestamp */
3465 +struct dpa_ptp_ident {
3466 + u8 version;
3467 + u8 msg_type;
3468 + u16 netw_prot;
3469 + u16 seq_id;
3470 + u8 snd_port_id[DPA_PTP_SOURCE_PORT_LENGTH];
3471 +};
3472 +
3473 +/* Timestamp format in 1588-2008 */
3474 +struct dpa_ptp_time {
3475 + u64 sec; /* just 48 bit used */
3476 + u32 nsec;
3477 +};
3478 +
3479 +/* needed for timestamp data over ioctl */
3480 +struct dpa_ptp_data {
3481 + struct dpa_ptp_ident ident;
3482 + struct dpa_ptp_time ts;
3483 +};
3484 +
3485 +struct dpa_ptp_circ_buf {
3486 + struct circ_buf circ_buf;
3487 + u32 size;
3488 + spinlock_t ptp_lock;
3489 +};
3490 +
3491 +/* PTP TSU control structure */
3492 +struct dpa_ptp_tsu {
3493 + struct dpa_priv_s *dpa_priv;
3494 + bool valid;
3495 + struct dpa_ptp_circ_buf rx_timestamps;
3496 + struct dpa_ptp_circ_buf tx_timestamps;
3497 +
3498 + /* HW timestamping over ioctl enabled flag */
3499 + int hwts_tx_en_ioctl;
3500 + int hwts_rx_en_ioctl;
3501 +};
3502 +
3503 +extern int dpa_ptp_init(struct dpa_priv_s *priv);
3504 +extern void dpa_ptp_cleanup(struct dpa_priv_s *priv);
3505 +extern void dpa_ptp_store_txstamp(const struct dpa_priv_s *priv,
3506 + struct sk_buff *skb, void *data);
3507 +extern void dpa_ptp_store_rxstamp(const struct dpa_priv_s *priv,
3508 + struct sk_buff *skb, void *data);
3509 +extern int dpa_ioctl_1588(struct net_device *dev, struct ifreq *ifr, int cmd);
3510 +#endif
3511 --- /dev/null
3512 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_debugfs.c
3513 @@ -0,0 +1,180 @@
3514 +/* Copyright 2008-2013 Freescale Semiconductor Inc.
3515 + *
3516 + * Redistribution and use in source and binary forms, with or without
3517 + * modification, are permitted provided that the following conditions are met:
3518 + * * Redistributions of source code must retain the above copyright
3519 + * notice, this list of conditions and the following disclaimer.
3520 + * * Redistributions in binary form must reproduce the above copyright
3521 + * notice, this list of conditions and the following disclaimer in the
3522 + * documentation and/or other materials provided with the distribution.
3523 + * * Neither the name of Freescale Semiconductor nor the
3524 + * names of its contributors may be used to endorse or promote products
3525 + * derived from this software without specific prior written permission.
3526 + *
3527 + *
3528 + * ALTERNATIVELY, this software may be distributed under the terms of the
3529 + * GNU General Public License ("GPL") as published by the Free Software
3530 + * Foundation, either version 2 of that License or (at your option) any
3531 + * later version.
3532 + *
3533 + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
3534 + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
3535 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
3536 + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
3537 + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
3538 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
3539 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
3540 + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3541 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3542 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3543 + */
3544 +
3545 +#include <linux/module.h>
3546 +#include <linux/fsl_qman.h> /* struct qm_mcr_querycgr */
3547 +#include <linux/debugfs.h>
3548 +#include "dpaa_debugfs.h"
3549 +#include "dpaa_eth.h" /* struct dpa_priv_s, dpa_percpu_priv_s, dpa_bp */
3550 +
3551 +#define DPA_DEBUGFS_DESCRIPTION "FSL DPAA Ethernet debugfs entries"
3552 +#define DPA_ETH_DEBUGFS_ROOT "fsl_dpa"
3553 +
3554 +static struct dentry *dpa_debugfs_root;
3555 +
3556 +static int __cold dpa_debugfs_loop_open(struct inode *inode, struct file *file);
3557 +static ssize_t dpa_loop_write(struct file *f,
3558 + const char __user *buf, size_t count, loff_t *off);
3559 +
3560 +static const struct file_operations dpa_debugfs_lp_fops = {
3561 + .open = dpa_debugfs_loop_open,
3562 + .write = dpa_loop_write,
3563 + .read = seq_read,
3564 + .llseek = seq_lseek,
3565 + .release = single_release,
3566 +};
3567 +
3568 +static int dpa_debugfs_loop_show(struct seq_file *file, void *offset)
3569 +{
3570 + struct dpa_priv_s *priv;
3571 +
3572 + BUG_ON(offset == NULL);
3573 +
3574 + priv = netdev_priv((struct net_device *)file->private);
3575 + seq_printf(file, "%d->%d\n", priv->loop_id, priv->loop_to);
3576 +
3577 + return 0;
3578 +}
3579 +
3580 +static int user_input_convert(const char __user *user_buf, size_t count,
3581 + long *val)
3582 +{
3583 + char buf[12];
3584 +
3585 + if (count > sizeof(buf) - 1)
3586 + return -EINVAL;
3587 + if (copy_from_user(buf, user_buf, count))
3588 + return -EFAULT;
3589 + buf[count] = '\0';
3590 + if (kstrtol(buf, 0, val))
3591 + return -EINVAL;
3592 + return 0;
3593 +}
3594 +
3595 +static ssize_t dpa_loop_write(struct file *f,
3596 + const char __user *buf, size_t count, loff_t *off)
3597 +{
3598 + struct dpa_priv_s *priv;
3599 + struct net_device *netdev;
3600 + struct seq_file *sf;
3601 + int ret;
3602 + long val;
3603 +
3604 + ret = user_input_convert(buf, count, &val);
3605 + if (ret)
3606 + return ret;
3607 +
3608 + sf = (struct seq_file *)f->private_data;
3609 + netdev = (struct net_device *)sf->private;
3610 + priv = netdev_priv(netdev);
3611 +
3612 + priv->loop_to = ((val < 0) || (val > 20)) ? -1 : val;
3613 +
3614 + return count;
3615 +}
3616 +
3617 +static int __cold dpa_debugfs_loop_open(struct inode *inode, struct file *file)
3618 +{
3619 + int _errno;
3620 + const struct net_device *net_dev;
3621 +
3622 + _errno = single_open(file, dpa_debugfs_loop_show, inode->i_private);
3623 + if (unlikely(_errno < 0)) {
3624 + net_dev = (struct net_device *)inode->i_private;
3625 +
3626 + if (netif_msg_drv((struct dpa_priv_s *)netdev_priv(net_dev)))
3627 + netdev_err(net_dev, "single_open() = %d\n",
3628 + _errno);
3629 + }
3630 +
3631 + return _errno;
3632 +}
3633 +
3634 +
3635 +int dpa_netdev_debugfs_create(struct net_device *net_dev)
3636 +{
3637 + struct dpa_priv_s *priv = netdev_priv(net_dev);
3638 + static int cnt;
3639 + char loop_file_name[100];
3640 +
3641 + if (unlikely(dpa_debugfs_root == NULL)) {
3642 + pr_err(KBUILD_MODNAME ": %s:%hu:%s(): \t%s\n",
3643 + KBUILD_BASENAME".c", __LINE__, __func__,
3644 + "root debugfs missing, possible module ordering issue");
3645 + return -ENOMEM;
3646 + }
3647 +
3648 + sprintf(loop_file_name, "eth%d_loop", ++cnt);
3649 + priv->debugfs_loop_file = debugfs_create_file(loop_file_name,
3650 + S_IRUGO,
3651 + dpa_debugfs_root,
3652 + net_dev,
3653 + &dpa_debugfs_lp_fops);
3654 + if (unlikely(priv->debugfs_loop_file == NULL)) {
3655 + netdev_err(net_dev, "debugfs_create_file(%s/%s)",
3656 + dpa_debugfs_root->d_iname,
3657 + loop_file_name);
3658 +
3659 + return -ENOMEM;
3660 + }
3661 + return 0;
3662 +}
3663 +
3664 +void dpa_netdev_debugfs_remove(struct net_device *net_dev)
3665 +{
3666 + struct dpa_priv_s *priv = netdev_priv(net_dev);
3667 +
3668 + debugfs_remove(priv->debugfs_loop_file);
3669 +}
3670 +
3671 +int __init dpa_debugfs_module_init(void)
3672 +{
3673 + int _errno = 0;
3674 +
3675 + pr_info(KBUILD_MODNAME ": " DPA_DEBUGFS_DESCRIPTION "\n");
3676 +
3677 + dpa_debugfs_root = debugfs_create_dir(DPA_ETH_DEBUGFS_ROOT, NULL);
3678 +
3679 + if (unlikely(dpa_debugfs_root == NULL)) {
3680 + _errno = -ENOMEM;
3681 + pr_err(KBUILD_MODNAME ": %s:%hu:%s():\n",
3682 + KBUILD_BASENAME".c", __LINE__, __func__);
3683 + pr_err("\tdebugfs_create_dir(%s/"KBUILD_MODNAME") = %d\n",
3684 + DPA_ETH_DEBUGFS_ROOT, _errno);
3685 + }
3686 +
3687 + return _errno;
3688 +}
3689 +
3690 +void __exit dpa_debugfs_module_exit(void)
3691 +{
3692 + debugfs_remove(dpa_debugfs_root);
3693 +}
3694 --- /dev/null
3695 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_debugfs.h
3696 @@ -0,0 +1,43 @@
3697 +/* Copyright 2008-2013 Freescale Semiconductor Inc.
3698 + *
3699 + * Redistribution and use in source and binary forms, with or without
3700 + * modification, are permitted provided that the following conditions are met:
3701 + * * Redistributions of source code must retain the above copyright
3702 + * notice, this list of conditions and the following disclaimer.
3703 + * * Redistributions in binary form must reproduce the above copyright
3704 + * notice, this list of conditions and the following disclaimer in the
3705 + * documentation and/or other materials provided with the distribution.
3706 + * * Neither the name of Freescale Semiconductor nor the
3707 + * names of its contributors may be used to endorse or promote products
3708 + * derived from this software without specific prior written permission.
3709 + *
3710 + *
3711 + * ALTERNATIVELY, this software may be distributed under the terms of the
3712 + * GNU General Public License ("GPL") as published by the Free Software
3713 + * Foundation, either version 2 of that License or (at your option) any
3714 + * later version.
3715 + *
3716 + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
3717 + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
3718 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
3719 + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
3720 + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
3721 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
3722 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
3723 + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3724 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3725 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3726 + */
3727 +
3728 +#ifndef DPAA_DEBUGFS_H_
3729 +#define DPAA_DEBUGFS_H_
3730 +
3731 +#include <linux/netdevice.h>
3732 +#include <linux/dcache.h> /* struct dentry needed in dpaa_eth.h */
3733 +
3734 +int dpa_netdev_debugfs_create(struct net_device *net_dev);
3735 +void dpa_netdev_debugfs_remove(struct net_device *net_dev);
3736 +int __init dpa_debugfs_module_init(void);
3737 +void __exit dpa_debugfs_module_exit(void);
3738 +
3739 +#endif /* DPAA_DEBUGFS_H_ */
3740 --- /dev/null
3741 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.c
3742 @@ -0,0 +1,1223 @@
3743 +/* Copyright 2008-2013 Freescale Semiconductor Inc.
3744 + *
3745 + * Redistribution and use in source and binary forms, with or without
3746 + * modification, are permitted provided that the following conditions are met:
3747 + * * Redistributions of source code must retain the above copyright
3748 + * notice, this list of conditions and the following disclaimer.
3749 + * * Redistributions in binary form must reproduce the above copyright
3750 + * notice, this list of conditions and the following disclaimer in the
3751 + * documentation and/or other materials provided with the distribution.
3752 + * * Neither the name of Freescale Semiconductor nor the
3753 + * names of its contributors may be used to endorse or promote products
3754 + * derived from this software without specific prior written permission.
3755 + *
3756 + *
3757 + * ALTERNATIVELY, this software may be distributed under the terms of the
3758 + * GNU General Public License ("GPL") as published by the Free Software
3759 + * Foundation, either version 2 of that License or (at your option) any
3760 + * later version.
3761 + *
3762 + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
3763 + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
3764 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
3765 + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
3766 + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
3767 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
3768 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
3769 + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3770 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3771 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3772 + */
3773 +
3774 +#ifdef CONFIG_FSL_DPAA_ETH_DEBUG
3775 +#define pr_fmt(fmt) \
3776 + KBUILD_MODNAME ": %s:%hu:%s() " fmt, \
3777 + KBUILD_BASENAME".c", __LINE__, __func__
3778 +#else
3779 +#define pr_fmt(fmt) \
3780 + KBUILD_MODNAME ": " fmt
3781 +#endif
3782 +
3783 +#include <linux/init.h>
3784 +#include <linux/module.h>
3785 +#include <linux/of_mdio.h>
3786 +#include <linux/of_net.h>
3787 +#include <linux/kthread.h>
3788 +#include <linux/io.h>
3789 +#include <linux/if_arp.h> /* arp_hdr_len() */
3790 +#include <linux/if_vlan.h> /* VLAN_HLEN */
3791 +#include <linux/icmp.h> /* struct icmphdr */
3792 +#include <linux/ip.h> /* struct iphdr */
3793 +#include <linux/ipv6.h> /* struct ipv6hdr */
3794 +#include <linux/udp.h> /* struct udphdr */
3795 +#include <linux/tcp.h> /* struct tcphdr */
3796 +#include <linux/net.h> /* net_ratelimit() */
3797 +#include <linux/if_ether.h> /* ETH_P_IP and ETH_P_IPV6 */
3798 +#include <linux/highmem.h>
3799 +#include <linux/percpu.h>
3800 +#include <linux/dma-mapping.h>
3801 +#include <linux/fsl_bman.h>
3802 +#ifdef CONFIG_SOC_BUS
3803 +#include <linux/sys_soc.h> /* soc_device_match */
3804 +#endif
3805 +
3806 +#include "fsl_fman.h"
3807 +#include "fm_ext.h"
3808 +#include "fm_port_ext.h"
3809 +
3810 +#include "mac.h"
3811 +#include "dpaa_eth.h"
3812 +#include "dpaa_eth_common.h"
3813 +#ifdef CONFIG_FSL_DPAA_DBG_LOOP
3814 +#include "dpaa_debugfs.h"
3815 +#endif /* CONFIG_FSL_DPAA_DBG_LOOP */
3816 +
3817 +/* CREATE_TRACE_POINTS only needs to be defined once. Other dpa files
3818 + * using trace events only need to #include <trace/events/sched.h>
3819 + */
3820 +#define CREATE_TRACE_POINTS
3821 +#include "dpaa_eth_trace.h"
3822 +
3823 +#define DPA_NAPI_WEIGHT 64
3824 +
3825 +/* Valid checksum indication */
3826 +#define DPA_CSUM_VALID 0xFFFF
3827 +
3828 +#define DPA_DESCRIPTION "FSL DPAA Ethernet driver"
3829 +
3830 +MODULE_LICENSE("Dual BSD/GPL");
3831 +
3832 +MODULE_AUTHOR("Andy Fleming <afleming@freescale.com>");
3833 +
3834 +MODULE_DESCRIPTION(DPA_DESCRIPTION);
3835 +
3836 +static uint8_t debug = -1;
3837 +module_param(debug, byte, S_IRUGO);
3838 +MODULE_PARM_DESC(debug, "Module/Driver verbosity level");
3839 +
3840 +/* This has to work in tandem with the DPA_CS_THRESHOLD_xxx values. */